local new_xmpp_stream = require "util.xmppstream".new;
local uuid_gen = require "util.uuid".generate;
local new_xmpp_stream = require "util.xmppstream".new;
local uuid_gen = require "util.uuid".generate;
local function handle_component_auth(event)
local session, stanza = event.origin, event.stanza;
local function handle_component_auth(event)
local session, stanza = event.origin, event.stanza;
if (not session.host) or #stanza.tags > 0 then
(session.log or log)("warn", "Invalid component handshake for host: %s", session.host);
if (not session.host) or #stanza.tags > 0 then
(session.log or log)("warn", "Invalid component handshake for host: %s", session.host);
function stream_callbacks.error(session, error, data, data2)
if session.destroyed then return; end
function stream_callbacks.error(session, error, data, data2)
if session.destroyed then return; end
if error == "no-stream" then
session:close("invalid-namespace");
elseif error == "parse-error" then
if error == "no-stream" then
session:close("invalid-namespace");
elseif error == "parse-error" then
function stream_callbacks.handlestanza(session, stanza)
-- Namespaces are icky.
if not stanza.attr.xmlns and stanza.name == "handshake" then
function stream_callbacks.handlestanza(session, stanza)
-- Namespaces are icky.
if not stanza.attr.xmlns and stanza.name == "handshake" then