diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2012-10-08 04:58:04 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2012-10-08 04:58:04 +0000 |
commit | b2943645fed61d0c0cfee1225654e5ff44fd96f8 (patch) | |
tree | f734aaa012aa9a883748ed9868bbd7949f9a0f17 /protocols/Skype/src | |
parent | 2439856505a634e770112b73dfce0b8733558e9c (diff) |
- added password request dialog on skype login
git-svn-id: http://svn.miranda-ng.org/main/trunk@1808 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src')
-rw-r--r-- | protocols/Skype/src/resource.h | 5 | ||||
-rw-r--r-- | protocols/Skype/src/skype_dialogs.cpp | 63 | ||||
-rw-r--r-- | protocols/Skype/src/skype_proto.cpp | 50 | ||||
-rw-r--r-- | protocols/Skype/src/skype_proto.h | 6 |
4 files changed, 111 insertions, 13 deletions
diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h index 2cfd6eaeab..5c008dcaec 100644 --- a/protocols/Skype/src/resource.h +++ b/protocols/Skype/src/resource.h @@ -5,9 +5,14 @@ #define IDD_SKYPEACCOUNT 9
#define IDD_OPTIONS 10
#define IDI_ICON 101
+#define IDD_PASSWORDREQUEST 105
#define IDC_SN 1001
#define IDC_PW 1002
#define IDC_SL 1003
+#define IDC_SAVEPASS 1004
+#define IDC_SAVEPASSWORD 1004
+#define IDC_PASSWORD 1018
+#define IDC_INSTRUCTION 1019
// Next default values for new objects
//
diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index 6f86907bfc..5e0bfd4af1 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -131,6 +131,69 @@ INT_PTR CALLBACK CSkypeProto::SkypeOptionsProc(HWND hwnd, UINT message, WPARAM w return FALSE;
}
+INT_PTR CALLBACK CSkypeProto::SkypePasswordProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ CSkypeProto* ppro = (CSkypeProto*)::GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ ::TranslateDialogDefault(hwndDlg);
+
+ ppro = (CSkypeProto*)lParam;
+ ::SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam );
+ {
+ ::SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)CSkypeProto::iconList[0].Handle);
+ ::SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)CSkypeProto::iconList[0].Handle);
+
+ wchar_t skypeName[MAX_PATH];
+ ::mir_sntprintf(
+ skypeName,
+ MAX_PATH,
+ TranslateT("Enter a password for Skype Name %s:"),
+ ppro->login);
+ ::SetDlgItemText(hwndDlg, IDC_INSTRUCTION, skypeName);
+
+ ::SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_LIMITTEXT, 128 - 1, 0);
+
+ ::CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, ppro->GetSettingByte(NULL, "RememberPassword", 0));
+ }
+ break;
+
+ //case WM_DESTROY:
+ //ppro->m_hIconProtocol->ReleaseIcon(true);
+ //ppro->m_hIconProtocol->ReleaseIcon();
+ //break;
+
+ case WM_CLOSE:
+ EndDialog(hwndDlg, 0);
+ break;
+
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ ppro->rememberPassword = ::IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD) > 0;
+ ppro->SetSettingByte(NULL, "RememberPassword", ppro->rememberPassword);
+
+ ::GetDlgItemText(hwndDlg, IDC_PASSWORD, ppro->password, sizeof(ppro->password));
+
+ ppro->SignIn();
+
+ ::EndDialog(hwndDlg, IDOK);
+ break;
+
+ case IDCANCEL:
+ ppro->SetStatus(ID_STATUS_OFFLINE);
+ ::EndDialog(hwndDlg, IDCANCEL);
+ break;
+ }
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
int __cdecl CSkypeProto::OnAccountManagerInit(WPARAM wParam, LPARAM lParam)
{
return (int)CreateDialogParam(
diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index bafa79ed05..6b46b2a3e2 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -217,17 +217,7 @@ int CSkypeProto::SetStatus(int new_status) {
this->m_iStatus = new_status;
if (old_status == ID_STATUS_OFFLINE)
- {
- this->login = this->GetSettingString(SKYPE_SETTINGS_LOGIN);
- if (g_skype->GetAccount(mir_u2a(login), this->account))
- {
- this->m_iStatus = ID_STATUS_CONNECTING;
- this->password = this->GetDecodeSettingString(SKYPE_SETTINGS_PASSWORD);
-
- this->ForkThread(&CSkypeProto::SignIn, this);
- //this->SignIn(this);
- }
- }
+ this->SignIn();
CContact::AVAILABILITY availability = this->MirandaToSkypeStatus(this->m_iStatus);
if(availability != CContact::UNKNOWN)
@@ -263,7 +253,7 @@ int __cdecl CSkypeProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPA return 1;
}
-void __cdecl CSkypeProto::SignIn(void*)
+void __cdecl CSkypeProto::SignInThread(void*)
{
WaitForSingleObject(&this->signin_lock, INFINITE);
@@ -277,7 +267,43 @@ void __cdecl CSkypeProto::SignIn(void*) ReleaseMutex(this->signin_lock);
}
+void CSkypeProto::SignIn()
+{
+ this->login = this->GetSettingString(SKYPE_SETTINGS_LOGIN);
+ if (login == NULL)
+ {
+ this->SetStatus(ID_STATUS_OFFLINE);
+ this->SendBroadcast(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_BADUSERID);
+ ::MessageBox(
+ NULL,
+ TranslateT("You have not entered a Skype name.\nConfigure this in Options->Network->Skype and try again."),
+ _T("Skype"),
+ MB_OK);
+ return;
+ }
+ if (g_skype->GetAccount(::mir_u2a(login), this->account))
+ {
+ this->m_iStatus = ID_STATUS_CONNECTING;
+ this->password = this->GetDecodeSettingString(SKYPE_SETTINGS_PASSWORD);
+ if (this->password)
+ this->ForkThread(&CSkypeProto::SignInThread, this);
+ //this->SignIn(this);
+ else
+ this->RequestPassword();
+ }
+}
+
bool CSkypeProto::IsOnline()
{
return this->m_iStatus != ID_STATUS_OFFLINE;
+}
+
+void CSkypeProto::RequestPassword()
+{
+ ::DialogBoxParam(
+ g_hInstance,
+ MAKEINTRESOURCE(IDD_PASSWORDREQUEST),
+ NULL,
+ CSkypeProto::SkypePasswordProc,
+ LPARAM(this));
}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 74bc4703c6..ea8d7129e0 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -110,9 +110,12 @@ protected: TCHAR* login;
TCHAR* password;
+ bool rememberPassword;
+ void RequestPassword();
HANDLE signin_lock;
- void __cdecl SignIn(void*);
+ void SignIn();
+ void __cdecl SignInThread(void*);
bool IsOnline();
@@ -229,4 +232,5 @@ protected: // dialog procs
static INT_PTR CALLBACK SkypeAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
static INT_PTR CALLBACK SkypeOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
+ static INT_PTR CALLBACK SkypePasswordProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
};
\ No newline at end of file |