Support formatting in rainbows

Fixes #119
This commit is contained in:
Tulir Asokan
2020-03-20 14:32:29 +02:00
parent 5a2c74514d
commit 87b394abec
10 changed files with 159 additions and 54 deletions

View File

@ -729,9 +729,19 @@ func (c *Container) MarkRead(roomID, eventID string) {
_, _ = c.client.MakeRequest("POST", urlPath, struct{}{}, nil)
}
func (c *Container) PrepareMarkdownMessage(roomID string, msgtype mautrix.MessageType, text string, rel *ifc.Relation) *event.Event {
content := format.RenderMarkdown(text)
content.MsgType = msgtype
func (c *Container) PrepareMarkdownMessage(roomID string, msgtype mautrix.MessageType, text, html string, rel *ifc.Relation) *event.Event {
var content mautrix.Content
if html != "" {
content = mautrix.Content{
FormattedBody: html,
Format: mautrix.FormatHTML,
Body: text,
MsgType: msgtype,
}
} else {
content = format.RenderMarkdown(text)
content.MsgType = msgtype
}
if rel != nil && rel.Type == mautrix.RelReplace {
contentCopy := content

View File

@ -153,6 +153,9 @@ func (s *GomuksSyncer) ProcessResponse(res *mautrix.RespSync, since string) (err
func (s *GomuksSyncer) processSyncEvents(room *rooms.Room, events []json.RawMessage, source EventSource) {
for _, event := range events {
if source == EventSourcePresence {
debug.Print(string(event))
}
s.processSyncEvent(room, event, source)
}
}
@ -241,7 +244,7 @@ func (s *GomuksSyncer) GetFilterJSON(userID string) json.RawMessage {
"m.room.power_levels",
"m.room.tombstone",
},
Limit: 50,
// Limit: 50,
},
Ephemeral: mautrix.FilterPart{
Types: []string{"m.typing", "m.receipt"},