Mercurial > prosody-hg
comparison plugins/muc/name.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 |
| parents | 50b24b3476e6 |
| children | e16b3fd0bd80 |
comparison
equal
deleted
inserted
replaced
| 7352:50b24b3476e6 | 7353:ca31d3271cf8 |
|---|---|
| 15 | 15 |
| 16 local function set_name(room, name) | 16 local function set_name(room, name) |
| 17 if name == "" or name == (jid_split(room.jid)) then name = nil; end | 17 if name == "" or name == (jid_split(room.jid)) then name = nil; end |
| 18 if room._data.name == name then return false; end | 18 if room._data.name == name then return false; end |
| 19 room._data.name = name; | 19 room._data.name = name; |
| 20 room:save(true); | |
| 21 return true; | 20 return true; |
| 22 end | 21 end |
| 23 | 22 |
| 24 module:hook("muc-disco#info", function(event) | 23 module:hook("muc-disco#info", function(event) |
| 25 event.reply:tag("identity", {category="conference", type="text", name=get_name(event.room)}):up(); | 24 event.reply:tag("identity", {category="conference", type="text", name=get_name(event.room)}):up(); |
