aboutsummaryrefslogtreecommitdiff
path: root/matrix/pushrules/condition.go
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-11-14 00:00:35 +0200
committerTulir Asokan <tulir@maunium.net>2018-11-14 00:00:35 +0200
commitba387764ca1590625d349e74eb8a8a64d1849b67 (patch)
treebc8f02156a63eac99dcddaed38e45b7c312b40c0 /matrix/pushrules/condition.go
parentcfb2cc057c32330be0ca0a68cfbd245cb2b8e31b (diff)
Fix things
Diffstat (limited to 'matrix/pushrules/condition.go')
-rw-r--r--matrix/pushrules/condition.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/matrix/pushrules/condition.go b/matrix/pushrules/condition.go
index 22d59aa..bacab56 100644
--- a/matrix/pushrules/condition.go
+++ b/matrix/pushrules/condition.go
@@ -21,14 +21,14 @@ import (
"strconv"
"strings"
- "maunium.net/go/gomatrix"
+ "maunium.net/go/mautrix"
"maunium.net/go/gomuks/lib/glob"
)
// Room is an interface with the functions that are needed for processing room-specific push conditions
type Room interface {
- GetMember(mxid string) *gomatrix.Member
- GetMembers() map[string]*gomatrix.Member
+ GetMember(mxid string) *mautrix.Member
+ GetMembers() map[string]*mautrix.Member
GetSessionOwner() string
}
@@ -59,7 +59,7 @@ type PushCondition struct {
var MemberCountFilterRegex = regexp.MustCompile("^(==|[<>]=?)?([0-9]+)$")
// Match checks if this condition is fulfilled for the given event in the given room.
-func (cond *PushCondition) Match(room Room, event *gomatrix.Event) bool {
+func (cond *PushCondition) Match(room Room, event *mautrix.Event) bool {
switch cond.Kind {
case KindEventMatch:
return cond.matchValue(room, event)
@@ -72,7 +72,7 @@ func (cond *PushCondition) Match(room Room, event *gomatrix.Event) bool {
}
}
-func (cond *PushCondition) matchValue(room Room, event *gomatrix.Event) bool {
+func (cond *PushCondition) matchValue(room Room, event *mautrix.Event) bool {
index := strings.IndexRune(cond.Key, '.')
key := cond.Key
subkey := ""
@@ -106,7 +106,7 @@ func (cond *PushCondition) matchValue(room Room, event *gomatrix.Event) bool {
}
}
-func (cond *PushCondition) matchDisplayName(room Room, event *gomatrix.Event) bool {
+func (cond *PushCondition) matchDisplayName(room Room, event *mautrix.Event) bool {
ownerID := room.GetSessionOwner()
if ownerID == event.Sender {
return false
@@ -115,7 +115,7 @@ func (cond *PushCondition) matchDisplayName(room Room, event *gomatrix.Event) bo
return strings.Contains(event.Content.Body, member.Displayname)
}
-func (cond *PushCondition) matchMemberCount(room Room, event *gomatrix.Event) bool {
+func (cond *PushCondition) matchMemberCount(room Room, event *mautrix.Event) bool {
group := MemberCountFilterRegex.FindStringSubmatch(cond.MemberCountCondition)
if len(group) != 3 {
return false