Commit e40a3d72 authored by mathieui's avatar mathieui

Add a specific /invite command for the MucTab

parent e8a3f6f0
...@@ -296,6 +296,13 @@ MultiUserChat tab commands ...@@ -296,6 +296,13 @@ MultiUserChat tab commands
Ignore a specified nickname. Ignore a specified nickname.
/invite [MUCTab version]
**Usage:** ``/invite <jid> [reason]``
Invite *jid* to this room with *reason* (if
/unignore /unignore
**Usage:** ``/unignore <nickname>`` **Usage:** ``/unignore <nickname>``
...@@ -802,6 +802,11 @@ class MucTab(ChatTab): ...@@ -802,6 +802,11 @@ class MucTab(ChatTab):
self.register_command('names', self.command_names, 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.'), desc=_('Get the list of the users in the room, and the list of the people assuming the different roles.'),
shortdesc=_('List the users.')) 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'),
if self.core.xmpp.boundjid.server == "": #gmail sucks if self.core.xmpp.boundjid.server == "": #gmail sucks
del self.commands["nick"] del self.commands["nick"]
...@@ -895,6 +900,23 @@ class MucTab(ChatTab): ...@@ -895,6 +900,23 @@ class MucTab(ChatTab):
possible_affiliations = ['none', 'member', 'admin', 'owner', 'outcast'] possible_affiliations = ['none', 'member', 'admin', 'owner', 'outcast']
return the_input.new_completion(possible_affiliations, 2, '', quotify=True) 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
return self.core.command_help('invite')
self.core.command_invite('%s %s "%s"' % (jid,, 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): def scroll_user_list_up(self):
self.user_win.scroll_up() self.user_win.scroll_up()
self.user_win.refresh(self.users) self.user_win.refresh(self.users)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment