From 7ee5f251d927a5e0d5da352810e7686b56eb2b57 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sun, 25 Sep 2011 19:30:09 +0200 Subject: Restaure that --- src/tabs.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 88d8ad7f..2a7c3dc2 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1002,6 +1002,7 @@ class PrivateTab(ChatTab): #self.commands['info'] = (self.command_info, _('Usage: /info\nInfo: Display some information about the user in the MUC: '), None) self.commands['unquery'] = (self.command_unquery, _("Usage: /unquery\nUnquery: close the tab"), None) self.commands['part'] = (self.command_unquery, _("Usage: /part\nPart: close the tab"), None) + self.commands['version'] = (self.command_version, _('Usage: /version\nVersion: get the software version of the current interlocutor (usually its XMPP client and Operating System)'), None) self.resize() self.on = True @@ -1033,6 +1034,21 @@ class PrivateTab(ChatTab): """ self.core.close_tab() + def command_version(self, arg): + """ + /version + """ + def callback(res): + if not res: + return self.core.information('Could not get the software version from %s' % (jid,), 'Warning') + version = '%s is running %s version %s on %s' % (jid, + res.get('name') or _('an unknown software'), + res.get('version') or _('unknown'), + res.get('os') or _('on an unknown platform')) + self.core.information(version, 'Info') + jid = self.get_room().name + self.core.xmpp.plugin['xep_0092'].get_version(jid, callback=callback) + def resize(self): if self.core.information_win_size >= self.height-3 or not self.visible: return -- cgit v1.2.3 From 24dda3ff25603f81a178cc157dd002d5d7f3feda Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sun, 25 Sep 2011 19:31:42 +0200 Subject: and that --- src/tabs.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 2a7c3dc2..f46087fd 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -999,11 +999,12 @@ class PrivateTab(ChatTab): # keys self.key_func['^I'] = self.completion # commands - #self.commands['info'] = (self.command_info, _('Usage: /info\nInfo: Display some information about the user in the MUC: '), None) + self.commands['info'] = (self.command_info, _('Usage: /info\nInfo: Display some information about the user in the MUC: '), None) self.commands['unquery'] = (self.command_unquery, _("Usage: /unquery\nUnquery: close the tab"), None) self.commands['part'] = (self.command_unquery, _("Usage: /part\nPart: close the tab"), None) self.commands['version'] = (self.command_version, _('Usage: /version\nVersion: get the software version of the current interlocutor (usually its XMPP client and Operating System)'), None) self.resize() + self.parent_muc = self.core.get_tab_by_name(JID(room.name).bare, MucTab) self.on = True def completion(self): @@ -1049,6 +1050,16 @@ class PrivateTab(ChatTab): jid = self.get_room().name self.core.xmpp.plugin['xep_0092'].get_version(jid, callback=callback) + def command_info(self, arg): + """ + /info + """ + if arg: + self.parent_muc.command_info(arg) + else: + user = JID(self.get_room().name).resource + self.parent_muc.command_info(user) + def resize(self): if self.core.information_win_size >= self.height-3 or not self.visible: return -- cgit v1.2.3 From d5a013dd6a35cce610add92767335e0daafc3f9c Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sun, 25 Sep 2011 19:36:08 +0200 Subject: Fixes the refresh issue when the user of a private conversation leaves/joins --- src/tabs.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index f46087fd..f25006a8 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1151,22 +1151,25 @@ class PrivateTab(ChatTab): """ The user left the associated MUC """ + self.deactivate() if not status_message: self.get_room().add_message(_('\x191}%(spec)s \x193}%(nick)s\x195} has left the room') % {'nick':from_nick.replace('"', '\\"'), 'spec':get_theme().CHAR_QUIT.replace('"', '\\"')}) else: self.get_room().add_message(_('\x191}%(spec)s \x193}%(nick)s\x195} has left the room (%(status)s)"') % {'nick':from_nick.replace('"', '\\"'), 'spec':get_theme().CHAR_QUIT, 'status': status_message.replace('"', '\\"')}) - self.deactivate() - self.refresh() - self.core.doupdate() + if self.core.current_tab() is self: + self.refresh() + self.core.doupdate() def user_rejoined(self, nick): """ The user (or at least someone with the same nick) came back in the MUC """ - self.get_room().add_message('\x194}%(spec)s \x193}%(nick)s\x195} joined the room' % {'nick':nick, 'spec':get_theme().CHAR_JOIN}) self.activate() - self.refresh() - self.core.doupdate() + self.get_room().add_message('\x194}%(spec)s \x193}%(nick)s\x195} joined the room' % {'nick':nick, 'spec':get_theme().CHAR_JOIN}) + if self.core.current_tab() is self: + self.refresh() + self.core.doupdate() + def activate(self): self.on = True -- cgit v1.2.3 From 6037c4be65fd1a85e8500e830e61eef4837a815a Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 25 Sep 2011 20:28:57 +0200 Subject: Fix some more presence leaks --- src/tabs.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index f25006a8..1b0406f2 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -799,7 +799,8 @@ class MucTab(ChatTab): room.users.append(new_user) if from_nick == room.own_nick: room.joined = True - self.send_chat_state('active') + if self.core.current_tab() == self and self.core.status.show not in ('xa', 'away'): + self.send_chat_state('active') new_user.color = get_theme().COLOR_OWN_NICK room.add_message(_("\x195}Your nickname is \x193}%s") % (from_nick)) if '170' in status_codes: @@ -1021,7 +1022,8 @@ class PrivateTab(ChatTab): msg['body'] = xhtml.clean_text(line) msg['xhtml_im'] = xhtml.poezio_colors_to_html(line) if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: - msg['chat_state'] = 'active' + needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' + msg['chat_state'] = needed msg.send() self.core.add_message_to_text_buffer(self.get_room(), line, None, self.core.own_nick or self.get_room().own_nick) logger.log_message(JID(self.get_name()).bare, self.core.own_nick, line) @@ -1557,7 +1559,8 @@ class ConversationTab(ChatTab): msg['body'] = xhtml.clean_text(line) msg['xhtml_im'] = xhtml.poezio_colors_to_html(line) if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: - msg['chat_state'] = 'active' + needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' + msg['chat_state'] = needed msg.send() self.core.add_message_to_text_buffer(self.get_room(), line, None, self.core.own_nick) logger.log_message(JID(self.get_name()).bare, self.core.own_nick, line) -- cgit v1.2.3 From 31cad9a4ac79d2fd759b1add7ed20b15b705de85 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Thu, 29 Sep 2011 00:19:33 +0200 Subject: Fix that resize bug AGAIN --- src/tabs.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 1b0406f2..63fd2c96 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -681,6 +681,7 @@ class MucTab(ChatTab): """ if not self.visible: return + self.need_resize = False text_width = (self.width//10)*9 self.topic_win.resize(1, self.width, 0, 0) self.v_separator.resize(self.height-3, 1, 1, 9*(self.width//10)) @@ -1065,6 +1066,7 @@ class PrivateTab(ChatTab): def resize(self): if self.core.information_win_size >= self.height-3 or not self.visible: return + self.need_resize = False self.text_win.resize(self.height-3-self.core.information_win_size, self.width, 0, 0) self.text_win.rebuild_everything(self._room) self.info_header.resize(1, self.width, self.height-3-self.core.information_win_size, 0) @@ -1217,6 +1219,7 @@ class RosterInfoTab(Tab): def resize(self): if not self.visible: return + self.need_resize = False roster_width = self.width//2 info_width = self.width-roster_width-1 self.v_separator.resize(self.height-2, 1, 0, roster_width) @@ -1574,6 +1577,7 @@ class ConversationTab(ChatTab): def resize(self): if self.core.information_win_size >= self.height-3 or not self.visible: return + self.need_resize = False self.text_win.resize(self.height-4-self.core.information_win_size, self.width, 1, 0) self.text_win.rebuild_everything(self._room) self.upper_bar.resize(1, self.width, 0, 0) @@ -1691,6 +1695,7 @@ class MucListTab(Tab): def resize(self): if not self.visible: return + self.need_resize = False self.upper_message.resize(1, self.width, 0, 0) column_size = {'node-part': (self.width-5)//4, 'name': (self.width-5)//4*3, @@ -1825,6 +1830,7 @@ class SimpleTextTab(Tab): def resize(self): if not self.visible: return + self.need_resize = False self.text_win.resize(self.height-2, self.width, 0, 0) self.input.resize(1, self.width, self.height-1, 0) -- cgit v1.2.3