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

Update routing for unavailable resources

As per RFC 6121, don't reroute non-chat messages sent to unavailable
resources.
This commit is contained in:
Holger Weiss 2015-03-25 00:13:05 +01:00
parent 33c9f21171
commit bc008d4041

View File

@ -525,7 +525,15 @@ do_route(From, To, #xmlel{} = Packet) ->
case Mod:get_sessions(LUser, LServer, LResource) of
[] ->
case Name of
<<"message">> -> route_message(From, To, Packet);
<<"message">> ->
case xml:get_attr_s(<<"type">>, Attrs) of
<<"chat">> -> route_message(From, To, Packet);
<<"error">> -> ok;
_ ->
Err = jlib:make_error_reply(Packet,
?ERR_SERVICE_UNAVAILABLE),
ejabberd_router:route(To, From, Err)
end;
<<"iq">> ->
case xml:get_attr_s(<<"type">>, Attrs) of
<<"error">> -> ok;