diff options
author | mathieui <mathieui@mathieui.net> | 2011-05-14 01:21:59 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-05-14 01:21:59 +0200 |
commit | c55f1991438a891208b352a36ea15c2d8dc321c9 (patch) | |
tree | 517d64b99883c8581d3146dcd32d7c4fa09b4f68 /src | |
parent | bf5599d4d01e12659e3d01fc29587d503e66beb0 (diff) | |
download | poezio-c55f1991438a891208b352a36ea15c2d8dc321c9.tar.gz poezio-c55f1991438a891208b352a36ea15c2d8dc321c9.tar.bz2 poezio-c55f1991438a891208b352a36ea15c2d8dc321c9.tar.xz poezio-c55f1991438a891208b352a36ea15c2d8dc321c9.zip |
fixes #2171, fixes #2173, also set a minimum size (< 5 lines crashes poezio when resizing)
Diffstat (limited to 'src')
-rw-r--r-- | src/core.py | 26 | ||||
-rw-r--r-- | src/tabs.py | 9 | ||||
-rw-r--r-- | src/windows.py | 5 |
3 files changed, 34 insertions, 6 deletions
diff --git a/src/core.py b/src/core.py index 7e0fb747..ce95e310 100644 --- a/src/core.py +++ b/src/core.py @@ -128,6 +128,7 @@ class Core(object): 'message': (self.command_message, _('Usage: /message <jid> [optional message]\nMessage: Open a conversation with the specified JID (even if it is not in our roster), and send a message to it, if specified'), None), 'version': (self.command_version, _('Usage: /version <jid>\nVersion: get the software version of the given JID (usually its XMPP client and Operating System)'), None), 'connect': (self.command_reconnect, _('Usage: /connect\nConnect: disconnect from the remote server if you are currently connected and then connect to it again'), None), + 'server_cycle': (self.command_server_cycle, _('Usage: /server_cycle [domain] [message]\nServer Cycle: disconnect and reconnects in all the rooms in domain.'), None), } self.key_func = { @@ -1327,6 +1328,31 @@ class Core(object): del tab self.refresh_window() + def command_server_cycle(self, arg): + """ + Do a /cycle on each room of the given server. If none, do it on the current tab + """ + args = common.shell_split(arg) + tab = self.current_tab() + message = "" + + if len(args): + domain = args[0] + if len(args) > 1: + message = args[1] + else: + if isinstance(tab, tabs.MucTab): + domain = JID(tab.get_name()).domain + else: + self.information(_("No server specified"), "Error") + return + for tab in self.tabs: + if isinstance(tab, tabs.MucTab) and JID(tab.get_name()).domain == domain: + if tab.get_room().joined: + muc.leave_groupchat(tab.core.xmpp, tab.get_name(), tab.get_room().own_nick, message) + tab.get_room().joined = False + self.command_join(tab.get_name()) + def go_to_room_number(self): """ Read 2 more chars and go to the tab diff --git a/src/tabs.py b/src/tabs.py index fff73467..0301538c 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -294,10 +294,11 @@ class ChatTab(Tab): """ Send an empty chatstate message """ - msg = self.core.xmpp.make_message(self.get_name()) - msg['type'] = self.message_type - msg['chat_state'] = state - msg.send() + if not isinstance(self, MucTab) or self.get_room().joined: + msg = self.core.xmpp.make_message(self.get_name()) + msg['type'] = self.message_type + msg['chat_state'] = state + msg.send() def send_composing_chat_state(self, empty_before, empty_after): """ diff --git a/src/windows.py b/src/windows.py index df361ed8..c7c3bfa2 100644 --- a/src/windows.py +++ b/src/windows.py @@ -68,8 +68,9 @@ class Win(object): if not self._win: self._win = curses.newwin(height, width, y, x) else: - self._win.resize(height, width) - self._win.mvwin(y, x) + if height > 5 and width > 40: + self._win.resize(height, width) + self._win.mvwin(y, x) def resize(self, height, width, y, x): """ |