25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +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:22:27 +02:00
parent 04943ca469
commit cc7ecfb39e
2 changed files with 7 additions and 2 deletions

View File

@ -185,6 +185,7 @@ register_connection(SID, JID, Info) when ?IS_JID(JID) ->
undefined -> undefined ->
ok; ok;
?MODULE -> ?MODULE ->
ejabberd_hooks:run(register_user, LServer, [LUser, LServer]),
US = {LUser, LServer}, US = {LUser, LServer},
mnesia:async_dirty( mnesia:async_dirty(
fun() -> mnesia:write(#anonymous{us = US, sid=SID}) fun() -> mnesia:write(#anonymous{us = US, sid=SID})
@ -292,8 +293,8 @@ dirty_get_registered_users() ->
%% @spec (Server) -> nil() %% @spec (Server) -> nil()
%% Server = string() %% Server = string()
get_vh_registered_users(_Server) -> get_vh_registered_users(Server) ->
[]. [{U, S} || {U, S, _R} <- ejabberd_sm:get_vh_session_list(list_to_binary(Server))].
%% @spec (User, Server) -> Password | false %% @spec (User, Server) -> Password | false
%% User = string() %% User = string()

View File

@ -89,6 +89,8 @@ start(Host, _Opts) ->
?MODULE, process_item, 50), ?MODULE, process_item, 50),
ejabberd_hooks:add(register_user, HostB, ejabberd_hooks:add(register_user, HostB,
?MODULE, register_user, 50), ?MODULE, register_user, 50),
ejabberd_hooks:add(anonymous_purge_hook, HostB,
?MODULE, remove_user, 50),
ejabberd_hooks:add(remove_user, HostB, ejabberd_hooks:add(remove_user, HostB,
?MODULE, remove_user, 50). ?MODULE, remove_user, 50).
%%ejabberd_hooks:add(remove_user, HostB, %%ejabberd_hooks:add(remove_user, HostB,
@ -114,6 +116,8 @@ stop(Host) ->
?MODULE, process_item, 50), ?MODULE, process_item, 50),
ejabberd_hooks:delete(register_user, HostB, ejabberd_hooks:delete(register_user, HostB,
?MODULE, register_user, 50), ?MODULE, register_user, 50),
ejabberd_hooks:delete(anonymous_purge_hook, HostB,
?MODULE, remove_user, 50),
ejabberd_hooks:delete(remove_user, HostB, ejabberd_hooks:delete(remove_user, HostB,
?MODULE, remove_user, 50). ?MODULE, remove_user, 50).
%%ejabberd_hooks:delete(remove_user, HostB, %%ejabberd_hooks:delete(remove_user, HostB,