swap away from lazymemstore
This commit is contained in:
parent
0d013bfe28
commit
ba048c35da
22
main.go
22
main.go
@ -25,11 +25,27 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
store := mbl.NewLazyMemStore(conf.Statefile)
|
dataFilter := &mautrix.Filter{
|
||||||
matrixClient, err := mbl.NewMatrixClient(conf, store)
|
AccountData: mautrix.FilterPart{
|
||||||
|
Limit: 20,
|
||||||
|
NotTypes: []event.Type{
|
||||||
|
event.NewEventType("nun.batch"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
matrixClient, err := mbl.NewMatrixClient(conf, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
store := mautrix.NewAccountDataStore("nun.batch", matrixClient)
|
||||||
|
_, err = matrixClient.CreateFilter(dataFilter)
|
||||||
|
if err != nil {
|
||||||
|
//don't want to continue if we can't keep state
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
matrixClient.Store = store
|
||||||
syncer := matrixClient.Syncer.(*mautrix.DefaultSyncer)
|
syncer := matrixClient.Syncer.(*mautrix.DefaultSyncer)
|
||||||
mbl.AcceptAllRoomInvites(matrixClient)
|
mbl.AcceptAllRoomInvites(matrixClient)
|
||||||
syncer.OnEventType(event.EventMessage, func(source mautrix.EventSource, evt *event.Event) {
|
syncer.OnEventType(event.EventMessage, func(source mautrix.EventSource, evt *event.Event) {
|
||||||
@ -43,7 +59,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch cmd[1] {
|
switch cmd[0] {
|
||||||
case "version":
|
case "version":
|
||||||
// print version
|
// print version
|
||||||
if GitTag != "" {
|
if GitTag != "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user