aboutsummaryrefslogtreecommitdiff
path: root/syncapi
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-06-19 13:29:27 +0100
committerGitHub <noreply@github.com>2020-06-19 13:29:27 +0100
commit7f26b0cd13534ba235c2bf0a7220d3462ca8e9da (patch)
tree5e7728365d7cbb7d5366b704717397639ea92ad8 /syncapi
parent72444e4a4f31b70dfb7ddd875ef874f637699dce (diff)
Bind build support, further Yggdrasil demo updates (#1152)
* Add gobind builds for Yggdrasil demo * Massage client API a bit * Fix build * Fix gobind build * Fix gobind client API setup * Tweaks * Tweaks * Update sytest-whitelist, add comment * Default to sending push rules on initial sync
Diffstat (limited to 'syncapi')
-rw-r--r--syncapi/sync/request.go4
-rw-r--r--syncapi/sync/requestpool.go3
-rw-r--r--syncapi/types/types.go11
3 files changed, 13 insertions, 5 deletions
diff --git a/syncapi/sync/request.go b/syncapi/sync/request.go
index beeaa40f..5dd92c85 100644
--- a/syncapi/sync/request.go
+++ b/syncapi/sync/request.go
@@ -62,6 +62,10 @@ func newSyncRequest(req *http.Request, device userapi.Device) (*syncRequest, err
}
since = &tok
}
+ if since == nil {
+ tok := types.NewStreamToken(0, 0)
+ since = &tok
+ }
timelineLimit := defaultTimelineLimit
// TODO: read from stored filters too
filterQuery := req.URL.Query().Get("filter")
diff --git a/syncapi/sync/requestpool.go b/syncapi/sync/requestpool.go
index 8d51689e..743c63a6 100644
--- a/syncapi/sync/requestpool.go
+++ b/syncapi/sync/requestpool.go
@@ -256,7 +256,8 @@ func (rp *RequestPool) appendAccountData(
}
if len(dataTypes) == 0 {
- return data, nil
+ // TODO: this fixes the sytest but is it the right thing to do?
+ dataTypes[""] = []string{"m.push_rules"}
}
// Iterate over the rooms
diff --git a/syncapi/types/types.go b/syncapi/types/types.go
index c1f09fba..1094416a 100644
--- a/syncapi/types/types.go
+++ b/syncapi/types/types.go
@@ -98,6 +98,9 @@ func (t *StreamingToken) PDUPosition() StreamPosition {
func (t *StreamingToken) EDUPosition() StreamPosition {
return t.Positions[1]
}
+func (t *StreamingToken) String() string {
+ return t.syncToken.String()
+}
// IsAfter returns true if ANY position in this token is greater than `other`.
func (t *StreamingToken) IsAfter(other StreamingToken) bool {
@@ -220,8 +223,8 @@ func NewTopologyTokenFromString(tok string) (token TopologyToken, err error) {
err = fmt.Errorf("token %s is not a topology token", tok)
return
}
- if len(t.Positions) != 2 {
- err = fmt.Errorf("token %s wrong number of values, got %d want 2", tok, len(t.Positions))
+ if len(t.Positions) < 2 {
+ err = fmt.Errorf("token %s wrong number of values, got %d want at least 2", tok, len(t.Positions))
return
}
return TopologyToken{
@@ -247,8 +250,8 @@ func NewStreamTokenFromString(tok string) (token StreamingToken, err error) {
err = fmt.Errorf("token %s is not a streaming token", tok)
return
}
- if len(t.Positions) != 2 {
- err = fmt.Errorf("token %s wrong number of values, got %d want 2", tok, len(t.Positions))
+ if len(t.Positions) < 2 {
+ err = fmt.Errorf("token %s wrong number of values, got %d want at least 2", tok, len(t.Positions))
return
}
return StreamingToken{