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) ->
Acc;
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
{result, Features} -> Features;
empty -> []

View File

@ -367,15 +367,21 @@ get_sm_identity(Acc, _From,
-spec get_sm_features(features_acc(), jid(), jid(), binary(), 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 = LTo, lserver = LSTo} = To,
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">>,
{error, xmpp:err_not_allowed(Txt, Lang)}
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.
-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
{result, Features} ->
{result, [?NS_DISCO_INFO, ?NS_VCARD | Features]};
empty -> {result, [?NS_DISCO_INFO, ?NS_VCARD]}
{result, [?NS_VCARD | Features]};
empty -> {result, [?NS_VCARD]}
end;
_ -> Acc
end.