From 33d82119e994ec8ab8282238038adccc5a306baa Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Thu, 08 Jul 2010 14:56:04 +0000 Subject: Change Activity.Invite API to receive account_id and contact_id instead of the buddy key --- (limited to 'src') diff --git a/src/jarabe/model/buddy.py b/src/jarabe/model/buddy.py index 4ca6fb6..d52bb51 100644 --- a/src/jarabe/model/buddy.py +++ b/src/jarabe/model/buddy.py @@ -151,6 +151,10 @@ class OwnerBuddyModel(BaseBuddyModel): class BuddyModel(BaseBuddyModel): __gtype_name__ = 'SugarBuddyModel' def __init__(self, **kwargs): + + self._account = None + self._contact_id = None + BaseBuddyModel.__init__(self, **kwargs) def is_owner(self): @@ -162,6 +166,24 @@ class BuddyModel(BaseBuddyModel): def get_buddy(self): raise NotImplementedError + def get_account(self): + return self._account + + def set_account(self, account): + self._account = account + + account = gobject.property(type=object, getter=get_account, + setter=set_account) + + def get_contact_id(self): + return self._contact_id + + def set_contact_id(self, contact_id): + self._contact_id = contact_id + + contact_id = gobject.property(type=object, getter=get_contact_id, + setter=set_contact_id) + """ self._pservice = presenceservice.get_instance() diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py index 1e2fb9e..8031fdd 100644 --- a/src/jarabe/model/neighborhood.py +++ b/src/jarabe/model/neighborhood.py @@ -113,6 +113,8 @@ class _Account(gobject.GObject): def __init__(self, account_path): gobject.GObject.__init__(self) + self.object_path = account_path + self._connection = None self._buddy_handles = {} self._activity_handles = {} @@ -449,13 +451,16 @@ class Neighborhood(gobject.GObject): logging.debug('__buddy_added_cb %r', properties) contact_id = properties[CONNECTION + '/contact-id'] + assert contact_id is not None if contact_id in self._buddies: logging.debug('__buddy_added_cb buddy already tracked') return buddy = BuddyModel( - nick=properties[CONNECTION_INTERFACE_ALIASING + '/alias']) + nick=properties[CONNECTION_INTERFACE_ALIASING + '/alias'], + account=account.object_path, + contact_id=contact_id) self._buddies[contact_id] = buddy self.emit('buddy-added', buddy) diff --git a/src/jarabe/view/buddymenu.py b/src/jarabe/view/buddymenu.py index 1cbf10a..6c67d36 100644 --- a/src/jarabe/view/buddymenu.py +++ b/src/jarabe/view/buddymenu.py @@ -150,6 +150,7 @@ class BuddyMenu(Palette): activity = shell.get_model().get_active_activity() service = activity.get_service() if service: - service.Invite(self._buddy.props.key) + service.Invite(self._buddy.props.account, + self._buddy.props.contact_id) else: logging.error('Invite failed, activity service not ') -- cgit v0.9.1