Mercurial > prosody-hg
comparison plugins/muc/description.lib.lua @ 8829:6dd7fea941f6
MUC: Use correct field name for description in disco#info (fixes #1148)
Introduced in c3254827698d
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 26 May 2018 14:44:50 +0200 |
| parents | e16b3fd0bd80 |
| children | 5d7db3c7c026 |
comparison
equal
deleted
inserted
replaced
| 8828:2a0d7fa4c56a | 8829:6dd7fea941f6 |
|---|---|
| 16 if get_description(room) == description then return false; end | 16 if get_description(room) == description then return false; end |
| 17 room._data.description = description; | 17 room._data.description = description; |
| 18 return true; | 18 return true; |
| 19 end | 19 end |
| 20 | 20 |
| 21 local function add_disco_form(event) | |
| 22 table.insert(event.form, { | |
| 23 name = "muc#roominfo_description"; | |
| 24 label = "Description"; | |
| 25 value = get_description(event.room) or ""; | |
| 26 }); | |
| 27 end | |
| 28 | |
| 21 local function add_form_option(event) | 29 local function add_form_option(event) |
| 22 table.insert(event.form, { | 30 table.insert(event.form, { |
| 23 name = "muc#roomconfig_roomdesc"; | 31 name = "muc#roomconfig_roomdesc"; |
| 24 type = "text-single"; | 32 type = "text-single"; |
| 25 label = "Description"; | 33 label = "Description"; |
| 26 value = get_description(event.room) or ""; | 34 value = get_description(event.room) or ""; |
| 27 }); | 35 }); |
| 28 end | 36 end |
| 29 module:hook("muc-disco#info", add_form_option); | 37 module:hook("muc-disco#info", add_disco_form); |
| 30 module:hook("muc-config-form", add_form_option, 100-2); | 38 module:hook("muc-config-form", add_form_option, 100-2); |
| 31 | 39 |
| 32 module:hook("muc-config-submitted/muc#roomconfig_roomdesc", function(event) | 40 module:hook("muc-config-submitted/muc#roomconfig_roomdesc", function(event) |
| 33 if set_description(event.room, event.value) then | 41 if set_description(event.room, event.value) then |
| 34 event.status_codes["104"] = true; | 42 event.status_codes["104"] = true; |
