[Pkg-telepathy-commits] ./packages/unstable/pymsn r43: Added 00-fix-dns-resolution.diff patch.

Jonny Lamb jonnylamb at jonnylamb.com
Wed Aug 6 11:02:16 UTC 2008


------------------------------------------------------------
revno: 43
committer: Jonny Lamb <jonnylamb at jonnylamb.com>
branch nick: debian
timestamp: Wed 2008-08-06 12:02:16 +0100
message:
  Added 00-fix-dns-resolution.diff patch.
added:
  patches/
  patches/00-fix-dns-resolution.diff
modified:
  changelog
-------------- next part --------------
=== modified file 'changelog'
--- a/changelog	2008-08-05 22:37:40 +0000
+++ b/changelog	2008-08-06 11:02:16 +0000
@@ -1,4 +1,4 @@
-pymsn (0.3.1-3) UNRELEASED; urgency=low
+pymsn (0.3.1-3) UNRELEASED; urgency=medium
 
   [ Simon McVittie ]
   * Use my debian.org address in Uploaders
@@ -9,8 +9,9 @@
   * Changed python-pyopenssl Build-Dep and Depends to python-openssl.
   * Upped Standards-Version to 3.8.0.
   * Removed python-adns dependency.
+  * Added 00-fix-dns-resolution.diff patch. (Closes: #493908)
 
- -- Jonny Lamb <jonnylamb at jonnylamb.com>  Tue, 05 Aug 2008 23:37:17 +0100
+ -- Jonny Lamb <jonnylamb at jonnylamb.com>  Tue, 05 Aug 2008 23:38:18 +0100
 
 pymsn (0.3.1-2) unstable; urgency=low
 

=== added directory 'patches'
=== added file 'patches/00-fix-dns-resolution.diff'
--- a/patches/00-fix-dns-resolution.diff	1970-01-01 00:00:00 +0000
+++ b/patches/00-fix-dns-resolution.diff	2008-08-06 11:02:16 +0000
@@ -0,0 +1,90 @@
+diff -Nruad -Nruad pymsn-0.3.1.orig/pymsn/gnet/resolver.py pymsn-0.3.1/pymsn/gnet/resolver.py
+--- pymsn-0.3.1.orig/pymsn/gnet/resolver.py	2007-10-28 08:21:45.000000000 +0000
++++ pymsn-0.3.1/pymsn/gnet/resolver.py	2008-08-05 23:25:27.000000000 +0100
+@@ -21,9 +21,10 @@
+ 
+ import socket
+ 
+-import adns
+ import gobject
+ 
++from pymsn.util.decorator import async
++
+ __all__ = ['HostnameResolver']
+ 
+ class HostnameResponse(object):
+@@ -51,38 +52,23 @@
+ 
+ class HostnameResolver(object):
+     def __init__(self):
+-        self._c = adns.init(adns.iflags.noautosys)
+         self._queries = {}
+ 
+     def query(self, host, callback):
+-        if self._is_ip(host):
+-            self._emit_response(callback, (0, None, 0, ((2, host),)))
+-            return
+-    
+-        query = self._c.submit(host, adns.rr.ADDR)
+-        self._queries[query] = host, callback
+-        if len(self._queries) == 1:
+-            gobject.timeout_add(10, self._process_queries)
+-
+-    def _is_ip(self, address):
+-        try:
+-            socket.inet_pton(socket.AF_INET, address)
+-        except socket.error:
+-            try:
+-                socket.inet_pton(socket.AF_INET6, address)
+-            except socket.error:
+-                return False
+-            return True
+-        return True
+-
+-    def _process_queries(self):
+-        for query in self._c.completed(0):
+-            response = query.check()
+-            qname, callback = self._queries[query]
+-            del self._queries[query]
+-            self._emit_response(callback, response)
+-        return len(self._queries) > 0
++        result = socket.getaddrinfo(host, None, socket.AF_INET, socket.SOCK_STREAM)
++        if len(result) == 0:
++            status = 1
++            cname = ''
++            expires = 0
++            addresses = ()
++        else:
++            status = 0
++            cname = result[0][3]
++            expires = 0
++            addresses = ((socket.AF_INET, result[0][4][0]),)
++        self._emit_response(callback, (status, cname, expires, addresses))
+ 
++    @async
+     def _emit_response(self, callback, response):
+         callback[0](HostnameResponse(response), *callback[1:])
+         return False
+diff -Nruad -Nruad pymsn-0.3.1.orig/pymsn/msnp/notification.py pymsn-0.3.1/pymsn/msnp/notification.py
+--- pymsn-0.3.1.orig/pymsn/msnp/notification.py	2008-01-09 10:41:09.000000000 +0000
++++ pymsn-0.3.1/pymsn/msnp/notification.py	2008-08-05 23:25:19.000000000 +0100
+@@ -248,7 +248,6 @@
+     # Handlers ---------------------------------------------------------------
+     # --------- Connection ---------------------------------------------------
+     def _handle_VER(self, command):
+-        assert(len(command.arguments) > 1), "Invalid VER response : " + str(command)
+         self._protocol_version = int(command.arguments[0].lstrip('MSNP'))
+         self._send_command('CVR',
+                 ProtocolConstant.CVR + (self._client.profile.account,))
+diff -Nruad -Nruad pymsn-0.3.1.orig/pymsn/util/decorator.py pymsn-0.3.1/pymsn/util/decorator.py
+--- pymsn-0.3.1.orig/pymsn/util/decorator.py	2007-12-24 16:50:57.000000000 +0000
++++ pymsn-0.3.1/pymsn/util/decorator.py	2008-08-06 11:59:16.000000000 +0100
+@@ -30,7 +30,7 @@
+     """decorator to be used on decorators, it preserves the docstring and
+     function attributes of functions to which it is applied."""
+     def new_decorator(f):
+-        g = decorator(f)
++        g = function(f)
+         g.__name__ = f.__name__
+         g.__doc__ = f.__doc__
+         g.__dict__.update(f.__dict__)



More information about the Pkg-telepathy-commits mailing list