Skip to content

feat: send long messages as plain attachments#384

Open
lightclient wants to merge 1 commit intowhisperfish:mainfrom
lightclient:signal-long-text-attachment
Open

feat: send long messages as plain attachments#384
lightclient wants to merge 1 commit intowhisperfish:mainfrom
lightclient:signal-long-text-attachment

Conversation

@lightclient
Copy link
Copy Markdown

I've been encountering an issue where messages would get delivered on desktop clients, but not on the iOS client. It took a bit of time to finally figure out that it was due to the message size, but I eventually found that iOS will just silently drop messages larger 2048 bytes.

It appears the official clients add long-text handling when the body exceeds 2048 bytes. They truncate the inline body at a UTF-8 boundary and upload the full text as a text/x-signal-plain attachment.

You can see here:

I've implemented the same in this PR. Tested locally and am able to verify it is working now on macos desktop app and iOS app.

@gferon
Copy link
Copy Markdown
Collaborator

gferon commented Mar 7, 2026

Thank you very much, this is great!

Copy link
Copy Markdown
Contributor

@Schmiddiii Schmiddiii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to decode such attachments when we receive them? I don't think we do that anywhere yet.

Comment on lines +1491 to +1495
ContentBody::DataMessage(m) => m,
ContentBody::EditMessage(m) => match m.data_message.as_mut() {
Some(m) => m,
None => return Ok(()),
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably also need to handle sync messages analogously?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am currently doing that in the receiver of my project: https://github.com/hoehermann/purple-presage/blob/e6604db/src/rust/src/receive.rs#L163

By the way: Thank you very much for flare, it helped me in figuring out how to use presage. 🙂

@lightclient
Copy link
Copy Markdown
Author

@Schmiddiii thanks, that's a good point. Originally I thought the presage consumer could decide how to render messages with the plain text attachment, but on second thought it just seems more correct for Presage to make it happen on both sending and receiving. Will make the change.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants