From dc80a2288ef2cfed055d65b7797e9396c505c4a3 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Thu, 5 Aug 2010 22:37:55 +0000 Subject: command /say. fixed #1584 --- src/gui.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gui.py b/src/gui.py index 0906c898..91ed59ab 100644 --- a/src/gui.py +++ b/src/gui.py @@ -95,8 +95,8 @@ class Gui(object): 'topic': (self.command_topic, _("Usage: /topic \nTopic: Change the subject of the room")), 'link': (self.command_link, _("Usage: /link [option] [number]\nLink: Interact with a link in the conversation. Available options are 'open', 'copy'. Open just opens the link in the browser if it's http://, Copy just copy the link in the clipboard. An optional number can be provided, it indicates which link to interact with.")), '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')), - - 'nick': (self.command_nick, _("Usage: /nick \nNick: Change your nickname in the current room")) + 'nick': (self.command_nick, _("Usage: /nick \nNick: Change your nickname in the current room")), + 'say': (self.command_say, _('Usage: /say \nSay: Just send the message. Useful if you want your message to begin with a "/"')), } self.key_func = { @@ -606,7 +606,7 @@ class Gui(object): return if line.startswith('/') and not line.startswith('/me '): command = line.strip()[:].split()[0][1:] - arg = line[1+len(command):] + arg = line[2+len(command):] # jump the '/' and the ' ' # example. on "/link 0 open", command = "link" and arg = "0 open" if command in self.commands.keys(): func = self.commands[command][0] @@ -686,6 +686,20 @@ class Gui(object): roomname = self.current_room().name self.muc.eject_user(roomname, 'kick', nick, reason) + def command_say(self, arg): + """ + /say + """ + line = arg + if self.current_room().name != 'Info': + if self.current_room().jid is not None: + self.muc.send_private_message(self.current_room().name, line) + self.add_message_to_room(self.current_room(), line.decode('utf-8'), None, self.current_room().own_nick) + else: + self.muc.send_message(self.current_room().name, line) + self.window.input.refresh() + doupdate() + def command_join(self, arg): """ /join [room][/nick] [password] -- cgit v1.2.3