diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-13 14:50:51 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-13 14:50:51 +0300 |
commit | ab7236480aa71a278e4882eabbfed20f386333d3 (patch) | |
tree | 4b7e6a7ae4dcd69cc5c3269bd06ade216beaa959 /protocols/Telegram/src/proto.cpp | |
parent | 4e2a7eebd5e4e1a40450bbe02c48809059248624 (diff) |
Telegram: added error processing in message sending
Diffstat (limited to 'protocols/Telegram/src/proto.cpp')
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 9a79af6d94..fff388caa5 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -491,7 +491,16 @@ int CTelegramProto::SendMsg(MCONTACT hContact, const char *pszMessage) if (szId == nullptr) return 0; - return SendTextMessage(_atoi64(szId), pszMessage); + __int64 id = _atoi64(szId); + auto *pUser = FindUser(id); + if (pUser == nullptr) + return 0; + + int msgid = SendTextMessage(pUser->chatId, pszMessage); + if (msgid != -1) + m_arOwnMsg.insert(new TG_OWN_MESSAGE(hContact, (HANDLE)msgid, -1)); + + return msgid; } int CTelegramProto::SetStatus(int iNewStatus) |