diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-04-26 16:32:03 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-04-26 16:32:03 +0200 |
commit | 0edba763fbcef233c2fe7b5b33895fac370226c8 (patch) | |
tree | c630bb2e363c999453a367422056562a9d4944cb /src/mod_disco.erl | |
parent | Fix service disco handling for bare account JIDs (diff) |
mod_disco: Omit 'roster_get' call if possible
As a small optimization, avoid running the 'roster_get' hook in the
(common) case where a client requests service discovery information for
its own bare JID.
Diffstat (limited to '')
-rw-r--r-- | src/mod_disco.erl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mod_disco.erl b/src/mod_disco.erl index 4231df68d..724b9b957 100644 --- a/src/mod_disco.erl +++ b/src/mod_disco.erl @@ -354,6 +354,9 @@ get_sm_items(empty, From, To, _Node, _Lang) -> is_presence_subscribed(#jid{luser = User, lserver = Server}, + #jid{luser = User, lserver = Server}) -> true; +is_presence_subscribed(#jid{luser = User, + lserver = Server}, #jid{luser = LUser, lserver = LServer}) -> lists:any(fun (#roster{jid = {TUser, TServer, _}, subscription = S}) -> @@ -363,8 +366,7 @@ is_presence_subscribed(#jid{luser = User, end end, ejabberd_hooks:run_fold(roster_get, LServer, [], - [{LUser, LServer}])) - orelse User == LUser andalso Server == LServer. + [{LUser, LServer}])). process_sm_iq_info(From, To, #iq{type = Type, lang = Lang, sub_el = SubEl} = IQ) -> |