diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-11-12 05:48:29 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-11-12 05:48:29 +0100 |
commit | 9e8706a2e8bfb5dc1242ca42f87a6e3df90d9138 (patch) | |
tree | 923660b9ece82fbe88bf65f30d54a843dfd1357f /plugins/gpg | |
parent | a97e6b548b32836e97e88e83fdb1d0073b15c8c1 (diff) | |
download | poezio-9e8706a2e8bfb5dc1242ca42f87a6e3df90d9138.tar.gz poezio-9e8706a2e8bfb5dc1242ca42f87a6e3df90d9138.tar.bz2 poezio-9e8706a2e8bfb5dc1242ca42f87a6e3df90d9138.tar.xz poezio-9e8706a2e8bfb5dc1242ca42f87a6e3df90d9138.zip |
a plugin can now add informations in ConversationTab’s InfoWin. And the GPG plugin does that.
Diffstat (limited to 'plugins/gpg')
-rw-r--r-- | plugins/gpg/__init__.py | 13 |
1 files changed, 13 insertions, 0 deletions
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() != '': |