[kupfer] Handle rogue jabber servers that offer no presence information.



commit 9d48a1377d31916e2c6eca4fe18ef92c7621264d
Author: Stas SUÈCOV <stas net utcluj ro>
Date:   Sun Jul 1 20:54:55 2012 +0300

    Handle rogue jabber servers that offer no presence information.

 kupfer/plugin/empathy.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/plugin/empathy.py b/kupfer/plugin/empathy.py
index 065b978..cb5dd19 100644
--- a/kupfer/plugin/empathy.py
+++ b/kupfer/plugin/empathy.py
@@ -217,7 +217,11 @@ class ContactsSource(AppLeafContentMixin, ToplevelGroupingSource,
 						contact_attributes = [str(a) for a in contact_attributes]
 						contact_details = connection.GetContactAttributes(contacts, contact_attributes, False)
 						for contact, details in contact_details.iteritems():
-								status_code = details[_ATTRIBUTES.get("presence")][1]
+								try:
+									status_code = details[_ATTRIBUTES.get("presence")][1]
+								except KeyError, ex:
+									self.output_info('Presence could not be established with %s. Leaving unknown.' % ex)
+									status_code = u'unknown'
 								if not show_offline and status_code == 'offline':
 									continue
 								yield EmpathyContact(



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]