aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_component.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2016-03-18 14:03:35 +0000
committerMatthew Wild <mwild1@gmail.com>2016-03-18 14:03:35 +0000
commitc7e80a8b0191239b7d7103154d4c079868234e41 (patch)
treecc8a353f9fd1d39993e99256dd784e813d0e4153 /plugins/mod_component.lua
parentf76d7cdfb91850381b47ec3abfbc280f32136682 (diff)
parentf739ed2c46827cca1b0b7af08320584886e76283 (diff)
downloadprosody-c7e80a8b0191239b7d7103154d4c079868234e41.tar.gz
prosody-c7e80a8b0191239b7d7103154d4c079868234e41.zip
Merge 0.10->trunk
Diffstat (limited to 'plugins/mod_component.lua')
-rw-r--r--plugins/mod_component.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua
index a5136f6c..eebaaf3e 100644
--- a/plugins/mod_component.lua
+++ b/plugins/mod_component.lua
@@ -40,7 +40,7 @@ function module.add_host(module)
local send;
- local function on_destroy(session, err)
+ local function on_destroy(session, err) --luacheck: ignore 212/err
env.connected = false;
env.session = false;
send = nil;
@@ -149,7 +149,7 @@ local stream_callbacks = { default_ns = xmlns_component };
local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams";
-function stream_callbacks.error(session, error, data, data2)
+function stream_callbacks.error(session, error, data)
if session.destroyed then return; end
module:log("warn", "Error processing component stream: %s", tostring(error));
if error == "no-stream" then
@@ -295,7 +295,7 @@ function listener.onconnect(conn)
session.stream:reset();
end
- function session.data(conn, data)
+ function session.data(_, data)
local ok, err = stream:feed(data);
if ok then return; end
module:log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "):gsub("[%z\1-\31]", "_"));
@@ -314,6 +314,7 @@ function listener.ondisconnect(conn, err)
local session = sessions[conn];
if session then
(session.log or log)("info", "component disconnected: %s (%s)", tostring(session.host), tostring(err));
+ module:fire_event("component-disconnected", { session = session, reason = err });
if session.on_destroy then session:on_destroy(err); end
sessions[conn] = nil;
for k in pairs(session) do
@@ -322,7 +323,6 @@ function listener.ondisconnect(conn, err)
end
end
session.destroyed = true;
- session = nil;
end
end