Software /
code /
prosody
Changeset
8349:2342eccf4a88
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 25 Oct 2017 01:32:30 +0200 |
parents | 8346:a567a646cf21 (current diff) 8348:c3de5b454ec4 (diff) |
children | 8350:3ca11d408382 |
files | |
diffstat | 2 files changed, 31 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/core/stanza_router.lua Sun Oct 22 20:41:11 2017 +0200 +++ b/core/stanza_router.lua Wed Oct 25 01:32:30 2017 +0200 @@ -140,7 +140,8 @@ if h then local event; if xmlns == nil then - if stanza.name == "iq" and (stanza.attr.type == "set" or stanza.attr.type == "get") then + if stanza.name == "iq" and (stanza.attr.type == "set" or stanza.attr.type == "get") + and stanza.tags[1] and stanza.tags[1].attr.xmlns then event = "stanza/iq/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name; else event = "stanza/"..stanza.name;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/mod_stanza_debug.lua Wed Oct 25 01:32:30 2017 +0200 @@ -0,0 +1,29 @@ +module:set_global(); + +local tostring = tostring; +local filters = require "util.filters"; + +local function log_send(t, session) + if t and t ~= "" and t ~= " " then + session.log("debug", "SEND: %s", tostring(t)); + end + return t; +end + +local function log_recv(t, session) + if t and t ~= "" and t ~= " " then + session.log("debug", "RECV: %s", tostring(t)); + end + return t; +end + +local function init_raw_logging(session) + filters.add_filter(session, "stanzas/in", log_recv, -10000); + filters.add_filter(session, "stanzas/out", log_send, 10000); +end + +filters.add_filter_hook(init_raw_logging); + +function module.unload() + filters.remove_filter_hook(init_raw_logging); +end