Comparison

plugins/mod_pubsub/mod_pubsub.lua @ 11717:605484fc1c62

mod_pubsub: Normalize 'publisher' JID All the XEP-0060 examples have the publisher attribute set to a bare JID, but the text does allow it to be the full JID. Since mod_pubsub is more likely used for open nodes that anyone can subscribe to it makes sense to not leak the full JIDs. This is also disabled by defaults. In mod_pep on the other hand it might make sense to have the full JID since that data is more likely to be broadcast to contacts which are already somewhat trusted.
author Kim Alvefur <zash@zash.se>
date Sun, 25 Jul 2021 14:01:45 +0200
parent 11715:ddd6e21e58bf
child 11718:d79f5431f31b
comparison
equal deleted inserted replaced
11716:30f1e826cc95 11717:605484fc1c62
55 local archive = driver:open("pubsub_"..node_name, "archive"); 55 local archive = driver:open("pubsub_"..node_name, "archive");
56 local max_items = tonumber_max_items(node_config["max_items"]); 56 local max_items = tonumber_max_items(node_config["max_items"]);
57 return lib_pubsub.archive_itemstore(archive, max_items, nil, node_name); 57 return lib_pubsub.archive_itemstore(archive, max_items, nil, node_name);
58 end 58 end
59 59
60 function simple_broadcast(kind, node, jids, item, actor, node_obj) 60 function simple_broadcast(kind, node, jids, item, actor, node_obj, service)
61 if node_obj then 61 if node_obj then
62 if node_obj.config["notify_"..kind] == false then 62 if node_obj.config["notify_"..kind] == false then
63 return; 63 return;
64 end 64 end
65 end 65 end
73 if kind == "items" then 73 if kind == "items" then
74 if node_obj and node_obj.config.include_payload == false then 74 if node_obj and node_obj.config.include_payload == false then
75 item:maptags(function () return nil; end); 75 item:maptags(function () return nil; end);
76 end 76 end
77 if expose_publisher and actor then 77 if expose_publisher and actor then
78 item.attr.publisher = actor 78 item.attr.publisher = service.config.normalize_jid(actor);
79 end 79 end
80 end 80 end
81 end 81 end
82 82
83 local id = new_id(); 83 local id = new_id();