aboutsummaryrefslogtreecommitdiffstats
path: root/core/stanza_router.lua
diff options
context:
space:
mode:
Diffstat (limited to 'core/stanza_router.lua')
-rw-r--r--core/stanza_router.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index 6c117c25..c1819651 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -32,7 +32,7 @@ local jid_split = require "util.jid".split;
local print = print;
function core_process_stanza(origin, stanza)
- log("debug", "Received["..origin.type.."]: "..tostring(st.reply(st.reply(stanza))))
+ log("debug", "Received[%s]: %s", origin.type, stanza:pretty_top_tag())
if not stanza.attr.xmlns then stanza.attr.xmlns = "jabber:client"; end -- FIXME Hack. This should be removed when we fix namespace handling.
-- TODO verify validity of stanza (as well as JID validity)
@@ -174,16 +174,22 @@ function core_handle_stanza(origin, stanza)
stanza.attr.to = nil; -- reset it
else
log("warn", "Unhandled c2s presence: %s", tostring(stanza));
- origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+ if stanza.attr.type ~= "error" then
+ origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+ end
end
else
log("warn", "Unhandled c2s stanza: %s", tostring(stanza));
- origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+ if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
+ origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+ end
end -- TODO handle other stanzas
else
log("warn", "Unhandled origin: %s", origin.type);
- -- s2s stanzas can get here
- (origin.sends2s or origin.send)(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+ if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
+ -- s2s stanzas can get here
+ (origin.sends2s or origin.send)(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
+ end
end
end