mobilecoinofficial / auxin

Developer friendly wrapper around the Signal Messenger protocol.
GNU Affero General Public License v3.0
8 stars 8 forks source link

Fix for missingDevices/extraDevices issue #40

Closed NotGyro closed 2 years ago

NotGyro commented 2 years ago

I was notified by Ilia that, occasionally, attempting to send a message via auxin-cli would result in a 409 response being sent back by Signal's web API. This happened when the recipient had either added or removed a linked device. The body of this response was a json object following the form of {"missingDevices":[1,2,3], "extraDevices":[4,5,6]}

The changes I've made in this pull request appear to fix the issue. Now, this type of response is checked for explicitly (other http errors are propagated normally). In send_message(), if an error response is received with a json object in the body containing a missingDevices and extraDevices list, Auxin will clear out the existing device lists and attempt to fetch them with fill_peer_info(). If that succeeds without erroring, Auxin then attempts to re-send the message.