home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.6)
-
- import hooks
- _did_register_hooks = False
- from logging import getLogger
- log = getLogger('twitter')
- debug = log.debug
-
- def _register_hooks():
- global _did_register_hooks
- if _did_register_hooks:
- return None
- _did_register_hooks = True
- if False:
- hooks.register('digsby.notifications.get_topics', _on_get_topics)
- hooks.register('digsby.notifications.changed', _on_nots_changed)
-
-
-
- def active_twitter_protocols():
- profile = profile
- import common
- TwitterAccount = TwitterAccount
- import twitter
- for acct in profile.account_manager.socialaccounts:
- if isinstance(acct, TwitterAccount):
- if acct.enabled:
- conn = getattr(acct, 'connection', None)
- if conn is not None:
- yield conn
-
-
- acct.enabled
-
-
-
- def _on_nots_changed():
- for conn in active_twitter_protocols():
- _notifications_changed(conn)
-
-
-
- def _on_get_topics(nots):
- for conn in active_twitter_protocols():
- _get_notification_info(conn, nots)
-
-
-
- def _get_notification_info(self, info):
- return None
- profile = profile
- import common
- nots = profile.notifications.setdefault(None, { })
- prefix = self.account_prefix
- template = dict(header = '${tweet.user.screen_name}', minor = '${tweet.text.decode("xml")}', pages = 'tweets', update = 'paged', icon = 'skin:serviceicons.twitter')
-
- def templ(desc):
- t = template.copy()
- t['description'] = desc
- return t
-
- for key in nots.keys():
- if key.startswith(prefix):
- feed_name = key[len(prefix) + 1:]
- if feed_name in self.feeds_by_name:
- feed = self.feeds_by_name[feed_name]
- if feed['type'] == 'search':
- info[key] = templ(_('Twitter - ') + feed['label'] + ' (%s)' % self.username)
- elif feed['type'] == 'group':
- info[key] = templ(_('Twitter - Group: ') + feed['label'] + ' (%s)' % self.username)
-
-
- feed_name in self.feeds_by_name
-
-
-
- def _update_notifications(self, feeds):
- return None
-
- def feed_notification_name(feed):
- return '.'.join([
- self.account_prefix,
- feed['name']])
-
- profile = profile
- import common
- nots = profile.notifications.setdefault(None, { })
- popup_reaction = {
- 'reaction': 'Popup' }
- for feed in feeds:
- notify_name = feed_notification_name(feed)
- popup = feed.get('popups', sentinel)
- if popup and popup is not sentinel:
- if notify_name not in nots:
- nots[notify_name] = [
- popup_reaction]
- debug('adding popup for %r to notifications', notify_name)
- elif popup_reaction not in nots[notify_name]:
- nots[notify_name].append(popup_reaction)
- debug('adding popup for %r to notifications', notify_name)
-
- notify_name not in nots
- if notify_name in nots and popup == False:
- if popup_reaction in nots[notify_name]:
- nots[notify_name].remove(popup_reaction)
- debug('removing popup for %r', notify_name)
-
- popup_reaction in nots[notify_name]
-
- for key in nots.keys():
- if key.startswith(self.account_prefix):
- fname = key[len(self.account_prefix) + 1:]
- if fname not in self.feeds_by_name:
- debug('feed name %r not found in feeds, removing', fname)
- nots.pop(key)
-
- fname not in self.feeds_by_name
-
-
-
- def _notifications_changed(self):
- return None
- profile = profile
- import common
- popup_reaction = {
- 'reaction': 'Popup' }
- nots = profile.notifications.setdefault(None, { })
- for key in nots.keys():
- if key.startswith(self.account_prefix):
- fname = key[len(self.account_prefix) + 1:]
- if fname in self.feeds_by_name:
- feed = self.feeds_by_name[fname]
- in_not = popup_reaction in nots[key]
- if feed.get('popups', sentinel) != in_not:
- feed['popups'] = in_not
- self.webkitcontroller.edit_feed(feed)
-
-
- fname in self.feeds_by_name
-
-
-