Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/presenceservice.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/presenceservice.py')
-rw-r--r--src/presenceservice.py32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/presenceservice.py b/src/presenceservice.py
index 22e76c3..c8f4cb2 100644
--- a/src/presenceservice.py
+++ b/src/presenceservice.py
@@ -26,7 +26,7 @@ from dbus.gobject_service import ExportedGObject
from dbus.mainloop.glib import DBusGMainLoop
from telepathy.client import ManagerRegistry, Connection
from telepathy.interfaces import (CONN_MGR_INTERFACE, CONN_INTERFACE,
- CONN_INTERFACE_AVATARS)
+ CONN_INTERFACE_AVATARS, CONN_INTERFACE_ALIASING)
from telepathy.constants import (CONNECTION_STATUS_CONNECTING,
CONNECTION_STATUS_CONNECTED,
CONNECTION_STATUS_DISCONNECTED)
@@ -113,8 +113,6 @@ class PresenceService(ExportedGObject):
self._server_plugin.connect('status', self._server_status_cb)
self._server_plugin.connect('contact-online', self._contact_online)
self._server_plugin.connect('contact-offline', self._contact_offline)
- self._server_plugin.connect('buddy-properties-changed',
- self._buddy_properties_changed)
self._server_plugin.connect('activity-invitation',
self._activity_invitation)
self._server_plugin.connect('private-invitation',
@@ -178,12 +176,40 @@ class PresenceService(ExportedGObject):
'ActivitiesChanged', buddy_activities_changed)
self._conn_matches[conn].append(m)
+ if CONN_INTERFACE_BUDDY_INFO in conn:
+ def buddy_properties_changed(contact, properties):
+ self._buddy_properties_changed(tp, contact, properties)
+ m = conn[CONN_INTERFACE_BUDDY_INFO].connect_to_signal(
+ 'PropertiesChanged', buddy_properties_changed)
+ self._conn_matches[conn].append(m)
+
+ def buddy_curact_changed(contact, act_id, room):
+ if (act_id == '' or not util.validate_activity_id(act_id) or
+ room == 0):
+ act_id = ''
+ room = 0
+ self._buddy_properties_changed(tp, contact,
+ {'current-activity': act_id})
+ # FIXME: do something useful with the room handle?
+ m = conn[CONN_INTERFACE_BUDDY_INFO].connect_to_signal(
+ 'CurrentActivityChanged', buddy_curact_changed)
+ self._conn_matches[conn].append(m)
+
def avatar_updated(contact, avatar_token):
self._avatar_updated(tp, contact, avatar_token)
m = conn[CONN_INTERFACE_AVATARS].connect_to_signal('AvatarUpdated',
avatar_updated)
self._conn_matches[conn].append(m)
+ if CONN_INTERFACE_ALIASING in conn:
+ def aliases_changed(aliases):
+ for contact, alias in aliases:
+ self._buddy_properties_changed(tp, contact,
+ {'nick': alias})
+ m = conn[CONN_INTERFACE_ALIASING].connect_to_signal(
+ 'AliasesChanged', aliases_changed)
+ self._conn_matches[conn].append(m)
+
def _tp_disconnected(self, tp):
if tp.self_handle is not None:
self._handles_buddies.setdefault(tp, {}).pop(