Skip to content

event: add com.beeper.forwarded with a body fallback - #649

Draft
Fizzadar wants to merge 1 commit into
mainfrom
fizzadar/forwarded-message-field
Draft

Fizzadar wants to merge 1 commit into
mainfrom
fizzadar/forwarded-message-field

Conversation

@Fizzadar

Copy link
Copy Markdown
Member

mautrix/whatsapp marks forwarded messages by writing ↷ Forwarded into the message itself: media without a caption gets it as the body (the filename moves to filename), and text or captioned media gets ↷ Forwarded\n\n prepended plus <p data-mx-forwarded-notice> in the HTML. Clients can't tell that apart from a real caption, so forwarded photos render as captioned images and a forwarded album doesn't group into a gallery.

This adds a structured field following the per-message profile pattern:

  • MessageEventContent.BeeperForwarded (com.beeper.forwarded, with has_fallback).
  • AddForwardedFallback produces exactly the text/HTML the WhatsApp connector writes today. RemoveForwardedFallback undoes it when has_fallback is set, restoring the body to the filename for uncaptioned media.
  • bridgev2/matrix ASIntent.SendMessage adds the forwarded fallback before the per-message profile fallback, so the wire format for existing clients is unchanged. Clients that understand the field remove the profile fallback first, then the forwarded one.

Connectors that set the field and don't run through bridgev2/matrix (Beeper's on-device bridges) send the original caption with no fallback.

Follow-ups: mautrix/whatsapp sets the field instead of editing the body. Telegram's "Forwarded from X" header could use the same field later, but that needs source fields and isn't covered here.

View in Indent
Tag @indent to continue the conversation here.

Bridges can mark a message as forwarded with a structured field instead
of writing the notice into the body. The bridgev2 Matrix connector adds
the existing "↷ Forwarded" text and HTML fallback at send time and sets
has_fallback, so clients that understand the field can strip it and get
the original caption back.
@tulir

tulir commented Oct 27, 2026

Copy link
Copy Markdown
Member

Forwarded messages should be planned properly (probably based on MSC4553) rather than hacked in for one bridge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants