summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2012-10-08 04:58:04 +0000
committerAlexander Lantsev <aunsane@gmail.com>2012-10-08 04:58:04 +0000
commitb2943645fed61d0c0cfee1225654e5ff44fd96f8 (patch)
treef734aaa012aa9a883748ed9868bbd7949f9a0f17 /protocols
parent2439856505a634e770112b73dfce0b8733558e9c (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')
-rw-r--r--protocols/Skype/Skype.vcxproj3
-rw-r--r--protocols/Skype/Skype.vcxproj.filters3
-rw-r--r--protocols/Skype/res/Resource.rc47
-rw-r--r--protocols/Skype/src/resource.h5
-rw-r--r--protocols/Skype/src/skype_dialogs.cpp63
-rw-r--r--protocols/Skype/src/skype_proto.cpp50
-rw-r--r--protocols/Skype/src/skype_proto.h6
7 files changed, 164 insertions, 13 deletions
diff --git a/protocols/Skype/Skype.vcxproj b/protocols/Skype/Skype.vcxproj
index ea3f41c52e..1d265a9ace 100644
--- a/protocols/Skype/Skype.vcxproj
+++ b/protocols/Skype/Skype.vcxproj
@@ -123,6 +123,9 @@
<ResourceCompile Include="res\Version.rc" />
<ResourceCompile Include="res\Resource.rc" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="res\Main.ico" />
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/protocols/Skype/Skype.vcxproj.filters b/protocols/Skype/Skype.vcxproj.filters
index e44c53eb09..4fbcd04a14 100644
--- a/protocols/Skype/Skype.vcxproj.filters
+++ b/protocols/Skype/Skype.vcxproj.filters
@@ -80,4 +80,7 @@
<Filter>Resource Filess</Filter>
</ResourceCompile>
</ItemGroup>
+ <ItemGroup>
+ <None Include="res\Main.ico" />
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/protocols/Skype/res/Resource.rc b/protocols/Skype/res/Resource.rc
index 1edb17d873..7c8cab1b8a 100644
--- a/protocols/Skype/res/Resource.rc
+++ b/protocols/Skype/res/Resource.rc
@@ -13,6 +13,53 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
+// Neutral (Default) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)
+LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
+#pragma code_page(1251)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_PASSWORDREQUEST DIALOGEX 0, 0, 157, 87
+STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Enter Skype Password"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ LTEXT "Enter a password for skype name %d:",IDC_INSTRUCTION,7,7,142,8
+ EDITTEXT IDC_PASSWORD,17,16,122,14,ES_PASSWORD | ES_AUTOHSCROLL
+ CONTROL "Remember this session password",IDC_SAVEPASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,54,120,10
+ DEFPUSHBUTTON "OK",IDOK,24,66,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,84,66,50,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_PASSWORDREQUEST, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 149
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 80
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // Neutral (Default) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
// Russian (Russia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
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