1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
#include "skype_proto.h"
INT_PTR CALLBACK CSkypeProto::SkypeAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
CSkypeProto *proto;
switch (message)
{
case WM_INITDIALOG:
{
TranslateDialogDefault(hwnd);
proto = reinterpret_cast<CSkypeProto*>(lparam);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
wchar_t* sid = proto->GetSettingString(SKYPE_SETTINGS_LOGIN);
SetDlgItemText(hwnd, IDC_SL, sid);
::mir_free(sid);
wchar_t* pwd = proto->GetDecodeSettingString(SKYPE_SETTINGS_PASSWORD);
SetDlgItemText(hwnd, IDC_PW, pwd);
::mir_free(pwd);
if ( proto->m_iStatus != ID_STATUS_OFFLINE)
{
SendMessage(GetDlgItem(hwnd, IDC_SL), EM_SETREADONLY, 1, 0);
SendMessage(GetDlgItem(hwnd, IDC_PW), EM_SETREADONLY, 1, 0);
}
}
return TRUE;
case WM_COMMAND:
{
if (HIWORD(wparam) == EN_CHANGE && reinterpret_cast<HWND>(lparam) == GetFocus())
{
switch(LOWORD(wparam))
{
case IDC_SL:
case IDC_PW:
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
}
}
break;
case WM_NOTIFY:
{
if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
{
TCHAR data[128];
proto = reinterpret_cast<CSkypeProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
GetDlgItemText(hwnd, IDC_SL, data, sizeof(data));
proto->SetSettingString(SKYPE_SETTINGS_LOGIN, data);
GetDlgItemText(hwnd, IDC_PW, data, sizeof(data));
proto->SetDecodeSettingString(SKYPE_SETTINGS_PASSWORD, data);
return TRUE;
}
}
break;
}
return FALSE;
}
INT_PTR CALLBACK CSkypeProto::SkypeOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
CSkypeProto *proto;
switch (message)
{
case WM_INITDIALOG:
{
TranslateDialogDefault(hwnd);
proto = reinterpret_cast<CSkypeProto*>(lparam);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
wchar_t* data = proto->GetSettingString(SKYPE_SETTINGS_LOGIN, L"");
SetDlgItemText(hwnd, IDC_SL, data);
::mir_free(data);
data = proto->GetDecodeSettingString(SKYPE_SETTINGS_PASSWORD, L"");
SetDlgItemText(hwnd, IDC_PW, data);
::mir_free(data);
if (proto->m_iStatus != ID_STATUS_OFFLINE)
{
SendMessage(GetDlgItem(hwnd, IDC_SL), EM_SETREADONLY, 1, 0);
SendMessage(GetDlgItem(hwnd, IDC_PW), EM_SETREADONLY, 1, 0);
}
}
return TRUE;
case WM_COMMAND:
{
if (HIWORD(wparam) == EN_CHANGE && reinterpret_cast<HWND>(lparam) == GetFocus())
{
switch(LOWORD(wparam))
{
case IDC_SL:
case IDC_PW:
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
}
}
break;
case WM_NOTIFY:
{
if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
{
wchar_t data[128];
proto = reinterpret_cast<CSkypeProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
GetDlgItemText(hwnd, IDC_SL, data, sizeof(data));
proto->SetSettingString(SKYPE_SETTINGS_LOGIN, data);
GetDlgItemText(hwnd, IDC_PW, data, sizeof(data));
proto->SetDecodeSettingString(SKYPE_SETTINGS_PASSWORD, data);
return TRUE;
}
}
break;
}
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(
g_hInstance,
MAKEINTRESOURCE(IDD_SKYPEACCOUNT),
(HWND)lParam,
&CSkypeProto::SkypeAccountProc, (LPARAM)this);
}
int __cdecl CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM lParam)
{
OPTIONSDIALOGPAGE odp = {0};
odp.cbSize = sizeof(odp);
odp.hInstance = g_hInstance;
odp.ptszTitle = m_tszUserName;
odp.dwInitParam = LPARAM(this);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.position = 271828;
odp.ptszGroup = LPGENT("Network");
odp.ptszTab = LPGENT("Account");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.pfnDlgProc = SkypeOptionsProc;
Options_AddPage(wParam, &odp);
return 0;
}
|