Mercurial > prosody-modules
annotate mod_muc_log/mod_muc_log.lua @ 1007:ba220790a59c
mod_message_logging: New module to log user conversations to text files
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 09 May 2013 10:39:20 +0100 |
parents | 290c21a5e0ee |
children | b69e5d63a4fe |
rev | line source |
---|---|
47
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
1 local prosody = prosody; |
1004
290c21a5e0ee
mod_muc_log, mod_muc_log_http: cleanup syntax (off with the "~= nil"), and cut down wild table indexing.
Marco Cirillo <maranda@lightwitch.org>
parents:
976
diff
changeset
|
2 local hosts = prosody.hosts; |
976
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
3 local tostring = tostring; |
47
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
4 local splitJid = require "util.jid".split; |
976
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
5 local cm = require "core.configmanager"; |
62
0dfd65bfedb0
mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents:
61
diff
changeset
|
6 local datamanager = require "util.datamanager"; |
0dfd65bfedb0
mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents:
61
diff
changeset
|
7 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
|
8 local datastore = "muc_log"; |
976
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
9 local error_reply = require "util.stanza".error_reply; |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
10 local storagemanager = storagemanager; |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
11 |
103
0491aa849c91
mod_muc_log: make that it logs again
Thilo Cestonaro <thilo@cestona.ro>
parents:
94
diff
changeset
|
12 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
|
13 local config = nil; |
50
a96d3f37d845
mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents:
47
diff
changeset
|
14 |
976
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
15 -- Helper Functions |
103
0491aa849c91
mod_muc_log: make that it logs again
Thilo Cestonaro <thilo@cestona.ro>
parents:
94
diff
changeset
|
16 |
976
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
17 local function inject_storage_config() |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
18 local _storage = cm.getconfig()[mod_host].storage; |
50
a96d3f37d845
mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents:
47
diff
changeset
|
19 |
976
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
20 module:log("debug", "injecting storage config..."); |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
21 if type(_storage) == "string" then cm.getconfig()[mod_host].default_storage = _storage; end |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
22 if type(_storage) == "table" then -- append |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
23 _storage.muc_log = "internal"; |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
24 else |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
25 cm.getconfig()[mod_host].storage = { muc_log = "internal" }; |
62
0dfd65bfedb0
mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents:
61
diff
changeset
|
26 end |
976
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
27 |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
28 storagemanager.get_driver(mod_host, "muc_log"); -- init |
50
a96d3f37d845
mod_muclogging: with http_server part for viewing
Thilo Cestonaro <thilo@cestona.ro>
parents:
47
diff
changeset
|
29 end |
47
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
30 |
976
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
31 -- Module Definitions |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
32 |
47
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
33 function logIfNeeded(e) |
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
34 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
|
35 |
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
|
36 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
|
37 (stanza.name == "iq") or |
55
d9749ed44f6e
mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents:
54
diff
changeset
|
38 (stanza.name == "message" and tostring(stanza.attr.type) == "groupchat") |
47
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
39 then |
1004
290c21a5e0ee
mod_muc_log, mod_muc_log_http: cleanup syntax (off with the "~= nil"), and cut down wild table indexing.
Marco Cirillo <maranda@lightwitch.org>
parents:
976
diff
changeset
|
40 local node, host = splitJid(stanza.attr.to); |
290c21a5e0ee
mod_muc_log, mod_muc_log_http: cleanup syntax (off with the "~= nil"), and cut down wild table indexing.
Marco Cirillo <maranda@lightwitch.org>
parents:
976
diff
changeset
|
41 local muc = hosts[host].muc; |
290c21a5e0ee
mod_muc_log, mod_muc_log_http: cleanup syntax (off with the "~= nil"), and cut down wild table indexing.
Marco Cirillo <maranda@lightwitch.org>
parents:
976
diff
changeset
|
42 if node and host then |
47
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
43 local bare = node .. "@" .. host; |
1004
290c21a5e0ee
mod_muc_log, mod_muc_log_http: cleanup syntax (off with the "~= nil"), and cut down wild table indexing.
Marco Cirillo <maranda@lightwitch.org>
parents:
976
diff
changeset
|
44 if muc and muc.rooms[bare] then |
290c21a5e0ee
mod_muc_log, mod_muc_log_http: cleanup syntax (off with the "~= nil"), and cut down wild table indexing.
Marco Cirillo <maranda@lightwitch.org>
parents:
976
diff
changeset
|
45 local room = muc.rooms[bare] |
55
d9749ed44f6e
mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents:
54
diff
changeset
|
46 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
|
47 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
|
48 local mucTo = nil |
55
d9749ed44f6e
mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents:
54
diff
changeset
|
49 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
|
50 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
|
51 |
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
|
52 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
|
53 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
|
54 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
|
55 |
55
d9749ed44f6e
mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents:
54
diff
changeset
|
56 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
|
57 mucFrom = stanza.attr.to; |
1004
290c21a5e0ee
mod_muc_log, mod_muc_log_http: cleanup syntax (off with the "~= nil"), and cut down wild table indexing.
Marco Cirillo <maranda@lightwitch.org>
parents:
976
diff
changeset
|
58 if room._occupants and room._occupants[stanza.attr.to] then -- if true, the user has already joined the room |
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
|
59 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
|
60 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
|
61 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
|
62 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 |
1004
290c21a5e0ee
mod_muc_log, mod_muc_log_http: cleanup syntax (off with the "~= nil"), and cut down wild table indexing.
Marco Cirillo <maranda@lightwitch.org>
parents:
976
diff
changeset
|
63 if stanza.tags[1] and stanza.tags[1].name == "query" then |
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
|
64 local tmp = stanza.tags[1]; |
1004
290c21a5e0ee
mod_muc_log, mod_muc_log_http: cleanup syntax (off with the "~= nil"), and cut down wild table indexing.
Marco Cirillo <maranda@lightwitch.org>
parents:
976
diff
changeset
|
65 if tmp.tags[1] ~= nil and tmp.tags[1].name == "item" and tmp.tags[1].attr.nick then |
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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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
|
72 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
|
73 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
|
74 end |
55
d9749ed44f6e
mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents:
54
diff
changeset
|
75 else |
d9749ed44f6e
mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents:
54
diff
changeset
|
76 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
|
77 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
|
78 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
|
79 break; |
47
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
80 end |
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
81 end |
55
d9749ed44f6e
mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents:
54
diff
changeset
|
82 end |
47
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
83 |
1004
290c21a5e0ee
mod_muc_log, mod_muc_log_http: cleanup syntax (off with the "~= nil"), and cut down wild table indexing.
Marco Cirillo <maranda@lightwitch.org>
parents:
976
diff
changeset
|
84 if (mucFrom or mucTo) then |
62
0dfd65bfedb0
mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents:
61
diff
changeset
|
85 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
|
86 local realFrom = stanza.attr.from; |
d9749ed44f6e
mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents:
54
diff
changeset
|
87 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
|
88 |
0dfd65bfedb0
mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents:
61
diff
changeset
|
89 if data == nil then |
0dfd65bfedb0
mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents:
61
diff
changeset
|
90 data = {}; |
0dfd65bfedb0
mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents:
61
diff
changeset
|
91 end |
0dfd65bfedb0
mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents:
61
diff
changeset
|
92 |
55
d9749ed44f6e
mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents:
54
diff
changeset
|
93 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
|
94 stanza.attr.to = mucTo; |
62
0dfd65bfedb0
mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents:
61
diff
changeset
|
95 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
|
96 stanza.attr.from = realFrom; |
d9749ed44f6e
mod_muc_log: make it recognize s2s messages/presences
Thilo Cestonaro <thilo@cestona.ro>
parents:
54
diff
changeset
|
97 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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 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
|
106 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
|
107 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
|
108 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
|
109 end |
62
0dfd65bfedb0
mod_muc_log: using datamanager to store the logging.
Thilo Cestonaro <thilo@cestona.ro>
parents:
61
diff
changeset
|
110 data_store(node, host, datastore .. "/" .. today, data); |
47
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
111 end |
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
112 end |
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
113 end |
99ff520519fe
mod_muclogging: initial checkin
Thilo Cestonaro <thilo@cestona.ro>
parents:
diff
changeset
|
114 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
|
115 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
|
116 |
94
941fd7d8b9b2
mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents:
90
diff
changeset
|
117 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
|
118 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
|
119 module:hook("presence/full", logIfNeeded, 500); |
103
0491aa849c91
mod_muc_log: make that it logs again
Thilo Cestonaro <thilo@cestona.ro>
parents:
94
diff
changeset
|
120 |
976
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
121 local function reload() |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
122 inject_storage_config(); |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
123 end |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
124 |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
125 function module.load() |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
126 inject_storage_config(); |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
127 end |
0428009c1127
mod_muc_log: some cleanup and code refactor also force the plugin storage driver being internal.
Marco Cirillo <maranda@lightwitch.org>
parents:
103
diff
changeset
|
128 |
94
941fd7d8b9b2
mod_muc_log: split into mod_muc_log and mod_muc_log_http
Thilo Cestonaro <thilo@cestona.ro>
parents:
90
diff
changeset
|
129 module:log("debug", "module mod_muc_log loaded!"); |