From 6a668c99fcd6549b3b17085a738a93fdd5eb9719 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 10 Jan 2019 23:34:33 +0200 Subject: ICQ10: send private messages in group chats --- protocols/Icq10/src/proto.cpp | 18 +++++++++++++++++- protocols/Icq10/src/proto.h | 4 +++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/protocols/Icq10/src/proto.cpp b/protocols/Icq10/src/proto.cpp index 67c1ae8c9c..978bf847dc 100644 --- a/protocols/Icq10/src/proto.cpp +++ b/protocols/Icq10/src/proto.cpp @@ -160,7 +160,7 @@ int CIcqProto::GroupchatEventHook(WPARAM, LPARAM lParam) break; case GC_USER_PRIVMESS: - // Chat_SendPrivateMessage(gch); + SendPrivateMessage(gch); break; case GC_USER_LOGMENU: @@ -174,6 +174,22 @@ int CIcqProto::GroupchatEventHook(WPARAM, LPARAM lParam) return 0; } +void CIcqProto::SendPrivateMessage(GCHOOK *gch) +{ + MCONTACT hContact; + DWORD dwUin = _wtoi(gch->ptszUID); + auto *pCache = FindContactByUIN(dwUin); + if (pCache == nullptr) { + hContact = CreateContact(dwUin, true); + setWString(hContact, "Nick", gch->ptszNick); + db_set_b(hContact, "CList", "Hidden", 1); + db_set_dw(hContact, "Ignore", "Mask1", 0); + } + else hContact = pCache->m_hContact; + + CallService(MS_MSG_SENDMESSAGE, hContact, 0); +} + ///////////////////////////////////////////////////////////////////////////////////////// void CIcqProto::MarkReadTimerProc(HWND hwnd, UINT, UINT_PTR id, DWORD) diff --git a/protocols/Icq10/src/proto.h b/protocols/Icq10/src/proto.h index 6d350a7275..a0fe63fa96 100644 --- a/protocols/Icq10/src/proto.h +++ b/protocols/Icq10/src/proto.h @@ -85,7 +85,6 @@ class CIcqProto : public PROTO void CheckPassword(void); void ConnectionFailed(int iReason); CMStringA GetUserId(MCONTACT); - void LoadChatInfo(SESSION_INFO*); MCONTACT ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact = -1); void ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNode &msg); void RetrieveUserHistory(MCONTACT, __int64 startMsgId, __int64 endMsgId); @@ -97,6 +96,9 @@ class CIcqProto : public PROTO void OnLoggedIn(void); void OnLoggedOut(void); + void LoadChatInfo(SESSION_INFO *si); + void SendPrivateMessage(GCHOOK *gch); + mir_cs csMarkReadQueue; LIST arMarkReadQueue; static void CALLBACK MarkReadTimerProc(HWND hwnd, UINT, UINT_PTR id, DWORD); -- cgit v1.2.3