XEP-0059: max value check:

check that max is not negative, this is to spot the accidental use of C.NO_LIMIT for max
This commit is contained in:
Goffi 2019-01-11 09:48:19 +01:00
commit 8f7196aafb

View file

@ -61,6 +61,9 @@ class XEP_0059(object):
@return (rsm.RSMRequest, None): request with parsed arguments
or None if no RSM arguments have been found
"""
if int(extra.get(RSM_PREFIX + u'max', 0)) < 0:
raise ValueError(_(u"rsm_max can't be negative"))
rsm_args = {}
for arg in (u"max", u"after", u"before", u"index"):
try: