Comparison

plugins/muc/affiliation_notify.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
22 22
23 local function set_affiliation_notify(room, affiliation_notify) 23 local function set_affiliation_notify(room, affiliation_notify)
24 affiliation_notify = affiliation_notify and true or nil; 24 affiliation_notify = affiliation_notify and true or nil;
25 if room._data.affiliation_notify == affiliation_notify then return false; end 25 if room._data.affiliation_notify == affiliation_notify then return false; end
26 room._data.affiliation_notify = affiliation_notify; 26 room._data.affiliation_notify = affiliation_notify;
27 room:save(true);
28 return true; 27 return true;
29 end 28 end
30 29
31 module:hook("muc-config-form", function(event) 30 module:hook("muc-config-form", function(event)
32 table.insert(event.form, { 31 table.insert(event.form, {