summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-03-31 22:19:42 +0200
committermathieui <mathieui@mathieui.net>2014-03-31 22:19:42 +0200
commita0c7155140f50b2b1c22e7c1347be1024d4e3af8 (patch)
tree6066fdffdc5a68156725e3d03af1fd6bf3ae995a
parentcf37785edc2de2c5d5c02919f48ada38c566ff45 (diff)
downloadpoezio-a0c7155140f50b2b1c22e7c1347be1024d4e3af8.tar.gz
poezio-a0c7155140f50b2b1c22e7c1347be1024d4e3af8.tar.bz2
poezio-a0c7155140f50b2b1c22e7c1347be1024d4e3af8.tar.xz
poezio-a0c7155140f50b2b1c22e7c1347be1024d4e3af8.zip
Fix a traceback with broken roster items
only happens with buggy servers (hello ejabberd)
-rw-r--r--src/core.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core.py b/src/core.py
index bf24a20e..1cdf9e6c 100644
--- a/src/core.py
+++ b/src/core.py
@@ -3378,11 +3378,16 @@ class Core(object):
The roster was received.
"""
for item in iq['roster']:
- jid = item['jid']
- if item['subscription'] == 'remove':
- del roster[jid]
+ try:
+ jid = item['jid']
+ except InvalidJID:
+ jid = item._get_attr('jid', '')
+ log.error('Invalid JID: "%s"', jid, exc_info=True)
else:
- roster.update_contact_groups(jid)
+ if item['subscription'] == 'remove':
+ del roster[jid]
+ else:
+ roster.update_contact_groups(jid)
if isinstance(self.current_tab(), tabs.RosterInfoTab):
self.refresh_window()