From 9885203c6799c121f5bc8a733dc1937fe8c1b4d6 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 8 Mar 2013 22:53:35 +0100 Subject: 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 --- src/core.py | 8 ++++++-- src/plugin.py | 12 +++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'src') 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): """ -- cgit v1.2.3