Software /
code /
prosody
Annotate
spec/scansion/pubsub_multi_items.scs @ 13532:9970d333a63f
mod_pubsub: Use error registry
This is what util.error was made for!
This replaces the custom error stanza builder with common code in
util.stanza that knows enough about util.error and namespaced errors.
Some awkwardness remains in the way util.pubsub returns conflicting
form fields.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 27 Oct 2024 15:18:24 +0100 |
parent | 13493:933c669628a3 |
rev | line source |
---|---|
9833 | 1 # Pubsub: Requesting multiple specific items from a node (#1322) |
2 | |
3 [Client] Alice | |
4 jid: admin@localhost | |
5 password: password | |
6 | |
7 --------- | |
8 | |
9 Alice connects | |
10 | |
11 Alice sends: | |
12 <presence xmlns:stream="http://etherx.jabber.org/streams" id=":7IoqYcT3191rfk_dZGo2"/> | |
13 | |
14 Alice receives: | |
15 <presence xmlns:stream="http://etherx.jabber.org/streams" from="${Alice's full JID}" id=":7IoqYcT3191rfk_dZGo2"/> | |
16 | |
17 Alice sends: | |
18 <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id=":m0SM8Hn5JxP9BJJ_X4Mz" type="set"> | |
19 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
20 <create node="e96caf12-264f-4e5a-988e-00ae191771b6"/> | |
21 </pubsub> | |
22 </iq> | |
23 | |
24 Alice receives: | |
25 <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":m0SM8Hn5JxP9BJJ_X4Mz"/> | |
26 | |
27 Alice sends: | |
28 <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id=":gwZgEQmzAHcQz-FZOxi-" type="get"> | |
29 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner"> | |
30 <configure node="e96caf12-264f-4e5a-988e-00ae191771b6"/> | |
31 </pubsub> | |
32 </iq> | |
33 | |
34 Alice receives: | |
35 <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":gwZgEQmzAHcQz-FZOxi-"> | |
36 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner"> | |
37 <configure node="e96caf12-264f-4e5a-988e-00ae191771b6"> | |
38 <x xmlns="jabber:x:data" type="form"> | |
39 <field var="FORM_TYPE" type="hidden"> | |
40 <value>http://jabber.org/protocol/pubsub#node_config</value> | |
41 </field> | |
42 <field var="pubsub#title" label="Title" type="text-single"/> | |
43 <field var="pubsub#description" label="Description" type="text-single"/> | |
44 <field var="pubsub#type" label="The type of node data, usually specified by the namespace of the payload (if any)" type="text-single"/> | |
45 <field var="pubsub#max_items" label="Max # of items to persist" type="text-single"> | |
11855
8890eaa69446
mod_pubsub: Prevent max_items from being set to zero
Kim Alvefur <zash@zash.se>
parents:
11854
diff
changeset
|
46 <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max"> |
11856
14a679588b7b
mod_pubsub,mod_pep: Advertise maximum number of items via XEP-0122
Kim Alvefur <zash@zash.se>
parents:
11855
diff
changeset
|
47 <range min="1" max="256"/> |
11855
8890eaa69446
mod_pubsub: Prevent max_items from being set to zero
Kim Alvefur <zash@zash.se>
parents:
11854
diff
changeset
|
48 </validate> |
9833 | 49 <value>20</value> |
50 </field> | |
51 <field var="pubsub#persist_items" label="Persist items to storage" type="boolean"> | |
11720
72512c0858b3
mod_pubsub: Explicitly enable persistence by default to preserve behavior
Kim Alvefur <zash@zash.se>
parents:
11714
diff
changeset
|
52 <value>1</value> |
9833 | 53 </field> |
54 <field var="pubsub#access_model" label="Specify the subscriber model" type="list-single"> | |
55 <option label="authorize"> | |
56 <value>authorize</value> | |
57 </option> | |
58 <option label="open"> | |
59 <value>open</value> | |
60 </option> | |
61 <option label="presence"> | |
62 <value>presence</value> | |
63 </option> | |
64 <option label="roster"> | |
65 <value>roster</value> | |
66 </option> | |
67 <option label="whitelist"> | |
68 <value>whitelist</value> | |
69 </option> | |
70 <value>open</value> | |
71 </field> | |
13493
933c669628a3
scansion: Add roster groups setting to pubsub form in tests
Kim Alvefur <zash@zash.se>
parents:
12966
diff
changeset
|
72 <field type="list-multi" var="pubsub#roster_groups_allowed" label="Roster groups allowed to subscribe"/> |
9833 | 73 <field var="pubsub#publish_model" label="Specify the publisher model" type="list-single"> |
74 <option label="publishers"> | |
75 <value>publishers</value> | |
76 </option> | |
77 <option label="subscribers"> | |
78 <value>subscribers</value> | |
79 </option> | |
80 <option label="open"> | |
81 <value>open</value> | |
82 </option> | |
83 <value>publishers</value> | |
84 </field> | |
11854
b605cbd5f13b
mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
85 <field type='list-single' var='pubsub#send_last_published_item'> |
b605cbd5f13b
mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
86 <option label='never'> |
b605cbd5f13b
mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
87 <value>never</value> |
b605cbd5f13b
mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
88 </option> |
b605cbd5f13b
mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
89 <option label='on_sub'> |
b605cbd5f13b
mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
90 <value>on_sub</value> |
b605cbd5f13b
mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
91 </option> |
b605cbd5f13b
mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
92 <option label='on_sub_and_presence'> |
b605cbd5f13b
mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
93 <value>on_sub_and_presence</value> |
b605cbd5f13b
mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
94 </option> |
b605cbd5f13b
mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
95 <value>never</value> |
b605cbd5f13b
mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
96 </field> |
9833 | 97 <field var="pubsub#deliver_notifications" label="Whether to deliver event notifications" type="boolean"> |
98 <value>1</value> | |
99 </field> | |
100 <field var="pubsub#deliver_payloads" label="Whether to deliver payloads with event notifications" type="boolean"> | |
101 <value>1</value> | |
102 </field> | |
103 <field var="pubsub#notification_type" label="Specify the delivery style for notifications" type="list-single"> | |
104 <option label="Messages of type normal"> | |
105 <value>normal</value> | |
106 </option> | |
107 <option label="Messages of type headline"> | |
108 <value>headline</value> | |
109 </option> | |
110 <value>headline</value> | |
111 </field> | |
112 <field var="pubsub#notify_delete" label="Whether to notify subscribers when the node is deleted" type="boolean"> | |
113 <value>1</value> | |
114 </field> | |
115 <field var="pubsub#notify_retract" label="Whether to notify subscribers when items are removed from the node" type="boolean"> | |
116 <value>1</value> | |
117 </field> | |
12966
7465d3c5679d
scansion: Fix tests failing after addition of pubsub#itemreply config field
Matthew Wild <mwild1@gmail.com>
parents:
11856
diff
changeset
|
118 <field label="Specify whose JID to include as the publisher of items" var="pubsub#itemreply" type="list-single"> |
7465d3c5679d
scansion: Fix tests failing after addition of pubsub#itemreply config field
Matthew Wild <mwild1@gmail.com>
parents:
11856
diff
changeset
|
119 <option label="Include the node owner's JID"> |
7465d3c5679d
scansion: Fix tests failing after addition of pubsub#itemreply config field
Matthew Wild <mwild1@gmail.com>
parents:
11856
diff
changeset
|
120 <value>owner</value> |
7465d3c5679d
scansion: Fix tests failing after addition of pubsub#itemreply config field
Matthew Wild <mwild1@gmail.com>
parents:
11856
diff
changeset
|
121 </option> |
7465d3c5679d
scansion: Fix tests failing after addition of pubsub#itemreply config field
Matthew Wild <mwild1@gmail.com>
parents:
11856
diff
changeset
|
122 <option label="Include the item publisher's JID"> |
7465d3c5679d
scansion: Fix tests failing after addition of pubsub#itemreply config field
Matthew Wild <mwild1@gmail.com>
parents:
11856
diff
changeset
|
123 <value>publisher</value> |
7465d3c5679d
scansion: Fix tests failing after addition of pubsub#itemreply config field
Matthew Wild <mwild1@gmail.com>
parents:
11856
diff
changeset
|
124 </option> |
7465d3c5679d
scansion: Fix tests failing after addition of pubsub#itemreply config field
Matthew Wild <mwild1@gmail.com>
parents:
11856
diff
changeset
|
125 <option label="Don't include any JID with items"> |
7465d3c5679d
scansion: Fix tests failing after addition of pubsub#itemreply config field
Matthew Wild <mwild1@gmail.com>
parents:
11856
diff
changeset
|
126 <value>none</value> |
7465d3c5679d
scansion: Fix tests failing after addition of pubsub#itemreply config field
Matthew Wild <mwild1@gmail.com>
parents:
11856
diff
changeset
|
127 </option> |
7465d3c5679d
scansion: Fix tests failing after addition of pubsub#itemreply config field
Matthew Wild <mwild1@gmail.com>
parents:
11856
diff
changeset
|
128 <value>none</value> |
7465d3c5679d
scansion: Fix tests failing after addition of pubsub#itemreply config field
Matthew Wild <mwild1@gmail.com>
parents:
11856
diff
changeset
|
129 </field> |
9833 | 130 </x> |
131 </configure> | |
132 </pubsub> | |
133 </iq> | |
134 | |
135 Alice sends: | |
136 <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id=":pfWBQ2MNIq8ieul57Qp7" type="set"> | |
137 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
138 <publish node="e96caf12-264f-4e5a-988e-00ae191771b6"> | |
139 <item id="20e9eb9e-8acb-436e-a486-40e80400faf1"> | |
140 <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">foo</foo> | |
141 </item> | |
142 </publish> | |
143 </pubsub> | |
144 </iq> | |
145 | |
146 Alice receives: | |
147 <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":pfWBQ2MNIq8ieul57Qp7"> | |
148 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
149 <publish node="e96caf12-264f-4e5a-988e-00ae191771b6"> | |
150 <item id="20e9eb9e-8acb-436e-a486-40e80400faf1"/> | |
151 </publish> | |
152 </pubsub> | |
153 </iq> | |
154 | |
155 Alice sends: | |
156 <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id=":Q5TLT6nsW0HHdkDgrPPe" type="set"> | |
157 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
158 <publish node="e96caf12-264f-4e5a-988e-00ae191771b6"> | |
159 <item id="4b94623d-1127-41c0-ac47-e283fd890557"> | |
160 <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">bar</foo> | |
161 </item> | |
162 </publish> | |
163 </pubsub> | |
164 </iq> | |
165 | |
166 Alice receives: | |
167 <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":Q5TLT6nsW0HHdkDgrPPe"> | |
168 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
169 <publish node="e96caf12-264f-4e5a-988e-00ae191771b6"> | |
170 <item id="4b94623d-1127-41c0-ac47-e283fd890557"/> | |
171 </publish> | |
172 </pubsub> | |
173 </iq> | |
174 | |
175 Alice sends: | |
176 <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id=":3nvB2E20p1iuM6lOPaP6" type="get"> | |
177 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
178 <items node="e96caf12-264f-4e5a-988e-00ae191771b6"> | |
179 <item id="20e9eb9e-8acb-436e-a486-40e80400faf1"/> | |
180 <item id="4b94623d-1127-41c0-ac47-e283fd890557"/> | |
181 </items> | |
182 </pubsub> | |
183 </iq> | |
184 | |
185 Alice receives: | |
186 <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":3nvB2E20p1iuM6lOPaP6"> | |
187 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
188 <items node="e96caf12-264f-4e5a-988e-00ae191771b6"> | |
11714
d783716103c1
mod_pubsub: Fix inclusion of publisher (fixes #1399)
Kim Alvefur <zash@zash.se>
parents:
11631
diff
changeset
|
189 <item publisher="${Alice's JID}" xmlns="http://jabber.org/protocol/pubsub" id="20e9eb9e-8acb-436e-a486-40e80400faf1"> |
9833 | 190 <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">foo</foo> |
191 </item> | |
11714
d783716103c1
mod_pubsub: Fix inclusion of publisher (fixes #1399)
Kim Alvefur <zash@zash.se>
parents:
11631
diff
changeset
|
192 <item publisher="${Alice's JID}" xmlns="http://jabber.org/protocol/pubsub" id="4b94623d-1127-41c0-ac47-e283fd890557"> |
9833 | 193 <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">bar</foo> |
194 </item> | |
195 </items> | |
196 </pubsub> | |
197 </iq> | |
198 | |
199 Alice sends: | |
200 <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id=":XQdyK54iyOKiJvUoX9t_" type="get"> | |
201 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
202 <items node="e96caf12-264f-4e5a-988e-00ae191771b6"/> | |
203 </pubsub> | |
204 </iq> | |
205 | |
206 Alice receives: | |
207 <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":XQdyK54iyOKiJvUoX9t_"> | |
208 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
209 <items node="e96caf12-264f-4e5a-988e-00ae191771b6"> | |
11714
d783716103c1
mod_pubsub: Fix inclusion of publisher (fixes #1399)
Kim Alvefur <zash@zash.se>
parents:
11631
diff
changeset
|
210 <item xmlns="http://jabber.org/protocol/pubsub" publisher="${Alice's JID}" id="20e9eb9e-8acb-436e-a486-40e80400faf1"> |
9833 | 211 <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">foo</foo> |
212 </item> | |
11714
d783716103c1
mod_pubsub: Fix inclusion of publisher (fixes #1399)
Kim Alvefur <zash@zash.se>
parents:
11631
diff
changeset
|
213 <item xmlns="http://jabber.org/protocol/pubsub" publisher="${Alice's JID}" id="4b94623d-1127-41c0-ac47-e283fd890557"> |
9833 | 214 <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">bar</foo> |
215 </item> | |
216 </items> | |
217 </pubsub> | |
218 </iq> | |
219 | |
220 Alice sends: | |
221 <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id=":ySGQOz5tnyWT82idwJZP" type="set"> | |
222 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner"> | |
223 <delete node="e96caf12-264f-4e5a-988e-00ae191771b6"/> | |
224 </pubsub> | |
225 </iq> | |
226 | |
227 Alice receives: | |
228 <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":ySGQOz5tnyWT82idwJZP"/> | |
229 |