Comparison

plugins/mod_pubsub/pubsub.lib.lua @ 8815:5974c9da1391

mod_pubsub: Add support for generation of a plain text <body> from Atom payloads See https://xmpp.org/extensions/xep-0060.html#impl-body
author Kim Alvefur <zash@zash.se>
date Mon, 21 May 2018 00:44:37 +0200
parent 8814:07197f29e2b8
child 8822:4afa77e0d2b0
comparison
equal deleted inserted replaced
8814:07197f29e2b8 8815:5974c9da1391
51 type = "boolean"; 51 type = "boolean";
52 name = "pubsub#persist_items"; 52 name = "pubsub#persist_items";
53 label = "Persist items to storage"; 53 label = "Persist items to storage";
54 }; 54 };
55 { 55 {
56 type = "boolean";
57 name = "pubsub#include_body";
58 label = "Receive message body in addition to payload?";
59 };
60 {
56 type = "list-single"; 61 type = "list-single";
57 name = "pubsub#notification_type"; 62 name = "pubsub#notification_type";
58 label = "Specify the delivery style for notifications"; 63 label = "Specify the delivery style for notifications";
59 options = { 64 options = {
60 { label = "Messages of type normal", value = "normal" }, 65 { label = "Messages of type normal", value = "normal" },
194 end 199 end
195 config = { 200 config = {
196 ["max_items"] = tonumber(form_data["pubsub#max_items"]); 201 ["max_items"] = tonumber(form_data["pubsub#max_items"]);
197 ["persist_items"] = form_data["pubsub#persist_items"]; 202 ["persist_items"] = form_data["pubsub#persist_items"];
198 ["notification_type"] = form_data["pubsub#notification_type"]; 203 ["notification_type"] = form_data["pubsub#notification_type"];
204 ["include_body"] = form_data["pubsub#include_body"];
199 }; 205 };
200 end 206 end
201 if node then 207 if node then
202 ok, ret = service:create(node, stanza.attr.from, config); 208 ok, ret = service:create(node, stanza.attr.from, config);
203 if ok then 209 if ok then
382 local node_config = node_obj.config; 388 local node_config = node_obj.config;
383 local pubsub_form_data = { 389 local pubsub_form_data = {
384 ["pubsub#max_items"] = tostring(node_config["max_items"]); 390 ["pubsub#max_items"] = tostring(node_config["max_items"]);
385 ["pubsub#persist_items"] = node_config["persist_items"]; 391 ["pubsub#persist_items"] = node_config["persist_items"];
386 ["pubsub#notification_type"] = node_config["notification_type"]; 392 ["pubsub#notification_type"] = node_config["notification_type"];
393 ["pubsub#include_body"] = node_config["include_body"];
387 } 394 }
388 local reply = st.reply(stanza) 395 local reply = st.reply(stanza)
389 :tag("pubsub", { xmlns = xmlns_pubsub_owner }) 396 :tag("pubsub", { xmlns = xmlns_pubsub_owner })
390 :tag("configure", { node = node }) 397 :tag("configure", { node = node })
391 :add_child(node_config_form:form(pubsub_form_data)); 398 :add_child(node_config_form:form(pubsub_form_data));