diff options
author | lovetox <philipp@hoerist.com> | 2021-07-24 22:09:34 +0300 |
---|---|---|
committer | lovetox <philipp@hoerist.com> | 2021-07-24 22:45:22 +0300 |
commit | afaf927d47b74f223b69b6185bf73bc3c579ac00 (patch) | |
tree | 465b945fcde89aaa77df51ca5dddbfdfa2829761 | |
parent | 61bff9bd7838c186c30f0fde2835331dfa469749 (diff) |
Correctly handle RSM count request
Fixes #120
-rw-r--r-- | nbxmpp/modules/mam.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/nbxmpp/modules/mam.py b/nbxmpp/modules/mam.py index bbcf3b9..b7fd019 100644 --- a/nbxmpp/modules/mam.py +++ b/nbxmpp/modules/mam.py @@ -66,7 +66,10 @@ class MAM(BaseModule): raise MalformedStanzaError('rsm set missing', response) complete = fin.getAttr('complete') == 'true' - if not complete: + if max_ != 0 and not complete: + # max_ == 0 is a request for count of the items in a result set + # in this case first and last will be absent + # See: https://xmpp.org/extensions/xep-0059.html#count if rsm.first is None or rsm.last is None: raise MalformedStanzaError('first or last element missing', response) |