tdlib / td

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

secret chat TTL: 2 questions #1619

Closed Flohack74 closed 3 years ago

Flohack74 commented 3 years ago

Hi, still tdlib 1.6 (upgrade in the works)...

so we are slowly implementing all missing features in our client. We cam across setting a TTL for messages. That works well but, during testing we found 2 problems:

  1. Messages that were written without TTL, later a TTL is being set, will become "unread" again, and even after restart are not marked as read. all messages after TTL has been set are marked as read and disappear properly.
  2. pictures and videos are not destructed with TTL. We also do not see any message about messageExpiredPhoto, messageExpiredVideo. When should they appear?
levlam commented 3 years ago

You need to properly call openChat/closeChat, viewMessages and openMessageContent for TTL to work correctly.

messageExpiredPhoto and messageExpiredVideo appears only in private chats for individual self-destructing messages.

Flohack74 commented 3 years ago

Oh maybe we miss openMessageContent yes ;)

Flohack74 commented 3 years ago

One more question, official clients seem to blur the thumbnails, should dthat only happen when ttl is expired, or already before the user opens it? Probably second.

Flohack74 commented 3 years ago

Another one more question :) - so if a user clicks on a video, video note, audio or voice note content to start playback, when would the timer kick in, i.e. when should we send content opened msg?

Also, should we just send message content opened for every content (whatever opened means in this context), and when should we blur the thumbnails?

levlam commented 3 years ago

One more question, official clients seem to blur the thumbnails, should dthat only happen when ttl is expired, or already before the user opens it?

After TTL is expired, there is no thumbnail to show anymore. Thumbnail must be blurred, if is_secret==true in messageAnimation/messagePhoto/messageVideo/messageVideoNote.

Flohack74 commented 3 years ago

Sorry to bug you more, we see that blurring (isSecret == true) happens only when a TTL of one minute or less is set. Whats the logic behind that?

levlam commented 3 years ago

Secret chats are supposed to be used as an end-to-end replacement of ordinary private chats. If TTL is bigger than 1 minute, then this is just an ordinary video with auto-deletion enabled. The same can be done in private chats.