Mercurial > libervia-backend
annotate src/tmp/wokkel/pubsub.py @ 2066:09c18fcd8225
plugin XEP-0045, quick frontend (app,chat): various chat improvments:
- (XEP-0045): join defered is now fired when room is full joined and history is available
- (XEP-0045): mucJOIN signature has changed, it now returns the same arguments as mucRoomJoined and a boolean which is True if the room was alread joined
- quick frontend (app, chat): adapted code to new changes
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 09 Sep 2016 23:54:33 +0200 |
parents | 666ab06a9d81 |
children | 44f12990e275 |
rev | line source |
---|---|
1424 | 1 # -*- coding: utf-8 -*- |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
2 # -*- test-case-name: wokkel.test.test_pubsub -*- |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
3 # |
1422 | 4 # SàT adaptation for wokkel.pubsub |
5 # Copyright (C) 2015 Adien Cossa (souliane@mailoo.org) | |
6 # Copyright (c) 2003-2012 Ralph Meijer. | |
7 | |
8 # This program is free software: you can redistribute it and/or modify | |
9 # it under the terms of the GNU Affero General Public License as published by | |
10 # the Free Software Foundation, either version 3 of the License, or | |
11 # (at your option) any later version. | |
12 | |
13 # This program is distributed in the hope that it will be useful, | |
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 # GNU Affero General Public License for more details. | |
17 | |
18 # You should have received a copy of the GNU Affero General Public License | |
19 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 # -- | |
21 | |
22 # This program is based on wokkel (https://wokkel.ik.nu/), | |
23 # originaly written by Ralph Meijer | |
24 # It is sublicensed under AGPL v3 (or any later version) as allowed by the original | |
25 # license. | |
26 | |
27 # -- | |
28 | |
29 # Here is a copy of the original license: | |
30 | |
31 # Copyright (c) 2003-2012 Ralph Meijer. | |
32 # | |
33 # Permission is hereby granted, free of charge, to any person obtaining | |
34 # a copy of this software and associated documentation files (the | |
35 # "Software"), to deal in the Software without restriction, including | |
36 # without limitation the rights to use, copy, modify, merge, publish, | |
37 # distribute, sublicense, and/or sell copies of the Software, and to | |
38 # permit persons to whom the Software is furnished to do so, subject to | |
39 # the following conditions: | |
40 # | |
41 # The above copyright notice and this permission notice shall be | |
42 # included in all copies or substantial portions of the Software. | |
43 # | |
44 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
45 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
46 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
47 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
48 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
49 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
50 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
51 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
52 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
53 XMPP publish-subscribe protocol. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
54 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
55 This protocol is specified in |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
56 U{XEP-0060<http://xmpp.org/extensions/xep-0060.html>}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
57 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
58 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
59 from zope.interface import implements |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
60 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
61 from twisted.internet import defer |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
62 from twisted.python import log |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
63 from twisted.words.protocols.jabber import jid, error |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
64 from twisted.words.xish import domish |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
65 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
66 from wokkel import disco, data_form, generic, shim |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
67 from wokkel.compat import IQ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
68 from wokkel.subprotocols import IQHandlerMixin, XMPPHandler |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
69 from wokkel.iwokkel import IPubSubClient, IPubSubService, IPubSubResource |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
70 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
71 # Iq get and set XPath queries |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
72 IQ_GET = '/iq[@type="get"]' |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
73 IQ_SET = '/iq[@type="set"]' |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
74 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
75 # Publish-subscribe namespaces |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
76 NS_PUBSUB = 'http://jabber.org/protocol/pubsub' |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
77 NS_PUBSUB_EVENT = NS_PUBSUB + '#event' |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
78 NS_PUBSUB_ERRORS = NS_PUBSUB + '#errors' |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
79 NS_PUBSUB_OWNER = NS_PUBSUB + "#owner" |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
80 NS_PUBSUB_NODE_CONFIG = NS_PUBSUB + "#node_config" |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
81 NS_PUBSUB_META_DATA = NS_PUBSUB + "#meta-data" |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
82 NS_PUBSUB_SUBSCRIBE_OPTIONS = NS_PUBSUB + "#subscribe_options" |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
83 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
84 # XPath to match pubsub requests |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
85 PUBSUB_REQUEST = '/iq[@type="get" or @type="set"]/' + \ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
86 'pubsub[@xmlns="' + NS_PUBSUB + '" or ' + \ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
87 '@xmlns="' + NS_PUBSUB_OWNER + '"]' |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
88 |
1457
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
89 BOOL_TRUE = ('1','true') |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
90 BOOL_FALSE = ('0','false') |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
91 |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
92 class SubscriptionPending(Exception): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
93 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
94 Raised when the requested subscription is pending acceptance. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
95 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
96 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
97 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
98 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
99 class SubscriptionUnconfigured(Exception): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
100 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
101 Raised when the requested subscription needs to be configured before |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
102 becoming active. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
103 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
104 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
105 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
106 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
107 class PubSubError(error.StanzaError): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
108 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
109 Exception with publish-subscribe specific condition. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
110 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
111 def __init__(self, condition, pubsubCondition, feature=None, text=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
112 appCondition = domish.Element((NS_PUBSUB_ERRORS, pubsubCondition)) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
113 if feature: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
114 appCondition['feature'] = feature |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
115 error.StanzaError.__init__(self, condition, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
116 text=text, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
117 appCondition=appCondition) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
118 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
119 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
120 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
121 class BadRequest(error.StanzaError): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
122 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
123 Bad request stanza error. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
124 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
125 def __init__(self, pubsubCondition=None, text=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
126 if pubsubCondition: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
127 appCondition = domish.Element((NS_PUBSUB_ERRORS, pubsubCondition)) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
128 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
129 appCondition = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
130 error.StanzaError.__init__(self, 'bad-request', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
131 text=text, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
132 appCondition=appCondition) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
133 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
134 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
135 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
136 class Unsupported(PubSubError): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
137 def __init__(self, feature, text=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
138 self.feature = feature |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
139 PubSubError.__init__(self, 'feature-not-implemented', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
140 'unsupported', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
141 feature, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
142 text) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
143 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
144 def __str__(self): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
145 message = PubSubError.__str__(self) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
146 message += ', feature %r' % self.feature |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
147 return message |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
148 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
149 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
150 class Subscription(object): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
151 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
152 A subscription to a node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
153 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
154 @ivar nodeIdentifier: The identifier of the node subscribed to. The root |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
155 node is denoted by C{None}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
156 @type nodeIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
157 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
158 @ivar subscriber: The subscribing entity. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
159 @type subscriber: L{jid.JID} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
160 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
161 @ivar state: The subscription state. One of C{'subscribed'}, C{'pending'}, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
162 C{'unconfigured'}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
163 @type state: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
164 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
165 @ivar options: Optional list of subscription options. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
166 @type options: C{dict} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
167 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
168 @ivar subscriptionIdentifier: Optional subscription identifier. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
169 @type subscriptionIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
170 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
171 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
172 def __init__(self, nodeIdentifier, subscriber, state, options=None, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
173 subscriptionIdentifier=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
174 self.nodeIdentifier = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
175 self.subscriber = subscriber |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
176 self.state = state |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
177 self.options = options or {} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
178 self.subscriptionIdentifier = subscriptionIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
179 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
180 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
181 @staticmethod |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
182 def fromElement(element): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
183 return Subscription( |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
184 element.getAttribute('node'), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
185 jid.JID(element.getAttribute('jid')), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
186 element.getAttribute('subscription'), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
187 subscriptionIdentifier=element.getAttribute('subid')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
188 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
189 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
190 def toElement(self, defaultUri=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
191 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
192 Return the DOM representation of this subscription. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
193 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
194 @rtype: L{domish.Element} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
195 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
196 element = domish.Element((defaultUri, 'subscription')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
197 if self.nodeIdentifier: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
198 element['node'] = self.nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
199 element['jid'] = unicode(self.subscriber) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
200 element['subscription'] = self.state |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
201 if self.subscriptionIdentifier: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
202 element['subid'] = self.subscriptionIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
203 return element |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
204 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
205 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
206 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
207 class Item(domish.Element): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
208 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
209 Publish subscribe item. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
210 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
211 This behaves like an object providing L{domish.IElement}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
212 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
213 Item payload can be added using C{addChild} or C{addRawXml}, or using the |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
214 C{payload} keyword argument to C{__init__}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
215 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
216 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
217 def __init__(self, id=None, payload=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
218 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
219 @param id: optional item identifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
220 @type id: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
221 @param payload: optional item payload. Either as a domish element, or |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
222 as serialized XML. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
223 @type payload: object providing L{domish.IElement} or C{unicode}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
224 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
225 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
226 domish.Element.__init__(self, (None, 'item')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
227 if id is not None: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
228 self['id'] = id |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
229 if payload is not None: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
230 if isinstance(payload, basestring): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
231 self.addRawXml(payload) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
232 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
233 self.addChild(payload) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
234 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
235 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
236 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
237 class PubSubRequest(generic.Stanza): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
238 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
239 A publish-subscribe request. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
240 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
241 The set of instance variables used depends on the type of request. If |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
242 a variable is not applicable or not passed in the request, its value is |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
243 C{None}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
244 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
245 @ivar verb: The type of publish-subscribe request. See C{_requestVerbMap}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
246 @type verb: C{str}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
247 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
248 @ivar affiliations: Affiliations to be modified. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
249 @type affiliations: C{set} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
250 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
251 @ivar items: The items to be published, as L{domish.Element}s. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
252 @type items: C{list} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
253 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
254 @ivar itemIdentifiers: Identifiers of the items to be retrieved or |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
255 retracted. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
256 @type itemIdentifiers: C{set} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
257 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
258 @ivar maxItems: Maximum number of items to retrieve. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
259 @type maxItems: C{int}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
260 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
261 @ivar nodeIdentifier: Identifier of the node the request is about. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
262 @type nodeIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
263 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
264 @ivar nodeType: The type of node that should be created, or for which the |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
265 configuration is retrieved. C{'leaf'} or C{'collection'}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
266 @type nodeType: C{str} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
267 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
268 @ivar options: Configurations options for nodes, subscriptions and publish |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
269 requests. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
270 @type options: L{data_form.Form} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
271 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
272 @ivar subscriber: The subscribing entity. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
273 @type subscriber: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
274 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
275 @ivar subscriptionIdentifier: Identifier for a specific subscription. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
276 @type subscriptionIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
277 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
278 @ivar subscriptions: Subscriptions to be modified, as a set of |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
279 L{Subscription}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
280 @type subscriptions: C{set} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
281 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
282 @ivar affiliations: Affiliations to be modified, as a dictionary of entity |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
283 (L{JID<twisted.words.protocols.jabber.jid.JID>} to affiliation |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
284 (C{unicode}). |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
285 @type affiliations: C{dict} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
286 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
287 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
288 verb = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
289 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
290 affiliations = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
291 items = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
292 itemIdentifiers = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
293 maxItems = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
294 nodeIdentifier = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
295 nodeType = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
296 options = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
297 subscriber = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
298 subscriptionIdentifier = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
299 subscriptions = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
300 affiliations = None |
1457
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
301 notify = None |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
302 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
303 # Map request iq type and subelement name to request verb |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
304 _requestVerbMap = { |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
305 ('set', NS_PUBSUB, 'publish'): 'publish', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
306 ('set', NS_PUBSUB, 'subscribe'): 'subscribe', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
307 ('set', NS_PUBSUB, 'unsubscribe'): 'unsubscribe', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
308 ('get', NS_PUBSUB, 'options'): 'optionsGet', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
309 ('set', NS_PUBSUB, 'options'): 'optionsSet', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
310 ('get', NS_PUBSUB, 'subscriptions'): 'subscriptions', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
311 ('get', NS_PUBSUB, 'affiliations'): 'affiliations', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
312 ('set', NS_PUBSUB, 'create'): 'create', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
313 ('get', NS_PUBSUB_OWNER, 'default'): 'default', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
314 ('get', NS_PUBSUB_OWNER, 'configure'): 'configureGet', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
315 ('set', NS_PUBSUB_OWNER, 'configure'): 'configureSet', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
316 ('get', NS_PUBSUB, 'items'): 'items', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
317 ('set', NS_PUBSUB, 'retract'): 'retract', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
318 ('set', NS_PUBSUB_OWNER, 'purge'): 'purge', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
319 ('set', NS_PUBSUB_OWNER, 'delete'): 'delete', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
320 ('get', NS_PUBSUB_OWNER, 'affiliations'): 'affiliationsGet', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
321 ('set', NS_PUBSUB_OWNER, 'affiliations'): 'affiliationsSet', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
322 ('get', NS_PUBSUB_OWNER, 'subscriptions'): 'subscriptionsGet', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
323 ('set', NS_PUBSUB_OWNER, 'subscriptions'): 'subscriptionsSet', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
324 } |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
325 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
326 # Map request verb to request iq type and subelement name |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
327 _verbRequestMap = dict(((v, k) for k, v in _requestVerbMap.iteritems())) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
328 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
329 # Map request verb to parameter handler names |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
330 _parameters = { |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
331 'publish': ['node', 'items'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
332 'subscribe': ['nodeOrEmpty', 'jid', 'optionsWithSubscribe'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
333 'unsubscribe': ['nodeOrEmpty', 'jid', 'subidOrNone'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
334 'optionsGet': ['nodeOrEmpty', 'jid', 'subidOrNone'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
335 'optionsSet': ['nodeOrEmpty', 'jid', 'options', 'subidOrNone'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
336 'subscriptions': [], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
337 'affiliations': [], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
338 'create': ['nodeOrNone', 'configureOrNone'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
339 'default': ['default'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
340 'configureGet': ['nodeOrEmpty'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
341 'configureSet': ['nodeOrEmpty', 'configure'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
342 'items': ['node', 'maxItems', 'itemIdentifiers', 'subidOrNone'], |
1457
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
343 'retract': ['node', 'notify', 'itemIdentifiers'], |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
344 'purge': ['node'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
345 'delete': ['node'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
346 'affiliationsGet': ['nodeOrEmpty'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
347 'affiliationsSet': ['nodeOrEmpty', 'affiliations'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
348 'subscriptionsGet': ['nodeOrEmpty'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
349 'subscriptionsSet': [], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
350 } |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
351 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
352 def __init__(self, verb=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
353 self.verb = verb |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
354 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
355 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
356 def _parse_node(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
357 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
358 Parse the required node identifier out of the verbElement. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
359 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
360 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
361 self.nodeIdentifier = verbElement["node"] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
362 except KeyError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
363 raise BadRequest('nodeid-required') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
364 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
365 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
366 def _render_node(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
367 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
368 Render the required node identifier on the verbElement. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
369 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
370 if not self.nodeIdentifier: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
371 raise Exception("Node identifier is required") |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
372 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
373 verbElement['node'] = self.nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
374 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
375 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
376 def _parse_nodeOrEmpty(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
377 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
378 Parse the node identifier out of the verbElement. May be empty. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
379 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
380 self.nodeIdentifier = verbElement.getAttribute("node", '') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
381 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
382 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
383 def _render_nodeOrEmpty(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
384 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
385 Render the node identifier on the verbElement. May be empty. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
386 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
387 if self.nodeIdentifier: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
388 verbElement['node'] = self.nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
389 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
390 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
391 def _parse_nodeOrNone(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
392 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
393 Parse the optional node identifier out of the verbElement. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
394 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
395 self.nodeIdentifier = verbElement.getAttribute("node") |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
396 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
397 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
398 def _render_nodeOrNone(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
399 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
400 Render the optional node identifier on the verbElement. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
401 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
402 if self.nodeIdentifier: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
403 verbElement['node'] = self.nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
404 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
405 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
406 def _parse_items(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
407 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
408 Parse items out of the verbElement for publish requests. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
409 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
410 self.items = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
411 for element in verbElement.elements(): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
412 if element.uri == NS_PUBSUB and element.name == 'item': |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
413 self.items.append(element) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
414 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
415 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
416 def _render_items(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
417 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
418 Render items into the verbElement for publish requests. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
419 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
420 if self.items: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
421 for item in self.items: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
422 item.uri = NS_PUBSUB |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
423 verbElement.addChild(item) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
424 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
425 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
426 def _parse_jid(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
427 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
428 Parse subscriber out of the verbElement for un-/subscribe requests. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
429 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
430 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
431 self.subscriber = jid.internJID(verbElement["jid"]) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
432 except KeyError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
433 raise BadRequest('jid-required') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
434 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
435 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
436 def _render_jid(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
437 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
438 Render subscriber into the verbElement for un-/subscribe requests. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
439 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
440 verbElement['jid'] = self.subscriber.full() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
441 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
442 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
443 def _parse_default(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
444 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
445 Parse node type out of a request for the default node configuration. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
446 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
447 form = data_form.findForm(verbElement, NS_PUBSUB_NODE_CONFIG) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
448 if form is not None and form.formType == 'submit': |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
449 values = form.getValues() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
450 self.nodeType = values.get('pubsub#node_type', 'leaf') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
451 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
452 self.nodeType = 'leaf' |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
453 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
454 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
455 def _parse_configure(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
456 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
457 Parse options out of a request for setting the node configuration. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
458 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
459 form = data_form.findForm(verbElement, NS_PUBSUB_NODE_CONFIG) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
460 if form is not None: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
461 if form.formType in ('submit', 'cancel'): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
462 self.options = form |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
463 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
464 raise BadRequest(text=u"Unexpected form type '%s'" % form.formType) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
465 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
466 raise BadRequest(text="Missing configuration form") |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
467 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
468 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
469 def _parse_configureOrNone(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
470 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
471 Parse optional node configuration form in create request. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
472 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
473 for element in verbElement.parent.elements(): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
474 if element.uri == NS_PUBSUB and element.name == 'configure': |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
475 form = data_form.findForm(element, NS_PUBSUB_NODE_CONFIG) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
476 if form is not None: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
477 if form.formType != 'submit': |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
478 raise BadRequest(text=u"Unexpected form type '%s'" % |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
479 form.formType) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
480 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
481 form = data_form.Form('submit', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
482 formNamespace=NS_PUBSUB_NODE_CONFIG) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
483 self.options = form |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
484 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
485 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
486 def _render_configureOrNone(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
487 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
488 Render optional node configuration form in create request. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
489 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
490 if self.options is not None: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
491 configure = verbElement.parent.addElement('configure') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
492 configure.addChild(self.options.toElement()) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
493 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
494 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
495 def _parse_itemIdentifiers(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
496 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
497 Parse item identifiers out of items and retract requests. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
498 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
499 self.itemIdentifiers = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
500 for element in verbElement.elements(): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
501 if element.uri == NS_PUBSUB and element.name == 'item': |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
502 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
503 self.itemIdentifiers.append(element["id"]) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
504 except KeyError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
505 raise BadRequest() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
506 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
507 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
508 def _render_itemIdentifiers(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
509 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
510 Render item identifiers into items and retract requests. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
511 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
512 if self.itemIdentifiers: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
513 for itemIdentifier in self.itemIdentifiers: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
514 item = verbElement.addElement('item') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
515 item['id'] = itemIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
516 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
517 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
518 def _parse_maxItems(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
519 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
520 Parse maximum items out of an items request. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
521 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
522 value = verbElement.getAttribute('max_items') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
523 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
524 if value: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
525 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
526 self.maxItems = int(value) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
527 except ValueError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
528 raise BadRequest(text="Field max_items requires a positive " + |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
529 "integer value") |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
530 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
531 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
532 def _render_maxItems(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
533 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
534 Render maximum items into an items request. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
535 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
536 if self.maxItems: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
537 verbElement['max_items'] = unicode(self.maxItems) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
538 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
539 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
540 def _parse_subidOrNone(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
541 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
542 Parse subscription identifier out of a request. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
543 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
544 self.subscriptionIdentifier = verbElement.getAttribute("subid") |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
545 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
546 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
547 def _render_subidOrNone(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
548 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
549 Render subscription identifier into a request. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
550 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
551 if self.subscriptionIdentifier: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
552 verbElement['subid'] = self.subscriptionIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
553 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
554 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
555 def _parse_options(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
556 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
557 Parse options form out of a subscription options request. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
558 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
559 form = data_form.findForm(verbElement, NS_PUBSUB_SUBSCRIBE_OPTIONS) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
560 if form is not None: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
561 if form.formType in ('submit', 'cancel'): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
562 self.options = form |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
563 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
564 raise BadRequest(text=u"Unexpected form type '%s'" % form.formType) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
565 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
566 raise BadRequest(text="Missing options form") |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
567 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
568 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
569 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
570 def _render_options(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
571 verbElement.addChild(self.options.toElement()) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
572 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
573 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
574 def _parse_optionsWithSubscribe(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
575 for element in verbElement.parent.elements(): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
576 if element.name == 'options' and element.uri == NS_PUBSUB: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
577 form = data_form.findForm(element, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
578 NS_PUBSUB_SUBSCRIBE_OPTIONS) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
579 if form is not None: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
580 if form.formType != 'submit': |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
581 raise BadRequest(text=u"Unexpected form type '%s'" % |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
582 form.formType) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
583 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
584 form = data_form.Form('submit', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
585 formNamespace=NS_PUBSUB_SUBSCRIBE_OPTIONS) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
586 self.options = form |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
587 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
588 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
589 def _render_optionsWithSubscribe(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
590 if self.options is not None: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
591 optionsElement = verbElement.parent.addElement('options') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
592 self._render_options(optionsElement) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
593 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
594 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
595 def _parse_affiliations(self, verbElement): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
596 self.affiliations = {} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
597 for element in verbElement.elements(): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
598 if (element.uri == NS_PUBSUB_OWNER and |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
599 element.name == 'affiliation'): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
600 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
601 entity = jid.internJID(element['jid']).userhostJID() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
602 except KeyError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
603 raise BadRequest(text='Missing jid attribute') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
604 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
605 if entity in self.affiliations: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
606 raise BadRequest(text='Multiple affiliations for an entity') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
607 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
608 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
609 affiliation = element['affiliation'] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
610 except KeyError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
611 raise BadRequest(text='Missing affiliation attribute') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
612 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
613 self.affiliations[entity] = affiliation |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
614 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
615 |
1457
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
616 def _parse_notify(self, verbElement): |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
617 value = verbElement.getAttribute('notify') |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
618 |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
619 if value: |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
620 if value in BOOL_TRUE: |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
621 self.notify = True |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
622 elif value in BOOL_FALSE: |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
623 self.notify = False |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
624 else: |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
625 raise BadRequest(text="Field notify must be a boolean value") |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
626 |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
627 |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
628 def _render_notify(self, verbElement): |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
629 if self.notify is not None: |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
630 verbElement['notify'] = "true" if self.notify else "false" |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
631 |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
632 |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
633 def parseElement(self, element): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
634 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
635 Parse the publish-subscribe verb and parameters out of a request. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
636 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
637 generic.Stanza.parseElement(self, element) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
638 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
639 verbs = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
640 verbElements = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
641 for child in element.pubsub.elements(): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
642 key = (self.stanzaType, child.uri, child.name) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
643 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
644 verb = self._requestVerbMap[key] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
645 except KeyError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
646 continue |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
647 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
648 verbs.append(verb) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
649 verbElements.append(child) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
650 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
651 if not verbs: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
652 raise NotImplementedError() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
653 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
654 if len(verbs) > 1: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
655 if 'optionsSet' in verbs and 'subscribe' in verbs: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
656 self.verb = 'subscribe' |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
657 verbElement = verbElements[verbs.index('subscribe')] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
658 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
659 raise NotImplementedError() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
660 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
661 self.verb = verbs[0] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
662 verbElement = verbElements[0] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
663 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
664 for parameter in self._parameters[self.verb]: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
665 getattr(self, '_parse_%s' % parameter)(verbElement) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
666 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
667 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
668 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
669 def send(self, xs): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
670 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
671 Send this request to its recipient. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
672 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
673 This renders all of the relevant parameters for this specific |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
674 requests into an L{IQ}, and invoke its C{send} method. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
675 This returns a deferred that fires upon reception of a response. See |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
676 L{IQ} for details. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
677 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
678 @param xs: The XML stream to send the request on. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
679 @type xs: L{twisted.words.protocols.jabber.xmlstream.XmlStream} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
680 @rtype: L{defer.Deferred}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
681 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
682 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
683 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
684 (self.stanzaType, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
685 childURI, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
686 childName) = self._verbRequestMap[self.verb] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
687 except KeyError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
688 raise NotImplementedError() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
689 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
690 iq = IQ(xs, self.stanzaType) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
691 iq.addElement((childURI, 'pubsub')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
692 verbElement = iq.pubsub.addElement(childName) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
693 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
694 if self.sender: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
695 iq['from'] = self.sender.full() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
696 if self.recipient: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
697 iq['to'] = self.recipient.full() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
698 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
699 for parameter in self._parameters[self.verb]: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
700 getattr(self, '_render_%s' % parameter)(verbElement) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
701 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
702 return iq.send() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
703 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
704 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
705 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
706 class PubSubEvent(object): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
707 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
708 A publish subscribe event. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
709 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
710 @param sender: The entity from which the notification was received. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
711 @type sender: L{jid.JID} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
712 @param recipient: The entity to which the notification was sent. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
713 @type recipient: L{wokkel.pubsub.ItemsEvent} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
714 @param nodeIdentifier: Identifier of the node the event pertains to. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
715 @type nodeIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
716 @param headers: SHIM headers, see L{wokkel.shim.extractHeaders}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
717 @type headers: C{dict} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
718 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
719 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
720 def __init__(self, sender, recipient, nodeIdentifier, headers): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
721 self.sender = sender |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
722 self.recipient = recipient |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
723 self.nodeIdentifier = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
724 self.headers = headers |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
725 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
726 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
727 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
728 class ItemsEvent(PubSubEvent): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
729 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
730 A publish-subscribe event that signifies new, updated and retracted items. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
731 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
732 @param items: List of received items as domish elements. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
733 @type items: C{list} of L{domish.Element} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
734 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
735 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
736 def __init__(self, sender, recipient, nodeIdentifier, items, headers): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
737 PubSubEvent.__init__(self, sender, recipient, nodeIdentifier, headers) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
738 self.items = items |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
739 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
740 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
741 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
742 class DeleteEvent(PubSubEvent): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
743 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
744 A publish-subscribe event that signifies the deletion of a node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
745 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
746 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
747 redirectURI = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
748 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
749 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
750 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
751 class PurgeEvent(PubSubEvent): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
752 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
753 A publish-subscribe event that signifies the purging of a node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
754 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
755 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
756 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
757 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
758 class PubSubClient(XMPPHandler): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
759 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
760 Publish subscribe client protocol. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
761 """ |
1772
666ab06a9d81
tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient
Goffi <goffi@goffi.org>
parents:
1771
diff
changeset
|
762 implements(IPubSubClient) |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
763 |
1772
666ab06a9d81
tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient
Goffi <goffi@goffi.org>
parents:
1771
diff
changeset
|
764 _request_class = PubSubRequest |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
765 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
766 def connectionInitialized(self): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
767 self.xmlstream.addObserver('/message/event[@xmlns="%s"]' % |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
768 NS_PUBSUB_EVENT, self._onEvent) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
769 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
770 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
771 def _onEvent(self, message): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
772 if message.getAttribute('type') == 'error': |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
773 return |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
774 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
775 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
776 sender = jid.JID(message["from"]) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
777 recipient = jid.JID(message["to"]) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
778 except KeyError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
779 return |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
780 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
781 actionElement = None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
782 for element in message.event.elements(): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
783 if element.uri == NS_PUBSUB_EVENT: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
784 actionElement = element |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
785 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
786 if not actionElement: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
787 return |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
788 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
789 eventHandler = getattr(self, "_onEvent_%s" % actionElement.name, None) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
790 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
791 if eventHandler: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
792 headers = shim.extractHeaders(message) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
793 eventHandler(sender, recipient, actionElement, headers) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
794 message.handled = True |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
795 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
796 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
797 def _onEvent_items(self, sender, recipient, action, headers): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
798 nodeIdentifier = action["node"] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
799 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
800 items = [element for element in action.elements() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
801 if element.name in ('item', 'retract')] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
802 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
803 event = ItemsEvent(sender, recipient, nodeIdentifier, items, headers) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
804 self.itemsReceived(event) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
805 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
806 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
807 def _onEvent_delete(self, sender, recipient, action, headers): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
808 nodeIdentifier = action["node"] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
809 event = DeleteEvent(sender, recipient, nodeIdentifier, headers) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
810 if action.redirect: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
811 event.redirectURI = action.redirect.getAttribute('uri') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
812 self.deleteReceived(event) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
813 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
814 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
815 def _onEvent_purge(self, sender, recipient, action, headers): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
816 nodeIdentifier = action["node"] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
817 event = PurgeEvent(sender, recipient, nodeIdentifier, headers) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
818 self.purgeReceived(event) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
819 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
820 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
821 def itemsReceived(self, event): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
822 pass |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
823 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
824 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
825 def deleteReceived(self, event): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
826 pass |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
827 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
828 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
829 def purgeReceived(self, event): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
830 pass |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
831 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
832 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
833 def createNode(self, service, nodeIdentifier=None, options=None, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
834 sender=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
835 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
836 Create a publish subscribe node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
837 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
838 @param service: The publish subscribe service to create the node at. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
839 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
840 @param nodeIdentifier: Optional suggestion for the id of the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
841 @type nodeIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
842 @param options: Optional node configuration options. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
843 @type options: C{dict} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
844 """ |
1772
666ab06a9d81
tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient
Goffi <goffi@goffi.org>
parents:
1771
diff
changeset
|
845 request = self._request_class('create') |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
846 request.recipient = service |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
847 request.nodeIdentifier = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
848 request.sender = sender |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
849 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
850 if options: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
851 form = data_form.Form(formType='submit', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
852 formNamespace=NS_PUBSUB_NODE_CONFIG) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
853 form.makeFields(options) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
854 request.options = form |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
855 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
856 def cb(iq): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
857 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
858 new_node = iq.pubsub.create["node"] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
859 except AttributeError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
860 # the suggested node identifier was accepted |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
861 new_node = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
862 return new_node |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
863 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
864 d = request.send(self.xmlstream) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
865 d.addCallback(cb) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
866 return d |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
867 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
868 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
869 def deleteNode(self, service, nodeIdentifier, sender=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
870 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
871 Delete a publish subscribe node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
872 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
873 @param service: The publish subscribe service to delete the node from. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
874 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
875 @param nodeIdentifier: The identifier of the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
876 @type nodeIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
877 """ |
1772
666ab06a9d81
tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient
Goffi <goffi@goffi.org>
parents:
1771
diff
changeset
|
878 request = self._request_class('delete') |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
879 request.recipient = service |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
880 request.nodeIdentifier = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
881 request.sender = sender |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
882 return request.send(self.xmlstream) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
883 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
884 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
885 def subscribe(self, service, nodeIdentifier, subscriber, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
886 options=None, sender=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
887 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
888 Subscribe to a publish subscribe node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
889 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
890 @param service: The publish subscribe service that keeps the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
891 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
892 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
893 @param nodeIdentifier: The identifier of the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
894 @type nodeIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
895 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
896 @param subscriber: The entity to subscribe to the node. This entity |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
897 will get notifications of new published items. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
898 @type subscriber: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
899 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
900 @param options: Subscription options. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
901 @type options: C{dict} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
902 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
903 @return: Deferred that fires with L{Subscription} or errbacks with |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
904 L{SubscriptionPending} or L{SubscriptionUnconfigured}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
905 @rtype: L{defer.Deferred} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
906 """ |
1772
666ab06a9d81
tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient
Goffi <goffi@goffi.org>
parents:
1771
diff
changeset
|
907 request = self._request_class('subscribe') |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
908 request.recipient = service |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
909 request.nodeIdentifier = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
910 request.subscriber = subscriber |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
911 request.sender = sender |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
912 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
913 if options: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
914 form = data_form.Form(formType='submit', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
915 formNamespace=NS_PUBSUB_SUBSCRIBE_OPTIONS) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
916 form.makeFields(options) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
917 request.options = form |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
918 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
919 def cb(iq): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
920 subscription = Subscription.fromElement(iq.pubsub.subscription) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
921 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
922 if subscription.state == 'pending': |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
923 raise SubscriptionPending() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
924 elif subscription.state == 'unconfigured': |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
925 raise SubscriptionUnconfigured() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
926 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
927 # we assume subscription == 'subscribed' |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
928 # any other value would be invalid, but that should have |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
929 # yielded a stanza error. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
930 return subscription |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
931 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
932 d = request.send(self.xmlstream) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
933 d.addCallback(cb) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
934 return d |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
935 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
936 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
937 def unsubscribe(self, service, nodeIdentifier, subscriber, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
938 subscriptionIdentifier=None, sender=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
939 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
940 Unsubscribe from a publish subscribe node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
941 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
942 @param service: The publish subscribe service that keeps the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
943 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
944 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
945 @param nodeIdentifier: The identifier of the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
946 @type nodeIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
947 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
948 @param subscriber: The entity to unsubscribe from the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
949 @type subscriber: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
950 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
951 @param subscriptionIdentifier: Optional subscription identifier. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
952 @type subscriptionIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
953 """ |
1772
666ab06a9d81
tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient
Goffi <goffi@goffi.org>
parents:
1771
diff
changeset
|
954 request = self._request_class('unsubscribe') |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
955 request.recipient = service |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
956 request.nodeIdentifier = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
957 request.subscriber = subscriber |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
958 request.subscriptionIdentifier = subscriptionIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
959 request.sender = sender |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
960 return request.send(self.xmlstream) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
961 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
962 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
963 def publish(self, service, nodeIdentifier, items=None, sender=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
964 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
965 Publish to a publish subscribe node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
966 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
967 @param service: The publish subscribe service that keeps the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
968 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
969 @param nodeIdentifier: The identifier of the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
970 @type nodeIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
971 @param items: Optional list of L{Item}s to publish. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
972 @type items: C{list} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
973 """ |
1772
666ab06a9d81
tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient
Goffi <goffi@goffi.org>
parents:
1771
diff
changeset
|
974 request = self._request_class('publish') |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
975 request.recipient = service |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
976 request.nodeIdentifier = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
977 request.items = items |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
978 request.sender = sender |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
979 return request.send(self.xmlstream) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
980 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
981 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
982 def items(self, service, nodeIdentifier, maxItems=None, itemIdentifiers=None, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
983 subscriptionIdentifier=None, sender=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
984 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
985 Retrieve previously published items from a publish subscribe node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
986 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
987 @param service: The publish subscribe service that keeps the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
988 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
989 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
990 @param nodeIdentifier: The identifier of the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
991 @type nodeIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
992 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
993 @param maxItems: Optional limit on the number of retrieved items. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
994 @type maxItems: C{int} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
995 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
996 @param itemIdentifiers: Identifiers of the items to be retrieved. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
997 @type itemIdentifiers: C{set} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
998 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
999 @param subscriptionIdentifier: Optional subscription identifier. In |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1000 case the node has been subscribed to multiple times, this narrows |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1001 the results to the specific subscription. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1002 @type subscriptionIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1003 """ |
1772
666ab06a9d81
tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient
Goffi <goffi@goffi.org>
parents:
1771
diff
changeset
|
1004 request = self._request_class('items') |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1005 request.recipient = service |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1006 request.nodeIdentifier = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1007 if maxItems: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1008 request.maxItems = str(int(maxItems)) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1009 request.subscriptionIdentifier = subscriptionIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1010 request.sender = sender |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1011 request.itemIdentifiers = itemIdentifiers |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1012 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1013 def cb(iq): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1014 items = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1015 for element in iq.pubsub.items.elements(): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1016 if element.uri == NS_PUBSUB and element.name == 'item': |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1017 items.append(element) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1018 return items |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1019 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1020 d = request.send(self.xmlstream) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1021 d.addCallback(cb) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1022 return d |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1023 |
1457
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
1024 def retractItems(self, service, nodeIdentifier, itemIdentifiers, notify=None, sender=None): |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1025 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1026 Retract items from a publish subscribe node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1027 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1028 @param service: The publish subscribe service to delete the node from. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1029 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1030 @param nodeIdentifier: The identifier of the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1031 @type nodeIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1032 @param itemIdentifiers: Identifiers of the items to be retracted. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1033 @type itemIdentifiers: C{set} |
1457
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
1034 @param notify: True if notification is required |
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
1035 @type notify: C{unicode} |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1036 """ |
1772
666ab06a9d81
tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient
Goffi <goffi@goffi.org>
parents:
1771
diff
changeset
|
1037 request = self._request_class('retract') |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1038 request.recipient = service |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1039 request.nodeIdentifier = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1040 request.itemIdentifiers = itemIdentifiers |
1457
2e43eb9d8167
tmp(pubsub): added retract "notify" attribute management
Goffi <goffi@goffi.org>
parents:
1424
diff
changeset
|
1041 request.notify = notify |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1042 request.sender = sender |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1043 return request.send(self.xmlstream) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1044 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1045 def getOptions(self, service, nodeIdentifier, subscriber, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1046 subscriptionIdentifier=None, sender=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1047 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1048 Get subscription options. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1049 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1050 @param service: The publish subscribe service that keeps the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1051 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1052 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1053 @param nodeIdentifier: The identifier of the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1054 @type nodeIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1055 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1056 @param subscriber: The entity subscribed to the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1057 @type subscriber: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1058 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1059 @param subscriptionIdentifier: Optional subscription identifier. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1060 @type subscriptionIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1061 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1062 @rtype: L{data_form.Form} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1063 """ |
1772
666ab06a9d81
tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient
Goffi <goffi@goffi.org>
parents:
1771
diff
changeset
|
1064 request = self._request_class('optionsGet') |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1065 request.recipient = service |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1066 request.nodeIdentifier = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1067 request.subscriber = subscriber |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1068 request.subscriptionIdentifier = subscriptionIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1069 request.sender = sender |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1070 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1071 def cb(iq): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1072 form = data_form.findForm(iq.pubsub.options, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1073 NS_PUBSUB_SUBSCRIBE_OPTIONS) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1074 form.typeCheck() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1075 return form |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1076 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1077 d = request.send(self.xmlstream) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1078 d.addCallback(cb) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1079 return d |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1080 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1081 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1082 def setOptions(self, service, nodeIdentifier, subscriber, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1083 options, subscriptionIdentifier=None, sender=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1084 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1085 Set subscription options. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1086 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1087 @param service: The publish subscribe service that keeps the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1088 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1089 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1090 @param nodeIdentifier: The identifier of the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1091 @type nodeIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1092 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1093 @param subscriber: The entity subscribed to the node. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1094 @type subscriber: L{JID<twisted.words.protocols.jabber.jid.JID>} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1095 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1096 @param options: Subscription options. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1097 @type options: C{dict}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1098 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1099 @param subscriptionIdentifier: Optional subscription identifier. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1100 @type subscriptionIdentifier: C{unicode} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1101 """ |
1772
666ab06a9d81
tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient
Goffi <goffi@goffi.org>
parents:
1771
diff
changeset
|
1102 request = self._request_class('optionsSet') |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1103 request.recipient = service |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1104 request.nodeIdentifier = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1105 request.subscriber = subscriber |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1106 request.subscriptionIdentifier = subscriptionIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1107 request.sender = sender |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1108 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1109 form = data_form.Form(formType='submit', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1110 formNamespace=NS_PUBSUB_SUBSCRIBE_OPTIONS) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1111 form.makeFields(options) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1112 request.options = form |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1113 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1114 d = request.send(self.xmlstream) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1115 return d |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1116 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1117 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1118 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1119 class PubSubService(XMPPHandler, IQHandlerMixin): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1120 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1121 Protocol implementation for a XMPP Publish Subscribe Service. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1122 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1123 The word Service here is used as taken from the Publish Subscribe |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1124 specification. It is the party responsible for keeping nodes and their |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1125 subscriptions, and sending out notifications. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1126 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1127 Methods from the L{IPubSubService} interface that are called as a result |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1128 of an XMPP request may raise exceptions. Alternatively the deferred |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1129 returned by these methods may have their errback called. These are handled |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1130 as follows: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1131 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1132 - If the exception is an instance of L{error.StanzaError}, an error |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1133 response iq is returned. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1134 - Any other exception is reported using L{log.msg}. An error response |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1135 with the condition C{internal-server-error} is returned. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1136 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1137 The default implementation of said methods raises an L{Unsupported} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1138 exception and are meant to be overridden. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1139 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1140 @ivar discoIdentity: Service discovery identity as a dictionary with |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1141 keys C{'category'}, C{'type'} and C{'name'}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1142 @ivar pubSubFeatures: List of supported publish-subscribe features for |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1143 service discovery, as C{str}. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1144 @type pubSubFeatures: C{list} or C{None} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1145 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1146 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1147 implements(IPubSubService, disco.IDisco) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1148 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1149 iqHandlers = { |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1150 '/*': '_onPubSubRequest', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1151 } |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1152 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1153 _legacyHandlers = { |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1154 'publish': ('publish', ['sender', 'recipient', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1155 'nodeIdentifier', 'items']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1156 'subscribe': ('subscribe', ['sender', 'recipient', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1157 'nodeIdentifier', 'subscriber']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1158 'unsubscribe': ('unsubscribe', ['sender', 'recipient', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1159 'nodeIdentifier', 'subscriber']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1160 'subscriptions': ('subscriptions', ['sender', 'recipient']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1161 'affiliations': ('affiliations', ['sender', 'recipient']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1162 'create': ('create', ['sender', 'recipient', 'nodeIdentifier']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1163 'getConfigurationOptions': ('getConfigurationOptions', []), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1164 'default': ('getDefaultConfiguration', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1165 ['sender', 'recipient', 'nodeType']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1166 'configureGet': ('getConfiguration', ['sender', 'recipient', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1167 'nodeIdentifier']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1168 'configureSet': ('setConfiguration', ['sender', 'recipient', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1169 'nodeIdentifier', 'options']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1170 'items': ('items', ['sender', 'recipient', 'nodeIdentifier', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1171 'maxItems', 'itemIdentifiers']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1172 'retract': ('retract', ['sender', 'recipient', 'nodeIdentifier', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1173 'itemIdentifiers']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1174 'purge': ('purge', ['sender', 'recipient', 'nodeIdentifier']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1175 'delete': ('delete', ['sender', 'recipient', 'nodeIdentifier']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1176 } |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1177 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1178 _request_class = PubSubRequest |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1179 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1180 hideNodes = False |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1181 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1182 def __init__(self, resource=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1183 self.resource = resource |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1184 self.discoIdentity = {'category': 'pubsub', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1185 'type': 'service', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1186 'name': 'Generic Publish-Subscribe Service'} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1187 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1188 self.pubSubFeatures = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1189 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1190 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1191 def connectionMade(self): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1192 self.xmlstream.addObserver(PUBSUB_REQUEST, self.handleRequest) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1193 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1194 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1195 def getDiscoInfo(self, requestor, target, nodeIdentifier=''): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1196 def toInfo(nodeInfo): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1197 if not nodeInfo: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1198 return |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1199 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1200 (nodeType, metaData) = nodeInfo['type'], nodeInfo['meta-data'] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1201 info.append(disco.DiscoIdentity('pubsub', nodeType)) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1202 if metaData: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1203 form = data_form.Form(formType="result", |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1204 formNamespace=NS_PUBSUB_META_DATA) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1205 form.addField( |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1206 data_form.Field( |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1207 var='pubsub#node_type', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1208 value=nodeType, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1209 label='The type of node (collection or leaf)' |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1210 ) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1211 ) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1212 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1213 for metaDatum in metaData: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1214 form.addField(data_form.Field.fromDict(metaDatum)) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1215 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1216 info.append(form) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1217 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1218 return |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1219 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1220 info = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1221 |
1772
666ab06a9d81
tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient
Goffi <goffi@goffi.org>
parents:
1771
diff
changeset
|
1222 request = self._request_class('discoInfo') |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1223 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1224 if self.resource is not None: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1225 resource = self.resource.locateResource(request) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1226 identity = resource.discoIdentity |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1227 features = resource.features |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1228 getInfo = resource.getInfo |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1229 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1230 category = self.discoIdentity['category'] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1231 idType = self.discoIdentity['type'] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1232 name = self.discoIdentity['name'] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1233 identity = disco.DiscoIdentity(category, idType, name) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1234 features = self.pubSubFeatures |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1235 getInfo = self.getNodeInfo |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1236 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1237 if not nodeIdentifier: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1238 info.append(identity) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1239 info.append(disco.DiscoFeature(disco.NS_DISCO_ITEMS)) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1240 info.extend([disco.DiscoFeature("%s#%s" % (NS_PUBSUB, feature)) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1241 for feature in features]) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1242 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1243 d = defer.maybeDeferred(getInfo, requestor, target, nodeIdentifier or '') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1244 d.addCallback(toInfo) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1245 d.addErrback(log.err) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1246 d.addCallback(lambda _: info) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1247 return d |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1248 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1249 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1250 def getDiscoItems(self, requestor, target, nodeIdentifier=''): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1251 if self.hideNodes: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1252 d = defer.succeed([]) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1253 elif self.resource is not None: |
1772
666ab06a9d81
tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient
Goffi <goffi@goffi.org>
parents:
1771
diff
changeset
|
1254 request = self._request_class('discoInfo') |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1255 resource = self.resource.locateResource(request) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1256 d = resource.getNodes(requestor, target, nodeIdentifier) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1257 elif nodeIdentifier: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1258 d = self.getNodes(requestor, target) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1259 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1260 d = defer.succeed([]) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1261 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1262 d.addCallback(lambda nodes: [disco.DiscoItem(target, node) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1263 for node in nodes]) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1264 return d |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1265 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1266 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1267 def _onPubSubRequest(self, iq): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1268 request = self._request_class.fromElement(iq) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1269 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1270 if self.resource is not None: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1271 resource = self.resource.locateResource(request) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1272 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1273 resource = self |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1274 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1275 # Preprocess the request, knowing the handling resource |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1276 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1277 preProcessor = getattr(self, '_preProcess_%s' % request.verb) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1278 except AttributeError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1279 pass |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1280 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1281 request = preProcessor(resource, request) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1282 if request is None: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1283 return defer.succeed(None) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1284 |
1424 | 1285 # Process the request itself, |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1286 if resource is not self: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1287 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1288 handler = getattr(resource, request.verb) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1289 except AttributeError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1290 text = "Request verb: %s" % request.verb |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1291 return defer.fail(Unsupported('', text)) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1292 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1293 d = handler(request) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1294 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1295 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1296 handlerName, argNames = self._legacyHandlers[request.verb] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1297 except KeyError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1298 text = "Request verb: %s" % request.verb |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1299 return defer.fail(Unsupported('', text)) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1300 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1301 handler = getattr(self, handlerName) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1302 args = [getattr(request, arg) for arg in argNames] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1303 d = handler(*args) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1304 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1305 # If needed, translate the result into a response |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1306 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1307 cb = getattr(self, '_toResponse_%s' % request.verb) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1308 except AttributeError: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1309 pass |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1310 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1311 d.addCallback(cb, resource, request) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1312 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1313 return d |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1314 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1315 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1316 def _toResponse_subscribe(self, result, resource, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1317 response = domish.Element((NS_PUBSUB, "pubsub")) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1318 response.addChild(result.toElement(NS_PUBSUB)) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1319 return response |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1320 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1321 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1322 def _toResponse_subscriptions(self, result, resource, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1323 response = domish.Element((NS_PUBSUB, 'pubsub')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1324 subscriptions = response.addElement('subscriptions') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1325 for subscription in result: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1326 subscriptions.addChild(subscription.toElement(NS_PUBSUB)) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1327 return response |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1328 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1329 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1330 def _toResponse_affiliations(self, result, resource, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1331 response = domish.Element((NS_PUBSUB, 'pubsub')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1332 affiliations = response.addElement('affiliations') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1333 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1334 for nodeIdentifier, affiliation in result: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1335 item = affiliations.addElement('affiliation') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1336 item['node'] = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1337 item['affiliation'] = affiliation |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1338 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1339 return response |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1340 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1341 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1342 def _toResponse_create(self, result, resource, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1343 if not request.nodeIdentifier or request.nodeIdentifier != result: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1344 response = domish.Element((NS_PUBSUB, 'pubsub')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1345 create = response.addElement('create') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1346 create['node'] = result |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1347 return response |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1348 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1349 return None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1350 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1351 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1352 def _formFromConfiguration(self, resource, values): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1353 fieldDefs = resource.getConfigurationOptions() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1354 form = data_form.Form(formType="form", |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1355 formNamespace=NS_PUBSUB_NODE_CONFIG) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1356 form.makeFields(values, fieldDefs) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1357 return form |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1358 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1359 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1360 def _checkConfiguration(self, resource, form): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1361 fieldDefs = resource.getConfigurationOptions() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1362 form.typeCheck(fieldDefs, filterUnknown=True) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1363 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1364 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1365 def _preProcess_create(self, resource, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1366 if request.options: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1367 self._checkConfiguration(resource, request.options) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1368 return request |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1369 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1370 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1371 def _preProcess_default(self, resource, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1372 if request.nodeType not in ('leaf', 'collection'): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1373 raise error.StanzaError('not-acceptable') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1374 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1375 return request |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1376 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1377 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1378 def _toResponse_default(self, options, resource, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1379 response = domish.Element((NS_PUBSUB_OWNER, "pubsub")) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1380 default = response.addElement("default") |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1381 form = self._formFromConfiguration(resource, options) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1382 default.addChild(form.toElement()) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1383 return response |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1384 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1385 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1386 def _toResponse_configureGet(self, options, resource, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1387 response = domish.Element((NS_PUBSUB_OWNER, "pubsub")) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1388 configure = response.addElement("configure") |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1389 form = self._formFromConfiguration(resource, options) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1390 configure.addChild(form.toElement()) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1391 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1392 if request.nodeIdentifier: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1393 configure["node"] = request.nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1394 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1395 return response |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1396 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1397 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1398 def _preProcess_configureSet(self, resource, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1399 if request.options.formType == 'cancel': |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1400 return None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1401 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1402 self._checkConfiguration(resource, request.options) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1403 return request |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1404 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1405 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1406 def _toResponse_items(self, result, resource, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1407 response = domish.Element((NS_PUBSUB, 'pubsub')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1408 items = response.addElement('items') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1409 items["node"] = request.nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1410 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1411 for item in result: |
1771
b77dc676a4df
tmp (wokkel/rsm): various improvments:
Goffi <goffi@goffi.org>
parents:
1677
diff
changeset
|
1412 item.uri = NS_PUBSUB |
b77dc676a4df
tmp (wokkel/rsm): various improvments:
Goffi <goffi@goffi.org>
parents:
1677
diff
changeset
|
1413 items.addChild(item) |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1414 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1415 return response |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1416 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1417 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1418 def _createNotification(self, eventType, service, nodeIdentifier, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1419 subscriber, subscriptions=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1420 headers = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1421 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1422 if subscriptions: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1423 for subscription in subscriptions: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1424 if nodeIdentifier != subscription.nodeIdentifier: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1425 headers.append(('Collection', subscription.nodeIdentifier)) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1426 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1427 message = domish.Element((None, "message")) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1428 message["from"] = service.full() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1429 message["to"] = subscriber.full() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1430 event = message.addElement((NS_PUBSUB_EVENT, "event")) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1431 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1432 element = event.addElement(eventType) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1433 element["node"] = nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1434 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1435 if headers: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1436 message.addChild(shim.Headers(headers)) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1437 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1438 return message |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1439 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1440 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1441 def _toResponse_affiliationsGet(self, result, resource, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1442 response = domish.Element((NS_PUBSUB_OWNER, 'pubsub')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1443 affiliations = response.addElement('affiliations') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1444 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1445 if request.nodeIdentifier: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1446 affiliations['node'] = request.nodeIdentifier |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1447 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1448 for entity, affiliation in result.iteritems(): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1449 item = affiliations.addElement('affiliation') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1450 item['jid'] = entity.full() |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1451 item['affiliation'] = affiliation |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1452 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1453 return response |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1454 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1455 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1456 # public methods |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1457 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1458 def notifyPublish(self, service, nodeIdentifier, notifications): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1459 for subscriber, subscriptions, items in notifications: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1460 message = self._createNotification('items', service, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1461 nodeIdentifier, subscriber, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1462 subscriptions) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1463 for item in items: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1464 item.uri = NS_PUBSUB_EVENT |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1465 message.event.items.addChild(item) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1466 self.send(message) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1467 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1468 |
1677
a125b11af711
tmp (wokkel.pubsub): implemented missing notifyRetract
Goffi <goffi@goffi.org>
parents:
1510
diff
changeset
|
1469 def notifyRetract(self, service, nodeIdentifier, notifications): |
a125b11af711
tmp (wokkel.pubsub): implemented missing notifyRetract
Goffi <goffi@goffi.org>
parents:
1510
diff
changeset
|
1470 for subscriber, subscriptions, items in notifications: |
a125b11af711
tmp (wokkel.pubsub): implemented missing notifyRetract
Goffi <goffi@goffi.org>
parents:
1510
diff
changeset
|
1471 message = self._createNotification('items', service, |
a125b11af711
tmp (wokkel.pubsub): implemented missing notifyRetract
Goffi <goffi@goffi.org>
parents:
1510
diff
changeset
|
1472 nodeIdentifier, subscriber, |
a125b11af711
tmp (wokkel.pubsub): implemented missing notifyRetract
Goffi <goffi@goffi.org>
parents:
1510
diff
changeset
|
1473 subscriptions) |
a125b11af711
tmp (wokkel.pubsub): implemented missing notifyRetract
Goffi <goffi@goffi.org>
parents:
1510
diff
changeset
|
1474 for item in items: |
a125b11af711
tmp (wokkel.pubsub): implemented missing notifyRetract
Goffi <goffi@goffi.org>
parents:
1510
diff
changeset
|
1475 retract = domish.Element((None, "retract")) |
a125b11af711
tmp (wokkel.pubsub): implemented missing notifyRetract
Goffi <goffi@goffi.org>
parents:
1510
diff
changeset
|
1476 retract['id'] = item['id'] |
a125b11af711
tmp (wokkel.pubsub): implemented missing notifyRetract
Goffi <goffi@goffi.org>
parents:
1510
diff
changeset
|
1477 message.event.items.addChild(retract) |
a125b11af711
tmp (wokkel.pubsub): implemented missing notifyRetract
Goffi <goffi@goffi.org>
parents:
1510
diff
changeset
|
1478 self.send(message) |
a125b11af711
tmp (wokkel.pubsub): implemented missing notifyRetract
Goffi <goffi@goffi.org>
parents:
1510
diff
changeset
|
1479 |
a125b11af711
tmp (wokkel.pubsub): implemented missing notifyRetract
Goffi <goffi@goffi.org>
parents:
1510
diff
changeset
|
1480 |
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1481 def notifyDelete(self, service, nodeIdentifier, subscribers, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1482 redirectURI=None): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1483 for subscriber in subscribers: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1484 message = self._createNotification('delete', service, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1485 nodeIdentifier, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1486 subscriber) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1487 if redirectURI: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1488 redirect = message.event.delete.addElement('redirect') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1489 redirect['uri'] = redirectURI |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1490 self.send(message) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1491 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1492 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1493 def getNodeInfo(self, requestor, service, nodeIdentifier): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1494 return None |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1495 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1496 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1497 def getNodes(self, requestor, service): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1498 return [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1499 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1500 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1501 def publish(self, requestor, service, nodeIdentifier, items): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1502 raise Unsupported('publish') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1503 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1504 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1505 def subscribe(self, requestor, service, nodeIdentifier, subscriber): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1506 raise Unsupported('subscribe') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1507 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1508 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1509 def unsubscribe(self, requestor, service, nodeIdentifier, subscriber): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1510 raise Unsupported('subscribe') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1511 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1512 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1513 def subscriptions(self, requestor, service): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1514 raise Unsupported('retrieve-subscriptions') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1515 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1516 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1517 def affiliations(self, requestor, service): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1518 raise Unsupported('retrieve-affiliations') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1519 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1520 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1521 def create(self, requestor, service, nodeIdentifier): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1522 raise Unsupported('create-nodes') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1523 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1524 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1525 def getConfigurationOptions(self): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1526 return {} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1527 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1528 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1529 def getDefaultConfiguration(self, requestor, service, nodeType): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1530 raise Unsupported('retrieve-default') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1531 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1532 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1533 def getConfiguration(self, requestor, service, nodeIdentifier): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1534 raise Unsupported('config-node') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1535 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1536 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1537 def setConfiguration(self, requestor, service, nodeIdentifier, options): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1538 raise Unsupported('config-node') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1539 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1540 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1541 def items(self, requestor, service, nodeIdentifier, maxItems, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1542 itemIdentifiers): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1543 raise Unsupported('retrieve-items') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1544 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1545 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1546 def retract(self, requestor, service, nodeIdentifier, itemIdentifiers): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1547 raise Unsupported('retract-items') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1548 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1549 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1550 def purge(self, requestor, service, nodeIdentifier): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1551 raise Unsupported('purge-nodes') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1552 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1553 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1554 def delete(self, requestor, service, nodeIdentifier): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1555 raise Unsupported('delete-nodes') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1556 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1557 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1558 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1559 class PubSubResource(object): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1560 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1561 implements(IPubSubResource) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1562 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1563 features = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1564 discoIdentity = disco.DiscoIdentity('pubsub', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1565 'service', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1566 'Publish-Subscribe Service') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1567 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1568 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1569 def locateResource(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1570 return self |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1571 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1572 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1573 def getInfo(self, requestor, service, nodeIdentifier): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1574 return defer.succeed(None) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1575 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1576 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1577 def getNodes(self, requestor, service, nodeIdentifier): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1578 return defer.succeed([]) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1579 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1580 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1581 def getConfigurationOptions(self): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1582 return {} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1583 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1584 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1585 def publish(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1586 return defer.fail(Unsupported('publish')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1587 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1588 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1589 def subscribe(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1590 return defer.fail(Unsupported('subscribe')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1591 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1592 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1593 def unsubscribe(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1594 return defer.fail(Unsupported('subscribe')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1595 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1596 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1597 def subscriptions(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1598 return defer.fail(Unsupported('retrieve-subscriptions')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1599 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1600 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1601 def affiliations(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1602 return defer.fail(Unsupported('retrieve-affiliations')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1603 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1604 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1605 def create(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1606 return defer.fail(Unsupported('create-nodes')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1607 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1608 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1609 def default(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1610 return defer.fail(Unsupported('retrieve-default')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1611 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1612 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1613 def configureGet(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1614 return defer.fail(Unsupported('config-node')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1615 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1616 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1617 def configureSet(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1618 return defer.fail(Unsupported('config-node')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1619 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1620 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1621 def items(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1622 return defer.fail(Unsupported('retrieve-items')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1623 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1624 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1625 def retract(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1626 return defer.fail(Unsupported('retract-items')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1627 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1628 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1629 def purge(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1630 return defer.fail(Unsupported('purge-nodes')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1631 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1632 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1633 def delete(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1634 return defer.fail(Unsupported('delete-nodes')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1635 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1636 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1637 def affiliationsGet(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1638 return defer.fail(Unsupported('modify-affiliations')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1639 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1640 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1641 def affiliationsSet(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1642 return defer.fail(Unsupported('modify-affiliations')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1643 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1644 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1645 def subscriptionsGet(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1646 return defer.fail(Unsupported('manage-subscriptions')) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1647 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1648 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1649 def subscriptionsSet(self, request): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1650 return defer.fail(Unsupported('manage-subscriptions')) |