Software /
code /
prosody
Diff
core/usermanager.lua @ 3161:73e93a48c0c1
Update usermanager to not crash, etc.
author | Jeff Mitchell <jeff@jefferai.org> |
---|---|
date | Thu, 20 May 2010 14:18:12 -0400 |
parent | 3160:9064dd006b21 |
child | 3163:a23168cc4af5 |
line wrap: on
line diff
--- a/core/usermanager.lua Thu May 20 11:51:24 2010 -0400 +++ b/core/usermanager.lua Thu May 20 14:18:12 2010 -0400 @@ -20,8 +20,15 @@ local prosody = _G.prosody; +local setmetatable = setmetatable; + module "usermanager" +function new_null_provider() + local function dummy() end; + return setmetatable({}, { __index = function() return dummy; end }); +end + local function host_handler(host) local host_session = hosts[host]; host_session.events.add_handler("item-added/auth-provider", function (provider) @@ -32,15 +39,9 @@ end); host_session.events.add_handler("item-removed/auth-provider", function (provider) if host_session.users == provider then - userplugins.new_default_provider(host); + host_session.users = new_null_provider(); end end); - if host_session.users ~= nil then - log("debug", "using non-default authentication provider"); - else - log("debug", "using default authentication provider"); - host_session.users = new_default_provider(host); -- Start with the default usermanager provider - end end prosody.events.add_handler("host-activated", host_handler); prosody.events.add_handler("component-activated", host_handler);