aboutsummaryrefslogtreecommitdiff
path: root/matrix
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-03-20 14:32:29 +0200
committerTulir Asokan <tulir@maunium.net>2020-03-20 14:32:30 +0200
commit87b394abecc54b136487d0086c3e62dac6a2acf2 (patch)
treeae12fe3466f5f56f687b750b97721862a457a80a /matrix
parent5a2c74514dd672343fbd012ab864518b9ee12957 (diff)
Support formatting in rainbows
Fixes #119
Diffstat (limited to 'matrix')
-rw-r--r--matrix/matrix.go16
-rw-r--r--matrix/sync.go5
2 files changed, 17 insertions, 4 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go
index ef5ef8a..226df6c 100644
--- a/matrix/matrix.go
+++ b/matrix/matrix.go
@@ -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
diff --git a/matrix/sync.go b/matrix/sync.go
index 81c0596..8ec22b5 100644
--- a/matrix/sync.go
+++ b/matrix/sync.go
@@ -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"},