From c55f1991438a891208b352a36ea15c2d8dc321c9 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 14 May 2011 01:21:59 +0200 Subject: fixes #2171, fixes #2173, also set a minimum size (< 5 lines crashes poezio when resizing) --- src/core.py | 26 ++++++++++++++++++++++++++ src/tabs.py | 9 +++++---- 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 [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 \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): """ -- cgit v1.2.3