diff options
author | mathieui <mathieui@mathieui.net> | 2011-11-24 23:03:24 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-11-24 23:03:43 +0100 |
commit | 42e9e29845403ad92f5ea4f71443aa7ef35148df (patch) | |
tree | c869c725d73808db7311542f506866af0181a731 | |
parent | 77b386d0f16818bb7ccd08199e462f9451b7fc23 (diff) | |
download | poezio-42e9e29845403ad92f5ea4f71443aa7ef35148df.tar.gz poezio-42e9e29845403ad92f5ea4f71443aa7ef35148df.tar.bz2 poezio-42e9e29845403ad92f5ea4f71443aa7ef35148df.tar.xz poezio-42e9e29845403ad92f5ea4f71443aa7ef35148df.zip |
Add a /decline command
-rw-r--r-- | src/core.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/core.py b/src/core.py index ff1622a5..3c7b70dd 100644 --- a/src/core.py +++ b/src/core.py @@ -137,6 +137,7 @@ class Core(object): 'rawxml': (self.command_rawxml, _('Usage: /rawxml\nRawXML: Send a custom xml stanza.'), None), 'set_plugin': (self.command_set_plugin, _("Usage: /set_plugin <plugin> <option> [value]\nSet Plugin: Set the value of the option in a plugin configuration file."), self.completion_set_plugin), 'invite': (self.command_invite, _("Usage: /invite <jid> <room> [reason]\nInvite: Invite jid in room with reason."), self.completion_invite), + 'decline': (self.command_decline, _("Usage: /decline <room> [reason]\nDecline: Decline the invitation to room with or without reason."), self.completion_decline), } self.key_func = { @@ -360,6 +361,25 @@ class Core(object): rooms.append(tab.get_name()) return the_input.auto_completion(rooms, '') + def command_decline(self, arg): + args = common.shell_split(arg) + if not len(args): + return + jid = JID(args[0]) + if jid.bare not in self.pending_invites: + return + reason = args[1] if len(args) > 1 else '' + self.xmpp.plugin['xep_0045'].decline_invite(jid.bare, self.pending_invites[jid.bare], reason) + + def completion_decline(self, the_input): + txt = the_input.get_text() + args = common.shell_split(txt) + n = len(args) + if txt.endswith(' '): + n += 1 + if len(args) == 1: + return the_input.auto_completion(list(self.pending_invites.keys()), '') + def on_groupchat_decline(self, decline): pass |