From 14ba52669cf1f87cbf8564ab68ca5859be1bb282 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 30 Nov 2023 17:53:26 +0300 Subject: ICQ: fix for eternal cycle on group chat leaving + some code cleaning --- protocols/ICQ-WIM/src/groupchats.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'protocols/ICQ-WIM/src/groupchats.cpp') diff --git a/protocols/ICQ-WIM/src/groupchats.cpp b/protocols/ICQ-WIM/src/groupchats.cpp index aef323b1c9..42aea886a8 100644 --- a/protocols/ICQ-WIM/src/groupchats.cpp +++ b/protocols/ICQ-WIM/src/groupchats.cpp @@ -36,7 +36,7 @@ SESSION_INFO* CIcqProto::CreateGroupChat(const wchar_t *pwszId, const wchar_t *p return si; } -INT_PTR CIcqProto::OnLeaveChat(WPARAM hContact, LPARAM) +INT_PTR CIcqProto::SvcLeaveChat(WPARAM hContact, LPARAM) { CMStringW wszId(GetUserId(hContact)); if (auto *si = Chat_Find(wszId, m_szModuleName)) @@ -192,12 +192,17 @@ void CIcqProto::InviteUserToChat(SESSION_INFO *si) dlg.DoModal(); } -void CIcqProto::LeaveDestroyChat(SESSION_INFO *si) +void CIcqProto::OnLeaveChat(NETLIBHTTPREQUEST*, AsyncHttpRequest *pReq) { - Push(new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, "/buddylist/hideChat") - << AIMSID(this) << WCHAR_PARAM("buddy", si->ptszID) << INT64_PARAM("lastMsgId", getId(si->hContact, DB_KEY_LASTMSGID))); + db_delete_contact(INT_PTR(pReq->pUserInfo)); +} - db_delete_contact(si->hContact); +void CIcqProto::LeaveDestroyChat(SESSION_INFO *si) +{ + auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, "/buddylist/hideChat", &CIcqProto::OnLeaveChat) + << AIMSID(this) << WCHAR_PARAM("buddy", si->ptszID) << INT64_PARAM("lastMsgId", getId(si->hContact, DB_KEY_LASTMSGID)); + pReq->pUserInfo = (void *)si->hContact; + Push(pReq); } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3