コード例 #1
0
ファイル: friends.py プロジェクト: AbrahmAB/sugar
    def __init__(self, nick, key, account=None, contact_id=None):
        self._online_buddy = None

        BuddyModel.__init__(self, nick=nick, key=key, account=account,
                            contact_id=contact_id)

        neighborhood_model = neighborhood.get_model()
        neighborhood_model.connect('buddy-added', self.__buddy_added_cb)
        neighborhood_model.connect('buddy-removed', self.__buddy_removed_cb)

        buddy = neighborhood_model.get_buddy_by_key(key)
        if buddy is not None:
            self._set_online_buddy(buddy)
コード例 #2
0
    def __init__(self, nick, key, account=None, contact_id=None):
        self._online_buddy = None

        BuddyModel.__init__(self, nick=nick, key=key, account=account,
                            contact_id=contact_id)

        neighborhood_model = neighborhood.get_model()
        neighborhood_model.connect('buddy-added', self.__buddy_added_cb)
        neighborhood_model.connect('buddy-removed', self.__buddy_removed_cb)

        buddy = neighborhood_model.get_buddy_by_key(key)
        if buddy is not None:
            self._set_online_buddy(buddy)
コード例 #3
0
    def __buddy_added_cb(self, account, contact_id, nick, handle):
        logging.debug('__buddy_added_cb %r', contact_id)

        if contact_id in self._buddies:
            logging.debug('__buddy_added_cb buddy already tracked')
            return

        buddy = BuddyModel(nick=nick,
                           account=account.object_path,
                           contact_id=contact_id,
                           handle=handle)
        self._buddies[contact_id] = buddy