# HG changeset patch # User Kim Alvefur # Date 1508887950 -7200 # Node ID 2342eccf4a881c182c79c4992b7fd9670ded8d74 # Parent a567a646cf21674c8b1842a28cd26c388d979702# Parent c3de5b454ec48a942ed84c03b2dc07d22cc740ee Merge 0.10->trunk diff -r a567a646cf21 -r 2342eccf4a88 core/stanza_router.lua --- 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; diff -r a567a646cf21 -r 2342eccf4a88 plugins/mod_stanza_debug.lua --- /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