aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-03-03 22:53:42 +0200
committerTulir Asokan <tulir@maunium.net>2020-03-03 22:53:46 +0200
commit5db5cd550d71c9844f3abeb44d3a9bb7fd23ad80 (patch)
treeacba2bcbc7e4c3ab70bab4540f88cde6c0a16aea
parent1eab5526e3dffd80cc4b8bc39db2cf160bdf559c (diff)
Properly ignore presence in sync filter
-rw-r--r--matrix/sync.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/matrix/sync.go b/matrix/sync.go
index 564848b..81c0596 100644
--- a/matrix/sync.go
+++ b/matrix/sync.go
@@ -186,7 +186,8 @@ func (s *GomuksSyncer) OnEventType(eventType mautrix.EventType, callback EventHa
func (s *GomuksSyncer) notifyListeners(source EventSource, event *mautrix.Event) {
if (event.Type.IsState() && source&EventSourceState == 0 && event.StateKey == nil) ||
(event.Type.IsAccountData() && source&EventSourceAccountData == 0) ||
- (event.Type.IsEphemeral() && source&EventSourceEphemeral == 0) {
+ (event.Type.IsEphemeral() && event.Type != mautrix.EphemeralEventPresence && source&EventSourceEphemeral == 0) ||
+ (event.Type == mautrix.EphemeralEventPresence && source&EventSourcePresence == 0) {
evtJson, _ := json.Marshal(event)
debug.Printf("Event of type %s received from mismatching source %s: %s", event.Type.String(), source.String(), string(evtJson))
return
@@ -253,7 +254,7 @@ func (s *GomuksSyncer) GetFilterJSON(userID string) json.RawMessage {
Types: []string{"m.push_rules", "m.direct", "net.maunium.gomuks.preferences"},
},
Presence: mautrix.FilterPart{
- Types: []string{},
+ NotTypes: []string{"*"},
},
}
rawFilter, _ := json.Marshal(&filter)