diff options
author | Dan Williams <dcbw@redhat.com> | 2007-03-07 19:22:16 (GMT) |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2007-03-07 19:22:16 (GMT) |
commit | 4c05c4247cd808b02793386a260eccd99d92b47f (patch) | |
tree | b62e98735a525f7a06ce0c76c65ecb3c9d03fdb1 /services | |
parent | 9fa72e4cba586a457266ac071176d5eaa1ee814b (diff) | |
parent | abf60c1c89142e27790c5baac8447cf8d6d97761 (diff) |
Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
Diffstat (limited to 'services')
-rw-r--r-- | services/presence2/activity.py | 9 | ||||
-rw-r--r-- | services/presence2/presenceservice.py | 20 | ||||
-rw-r--r-- | services/presence2/server_plugin.py | 14 |
3 files changed, 35 insertions, 8 deletions
diff --git a/services/presence2/activity.py b/services/presence2/activity.py index f528be0..3a4216c 100644 --- a/services/presence2/activity.py +++ b/services/presence2/activity.py @@ -27,6 +27,7 @@ class Activity(dbus.service.Object): self._buddies = [] self._color = None self._valid = False + self._name = None self._activity_id = activity_id self._object_id = object_id @@ -85,6 +86,11 @@ class Activity(dbus.service.Object): def GetChannels(self): return self.get_channels() + @dbus.service.method(_ACTIVITY_INTERFACE, + in_signature="", out_signature="s") + def GetName(self): + return self.get_name() + # methods def object_path(self): return dbus.ObjectPath(self._object_path) @@ -102,6 +108,9 @@ class Activity(dbus.service.Object): def get_joined_buddies(self): return self._buddies + def get_name(self): + return self._name + def buddy_joined(self, buddy): if buddy not in self._buddies: self._buddies.append(buddy) diff --git a/services/presence2/presenceservice.py b/services/presence2/presenceservice.py index 86126ca..afccbbd 100644 --- a/services/presence2/presenceservice.py +++ b/services/presence2/presenceservice.py @@ -67,7 +67,8 @@ 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.connect('activity-invitation', self._activity_invitation) + self._server_plugin.connect('private-invitation', self._private_invitation) self._server_plugin.start() # Set up the link local connection @@ -199,11 +200,14 @@ class PresenceService(dbus.service.Object): if len(activities) > 0: buddy.set_properties({'current-activity':activities[0]}) - def _activity_invited(self, tp, act_id): + def _activity_invitation(self, tp, act_id): activity = self._activities.get(act_id) if activity: - pass - # FIXME do something + self.ActivityInvitation(activity.object_path()) + + def _private_invitation(self, tp, chan_path): + conn = tp.get_connection() + self.PrivateInvitation(str(conn.service_name), conn.object_path, chan_path) @dbus.service.signal(_PRESENCE_INTERFACE, signature="o") def ActivityAppeared(self, activity): @@ -221,6 +225,14 @@ class PresenceService(dbus.service.Object): def BuddyDisappeared(self, buddy): pass + @dbus.service.signal(_PRESENCE_INTERFACE, signature="o") + def ActivityInvitation(self, activity): + pass + + @dbus.service.signal(_PRESENCE_INTERFACE, signature="soo") + def PrivateInvitation(self, bus_name, connection, channel): + pass + @dbus.service.method(_PRESENCE_INTERFACE, out_signature="ao") def GetActivities(self): ret = [] diff --git a/services/presence2/server_plugin.py b/services/presence2/server_plugin.py index bf5d8f3..5ce46b0 100644 --- a/services/presence2/server_plugin.py +++ b/services/presence2/server_plugin.py @@ -29,7 +29,7 @@ import hashlib from telepathy.client import ConnectionManager, ManagerRegistry, Connection, Channel from telepathy.interfaces import ( CONN_MGR_INTERFACE, CONN_INTERFACE, CHANNEL_TYPE_CONTACT_LIST, CHANNEL_INTERFACE_GROUP, CONN_INTERFACE_ALIASING, - CONN_INTERFACE_AVATARS, CONN_INTERFACE_PRESENCE, CHANNEL_TYPE_TEXT) + CONN_INTERFACE_AVATARS, CONN_INTERFACE_PRESENCE, CHANNEL_TYPE_TEXT, CHANNEL_TYPE_STREAMED_MEDIA) from telepathy.constants import ( CONNECTION_HANDLE_TYPE_NONE, CONNECTION_HANDLE_TYPE_CONTACT, CONNECTION_STATUS_CONNECTED, CONNECTION_STATUS_DISCONNECTED, CONNECTION_STATUS_CONNECTING, @@ -84,7 +84,9 @@ class ServerPlugin(gobject.GObject): ([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])), 'contact-activities-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])), - 'activity-invited': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + 'activity-invitation': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + ([gobject.TYPE_PYOBJECT])), + 'private-invitation': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT])) } @@ -419,7 +421,7 @@ class ServerPlugin(gobject.GObject): 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: + if handle_type == CONNECTION_HANDLE_TYPE_ROOM and channel_type == CHANNEL_TYPE_TEXT: channel = Channel(self._conn._dbus_object._named_service, object_path) # hack @@ -430,4 +432,8 @@ class ServerPlugin(gobject.GObject): if local_pending: for act_id, act_handle in self._activities.items(): if handle == act_handle: - self.emit("activity-invited", act_id) + self.emit("activity-invitation", act_id) + + elif handle_type == CONNECTION_HANDLE_TYPE_CONTACT and \ + channel_type in [CHANNEL_TYPE_TEXT, CHANNEL_TYPE_STREAMED_MEDIA]: + self.emit("private-invitation", object_path) |