diff src/plugins/plugin_xep_0115.py @ 667:a79a6843928c

plugin XEP-0115: changed node for "http://sat.goffi.org" + filtering using list comprehension instead of filter()
author Goffi <goffi@goffi.org>
date Tue, 05 Nov 2013 22:40:56 +0100
parents 84a6e83157c2
children bfabeedbf32e
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0115.py	Tue Nov 05 22:40:55 2013 +0100
+++ b/src/plugins/plugin_xep_0115.py	Tue Nov 05 22:40:56 2013 +0100
@@ -101,7 +101,7 @@
         presenceInst = client.presence
         c_elt = domish.Element((NS_ENTITY_CAPABILITY, 'c'))
         c_elt['hash'] = 'sha-1'
-        c_elt['node'] = 'http://wiki.goffi.org/wiki/Salut_%C3%A0_Toi'
+        c_elt['node'] = 'http://sat.goffi.org'
         c_elt['ver'] = XEP_0115.cap_hash
         presenceInst._c_elt = c_elt
         if "_legacy_send" in dir(presenceInst):
@@ -130,14 +130,14 @@
 
         def generateHash_2(services, profile):
             _s = []
-            byte_identities = [ByteIdentity(identity) for identity in filter(lambda x: isinstance(x, disco.DiscoIdentity), services)]  # FIXME: lang must be managed here
+            byte_identities = [ByteIdentity(service) for service in services if isinstance(service, disco.DiscoIdentity)]  # FIXME: lang must be managed here
             byte_identities.sort(key=lambda i: i.lang)
             byte_identities.sort(key=lambda i: i.idType)
             byte_identities.sort(key=lambda i: i.category)
             for identity in byte_identities:
                 _s.append(str(identity))
                 _s.append('<')
-            byte_features = [feature.encode('utf-8') for feature in filter(lambda x: isinstance(x, disco.DiscoFeature), services)]
+            byte_features = [service.encode('utf-8') for service in services if isinstance(service, disco.DiscoFeature)]
             byte_features.sort()  # XXX: the default sort has the same behaviour as the requested RFC 4790 i;octet sort
             for feature in byte_features:
                 _s.append(feature)