From ba3441e05e53a8f5a4156d72930fe16149d0f628 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 29 Feb 2024 13:37:44 +0300 Subject: logs for #4244 --- protocols/Telegram/src/server.cpp | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'protocols/Telegram/src') diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 2b04167928..00ee4b01d4 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -594,23 +594,40 @@ void CTelegramProto::ProcessChatPosition(TD::updateChatPosition *pObj) return; } - if (pUser->hContact == INVALID_CONTACT_ID) + if (pUser->hContact == INVALID_CONTACT_ID) { + debugLogA("Temporary contact, skipping"); return; + } auto *pPos = (TD::chatPosition *)pObj->position_.get(); if (auto *pList = pPos->list_.get()) { CMStringW wszGroup; - if (pList->get_id() == TD::chatListArchive::ID) + + switch (auto typeId = pList->get_id()) { + case TD::chatListArchive::ID: wszGroup = TranslateT("Archive"); - else if (pList->get_id() == TD::chatListFolder::ID) { - CMStringA szSetting(FORMAT, "ChatFilter%d", ((TD::chatListFolder *)pList)->chat_folder_id_); - wszGroup = getMStringW(szSetting); - if (wszGroup.IsEmpty()) - return; + break; + + case TD::chatListFolder::ID: + { + int iGroupId = ((TD::chatListFolder *)pList)->chat_folder_id_; + CMStringA szSetting(FORMAT, "ChatFilter%d", iGroupId); + wszGroup = getMStringW(szSetting); + if (wszGroup.IsEmpty()) { + debugLogA("Empty group name for group #%d, ignored", iGroupId); + return; + } + } + break; + + default: + debugLogA("Unknown position type ID %d, ignored", typeId); + return; } - else return; ptrW pwszExistingGroup(Clist_GetGroup(pUser->hContact)); + debugLogW(L"Existing contact group %s, calculated %s", pwszExistingGroup.get(), wszGroup.c_str()); + if (!pwszExistingGroup || (!pUser->isGroupChat && !mir_wstrcmp(pwszExistingGroup, m_wszDefaultGroup)) || (pUser->isGroupChat && !mir_wstrcmp(pwszExistingGroup, ptrW(Chat_GetGroup())))) { -- cgit v1.2.3