From 55e240d0dd36288af6cd195d95f567e0cba4180e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 28 Dec 2018 21:00:12 +0300 Subject: ACKTYPE_GETINFO-related code cleaning --- protocols/FacebookRM/src/contacts.cpp | 4 ++-- protocols/Gadu-Gadu/src/core.cpp | 2 +- protocols/Gadu-Gadu/src/gg_proto.cpp | 2 +- protocols/IRCG/src/userinfo.cpp | 2 +- protocols/Icq10/src/server.cpp | 11 +++++++++-- protocols/JabberG/src/jabber_iqid.cpp | 4 ++-- protocols/Sametime/src/sametime.cpp | 2 +- 7 files changed, 17 insertions(+), 10 deletions(-) (limited to 'protocols') diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index 7e5505e0d7..c7202d55e9 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -473,7 +473,7 @@ void FacebookProto::RefreshUserInfo(void *data) ptrA user_id(getStringA(hContact, FACEBOOK_KEY_ID)); if (user_id == nullptr || isOffline()) { - ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)nullptr, 0); + ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, nullptr); return; } @@ -538,7 +538,7 @@ void FacebookProto::RefreshUserInfo(void *data) } } - ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)nullptr, 0); + ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, nullptr); } HANDLE FacebookProto::GetAwayMsg(MCONTACT) diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 0fa47ccedf..41ec9a9a9b 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -728,7 +728,7 @@ retry: } debugLogA("mainthread() (%x): Setting user info for uin %d.", this, uin); - ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0); + ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1); } if (__nickname) mir_free(__nickname); diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index ed1d995c65..fa628c2889 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -170,7 +170,7 @@ void __cdecl GaduProto::cmdgetinfothread(void *hContact) { debugLogA("cmdgetinfothread(): started. Failed info retreival."); gg_sleep(100, FALSE, "cmdgetinfothread", 103, 1); - ProtoBroadcastAck((UINT_PTR)hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)1, 0); + ProtoBroadcastAck((UINT_PTR)hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)1); debugLogA("cmdgetinfothread(): end."); } diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index 1d93cab326..9a4a9be689 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -86,7 +86,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM SetDlgItemText(m_hwnd, IDC_HOST, dbv.pwszVal); db_free(&dbv); } - ProtoBroadcastAck(p->ppro->m_szModuleName, p->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0); + ProtoBroadcastAck(p->ppro->m_szModuleName, p->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1); } break; diff --git a/protocols/Icq10/src/server.cpp b/protocols/Icq10/src/server.cpp index e7c49a7e04..7c5b8c6e0e 100644 --- a/protocols/Icq10/src/server.cpp +++ b/protocols/Icq10/src/server.cpp @@ -167,6 +167,7 @@ void CIcqProto::RetrieveUserInfo(MCONTACT hContact) { auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/presence/get", &CIcqProto::OnGetUserInfo); pReq->flags |= NLHRF_NODUMPSEND; + pReq->pUserInfo = (void*)hContact; pReq << CHAR_PARAM("f", "json") << CHAR_PARAM("aimsid", m_aimsid) << INT_PARAM("mdir", 1) << INT_PARAM("t", getDword(hContact, "UIN")); Push(pReq); } @@ -315,15 +316,21 @@ void CIcqProto::OnCheckPassword(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*) StartSession(); } -void CIcqProto::OnGetUserInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*) +void CIcqProto::OnGetUserInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq) { + MCONTACT hContact = (MCONTACT)pReq->pUserInfo; + JsonReply root(pReply); - if (root.error() != 200) + if (root.error() != 200) { + ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, nullptr); return; + } const JSONNode &data = root.data(); for (auto &it : data["users"]) ParseBuddyInfo(it); + + ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, nullptr); } void CIcqProto::OnStartSession(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*) diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index b892d4b069..d34a7fa0ad 100755 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -712,7 +712,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) if (!mir_wstrcmp(type, L"error")) { if ((hContact = HContactFromJID(jid)) != 0) - ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)1, 0); + ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)1); return; } @@ -1148,7 +1148,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) } else { if ((hContact = HContactFromJID(jid)) != 0) - ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0); + ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1); WindowList_Broadcast(m_hWindowList, WM_JABBER_REFRESH_VCARD, 0, 0); } } diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index 15bbcd4357..ab7dce7818 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -115,7 +115,7 @@ void __cdecl sttFakeAckInfoSuccessThread(TFakeAckParams* tParam) proto->debugLogW(L"sttFakeAckInfoSuccessThread() start"); Sleep(100); - proto->ProtoBroadcastAck(tParam->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0); + proto->ProtoBroadcastAck(tParam->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1); proto->debugLogW(L"sttFakeAckInfoSuccessThread() end"); mir_free(tParam); -- cgit v1.2.3