Comparison

plugins/muc/members_only.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 7401:e16b3fd0bd80
comparison
equal deleted inserted replaced
7352:50b24b3476e6 7353:ca31d3271cf8
42 for occupant in pairs(occupants_changed) do 42 for occupant in pairs(occupants_changed) do
43 room:publicise_occupant_status(occupant, x); 43 room:publicise_occupant_status(occupant, x);
44 module:fire_event("muc-occupant-left", {room = room; nick = occupant.nick; occupant = occupant;}); 44 module:fire_event("muc-occupant-left", {room = room; nick = occupant.nick; occupant = occupant;});
45 end 45 end
46 end 46 end
47 room:save(true);
48 return true; 47 return true;
49 end 48 end
50 49
51 module:hook("muc-disco#info", function(event) 50 module:hook("muc-disco#info", function(event)
52 event.reply:tag("feature", {var = get_members_only(event.room) and "muc_membersonly" or "muc_open"}):up(); 51 event.reply:tag("feature", {var = get_members_only(event.room) and "muc_membersonly" or "muc_open"}):up();
116 :get_child("invite").attr.from; 115 :get_child("invite").attr.from;
117 module:log("debug", "%s invited %s into members only room %s, granting membership", 116 module:log("debug", "%s invited %s into members only room %s, granting membership",
118 from, invitee, room.jid); 117 from, invitee, room.jid);
119 -- This might fail; ignore for now 118 -- This might fail; ignore for now
120 room:set_affiliation(from, invitee, "member", "Invited by " .. from); 119 room:set_affiliation(from, invitee, "member", "Invited by " .. from);
120 room:save();
121 end 121 end
122 end 122 end
123 end); 123 end);
124 124
125 return { 125 return {