Software / code / prosody
Comparison
plugins/mod_component.lua @ 2495:9c32f469b82c
mod_component: Cleaned up unused variables.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Sun, 24 Jan 2010 05:36:25 +0500 |
| parent | 2490:6eee75fb3159 |
| child | 2925:692b3c6c5bd2 |
comparison
equal
deleted
inserted
replaced
| 2494:6a60d67b4bb8 | 2495:9c32f469b82c |
|---|---|
| 12 | 12 |
| 13 local hosts = _G.hosts; | 13 local hosts = _G.hosts; |
| 14 | 14 |
| 15 local t_concat = table.concat; | 15 local t_concat = table.concat; |
| 16 | 16 |
| 17 local lxp = require "lxp"; | |
| 18 local logger = require "util.logger"; | |
| 19 local config = require "core.configmanager"; | 17 local config = require "core.configmanager"; |
| 20 local connlisteners = require "net.connlisteners"; | |
| 21 local cm_register_component = require "core.componentmanager".register_component; | 18 local cm_register_component = require "core.componentmanager".register_component; |
| 22 local cm_deregister_component = require "core.componentmanager".deregister_component; | 19 local cm_deregister_component = require "core.componentmanager".deregister_component; |
| 23 local uuid_gen = require "util.uuid".generate; | |
| 24 local sha1 = require "util.hashes".sha1; | 20 local sha1 = require "util.hashes".sha1; |
| 25 local st = require "util.stanza"; | 21 local st = require "util.stanza"; |
| 26 local init_xmlhandlers = require "core.xmlhandlers"; | |
| 27 | |
| 28 local sessions = {}; | |
| 29 | 22 |
| 30 local log = module._log; | 23 local log = module._log; |
| 31 | |
| 32 local component_listener = { default_port = 5347; default_mode = "*a"; default_interface = config.get("*", "core", "component_interface") or "127.0.0.1" }; | |
| 33 | |
| 34 local xmlns_component = 'jabber:component:accept'; | |
| 35 | 24 |
| 36 --- Handle authentication attempts by components | 25 --- Handle authentication attempts by components |
| 37 function handle_component_auth(session, stanza) | 26 function handle_component_auth(session, stanza) |
| 38 log("info", "Handling component auth"); | 27 log("info", "Handling component auth"); |
| 39 if (not session.host) or #stanza.tags > 0 then | 28 if (not session.host) or #stanza.tags > 0 then |
| 78 | 67 |
| 79 -- Signal successful authentication | 68 -- Signal successful authentication |
| 80 session.send(st.stanza("handshake")); | 69 session.send(st.stanza("handshake")); |
| 81 end | 70 end |
| 82 | 71 |
| 83 module:add_handler("component", "handshake", xmlns_component, handle_component_auth); | 72 module:add_handler("component", "handshake", "jabber:component:accept", handle_component_auth); |