summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2016-08-08 05:28:08 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2016-08-08 05:28:08 +0000
commit212d36e4fd71b88a427ecbc8e3c3536daf88de38 (patch)
treef3edc67100ad12cce67c560f604c971784990612 /protocols/VKontakte
parente53d2bd66b1b0bebcc355c165c1060a4490f01ab (diff)
VKontakte:
fixed processing for ‘validation required’ error change MessageBox -> MessageBoxW change styles for some MessageBoxW git-svn-id: http://svn.miranda-ng.org/main/trunk@17166 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r--protocols/VKontakte/src/misc.cpp25
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp4
-rw-r--r--protocols/VKontakte/src/vk_history.cpp4
-rw-r--r--protocols/VKontakte/src/vk_options.cpp2
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp4
-rw-r--r--protocols/VKontakte/src/vk_proto.h2
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp8
7 files changed, 31 insertions, 18 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 4bbb24b730..d4ac98f3c7 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -413,12 +413,24 @@ bool CVkProto::AutoFillForm(char *pBody, CMStringA &szAction, CMStringA& szResul
value = (char*)T2Utf(ptrW(GetUserStoredPassword()));
else if (name == "captcha_key") {
char *pCaptchaBeg = strstr(pFormBeg, "<img id=\"captcha\"");
- if (pCaptchaBeg != NULL)
+ if (pCaptchaBeg)
if (!RunCaptchaForm(getAttr(pCaptchaBeg, "src"), value))
return false;
}
- else if (name == "code")
- value = RunConfirmationCode();
+ else if (name == "code") {
+ char szPrefixTel[10], szSufixTel[10];
+ CMStringW wszTitle;
+ char *pPhonePref = strstr(pFormBeg, "<span class=\"field_prefix\">");
+ if (pPhonePref && sscanf(pPhonePref, "<span class=\"field_prefix\">%s</span>", szPrefixTel) == 1) {
+ pPhonePref = strstr(pPhonePref + 1, "<span class=\"field_prefix\">&nbsp;");
+ if (pPhonePref && sscanf(pPhonePref, "<span class=\"field_prefix\">&nbsp;%s</span>", szSufixTel) == 1) {
+ wszTitle.Format(L"%s %s %s %s %s", TranslateT("Enter the missing digits between"), ptrW(mir_a2u(szPrefixTel)), TranslateT("and"), ptrW(mir_a2u(szSufixTel)), TranslateT("of the phone number linked to your account"));
+ MessageBoxW(NULL, wszTitle, TranslateT("Attention!"), MB_ICONWARNING | MB_OK);
+ }
+ }
+
+ value = RunConfirmationCode(wszTitle);
+ }
if (!result.IsEmpty())
result.AppendChar('&');
@@ -432,11 +444,12 @@ bool CVkProto::AutoFillForm(char *pBody, CMStringA &szAction, CMStringA& szResul
return true;
}
-CMStringW CVkProto::RunConfirmationCode()
+CMStringW CVkProto::RunConfirmationCode(LPCWSTR pwszTitle)
{
ENTER_STRING pForm = { sizeof(pForm) };
- pForm.type = ESF_PASSWORD;
- pForm.caption = TranslateT("Enter confirmation code");
+ pForm.type = ESF_COMBO;
+ pForm.recentCount = 0;
+ pForm.caption = IsEmpty(pwszTitle) ? TranslateT("Enter confirmation code") : pwszTitle;
pForm.ptszInitVal = NULL;
pForm.szModuleName = m_szModuleName;
pForm.szDataPrefix = "confirmcode_";
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index a60a8c3274..fbfbca0e3c 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -591,9 +591,9 @@ void CVkProto::LogMenuHook(CVkChatInfo *cc, GCHOOK *gch)
break;
case IDM_DESTROY:
- if (IDYES == MessageBox(NULL,
+ if (IDYES == MessageBoxW(NULL,
TranslateT("This chat is going to be destroyed forever with all its contents. This action cannot be undone. Are you sure?"),
- TranslateT("Warning"), MB_YESNOCANCEL | MB_ICONQUESTION))
+ TranslateT("Warning"), MB_YESNO | MB_ICONQUESTION))
{
CMStringA code;
code.Format("API.messages.removeChatUser({\"chat_id\":%d, \"user_id\":%d});"
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp
index 756e6f6cbf..2a35594c2b 100644
--- a/protocols/VKontakte/src/vk_history.cpp
+++ b/protocols/VKontakte/src/vk_history.cpp
@@ -25,7 +25,7 @@ INT_PTR __cdecl CVkProto::SvcGetAllServerHistoryForContact(WPARAM hContact, LPAR
if (!IsOnline())
return 0;
LPCWSTR str = TranslateT("Are you sure to reload all messages from vk.com?\nLocal contact history will be deleted and reloaded from the server.\nIt may take a long time.\nDo you want to continue?");
- if (IDNO == MessageBox(NULL, str, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
+ if (IDNO == MessageBoxW(NULL, str, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
return 0;
LONG userID = getDword(hContact, "ID", VK_INVALID_USER);
@@ -52,7 +52,7 @@ INT_PTR __cdecl CVkProto::SvcGetAllServerHistory(WPARAM, LPARAM)
if (!IsOnline())
return 0;
LPCWSTR str = TranslateT("Are you sure you want to reload all messages for all contacts from vk.com?\nLocal contact history will be deleted and reloaded from the server.\nIt may take a very long time and/or corrupt Miranda database.\nWe recommend check your database before reloading messages and after it (Miranda32.exe /svc:dbchecker or Miranda64.exe /svc:dbchecker).\nDo you want to continue?");
- if (IDNO == MessageBox(NULL, str, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
+ if (IDNO == MessageBoxW(NULL, str, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
return 0;
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp
index c30fed271d..de336d3f9c 100644
--- a/protocols/VKontakte/src/vk_options.cpp
+++ b/protocols/VKontakte/src/vk_options.cpp
@@ -493,7 +493,7 @@ CVkOptionMenuForm::CVkOptionMenuForm(CVkProto *proto):
void CVkOptionMenuForm::OnApply()
{
- if (MessageBox(NULL,
+ if (MessageBoxW(NULL,
TranslateT("These changes will take effect after Miranda NG restart.\nWould you like to restart it now?"),
TranslateT("VKontakte protocol"), MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) == IDYES)
CallServiceSync(MS_SYSTEM_RESTART, 1, 0);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 77388d3a51..0005edb867 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -463,8 +463,8 @@ void CVkProto::MsgPopup(MCONTACT hContact, const wchar_t *wszMsg, const wchar_t
CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
}
else {
- DWORD mtype = MB_OK | MB_SETFOREGROUND | MB_ICONSTOP;
- MessageBox(NULL, wszMsg, wszTitle, mtype);
+ DWORD mtype = MB_OK | MB_SETFOREGROUND | err ? MB_ICONERROR : MB_ICONINFORMATION;
+ MessageBoxW(NULL, wszMsg, wszTitle, mtype);
}
}
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 401e6b213e..81fb1db44a 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -329,7 +329,7 @@ private:
bool CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &Node);
void OnReceiveSmth(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
bool AutoFillForm(char*, CMStringA&, CMStringA&);
- CMStringW RunConfirmationCode();
+ CMStringW RunConfirmationCode(LPCWSTR pwszTitle);
CMStringW RunRenameNick(LPCWSTR pwszOldName);
void GrabCookies(NETLIBHTTPREQUEST *nhr);
void ApplyCookies(AsyncHttpRequest*);
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index fafc9be71b..dee7e1547f 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -769,7 +769,7 @@ INT_PTR __cdecl CVkProto::SvcAddAsFriend(WPARAM hContact, LPARAM)
INT_PTR CVkProto::SvcWipeNonFriendContacts(WPARAM, LPARAM)
{
debugLogA("CVkProto::SvcWipeNonFriendContacts");
- if (IDNO == MessageBox(NULL, TranslateT("Are you sure to wipe local contacts missing in your friend list?"),
+ if (IDNO == MessageBoxW(NULL, TranslateT("Are you sure to wipe local contacts missing in your friend list?"),
TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
return 0;
@@ -788,7 +788,7 @@ INT_PTR __cdecl CVkProto::SvcDeleteFriend(WPARAM hContact, LPARAM flag)
CMStringW pwszMsg;
if (flag == 0) {
pwszMsg.AppendFormat(TranslateT("Are you sure to delete %s from your friend list?"), IsEmpty(pwszNick) ? TranslateT("(Unknown contact)") : pwszNick);
- if (IDNO == MessageBox(NULL, pwszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
+ if (IDNO == MessageBoxW(NULL, pwszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
return 1;
}
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/friends.delete.json", true, &CVkProto::OnReceiveDeleteFriend)
@@ -883,7 +883,7 @@ INT_PTR __cdecl CVkProto::SvcBanUser(WPARAM hContact, LPARAM)
wszVarWarning.IsEmpty() ? L" " : TranslateT("\nIt will also"),
wszVarWarning.IsEmpty() ? L"\n" : wszVarWarning);
- if (IDNO == MessageBox(NULL, pwszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
+ if (IDNO == MessageBoxW(NULL, pwszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
return 1;
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveSmth)
@@ -904,7 +904,7 @@ INT_PTR __cdecl CVkProto::SvcReportAbuse(WPARAM hContact, LPARAM)
CMStringW wszNick(ptrW(db_get_wsa(hContact, m_szModuleName, "Nick"))),
pwszMsg(FORMAT, TranslateT("Are you sure to report abuse on %s?"), wszNick.IsEmpty() ? TranslateT("(Unknown contact)") : wszNick);
- if (IDNO == MessageBox(NULL, pwszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
+ if (IDNO == MessageBoxW(NULL, pwszMsg, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
return 1;
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/users.report.json", true, &CVkProto::OnReceiveSmth)