Software /
code /
prosody-modules
Annotate
mod_stanza_counter/mod_stanza_counter.lua @ 434:ac4a6cc5776c
mod_stanza_counter: cleanup, corrections. (prosody starts, web stats work)
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Tue, 20 Sep 2011 22:05:14 +0000 |
parent | 433:967757965dbd |
child | 435:b6abe463b4fc |
rev | line source |
---|---|
432
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
1 -- (C) 2011, Marco Cirillo (LW.Org) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
2 -- General Stanzas' Counter with web output. |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
3 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
4 local jid_bare = require "util.jid".bare |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
5 local httpserver = require "net.httpserver" |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
6 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
7 module.host = "*" -- Needs to be global for stats web wise. |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
8 |
434
ac4a6cc5776c
mod_stanza_counter: cleanup, corrections. (prosody starts, web stats work)
Marco Cirillo <maranda@lightwitch.org>
parents:
433
diff
changeset
|
9 local ports = module:get_option_array("stanza_counter_ports" or {{ port = 5280 }}) |
432
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
10 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
11 -- http handlers |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
12 |
434
ac4a6cc5776c
mod_stanza_counter: cleanup, corrections. (prosody starts, web stats work)
Marco Cirillo <maranda@lightwitch.org>
parents:
433
diff
changeset
|
13 local r_200 = "\n<html>\n<head>\n<title>Prosody's Stanza Counter</title>\n<meta name=\"robots\" content=\"noindex, nofollow\" />\n</head>\n\n<body>\n<h3>Incoming and Outgoing stanzas divided per type</h3>\n<p><strong>Incoming IQs</strong>: %d<br/>\n<strong>Outgoing IQs</strong>: %d<br/>\n<strong>Incoming Messages</strong>: %d<br/>\n<strong>Outgoing Messages</strong>: %d<br/>\n<strong>Incoming Presences</strong>: %d<br/>\n<strong>Outgoing Presences</strong>: %d<p>\n</body>\n\n</html>\n" |
432
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
14 |
434
ac4a6cc5776c
mod_stanza_counter: cleanup, corrections. (prosody starts, web stats work)
Marco Cirillo <maranda@lightwitch.org>
parents:
433
diff
changeset
|
15 local r_405 = "\n<html>\n<head>\n<title>Prosody's Stanza Counter - Error</title>\n<meta name=\"robots\" content=\"noindex, nofollow\" />\n</head>\n\n<body>\n<h3>Bad Method ... I only support GET.</h3>\n</body>\n\n</html>\n" |
432
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
16 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
17 local function res(code, r, h) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
18 local response = { |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
19 status = code; |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
20 body = r; |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
21 } |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
22 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
23 if h then response.headers = h; end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
24 return response |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
25 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
26 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
27 local function req(method, body, request) |
434
ac4a6cc5776c
mod_stanza_counter: cleanup, corrections. (prosody starts, web stats work)
Marco Cirillo <maranda@lightwitch.org>
parents:
433
diff
changeset
|
28 if method == "GET" then |
432
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
29 local forge_res = r_200:format(prosody.stanza_counter.iq["incoming"], |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
30 prosody.stanza_counter.iq["outgoing"], |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
31 prosody.stanza_counter.message["incoming"], |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
32 prosody.stanza_counter.message["outgoing"], |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
33 prosody.stanza_counter.presence["incoming"], |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
34 prosody.stanza_counter.presence["outgoing"]); |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
35 return res(200, forge_res) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
36 else |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
37 return res(405, r_405, {["Allow"] = "GET"}) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
38 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
39 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
40 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
41 -- Setup, Init functions. |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
42 -- initialize function counter table on the global object on start |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
43 local function init_counter() |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
44 prosody.stanza_counter = { |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
45 iq = { incoming=0, outgoing=0 }, |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
46 message = { incoming=0, outgoing=0 }, |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
47 presence = { incoming=0, outgoing=0 } |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
48 } |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
49 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
50 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
51 -- init http interface |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
52 local function init_web() |
434
ac4a6cc5776c
mod_stanza_counter: cleanup, corrections. (prosody starts, web stats work)
Marco Cirillo <maranda@lightwitch.org>
parents:
433
diff
changeset
|
53 httpserver.new_from_config(ports, req, { base = "stanza-counter" }) |
432
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
54 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
55 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
56 -- Setup on server start |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
57 local function setup() |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
58 init_counter(); init_web(); |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
59 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
60 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
61 -- Basic Stanzas' Counters |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
62 local function iq_callback(check) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
63 return function(self) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
64 local origin, stanza = self.origin, self.stanza |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
65 if not prosody.stanza_counter then init_counter() end |
434
ac4a6cc5776c
mod_stanza_counter: cleanup, corrections. (prosody starts, web stats work)
Marco Cirillo <maranda@lightwitch.org>
parents:
433
diff
changeset
|
66 if check then |
432
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
67 if not stanza.attr.to or hosts[jid_bare(stanza.attr.to)] then return nil; |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
68 else |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
69 prosody.stanza_counter.iq["outgoing"] = prosody.stanza_counter.iq["outgoing"] + 1 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
70 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
71 else |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
72 prosody.stanza_counter.iq["incoming"] = prosody.stanza_counter.iq["incoming"] + 1 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
73 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
74 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
75 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
76 |
434
ac4a6cc5776c
mod_stanza_counter: cleanup, corrections. (prosody starts, web stats work)
Marco Cirillo <maranda@lightwitch.org>
parents:
433
diff
changeset
|
77 local function mes_callback(check) |
432
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
78 return function(self) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
79 local origin, stanza = self.origin, self.stanza |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
80 if not prosody.stanza_counter then init_counter() end |
434
ac4a6cc5776c
mod_stanza_counter: cleanup, corrections. (prosody starts, web stats work)
Marco Cirillo <maranda@lightwitch.org>
parents:
433
diff
changeset
|
81 if check then |
432
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
82 if not stanza.attr.to or hosts[jid_bare(stanza.attr.to)] then return nil; |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
83 else |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
84 prosody.stanza_counter.message["outgoing"] = prosody.stanza_counter.message["outgoing"] + 1 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
85 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
86 else |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
87 prosody.stanza_counter.message["incoming"] = prosody.stanza_counter.message["incoming"] + 1 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
88 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
89 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
90 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
91 |
434
ac4a6cc5776c
mod_stanza_counter: cleanup, corrections. (prosody starts, web stats work)
Marco Cirillo <maranda@lightwitch.org>
parents:
433
diff
changeset
|
92 local function pre_callback(check) |
432
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
93 return function(self) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
94 local origin, stanza = self.origin, self.stanza |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
95 if not prosody.stanza_counter then init_counter() end |
434
ac4a6cc5776c
mod_stanza_counter: cleanup, corrections. (prosody starts, web stats work)
Marco Cirillo <maranda@lightwitch.org>
parents:
433
diff
changeset
|
96 if check then |
432
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
97 if not stanza.attr.to or hosts[jid_bare(stanza.attr.to)] then return nil; |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
98 else |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
99 prosody.stanza_counter.presence["outgoing"] = prosody.stanza_counter.presence["outgoing"] + 1 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
100 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
101 else |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
102 prosody.stanza_counter.presence["incoming"] = prosody.stanza_counter.presence["incoming"] + 1 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
103 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
104 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
105 end |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
106 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
107 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
108 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
109 -- Hook all pre-stanza events. |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
110 module:hook("pre-iq/bare", iq_callback(true), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
111 module:hook("pre-iq/full", iq_callback(true), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
112 module:hook("pre-iq/host", iq_callback(true), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
113 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
114 module:hook("pre-message/bare", mes_callback(true), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
115 module:hook("pre-message/full", mes_callback(true), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
116 module:hook("pre-message/host", mes_callback(true), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
117 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
118 module:hook("pre-presence/bare", pre_callback(true), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
119 module:hook("pre-presence/full", pre_callback(true), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
120 module:hook("pre-presence/host", pre_callback(true), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
121 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
122 -- Hook all stanza events. |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
123 module:hook("iq/bare", iq_callback(false), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
124 module:hook("iq/full", iq_callback(false), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
125 module:hook("iq/host", iq_callback(false), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
126 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
127 module:hook("message/bare", mes_callback(false), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
128 module:hook("message/full", mes_callback(false), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
129 module:hook("message/host", mes_callback(false), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
130 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
131 module:hook("presence/bare", pre_callback(false), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
132 module:hook("presence/full", pre_callback(false), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
133 module:hook("presence/host", pre_callback(false), 140) |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
134 |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
135 -- Hook server start to initialize the counter. |
23a6289a00bd
mod_stanza_counter: initial draft.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff
changeset
|
136 module:hook("server-started", setup) |