summaryrefslogtreecommitdiff
path: root/sunshine/contacts.py
diff options
context:
space:
mode:
authorKrzysztof Klinikowski <kkszysiu@gmail.com>2010-04-08 22:24:41 +0200
committerKrzysztof Klinikowski <kkszysiu@gmail.com>2010-04-08 22:24:41 +0200
commitf5540a41be97210d194263d0bf21170524469c69 (patch)
treed18e7231b32ad9b8cad55672071d1a1f32395d2e /sunshine/contacts.py
parent87798cb06a277d4719d0039f50e3e3dffa56f8c3 (diff)
Capabilities and contacts changes.
Diffstat (limited to 'sunshine/contacts.py')
-rw-r--r--sunshine/contacts.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/sunshine/contacts.py b/sunshine/contacts.py
index 6dd3d0a..4d4dadb 100644
--- a/sunshine/contacts.py
+++ b/sunshine/contacts.py
@@ -36,7 +36,8 @@ class SunshineContacts(telepathy.server.ConnectionInterfaceContacts):
telepathy.CONNECTION_INTERFACE_SIMPLE_PRESENCE : 'presence',
telepathy.CONNECTION_INTERFACE_ALIASING : 'alias',
telepathy.CONNECTION_INTERFACE_AVATARS : 'token',
- telepathy.CONNECTION_INTERFACE_CAPABILITIES : 'caps'
+ telepathy.CONNECTION_INTERFACE_CAPABILITIES : 'caps',
+ telepathy.CONNECTION_INTERFACE_CONTACT_CAPABILITIES : 'capabilities'
}
def __init__(self):
@@ -52,10 +53,12 @@ class SunshineContacts(telepathy.server.ConnectionInterfaceContacts):
out_signature='a{ua{sv}}', sender_keyword='sender')
def GetContactAttributes(self, handles, interfaces, hold, sender):
#InspectHandle already checks we're connected, the handles and handle type.
+ supported_interfaces = set()
for interface in interfaces:
- if interface not in self.attributes:
- raise telepathy.errors.InvalidArgument(
- 'Interface %s is not supported by GetContactAttributes' % (interface))
+ if interface in self.attributes:
+ supported_interfaces.add(interface)
+ else:
+ logger.debug("Ignoring unsupported interface %s" % interface)
handle_type = telepathy.HANDLE_TYPE_CONTACT
ret = {}
@@ -65,14 +68,16 @@ class SunshineContacts(telepathy.server.ConnectionInterfaceContacts):
functions = {
telepathy.CONNECTION :
lambda x: zip(x, self.InspectHandles(handle_type, x)),
- telepathy.CONNECTION_INTERFACE_SIMPLE_PRESENCE :
+ telepathy.CONNECTION_INTERFACE_SIMPLE_PRESENCE:
lambda x: self.GetPresences(x).items(),
- telepathy.CONNECTION_INTERFACE_ALIASING :
+ telepathy.CONNECTION_INTERFACE_ALIASING:
lambda x: self.GetAliases(x).items(),
- telepathy.CONNECTION_INTERFACE_AVATARS :
+ telepathy.CONNECTION_INTERFACE_AVATARS:
lambda x: self.GetKnownAvatarTokens(x).items(),
- telepathy.CONNECTION_INTERFACE_CAPABILITIES :
- lambda x: self.GetCapabilities(x).items()
+ telepathy.CONNECTION_INTERFACE_CAPABILITIES:
+ lambda x: self.GetCapabilities(x).items(),
+ telepathy.CONNECTION_INTERFACE_CONTACT_CAPABILITIES:
+ lambda x: self.GetContactCapabilities(x).items()
}
#Hold handles if needed
@@ -81,8 +86,9 @@ class SunshineContacts(telepathy.server.ConnectionInterfaceContacts):
# Attributes from the interface org.freedesktop.Telepathy.Connection
# are always returned, and need not be requested explicitly.
- interfaces = set(interfaces + [telepathy.CONNECTION])
- for interface in interfaces:
+ supported_interfaces.add(telepathy.CONNECTION)
+
+ for interface in supported_interfaces:
interface_attribute = interface + '/' + self.attributes[interface]
results = functions[interface](handles)
for handle, value in results: