forked from MirrorHub/mautrix-whatsapp
Check prev_content for all leave events
This commit is contained in:
parent
d24a8821c1
commit
c85b003fe8
1 changed files with 7 additions and 7 deletions
14
matrix.go
14
matrix.go
|
@ -274,14 +274,14 @@ func (mx *MatrixHandler) HandleMembership(evt *event.Event) {
|
||||||
isSelf := id.UserID(evt.GetStateKey()) == evt.Sender
|
isSelf := id.UserID(evt.GetStateKey()) == evt.Sender
|
||||||
|
|
||||||
if content.Membership == event.MembershipLeave {
|
if content.Membership == event.MembershipLeave {
|
||||||
if isSelf {
|
if evt.Unsigned.PrevContent != nil {
|
||||||
if evt.Unsigned.PrevContent != nil {
|
_ = evt.Unsigned.PrevContent.ParseRaw(evt.Type)
|
||||||
_ = evt.Unsigned.PrevContent.ParseRaw(evt.Type)
|
prevContent, ok := evt.Unsigned.PrevContent.Parsed.(*event.MemberEventContent)
|
||||||
prevContent, ok := evt.Unsigned.PrevContent.Parsed.(*event.MemberEventContent)
|
if ok && prevContent.Membership != "join" {
|
||||||
if ok && prevContent.Membership != "join" {
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if isSelf {
|
||||||
portal.HandleMatrixLeave(user)
|
portal.HandleMatrixLeave(user)
|
||||||
} else {
|
} else {
|
||||||
portal.HandleMatrixKick(user, evt)
|
portal.HandleMatrixKick(user, evt)
|
||||||
|
|
Loading…
Reference in a new issue