diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2021-08-20 20:30:11 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2021-08-20 20:30:11 +0200 |
commit | 8f8de0403bab0a819420db69bb44bdb2a474d137 (patch) | |
tree | 3addbdbd28c66b601356ee31977237a72dc46033 | |
parent | Merge pull request #3660 from ballerburg9005/patch-1 (diff) |
PubSub: Support 'max_items=max' node configuration
Let clients request the maximum limit for the node configuration option
'max_items' by specifying the special value 'max' instead of an integer.
This was added to XEP-0060, revision 1.17.0 (and clarified in revision
1.20.0).
Thanks to Ammonit Measurement GmbH for sponsoring this work.
-rw-r--r-- | mix.exs | 2 | ||||
-rw-r--r-- | rebar.config | 2 | ||||
-rw-r--r-- | src/mod_pubsub.erl | 7 |
3 files changed, 7 insertions, 4 deletions
@@ -124,7 +124,7 @@ defmodule Ejabberd.MixProject do {:pkix, "~> 1.0"}, {:stringprep, ">= 1.0.26"}, {:stun, "~> 1.0"}, - {:xmpp, "~> 1.5"}, + {:xmpp, git: "https://github.com/processone/xmpp", ref: "e943c0285aa85e3cbd4bfb9259f6b7de32b00395", override: true}, {:yconf, "~> 1.0"}] ++ cond_deps() end diff --git a/rebar.config b/rebar.config index 798e6350b..a70ccfba3 100644 --- a/rebar.config +++ b/rebar.config @@ -59,7 +59,7 @@ {stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.27"}}}, {if_var_true, stun, {stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.44"}}}}, - {xmpp, ".*", {git, "https://github.com/processone/xmpp", {tag, "1.5.4"}}}, + {xmpp, ".*", {git, "https://github.com/processone/xmpp", "e943c0285aa85e3cbd4bfb9259f6b7de32b00395"}}, {yconf, ".*", {git, "https://github.com/processone/yconf", {tag, "1.0.12"}}} ]}. diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index d49a11817..49a54c9b4 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -3553,8 +3553,10 @@ decode_get_pending(#xdata{fields = Fs}, Lang) -> check_opt_range(_Opt, _Opts, undefined) -> true; check_opt_range(Opt, Opts, Max) -> - Val = proplists:get_value(Opt, Opts, Max), - Val =< Max. + case proplists:get_value(Opt, Opts, Max) of + max -> true; + Val -> Val =< Max + end. -spec get_max_items_node(host()) -> undefined | non_neg_integer(). get_max_items_node(Host) -> @@ -3708,6 +3710,7 @@ features() -> <<"access-whitelist">>, % OPTIONAL <<"collections">>, % RECOMMENDED <<"config-node">>, % RECOMMENDED + <<"config-node-max">>, <<"create-and-configure">>, % RECOMMENDED <<"item-ids">>, % RECOMMENDED <<"last-published">>, % RECOMMENDED |