From e9e15058bd22ecc225bde40380b0fcc2b422d37f Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Thu, 29 Sep 2011 02:07:45 +0200 Subject: Mais putain --- src/tabs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 63fd2c96..bc656cdd 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -884,7 +884,7 @@ class MucTab(ChatTab): 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} 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 \x193}%(nick)s\x195} has been banned') % {'spec':get_theme().CHAR_KICK, 'nick':from_nick.replace('"', '\\"')} if reason is not None and reason.text: kick_msg += _('\x195} Reason: \x196}%(reason)s\x195}') % {'reason': reason.text} room.add_message(kick_msg) -- cgit v1.2.3 From ed87f26db763432505072eb5a2875f30fc4061d1 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 1 Oct 2011 23:48:42 +0200 Subject: Added a connect() function to the plugins API, for internal event --- src/tabs.py | 1 + 1 file changed, 1 insertion(+) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index bc656cdd..a349da0b 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -298,6 +298,7 @@ class ChatTab(Tab): if not self.execute_command(clean_text): if txt.startswith('//'): txt = txt[1:] + self.core.run_event('enter', line=txt) self.command_say(txt) self.cancel_paused_delay() -- cgit v1.2.3 From 881de6a7c02e4c11957a1bb0dd3b31b8884fa8b0 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sat, 29 Oct 2011 07:05:19 +0200 Subject: add get_conversation_messages for the plugin API --- src/tabs.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index a349da0b..8606c450 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -368,6 +368,9 @@ class ChatTab(Tab): self.text_win.refresh(self._room) self.input.refresh() + def get_conversation_messages(self): + return self._room.messages + def command_say(self, line): raise NotImplementedError -- cgit v1.2.3 From 16854c39fd857db8abce6378b247ac1dbf528fbd Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sun, 6 Nov 2011 16:01:14 +0100 Subject: Remove a tab._room reference in a plugin API. --- src/tabs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 07652f74..afeb7c85 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -394,7 +394,7 @@ class ChatTab(Tab): self.input.refresh() def get_conversation_messages(self): - return self._room.messages + return self.messages def command_say(self, line): raise NotImplementedError -- cgit v1.2.3 From 1a57fcc4faed0c560832ea9d68f3803846a0b529 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sun, 6 Nov 2011 17:20:59 +0100 Subject: Actually, no, messages are in _text_buffer --- src/tabs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index afeb7c85..7e6c5dd2 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -394,7 +394,7 @@ class ChatTab(Tab): self.input.refresh() def get_conversation_messages(self): - return self.messages + return self._text_buffer.messages def command_say(self, line): raise NotImplementedError -- cgit v1.2.3 From 961cf5df8548ec0985f2755d21af933d8c023ee4 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 6 Nov 2011 23:46:00 +0100 Subject: New type of events to be used with the plugins --- src/tabs.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 7e6c5dd2..79be7d58 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -323,7 +323,6 @@ class ChatTab(Tab): if not self.execute_command(clean_text): if txt.startswith('//'): txt = txt[1:] - self.core.run_event('enter', line=txt) self.command_say(txt) self.cancel_paused_delay() @@ -723,6 +722,7 @@ class MucTab(ChatTab): 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'] = needed + self.core.events.trigger('muc_say', msg) self.cancel_paused_delay() msg.send() self.chat_state = needed @@ -1216,6 +1216,7 @@ class PrivateTab(ChatTab): if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' msg['chat_state'] = needed + self.core.events.trigger('private_say', msg) msg.send() self.core.add_message_to_text_buffer(self._text_buffer, line, None, self.core.own_nick or self.own_nick) self.cancel_paused_delay() @@ -1879,6 +1880,7 @@ class ConversationTab(ChatTab): if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' msg['chat_state'] = needed + self.core.events.trigger('conversation_say', msg) msg.send() self.core.add_message_to_text_buffer(self._text_buffer, line, None, self.core.own_nick) logger.log_message(JID(self.get_name()).bare, self.core.own_nick, line) -- cgit v1.2.3 From 17e5411d8f050a3c5e5bcd010551eecac96b5911 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Mon, 7 Nov 2011 19:47:16 +0100 Subject: use only full color mode when sending messages. Simple color mode should never be used in any part of the code except inside the input. --- src/tabs.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 7a968740..cae188ae 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -323,7 +323,7 @@ class ChatTab(Tab): if not self.execute_command(clean_text): if txt.startswith('//'): txt = txt[1:] - self.command_say(txt) + self.command_say(xhtml.convert_simple_to_full_colors(txt)) self.cancel_paused_delay() def send_chat_state(self, state, always_send=False): @@ -601,7 +601,7 @@ class MucTab(ChatTab): r = self.core.open_private_window(self.name, user.nick) if r and len(args) > 1: msg = arg[len(nick)+1:] - self.core.current_tab().command_say(msg) + self.core.current_tab().command_say(xhtml.convert_simple_to_full_colors(msg)) if not r: self.core.information(_("Cannot find user: %s" % nick), 'Error') @@ -718,7 +718,7 @@ class MucTab(ChatTab): if line.find('\x19') == -1: msg['body'] = line else: - msg['body'] = xhtml.clean_text_simple(line) + 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'] = needed @@ -1211,7 +1211,7 @@ class PrivateTab(ChatTab): if line.find('\x19') == -1: msg['body'] = line else: - msg['body'] = xhtml.clean_text_simple(line) + 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: needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' @@ -1875,7 +1875,7 @@ class ConversationTab(ChatTab): if line.find('\x19') == -1: msg['body'] = line else: - msg['body'] = xhtml.clean_text_simple(line) + 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: needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' -- cgit v1.2.3 From 36cd91dc9c6e30025e622f958fbdf984de10483b Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Mon, 7 Nov 2011 19:54:45 +0100 Subject: trigger events *_say BEFORE generating the xhtml, making it possible to add colors in the hook --- src/tabs.py | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index cae188ae..02d3c90d 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -715,14 +715,16 @@ class MucTab(ChatTab): needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' msg = self.core.xmpp.make_message(self.get_name()) msg['type'] = 'groupchat' - if line.find('\x19') == -1: - msg['body'] = line - else: - msg['body'] = xhtml.clean_text(line) - msg['xhtml_im'] = xhtml.poezio_colors_to_html(line) + msg['body'] = line + # trigger the event BEFORE looking for colors. + # This lets a plugin insert \x19xxx} colors, that will + # be converted in xhtml. + self.core.events.trigger('muc_say', msg) + if msg['body'].find('\x19') != -1: + msg['xhtml_im'] = xhtml.poezio_colors_to_html(msg['body']) + msg['body'] = xhtml.clean_text(msg['body']) if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: msg['chat_state'] = needed - self.core.events.trigger('muc_say', msg) self.cancel_paused_delay() msg.send() self.chat_state = needed @@ -1208,11 +1210,14 @@ class PrivateTab(ChatTab): return msg = self.core.xmpp.make_message(self.get_name()) msg['type'] = 'chat' - if line.find('\x19') == -1: - msg['body'] = line - else: - msg['body'] = xhtml.clean_text(line) - msg['xhtml_im'] = xhtml.poezio_colors_to_html(line) + msg['body'] = line + # trigger the event BEFORE looking for colors. + # This lets a plugin insert \x19xxx} colors, that will + # be converted in xhtml. + self.core.events.trigger('private_say', msg) + if msg['body'].find('\x19') != -1: + msg['body'] = xhtml.clean_text(msg['body']) + msg['xhtml_im'] = xhtml.poezio_colors_to_html(msg['body']) if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' msg['chat_state'] = needed @@ -1872,11 +1877,14 @@ class ConversationTab(ChatTab): def command_say(self, line): msg = self.core.xmpp.make_message(self.get_name()) msg['type'] = 'chat' - if line.find('\x19') == -1: - msg['body'] = line - else: - msg['body'] = xhtml.clean_text(line) - msg['xhtml_im'] = xhtml.poezio_colors_to_html(line) + msg['body'] = line + # trigger the event BEFORE looking for colors. + # This lets a plugin insert \x19xxx} colors, that will + # be converted in xhtml. + self.core.events.trigger('conversation_say', msg) + if msg['body'].find('\x19') != -1: + msg['body'] = xhtml.clean_text(msg['body']) + msg['xhtml_im'] = xhtml.poezio_colors_to_html(msg['body']) if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' msg['chat_state'] = needed -- cgit v1.2.3 From 32a75fd5c746ba6080f43ef56be361deb2e3bad3 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Mon, 7 Nov 2011 23:47:49 +0100 Subject: Trigger conversation_say and private_say only once, and fix the place where we add the message to the window (before removing the colors) --- src/tabs.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 02d3c90d..984d428f 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1215,15 +1215,14 @@ class PrivateTab(ChatTab): # This lets a plugin insert \x19xxx} colors, that will # be converted in xhtml. self.core.events.trigger('private_say', msg) + self.core.add_message_to_text_buffer(self._text_buffer, msg['body'], None, self.core.own_nick or self.own_nick) if msg['body'].find('\x19') != -1: - msg['body'] = xhtml.clean_text(msg['body']) msg['xhtml_im'] = xhtml.poezio_colors_to_html(msg['body']) + msg['body'] = xhtml.clean_text(msg['body']) if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' msg['chat_state'] = needed - self.core.events.trigger('private_say', msg) msg.send() - self.core.add_message_to_text_buffer(self._text_buffer, xhtml.convert_simple_to_full_colors(line), None, self.core.own_nick or self.own_nick) self.cancel_paused_delay() self.text_win.refresh() self.input.refresh() @@ -1879,18 +1878,18 @@ class ConversationTab(ChatTab): msg['type'] = 'chat' msg['body'] = line # trigger the event BEFORE looking for colors. + # and before displaying the message in the window # This lets a plugin insert \x19xxx} colors, that will # be converted in xhtml. self.core.events.trigger('conversation_say', msg) + self.core.add_message_to_text_buffer(self._text_buffer, msg['body'], None, self.core.own_nick) if msg['body'].find('\x19') != -1: - msg['body'] = xhtml.clean_text(msg['body']) msg['xhtml_im'] = xhtml.poezio_colors_to_html(msg['body']) + msg['body'] = xhtml.clean_text(msg['body']) if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' msg['chat_state'] = needed - self.core.events.trigger('conversation_say', msg) msg.send() - self.core.add_message_to_text_buffer(self._text_buffer, xhtml.convert_simple_to_full_colors(line), None, self.core.own_nick) logger.log_message(JID(self.get_name()).bare, self.core.own_nick, line) self.cancel_paused_delay() self.text_win.refresh() -- cgit v1.2.3 From 33997e43569fb2ea5944fa83812f19a484ce3c32 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 8 Nov 2011 00:14:44 +0100 Subject: Should fix day_change plugin --- src/tabs.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 984d428f..f26c34b6 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1995,6 +1995,9 @@ class ConversationTab(ChatTab): if config.get('send_chat_states', 'true') == 'true': self.send_chat_state('gone') + def add_message(self, txt, time=None, nickname=None, forced_user=None): + self._text_buffer.add_message(txt, time, nickname, None, None, forced_user) + class MucListTab(Tab): """ A tab listing rooms from a specific server, displaying various information, -- cgit v1.2.3 From 7d6c92ffc6af5ae738fc51b2f1454370e09a49fb Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 8 Nov 2011 00:30:53 +0100 Subject: Add a command /clear_infos --- src/tabs.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index f26c34b6..eaa7c375 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1410,6 +1410,7 @@ class RosterInfoTab(Tab): self.commands['remove'] = (self.command_remove, _("Usage: /remove [jid]\nRemove: Use this command to remove the specified JID from your roster. This wil unsubscribe you from its presence, cancel its subscription to yours, and remove the item from your roster"), self.completion_remove) self.commands['export'] = (self.command_export, _("Usage: /export [/path/to/file]\nExport: Use this command to export your contacts into /path/to/file if specified, or $HOME/poezio_contacts if not."), None) self.commands['import'] = (self.command_import, _("Usage: /import [/path/to/file]\nImport: Use this command to import your contacts from /path/to/file if specified, or $HOME/poezio_contacts if not."), None) + self.commands['clear_infos'] = (self.command_clear_infos, _("Usage: /clear_infos\nClear Infos: Use this command to clear the info buffer."), None) self.resize() def resize(self): @@ -1430,6 +1431,15 @@ class RosterInfoTab(Tab): not self.input.help_message: self.complete_commands(self.input) + def command_clear_infos(self, arg): + """ + /clear_infos + """ + self.core.information_buffer.messages = [] + self.information_win.rebuild_everything(self.core.information_buffer) + self.core.information_win.rebuild_everything(self.core.information_buffer) + self.refresh() + def command_deny(self, args): """ Denies a JID from our roster -- cgit v1.2.3 From 51364f7bea78f27820c67bf83a8e62ca593d61bb Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 6 Nov 2011 21:10:09 +0100 Subject: =?UTF-8?q?Code=20cleanup=20(unused=20import,=20variables,=20undef?= =?UTF-8?q?ined=20names,=20etc=E2=80=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tabs.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 984d428f..ce091913 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -24,7 +24,6 @@ from gettext import gettext as _ import windows import curses import difflib -import text_buffer import string import common import core @@ -40,7 +39,7 @@ from theming import get_theme from sleekxmpp.xmlstream.stanzabase import JID from config import config from roster import RosterGroup, roster -from contact import Contact, Resource +from contact import Contact from text_buffer import TextBuffer from user import User from os import getenv, path @@ -568,9 +567,9 @@ class MucTab(ChatTab): """ args = arg.split() if len(args): - msg = ' '.join(args) + arg = ' '.join(args) else: - msg = None + arg = None if self.joined: muc.leave_groupchat(self.core.xmpp, self.name, self.own_nick, arg) self.add_message(_("\x195}You left the chatroom\x193}")) @@ -938,7 +937,7 @@ class MucTab(ChatTab): self.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: self.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) + self.core.on_user_rejoined_private_conversation(self.name, from_nick) def on_user_nick_change(self, presence, user, from_nick, from_room): new_nick = presence.find('{%s}x/{%s}item' % (NS_MUC_USER, NS_MUC_USER)).attrib['nick'] -- cgit v1.2.3 From 8c231287bd65efd0adccd9ca6aeedd3151e8f2cb Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 6 Nov 2011 21:22:59 +0100 Subject: Make private join/parts work properly --- src/tabs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index ce091913..8f510f97 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1354,12 +1354,12 @@ class PrivateTab(ChatTab): """ self.activate() tab = self.core.get_tab_by_name(JID(self.name).bare, MucTab) - color = None - if tab: + color = 3 + if tab and config.get('display_user_color_in_join_part', ''): user = tab.get_user_by_name(nick) if user: - color = user.color - self.add_message('\x194}%(spec)s \x19%(color)d}%(nick)s\x195} joined the room' % {'nick':nick, 'color': color or 3, 'spec':get_theme().CHAR_JOIN}) + color = user.color[0] + self.add_message('\x194}%(spec)s \x19%(color)d}%(nick)s\x195} joined the room' % {'nick':nick, 'color': color, 'spec':get_theme().CHAR_JOIN}) if self.core.current_tab() is self: self.refresh() self.core.doupdate() -- cgit v1.2.3 From 1f0ffa9253ecbb3828cb772589587ed472b6d6c0 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 7 Nov 2011 14:33:37 +0100 Subject: =?UTF-8?q?Fix=20subscriptions=20(/add=20=E2=86=92=20/accept=20ins?= =?UTF-8?q?tead=20of=20/add=20=E2=86=92=20/accept=20=E2=86=92=20/accept)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tabs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 8f510f97..67905c0f 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1457,6 +1457,7 @@ class RosterInfoTab(Tab): self.core.information(_('No JID specified'), 'Error') return self.core.xmpp.sendPresence(pto=jid, ptype='subscribe') + self.core.xmpp.sendPresence(pto=jid, ptype='subscribed') def command_name(self, args): """ @@ -1684,7 +1685,6 @@ class RosterInfoTab(Tab): else: jid = args[0] self.core.xmpp.sendPresence(pto=jid, ptype='subscribed') - self.core.xmpp.sendPresence(pto=jid, ptype='subscribe') def refresh(self): if self.need_resize: -- cgit v1.2.3 From 9c688795d1c9381c71d0883285b357cdf21e2e37 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 7 Nov 2011 19:38:37 +0100 Subject: Removed "WARNING" debug messages, because they are irrelevant --- src/tabs.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 67905c0f..d86b456c 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -118,13 +118,12 @@ class Tab(object): @state.setter def state(self, value): if not value in STATE_COLORS: - log.debug("WARNING: invalid value for tab state") - return + log.debug("Invalid value for tab state: %s" % value) elif STATE_PRIORITY[value] < STATE_PRIORITY[self._state] and \ value != 'current': - log.debug("WARNING: did not set status because of lower priority") - return - self._state = value + log.debug("Did not set status because of lower priority, asked: %s, kept: %s" % (value, self.state)) + else: + self._state = value @staticmethod def resize(scr): -- cgit v1.2.3 From 08349495af2618de761e874d1daa149c390501bb Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 8 Nov 2011 22:03:33 +0100 Subject: Fix /kick with the optional message --- src/tabs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 5d7f2286..2f708ca8 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -658,7 +658,12 @@ class MucTab(ChatTab): if not len(args): self.core.command_help('kick') else: - self.command_role(arg+ ' none') + if len(args) > 1: + msg = ' '+args[1] + self.core.information("-%s-" % msg) + else: + msg = '' + self.command_role(args[0]+ ' none'+msg) def command_role(self, arg): """ -- cgit v1.2.3 From e61f496d29d8ad2e8d5d856a0205dd36a3293cc8 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 8 Nov 2011 23:28:29 +0100 Subject: Edited the help messages of the commands for clarity/consistency --- src/tabs.py | 60 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 2f708ca8..611202e4 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -293,7 +293,7 @@ class ChatTab(Tab): self.key_func['^M'] = self.on_enter self.commands['say'] = (self.command_say, _("""Usage: /say \nSay: Just send the message. - Useful if you want your message to begin with a '/'"""), None) + Useful if you want your message to begin with a '/'."""), None) self.chat_state = None def last_words_completion(self): @@ -427,20 +427,20 @@ class MucTab(ChatTab): self.commands['unignore'] = (self.command_unignore, _("Usage: /unignore \nUnignore: Remove the specified nickname from the ignore list."), self.completion_unignore) self.commands['kick'] = (self.command_kick, _("Usage: /kick [reason]\nKick: Kick the user with the specified nickname. You also can give an optional reason."), None) self.commands['role'] = (self.command_role, _("Usage: /role [reason]\nRole: Set the role of an user. Roles can be: none, visitor, participant, moderator. You also can give an optional reason."), None) - self.commands['affiliation'] = (self.command_affiliation, _("Usage: /affiliation [reason]\nAffiliation: Set the affiliation of an user. Affiliations can be: outcast, none, member, admin, owner. You also can give an optional reason."), None) - 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['affiliation'] = (self.command_affiliation, _("Usage: /affiliation [reason]\nAffiliation: Set the affiliation of an user. Affiliations can be: none, member, admin, owner. You also can give an optional reason."), None) + 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) - self.commands['info'] = (self.command_info, _('Usage: /info \nInfo: Display some information about the user in the MUC: his/here role, affiliation, status and status message.'), None) + self.commands['cycle'] = (self.command_cycle, _('Usage: /cycle [message]\nCycle: Leave the current room and rejoin it immediately.'), None) + self.commands['info'] = (self.command_info, _('Usage: /info \nInfo: Display some information about the user in the MUC: its/his/her role, affiliation, status and status message.'), None) self.commands['configure'] = (self.command_configure, _('Usage: /configure\nConfigure: Configure the current room, through a form.'), None) - self.commands['version'] = (self.command_version, _('Usage: /version \nVersion: get the software version of the given JID or nick in room (usually its XMPP client and Operating System)'), None) - self.commands['names'] = (self.command_names, _('Usage: /names\nNames: get the list of the users in the room, and the list of the people assuming the different roles.'), None) + self.commands['version'] = (self.command_version, _('Usage: /version \nVersion: Get the software version of the given JID or nick in room (usually its XMPP client and Operating System).'), None) + self.commands['names'] = (self.command_names, _('Usage: /names\nNames: Get the list of the users in the room, and the list of the people assuming the different roles.'), None) self.commands['clear'] = (self.command_clear, - _("""Usage: /clear\nClear: clears the current buffer'"""), None) + _('Usage: /clear\nClear: Clear the current buffer.'), None) self.resize() def scroll_user_list_up(self): @@ -1190,10 +1190,10 @@ 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['unquery'] = (self.command_unquery, _("Usage: /unquery\nUnquery: 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.commands['info'] = (self.command_info, _('Usage: /info\nInfo: Display some information about the user in the MUC: its/his/her role, affiliation, status and status message.'), None) + self.commands['unquery'] = (self.command_unquery, _("Usage: /unquery\nUnquery: 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(name).bare, MucTab) self.on = True @@ -1393,15 +1393,15 @@ class RosterInfoTab(Tab): self.key_func["o"] = self.toggle_offline_show self.key_func["s"] = self.start_search self.key_func["S"] = self.start_search_slow - self.commands['deny'] = (self.command_deny, _("Usage: /deny [jid]\nDeny: Use this command to remove and deny your presence to the provided JID (or the selected contact in your roster), who is asking you to be in his/here roster"), self.completion_deny) - self.commands['accept'] = (self.command_accept, _("Usage: /accept [jid]\nAccept: Use this command to authorize the provided JID (or the selected contact in your roster), to see your presence, and to ask to subscribe to it (mutual presence subscription)."), self.completion_deny) - self.commands['add'] = (self.command_add, _("Usage: /add \nAdd: Use this command to add the specified JID to your roster. The reverse authorization will automatically be accepted if the remote JID accepts your subscription, leading to a mutual presence subscription."), None) - self.commands['name'] = (self.command_name, _("Usage: /name \nSet the given JID's name"), self.completion_name) - self.commands['groupadd'] = (self.command_groupadd, _("Usage: /groupadd \nAdd the given JID to the given group"), self.completion_groupadd) - self.commands['groupremove'] = (self.command_groupremove, _("Usage: /groupremove \nRemove the given JID from the given group"), self.completion_groupremove) - self.commands['remove'] = (self.command_remove, _("Usage: /remove [jid]\nRemove: Use this command to remove the specified JID from your roster. This wil unsubscribe you from its presence, cancel its subscription to yours, and remove the item from your roster"), self.completion_remove) - self.commands['export'] = (self.command_export, _("Usage: /export [/path/to/file]\nExport: Use this command to export your contacts into /path/to/file if specified, or $HOME/poezio_contacts if not."), None) - self.commands['import'] = (self.command_import, _("Usage: /import [/path/to/file]\nImport: Use this command to import your contacts from /path/to/file if specified, or $HOME/poezio_contacts if not."), None) + self.commands['deny'] = (self.command_deny, _("Usage: /deny [jid]\nDeny: Deny your presence to the provided JID (or the selected contact in your roster), who is asking you to be in his/here roster."), self.completion_deny) + self.commands['accept'] = (self.command_accept, _("Usage: /accept [jid]\nAccept: Allow the provided JID (or the selected contact in your roster), to see your presence."), self.completion_deny) + self.commands['add'] = (self.command_add, _("Usage: /add \nAdd: Add the specified JID to your roster, ask him to allow you to see his presence, and allow him to see your presence."), None) + self.commands['name'] = (self.command_name, _("Usage: /name \nSet the given JID's name."), self.completion_name) + self.commands['groupadd'] = (self.command_groupadd, _("Usage: /groupadd \nAdd the given JID to the given group."), self.completion_groupadd) + self.commands['groupremove'] = (self.command_groupremove, _("Usage: /groupremove \nRemove the given JID from the given group."), self.completion_groupremove) + self.commands['remove'] = (self.command_remove, _("Usage: /remove [jid]\nRemove: Remove the specified JID from your roster. This wil unsubscribe you from its presence, cancel its subscription to yours, and remove the item from your roster."), self.completion_remove) + self.commands['export'] = (self.command_export, _("Usage: /export [/path/to/file]\nExport: Export your contacts into /path/to/file if specified, or $HOME/poezio_contacts if not."), None) + self.commands['import'] = (self.command_import, _("Usage: /import [/path/to/file]\nImport: Import your contacts from /path/to/file if specified, or $HOME/poezio_contacts if not."), None) self.resize() def resize(self): @@ -1856,10 +1856,10 @@ class ConversationTab(ChatTab): # keys self.key_func['^I'] = self.completion # commands - self.commands['unquery'] = (self.command_unquery, _("Usage: /unquery\nUnquery: close the tab"), None) - self.commands['close'] = (self.command_unquery, _("Usage: /close\Close: 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.commands['info'] = (self.command_info, _('Usage: /info\nInfo: get the status of the contact.'), None) + self.commands['unquery'] = (self.command_unquery, _("Usage: /unquery\nUnquery: Close the tab."), None) + self.commands['close'] = (self.command_unquery, _("Usage: /close\Close: 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.commands['info'] = (self.command_info, _('Usage: /info\nInfo: Get the status of the contact.'), None) self.resize() def completion(self): @@ -2005,7 +2005,7 @@ class MucListTab(Tab): self.key_func['j'] = self.join_selected self.key_func['J'] = self.join_selected_no_focus self.key_func['^M'] = self.join_selected - self.commands['close'] = (self.close, _("Usage: /close\nClose: Just close this tab"), None) + self.commands['close'] = (self.close, _("Usage: /close\nClose: Just close this tab."), None) self.resize() def refresh(self): -- cgit v1.2.3