diff options
author | mathieui <mathieui@mathieui.net> | 2013-01-28 19:08:42 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2013-01-28 19:08:42 +0100 |
commit | 0c19f49e9852e6fdd195be970804cb67091b842b (patch) | |
tree | 5abd182100ef50f8603f8900029c72ebf44779ce /src | |
parent | d7b078950d3bdce69182480479d12772b8d30926 (diff) | |
download | poezio-0c19f49e9852e6fdd195be970804cb67091b842b.tar.gz poezio-0c19f49e9852e6fdd195be970804cb67091b842b.tar.bz2 poezio-0c19f49e9852e6fdd195be970804cb67091b842b.tar.xz poezio-0c19f49e9852e6fdd195be970804cb67091b842b.zip |
fix the completion of jids for /message
Diffstat (limited to 'src')
-rw-r--r-- | src/core.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core.py b/src/core.py index ae4d73d7..dc47c003 100644 --- a/src/core.py +++ b/src/core.py @@ -2308,6 +2308,15 @@ class Core(object): if len(args) > 1: tab.command_say(args[1]) + def completion_message(self, the_input): + """Completion for /message""" + n = len(the_input.get_text().split()) + if n > 2 or (n == 2 and the_input.get_text().endswith(' ')): + return + comp = reduce(lambda x, y: x + [i for i in y], (jid.resources for jid in roster if len(jid)), []) + comp = (str(res.jid) for res in comp) + return the_input.auto_completion(sorted(comp), '', quotify=True) + def command_xml_tab(self, arg=''): """/xml_tab""" self.xml_tab = True @@ -2399,7 +2408,7 @@ class Core(object): usage=_('<jid> [optional message]'), desc=_('Open a conversation with the specified JID (even if it is not in our roster), and send a message to it, if the message is specified.'), shortdesc=_('Send a message'), - completion=self.completion_version) + completion=self.completion_message) self.register_command('version', self.command_version, usage='<jid>', desc=_('Get the software version of the given JID (usually its XMPP client and Operating System).'), |