24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-07-04 23:15:31 +02:00

Avoid multiple disco#info request for caps.

Only send it when we receive the presence from the user,
if the user sends caps and we don't have it cached.
This commit is contained in:
Pablo Polvorin 2012-01-27 16:08:28 -03:00
parent eaecb9b65c
commit fead37d1c5

View File

@ -168,7 +168,11 @@ user_receive_packet(_DebugFlag,
#jid{lserver = Server}, From, _To,
{xmlelement, "presence", Attrs, Els}) ->
Type = xml:get_attr_s("type", Attrs),
if Type == ""; Type == "available" ->
IsRemote = not lists:member(From#jid.lserver, ?MYHOSTS),
%% Local users presence caps are already handled by user_send_packet.
%% Otherwise we could send multiple request when broadcasting presence
%% to every local subscriber.
if IsRemote and ((Type == "") or (Type == "available")) ->
case read_caps(Els) of
nothing ->
ok;