Software /
code /
prosody
Comparison
plugins/mod_component.lua @ 4464:b0574fc78a0a
mod_component: removed unused variable reference, added "flagging" to assert if a component is connected or not.
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Fri, 06 Jan 2012 21:45:33 +0000 |
parent | 4323:53f3c3001499 |
child | 4650:464ca74ddf6a |
comparison
equal
deleted
inserted
replaced
4463:df2cbc52c83b | 4464:b0574fc78a0a |
---|---|
8 | 8 |
9 if module:get_host_type() ~= "component" then | 9 if module:get_host_type() ~= "component" then |
10 error("Don't load mod_component manually, it should be for a component, please see http://prosody.im/doc/components", 0); | 10 error("Don't load mod_component manually, it should be for a component, please see http://prosody.im/doc/components", 0); |
11 end | 11 end |
12 | 12 |
13 local hosts = _G.hosts; | |
14 | |
15 local t_concat = table.concat; | 13 local t_concat = table.concat; |
16 | 14 |
17 local sha1 = require "util.hashes".sha1; | 15 local sha1 = require "util.hashes".sha1; |
18 local st = require "util.stanza"; | 16 local st = require "util.stanza"; |
19 | 17 |
21 | 19 |
22 local main_session, send; | 20 local main_session, send; |
23 | 21 |
24 local function on_destroy(session, err) | 22 local function on_destroy(session, err) |
25 if main_session == session then | 23 if main_session == session then |
24 connected = false; | |
26 main_session = nil; | 25 main_session = nil; |
27 send = nil; | 26 send = nil; |
28 session.on_destroy = nil; | 27 session.on_destroy = nil; |
29 end | 28 end |
30 end | 29 end |
81 return true; | 80 return true; |
82 end | 81 end |
83 | 82 |
84 -- If component not already created for this host, create one now | 83 -- If component not already created for this host, create one now |
85 if not main_session then | 84 if not main_session then |
85 connected = true; | |
86 send = session.send; | 86 send = session.send; |
87 main_session = session; | 87 main_session = session; |
88 session.on_destroy = on_destroy; | 88 session.on_destroy = on_destroy; |
89 session.component_validate_from = module:get_option_boolean("validate_from_addresses", true); | 89 session.component_validate_from = module:get_option_boolean("validate_from_addresses", true); |
90 log("info", "Component successfully authenticated: %s", session.host); | 90 log("info", "Component successfully authenticated: %s", session.host); |