|
@ -330,12 +330,13 @@ func (c *Clients) newClient(config api.ClientConfig) (*gomatrix.Client, error) { |
|
|
} |
|
|
} |
|
|
client.Client = c.httpClient |
|
|
client.Client = c.httpClient |
|
|
syncer := client.Syncer.(*gomatrix.DefaultSyncer) |
|
|
syncer := client.Syncer.(*gomatrix.DefaultSyncer) |
|
|
client.Store = &matrix.NEBStore{ |
|
|
|
|
|
|
|
|
nebStore := &matrix.NEBStore{ |
|
|
InMemoryStore: *gomatrix.NewInMemoryStore(), |
|
|
InMemoryStore: *gomatrix.NewInMemoryStore(), |
|
|
Database: c.db, |
|
|
Database: c.db, |
|
|
ClientConfig: config, |
|
|
ClientConfig: config, |
|
|
} |
|
|
} |
|
|
syncer.Store = client.Store |
|
|
|
|
|
|
|
|
client.Store = nebStore |
|
|
|
|
|
syncer.Store = nebStore |
|
|
|
|
|
|
|
|
// TODO: Check that the access token is valid for the userID by peforming
|
|
|
// TODO: Check that the access token is valid for the userID by peforming
|
|
|
// a request against the server.
|
|
|
// a request against the server.
|
|
@ -354,6 +355,13 @@ func (c *Clients) newClient(config api.ClientConfig) (*gomatrix.Client, error) { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
log.WithFields(log.Fields{ |
|
|
|
|
|
"user_id": config.UserID, |
|
|
|
|
|
"sync": config.Sync, |
|
|
|
|
|
"auto_join_rooms": config.AutoJoinRooms, |
|
|
|
|
|
"since": nebStore.LoadNextBatch(config.UserID), |
|
|
|
|
|
}).Info("Created new client") |
|
|
|
|
|
|
|
|
if config.Sync { |
|
|
if config.Sync { |
|
|
go func() { |
|
|
go func() { |
|
|
for { |
|
|
for { |
|
|