--- sbbs/sbbs3/ctrl/ftpcfgdlgunit.cpp 2018/04/24 16:39:34 1.1 +++ sbbs/sbbs3/ctrl/ftpcfgdlgunit.cpp 2018/04/24 16:41:09 1.1.1.2 @@ -1,6 +1,6 @@ /* Synchronet Control Panel (GUI Borland C++ Builder Project for Win32) */ -/* $Id: ftpcfgdlgunit.cpp,v 1.1 2018/04/24 16:39:34 root Exp $ */ +/* $Id: ftpcfgdlgunit.cpp,v 1.1.1.2 2018/04/24 16:41:09 root Exp $ */ /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * @@ -68,13 +68,17 @@ void __fastcall TFtpCfgDlg::FormShow(TOb } MaxClientsEdit->Text=AnsiString((int)MainForm->ftp_startup.max_clients); MaxInactivityEdit->Text=AnsiString((int)MainForm->ftp_startup.max_inactivity); + QwkTimeoutEdit->Text=AnsiString((int)MainForm->ftp_startup.qwk_timeout); PortEdit->Text=AnsiString((int)MainForm->ftp_startup.port); AutoStartCheckBox->Checked=MainForm->FtpAutoStart; LogFileCheckBox->Checked=MainForm->FtpLogFile; IndexFileNameEdit->Text=AnsiString(MainForm->ftp_startup.index_file_name); + HtmlFileNameEdit->Text=AnsiString(MainForm->ftp_startup.html_index_file); + HtmlJavaScriptEdit->Text=AnsiString(MainForm->ftp_startup.html_index_script); AnswerSoundEdit->Text=AnsiString(MainForm->ftp_startup.answer_sound); HangupSoundEdit->Text=AnsiString(MainForm->ftp_startup.hangup_sound); + HackAttemptSoundEdit->Text=AnsiString(MainForm->ftp_startup.hack_sound); CmdLogCheckBox->Checked=MainForm->ftp_startup.options&FTP_OPT_DEBUG_RX; DebugTxCheckBox->Checked=MainForm->ftp_startup.options&FTP_OPT_DEBUG_TX; DebugDataCheckBox->Checked=MainForm->ftp_startup.options&FTP_OPT_DEBUG_DATA; @@ -87,6 +91,10 @@ void __fastcall TFtpCfgDlg::FormShow(TOb =!(MainForm->ftp_startup.options&FTP_OPT_NO_HOST_LOOKUP); AutoIndexCheckBox->Checked=MainForm->ftp_startup.options&FTP_OPT_INDEX_FILE; AutoIndexCheckBoxClick(Sender); + HtmlIndexCheckBox->Checked + =MainForm->ftp_startup.options&FTP_OPT_HTML_INDEX_FILE; + HtmlIndexCheckBoxClick(Sender); + PageControl->ActivePage=GeneralTabSheet; } //--------------------------------------------------------------------------- @@ -96,8 +104,7 @@ void __fastcall TFtpCfgDlg::OKBtnClick(T char str[128],*p; DWORD addr; - sprintf(str,"%.*s",sizeof(str)-1 - ,NetworkInterfaceEdit->Text.c_str()); + SAFECOPY(str,NetworkInterfaceEdit->Text.c_str()); p=str; while(*p && *p<=' ') p++; if(*p && isdigit(*p)) { @@ -116,19 +123,25 @@ void __fastcall TFtpCfgDlg::OKBtnClick(T MainForm->ftp_startup.interface_addr=0; MainForm->ftp_startup.max_clients=MaxClientsEdit->Text.ToIntDef(10); MainForm->ftp_startup.max_inactivity=MaxInactivityEdit->Text.ToIntDef(300); + MainForm->ftp_startup.qwk_timeout=QwkTimeoutEdit->Text.ToIntDef(600); MainForm->ftp_startup.port=PortEdit->Text.ToIntDef(23); MainForm->FtpAutoStart=AutoStartCheckBox->Checked; MainForm->FtpLogFile=LogFileCheckBox->Checked; - sprintf(MainForm->ftp_startup.index_file_name,"%.*s" - ,sizeof(MainForm->ftp_startup.index_file_name)-1 + SAFECOPY(MainForm->ftp_startup.index_file_name ,IndexFileNameEdit->Text.c_str()); - sprintf(MainForm->ftp_startup.answer_sound,"%.*s" - ,sizeof(MainForm->ftp_startup.answer_sound)-1 + SAFECOPY(MainForm->ftp_startup.html_index_file + ,HtmlFileNameEdit->Text.c_str()); + SAFECOPY(MainForm->ftp_startup.html_index_script + ,HtmlJavaScriptEdit->Text.c_str()); + + SAFECOPY(MainForm->ftp_startup.answer_sound ,AnswerSoundEdit->Text.c_str()); - sprintf(MainForm->ftp_startup.hangup_sound,"%.*s" - ,sizeof(MainForm->ftp_startup.hangup_sound)-1 + SAFECOPY(MainForm->ftp_startup.hangup_sound ,HangupSoundEdit->Text.c_str()); + SAFECOPY(MainForm->ftp_startup.hack_sound + ,HackAttemptSoundEdit->Text.c_str()); + if(DebugTxCheckBox->Checked==true) MainForm->ftp_startup.options|=FTP_OPT_DEBUG_TX; else @@ -161,6 +174,10 @@ void __fastcall TFtpCfgDlg::OKBtnClick(T MainForm->ftp_startup.options|=FTP_OPT_INDEX_FILE; else MainForm->ftp_startup.options&=~FTP_OPT_INDEX_FILE; + if(HtmlIndexCheckBox->Checked==true) + MainForm->ftp_startup.options|=FTP_OPT_HTML_INDEX_FILE; + else + MainForm->ftp_startup.options&=~FTP_OPT_HTML_INDEX_FILE; MainForm->SaveSettings(Sender); } @@ -185,6 +202,15 @@ void __fastcall TFtpCfgDlg::HangupSoundB } } //--------------------------------------------------------------------------- +void __fastcall TFtpCfgDlg::HackAttemptSoundButtonClick(TObject *Sender) +{ + OpenDialog->FileName=HackAttemptSoundEdit->Text; + if(OpenDialog->Execute()==true) { + HackAttemptSoundEdit->Text=OpenDialog->FileName; + sndPlaySound(OpenDialog->FileName.c_str(),SND_ASYNC); + } +} +//--------------------------------------------------------------------------- void __fastcall TFtpCfgDlg::AutoIndexCheckBoxClick(TObject *Sender) { @@ -192,4 +218,22 @@ void __fastcall TFtpCfgDlg::AutoIndexChe } //--------------------------------------------------------------------------- + +void __fastcall TFtpCfgDlg::HtmlJavaScriptButtonClick(TObject *Sender) +{ + OpenDialog->FileName=HtmlJavaScriptEdit->Text; + if(OpenDialog->Execute()==true) { + HtmlJavaScriptEdit->Text=OpenDialog->FileName; + } +} +//--------------------------------------------------------------------------- + +void __fastcall TFtpCfgDlg::HtmlIndexCheckBoxClick(TObject *Sender) +{ + HtmlFileNameEdit->Enabled=HtmlIndexCheckBox->Checked; + HtmlJavaScriptEdit->Enabled=HtmlIndexCheckBox->Checked; + HtmlJavaScriptLabel->Enabled=HtmlIndexCheckBox->Checked; +} +//--------------------------------------------------------------------------- +