[sugar] [PATCH] services/presence: buddy: add mapping to/from Telepathy handles

Simon McVittie simon.mcvittie
Mon May 21 07:20:07 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

- ---
 services/presence/buddy.py |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/services/presence/buddy.py b/services/presence/buddy.py
index 53999e8..ab397ef 100644
- --- a/services/presence/buddy.py
+++ b/services/presence/buddy.py
@@ -236,6 +236,28 @@ class Buddy(ExportedGObject):
             full set of properties, just the changes.
         """
 
+    @dbus.service.signal(_BUDDY_INTERFACE, signature='sou')
+    def TelepathyHandleAdded(self, tp_conn_name, tp_conn_path, handle):
+        """Another Telepathy handle has become associated with the buddy.
+
+        This must only be emitted for non-channel-specific handles.
+
+        tp_conn_name -- The bus name at which the Telepathy connection may be
+            found
+        tp_conn_path -- The object path at which the Telepathy connection may
+            be found
+        handle -- The handle of type CONTACT, which is not channel-specific,
+            newly associated with the buddy
+        """
+
+    @dbus.service.signal(_BUDDY_INTERFACE, signature='sou')
+    def TelepathyHandleRemoved(self, tp_conn_name, tp_conn_path, handle):
+        """A Telepathy handle has ceased to be associated with the buddy,
+        probably because that contact went offline.
+
+        The parameters are the same as for TelepathyHandleAdded.
+        """
+
     # dbus methods
     @dbus.service.method(_BUDDY_INTERFACE,
                         in_signature="", out_signature="ay")
@@ -294,6 +316,22 @@ class Buddy(ExportedGObject):
             props[_PROP_CURACT] = ""
         return props
 
+    @dbus.service.method(_BUDDY_INTERFACE,
+                         in_signature='', out_signature='a(sou)')
+    def GetTelepathyHandles(self):
+        """Return a list of non-channel-specific Telepathy contact handles
+        associated with this Buddy.
+
+        :Returns:
+            An array of triples (connection well-known bus name, connection
+            object path, handle).
+        """
+        ret = []
+        for plugin in self.handles:
+            conn = plugin.get_connection()
+            ret.append((str(conn.service_name), conn.object_path,
+                        self.handles[plugin]))
+
     # methods
     def object_path(self):
         """Retrieve our dbus.ObjectPath object"""
- -- 
1.5.2-rc3.GIT

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net

iD8DBQFGUYBnWSc8zVUw7HYRAjzLAJ9tGJwOybMRFgPxzRPHf/bxMxgvgACfRZai
mrDbiRdLbT5/Sst0u1ruqPw=
=sLDo
-----END PGP SIGNATURE-----



More information about the Sugar-devel mailing list