[telepathy-python/master] Fixed GetCapabilities method that was plain broken

Louis-Francis Ratté-Boulianne louis-francis.ratte-boulianne at collabora.co.uk
Tue Aug 4 11:02:59 PDT 2009


---
 NEWS               |    1 +
 src/server/conn.py |   11 +++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index b8ce260..d1a75e0 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Enhancements:
 Fixes:
 
  * #23081: Fixing TargetID handle search (Thiago Borges Abdnur)
+ * Fix GetCapabilities method that was broken and didn't return anything
 
 telepathy-python 0.15.10 (2009-07-30)
 =====================================
diff --git a/src/server/conn.py b/src/server/conn.py
index b300d66..0ef2206 100644
--- a/src/server/conn.py
+++ b/src/server/conn.py
@@ -26,6 +26,7 @@ import weakref
 from telepathy.constants import (CONNECTION_STATUS_DISCONNECTED,
                                  CONNECTION_STATUS_CONNECTED,
                                  HANDLE_TYPE_NONE,
+                                 HANDLE_TYPE_CONTACT,
                                  LAST_HANDLE_TYPE)
 from telepathy.errors import (Disconnected, InvalidArgument,
                               InvalidHandle, NotAvailable,
@@ -335,13 +336,15 @@ class ConnectionInterfaceCapabilities(_ConnectionInterfaceCapabilities):
     @dbus.service.method(CONN_INTERFACE_CAPABILITIES, in_signature='au', out_signature='a(usuu)')
     def GetCapabilities(self, handles):
         ret = []
+        handle_type = HANDLE_TYPE_CONTACT
         for handle in handles:
-            if (handle != 0 and handle not in self._handles):
+            if (handle != 0 and (handle_type, handle) not in self._handles):
                 raise InvalidHandle
             elif handle in self._caps:
-                theirs = self._caps[handle]
-                for type in theirs:
-                    ret.append([handle, type, theirs[0], theirs[1]])
+                types = self._caps[handle]
+                for ctype, specs in types.items():
+                    ret.append([handle, ctype, specs[0], specs[1]])
+        return ret
 
     @dbus.service.signal(CONN_INTERFACE_CAPABILITIES, signature='a(usuuuu)')
     def CapabilitiesChanged(self, caps):
-- 
1.5.6.5



More information about the telepathy-commits mailing list