Software /
code /
prosody-modules
Comparison
mod_mam_muc/mod_mam_muc.lua @ 1313:440d7276ca62
mod_mam_muc: Rename variable
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 20 Feb 2014 20:22:35 +0100 |
parent | 1312:a48cf3ccdf9c |
child | 1314:cc9831033f5d |
comparison
equal
deleted
inserted
replaced
1312:a48cf3ccdf9c | 1313:440d7276ca62 |
---|---|
1 -- XEP-0313: Message Archive Management for Prosody | 1 -- XEP-0313: Message Archive Management for Prosody MUC |
2 -- Copyright (C) 2011-2013 Kim Alvefur | 2 -- Copyright (C) 2011-2013 Kim Alvefur |
3 -- | 3 -- |
4 -- This file is MIT/X11 licensed. | 4 -- This file is MIT/X11 licensed. |
5 | 5 |
6 local xmlns_mam = "urn:xmpp:mam:tmp"; | 6 local xmlns_mam = "urn:xmpp:mam:tmp"; |
7 local xmlns_delay = "urn:xmpp:delay"; | 7 local xmlns_delay = "urn:xmpp:delay"; |
8 local xmlns_forward = "urn:xmpp:forward:0"; | 8 local xmlns_forward = "urn:xmpp:forward:0"; |
9 local muc_form_config_option = "muc#roomconfig_enablelogging" | 9 local muc_form_enable_logging = "muc#roomconfig_enablelogging" |
10 | 10 |
11 local st = require "util.stanza"; | 11 local st = require "util.stanza"; |
12 local rsm = module:require "mod_mam/rsm"; | 12 local rsm = module:require "mod_mam/rsm"; |
13 local jid_bare = require "util.jid".bare; | 13 local jid_bare = require "util.jid".bare; |
14 local jid_split = require "util.jid".split; | 14 local jid_split = require "util.jid".split; |
49 if logging_enabled == nil then | 49 if logging_enabled == nil then |
50 logging_enabled = log_by_default; | 50 logging_enabled = log_by_default; |
51 end | 51 end |
52 table.insert(form, | 52 table.insert(form, |
53 { | 53 { |
54 name = muc_form_config_option, | 54 name = muc_form_enable_logging, |
55 type = "boolean", | 55 type = "boolean", |
56 label = "Enable Logging?", | 56 label = "Enable Logging?", |
57 value = logging_enabled, | 57 value = logging_enabled, |
58 } | 58 } |
59 ); | 59 ); |
60 end); | 60 end); |
61 | 61 |
62 module:hook("muc-config-submitted", function(event) | 62 module:hook("muc-config-submitted", function(event) |
63 local room, fields, changed = event.room, event.fields, event.changed; | 63 local room, fields, changed = event.room, event.fields, event.changed; |
64 local new = fields[muc_form_config_option]; | 64 local new = fields[muc_form_enable_logging]; |
65 if new ~= room._data.logging then | 65 if new ~= room._data.logging then |
66 room._data.logging = new; | 66 room._data.logging = new; |
67 if type(changed) == "table" then | 67 if type(changed) == "table" then |
68 changed[muc_form_config_option] = true; | 68 changed[muc_form_enable_logging] = true; |
69 else | 69 else |
70 event.changed = true; | 70 event.changed = true; |
71 end | 71 end |
72 end | 72 end |
73 end); | 73 end); |