Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim-plugins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <forenjunkie@chello.at>2017-01-13 01:54:52 +0300
committerPhilipp Hörist <forenjunkie@chello.at>2017-01-13 01:54:52 +0300
commit07af0f4339c92c15686baa5757d8cb49e1791093 (patch)
tree99701074e78dfa91e0e2e0283181aee2fd72af5f /httpupload/httpupload.py
parenteddbe04bb9e06ed4d7e153e72b6847df1ed0dafa (diff)
[httpupload] Refactor error stanza handling
Diffstat (limited to 'httpupload/httpupload.py')
-rw-r--r--httpupload/httpupload.py38
1 files changed, 17 insertions, 21 deletions
diff --git a/httpupload/httpupload.py b/httpupload/httpupload.py
index 831a915..9d40288 100644
--- a/httpupload/httpupload.py
+++ b/httpupload/httpupload.py
@@ -334,20 +334,26 @@ class Base(object):
progress_messages = Queue(8)
event = threading.Event()
progress_window = ProgressWindow(_('HTTP Upload'), _('Requesting HTTP Upload Slot...'), progress_messages, self.plugin, event)
+
def upload_file(stanza):
+ if stanza.getType() == 'error':
+ ErrorDialog(_('Could not request upload slot'),
+ stanza.getErrorMsg(),
+ transient_for=self.chat_control.parent_win.window)
+ log.error(stanza)
+ progress_window.close_dialog()
+ return
+
slot = stanza.getTag("slot")
- if not slot:
+ if slot:
+ put = slot.getTag("put")
+ get = slot.getTag("get")
+ else:
progress_window.close_dialog()
- log.error("got unexpected stanza: "+str(stanza))
- error = stanza.getTag("error")
- if error and error.getTag("text"):
- ErrorDialog(_('Could not request upload slot'),
- _('Got unexpected response from server: %s') % str(error.getTagData("text")),
- transient_for=self.chat_control.parent_win.window)
- else:
- ErrorDialog(_('Could not request upload slot'),
- _('Got unexpected response from server (protocol mismatch??)'),
- transient_for=self.chat_control.parent_win.window)
+ log.error("got unexpected stanza: " + str(stanza))
+ ErrorDialog(_('Could not request upload slot'),
+ _('Got unexpected response from server (see log)'),
+ transient_for=self.chat_control.parent_win.window)
return
try:
@@ -369,16 +375,6 @@ class Base(object):
transient_for=self.chat_control.parent_win.window)
raise # fill error log with useful information
- put = slot.getTag("put")
- get = slot.getTag("get")
- if not put or not get:
- progress_window.close_dialog()
- log.error("got unexpected stanza: " + str(stanza))
- ErrorDialog(_('Could not request upload slot'),
- _('Got unexpected response from server (protocol mismatch??)'),
- transient_for=self.chat_control.parent_win.window)
- return
-
def upload_complete(response_code):
if isinstance(response_code, str):
# We got a error Message