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
|
/*
Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation version 2
of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdafx.h"
class CSkypeOptionsMain : public CSkypeDlgBase
{
CCtrlEdit m_skypename, m_password, m_group, m_place;
CCtrlCheck m_autosync, m_usehostname, m_usebb;
CCtrlHyperlink m_link;
public:
CSkypeOptionsMain(CSkypeProto *proto, int idDialog) :
CSkypeDlgBase(proto, idDialog),
m_skypename(this, IDC_SKYPENAME),
m_password(this, IDC_PASSWORD),
m_group(this, IDC_GROUP),
m_place(this, IDC_PLACE),
m_autosync(this, IDC_AUTOSYNC),
m_usehostname(this, IDC_USEHOST),
m_usebb(this, IDC_BBCODES),
m_link(this, IDC_CHANGEPASS, "https://login.skype.com/recovery/password-change") // TODO : ...?username=%username%
{
CreateLink(m_group, proto->m_wstrCListGroup);
CreateLink(m_autosync, proto->m_bAutoHistorySync);
CreateLink(m_place, proto->m_wstrPlace);
CreateLink(m_usehostname, proto->m_bUseHostnameAsPlace);
CreateLink(m_usebb, proto->m_bUseBBCodes);
m_usehostname.OnChange = Callback(this, &CSkypeOptionsMain::OnUsehostnameCheck);
}
bool OnInitDialog() override
{
m_skypename.SetTextA(ptrA(m_proto->getStringA(SKYPE_SETTINGS_ID)));
m_password.SetTextA(pass_ptrA(m_proto->getStringA("Password")));
m_place.Enable(!m_proto->m_bUseHostnameAsPlace);
m_skypename.SendMsg(EM_LIMITTEXT, 128, 0);
m_password.SendMsg(EM_LIMITTEXT, 128, 0);
m_group.SendMsg(EM_LIMITTEXT, 64, 0);
return true;
}
bool OnApply() override
{
ptrA szNewSkypename(m_skypename.GetTextA()),
szOldSkypename(m_proto->getStringA(SKYPE_SETTINGS_ID));
pass_ptrA szNewPassword(m_password.GetTextA()),
szOldPassword(m_proto->getStringA("Password"));
if (mir_strcmpi(szNewSkypename, szOldSkypename) || mir_strcmp(szNewPassword, szOldPassword))
m_proto->delSetting("TokenExpiresIn");
m_proto->setString(SKYPE_SETTINGS_ID, szNewSkypename);
m_proto->setString("Password", szNewPassword);
ptrW group(m_group.GetText());
if (mir_wstrlen(group) > 0 && !Clist_GroupExists(group))
Clist_GroupCreate(0, group);
return true;
}
void OnUsehostnameCheck(CCtrlCheck *)
{
m_place.Enable(!m_usehostname.GetState());
}
};
/////////////////////////////////////////////////////////////////////////////////
MWindow CSkypeProto::OnCreateAccMgrUI(MWindow hwndParent)
{
auto *pDlg = new CSkypeOptionsMain(this, IDD_ACCOUNT_MANAGER);
pDlg->SetParent(hwndParent);
pDlg->Show();
return pDlg->GetHwnd();
}
int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.szTitle.w = m_tszUserName;
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
odp.szGroup.w = LPGENW("Network");
odp.szTab.w = LPGENW("Account");
odp.pDialog = new CSkypeOptionsMain(this, IDD_OPTIONS_MAIN);
g_plugin.addOptions(wParam, &odp);
return 0;
}
|