Software /
code /
prosody
Annotate
spec/scansion/pubsub_max_items.scs @ 11821:a9ad287c3388
core.moduleapi: Filter out unrelated direct replies to module:send_iq
This is primarily something that happens with an internal query to
mod_mam, which calls origin.send() several times with results, leading
to the first such result being treated as the final response and
resolving the promise.
Now, these responses pass trough to the underlying origin.send(), where
they can be caught. Tricky but not impossible. For remote queries, it's
even trickier, you would likely need to bind a resource or similar.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 24 Sep 2021 20:12:16 +0200 |
parent | 11768:aa6ab07544c2 |
child | 11854:b605cbd5f13b |
rev | line source |
---|---|
11768
aa6ab07544c2
mod_pubsub: Add support for limiting result size #1608
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
1 # Pubsub: Requesting the Most Recent Items (#1608) |
9833 | 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"> | |
11768
aa6ab07544c2
mod_pubsub: Add support for limiting result size #1608
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
20 <create node="5549ea47-ea53-4cc1-9e7c-37842fe4bc06"/> |
9833 | 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"> | |
11768
aa6ab07544c2
mod_pubsub: Add support for limiting result size #1608
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
30 <configure node="5549ea47-ea53-4cc1-9e7c-37842fe4bc06"/> |
9833 | 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"> | |
11768
aa6ab07544c2
mod_pubsub: Add support for limiting result size #1608
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
37 <configure node="5549ea47-ea53-4cc1-9e7c-37842fe4bc06"> |
9833 | 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"> | |
11631
6641ca266d94
mod_pubsub,mod_pep: Support "max" as 'pubsub#max_items'
Kim Alvefur <zash@zash.se>
parents:
9833
diff
changeset
|
46 <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max"/> |
9833 | 47 <value>20</value> |
48 </field> | |
49 <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
|
50 <value>1</value> |
9833 | 51 </field> |
52 <field var="pubsub#access_model" label="Specify the subscriber model" type="list-single"> | |
53 <option label="authorize"> | |
54 <value>authorize</value> | |
55 </option> | |
56 <option label="open"> | |
57 <value>open</value> | |
58 </option> | |
59 <option label="presence"> | |
60 <value>presence</value> | |
61 </option> | |
62 <option label="roster"> | |
63 <value>roster</value> | |
64 </option> | |
65 <option label="whitelist"> | |
66 <value>whitelist</value> | |
67 </option> | |
68 <value>open</value> | |
69 </field> | |
70 <field var="pubsub#publish_model" label="Specify the publisher model" type="list-single"> | |
71 <option label="publishers"> | |
72 <value>publishers</value> | |
73 </option> | |
74 <option label="subscribers"> | |
75 <value>subscribers</value> | |
76 </option> | |
77 <option label="open"> | |
78 <value>open</value> | |
79 </option> | |
80 <value>publishers</value> | |
81 </field> | |
82 <field var="pubsub#deliver_notifications" label="Whether to deliver event notifications" type="boolean"> | |
83 <value>1</value> | |
84 </field> | |
85 <field var="pubsub#deliver_payloads" label="Whether to deliver payloads with event notifications" type="boolean"> | |
86 <value>1</value> | |
87 </field> | |
88 <field var="pubsub#notification_type" label="Specify the delivery style for notifications" type="list-single"> | |
89 <option label="Messages of type normal"> | |
90 <value>normal</value> | |
91 </option> | |
92 <option label="Messages of type headline"> | |
93 <value>headline</value> | |
94 </option> | |
95 <value>headline</value> | |
96 </field> | |
97 <field var="pubsub#notify_delete" label="Whether to notify subscribers when the node is deleted" type="boolean"> | |
98 <value>1</value> | |
99 </field> | |
100 <field var="pubsub#notify_retract" label="Whether to notify subscribers when items are removed from the node" type="boolean"> | |
101 <value>1</value> | |
102 </field> | |
103 </x> | |
104 </configure> | |
105 </pubsub> | |
106 </iq> | |
107 | |
108 Alice sends: | |
109 <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id=":pfWBQ2MNIq8ieul57Qp7" type="set"> | |
110 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
11768
aa6ab07544c2
mod_pubsub: Add support for limiting result size #1608
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
111 <publish node="5549ea47-ea53-4cc1-9e7c-37842fe4bc06"> |
9833 | 112 <item id="20e9eb9e-8acb-436e-a486-40e80400faf1"> |
113 <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">foo</foo> | |
114 </item> | |
115 </publish> | |
116 </pubsub> | |
117 </iq> | |
118 | |
119 Alice receives: | |
120 <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":pfWBQ2MNIq8ieul57Qp7"> | |
121 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
11768
aa6ab07544c2
mod_pubsub: Add support for limiting result size #1608
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
122 <publish node="5549ea47-ea53-4cc1-9e7c-37842fe4bc06"> |
9833 | 123 <item id="20e9eb9e-8acb-436e-a486-40e80400faf1"/> |
124 </publish> | |
125 </pubsub> | |
126 </iq> | |
127 | |
128 Alice sends: | |
129 <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id=":Q5TLT6nsW0HHdkDgrPPe" type="set"> | |
130 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
11768
aa6ab07544c2
mod_pubsub: Add support for limiting result size #1608
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
131 <publish node="5549ea47-ea53-4cc1-9e7c-37842fe4bc06"> |
9833 | 132 <item id="4b94623d-1127-41c0-ac47-e283fd890557"> |
133 <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">bar</foo> | |
134 </item> | |
135 </publish> | |
136 </pubsub> | |
137 </iq> | |
138 | |
139 Alice receives: | |
140 <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":Q5TLT6nsW0HHdkDgrPPe"> | |
141 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
11768
aa6ab07544c2
mod_pubsub: Add support for limiting result size #1608
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
142 <publish node="5549ea47-ea53-4cc1-9e7c-37842fe4bc06"> |
9833 | 143 <item id="4b94623d-1127-41c0-ac47-e283fd890557"/> |
144 </publish> | |
145 </pubsub> | |
146 </iq> | |
147 | |
148 Alice sends: | |
149 <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id=":3nvB2E20p1iuM6lOPaP6" type="get"> | |
150 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
11768
aa6ab07544c2
mod_pubsub: Add support for limiting result size #1608
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
151 <items node="5549ea47-ea53-4cc1-9e7c-37842fe4bc06" max_items="1"/> |
9833 | 152 </pubsub> |
153 </iq> | |
154 | |
155 Alice receives: | |
156 <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":3nvB2E20p1iuM6lOPaP6"> | |
157 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
11768
aa6ab07544c2
mod_pubsub: Add support for limiting result size #1608
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
158 <items node="5549ea47-ea53-4cc1-9e7c-37842fe4bc06"> |
11714
d783716103c1
mod_pubsub: Fix inclusion of publisher (fixes #1399)
Kim Alvefur <zash@zash.se>
parents:
11631
diff
changeset
|
159 <item publisher="${Alice's JID}" xmlns="http://jabber.org/protocol/pubsub" id="4b94623d-1127-41c0-ac47-e283fd890557"> |
9833 | 160 <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">bar</foo> |
161 </item> | |
162 </items> | |
163 </pubsub> | |
164 </iq> | |
165 | |
166 Alice sends: | |
167 <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id=":XQdyK54iyOKiJvUoX9t_" type="get"> | |
168 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
11768
aa6ab07544c2
mod_pubsub: Add support for limiting result size #1608
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
169 <items node="5549ea47-ea53-4cc1-9e7c-37842fe4bc06"/> |
9833 | 170 </pubsub> |
171 </iq> | |
172 | |
173 Alice receives: | |
174 <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":XQdyK54iyOKiJvUoX9t_"> | |
175 <pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
11768
aa6ab07544c2
mod_pubsub: Add support for limiting result size #1608
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
176 <items node="5549ea47-ea53-4cc1-9e7c-37842fe4bc06"> |
11714
d783716103c1
mod_pubsub: Fix inclusion of publisher (fixes #1399)
Kim Alvefur <zash@zash.se>
parents:
11631
diff
changeset
|
177 <item xmlns="http://jabber.org/protocol/pubsub" publisher="${Alice's JID}" id="20e9eb9e-8acb-436e-a486-40e80400faf1"> |
9833 | 178 <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">foo</foo> |
179 </item> | |
11714
d783716103c1
mod_pubsub: Fix inclusion of publisher (fixes #1399)
Kim Alvefur <zash@zash.se>
parents:
11631
diff
changeset
|
180 <item xmlns="http://jabber.org/protocol/pubsub" publisher="${Alice's JID}" id="4b94623d-1127-41c0-ac47-e283fd890557"> |
9833 | 181 <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">bar</foo> |
182 </item> | |
183 </items> | |
184 </pubsub> | |
185 </iq> | |
186 | |
187 Alice sends: | |
188 <iq xmlns:stream="http://etherx.jabber.org/streams" to="pubsub.localhost" id=":ySGQOz5tnyWT82idwJZP" type="set"> | |
189 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner"> | |
11768
aa6ab07544c2
mod_pubsub: Add support for limiting result size #1608
Kim Alvefur <zash@zash.se>
parents:
11720
diff
changeset
|
190 <delete node="5549ea47-ea53-4cc1-9e7c-37842fe4bc06"/> |
9833 | 191 </pubsub> |
192 </iq> | |
193 | |
194 Alice receives: | |
195 <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":ySGQOz5tnyWT82idwJZP"/> | |
196 |