MUC: Save room to storage once after form processing, not in each individual setter
--- a/plugins/muc/affiliation_notify.lib.lua Thu Apr 14 21:23:09 2016 +0200
+++ b/plugins/muc/affiliation_notify.lib.lua Fri Apr 15 11:50:55 2016 +0200
@@ -24,7 +24,6 @@
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
--- a/plugins/muc/description.lib.lua Thu Apr 14 21:23:09 2016 +0200
+++ b/plugins/muc/description.lib.lua Fri Apr 15 11:50:55 2016 +0200
@@ -15,7 +15,6 @@
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
--- a/plugins/muc/hidden.lib.lua Thu Apr 14 21:23:09 2016 +0200
+++ b/plugins/muc/hidden.lib.lua Fri Apr 15 11:50:55 2016 +0200
@@ -15,7 +15,6 @@
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
--- a/plugins/muc/members_only.lib.lua Thu Apr 14 21:23:09 2016 +0200
+++ b/plugins/muc/members_only.lib.lua Fri Apr 15 11:50:55 2016 +0200
@@ -44,7 +44,6 @@
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 @@
from, invitee, room.jid);
-- This might fail; ignore for now
room:set_affiliation(from, invitee, "member", "Invited by " .. from);
+ room:save();
end
end
end);
--- a/plugins/muc/moderated.lib.lua Thu Apr 14 21:23:09 2016 +0200
+++ b/plugins/muc/moderated.lib.lua Fri Apr 15 11:50:55 2016 +0200
@@ -15,7 +15,6 @@
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
--- a/plugins/muc/muc.lib.lua Thu Apr 14 21:23:09 2016 +0200
+++ b/plugins/muc/muc.lib.lua Fri Apr 15 11:50:55 2016 +0200
@@ -782,6 +782,7 @@
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 @@
end
end
- if self.save then self:save(); end
+ self:save(true);
module:fire_event("muc-set-affiliation", {
room = self;
--- a/plugins/muc/name.lib.lua Thu Apr 14 21:23:09 2016 +0200
+++ b/plugins/muc/name.lib.lua Fri Apr 15 11:50:55 2016 +0200
@@ -17,7 +17,6 @@
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
--- a/plugins/muc/password.lib.lua Thu Apr 14 21:23:09 2016 +0200
+++ b/plugins/muc/password.lib.lua Fri Apr 15 11:50:55 2016 +0200
@@ -17,7 +17,6 @@
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
--- a/plugins/muc/persistent.lib.lua Thu Apr 14 21:23:09 2016 +0200
+++ b/plugins/muc/persistent.lib.lua Fri Apr 15 11:50:55 2016 +0200
@@ -15,7 +15,6 @@
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
--- a/plugins/muc/subject.lib.lua Thu Apr 14 21:23:09 2016 +0200
+++ b/plugins/muc/subject.lib.lua Fri Apr 15 11:50:55 2016 +0200
@@ -25,7 +25,6 @@
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 @@
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;
--- a/plugins/muc/whois.lib.lua Thu Apr 14 21:23:09 2016 +0200
+++ b/plugins/muc/whois.lib.lua Fri Apr 15 11:50:55 2016 +0200
@@ -20,7 +20,6 @@
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