Philipp Hörist pushed to branch master at gajim / gajim

Commits:

1 changed file:

Changes:

  • gajim/common/modules/ibb.py
    ... ... @@ -20,7 +20,7 @@
    20 20
     from nbxmpp.namespaces import Namespace
    
    21 21
     from nbxmpp.protocol import NodeProcessed
    
    22 22
     from nbxmpp.structs import StanzaHandler
    
    23
    -from nbxmpp.util import is_error_result
    
    23
    +from nbxmpp.errors import StanzaError
    
    24 24
     
    
    25 25
     from gajim.common import app
    
    26 26
     from gajim.common.helpers import to_user_string
    
    ... ... @@ -149,11 +149,15 @@ def send_open(self, to, sid, fp):
    149 149
                                           user_data=file_props)
    
    150 150
             return file_props
    
    151 151
     
    
    152
    -    def _on_open_result(self, result, file_props):
    
    153
    -        if is_error_result(result):
    
    154
    -            app.socks5queue.error_cb('Error', to_user_string(result))
    
    155
    -            self._log.warning(result)
    
    152
    +    def _on_open_result(self, task):
    
    153
    +        try:
    
    154
    +            task.finish()
    
    155
    +        except StanzaError as error:
    
    156
    +            app.socks5queue.error_cb('Error', to_user_string(error))
    
    157
    +            self._log.warning(error)
    
    156 158
                 return
    
    159
    +
    
    160
    +        file_props = task.get_user_data()
    
    157 161
             self.send_data(file_props)
    
    158 162
     
    
    159 163
         def send_close(self, file_props):
    
    ... ... @@ -183,10 +187,12 @@ def send_close(self, file_props):
    183 187
                 if session.weinitiate:
    
    184 188
                     session.cancel_session()
    
    185 189
     
    
    186
    -    def _on_close_result(self, result):
    
    187
    -        if is_error_result(result):
    
    188
    -            app.socks5queue.error_cb('Error', to_user_string(result))
    
    189
    -            self._log.warning(result)
    
    190
    +    def _on_close_result(self, task):
    
    191
    +        try:
    
    192
    +            task.finish()
    
    193
    +        except StanzaError as error:
    
    194
    +            app.socks5queue.error_cb('Error', to_user_string(error))
    
    195
    +            self._log.warning(error)
    
    190 196
                 return
    
    191 197
     
    
    192 198
         def send_data(self, file_props):
    
    ... ... @@ -217,11 +223,15 @@ def send_data(self, file_props):
    217 223
                     file_props.completed = True
    
    218 224
                 app.socks5queue.progress_transfer_cb(self._account, file_props)
    
    219 225
     
    
    220
    -    def _on_data_result(self, result, file_props):
    
    221
    -        if is_error_result(result):
    
    222
    -            app.socks5queue.error_cb('Error', to_user_string(result))
    
    223
    -            self._log.warning(result)
    
    226
    +    def _on_data_result(self, task):
    
    227
    +        try:
    
    228
    +            task.finish()
    
    229
    +        except StanzaError as error:
    
    230
    +            app.socks5queue.error_cb('Error', to_user_string(error))
    
    231
    +            self._log.warning(error)
    
    224 232
                 return
    
    233
    +
    
    234
    +        file_props = task.get_user_data()
    
    225 235
             self.send_data(file_props)
    
    226 236
     
    
    227 237