diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-10-29 18:24:58 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-10-29 18:24:58 +0000 |
commit | f9526af6e2236193cbd5bbab7af5d8e386c2233e (patch) | |
tree | 5ba58e6af180b642c6a491247f9e32b13db66bc9 /protocols/VKontakte/src/vk_options.cpp | |
parent | 13045806fbae565ae8062166a328633622a0dcb9 (diff) |
VKontakte:
fix for cleaning access token on login or password change
version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@15649 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_options.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_options.cpp | 69 |
1 files changed, 48 insertions, 21 deletions
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 86470e1295..03fbb011c0 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -34,13 +34,13 @@ INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP 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 tszLogin(ppro->getTStringA("Login"));
- if (tszLogin != NULL)
- SetDlgItemText(hwndDlg, IDC_LOGIN, tszLogin);
+ ptrT ptszLogin(ppro->getTStringA("Login"));
+ if (ptszLogin != NULL)
+ SetDlgItemText(hwndDlg, IDC_LOGIN, ptszLogin);
- ptrT tszPassw(ppro->GetUserStoredPassword());
- if (tszPassw != NULL)
- SetDlgItemText(hwndDlg, IDC_PASSWORD, tszPassw);
+ ptrT ptszPassw(ppro->GetUserStoredPassword());
+ if (ptszPassw != NULL)
+ SetDlgItemText(hwndDlg, IDC_PASSWORD, ptszPassw);
}
return TRUE;
@@ -63,13 +63,27 @@ INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
TCHAR str[1025];
+ bool bNeedClearToken = false;
GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
- ppro->setTString("Login", str);
+
+ CMString tszLogin(ptrT(ppro->getTStringA("Login")));
+ if (tszLogin != str) {
+ bNeedClearToken = true;
+ ppro->setTString("Login", str);
+ }
GetDlgItemText(hwndDlg, IDC_PASSWORD, str, _countof(str));
+ CMString tszPassw(ptrT(ppro->GetUserStoredPassword()));
+
T2Utf szRawPasswd(str);
- if (szRawPasswd != NULL)
+ if (szRawPasswd != NULL && tszPassw != str) {
+ bNeedClearToken = true;
ppro->setString("Password", szRawPasswd);
+ }
+
+ if (bNeedClearToken)
+ ppro->ClearAccessToken();
+
}
break;
@@ -108,13 +122,13 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L 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 tszLogin(ppro->getTStringA("Login"));
- if (tszLogin != NULL)
- SetDlgItemText(hwndDlg, IDC_LOGIN, tszLogin);
+ ptrT ptszLogin(ppro->getTStringA("Login"));
+ if (ptszLogin != NULL)
+ SetDlgItemText(hwndDlg, IDC_LOGIN, ptszLogin);
- ptrT tszPassw(ppro->GetUserStoredPassword());
- if (tszPassw != NULL)
- SetDlgItemText(hwndDlg, IDC_PASSWORD, tszPassw);
+ ptrT ptszPassw(ppro->GetUserStoredPassword());
+ if (ptszPassw != NULL)
+ SetDlgItemText(hwndDlg, IDC_PASSWORD, ptszPassw);
SetDlgItemText(hwndDlg, IDC_GROUPNAME, ppro->getGroup());
}
@@ -170,20 +184,30 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
TCHAR str[1025];
+ bool bNeedClearToken = false;
GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
- ppro->setTString("Login", str);
- GetDlgItemText(hwndDlg, IDC_GROUPNAME, str, _countof(str));
- if (mir_tstrcmp(ppro->getGroup(), str)) {
- ppro->setGroup(str);
- ppro->setTString("ProtoGroup", str);
+ CMString tszLogin(ptrT(ppro->getTStringA("Login")));
+ if (tszLogin != str) {
+ bNeedClearToken = true;
+ ppro->setTString("Login", str);
}
GetDlgItemText(hwndDlg, IDC_PASSWORD, str, _countof(str));
+ CMString tszPassw(ptrT(ppro->GetUserStoredPassword()));
+
T2Utf szRawPasswd(str);
- if (szRawPasswd != NULL)
+ if (szRawPasswd != NULL && tszPassw != str) {
+ bNeedClearToken = true;
ppro->setString("Password", szRawPasswd);
-
+ }
+
+ GetDlgItemText(hwndDlg, IDC_GROUPNAME, str, _countof(str));
+ if (mir_tstrcmp(ppro->getGroup(), str)) {
+ ppro->setGroup(str);
+ ppro->setTString("ProtoGroup", str);
+ }
+
ppro->m_bServerDelivery = IsDlgButtonChecked(hwndDlg, IDC_DELIVERY) == BST_CHECKED;
ppro->setByte("ServerDelivery", ppro->m_bServerDelivery);
@@ -212,6 +236,9 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L ppro->m_iSyncHistoryMetod = sync3Days;
ppro->setByte("SyncHistoryMetod", ppro->m_iSyncHistoryMetod);
+
+ if (bNeedClearToken)
+ ppro->ClearAccessToken();
}
break;
|