diff options
Diffstat (limited to 'plugins')
-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() != '': |