changeset b1567f3877c9 in /home/hg/repos/gajim

author: Emmanuel Gil Peyrot <[email protected]>
branches: gajim_0.16
details:http://hg.gajim.org/gajim?cmd=changeset;node=b1567f3877c9
description: Make the port optional in <streamhost/>

        XEP-0065 section 9.2 says “The "port" attribute specifies the port to
        connect to.  This attribute MAY be present.  The value MUST be a valid
        port number in decimal form.  If not specified, the port value is
        "1080" (in accordance with RFC 1928).”

        This fixes a traceback when a streamhost is advertised with the default
        port.

diffstat:

 src/common/proxy65_manager.py |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r f769137e5867 -r b1567f3877c9 src/common/proxy65_manager.py
--- a/src/common/proxy65_manager.py     Sun Jul 17 00:41:34 2016 +0200
+++ b/src/common/proxy65_manager.py     Tue Aug 02 14:09:22 2016 +0100
@@ -84,9 +84,13 @@
         for item in query.getChildren():
             if item.getName() == 'streamhost':
                 host = item.getAttr('host')
+                jid = item.getAttr('jid')
                 port = item.getAttr('port')
-                jid = item.getAttr('jid')
-                if not host or not port or not jid:
+                try:
+                    port = int(port)
+                except ValueError, TypeError:
+                    port = 1080
+                if not host or not jid:
                     self.proxies[proxy]._on_connect_failure()
                 self.proxies[proxy].resolve_result(host, port, jid)
                 # we can have only one streamhost
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to