summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-08-05 23:29:36 +0200
committermathieui <mathieui@mathieui.net>2013-08-05 23:29:36 +0200
commite40a3d72f532a9bc41339a8597a52e77a1a3ff98 (patch)
tree7d3527e775da837354ac5b0196aa8e3407025452
parente8a3f6f07cc9a1a43e39adb7ad1fc389aa2beafd (diff)
downloadpoezio-e40a3d72f532a9bc41339a8597a52e77a1a3ff98.tar.gz
poezio-e40a3d72f532a9bc41339a8597a52e77a1a3ff98.tar.bz2
poezio-e40a3d72f532a9bc41339a8597a52e77a1a3ff98.tar.xz
poezio-e40a3d72f532a9bc41339a8597a52e77a1a3ff98.zip
Add a specific /invite command for the MucTab
-rw-r--r--doc/source/commands.rst7
-rw-r--r--src/tabs.py22
2 files changed, 29 insertions, 0 deletions
diff --git a/doc/source/commands.rst b/doc/source/commands.rst
index 626b57d0..008fbda2 100644
--- a/doc/source/commands.rst
+++ b/doc/source/commands.rst
@@ -296,6 +296,13 @@ MultiUserChat tab commands
Ignore a specified nickname.
+ /invite [MUCTab version]
+ **Usage:** ``/invite <jid> [reason]``
+
+ Invite *jid* to this room with *reason* (if
+ provided).
+
+
/unignore
**Usage:** ``/unignore <nickname>``
diff --git a/src/tabs.py b/src/tabs.py
index 168a0459..db534a72 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -802,6 +802,11 @@ class MucTab(ChatTab):
self.register_command('names', self.command_names,
desc=_('Get the list of the users in the room, and the list of the people assuming the different roles.'),
shortdesc=_('List the users.'))
+ self.register_command('invite', self.command_invite,
+ desc=_('Invite a contact to this room'),
+ usage=_('<jid> [reason]'),
+ shortdesc=_('Invite a contact to this room'),
+ completion=self.completion_invite)
if self.core.xmpp.boundjid.server == "gmail.com": #gmail sucks
del self.commands["nick"]
@@ -895,6 +900,23 @@ class MucTab(ChatTab):
possible_affiliations = ['none', 'member', 'admin', 'owner', 'outcast']
return the_input.new_completion(possible_affiliations, 2, '', quotify=True)
+ def command_invite(self, args):
+ """/invite <jid> [reason]"""
+ args = common.shell_split(args)
+ if len(args) == 1:
+ jid, reason = args[0], ''
+ elif len(args) == 2:
+ jid, reason = args
+ else:
+ return self.core.command_help('invite')
+ self.core.command_invite('%s %s "%s"' % (jid, self.name, reason))
+
+ 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(roster.jids(), 1, quotify=True)
+
def scroll_user_list_up(self):
self.user_win.scroll_up()
self.user_win.refresh(self.users)