diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/componentmanager.lua | 2 | ||||
-rw-r--r-- | core/rostermanager.lua | 6 | ||||
-rw-r--r-- | core/s2smanager.lua | 9 | ||||
-rw-r--r-- | core/stanza_router.lua | 16 |
4 files changed, 15 insertions, 18 deletions
diff --git a/core/componentmanager.lua b/core/componentmanager.lua index 38718882..254abfe4 100644 --- a/core/componentmanager.lua +++ b/core/componentmanager.lua @@ -25,7 +25,7 @@ function register_component(host, component) if not hosts[host] then
-- TODO check for host well-formedness
components[host] = component;
- hosts[host] = {type = "component", host = host, connected = true};
+ hosts[host] = {type = "component", host = host, connected = true, s2sout = {} };
log("debug", "component added: "..host);
else
log("error", "Attempt to set component for existing host: "..host);
diff --git a/core/rostermanager.lua b/core/rostermanager.lua index 504d9961..a08f989d 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -1,8 +1,6 @@ -local mainlog = log; -local function log(type, message) - mainlog(type, "rostermanager", message); -end + +local log = require "util.logger".init("rostermanager"); local setmetatable = setmetatable; local format = string.format; diff --git a/core/s2smanager.lua b/core/s2smanager.lua index 3f286d0e..bec1c29b 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -24,13 +24,10 @@ local md5_hash = require "util.hashes".md5; local dialback_secret = "This is very secret!!! Ha!"; -local srvmap = { ["gmail.com"] = "talk.google.com", ["identi.ca"] = "longlance.controlezvous.ca", ["cdr.se"] = "jabber.cdr.se" }; +local srvmap = { ["gmail.com"] = "talk.google.com", ["identi.ca"] = "hampton.controlezvous.ca", ["cdr.se"] = "jabber.cdr.se" }; module "s2smanager" -function connect_host(from_host, to_host) -end - function send_to_host(from_host, to_host, data) local host = hosts[from_host].s2sout[to_host]; if host then @@ -67,10 +64,6 @@ function send_to_host(from_host, to_host, data) end end -function disconnect_host(host) - -end - local open_sessions = 0; function new_incoming(conn) diff --git a/core/stanza_router.lua b/core/stanza_router.lua index 6c117c25..c1819651 100644 --- a/core/stanza_router.lua +++ b/core/stanza_router.lua @@ -32,7 +32,7 @@ local jid_split = require "util.jid".split; local print = print; function core_process_stanza(origin, stanza) - log("debug", "Received["..origin.type.."]: "..tostring(st.reply(st.reply(stanza)))) + log("debug", "Received[%s]: %s", origin.type, stanza:pretty_top_tag()) if not stanza.attr.xmlns then stanza.attr.xmlns = "jabber:client"; end -- FIXME Hack. This should be removed when we fix namespace handling. -- TODO verify validity of stanza (as well as JID validity) @@ -174,16 +174,22 @@ function core_handle_stanza(origin, stanza) stanza.attr.to = nil; -- reset it else log("warn", "Unhandled c2s presence: %s", tostring(stanza)); - origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error? + if stanza.attr.type ~= "error" then + origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error? + end end else log("warn", "Unhandled c2s stanza: %s", tostring(stanza)); - origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error? + if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then + origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error? + end end -- TODO handle other stanzas else log("warn", "Unhandled origin: %s", origin.type); - -- s2s stanzas can get here - (origin.sends2s or origin.send)(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error? + if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then + -- s2s stanzas can get here + (origin.sends2s or origin.send)(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error? + end end end |