Comparison

plugins/muc/muc.lib.lua @ 7353:ca31d3271cf8

MUC: Save room to storage once after form processing, not in each individual setter
author Kim Alvefur <zash@zash.se>
date Fri, 15 Apr 2016 11:50:55 +0200
parent 7352:50b24b3476e6
child 7360:7a37fade5380
comparison
equal deleted inserted replaced
7352:50b24b3476e6 7353:ca31d3271cf8
780 elseif item.attr.role and item.attr.nick and not item.attr.affiliation then 780 elseif item.attr.role and item.attr.nick and not item.attr.affiliation then
781 success, errtype, err = self:set_role(actor, self.jid.."/"..item.attr.nick, item.attr.role, reason); 781 success, errtype, err = self:set_role(actor, self.jid.."/"..item.attr.nick, item.attr.role, reason);
782 else 782 else
783 success, errtype, err = nil, "cancel", "bad-request"; 783 success, errtype, err = nil, "cancel", "bad-request";
784 end 784 end
785 room:save();
785 if not success then 786 if not success then
786 origin.send(st.error_reply(stanza, errtype, err)); 787 origin.send(st.error_reply(stanza, errtype, err));
787 else 788 else
788 origin.send(st.reply(stanza)); 789 origin.send(st.reply(stanza));
789 end 790 end
1146 end); 1147 end);
1147 end 1148 end
1148 end 1149 end
1149 end 1150 end
1150 1151
1151 if self.save then self:save(); end 1152 self:save(true);
1152 1153
1153 module:fire_event("muc-set-affiliation", { 1154 module:fire_event("muc-set-affiliation", {
1154 room = self; 1155 room = self;
1155 actor = actor; 1156 actor = actor;
1156 jid = jid; 1157 jid = jid;