summaryrefslogtreecommitdiff
path: root/src/window.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-09-27 22:53:25 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-09-27 22:53:25 +0000
commit3ea295f8c78d74c7ce94db3271f0ce3464e4e0cb (patch)
tree6058acac1735fb2cc583bd1edbca6b9b93dd500c /src/window.py
parentd94efc30ccfb376dab7381090facc6c75b2f49c2 (diff)
downloadpoezio-3ea295f8c78d74c7ce94db3271f0ce3464e4e0cb.tar.gz
poezio-3ea295f8c78d74c7ce94db3271f0ce3464e4e0cb.tar.bz2
poezio-3ea295f8c78d74c7ce94db3271f0ce3464e4e0cb.tar.xz
poezio-3ea295f8c78d74c7ce94db3271f0ce3464e4e0cb.zip
avoid a crash when receiving a message from someone not in our roster
Diffstat (limited to 'src/window.py')
-rw-r--r--src/window.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/window.py b/src/window.py
index bef3bc9c..c10d3388 100644
--- a/src/window.py
+++ b/src/window.py
@@ -257,16 +257,22 @@ class ConversationInfoWin(InfoWin):
def refresh(self, room, contact):
if not self.visible:
return
+ # contact can be None, if we receive a message
+ # from someone not in our roster. In this case, we display
+ # only the maximum information from the message we can get.
g_lock.acquire()
self.win.erase()
- self.write_room_name(contact)
+ self.write_room_name(contact, room)
self.print_scroll_position(room)
self.finish_line(theme.COLOR_INFORMATION_BAR)
self.win.refresh()
g_lock.release()
- def write_room_name(self, contact):
- txt = '%s' % contact.get_jid().bare
+ def write_room_name(self, contact, room):
+ if not contact:
+ txt = '%s' % room.name
+ else:
+ txt = '%s' % contact.get_jid().bare
self.addnstr(txt, len(txt), curses.color_pair(theme.COLOR_INFORMATION_BAR))
class MucInfoWin(InfoWin):