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
|
/*
former MetaContacts Plugin for Miranda IM.
Copyright © 2014 Miranda NG Team
Copyright © 2004-07 Scott Ellis
Copyright © 2004 Universite Louis PASTEUR, STRASBOURG.
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; either version 2
of the License, or (at your option) any later version.
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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "..\..\core\commonheaders.h"
#include "metacontacts.h"
MetaOptions options;
int Meta_WriteOptions()
{
db_set_b(NULL, META_PROTO, "LockHandle", options.bLockHandle);
db_set_b(NULL, META_PROTO, "SuppressStatus", options.bSuppressStatus);
db_set_w(NULL, META_PROTO, "MenuContactLabel", (WORD)options.menu_contact_label);
db_set_w(NULL, META_PROTO, "MenuContactFunction", (WORD)options.menu_function);
db_set_w(NULL, META_PROTO, "CListContactName", (WORD)options.clist_contact_name);
db_set_dw(NULL, META_PROTO, "SetStatusFromOfflineDelay", (DWORD)(options.set_status_from_offline_delay));
return 0;
}
int Meta_ReadOptions()
{
db_mc_enable(db_get_b(NULL, META_PROTO, "Enabled", true) != 0);
options.bSuppressStatus = db_get_b(NULL, META_PROTO, "SuppressStatus", true) != 0;
options.menu_contact_label = (int)db_get_w(NULL, META_PROTO, "MenuContactLabel", DNT_UID);
options.menu_function = (int)db_get_w(NULL, META_PROTO, "MenuContactFunction", FT_MENU);
options.clist_contact_name = (int)db_get_w(NULL, META_PROTO, "CListContactName", CNNT_DISPLAYNAME);
options.set_status_from_offline_delay = (int)db_get_dw(NULL, META_PROTO, "SetStatusFromOfflineDelay", DEFAULT_SET_STATUS_SLEEP_TIME);
options.bLockHandle = db_get_b(NULL, META_PROTO, "LockHandle", false) != 0;
return 0;
}
class CMetaOptionsDlg : public CDlgBase
{
CCtrlCheck m_btnUid, m_btnDid, m_btnCheck;
CCtrlCheck m_btnMsg, m_btnMenu, m_btnInfo;
CCtrlCheck m_btnNick, m_btnName, m_btnLock;
public:
CMetaOptionsDlg() :
CDlgBase(hInst, IDD_METAOPTIONS),
m_btnUid(this, IDC_RAD_UID),
m_btnDid(this, IDC_RAD_DID),
m_btnMsg(this, IDC_RAD_MSG),
m_btnMenu(this, IDC_RAD_MENU),
m_btnInfo(this, IDC_RAD_INFO),
m_btnNick(this, IDC_RAD_NICK),
m_btnName(this, IDC_RAD_NAME),
m_btnLock(this, IDC_CHK_LOCKHANDLE),
m_btnCheck(this, IDC_CHK_SUPPRESSSTATUS)
{
}
virtual void OnInitDialog()
{
m_btnLock.SetState(options.bLockHandle);
m_btnCheck.SetState(options.bSuppressStatus);
if (options.menu_contact_label == DNT_UID)
m_btnUid.SetState(true);
else
m_btnDid.SetState(true);
switch (options.menu_function) {
case FT_MSG: m_btnMsg.SetState(true); break;
case FT_MENU: m_btnMenu.SetState(true); break;
case FT_INFO: m_btnInfo.SetState(true); break;
}
if (options.clist_contact_name == CNNT_NICK)
m_btnNick.SetState(true);
else
m_btnName.SetState(true);
}
virtual void OnApply()
{
options.bLockHandle = m_btnLock.GetState() != 0;
options.bSuppressStatus = m_btnCheck.GetState() != 0;
if (m_btnUid.GetState()) options.menu_contact_label = DNT_UID;
else if (m_btnDid.GetState()) options.menu_contact_label = DNT_DID;
if (m_btnMsg.GetState()) options.menu_function = FT_MSG;
else if (m_btnMenu.GetState()) options.menu_function = FT_MENU;
else if (m_btnInfo.GetState()) options.menu_function = FT_INFO;
if (m_btnNick.GetState()) options.clist_contact_name = CNNT_NICK;
else if (m_btnName.GetState()) options.clist_contact_name = CNNT_DISPLAYNAME;
Meta_WriteOptions();
Meta_SuppressStatus(options.bSuppressStatus);
Meta_SetAllNicks();
}
};
/////////////////////////////////////////////////////////////////////////////////////////
int Meta_OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -790000000;
odp.flags = ODPF_BOLDGROUPS;
odp.pszTitle = LPGEN("Metacontacts");
odp.pszGroup = LPGEN("Contacts");
odp.pDialog = new CMetaOptionsDlg();
Options_AddPage(wParam, &odp);
return 0;
}
|