Comparison

mod_muc_log/mod_muc_log.lua @ 60:5cca708c9f11

mod_muc_log: escape nicknames and status messages too. (thx waqas for finding it; Hope you had fun :P )
author Thilo Cestonaro <thilo@cestona.ro>
date Wed, 21 Oct 2009 10:19:25 +0200
parent 59:50e3d5b87119
child 61:e609da067e9f
comparison
equal deleted inserted replaced
59:50e3d5b87119 60:5cca708c9f11
254 end 254 end
255 end 255 end
256 if show ~= nil then 256 if show ~= nil then
257 ret = html.day.presence.statusChange:gsub("###TIME_STUFF###", timeStuff); 257 ret = html.day.presence.statusChange:gsub("###TIME_STUFF###", timeStuff);
258 if status ~= "" then 258 if status ~= "" then
259 status = html.day.presence.statusText:gsub("###STATUS###", status); 259 status = html.day.presence.statusText:gsub("###STATUS###", htmlEscape(status));
260 end 260 end
261 ret = ret:gsub("###SHOW###", show):gsub("###NICK###", nick):gsub("###STATUS_STUFF###", status); 261 ret = ret:gsub("###SHOW###", show):gsub("###NICK###", nick):gsub("###STATUS_STUFF###", status);
262 else 262 else
263 ret = html.day.presence.join:gsub("###TIME_STUFF###", timeStuff):gsub("###NICK###", nick); 263 ret = html.day.presence.join:gsub("###TIME_STUFF###", timeStuff):gsub("###NICK###", nick);
264 end 264 end
276 body = tag[1]; 276 body = tag[1];
277 if nick ~= nil then 277 if nick ~= nil then
278 break; 278 break;
279 end 279 end
280 elseif tag.tag == "nick" and nick == nil then 280 elseif tag.tag == "nick" and nick == nil then
281 nick = tag[1]; 281 nick = htmlEscape(tag[1]);
282 if body ~= nil or title ~= nil then 282 if body ~= nil or title ~= nil then
283 break; 283 break;
284 end 284 end
285 elseif tag.tag == "subject" then 285 elseif tag.tag == "subject" then
286 title = tag[1]; 286 title = tag[1];
320 if stanza[1] ~= nil then 320 if stanza[1] ~= nil then
321 local nick; 321 local nick;
322 322
323 -- grep nick from "from" resource 323 -- grep nick from "from" resource
324 if stanza[1].attr.from ~= nil then 324 if stanza[1].attr.from ~= nil then
325 nick = stanza[1].attr.from:match("/(.+)$"); 325 nick = htmlEscape(stanza[1].attr.from:match("/(.+)$"));
326 end 326 end
327 327
328 if stanza[1].tag == "presence" and nick ~= nil then 328 if stanza[1].tag == "presence" and nick ~= nil then
329 ret = ret .. parsePresenceStanza(stanza, timeStuff, nick); 329 ret = ret .. parsePresenceStanza(stanza, timeStuff, nick);
330 elseif stanza[1].tag == "message" then 330 elseif stanza[1].tag == "message" then