diff --git a/httpupload/httpupload.py b/httpupload/httpupload.py index e845e3dca1a8435fc0e3aef7a3a87ca2fadb47f3..5c997786290caccf098118a2117979d6d18e83f8 100644 --- a/httpupload/httpupload.py +++ b/httpupload/httpupload.py @@ -282,13 +282,10 @@ class Base(object): account = self.chat_control.account for plugin in gajim.plugin_manager.active_plugins: if type(plugin).__name__ == 'OmemoPlugin': - omemo = plugin - break - if omemo: - state = omemo.get_omemo_state(account) - log.info('Encryption is: ' + - str(state.encryption.is_active(jid))) - return state.encryption.is_active(jid) + state = plugin.get_omemo_state(account) + log.info('Encryption is: ' + + str(state.encryption.is_active(jid))) + return state.encryption.is_active(jid) log.info('Encryption is: False / OMEMO not found') return False @@ -381,8 +378,12 @@ class Base(object): return def upload_complete(response_code): - if response_code == 0: - return # Upload was aborted + if isinstance(response_code, str): + # We got a error Message + ErrorDialog( + _('Error'), response_code, + transient_for=self.chat_control.parent_win.window) + return if response_code >= 200 and response_code < 300: log.info("Upload completed successfully") xhtml = None @@ -478,15 +479,10 @@ class Base(object): transfer = urllib2.urlopen(request, timeout=30) log.debug("urllib2 upload request done, response code: " + str(transfer.getcode())) return transfer.getcode() - except UploadAbortedException: - log.info("Upload aborted") - except: - progress_window.close_dialog() - ErrorDialog(_('Could not upload file'), - _('Got unexpected exception while uploading file (see error log for more information)'), - transient_for=self.chat_control.parent_win.window) - raise # fill error log with useful information - return 0 + except Exception as error: + gobject.idle_add(progress_window.close_dialog) + log.exception('Error') + return str(error) log.info("Uploading file to '%s'..." % str(put.getData())) log.info("Please download from '%s' later..." % str(get.getData())) diff --git a/httpupload/manifest.ini b/httpupload/manifest.ini index 8b93cb4024ee90e4f73f1dcf589d35fc02401884..b76d19ae32e6822d14c39f61437a3607a0395749 100644 --- a/httpupload/manifest.ini +++ b/httpupload/manifest.ini @@ -1,7 +1,7 @@ [info] name: HttpUpload short_name: httpupload -version: 0.4.1 +version: 0.4.2 description: This plugin is designed to send a file to a contact or muc by using httpupload.<br/> Your server must support <a href="http://xmpp.org/extensions/xep-0363.html">XEP-0363: HTTP Upload</a>.<br/> Conversations supported this.<br/> @@ -10,6 +10,6 @@ description: This plugin is designed to send a file to a contact or muc by using If the receiving side doesn't support this, only a text message containing the link to the image is send. authors: Thilo Molitor <thilo@eightysoft.de> Philipp Hörist <philipp@hoerist.com> -homepage: https://trac-plugins.gajim.org/wiki/HttpUploadPlugin +homepage: https://dev.gajim.org/gajim/gajim-plugins/wikis/HttpUploadPlugin min_gajim_version: 0.16.5 max_gajim_version: 0.16.9