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

how to maintain a active main chat list as telegram client? #2430

Open gillbates opened 1 year ago

gillbates commented 1 year ago

Hi Team,

we've tried the java example: https://github.com/tdlib/td/blob/b3ab664a18f8611f4dfcd3054717504271eeaa7a/example/java/org/drinkless/tdlib/example/Example.java#L248

and we make a test scenario:

1, login a new account A without any chats: 2, A send message to a friend and thus a chat 1 is created. 2, A create a basic group with friend and thus chat 2 is created. 3, A delete the chat 1 from mac telegram client ui. 4, now we use gcs, and mainChatList shows a list with size 1 (only chat 2 there), this is correct. 5, At mac telegram client ui, we click to leave group (chat 2). now no more chats on UI. 6, if we use gcs again or even restart this class, it will always return the list with size 1 (chat 2 still there) 7, we even tried to send a GetChats after step 5

 TdApi.GetChats chats = new TdApi.GetChats();
        chats.limit = 1000;
        TdApi.ChatListMain chatListMain = new TdApi.ChatListMain();
        chats.chatList = chatListMain;
        haveFullMainChatList = false;
        client.send(chats, defaultHandler);

but it will still return a result list contains chat 2.

anyone has an idea about this?

levlam commented 1 year ago

Could you log in at https://web.telegram.org to see, whether the chat 2 is present?

gillbates commented 1 year ago

Could you log in at https://web.telegram.org to see, whether the chat 2 is present?

@levlam

chat 2 is not there both at web & mac telegram.

You could reproduce this by steps above, it could 100% be reproduced ...

levlam commented 1 year ago

I can't reproduce this. When I leave a group from another app, it disappears. Could you reproduce this if the other app is TDLib-based?

gillbates commented 1 year ago

@levlam

my reproduce step:

1, start this Example java. 2, login into web telegram. 3, use gcs, and now it will print chat 2. 4, leave chat 2 in web telegram 5, use gcs or restart java, it will still print chat 2

it will disappear from your side?

levlam commented 1 year ago

The chat disappears on my side. Could you send full TDLib log to https://t.me/tdlib_bot?

For this you need to comment the line, which sets verbosity level to 0:

   Client.execute(new TdApi.SetLogVerbosityLevel(0));
levlam commented 1 year ago

The mentioned issue happens because server doesn't send updates for the chat list change to the app, but some workarounds were added to TDLib to mitigate the issue.

gillbates commented 1 year ago

yes...wait for updates and fix ...