signaller/internal/backends/memory/roomevents.go

31 lines
693 B
Go
Raw Permalink Normal View History

2019-07-21 11:30:14 +00:00
package memory
import (
"encoding/json"
"time"
2019-08-03 14:19:18 +00:00
"github.com/signaller-matrix/signaller/internal"
"github.com/signaller-matrix/signaller/internal/models/rooms"
2019-07-21 11:30:14 +00:00
)
type RoomEvent struct {
Content json.RawMessage
Type rooms.Type
EventID string
Sender internal.User
OriginServerTS time.Time
Room internal.Room
}
func (roomEvent *RoomEvent) ToEvent() rooms.Event {
event := rooms.Event{
Content: roomEvent.Content,
Type: roomEvent.Type,
EventID: roomEvent.EventID,
Sender: roomEvent.Sender.ID(),
OriginServerTS: roomEvent.OriginServerTS.Unix(),
RoomID: roomEvent.Room.ID()}
return event
}