+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
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 !
true ->
ok
end
- end, Resources);
+ end, PResources);
true ->
if
Subsc ->
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
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.