diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-05-19 20:38:12 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-05-19 20:38:12 +0200 |
commit | 5aff41b69be43cfec31ea4b6b5c735b500fae9db (patch) | |
tree | 313edc803260377bf006c23e2f5dd0d6362ecfe5 /src | |
parent | 09d4c16dc1c7af58248800c8a0cab9c3df180197 (diff) | |
download | poezio-5aff41b69be43cfec31ea4b6b5c735b500fae9db.tar.gz poezio-5aff41b69be43cfec31ea4b6b5c735b500fae9db.tar.bz2 poezio-5aff41b69be43cfec31ea4b6b5c735b500fae9db.tar.xz poezio-5aff41b69be43cfec31ea4b6b5c735b500fae9db.zip |
Fix the argument split issues
Diffstat (limited to 'src')
-rw-r--r-- | src/common.py | 8 | ||||
-rw-r--r-- | src/core.py | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/common.py b/src/common.py index 6a9d4a9c..9435dab5 100644 --- a/src/common.py +++ b/src/common.py @@ -193,19 +193,19 @@ def datetime_tuple(timestamp): ret -= dst return ret -def shell_split(string): - sh = shlex.shlex(string, posix=False) +def shell_split(st): + sh = shlex.shlex(st, posix=True) sh.whitespace_split = True sh.quotes = '"' ret = list() try: w = sh.get_token() - while w: + while w is not None: ret.append(w) w = sh.get_token() return ret except ValueError: - return string.split(" ") + return st.split(" ") def curses_color_pair(color): if color < 0: diff --git a/src/core.py b/src/core.py index 8e0d56ce..a639cbfa 100644 --- a/src/core.py +++ b/src/core.py @@ -1006,15 +1006,15 @@ class Core(object): """ /status <status> [msg] """ - args = arg.split() - if len(args) < 1: + args = common.shell_split(arg) + if len(args) != 2 and len(args) != 1: return if not args[0] in possible_show.keys(): self.command_help('status') return show = possible_show[args[0]] - if len(args) > 1: - msg = ' '.join(args[1:]) + if len(args) == 2: + msg = args[1] else: msg = None pres = self.xmpp.make_presence() |