Software / code / prosody
Comparison
plugins/mod_dialback.lua @ 4842:88101f652174
Backed out changeset 9f1fb34cd7f8 - obsoleted by 5ef05f32bc42.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 11 May 2012 01:39:52 +0100 |
| parent | 4837:9f1fb34cd7f8 |
| child | 4843:d91dda67647a |
comparison
equal
deleted
inserted
replaced
| 4837:9f1fb34cd7f8 | 4842:88101f652174 |
|---|---|
| 74 return true; | 74 return true; |
| 75 end | 75 end |
| 76 | 76 |
| 77 dialback_requests[attr.from.."/"..origin.streamid] = origin; | 77 dialback_requests[attr.from.."/"..origin.streamid] = origin; |
| 78 | 78 |
| 79 local compat_check; | |
| 80 if not origin.from_host then | 79 if not origin.from_host then |
| 81 -- Just used for friendlier logging | 80 -- Just used for friendlier logging |
| 82 origin.from_host = nameprep(attr.from); | 81 origin.from_host = nameprep(attr.from); |
| 83 -- COMPAT: Fix server's chopness by not including from | 82 -- COMPAT: Fix ejabberd chopness by resetting the send function |
| 84 compat_check = true; | 83 if not origin.from_host then |
| 84 origin.log("debug", "We need to know where to connect but remote server blindly refuses to tell us and to comply to specs, closing connection."); | |
| 85 origin:close("invalid-from"); | |
| 86 else | |
| 87 origin.log("debug", "Remote server didn't specify a from attr, resetting session.send now that we know where to knock to."); | |
| 88 origin.send = function(stanza) hosts[attr.to].events.fire_event("route/remote", { from_host = origin.to_host, to_host = origin.from_host, stanza = stanza}); end | |
| 89 end | |
| 85 end | 90 end |
| 86 if not origin.to_host then | 91 if not origin.to_host then |
| 87 -- Just used for friendlier logging | 92 -- Just used for friendlier logging |
| 88 origin.to_host = nameprep(attr.to); | 93 origin.to_host = attr.to; |
| 89 -- COMPAT: Fix server's chopness by not including to | |
| 90 compat_check = true; | |
| 91 end | |
| 92 | |
| 93 if not origin.from_host and not origin.to_host then | |
| 94 origin.log("debug", "Improper addressing supplied, no to or from?"); | |
| 95 origin:close("improper-addressing"); | |
| 96 end | |
| 97 -- COMPAT: reset session.send | |
| 98 if compat_check then | |
| 99 origin.send = function(stanza) hosts[attr.to].events.fire_event("route/remote", { from_host = origin.to_host, to_host = origin.from_host, stanza = stanza}); end | |
| 100 end | 94 end |
| 101 | 95 |
| 102 origin.log("debug", "asking %s if key %s belongs to them", attr.from, stanza[1]); | 96 origin.log("debug", "asking %s if key %s belongs to them", attr.from, stanza[1]); |
| 103 origin.send(st.stanza("db:verify", { from = attr.to, to = attr.from, id = origin.streamid }):text(stanza[1])); | 97 origin.send(st.stanza("db:verify", { from = attr.to, to = attr.from, id = origin.streamid }):text(stanza[1])); |
| 104 return true; | 98 return true; |