diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-04-24 02:11:32 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-04-24 02:14:00 +0300 |
commit | fcd9a932cb5542ed8980fc1daba7ee1f0041a3f2 (patch) | |
tree | aaaf81233593391432b42369801580dff2fc75b4 /matrix/sync.go | |
parent | 2a0145db884038342ba00cdb29fc29085e1faace (diff) |
Initial move to initial sync. Everything broke :(
Diffstat (limited to 'matrix/sync.go')
-rw-r--r-- | matrix/sync.go | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/matrix/sync.go b/matrix/sync.go index f3966cb..ec1c34e 100644 --- a/matrix/sync.go +++ b/matrix/sync.go @@ -20,16 +20,16 @@ package matrix import ( "encoding/json" - "fmt" - "runtime/debug" "time" "maunium.net/go/gomatrix" + "maunium.net/go/gomuks/debug" "maunium.net/go/gomuks/matrix/rooms" ) type SyncerSession interface { GetRoom(id string) *rooms.Room + SetInitialSyncDone() GetUserID() string } @@ -53,16 +53,7 @@ func NewGomuksSyncer(session SyncerSession) *GomuksSyncer { // ProcessResponse processes a Matrix sync response. func (s *GomuksSyncer) ProcessResponse(res *gomatrix.RespSync, since string) (err error) { - if len(since) == 0 { - return - } - // debug.Print("Processing sync response", since, res) - - defer func() { - if r := recover(); r != nil { - err = fmt.Errorf("ProcessResponse for %s since %s panicked: %s\n%s", s.Session.GetUserID(), since, r, debug.Stack()) - } - }() + debug.Print("Processing sync response", since, res) s.processSyncEvents(nil, res.Presence.Events, false, false) s.processSyncEvents(nil, res.AccountData.Events, false, false) @@ -93,6 +84,9 @@ func (s *GomuksSyncer) ProcessResponse(res *gomatrix.RespSync, since string) (er } } + if since == "" { + s.Session.SetInitialSyncDone() + } s.FirstSyncDone = true return |