Comparison

mod_mam_muc/mod_mam_muc.lua @ 1275:50c427295767

mod_mam_muc: Make the logging option in the room config reflect logging and inherit the default
author Kim Alvefur <zash@zash.se>
date Sat, 18 Jan 2014 21:04:33 +0100
parent 1146:9fa89dc7a86f
child 1276:01dfaf2f2782
comparison
equal deleted inserted replaced
1274:4b15437d6c56 1275:50c427295767
31 local archive = module:open_store("archive2", "archive"); 31 local archive = module:open_store("archive2", "archive");
32 local rooms = hosts[module.host].modules.muc.rooms; 32 local rooms = hosts[module.host].modules.muc.rooms;
33 33
34 module:hook("muc-config-form", function(event) 34 module:hook("muc-config-form", function(event)
35 local room, form = event.room, event.form; 35 local room, form = event.room, event.form;
36 local logging_enabled = room._data.logging;
37 if logging_enabled == nil then
38 logging_enabled = log_by_default;
39 end
36 table.insert(form, 40 table.insert(form,
37 { 41 {
38 name = muc_form_config_option, 42 name = muc_form_config_option,
39 type = "boolean", 43 type = "boolean",
40 label = "Enable Logging?", 44 label = "Enable Logging?",
41 value = room._data.logging or false, 45 value = logging_enabled,
42 } 46 }
43 ); 47 );
44 end); 48 end);
45 49
46 module:hook("muc-config-submitted", function(event) 50 module:hook("muc-config-submitted", function(event)