25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

Don't route error/groupchat messages to bare JIDs

As per RFC 6121, drop error messages that were sent to bare JIDs, and
return an error if a groupchat message was sent to a bare JID.
This commit is contained in:
Holger Weiss 2015-03-25 00:52:49 +01:00
parent bc008d4041
commit 8f9a2d6df8

View File

@ -516,7 +516,18 @@ do_route(From, To, #xmlel{} = Packet) ->
PResources);
true -> ok
end;
<<"message">> -> route_message(From, To, Packet);
<<"message">> ->
case xml:get_attr_s(<<"type">>, Attrs) of
<<"chat">> -> route_message(From, To, Packet);
<<"headline">> -> route_message(From, To, Packet);
<<"error">> -> ok;
<<"groupchat">> ->
Err = jlib:make_error_reply(Packet,
?ERR_SERVICE_UNAVAILABLE),
ejabberd_router:route(To, From, Err);
_ ->
route_message(From, To, Packet)
end;
<<"iq">> -> process_iq(From, To, Packet);
_ -> ok
end;