Software / code / prosody
Comparison
plugins/muc/whois.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 |
|---|---|
| 18 | 18 |
| 19 local function set_whois(room, whois) | 19 local function set_whois(room, whois) |
| 20 assert(valid_whois[whois], "Invalid whois value") | 20 assert(valid_whois[whois], "Invalid whois value") |
| 21 if get_whois(room) == whois then return false; end | 21 if get_whois(room) == whois then return false; end |
| 22 room._data.whois = whois; | 22 room._data.whois = whois; |
| 23 room:save(true); | |
| 24 return true; | 23 return true; |
| 25 end | 24 end |
| 26 | 25 |
| 27 module:hook("muc-disco#info", function(event) | 26 module:hook("muc-disco#info", function(event) |
| 28 event.reply:tag("feature", {var = get_whois(event.room) ~= "anyone" and "muc_semianonymous" or "muc_nonanonymous"}):up(); | 27 event.reply:tag("feature", {var = get_whois(event.room) ~= "anyone" and "muc_semianonymous" or "muc_nonanonymous"}):up(); |