Software /
code /
prosody
Annotate
plugins/mod_stanza_debug.lua @ 10688:83668e16b9a3
MUC: Switch to new storage format by default
Changing the default setting of `new_muc_storage_format` from false to true.
The code supports reading both formats since 0.11, but servers with MUCs stored
using the new format will not be able to downgrade to 0.10 or earlier.
The new format is clearer (less nesting for the most commonly-accessed data),
and combined with the new map-store methods, allows for some operations to become
more efficient (such as finding out which MUCs on a service a given user is affiliated
with).
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 12 Mar 2020 16:10:44 +0000 |
parent | 10111:0f335815244f |
child | 12977:74b9e05af71e |
rev | line source |
---|---|
8348
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 module:set_global(); |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 local filters = require "util.filters"; |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 local function log_send(t, session) |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 if t and t ~= "" and t ~= " " then |
10111
0f335815244f
plugins: Remove tostring call from logging
Kim Alvefur <zash@zash.se>
parents:
8348
diff
changeset
|
7 session.log("debug", "SEND: %s", t); |
8348
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 end |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 return t; |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 end |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 local function log_recv(t, session) |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 if t and t ~= "" and t ~= " " then |
10111
0f335815244f
plugins: Remove tostring call from logging
Kim Alvefur <zash@zash.se>
parents:
8348
diff
changeset
|
14 session.log("debug", "RECV: %s", t); |
8348
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 end |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 return t; |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 end |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 local function init_raw_logging(session) |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 filters.add_filter(session, "stanzas/in", log_recv, -10000); |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 filters.add_filter(session, "stanzas/out", log_send, 10000); |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 end |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 filters.add_filter_hook(init_raw_logging); |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 function module.unload() |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 filters.remove_filter_hook(init_raw_logging); |
c3de5b454ec4
mod_stanza_debug: Logs full stanzas sent and received for debugging purposes
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 end |