Comparison

plugins/muc/mod_muc.lua @ 4528:875b90d5ce0f

muc - implement per channel history limits - allow configuration via channel settings - store the settings for permanent channels - honor muc max_history_messages from the config as upper limit - only broadcast_message with historic = true if history_length is > 0
author Markus Kötter <koetter@rrzn-hiwi.uni-hannover.de>
date Fri, 13 Apr 2012 21:23:26 +0200
parent 4370:be14f96290a4
child 4924:d8b9fe5900a2
comparison
equal deleted inserted replaced
4517:2e274e088ddc 4528:875b90d5ce0f
67 67
68 for jid in pairs(persistent_rooms) do 68 for jid in pairs(persistent_rooms) do
69 local node = jid_split(jid); 69 local node = jid_split(jid);
70 local data = datamanager.load(node, muc_host, "config") or {}; 70 local data = datamanager.load(node, muc_host, "config") or {};
71 local room = muc_new_room(jid, { 71 local room = muc_new_room(jid, {
72 history_length = max_history_messages; 72 max_history_length = max_history_messages;
73 }); 73 });
74 room._data = data._data; 74 room._data = data._data;
75 room._data.history_length = max_history_messages; --TODO: Need to allow per-room with a global limit 75 room._data.max_history_length = max_history_messages; -- Overwrite old max_history_length in data with current settings
76 room._affiliations = data._affiliations; 76 room._affiliations = data._affiliations;
77 room.route_stanza = room_route_stanza; 77 room.route_stanza = room_route_stanza;
78 room.save = room_save; 78 room.save = room_save;
79 rooms[jid] = room; 79 rooms[jid] = room;
80 end 80 end
81 81
82 local host_room = muc_new_room(muc_host, { 82 local host_room = muc_new_room(muc_host, {
83 history_length = max_history_messages; 83 max_history_length = max_history_messages;
84 }); 84 });
85 host_room.route_stanza = room_route_stanza; 85 host_room.route_stanza = room_route_stanza;
86 host_room.save = room_save; 86 host_room.save = room_save;
87 87
88 local function get_disco_info(stanza) 88 local function get_disco_info(stanza)
129 if not room then 129 if not room then
130 if not(restrict_room_creation) or 130 if not(restrict_room_creation) or
131 (restrict_room_creation == "admin" and is_admin(stanza.attr.from)) or 131 (restrict_room_creation == "admin" and is_admin(stanza.attr.from)) or
132 (restrict_room_creation == "local" and select(2, jid_split(stanza.attr.from)) == module.host:gsub("^[^%.]+%.", "")) then 132 (restrict_room_creation == "local" and select(2, jid_split(stanza.attr.from)) == module.host:gsub("^[^%.]+%.", "")) then
133 room = muc_new_room(bare, { 133 room = muc_new_room(bare, {
134 history_length = max_history_messages; 134 max_history_length = max_history_messages;
135 }); 135 });
136 room.route_stanza = room_route_stanza; 136 room.route_stanza = room_route_stanza;
137 room.save = room_save; 137 room.save = room_save;
138 rooms[bare] = room; 138 rooms[bare] = room;
139 end 139 end