aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2010-12-23 21:05:21 +0100
committerBadlop <badlop@process-one.net>2010-12-23 21:05:21 +0100
commit4b0a7fe307bb89a7d7e9edfd510499818f835e9d (patch)
treed5b850c3b8f16dbf4040ee8f68819754eb4cdd79
parentFix bug introduced with an old commit (EJAB-72) (diff)
Only call mod_roster when the user is in a local vhost, fixing EJAB-869
-rw-r--r--src/mod_shared_roster.erl22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl
index 018e71085..5a36ef2fc 100644
--- a/src/mod_shared_roster.erl
+++ b/src/mod_shared_roster.erl
@@ -367,14 +367,22 @@ in_subscription(Acc, User, Server, JID, Type, _Reason) ->
process_subscription(in, User, Server, JID, Type, Acc).
out_subscription(UserFrom, ServerFrom, JIDTo, unsubscribed) ->
- %% Remove pending out subscription
{UserTo, ServerTo, _} = jlib:short_prepd_bare_jid(JIDTo),
- JIDFrom = exmpp_jid:make(UserFrom, UserTo),
- mod_roster:out_subscription(UserTo, ServerTo, JIDFrom, unsubscribe),
-
- %% Remove pending in subscription
- mod_roster:in_subscription(aaaa, UserFrom, ServerFrom, JIDTo, unsubscribe, ""),
-
+ case ejabberd_hosts:registered(binary_to_list(ServerTo)) of
+ true ->
+ %% Remove pending out subscription
+ JIDFrom = exmpp_jid:make(UserFrom, ServerFrom),
+ mod_roster:out_subscription(UserTo, ServerTo, JIDFrom, unsubscribe);
+ false ->
+ ok
+ end,
+ case ejabberd_hosts:registered(binary_to_list(ServerFrom)) of
+ true ->
+ %% Remove pending in subscription
+ mod_roster:in_subscription(aaaa, UserFrom, ServerFrom, JIDTo, unsubscribe, "");
+ false ->
+ ok
+ end,
process_subscription(out, UserFrom, ServerFrom, JIDTo, unsubscribed, false);
out_subscription(User, Server, JID, Type) ->
process_subscription(out, User, Server, JID, Type, false).