Comparison

plugins/mod_bookmarks.lua @ 12177:024cc878f472

mod_bookmarks: Block publishing to older XEP-0402 v0.3.0 node Having both the :0 and :1 nodes would be especially awkward, since there is no upgrade path for this case. In theory, these should be rare since no clients should have been doing XEP-0402 unless mod_bookmarks(2) was enabled. This was guesstimated to be rare with most clients doing XEP-0048 with Private XML.
author Kim Alvefur <zash@zash.se>
date Mon, 10 Jan 2022 22:15:55 +0100
parent 12172:2515033c2a74
child 12178:0aa99a6dfb3e
comparison
equal deleted inserted replaced
12176:e7639625a848 12177:024cc878f472
8 8
9 local mod_pep = module:depends "pep"; 9 local mod_pep = module:depends "pep";
10 local private_storage = module:open_store("private", "map"); 10 local private_storage = module:open_store("private", "map");
11 11
12 local namespace = "urn:xmpp:bookmarks:1"; 12 local namespace = "urn:xmpp:bookmarks:1";
13 local namespace_old = "urn:xmpp:bookmarks:0";
13 local namespace_private = "jabber:iq:private"; 14 local namespace_private = "jabber:iq:private";
14 local namespace_legacy = "storage:bookmarks"; 15 local namespace_legacy = "storage:bookmarks";
15 local xmlns_pubsub = "http://jabber.org/protocol/pubsub"; 16 local xmlns_pubsub = "http://jabber.org/protocol/pubsub";
16 17
17 local default_options = { 18 local default_options = {
269 if pubsub == nil then 270 if pubsub == nil then
270 return; 271 return;
271 end 272 end
272 273
273 local publish = pubsub:get_child("publish"); 274 local publish = pubsub:get_child("publish");
274 if publish == nil or publish.attr.node ~= namespace_legacy then 275 if publish == nil then return end
276 if publish.attr.node == namespace_old then
277 session.send(st.error_reply(stanza, "modify", "not-allowed",
278 "Your client does XEP-0402 version 0.3.0 but 0.4.0+ is required"));
279 return true;
280 end
281 if publish.attr.node ~= namespace_legacy then
275 return; 282 return;
276 end 283 end
277 284
278 local item = publish:get_child("item"); 285 local item = publish:get_child("item");
279 if item == nil then 286 if item == nil then