aboutsummaryrefslogtreecommitdiff
path: root/matrix
diff options
context:
space:
mode:
Diffstat (limited to 'matrix')
-rw-r--r--matrix/matrix.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go
index 8199449..7ba6ebb 100644
--- a/matrix/matrix.go
+++ b/matrix/matrix.go
@@ -260,7 +260,8 @@ func (c *Container) processOwnMembershipChange(evt *gomatrix.Event) {
if evt.Unsigned.PrevContent != nil {
prevMembership, _ = evt.Unsigned.PrevContent["membership"].(string)
}
- if membership == prevMembership {
+ const Hour = 1 * 60 * 60 * 1000
+ if membership == prevMembership || evt.Unsigned.Age > Hour {
return
}
switch membership {
@@ -273,11 +274,6 @@ func (c *Container) processOwnMembershipChange(evt *gomatrix.Event) {
// HandleMembership is the event handler for the m.room.membership state event.
func (c *Container) HandleMembership(evt *gomatrix.Event) {
- const Hour = 1 * 60 * 60 * 1000
- if evt.Unsigned.Age > Hour {
- return
- }
-
if evt.StateKey != nil && *evt.StateKey == c.config.Session.UserID {
c.processOwnMembershipChange(evt)
}