aboutsummaryrefslogtreecommitdiff
path: root/src/mod_shared_roster.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2013-11-13 20:40:56 +1000
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2014-05-09 21:26:55 +0400
commit003fd321ee03cc044064b21b7135bf9123201c60 (patch)
tree3f79db7ef2a0d4256423fa3582d909b111b33401 /src/mod_shared_roster.erl
parentFix previous commit (C2S session close on server shutdown) (diff)
Do not try to retreive vCards via local SM for foreign JIDs
Diffstat (limited to 'src/mod_shared_roster.erl')
-rw-r--r--src/mod_shared_roster.erl29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl
index e572a3a4d..8a1423c76 100644
--- a/src/mod_shared_roster.erl
+++ b/src/mod_shared_roster.erl
@@ -187,17 +187,24 @@ get_rosteritem_name([], _, _) -> <<"">>;
get_rosteritem_name([ModVcard], U, S) ->
From = jlib:make_jid(<<"">>, S, jlib:atom_to_binary(?MODULE)),
To = jlib:make_jid(U, S, <<"">>),
- IQ = {iq, <<"">>, get, <<"vcard-temp">>, <<"">>,
- #xmlel{name = <<"vCard">>,
- attrs = [{<<"xmlns">>, <<"vcard-temp">>}],
- children = []}},
- IQ_Vcard = ModVcard:process_sm_iq(From, To, IQ),
- try get_rosteritem_name_vcard(IQ_Vcard#iq.sub_el) catch
- E1:E2 ->
- ?ERROR_MSG("Error ~p found when trying to get the "
- "vCard of ~s@~s in ~p:~n ~p",
- [E1, U, S, ModVcard, E2]),
- <<"">>
+ case lists:member(To#jid.lserver, ?MYHOSTS) of
+ true ->
+ IQ = {iq, <<"">>, get, <<"vcard-temp">>, <<"">>,
+ #xmlel{name = <<"vCard">>,
+ attrs = [{<<"xmlns">>, <<"vcard-temp">>}],
+ children = []}},
+ IQ_Vcard = ModVcard:process_sm_iq(From, To, IQ),
+ case catch get_rosteritem_name_vcard(IQ_Vcard#iq.sub_el) of
+ {'EXIT', Err} ->
+ ?ERROR_MSG("Error found when trying to get the "
+ "vCard of ~s@~s in ~p:~n ~p",
+ [U, S, ModVcard, Err]),
+ <<"">>;
+ NickName ->
+ NickName
+ end;
+ false ->
+ <<"">>
end.
get_rosteritem_name_vcard([]) -> <<"">>;