From 3a35e893b276bf28fbf949d67b92961bc5293b55 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 28 Feb 2023 18:29:25 +0300 Subject: fixes #2938 (MRA: contact search does not work) --- protocols/ICQ-WIM/src/http.cpp | 4 ++-- protocols/ICQ-WIM/src/options.cpp | 2 +- protocols/ICQ-WIM/src/proto.h | 1 + protocols/ICQ-WIM/src/server.cpp | 2 +- protocols/ICQ-WIM/src/utils.cpp | 7 +++++++ 5 files changed, 12 insertions(+), 4 deletions(-) (limited to 'protocols') diff --git a/protocols/ICQ-WIM/src/http.cpp b/protocols/ICQ-WIM/src/http.cpp index 79910dad11..fded4807ea 100644 --- a/protocols/ICQ-WIM/src/http.cpp +++ b/protocols/ICQ-WIM/src/http.cpp @@ -104,7 +104,7 @@ AsyncRapiRequest::AsyncRapiRequest(CIcqProto *ppro, const char *pszMethod, MTHtt { params.set_name("params"); - if (ppro->getByte(DB_KEY_PHONEREG)) { + if (ppro->SkipRapi()) { m_szUrl.AppendChar('/'); m_szUrl.Append(pszMethod); @@ -181,7 +181,7 @@ bool CIcqProto::ExecuteRequest(AsyncHttpRequest *pReq) } // replace credentials inside JSON body for pure RAPI requests - if (pReq->m_conn == CONN_RAPI && !mir_strcmp(pReq->szUrl, ICQ_ROBUST_SERVER) && !getByte(DB_KEY_PHONEREG)) { + if (pReq->m_conn == CONN_RAPI && !mir_strcmp(pReq->szUrl, ICQ_ROBUST_SERVER) && !SkipRapi()) { CMStringA szAgent(FORMAT, "%S Mail.ru Windows ICQ (version 10.0.1999)", (wchar_t*)m_szOwnId); pReq->AddHeader("User-Agent", szAgent); pReq->AddHeader("Content-Type", "application/json"); diff --git a/protocols/ICQ-WIM/src/options.cpp b/protocols/ICQ-WIM/src/options.cpp index ab17121a30..9a07a4b462 100644 --- a/protocols/ICQ-WIM/src/options.cpp +++ b/protocols/ICQ-WIM/src/options.cpp @@ -58,7 +58,7 @@ public: bool CIcqProto::RetrievePassword() { // if we registered via phone (i.e., server holds the password), we don't need to enter it - if (getByte(DB_KEY_PHONEREG)) + if (SkipRapi()) return true; if (!m_szPassword.IsEmpty() && m_bRememberPwd) diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index f36f6911ab..31b31b2c26 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -378,6 +378,7 @@ class CIcqProto : public PROTO bool IsQueueEmpty(); void Push(MHttpRequest*); bool RefreshRobustToken(AsyncHttpRequest *pReq); + bool SkipRapi(); //////////////////////////////////////////////////////////////////////////////////////// // cache diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 6780daad1e..2ee357ddef 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -613,7 +613,7 @@ void CIcqProto::SetServerStatus(int iStatus) Push(new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/presence/setState") << AIMSID(this) << CHAR_PARAM("view", szStatus) << INT_PARAM("invisible", invisible)); - if (iStatus == ID_STATUS_OFFLINE && !getByte(DB_KEY_PHONEREG)) { + if (iStatus == ID_STATUS_OFFLINE && !SkipRapi()) { auto *pReq = new AsyncHttpRequest(CONN_NONE, REQUEST_GET, ICQ_API_SERVER "/aim/endSession", &CIcqProto::OnSessionEnd); pReq << AIMSID(this) << INT_PARAM("invalidateToken", 1); ExecuteRequest(pReq); diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp index 6bfc868e96..f2f70ad0bb 100644 --- a/protocols/ICQ-WIM/src/utils.cpp +++ b/protocols/ICQ-WIM/src/utils.cpp @@ -330,6 +330,13 @@ void CIcqProto::setId(MCONTACT hContact, const char *szSetting, __int64 iValue) ///////////////////////////////////////////////////////////////////////////////////////// +bool CIcqProto::SkipRapi() +{ + return m_isMra || getByte(DB_KEY_PHONEREG); +} + +///////////////////////////////////////////////////////////////////////////////////////// + wchar_t* time2text(time_t ts) { if (ts == 0) -- cgit v1.2.3