From fded5c38c6eb27b83817978148a65e4fa60be26e Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Tue, 28 Jul 2015 18:18:04 +0000 Subject: MSN: - Popups on login errors git-svn-id: http://svn.miranda-ng.org/main/trunk@14745 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MSN/src/msn_auth.cpp | 2 +- protocols/MSN/src/msn_misc.cpp | 45 ++++++++++++++++++++++++++---------------- protocols/MSN/src/stdafx.h | 6 ++++++ 3 files changed, 35 insertions(+), 18 deletions(-) (limited to 'protocols/MSN/src') diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index 17b18abb11..ca0764fd11 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -903,7 +903,7 @@ int CMsnProto::MSN_AuthOAuth(void) * window with same URL in order to let user correct this */ if (nlhrReply->resultCode == 200 && nlhrReply->pData) { url.Format("https://login.live.com/oauth20_authorize.srf?%s", pszPostParams); - Utils_OpenUrl(url); + MSN_ShowPopup(TranslateT("MSN Protocol"),TranslateT(MSN_LOGIN_OAUTH),MSN_ALLOW_MSGBOX,url); } hHttpsConnection = NULL; } diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index cce21faa02..9f7f6ab15f 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -967,6 +967,26 @@ void CMsnProto::MSN_ShowError(const char* msgtext, ...) MSN_ShowPopup(m_tszUserName, tBuffer, MSN_ALLOW_MSGBOX | MSN_SHOW_ERROR, NULL); } +void HandlePopupData(PopupData *tData) { + if (tData != NULL) { + if (tData->flags & MSN_HOTMAIL_POPUP) { + MCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL); + if (hContact) CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)1); + if (tData->flags & MSN_ALLOW_ENTER) + tData->proto->MsnInvokeMyURL(true, tData->url); + } + else if (tData->url != NULL) + Utils_OpenUrl(tData->url); + } +} + +void RemovePopupData(PopupData *tData) { + if (tData != NULL && (tData->flags & MSN_HOTMAIL_POPUP)) { + MCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL); + if (hContact) + CallService(MS_CLIST_REMOVEEVENT, hContact, 1); + } +} ///////////////////////////////////////////////////////////////////////////////////////// // Popup plugin window proc @@ -976,25 +996,12 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara switch (msg) { case WM_COMMAND: - if (tData != NULL) { - if (tData->flags & MSN_HOTMAIL_POPUP) { - MCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL); - if (hContact) CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)1); - if (tData->flags & MSN_ALLOW_ENTER) - tData->proto->MsnInvokeMyURL(true, tData->url); - } - else if (tData->url != NULL) - Utils_OpenUrl(tData->url); - } + HandlePopupData(tData); PUDeletePopup(hWnd); break; case WM_CONTEXTMENU: - if (tData != NULL && tData->flags & MSN_HOTMAIL_POPUP) { - MCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL); - if (hContact) - CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)1); - } + RemovePopupData(tData); PUDeletePopup(hWnd); break; @@ -1062,8 +1069,12 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) if (pud->flags & MSN_ALLOW_MSGBOX) { TCHAR szMsg[MAX_SECONDLINE + MAX_CONTACTNAME]; mir_sntprintf(szMsg, _countof(szMsg), _T("%s:\n%s"), pud->title, pud->text); - MessageBox(NULL, szMsg, TranslateT("MSN Protocol"), - MB_OK | (iserr ? MB_ICONERROR : MB_ICONINFORMATION)); + int ret = MessageBox(NULL, szMsg, TranslateT("MSN Protocol"), + MB_YESNO | (iserr ? MB_ICONERROR : MB_ICONINFORMATION)); + if (ret == IDYES) + HandlePopupData(pud); + else + RemovePopupData(pud); } mir_free(pud->title); mir_free(pud->text); diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h index 1f34366308..132be9f0ed 100644 --- a/protocols/MSN/src/stdafx.h +++ b/protocols/MSN/src/stdafx.h @@ -193,6 +193,12 @@ const char MSN_USER_AGENT[] = NETLIB_USER_AGENT; extern const char sttVoidUid[]; +#define MSN_LOGIN_OAUTH LPGEN("Automatic authentication to MSN failed, possibly due to Captcha-Authentication.\ + Do you want to open a browser window to do a manual login?\n\n\ + This will not log you in to MSN in Miranda, but it allows you to fix potential problems like entering a captcha\ + that gets asked due to location change or to accept new TOS, which are required only once.\n\n\ + Also please note that MSN protocol doesn't support two-factor authentication.") + ///////////////////////////////////////////////////////////////////////////////////////// // MSN plugin functions -- cgit v1.2.3