Mercurial > libervia-backend
annotate src/tmp/wokkel/pubsub.py @ 1378:3dae6964c071
quick_frontends, primitivus: move the chat states logic to quick_frontend
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 20 Mar 2015 16:28:19 +0100 |
parents | 9141bde7ff31 |
children | be1fccf4854d |
rev | line source |
---|---|
1266
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1 # -*- 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
|
2 # |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
3 # Copyright (c) Ralph Meijer. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
4 # See LICENSE 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
|
5 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
6 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
7 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
|
8 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
9 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
|
10 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
|
11 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
12 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
13 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
|
14 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
15 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
|
16 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
|
17 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
|
18 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
|
19 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
20 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
|
21 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
|
22 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
|
23 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
|
24 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
25 # 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
|
26 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
|
27 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
|
28 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
29 # 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
|
30 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
|
31 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
|
32 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
|
33 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
|
34 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
|
35 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
|
36 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
|
37 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
38 # 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
|
39 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
|
40 '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
|
41 '@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
|
42 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
43 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
|
44 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
45 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
|
46 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
47 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
48 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
49 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
50 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
|
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 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
|
53 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
56 |
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 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
|
59 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
60 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
|
61 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 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
|
69 |
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
72 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
|
73 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
74 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
|
75 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
76 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
|
77 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
|
78 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
|
79 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
80 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
|
81 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
|
82 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
|
83 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
|
84 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
85 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
86 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
87 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
|
88 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
|
89 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
|
90 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
|
91 'unsupported', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
92 feature, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
93 text) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
94 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
95 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
|
96 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
|
97 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
|
98 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
|
99 |
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 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
|
102 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
103 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
|
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 @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
|
106 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
|
107 @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
|
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 @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
|
110 @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
|
111 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
112 @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
|
113 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
|
114 @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
|
115 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
116 @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
|
117 @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
|
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 @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
|
120 @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
|
121 """ |
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 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
|
124 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
|
125 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
|
126 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
|
127 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
|
128 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
|
129 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
|
130 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
131 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
132 @staticmethod |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
133 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
|
134 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
|
135 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
|
136 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
|
137 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
|
138 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
|
139 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
140 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
141 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
|
142 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
143 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
|
144 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
145 @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
|
146 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
147 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
|
148 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
|
149 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
|
150 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
|
151 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
|
152 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
|
153 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
|
154 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
|
155 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
156 |
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 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
|
159 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
160 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
|
161 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
162 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
|
163 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
164 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
|
165 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
|
166 """ |
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 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
|
169 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
170 @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
|
171 @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
|
172 @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
|
173 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
|
174 @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
|
175 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
176 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
177 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
|
178 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
|
179 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
|
180 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
|
181 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
|
182 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
|
183 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
184 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
|
185 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
186 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
187 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
188 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
|
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 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
|
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 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
|
193 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
|
194 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
|
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 @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
|
197 @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
|
198 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
199 @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
|
200 @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
|
201 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
202 @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
|
203 @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
|
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 @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
|
206 retracted. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
207 @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
|
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 @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
|
210 @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
|
211 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
212 @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
|
213 @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
|
214 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
215 @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
|
216 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
|
217 @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
|
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 @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
|
220 requests. |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
221 @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
|
222 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
223 @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
|
224 @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
|
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 @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
|
227 @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
|
228 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
229 @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
|
230 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
|
231 @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
|
232 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
233 @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
|
234 (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
|
235 (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
|
236 @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
|
237 """ |
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 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
|
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 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
|
242 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
|
243 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
|
244 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
|
245 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
|
246 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
|
247 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
|
248 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
|
249 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
|
250 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
|
251 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
|
252 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
253 # 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
|
254 _requestVerbMap = { |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
255 ('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
|
256 ('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
|
257 ('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
|
258 ('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
|
259 ('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
|
260 ('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
|
261 ('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
|
262 ('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
|
263 ('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
|
264 ('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
|
265 ('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
|
266 ('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
|
267 ('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
|
268 ('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
|
269 ('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
|
270 ('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
|
271 ('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
|
272 ('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
|
273 ('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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
276 # 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
|
277 _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
|
278 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
279 # 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
|
280 _parameters = { |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
281 '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
|
282 '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
|
283 '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
|
284 '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
|
285 '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
|
286 'subscriptions': [], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
287 'affiliations': [], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
288 '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
|
289 '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
|
290 '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
|
291 '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
|
292 'items': ['node', 'maxItems', 'itemIdentifiers', 'subidOrNone'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
293 'retract': ['node', 'itemIdentifiers'], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
294 '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
|
295 '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
|
296 '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
|
297 '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
|
298 '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
|
299 'subscriptionsSet': [], |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
300 } |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
301 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
302 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
|
303 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
|
304 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
305 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
306 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
|
307 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
308 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
|
309 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
310 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
311 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
|
312 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
|
313 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
|
314 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
315 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
316 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
|
317 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
318 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
|
319 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
320 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
|
321 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
|
322 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
323 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
|
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 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
|
327 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
328 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
|
329 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
330 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
|
331 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
332 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
333 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
|
334 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
335 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
|
336 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
337 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
|
338 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
|
339 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
340 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
341 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
|
342 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
343 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
|
344 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
345 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
|
346 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
347 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
348 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
|
349 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
350 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
|
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 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
|
353 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
|
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_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
|
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 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
|
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 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
|
361 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
|
362 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
|
363 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
|
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_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
|
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 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
|
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 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
|
371 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
|
372 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
|
373 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
|
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_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
|
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 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
|
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 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
381 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
|
382 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
|
383 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
386 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
|
387 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
388 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
|
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 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
|
391 |
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 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
|
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 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
|
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 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
|
398 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
|
399 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
|
400 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
|
401 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
402 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
|
403 |
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 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
|
406 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
407 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
|
408 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
409 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
|
410 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
|
411 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
|
412 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
|
413 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
414 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
|
415 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
416 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
419 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
|
420 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
421 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
|
422 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
423 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
|
424 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
|
425 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
|
426 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
|
427 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
|
428 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
|
429 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
|
430 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
431 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
|
432 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
|
433 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
|
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_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
|
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 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
|
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 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
|
441 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
|
442 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
|
443 |
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 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
|
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 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
|
448 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
449 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
|
450 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
|
451 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
|
452 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
453 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
|
454 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
|
455 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
458 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
|
459 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
460 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
|
461 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
462 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
|
463 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
|
464 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
|
465 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
|
466 |
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 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
|
469 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
470 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
|
471 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
472 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
|
473 |
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 value: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
475 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
476 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
|
477 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
|
478 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
|
479 "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
|
480 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
481 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
482 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
|
483 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
484 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
|
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 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
|
487 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
|
488 |
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 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
|
491 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
492 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
|
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 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
|
495 |
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 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
|
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 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
|
500 """ |
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 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
|
502 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
|
503 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
504 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
505 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
|
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 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
|
508 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
509 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
|
510 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
|
511 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
|
512 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
|
513 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
514 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
|
515 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
516 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
|
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 |
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 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
|
521 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
|
522 |
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 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
|
525 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
|
526 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
|
527 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
|
528 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
|
529 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
|
530 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
|
531 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
|
532 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
|
533 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
534 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
|
535 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
|
536 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
|
537 |
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 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
|
540 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
|
541 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
|
542 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
545 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
|
546 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
|
547 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
|
548 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
|
549 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
|
550 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
551 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
|
552 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
|
553 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
|
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 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
|
556 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
|
557 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
558 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
559 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
|
560 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
|
561 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
|
562 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
563 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
|
564 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
565 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
566 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
|
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 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
|
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 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
|
571 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
572 verbs = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
573 verbElements = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
574 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
|
575 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
|
576 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
577 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
|
578 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
|
579 continue |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
580 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
581 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
|
582 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
|
583 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
584 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
|
585 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
|
586 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
587 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
|
588 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
|
589 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
|
590 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
|
591 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
592 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
|
593 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
594 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
|
595 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
|
596 |
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 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
|
598 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
|
599 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
600 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
601 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
602 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
|
603 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
604 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
|
605 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
606 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
|
607 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
|
608 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
|
609 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
|
610 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
611 @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
|
612 @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
|
613 @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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
616 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
617 (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
|
618 childURI, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
619 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
|
620 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
|
621 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
|
622 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
623 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
|
624 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
|
625 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
|
626 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
627 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
|
628 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
|
629 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
|
630 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
|
631 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
632 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
|
633 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
|
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 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
|
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 |
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 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
|
640 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
641 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
|
642 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
643 @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
|
644 @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
|
645 @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
|
646 @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
|
647 @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
|
648 @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
|
649 @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
|
650 @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
|
651 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
652 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
653 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
|
654 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
|
655 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
|
656 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
|
657 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
|
658 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
659 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
660 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
661 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
|
662 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
663 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
|
664 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
665 @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
|
666 @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
|
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 __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
|
670 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
|
671 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
674 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
675 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
|
676 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
677 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
|
678 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
679 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
680 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
684 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
|
685 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
686 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
|
687 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
688 |
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
691 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
|
692 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
693 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
|
694 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
695 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
696 implements(IPubSubClient) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
697 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
698 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
|
699 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
|
700 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
703 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
|
704 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
|
705 return |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
706 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
707 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
708 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
|
709 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
|
710 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
|
711 return |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
712 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
713 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
|
714 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
|
715 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
|
716 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
|
717 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
718 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
|
719 return |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
720 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
721 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
|
722 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
723 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
|
724 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
|
725 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
|
726 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
729 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
|
730 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
|
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 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
|
733 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
|
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 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
|
736 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
|
737 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
738 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
739 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
|
740 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
|
741 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
|
742 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
|
743 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
|
744 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
|
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 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
|
748 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
|
749 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
|
750 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
|
751 |
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 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
|
754 pass |
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 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
|
758 pass |
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
761 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
|
762 pass |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
763 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
764 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
765 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
|
766 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
|
767 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
768 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
|
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 @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
|
771 @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
|
772 @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
|
773 @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
|
774 @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
|
775 @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
|
776 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
777 request = PubSubRequest('create') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
778 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
|
779 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
|
780 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
|
781 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
782 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
|
783 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
|
784 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
|
785 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
|
786 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
|
787 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
788 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
|
789 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
790 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
|
791 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
|
792 # 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
|
793 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
|
794 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
|
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 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
|
797 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
|
798 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
801 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
|
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 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
|
804 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
805 @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
|
806 @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
|
807 @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
|
808 @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
|
809 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
810 request = PubSubRequest('delete') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
811 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
|
812 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
|
813 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
|
814 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
|
815 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
816 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
817 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
|
818 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
|
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 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
|
821 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
822 @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
|
823 @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
|
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 @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
|
826 @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
|
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 @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
|
829 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
|
830 @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
|
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 @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
|
833 @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
|
834 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
835 @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
|
836 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
|
837 @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
|
838 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
839 request = PubSubRequest('subscribe') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
840 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
|
841 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
|
842 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
|
843 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
|
844 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
845 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
|
846 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
|
847 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
|
848 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
|
849 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
|
850 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
851 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
|
852 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
|
853 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
854 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
|
855 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
|
856 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
|
857 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
|
858 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
859 # 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
|
860 # 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
|
861 # 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
|
862 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
|
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 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
|
870 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
|
871 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
872 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
|
873 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
874 @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
|
875 @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
|
876 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
877 @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
|
878 @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
|
879 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
880 @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
|
881 @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
|
882 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
883 @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
|
884 @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
|
885 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
886 request = PubSubRequest('unsubscribe') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
887 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
|
888 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
|
889 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
|
890 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
|
891 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
|
892 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
|
893 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
894 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
895 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
|
896 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
897 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
|
898 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
899 @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
|
900 @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
|
901 @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
|
902 @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
|
903 @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
|
904 @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
|
905 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
906 request = PubSubRequest('publish') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
907 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
|
908 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
|
909 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
|
910 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
|
911 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
914 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
|
915 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
|
916 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
917 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
|
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 @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
|
920 @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
|
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 @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
|
923 @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
|
924 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
925 @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
|
926 @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
|
927 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
928 @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
|
929 @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
|
930 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
931 @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
|
932 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
|
933 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
|
934 @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
|
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 request = PubSubRequest('items') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
937 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
|
938 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
|
939 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
|
940 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
|
941 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
|
942 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
|
943 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
|
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 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
|
946 items = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
947 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
|
948 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
|
949 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
|
950 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
|
951 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
952 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
|
953 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
|
954 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
|
955 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
956 def retractItems(self, service, nodeIdentifier, itemIdentifiers, 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
|
957 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
958 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
|
959 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
960 @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
|
961 @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
|
962 @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
|
963 @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
|
964 @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
|
965 @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
|
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 request = PubSubRequest('retract') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
968 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
|
969 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
|
970 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
|
971 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
|
972 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
|
973 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
974 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
|
975 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
|
976 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
977 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
|
978 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
979 @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
|
980 @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
|
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 @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
|
983 @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
|
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 @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
|
986 @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
|
987 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
988 @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
|
989 @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
|
990 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
991 @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
|
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 request = PubSubRequest('optionsGet') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
994 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
|
995 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
|
996 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
|
997 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
|
998 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
|
999 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1000 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
|
1001 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
|
1002 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
|
1003 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
|
1004 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
|
1005 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1006 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
|
1007 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
|
1008 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
|
1009 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1010 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1011 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
|
1012 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
|
1013 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1014 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
|
1015 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1016 @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
|
1017 @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
|
1018 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1019 @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
|
1020 @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
|
1021 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1022 @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
|
1023 @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
|
1024 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1025 @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
|
1026 @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
|
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 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
|
1029 @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
|
1030 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1031 request = PubSubRequest('optionsSet') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1032 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
|
1033 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
|
1034 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
|
1035 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
|
1036 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
|
1037 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1038 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
|
1039 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
|
1040 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
|
1041 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
|
1042 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1043 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
|
1044 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
|
1045 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1046 |
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 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
|
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 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
|
1051 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1052 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
|
1053 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
|
1054 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
|
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 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
|
1057 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
|
1058 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
|
1059 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
|
1060 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1061 - 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
|
1062 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
|
1063 - 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
|
1064 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
|
1065 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1066 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
|
1067 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
|
1068 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1069 @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
|
1070 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
|
1071 @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
|
1072 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
|
1073 @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
|
1074 """ |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1075 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1076 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
|
1077 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1078 iqHandlers = { |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1079 '/*': '_onPubSubRequest', |
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 _legacyHandlers = { |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1083 '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
|
1084 '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
|
1085 '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
|
1086 '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
|
1087 '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
|
1088 '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
|
1089 '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
|
1090 '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
|
1091 '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
|
1092 '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
|
1093 '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
|
1094 ['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
|
1095 '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
|
1096 'nodeIdentifier']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1097 '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
|
1098 '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
|
1099 '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
|
1100 '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
|
1101 '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
|
1102 'itemIdentifiers']), |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1103 '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
|
1104 '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
|
1105 } |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1106 |
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_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
|
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 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
|
1110 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1111 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
|
1112 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
|
1113 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
|
1114 '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
|
1115 '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
|
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 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1120 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
|
1121 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1124 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
|
1125 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
|
1126 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
|
1127 return |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1128 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1129 (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
|
1130 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
|
1131 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
|
1132 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
|
1133 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
|
1134 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
|
1135 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
|
1136 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
|
1137 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
|
1138 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
|
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 ) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1141 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1142 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
|
1143 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
|
1144 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1145 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
|
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 return |
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 info = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1150 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1151 request = PubSubRequest('discoInfo') |
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 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
|
1154 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
|
1155 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
|
1156 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
|
1157 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
|
1158 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1159 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
|
1160 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
|
1161 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
|
1162 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
|
1163 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
|
1164 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
|
1165 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1166 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
|
1167 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
|
1168 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
|
1169 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
|
1170 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
|
1171 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1172 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
|
1173 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
|
1174 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
|
1175 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
|
1176 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1179 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
|
1180 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
|
1181 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
|
1182 elif 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
|
1183 request = PubSubRequest('discoInfo') |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1184 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
|
1185 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
|
1186 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
|
1187 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
|
1188 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1189 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
|
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 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
|
1192 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
|
1193 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
|
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 |
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 _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
|
1197 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
|
1198 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1199 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
|
1200 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
|
1201 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1202 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
|
1203 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1204 # 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
|
1205 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1206 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
|
1207 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
|
1208 pass |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1209 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1210 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
|
1211 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
|
1212 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
|
1213 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1214 # Process the request itself, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1215 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
|
1216 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1217 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
|
1218 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
|
1219 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
|
1220 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
|
1221 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1222 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
|
1223 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1224 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1225 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
|
1226 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
|
1227 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
|
1228 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
|
1229 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1230 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
|
1231 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
|
1232 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
|
1233 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1234 # 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
|
1235 try: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1236 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
|
1237 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
|
1238 pass |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1239 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1240 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
|
1241 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1242 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
|
1243 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1244 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1245 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
|
1246 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
|
1247 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
|
1248 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1251 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
|
1252 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
|
1253 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
|
1254 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
|
1255 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
|
1256 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
|
1257 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1258 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1259 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
|
1260 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
|
1261 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
|
1262 |
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 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
|
1264 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
|
1265 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
|
1266 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
|
1267 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1268 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1271 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
|
1272 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
|
1273 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
|
1274 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
|
1275 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
|
1276 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
|
1277 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1278 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
|
1279 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1280 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1281 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
|
1282 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
|
1283 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
|
1284 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
|
1285 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
|
1286 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
|
1287 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1288 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1289 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
|
1290 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
|
1291 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1294 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
|
1295 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
|
1296 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
|
1297 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
|
1298 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1299 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1300 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
|
1301 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
|
1302 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
|
1303 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1304 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
|
1305 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1306 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1307 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
|
1308 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
|
1309 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
|
1310 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
|
1311 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
|
1312 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
|
1313 |
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 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
|
1316 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
|
1317 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
|
1318 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
|
1319 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
|
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 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
|
1322 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
|
1323 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1324 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
|
1325 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1326 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1327 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
|
1328 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
|
1329 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
|
1330 else: |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1331 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
|
1332 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1335 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
|
1336 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
|
1337 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
|
1338 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
|
1339 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1340 for item 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
|
1341 if item.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
|
1342 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
|
1343 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
|
1344 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1345 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
|
1346 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1347 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1348 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
|
1349 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
|
1350 headers = [] |
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 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
|
1353 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
|
1354 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
|
1355 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
|
1356 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1357 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
|
1358 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
|
1359 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
|
1360 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
|
1361 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1362 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
|
1363 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
|
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 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
|
1366 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
|
1367 |
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 message |
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 _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
|
1372 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
|
1373 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
|
1374 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1375 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
|
1376 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
|
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 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
|
1379 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
|
1380 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
|
1381 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
|
1382 |
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 # 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
|
1387 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1388 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
|
1389 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
|
1390 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
|
1391 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
|
1392 subscriptions) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1393 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
|
1394 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
|
1395 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
|
1396 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1399 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
|
1400 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
|
1401 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
|
1402 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
|
1403 nodeIdentifier, |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1404 subscriber) |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1405 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
|
1406 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
|
1407 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
|
1408 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
|
1409 |
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 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
|
1412 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
|
1413 |
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 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
|
1416 return [] |
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1419 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
|
1420 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1423 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
|
1424 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
|
1425 |
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 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
|
1428 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
|
1429 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1430 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1431 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
|
1432 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
|
1433 |
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 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
|
1436 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1439 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
|
1440 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
|
1441 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1442 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1443 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
|
1444 return {} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1445 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1446 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1447 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
|
1448 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
|
1449 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1450 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1451 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
|
1452 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
|
1453 |
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 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
|
1456 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1459 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
|
1460 itemIdentifiers): |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1461 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
|
1462 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1463 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1464 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
|
1465 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
|
1466 |
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 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
|
1469 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
|
1470 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1471 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1472 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
|
1473 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
|
1474 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1475 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1476 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1477 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
|
1478 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1479 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
|
1480 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1481 features = [] |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1482 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
|
1483 'service', |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1484 '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
|
1485 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1486 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1487 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
|
1488 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
|
1489 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1490 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1491 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
|
1492 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
|
1493 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1494 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1495 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
|
1496 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
|
1497 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1498 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1499 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
|
1500 return {} |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1501 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1502 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1503 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
|
1504 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
|
1505 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1506 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1507 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
|
1508 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
|
1509 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1510 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1511 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
|
1512 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
|
1513 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1514 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1515 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
|
1516 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
|
1517 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1518 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1519 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
|
1520 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
|
1521 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1522 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1523 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
|
1524 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
|
1525 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1526 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1527 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
|
1528 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
|
1529 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1530 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1531 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
|
1532 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
|
1533 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1534 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1535 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
|
1536 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
|
1537 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1538 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1539 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
|
1540 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
|
1541 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1542 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1543 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
|
1544 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1547 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
|
1548 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1551 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
|
1552 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
|
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 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1555 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
|
1556 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
|
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 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
|
1560 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
|
1561 |
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 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
|
1564 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
|
1565 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1566 |
9141bde7ff31
use sat.tmp.wokkel as a buffer module until the changes are integrated to wokkel
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1567 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
|
1568 return defer.fail(Unsupported('manage-subscriptions')) |