]> granicus.if.org Git - ejabberd/commitdiff
Write validator for mod_multicast's limits option
authorBadlop <badlop@process-one.net>
Mon, 26 Jun 2017 11:39:50 +0000 (13:39 +0200)
committerBadlop <badlop@process-one.net>
Mon, 26 Jun 2017 11:39:50 +0000 (13:39 +0200)
src/mod_multicast.erl

index f27003f7d358974c41f19382fed88873730ae6f4..4d3e481a7de518531847c5d9e74f8f10cc528ebe 100644 (file)
@@ -1117,6 +1117,13 @@ depends(_Host, _Opts) ->
 mod_opt_type(access) ->
     fun acl:access_rules_validator/1;
 mod_opt_type(host) -> fun iolist_to_binary/1;
-mod_opt_type(limits) ->
-    fun (A) when is_list(A) -> A end;
-mod_opt_type(_) -> [access, host, limits].
+mod_opt_type({limits, Type}) when (Type == local) or (Type == remote) ->
+    fun(L) ->
+           lists:map(
+               fun ({message, infinite}) -> infinite;
+                   ({presence, infinite}) -> infinite;
+                   ({message, I}) when is_integer(I) -> I;
+                   ({presence, I}) when is_integer(I) -> I
+               end, L)
+    end;
+mod_opt_type(_) -> [access, host, {limits, local}, {limits, remote}].