Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2011-03-24 20:46:28 (GMT)
committer Simon Schampijer <simon@schampijer.de>2011-03-31 16:01:30 (GMT)
commit9c4c22249a4773551fa7dc8f5c1a6f3b1e45cc14 (patch)
tree0e5aa7aec5ca3e05106a6f82386bc068b4d1e4f3
parentaa889e81c7e8bd9a9df5c7fc27432a7335d2d905 (diff)
Fix inviting from friends view OLPC #10767
Add the contact_id and the account information to the buddymodel used in the group view. We do not store it in the friends model as the contact_id and the account information may vary. When we read the friends information from disk the contact_id and account information gets added to the model whenever we have it. Signed-off-by: Simon Schampijer <simon@laptop.org> Acked-By: Sascha Silbe <silbe@activitycentral.com>
-rw-r--r--src/jarabe/model/friends.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/jarabe/model/friends.py b/src/jarabe/model/friends.py
index f78d785..7f50c1e 100644
--- a/src/jarabe/model/friends.py
+++ b/src/jarabe/model/friends.py
@@ -36,10 +36,11 @@ class FriendBuddyModel(BuddyModel):
_NOT_PRESENT_COLOR = '#D5D5D5,#FFFFFF'
- def __init__(self, nick, key):
+ def __init__(self, nick, key, account=None, contact_id=None):
self._online_buddy = None
- BuddyModel.__init__(self, nick=nick, key=key)
+ 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)
@@ -60,6 +61,11 @@ class FriendBuddyModel(BuddyModel):
self.notify('color')
self.notify('present')
+ if buddy.contact_id != self.contact_id:
+ self.contact_id = buddy.contact_id
+ if buddy.account != self.account:
+ self.account = buddy.account
+
def __buddy_removed_cb(self, model_, buddy):
if buddy.key != self.key:
return
@@ -117,7 +123,9 @@ class Friends(gobject.GObject):
def make_friend(self, buddy):
if not self.has_buddy(buddy):
- buddy = FriendBuddyModel(key=buddy.key, nick=buddy.nick)
+ buddy = FriendBuddyModel(key=buddy.key, nick=buddy.nick,
+ account=buddy.account,
+ contact_id=buddy.contact_id)
self.add_friend(buddy)
self.save()