25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

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.
This commit is contained in:
Holger Weiss 2021-08-20 20:30:11 +02:00
parent 8afc320aba
commit 8f8de0403b
3 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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"}}}
]}.

View File

@ -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