diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2007-03-07 14:27:47 (GMT) |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2007-03-07 14:27:47 (GMT) |
commit | 139b190650331fece7c57a99f14ed09c8b1f720a (patch) | |
tree | bdec44f7ec58acd527d4483c58faa39c6e8a86c3 | |
parent | 375f61c9eecaed64a5113aacab50ed4225bb2515 (diff) |
catch invitations request
-rw-r--r-- | services/presence2/presenceservice.py | 7 | ||||
-rw-r--r-- | services/presence2/server_plugin.py | 19 |
2 files changed, 25 insertions, 1 deletions
diff --git a/services/presence2/presenceservice.py b/services/presence2/presenceservice.py index 61462ba..86126ca 100644 --- a/services/presence2/presenceservice.py +++ b/services/presence2/presenceservice.py @@ -67,6 +67,7 @@ class PresenceService(dbus.service.Object): self._server_plugin.connect('avatar-updated', self._avatar_updated) self._server_plugin.connect('properties-changed', self._properties_changed) self._server_plugin.connect('contact-activities-changed', self._contact_activities_changed) + self._server_plugin.connect('activity-invited', self._activity_invited) self._server_plugin.start() # Set up the link local connection @@ -198,6 +199,12 @@ class PresenceService(dbus.service.Object): if len(activities) > 0: buddy.set_properties({'current-activity':activities[0]}) + def _activity_invited(self, tp, act_id): + activity = self._activities.get(act_id) + if activity: + pass + # FIXME do something + @dbus.service.signal(_PRESENCE_INTERFACE, signature="o") def ActivityAppeared(self, activity): pass diff --git a/services/presence2/server_plugin.py b/services/presence2/server_plugin.py index 7d8ffc2..a195b4e 100644 --- a/services/presence2/server_plugin.py +++ b/services/presence2/server_plugin.py @@ -83,7 +83,9 @@ class ServerPlugin(gobject.GObject): 'properties-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])), 'contact-activities-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - ([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])) + ([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])), + 'activity-invited': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + ([gobject.TYPE_PYOBJECT])) } def __init__(self, registry): @@ -154,6 +156,7 @@ class ServerPlugin(gobject.GObject): del acct conn[CONN_INTERFACE].connect_to_signal('StatusChanged', self._status_changed_cb) + conn[CONN_INTERFACE].connect_to_signal('NewChannel', self._new_channel_cb) # hack conn._valid_interfaces.add(CONN_INTERFACE_PRESENCE) @@ -417,3 +420,17 @@ class ServerPlugin(gobject.GObject): self._activities[act_id] = act_handle activities_id = map(lambda x: x[0], activities) self.emit("contact-activities-changed", contact, activities_id) + + def _new_channel_cb(self, object_path, channel_type, handle_type, handle, suppress_handler): + if handle_type == CONNECTION_HANDLE_TYPE_ROOM: + channel = Channel(self._conn._dbus_object._named_service, object_path) + + # hack + channel._valid_interfaces.add(CHANNEL_INTERFACE_GROUP) + + current, local_pending, remote_pending = channel[CHANNEL_INTERFACE_GROUP].GetAllMembers() + + if local_pending: + for act_id, act_handle in self._activities.items(): + if handle == act_handle: + self.emit("activity-invited", act_id) |