2 // This file is part of the aMule Project.
4 // Copyright (c) 2003-2008 Angel Vidal ( kry@amule.org )
5 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include <ec/cpp/ECTag.h> // Needed for CECTag
29 #include <ec/cpp/ECSpecialTags.h> // Needed for special EC tag creator classes
31 #include "Preferences.h"
34 CEC_Category_Tag::CEC_Category_Tag(uint32 cat_index
, EC_DETAIL_LEVEL detail_level
) : CECTag(EC_TAG_CATEGORY
, cat_index
)
36 Category_Struct
*cat
= theApp
->glob_prefs
->GetCategory(cat_index
);
37 switch (detail_level
) {
38 case EC_DETAIL_UPDATE
:
39 case EC_DETAIL_INC_UPDATE
:
42 AddTag(CECTag(EC_TAG_CATEGORY_PATH
, cat
->path
.GetRaw()));
43 AddTag(CECTag(EC_TAG_CATEGORY_COMMENT
, cat
->comment
));
44 AddTag(CECTag(EC_TAG_CATEGORY_COLOR
, (uint32
)cat
->color
));
45 AddTag(CECTag(EC_TAG_CATEGORY_PRIO
, cat
->prio
));
47 AddTag(CECTag(EC_TAG_CATEGORY_TITLE
, cat
->title
));
51 CEC_Category_Tag::CEC_Category_Tag(uint32 cat_index
, wxString name
, wxString path
,
52 wxString comment
, uint32 color
, uint8 prio
) : CECTag(EC_TAG_CATEGORY
, cat_index
)
54 AddTag(CECTag(EC_TAG_CATEGORY_PATH
, path
));
55 AddTag(CECTag(EC_TAG_CATEGORY_COMMENT
, comment
));
56 AddTag(CECTag(EC_TAG_CATEGORY_COLOR
, color
));
57 AddTag(CECTag(EC_TAG_CATEGORY_PRIO
, prio
));
58 AddTag(CECTag(EC_TAG_CATEGORY_TITLE
, name
));
61 void CEC_Category_Tag::Apply()
63 theApp
->glob_prefs
->UpdateCategory(GetInt(), Name(), CPath(Path()), Comment(), Color(), Prio());
66 void CEC_Category_Tag::Create()
68 theApp
->glob_prefs
->CreateCategory(Name(), CPath(Path()), Comment(), Color(), Prio());
71 CEC_Prefs_Packet::CEC_Prefs_Packet(uint32 selection
, EC_DETAIL_LEVEL pref_details
, EC_DETAIL_LEVEL cat_details
) : CECPacket(EC_OP_SET_PREFERENCES
, pref_details
)
73 if (selection
& EC_PREFS_CATEGORIES
) {
74 if (theApp
->glob_prefs
->GetCatCount() > 1) {
75 CECEmptyTag
cats(EC_TAG_PREFS_CATEGORIES
);
76 for (unsigned int i
= 0; i
< theApp
->glob_prefs
->GetCatCount(); ++i
) {
77 CEC_Category_Tag
catTag(i
, cat_details
);
84 if (selection
& EC_PREFS_GENERAL
) {
85 CECEmptyTag
user_prefs(EC_TAG_PREFS_GENERAL
);
86 user_prefs
.AddTag(CECTag(EC_TAG_USER_NICK
, thePrefs::GetUserNick()));
87 user_prefs
.AddTag(CECTag(EC_TAG_USER_HASH
, thePrefs::GetUserHash()));
88 user_prefs
.AddTag(CECTag(EC_TAG_USER_HOST
, thePrefs::GetYourHostname()));
92 if (selection
& EC_PREFS_CONNECTIONS
) {
93 CECEmptyTag
connPrefs(EC_TAG_PREFS_CONNECTIONS
);
94 connPrefs
.AddTag(CECTag(EC_TAG_CONN_UL_CAP
, thePrefs::GetMaxGraphUploadRate()));
95 connPrefs
.AddTag(CECTag(EC_TAG_CONN_DL_CAP
, thePrefs::GetMaxGraphDownloadRate()));
96 connPrefs
.AddTag(CECTag(EC_TAG_CONN_MAX_UL
, thePrefs::GetMaxUpload()));
97 connPrefs
.AddTag(CECTag(EC_TAG_CONN_MAX_DL
, thePrefs::GetMaxDownload()));
98 connPrefs
.AddTag(CECTag(EC_TAG_CONN_SLOT_ALLOCATION
, thePrefs::GetSlotAllocation()));
99 connPrefs
.AddTag(CECTag(EC_TAG_CONN_TCP_PORT
, thePrefs::GetPort()));
100 connPrefs
.AddTag(CECTag(EC_TAG_CONN_UDP_PORT
, thePrefs::GetUDPPort()));
101 if (thePrefs::IsUDPDisabled()) {
102 connPrefs
.AddTag(CECEmptyTag(EC_TAG_CONN_UDP_DISABLE
));
104 connPrefs
.AddTag(CECTag(EC_TAG_CONN_MAX_FILE_SOURCES
, thePrefs::GetMaxSourcePerFile()));
105 connPrefs
.AddTag(CECTag(EC_TAG_CONN_MAX_CONN
, thePrefs::GetMaxConnections()));
106 if (thePrefs::DoAutoConnect()) {
107 connPrefs
.AddTag(CECEmptyTag(EC_TAG_CONN_AUTOCONNECT
));
109 if (thePrefs::Reconnect()) {
110 connPrefs
.AddTag(CECEmptyTag(EC_TAG_CONN_RECONNECT
));
112 if (thePrefs::GetNetworkED2K()) {
113 connPrefs
.AddTag(CECEmptyTag(EC_TAG_NETWORK_ED2K
));
115 if (thePrefs::GetNetworkKademlia()) {
116 connPrefs
.AddTag(CECEmptyTag(EC_TAG_NETWORK_KADEMLIA
));
121 if (selection
& EC_PREFS_MESSAGEFILTER
) {
122 CECEmptyTag
msg_prefs(EC_TAG_PREFS_MESSAGEFILTER
);
123 if (thePrefs::MustFilterMessages()) {
124 msg_prefs
.AddTag(CECEmptyTag(EC_TAG_MSGFILTER_ENABLED
));
126 if (thePrefs::IsFilterAllMessages()) {
127 msg_prefs
.AddTag(CECEmptyTag(EC_TAG_MSGFILTER_ALL
));
129 if (thePrefs::MsgOnlyFriends()) {
130 msg_prefs
.AddTag(CECEmptyTag(EC_TAG_MSGFILTER_FRIENDS
));
132 if (thePrefs::MsgOnlySecure()) {
133 msg_prefs
.AddTag(CECEmptyTag(EC_TAG_MSGFILTER_SECURE
));
135 if (thePrefs::IsFilterByKeywords()) {
136 msg_prefs
.AddTag(CECEmptyTag(EC_TAG_MSGFILTER_BY_KEYWORD
));
138 msg_prefs
.AddTag(CECTag(EC_TAG_MSGFILTER_KEYWORDS
, thePrefs::GetMessageFilterString()));
142 if (selection
& EC_PREFS_REMOTECONTROLS
) {
143 CECEmptyTag
rc_prefs(EC_TAG_PREFS_REMOTECTRL
);
144 rc_prefs
.AddTag(CECTag(EC_TAG_WEBSERVER_PORT
, thePrefs::GetWSPort()));
145 if (thePrefs::GetWSIsEnabled()) {
146 rc_prefs
.AddTag(CECEmptyTag(EC_TAG_WEBSERVER_AUTORUN
));
148 if (!thePrefs::GetWSPass().IsEmpty()) {
150 wxCHECK2(passhash
.Decode(thePrefs::GetWSPass()), /* Do nothing. */);
151 rc_prefs
.AddTag(CECTag(EC_TAG_PASSWD_HASH
, passhash
));
153 if (thePrefs::GetWSIsLowUserEnabled()) {
154 CECEmptyTag
lowUser(EC_TAG_WEBSERVER_GUEST
);
155 if (!thePrefs::GetWSLowPass().IsEmpty()) {
157 wxCHECK2(passhash
.Decode(thePrefs::GetWSLowPass()), /* Do nothing. */);
158 lowUser
.AddTag(CECTag(EC_TAG_PASSWD_HASH
, passhash
));
160 rc_prefs
.AddTag(lowUser
);
162 if (thePrefs::GetWebUseGzip()) {
163 rc_prefs
.AddTag(CECEmptyTag(EC_TAG_WEBSERVER_USEGZIP
));
165 rc_prefs
.AddTag(CECTag(EC_TAG_WEBSERVER_REFRESH
, thePrefs::GetWebPageRefresh()));
166 rc_prefs
.AddTag(CECTag(EC_TAG_WEBSERVER_TEMPLATE
, thePrefs::GetWebTemplate()));
170 if (selection
& EC_PREFS_ONLINESIG
) {
171 CECEmptyTag
online_sig(EC_TAG_PREFS_ONLINESIG
);
172 if (thePrefs::IsOnlineSignatureEnabled()) {
173 online_sig
.AddTag(CECEmptyTag(EC_TAG_ONLINESIG_ENABLED
));
178 if (selection
& EC_PREFS_SERVERS
) {
179 CECEmptyTag
srv_prefs(EC_TAG_PREFS_SERVERS
);
180 if (thePrefs::DeadServer()) {
181 srv_prefs
.AddTag(CECEmptyTag(EC_TAG_SERVERS_REMOVE_DEAD
));
183 srv_prefs
.AddTag(CECTag(EC_TAG_SERVERS_DEAD_SERVER_RETRIES
, (uint16
)thePrefs::GetDeadserverRetries()));
184 if (thePrefs::AutoServerlist()) {
185 srv_prefs
.AddTag(CECEmptyTag(EC_TAG_SERVERS_AUTO_UPDATE
));
187 // Here should come the URL list...
188 if (thePrefs::AddServersFromServer()) {
189 srv_prefs
.AddTag(CECEmptyTag(EC_TAG_SERVERS_ADD_FROM_SERVER
));
191 if (thePrefs::AddServersFromClient()) {
192 srv_prefs
.AddTag(CECEmptyTag(EC_TAG_SERVERS_ADD_FROM_CLIENT
));
194 if (thePrefs::Score()) {
195 srv_prefs
.AddTag(CECEmptyTag(EC_TAG_SERVERS_USE_SCORE_SYSTEM
));
197 if (thePrefs::GetSmartIdCheck()) {
198 srv_prefs
.AddTag(CECEmptyTag(EC_TAG_SERVERS_SMART_ID_CHECK
));
200 if (thePrefs::IsSafeServerConnectEnabled()) {
201 srv_prefs
.AddTag(CECEmptyTag(EC_TAG_SERVERS_SAFE_SERVER_CONNECT
));
203 if (thePrefs::AutoConnectStaticOnly()) {
204 srv_prefs
.AddTag(CECEmptyTag(EC_TAG_SERVERS_AUTOCONN_STATIC_ONLY
));
206 if (thePrefs::IsManualHighPrio()) {
207 srv_prefs
.AddTag(CECEmptyTag(EC_TAG_SERVERS_MANUAL_HIGH_PRIO
));
209 srv_prefs
.AddTag(CECTag(EC_TAG_SERVERS_UPDATE_URL
, thePrefs::GetEd2kServersUrl()));
213 if (selection
& EC_PREFS_FILES
) {
214 CECEmptyTag
filePrefs(EC_TAG_PREFS_FILES
);
215 if (thePrefs::IsICHEnabled()) {
216 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_ICH_ENABLED
));
218 if (thePrefs::IsTrustingEveryHash()) {
219 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_AICH_TRUST
));
221 if (thePrefs::AddNewFilesPaused()) {
222 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_NEW_PAUSED
));
224 if (thePrefs::GetNewAutoDown()) {
225 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_NEW_AUTO_DL_PRIO
));
227 if (thePrefs::GetPreviewPrio()) {
228 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_PREVIEW_PRIO
));
230 if (thePrefs::GetNewAutoUp()) {
231 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_NEW_AUTO_UL_PRIO
));
233 if (thePrefs::TransferFullChunks()) {
234 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_UL_FULL_CHUNKS
));
236 if (thePrefs::StartNextFile()) {
237 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_START_NEXT_PAUSED
));
239 if (thePrefs::StartNextFileSame()) {
240 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_RESUME_SAME_CAT
));
242 if (thePrefs::GetSrcSeedsOn()) {
243 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_SAVE_SOURCES
));
245 if (thePrefs::GetExtractMetaData()) {
246 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_EXTRACT_METADATA
));
248 if (thePrefs::GetAllocFullFile()) {
249 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_ALLOC_FULL_SIZE
));
251 if (thePrefs::IsCheckDiskspaceEnabled()) {
252 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_CHECK_FREE_SPACE
));
254 filePrefs
.AddTag(CECTag(EC_TAG_FILES_MIN_FREE_SPACE
, thePrefs::GetMinFreeDiskSpaceMB()));
258 if (selection
& EC_PREFS_SRCDROP
) {
259 CECEmptyTag
srcdrop(EC_TAG_PREFS_SRCDROP
);
260 srcdrop
.AddTag(CECTag(EC_TAG_SRCDROP_NONEEDED
, (uint8
)thePrefs::GetNoNeededSources()));
261 if (thePrefs::DropFullQueueSources()) {
262 srcdrop
.AddTag(CECEmptyTag(EC_TAG_SRCDROP_DROP_FQS
));
264 if (thePrefs::DropHighQueueRankingSources()) {
265 srcdrop
.AddTag(CECEmptyTag(EC_TAG_SRCDROP_DROP_HQRS
));
267 srcdrop
.AddTag(CECTag(EC_TAG_SRCDROP_HQRS_VALUE
, (uint16
)thePrefs::HighQueueRanking()));
268 srcdrop
.AddTag(CECTag(EC_TAG_SRCDROP_AUTODROP_TIMER
, (uint16
)thePrefs::GetAutoDropTimer()));
272 if (selection
& EC_PREFS_DIRECTORIES
) {
276 if (selection
& EC_PREFS_STATISTICS
) {
280 if (selection
& EC_PREFS_SECURITY
) {
281 CECEmptyTag
secPrefs(EC_TAG_PREFS_SECURITY
);
282 secPrefs
.AddTag(CECTag(EC_TAG_SECURITY_CAN_SEE_SHARES
, thePrefs::CanSeeShares()));
283 if (thePrefs::IsFilteringClients()) {
284 secPrefs
.AddTag(CECEmptyTag(EC_TAG_IPFILTER_CLIENTS
));
286 if (thePrefs::IsFilteringServers()) {
287 secPrefs
.AddTag(CECEmptyTag(EC_TAG_IPFILTER_SERVERS
));
289 if (thePrefs::IPFilterAutoLoad()) {
290 secPrefs
.AddTag(CECEmptyTag(EC_TAG_IPFILTER_AUTO_UPDATE
));
292 secPrefs
.AddTag(CECTag(EC_TAG_IPFILTER_UPDATE_URL
, thePrefs::IPFilterURL()));
293 secPrefs
.AddTag(CECTag(EC_TAG_IPFILTER_LEVEL
, thePrefs::GetIPFilterLevel()));
294 if (thePrefs::FilterLanIPs()) {
295 secPrefs
.AddTag(CECEmptyTag(EC_TAG_IPFILTER_FILTER_LAN
));
297 if (thePrefs::IsSecureIdentEnabled()) {
298 secPrefs
.AddTag(CECEmptyTag(EC_TAG_SECURITY_USE_SECIDENT
));
301 if (thePrefs::IsClientCryptLayerSupported()) {
302 secPrefs
.AddTag(CECEmptyTag(EC_TAG_SECURITY_OBFUSCATION_SUPPORTED
));
304 if (thePrefs::IsClientCryptLayerRequested()) {
305 secPrefs
.AddTag(CECEmptyTag(EC_TAG_SECURITY_OBFUSCATION_REQUESTED
));
307 if (thePrefs::IsClientCryptLayerRequired()) {
308 secPrefs
.AddTag(CECEmptyTag(EC_TAG_SECURITY_OBFUSCATION_REQUIRED
));
314 if (selection
& EC_PREFS_CORETWEAKS
) {
315 CECEmptyTag
cwPrefs(EC_TAG_PREFS_CORETWEAKS
);
316 cwPrefs
.AddTag(CECTag(EC_TAG_CORETW_MAX_CONN_PER_FIVE
, thePrefs::GetMaxConperFive()));
317 if (thePrefs::GetVerbose()) {
318 cwPrefs
.AddTag(CECEmptyTag(EC_TAG_CORETW_VERBOSE
));
320 cwPrefs
.AddTag(CECTag(EC_TAG_CORETW_FILEBUFFER
, thePrefs::GetFileBufferSize()));
321 cwPrefs
.AddTag(CECTag(EC_TAG_CORETW_UL_QUEUE
, thePrefs::GetQueueSize()));
322 cwPrefs
.AddTag(CECTag(EC_TAG_CORETW_SRV_KEEPALIVE_TIMEOUT
, thePrefs::GetServerKeepAliveTimeout()));
326 if (selection
& EC_PREFS_KADEMLIA
) {
327 CECEmptyTag
kadPrefs(EC_TAG_PREFS_KADEMLIA
);
328 kadPrefs
.AddTag(CECTag(EC_TAG_KADEMLIA_UPDATE_URL
, thePrefs::GetKadNodesUrl()));
334 * Applies a boolean value from the set_preferences request
336 * @param use_tag If true, an unset variable means "leave unchanged". If false, an unset variable means false.
337 * @param thisTab The TAG that contains the TAG with a boolean value
338 * @param applyFunc The function to use for applying the value
339 * @param tagName The name of the TAG that holds the boolean value
341 void ApplyBoolean(bool use_tag
, const CECTag
*thisTab
, void (applyFunc
)(bool), int tagName
)
343 const CECTag
*boolTag
= thisTab
->GetTagByName(tagName
);
345 if (boolTag
!= NULL
) {
346 applyFunc(boolTag
->GetInt() != 0);
349 applyFunc(boolTag
!= NULL
);
354 * This will set all preferences except of categories, which are work as following:
355 * -> On remote gui they are loaded on startup, and then changed on-command
356 * -> Webserver doesn't supposed to change it.
358 void CEC_Prefs_Packet::Apply()
360 const CECTag
*thisTab
= NULL
;
361 const CECTag
*oneTag
= NULL
;
363 if ((thisTab
= GetTagByName(EC_TAG_PREFS_GENERAL
)) != NULL
) {
364 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_USER_NICK
)) != NULL
) {
365 thePrefs::SetUserNick(oneTag
->GetStringData());
367 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_USER_HASH
)) != NULL
) {
368 thePrefs::SetUserHash(oneTag
->GetMD4Data());
370 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_USER_HOST
)) != NULL
) {
371 thePrefs::SetYourHostname(oneTag
->GetStringData());
376 // webserver doesn't transmit all boolean values
378 bool use_tag
= (GetDetailLevel() == EC_DETAIL_FULL
);
380 if ((thisTab
= GetTagByName(EC_TAG_PREFS_CONNECTIONS
)) != NULL
) {
381 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_UL_CAP
)) != NULL
) {
382 thePrefs::SetMaxGraphUploadRate(oneTag
->GetInt());
384 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_DL_CAP
)) != NULL
) {
385 thePrefs::SetMaxGraphDownloadRate(oneTag
->GetInt());
387 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_MAX_UL
)) != NULL
) {
388 thePrefs::SetMaxUpload(oneTag
->GetInt());
390 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_MAX_DL
)) != NULL
) {
391 thePrefs::SetMaxDownload(oneTag
->GetInt());
393 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_SLOT_ALLOCATION
)) != NULL
) {
394 thePrefs::SetSlotAllocation(oneTag
->GetInt());
396 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_TCP_PORT
)) != NULL
) {
397 thePrefs::SetPort(oneTag
->GetInt());
399 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_UDP_PORT
)) != NULL
) {
400 thePrefs::SetUDPPort(oneTag
->GetInt());
402 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetUDPDisable
, EC_TAG_CONN_UDP_DISABLE
);
403 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_MAX_FILE_SOURCES
)) != NULL
) {
404 thePrefs::SetMaxSourcesPerFile(oneTag
->GetInt());
406 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_MAX_CONN
)) != NULL
) {
407 thePrefs::SetMaxConnections(oneTag
->GetInt());
409 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAutoConnect
, EC_TAG_CONN_AUTOCONNECT
);
410 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetReconnect
, EC_TAG_CONN_RECONNECT
);
411 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetNetworkED2K
, EC_TAG_NETWORK_ED2K
);
412 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetNetworkKademlia
, EC_TAG_NETWORK_KADEMLIA
);
415 if ((thisTab
= GetTagByName(EC_TAG_PREFS_MESSAGEFILTER
)) != NULL
) {
416 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetMustFilterMessages
, EC_TAG_MSGFILTER_ENABLED
);
417 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetFilterAllMessages
, EC_TAG_MSGFILTER_ALL
);
418 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetMsgOnlyFriends
, EC_TAG_MSGFILTER_FRIENDS
);
419 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetMsgOnlySecure
, EC_TAG_MSGFILTER_SECURE
);
420 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetFilterByKeywords
, EC_TAG_MSGFILTER_BY_KEYWORD
);
421 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_MSGFILTER_KEYWORDS
)) != NULL
) {
422 thePrefs::SetMessageFilterString(oneTag
->GetStringData());
426 if ((thisTab
= GetTagByName(EC_TAG_PREFS_REMOTECTRL
)) != NULL
) {
427 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetWSIsEnabled
, EC_TAG_WEBSERVER_AUTORUN
);
428 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_WEBSERVER_PORT
)) != NULL
) {
429 thePrefs::SetWSPort(oneTag
->GetInt());
431 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_PASSWD_HASH
)) != NULL
) {
432 thePrefs::SetWSPass(oneTag
->GetMD4Data().Encode());
434 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetWSIsLowUserEnabled
, EC_TAG_WEBSERVER_GUEST
);
435 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_WEBSERVER_GUEST
)) != NULL
) {
436 if ((oneTag
->GetTagByName(EC_TAG_PASSWD_HASH
)) != NULL
) {
437 thePrefs::SetWSLowPass(oneTag
->GetTagByName(EC_TAG_PASSWD_HASH
)->GetMD4Data().Encode());
440 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetWebUseGzip
, EC_TAG_WEBSERVER_USEGZIP
);
441 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_WEBSERVER_REFRESH
)) != NULL
) {
442 thePrefs::SetWebPageRefresh(oneTag
->GetInt());
444 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_WEBSERVER_TEMPLATE
)) != NULL
) {
445 thePrefs::SetWebTemplate(oneTag
->GetStringData());
449 if ((thisTab
= GetTagByName(EC_TAG_PREFS_ONLINESIG
)) != NULL
) {
450 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetOnlineSignatureEnabled
, EC_TAG_ONLINESIG_ENABLED
);
453 if ((thisTab
= GetTagByName(EC_TAG_PREFS_SERVERS
)) != NULL
) {
454 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetDeadServer
, EC_TAG_SERVERS_REMOVE_DEAD
);
455 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_SERVERS_DEAD_SERVER_RETRIES
)) != NULL
) {
456 thePrefs::SetDeadserverRetries(oneTag
->GetInt());
458 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAutoServerlist
, EC_TAG_SERVERS_AUTO_UPDATE
);
459 // Here should come the URL list...
460 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAddServersFromServer
, EC_TAG_SERVERS_ADD_FROM_SERVER
);
461 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAddServersFromClient
, EC_TAG_SERVERS_ADD_FROM_CLIENT
);
462 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetScoreSystem
, EC_TAG_SERVERS_USE_SCORE_SYSTEM
);
463 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetSmartIdCheck
, EC_TAG_SERVERS_SMART_ID_CHECK
);
464 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetSafeServerConnectEnabled
, EC_TAG_SERVERS_SAFE_SERVER_CONNECT
);
465 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAutoConnectStaticOnly
, EC_TAG_SERVERS_AUTOCONN_STATIC_ONLY
);
466 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetManualHighPrio
, EC_TAG_SERVERS_MANUAL_HIGH_PRIO
);
467 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_SERVERS_UPDATE_URL
)) != NULL
) {
468 thePrefs::SetEd2kServersUrl(oneTag
->GetStringData());
472 if ((thisTab
= GetTagByName(EC_TAG_PREFS_FILES
)) != NULL
) {
473 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetICHEnabled
, EC_TAG_FILES_ICH_ENABLED
);
474 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetTrustingEveryHash
, EC_TAG_FILES_AICH_TRUST
);
475 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAddNewFilesPaused
, EC_TAG_FILES_NEW_PAUSED
);
476 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetNewAutoDown
, EC_TAG_FILES_NEW_AUTO_DL_PRIO
);
477 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetPreviewPrio
, EC_TAG_FILES_PREVIEW_PRIO
);
478 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetNewAutoUp
, EC_TAG_FILES_NEW_AUTO_UL_PRIO
);
479 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetTransferFullChunks
, EC_TAG_FILES_UL_FULL_CHUNKS
);
480 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetStartNextFile
, EC_TAG_FILES_START_NEXT_PAUSED
);
481 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetStartNextFileSame
, EC_TAG_FILES_RESUME_SAME_CAT
);
482 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetSrcSeedsOn
, EC_TAG_FILES_SAVE_SOURCES
);
483 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetExtractMetaData
, EC_TAG_FILES_EXTRACT_METADATA
);
484 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAllocFullFile
, EC_TAG_FILES_ALLOC_FULL_SIZE
);
485 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetCheckDiskspaceEnabled
, EC_TAG_FILES_CHECK_FREE_SPACE
);
486 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_FILES_MIN_FREE_SPACE
)) != NULL
) {
487 thePrefs::SetMinFreeDiskSpaceMB(oneTag
->GetInt());
491 if ((thisTab
= GetTagByName(EC_TAG_PREFS_SRCDROP
)) != NULL
) {
492 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_SRCDROP_NONEEDED
)) != NULL
) {
493 thePrefs::SetNoNeededSources(oneTag
->GetInt());
495 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetDropFullQueueSources
, EC_TAG_SRCDROP_DROP_FQS
);
496 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetDropHighQueueRankingSources
, EC_TAG_SRCDROP_DROP_HQRS
);
497 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_SRCDROP_HQRS_VALUE
)) != NULL
) {
498 thePrefs::SetHighQueueRanking(oneTag
->GetInt());
500 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_SRCDROP_AUTODROP_TIMER
)) != NULL
) {
501 thePrefs::SetAutoDropTimer(oneTag
->GetInt());
505 if ((thisTab
= GetTagByName(EC_TAG_PREFS_DIRECTORIES
)) != NULL
) {
509 if ((thisTab
= GetTagByName(EC_TAG_PREFS_STATISTICS
)) != NULL
) {
513 if ((thisTab
= GetTagByName(EC_TAG_PREFS_SECURITY
)) != NULL
) {
514 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_SECURITY_CAN_SEE_SHARES
)) != NULL
) {
515 thePrefs::SetCanSeeShares(oneTag
->GetInt());
517 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetFilteringClients
, EC_TAG_IPFILTER_CLIENTS
);
518 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetFilteringServers
, EC_TAG_IPFILTER_SERVERS
);
519 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetIPFilterAutoLoad
, EC_TAG_IPFILTER_AUTO_UPDATE
);
520 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_IPFILTER_UPDATE_URL
)) != NULL
) {
521 thePrefs::SetIPFilterURL(oneTag
->GetStringData());
523 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_IPFILTER_LEVEL
)) != NULL
) {
524 thePrefs::SetIPFilterLevel(oneTag
->GetInt());
526 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetFilterLanIPs
, EC_TAG_IPFILTER_FILTER_LAN
);
527 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetSecureIdentEnabled
, EC_TAG_SECURITY_USE_SECIDENT
);
529 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetClientCryptLayerSupported
, EC_TAG_SECURITY_OBFUSCATION_SUPPORTED
);
530 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetClientCryptLayerRequested
, EC_TAG_SECURITY_OBFUSCATION_REQUESTED
);
531 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetClientCryptLayerRequired
, EC_TAG_SECURITY_OBFUSCATION_REQUIRED
);
534 if ((thisTab
= GetTagByName(EC_TAG_PREFS_CORETWEAKS
)) != NULL
) {
535 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CORETW_MAX_CONN_PER_FIVE
)) != NULL
) {
536 thePrefs::SetMaxConsPerFive(oneTag
->GetInt());
538 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetVerbose
, EC_TAG_CORETW_VERBOSE
);
539 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CORETW_FILEBUFFER
)) != NULL
) {
540 thePrefs::SetFileBufferSize(oneTag
->GetInt());
542 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CORETW_UL_QUEUE
)) != NULL
) {
543 thePrefs::SetQueueSize(oneTag
->GetInt());
545 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CORETW_SRV_KEEPALIVE_TIMEOUT
)) != NULL
) {
546 thePrefs::SetServerKeepAliveTimeout(oneTag
->GetInt());
550 if ((thisTab
= GetTagByName(EC_TAG_PREFS_KADEMLIA
)) != NULL
) {
551 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_KADEMLIA_UPDATE_URL
)) != NULL
) {
552 thePrefs::SetKadNodesUrl(oneTag
->GetStringData());
556 theApp
->glob_prefs
->Save();
558 // File_checked_for_headers