summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-11-11 22:36:43 +0100
committermathieui <mathieui@mathieui.net>2011-11-11 22:36:43 +0100
commitb13f8786cf2ef229e5dcaa3c5fd8770ec0c6ee10 (patch)
tree1a9fd6d3cb061ad5afd64cd4dc628301eca7d144
parentcd3390d91143b01f0409c2eb1c58fa6c989169b7 (diff)
downloadpoezio-b13f8786cf2ef229e5dcaa3c5fd8770ec0c6ee10.tar.gz
poezio-b13f8786cf2ef229e5dcaa3c5fd8770ec0c6ee10.tar.bz2
poezio-b13f8786cf2ef229e5dcaa3c5fd8770ec0c6ee10.tar.xz
poezio-b13f8786cf2ef229e5dcaa3c5fd8770ec0c6ee10.zip
Modify /presence
-rw-r--r--src/core.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/core.py b/src/core.py
index a4211a3f..04f89172 100644
--- a/src/core.py
+++ b/src/core.py
@@ -132,7 +132,7 @@ class Core(object):
'load': (self.command_load, _('Usage: /load <plugin>\nLoad: Load the specified plugin'), self.plugin_manager.completion_load),
'unload': (self.command_unload, _('Usage: /unload <plugin>\nUnload: Unload the specified plugin'), self.plugin_manager.completion_unload),
'plugins': (self.command_plugins, _('Usage: /plugins\nPlugins: Show the plugins in use.'), None),
- 'presence': (self.command_presence, _('Usage: /presence\nPresence: Send a directed presence.'), None),
+ 'presence': (self.command_presence, _('Usage: /presence <JID> [type] [status]\nPresence: Send a directed presence to <JID> and using [type] and [status] if provided.'), None),
}
self.key_func = {
@@ -1160,12 +1160,21 @@ class Core(object):
def command_presence(self, arg):
"""
- /presence <presence stanza>
+ /presence <JID> [type] [status]
"""
- if not arg:
+ args = common.shell_split(arg)
+ if len(args) == 1:
+ jid, type, status = args[0], None, None
+ elif len(args) == 2:
+ jid, type, status = args[0], args[1], None
+ elif len(args) == 3:
+ jid, type, status = args[0], args[1], args[2]
+ else:
return
+ if type == 'available':
+ type = None
try:
- self.xmpp.Presence(xml=ET.fromstring(arg)).send()
+ self.xmpp.make_presence(pto=jid, ptype=type, pstatus=status).send()
except :
import traceback
self.information(_('Could not send directed presence'), 'Error')