From 152b89ed5e6a4a3edbfc40222b4388049a213b82 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 22 Mar 2018 21:44:46 +0200 Subject: Add support for m.emote. Fixes #6 --- matrix/matrix.go | 5 +++-- matrix/room/room.go | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'matrix') diff --git a/matrix/matrix.go b/matrix/matrix.go index a73e050..19bc226 100644 --- a/matrix/matrix.go +++ b/matrix/matrix.go @@ -280,10 +280,11 @@ func (c *Container) HandleTyping(evt *gomatrix.Event) { } // SendMessage sends a message with the given text to the given room. -func (c *Container) SendMessage(roomID, text string) (string, error) { +func (c *Container) SendMessage(roomID, msgtype, text string) (string, error) { defer c.gmx.Recover() c.SendTyping(roomID, false) - resp, err := c.client.SendText(roomID, text) + resp, err := c.client.SendMessageEvent(roomID, "m.room.message", + gomatrix.TextMessage{MsgType: msgtype, Body: text}) if err != nil { return "", err } diff --git a/matrix/room/room.go b/matrix/room/room.go index c006bd3..4166fd7 100644 --- a/matrix/room/room.go +++ b/matrix/room/room.go @@ -225,6 +225,11 @@ func (room *Room) GetMember(userID string) *Member { return member } +// GetSessionOwner returns the Member instance of the user whose session this room was created for. +func (room *Room) GetSessionOwner() *Member { + return room.GetMember(room.SessionUserID) +} + // NewRoom creates a new Room with the given ID func NewRoom(roomID, owner string) *Room { return &Room{ -- cgit v1.2.3