summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/VKontakte/res/resource.rc53
-rw-r--r--protocols/VKontakte/src/resource.h3
-rw-r--r--protocols/VKontakte/src/vk_options.cpp77
-rw-r--r--protocols/VKontakte/src/vk_queue.cpp10
-rw-r--r--protocols/VKontakte/src/vk_struct.cpp14
-rw-r--r--protocols/VKontakte/src/vk_struct.h7
6 files changed, 91 insertions, 73 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc
index ff8e88addb..f75a2535c3 100644
--- a/protocols/VKontakte/res/resource.rc
+++ b/protocols/VKontakte/res/resource.rc
@@ -26,19 +26,32 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_NOTIFICATION ICON "notify.ico"
+
IDI_FRIENDADD ICON "add.ico"
+
IDI_BAN ICON "ban.ico"
+
IDI_FRIENDDEL ICON "delete.ico"
+
IDI_READMSG ICON "read.ico"
+
IDI_ABUSE ICON "report.ico"
+
IDI_VISITPROFILE ICON "home.ico"
+
IDI_HISTORY ICON "history.ico"
+
IDI_KEYS ICON "key.ico"
+
IDI_BROADCAST ICON "broadcast.ico"
+
IDI_STATUS ICON "status.ico"
+
IDI_WALL ICON "wall.ico"
+
IDI_MARKMESSAGESASREAD ICON "markread.ico"
+
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
@@ -88,7 +101,8 @@ BEGIN
VERTGUIDE, 167
VERTGUIDE, 288
TOPMARGIN, 7
- BOTTOMMARGIN, 202
+ BOTTOMMARGIN, 228
+ HORZGUIDE, 223
END
IDD_INVITE, DIALOG
@@ -242,7 +256,7 @@ BEGIN
EDITTEXT IDC_RET_CHAT_MES,134,204,157,12,ES_AUTOHSCROLL
END
-IDD_OPT_MAIN DIALOGEX 0, 0, 304, 213
+IDD_OPT_MAIN DIALOGEX 0, 0, 304, 233
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
@@ -250,27 +264,30 @@ BEGIN
GROUPBOX "Login settings",IDC_STATIC,4,8,293,50
RTEXT "E-mail or phone number:",IDC_STATIC,12,17,150,10
EDITTEXT IDC_LOGIN,167,16,121,12,ES_AUTOHSCROLL
- RTEXT "Password:",IDC_STATIC,12,29,150,10
- EDITTEXT IDC_PASSWORD,167,29,121,12,ES_PASSWORD | ES_AUTOHSCROLL
+ RTEXT "Password:",IDC_STATIC,12,30,150,10
+ EDITTEXT IDC_PASSWORD,167,30,121,12,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Open VKontakte site",IDC_URL,"Hyperlink",WS_TABSTOP,59,44,174,11
- GROUPBOX "Local settings",IDC_STATIC,4,59,293,65
+ GROUPBOX "Local settings",IDC_STATIC,4,59,293,75
RTEXT "Contact list group:",IDC_STATIC,12,71,150,8
EDITTEXT IDC_GROUPNAME,167,69,121,12,ES_AUTOHSCROLL
- CONTROL "Server-side delivery confirmation",IDC_DELIVERY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,88,278,10
+ RTEXT "Language for names and titles (*):",IDC_STATIC,12,86,148,10
+ COMBOBOX IDC_COMBO_LANGUAGE,167,84,121,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ CONTROL "Server-side delivery confirmation",IDC_DELIVERY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,98,278,10
CONTROL "Use local time for received messages",IDC_USE_LOCAL_TIME,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,99,278,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,109,278,10
CONTROL "Automatically wipe local contacts missing in your friend list",IDC_AUTOCLEAN,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,110,278,10
- GROUPBOX "Mark message as read...",IDC_STATIC_MARK_AS_READ,4,127,293,33,WS_GROUP
- CONTROL "on read",IDC_ONREAD,"Button",BS_AUTORADIOBUTTON,12,138,138,10
- CONTROL "on receive",IDC_ONRECEIVE,"Button",BS_AUTORADIOBUTTON,12,148,138,10
- CONTROL "on reply",IDC_ONREPLY,"Button",BS_AUTORADIOBUTTON,155,138,133,10
- CONTROL "on typing",IDC_ONTYPING,"Button",BS_AUTORADIOBUTTON,155,148,133,10
- GROUPBOX "Sync history on protocol online...",IDC_STATIC_SYNC_HISTORY,4,163,293,36,WS_GROUP
- CONTROL "off",IDC_SYNC_OFF,"Button",BS_AUTORADIOBUTTON,12,174,138,10
- CONTROL "automatically",IDC_SYNC_AUTO,"Button",BS_AUTORADIOBUTTON,12,185,138,10
- CONTROL "for last 1 day",IDC_SYNC_LAST1DAY,"Button",BS_AUTORADIOBUTTON,155,174,133,10
- CONTROL "for last 3 days",IDC_SYNC_LAST3DAY,"Button",BS_AUTORADIOBUTTON,155,185,133,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,120,278,10
+ GROUPBOX "Mark message as read...",IDC_STATIC_MARK_AS_READ,4,137,293,33,WS_GROUP
+ CONTROL "on read",IDC_ONREAD,"Button",BS_AUTORADIOBUTTON,12,148,138,10
+ CONTROL "on receive",IDC_ONRECEIVE,"Button",BS_AUTORADIOBUTTON,12,158,138,10
+ CONTROL "on reply",IDC_ONREPLY,"Button",BS_AUTORADIOBUTTON,155,148,133,10
+ CONTROL "on typing",IDC_ONTYPING,"Button",BS_AUTORADIOBUTTON,155,158,133,10
+ GROUPBOX "Sync history on protocol online...",IDC_STATIC_SYNC_HISTORY,4,173,293,36,WS_GROUP
+ CONTROL "off",IDC_SYNC_OFF,"Button",BS_AUTORADIOBUTTON,12,184,138,10
+ CONTROL "automatically",IDC_SYNC_AUTO,"Button",BS_AUTORADIOBUTTON,12,195,138,10
+ CONTROL "for last 1 day",IDC_SYNC_LAST1DAY,"Button",BS_AUTORADIOBUTTON,155,184,133,10
+ CONTROL "for last 3 days",IDC_SYNC_LAST3DAY,"Button",BS_AUTORADIOBUTTON,155,195,133,10
+ CTEXT "Options marked with an asterisk (*) will only take effect after Miranda has been restarted.",IDC_STATIC,12,213,276,10
END
IDD_CAPTCHAFORM DIALOGEX 0, 0, 258, 224
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h
index f387c18e32..c56f5cce12 100644
--- a/protocols/VKontakte/src/resource.h
+++ b/protocols/VKontakte/src/resource.h
@@ -113,6 +113,7 @@
#define IDC_N_INVITES 1097
#define IDC_USENOSTDPOPUPS 1098
#define IDC_RET_CHAT_MES 1099
+#define IDC_COMBO_LANGUAGE 1100
// Next default values for new objects
//
@@ -121,7 +122,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 122
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1100
+#define _APS_NEXT_CONTROL_VALUE 1101
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp
index 92537b1474..223df9ce21 100644
--- a/protocols/VKontakte/src/vk_options.cpp
+++ b/protocols/VKontakte/src/vk_options.cpp
@@ -17,6 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
+
+
//////////////////////////////////////////////////////////////////////////////
// Account manager dialog
@@ -31,8 +33,6 @@ INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
ppro = (CVkProto*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon, 1));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon));
{
ptrT ptszLogin(ppro->getTStringA("Login"));
if (ptszLogin != NULL)
@@ -90,11 +90,6 @@ INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
case WM_CLOSE:
EndDialog(hwndDlg, 0);
break;
-
- case WM_DESTROY:
- IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
- IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
- break;
}
return FALSE;
@@ -112,6 +107,20 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
{
CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ CVKLang vkLangCodes[] = {
+ { NULL, LPGENT("Account language") },
+ { _T("en"), LPGENT("English") },
+ { _T("ru"), LPGENT("Russian") },
+ { _T("be"), LPGENT("Belarusian") },
+ { _T("ua"), LPGENT("Ukrainian") },
+ { _T("es"), LPGENT("Spanish") },
+ { _T("fi"), LPGENT("Finnish") },
+ { _T("de"), LPGENT("German") },
+ { _T("it"), LPGENT("Italian") },
+ };
+
+ HWND hWndCombo = GetDlgItem(hwndDlg, IDC_COMBO_LANGUAGE);
+
switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
@@ -119,8 +128,6 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
ppro = (CVkProto*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon, 1));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon));
{
ptrT ptszLogin(ppro->getTStringA("Login"));
if (ptszLogin != NULL)
@@ -128,9 +135,16 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
ptrT ptszPassw(ppro->GetUserStoredPassword());
if (ptszPassw != NULL)
- SetDlgItemText(hwndDlg, IDC_PASSWORD, ptszPassw);
+ SetDlgItemText(hwndDlg, IDC_PASSWORD, ptszPassw);
+ }
+
+ SetDlgItemText(hwndDlg, IDC_GROUPNAME, ppro->getGroup());
- SetDlgItemText(hwndDlg, IDC_GROUPNAME, ppro->getGroup());
+ for (size_t i = 0; i < _countof(vkLangCodes); i++) {
+ LRESULT iItem = SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)TranslateTS(vkLangCodes[i].szDescription));
+ SendMessage(hWndCombo, CB_SETITEMDATA, iItem, (LPARAM)vkLangCodes[i].szCode);
+ if (!mir_tstrcmpi(vkLangCodes[i].szCode, ppro->m_VKLang))
+ SendMessage(hWndCombo, CB_SETCURSEL, i, 0);
}
CheckDlgButton(hwndDlg, IDC_DELIVERY, ppro->m_bServerDelivery ? BST_CHECKED : BST_UNCHECKED);
@@ -161,6 +175,10 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
+
+ case IDC_COMBO_LANGUAGE:
+ if (HIWORD(wParam) == CBN_SELCHANGE && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
case IDC_DELIVERY:
case IDC_USE_LOCAL_TIME:
@@ -207,7 +225,13 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
ppro->setGroup(str);
ppro->setTString("ProtoGroup", str);
}
-
+
+ ppro->m_VKLang = mir_tstrdup((TCHAR*)SendMessage(hWndCombo, CB_GETITEMDATA, SendMessage(hWndCombo, CB_GETCURSEL, 0, 0), 0));
+ if (!IsEmpty(ppro->m_VKLang))
+ ppro->setTString("VKLang", ppro->m_VKLang);
+ else
+ ppro->delSetting("VKLang");
+
ppro->m_bServerDelivery = IsDlgButtonChecked(hwndDlg, IDC_DELIVERY) == BST_CHECKED;
ppro->setByte("ServerDelivery", ppro->m_bServerDelivery);
@@ -245,11 +269,6 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
case WM_CLOSE:
EndDialog(hwndDlg, 0);
break;
-
- case WM_DESTROY:
- IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
- IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
- break;
}
return FALSE;
@@ -266,9 +285,6 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam
ppro = (CVkProto*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon, 1));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon));
-
CheckDlgButton(hwndDlg, IDC_HIDECHATS, ppro->m_bHideChats ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SYNC_MSG_STATUS, ppro->m_bSyncReadMessageStatusFromServer ? BST_CHECKED : BST_UNCHECKED);
@@ -400,11 +416,6 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam
case WM_CLOSE:
EndDialog(hwndDlg, 0);
break;
-
- case WM_DESTROY:
- IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
- IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
- break;
}
return FALSE;
@@ -421,9 +432,6 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar
ppro = (CVkProto*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon, 1));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon));
-
CheckDlgButton(hwndDlg, IDC_NEWS_ENBL, ppro->m_bNewsEnabled ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_NOTIF_ENBL, ppro->m_bNotificationsEnabled ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_NOTIF_MARK_VIEWED, ppro->m_bNotificationsMarkAsViewed ? BST_CHECKED : BST_UNCHECKED);
@@ -568,11 +576,6 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar
case WM_CLOSE:
EndDialog(hwndDlg, 0);
break;
-
- case WM_DESTROY:
- IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
- IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
- break;
}
return FALSE;
@@ -589,9 +592,6 @@ INT_PTR CALLBACK CVkProto::OptionsViewProc(HWND hwndDlg, UINT uMsg, WPARAM wPara
ppro = (CVkProto*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon, 1));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon));
-
CheckDlgButton(hwndDlg, IDC_IMG_OFF, (ppro->m_iIMGBBCSupport == imgNo) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_IMG_FULLSIZE, (ppro->m_iIMGBBCSupport == imgFullSize) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_IMG_130, (ppro->m_iIMGBBCSupport == imgPreview130) ? BST_CHECKED : BST_UNCHECKED);
@@ -675,11 +675,6 @@ INT_PTR CALLBACK CVkProto::OptionsViewProc(HWND hwndDlg, UINT uMsg, WPARAM wPara
case WM_CLOSE:
EndDialog(hwndDlg, 0);
break;
-
- case WM_DESTROY:
- IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
- IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
- break;
}
return FALSE;
diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp
index 2f969937fc..a89f69ced3 100644
--- a/protocols/VKontakte/src/vk_queue.cpp
+++ b/protocols/VKontakte/src/vk_queue.cpp
@@ -81,7 +81,7 @@ void CVkProto::ExecuteRequest(AsyncHttpRequest *pReq)
}
debugLogA("CVkProto::ExecuteRequest pReq->bNeedsRestart = %d", (int)pReq->bNeedsRestart);
- if (!reply)
+ if (!reply && pReq->m_bApiReq)
m_hAPIConnection = NULL;
} while (pReq->bNeedsRestart && !m_bTerminated);
@@ -94,11 +94,12 @@ AsyncHttpRequest* CVkProto::Push(AsyncHttpRequest *pReq, int iTimeout)
{
debugLogA("CVkProto::Push");
pReq->timeout = iTimeout;
- if (pReq->m_bApiReq)
- {
- if (m_VKLang != nullptr) pReq << TCHAR_PARAM("lang", m_VKLang);
+ if (pReq->m_bApiReq) {
pReq << VER_API;
+ if (!IsEmpty(m_VKLang))
+ pReq << TCHAR_PARAM("lang", m_VKLang);
}
+
{
mir_cslock lck(m_csRequestsQueue);
m_arRequestsQueue.insert(pReq);
@@ -124,7 +125,6 @@ void CVkProto::WorkerThread(void*)
m_szAccessToken = NULL;
}
-
if (m_szAccessToken != NULL)
// try to receive a response from server
RetrieveMyInfo();
diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp
index 6637e910d0..3568d8515c 100644
--- a/protocols/VKontakte/src/vk_struct.cpp
+++ b/protocols/VKontakte/src/vk_struct.cpp
@@ -44,20 +44,20 @@ AsyncHttpRequest::AsyncHttpRequest(CVkProto *ppro, int iRequestType, LPCSTR _url
bIsMainConn = false;
bExpUrlEncode = ppro->m_bUseNonStandardUrlEncode;
AddHeader("Connection", "keep-alive");
-
- flags = VK_NODUMPHEADERS | NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT;
- if (bSecure)
- flags |= NLHRF_SSL;
-
+
if (*_url == '/') { // relative url leads to a site
m_szUrl = ((bSecure) ? "https://" : "http://") + CMStringA("api.vk.com");
m_szUrl += _url;
bIsMainConn = true;
}
- else m_szUrl = _url;
+ else
+ m_szUrl = _url;
- if (bSecure)
+ flags = VK_NODUMPHEADERS | NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT;
+ if (bSecure) {
+ flags |= NLHRF_SSL;
this << CHAR_PARAM("access_token", ppro->m_szAccessToken);
+ }
requestType = iRequestType;
m_pFunc = pFunc;
diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h
index d90d2c452d..c2fe4e50be 100644
--- a/protocols/VKontakte/src/vk_struct.h
+++ b/protocols/VKontakte/src/vk_struct.h
@@ -242,4 +242,9 @@ struct CVKChatContactTypingParam {
struct CVKInteres {
const char *szField;
TCHAR *ptszTranslate;
-}; \ No newline at end of file
+};
+
+struct CVKLang {
+ TCHAR *szCode;
+ TCHAR *szDescription;
+}; \ No newline at end of file