BREAKING: update mautrix to 0.15.x

This commit is contained in:
Aine
2023-06-01 14:32:20 +00:00
parent a6b20a75ab
commit 2bdb8ca635
222 changed files with 7851 additions and 23986 deletions

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2020 Tulir Asokan
// Copyright (c) 2023 Tulir Asokan
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -97,6 +97,9 @@ type MessageEventContent struct {
FileName string `json:"filename,omitempty"`
Mentions *Mentions `json:"m.mentions,omitempty"`
UnstableMentions *Mentions `json:"org.matrix.msc3952.mentions,omitempty"`
// Edits and relations
NewContent *MessageEventContent `json:"m.new_content,omitempty"`
RelatesTo *RelatesTo `json:"m.relates_to,omitempty"`
@@ -135,6 +138,12 @@ func (content *MessageEventContent) SetEdit(original id.EventID) {
if content.Format == FormatHTML && len(content.FormattedBody) > 0 {
content.FormattedBody = "* " + content.FormattedBody
}
// If the message is long, remove most of the useless edit fallback to avoid event size issues.
if len(content.Body) > 10000 {
content.FormattedBody = ""
content.Format = ""
content.Body = content.Body[:50] + "[edit fallback cut…]"
}
}
}
@@ -163,6 +172,11 @@ func (content *MessageEventContent) GetInfo() *FileInfo {
return content.Info
}
type Mentions struct {
UserIDs []id.UserID `json:"user_ids,omitempty"`
Room bool `json:"room,omitempty"`
}
type EncryptedFileInfo struct {
attachment.EncryptedFile
URL id.ContentURIString `json:"url"`