aboutsummaryrefslogtreecommitdiff
path: root/matrix/matrix.go
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-05-15 15:39:40 +0300
committerTulir Asokan <tulir@maunium.net>2018-05-15 17:55:08 +0300
commit2d642095723416be7dd552ff79ef31ef06ec6e34 (patch)
treee8b5bf0d5c9ae404b55ac5665dfc186add26fa51 /matrix/matrix.go
parenteff910ff43e139ae4912bed2d53475314e8fc942 (diff)
Update state event handling
Diffstat (limited to 'matrix/matrix.go')
-rw-r--r--matrix/matrix.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go
index cdd4ed5..7bb790e 100644
--- a/matrix/matrix.go
+++ b/matrix/matrix.go
@@ -227,7 +227,7 @@ func (c *Container) Start() {
// HandleMessage is the event handler for the m.room.message timeline event.
func (c *Container) HandleMessage(source EventSource, evt *gomatrix.Event) {
- if source == EventSourceLeave {
+ if source & EventSourceLeave != 0 {
return
}
mainView := c.ui.MainView()
@@ -312,11 +312,14 @@ func (c *Container) processOwnMembershipChange(evt *gomatrix.Event) {
// HandleMembership is the event handler for the m.room.member state event.
func (c *Container) HandleMembership(source EventSource, evt *gomatrix.Event) {
- if !c.config.Session.InitialSyncDone && source == EventSourceLeave {
+ isLeave := source & EventSourceLeave != 0
+ isTimeline := source & EventSourceTimeline != 0
+ isNonTimelineLeave := isLeave && !isTimeline
+ if !c.config.Session.InitialSyncDone && isNonTimelineLeave {
return
} else if evt.StateKey != nil && *evt.StateKey == c.config.Session.UserID {
c.processOwnMembershipChange(evt)
- } else if !c.config.Session.InitialSyncDone || source == EventSourceLeave {
+ } else if !isTimeline && (!c.config.Session.InitialSyncDone || isLeave) {
// We don't care about other users' membership events in the initial sync or chats we've left.
return
}