|
|
1.1 ! root 1: /* Synchronet Control Panel (GUI Borland C++ Builder Project for Win32) */ ! 2: ! 3: /* $Id: FtpCfgDlgUnit.cpp,v 1.3 2000/11/02 03:42:18 rswindell Exp $ */ ! 4: ! 5: /**************************************************************************** ! 6: * @format.tab-size 4 (Plain Text/Source Code File Header) * ! 7: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * ! 8: * * ! 9: * Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html * ! 10: * * ! 11: * This program is free software; you can redistribute it and/or * ! 12: * modify it under the terms of the GNU General Public License * ! 13: * as published by the Free Software Foundation; either version 2 * ! 14: * of the License, or (at your option) any later version. * ! 15: * See the GNU General Public License for more details: gpl.txt or * ! 16: * http://www.fsf.org/copyleft/gpl.html * ! 17: * * ! 18: * Anonymous FTP access to the most recent released source is available at * ! 19: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net * ! 20: * * ! 21: * Anonymous CVS access to the development source and modification history * ! 22: * is available at cvs.synchro.net:/cvsroot/sbbs, example: * ! 23: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login * ! 24: * (just hit return, no password is necessary) * ! 25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src * ! 26: * * ! 27: * For Synchronet coding style and modification guidelines, see * ! 28: * http://www.synchro.net/source.html * ! 29: * * ! 30: * You are encouraged to submit any modifications (preferably in Unix diff * ! 31: * format) via e-mail to [email protected] * ! 32: * * ! 33: * Note: If this box doesn't appear square, then you need to fix your tabs. * ! 34: ****************************************************************************/ ! 35: ! 36: //--------------------------------------------------------------------- ! 37: #include <vcl.h> ! 38: #pragma hdrstop ! 39: ! 40: #include "MainFormUnit.h" ! 41: #include "FtpCfgDlgUnit.h" ! 42: #include "TextFileEditUnit.h" ! 43: #include <stdio.h> // sprintf() ! 44: #include <mmsystem.h> // sndPlaySound() ! 45: //--------------------------------------------------------------------- ! 46: #pragma resource "*.dfm" ! 47: TFtpCfgDlg *FtpCfgDlg; ! 48: //--------------------------------------------------------------------- ! 49: __fastcall TFtpCfgDlg::TFtpCfgDlg(TComponent* AOwner) ! 50: : TForm(AOwner) ! 51: { ! 52: } ! 53: //--------------------------------------------------------------------- ! 54: void __fastcall TFtpCfgDlg::FormShow(TObject *Sender) ! 55: { ! 56: char str[128]; ! 57: ! 58: if(MainForm->ftp_startup.interface_addr==0) ! 59: NetworkInterfaceEdit->Text="<ANY>"; ! 60: else { ! 61: sprintf(str,"%d.%d.%d.%d" ! 62: ,(MainForm->ftp_startup.interface_addr>>24)&0xff ! 63: ,(MainForm->ftp_startup.interface_addr>>16)&0xff ! 64: ,(MainForm->ftp_startup.interface_addr>>8)&0xff ! 65: ,MainForm->ftp_startup.interface_addr&0xff ! 66: ); ! 67: NetworkInterfaceEdit->Text=AnsiString(str); ! 68: } ! 69: MaxClientsEdit->Text=AnsiString((int)MainForm->ftp_startup.max_clients); ! 70: MaxInactivityEdit->Text=AnsiString((int)MainForm->ftp_startup.max_inactivity); ! 71: PortEdit->Text=AnsiString((int)MainForm->ftp_startup.port); ! 72: AutoStartCheckBox->Checked=MainForm->FtpAutoStart; ! 73: LogFileCheckBox->Checked=MainForm->FtpLogFile; ! 74: ! 75: IndexFileNameEdit->Text=AnsiString(MainForm->ftp_startup.index_file_name); ! 76: AnswerSoundEdit->Text=AnsiString(MainForm->ftp_startup.answer_sound); ! 77: HangupSoundEdit->Text=AnsiString(MainForm->ftp_startup.hangup_sound); ! 78: CmdLogCheckBox->Checked=MainForm->ftp_startup.options&FTP_OPT_DEBUG_RX; ! 79: DebugTxCheckBox->Checked=MainForm->ftp_startup.options&FTP_OPT_DEBUG_TX; ! 80: DebugDataCheckBox->Checked=MainForm->ftp_startup.options&FTP_OPT_DEBUG_DATA; ! 81: DirFilesCheckBox->Checked=MainForm->ftp_startup.options&FTP_OPT_DIR_FILES; ! 82: AllowQWKCheckBox->Checked ! 83: =MainForm->ftp_startup.options&FTP_OPT_ALLOW_QWK; ! 84: LocalFileSysCheckBox->Checked ! 85: =!(MainForm->ftp_startup.options&FTP_OPT_NO_LOCAL_FSYS); ! 86: HostnameCheckBox->Checked ! 87: =!(MainForm->ftp_startup.options&FTP_OPT_NO_HOST_LOOKUP); ! 88: AutoIndexCheckBox->Checked=MainForm->ftp_startup.options&FTP_OPT_INDEX_FILE; ! 89: AutoIndexCheckBoxClick(Sender); ! 90: PageControl->ActivePage=GeneralTabSheet; ! 91: } ! 92: //--------------------------------------------------------------------------- ! 93: ! 94: void __fastcall TFtpCfgDlg::OKBtnClick(TObject *Sender) ! 95: { ! 96: char str[128],*p; ! 97: DWORD addr; ! 98: ! 99: sprintf(str,"%.*s",sizeof(str)-1 ! 100: ,NetworkInterfaceEdit->Text.c_str()); ! 101: p=str; ! 102: while(*p && *p<=' ') p++; ! 103: if(*p && isdigit(*p)) { ! 104: addr=atoi(p)<<24; ! 105: while(*p && *p!='.') p++; ! 106: if(*p=='.') p++; ! 107: addr|=atoi(p)<<16; ! 108: while(*p && *p!='.') p++; ! 109: if(*p=='.') p++; ! 110: addr|=atoi(p)<<8; ! 111: while(*p && *p!='.') p++; ! 112: if(*p=='.') p++; ! 113: addr|=atoi(p); ! 114: MainForm->ftp_startup.interface_addr=addr; ! 115: } else ! 116: MainForm->ftp_startup.interface_addr=0; ! 117: MainForm->ftp_startup.max_clients=MaxClientsEdit->Text.ToIntDef(10); ! 118: MainForm->ftp_startup.max_inactivity=MaxInactivityEdit->Text.ToIntDef(300); ! 119: MainForm->ftp_startup.port=PortEdit->Text.ToIntDef(23); ! 120: MainForm->FtpAutoStart=AutoStartCheckBox->Checked; ! 121: MainForm->FtpLogFile=LogFileCheckBox->Checked; ! 122: ! 123: sprintf(MainForm->ftp_startup.index_file_name,"%.*s" ! 124: ,sizeof(MainForm->ftp_startup.index_file_name)-1 ! 125: ,IndexFileNameEdit->Text.c_str()); ! 126: sprintf(MainForm->ftp_startup.answer_sound,"%.*s" ! 127: ,sizeof(MainForm->ftp_startup.answer_sound)-1 ! 128: ,AnswerSoundEdit->Text.c_str()); ! 129: sprintf(MainForm->ftp_startup.hangup_sound,"%.*s" ! 130: ,sizeof(MainForm->ftp_startup.hangup_sound)-1 ! 131: ,HangupSoundEdit->Text.c_str()); ! 132: if(DebugTxCheckBox->Checked==true) ! 133: MainForm->ftp_startup.options|=FTP_OPT_DEBUG_TX; ! 134: else ! 135: MainForm->ftp_startup.options&=~FTP_OPT_DEBUG_TX; ! 136: if(CmdLogCheckBox->Checked==true) ! 137: MainForm->ftp_startup.options|=FTP_OPT_DEBUG_RX; ! 138: else ! 139: MainForm->ftp_startup.options&=~FTP_OPT_DEBUG_RX; ! 140: if(DebugDataCheckBox->Checked==true) ! 141: MainForm->ftp_startup.options|=FTP_OPT_DEBUG_DATA; ! 142: else ! 143: MainForm->ftp_startup.options&=~FTP_OPT_DEBUG_DATA; ! 144: if(HostnameCheckBox->Checked==false) ! 145: MainForm->ftp_startup.options|=FTP_OPT_NO_HOST_LOOKUP; ! 146: else ! 147: MainForm->ftp_startup.options&=~FTP_OPT_NO_HOST_LOOKUP; ! 148: if(AllowQWKCheckBox->Checked==true) ! 149: MainForm->ftp_startup.options|=FTP_OPT_ALLOW_QWK; ! 150: else ! 151: MainForm->ftp_startup.options&=~FTP_OPT_ALLOW_QWK; ! 152: if(DirFilesCheckBox->Checked==true) ! 153: MainForm->ftp_startup.options|=FTP_OPT_DIR_FILES; ! 154: else ! 155: MainForm->ftp_startup.options&=~FTP_OPT_DIR_FILES; ! 156: if(LocalFileSysCheckBox->Checked==false) ! 157: MainForm->ftp_startup.options|=FTP_OPT_NO_LOCAL_FSYS; ! 158: else ! 159: MainForm->ftp_startup.options&=~FTP_OPT_NO_LOCAL_FSYS; ! 160: if(AutoIndexCheckBox->Checked==true) ! 161: MainForm->ftp_startup.options|=FTP_OPT_INDEX_FILE; ! 162: else ! 163: MainForm->ftp_startup.options&=~FTP_OPT_INDEX_FILE; ! 164: ! 165: MainForm->SaveSettings(Sender); ! 166: } ! 167: //--------------------------------------------------------------------------- ! 168: ! 169: void __fastcall TFtpCfgDlg::AnswerSoundButtonClick(TObject *Sender) ! 170: { ! 171: OpenDialog->FileName=AnswerSoundEdit->Text; ! 172: if(OpenDialog->Execute()==true) { ! 173: AnswerSoundEdit->Text=OpenDialog->FileName; ! 174: sndPlaySound(OpenDialog->FileName.c_str(),SND_ASYNC); ! 175: } ! 176: } ! 177: //--------------------------------------------------------------------------- ! 178: ! 179: void __fastcall TFtpCfgDlg::HangupSoundButtonClick(TObject *Sender) ! 180: { ! 181: OpenDialog->FileName=HangupSoundEdit->Text; ! 182: if(OpenDialog->Execute()==true) { ! 183: HangupSoundEdit->Text=OpenDialog->FileName; ! 184: sndPlaySound(OpenDialog->FileName.c_str(),SND_ASYNC); ! 185: } ! 186: } ! 187: //--------------------------------------------------------------------------- ! 188: ! 189: void __fastcall TFtpCfgDlg::AutoIndexCheckBoxClick(TObject *Sender) ! 190: { ! 191: IndexFileNameEdit->Enabled=AutoIndexCheckBox->Checked; ! 192: } ! 193: //--------------------------------------------------------------------------- ! 194: ! 195:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.