summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-12-18 20:35:19 +0100
committerFlorent Le Coz <louiz@louiz.org>2012-01-26 10:05:34 +0100
commitf1fae6b38717a4df54e4306608ffa22055548f69 (patch)
treead2f65ecfbd30e940b885ced0badc6c4898e9f8c /src
parent825d5a6dd1aee29aef12d49d147b50f8ce7c15d0 (diff)
downloadpoezio-f1fae6b38717a4df54e4306608ffa22055548f69.tar.gz
poezio-f1fae6b38717a4df54e4306608ffa22055548f69.tar.bz2
poezio-f1fae6b38717a4df54e4306608ffa22055548f69.tar.xz
poezio-f1fae6b38717a4df54e4306608ffa22055548f69.zip
Add a /invites command
Diffstat (limited to 'src')
-rw-r--r--src/core.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core.py b/src/core.py
index d0f6c4de..e3d655d5 100644
--- a/src/core.py
+++ b/src/core.py
@@ -144,6 +144,7 @@ class Core(object):
'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),
+ 'invitations': (self.command_invitations, _("Usage: /invites\nInvites: Show the pending invitations."), None),
'bookmarks': (self.command_bookmarks, _("Usage: /bookmarks\nBookmarks: Show the current bookmarks."), None),
'remove_bookmark': (self.command_remove_bookmark, _("Usage: /remove_bookmark [jid]\nRemove Bookmark: Remove the specified bookmark, or the bookmark on the current tab, if any."), self.completion_remove_bookmark),
'xml_tab': (self.command_xml_tab, _("Usage: /xml_tab\nXML Tab: Open an XML tab."), None),
@@ -376,6 +377,7 @@ class Core(object):
self.pending_invites[jid.bare] = inviter.full
def command_invite(self, arg):
+ """/invite <to> <room> [reason]"""
args = common.shell_split(arg)
if len(args) < 2:
return
@@ -400,6 +402,7 @@ class Core(object):
return the_input.auto_completion(rooms, '')
def command_decline(self, arg):
+ """/decline <room@server.tld> [reason]"""
args = common.shell_split(arg)
if not len(args):
return
@@ -409,6 +412,17 @@ class Core(object):
reason = args[1] if len(args) > 1 else ''
self.xmpp.plugin['xep_0045'].decline_invite(jid.bare, self.pending_invites[jid.bare], reason)
+ def command_invitations(self, arg):
+ """/invitations"""
+ build = ""
+ for invite in self.pending_invites:
+ build += "%s by %s" % (invite, JID(self.pending_invites[invite]).bare)
+ if self.pending_invites:
+ build = "You are invited to the following rooms:\n" + build
+ else:
+ build = "You are do not have any pending invitation."
+ self.information(build, 'Info')
+
def completion_decline(self, the_input):
txt = the_input.get_text()
args = common.shell_split(txt)