Software /
code /
prosody
Comparison
plugins/mod_dialback.lua @ 438:193f9dd64f17
Bumper commit for the new modulemanager API \o/ Updates all the modules, though some more changes may be in store.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 27 Nov 2008 03:12:12 +0000 |
parent | 352:a73a5afd7da3 |
child | 519:cccd610a0ef9 |
comparison
equal
deleted
inserted
replaced
437:c1a720db2157 | 438:193f9dd64f17 |
---|---|
6 | 6 |
7 local log = require "util.logger".init("mod_dialback"); | 7 local log = require "util.logger".init("mod_dialback"); |
8 | 8 |
9 local xmlns_dialback = "jabber:server:dialback"; | 9 local xmlns_dialback = "jabber:server:dialback"; |
10 | 10 |
11 add_handler({"s2sin_unauthed", "s2sin"}, "verify", xmlns_dialback, | 11 module:add_handler({"s2sin_unauthed", "s2sin"}, "verify", xmlns_dialback, |
12 function (origin, stanza) | 12 function (origin, stanza) |
13 -- We are being asked to verify the key, to ensure it was generated by us | 13 -- We are being asked to verify the key, to ensure it was generated by us |
14 log("debug", "verifying dialback key..."); | 14 log("debug", "verifying dialback key..."); |
15 local attr = stanza.attr; | 15 local attr = stanza.attr; |
16 -- FIXME: Grr, ejabberd breaks this one too?? it is black and white in XEP-220 example 34 | 16 -- FIXME: Grr, ejabberd breaks this one too?? it is black and white in XEP-220 example 34 |
24 end | 24 end |
25 log("debug", "verifyied dialback key... it is %s", type); | 25 log("debug", "verifyied dialback key... it is %s", type); |
26 origin.sends2s(format("<db:verify from='%s' to='%s' id='%s' type='%s'>%s</db:verify>", attr.to, attr.from, attr.id, type, stanza[1])); | 26 origin.sends2s(format("<db:verify from='%s' to='%s' id='%s' type='%s'>%s</db:verify>", attr.to, attr.from, attr.id, type, stanza[1])); |
27 end); | 27 end); |
28 | 28 |
29 add_handler("s2sin_unauthed", "result", xmlns_dialback, | 29 module:add_handler("s2sin_unauthed", "result", xmlns_dialback, |
30 function (origin, stanza) | 30 function (origin, stanza) |
31 -- he wants to be identified through dialback | 31 -- he wants to be identified through dialback |
32 -- We need to check the key with the Authoritative server | 32 -- We need to check the key with the Authoritative server |
33 local attr = stanza.attr; | 33 local attr = stanza.attr; |
34 local attr = stanza.attr; | 34 local attr = stanza.attr; |
40 format("<db:verify from='%s' to='%s' id='%s'>%s</db:verify>", origin.to_host, origin.from_host, | 40 format("<db:verify from='%s' to='%s' id='%s'>%s</db:verify>", origin.to_host, origin.from_host, |
41 origin.streamid, origin.dialback_key)); | 41 origin.streamid, origin.dialback_key)); |
42 hosts[origin.to_host].s2sout[origin.from_host].dialback_verifying = origin; | 42 hosts[origin.to_host].s2sout[origin.from_host].dialback_verifying = origin; |
43 end); | 43 end); |
44 | 44 |
45 add_handler({ "s2sout_unauthed", "s2sout" }, "verify", xmlns_dialback, | 45 module:add_handler({ "s2sout_unauthed", "s2sout" }, "verify", xmlns_dialback, |
46 function (origin, stanza) | 46 function (origin, stanza) |
47 if origin.dialback_verifying then | 47 if origin.dialback_verifying then |
48 local valid; | 48 local valid; |
49 local attr = stanza.attr; | 49 local attr = stanza.attr; |
50 if attr.type == "valid" then | 50 if attr.type == "valid" then |
62 attr.to, attr.from, attr.id, valid, origin.dialback_verifying.dialback_key)); | 62 attr.to, attr.from, attr.id, valid, origin.dialback_verifying.dialback_key)); |
63 end | 63 end |
64 end | 64 end |
65 end); | 65 end); |
66 | 66 |
67 add_handler({ "s2sout_unauthed", "s2sout" }, "result", xmlns_dialback, | 67 module:add_handler({ "s2sout_unauthed", "s2sout" }, "result", xmlns_dialback, |
68 function (origin, stanza) | 68 function (origin, stanza) |
69 if stanza.attr.type == "valid" then | 69 if stanza.attr.type == "valid" then |
70 s2s_make_authenticated(origin); | 70 s2s_make_authenticated(origin); |
71 else | 71 else |
72 -- FIXME | 72 -- FIXME |