diff options
author | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-09-11 04:07:04 +0000 |
---|---|---|
committer | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-09-11 04:07:04 +0000 |
commit | efc7b22bdb316633fb50af3b674ee117aefc8619 (patch) | |
tree | 284b4a89fe02b89f756b8efb774879647a36e127 | |
parent | 2a5635c677fa7d2d5d0d3d978542fd0a82c1a594 (diff) | |
download | poezio-efc7b22bdb316633fb50af3b674ee117aefc8619.tar.gz poezio-efc7b22bdb316633fb50af3b674ee117aefc8619.tar.bz2 poezio-efc7b22bdb316633fb50af3b674ee117aefc8619.tar.xz poezio-efc7b22bdb316633fb50af3b674ee117aefc8619.zip |
You can now kick ANYONE (even with a space), and have a space in your nick. fixed #1803
-rw-r--r-- | src/gui.py | 41 |
1 files changed, 30 insertions, 11 deletions
@@ -20,9 +20,10 @@ from os.path import isfile from time import sleep -import sys import os import re +import sys +import shlex import curses import webbrowser @@ -760,7 +761,11 @@ class Gui(object): """ # TODO return - args = arg.split() + # check shlex here + try: + args = shlex.split(arg) + except ValueError as error: + return self.add_message_to_room(self.current_room(), _("Error: %s") % (error)) room = self.current_room() if len(args) != 1: self.add_message_to_room(room, _('whois command takes exactly one argument')) @@ -809,7 +814,10 @@ class Gui(object): """ /kick <nick> [reason] """ - args = arg.split() + try: + args = shlex.split(arg) + except ValueError as error: + return self.add_message_to_room(self.current_room(), _("Error: %s") % (error)) if len(args) < 1: self.command_help('kick') return @@ -980,7 +988,10 @@ class Gui(object): """ /ignore <nick> """ - args = arg.split() + try: + args = shlex.split(arg) + except ValueError as error: + return self.add_message_to_room(self.current_room(), _("Error: %s") % (error)) if len(args) != 1: self.command_help('ignore') return @@ -1000,7 +1011,10 @@ class Gui(object): """ /unignore <nick> """ - args = arg.split() + try: + args = shlex.split(arg) + except ValueError as error: + return self.add_message_to_room(self.current_room(), _("Error: %s") % (error)) if len(args) != 1: self.command_help('unignore') return @@ -1065,7 +1079,10 @@ class Gui(object): """ /query <nick> [message] """ - args = arg.split() + try: + args = shlex.split(arg) + except ValueError as error: + return self.add_message_to_room(self.current_room(), _("Error: %s") % (error)) if len(args) < 1: return nick = args[0] @@ -1085,13 +1102,12 @@ class Gui(object): """ /topic [new topic] """ - args = arg.split() room = self.current_room() - if len(args) == 0: + if not arg.strip(): self.add_message_to_room(room, _("The subject of the room is: %s") % room.topic) return - subject = ' '.join(args) - if not room.joined or room.name == "Info": + subject = arg + if not room.joined or room.name == "Info" and not room.jid: return muc.change_subject(self.xmpp, room.name, subject) @@ -1145,7 +1161,10 @@ class Gui(object): """ /nick <nickname> """ - args = arg.split() + try: + args = shlex.split(arg) + except ValueError as error: + return self.add_message_to_room(self.current_room(), _("Error: %s") % (error)) if len(args) != 1: return nick = args[0] |