summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-11-11 22:15:04 +0100
committermathieui <mathieui@mathieui.net>2011-11-11 22:15:04 +0100
commite53446a7b2061f7e52dfbf19b0ad23b18b213bda (patch)
tree286aca9efae4209b258b7c218a5caa47f4782b24 /src
parent0cfe87a9a6d3ce85ed11114b0607ac178f2a5821 (diff)
downloadpoezio-e53446a7b2061f7e52dfbf19b0ad23b18b213bda.tar.gz
poezio-e53446a7b2061f7e52dfbf19b0ad23b18b213bda.tar.bz2
poezio-e53446a7b2061f7e52dfbf19b0ad23b18b213bda.tar.xz
poezio-e53446a7b2061f7e52dfbf19b0ad23b18b213bda.zip
Add a /presence command for directed presences
Diffstat (limited to 'src')
-rw-r--r--src/core.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core.py b/src/core.py
index 50acf784..a4211a3f 100644
--- a/src/core.py
+++ b/src/core.py
@@ -15,6 +15,7 @@ import threading
import traceback
from datetime import datetime
+from xml.etree import cElementTree as ET
from inspect import getargspec
@@ -131,6 +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),
}
self.key_func = {
@@ -1156,6 +1158,19 @@ class Core(object):
if isinstance(current, tabs.MucTab) and current.joined and show not in ('away', 'xa'):
current.send_chat_state('active')
+ def command_presence(self, arg):
+ """
+ /presence <presence stanza>
+ """
+ if not arg:
+ return
+ try:
+ self.xmpp.Presence(xml=ET.fromstring(arg)).send()
+ except :
+ import traceback
+ self.information(_('Could not send directed presence'), 'Error')
+ log.debug(_("Could not send directed presence:\n") + traceback.format_exc())
+
def completion_status(self, the_input):
return the_input.auto_completion([status for status in possible_show], ' ')