From 7493d2c174e3fa658c7825e58069597431b686ec Mon Sep 17 00:00:00 2001 From: Morgan Collett Date: Thu, 11 Oct 2007 10:56:35 +0000 Subject: Emit BuddyHandleJoined when BuddyJoined emitted so sugar.presence will be able to track handles without calling PS --- diff --git a/src/activity.py b/src/activity.py index c0f195d..a51ab33 100644 --- a/src/activity.py +++ b/src/activity.py @@ -319,6 +319,9 @@ class Activity(ExportedGObject): # Pretend everyone joined for buddy in self._buddies: self.BuddyJoined(buddy.object_path()) + handle = buddy.get_identifier_by_plugin(self._tp) + assert handle is not None + self.BuddyHandleJoined(buddy.object_path(), handle[0]) else: # Pretend everyone left for buddy in self._buddies: @@ -338,6 +341,17 @@ class Activity(ExportedGObject): _logger.debug('BuddyJoined: %s', buddy_path) @dbus.service.signal(_ACTIVITY_INTERFACE, + signature="ou") + def BuddyHandleJoined(self, buddy_path, handle): + """Generates DBUS signal when a buddy joins this activity. + + buddy_path -- DBUS path to buddy object + handle -- buddy handle in this activity + """ + _logger.debug('BuddyHandleJoined: %s (handle %u)' % + (buddy_path, handle)) + + @dbus.service.signal(_ACTIVITY_INTERFACE, signature="o") def BuddyLeft(self, buddy_path): """Generates DBUS signal when a buddy leaves this activity. @@ -347,6 +361,17 @@ class Activity(ExportedGObject): _logger.debug('BuddyLeft: %s', buddy_path) @dbus.service.signal(_ACTIVITY_INTERFACE, + signature="ou") + def BuddyHandleLeft(self, buddy_path, handle): + """Generates DBUS signal when a buddy leaves this activity. + + buddy_path -- DBUS path to buddy object + handle -- buddy handle in this activity + """ + _logger.debug('BuddyHandleLeft: %s (handle %u)' % + (buddy_path, handle)) + + @dbus.service.signal(_ACTIVITY_INTERFACE, signature="a{sv}") def PropertiesChanged(self, properties): """Emits D-Bus signal when properties of this activity change. @@ -680,6 +705,9 @@ class Activity(ExportedGObject): buddy.add_activity(self) if self._valid: self.BuddyJoined(buddy.object_path()) + handle = buddy.get_identifier_by_plugin(self._tp) + assert handle is not None + self.BuddyHandleJoined(buddy.object_path(), handle[0]) else: _logger.debug('Suppressing BuddyJoined: activity not "valid"') -- cgit v0.9.1