sync: None since in the initial sync

We can read this in the spec [1]:

> To read events, the intended flow of operation is for clients to first
> call the /sync API without a since parameter. This returns the most
> recent message events for each room, as well as the state of the room at
> the start of the returned timeline

[1] https://matrix.org/docs/spec/client_server/latest.html#syncing
This commit is contained in:
Daniel García Moreno 2018-10-19 13:33:58 +02:00
parent e25f936493
commit e855d9ed64

View file

@ -18,7 +18,12 @@ impl AppOp {
pub fn sync(&mut self, initial: bool) {
if !self.syncing && self.logged_in {
self.syncing = true;
self.backend.send(BKCommand::Sync(self.since.clone(), initial)).unwrap();
// for the initial sync we set the since to None to avoid long syncing
// the since can be a very old value and following the spec we should
// do the initial sync without a since:
// https://matrix.org/docs/spec/client_server/latest.html#syncing
let since = match initial { true => None, _ => self.since.clone() };
self.backend.send(BKCommand::Sync(since, initial)).unwrap();
}
}