diff options
author | mathieui <mathieui@mathieui.net> | 2011-12-18 20:35:19 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-12-18 20:35:19 +0100 |
commit | 2ed6b205940c65206a7732795727fc2ed2338ef4 (patch) | |
tree | ad2f65ecfbd30e940b885ced0badc6c4898e9f8c /src | |
parent | 9e7842d0146d64f6a99aa5950a3f4308bb1d8a16 (diff) | |
download | poezio-2ed6b205940c65206a7732795727fc2ed2338ef4.tar.gz poezio-2ed6b205940c65206a7732795727fc2ed2338ef4.tar.bz2 poezio-2ed6b205940c65206a7732795727fc2ed2338ef4.tar.xz poezio-2ed6b205940c65206a7732795727fc2ed2338ef4.zip |
Add a /invites command
Diffstat (limited to 'src')
-rw-r--r-- | src/core.py | 14 |
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) |