whisperfish / libsignal-service-rs

A Rust version of the libsignal-service-java library for communicating with Signal servers.
https://whisperfish.github.io/libsignal-service-rs/libsignal_service
GNU Affero General Public License v3.0
69 stars 32 forks source link

Fix empty sync messages being sent #346

Closed Schmiddiii closed 1 week ago

Schmiddiii commented 2 weeks ago

This happened when giving send_message a SyncMessage to one self. In that case, the message would not be sent and instead create_multi_device_sent_transcript_content would create a new sync message, which is empty as the SyncMessage is neither a DataMessage nor an EditMessage.

This PR changes the condition to ignore sync messages.

This currently fails for me as I am rate limited. Would be nice if someone not rate limited could try it out, otherwise I will wait for a while for the rate limit to stop.

Schmiddiii commented 1 week ago

This does not seem to work yet. Getting an error when syncing contacts:

SendFailed(
    MaximumRetriesLimitExceeded,
)

I will need to look into it some more, but am already getting rate-limited after this failure happens once (even though the logs mention "sending via unidentified").

Schmiddiii commented 1 week ago

The failure seems to be failing to create a session with device 2 for me. I get the following log message three times when sending the sync message (after which, I get the rate limited error):

[2024-11-19T09:44:51Z DEBUG libsignal_service::sender] MismatchedDevices { missing_devices: [2], extra_devices: [] }

Not sure how to debug this further, but may try this afternoon.

Schmiddiii commented 1 week ago

Figured out the issue, this message should not be sent with unidentified access.

I'm not sure if this should be with every SyncMessage (like implemented here) or if we should do that on the presage side.