Philipp Hörist pushed to branch master at gajim / gajim
Commits:
8b3eb6d6 by lovetox at 2020-10-24T10:17:14+02:00
IBB: Adapt to nbxmpp changes
- - - - -
1 changed file:
- gajim/common/modules/ibb.py
Changes:
=====================================
gajim/common/modules/ibb.py
=====================================
@@ -20,7 +20,7 @@
from nbxmpp.namespaces import Namespace
from nbxmpp.protocol import NodeProcessed
from nbxmpp.structs import StanzaHandler
-from nbxmpp.util import is_error_result
+from nbxmpp.errors import StanzaError
from gajim.common import app
from gajim.common.helpers import to_user_string
@@ -149,11 +149,15 @@ def send_open(self, to, sid, fp):
user_data=file_props)
return file_props
- def _on_open_result(self, result, file_props):
- if is_error_result(result):
- app.socks5queue.error_cb('Error', to_user_string(result))
- self._log.warning(result)
+ def _on_open_result(self, task):
+ try:
+ task.finish()
+ except StanzaError as error:
+ app.socks5queue.error_cb('Error', to_user_string(error))
+ self._log.warning(error)
return
+
+ file_props = task.get_user_data()
self.send_data(file_props)
def send_close(self, file_props):
@@ -183,10 +187,12 @@ def send_close(self, file_props):
if session.weinitiate:
session.cancel_session()
- def _on_close_result(self, result):
- if is_error_result(result):
- app.socks5queue.error_cb('Error', to_user_string(result))
- self._log.warning(result)
+ def _on_close_result(self, task):
+ try:
+ task.finish()
+ except StanzaError as error:
+ app.socks5queue.error_cb('Error', to_user_string(error))
+ self._log.warning(error)
return
def send_data(self, file_props):
@@ -217,11 +223,15 @@ def send_data(self, file_props):
file_props.completed = True
app.socks5queue.progress_transfer_cb(self._account, file_props)
- def _on_data_result(self, result, file_props):
- if is_error_result(result):
- app.socks5queue.error_cb('Error', to_user_string(result))
- self._log.warning(result)
+ def _on_data_result(self, task):
+ try:
+ task.finish()
+ except StanzaError as error:
+ app.socks5queue.error_cb('Error', to_user_string(error))
+ self._log.warning(error)
return
+
+ file_props = task.get_user_data()
self.send_data(file_props)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/8b3eb6d6f0defe13575531a417d292f59d03209f
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/8b3eb6d6f0defe13575531a417d292f59d03209f
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits