summaryrefslogtreecommitdiff
path: root/src/tabs.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2011-01-02 15:50:01 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2011-01-02 15:50:01 +0000
commit11357165186dce6614b03399f025febd4c48183e (patch)
tree1001faabe80a6637d9ac89beb1131fca7395dd0c /src/tabs.py
parent15f7340661e0ef4b375e54dabc1f3c1f6f885c38 (diff)
downloadpoezio-11357165186dce6614b03399f025febd4c48183e.tar.gz
poezio-11357165186dce6614b03399f025febd4c48183e.tar.bz2
poezio-11357165186dce6614b03399f025febd4c48183e.tar.xz
poezio-11357165186dce6614b03399f025febd4c48183e.zip
fix /list with new SleekXMPP xep_0030 version. Also add some error handling and a '(loading)' information while waiting for the answer
Diffstat (limited to 'src/tabs.py')
-rw-r--r--src/tabs.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/tabs.py b/src/tabs.py
index b106592b..b8fe9d84 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -1010,6 +1010,7 @@ class MucListTab(Tab):
self._color_state = theme.COLOR_TAB_NORMAL
self.name = server
self.upper_message = windows.Topic()
+ self.upper_message.set_message('Chatroom list on server %s (Loading)' % self.name)
columns = ('node-part','name', 'users')
self.list_header = windows.ColumnHeaderWin(columns)
self.listview = windows.ListWin(columns)
@@ -1026,7 +1027,7 @@ class MucListTab(Tab):
self.resize()
def refresh(self, tabs, informations, roster):
- self.upper_message.refresh('Chatroom list on server %s' % self.name)
+ self.upper_message.refresh()
self.list_header.refresh()
self.listview.refresh()
self.tab_win.refresh(tabs, tabs[0])
@@ -1057,6 +1058,32 @@ class MucListTab(Tab):
def join_selected_no_focus(self):
return
+ def set_error(self, msg, code, body):
+ """
+ If there's an error (retrieving the values etc)
+ """
+ self._error_message = _('Error: %(code)s - %(msg)s: %(body)s') % {'msg':msg, 'body':body, 'code':code}
+ self.upper_message.set_message(self._error_message)
+ self.upper_message.refresh()
+ curses.doupdate()
+
+ def on_muc_list_item_received(self, iq):
+ """
+ Callback called when a disco#items result is received
+ Used with command_list
+ """
+ log.debug('res: %s\n\n' % iq)
+ if iq['type'] == 'error':
+ self.set_error(iq['error']['type'], iq['error']['code'], iq['error']['text'])
+ return
+ items = [{'node-part':JID(item[0]).user,
+ 'jid': item[0],
+ 'name': item[2]} for item in iq['disco_items'].get_items()]
+ self.listview.add_lines(items)
+ self.upper_message.set_message('Chatroom list on server %s' % self.name)
+ self.upper_message.refresh()
+ curses.doupdate()
+
def join_selected(self):
row = self.listview.get_selected_row()
if not row: