Adjust chat message collection to changes in chat endpoint
Adjust chat message collection to changes in chat endpoint

The messages are now got based on the id of the last known message
instead of on an offset (the number of known messages) to adjust to the
changes in the chat endpoint.

The chat endpoint was modified too to, based on the value of the
"lookIntoFuture" parameter, either immediately return the history of
messages or wait for new messages to be received; in this later case,
however, the old behaviour was preserved, so it can still be used to get
the existing messages too besides the new ones.

The only difference with the old behaviour is that now the number of
received messages is limited by the "limit" parameter (100 by default).
However, when "lookIntoFuture" is enabled and there are existing
messages it returns immediately, so even if there is a long history it
will load chunks of 100 messages until all the existing messages are
received (which also makes the browser more responsive than loading
thousands of messages at once).

Note that when "lookIntoFuture" is enabled the chat endpoint provides
the messages sorted from oldest to newest, so it is no longer needed to
explicitly sort the models in the collection.

Signed-off-by: Daniel Calviño Sánchez <bd7629e975cc0e00ea7cda4ab6a120f2ee42ac1b@gmail.com>

nextcloud/spreed,nextcloud/spreed,nextcloud/spreed