Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/buddy.py
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2007-07-05 15:11:11 (GMT)
committer Simon McVittie <simon.mcvittie@collabora.co.uk>2007-07-05 15:11:11 (GMT)
commit257d70a3772be3bcead638572e9a07c8e2d3190c (patch)
tree3ff53abdd88c286e9c8572f920f9a4b91558a8b0 /src/buddy.py
parent154a6a4144e44353b28c5cdfd868ecbabca99557 (diff)
buddy, activity: cope with missing interfaces gracefully
Diffstat (limited to 'src/buddy.py')
-rw-r--r--src/buddy.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/buddy.py b/src/buddy.py
index c1e0c9e..1ec05ff 100644
--- a/src/buddy.py
+++ b/src/buddy.py
@@ -563,6 +563,9 @@ class Buddy(ExportedGObject):
conn = tp.get_connection()
handle, identifier = self._handles[tp]
+ if CONN_INTERFACE_AVATARS not in conn:
+ return
+
if icon is None:
icon = buddy_icon_cache.get_icon(conn.object_path, identifier,
new_avatar_token)
@@ -636,6 +639,12 @@ class GenericOwner(Buddy):
uses SetActivities on BuddyInfo channel
"""
conn = tp.get_connection()
+
+ if CONN_INTERFACE_BUDDY_INFO not in conn:
+ _logger.warning('%s does not support BuddyInfo - unable to '
+ 'set activities')
+ return
+
conn[CONN_INTERFACE_BUDDY_INFO].SetActivities(
self._activities_by_connection[tp].iteritems(),
reply_handler=_noop,
@@ -663,6 +672,12 @@ class GenericOwner(Buddy):
_logger.debug("Setting current activity to '%s' (handle %s)",
cur_activity, cur_activity_handle)
conn = tp.get_connection()
+
+ if CONN_INTERFACE_BUDDY_INFO not in conn:
+ _logger.warning('%s does not support BuddyInfo - unable to '
+ 'set current activity')
+ return
+
conn[CONN_INTERFACE_BUDDY_INFO].SetCurrentActivity(cur_activity,
cur_activity_handle,
reply_handler=_noop,
@@ -672,6 +687,12 @@ class GenericOwner(Buddy):
def _set_self_alias(self, tp):
self_handle = self._handles[tp][0]
conn = tp.get_connection()
+
+ if CONN_INTERFACE_ALIASING not in conn:
+ _logger.warning('%s does not support aliasing - unable to '
+ 'set my own alias')
+ return False
+
conn[CONN_INTERFACE_ALIASING].SetAliases({self_handle: self._nick},
reply_handler=_noop,
error_handler=lambda e:
@@ -698,6 +719,11 @@ class GenericOwner(Buddy):
del props['ip4-address']
if connected:
+ if CONN_INTERFACE_BUDDY_INFO not in conn:
+ _logger.warning('%s does not support BuddyInfo - unable to '
+ 'set my own buddy properties')
+ return False
+
conn[CONN_INTERFACE_BUDDY_INFO].SetProperties(props,
reply_handler=_noop,
error_handler=lambda e:
@@ -749,6 +775,11 @@ class GenericOwner(Buddy):
conn = tp.get_connection()
icon_data = self._icon
+ if CONN_INTERFACE_AVATARS not in conn:
+ _logger.warning('%s does not support Avatars - unable to '
+ 'set my own avatar on this connection')
+ return
+
m = new_md5()
m.update(icon_data)
digest = m.hexdigest()