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; |