Philipp Hörist pushed to branch gajim_1.1 at gajim / gajim

Commits:

5 changed files:

Changes:

  • gajim/common/app.py
    ... ... @@ -148,6 +148,7 @@ socks5queue = None
    148 148
     gupnp_igd = None
    
    149 149
     
    
    150 150
     gajim_identity = {'type': 'pc', 'category': 'client', 'name': 'Gajim'}
    
    151
    +
    
    151 152
     gajim_common_features = [nbxmpp.NS_BYTESTREAM, nbxmpp.NS_SI, nbxmpp.NS_FILE,
    
    152 153
         nbxmpp.NS_MUC, nbxmpp.NS_MUC_USER, nbxmpp.NS_MUC_ADMIN, nbxmpp.NS_MUC_OWNER,
    
    153 154
         nbxmpp.NS_MUC_CONFIG, nbxmpp.NS_COMMANDS, nbxmpp.NS_DISCO_INFO, 'ipv6',
    

  • gajim/common/jingle_session.py
    ... ... @@ -445,6 +445,8 @@ class JingleSession:
    445 445
                 if child.getName() == 'checksum':
    
    446 446
                     hash_ = child.getTag('file').getTag(name='hash',
    
    447 447
                                                         namespace=nbxmpp.NS_HASHES_2)
    
    448
    +                if hash_ is None:
    
    449
    +                    continue
    
    448 450
                     algo = hash_.getAttr('algo')
    
    449 451
                     if algo in nbxmpp.Hashes2.supported:
    
    450 452
                         file_props = FilesProp.getFileProp(self.connection.name,
    

  • gajim/common/jingle_xtls.py
    ... ... @@ -100,7 +100,7 @@ def get_context(fingerprint, verify_cb=None, remote_jid=None):
    100 100
         flags = (SSL.OP_NO_SSLv2 | SSL.OP_NO_SSLv3 | SSL.OP_SINGLE_DH_USE \
    
    101 101
                  | SSL.OP_NO_TICKET)
    
    102 102
         ctx.set_options(flags)
    
    103
    -    ctx.set_cipher_list('HIGH:!aNULL:!3DES')
    
    103
    +    ctx.set_cipher_list(b'HIGH:!aNULL:!3DES')
    
    104 104
     
    
    105 105
         if fingerprint == 'server': # for testing purposes only
    
    106 106
             ctx.set_verify(SSL.VERIFY_NONE|SSL.VERIFY_FAIL_IF_NO_PEER_CERT,
    

  • gajim/common/socks5.py
    ... ... @@ -687,13 +687,11 @@ class Socks5:
    687 687
                 OpenSSL.SSL.WantX509LookupError) as e:
    
    688 688
                     log.info('SSL rehandshake request: %s', repr(e))
    
    689 689
                     raise e
    
    690
    +            except OpenSSL.SSL.SysCallError:
    
    691
    +                return self._on_send_exception()
    
    690 692
                 except Exception as e:
    
    691 693
                     if e.errno not in (EINTR, ENOBUFS, EWOULDBLOCK):
    
    692
    -                    # peer stopped reading
    
    693
    -                    self.state = 8 # end connection
    
    694
    -                    self.disconnect()
    
    695
    -                    self.file_props.error = -1
    
    696
    -                    return -1
    
    694
    +                    return self._on_send_exception()
    
    697 695
                 self.size += lenn
    
    698 696
                 current_time = time.time()
    
    699 697
                 self.file_props.elapsed_time += current_time - \
    
    ... ... @@ -719,6 +717,13 @@ class Socks5:
    719 717
                 self.disconnect()
    
    720 718
                 return -1
    
    721 719
     
    
    720
    +    def _on_send_exception(self):
    
    721
    +        # peer stopped reading
    
    722
    +        self.state = 8 # end connection
    
    723
    +        self.disconnect()
    
    724
    +        self.file_props.error = -1
    
    725
    +        return -1
    
    726
    +
    
    722 727
         def get_file_contents(self, timeout):
    
    723 728
             """
    
    724 729
             Read file contents from socket and write them to file
    

  • gajim/tooltips.py
    ... ... @@ -609,8 +609,7 @@ class FileTransfersTooltip():
    609 609
             self.sid = sid
    
    610 610
             return False, self.widget
    
    611 611
     
    
    612
    -    @staticmethod
    
    613
    -    def _create_tooltip(file_props, sid):
    
    612
    +    def _create_tooltip(self, file_props, _sid):
    
    614 613
             ft_table = Gtk.Table(2, 1)
    
    615 614
             ft_table.set_property('column-spacing', 2)
    
    616 615
             current_row = 1
    
    ... ... @@ -642,26 +641,7 @@ class FileTransfersTooltip():
    642 641
             if not transfered_len:
    
    643 642
                 transfered_len = 0
    
    644 643
             properties.append((_('Transferred: '), helpers.convert_bytes(transfered_len)))
    
    645
    -        status = ''
    
    646
    -        if file_props.started:
    
    647
    -            status = _('Not started')
    
    648
    -        if file_props.stopped:
    
    649
    -            status = _('Stopped')
    
    650
    -        elif file_props.completed:
    
    651
    -            status = _('Completed')
    
    652
    -        elif not file_props.connected:
    
    653
    -            if file_props.completed:
    
    654
    -                status = _('Completed')
    
    655
    -            else:
    
    656
    -                if file_props.paused:
    
    657
    -                    status = Q_('?transfer status:Paused')
    
    658
    -                elif file_props.stalled:
    
    659
    -                    # stalled is not paused. it is like 'frozen' it stopped alone
    
    660
    -                    status = _('Stalled')
    
    661
    -                else:
    
    662
    -                    status = _('Transferring')
    
    663
    -        else:
    
    664
    -            status = _('Not started')
    
    644
    +        status = self._get_current_status(file_props)
    
    665 645
             properties.append((_('Status: '), status))
    
    666 646
             file_desc = file_props.desc or ''
    
    667 647
             properties.append((_('Description: '), GLib.markup_escape_text(
    
    ... ... @@ -686,6 +666,24 @@ class FileTransfersTooltip():
    686 666
             ft_table.show_all()
    
    687 667
             return ft_table
    
    688 668
     
    
    669
    +    @staticmethod
    
    670
    +    def _get_current_status(file_props):
    
    671
    +        if file_props.stopped:
    
    672
    +            return _('Aborted')
    
    673
    +        if file_props.completed:
    
    674
    +            return _('Completed')
    
    675
    +        if file_props.paused:
    
    676
    +            return Q_('?transfer status:Paused')
    
    677
    +        if file_props.stalled:
    
    678
    +            # stalled is not paused. it is like 'frozen' it stopped alone
    
    679
    +            return _('Stalled')
    
    680
    +
    
    681
    +        if file_props.connected:
    
    682
    +            if file_props.started:
    
    683
    +                return _('Transferring')
    
    684
    +            return _('Not started')
    
    685
    +        return _('Not started')
    
    686
    +
    
    689 687
     
    
    690 688
     def colorize_status(status):
    
    691 689
         """