aboutsummaryrefslogtreecommitdiff
path: root/interface
diff options
context:
space:
mode:
Diffstat (limited to 'interface')
-rw-r--r--interface/matrix.go40
-rw-r--r--interface/ui.go25
2 files changed, 34 insertions, 31 deletions
diff --git a/interface/matrix.go b/interface/matrix.go
index 34d8f7f..4be21fd 100644
--- a/interface/matrix.go
+++ b/interface/matrix.go
@@ -17,16 +17,18 @@
package ifc
import (
- "maunium.net/go/gomuks/config"
- "maunium.net/go/gomuks/matrix/event"
"maunium.net/go/mautrix"
+ "maunium.net/go/mautrix/event"
+ "maunium.net/go/mautrix/id"
+ "maunium.net/go/gomuks/config"
+ "maunium.net/go/gomuks/matrix/muksevt"
"maunium.net/go/gomuks/matrix/rooms"
)
type Relation struct {
- Type mautrix.RelationType
- Event *event.Event
+ Type event.RelationType
+ Event *muksevt.Event
}
type MatrixContainer interface {
@@ -42,23 +44,23 @@ type MatrixContainer interface {
Logout()
SendPreferencesToMatrix()
- PrepareMarkdownMessage(roomID string, msgtype mautrix.MessageType, text, html string, relation *Relation) *event.Event
- SendEvent(evt *event.Event) (string, error)
- Redact(roomID, eventID, reason string) error
- SendTyping(roomID string, typing bool)
- MarkRead(roomID, eventID string)
- JoinRoom(roomID, server string) (*rooms.Room, error)
- LeaveRoom(roomID string) error
+ PrepareMarkdownMessage(roomID id.RoomID, msgtype event.MessageType, text, html string, relation *Relation) *muksevt.Event
+ SendEvent(evt *muksevt.Event) (id.EventID, error)
+ Redact(roomID id.RoomID, eventID id.EventID, reason string) error
+ SendTyping(roomID id.RoomID, typing bool)
+ MarkRead(roomID id.RoomID, eventID id.EventID)
+ JoinRoom(roomID id.RoomID, server string) (*rooms.Room, error)
+ LeaveRoom(roomID id.RoomID) error
CreateRoom(req *mautrix.ReqCreateRoom) (*rooms.Room, error)
FetchMembers(room *rooms.Room) error
- GetHistory(room *rooms.Room, limit int) ([]*event.Event, error)
- GetEvent(room *rooms.Room, eventID string) (*event.Event, error)
- GetRoom(roomID string) *rooms.Room
- GetOrCreateRoom(roomID string) *rooms.Room
+ GetHistory(room *rooms.Room, limit int) ([]*muksevt.Event, error)
+ GetEvent(room *rooms.Room, eventID id.EventID) (*muksevt.Event, error)
+ GetRoom(roomID id.RoomID) *rooms.Room
+ GetOrCreateRoom(roomID id.RoomID) *rooms.Room
- Download(uri mautrix.ContentURI) ([]byte, error)
- DownloadToDisk(uri mautrix.ContentURI, target string) (string, error)
- GetDownloadURL(uri mautrix.ContentURI) string
- GetCachePath(uri mautrix.ContentURI) string
+ Download(uri id.ContentURI) ([]byte, error)
+ DownloadToDisk(uri id.ContentURI, target string) (string, error)
+ GetDownloadURL(uri id.ContentURI) string
+ GetCachePath(uri id.ContentURI) string
}
diff --git a/interface/ui.go b/interface/ui.go
index abc108f..67cc35c 100644
--- a/interface/ui.go
+++ b/interface/ui.go
@@ -19,9 +19,10 @@ package ifc
import (
"time"
- "maunium.net/go/gomuks/matrix/event"
- "maunium.net/go/gomuks/matrix/pushrules"
+ "maunium.net/go/gomuks/matrix/muksevt"
"maunium.net/go/gomuks/matrix/rooms"
+ "maunium.net/go/mautrix/id"
+ "maunium.net/go/mautrix/pushrules"
)
type UIProvider func(gmx Gomuks) GomuksUI
@@ -40,7 +41,7 @@ type GomuksUI interface {
}
type MainView interface {
- GetRoom(roomID string) RoomView
+ GetRoom(roomID id.RoomID) RoomView
AddRoom(room *rooms.Room)
RemoveRoom(room *rooms.Room)
SetRooms(rooms *rooms.RoomCache)
@@ -48,7 +49,7 @@ type MainView interface {
UpdateTags(room *rooms.Room)
- SetTyping(roomID string, users []string)
+ SetTyping(roomID id.RoomID, users []id.UserID)
NotifyMessage(room *rooms.Room, message Message, should pushrules.PushActionArrayShould)
}
@@ -57,23 +58,23 @@ type RoomView interface {
MxRoom() *rooms.Room
SetCompletions(completions []string)
- SetTyping(users []string)
+ SetTyping(users []id.UserID)
UpdateUserList()
- AddEvent(evt *event.Event) Message
- AddRedaction(evt *event.Event)
- AddEdit(evt *event.Event)
- AddReaction(evt *event.Event, key string)
- GetEvent(eventID string) Message
+ AddEvent(evt *muksevt.Event) Message
+ AddRedaction(evt *muksevt.Event)
+ AddEdit(evt *muksevt.Event)
+ AddReaction(evt *muksevt.Event, key string)
+ GetEvent(eventID id.EventID) Message
AddServiceMessage(message string)
}
type Message interface {
- ID() string
+ ID() id.EventID
Time() time.Time
NotificationSenderName() string
NotificationContent() string
SetIsHighlight(highlight bool)
- SetID(id string)
+ SetID(id id.EventID)
}