diff options
author | George Hazan <ghazan@miranda.im> | 2019-01-11 20:51:38 +0200 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-01-11 20:51:38 +0200 |
commit | 22a5482065a5803416aafdb933bd8bc62cf78b6e (patch) | |
tree | b115d3bac57c9e5dec76fdba8db795a520cf7845 /protocols | |
parent | 6c0d35da843f6a37bf5556aabb500256535a338f (diff) |
fixes #1752 (ICQ10: cannot leave groupchat)
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Icq10/src/groupchats.cpp | 18 | ||||
-rw-r--r-- | protocols/Icq10/src/proto.cpp | 7 | ||||
-rw-r--r-- | protocols/Icq10/src/proto.h | 3 |
3 files changed, 23 insertions, 5 deletions
diff --git a/protocols/Icq10/src/groupchats.cpp b/protocols/Icq10/src/groupchats.cpp index ec5d0efd88..0951df4d0f 100644 --- a/protocols/Icq10/src/groupchats.cpp +++ b/protocols/Icq10/src/groupchats.cpp @@ -165,17 +165,29 @@ void CIcqProto::InviteUserToChat(SESSION_INFO *si) dlg.DoModal(); } +void CIcqProto::LeaveDestroyChat(SESSION_INFO *si) +{ + auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/buddylist/hideChat"); + pReq << CHAR_PARAM("f", "json") << CHAR_PARAM("aimsid", m_aimsid) << WCHAR_PARAM("buddy", si->ptszID) + << CHAR_PARAM("r", pReq->m_reqId) << INT64_PARAM("lastMsgId", getId(si->hContact, DB_KEY_LASTMSGID)); + Push(pReq); + + Chat_Terminate(si->pszModule, si->ptszID, true); +} + ///////////////////////////////////////////////////////////////////////////////////////// // Group chats static gc_item sttLogListItems[] = { { LPGENW("&Invite a user"), IDM_INVITE, MENU_ITEM }, + { nullptr, 0, MENU_SEPARATOR }, + { LPGENW("&Leave/destroy chat"), IDM_LEAVE, MENU_ITEM } }; int CIcqProto::GroupchatMenuHook(WPARAM, LPARAM lParam) { - GCMENUITEMS* gcmi = (GCMENUITEMS*)lParam; + GCMENUITEMS *gcmi = (GCMENUITEMS*)lParam; if (gcmi == nullptr) return 0; @@ -236,6 +248,10 @@ void CIcqProto::Chat_ProcessLogMenu(SESSION_INFO *si, int iChoice) case IDM_INVITE: InviteUserToChat(si); break; + + case IDM_LEAVE: + LeaveDestroyChat(si); + break; } } diff --git a/protocols/Icq10/src/proto.cpp b/protocols/Icq10/src/proto.cpp index 1d849d68c9..4b0aa787f0 100644 --- a/protocols/Icq10/src/proto.cpp +++ b/protocols/Icq10/src/proto.cpp @@ -96,11 +96,12 @@ void CIcqProto::OnShutdown() void CIcqProto::OnContactDeleted(MCONTACT hContact) { - DWORD dwUin = getDword(hContact, DB_KEY_UIN); - m_arCache.remove(FindContactByUIN(dwUin)); + CMStringA szId(GetUserId(hContact)); + if (!isChatRoom(hContact)) + m_arCache.remove(FindContactByUIN(atoi(szId))); auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/buddylist/removeBuddy"); - pReq << CHAR_PARAM("f", "json") << CHAR_PARAM("aimsid", m_aimsid) << INT_PARAM("buddy", dwUin) + pReq << CHAR_PARAM("f", "json") << CHAR_PARAM("aimsid", m_aimsid) << CHAR_PARAM("buddy", szId) << CHAR_PARAM("r", pReq->m_reqId) << INT_PARAM("allGroups", 1); pReq->flags |= NLHRF_NODUMPSEND; Push(pReq); diff --git a/protocols/Icq10/src/proto.h b/protocols/Icq10/src/proto.h index 96dc779199..70f0c9855f 100644 --- a/protocols/Icq10/src/proto.h +++ b/protocols/Icq10/src/proto.h @@ -39,7 +39,7 @@ enum ChatMenuItems { - IDM_INVITE = 10, IDM_EXIT, IDM_DESTROY + IDM_INVITE = 10, IDM_LEAVE }; struct IcqCacheItem @@ -151,6 +151,7 @@ class CIcqProto : public PROTO<CIcqProto> void Chat_SendPrivateMessage(GCHOOK *gch); void InviteUserToChat(SESSION_INFO *si); + void LeaveDestroyChat(SESSION_INFO *si); void LoadChatInfo(SESSION_INFO *si); //////////////////////////////////////////////////////////////////////////////////////// |