25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-30 16:36:29 +01:00

* src/ejabberd_sm.erl (do_route/3): Minor fix

* src/ejabberd_sm.erl (route_message/3): Minor changes

SVN Revision: 194
This commit is contained in:
Alexey Shchepin 2004-01-02 19:36:38 +00:00
parent 1d1d6b6c36
commit 7e6d96b192
2 changed files with 21 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2004-01-01 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_sm.erl (do_route/3): Minor fix
* src/ejabberd_sm.erl (route_message/3): Minor changes
2003-12-28 Alexey Shchepin <alexey@sevcom.net> 2003-12-28 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_app.erl: Now possible to specify path to log file * src/ejabberd_app.erl: Now possible to specify path to log file

View File

@ -177,11 +177,11 @@ do_route(From, To, Packet) ->
end, end,
if Pass -> if Pass ->
LFrom = jlib:jid_tolower(From), LFrom = jlib:jid_tolower(From),
Resources = get_user_resources(User), PResources = get_user_present_resources(User),
if if
Resources /= [] -> PResources /= [] ->
lists:foreach( lists:foreach(
fun(R) -> fun({_, R}) ->
if LFrom /= if LFrom /=
{LUser, LServer, R} -> {LUser, LServer, R} ->
ejabberd_sm ! ejabberd_sm !
@ -192,7 +192,7 @@ do_route(From, To, Packet) ->
true -> true ->
ok ok
end end
end, Resources); end, PResources);
true -> true ->
if if
Subsc -> Subsc ->
@ -248,7 +248,7 @@ do_route(From, To, Packet) ->
end. end.
route_message(From, To, Packet) -> route_message(From, To, Packet) ->
#jid{luser = LUser} = To, LUser = To#jid.luser,
case catch lists:max(get_user_present_resources(LUser)) of case catch lists:max(get_user_present_resources(LUser)) of
{'EXIT', _} -> {'EXIT', _} ->
case xml:get_tag_attr_s("type", Packet) of case xml:get_tag_attr_s("type", Packet) of
@ -273,10 +273,16 @@ route_message(From, To, Packet) ->
end end
end; end;
{_, R} -> {_, R} ->
ejabberd_sm ! {route, LResource = jlib:resourceprep(R),
From, LUR = {LUser, LResource},
jlib:jid_replace_resource(To, R), case mnesia:dirty_read({session, LUR}) of
Packet} [] ->
ok; % Race condition
[Sess] ->
Pid = Sess#session.pid,
?DEBUG("sending to process ~p~n", [Pid]),
Pid ! {route, From, To, Packet}
end
end. end.