diff options
author | mathieui <mathieui@mathieui.net> | 2013-03-08 22:53:35 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2013-03-08 22:53:35 +0100 |
commit | 9885203c6799c121f5bc8a733dc1937fe8c1b4d6 (patch) | |
tree | 4190635a7c9c78d2dce1a4c8357ccb887f12b8af /plugins/otr.py | |
parent | dbde08a5267cf003d8a4a9c16f5b18275e9a4bd1 (diff) | |
download | poezio-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/otr.py')
-rw-r--r-- | plugins/otr.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/plugins/otr.py b/plugins/otr.py index f3a1d7a2..4e900b84 100644 --- a/plugins/otr.py +++ b/plugins/otr.py @@ -13,10 +13,10 @@ class Plugin(BasePlugin): def init(self): self.contacts = {} # a dict of {full-JID: OTR object} - self.add_event_handler('conversation_say_after', self.on_conversation_say) - self.add_event_handler('conversation_msg', self.on_conversation_msg) + self.api.add_event_handler('conversation_say_after', self.on_conversation_say) + self.api.add_event_handler('conversation_msg', self.on_conversation_msg) - self.add_tab_command(ConversationTab, 'otr', self.command_otr, + self.api.add_tab_command(ConversationTab, 'otr', self.command_otr, usage='<start|end|fpr>', help='Start or stop OTR for the current conversation.', short='Manage OTR status', @@ -113,27 +113,27 @@ class Plugin(BasePlugin): """ args = args.split() if not args: - return self.core.command_help("otr") - if isinstance(self.core.current_tab(), ConversationTab): - jid = JID(self.core.current_tab().get_name()) + return self.api.run_command("/help otr") + if isinstance(self.api.current_tab(), ConversationTab): + jid = JID(self.api.current_tab().get_name()) command = args[0] if command == 'start': - otr_state = self.get_otr(self.core.current_tab()) - self.otr_say(self.core.current_tab(), otr_state.start().decode()) + otr_state = self.get_otr(self.api.current_tab()) + self.otr_say(self.api.current_tab(), otr_state.start().decode()) elif command == 'end': - otr_state = self.get_otr(self.core.current_tab()) + otr_state = self.get_otr(self.api.current_tab()) msg = otr_state.end() if msg is not None: - self.otr_say(self.core.current_tab(), msg.decode()) + self.otr_say(self.api.current_tab(), msg.decode()) elif command == 'fpr': - otr_state = self.get_otr(self.core.current_tab()) + otr_state = self.get_otr(self.api.current_tab()) our = otr_state.our_fpr if our: our = hex(int.from_bytes(our, 'big'))[2:].ljust(40).upper() their = otr_state.their_fpr if their: their = hex(int.from_bytes(their, 'big'))[2:].ljust(40).upper() - self.core.current_tab().add_message('Your: %s Their: %s' % (our, their)) + self.api.current_tab().add_message('Your: %s Their: %s' % (our, their)) self.core.refresh_window() def otr_completion(self, the_input): |