Mercurial > prosody-hg
comparison core/s2smanager.lua @ 1889:e875833ae08e
s2smanager: Send stream:features for incoming s2s connections which support XMPP 1.0
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 04 Oct 2009 16:38:33 +0100 |
| parents | 562635baad36 |
| children | aed0d8a0cca8 |
comparison
equal
deleted
inserted
replaced
| 1888:562635baad36 | 1889:e875833ae08e |
|---|---|
| 25 local modulemanager = require "core.modulemanager"; | 25 local modulemanager = require "core.modulemanager"; |
| 26 local st = require "stanza"; | 26 local st = require "stanza"; |
| 27 local stanza = st.stanza; | 27 local stanza = st.stanza; |
| 28 local nameprep = require "util.encodings".stringprep.nameprep; | 28 local nameprep = require "util.encodings".stringprep.nameprep; |
| 29 | 29 |
| 30 local fire_event = require "core.eventmanager".fire_event; | |
| 30 local uuid_gen = require "util.uuid".generate; | 31 local uuid_gen = require "util.uuid".generate; |
| 31 | 32 |
| 32 local logger_init = require "util.logger".init; | 33 local logger_init = require "util.logger".init; |
| 33 | 34 |
| 34 local log = logger_init("s2smanager"); | 35 local log = logger_init("s2smanager"); |
| 356 -- Attempting to connect to a host we don't serve | 357 -- Attempting to connect to a host we don't serve |
| 357 session:close({ condition = "host-unknown"; text = "This host does not serve "..session.to_host }); | 358 session:close({ condition = "host-unknown"; text = "This host does not serve "..session.to_host }); |
| 358 return; | 359 return; |
| 359 end | 360 end |
| 360 if session.version >= 1.0 then | 361 if session.version >= 1.0 then |
| 361 send(st.stanza("stream:features") | 362 local features = st.stanza("stream:features"); |
| 362 :tag("dialback", { xmlns='urn:xmpp:features:dialback' }):tag("optional"):up():up()); | 363 fire_event("s2s-stream-features", session, features); |
| 364 | |
| 365 log("debug", "Sending stream features: %s", tostring(features)); | |
| 366 send(features); | |
| 363 end | 367 end |
| 364 elseif session.direction == "outgoing" then | 368 elseif session.direction == "outgoing" then |
| 365 -- If we are just using the connection for verifying dialback keys, we won't try and auth it | 369 -- If we are just using the connection for verifying dialback keys, we won't try and auth it |
| 366 if not attr.id then error("stream response did not give us a streamid!!!"); end | 370 if not attr.id then error("stream response did not give us a streamid!!!"); end |
| 367 session.streamid = attr.id; | 371 session.streamid = attr.id; |
