tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Clear uploading files/unsent/pending messages queue on crash #2867

Closed ng8weji9vowdv closed 5 months ago

levlam commented 6 months ago

You need to delete the yet unsent message with the file to cancel its uploading.

levlam commented 6 months ago

You receive the message when call sendMessage.

levlam commented 6 months ago

You receive updateNewMessage with yet unsent messages after app restart.

levlam commented 6 months ago

Since you can't answer that question in the proper way lemme ask you this, how do i reset unset messages all at once?

In exactly the same way as in any Telegram app. You open each chat with yet unsent message and delete yet unsent messages one by one.

levlam commented 6 months ago

You receive all yet unsent messages from TDLib in updates.

Why not to expose a single method that would go through database and delete all unsent by tdlib messages?

Because this is never needed by Telegram apps.

levlam commented 6 months ago

When? On startup?

And on start up also. Apps aren't supposed to have their own database.

levlam commented 6 months ago

updateNewMessage.

levlam commented 6 months ago

You must never called cancelPreliminaryUploadFile for files for which preliminaryUploadFile wasn't called.

levlam commented 6 months ago

All being sent messages are received in updateNewMessage updates by the app. Apps can keep track of all yet unsent messages in any point in time if they wish to.

levlam commented 6 months ago

Why not to make an exception for files which are clearly using preliminaryUploadFile in sendMessage/sendMessageAlbum

The only files using preliminaryUploadFile are the files for which preliminaryUploadFile is called.

to let us cancel their upload and cause the fail

Apps don't fail message sending when restarting.

levlam commented 5 months ago

I already said multiple times how to abort sending all yet unsent messages.