diff options
author | George Hazan <ghazan@miranda.im> | 2023-03-06 19:06:45 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-03-06 19:06:45 +0300 |
commit | 4be3cbfb5a759d868eac6c8060967ebf0f0af456 (patch) | |
tree | f279c94f14e1a63c8693d47064d68d778ea94085 /protocols/Telegram/src/groupchat.cpp | |
parent | 420bdbea266c864509ed58ac792d5059516dddf5 (diff) |
fixes #3394 (Telegram: невозможно написать в приват из групчата)
Diffstat (limited to 'protocols/Telegram/src/groupchat.cpp')
-rw-r--r-- | protocols/Telegram/src/groupchat.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/protocols/Telegram/src/groupchat.cpp b/protocols/Telegram/src/groupchat.cpp index 0aa21fb752..76fb694a5c 100644 --- a/protocols/Telegram/src/groupchat.cpp +++ b/protocols/Telegram/src/groupchat.cpp @@ -151,6 +151,7 @@ int CTelegramProto::GcEventHook(WPARAM, LPARAM lParam) break; case GC_USER_PRIVMESS: + Chat_SendPrivateMessage(gch); break; case GC_USER_LOGMENU: @@ -163,6 +164,29 @@ int CTelegramProto::GcEventHook(WPARAM, LPARAM lParam) return 1; } +void CTelegramProto::Chat_SendPrivateMessage(GCHOOK *gch) +{ + MCONTACT hContact; + TD::int53 userId = _wtoi64(gch->ptszUID); + auto *pUser = FindUser(userId); + if (pUser == nullptr || pUser->hContact == INVALID_CONTACT_ID) { + PROTOSEARCHRESULT psr = { sizeof(psr) }; + psr.id.w = (wchar_t *)gch->ptszUID; + psr.firstName.w = (wchar_t *)gch->ptszNick; + + hContact = AddToList(PALF_TEMPORARY, &psr); + if (hContact == 0) + return; + + setWString(hContact, "Nick", gch->ptszNick); + Contact::Hide(hContact); + db_set_dw(hContact, "Ignore", "Mask1", 0); + } + else hContact = pUser->hContact; + + CallService(MS_MSG_SENDMESSAGE, hContact, 0); +} + ///////////////////////////////////////////////////////////////////////////////////////// int CTelegramProto::GcMenuHook(WPARAM, LPARAM lParam) |