From 9e8706a2e8bfb5dc1242ca42f87a6e3df90d9138 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sat, 12 Nov 2011 05:48:29 +0100 Subject: =?UTF-8?q?a=20plugin=20can=20now=20add=20informations=20in=20Conv?= =?UTF-8?q?ersationTab=E2=80=99s=20InfoWin.=20And=20the=20GPG=20plugin=20d?= =?UTF-8?q?oes=20that.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/gpg/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'plugins/gpg') diff --git a/plugins/gpg/__init__.py b/plugins/gpg/__init__.py index a2742d3c..873aa285 100644 --- a/plugins/gpg/__init__.py +++ b/plugins/gpg/__init__.py @@ -7,6 +7,7 @@ log = logging.getLogger(__name__) from plugin import BasePlugin +from tabs import ConversationTab NS_SIGNED = "jabber:x:signed" NS_ENCRYPTED = "jabber:x:encrypted" @@ -51,8 +52,11 @@ class Plugin(BasePlugin): self.add_event_handler('conversation_say_after', self.on_conversation_say) self.add_event_handler('conversation_msg', self.on_conversation_msg) + ConversationTab.add_information_element('gpg', self.display_encryption_status) + def cleanup(self): self.send_unsigned_presence() + ConversationTab.remove_information_element('gpg') def sign_presence(self, presence): """ @@ -138,6 +142,15 @@ class Plugin(BasePlugin): return message['body'] = str(decrypted) + def display_encryption_status(self, jid): + """ + Returns the status of encryption for the associated jid. This is to be used + in the ConversationTab’s InfoWin. + """ + if jid.full not in self.contacts.keys(): + return '' + return ' GPG Key: %s' % self.contacts[jid.full] + def remove_gpg_headers(self, text): lines = text.splitlines() while lines[0].strip() != '': -- cgit v1.2.3