From 6d436f570ae186a472fe0d743cef7339e0c16d5d Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 27 Oct 2011 21:20:26 +0200 Subject: Fixed a TB on /kick --- src/tabs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tabs.py b/src/tabs.py index cd9450a7..8c4e8717 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -628,7 +628,8 @@ class MucTab(ChatTab): args = common.shell_split(arg) if not len(args): self.core.command_help('kick') - self._command_change_role('kick '+arg) + else: + self.command_role('none '+arg) def command_role(self, arg): """ -- cgit v1.2.3 From 611acbeb2aeabaac0f5d7a182566c7f57160ba4e Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 30 Oct 2011 23:18:47 +0100 Subject: Fixes #2277 --- src/tabs.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tabs.py b/src/tabs.py index 8c4e8717..3dd7aaea 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -409,6 +409,7 @@ class MucTab(ChatTab): self.commands['topic'] = (self.command_topic, _("Usage: /topic \nTopic: Change the subject of the room"), self.completion_topic) self.commands['query'] = (self.command_query, _('Usage: /query [message]\nQuery: Open a private conversation with . This nick has to be present in the room you\'re currently in. If you specified a message after the nickname, it will immediately be sent to this user'), None) self.commands['part'] = (self.command_part, _("Usage: /part [message]\nPart: disconnect from a room. You can specify an optional message."), None) + self.commands['close'] = (self.command_close, _("Usage: /close [message]\nClose: disconnect from a room and close the tab. You can specify an optional message if you are still connected."), None) self.commands['nick'] = (self.command_nick, _("Usage: /nick \nNick: Change your nickname in the current room"), None) self.commands['recolor'] = (self.command_recolor, _('Usage: /recolor\nRecolor: Re-assign a color to all participants of the current room, based on the last time they talked. Use this if the participants currently talking have too many identical colors.'), None) self.commands['cycle'] = (self.command_cycle, _('Usage: /cycle [message]\nCycle: Leaves the current room and rejoin it immediately'), None) @@ -548,9 +549,20 @@ class MucTab(ChatTab): msg = None if self.get_room().joined: muc.leave_groupchat(self.core.xmpp, room.name, room.own_nick, arg) - self.core.close_tab() + self.get_room().joined = False + self.get_room().add_message(_("\x195}You left the chatroom\x193}")) + self.refresh() + self.core.doupdate() self.core.disable_private_tabs(self.get_room().name) + def command_close(self, arg): + """ + /close [msg] + """ + self.command_part(arg) + self.core.close_tab() + + def command_query(self, arg): """ /query [message] @@ -1059,7 +1071,7 @@ class PrivateTab(ChatTab): # commands 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['close'] = (self.command_unquery, _("Usage: /close\nClose: 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) @@ -1735,7 +1747,7 @@ class ConversationTab(ChatTab): self.key_func['^I'] = self.completion # commands self.commands['unquery'] = (self.command_unquery, _("Usage: /unquery\nUnquery: close the tab"), None) - self.commands['part'] = (self.command_unquery, _("Usage: /part\Part: close the tab"), None) + self.commands['close'] = (self.command_unquery, _("Usage: /close\Close: close the tab"), None) self.resize() def completion(self): -- cgit v1.2.3 From ecf3685db6234e9dc53a41d4635d092a48de37a4 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 1 Nov 2011 12:17:17 +0100 Subject: Fixed #2281 --- src/tabs.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/tabs.py b/src/tabs.py index 3dd7aaea..bc85a618 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1643,6 +1643,8 @@ class RosterInfoTab(Tab): return False def move_cursor_down(self): + if isinstance(self.input, windows.CommandInput): + return self.roster_win.move_cursor_down() self.roster_win.refresh(roster) self.contact_info_win.refresh(self.roster_win.get_selected_row()) @@ -1650,6 +1652,8 @@ class RosterInfoTab(Tab): self.core.doupdate() def move_cursor_up(self): + if isinstance(self.input, windows.CommandInput): + return self.roster_win.move_cursor_up() self.roster_win.refresh(roster) self.contact_info_win.refresh(self.roster_win.get_selected_row()) -- cgit v1.2.3 From dac8a12abff0ec7c8d3baec4eb73535040c9de9d Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 1 Nov 2011 17:14:43 +0100 Subject: Add a config option that display the nick in join/part/status change/etc. in that user color. Fixes #2282. --- src/tabs.py | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/tabs.py b/src/tabs.py index bc85a618..b8385747 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -907,14 +907,16 @@ class MucTab(ChatTab): """ When a new user joins the groupchat """ - room.users.append(User(from_nick, affiliation, - show, status, role, jid)) + user = User(from_nick, affiliation, + show, status, role, jid) + room.users.append(user) hide_exit_join = config.get('hide_exit_join', -1) if hide_exit_join != 0: + color = user.color[0] if config.get('display_user_color_in_join_part', '') == 'true' else 3 if not jid.full: - room.add_message('\x194}%(spec)s \x193}%(nick)s\x195} joined the room' % {'nick':from_nick, 'spec':get_theme().CHAR_JOIN}) + room.add_message('\x194}%(spec)s \x19%(color)d}%(nick)s\x195} joined the room' % {'nick':from_nick, 'color':color, 'spec':get_theme().CHAR_JOIN}) else: - room.add_message('\x194}%(spec)s \x193}%(nick)s \x195}(\x194}%(jid)s\x195}) joined the room' % {'spec':get_theme().CHAR_JOIN, 'nick':from_nick, 'jid':jid.full}) + room.add_message('\x194}%(spec)s \x19%(color)d}%(nick)s \x195}(\x194}%(jid)s\x195}) joined the room' % {'spec':get_theme().CHAR_JOIN, 'nick':from_nick, 'color':color, 'jid':jid.full}) self.core.on_user_rejoined_private_conversation(room.name, from_nick) @@ -927,7 +929,8 @@ class MucTab(ChatTab): if isinstance(_tab, PrivateTab) and JID(_tab.get_name()).bare == room.name: _tab.get_room().own_nick = new_nick user.change_nick(new_nick) - room.add_message('\x193}%(old)s\x195} is now known as \x193}%(new)s' % {'old':from_nick, 'new':new_nick}) + color = user.color[0] if config.get('display_user_color_in_join_part', '') == 'true' else 3 + room.add_message('\x19%(color)d}%(old)s\x195} is now known as \x19%(color)d}%(new)s' % {'old':from_nick, 'new':new_nick, 'color':color}) # rename the private tabs if needed self.core.rename_private_tabs(room.name, from_nick, new_nick) @@ -949,10 +952,11 @@ class MucTab(ChatTab): else: kick_msg = _('\x191}%(spec)s \x193}You\x195} have been banned.') % {'spec':get_theme().CHAR_KICK} else: + color = user.color[0] if config.get('display_user_color_in_join_part', '') == 'true' else 3 if by: - kick_msg = _('\x191}%(spec)s \x193}%(nick)s\x195} has been banned by \x194}%(by)s') % {'spec':get_theme().CHAR_KICK, 'nick':from_nick, 'by':by} + kick_msg = _('\x191}%(spec)s \x19%(color)d}%(nick)s\x195} has been banned by \x194}%(by)s') % {'spec':get_theme().CHAR_KICK, 'nick':from_nick, 'color':color, 'by':by} else: - kick_msg = _('\x191}%(spec)s \x193}%(nick)s\x195} has been banned') % {'spec':get_theme().CHAR_KICK, 'nick':from_nick.replace('"', '\\"')} + kick_msg = _('\x191}%(spec)s \x19%(color)d}%(nick)s\x195} has been banned') % {'spec':get_theme().CHAR_KICK, 'nick':from_nick.replace('"', '\\"'), 'color':color} if reason is not None and reason.text: kick_msg += _('\x195} Reason: \x196}%(reason)s\x195}') % {'reason': reason.text} room.add_message(kick_msg) @@ -978,10 +982,11 @@ class MucTab(ChatTab): if config.get('autorejoin', 'false') == 'true': muc.join_groupchat(self.core.xmpp, room.name, room.own_nick) else: + color = user.color[0] if config.get('display_user_color_in_join_part', '') == 'true' else 3 if by: - kick_msg = _('\x191}%(spec)s \x193}%(nick)s\x195} has been kicked by \x193}%(by)s') % {'spec':get_theme().CHAR_KICK.replace('"', '\\"'), 'nick':from_nick.replace('"', '\\"'), 'by':by.replace('"', '\\"')} + kick_msg = _('\x191}%(spec)s \x19%(color)d}%(nick)s\x195} has been kicked by \x193}%(by)s') % {'spec':get_theme().CHAR_KICK.replace('"', '\\"'), 'nick':from_nick.replace('"', '\\"'), 'color':color, 'by':by.replace('"', '\\"')} else: - kick_msg = _('\x191}%(spec)s \x193}%(nick)s\x195} has been kicked') % {'spec':get_theme().CHAR_KICK, 'nick':from_nick.replace('"', '\\"')} + kick_msg = _('\x191}%(spec)s \x19%(color)d}%(nick)s\x195} has been kicked') % {'spec':get_theme().CHAR_KICK, 'nick':from_nick.replace('"', '\\"'), 'color':color} if reason is not None and reason.text: kick_msg += _('\x195} Reason: \x196}%(reason)s') % {'reason': reason.text} room.add_message(kick_msg) @@ -999,10 +1004,12 @@ class MucTab(ChatTab): self.core.doupdate() hide_exit_join = config.get('hide_exit_join', -1) if config.get('hide_exit_join', -1) >= -1 else -1 if hide_exit_join == -1 or user.has_talked_since(hide_exit_join): + log.debug("\n\nALLO: USERCOLOR: %s\n\n" % user.color.__repr__()) + color = user.color[0] if config.get('display_user_color_in_join_part', '') == 'true' else 3 if not jid.full: - leave_msg = _('\x191}%(spec)s \x193}%(nick)s\x195} has left the room') % {'nick':from_nick, 'spec':get_theme().CHAR_QUIT} + leave_msg = _('\x191}%(spec)s \x19%(color)d}%(nick)s\x195} has left the room') % {'nick':from_nick, 'color':color, 'spec':get_theme().CHAR_QUIT} else: - leave_msg = _('\x191}%(spec)s \x193}%(nick)s\x195} (\x194}%(jid)s\x195}) has left the room') % {'spec':get_theme().CHAR_QUIT, 'nick':from_nick, 'jid':jid.full} + leave_msg = _('\x191}%(spec)s \x19%(color)d}%(nick)s\x195} (\x194}%(jid)s\x195}) has left the room') % {'spec':get_theme().CHAR_QUIT, 'nick':from_nick, 'color':color, 'jid':jid.full} if status: leave_msg += ' (%s)' % status room.add_message(leave_msg) @@ -1016,7 +1023,11 @@ class MucTab(ChatTab): # build the message display_message = False # flag to know if something significant enough # to be displayed has changed - msg = _('\x193}%s\x195} changed: ')% from_nick.replace('"', '\\"') + color = user.color[0] if config.get('display_user_color_in_join_part', '') == 'true' else 3 + if from_nick == room.own_nick: + msg = _('\x193d}You\x195} changed: ') + else: + msg = _('\x19%(color)d}%(nick)s\x195} changed: ') % {'nick': from_nick.replace('"', '\\"'), 'color': color} if show not in SHOW_NAME: self.core.information("%s from room %s sent an invalid show: %s" %\ (from_nick, from_room, show), "warning") @@ -1040,7 +1051,9 @@ class MucTab(ChatTab): if not display_message: return msg = msg[:-2] # remove the last ", " - hide_status_change = config.get('hide_status_change', -1) if config.get('hide_status_change', -1) >= -1 else -1 + hide_status_change = config.get('hide_status_change', -1) + if hide_status_change < -1: + hide_status_change = -1 if (hide_status_change == -1 or \ user.has_talked_since(hide_status_change) or\ user.nick == room.own_nick)\ @@ -1237,7 +1250,7 @@ class PrivateTab(ChatTab): The user (or at least someone with the same nick) came back in the MUC """ self.activate() - self.get_room().add_message('\x194}%(spec)s \x193}%(nick)s\x195} joined the room' % {'nick':nick, 'spec':get_theme().CHAR_JOIN}) + self.get_room().add_message('\x194}%(spec)s \x19%(color)d}%(nick)s\x195} joined the room' % {'nick':nick, 'color':user.color, 'spec':get_theme().CHAR_JOIN}) if self.core.current_tab() is self: self.refresh() self.core.doupdate() -- cgit v1.2.3 From a603f46906b722d54220e3dba519fba1da2fd18b Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 3 Nov 2011 08:57:21 +0100 Subject: Fix a typo that causes a curses TB --- src/tabs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/tabs.py b/src/tabs.py index b8385747..a9709c02 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1025,7 +1025,7 @@ class MucTab(ChatTab): # to be displayed has changed color = user.color[0] if config.get('display_user_color_in_join_part', '') == 'true' else 3 if from_nick == room.own_nick: - msg = _('\x193d}You\x195} changed: ') + msg = _('\x193}You\x195} changed: ') else: msg = _('\x19%(color)d}%(nick)s\x195} changed: ') % {'nick': from_nick.replace('"', '\\"'), 'color': color} if show not in SHOW_NAME: -- cgit v1.2.3