mod_muc_log/mod_muc_log.lua
author Thilo Cestonaro <thilo@cestona.ro>
Tue, 17 Nov 2009 21:19:17 +0100
changeset 94 941fd7d8b9b2
parent 90 d6521ebea967
child 103 0491aa849c91
permissions -rw-r--r--
mod_muc_log: split into mod_muc_log and mod_muc_log_http mod_muc_log: should be enabled per muc component which should log! mod_muc_log_http: handle /me messages, add previous, next day links to day view, add link to speeqe.com to directly join the room, make the window recalculate the content div size, scrollbars are only shown when needed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
     1
-- Copyright (C) 2009 Thilo Cestonaro
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
     2
-- 
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
     3
-- This project is MIT/X11 licensed. Please see the
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
     4
-- COPYING file in the source package for more information.
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
     5
--
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
     6
local prosody = prosody;
94
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
     7
local tostring = _G.tostring;
47
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
     8
local splitJid = require "util.jid".split;
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
     9
local config_get = require "core.configmanager".get;
62
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    10
local datamanager = require "util.datamanager";
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    11
local data_load, data_store, data_getpath = datamanager.load, datamanager.store, datamanager.getpath;
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    12
local datastore = "muc_log";
94
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
    13
-- local mod_host = module:get_host();
88
d8cdbebb58f2 mod_muc_log: can handle now more components and should be used as global module! HTTP Path changed to http://...../muc_log/<component>/<room>/
Thilo Cestonaro <thilo@cestona.ro>
parents: 87
diff changeset
    14
local config = nil;
50
a96d3f37d845 mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents: 47
diff changeset
    15
a96d3f37d845 mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents: 47
diff changeset
    16
--[[ LuaFileSystem 
a96d3f37d845 mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents: 47
diff changeset
    17
* URL: http://www.keplerproject.org/luafilesystem/index.html
a96d3f37d845 mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents: 47
diff changeset
    18
* Install: luarocks install luafilesystem
a96d3f37d845 mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents: 47
diff changeset
    19
* ]]
a96d3f37d845 mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents: 47
diff changeset
    20
local lfs = require "lfs";
56
e9de45beaf5e mod_muc_log: templify the html stuff
Thilo Cestonaro <thilo@cestona.ro>
parents: 55
diff changeset
    21
--[[
94
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
    22
local function checkDatastorePathExists(node, host, today, create)
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
    23
	create = create or false;
62
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    24
	local path = data_getpath(node, host, datastore, "dat", true);
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    25
	path = path:gsub("/[^/]*$", "");
50
a96d3f37d845 mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents: 47
diff changeset
    26
a96d3f37d845 mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents: 47
diff changeset
    27
	-- check existance
85
83494de806a4 mod_muc_log: Do not log other muc-component's rooms then the module was loaded for. Do neither log nor provide access to possible existing log if a room is private. (thx flo for spotting this)
Thilo Cestonaro <thilo@cestona.ro>
parents: 81
diff changeset
    28
	local attributes, err = lfs.attributes(path);
83494de806a4 mod_muc_log: Do not log other muc-component's rooms then the module was loaded for. Do neither log nor provide access to possible existing log if a room is private. (thx flo for spotting this)
Thilo Cestonaro <thilo@cestona.ro>
parents: 81
diff changeset
    29
	if attributes == nil or attributes.mode ~= "directory" then
62
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    30
		module:log("warn", "muc_log folder isn't a folder: %s", path);
50
a96d3f37d845 mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents: 47
diff changeset
    31
		return false;
62
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    32
	end
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    33
	
85
83494de806a4 mod_muc_log: Do not log other muc-component's rooms then the module was loaded for. Do neither log nor provide access to possible existing log if a room is private. (thx flo for spotting this)
Thilo Cestonaro <thilo@cestona.ro>
parents: 81
diff changeset
    34
	attributes, err = lfs.attributes(path .. "/" .. today);
62
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    35
	if attributes == nil then
94
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
    36
		if create then
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
    37
			return lfs.mkdir(path .. "/" .. today);
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
    38
		else
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
    39
			return false;
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
    40
		end
62
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    41
	elseif attributes.mode == "directory" then
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    42
		return true;
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    43
	end
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    44
	return false;
50
a96d3f37d845 mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents: 47
diff changeset
    45
end
47
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
    46
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
    47
function logIfNeeded(e)
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
    48
	local stanza, origin = e.stanza, e.origin;
50
a96d3f37d845 mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents: 47
diff changeset
    49
	
61
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    50
	if	(stanza.name == "presence") or
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    51
		(stanza.name == "iq") or
55
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
    52
	   	(stanza.name == "message" and tostring(stanza.attr.type) == "groupchat")
47
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
    53
	then
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
    54
		local node, host, resource = splitJid(stanza.attr.to);
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
    55
		if node ~= nil and host ~= nil then
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
    56
			local bare = node .. "@" .. host;
94
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
    57
			if host == mod_host and prosody.hosts[host] ~= nil and prosody.hosts[host].muc ~= nil and prosody.hosts[host].muc.rooms[bare] ~= nil then
47
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
    58
				local room = prosody.hosts[host].muc.rooms[bare]
55
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
    59
				local today = os.date("%y%m%d");
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
    60
				local now = os.date("%X")
61
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    61
				local mucTo = nil
55
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
    62
				local mucFrom = nil;
61
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    63
				local alreadyJoined = false;
85
83494de806a4 mod_muc_log: Do not log other muc-component's rooms then the module was loaded for. Do neither log nor provide access to possible existing log if a room is private. (thx flo for spotting this)
Thilo Cestonaro <thilo@cestona.ro>
parents: 81
diff changeset
    64
				
83494de806a4 mod_muc_log: Do not log other muc-component's rooms then the module was loaded for. Do neither log nor provide access to possible existing log if a room is private. (thx flo for spotting this)
Thilo Cestonaro <thilo@cestona.ro>
parents: 81
diff changeset
    65
				if room._data.hidden then -- do not log any data of private rooms
83494de806a4 mod_muc_log: Do not log other muc-component's rooms then the module was loaded for. Do neither log nor provide access to possible existing log if a room is private. (thx flo for spotting this)
Thilo Cestonaro <thilo@cestona.ro>
parents: 81
diff changeset
    66
					return;
83494de806a4 mod_muc_log: Do not log other muc-component's rooms then the module was loaded for. Do neither log nor provide access to possible existing log if a room is private. (thx flo for spotting this)
Thilo Cestonaro <thilo@cestona.ro>
parents: 81
diff changeset
    67
				end
83494de806a4 mod_muc_log: Do not log other muc-component's rooms then the module was loaded for. Do neither log nor provide access to possible existing log if a room is private. (thx flo for spotting this)
Thilo Cestonaro <thilo@cestona.ro>
parents: 81
diff changeset
    68
				
55
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
    69
				if stanza.name == "presence" and stanza.attr.type == nil then
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
    70
					mucFrom = stanza.attr.to;
61
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    71
					if room._occupants ~= nil and room._occupants[stanza.attr.to] ~= nil then -- if true, the user has already joined the room
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    72
						alreadyJoined = true;
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    73
						stanza:tag("alreadyJoined"):text("true"); -- we need to log the information that the user has already joined, so add this and remove after logging
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    74
					end
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    75
				elseif stanza.name == "iq" and stanza.attr.type == "set" then -- kick, to is the room, from is the admin, nick who is kicked is attr of iq->query->item
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    76
					if stanza.tags[1] ~= nil and stanza.tags[1].name == "query" then
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    77
						local tmp = stanza.tags[1];
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    78
						if tmp.tags[1] ~= nil and tmp.tags[1].name == "item" and tmp.tags[1].attr.nick ~= nil then
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    79
							tmp = tmp.tags[1];
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    80
							for jid, nick in pairs(room._jid_nick) do
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    81
								if nick == stanza.attr.to .. "/" .. tmp.attr.nick then
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    82
									mucTo = nick;
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    83
									break;
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    84
								end
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    85
							end
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    86
						end
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    87
					end
55
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
    88
				else
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
    89
					for jid, nick in pairs(room._jid_nick) do
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
    90
						if jid == stanza.attr.from then
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
    91
							mucFrom = nick;
61
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
    92
							break;
47
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
    93
						end
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
    94
					end
55
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
    95
				end
47
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
    96
94
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
    97
				if (mucFrom ~= nil or mucTo ~= nil) and checkDatastorePathExists(node, host, today, true) then
62
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
    98
					local data = data_load(node, host, datastore .. "/" .. today);
55
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
    99
					local realFrom = stanza.attr.from;
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
   100
					local realTo = stanza.attr.to;
62
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
   101
					
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
   102
					if data == nil then
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
   103
						data = {};
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
   104
					end
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
   105
					
55
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
   106
					stanza.attr.from = mucFrom;
61
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   107
					stanza.attr.to = mucTo;
62
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
   108
					data[#data + 1] = "<stanza time=\"".. now .. "\">" .. tostring(stanza) .. "</stanza>\n";
55
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
   109
					stanza.attr.from = realFrom;
d9749ed44f6e mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents: 54
diff changeset
   110
					stanza.attr.to = realTo;
61
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   111
					if alreadyJoined == true then
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   112
						if stanza[#stanza].name == "alreadyJoined" then  -- normaly the faked element should be the last, remove it when it is the last
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   113
							stanza[#stanza] = nil;
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   114
						else
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   115
							for i = 1, #stanza, 1 do
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   116
								if stanza[i].name == "alreadyJoined" then  -- remove the faked element
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   117
									stanza[i] = nil;
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   118
									break;
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   119
								end
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   120
							end
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   121
						end
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   122
					end
62
0dfd65bfedb0 mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents: 61
diff changeset
   123
					data_store(node, host, datastore .. "/" .. today, data);
47
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
   124
				end
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
   125
			end
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
   126
		end
99ff520519fe mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff changeset
   127
	end
61
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   128
end
e609da067e9f mod_muc_log: display room's current title; show kicked messages with and without reason
Thilo Cestonaro <thilo@cestona.ro>
parents: 60
diff changeset
   129
94
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
   130
module:hook("message/bare", logIfNeeded, 500);
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
   131
module:hook("iq/bare", logIfNeeded, 500);
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
   132
module:hook("presence/full", logIfNeeded, 500);
90
d6521ebea967 mod_muc_log: specified day is now part of the url not a query. days are sorted, newest top.
Thilo Cestonaro <thilo@cestona.ro>
parents: 89
diff changeset
   133
]]--
94
941fd7d8b9b2 mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents: 90
diff changeset
   134
module:log("debug", "module mod_muc_log loaded!");