annotate sat_pubsub/tap.py @ 311:a776544d84e5

copyright update
author Goffi <goffi@goffi.org>
date Sun, 03 Jan 2016 18:28:34 +0100
parents 61f92273fb69
children 5d7c3787672e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
233
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
1 #!/usr/bin/python
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
2 #-*- coding: utf-8 -*-
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
3
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
4 """
311
a776544d84e5 copyright update
Goffi <goffi@goffi.org>
parents: 287
diff changeset
5 Copyright (c) 2012-2016 Jérôme Poisson
a776544d84e5 copyright update
Goffi <goffi@goffi.org>
parents: 287
diff changeset
6 Copyright (c) 2013-2016 Jérôme Poisson
235
64f780413b82 fixed Ralph Meijer copyright years (last commit was in 2011, not in 2009)
Goffi <goffi@goffi.org>
parents: 234
diff changeset
7 Copyright (c) 2003-2011 Ralph Meijer
233
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
8
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
9
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
10 This program is free software: you can redistribute it and/or modify
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
11 it under the terms of the GNU Affero General Public License as published by
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
12 the Free Software Foundation, either version 3 of the License, or
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
13 (at your option) any later version.
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
14
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
15 This program is distributed in the hope that it will be useful,
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
18 GNU Affero General Public License for more details.
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
19
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
20 You should have received a copy of the GNU Affero General Public License
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
22 --
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
23
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
24 This program is based on Idavoll (http://idavoll.ik.nu/),
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
25 originaly written by Ralph Meijer (http://ralphm.net/blog/)
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
26 It is sublicensed under AGPL v3 (or any later version) as allowed by the original
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
27 license.
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
28
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
29 --
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
30
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
31 Here is a copy of the original license:
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
32
235
64f780413b82 fixed Ralph Meijer copyright years (last commit was in 2011, not in 2009)
Goffi <goffi@goffi.org>
parents: 234
diff changeset
33 Copyright (c) 2003-2011 Ralph Meijer
233
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
34
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
35 Permission is hereby granted, free of charge, to any person obtaining
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
36 a copy of this software and associated documentation files (the
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
37 "Software"), to deal in the Software without restriction, including
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
38 without limitation the rights to use, copy, modify, merge, publish,
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
39 distribute, sublicense, and/or sell copies of the Software, and to
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
40 permit persons to whom the Software is furnished to do so, subject to
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
41 the following conditions:
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
42
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
43 The above copyright notice and this permission notice shall be
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
44 included in all copies or substantial portions of the Software.
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
45
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
46 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
47 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
48 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
49 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
50 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
51 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
52 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
53
564ae55219e1 sublicensed under AGPL V3
Goffi <goffi@goffi.org>
parents: 232
diff changeset
54 """
155
5191ba7c4df8 Work towards first release 0.5.0.
Ralph Meijer <ralphm@ik.nu>
parents: 97
diff changeset
55
167
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
56 from twisted.application import service
1
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
57 from twisted.python import usage
167
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
58 from twisted.words.protocols.jabber.jid import JID
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
59
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
60 from wokkel.component import Component
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
61 from wokkel.disco import DiscoHandler
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
62 from wokkel.generic import FallbackHandler, VersionHandler
222
698af5d720ad Reshape Idavoll as a PubSubResource.
Ralph Meijer <ralphm@ik.nu>
parents: 218
diff changeset
63 from wokkel.iwokkel import IPubSubResource
281
30895c49ebd2 fixes the imports from sat.tmp
souliane <souliane@mailoo.org>
parents: 280
diff changeset
64 from wokkel import pubsub, rsm, mam as wokkel_mam
167
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
65
281
30895c49ebd2 fixes the imports from sat.tmp
souliane <souliane@mailoo.org>
parents: 280
diff changeset
66 from sat_pubsub import __version__, const, mam
234
51af2ed8bd50 replaced idavoll imports by sat_pubsub imports
Goffi <goffi@goffi.org>
parents: 233
diff changeset
67 from sat_pubsub.backend import BackendService
285
a87c155d0fd5 replaced former roster dirty hack by a XEP-0356 first draft implementation, only roster get is implemented so far
Goffi <goffi@goffi.org>
parents: 283
diff changeset
68 from sat_pubsub.privilege import PrivilegesHandler
287
61f92273fb69 implementation of XEP-0355 (Namespace Delegation) to use SàT Pubsub as PEP service, first draft
Goffi <goffi@goffi.org>
parents: 285
diff changeset
69 from sat_pubsub.delegation import DelegationsHandler
167
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
70
280
798cb8962c0b MAM (XEP-0313) support: first draft
souliane <souliane@mailoo.org>
parents: 278
diff changeset
71
1
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
72 class Options(usage.Options):
156
6250905b72f6 Fix spacing errors. Do 0.5.0 release.
Ralph Meijer <ralphm@ik.nu>
parents: 155
diff changeset
73 optParameters = [
170
958e69630e52 Provide twistd parameters for connecting to a remote PostgreSQL database.
Ralph Meijer <ralphm@ik.nu>
parents: 169
diff changeset
74 ('jid', None, 'pubsub', 'JID this component will be available at'),
958e69630e52 Provide twistd parameters for connecting to a remote PostgreSQL database.
Ralph Meijer <ralphm@ik.nu>
parents: 169
diff changeset
75 ('secret', None, 'secret', 'Jabber server component secret'),
958e69630e52 Provide twistd parameters for connecting to a remote PostgreSQL database.
Ralph Meijer <ralphm@ik.nu>
parents: 169
diff changeset
76 ('rhost', None, '127.0.0.1', 'Jabber server host'),
958e69630e52 Provide twistd parameters for connecting to a remote PostgreSQL database.
Ralph Meijer <ralphm@ik.nu>
parents: 169
diff changeset
77 ('rport', None, '5347', 'Jabber server port'),
246
2a948abb77ed default backend value is now pgsql
Goffi <goffi@goffi.org>
parents: 242
diff changeset
78 ('backend', None, 'pgsql', 'Choice of storage backend'),
190
6e6c89eca9db Make sure optional PostgreSQL connect parameters are passed as None, require
Ralph Meijer <ralphm@ik.nu>
parents: 189
diff changeset
79 ('dbuser', None, None, 'Database user (pgsql backend)'),
170
958e69630e52 Provide twistd parameters for connecting to a remote PostgreSQL database.
Ralph Meijer <ralphm@ik.nu>
parents: 169
diff changeset
80 ('dbname', None, 'pubsub', 'Database name (pgsql backend)'),
190
6e6c89eca9db Make sure optional PostgreSQL connect parameters are passed as None, require
Ralph Meijer <ralphm@ik.nu>
parents: 189
diff changeset
81 ('dbpass', None, None, 'Database password (pgsql backend)'),
6e6c89eca9db Make sure optional PostgreSQL connect parameters are passed as None, require
Ralph Meijer <ralphm@ik.nu>
parents: 189
diff changeset
82 ('dbhost', None, None, 'Database host (pgsql backend)'),
6e6c89eca9db Make sure optional PostgreSQL connect parameters are passed as None, require
Ralph Meijer <ralphm@ik.nu>
parents: 189
diff changeset
83 ('dbport', None, None, 'Database port (pgsql backend)'),
156
6250905b72f6 Fix spacing errors. Do 0.5.0 release.
Ralph Meijer <ralphm@ik.nu>
parents: 155
diff changeset
84 ]
76
66fac7cd9edc Added -v (--verbose) flag to print out all traffic.
Ralph Meijer <ralphm@ik.nu>
parents: 42
diff changeset
85
156
6250905b72f6 Fix spacing errors. Do 0.5.0 release.
Ralph Meijer <ralphm@ik.nu>
parents: 155
diff changeset
86 optFlags = [
6250905b72f6 Fix spacing errors. Do 0.5.0 release.
Ralph Meijer <ralphm@ik.nu>
parents: 155
diff changeset
87 ('verbose', 'v', 'Show traffic'),
6250905b72f6 Fix spacing errors. Do 0.5.0 release.
Ralph Meijer <ralphm@ik.nu>
parents: 155
diff changeset
88 ('hide-nodes', None, 'Hide all nodes for disco')
6250905b72f6 Fix spacing errors. Do 0.5.0 release.
Ralph Meijer <ralphm@ik.nu>
parents: 155
diff changeset
89 ]
167
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
90
156
6250905b72f6 Fix spacing errors. Do 0.5.0 release.
Ralph Meijer <ralphm@ik.nu>
parents: 155
diff changeset
91 def postOptions(self):
6250905b72f6 Fix spacing errors. Do 0.5.0 release.
Ralph Meijer <ralphm@ik.nu>
parents: 155
diff changeset
92 if self['backend'] not in ['pgsql', 'memory']:
6250905b72f6 Fix spacing errors. Do 0.5.0 release.
Ralph Meijer <ralphm@ik.nu>
parents: 155
diff changeset
93 raise usage.UsageError, "Unknown backend!"
1
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
94
177
faf1c9bc2612 Add HTTP gateway in a separate plugin.
Ralph Meijer <ralphm@ik.nu>
parents: 176
diff changeset
95 self['jid'] = JID(self['jid'])
faf1c9bc2612 Add HTTP gateway in a separate plugin.
Ralph Meijer <ralphm@ik.nu>
parents: 176
diff changeset
96
222
698af5d720ad Reshape Idavoll as a PubSubResource.
Ralph Meijer <ralphm@ik.nu>
parents: 218
diff changeset
97
698af5d720ad Reshape Idavoll as a PubSubResource.
Ralph Meijer <ralphm@ik.nu>
parents: 218
diff changeset
98
1
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
99 def makeService(config):
167
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
100 s = service.MultiService()
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
101
176
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
102 # Create backend service with storage
167
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
103
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
104 if config['backend'] == 'pgsql':
204
b4bf0a5ce50d Implement storage facilities for the HTTP gateway.
Ralph Meijer <ralphm@ik.nu>
parents: 193
diff changeset
105 from twisted.enterprise import adbapi
234
51af2ed8bd50 replaced idavoll imports by sat_pubsub imports
Goffi <goffi@goffi.org>
parents: 233
diff changeset
106 from sat_pubsub.pgsql_storage import Storage
276
b757c29b20d7 import changes from idavoll changeset 233 (24be3a11ddbc), by Ralph Meijer and based on a patch by Nuno Santos
souliane <souliane@mailoo.org>
parents: 255
diff changeset
107 from psycopg2.extras import NamedTupleConnection
227
8540825f85e0 Replaced unmaintained pyPgSQL by Psycopg 2
Goffi <goffi@goffi.org>
parents: 223
diff changeset
108 dbpool = adbapi.ConnectionPool('psycopg2',
204
b4bf0a5ce50d Implement storage facilities for the HTTP gateway.
Ralph Meijer <ralphm@ik.nu>
parents: 193
diff changeset
109 user=config['dbuser'],
218
479fc959af0e Fix wrong use of configuration variables for pgsql db initialization.
Ralph Meijer <ralphm@ik.nu>
parents: 217
diff changeset
110 password=config['dbpass'],
204
b4bf0a5ce50d Implement storage facilities for the HTTP gateway.
Ralph Meijer <ralphm@ik.nu>
parents: 193
diff changeset
111 database=config['dbname'],
218
479fc959af0e Fix wrong use of configuration variables for pgsql db initialization.
Ralph Meijer <ralphm@ik.nu>
parents: 217
diff changeset
112 host=config['dbhost'],
204
b4bf0a5ce50d Implement storage facilities for the HTTP gateway.
Ralph Meijer <ralphm@ik.nu>
parents: 193
diff changeset
113 port=config['dbport'],
b4bf0a5ce50d Implement storage facilities for the HTTP gateway.
Ralph Meijer <ralphm@ik.nu>
parents: 193
diff changeset
114 cp_reconnect=True,
b4bf0a5ce50d Implement storage facilities for the HTTP gateway.
Ralph Meijer <ralphm@ik.nu>
parents: 193
diff changeset
115 client_encoding='utf-8',
276
b757c29b20d7 import changes from idavoll changeset 233 (24be3a11ddbc), by Ralph Meijer and based on a patch by Nuno Santos
souliane <souliane@mailoo.org>
parents: 255
diff changeset
116 connection_factory=NamedTupleConnection,
204
b4bf0a5ce50d Implement storage facilities for the HTTP gateway.
Ralph Meijer <ralphm@ik.nu>
parents: 193
diff changeset
117 )
b4bf0a5ce50d Implement storage facilities for the HTTP gateway.
Ralph Meijer <ralphm@ik.nu>
parents: 193
diff changeset
118 st = Storage(dbpool)
167
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
119 elif config['backend'] == 'memory':
234
51af2ed8bd50 replaced idavoll imports by sat_pubsub imports
Goffi <goffi@goffi.org>
parents: 233
diff changeset
120 from sat_pubsub.memory_storage import Storage
167
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
121 st = Storage()
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
122
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
123 bs = BackendService(st)
177
faf1c9bc2612 Add HTTP gateway in a separate plugin.
Ralph Meijer <ralphm@ik.nu>
parents: 176
diff changeset
124 bs.setName('backend')
167
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
125 bs.setServiceParent(s)
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
126
176
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
127 # Set up XMPP server-side component with publish-subscribe capabilities
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
128
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
129 cs = Component(config["rhost"], int(config["rport"]),
177
faf1c9bc2612 Add HTTP gateway in a separate plugin.
Ralph Meijer <ralphm@ik.nu>
parents: 176
diff changeset
130 config["jid"].full(), config["secret"])
faf1c9bc2612 Add HTTP gateway in a separate plugin.
Ralph Meijer <ralphm@ik.nu>
parents: 176
diff changeset
131 cs.setName('component')
176
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
132 cs.setServiceParent(s)
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
133
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
134 cs.factory.maxDelay = 900
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
135
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
136 if config["verbose"]:
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
137 cs.logTraffic = True
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
138
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
139 FallbackHandler().setHandlerParent(cs)
241
d2bdff8a4b45 changed version handler to SàT Pubsub
Goffi <goffi@goffi.org>
parents: 235
diff changeset
140 VersionHandler(u'SàT Pubsub', __version__).setHandlerParent(cs)
176
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
141 DiscoHandler().setHandlerParent(cs)
17fc5dd77158 Move around service setup.
Ralph Meijer <ralphm@ik.nu>
parents: 170
diff changeset
142
285
a87c155d0fd5 replaced former roster dirty hack by a XEP-0356 first draft implementation, only roster get is implemented so far
Goffi <goffi@goffi.org>
parents: 283
diff changeset
143 ph = PrivilegesHandler()
a87c155d0fd5 replaced former roster dirty hack by a XEP-0356 first draft implementation, only roster get is implemented so far
Goffi <goffi@goffi.org>
parents: 283
diff changeset
144 ph.setHandlerParent(cs)
a87c155d0fd5 replaced former roster dirty hack by a XEP-0356 first draft implementation, only roster get is implemented so far
Goffi <goffi@goffi.org>
parents: 283
diff changeset
145 bs.privilege = ph
a87c155d0fd5 replaced former roster dirty hack by a XEP-0356 first draft implementation, only roster get is implemented so far
Goffi <goffi@goffi.org>
parents: 283
diff changeset
146
287
61f92273fb69 implementation of XEP-0355 (Namespace Delegation) to use SàT Pubsub as PEP service, first draft
Goffi <goffi@goffi.org>
parents: 285
diff changeset
147 dh = DelegationsHandler()
61f92273fb69 implementation of XEP-0355 (Namespace Delegation) to use SàT Pubsub as PEP service, first draft
Goffi <goffi@goffi.org>
parents: 285
diff changeset
148 dh.setHandlerParent(cs)
61f92273fb69 implementation of XEP-0355 (Namespace Delegation) to use SàT Pubsub as PEP service, first draft
Goffi <goffi@goffi.org>
parents: 285
diff changeset
149 bs.delegation = dh
61f92273fb69 implementation of XEP-0355 (Namespace Delegation) to use SàT Pubsub as PEP service, first draft
Goffi <goffi@goffi.org>
parents: 285
diff changeset
150
222
698af5d720ad Reshape Idavoll as a PubSubResource.
Ralph Meijer <ralphm@ik.nu>
parents: 218
diff changeset
151 resource = IPubSubResource(bs)
698af5d720ad Reshape Idavoll as a PubSubResource.
Ralph Meijer <ralphm@ik.nu>
parents: 218
diff changeset
152 resource.hideNodes = config["hide-nodes"]
698af5d720ad Reshape Idavoll as a PubSubResource.
Ralph Meijer <ralphm@ik.nu>
parents: 218
diff changeset
153 resource.serviceJID = config["jid"]
698af5d720ad Reshape Idavoll as a PubSubResource.
Ralph Meijer <ralphm@ik.nu>
parents: 218
diff changeset
154
278
8a71486c3e95 implements RSM (XEP-0059)
souliane <souliane@mailoo.org>
parents: 276
diff changeset
155 ps = (rsm if const.FLAG_ENABLE_RSM else pubsub).PubSubService(resource)
169
96afb248df5e Fix typos in service creation. Make disco not respond when a resource is provided.
Ralph Meijer <ralphm@ik.nu>
parents: 167
diff changeset
156 ps.setHandlerParent(cs)
222
698af5d720ad Reshape Idavoll as a PubSubResource.
Ralph Meijer <ralphm@ik.nu>
parents: 218
diff changeset
157 resource.pubsubService = ps
167
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
158
280
798cb8962c0b MAM (XEP-0313) support: first draft
souliane <souliane@mailoo.org>
parents: 278
diff changeset
159 if const.FLAG_ENABLE_MAM:
282
7d54ff2eeaf2 actually retrieve the MAM messages
souliane <souliane@mailoo.org>
parents: 281
diff changeset
160 mam_resource = mam.MAMResource(bs)
281
30895c49ebd2 fixes the imports from sat.tmp
souliane <souliane@mailoo.org>
parents: 280
diff changeset
161 mam_s = wokkel_mam.MAMService(mam_resource)
280
798cb8962c0b MAM (XEP-0313) support: first draft
souliane <souliane@mailoo.org>
parents: 278
diff changeset
162 mam_s.setHandlerParent(cs)
798cb8962c0b MAM (XEP-0313) support: first draft
souliane <souliane@mailoo.org>
parents: 278
diff changeset
163
167
ef22e4150caa Move protocol implementations (pubsub, disco, forms) to and depend on wokkel.
Ralph Meijer <ralphm@ik.nu>
parents: 163
diff changeset
164 return s