25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Support anonymous accounts in Shared Roster @all@ directive (EJAB-1264)

With this change, logged anonymous accounts are considered to be registered.
This commit is contained in:
Badlop 2010-06-10 12:01:15 +02:00
parent ba9094a089
commit 0874b93e7c
2 changed files with 7 additions and 2 deletions

View File

@ -143,6 +143,7 @@ register_connection(SID, #jid{luser = LUser, lserver = LServer}, Info) ->
AuthModule = xml:get_attr_s(auth_module, Info), AuthModule = xml:get_attr_s(auth_module, Info),
case AuthModule == ?MODULE of case AuthModule == ?MODULE of
true -> true ->
ejabberd_hooks:run(register_user, LServer, [LUser, LServer]),
US = {LUser, LServer}, US = {LUser, LServer},
mnesia:sync_dirty( mnesia:sync_dirty(
fun() -> mnesia:write(#anonymous{us = US, sid=SID}) fun() -> mnesia:write(#anonymous{us = US, sid=SID})
@ -215,8 +216,8 @@ try_register(_User, _Server, _Password) ->
dirty_get_registered_users() -> dirty_get_registered_users() ->
[]. [].
get_vh_registered_users(_Server) -> get_vh_registered_users(Server) ->
[]. [{U, S} || {U, S, _R} <- ejabberd_sm:get_vh_session_list(Server)].
%% Return password of permanent user or false for anonymous users %% Return password of permanent user or false for anonymous users

View File

@ -93,6 +93,8 @@ start(Host, _Opts) ->
?MODULE, unset_presence, 50), ?MODULE, unset_presence, 50),
ejabberd_hooks:add(register_user, Host, ejabberd_hooks:add(register_user, Host,
?MODULE, register_user, 50), ?MODULE, register_user, 50),
ejabberd_hooks:add(anonymous_purge_hook, Host,
?MODULE, remove_user, 50),
ejabberd_hooks:add(remove_user, Host, ejabberd_hooks:add(remove_user, Host,
?MODULE, remove_user, 50). ?MODULE, remove_user, 50).
%%ejabberd_hooks:add(remove_user, Host, %%ejabberd_hooks:add(remove_user, Host,
@ -121,6 +123,8 @@ stop(Host) ->
?MODULE, unset_presence, 50), ?MODULE, unset_presence, 50),
ejabberd_hooks:delete(register_user, Host, ejabberd_hooks:delete(register_user, Host,
?MODULE, register_user, 50), ?MODULE, register_user, 50),
ejabberd_hooks:delete(anonymous_purge_hook, Host,
?MODULE, remove_user, 50),
ejabberd_hooks:delete(remove_user, Host, ejabberd_hooks:delete(remove_user, Host,
?MODULE, remove_user, 50). ?MODULE, remove_user, 50).
%%ejabberd_hooks:delete(remove_user, Host, %%ejabberd_hooks:delete(remove_user, Host,