From f0e5f631450925938fba4d50e1d6f01d85adc712 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 23 Jan 2019 13:16:35 +0300 Subject: ICQ-WIM: - fixes #1716 (ICQ10: add to account manager "register or login by phone number" link) - fixes #1744 (ICQ10: pressing OK in settings rewrites registration settings) --- protocols/ICQ-WIM/res/resources.rc | 88 ++++++++++++-------------------------- protocols/ICQ-WIM/src/options.cpp | 11 ++--- protocols/ICQ-WIM/src/proto.cpp | 2 +- protocols/ICQ-WIM/src/stdafx.h | 1 + 4 files changed, 33 insertions(+), 69 deletions(-) (limited to 'protocols/ICQ-WIM') diff --git a/protocols/ICQ-WIM/res/resources.rc b/protocols/ICQ-WIM/res/resources.rc index a792fb924f..d2b7888d8d 100644 --- a/protocols/ICQ-WIM/res/resources.rc +++ b/protocols/ICQ-WIM/res/resources.rc @@ -11,67 +11,6 @@ ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// Russian (Russia) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) -LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -#pragma code_page(1251) - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_REGISTER DIALOGEX 0, 0, 316, 111 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "Account registration" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,205,90,50,14 - PUSHBUTTON "Cancel",IDCANCEL,259,90,50,14 - LTEXT "Enter full phone number",IDC_STATIC,7,7,302,14 - EDITTEXT IDC_PHONE,7,18,302,14,ES_AUTOHSCROLL - PUSHBUTTON "Send me registration code via SMS",IDC_SENDSMS,49,37,221,14,BS_CENTER | WS_DISABLED - LTEXT "Enter registration code",IDC_STATIC,7,58,302,8 - EDITTEXT IDC_CODE,7,70,302,14,ES_AUTOHSCROLL | WS_DISABLED -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_REGISTER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 309 - TOPMARGIN, 7 - BOTTOMMARGIN, 104 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// AFX_DIALOG_LAYOUT -// - -IDD_REGISTER AFX_DIALOG_LAYOUT -BEGIN - 0 -END - -#endif // Russian (Russia) resources -///////////////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////////////////// // English (United States) resources @@ -93,6 +32,7 @@ BEGIN EDITTEXT IDC_UIN,54,0,131,12,ES_AUTOHSCROLL LTEXT "Password:",IDC_STATIC,0,16,53,12 EDITTEXT IDC_PASSWORD,54,16,131,12,ES_PASSWORD | ES_AUTOHSCROLL + PUSHBUTTON "Create a new ICQ account",IDC_REGISTER,62,34,122,14 END IDD_OPTIONS_FULL DIALOGEX 0, 0, 310, 98 @@ -121,6 +61,20 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,158,243,50,14 END +IDD_REGISTER DIALOGEX 0, 0, 316, 111 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "Account registration" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,205,90,50,14 + PUSHBUTTON "Cancel",IDCANCEL,259,90,50,14 + LTEXT "Enter full phone number",IDC_STATIC,7,7,302,14 + EDITTEXT IDC_PHONE,7,18,302,14,ES_AUTOHSCROLL + PUSHBUTTON "Send me registration code via SMS",IDC_SENDSMS,49,37,221,14,BS_CENTER | WS_DISABLED + LTEXT "Enter registration code",IDC_STATIC,7,58,302,8 + EDITTEXT IDC_CODE,7,70,302,14,ES_AUTOHSCROLL | WS_DISABLED +END ///////////////////////////////////////////////////////////////////////////// // @@ -142,6 +96,14 @@ BEGIN IDD_GROUPCHAT_INVITE, DIALOG BEGIN END + + IDD_REGISTER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 309 + TOPMARGIN, 7 + BOTTOMMARGIN, 104 + END END #endif // APSTUDIO_INVOKED @@ -166,6 +128,10 @@ BEGIN 0 END +IDD_REGISTER AFX_DIALOG_LAYOUT +BEGIN + 0 +END #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// diff --git a/protocols/ICQ-WIM/src/options.cpp b/protocols/ICQ-WIM/src/options.cpp index 3ff4494232..4b2bd88035 100644 --- a/protocols/ICQ-WIM/src/options.cpp +++ b/protocols/ICQ-WIM/src/options.cpp @@ -148,7 +148,7 @@ void CIcqProto::OnLoginViaPhone(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pRe setString(DB_KEY_SESSIONKEY, m_szSessionKey); m_dwUin = _wtoi(data["loginId"].as_mstring()); - setByte("PhoneReg", 1); + setByte(DB_KEY_PHONEREG, 1); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -186,7 +186,7 @@ public: if (wszOldPass != ptrW(edtPassword.GetText())) { m_proto->delSetting(DB_KEY_ATOKEN); m_proto->delSetting(DB_KEY_SESSIONKEY); - m_proto->delSetting("PhoneReg"); + m_proto->delSetting(DB_KEY_PHONEREG); } return true; } @@ -195,11 +195,8 @@ public: { CIcqRegistrationDlg dlg(m_proto); dlg.SetParent(m_hwnd); - if (dlg.DoModal()) { - edtUin.SetInt(m_proto->getDword(DB_KEY_UIN)); - edtPassword.SetText(L""); - wszOldPass.Empty(); - } + if (dlg.DoModal()) // force exit to avoid data corruption + PostMessage(m_hwndParent, WM_COMMAND, MAKELONG(IDCANCEL, BN_CLICKED), 0); } }; diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp index 90d1259fdd..ed713f3983 100644 --- a/protocols/ICQ-WIM/src/proto.cpp +++ b/protocols/ICQ-WIM/src/proto.cpp @@ -408,7 +408,7 @@ int CIcqProto::SetStatus(int iNewStatus) return 0; } - if (!getByte("PhoneReg") && mir_wstrlen(m_szPassword) == 0) { + if (!getByte(DB_KEY_PHONEREG) && mir_wstrlen(m_szPassword) == 0) { debugLogA("Thread ended, password is not configured"); ConnectionFailed(LOGINERR_BADUSERID); return 0; diff --git a/protocols/ICQ-WIM/src/stdafx.h b/protocols/ICQ-WIM/src/stdafx.h index 59e77234f8..ed564a18f0 100644 --- a/protocols/ICQ-WIM/src/stdafx.h +++ b/protocols/ICQ-WIM/src/stdafx.h @@ -82,6 +82,7 @@ #define DB_KEY_UIN "UIN" #define DB_KEY_ATOKEN "AToken" +#define DB_KEY_PHONEREG "PhoneReg" #define DB_KEY_RCLIENTID "RClientID" #define DB_KEY_LASTMSGID "LastMsgId" #define DB_KEY_REMOTEREAD "RemoteReadId" -- cgit v1.2.3