Software /
code /
prosody
Comparison
core/usermanager.lua @ 3293:4ce9d569a99c
usermanager: Expose host_handler() as initialize_host()
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 29 Jun 2010 19:11:18 +0100 |
parent | 3285:c116c4b2db5a |
child | 3336:3a8ce659edfc |
comparison
equal
deleted
inserted
replaced
3292:f2ac2ead80b1 | 3293:4ce9d569a99c |
---|---|
30 function new_null_provider() | 30 function new_null_provider() |
31 local function dummy() end; | 31 local function dummy() end; |
32 return setmetatable({name = "null"}, { __index = function() return dummy; end }); | 32 return setmetatable({name = "null"}, { __index = function() return dummy; end }); |
33 end | 33 end |
34 | 34 |
35 local function host_handler(host) | 35 function initialize_host(host) |
36 local host_session = hosts[host]; | 36 local host_session = hosts[host]; |
37 host_session.events.add_handler("item-added/auth-provider", function (event) | 37 host_session.events.add_handler("item-added/auth-provider", function (event) |
38 local provider = event.item; | 38 local provider = event.item; |
39 local auth_provider = config.get(host, "core", "authentication") or default_provider; | 39 local auth_provider = config.get(host, "core", "authentication") or default_provider; |
40 if provider.name == auth_provider then | 40 if provider.name == auth_provider then |
54 local auth_provider = config.get(host, "core", "authentication") or default_provider; | 54 local auth_provider = config.get(host, "core", "authentication") or default_provider; |
55 if auth_provider ~= "null" then | 55 if auth_provider ~= "null" then |
56 modulemanager.load(host, "auth_"..auth_provider); | 56 modulemanager.load(host, "auth_"..auth_provider); |
57 end | 57 end |
58 end; | 58 end; |
59 prosody.events.add_handler("host-activated", host_handler, 100); | 59 prosody.events.add_handler("host-activated", initialize_host, 100); |
60 prosody.events.add_handler("component-activated", host_handler, 100); | 60 prosody.events.add_handler("component-activated", initialize_host, 100); |
61 | 61 |
62 function is_cyrus(host) return config.get(host, "core", "sasl_backend") == "cyrus"; end | 62 function is_cyrus(host) return config.get(host, "core", "sasl_backend") == "cyrus"; end |
63 | 63 |
64 function test_password(username, password, host) | 64 function test_password(username, password, host) |
65 return hosts[host].users.test_password(username, password); | 65 return hosts[host].users.test_password(username, password); |