summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-01-07 21:14:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-01-07 21:14:25 +0300
commit5036c841e9ac3cc32b4638ad17c531a02db7474d (patch)
tree43f4f2cf25bc7b7130df11aa9b772524f6881a34
parent586a7651ec4d8148e1e3b674abc843070631ebd4 (diff)
ICQ: fixes history loading for #2989
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp6
-rw-r--r--protocols/ICQ-WIM/src/server.cpp17
2 files changed, 17 insertions, 6 deletions
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index 11b85189ca..1c143f4b9d 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -527,15 +527,17 @@ HANDLE CIcqProto::SearchBasic(const wchar_t *pszSearch)
bool bPhoneReg = getByte(DB_KEY_PHONEREG) != 0;
auto *pReq = new AsyncHttpRequest(CONN_RAPI, REQUEST_POST, bPhoneReg ? "https://u.icq.net/api/v65/rapi/search" : ICQ_ROBUST_SERVER, &CIcqProto::OnSearchResults);
- JSONNode request, params; params.set_name("params");
- params << WCHAR_PARAM(*pszSearch == '+' ? "phonenum" : "keyword", pszSearch);
+ JSONNode request;
if (bPhoneReg) {
pReq->AddHeader("Content-Type", "application/json");
request << CHAR_PARAM("aimsid", m_aimsid);
}
else request << CHAR_PARAM("method", "search");
+ JSONNode params; params.set_name("params");
+ params << WCHAR_PARAM(*pszSearch == '+' ? "phonenum" : "keyword", pszSearch);
request << CHAR_PARAM("reqId", pReq->m_reqId) << params;
+
pReq->m_szParam = ptrW(json_write(&request));
Push(pReq);
return pReq;
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp
index 70c8f1cedf..20eb6d63ff 100644
--- a/protocols/ICQ-WIM/src/server.cpp
+++ b/protocols/ICQ-WIM/src/server.cpp
@@ -629,7 +629,8 @@ void CIcqProto::RetrieveUserHistory(MCONTACT hContact, __int64 startMsgId, bool
if (startMsgId == 0)
startMsgId = -1;
- auto *pReq = new AsyncHttpRequest(CONN_RAPI, REQUEST_POST, ICQ_ROBUST_SERVER, &CIcqProto::OnGetUserHistory);
+ bool bPhoneReg = getByte(DB_KEY_PHONEREG) != 0;
+ auto *pReq = new AsyncHttpRequest(CONN_RAPI, REQUEST_POST, bPhoneReg ? "https://u.icq.net/api/v65/rapi/getHistory" : ICQ_ROBUST_SERVER, &CIcqProto::OnGetUserHistory);
#ifndef _DEBUG
pReq->flags |= NLHRF_NODUMPSEND;
#endif
@@ -640,10 +641,18 @@ void CIcqProto::RetrieveUserHistory(MCONTACT hContact, __int64 startMsgId, bool
if (patchVer == 0)
patchVer = 1;
- JSONNode request, params; params.set_name("params");
+ JSONNode request;
+ if (bPhoneReg) {
+ pReq->AddHeader("Content-Type", "application/json");
+ request << CHAR_PARAM("aimsid", m_aimsid);
+ }
+ else request << CHAR_PARAM("method", "getHistory");
+
+ JSONNode params; params.set_name("params");
params << WCHAR_PARAM("sn", GetUserId(hContact)) << INT64_PARAM("fromMsgId", startMsgId);
- params << INT_PARAM("count", 1000) << CHAR_PARAM("aimSid", m_aimsid) << SINT64_PARAM("patchVersion", patchVer) << CHAR_PARAM("language", "ru-ru");
- request << CHAR_PARAM("method", "getHistory") << CHAR_PARAM("reqId", pReq->m_reqId) << params;
+ params << INT_PARAM("count", 1000) << SINT64_PARAM("patchVersion", patchVer) << CHAR_PARAM("language", "ru-ru");
+ request << CHAR_PARAM("reqId", pReq->m_reqId) << params;
+
pReq->m_szParam = ptrW(json_write(&request));
Push(pReq);
}