24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-10 21:47:01 +02:00

Merge pull request #547 from weiss/fix-account-jid-disco

Fix service discovery handling for account JIDs
This commit is contained in:
badlop 2015-04-27 19:39:32 +02:00
commit 6f99775115

View File

@ -352,19 +352,19 @@ get_sm_items(empty, From, To, _Node, _Lang) ->
_ -> {error, ?ERR_NOT_ALLOWED} _ -> {error, ?ERR_NOT_ALLOWED}
end. end.
is_presence_subscribed(#jid{luser = User, is_presence_subscribed(#jid{luser = User, lserver = Server},
lserver = Server}, #jid{luser = User, lserver = Server}) -> true;
#jid{luser = LUser, lserver = LServer}) -> is_presence_subscribed(#jid{luser = FromUser, lserver = FromServer},
lists:any(fun (#roster{jid = {TUser, TServer, _}, #jid{luser = ToUser, lserver = ToServer}) ->
subscription = S}) -> lists:any(fun (#roster{jid = {SubUser, SubServer, _}, subscription = Sub})
if LUser == TUser, LServer == TServer, S /= none -> when FromUser == SubUser, FromServer == SubServer,
true; Sub /= none ->
true -> false true;
end (_RosterEntry) ->
false
end, end,
ejabberd_hooks:run_fold(roster_get, Server, [], ejabberd_hooks:run_fold(roster_get, ToServer, [],
[{User, Server}])) [{ToUser, ToServer}])).
orelse User == LUser andalso Server == LServer.
process_sm_iq_info(From, To, process_sm_iq_info(From, To,
#iq{type = Type, lang = Lang, sub_el = SubEl} = IQ) -> #iq{type = Type, lang = Lang, sub_el = SubEl} = IQ) ->