25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

Advertise disco#info and disco#items features in mod_disco

Fixes #2470
This commit is contained in:
Evgeniy Khramtsov 2018-06-13 14:55:06 +03:00
parent 0a20e45690
commit 645f11d79d
3 changed files with 12 additions and 6 deletions

View File

@ -157,7 +157,7 @@ vcard_iq_publish(Acc) ->
get_sm_features({error, _Error} = Acc, _From, _To, _Node, _Lang) -> get_sm_features({error, _Error} = Acc, _From, _To, _Node, _Lang) ->
Acc; Acc;
get_sm_features(Acc, _From, _To, <<"">>, _Lang) -> get_sm_features(Acc, _From, _To, <<"">>, _Lang) ->
{result, [?NS_DISCO_INFO, ?NS_PEP_VCARD_CONVERSION_0 | {result, [?NS_PEP_VCARD_CONVERSION_0 |
case Acc of case Acc of
{result, Features} -> Features; {result, Features} -> Features;
empty -> [] empty -> []

View File

@ -367,15 +367,21 @@ get_sm_identity(Acc, _From,
-spec get_sm_features(features_acc(), jid(), jid(), binary(), binary()) -> -spec get_sm_features(features_acc(), jid(), jid(), binary(), binary()) ->
{error, stanza_error()} | {result, [binary()]}. {error, stanza_error()} | {result, [binary()]}.
get_sm_features(empty, From, To, _Node, Lang) -> get_sm_features(empty, From, To, Node, Lang) ->
#jid{luser = LFrom, lserver = LSFrom} = From, #jid{luser = LFrom, lserver = LSFrom} = From,
#jid{luser = LTo, lserver = LSTo} = To, #jid{luser = LTo, lserver = LSTo} = To,
case {LFrom, LSFrom} of case {LFrom, LSFrom} of
{LTo, LSTo} -> {error, xmpp:err_item_not_found()}; {LTo, LSTo} ->
case Node of
<<"">> -> {result, [?NS_DISCO_INFO, ?NS_DISCO_ITEMS]};
_ -> {error, xmpp:err_item_not_found()}
end;
_ -> _ ->
Txt = <<"Query to another users is forbidden">>, Txt = <<"Query to another users is forbidden">>,
{error, xmpp:err_not_allowed(Txt, Lang)} {error, xmpp:err_not_allowed(Txt, Lang)}
end; end;
get_sm_features({result, Features}, _From, _To, <<"">>, _Lang) ->
{result, [?NS_DISCO_INFO, ?NS_DISCO_ITEMS|Features]};
get_sm_features(Acc, _From, _To, _Node, _Lang) -> Acc. get_sm_features(Acc, _From, _To, _Node, _Lang) -> Acc.
-spec get_user_resources(binary(), binary()) -> [disco_item()]. -spec get_user_resources(binary(), binary()) -> [disco_item()].

View File

@ -186,8 +186,8 @@ get_sm_features(Acc, _From, _To, Node, _Lang) ->
<<"">> -> <<"">> ->
case Acc of case Acc of
{result, Features} -> {result, Features} ->
{result, [?NS_DISCO_INFO, ?NS_VCARD | Features]}; {result, [?NS_VCARD | Features]};
empty -> {result, [?NS_DISCO_INFO, ?NS_VCARD]} empty -> {result, [?NS_VCARD]}
end; end;
_ -> Acc _ -> Acc
end. end.