diff options
author | mathieui <mathieui@mathieui.net> | 2014-04-14 22:32:34 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-04-14 22:32:34 +0200 |
commit | 3221534b0f77a00043032c1e350814f607a56380 (patch) | |
tree | 6c7bd391e3c2e70c40efdb0c0249d676036899a3 /src/core/completions.py | |
parent | 245f5f050cd1b72f365a21c57d3462ed5207e0cc (diff) | |
download | poezio-3221534b0f77a00043032c1e350814f607a56380.tar.gz poezio-3221534b0f77a00043032c1e350814f607a56380.tar.bz2 poezio-3221534b0f77a00043032c1e350814f607a56380.tar.xz poezio-3221534b0f77a00043032c1e350814f607a56380.zip |
Implement XEP-0249 (Direct MUC Invitations)
- fallback to mediated invitations if only the bare jid is given to the
command or if the jid does not advertise support
TODO: provide a way to send passwords
Diffstat (limited to 'src/core/completions.py')
-rw-r--r-- | src/core/completions.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/completions.py b/src/core/completions.py index 1df8d23d..75122885 100644 --- a/src/core/completions.py +++ b/src/core/completions.py @@ -249,7 +249,12 @@ def completion_invite(self, the_input): """Completion for /invite""" n = the_input.get_argument_position(quoted=True) if n == 1: - return the_input.new_completion(sorted(jid for jid in roster.jids()), n, quotify=True) + comp = reduce(lambda x, y: x + [i.jid for i in y], (roster[jid].resources for jid in roster.jids() if len(roster[jid])), []) + comp = sorted(comp) + bares = sorted(roster[contact].bare_jid for contact in roster.jids() if len(roster[contact])) + off = sorted(jid for jid in roster.jids() if jid not in bares) + comp = comp + bares + off + return the_input.new_completion(comp, n, quotify=True) elif n == 2: rooms = [] for tab in self.get_tabs(tabs.MucTab): |