Software /
code /
prosody
Comparison
plugins/mod_dialback.lua @ 4585:a8901f59bc53
Merge with Zash
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 03 Mar 2012 01:12:16 +0000 |
parent | 4584:9a5de6509aa8 |
child | 4586:4d63852910ff |
comparison
equal
deleted
inserted
replaced
4577:ed0071f0e230 | 4585:a8901f59bc53 |
---|---|
7 -- | 7 -- |
8 | 8 |
9 local format = string.format; | 9 local format = string.format; |
10 | 10 |
11 local hosts = _G.hosts; | 11 local hosts = _G.hosts; |
12 local send_s2s = require "core.s2smanager".send_to_host; | |
13 local s2s_make_authenticated = require "core.s2smanager".make_authenticated; | 12 local s2s_make_authenticated = require "core.s2smanager".make_authenticated; |
14 | 13 |
15 local log = module._log; | 14 local log = module._log; |
16 | 15 |
17 local st = require "util.stanza"; | 16 local st = require "util.stanza"; |
85 -- Just used for friendlier logging | 84 -- Just used for friendlier logging |
86 origin.to_host = attr.to; | 85 origin.to_host = attr.to; |
87 end | 86 end |
88 | 87 |
89 origin.log("debug", "asking %s if key %s belongs to them", attr.from, stanza[1]); | 88 origin.log("debug", "asking %s if key %s belongs to them", attr.from, stanza[1]); |
90 --send_s2s(attr.to, attr.from, | |
91 origin.send(st.stanza("db:verify", { from = attr.to, to = attr.from, id = origin.streamid }):text(stanza[1])); | 89 origin.send(st.stanza("db:verify", { from = attr.to, to = attr.from, id = origin.streamid }):text(stanza[1])); |
92 return true; | 90 return true; |
93 end | 91 end |
94 end); | 92 end); |
95 | 93 |
160 initiate_dialback(origin); | 158 initiate_dialback(origin); |
161 return true; | 159 return true; |
162 end | 160 end |
163 end, 100); | 161 end, 100); |
164 | 162 |
163 module:hook("s2s-no-stream-features", function (event) | |
164 initiate_dialback(event.origin); | |
165 return true; | |
166 end, 100); | |
167 | |
165 -- Offer dialback to incoming hosts | 168 -- Offer dialback to incoming hosts |
166 module:hook("s2s-stream-features", function (data) | 169 module:hook("s2s-stream-features", function (data) |
167 data.features:tag("dialback", { xmlns='urn:xmpp:features:dialback' }):up(); | 170 data.features:tag("dialback", { xmlns='urn:xmpp:features:dialback' }):up(); |
168 end); | 171 end); |