// PPgAckronic.cpp : implementation file
//
#include "stdafx.h"
#include "emule.h"
#include "PPgAckronic.h"
#include "Preferences.h"
#include "otherfunctions.h"
#include "UserMsgs.h"
#include "PreferencesDlg.h"
#include "opcodes.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

// CPPgAckronic dialog

IMPLEMENT_DYNAMIC(CPPgAckronic, CPropertyPage)

BEGIN_MESSAGE_MAP(CPPgAckronic, CPropertyPage)
	ON_WM_HSCROLL()	
	 ON_MESSAGE(UM_TREEOPTSCTRL_NOTIFY, OnTreeOptsCtrlNotify)
	ON_WM_DESTROY()
END_MESSAGE_MAP()

CPPgAckronic::CPPgAckronic()
	: CPropertyPage(CPPgAckronic::IDD)
	, m_ctrlTreeOptions(theApp.m_iDfltImageListColorFlags)
{
	
	//Ackronic START - Aggiunto da Aenarion[ITA] - Emulate
	m_htiEmulator = NULL;
	m_htiEnableMLDonkey = NULL;
	m_htiEnableeDonkey = NULL;
	m_htiEnableeDonkeyHybrid = NULL;
	m_htiEnableShareaza = NULL;
	m_htiEmuLphant = NULL;
	m_htiLogEmulator = NULL;
	//Ackronic END - Aggiunto da Aenarion[ITA] - Emulate

	//Ackronic START - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client
	m_htiEnableDownloadInBlue = NULL; 
	m_htiEnableUploadInBlue = NULL;
	m_htiEnableDownloadInBold = NULL; 
	m_htiShowClientPercentage = NULL;
	//Ackronic END - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client

	// NEO: QS - [QuickStart]
		m_htiQuickStart = NULL;
			m_htiQuickStartEnable = NULL;
			m_htiQuickStartTime = NULL;
			//m_htiQuickStartTimePerFile = NULL;
			m_htiQuickMaxConperFive = NULL;
			m_htiQuickMaxHalfOpen = NULL;
			m_htiQuickMaxConnections = NULL;
		// NEO: QS END


	// [ReaskOnIDChange]
	m_htiOnIDChange = NULL;
		m_htiInformOnIPChange = NULL;
		m_htiReAskOnIPChange = NULL;
		m_htiQuickStartOnIPChange = NULL; // NEO: QS - [QuickStart]
		//m_htiCheckL2HIDChange = NULL;
		m_htiReconnectKadOnIPChange = NULL;
		m_htiRebindSocketsOnIPChange = NULL;
	// RIC END

	//Ackronic START - Aggiunto da Aenarion[ITA] - Drop
	m_htiDropSources = NULL;
	m_htiDropSourcesTimerNNS = NULL;
	m_htiDropSourcesTimerFQ = NULL;
	m_htiDropSourcesTimerHQR = NULL;
	m_htiDropSourcesNNS = NULL;
	m_htiDropSourcesFQ = NULL;
	m_htiDropSourcesHQR = NULL;
    m_htiHqrBox = NULL;
	//Ackronic END - Aggiunto da Aenarion[ITA] - Drop

	//MORPH START - Added by SiRoB, khaos::categorymod+
	m_htiShowCatNames = NULL;
	m_htiSelectCat = NULL;
	m_htiUseActiveCat = NULL;
	m_htiAutoSetResOrder = NULL;
	m_htiShowA4AFDebugOutput = NULL;
	m_htiSmartA4AFSwapping = NULL;
	m_htiAdvA4AFMode = NULL;
	m_htiBalanceSources = NULL;
	m_htiStackSources = NULL;
	m_htiDisableAdvA4AF = NULL;
	m_htiSmallFileDLPush = NULL;
	m_htiResumeFileInNewCat = NULL;
	m_htiUseAutoCat = NULL;
	//Ackronic END - Aggiunto da Aenarion[ITA] - A4AF

	// ==> Sivka-Ban - Stulle
	m_htiSivkaBanGroup = NULL;
	m_htiEnableSivkaBan = NULL;
	m_htiSivkaAskTime = NULL;
	m_htiSivkaAskCounter = NULL;
	m_htiSivkaAskLog = NULL;
	// <== Sivka-Ban - Stulle
	// ==> ban systems optional - Stulle
	m_htiAntiLeecherGroup = NULL;
	m_htiEnableAntiLeecher = NULL; //MORPH - Added by IceCream, activate Anti-leecher
	m_htiBadModString = NULL;
	m_htiBadNickBan = NULL;
	//m_htiGhostMod = NULL;
	//m_htiAntiModIdFaker = NULL;
	m_htiAntiNickThief = NULL; // AntiNickThief - Stulle
	m_htiEmptyNick = NULL;
	m_htiFakeEmule = NULL;
	//m_htiHiddenStr = NULL;
	m_htiLeecherName = NULL;
	m_htiCommunityCheck = NULL;
	// <== ban systems optional - Stulle
	m_htiEnableAntiCreditHack = NULL; //MORPH - Added by IceCream, activate Anti-CreditHack
	m_htiAntiXsExploiter = NULL; // Anti-XS-Exploit [Xman] - Stulle
	m_htiSpamBan = NULL; // Spam Ban [Xman] - Stulle
	m_htiClientBanTime = NULL; // adjust ClientBanTime - Stulle

	m_bInitializedTreeOpts = false;
}

CPPgAckronic::~CPPgAckronic()
{
}

void CPPgAckronic::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_ACK_OPTS, m_ctrlTreeOptions);
	if (!m_bInitializedTreeOpts)
	{
		int iImgSecu = 8;
		int iImgEmulator = 8;//Ackronic - Aggiunto da Aenarion[ITA] - Emulate
		int iImgDisp = 8;//Ackronic - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client
		int iImgDrop = 8;//Ackronic - Aggiunto da Aenarion[ITA] - Drop
		//MORPH START - Added by SiRoB, khaos::categorymod+
		int iImgDM = 8;
		int iImgSCC = 8;
		int iImgSAC = 8;
		int iImgA4AF = 8;
		//MORPH END - Added by SiRoB, khaos::categorymod+
		int iLmgQS = 8;// NEO: QS - [QuickStart]
		int iLmgRT = 8;// NEO: RIC - [ReaskOnIDChange]
		CImageList* piml = m_ctrlTreeOptions.GetImageList(TVSIL_NORMAL);
		if (piml){
					iImgSecu = piml->Add(CTempIconLoader(_T("SECURITY")));
					iImgEmulator = piml->Add(CTempIconLoader(_T("EMULATE")));//Ackronic - Aggiunto da Aenarion[ITA] - Emulate	
					iImgDisp = piml->Add(CTempIconLoader(_T("DISPLAY")));//Ackronic - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client
					iImgDrop = piml->Add(CTempIconLoader(_T("DROP")));//Ackronic - Aggiunto da Aenarion[ITA] - Drop
					//MORPH START - Added by SiRoB, khaos::categorymod+
					iImgSCC = piml->Add(CTempIconLoader(_T("CATEGORY")));
					iImgSAC = piml->Add(CTempIconLoader(_T("ClientCompatible")));
					iImgA4AF = piml->Add(CTempIconLoader(_T("ADVA4AF")));
					iImgDM = piml->Add(CTempIconLoader(_T("DOWNLOAD")));
					iLmgRT = piml->Add(CTempIconLoader(_T("REASKONIDCHANGE")));// NEO: RIC - [ReaskOnIDChange]
					iLmgQS = piml->Add(CTempIconLoader(_T("QUICKSTART")));// NEO: QS - [QuickStart]
		}

		m_htiDM = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_DM), iImgDM, TVI_ROOT);
		//MORPH START - Added by SiRoB, khaos::categorymod+
		m_htiSCC = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_SCC), iImgSCC, m_htiDM);
		m_htiShowCatNames = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_CAT_SHOWCATNAME), m_htiSCC, m_bShowCatNames);
		m_htiSelectCat = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_CAT_SHOWSELCATDLG), m_htiSCC, m_bSelectCat);
		m_htiUseAutoCat = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_CAT_USEAUTOCAT), m_htiSCC, m_bUseAutoCat);
		m_htiUseActiveCat = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_CAT_USEACTIVE), m_htiSCC, m_bUseActiveCat);
		m_htiAutoSetResOrder = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_CAT_AUTORESUMEORD), m_htiSCC, m_bAutoSetResOrder);
		m_htiSmallFileDLPush = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_CAT_SMALLFILEDLPUSH), m_htiSCC, m_bSmallFileDLPush);
		m_htiResumeFileInNewCat = m_ctrlTreeOptions.InsertItem(GetResString(IDS_CAT_STARTFILESONADD), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiSCC);
		m_ctrlTreeOptions.AddEditBox(m_htiResumeFileInNewCat, RUNTIME_CLASS(CNumTreeOptionsEdit));

		m_htiSAC = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_SAC), iImgSAC, m_htiDM);
		m_htiShowA4AFDebugOutput  = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_A4AF_SHOWDEBUG), m_htiSAC, m_bShowA4AFDebugOutput);
		m_htiSmartA4AFSwapping = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_A4AF_SMARTSWAP), m_htiSAC, m_bSmartA4AFSwapping);
		m_htiAdvA4AFMode = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_DEFAULT) + _T(" ") + GetResString(IDS_A4AF_ADVMODE), iImgA4AF, m_htiSAC);
		m_htiDisableAdvA4AF = m_ctrlTreeOptions.InsertRadioButton(GetResString(IDS_A4AF_DISABLED), m_htiAdvA4AFMode, m_iAdvA4AFMode == 0);
		m_htiBalanceSources = m_ctrlTreeOptions.InsertRadioButton(GetResString(IDS_A4AF_BALANCE), m_htiAdvA4AFMode, m_iAdvA4AFMode == 1);
		m_htiStackSources = m_ctrlTreeOptions.InsertRadioButton(GetResString(IDS_A4AF_STACK), m_htiAdvA4AFMode, m_iAdvA4AFMode == 2);
		
		//m_ctrlTreeOptions.Expand(m_htiSCC, TVE_EXPAND);
		//m_ctrlTreeOptions.Expand(m_htiSAC, TVE_EXPAND);
		m_ctrlTreeOptions.Expand(m_htiAdvA4AFMode, TVE_EXPAND);
		//MORPH END - Added by SiRoB, khaos::categorymod+

		// NEO: QS - [QuickStart]
			m_htiQuickStart = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_QUICK_START),iLmgQS, TVI_ROOT);
				m_htiQuickStartEnable = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_X_QUICK_START_ENABLE),m_htiQuickStart);
				m_htiQuickStartTime = m_ctrlTreeOptions.InsertItem(GetResString(IDS_X_QUICK_START_TIME), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiQuickStart);
				m_ctrlTreeOptions.AddEditBox(m_htiQuickStartTime, RUNTIME_CLASS(CNumTreeOptionsEdit));
				//m_htiQuickStartTimePerFile = m_ctrlTreeOptions.InsertItem(GetResString(IDS_X_QUICK_START_TIME_PER_FILE), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiQuickStart);
				//m_ctrlTreeOptions.AddEditBox(m_htiQuickStartTimePerFile, RUNTIME_CLASS(CNumTreeOptionsEdit));
				m_htiQuickMaxConperFive = m_ctrlTreeOptions.InsertItem(GetResString(IDS_X_QUICK_START_MAXPER5), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiQuickStart);
				m_ctrlTreeOptions.AddEditBox(m_htiQuickMaxConperFive, RUNTIME_CLASS(CNumTreeOptionsEdit));
				m_htiQuickMaxHalfOpen = m_ctrlTreeOptions.InsertItem(GetResString(IDS_X_QUICK_START_MAXHALF), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiQuickStart);
				m_ctrlTreeOptions.AddEditBox(m_htiQuickMaxHalfOpen, RUNTIME_CLASS(CNumTreeOptionsEdit));
				m_htiQuickMaxConnections = m_ctrlTreeOptions.InsertItem(GetResString(IDS_X_QUICK_START_MAXCON), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiQuickStart);
				m_ctrlTreeOptions.AddEditBox(m_htiQuickMaxConnections, RUNTIME_CLASS(CNumTreeOptionsEdit));
			// NEO: QS END
			// NEO: RIC - [ReaskOnIDChange]
		m_htiOnIDChange = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_REASK_SOURCE),iLmgRT , m_htiQuickStart);
			m_htiCheckIPChange = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_CHECK_IP_CHANGE), m_htiOnIDChange, m_bCheckIPChange);
			m_htiInformOnIPChange = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_X_INFORM_ON_ID_CHANGE), m_htiOnIDChange, m_bInformOnIPChange);
			m_htiReAskOnIPChange = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_X_REASK_ON_ID_CHANGE), m_htiOnIDChange, m_bReAskOnIPChange);
			m_htiQuickStartOnIPChange = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_X_QUICK_START_ON_ID_CHANGE),m_htiOnIDChange,m_bQuickStartOnIPChange);// NEO: QS - [QuickStart]
			//m_htiCheckL2HIDChange = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_X_CHECK_L2H_CHANGES), m_htiOnIDChange, m_bCheckL2HIDChange);
			m_htiReconnectKadOnIPChange = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_X_RECONNECTKAD_ON_ID_CHANGE),m_htiOnIDChange, m_bReconnectKadOnIPChange);
			m_htiRebindSocketsOnIPChange = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_X_REBIND_SOCKETS_ON_IP_CHANGE), m_htiOnIDChange, m_bRebindSocketsOnIPChange);
		
		//Ackronic START - Aggiunto da Aenarion[ITA] - Emulate
		m_htiEmulator = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_EMULATOR), iImgEmulator, TVI_ROOT);
		m_htiEnableMLDonkey = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_EMUMLDONKEY), m_htiEmulator, EmuMLDonkey);
		m_htiEnableeDonkey = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_EMUEDONKEY), m_htiEmulator, EmueDonkey);
		m_htiEnableeDonkeyHybrid = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_EMUEDONKEYHYBRID), m_htiEmulator, EmueDonkeyHybrid);
		m_htiEnableShareaza = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_EMUSHAREAZA2), m_htiEmulator, EmuShareaza);
		m_htiEmuLphant = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_EMULATE_LPHANT), m_htiEmulator, m_bEmuLphant);
		m_htiLogEmulator = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_LOGEMULATOR), m_htiEmulator, m_bLogEmulator);
		m_ctrlTreeOptions.Expand(m_htiEmulator, TVE_EXPAND);
		//Ackronic END - Aggiunto da Aenarion[ITA] - Emulate

		//Ackronic START - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client
		m_htiDisp = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_PW_DISPLAY), iImgDisp, TVI_ROOT);
		m_htiEnableDownloadInBlue = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_DOWNLOAD_IN_BLUE), m_htiDisp, m_bEnableDownloadInBlue); 
		m_htiEnableUploadInBlue = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_UPLOAD_IN_BLUE), m_htiDisp, m_bEnableUploadInBlue); 
		m_htiEnableDownloadInBold = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_DOWNLOAD_IN_BOLD), m_htiDisp, m_bEnableDownloadInBold); 
		m_htiShowClientPercentage = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_CLIENTPERCENTAGE), m_htiDisp, m_bShowClientPercentage);
		m_ctrlTreeOptions.Expand(m_htiDisp, TVE_EXPAND);
		//Ackronic START - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client


		//Ackronic START - Aggiunto da Aenarion[ITA] - Drop
		m_htiDropSources = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_DROPS), iImgDrop, TVI_ROOT);
		m_htiDropSourcesNNS = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_DROPS1), m_htiDropSources, m_iDropSources = 1);
		m_htiDropSourcesTimerNNS = m_ctrlTreeOptions.InsertItem(GetResString(IDS_DROPS2), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiDropSources);
		m_ctrlTreeOptions.AddEditBox(m_htiDropSourcesTimerNNS, RUNTIME_CLASS(CNumTreeOptionsEdit));
		m_htiDropSourcesFQ = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_DROPS3), m_htiDropSources, m_iDropSources = 3);
		m_htiDropSourcesTimerFQ = m_ctrlTreeOptions.InsertItem(GetResString(IDS_DROPS2), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiDropSources);
		m_ctrlTreeOptions.AddEditBox(m_htiDropSourcesTimerFQ, RUNTIME_CLASS(CNumTreeOptionsEdit));
		m_htiDropSourcesHQR = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_DROPS4), m_htiDropSources, m_iDropSources = 7);
		m_htiDropSourcesTimerHQR = m_ctrlTreeOptions.InsertItem(GetResString(IDS_DROPS2), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiDropSources);
		m_ctrlTreeOptions.AddEditBox(m_htiDropSourcesTimerHQR, RUNTIME_CLASS(CNumTreeOptionsEdit));
		m_htiHqrBox = m_ctrlTreeOptions.InsertItem(GetResString(IDS_DROPHQSLIMIT), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiDropSources);
		m_ctrlTreeOptions.AddEditBox(m_htiHqrBox , RUNTIME_CLASS(CNumTreeOptionsEdit));
		m_ctrlTreeOptions.Expand(m_htiDropSources, TVE_EXPAND);
		//Ackronic END - Aggiunto da Aenarion[ITA] - Drop

		// ==> Sivka-Ban - Stulle
		m_htiSecu = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_SECURITY), iImgSecu, TVI_ROOT);
		m_htiSivkaBanGroup = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_SIVKA_BAN_CONTROL), iImgSecu, m_htiSecu);
		m_htiEnableSivkaBan = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_SIVKA_BAN),m_htiSivkaBanGroup, m_bEnableSivkaBan);
		m_htiSivkaAskTime = m_ctrlTreeOptions.InsertItem(GetResString(IDS_SIVKA_ASK_TIME), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiSivkaBanGroup);
		m_ctrlTreeOptions.AddEditBox(m_htiSivkaAskTime, RUNTIME_CLASS(CNumTreeOptionsEdit));
		m_htiSivkaAskCounter = m_ctrlTreeOptions.InsertItem(GetResString(IDS_SIVKA_ASK_COUNTER), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiSivkaBanGroup);
		m_ctrlTreeOptions.AddEditBox(m_htiSivkaAskCounter, RUNTIME_CLASS(CNumTreeOptionsEdit));
		m_htiSivkaAskLog = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_SIVKA_ASK_LOG), m_htiSivkaBanGroup, m_bSivkaAskLog);
		// <== Sivka-Ban - Stulle
		// ==> ban systems optional - Stulle
		m_htiAntiLeecherGroup = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_ANTI_LEECHER_GROUP), iImgSecu, m_htiSecu);
		m_htiEnableAntiLeecher = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_SUC_ENABLED), m_htiAntiLeecherGroup, m_bEnableAntiLeecher); //MORPH - Added by IceCream, Enable Anti-leecher
		m_htiBadModString = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_BAD_MOD_STRING), m_htiAntiLeecherGroup, m_bBadModString);
		m_htiBadNickBan = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_BAD_NICK_BAN), m_htiAntiLeecherGroup, m_bBadNickBan);
		//m_htiGhostMod = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_GHOST_MOD), m_htiAntiLeecherGroup, m_bGhostMod);
		//m_htiAntiModIdFaker = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_ANTI_MOD_FAKER), m_htiAntiLeecherGroup, m_bAntiModIdFaker);
		m_htiAntiNickThief = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_ANTI_NICK_THIEF), m_htiAntiLeecherGroup, m_bAntiNickThief); // AntiNickThief - Stulle
		m_htiEmptyNick = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_EMPTY_NICK), m_htiAntiLeecherGroup, m_bEmptyNick);
		m_htiFakeEmule = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_FAKE_EMULE), m_htiAntiLeecherGroup, m_bFakeEmule);
		//m_htiHiddenStr = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_HIDDEN_STR), m_htiAntiLeecherGroup, m_bHiddenStr);
		m_htiLeecherName = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_LEECHER_NAME), m_htiAntiLeecherGroup, m_bLeecherName);
		m_htiCommunityCheck = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_COMMUNITY_CHECK), m_htiAntiLeecherGroup, m_bCommunityCheck);
		m_ctrlTreeOptions.Expand(m_htiEnableAntiLeecher, TVE_EXPAND);
		// <== ban systems optional - Stulle
		m_htiEnableAntiCreditHack = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_ANTI_CREDITHACK), m_htiSecu, m_bEnableAntiCreditHack); //MORPH - Added by IceCream, Enable Anti-CreditHack
		m_htiAntiXsExploiter = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_ANTI_XS_EXPLOITER), m_htiSecu, m_bAntiXsExploiter); // Anti-XS-Exploit [Xman] - Stulle
		m_htiSpamBan = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_SPAM_BAN), m_htiSecu, m_bSpamBan); // Spam Ban [Xman] - Stulle
		// ==> adjust ClientBanTime - Stulle
		m_htiClientBanTime = m_ctrlTreeOptions.InsertItem(GetResString(IDS_CLIENT_BAN_TIME), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiSecu);
		m_ctrlTreeOptions.AddEditBox(m_htiClientBanTime, RUNTIME_CLASS(CNumTreeOptionsEdit));
		// <== adjust ClientBanTime - Stulle
		m_ctrlTreeOptions.Expand(m_htiSecu, TVE_EXPAND);

	
		m_ctrlTreeOptions.SendMessage(WM_VSCROLL, SB_TOP);
		m_bInitializedTreeOpts = true;
	}
//////////////////////////////////////////////////////////////////////////////////


		//MORPH START - Added by SiRoB, khaos::categorymod+
		DDX_TreeEdit(pDX, IDC_ACK_OPTS, m_htiResumeFileInNewCat, m_iResumeFileInNewCat);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiShowCatNames, m_bShowCatNames);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiSelectCat, m_bSelectCat);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiUseActiveCat, m_bUseActiveCat);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiAutoSetResOrder, m_bAutoSetResOrder);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiSmallFileDLPush, m_bSmallFileDLPush);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiShowA4AFDebugOutput, m_bShowA4AFDebugOutput);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiSmartA4AFSwapping, m_bSmartA4AFSwapping);
		DDX_TreeRadio(pDX, IDC_ACK_OPTS, m_htiAdvA4AFMode, m_iAdvA4AFMode);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiUseAutoCat, m_bUseAutoCat);

		// NEO: QS - [QuickStart]
		DDX_TreeCheck(pDX,IDC_ACK_OPTS, m_htiQuickStartEnable, m_bQuickStart);
		DDX_TreeEdit(pDX,IDC_ACK_OPTS, m_htiQuickStartTime, m_iQuickStartTime);
		//DDX_TreeEdit(pDX,IDC_ACK_OPTS, m_htiQuickStartTimePerFile, m_iQuickStartTimePerFile);
		DDX_TreeEdit(pDX,IDC_ACK_OPTS, m_htiQuickMaxConperFive, m_iQuickMaxConperFive);
		DDX_TreeEdit(pDX,IDC_ACK_OPTS, m_htiQuickMaxHalfOpen, m_iQuickMaxHalfOpen);
		DDX_TreeEdit(pDX,IDC_ACK_OPTS, m_htiQuickMaxConnections, m_iQuickMaxConnections);
		// NEO: QS END

		// NEO: RIC - [ReaskOnIDChange]
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiCheckIPChange,m_bCheckIPChange);
		if(m_htiInformOnIPChange) DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiInformOnIPChange, m_bInformOnIPChange);
		if(m_htiReAskOnIPChange) DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiReAskOnIPChange, m_bReAskOnIPChange);
		if( m_htiQuickStartOnIPChange) DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiQuickStartOnIPChange, m_bQuickStartOnIPChange); // NEO: QS - [QuickStart]
		//DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiCheckL2HIDChange, m_bCheckL2HIDChange);
		if(m_htiReconnectKadOnIPChange) DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiReconnectKadOnIPChange, m_bReconnectKadOnIPChange);
		if(m_htiRebindSocketsOnIPChange) DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiRebindSocketsOnIPChange, m_bRebindSocketsOnIPChange);

		

		//Ackronic START - Aggiunto da Aenarion[ITA] - Emulate
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiEnableMLDonkey, EmuMLDonkey);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiEnableeDonkey, EmueDonkey);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiEnableeDonkeyHybrid, EmueDonkeyHybrid);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiEnableShareaza, EmuShareaza);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiEmuLphant, m_bEmuLphant);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiLogEmulator, m_bLogEmulator);
		//Ackronic END - Aggiunto da Aenarion[ITA] - Emulate

		//Ackronic START - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiEnableDownloadInBlue, m_bEnableDownloadInBlue); 
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiEnableUploadInBlue, m_bEnableUploadInBlue);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiEnableDownloadInBold, m_bEnableDownloadInBold);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiShowClientPercentage, m_bShowClientPercentage);
		//Ackronic END - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client


		//Ackronic START - Aggiunto da Aenarion[ITA] - Drop
		DDX_TreeEdit(pDX, IDC_ACK_OPTS, m_htiHqrBox, iMaxRemoveQRS);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiDropSourcesNNS, m_iDropSourcesNNS);
		DDX_TreeEdit(pDX, IDC_ACK_OPTS, m_htiDropSourcesTimerNNS, m_iDropSourcesTimerNNS);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiDropSourcesFQ, m_iDropSourcesFQ);
		DDX_TreeEdit(pDX, IDC_ACK_OPTS, m_htiDropSourcesTimerFQ, m_iDropSourcesTimerFQ);
		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiDropSourcesHQR, m_iDropSourcesHQR);
		DDX_TreeEdit(pDX, IDC_ACK_OPTS, m_htiDropSourcesTimerHQR, m_iDropSourcesTimerHQR);
		DDV_MinMaxInt(pDX, iMaxRemoveQRS, 2500, 100000);
		//Ackronic END - Aggiunto da Aenarion[ITA] - Drop

		// ==> Sivka-Ban - Stulle
	DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiEnableSivkaBan, m_bEnableSivkaBan);
	DDX_TreeEdit(pDX, IDC_ACK_OPTS, m_htiSivkaAskTime, m_iSivkaAskTime);
	DDV_MinMaxInt(pDX, m_iSivkaAskTime, 5, 10);
	DDX_TreeEdit(pDX, IDC_ACK_OPTS, m_htiSivkaAskCounter, m_iSivkaAskCounter);
	DDV_MinMaxInt(pDX, m_iSivkaAskCounter, 5, 15);
	DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiSivkaAskLog, m_bSivkaAskLog);
	// <== Sivka-Ban - Stulle
	// ==> ban systems optional - Stulle
	DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiEnableAntiLeecher, m_bEnableAntiLeecher); //MORPH - Added by IceCream, enable Anti-leecher
	if(m_htiBadModString)	DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiBadModString, m_bBadModString);
	if(m_htiBadNickBan)		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiBadNickBan, m_bBadNickBan);
	//if(m_htiGhostMod)		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiGhostMod, m_bGhostMod);
	//if(m_htiAntiModIdFaker)	DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiAntiModIdFaker, m_bAntiModIdFaker);
	if(m_htiAntiNickThief)	DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiAntiNickThief, m_bAntiNickThief); // AntiNickThief - Stulle
	if(m_htiEmptyNick)		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiEmptyNick, m_bEmptyNick);
	if(m_htiFakeEmule)		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiFakeEmule, m_bFakeEmule);
	//if(m_htiHiddenStr)		DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiHiddenStr, m_bHiddenStr);
	if(m_htiLeecherName)	DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiLeecherName, m_bLeecherName);
	if(m_htiCommunityCheck)	DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiCommunityCheck, m_bCommunityCheck);
	// <== ban systems optional - Stulle
	DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiEnableAntiCreditHack, m_bEnableAntiCreditHack); //MORPH - Added by IceCream, enable Anti-CreditHack
	DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiAntiXsExploiter, m_bAntiXsExploiter); // Anti-XS-Exploit [Xman] - Stulle
	DDX_TreeCheck(pDX, IDC_ACK_OPTS, m_htiSpamBan, m_bSpamBan); // Spam Ban [Xman] - Stulle
	// ==> adjust ClientBanTime - Stulle
	DDX_TreeEdit(pDX, IDC_ACK_OPTS, m_htiClientBanTime, m_iClientBanTime);
	DDV_MinMaxInt(pDX, m_iClientBanTime, 1, 10);
	// <== adjust ClientBanTime - Stulle
	// ==> ban systems optional - Stulle
	if (m_htiBadModString)		m_ctrlTreeOptions.SetCheckBoxEnable(m_htiBadModString, m_bEnableAntiLeecher);
	if (m_htiBadNickBan)		m_ctrlTreeOptions.SetCheckBoxEnable(m_htiBadNickBan, m_bEnableAntiLeecher);
	//if (m_htiGhostMod)			m_ctrlTreeOptions.SetCheckBoxEnable(m_htiGhostMod, m_bEnableAntiLeecher);
	//if (m_htiAntiModIdFaker)	m_ctrlTreeOptions.SetCheckBoxEnable(m_htiAntiModIdFaker, m_bEnableAntiLeecher);
	if (m_htiAntiNickThief)		m_ctrlTreeOptions.SetCheckBoxEnable(m_htiAntiNickThief, m_bEnableAntiLeecher);
	if (m_htiEmptyNick)			m_ctrlTreeOptions.SetCheckBoxEnable(m_htiEmptyNick, m_bEnableAntiLeecher);
	if (m_htiFakeEmule)			m_ctrlTreeOptions.SetCheckBoxEnable(m_htiFakeEmule, m_bEnableAntiLeecher);
	//if (m_htiHiddenStr)			m_ctrlTreeOptions.SetCheckBoxEnable(m_htiHiddenStr, m_bEnableAntiLeecher);
	if (m_htiLeecherName)		m_ctrlTreeOptions.SetCheckBoxEnable(m_htiLeecherName, m_bEnableAntiLeecher);
	if (m_htiCommunityCheck)	m_ctrlTreeOptions.SetCheckBoxEnable(m_htiCommunityCheck, m_bEnableAntiLeecher);
	// <== ban systems optional - Stulle

	// NEO: RIC - [ReaskOnIDChange]
	if(m_htiInformOnIPChange) m_ctrlTreeOptions.SetCheckBoxEnable(m_htiInformOnIPChange, m_bCheckIPChange);
	if(m_htiReAskOnIPChange) m_ctrlTreeOptions.SetCheckBoxEnable(m_htiReAskOnIPChange, m_bCheckIPChange);
	if(m_htiQuickStartOnIPChange) m_ctrlTreeOptions.SetCheckBoxEnable(m_htiQuickStartOnIPChange, m_bCheckIPChange); // NEO: QS - [QuickStart]
	if(m_htiReconnectKadOnIPChange) m_ctrlTreeOptions.SetCheckBoxEnable(m_htiReconnectKadOnIPChange, m_bCheckIPChange);
	if(m_htiRebindSocketsOnIPChange) m_ctrlTreeOptions.SetCheckBoxEnable(m_htiRebindSocketsOnIPChange, m_bCheckIPChange);


		

	}

BOOL CPPgAckronic::OnInitDialog()
{

	//Ackronic START - Aggiunto da Aenarion[ITA] - Emulate
	EmuMLDonkey      = thePrefs.EmuMLDonkey;
	EmueDonkey       = thePrefs.EmueDonkey;
	EmueDonkeyHybrid = thePrefs.EmueDonkeyHybrid;
	EmuShareaza      = thePrefs.EmuShareaza;
	m_bEmuLphant     = thePrefs.m_bEmuLphant;
	m_bLogEmulator   = thePrefs.m_bLogEmulator;
	//Ackronic END - Aggiunto da Aenarion[ITA] - Emulate

	//Ackronic START - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client
	m_bEnableDownloadInBlue = thePrefs.enableDownloadInBlue; 
	m_bEnableUploadInBlue = thePrefs.enableUploadInBlue;
	m_bEnableDownloadInBold = thePrefs.m_bShowActiveDownloadsBold;
	m_bShowClientPercentage = thePrefs.m_bShowClientPercentage;
	//Ackronic END - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client

	// NEO: QS - [QuickStart]
	m_bQuickStart = thePrefs.m_bQuickStart;
	m_iQuickStartTime = thePrefs.m_iQuickStartTime;
	//m_iQuickStartTimePerFile = thePrefs.m_iQuickStartTimePerFile;
	m_iQuickMaxConperFive = thePrefs.m_iQuickMaxConperFive;
	m_iQuickMaxHalfOpen = thePrefs.m_iQuickMaxHalfOpen;
	m_iQuickMaxConnections = thePrefs.m_iQuickMaxConnections;
	// NEO: QS END

	// NEO: RIC - [ReaskOnIDChange]
	m_bCheckIPChange = thePrefs.m_bCheckIPChange;
	m_bInformOnIPChange = thePrefs.m_bInformOnIPChange;
	m_bReAskOnIPChange = thePrefs.m_bReAskOnIPChange;
	m_bQuickStartOnIPChange = thePrefs.m_bQuickStartOnIPChange; // NEO: QS - [QuickStart]
	//m_bCheckL2HIDChange = thePrefs.m_bCheckL2HIDChange;
	m_bReconnectKadOnIPChange = thePrefs.m_bReconnectKadOnIPChange;
	m_bRebindSocketsOnIPChange = thePrefs.m_bRebindSocketsOnIPChange;
	// NEO: RIC END


	//Ackronic START - Aggiunto da Aenarion[ITA] - Drop
	m_iDropSourcesNNS = thePrefs.m_bDropSourcesNNS;
	m_iDropSourcesTimerNNS = thePrefs.m_iDropSourcesTimerNNS;
	m_iDropSourcesFQ = thePrefs.m_bDropSourcesFQ;
	m_iDropSourcesTimerFQ = thePrefs.m_iDropSourcesTimerFQ;
	m_iDropSourcesHQR = thePrefs.m_bDropSourcesHQR;
	m_iDropSourcesTimerHQR = thePrefs.m_iDropSourcesTimerHQR;
    iMaxRemoveQRS = /*(int)*/ thePrefs.GetMaxRemoveQRS();
	//Ackronic END - Aggiunto da Aenarion[ITA] - Drop

	//MORPH START - Added by SiRoB, khaos::categorymod+
	m_bShowCatNames = thePrefs.ShowCatNameInDownList();
	m_bSelectCat = thePrefs.SelectCatForNewDL();
	m_bUseActiveCat = thePrefs.UseActiveCatForLinks();
	m_bAutoSetResOrder = thePrefs.AutoSetResumeOrder();
	m_bShowA4AFDebugOutput = thePrefs.m_bShowA4AFDebugOutput;
	m_bSmartA4AFSwapping = thePrefs.UseSmartA4AFSwapping();
	m_iAdvA4AFMode = thePrefs.AdvancedA4AFMode();
	m_bSmallFileDLPush = thePrefs.SmallFileDLPush();
	m_iResumeFileInNewCat = thePrefs.StartDLInEmptyCats();
	m_bUseAutoCat = thePrefs.UseAutoCat();

	// ==> Sivka-Ban - Stulle
	m_bEnableSivkaBan = thePrefs.enableSivkaBan;
	m_iSivkaAskTime = (int)(thePrefs.GetSivkaAskTime());
	m_iSivkaAskCounter = (int)(thePrefs.GetSivkaAskCounter());
	m_bSivkaAskLog = thePrefs.SivkaAskLog;
	// <== Sivka-Ban - Stulle
	// ==> ban systems optional - Stulle
	m_bEnableAntiLeecher = thePrefs.enableAntiLeecher; //MORPH - Added by IceCream, enabnle Anti-leecher
	m_bBadModString = thePrefs.IsBadModString();
	m_bBadNickBan = thePrefs.IsBadNickBan();
	//m_bGhostMod = thePrefs.IsGhostMod();
	//m_bAntiModIdFaker = thePrefs.IsAntiModIdFaker();
	m_bAntiNickThief = thePrefs.IsAntiNickThief(); // AntiNickThief - Stulle
	m_bEmptyNick = thePrefs.IsEmptyNick();
	m_bFakeEmule = thePrefs.IsFakeEmule();
	//m_bHiddenStr = thePrefs.IsHiddenStr();
	m_bLeecherName = thePrefs.IsLeecherName();
	m_bCommunityCheck = thePrefs.IsCommunityCheck();
	// <== ban systems optional - Stulle
	m_bEnableAntiCreditHack = thePrefs.enableAntiCreditHack; //MORPH - Added by IceCream, enabnle Anti-CreditHack
	m_bAntiXsExploiter = thePrefs.GetAntiXSExploiter(); // Anti-XS-Exploit [Xman] - Stulle
	m_bSpamBan = thePrefs.GetSpamBan(); // Spam Ban [Xman] - Stulle
	m_iClientBanTime = thePrefs.GetClientBanTime()/3600000; // adjust ClientBanTime - Stulle

	
	InitWindowStyles(this);
	CPropertyPage::OnInitDialog();
	Localize();
	LoadSettings();
	return TRUE;
	
}
BOOL CPPgAckronic::OnKillActive()
{
	// if prop page is closed by pressing ENTER we have to explicitly commit any possibly pending
	// data from an open edit control
	m_ctrlTreeOptions.HandleChildControlLosingFocus();
	return CPropertyPage::OnKillActive();
}
void CPPgAckronic::Localize(void)
{
	if(m_hWnd){
	   
		//Ackronic START - Aggiunto da Aenarion[ITA] - Emulate
		if (m_htiEnableMLDonkey) m_ctrlTreeOptions.SetItemText(m_htiEnableMLDonkey, GetResString(IDS_EMUMLDONKEY));
		if (m_htiEnableeDonkey) m_ctrlTreeOptions.SetItemText(m_htiEnableeDonkey, GetResString(IDS_EMUEDONKEY));
		if (m_htiEnableeDonkeyHybrid) m_ctrlTreeOptions.SetItemText(m_htiEnableeDonkeyHybrid, GetResString(IDS_EMUEDONKEYHYBRID));
		if (m_htiEnableShareaza) m_ctrlTreeOptions.SetItemText(m_htiEnableShareaza, GetResString(IDS_EMUSHAREAZA2));
		if (m_htiEmuLphant) m_ctrlTreeOptions.SetItemText(m_htiEmuLphant, GetResString(IDS_EMULATE_LPHANT));
		if (m_htiLogEmulator) m_ctrlTreeOptions.SetItemText(m_htiLogEmulator, GetResString(IDS_LOGEMULATOR));
		//Ackronic END - Aggiunto da Aenarion[ITA] - Emulate

		//Ackronic START - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client
		if (m_htiEnableDownloadInBlue) m_ctrlTreeOptions.SetItemText(m_htiEnableDownloadInBlue, GetResString(IDS_DOWNLOAD_IN_BLUE)); 
		if (m_htiEnableUploadInBlue) m_ctrlTreeOptions.SetItemText(m_htiEnableUploadInBlue, GetResString(IDS_UPLOAD_IN_BLUE)); 
		if (m_htiEnableDownloadInBold) m_ctrlTreeOptions.SetItemText(m_htiEnableDownloadInBold, GetResString(IDS_DOWNLOAD_IN_BOLD)); 
		if (m_htiShowClientPercentage) m_ctrlTreeOptions.SetItemText(m_htiShowClientPercentage, GetResString(IDS_CLIENTPERCENTAGE));
		//Ackronic END - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client




	

		//MORPH START - Added by SiRoB, khaos::categorymod+
		if (m_htiShowCatNames) m_ctrlTreeOptions.SetItemText(m_htiShowCatNames, GetResString(IDS_CAT_SHOWCATNAME));
		if (m_htiSelectCat) m_ctrlTreeOptions.SetItemText(m_htiSelectCat, GetResString(IDS_CAT_SHOWSELCATDLG));
		if (m_htiUseAutoCat) m_ctrlTreeOptions.SetItemText(m_htiUseAutoCat, GetResString(IDS_CAT_USEAUTOCAT));
		if (m_htiUseActiveCat) m_ctrlTreeOptions.SetItemText(m_htiUseActiveCat, GetResString(IDS_CAT_USEACTIVE));
		if (m_htiAutoSetResOrder) m_ctrlTreeOptions.SetItemText(m_htiAutoSetResOrder, GetResString(IDS_CAT_AUTORESUMEORD));
		if (m_htiSmallFileDLPush) m_ctrlTreeOptions.SetItemText(m_htiSmallFileDLPush, GetResString(IDS_CAT_SMALLFILEDLPUSH));
		if (m_htiResumeFileInNewCat) m_ctrlTreeOptions.SetEditLabel(m_htiResumeFileInNewCat, GetResString(IDS_CAT_STARTFILESONADD));
		if (m_htiSmartA4AFSwapping) m_ctrlTreeOptions.SetItemText(m_htiSmartA4AFSwapping, GetResString(IDS_A4AF_SMARTSWAP));
		if (m_htiShowA4AFDebugOutput) m_ctrlTreeOptions.SetItemText(m_htiShowA4AFDebugOutput, GetResString(IDS_A4AF_SHOWDEBUG));
		if (m_htiAdvA4AFMode) m_ctrlTreeOptions.SetItemText(m_htiAdvA4AFMode, /*GetResString(IDS_DEFAULT) + " " +*/ GetResString(IDS_A4AF_ADVMODE));
		if (m_htiDisableAdvA4AF) m_ctrlTreeOptions.SetItemText(m_htiDisableAdvA4AF, GetResString(IDS_A4AF_DISABLED));
		if (m_htiBalanceSources) m_ctrlTreeOptions.SetItemText(m_htiBalanceSources, GetResString(IDS_A4AF_BALANCE));
		if (m_htiStackSources) m_ctrlTreeOptions.SetItemText(m_htiStackSources, GetResString(IDS_A4AF_STACK));
		// khaos::accuratetimerem+

		// ==> Sivka-Ban - Stulle
		if (m_htiEnableSivkaBan) m_ctrlTreeOptions.SetItemText(m_htiEnableSivkaBan, GetResString(IDS_SIVKA_BAN));
		if (m_htiSivkaAskTime) m_ctrlTreeOptions.SetEditLabel(m_htiSivkaAskTime, GetResString(IDS_SIVKA_ASK_TIME));
		if (m_htiSivkaAskCounter) m_ctrlTreeOptions.SetEditLabel(m_htiSivkaAskCounter, GetResString(IDS_SIVKA_ASK_COUNTER));
		if (m_htiSivkaAskLog) m_ctrlTreeOptions.SetItemText(m_htiSivkaAskLog, GetResString(IDS_SIVKA_ASK_LOG));
		// <== Sivka-Ban - Stulle
		// ==> ban systems optional - Stulle
		if (m_htiEnableAntiLeecher) m_ctrlTreeOptions.SetItemText(m_htiEnableAntiLeecher, GetResString(IDS_SUC_ENABLED)); //MORPH - Added by IceCream, enable Anti-leecher
		if (m_htiBadModString) m_ctrlTreeOptions.SetItemText(m_htiBadModString, GetResString(IDS_BAD_MOD_STRING));
		if (m_htiBadNickBan) m_ctrlTreeOptions.SetItemText(m_htiBadNickBan, GetResString(IDS_BAD_NICK_BAN));
		//if (m_htiGhostMod) m_ctrlTreeOptions.SetItemText(m_htiGhostMod, GetResString(IDS_GHOST_MOD));
		//if (m_htiAntiModIdFaker) m_ctrlTreeOptions.SetItemText(m_htiAntiModIdFaker, GetResString(IDS_ANTI_MOD_FAKER));
		if (m_htiAntiNickThief) m_ctrlTreeOptions.SetItemText(m_htiAntiNickThief, GetResString(IDS_ANTI_NICK_THIEF)); // AntiNickThief - Stulle
		if (m_htiEmptyNick) m_ctrlTreeOptions.SetItemText(m_htiEmptyNick, GetResString(IDS_EMPTY_NICK));
		if (m_htiFakeEmule) m_ctrlTreeOptions.SetItemText(m_htiFakeEmule, GetResString(IDS_FAKE_EMULE));
		//if (m_htiHiddenStr) m_ctrlTreeOptions.SetItemText(m_htiHiddenStr, GetResString(IDS_HIDDEN_STR));
		if (m_htiLeecherName) m_ctrlTreeOptions.SetItemText(m_htiLeecherName, GetResString(IDS_LEECHER_NAME));
		if (m_htiCommunityCheck) m_ctrlTreeOptions.SetItemText(m_htiCommunityCheck, GetResString(IDS_COMMUNITY_CHECK));
		// <== ban systems optional - Stulle
		if (m_htiEnableAntiCreditHack) m_ctrlTreeOptions.SetItemText(m_htiEnableAntiCreditHack, GetResString(IDS_ANTI_CREDITHACK)); //MORPH - Added by IceCream, enable Anti-CreditHack
		if (m_htiAntiXsExploiter) m_ctrlTreeOptions.SetItemText(m_htiAntiXsExploiter, GetResString(IDS_ANTI_XS_EXPLOITER)); // Anti-XS-Exploit [Xman] - Stulle
		if (m_bSpamBan) m_ctrlTreeOptions.SetItemText(m_htiSpamBan, GetResString(IDS_SPAM_BAN)); // Spam Ban [Xman] - Stulle
		if (m_htiClientBanTime) m_ctrlTreeOptions.SetEditLabel(m_htiClientBanTime, GetResString(IDS_CLIENT_BAN_TIME)); // adjust ClientBanTime - Stulle

		
	}
}


BOOL CPPgAckronic::OnApply()
{    
	m_ctrlTreeOptions.HandleChildControlLosingFocus();

    if (!UpdateData())
		return FALSE;


	//Ackronic START - Aggiunto da Aenarion[ITA] - Emulate
	thePrefs.EmuMLDonkey		= EmuMLDonkey;
	thePrefs.EmueDonkey			= EmueDonkey;
	thePrefs.EmueDonkeyHybrid	= EmueDonkeyHybrid;
	thePrefs.EmuShareaza		= EmuShareaza;
	thePrefs.m_bEmuLphant		= m_bEmuLphant;
	thePrefs.m_bLogEmulator		= m_bLogEmulator;
	//Ackronic END - Aggiunto da Aenarion[ITA] - Emulate

	//Ackronic START - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client
	thePrefs.enableDownloadInBlue = m_bEnableDownloadInBlue; 
	thePrefs.enableUploadInBlue = m_bEnableUploadInBlue; 
	thePrefs.m_bShowActiveDownloadsBold = m_bEnableDownloadInBold; 
	thePrefs.m_bShowClientPercentage = m_bShowClientPercentage;
    //Ackronic END - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client

	// NEO: QS - [QuickStart]
	thePrefs.m_bQuickStart = m_bQuickStart;
	if(m_iQuickStartTime > 18)
	thePrefs.m_iQuickStartTime = 18;
	else if(m_iQuickStartTime < 8)
	thePrefs.m_iQuickStartTime = 8;
	else thePrefs.m_iQuickStartTime = m_iQuickStartTime;
	//thePrefs.m_iQuickStartTimePerFile = m_iQuickStartTimePerFile;
	if(m_iQuickMaxConperFive > 200)
	thePrefs.m_iQuickMaxConperFive = 200;
	else if(m_iQuickMaxConperFive < 5)
	thePrefs.m_iQuickMaxConperFive = 5;
	else thePrefs.m_iQuickMaxConperFive = m_iQuickMaxConperFive;
	if(m_iQuickMaxHalfOpen > 100)
	thePrefs.m_iQuickMaxHalfOpen = 100;
	else if(m_iQuickMaxHalfOpen < 2)
	thePrefs.m_iQuickMaxHalfOpen = 2;
	else thePrefs.m_iQuickMaxHalfOpen = m_iQuickMaxHalfOpen;
	if(m_iQuickMaxConnections > 4000)
	thePrefs.m_iQuickMaxConnections = 4000;
	else if(m_iQuickMaxConnections < 200)
	thePrefs.m_iQuickMaxConnections = 200;
	else thePrefs.m_iQuickMaxConnections = m_iQuickMaxConnections;
	// NEO: QS END

	// NEO: RIC - [ReaskOnIDChange]
	thePrefs.m_bCheckIPChange = m_bCheckIPChange;
	thePrefs.m_bInformOnIPChange = m_bInformOnIPChange;
	thePrefs.m_bReAskOnIPChange = m_bReAskOnIPChange;
	thePrefs.m_bQuickStartOnIPChange = m_bQuickStartOnIPChange; // NEO: QS - [QuickStart]
	//thePrefs.m_bCheckL2HIDChange = m_bCheckL2HIDChange;
	thePrefs.m_bReconnectKadOnIPChange = m_bReconnectKadOnIPChange;
	thePrefs.m_bRebindSocketsOnIPChange = m_bRebindSocketsOnIPChange;
	// NEO: RIC END

	//Ackronic START - Aggiunto da Aenarion[ITA] - Drop
	if(m_iDropSourcesTimerNNS < 2)
		thePrefs.m_iDropSourcesTimerNNS = 2;
	else thePrefs.m_iDropSourcesTimerNNS = m_iDropSourcesTimerNNS;

	if(m_iDropSourcesTimerFQ < 2)
		thePrefs.m_iDropSourcesTimerFQ = 2;
	else thePrefs.m_iDropSourcesTimerFQ = m_iDropSourcesTimerFQ;

	if(m_iDropSourcesTimerHQR < 2)
		thePrefs.m_iDropSourcesTimerHQR = 2;
	else thePrefs.m_iDropSourcesTimerHQR = m_iDropSourcesTimerHQR;
	
	thePrefs.SetDropSourcesNNS(m_iDropSourcesNNS);
	thePrefs.SetDropSourcesFQ(m_iDropSourcesFQ);
	thePrefs.SetDropSourcesHQR(m_iDropSourcesHQR);
	thePrefs.SetMaxRemoveQRS(iMaxRemoveQRS ? iMaxRemoveQRS : 5000);
	//Ackronic START - Aggiunto da Aenarion[ITA] - Drop



	//MORPH START - Added by SiRoB, khaos::categorymod+
	thePrefs.m_bShowCatNames = m_bShowCatNames;
	thePrefs.m_bSelCatOnAdd = m_bSelectCat;
	thePrefs.m_bActiveCatDefault = m_bUseActiveCat;
	thePrefs.m_bAutoSetResumeOrder = m_bAutoSetResOrder;
	thePrefs.m_bShowA4AFDebugOutput = m_bShowA4AFDebugOutput;
	thePrefs.m_bSmartA4AFSwapping = m_bSmartA4AFSwapping;
	thePrefs.m_iAdvancedA4AFMode = (uint8)m_iAdvA4AFMode;
	thePrefs.m_bSmallFileDLPush = m_bSmallFileDLPush;
	thePrefs.m_iStartDLInEmptyCats = (uint8)m_iResumeFileInNewCat;
	thePrefs.m_bUseAutoCat = m_bUseAutoCat;

	// ==> Sivka-Ban - Stulle
	thePrefs.enableSivkaBan = m_bEnableSivkaBan;
	thePrefs.m_iSivkaAskTime = (uint16)m_iSivkaAskTime;
	thePrefs.m_iSivkaAskCounter = (uint16)m_iSivkaAskCounter;
	thePrefs.SivkaAskLog = m_bSivkaAskLog;
	// <== Sivka-Ban - Stulle
	// ==> ban systems optional - Stulle
	thePrefs.enableAntiLeecher = m_bEnableAntiLeecher; //MORPH - Added by IceCream, enable Anti-leecher
	thePrefs.m_bBadModString = m_bBadModString;
	thePrefs.m_bBadNickBan = m_bBadNickBan;
	//thePrefs.m_bGhostMod = m_bGhostMod;
	//thePrefs.m_bAntiModIdFaker = m_bAntiModIdFaker;
	thePrefs.m_bAntiNickThief = m_bAntiNickThief; // AntiNickThief - Stulle
	thePrefs.m_bEmptyNick = m_bEmptyNick;
	thePrefs.m_bFakeEmule = m_bFakeEmule;
	//thePrefs.m_bHiddenStr = m_bHiddenStr;
	thePrefs.m_bLeecherName = m_bLeecherName;
	thePrefs.m_bCommunityCheck = m_bCommunityCheck;
	// <== ban systems optional - Stulle
	thePrefs.enableAntiCreditHack = m_bEnableAntiCreditHack; //MORPH - Added by IceCream, enable Anti-CreditHack
	thePrefs.m_bAntiXsExploiter = m_bAntiXsExploiter; // Anti-XS-Exploit [Xman] - Stulle
	thePrefs.m_bSpamBan = m_bSpamBan; // Spam Ban [Xman] - Stulle
	thePrefs.m_dwClientBanTime = m_iClientBanTime*3600000; // adjust ClientBanTime - Stulle

	SetModified(FALSE);
	return CPropertyPage::OnApply();
}

void CPPgAckronic::LoadSettings(void)
{   
}
void CPPgAckronic::OnDestroy()
{

	m_ctrlTreeOptions.DeleteAllItems();
	m_ctrlTreeOptions.DestroyWindow();
	m_bInitializedTreeOpts = false;

	//Ackronic START - Aggiunto da Aenarion[ITA] - Emulate
	m_htiEmulator = NULL;
	m_htiEnableMLDonkey = NULL;
	m_htiEnableeDonkey = NULL;
	m_htiEnableeDonkeyHybrid = NULL;
	m_htiEnableShareaza = NULL;
	m_htiEmuLphant = NULL;
	m_htiLogEmulator = NULL;
	//Ackronic END - Aggiunto da Aenarion[ITA] - Emulate

	//Ackronic START - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client
	m_htiEnableDownloadInBlue = NULL; 
	m_htiEnableUploadInBlue = NULL;
	m_htiEnableDownloadInBold = NULL; 
	m_htiShowClientPercentage = NULL;
	//Ackronic END - Aggiunto da Aenarion[ITA] - download in blu & grasetto & %client

	// NEO: QS - [QuickStart]
		m_htiQuickStart = NULL;
			m_htiQuickStartEnable = NULL;
			m_htiQuickStartTime = NULL;
			//m_htiQuickStartTimePerFile = NULL;
			m_htiQuickMaxConperFive = NULL;
			m_htiQuickMaxHalfOpen = NULL;
			m_htiQuickMaxConnections = NULL;
		// NEO: QS END

	// NEO: RIC - [ReaskOnIDChange]
	m_htiOnIDChange = NULL;
	    m_htiCheckIPChange = NULL;
		m_htiInformOnIPChange = NULL;
		m_htiReAskOnIPChange = NULL;
		m_htiQuickStartOnIPChange = NULL; // NEO: QS - [QuickStart]
		//m_htiCheckL2HIDChange = NULL;
		m_htiReconnectKadOnIPChange = NULL;
		m_htiRebindSocketsOnIPChange = NULL;
		// NEO: RIC END

	//Ackronic START - Aggiunto da Aenarion[ITA] - Drop
	m_htiDropSources = NULL;
	m_htiDropSourcesTimerNNS = NULL;
	m_htiDropSourcesTimerFQ = NULL;
	m_htiDropSourcesTimerHQR = NULL;
	m_htiDropSourcesNNS = NULL;
	m_htiDropSourcesFQ = NULL;
	m_htiDropSourcesHQR = NULL;
    m_htiHqrBox = NULL;
	//Ackronic END - Aggiunto da Aenarion[ITA] - Drop


	//MORPH START - Added by SiRoB, khaos::categorymod+
	m_htiShowCatNames = NULL;
	m_htiSelectCat = NULL;
	m_htiUseActiveCat = NULL;
	m_htiAutoSetResOrder = NULL;
	m_htiSmartA4AFSwapping = NULL;
	m_htiAdvA4AFMode = NULL;
	m_htiBalanceSources = NULL;
	m_htiStackSources = NULL;
	m_htiShowA4AFDebugOutput = NULL;
	m_htiDisableAdvA4AF = NULL;
	m_htiSmallFileDLPush = NULL;
	m_htiResumeFileInNewCat = NULL;
	m_htiUseAutoCat = NULL;
	// khaos::accuratetimerem+

	// ==> Sivka-Ban - Stulle
	m_htiSivkaBanGroup = NULL;
	m_htiEnableSivkaBan = NULL;
	m_htiSivkaAskTime = NULL;
	m_htiSivkaAskCounter = NULL;
	m_htiSivkaAskLog = NULL;
	// <== Sivka-Ban - Stulle
	// ==> ban systems optional - Stulle
	m_htiAntiLeecherGroup = NULL;
	m_htiEnableAntiLeecher = NULL; //MORPH - Added by IceCream, activate Anti-leecher
	m_htiBadModString = NULL;
	m_htiBadNickBan = NULL;
	//m_htiGhostMod = NULL;
	//m_htiAntiModIdFaker = NULL;
	m_htiAntiNickThief = NULL; // AntiNickThief - Stulle
	m_htiEmptyNick = NULL;
	m_htiFakeEmule = NULL;
	//m_htiHiddenStr = NULL;
	m_htiLeecherName = NULL;
	m_htiCommunityCheck = NULL;
	// <== ban systems optional - Stulle
	m_htiEnableAntiCreditHack = NULL; //MORPH - Added by IceCream, activate Anti-CreditHack
	m_htiAntiXsExploiter = NULL; // Anti-XS-Exploit [Xman] - Stulle
	m_htiSpamBan = NULL; // Spam Ban [Xman] - Stulle
	m_htiClientBanTime = NULL; // adjust ClientBanTime - Stulle

CPropertyPage::OnDestroy();
}

LRESULT CPPgAckronic::OnTreeOptsCtrlNotify(WPARAM wParam, LPARAM lParam)
{
	
	if (wParam == IDC_ACK_OPTS)
	{
		TREEOPTSCTRLNOTIFY* pton = (TREEOPTSCTRLNOTIFY*)lParam;
		BOOL bCheck;
	
		// NEO: RIC - [ReaskOnIDChange]
		if(m_htiCheckIPChange && pton->hItem == m_htiCheckIPChange)
		{
			
			if (m_ctrlTreeOptions.GetCheckBox(m_htiCheckIPChange, bCheck))
			{
				if(m_htiInformOnIPChange) m_ctrlTreeOptions.SetCheckBoxEnable(m_htiInformOnIPChange, bCheck);
				if(m_htiReAskOnIPChange) m_ctrlTreeOptions.SetCheckBoxEnable(m_htiReAskOnIPChange, bCheck);
				if(m_htiQuickStartOnIPChange) m_ctrlTreeOptions.SetCheckBoxEnable(m_htiQuickStartOnIPChange, bCheck); // NEO: QS - [QuickStart]
				if(m_htiReconnectKadOnIPChange) m_ctrlTreeOptions.SetCheckBoxEnable(m_htiReconnectKadOnIPChange, bCheck);
				if(m_htiRebindSocketsOnIPChange) m_ctrlTreeOptions.SetCheckBoxEnable(m_htiRebindSocketsOnIPChange, bCheck);
			}
		}
		// ==> ban systems optional - Stulle
		if (m_htiEnableAntiLeecher && pton->hItem == m_htiEnableAntiLeecher)
		{
			
			if (m_ctrlTreeOptions.GetCheckBox(m_htiEnableAntiLeecher, bCheck))
			{
				if (m_htiBadModString)		m_ctrlTreeOptions.SetCheckBoxEnable(m_htiBadModString, bCheck);
				if (m_htiBadNickBan)		m_ctrlTreeOptions.SetCheckBoxEnable(m_htiBadNickBan, bCheck);
				//if (m_htiGhostMod)			m_ctrlTreeOptions.SetCheckBoxEnable(m_htiGhostMod, bCheck);
				//if (m_htiAntiModIdFaker)	m_ctrlTreeOptions.SetCheckBoxEnable(m_htiAntiModIdFaker, bCheck);
				if (m_htiAntiNickThief)		m_ctrlTreeOptions.SetCheckBoxEnable(m_htiAntiNickThief, bCheck);
				if (m_htiEmptyNick)			m_ctrlTreeOptions.SetCheckBoxEnable(m_htiEmptyNick, bCheck);
				if (m_htiFakeEmule)			m_ctrlTreeOptions.SetCheckBoxEnable(m_htiFakeEmule, bCheck);
				//if (m_htiHiddenStr)			m_ctrlTreeOptions.SetCheckBoxEnable(m_htiHiddenStr, bCheck);
				if (m_htiLeecherName)		m_ctrlTreeOptions.SetCheckBoxEnable(m_htiLeecherName, bCheck);
				if (m_htiCommunityCheck)	m_ctrlTreeOptions.SetCheckBoxEnable(m_htiCommunityCheck, bCheck);
			}
		}
		// <== ban systems optional - Stulle
		
	SetModified();
	}
	return 0;
}