diff options
author | Kim Alvefur <zash@zash.se> | 2016-04-15 11:50:55 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-04-15 11:50:55 +0200 |
commit | 7ea91caa95e5f1e65a03032559241ec4832203df (patch) | |
tree | 9f885da1a933ab13e2fa3c18bd359e8c240f274b /plugins/muc | |
parent | e05eb9a0d70487b62ebd85686044af7859696799 (diff) | |
download | prosody-7ea91caa95e5f1e65a03032559241ec4832203df.tar.gz prosody-7ea91caa95e5f1e65a03032559241ec4832203df.zip |
MUC: Save room to storage once after form processing, not in each individual setter
Diffstat (limited to 'plugins/muc')
-rw-r--r-- | plugins/muc/affiliation_notify.lib.lua | 1 | ||||
-rw-r--r-- | plugins/muc/description.lib.lua | 1 | ||||
-rw-r--r-- | plugins/muc/hidden.lib.lua | 1 | ||||
-rw-r--r-- | plugins/muc/members_only.lib.lua | 2 | ||||
-rw-r--r-- | plugins/muc/moderated.lib.lua | 1 | ||||
-rw-r--r-- | plugins/muc/muc.lib.lua | 3 | ||||
-rw-r--r-- | plugins/muc/name.lib.lua | 1 | ||||
-rw-r--r-- | plugins/muc/password.lib.lua | 1 | ||||
-rw-r--r-- | plugins/muc/persistent.lib.lua | 1 | ||||
-rw-r--r-- | plugins/muc/subject.lib.lua | 2 | ||||
-rw-r--r-- | plugins/muc/whois.lib.lua | 1 |
11 files changed, 3 insertions, 12 deletions
diff --git a/plugins/muc/affiliation_notify.lib.lua b/plugins/muc/affiliation_notify.lib.lua index 7996c4b8..e708ae94 100644 --- a/plugins/muc/affiliation_notify.lib.lua +++ b/plugins/muc/affiliation_notify.lib.lua @@ -24,7 +24,6 @@ local function set_affiliation_notify(room, affiliation_notify) affiliation_notify = affiliation_notify and true or nil; if room._data.affiliation_notify == affiliation_notify then return false; end room._data.affiliation_notify = affiliation_notify; - room:save(true); return true; end diff --git a/plugins/muc/description.lib.lua b/plugins/muc/description.lib.lua index 8dfabbcb..44556a46 100644 --- a/plugins/muc/description.lib.lua +++ b/plugins/muc/description.lib.lua @@ -15,7 +15,6 @@ local function set_description(room, description) if description == "" then description = nil; end if get_description(room) == description then return false; end room._data.description = description; - room:save(true); return true; end diff --git a/plugins/muc/hidden.lib.lua b/plugins/muc/hidden.lib.lua index e1821bd7..43521e14 100644 --- a/plugins/muc/hidden.lib.lua +++ b/plugins/muc/hidden.lib.lua @@ -15,7 +15,6 @@ local function set_hidden(room, hidden) hidden = hidden and true or nil; if get_hidden(room) == hidden then return false; end room._data.hidden = hidden; - room:save(true); return true; end diff --git a/plugins/muc/members_only.lib.lua b/plugins/muc/members_only.lib.lua index 7a6de43b..888e8622 100644 --- a/plugins/muc/members_only.lib.lua +++ b/plugins/muc/members_only.lib.lua @@ -44,7 +44,6 @@ local function set_members_only(room, members_only) module:fire_event("muc-occupant-left", {room = room; nick = occupant.nick; occupant = occupant;}); end end - room:save(true); return true; end @@ -118,6 +117,7 @@ module:hook("muc-invite", function(event) from, invitee, room.jid); -- This might fail; ignore for now room:set_affiliation(from, invitee, "member", "Invited by " .. from); + room:save(); end end end); diff --git a/plugins/muc/moderated.lib.lua b/plugins/muc/moderated.lib.lua index a7e6314c..2f53ba4c 100644 --- a/plugins/muc/moderated.lib.lua +++ b/plugins/muc/moderated.lib.lua @@ -15,7 +15,6 @@ local function set_moderated(room, moderated) moderated = moderated and true or nil; if get_moderated(room) == moderated then return false; end room._data.moderated = moderated; - room:save(true); return true; end diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 7ff9bde5..42a0af25 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -782,6 +782,7 @@ function room_mt:handle_admin_query_set_command(origin, stanza) else success, errtype, err = nil, "cancel", "bad-request"; end + room:save(); if not success then origin.send(st.error_reply(stanza, errtype, err)); else @@ -1148,7 +1149,7 @@ function room_mt:set_affiliation(actor, jid, affiliation, reason) end end - if self.save then self:save(); end + self:save(true); module:fire_event("muc-set-affiliation", { room = self; diff --git a/plugins/muc/name.lib.lua b/plugins/muc/name.lib.lua index fb014f75..3dbae9db 100644 --- a/plugins/muc/name.lib.lua +++ b/plugins/muc/name.lib.lua @@ -17,7 +17,6 @@ local function set_name(room, name) if name == "" or name == (jid_split(room.jid)) then name = nil; end if room._data.name == name then return false; end room._data.name = name; - room:save(true); return true; end diff --git a/plugins/muc/password.lib.lua b/plugins/muc/password.lib.lua index da122d1c..8cb124ea 100644 --- a/plugins/muc/password.lib.lua +++ b/plugins/muc/password.lib.lua @@ -17,7 +17,6 @@ local function set_password(room, password) if password == "" then password = nil; end if room._data.password == password then return false; end room._data.password = password; - room:save(true); return true; end diff --git a/plugins/muc/persistent.lib.lua b/plugins/muc/persistent.lib.lua index 60493e06..773509b5 100644 --- a/plugins/muc/persistent.lib.lua +++ b/plugins/muc/persistent.lib.lua @@ -15,7 +15,6 @@ local function set_persistent(room, persistent) persistent = persistent and true or nil; if get_persistent(room) == persistent then return false; end room._data.persistent = persistent; - room:save(true); return true; end diff --git a/plugins/muc/subject.lib.lua b/plugins/muc/subject.lib.lua index 2b1a2f52..8f5f9231 100644 --- a/plugins/muc/subject.lib.lua +++ b/plugins/muc/subject.lib.lua @@ -25,7 +25,6 @@ local function set_changesubject(room, changesubject) changesubject = changesubject and true or nil; if get_changesubject(room) == changesubject then return false; end room._data.changesubject = changesubject; - room:save(true); return true; end @@ -61,7 +60,6 @@ local function set_subject(room, from, subject) if old_subject == subject and old_from == from then return false; end room._data.subject_from = from; room._data.subject = subject; - room:save(); local msg = create_subject_message(from, subject); room:broadcast_message(msg); return true; diff --git a/plugins/muc/whois.lib.lua b/plugins/muc/whois.lib.lua index 84916c6a..07e72c69 100644 --- a/plugins/muc/whois.lib.lua +++ b/plugins/muc/whois.lib.lua @@ -20,7 +20,6 @@ local function set_whois(room, whois) assert(valid_whois[whois], "Invalid whois value") if get_whois(room) == whois then return false; end room._data.whois = whois; - room:save(true); return true; end |