mautrix / googlechat

A Matrix-Google Chat puppeting bridge
https://matrix.to/#/#googlechat:maunium.net
GNU Affero General Public License v3.0
113 stars 31 forks source link

[Feature Request] Detect formatting from Matrix client and pass through to hangups #26

Closed bobpaul closed 4 years ago

bobpaul commented 4 years ago

Steps

  1. Mark some text as bold, italics, and strike through in Riot. Eg: Send the message: **bold** _italics_ <del>strike</del>
  2. Note these are all formatting options supported in hangouts: https://support.google.com/chat/answer/7649118?hl=en
  3. Open https://hangouts.google.com and notice the message text is not displayed as bold, italics, and strike-through but rather as the exact text **bold** _italics_ <del>strike</del>

Expected Behavior mautrix-hangouts should parse **foo** as bold, _bar_ as italics, and <del>baz</del> as strikethrough. mautrix-hangouts should divide the message into segments and apply formatting to each segment.

bobpaul commented 4 years ago

Message formatting can also be used to insert hyperlinks, which would fix #9

meyerrj commented 4 years ago

It looks like there's some examples here:

https://github.com/tdryer/hangups/blob/master/hangups/test/test_message_parser.py

https://github.com/tdryer/hangups/blob/33f1b1cbb1c6b22ef074ce17b848f9b469d31838/hangups/conversation_event.py#L99

Just guessing, but could the fix be something like changing this:

message_content=hangouts.MessageContent(
    segment=[hangups.ChatMessageSegment(text).serialize()],
),

To this?

message_content=hangouts.MessageContent(
    segment = [hangups.ChatMessageSegment(seg.text, **seg.params).serialize() for seg in ChatMessageParser.parse(text)],
),

Assuming ChatMessageParser is imported as-is...