25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Fix account registration

This commit is contained in:
Badlop 2012-06-06 12:55:35 +02:00
parent bb026ef598
commit a99c1e7031

View File

@ -95,13 +95,13 @@ start(Host, Opts) ->
loop(Host, AccessMaxOfflineMsgs) -> loop(Host, AccessMaxOfflineMsgs) ->
receive receive
#offline_msg{us = User} = Msg -> #offline_msg{us = UserServer} = Msg ->
DBType = gen_mod:db_type(Host, ?MODULE), DBType = gen_mod:db_type(Host, ?MODULE),
Msgs = receive_all(User, [Msg], DBType), Msgs = receive_all(UserServer, [Msg], DBType),
Len = length(Msgs), Len = length(Msgs),
MaxOfflineMsgs = get_max_user_messages(AccessMaxOfflineMsgs, MaxOfflineMsgs = get_max_user_messages(AccessMaxOfflineMsgs,
User, Host), UserServer, Host),
store_offline_msg(Host, User, Msgs, Len, MaxOfflineMsgs, DBType), store_offline_msg(Host, UserServer, Msgs, Len, MaxOfflineMsgs, DBType),
loop(Host, AccessMaxOfflineMsgs); loop(Host, AccessMaxOfflineMsgs);
_ -> _ ->
loop(Host, AccessMaxOfflineMsgs) loop(Host, AccessMaxOfflineMsgs)
@ -176,9 +176,9 @@ store_offline_msg(Host, User, Msgs, Len, MaxOfflineMsgs, odbc) ->
end. end.
%% Function copied from ejabberd_sm.erl: %% Function copied from ejabberd_sm.erl:
get_max_user_messages(AccessRule, LUser, Host) -> get_max_user_messages(AccessRule, {User, Server}, Host) ->
case acl:match_rule( case acl:match_rule(
Host, AccessRule, jlib:make_jid(LUser, Host, "")) of Host, AccessRule, jlib:make_jid(User, Server, "")) of
Max when is_integer(Max) -> Max; Max when is_integer(Max) -> Max;
infinity -> infinity; infinity -> infinity;
_ -> ?MAX_USER_MESSAGES _ -> ?MAX_USER_MESSAGES