+local stream_callbacks = { stream_tag = "http://etherx.jabber.org/streams|stream",
+ default_ns = "jabber:server",
+ streamopened = s2s_streamopened, streamclosed = s2s_streamclosed, handlestanza = core_process_stanza };
+
+function stream_callbacks.error(session, error, data)
+ if error == "no-stream" then
+ session:close("invalid-namespace");
+ else
+ session.log("debug", "Server-to-server XML parse error: %s", tostring(error));
+ session:close("xml-not-well-formed");
+ end
+end
+
+local function handleerr(err) log("error", "Traceback[s2s]: %s: %s", tostring(err), debug.traceback()); end
+function stream_callbacks.handlestanza(a, b)
+ xpcall(function () core_process_stanza(a, b) end, handleerr);
+end