comparison sat_pubsub/delegation.py @ 289:f08f8536cab8

mod delegation: extensions management (XEP-0128)
author Goffi <goffi@goffi.org>
date Sat, 18 Apr 2015 00:15:01 +0200
parents 073161f6f143
children 61fb4817b77f
comparison
equal deleted inserted replaced
288:073161f6f143 289:f08f8536cab8
23 This module implements XEP-0355 (Namespace delegation) to use SàT Pubsub as PEP service 23 This module implements XEP-0355 (Namespace delegation) to use SàT Pubsub as PEP service
24 """ 24 """
25 25
26 from wokkel.subprotocols import XMPPHandler 26 from wokkel.subprotocols import XMPPHandler
27 from wokkel import pubsub 27 from wokkel import pubsub
28 from wokkel import data_form
28 from wokkel import disco, iwokkel 29 from wokkel import disco, iwokkel
29 from twisted.python import log 30 from twisted.python import log
30 from twisted.words.protocols.jabber import error 31 from twisted.words.protocols.jabber import error
31 from zope.interface import implements 32 from zope.interface import implements
32 33
106 def gotInfos(infos): 107 def gotInfos(infos):
107 ns_features = [] 108 ns_features = []
108 for info in infos: 109 for info in infos:
109 if isinstance(info, disco.DiscoFeature) and info.startswith(namespace): 110 if isinstance(info, disco.DiscoFeature) and info.startswith(namespace):
110 ns_features.append(info) 111 ns_features.append(info)
112 elif (isinstance(info, data_form.Form) and info.formNamespace
113 and info.formNamespace.startwith(namespace)):
114 # extensions management (XEP-0128)
115 ns_features.append(info)
111 116
112 if namespace == pubsub.NS_PUBSUB: 117 if namespace == pubsub.NS_PUBSUB:
113 ns_features.append(disco.DiscoIdentity('pubsub', 'pep')) 118 ns_features.append(disco.DiscoIdentity('pubsub', 'pep'))
114 119
115 return ns_features 120 return ns_features