comparison sat_pubsub/tap.py @ 285:a87c155d0fd5

replaced former roster dirty hack by a XEP-0356 first draft implementation, only roster get is implemented so far
author Goffi <goffi@goffi.org>
date Tue, 31 Mar 2015 17:31:56 +0200
parents 002c59dbc23f
children 61f92273fb69
comparison
equal deleted inserted replaced
284:dfc47748d8d8 285:a87c155d0fd5
62 from wokkel.iwokkel import IPubSubResource 62 from wokkel.iwokkel import IPubSubResource
63 from wokkel import pubsub, rsm, mam as wokkel_mam 63 from wokkel import pubsub, rsm, mam as wokkel_mam
64 64
65 from sat_pubsub import __version__, const, mam 65 from sat_pubsub import __version__, const, mam
66 from sat_pubsub.backend import BackendService 66 from sat_pubsub.backend import BackendService
67 from sat_pubsub.remote_roster import RosterClient 67 from sat_pubsub.privilege import PrivilegesHandler
68 68
69 69
70 class Options(usage.Options): 70 class Options(usage.Options):
71 optParameters = [ 71 optParameters = [
72 ('jid', None, 'pubsub', 'JID this component will be available at'), 72 ('jid', None, 'pubsub', 'JID this component will be available at'),
136 136
137 FallbackHandler().setHandlerParent(cs) 137 FallbackHandler().setHandlerParent(cs)
138 VersionHandler(u'SàT Pubsub', __version__).setHandlerParent(cs) 138 VersionHandler(u'SàT Pubsub', __version__).setHandlerParent(cs)
139 DiscoHandler().setHandlerParent(cs) 139 DiscoHandler().setHandlerParent(cs)
140 140
141 ph = PrivilegesHandler()
142 ph.setHandlerParent(cs)
143 bs.privilege = ph
144
141 resource = IPubSubResource(bs) 145 resource = IPubSubResource(bs)
142 resource.hideNodes = config["hide-nodes"] 146 resource.hideNodes = config["hide-nodes"]
143 resource.serviceJID = config["jid"] 147 resource.serviceJID = config["jid"]
144 148
145 ps = (rsm if const.FLAG_ENABLE_RSM else pubsub).PubSubService(resource) 149 ps = (rsm if const.FLAG_ENABLE_RSM else pubsub).PubSubService(resource)
146 ps.setHandlerParent(cs) 150 ps.setHandlerParent(cs)
147 resource.pubsubService = ps 151 resource.pubsubService = ps
148 152
149 rc = RosterClient()
150 rc.setHandlerParent(cs)
151 bs.roster = rc
152
153 if const.FLAG_ENABLE_MAM: 153 if const.FLAG_ENABLE_MAM:
154 mam_resource = mam.MAMResource(bs) 154 mam_resource = mam.MAMResource(bs)
155 mam_s = wokkel_mam.MAMService(mam_resource) 155 mam_s = wokkel_mam.MAMService(mam_resource)
156 mam_s.setHandlerParent(cs) 156 mam_s.setHandlerParent(cs)
157 157