changesubject = changesubject and true or nil;
if get_changesubject(room) == changesubject then return false; end
room._data.changesubject = changesubject;
- if room.save then room:save(true); end
return true;
end
label = "Allow Occupants to Change Subject?";
value = get_changesubject(event.room);
});
-end);
+end, 100-8);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_changesubject"];
- if new ~= nil and set_changesubject(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_changesubject", function(event)
+ if set_changesubject(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
if old_subject == subject and old_from == from then return false; end
room._data.subject_from = from;
room._data.subject = subject;
- if room.save then room:save(); end
local msg = create_subject_message(from, subject);
room:broadcast_message(msg);
return true;
local stanza = event.stanza;
local subject = stanza:get_child("subject");
if subject then
+ local room = event.room;
local occupant = event.occupant;
-- Role check for subject changes
local role_rank = valid_roles[occupant and occupant.role or "none"];
if role_rank >= valid_roles.moderator or
- ( role_rank >= valid_roles.participant and get_changesubject(event.room) ) then -- and participant
- set_subject(event.room, occupant.nick, subject:get_text());
+ ( role_rank >= valid_roles.participant and get_changesubject(room) ) then -- and participant
+ set_subject(room, occupant.nick, subject:get_text());
+ room:save();
return true;
else
event.origin.send(st.error_reply(stanza, "auth", "forbidden"));