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
|
#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 __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;
}
|