Software /
code /
prosody-modules
Comparison
mod_muclogging/mod_muclogging.lua @ 51:6a40e44a2b8a
mod_muclogging: removed devel debug message stuff
author | Thilo Cestonaro <thilo@cestona.ro> |
---|---|
date | Sun, 18 Oct 2009 23:17:16 +0200 |
parent | 50:a96d3f37d845 |
comparison
equal
deleted
inserted
replaced
50:a96d3f37d845 | 51:6a40e44a2b8a |
---|---|
6 local prosody = prosody; | 6 local prosody = prosody; |
7 local splitJid = require "util.jid".split; | 7 local splitJid = require "util.jid".split; |
8 local bareJid = require "util.jid".bare; | 8 local bareJid = require "util.jid".bare; |
9 local config_get = require "core.configmanager".get; | 9 local config_get = require "core.configmanager".get; |
10 local httpserver = require "net.httpserver"; | 10 local httpserver = require "net.httpserver"; |
11 local dump = require "util.logger".dump; | 11 -- local dump = require "util.logger".dump; |
12 local config = {}; | 12 local config = {}; |
13 | 13 |
14 --[[ LuaFileSystem | 14 --[[ LuaFileSystem |
15 * URL: http://www.keplerproject.org/luafilesystem/index.html | 15 * URL: http://www.keplerproject.org/luafilesystem/index.html |
16 * Install: luarocks install luafilesystem | 16 * Install: luarocks install luafilesystem |
207 if f ~= nil then | 207 if f ~= nil then |
208 local content = f:read("*a"); | 208 local content = f:read("*a"); |
209 local parsed = lom.parse("<xml>" .. content .. "</xml>"); | 209 local parsed = lom.parse("<xml>" .. content .. "</xml>"); |
210 if parsed ~= nil then | 210 if parsed ~= nil then |
211 for _,stanza in ipairs(parsed) do | 211 for _,stanza in ipairs(parsed) do |
212 module:log("debug", "dump of stanza: \n%s", dump(stanza)) | 212 -- module:log("debug", "dump of stanza: \n%s", dump(stanza)) |
213 if stanza.attr ~= nil and stanza.attr.time ~= nil then | 213 if stanza.attr ~= nil and stanza.attr.time ~= nil then |
214 ret = ret .. "<a name=\"" .. stanza.attr.time .. "\" href=\"#" .. stanza.attr.time .. "\" class=\"timestuff\">[" .. stanza.attr.time .. "]</a> "; | 214 ret = ret .. "<a name=\"" .. stanza.attr.time .. "\" href=\"#" .. stanza.attr.time .. "\" class=\"timestuff\">[" .. stanza.attr.time .. "]</a> "; |
215 if stanza[1] ~= nil then | 215 if stanza[1] ~= nil then |
216 local nick; | 216 local nick; |
217 if stanza[1].attr.from ~= nil then | 217 if stanza[1].attr.from ~= nil then |
302 return; | 302 return; |
303 end | 303 end |
304 | 304 |
305 function module.load() | 305 function module.load() |
306 config = config_get("*", "core", "muclogging"); | 306 config = config_get("*", "core", "muclogging"); |
307 module:log("debug", "muclogging config: \n%s", dump(config)); | 307 -- module:log("debug", "muclogging config: \n%s", dump(config)); |
308 | 308 |
309 if config.http_port ~= nil then | 309 if config.http_port ~= nil then |
310 httpserver.new_from_config({ config.http_port }, "muclogging", handle_request); | 310 httpserver.new_from_config({ config.http_port }, "muclogging", handle_request); |
311 end | 311 end |
312 return validateLogFolder(); | 312 return validateLogFolder(); |