aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2017-08-23 09:00:13 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2017-08-23 09:00:13 +0300
commit47175adc747862af58071ad91c975f062dc66636 (patch)
treed5feefea7a71874e5ee5923780b8f72ad8b50e3f /src
parentIgnore some options from rebar.config (diff)
Explicitly match against <domain/resource>
Fixes #1958
Diffstat (limited to 'src')
-rw-r--r--src/mod_privacy.erl42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/mod_privacy.erl b/src/mod_privacy.erl
index 85384610d..343645ff7 100644
--- a/src/mod_privacy.erl
+++ b/src/mod_privacy.erl
@@ -638,25 +638,29 @@ is_ptype_match(Item, PType) ->
ljid(), none | both | from | to, [binary()]) -> boolean().
is_type_match(none, _Value, _JID, _Subscription, _Groups) ->
true;
-is_type_match(Type, Value, JID, Subscription, Groups) ->
- case Type of
- jid ->
- case Value of
- {<<"">>, Server, <<"">>} ->
- case JID of
- {_, Server, _} -> true;
- _ -> false
- end;
- {User, Server, <<"">>} ->
- case JID of
- {User, Server, _} -> true;
- _ -> false
- end;
- _ -> Value == JID
- end;
- subscription -> Value == Subscription;
- group -> lists:member(Value, Groups)
- end.
+is_type_match(jid, Value, JID, _Subscription, _Groups) ->
+ case Value of
+ {<<"">>, Server, <<"">>} ->
+ case JID of
+ {_, Server, _} -> true;
+ _ -> false
+ end;
+ {User, Server, <<"">>} ->
+ case JID of
+ {User, Server, _} -> true;
+ _ -> false
+ end;
+ {<<"">>, Server, Resource} ->
+ case JID of
+ {_, Server, Resource} -> true;
+ _ -> false
+ end;
+ _ -> Value == JID
+ end;
+is_type_match(subscription, Value, _JID, Subscription, _Groups) ->
+ Value == Subscription;
+is_type_match(group, Group, _JID, _Subscription, Groups) ->
+ lists:member(Group, Groups).
-spec remove_user(binary(), binary()) -> ok.
remove_user(User, Server) ->