summaryrefslogtreecommitdiff
path: root/plugins/uptime.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-03-08 22:53:35 +0100
committermathieui <mathieui@mathieui.net>2013-03-08 22:53:35 +0100
commit9885203c6799c121f5bc8a733dc1937fe8c1b4d6 (patch)
tree4190635a7c9c78d2dce1a4c8357ccb887f12b8af /plugins/uptime.py
parentdbde08a5267cf003d8a4a9c16f5b18275e9a4bd1 (diff)
downloadpoezio-9885203c6799c121f5bc8a733dc1937fe8c1b4d6.tar.gz
poezio-9885203c6799c121f5bc8a733dc1937fe8c1b4d6.tar.bz2
poezio-9885203c6799c121f5bc8a733dc1937fe8c1b4d6.tar.xz
poezio-9885203c6799c121f5bc8a733dc1937fe8c1b4d6.zip
Update the plugins to use the PluginAPI
Also: - Add get_conversation_messages() to PluginAPI - Make plugins_autoload colon-separated instead of space-separated (for consistency) - Replace a JID() with a safeJID() in the uptime plugin
Diffstat (limited to 'plugins/uptime.py')
-rw-r--r--plugins/uptime.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/plugins/uptime.py b/plugins/uptime.py
index 5390f9f7..cc47b46f 100644
--- a/plugins/uptime.py
+++ b/plugins/uptime.py
@@ -1,12 +1,11 @@
from plugin import BasePlugin
import tabs
-from common import parse_secs_to_str
+from common import parse_secs_to_str, safeJID
from sleekxmpp.xmlstream import ET
-from sleekxmpp.xmlstream.stanzabase import JID
class Plugin(BasePlugin):
def init(self):
- self.add_command('uptime', self.command_uptime,
+ self.api.add_command('uptime', self.command_uptime,
usage='<jid>',
help='Ask for the uptime of a server or component (see XEP-0012).',
short='Get the uptime')
@@ -14,10 +13,10 @@ class Plugin(BasePlugin):
def command_uptime(self, arg):
def callback(iq):
for query in iq.xml.getiterator('{jabber:iq:last}query'):
- self.core.information('Server %s online since %s' % (iq['from'], parse_secs_to_str(int(query.attrib['seconds']))), 'Info')
+ self.api.information('Server %s online since %s' % (iq['from'], parse_secs_to_str(int(query.attrib['seconds']))), 'Info')
return
- self.core.information('Could not retrieve uptime', 'Error')
- jid = JID(arg)
+ self.api.information('Could not retrieve uptime', 'Error')
+ jid = safeJID(arg)
if not jid.server:
return
iq = self.core.xmpp.makeIqGet(ito=jid.server)