Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-03-16 16:19:24 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-03-16 16:19:24 (GMT)
commit5955f17197496e38e5cffdde42071bcb832b101f (patch)
tree65c4368a1d362af99e58eb9630e35ee93b33e943 /services
parent831c4c6828a94b48e28493839c7d2a23eb560515 (diff)
Hook up current activity bits
Diffstat (limited to 'services')
-rw-r--r--services/presence2/server_plugin.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/services/presence2/server_plugin.py b/services/presence2/server_plugin.py
index e335194..6e309a8 100644
--- a/services/presence2/server_plugin.py
+++ b/services/presence2/server_plugin.py
@@ -238,6 +238,7 @@ class ServerPlugin(gobject.GObject):
self._conn[CONN_INTERFACE_BUDDY_INFO].connect_to_signal('PropertiesChanged', self._buddy_properties_changed_cb)
self._conn[CONN_INTERFACE_BUDDY_INFO].connect_to_signal('ActivitiesChanged', self._buddy_activities_changed_cb)
+ self._conn[CONN_INTERFACE_BUDDY_INFO].connect_to_signal('CurrentActivityChanged', self._buddy_current_activity_changed_cb)
self._conn[CONN_INTERFACE_AVATARS].connect_to_signal('AvatarUpdated', self._avatar_updated_cb)
@@ -316,8 +317,25 @@ class ServerPlugin(gobject.GObject):
self._conn[CONN_INTERFACE_BUDDY_INFO].SetActivities(self._joined_activities)
+ cur_activity = self._owner.props.current_activity
+ cur_activity_handle = 0
+ if not cur_activity:
+ cur_activity = ""
+ else:
+ cur_activity_handle = self._get_handle_for_activity(cur_activity)
+ if not cur_activity_handle:
+ # dont advertise a current activity that's not shared
+ cur_activity = ""
+ self._conn[CONN_INTERFACE_BUDDY_INFO].SetCurrentActivity(cur_activity, cur_activity_handle)
+
self._upload_avatar()
+ def _get_handle_for_activity(self, activity_id):
+ for (act, handle) in self._joined_activities:
+ if activity_id == act:
+ return handle
+ return None
+
def _status_changed_cb(self, state, reason):
if state == CONNECTION_STATUS_CONNECTING:
print 'connecting: %r' % reason
@@ -455,6 +473,18 @@ class ServerPlugin(gobject.GObject):
activities_id = map(lambda x: x[0], activities)
self.emit("buddy-activities-changed", handle, activities_id)
+ def _buddy_current_activity_changed_cb(self, handle, activity, channel):
+ if handle == self._conn[CONN_INTERFACE].GetSelfHandle():
+ # ignore network events for Owner current activity changes since those
+ # are handled locally
+ return
+
+ if not len(activity) or not util.validate_activity_id(activity):
+ activity = None
+ prop = {'current-activity': activity}
+ logging.debug("Handle %s: current activity now %s" % (handle, activity))
+ self._buddy_properties_changed_cb(handle, prop)
+
def _new_channel_cb(self, object_path, channel_type, handle_type, handle, suppress_handler):
if handle_type == CONNECTION_HANDLE_TYPE_ROOM and channel_type == CHANNEL_TYPE_TEXT:
channel = Channel(self._conn._dbus_object._named_service, object_path)