changeset 8738c57fba91 in /home/hg/repos/gajim-plugins

author: lovetox <[email protected]>
branches: 
details:gajim-plugins?cmd=changeset;node=8738c57fba91
description: Display warning message when cryptography is not installed

diffstat:

 url_image_preview/url_image_preview.py |  4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diffs (21 lines):

diff -r 077431a5dbf5 -r 8738c57fba91 url_image_preview/url_image_preview.py
--- a/url_image_preview/url_image_preview.py    Wed Sep 07 23:01:26 2016 +0200
+++ b/url_image_preview/url_image_preview.py    Wed Sep 07 23:07:58 2016 +0200
@@ -45,6 +45,8 @@
     from cryptography.hazmat.primitives.ciphers.modes import GCM
     decryption_available = True
 except Exception as e:
+    DEP_MSG = 'For preview of encrypted images, ' \
+              'please install python-cryptography!'
     log.debug('Cryptography Import Error: ' + str(e))
     log.info('Decryption/Encryption disabled due to errors')
     decryption_available = False
@@ -56,6 +58,8 @@
 class UrlImagePreviewPlugin(GajimPlugin):
     @log_calls('UrlImagePreviewPlugin')
     def init(self):
+        if not decryption_available:
+            self.available_text = DEP_MSG
         self.config_dialog = UrlImagePreviewPluginConfigDialog(self)
         self.events_handlers = {}
         self.events_handlers['message-received'] = (
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to