summaryrefslogtreecommitdiff
path: root/src
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 /src
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 'src')
-rw-r--r--src/core.py8
-rw-r--r--src/plugin.py12
2 files changed, 17 insertions, 3 deletions
diff --git a/src/core.py b/src/core.py
index 03f892b6..db8c257a 100644
--- a/src/core.py
+++ b/src/core.py
@@ -300,8 +300,12 @@ class Core(object):
Load the plugins on startup.
"""
plugins = config.get('plugins_autoload', '')
- for plugin in plugins.split():
- self.plugin_manager.load(plugin)
+ if ':' in plugins:
+ for plugin in plugins.split(':'):
+ self.plugin_manager.load(plugin)
+ else:
+ for plugin in plugins.split():
+ self.plugin_manager.load(plugin)
self.plugins_autoloaded = True
def start(self):
diff --git a/src/plugin.py b/src/plugin.py
index 2ef83510..9687c1d2 100644
--- a/src/plugin.py
+++ b/src/plugin.py
@@ -119,6 +119,16 @@ class PluginAPI(object):
"""
return self.core.send_message(*args, **kwargs)
+ def get_conversation_messages(self, _, *args, **kwargs):
+ """
+ Get all the Messages of the current Tab.
+
+ :returns: The list of :py:class:`text_buffer.Message` objects.
+ :returns: None if the Tab does not inherit from ChatTab.
+ :rtype: :py:class:`list`
+ """
+ return self.core.get_conversation_messages()
+
def add_timed_event(self, _, *args, **kwargs):
"""
Schedule a timed event.
@@ -331,7 +341,7 @@ class PluginAPI(object):
A list of the SleekXMPP events can be found here
http://sleekxmpp.com/event_index.html
"""
- self.core.xmmp.add_event_handler(event_name, handler)
+ self.core.xmpp.add_event_handler(event_name, handler)
def del_sleek_event_handler(self, module, event_name, handler):
"""