Skip to content
Snippets Groups Projects
Commit ca16e132 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Display warning message when cryptography is not installed

parent 841a1ee7
No related branches found
No related tags found
No related merge requests found
...@@ -45,6 +45,8 @@ try: ...@@ -45,6 +45,8 @@ try:
from cryptography.hazmat.primitives.ciphers.modes import GCM from cryptography.hazmat.primitives.ciphers.modes import GCM
decryption_available = True decryption_available = True
except Exception as e: except Exception as e:
DEP_MSG = 'For preview of encrypted images, ' \
'please install python-cryptography!'
log.debug('Cryptography Import Error: ' + str(e)) log.debug('Cryptography Import Error: ' + str(e))
log.info('Decryption/Encryption disabled due to errors') log.info('Decryption/Encryption disabled due to errors')
decryption_available = False decryption_available = False
...@@ -56,6 +58,8 @@ ACCEPTED_MIME_TYPES = ('image/png', 'image/jpeg', 'image/gif', 'image/raw', ...@@ -56,6 +58,8 @@ ACCEPTED_MIME_TYPES = ('image/png', 'image/jpeg', 'image/gif', 'image/raw',
class UrlImagePreviewPlugin(GajimPlugin): class UrlImagePreviewPlugin(GajimPlugin):
@log_calls('UrlImagePreviewPlugin') @log_calls('UrlImagePreviewPlugin')
def init(self): def init(self):
if not decryption_available:
self.available_text = DEP_MSG
self.config_dialog = UrlImagePreviewPluginConfigDialog(self) self.config_dialog = UrlImagePreviewPluginConfigDialog(self)
self.events_handlers = {} self.events_handlers = {}
self.events_handlers['message-received'] = ( self.events_handlers['message-received'] = (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment