return "MUC room ("..self.jid..")";
end
+function room_mt.save()
+ -- overriden by mod_muc.lua
+end
+
function room_mt:get_occupant_jid(real_jid)
return self._jid_nick[real_jid]
end
end
event.field, event.value = nil, nil;
- if self.save then self:save(true); end
+ self:save(true);
origin.send(st.reply(stanza));
if next(event.status_codes) then
occupants_updated[occupant] = true;
end
for occupant in pairs(occupants_updated) do
+ occupant:set_session(occupant.jid, st.presence({type="unavailable"}), true);
self:publicise_occupant_status(occupant, x);
module:fire_event("muc-occupant-left", { room = self; nick = occupant.nick; occupant = occupant;});
end
else
success, errtype, err = nil, "cancel", "bad-request";
end
+ room:save();
if not success then
origin.send(st.error_reply(stanza, errtype, err));
else
end
end
- if self.save then self:save(); end
+ self:save(true);
module:fire_event("muc-set-affiliation", {
room = self;
local _M = {}; -- module "muc"
-function _M.new_room(jid, config) -- luacheck: ignore 212
- -- TODO use config?
+function _M.new_room(jid, config)
return setmetatable({
jid = jid;
_jid_nick = {};
_occupants = {};
- _data = {
- };
+ _data = config or {};
_affiliations = {};
}, room_mt);
end
+function room_mt:freeze()
+ return {
+ jid = self.jid;
+ _data = self._data;
+ _affiliations = self._affiliations;
+ }
+end
+
_M.room_mt = room_mt;
return _M;