aboutsummaryrefslogtreecommitdiff
path: root/matrix
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-04-09 23:45:54 +0300
committerTulir Asokan <tulir@maunium.net>2018-04-09 23:45:54 +0300
commiteda2b575f06e72040ebf82d24a7ec1ac84b7948c (patch)
treefe02378ebd00443cb675675ddade335ceab25cd1 /matrix
parent2ba2fde3966211845b1117c85b27e3c947b6307f (diff)
Refactor UI to use interfaces everywhere
Diffstat (limited to 'matrix')
-rw-r--r--matrix/matrix.go32
1 files changed, 16 insertions, 16 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go
index 7391ca0..6fff6d8 100644
--- a/matrix/matrix.go
+++ b/matrix/matrix.go
@@ -22,13 +22,14 @@ import (
"strings"
"time"
- "maunium.net/go/gomatrix"
- "maunium.net/go/gomuks/config"
- "maunium.net/go/gomuks/interface"
- "maunium.net/go/gomuks/matrix/pushrules"
- "maunium.net/go/gomuks/matrix/rooms"
- "maunium.net/go/gomuks/ui/debug"
- "maunium.net/go/gomuks/ui/widget"
+
+"maunium.net/go/gomatrix"
+"maunium.net/go/gomuks/config"
+"maunium.net/go/gomuks/debug"
+"maunium.net/go/gomuks/interface"
+"maunium.net/go/gomuks/matrix/pushrules"
+"maunium.net/go/gomuks/matrix/rooms"
+
)
// Container is a wrapper for a gomatrix Client and some other stuff.
@@ -224,10 +225,10 @@ func (c *Container) HandleMessage(evt *gomatrix.Event) {
message := mainView.ProcessMessageEvent(roomView, evt)
if message != nil {
if c.syncer.FirstSyncDone {
- pushRules := c.PushRules().GetActions(roomView.Room, evt).Should()
- mainView.NotifyMessage(roomView.Room, message, pushRules)
+ pushRules := c.PushRules().GetActions(roomView.MxRoom(), evt).Should()
+ mainView.NotifyMessage(roomView.MxRoom(), message, pushRules)
}
- roomView.AddMessage(message, widget.AppendMessage)
+ roomView.AddMessage(message, ifc.AppendMessage)
c.ui.Render()
}
}
@@ -255,8 +256,7 @@ func (c *Container) processOwnMembershipChange(evt *gomatrix.Event) {
if evt.Unsigned.PrevContent != nil {
prevMembership, _ = evt.Unsigned.PrevContent["membership"].(string)
}
- const Hour = 1 * 60 * 60 * 1000
- if membership == prevMembership || evt.Unsigned.Age > Hour {
+ if membership == prevMembership {
return
}
switch membership {
@@ -282,15 +282,15 @@ func (c *Container) HandleMembership(evt *gomatrix.Event) {
message := mainView.ProcessMembershipEvent(roomView, evt)
if message != nil {
// TODO this shouldn't be necessary
- roomView.Room.UpdateState(evt)
+ roomView.MxRoom().UpdateState(evt)
// TODO This should probably also be in a different place
roomView.UpdateUserList()
if c.syncer.FirstSyncDone {
- pushRules := c.PushRules().GetActions(roomView.Room, evt).Should()
- mainView.NotifyMessage(roomView.Room, message, pushRules)
+ pushRules := c.PushRules().GetActions(roomView.MxRoom(), evt).Should()
+ mainView.NotifyMessage(roomView.MxRoom(), message, pushRules)
}
- roomView.AddMessage(message, widget.AppendMessage)
+ roomView.AddMessage(message, ifc.AppendMessage)
c.ui.Render()
}
}