Add custom fields to set room and event ID when sending

This commit is contained in:
Tulir Asokan 2022-08-14 18:55:26 +03:00
commit 74a27d5925
2 changed files with 7 additions and 0 deletions

View file

@ -894,6 +894,8 @@ func (cli *Client) SetRoomAccountData(roomID id.RoomID, name string, data interf
type ReqSendEvent struct {
Timestamp int64
TransactionID string
MeowEventID id.EventID
}
// SendMessageEvent sends a message event into a room. See https://spec.matrix.org/v1.2/client-server-api/#put_matrixclientv3roomsroomidsendeventtypetxnid
@ -915,6 +917,9 @@ func (cli *Client) SendMessageEvent(roomID id.RoomID, eventType event.Type, cont
if req.Timestamp > 0 {
queryParams["ts"] = strconv.FormatInt(req.Timestamp, 10)
}
if req.MeowEventID != "" {
queryParams["fi.mau.event_id"] = req.MeowEventID.String()
}
urlData := ClientURLPath{"v3", "rooms", roomID, "send", eventType.String(), txnID}

View file

@ -103,6 +103,8 @@ type ReqCreateRoom struct {
RoomVersion string `json:"room_version,omitempty"`
PowerLevelOverride *event.PowerLevelsEventContent `json:"power_level_content_override,omitempty"`
MeowRoomID id.RoomID `json:"fi.mau.room_id,omitempty"`
}
// ReqRedact is the JSON request for https://spec.matrix.org/v1.2/client-server-api/#put_matrixclientv3roomsroomidredacteventidtxnid