summaryrefslogtreecommitdiff
path: root/src/tabs/muclisttab.py
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-03-31 18:54:41 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-06-11 20:49:43 +0100
commit332a5c2553db41de777473a1e1be9cd1522c9496 (patch)
tree3ee06a59f147ccc4009b35cccfbe2461bcd18310 /src/tabs/muclisttab.py
parentcf44cf7cdec9fdb35caa372563d57e7045dc29dd (diff)
downloadpoezio-332a5c2553db41de777473a1e1be9cd1522c9496.tar.gz
poezio-332a5c2553db41de777473a1e1be9cd1522c9496.tar.bz2
poezio-332a5c2553db41de777473a1e1be9cd1522c9496.tar.xz
poezio-332a5c2553db41de777473a1e1be9cd1522c9496.zip
Move the src directory to poezio, for better cython compatibility.
Diffstat (limited to 'src/tabs/muclisttab.py')
-rw-r--r--src/tabs/muclisttab.py70
1 files changed, 0 insertions, 70 deletions
diff --git a/src/tabs/muclisttab.py b/src/tabs/muclisttab.py
deleted file mode 100644
index 92d55190..00000000
--- a/src/tabs/muclisttab.py
+++ /dev/null
@@ -1,70 +0,0 @@
-"""
-A MucListTab is a tab listing the rooms on a conference server.
-
-It has no functionnality except scrolling the list, and allowing the
-user to join the rooms.
-"""
-import logging
-log = logging.getLogger(__name__)
-
-from . import ListTab
-
-from slixmpp.plugins.xep_0030.stanza.items import DiscoItem
-
-class MucListTab(ListTab):
- """
- A tab listing rooms from a specific server, displaying various information,
- scrollable, and letting the user join them, etc
- """
- plugin_commands = {}
- plugin_keys = {}
-
- def __init__(self, server):
- ListTab.__init__(self, server,
- "ā€œjā€: join room.",
- 'Chatroom list on server %s (Loading)' % server,
- (('node-part', 0), ('name', 2), ('users', 3)))
- self.key_func['j'] = self.join_selected
- self.key_func['J'] = self.join_selected_no_focus
- self.key_func['^M'] = self.join_selected
-
- def get_columns_sizes(self):
- return {'node-part': int(self.width* 2 / 8),
- 'name': int(self.width * 5 / 8),
- 'users': self.width - int(self.width * 2 / 8)
- - int(self.width * 5 / 8)}
-
- def join_selected_no_focus(self):
- return
-
- def on_muc_list_item_received(self, iq):
- """
- Callback called when a disco#items result is received
- Used with command_list
- """
- if iq['type'] == 'error':
- self.set_error(iq['error']['type'], iq['error']['code'], iq['error']['text'])
- return
- def get_items():
- substanza = iq['disco_items']
- for item in substanza['substanzas']:
- if isinstance(item, DiscoItem):
- yield (item['jid'], item['node'], item['name'])
- items = [(item[0].split('@')[0],
- item[0],
- item[2] or '', '') for item in get_items()]
- self.listview.set_lines(items)
- self.info_header.message = 'Chatroom list on server %s' % self.name
- if self.core.current_tab() is self:
- self.refresh()
- else:
- self.state = 'highlight'
- self.refresh_tab_win()
- self.core.doupdate()
-
- def join_selected(self):
- row = self.listview.get_selected_row()
- if not row:
- return
- self.core.command_join(row[1])
-