diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-06-22 22:07:54 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-06-22 22:07:54 (GMT) |
commit | 59f25b07418e5f1143d9ddf94b5497ca9436f8d9 (patch) | |
tree | 701fe4b08c2945cc0b62ecce3f85ad74b4cf9df5 /sugar/presence | |
parent | c234b7b4a396ce523692d5516c3cc4fb159d9d0c (diff) |
Get one-to-one chat to actually work...
Diffstat (limited to 'sugar/presence')
-rw-r--r-- | sugar/presence/Buddy.py | 4 | ||||
-rw-r--r-- | sugar/presence/Service.py | 19 |
2 files changed, 16 insertions, 7 deletions
diff --git a/sugar/presence/Buddy.py b/sugar/presence/Buddy.py index 6bbd787..c4dd0a5 100644 --- a/sugar/presence/Buddy.py +++ b/sugar/presence/Buddy.py @@ -142,8 +142,8 @@ class Buddy(gobject.GObject): for service in self._services.values(): if service.get_type() == stype and service.get_activity_id() == actid: return service - if self._services.has_key(short_stype): - return self._services[short_stype] + if self._services.has_key(stype): + return self._services[stype] return None def is_valid(self): diff --git a/sugar/presence/Service.py b/sugar/presence/Service.py index 56246bb..c82d019 100644 --- a/sugar/presence/Service.py +++ b/sugar/presence/Service.py @@ -69,9 +69,6 @@ def deserialize(sdict): stype = sdict['stype'] if type(stype) == type(u""): stype = stype.encode() - activity_id = sdict['activity_id'] - if type(activity_id) == type(u""): - activity_id = activity_id.encode() domain = sdict['domain'] if type(domain) == type(u""): domain = domain.encode() @@ -87,7 +84,18 @@ def deserialize(sdict): address = address.encode() except KeyError: pass - name = compose_service_name(name, activity_id) + + activity_id = None + try: + activity_id = sdict['activity_id'] + if type(activity_id) == type(u""): + activity_id = activity_id.encode() + except KeyError: + pass + + if activity_id is not None: + name = compose_service_name(name, activity_id) + return Service(name, stype, domain, address=address, port=port, properties=properties) @@ -152,7 +160,8 @@ class Service(object): else: sdict['name'] = dbus.Variant(self._name) sdict['stype'] = dbus.Variant(self._stype) - sdict['activity_id'] = dbus.Variant(self._activity_id) + if self._activity_id: + sdict['activity_id'] = dbus.Variant(self._activity_id) sdict['domain'] = dbus.Variant(self._domain) if self._address: sdict['address'] = dbus.Variant(self._address) |