2 // This file is part of the aMule Project.
4 // Copyright (c) 2003-2008 Kry ( elkry@sourceforge.net / http://www.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::GetAllocFullChunk()) {
249 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_ALLOC_FULL_CHUNKS
));
251 if (thePrefs::GetAllocFullPart()) {
252 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_ALLOC_FULL_SIZE
));
254 if (thePrefs::IsCheckDiskspaceEnabled()) {
255 filePrefs
.AddTag(CECEmptyTag(EC_TAG_FILES_CHECK_FREE_SPACE
));
257 filePrefs
.AddTag(CECTag(EC_TAG_FILES_MIN_FREE_SPACE
, thePrefs::GetMinFreeDiskSpace()));
261 if (selection
& EC_PREFS_SRCDROP
) {
262 CECEmptyTag
srcdrop(EC_TAG_PREFS_SRCDROP
);
263 srcdrop
.AddTag(CECTag(EC_TAG_SRCDROP_NONEEDED
, (uint8
)thePrefs::GetNoNeededSources()));
264 if (thePrefs::DropFullQueueSources()) {
265 srcdrop
.AddTag(CECEmptyTag(EC_TAG_SRCDROP_DROP_FQS
));
267 if (thePrefs::DropHighQueueRankingSources()) {
268 srcdrop
.AddTag(CECEmptyTag(EC_TAG_SRCDROP_DROP_HQRS
));
270 srcdrop
.AddTag(CECTag(EC_TAG_SRCDROP_HQRS_VALUE
, (uint16
)thePrefs::HighQueueRanking()));
271 srcdrop
.AddTag(CECTag(EC_TAG_SRCDROP_AUTODROP_TIMER
, (uint16
)thePrefs::GetAutoDropTimer()));
275 if (selection
& EC_PREFS_DIRECTORIES
) {
279 if (selection
& EC_PREFS_STATISTICS
) {
283 if (selection
& EC_PREFS_SECURITY
) {
284 CECEmptyTag
secPrefs(EC_TAG_PREFS_SECURITY
);
285 secPrefs
.AddTag(CECTag(EC_TAG_SECURITY_CAN_SEE_SHARES
, thePrefs::CanSeeShares()));
286 if (thePrefs::IsFilteringClients()) {
287 secPrefs
.AddTag(CECEmptyTag(EC_TAG_IPFILTER_CLIENTS
));
289 if (thePrefs::IsFilteringServers()) {
290 secPrefs
.AddTag(CECEmptyTag(EC_TAG_IPFILTER_SERVERS
));
292 if (thePrefs::IPFilterAutoLoad()) {
293 secPrefs
.AddTag(CECEmptyTag(EC_TAG_IPFILTER_AUTO_UPDATE
));
295 secPrefs
.AddTag(CECTag(EC_TAG_IPFILTER_UPDATE_URL
, thePrefs::IPFilterURL()));
296 secPrefs
.AddTag(CECTag(EC_TAG_IPFILTER_LEVEL
, thePrefs::GetIPFilterLevel()));
297 if (thePrefs::FilterLanIPs()) {
298 secPrefs
.AddTag(CECEmptyTag(EC_TAG_IPFILTER_FILTER_LAN
));
300 if (thePrefs::IsSecureIdentEnabled()) {
301 secPrefs
.AddTag(CECEmptyTag(EC_TAG_SECURITY_USE_SECIDENT
));
304 if (thePrefs::IsClientCryptLayerSupported()) {
305 secPrefs
.AddTag(CECEmptyTag(EC_TAG_SECURITY_OBFUSCATION_SUPPORTED
));
307 if (thePrefs::IsClientCryptLayerRequested()) {
308 secPrefs
.AddTag(CECEmptyTag(EC_TAG_SECURITY_OBFUSCATION_REQUESTED
));
310 if (thePrefs::IsClientCryptLayerRequired()) {
311 secPrefs
.AddTag(CECEmptyTag(EC_TAG_SECURITY_OBFUSCATION_REQUIRED
));
317 if (selection
& EC_PREFS_CORETWEAKS
) {
318 CECEmptyTag
cwPrefs(EC_TAG_PREFS_CORETWEAKS
);
319 cwPrefs
.AddTag(CECTag(EC_TAG_CORETW_MAX_CONN_PER_FIVE
, thePrefs::GetMaxConperFive()));
320 if (thePrefs::GetVerbose()) {
321 cwPrefs
.AddTag(CECEmptyTag(EC_TAG_CORETW_VERBOSE
));
323 cwPrefs
.AddTag(CECTag(EC_TAG_CORETW_FILEBUFFER
, thePrefs::GetFileBufferSize()));
324 cwPrefs
.AddTag(CECTag(EC_TAG_CORETW_UL_QUEUE
, thePrefs::GetQueueSize()));
325 cwPrefs
.AddTag(CECTag(EC_TAG_CORETW_SRV_KEEPALIVE_TIMEOUT
, thePrefs::GetServerKeepAliveTimeout()));
329 if (selection
& EC_PREFS_KADEMLIA
) {
330 CECEmptyTag
kadPrefs(EC_TAG_PREFS_KADEMLIA
);
331 kadPrefs
.AddTag(CECTag(EC_TAG_KADEMLIA_UPDATE_URL
, thePrefs::GetKadNodesUrl()));
337 * Applies a boolean value from the set_preferences request
339 * @param use_tag If true, an unset variable means "leave unchanged". If false, an unset variable means false.
340 * @param thisTab The TAG that contains the TAG with a boolean value
341 * @param applyFunc The function to use for applying the value
342 * @param tagName The name of the TAG that holds the boolean value
344 void ApplyBoolean(bool use_tag
, const CECTag
*thisTab
, void (applyFunc
)(bool), int tagName
)
346 const CECTag
*boolTag
= thisTab
->GetTagByName(tagName
);
348 if (boolTag
!= NULL
) {
349 applyFunc(boolTag
->GetInt() != 0);
352 applyFunc(boolTag
!= NULL
);
357 * This will set all preferences except of categories, which are work as following:
358 * -> On remote gui they are loaded on startup, and then changed on-command
359 * -> Webserver doesn't supposed to change it.
361 void CEC_Prefs_Packet::Apply()
363 const CECTag
*thisTab
= NULL
;
364 const CECTag
*oneTag
= NULL
;
366 if ((thisTab
= GetTagByName(EC_TAG_PREFS_GENERAL
)) != NULL
) {
367 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_USER_NICK
)) != NULL
) {
368 thePrefs::SetUserNick(oneTag
->GetStringData());
370 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_USER_HASH
)) != NULL
) {
371 thePrefs::SetUserHash(oneTag
->GetMD4Data());
373 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_USER_HOST
)) != NULL
) {
374 thePrefs::SetYourHostname(oneTag
->GetStringData());
379 // webserver doesn't transmit all boolean values
381 bool use_tag
= (GetDetailLevel() == EC_DETAIL_FULL
);
383 if ((thisTab
= GetTagByName(EC_TAG_PREFS_CONNECTIONS
)) != NULL
) {
384 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_UL_CAP
)) != NULL
) {
385 thePrefs::SetMaxGraphUploadRate(oneTag
->GetInt());
387 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_DL_CAP
)) != NULL
) {
388 thePrefs::SetMaxGraphDownloadRate(oneTag
->GetInt());
390 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_MAX_UL
)) != NULL
) {
391 thePrefs::SetMaxUpload(oneTag
->GetInt());
393 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_MAX_DL
)) != NULL
) {
394 thePrefs::SetMaxDownload(oneTag
->GetInt());
396 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_SLOT_ALLOCATION
)) != NULL
) {
397 thePrefs::SetSlotAllocation(oneTag
->GetInt());
399 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_TCP_PORT
)) != NULL
) {
400 thePrefs::SetPort(oneTag
->GetInt());
402 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_UDP_PORT
)) != NULL
) {
403 thePrefs::SetUDPPort(oneTag
->GetInt());
405 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetUDPDisable
, EC_TAG_CONN_UDP_DISABLE
);
406 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_MAX_FILE_SOURCES
)) != NULL
) {
407 thePrefs::SetMaxSourcesPerFile(oneTag
->GetInt());
409 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CONN_MAX_CONN
)) != NULL
) {
410 thePrefs::SetMaxConnections(oneTag
->GetInt());
412 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAutoConnect
, EC_TAG_CONN_AUTOCONNECT
);
413 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetReconnect
, EC_TAG_CONN_RECONNECT
);
414 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetNetworkED2K
, EC_TAG_NETWORK_ED2K
);
415 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetNetworkKademlia
, EC_TAG_NETWORK_KADEMLIA
);
418 if ((thisTab
= GetTagByName(EC_TAG_PREFS_MESSAGEFILTER
)) != NULL
) {
419 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetMustFilterMessages
, EC_TAG_MSGFILTER_ENABLED
);
420 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetFilterAllMessages
, EC_TAG_MSGFILTER_ALL
);
421 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetMsgOnlyFriends
, EC_TAG_MSGFILTER_FRIENDS
);
422 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetMsgOnlySecure
, EC_TAG_MSGFILTER_SECURE
);
423 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetFilterByKeywords
, EC_TAG_MSGFILTER_BY_KEYWORD
);
424 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_MSGFILTER_KEYWORDS
)) != NULL
) {
425 thePrefs::SetMessageFilterString(oneTag
->GetStringData());
429 if ((thisTab
= GetTagByName(EC_TAG_PREFS_REMOTECTRL
)) != NULL
) {
430 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetWSIsEnabled
, EC_TAG_WEBSERVER_AUTORUN
);
431 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_WEBSERVER_PORT
)) != NULL
) {
432 thePrefs::SetWSPort(oneTag
->GetInt());
434 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_PASSWD_HASH
)) != NULL
) {
435 thePrefs::SetWSPass(oneTag
->GetMD4Data().Encode());
437 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetWSIsLowUserEnabled
, EC_TAG_WEBSERVER_GUEST
);
438 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_WEBSERVER_GUEST
)) != NULL
) {
439 if ((oneTag
->GetTagByName(EC_TAG_PASSWD_HASH
)) != NULL
) {
440 thePrefs::SetWSLowPass(oneTag
->GetTagByName(EC_TAG_PASSWD_HASH
)->GetMD4Data().Encode());
443 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetWebUseGzip
, EC_TAG_WEBSERVER_USEGZIP
);
444 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_WEBSERVER_REFRESH
)) != NULL
) {
445 thePrefs::SetWebPageRefresh(oneTag
->GetInt());
447 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_WEBSERVER_TEMPLATE
)) != NULL
) {
448 thePrefs::SetWebTemplate(oneTag
->GetStringData());
452 if ((thisTab
= GetTagByName(EC_TAG_PREFS_ONLINESIG
)) != NULL
) {
453 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetOnlineSignatureEnabled
, EC_TAG_ONLINESIG_ENABLED
);
456 if ((thisTab
= GetTagByName(EC_TAG_PREFS_SERVERS
)) != NULL
) {
457 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetDeadServer
, EC_TAG_SERVERS_REMOVE_DEAD
);
458 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_SERVERS_DEAD_SERVER_RETRIES
)) != NULL
) {
459 thePrefs::SetDeadserverRetries(oneTag
->GetInt());
461 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAutoServerlist
, EC_TAG_SERVERS_AUTO_UPDATE
);
462 // Here should come the URL list...
463 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAddServersFromServer
, EC_TAG_SERVERS_ADD_FROM_SERVER
);
464 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAddServersFromClient
, EC_TAG_SERVERS_ADD_FROM_CLIENT
);
465 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetScoreSystem
, EC_TAG_SERVERS_USE_SCORE_SYSTEM
);
466 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetSmartIdCheck
, EC_TAG_SERVERS_SMART_ID_CHECK
);
467 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetSafeServerConnectEnabled
, EC_TAG_SERVERS_SAFE_SERVER_CONNECT
);
468 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAutoConnectStaticOnly
, EC_TAG_SERVERS_AUTOCONN_STATIC_ONLY
);
469 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetManualHighPrio
, EC_TAG_SERVERS_MANUAL_HIGH_PRIO
);
470 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_SERVERS_UPDATE_URL
)) != NULL
) {
471 thePrefs::SetEd2kServersUrl(oneTag
->GetStringData());
475 if ((thisTab
= GetTagByName(EC_TAG_PREFS_FILES
)) != NULL
) {
476 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetICHEnabled
, EC_TAG_FILES_ICH_ENABLED
);
477 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetTrustingEveryHash
, EC_TAG_FILES_AICH_TRUST
);
478 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAddNewFilesPaused
, EC_TAG_FILES_NEW_PAUSED
);
479 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetNewAutoDown
, EC_TAG_FILES_NEW_AUTO_DL_PRIO
);
480 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetPreviewPrio
, EC_TAG_FILES_PREVIEW_PRIO
);
481 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetNewAutoUp
, EC_TAG_FILES_NEW_AUTO_UL_PRIO
);
482 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetTransferFullChunks
, EC_TAG_FILES_UL_FULL_CHUNKS
);
483 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetStartNextFile
, EC_TAG_FILES_START_NEXT_PAUSED
);
484 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetStartNextFileSame
, EC_TAG_FILES_RESUME_SAME_CAT
);
485 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetSrcSeedsOn
, EC_TAG_FILES_SAVE_SOURCES
);
486 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetExtractMetaData
, EC_TAG_FILES_EXTRACT_METADATA
);
487 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAllocFullChunk
, EC_TAG_FILES_ALLOC_FULL_CHUNKS
);
488 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetAllocFullPart
, EC_TAG_FILES_ALLOC_FULL_SIZE
);
489 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetCheckDiskspaceEnabled
, EC_TAG_FILES_CHECK_FREE_SPACE
);
490 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_FILES_MIN_FREE_SPACE
)) != NULL
) {
491 thePrefs::SetMinFreeDiskSpace(oneTag
->GetInt());
495 if ((thisTab
= GetTagByName(EC_TAG_PREFS_SRCDROP
)) != NULL
) {
496 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_SRCDROP_NONEEDED
)) != NULL
) {
497 thePrefs::SetNoNeededSources(oneTag
->GetInt());
499 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetDropFullQueueSources
, EC_TAG_SRCDROP_DROP_FQS
);
500 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetDropHighQueueRankingSources
, EC_TAG_SRCDROP_DROP_HQRS
);
501 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_SRCDROP_HQRS_VALUE
)) != NULL
) {
502 thePrefs::SetHighQueueRanking(oneTag
->GetInt());
504 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_SRCDROP_AUTODROP_TIMER
)) != NULL
) {
505 thePrefs::SetAutoDropTimer(oneTag
->GetInt());
509 if ((thisTab
= GetTagByName(EC_TAG_PREFS_DIRECTORIES
)) != NULL
) {
513 if ((thisTab
= GetTagByName(EC_TAG_PREFS_STATISTICS
)) != NULL
) {
517 if ((thisTab
= GetTagByName(EC_TAG_PREFS_SECURITY
)) != NULL
) {
518 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_SECURITY_CAN_SEE_SHARES
)) != NULL
) {
519 thePrefs::SetCanSeeShares(oneTag
->GetInt());
521 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetFilteringClients
, EC_TAG_IPFILTER_CLIENTS
);
522 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetFilteringServers
, EC_TAG_IPFILTER_SERVERS
);
523 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetIPFilterAutoLoad
, EC_TAG_IPFILTER_AUTO_UPDATE
);
524 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_IPFILTER_UPDATE_URL
)) != NULL
) {
525 thePrefs::SetIPFilterURL(oneTag
->GetStringData());
527 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_IPFILTER_LEVEL
)) != NULL
) {
528 thePrefs::SetIPFilterLevel(oneTag
->GetInt());
530 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetFilterLanIPs
, EC_TAG_IPFILTER_FILTER_LAN
);
531 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetSecureIdentEnabled
, EC_TAG_SECURITY_USE_SECIDENT
);
533 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetClientCryptLayerSupported
, EC_TAG_SECURITY_OBFUSCATION_SUPPORTED
);
534 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetClientCryptLayerRequested
, EC_TAG_SECURITY_OBFUSCATION_REQUESTED
);
535 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetClientCryptLayerRequired
, EC_TAG_SECURITY_OBFUSCATION_REQUIRED
);
538 if ((thisTab
= GetTagByName(EC_TAG_PREFS_CORETWEAKS
)) != NULL
) {
539 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CORETW_MAX_CONN_PER_FIVE
)) != NULL
) {
540 thePrefs::SetMaxConsPerFive(oneTag
->GetInt());
542 ApplyBoolean(use_tag
, thisTab
, thePrefs::SetVerbose
, EC_TAG_CORETW_VERBOSE
);
543 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CORETW_FILEBUFFER
)) != NULL
) {
544 thePrefs::SetFileBufferSize(oneTag
->GetInt());
546 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CORETW_UL_QUEUE
)) != NULL
) {
547 thePrefs::SetQueueSize(oneTag
->GetInt());
549 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_CORETW_SRV_KEEPALIVE_TIMEOUT
)) != NULL
) {
550 thePrefs::SetServerKeepAliveTimeout(oneTag
->GetInt());
554 if ((thisTab
= GetTagByName(EC_TAG_PREFS_KADEMLIA
)) != NULL
) {
555 if ((oneTag
= thisTab
->GetTagByName(EC_TAG_KADEMLIA_UPDATE_URL
)) != NULL
) {
556 thePrefs::SetKadNodesUrl(oneTag
->GetStringData());
560 theApp
->glob_prefs
->Save();
562 // File_checked_for_headers