Comparison

mod_muc_offline_delivery/mod_muc_offline_delivery.lua @ 4770:6ca2769da62a

mod_muc_offline_delivery: split name/var so that retrieval of form data works The option is stored in the affiliation data as 'offline_delivery'.
author Matthew Wild <mwild1@gmail.com>
date Mon, 15 Nov 2021 15:29:02 +0000
parent 4768:8bd36bba2292
child 4773:eb63890ae8fc
comparison
equal deleted inserted replaced
4769:00fc569e8333 4770:6ca2769da62a
1 local st = require "util.stanza"; 1 local st = require "util.stanza";
2 2
3 module:add_item("muc-registration-field", { 3 module:add_item("muc-registration-field", {
4 name = "{http://tigase.org/protocol/muc}offline"; 4 name = "offline_delivery";
5 var = "{http://tigase.org/protocol/muc}offline";
5 type = "boolean"; 6 type = "boolean";
6 label = "Receive messages while not connected to the room"; 7 label = "Receive messages while not connected to the room";
7 value = false; 8 value = false;
8 }); 9 });
9 10
10 module:hook("muc-registration-submitted", function (event) 11 module:hook("muc-registration-submitted", function (event)
11 local deliver_offline = event.submitted_data["{http://tigase.org/protocol/muc}offline"] or nil; 12 local deliver_offline = event.submitted_data.offline_delivery or nil;
12 event.affiliation_data.offline_delivery = deliver_offline; 13 event.affiliation_data.offline_delivery = deliver_offline;
13 end); 14 end);
14 15
15 module:hook("muc-add-history", function (event) 16 module:hook("muc-add-history", function (event)
16 module:log("debug", "Broadcasting message to offline occupants..."); 17 module:log("debug", "Broadcasting message to offline occupants...");