mirror of
https://github.com/signaller-matrix/signaller.git
synced 2024-11-21 18:02:24 +00:00
Fix root type path
This commit is contained in:
parent
f7eb4f7e28
commit
cb452bbd98
@ -5,12 +5,13 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/signaller-matrix/signaller/internal"
|
||||
"github.com/signaller-matrix/signaller/internal/models/common"
|
||||
"github.com/signaller-matrix/signaller/internal/models/rooms"
|
||||
)
|
||||
|
||||
type RoomEvent struct {
|
||||
Content json.RawMessage
|
||||
Type rooms.Type
|
||||
Type common.EventType
|
||||
EventID string
|
||||
Sender internal.User
|
||||
OriginServerTS time.Time
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
"github.com/signaller-matrix/signaller/internal/models/common"
|
||||
"github.com/signaller-matrix/signaller/internal/models/createroom"
|
||||
"github.com/signaller-matrix/signaller/internal/models/devices"
|
||||
"github.com/signaller-matrix/signaller/internal/models/rooms"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
@ -50,7 +49,7 @@ func (user *User) CreateRoom(request createroom.Request) (internal.Room, models.
|
||||
// Create room event
|
||||
events = append(events, RoomEvent{
|
||||
Content: nil,
|
||||
Type: rooms.Create,
|
||||
Type: common.Create,
|
||||
EventID: internal.RandomString(eventIDSize),
|
||||
Sender: user,
|
||||
OriginServerTS: t})
|
||||
@ -60,7 +59,7 @@ func (user *User) CreateRoom(request createroom.Request) (internal.Room, models.
|
||||
// Set join rules event
|
||||
events = append(events, RoomEvent{
|
||||
Content: []byte(request.Visibility), // TODO: check visibility vs join rules
|
||||
Type: rooms.JoinRules,
|
||||
Type: common.JoinRules,
|
||||
EventID: internal.RandomString(eventIDSize),
|
||||
Sender: user,
|
||||
OriginServerTS: t})
|
||||
@ -69,7 +68,7 @@ func (user *User) CreateRoom(request createroom.Request) (internal.Room, models.
|
||||
if request.Name != "" {
|
||||
events = append(events, RoomEvent{
|
||||
Content: nil, // TODO: add
|
||||
Type: rooms.Name,
|
||||
Type: common.Name,
|
||||
EventID: internal.RandomString(eventIDSize),
|
||||
Sender: user,
|
||||
OriginServerTS: t})
|
||||
@ -79,7 +78,7 @@ func (user *User) CreateRoom(request createroom.Request) (internal.Room, models.
|
||||
if request.RoomAliasName != "" {
|
||||
events = append(events, RoomEvent{
|
||||
Content: nil, // TODO: add
|
||||
Type: rooms.CanonicalAlias,
|
||||
Type: common.CanonicalAlias,
|
||||
EventID: internal.RandomString(eventIDSize),
|
||||
Sender: user,
|
||||
OriginServerTS: t})
|
||||
@ -125,7 +124,7 @@ func (user *User) SetTopic(room internal.Room, topic string) models.ApiError {
|
||||
memRoom.mutex.Unlock()
|
||||
|
||||
rEvent := &RoomEvent{
|
||||
Type: rooms.Topic,
|
||||
Type: common.Topic,
|
||||
Sender: user,
|
||||
OriginServerTS: time.Now(),
|
||||
Room: room}
|
||||
@ -206,7 +205,7 @@ func (user *User) SendMessage(room internal.Room, text string) models.ApiError {
|
||||
|
||||
rEvent := &RoomEvent{
|
||||
Content: nil,
|
||||
Type: rooms.Message,
|
||||
Type: common.Message,
|
||||
EventID: internal.RandomString(defaultTokenSize),
|
||||
Sender: user,
|
||||
OriginServerTS: time.Now(),
|
||||
|
@ -3,6 +3,8 @@ package rooms
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/signaller-matrix/signaller/internal/models/common"
|
||||
|
||||
"github.com/signaller-matrix/signaller/internal/models/events"
|
||||
)
|
||||
|
||||
@ -18,7 +20,7 @@ const (
|
||||
// https://matrix.org/docs/spec/client_server/latest#room-event-fields
|
||||
type Event struct {
|
||||
Content json.RawMessage `json:"content"` // Required. The fields in this object will vary depending on the type of event. When interacting with the REST API, this is the HTTP body.
|
||||
Type Type `json:"type"` // Required. The type of event. This SHOULD be namespaced similar to Java package naming conventions e.g. 'com.example.subdomain.event.type'
|
||||
Type common.EventType `json:"type"` // Required. The type of event. This SHOULD be namespaced similar to Java package naming conventions e.g. 'com.example.subdomain.event.type'
|
||||
EventID string `json:"event_id"` // Required. The globally unique event identifier.
|
||||
Sender string `json:"sender"` // Required. Contains the fully-qualified ID of the user who sent this event.
|
||||
OriginServerTS int64 `json:"origin_server_ts"` // Required. Timestamp in milliseconds on originating homeserver when this event was sent.
|
||||
|
Loading…
Reference in New Issue
Block a user