From 0c8f333b8cab96c11b19a09e7d227d8f6d153f57 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 26 Jun 2024 14:01:54 +0300 Subject: ICQ: only MRA code remains in case we knew how to log in sometimes --- protocols/ICQ-WIM/src/main.cpp | 20 -------------------- protocols/ICQ-WIM/src/mra.cpp | 2 +- protocols/ICQ-WIM/src/options.cpp | 11 ++++------- protocols/ICQ-WIM/src/proto.cpp | 21 +-------------------- protocols/ICQ-WIM/src/proto.h | 11 +++-------- protocols/ICQ-WIM/src/server.cpp | 33 +++++++++++---------------------- protocols/ICQ-WIM/src/stdafx.h | 2 +- 7 files changed, 21 insertions(+), 79 deletions(-) (limited to 'protocols/ICQ-WIM') diff --git a/protocols/ICQ-WIM/src/main.cpp b/protocols/ICQ-WIM/src/main.cpp index e83e231cea..bcc74bcbf7 100644 --- a/protocols/ICQ-WIM/src/main.cpp +++ b/protocols/ICQ-WIM/src/main.cpp @@ -40,23 +40,6 @@ CMPlugin g_plugin; ///////////////////////////////////////////////////////////////////////////////////////// -struct CMPluginMra : public ACCPROTOPLUGIN -{ - CMPluginMra() : ACCPROTOPLUGIN("MRA", pluginInfoEx) - { - SetUniqueId(DB_KEY_ID); - } - - void Register() - { - m_hInst = g_plugin.getInst(); - RegisterProtocol(PROTOTYPE_PROTOCOL, g_plugin.fnInit, g_plugin.fnUninit); - } -} -static g_pluginMra; - -///////////////////////////////////////////////////////////////////////////////////////// - CMPlugin::CMPlugin() : ACCPROTOPLUGIN(MODULENAME, pluginInfoEx) { @@ -91,9 +74,6 @@ static IconItem iconList[] = int CMPlugin::Load() { - // register the second instance of this plugin as MRA - g_pluginMra.Register(); - registerIcon("Protocols/ICQ", iconList, "ICQ"); HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad); diff --git a/protocols/ICQ-WIM/src/mra.cpp b/protocols/ICQ-WIM/src/mra.cpp index 35772e8f1c..7b86c30f4e 100644 --- a/protocols/ICQ-WIM/src/mra.cpp +++ b/protocols/ICQ-WIM/src/mra.cpp @@ -29,7 +29,7 @@ void CIcqProto::SendMrimLogin(MHttpResponse *pReply) pReq->AddHeader("User-Agent", NETLIB_USER_AGENT); if (!m_szMraCookie.IsEmpty()) pReq->AddHeader("Cookie", m_szMraCookie); - pReq << CHAR_PARAM("clientName", "webagent") << INT_PARAM("clientVersion", 711) << CHAR_PARAM("devId", MRA_APP_ID) + pReq << CHAR_PARAM("clientName", "webagent") << INT_PARAM("clientVersion", 711) << CHAR_PARAM("devId", APP_ID) << CHAR_PARAM("r", "91640-1626423568") << CHAR_PARAM("f", "json"); #ifndef _DEBUG pReq->flags |= NLHRF_NODUMPSEND; diff --git a/protocols/ICQ-WIM/src/options.cpp b/protocols/ICQ-WIM/src/options.cpp index 4676a98679..ca7603b9bb 100644 --- a/protocols/ICQ-WIM/src/options.cpp +++ b/protocols/ICQ-WIM/src/options.cpp @@ -99,7 +99,7 @@ struct CIcqRegistrationDlg : public CIcqDlgBase bool OnApply() override { auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, "https://u.icq.net/api/v60/smsreg/loginWithPhoneNumber.php", &CIcqProto::OnLoginViaPhone); - pReq << CHAR_PARAM("locale", "en") << CHAR_PARAM("msisdn", szMsisdn) << CHAR_PARAM("trans_id", szTrans) << CHAR_PARAM("k", m_proto->appId()) + pReq << CHAR_PARAM("locale", "en") << CHAR_PARAM("msisdn", szMsisdn) << CHAR_PARAM("trans_id", szTrans) << CHAR_PARAM("k", APP_ID) << CHAR_PARAM("r", pReq->m_reqId) << CHAR_PARAM("f", "json") << WCHAR_PARAM("sms_code", ptrW(edtCode.GetText())) << INT_PARAM("create_account", 1); pReq->pUserInfo = this; @@ -127,7 +127,7 @@ struct CIcqRegistrationDlg : public CIcqDlgBase { auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, "https://u.icq.net/api/v60/smsreg/requestPhoneValidation.php", &CIcqProto::OnValidateSms); pReq << CHAR_PARAM("locale", "en") << CHAR_PARAM("msisdn", szMsisdn) << CHAR_PARAM("r", pReq->m_reqId) - << CHAR_PARAM("smsFormatType", "human") << CHAR_PARAM("k", m_proto->appId()); + << CHAR_PARAM("smsFormatType", "human") << CHAR_PARAM("k", APP_ID); pReq->pUserInfo = this; m_proto->Push(pReq); } @@ -154,7 +154,7 @@ void CIcqProto::OnCheckPhone(MHttpResponse *pReply, AsyncHttpRequest *pReq) auto *pNew = new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, "https://www.icq.com/smsreg/normalizePhoneNumber.php", &CIcqProto::OnNormalizePhone); pNew << CHAR_PARAM("countryCode", szPrefix) << CHAR_PARAM("phoneNumber", szPhoneNumber.c_str() + szPrefix.GetLength()) - << CHAR_PARAM("k", appId()) << CHAR_PARAM("r", pReq->m_reqId); + << CHAR_PARAM("k", APP_ID) << CHAR_PARAM("r", pReq->m_reqId); pNew->pUserInfo = pDlg; Push(pNew); } @@ -246,10 +246,7 @@ public: bool OnInitDialog() override { - if (m_proto->m_isMra) - btnCreate.Hide(); - else - SetDlgItemText(m_hwnd, IDC_UIN_LABEL, TranslateT("UIN:")); + btnCreate.Hide(); wszOldPass = m_proto->getMStringW("Password"); edtPassword.SetText(wszOldPass); diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp index 43a0e7a205..74cb47659a 100644 --- a/protocols/ICQ-WIM/src/proto.cpp +++ b/protocols/ICQ-WIM/src/proto.cpp @@ -60,8 +60,6 @@ CIcqProto::CIcqProto(const char *aProtoName, const wchar_t *aUserName) : { db_set_resident(m_szModuleName, DB_KEY_ONLINETS); - m_isMra = !stricmp(Proto_GetAccount(m_szModuleName)->szProtoName, "MRA"); - g_plugin.addPopupOption(CMStringW(FORMAT, TranslateT("%s error notifications"), m_tszUserName), m_bErrorPopups); // services @@ -369,23 +367,6 @@ void CIcqProto::OnBuildProtoMenu() mi.position = 200002; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_GROUP); Menu_AddProtoMenuItem(&mi, m_szModuleName); - - // Profile viewer - if (!m_isMra) { - mi.pszService = "/EditProfile"; - CreateProtoService(mi.pszService, &CIcqProto::EditProfile); - mi.name.a = LPGEN("Edit my web profile"); - mi.position = 210001; - mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDAWEB); - Menu_AddProtoMenuItem(&mi, m_szModuleName); - } -} - -INT_PTR CIcqProto::EditProfile(WPARAM, LPARAM) -{ - if (mir_wstrlen(m_szOwnId)) - Utils_OpenUrlW(CMStringW(FORMAT, L"https://icq.com/people/%s/edit/", (wchar_t*)m_szOwnId)); - return 0; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -595,7 +576,7 @@ HANDLE CIcqProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, wcha auto *pReq = new AsyncHttpRequest(CONN_NONE, REQUEST_GET, "https://files.icq.com/files/init", &CIcqProto::OnFileInit); pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("client", "icq") << CHAR_PARAM("f", "json") << WCHAR_PARAM("filename", pTransfer->m_wszShortName) - << CHAR_PARAM("k", appId()) << INT_PARAM("size", statbuf.st_size) << INT_PARAM("ts", TS()); + << CHAR_PARAM("k", APP_ID) << INT_PARAM("size", statbuf.st_size) << INT_PARAM("ts", TS()); CalcHash(pReq); pReq->pUserInfo = pTransfer; Push(pReq); diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index 61ce296697..27bc6b2490 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -33,8 +33,8 @@ #include "m_system.h" #include "m_protoint.h" -#define MRA_APP_ID "ic1pzYNtEU6dDnEQ" -#define ICQ_APP_ID "ic1nmMjqg7Yu-0hL" +#define APP_ID "ic1pzYNtEU6dDnEQ" + #define ICQ_FILE_SERVER "https://u.icq.net/files/api/v1.1" #define ICQ_FAKE_EVENT_ID 0xBABAEB #define ICQ_ROBUST_SERVER "https://u.icq.net/rapi" @@ -213,7 +213,7 @@ class CIcqProto : public PROTO friend AsyncHttpRequest* operator <<(AsyncHttpRequest*, const AIMSID&); - bool m_bOnline, m_bTerminated, m_bFirstBos, m_isMra, m_bError462, m_bInvisible, m_bRemoveForAll; + bool m_bOnline, m_bTerminated, m_bFirstBos, m_bError462, m_bInvisible, m_bRemoveForAll; int m_iTimeShift; MCONTACT CheckOwnMessage(const CMStringA &reqId, const CMStringA &msgId, bool bRemove); @@ -414,7 +414,6 @@ class CIcqProto : public PROTO INT_PTR __cdecl SvcOfflineFile(WPARAM, LPARAM); INT_PTR __cdecl EditGroups(WPARAM, LPARAM); - INT_PTR __cdecl EditProfile(WPARAM, LPARAM); INT_PTR __cdecl SvcGetEmailCount(WPARAM, LPARAM); INT_PTR __cdecl SvcGotoInbox(WPARAM, LPARAM); INT_PTR __cdecl UploadGroups(WPARAM, LPARAM); @@ -487,10 +486,6 @@ public: { return time(0) - m_iTimeShift; } - __forceinline const char *appId() const - { return (m_isMra) ? MRA_APP_ID : ICQ_APP_ID; - } - void SetPermitDeny(const CMStringW &userId, bool bAllow); }; diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 9f00af8f2a..fa0313cd65 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -119,19 +119,8 @@ void CIcqProto::CheckPassword() return; } - if (m_isMra) { - m_bError462 = false; - SendMrimLogin(nullptr); - } - else { - auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_POST, "https://api.login.icq.net/auth/clientLogin", &CIcqProto::OnCheckPassword); - pReq << CHAR_PARAM("clientName", "Miranda NG") << CHAR_PARAM("clientVersion", mirVer) << CHAR_PARAM("devId", appId()) - << CHAR_PARAM("f", "json") << CHAR_PARAM("tokenType", "longTerm") << WCHAR_PARAM("s", m_szOwnId) << CHAR_PARAM("pwd", m_szPassword); - #ifndef _DEBUG - pReq->flags |= NLHRF_NODUMPSEND; - #endif - Push(pReq); - } + m_bError462 = false; + SendMrimLogin(nullptr); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -738,7 +727,7 @@ bool CIcqProto::RefreshRobustToken(AsyncHttpRequest *pOrigReq) #endif int ts = TS(); - pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("k", appId()) << CHAR_PARAM("nonce", CMStringA(FORMAT, "%d-%d", ts, rand() % 10)) << INT_PARAM("ts", ts); + pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("k", APP_ID) << CHAR_PARAM("nonce", CMStringA(FORMAT, "%d-%d", ts, rand() % 10)) << INT_PARAM("ts", ts); CalcHash(pReq); CMStringA szAgent(FORMAT, "%S Mail.ru Windows ICQ (version 10.0.1999)", (wchar_t*)m_szOwnId); @@ -757,7 +746,7 @@ LBL_Error: #ifndef _DEBUG pReq->flags |= NLHRF_NODUMPSEND; #endif - pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("f", "json") << CHAR_PARAM("k", appId()) << INT_PARAM("ts", ts) + pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("f", "json") << CHAR_PARAM("k", APP_ID) << INT_PARAM("ts", ts) << CHAR_PARAM("client", "icq") << CHAR_PARAM("reqId", pReq->m_reqId) << CHAR_PARAM("authToken", m_szRToken); pReq->pUserInfo = &bRet; if (!ExecuteRequest(pReq)) @@ -788,7 +777,7 @@ void CIcqProto::RetrieveUserCaps(IcqUser *pUser) auto *pReq = new AsyncHttpRequest(CONN_OLD, REQUEST_GET, "/presence/get", &CIcqProto::OnGetUserCaps); pReq->hContact = pUser->m_hContact; pReq->pUserInfo = pUser; - pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("f", "json") << CHAR_PARAM("k", appId()) << CHAR_PARAM("r", pReq->m_reqId) + pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("f", "json") << CHAR_PARAM("k", APP_ID) << CHAR_PARAM("r", pReq->m_reqId) << WCHAR_PARAM("t", GetUserId(pUser->m_hContact)) << INT_PARAM("mdir", 0) << INT_PARAM("capabilities", 1); Push(pReq); } @@ -814,7 +803,7 @@ void CIcqProto::RetrievePresence(MCONTACT hContact) auto *pReq = new AsyncHttpRequest(CONN_OLD, REQUEST_GET, "/presence/get", &CIcqProto::OnGePresence); pReq->hContact = hContact; - pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("f", "json") << CHAR_PARAM("k", appId()) << CHAR_PARAM("r", pReq->m_reqId) + pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("f", "json") << CHAR_PARAM("k", APP_ID) << CHAR_PARAM("r", pReq->m_reqId) << WCHAR_PARAM("t", wszId) << INT_PARAM("mdir", 1); Push(pReq); } @@ -1093,7 +1082,7 @@ void CIcqProto::StartSession() << INT_PARAM("buildNumber", __BUILD_NUM) << CHAR_PARAM("deviceId", szDeviceId) << CHAR_PARAM("events", EVENTS) << CHAR_PARAM("f", "json") << CHAR_PARAM("imf", "plain") << CHAR_PARAM("inactiveView", "offline") << CHAR_PARAM("includePresenceFields", FIELDS) << CHAR_PARAM("invisible", "false") - << CHAR_PARAM("k", appId()) << INT_PARAM("mobile", 0) << CHAR_PARAM("nonce", nonce) << CHAR_PARAM("r", pReq->m_reqId) + << CHAR_PARAM("k", APP_ID) << INT_PARAM("mobile", 0) << CHAR_PARAM("nonce", nonce) << CHAR_PARAM("r", pReq->m_reqId) << INT_PARAM("rawMsg", 0) << INT_PARAM("sessionTimeout", 7776000) << INT_PARAM("ts", ts) << CHAR_PARAM("view", "online"); CalcHash(pReq); @@ -1240,7 +1229,7 @@ LBL_Error: m_arOwnIds.insert(pOwn); } - pReq << AIMSID(this) << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("k", appId()) << CHAR_PARAM("mentions", "") << WCHAR_PARAM("message", wszUrl) + pReq << AIMSID(this) << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("k", APP_ID) << CHAR_PARAM("mentions", "") << WCHAR_PARAM("message", wszUrl) << CHAR_PARAM("offlineIM", "true") << WCHAR_PARAM("parts", wszParts) << WCHAR_PARAM("t", GetUserId(pTransfer->pfts.hContact)) << INT_PARAM("ts", TS()); Push(pReq); return; @@ -1248,7 +1237,7 @@ LBL_Error: // else send the next portion auto *pReq = new AsyncHttpRequest(CONN_NONE, REQUEST_POST, pTransfer->m_szHost, &CIcqProto::OnFileContinue); - pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("client", "icq") << CHAR_PARAM("k", appId()) << INT_PARAM("ts", TS()); + pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("client", "icq") << CHAR_PARAM("k", APP_ID) << INT_PARAM("ts", TS()); CalcHash(pReq); pReq->m_szUrl.AppendChar('?'); pReq->m_szUrl += pReq->m_szParam; pReq->m_szParam.Empty(); @@ -1283,7 +1272,7 @@ LBL_Error: pTransfer->m_szHost = L"https://" + wszHost + wszUrl; auto *pReq = new AsyncHttpRequest(CONN_NONE, REQUEST_POST, pTransfer->m_szHost, &CIcqProto::OnFileContinue); - pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("client", "icq") << CHAR_PARAM("k", appId()) << INT_PARAM("ts", TS()); + pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("client", "icq") << CHAR_PARAM("k", APP_ID) << INT_PARAM("ts", TS()); CalcHash(pReq); pReq->m_szUrl.AppendChar('?'); pReq->m_szUrl += pReq->m_szParam; pReq->m_szParam.Empty(); @@ -1508,7 +1497,7 @@ void CIcqProto::SendMessageParts(MCONTACT hContact, const JSONNode &parts, IcqOw if (pOwn) pOwn->setGuid(pReq->m_reqId); - pReq << AIMSID(this) << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("k", appId()) << CHAR_PARAM("mentions", "") + pReq << AIMSID(this) << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("k", APP_ID) << CHAR_PARAM("mentions", "") << CHAR_PARAM("offlineIM", "true") << CHAR_PARAM("parts", parts.write().c_str()) << CHAR_PARAM("t", szUserid) << INT_PARAM("ts", TS()); Push(pReq); } diff --git a/protocols/ICQ-WIM/src/stdafx.h b/protocols/ICQ-WIM/src/stdafx.h index dcb161eaf4..d2a7be4afc 100644 --- a/protocols/ICQ-WIM/src/stdafx.h +++ b/protocols/ICQ-WIM/src/stdafx.h @@ -84,7 +84,7 @@ // ICQ plugin includes #include "version.h" -#define MODULENAME "ICQ" +#define MODULENAME "MRA" #define DB_KEY_ID "aimId" #define DB_KEY_ABOUT "About" -- cgit v1.2.3