diff options
author | Krzysztof Klinikowski <kkszysiu@gmail.com> | 2010-04-21 13:37:06 +0200 |
---|---|---|
committer | Krzysztof Klinikowski <kkszysiu@gmail.com> | 2010-04-21 13:37:06 +0200 |
commit | eb141fba810cd6f456a252a8d63bbf272b209814 (patch) | |
tree | bbebe0a11ae4fbc43013728123d3b8e77e34fcd2 /sunshine | |
parent | c07646c432a593d37c54223d08d5607b19b9ee4b (diff) |
Be explicit about data types in methods that produce contact attributes
Diffstat (limited to 'sunshine')
-rw-r--r-- | sunshine/aliasing.py | 3 | ||||
-rw-r--r-- | sunshine/contacts.py | 4 | ||||
-rw-r--r-- | sunshine/presence.py | 16 |
3 files changed, 12 insertions, 11 deletions
diff --git a/sunshine/aliasing.py b/sunshine/aliasing.py index 5481cb9..c57cc88 100644 --- a/sunshine/aliasing.py +++ b/sunshine/aliasing.py @@ -18,6 +18,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import logging +import dbus import telepathy import telepathy.constants @@ -45,7 +46,7 @@ class SunshineAliasing(telepathy.server.ConnectionInterfaceAliasing): def GetAliases(self, contacts): logger.debug("Called GetAliases") - result = {} + result = dbus.Dictionary(signature='us') for contact in contacts: result[contact] = self._get_alias(contact) return result diff --git a/sunshine/contacts.py b/sunshine/contacts.py index 4d4dadb..cdd5fa8 100644 --- a/sunshine/contacts.py +++ b/sunshine/contacts.py @@ -61,9 +61,9 @@ class SunshineContacts(telepathy.server.ConnectionInterfaceContacts): logger.debug("Ignoring unsupported interface %s" % interface) handle_type = telepathy.HANDLE_TYPE_CONTACT - ret = {} + ret = dbus.Dictionary(signature='ua{sv}') for handle in handles: - ret[handle] = {} + ret[handle] = dbus.Dictionary(signature='sv') functions = { telepathy.CONNECTION : diff --git a/sunshine/presence.py b/sunshine/presence.py index 144170e..efa9554 100644 --- a/sunshine/presence.py +++ b/sunshine/presence.py @@ -105,12 +105,12 @@ class SunshinePresenceMapping(object): } to_presence_type = { - ONLINE: telepathy.constants.CONNECTION_PRESENCE_TYPE_AVAILABLE, - FFC: telepathy.constants.CONNECTION_PRESENCE_TYPE_AVAILABLE, - AWAY: telepathy.constants.CONNECTION_PRESENCE_TYPE_AWAY, - DND: telepathy.constants.CONNECTION_PRESENCE_TYPE_BUSY, - INVISIBLE: telepathy.constants.CONNECTION_PRESENCE_TYPE_HIDDEN, - OFFLINE: telepathy.constants.CONNECTION_PRESENCE_TYPE_OFFLINE + ONLINE: dbus.UInt32(telepathy.constants.CONNECTION_PRESENCE_TYPE_AVAILABLE), + FFC: dbus.UInt32(telepathy.constants.CONNECTION_PRESENCE_TYPE_AVAILABLE), + AWAY: dbus.UInt32(telepathy.constants.CONNECTION_PRESENCE_TYPE_AWAY), + DND: dbus.UInt32(telepathy.constants.CONNECTION_PRESENCE_TYPE_BUSY), + INVISIBLE: dbus.UInt32(telepathy.constants.CONNECTION_PRESENCE_TYPE_HIDDEN), + OFFLINE: dbus.UInt32(telepathy.constants.CONNECTION_PRESENCE_TYPE_OFFLINE) } class SunshinePresence(telepathy.server.ConnectionInterfaceSimplePresence): @@ -239,7 +239,7 @@ class SunshinePresence(telepathy.server.ConnectionInterfaceSimplePresence): self._self_presence_changed(SunshineHandleFactory(self, 'self'), presence, message) def get_simple_presences(self, contacts): - presences = {} + presences = dbus.Dictionary(signature='u(uss)') for handle_id in contacts: handle = self.handle(telepathy.HANDLE_TYPE_CONTACT, handle_id) if handle == SunshineHandleFactory(self, 'self'): @@ -260,7 +260,7 @@ class SunshinePresence(telepathy.server.ConnectionInterfaceSimplePresence): presence_type = SunshinePresenceMapping.to_presence_type[presence] - presences[handle] = (presence_type, presence, personal_message) + presences[handle] = dbus.Struct((presence_type, presence, personal_message), signature='uss') return presences def get_statuses(self): |