summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-02-29 13:37:44 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-02-29 13:37:44 +0300
commitba3441e05e53a8f5a4156d72930fe16149d0f628 (patch)
treef32f60c8ecf4293081548bdd41d9cd858d60825b
parent1362e985f52a4501d3a7796fa63f290cffad0c88 (diff)
logs for #4244
-rw-r--r--protocols/Telegram/src/server.cpp33
1 files changed, 25 insertions, 8 deletions
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())))) {