Comparison

plugins/mod_dialback.lua @ 1876:6d33e0521667

mod_dialback: Initiate dialback on incoming stream:features
author Matthew Wild <mwild1@gmail.com>
date Sun, 04 Oct 2009 14:10:24 +0100
parent 1523:841d61be198f
child 1937:9c700500f408
comparison
equal deleted inserted replaced
1875:334383faf77b 1876:6d33e0521667
8 8
9 9
10 local hosts = _G.hosts; 10 local hosts = _G.hosts;
11 local send_s2s = require "core.s2smanager".send_to_host; 11 local send_s2s = require "core.s2smanager".send_to_host;
12 local s2s_make_authenticated = require "core.s2smanager".make_authenticated; 12 local s2s_make_authenticated = require "core.s2smanager".make_authenticated;
13 local s2s_initiate_dialback = require "core.s2smanager".initiate_dialback;
13 local s2s_verify_dialback = require "core.s2smanager".verify_dialback; 14 local s2s_verify_dialback = require "core.s2smanager".verify_dialback;
14 local s2s_destroy_session = require "core.s2smanager".destroy_session; 15 local s2s_destroy_session = require "core.s2smanager".destroy_session;
15 16
16 local log = module._log; 17 local log = module._log;
17 18
18 local st = require "util.stanza"; 19 local st = require "util.stanza";
19 20
21 local xmlns_stream = "http://etherx.jabber.org/streams";
20 local xmlns_dialback = "jabber:server:dialback"; 22 local xmlns_dialback = "jabber:server:dialback";
21 23
22 local dialback_requests = setmetatable({}, { __mode = 'v' }); 24 local dialback_requests = setmetatable({}, { __mode = 'v' });
23 25
24 module:add_handler({"s2sin_unauthed", "s2sin"}, "verify", xmlns_dialback, 26 module:add_handler({"s2sin_unauthed", "s2sin"}, "verify", xmlns_dialback,
111 s2s_make_authenticated(origin, attr.from); 113 s2s_make_authenticated(origin, attr.from);
112 else 114 else
113 s2s_destroy_session(origin) 115 s2s_destroy_session(origin)
114 end 116 end
115 end); 117 end);
118
119 module:hook_stanza(xmlns_stream, "features", function (origin, stanza)
120 s2s_initiate_dialback(origin);
121 return true;
122 end, 100);