From 76cbb4b4419e389f8d5588e014247801758e98fc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 7 Jan 2014 20:51:47 +0000 Subject: idea with the base domain in VK considered useless git-svn-id: http://svn.miranda-ng.org/main/trunk@7537 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/res/resource.rc | 2 -- protocols/VKontakte/src/resource.h | 1 - protocols/VKontakte/src/vk_options.cpp | 13 +------------ protocols/VKontakte/src/vk_proto.cpp | 4 ---- protocols/VKontakte/src/vk_proto.h | 5 +---- protocols/VKontakte/src/vk_queue.cpp | 6 +++--- protocols/VKontakte/src/vk_thread.cpp | 13 +++++++------ 7 files changed, 12 insertions(+), 32 deletions(-) (limited to 'protocols/VKontakte') diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc index e0d5cdc91c..d4cd5ae63e 100644 --- a/protocols/VKontakte/res/resource.rc +++ b/protocols/VKontakte/res/resource.rc @@ -51,8 +51,6 @@ BEGIN EDITTEXT IDC_GROUPNAME,167,86,121,12,ES_AUTOHSCROLL GROUPBOX "Advanced",IDC_STATIC,4,108,293,108 CONTROL "Server-side delivery confirmation",IDC_DELIVERY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,121,278,10 - LTEXT "VKontakte domain",IDC_STATIC,12,135,154,8 - EDITTEXT IDC_VKDOMAIN,167,133,121,12,ES_AUTOHSCROLL END IDD_CAPTCHAFORM DIALOGEX 0, 0, 258, 224 diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h index 2de4898616..db17b49f6f 100644 --- a/protocols/VKontakte/src/resource.h +++ b/protocols/VKontakte/src/resource.h @@ -18,7 +18,6 @@ #define IDC_SUBMIT 1010 #define IDC_DELIVERY 1011 #define IDC_GROUPNAME 1012 -#define IDC_VKDOMAIN 1014 // Next default values for new objects // diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index b644e1e34d..35fc818bd3 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -117,7 +117,6 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L SetDlgItemText(hwndDlg, IDC_PASSWORD, tszPassw); SetDlgItemText(hwndDlg, IDC_GROUPNAME, ppro->getGroup()); - SetDlgItemTextA(hwndDlg, IDC_VKDOMAIN, ppro->getDomain()); } CheckDlgButton(hwndDlg, IDC_DELIVERY, ppro->m_bServerDelivery); return TRUE; @@ -131,7 +130,6 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case IDC_LOGIN: case IDC_PASSWORD: case IDC_GROUPNAME: - case IDC_VKDOMAIN: if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; @@ -145,10 +143,7 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY) { - union { - TCHAR str[128]; - char stra[256]; - }; + TCHAR str[128]; GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str)); ppro->setTString("Login", str); @@ -158,12 +153,6 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L ppro->setTString("ProtoGroup", str); } - GetDlgItemTextA(hwndDlg, IDC_VKDOMAIN, stra, SIZEOF(stra)); - if (strcmp(ppro->getDomain(), stra)) { - ppro->setDomain(stra); - ppro->setString("BaseDomain", stra); - } - GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str)); ptrA szRawPasswd(mir_utf8encodeT(str)); if (szRawPasswd != NULL) diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 3a4f28bb1d..1d45da95fe 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -42,10 +42,6 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); - m_baseDomain = getStringA("BaseDomain"); - if (m_baseDomain == NULL) - m_baseDomain = mir_strdup("vk.com"); - m_defaultGroup = getTStringA("ProtoGroup"); if (m_defaultGroup == NULL) m_defaultGroup = mir_tstrdup(_T("VKontakte")); diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index dbb5d68100..7b488f15ae 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -135,9 +135,6 @@ struct CVkProto : public PROTO __forceinline LPCTSTR getGroup() const { return m_defaultGroup; } __forceinline void setGroup(LPCTSTR grp) { m_defaultGroup = mir_tstrdup(grp); } - __forceinline LPCSTR getDomain() const { return m_baseDomain; } - __forceinline void setDomain(LPCSTR domain) { m_baseDomain = mir_strdup(domain); } - private: LIST m_arRequestsQueue; CRITICAL_SECTION m_csRequestsQueue; @@ -192,7 +189,7 @@ private: bool m_bOnline; LONG m_myUserId; - ptrA m_baseDomain, m_szAccessToken; + ptrA m_szAccessToken; ptrT m_defaultGroup; UINT_PTR m_timer; diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index 0b4c48140a..46a344c753 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -64,7 +64,7 @@ AsyncHttpRequest* CVkProto::PushAsyncHttpRequest(int iRequestType, LPCSTR szUrl, CMStringA url; if (*szUrl == '/') { // relative url leads to a site - url = ((bSecure) ? "https://api." : "http://api.") + CMStringA(m_baseDomain); + url = ((bSecure) ? "https://" : "http://") + CMStringA("api.vk.com"); url += szUrl; pReq->bIsMainConn = true; } @@ -105,12 +105,12 @@ void CVkProto::WorkerThread(void*) // try to receive a response from server RetrieveMyInfo(); else { - CMStringA redirectUrl; redirectUrl.Format("http://api.%s/blank.html", m_baseDomain); // Initialize new OAuth session + extern char szBlankUrl[]; HttpParam params[] = { { "client_id", VK_APP_ID }, { "scope", "friends,photos,audio,video,wall,messages,offline" }, - { "redirect_uri", redirectUrl }, + { "redirect_uri", szBlankUrl }, { "display", "wap" }, { "response_type", "token" } }; diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 33a449ce95..fdcfa44742 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -17,6 +17,8 @@ along with this program. If not, see . #include "stdafx.h" +char szBlankUrl[] = "http://api.vk.com/blank.html"; + void CVkProto::ShutdownSession() { if (m_hWorkerThread) { @@ -98,8 +100,7 @@ void CVkProto::OnOAuthAuthorize(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq if (reply->resultCode == 302) { // manual redirect LPCSTR pszLocation = findHeader(reply, "Location"); if (pszLocation) { - CMStringA redirectUrl; redirectUrl.Format("http://api.%s/blank.html", m_baseDomain); - if (!_strnicmp(pszLocation, redirectUrl, redirectUrl.GetLength())) { + if (!_strnicmp(pszLocation, szBlankUrl, sizeof(szBlankUrl)-1)) { m_szAccessToken = NULL; LPCSTR p = strstr(pszLocation, VK_TOKEN_BEG); if (p) { @@ -460,8 +461,8 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe int ownerID = json_as_int(json_get(pAudio, "owner_id")); ptrT ptszArtist(json_as_string(json_get(pAudio, "artist"))); ptrT ptszTitle(json_as_string(json_get(pAudio, "title"))); - tszBody.AppendFormat(_T("%s: (%s - %s) - http://%S/audio%d_%d"), - TranslateT("Audio"), ptszArtist, ptszTitle, m_baseDomain, ownerID, aid); + tszBody.AppendFormat(_T("%s: (%s - %s) - http://vk.com/audio%d_%d"), + TranslateT("Audio"), ptszArtist, ptszTitle, ownerID, aid); } else if (!lstrcmp(ptszType, _T("video"))) { JSONNODE *pVideo = json_get(pAttach, "video"); @@ -470,8 +471,8 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe ptrT ptszTitle(json_as_string(json_get(pVideo, "title"))); int vid = json_as_int(json_get(pVideo, "vid")); int ownerID = json_as_int(json_get(pVideo, "owner_id")); - tszBody.AppendFormat(_T("%s: %s - http://%S/video%d_%d"), - TranslateT("Video"), ptszTitle, m_baseDomain, ownerID, vid); + tszBody.AppendFormat(_T("%s: %s - http://vk.com/video%d_%d"), + TranslateT("Video"), ptszTitle, ownerID, vid); } else if (!lstrcmp(ptszType, _T("doc"))) { JSONNODE *pDoc = json_get(pAttach, "doc"); -- cgit v1.2.3