});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_affiliationnotify"];
- if new ~= nil and set_affiliation_notify(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_affiliationnotify", function(event)
+ if set_affiliation_notify(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
module:hook("muc-disco#info", add_form_option);
module:hook("muc-config-form", add_form_option);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_roomdesc"];
- if new ~= nil and set_description(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_roomdesc", function(event)
+ if set_description(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_publicroom"];
- if new ~= nil and set_hidden(event.room, not new) then
+module:hook("muc-config-submitted/muc#roomconfig_publicroom", function(event)
+ if set_hidden(event.room, not event.value) then
event.status_codes["104"] = true;
end
end);
end
local function set_historylength(room, length)
- length = assert(tonumber(length), "Length not a valid number");
+ if length then
+ length = assert(tonumber(length), "Length not a valid number");
+ end
if length == default_history_length then length = nil; end
room._data.history_length = length;
return true;
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_historylength"];
- if new ~= nil and set_historylength(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_historylength", function(event)
+ if set_historylength(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_membersonly"];
- if new ~= nil and set_members_only(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_membersonly", function(event)
+ if set_members_only(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_moderatedroom"];
- if new ~= nil and set_moderated(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_moderatedroom", function(event)
+ if set_moderated(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_roomname"];
- if new ~= nil and set_name(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_roomname", function(event)
+ if set_name(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_roomsecret"];
- if new ~= nil and set_password(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_roomsecret", function(event)
+ if set_password(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_persistentroom"];
- if new ~= nil and set_persistent(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_persistentroom", function(event)
+ if set_persistent(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
});
end);
-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);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_whois"];
- if new ~= nil and set_whois(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_whois", function(event)
+ if set_whois(event.room, event.value) then
local code = (new == 'moderators') and "173" or "172";
event.status_codes[code] = true;
end