25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-02 15:27:09 +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>
* src/ejabberd_app.erl: Now possible to specify path to log file

View File

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