summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-06 19:45:42 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-06 19:45:42 +0300
commitcfdabde550aa3cdb3b13e5352f3654e2f6131718 (patch)
tree1766ee7609de4ad7810fb55820a02640121a0296
parentc38733b3bcdfdf4af461f1d6a2cd9350b575249f (diff)
fixes #3994 (Telegram: new problems after adding to chat)
-rw-r--r--protocols/Telegram/src/proto.h2
-rw-r--r--protocols/Telegram/src/server.cpp2
-rw-r--r--protocols/Telegram/src/utils.cpp14
3 files changed, 10 insertions, 8 deletions
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index 0d3b759740..172024ccdf 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -269,7 +269,7 @@ class CTelegramProto : public PROTO<CTelegramProto>
bool GetMessageFile(TG_FILE_REQUEST::Type, TG_USER *pUser, const TD::file *pFile, const char *pszFileName, const std::string &caption, const char *szId, const char *szUser, const TD::message *pMsg);
CMStringA GetMessageSticker(const TD::file *pFile, const char *pwszExtension);
- CMStringA GetMessageText(TG_USER *pUser, const TD::message *pMsg);
+ CMStringA GetMessageText(TG_USER *pUser, const TD::message *pMsg, bool bSkipJoin = false);
void UpdateString(MCONTACT hContact, const char *pszSetting, const std::string &str);
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index 6066f55d46..c84cec8f95 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -406,7 +406,7 @@ void CTelegramProto::OnGetHistory(td::ClientManager::Response &response, void *p
if (db_event_getById(m_szModuleName, szMsgId))
continue;
- CMStringA szBody = GetMessageText(pUser, pMsg);
+ CMStringA szBody = GetMessageText(pUser, pMsg, true);
if (szBody.IsEmpty())
continue;
diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp
index 8fff0f9d2b..9bcd1f5891 100644
--- a/protocols/Telegram/src/utils.cpp
+++ b/protocols/Telegram/src/utils.cpp
@@ -468,7 +468,7 @@ static bool checkStickerType(uint32_t ID)
}
}
-CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg)
+CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg, bool bSkipJoin)
{
const TD::MessageContent *pBody = pMsg->content_.get();
@@ -490,14 +490,16 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg
break;
case TD::messageChatAddMembers::ID:
- if (auto *pDoc = (TD::messageChatAddMembers *)pBody)
- for (auto &it : pDoc->member_user_ids_)
- GcChangeMember(pUser, pszUserId, it, true);
+ if (!bSkipJoin)
+ if (auto *pDoc = (TD::messageChatAddMembers *)pBody)
+ for (auto &it : pDoc->member_user_ids_)
+ GcChangeMember(pUser, pszUserId, it, true);
break;
case TD::messageChatDeleteMember::ID:
- if (auto *pDoc = (TD::messageChatDeleteMember *)pBody)
- GcChangeMember(pUser, pszUserId, pDoc->user_id_, false);
+ if (!bSkipJoin)
+ if (auto *pDoc = (TD::messageChatDeleteMember *)pBody)
+ GcChangeMember(pUser, pszUserId, pDoc->user_id_, false);
break;
case TD::messageChatChangeTitle::ID: