Philipp Hörist pushed to branch gajim_1.1 at gajim / gajim
Commits: 9419e8dd by Philipp Hörist at 2019-02-15T15:35:44Z Fix deprecation warning
set_cipher_list wants bytes
- - - - - 05f1c780 by Philipp Hörist at 2019-02-15T15:35:56Z XTLS: Fix endless loop on write error
- - - - - a1d68677 by Philipp Hörist at 2019-02-15T15:35:57Z Dont fail on urn:xmpp:hashes:1
Fixes #9514
- - - - - 4189d5b9 by Philipp Hörist at 2019-02-15T15:35:57Z Fix filetransfer tooltip
- - - - -
5 changed files:
- gajim/common/app.py - gajim/common/jingle_session.py - gajim/common/jingle_xtls.py - gajim/common/socks5.py - gajim/tooltips.py
Changes:
===================================== gajim/common/app.py ===================================== @@ -148,6 +148,7 @@ socks5queue = None gupnp_igd = None
gajim_identity = {'type': 'pc', 'category': 'client', 'name': 'Gajim'} + gajim_common_features = [nbxmpp.NS_BYTESTREAM, nbxmpp.NS_SI, nbxmpp.NS_FILE, nbxmpp.NS_MUC, nbxmpp.NS_MUC_USER, nbxmpp.NS_MUC_ADMIN, nbxmpp.NS_MUC_OWNER, nbxmpp.NS_MUC_CONFIG, nbxmpp.NS_COMMANDS, nbxmpp.NS_DISCO_INFO, 'ipv6',
===================================== gajim/common/jingle_session.py ===================================== @@ -445,6 +445,8 @@ class JingleSession: if child.getName() == 'checksum': hash_ = child.getTag('file').getTag(name='hash', namespace=nbxmpp.NS_HASHES_2) + if hash_ is None: + continue algo = hash_.getAttr('algo') if algo in nbxmpp.Hashes2.supported: 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): flags = (SSL.OP_NO_SSLv2 | SSL.OP_NO_SSLv3 | SSL.OP_SINGLE_DH_USE \ | SSL.OP_NO_TICKET) ctx.set_options(flags) - ctx.set_cipher_list('HIGH:!aNULL:!3DES') + ctx.set_cipher_list(b'HIGH:!aNULL:!3DES')
if fingerprint == 'server': # for testing purposes only ctx.set_verify(SSL.VERIFY_NONE|SSL.VERIFY_FAIL_IF_NO_PEER_CERT,
===================================== gajim/common/socks5.py ===================================== @@ -687,13 +687,11 @@ class Socks5: OpenSSL.SSL.WantX509LookupError) as e: log.info('SSL rehandshake request: %s', repr(e)) raise e + except OpenSSL.SSL.SysCallError: + return self._on_send_exception() except Exception as e: if e.errno not in (EINTR, ENOBUFS, EWOULDBLOCK): - # peer stopped reading - self.state = 8 # end connection - self.disconnect() - self.file_props.error = -1 - return -1 + return self._on_send_exception() self.size += lenn current_time = time.time() self.file_props.elapsed_time += current_time - \ @@ -719,6 +717,13 @@ class Socks5: self.disconnect() return -1
+ def _on_send_exception(self): + # peer stopped reading + self.state = 8 # end connection + self.disconnect() + self.file_props.error = -1 + return -1 + def get_file_contents(self, timeout): """ Read file contents from socket and write them to file
===================================== gajim/tooltips.py ===================================== @@ -609,8 +609,7 @@ class FileTransfersTooltip(): self.sid = sid return False, self.widget
- @staticmethod - def _create_tooltip(file_props, sid): + def _create_tooltip(self, file_props, _sid): ft_table = Gtk.Table(2, 1) ft_table.set_property('column-spacing', 2) current_row = 1 @@ -642,26 +641,7 @@ class FileTransfersTooltip(): if not transfered_len: transfered_len = 0 properties.append((_('Transferred: '), helpers.convert_bytes(transfered_len))) - status = '' - if file_props.started: - status = _('Not started') - if file_props.stopped: - status = _('Stopped') - elif file_props.completed: - status = _('Completed') - elif not file_props.connected: - if file_props.completed: - status = _('Completed') - else: - if file_props.paused: - status = Q_('?transfer status:Paused') - elif file_props.stalled: - # stalled is not paused. it is like 'frozen' it stopped alone - status = _('Stalled') - else: - status = _('Transferring') - else: - status = _('Not started') + status = self._get_current_status(file_props) properties.append((_('Status: '), status)) file_desc = file_props.desc or '' properties.append((_('Description: '), GLib.markup_escape_text( @@ -686,6 +666,24 @@ class FileTransfersTooltip(): ft_table.show_all() return ft_table
+ @staticmethod + def _get_current_status(file_props): + if file_props.stopped: + return _('Aborted') + if file_props.completed: + return _('Completed') + if file_props.paused: + return Q_('?transfer status:Paused') + if file_props.stalled: + # stalled is not paused. it is like 'frozen' it stopped alone + return _('Stalled') + + if file_props.connected: + if file_props.started: + return _('Transferring') + return _('Not started') + return _('Not started') +
def colorize_status(status): """
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/bf9aed69fe6384772ea4ab849a54881b44...