From 86d1adcf709dfb07a80d3138b4bcd701e346c532 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Mon, 25 Mar 2002 09:11:23 +0000 Subject: [PATCH] Added Advanced Properites tabsheet with Hostname configuration edit box. --- src/sbbs3/ctrl/MainFormUnit.cpp | 77 ++++++++++--------- src/sbbs3/ctrl/MainFormUnit.h | 1 + src/sbbs3/ctrl/PropertiesDlgUnit.dfm | 106 ++++++++++++++++----------- src/sbbs3/ctrl/PropertiesDlgUnit.h | 7 +- 4 files changed, 108 insertions(+), 83 deletions(-) diff --git a/src/sbbs3/ctrl/MainFormUnit.cpp b/src/sbbs3/ctrl/MainFormUnit.cpp index b906a94385..28f9e4ab24 100644 --- a/src/sbbs3/ctrl/MainFormUnit.cpp +++ b/src/sbbs3/ctrl/MainFormUnit.cpp @@ -271,9 +271,11 @@ static void bbs_start(void) { Screen->Cursor=crAppStart; bbs_status("Starting"); - strcpy(MainForm->bbs_startup.ctrl_dir,MainForm->CtrlDirectory.c_str()); + SAFECOPY(MainForm->bbs_startup.ctrl_dir + ,MainForm->CtrlDirectory.c_str()); + SAFECOPY(MainForm->bbs_startup.host_name + ,MainForm->Hostname.c_str()); _beginthread((void(*)(void*))bbs_thread,0,&MainForm->bbs_startup); - Application->ProcessMessages(); } @@ -446,7 +448,10 @@ static void mail_start(void) { Screen->Cursor=crAppStart; mail_status("Starting"); - strcpy(MainForm->mail_startup.ctrl_dir,MainForm->CtrlDirectory.c_str()); + SAFECOPY(MainForm->mail_startup.ctrl_dir + ,MainForm->CtrlDirectory.c_str()); + SAFECOPY(MainForm->mail_startup.host_name + ,MainForm->Hostname.c_str()); _beginthread((void(*)(void*))mail_server,0,&MainForm->mail_startup); Application->ProcessMessages(); } @@ -566,7 +571,10 @@ static void ftp_start(void) { Screen->Cursor=crAppStart; ftp_status("Starting"); - strcpy(MainForm->ftp_startup.ctrl_dir,MainForm->CtrlDirectory.c_str()); + SAFECOPY(MainForm->ftp_startup.ctrl_dir + ,MainForm->CtrlDirectory.c_str()); + SAFECOPY(MainForm->ftp_startup.host_name + ,MainForm->Hostname.c_str()); _beginthread((void(*)(void*))ftp_server,0,&MainForm->ftp_startup); Application->ProcessMessages(); } @@ -806,9 +814,11 @@ void __fastcall TMainForm::ServicesStartExecute(TObject *Sender) Screen->Cursor=crAppStart; services_status("Starting"); - strcpy(MainForm->services_startup.ctrl_dir,MainForm->CtrlDirectory.c_str()); + SAFECOPY(MainForm->services_startup.ctrl_dir + ,MainForm->CtrlDirectory.c_str()); + SAFECOPY(MainForm->services_startup.host_name + ,MainForm->Hostname.c_str()); _beginthread((void(*)(void*))services_thread,0,&MainForm->services_startup); - Application->ProcessMessages(); } //--------------------------------------------------------------------------- @@ -1362,6 +1372,8 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender) ViewToolbarMenuItem->Checked=Toolbar->Visible; ViewStatusBarMenuItem->Checked=StatusBar->Visible; + if(Registry->ValueExists("Hostname")) + Hostname=Registry->ReadString("Hostname"); if(Registry->ValueExists("CtrlDirectory")) CtrlDirectory=Registry->ReadString("CtrlDirectory"); if(Registry->ValueExists("LoginCommand")) @@ -1407,15 +1419,13 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender) bbs_startup.xtrn_polls_before_yield=Registry->ReadInteger("ExternalYield"); if(Registry->ValueExists("AnswerSound")) - sprintf(bbs_startup.answer_sound,"%.*s" - ,sizeof(bbs_startup.answer_sound)-1 + SAFECOPY(bbs_startup.answer_sound ,Registry->ReadString("AnswerSound").c_str()); else FirstRun=true; if(Registry->ValueExists("HangupSound")) - sprintf(bbs_startup.hangup_sound,"%.*s" - ,sizeof(bbs_startup.hangup_sound)-1 + SAFECOPY(bbs_startup.hangup_sound ,Registry->ReadString("HangupSound").c_str()); if(Registry->ValueExists("StartupOptions")) @@ -1445,36 +1455,30 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender) mail_startup.pop3_port=Registry->ReadInteger("MailPOP3Port"); if(Registry->ValueExists("MailRelayServer")) - sprintf(mail_startup.relay_server,"%.*s" - ,sizeof(mail_startup.relay_server)-1 + SAFECOPY(mail_startup.relay_server ,Registry->ReadString("MailRelayServer").c_str()); if(Registry->ValueExists("MailRelayPort")) mail_startup.relay_port=Registry->ReadInteger("MailRelayPort"); if(Registry->ValueExists("MailDefaultUser")) - sprintf(mail_startup.default_user,"%.*s" - ,sizeof(mail_startup.default_user)-1 + SAFECOPY(mail_startup.default_user ,Registry->ReadString("MailDefaultUser").c_str()); if(Registry->ValueExists("MailDNSServer")) - sprintf(mail_startup.dns_server,"%.*s" - ,sizeof(mail_startup.dns_server)-1 + SAFECOPY(mail_startup.dns_server ,Registry->ReadString("MailDNSServer").c_str()); if(Registry->ValueExists("MailInboundSound")) - sprintf(mail_startup.inbound_sound,"%.*s" - ,sizeof(mail_startup.inbound_sound)-1 + SAFECOPY(mail_startup.inbound_sound ,Registry->ReadString("MailInboundSound").c_str()); if(Registry->ValueExists("MailOutboundSound")) - sprintf(mail_startup.outbound_sound,"%.*s" - ,sizeof(mail_startup.outbound_sound)-1 + SAFECOPY(mail_startup.outbound_sound ,Registry->ReadString("MailOutboundSound").c_str()); if(Registry->ValueExists("MailPOP3Sound")) - sprintf(mail_startup.pop3_sound,"%.*s" - ,sizeof(mail_startup.pop3_sound)-1 + SAFECOPY(mail_startup.pop3_sound ,Registry->ReadString("MailPOP3Sound").c_str()); if(Registry->ValueExists("MailOptions")) @@ -1496,33 +1500,27 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender) ftp_startup.port=Registry->ReadInteger("FtpPort"); if(Registry->ValueExists("FtpAnswerSound")) - sprintf(ftp_startup.answer_sound,"%.*s" - ,sizeof(ftp_startup.answer_sound)-1 + SAFECOPY(ftp_startup.answer_sound ,Registry->ReadString("FtpAnswerSound").c_str()); if(Registry->ValueExists("FtpHangupSound")) - sprintf(ftp_startup.hangup_sound,"%.*s" - ,sizeof(ftp_startup.hangup_sound)-1 + SAFECOPY(ftp_startup.hangup_sound ,Registry->ReadString("FtpHangupSound").c_str()); if(Registry->ValueExists("FtpHackAttemptSound")) - sprintf(ftp_startup.hack_sound,"%.*s" - ,sizeof(ftp_startup.hack_sound)-1 + SAFECOPY(ftp_startup.hack_sound ,Registry->ReadString("FtpHackAttemptSound").c_str()); if(Registry->ValueExists("FtpIndexFileName")) - sprintf(ftp_startup.index_file_name,"%.*s" - ,sizeof(ftp_startup.index_file_name)-1 + SAFECOPY(ftp_startup.index_file_name ,Registry->ReadString("FtpIndexFileName").c_str()); if(Registry->ValueExists("FtpHtmlIndexFile")) - sprintf(ftp_startup.html_index_file,"%.*s" - ,sizeof(ftp_startup.html_index_file)-1 + SAFECOPY(ftp_startup.html_index_file ,Registry->ReadString("FtpHtmlIndexFile").c_str()); if(Registry->ValueExists("FtpHtmlIndexScript")) - sprintf(ftp_startup.html_index_script,"%.*s" - ,sizeof(ftp_startup.html_index_script)-1 + SAFECOPY(ftp_startup.html_index_script ,Registry->ReadString("FtpHtmlIndexScript").c_str()); if(Registry->ValueExists("FtpOptions")) @@ -1533,13 +1531,11 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender) =Registry->ReadInteger("ServicesInterface"); if(Registry->ValueExists("ServicesAnswerSound")) - sprintf(services_startup.answer_sound,"%.*s" - ,sizeof(services_startup.answer_sound)-1 + SAFECOPY(services_startup.answer_sound ,Registry->ReadString("ServicesAnswerSound").c_str()); if(Registry->ValueExists("ServicesHangupSound")) - sprintf(services_startup.hangup_sound,"%.*s" - ,sizeof(services_startup.hangup_sound)-1 + SAFECOPY(services_startup.hangup_sound ,Registry->ReadString("ServicesHangupSound").c_str()); if(Registry->ValueExists("ServicesOptions")) @@ -1788,6 +1784,7 @@ void __fastcall TMainForm::SaveSettings(TObject* Sender) Registry->WriteBool("ToolBarVisible",Toolbar->Visible); Registry->WriteBool("StatusBarVisible",StatusBar->Visible); + Registry->WriteString("Hostname",Hostname); Registry->WriteString("CtrlDirectory",CtrlDirectory); Registry->WriteString("LoginCommand",LoginCommand); Registry->WriteString("ConfigCommand",ConfigCommand); @@ -2256,6 +2253,7 @@ void __fastcall TMainForm::PropertiesExecute(TObject *Sender) Application->CreateForm(__classid(TPropertiesDlg), &PropertiesDlg); PropertiesDlg->LoginCmdEdit->Text=LoginCommand; PropertiesDlg->ConfigCmdEdit->Text=ConfigCommand; + PropertiesDlg->HostnameEdit->Text=Hostname; PropertiesDlg->CtrlDirEdit->Text=CtrlDirectory; PropertiesDlg->NodeIntUpDown->Position=NodeDisplayInterval; PropertiesDlg->ClientIntUpDown->Position=ClientDisplayInterval; @@ -2265,6 +2263,7 @@ void __fastcall TMainForm::PropertiesExecute(TObject *Sender) if(PropertiesDlg->ShowModal()==mrOk) { LoginCommand=PropertiesDlg->LoginCmdEdit->Text; ConfigCommand=PropertiesDlg->ConfigCmdEdit->Text; + Hostname=PropertiesDlg->HostnameEdit->Text; CtrlDirectory=PropertiesDlg->CtrlDirEdit->Text; Password=PropertiesDlg->PasswordEdit->Text; NodeDisplayInterval=PropertiesDlg->NodeIntUpDown->Position; @@ -2274,7 +2273,7 @@ void __fastcall TMainForm::PropertiesExecute(TObject *Sender) SaveSettings(Sender); } delete PropertiesDlg; - + inside=false; } //--------------------------------------------------------------------------- diff --git a/src/sbbs3/ctrl/MainFormUnit.h b/src/sbbs3/ctrl/MainFormUnit.h index a53942e064..54e8606d5e 100644 --- a/src/sbbs3/ctrl/MainFormUnit.h +++ b/src/sbbs3/ctrl/MainFormUnit.h @@ -333,6 +333,7 @@ public: // User declarations bool FtpLogFile; bool FirstRun; AnsiString CtrlDirectory; + AnsiString Hostname; AnsiString LoginCommand; AnsiString ConfigCommand; AnsiString Password; diff --git a/src/sbbs3/ctrl/PropertiesDlgUnit.dfm b/src/sbbs3/ctrl/PropertiesDlgUnit.dfm index 5d4375fdce..6392043a15 100644 --- a/src/sbbs3/ctrl/PropertiesDlgUnit.dfm +++ b/src/sbbs3/ctrl/PropertiesDlgUnit.dfm @@ -1,9 +1,9 @@ object PropertiesDlg: TPropertiesDlg - Left = 620 - Top = 340 + Left = 624 + Top = 358 BorderStyle = bsDialog Caption = 'Control Panel Properties' - ClientHeight = 321 + ClientHeight = 288 ClientWidth = 433 Color = clBtnFace ParentFont = True @@ -13,7 +13,7 @@ object PropertiesDlg: TPropertiesDlg OnShow = FormShow DesignSize = ( 433 - 321) + 288) PixelsPerInch = 120 TextHeight = 16 object OKBtn: TButton @@ -42,10 +42,10 @@ object PropertiesDlg: TPropertiesDlg Left = 8 Top = 8 Width = 313 - Height = 306 - ActivePage = SettingsTabSheet + Height = 273 + ActivePage = AdvancedTabSheet Anchors = [akLeft, akTop, akBottom] - TabIndex = 0 + TabIndex = 2 TabOrder = 2 object SettingsTabSheet: TTabSheet Caption = 'Settings' @@ -65,17 +65,9 @@ object PropertiesDlg: TPropertiesDlg AutoSize = False Caption = 'Config Command' end - object Label1: TLabel - Left = 8 - Top = 76 - Width = 110 - Height = 24 - AutoSize = False - Caption = 'Control Directory' - end object Label4: TLabel Left = 8 - Top = 108 + Top = 76 Width = 225 Height = 24 AutoSize = False @@ -83,7 +75,7 @@ object PropertiesDlg: TPropertiesDlg end object Label5: TLabel Left = 8 - Top = 140 + Top = 108 Width = 225 Height = 24 AutoSize = False @@ -91,7 +83,7 @@ object PropertiesDlg: TPropertiesDlg end object PasswordLabel: TLabel Left = 8 - Top = 238 + Top = 206 Width = 110 Height = 24 AutoSize = False @@ -117,95 +109,85 @@ object PropertiesDlg: TPropertiesDlg ShowHint = True TabOrder = 1 end - object CtrlDirEdit: TEdit - Left = 120 - Top = 76 - Width = 169 - Height = 24 - Hint = 'Control directory (e.g. c:\sbbs\ctrl)' - ParentShowHint = False - ShowHint = True - TabOrder = 2 - end object NodeIntEdit: TEdit Left = 240 - Top = 108 + Top = 76 Width = 25 Height = 24 Hint = 'Frequency of updates to Node window' ParentShowHint = False ShowHint = True - TabOrder = 3 + TabOrder = 2 Text = '1' end object NodeIntUpDown: TUpDown Left = 265 - Top = 108 + Top = 76 Width = 19 Height = 24 Associate = NodeIntEdit Min = 1 Max = 99 Position = 1 - TabOrder = 4 + TabOrder = 3 Wrap = False end object ClientIntEdit: TEdit Left = 240 - Top = 140 + Top = 108 Width = 25 Height = 24 Hint = 'Frequency of updates to clients window' ParentShowHint = False ShowHint = True - TabOrder = 5 + TabOrder = 4 Text = '1' end object ClientIntUpDown: TUpDown Left = 265 - Top = 140 + Top = 108 Width = 19 Height = 24 Associate = ClientIntEdit Min = 1 Max = 99 Position = 1 - TabOrder = 6 + TabOrder = 5 Wrap = False end object UndockableCheckBox: TCheckBox Left = 8 - Top = 170 + Top = 138 Width = 281 Height = 24 Hint = 'Allow child windows to be "un-docked" from main window' Caption = 'Undockable Windows' ParentShowHint = False ShowHint = True - TabOrder = 7 + TabOrder = 6 end object TrayIconCheckBox: TCheckBox Left = 8 - Top = 202 + Top = 170 Width = 281 Height = 24 Hint = 'Create tray icon when minimized' Caption = 'Minimize to System Tray' ParentShowHint = False ShowHint = True - TabOrder = 8 + TabOrder = 7 OnClick = TrayIconCheckBoxClick end object PasswordEdit: TEdit Left = 120 - Top = 238 + Top = 206 Width = 169 Height = 24 Hint = 'Required password for restoring from system tray icon' ParentShowHint = False PasswordChar = '*' ShowHint = True - TabOrder = 9 + TabOrder = 8 end end object CustomizeTabSheet: TTabSheet @@ -283,6 +265,46 @@ object PropertiesDlg: TPropertiesDlg 'All Windows') end end + object AdvancedTabSheet: TTabSheet + Caption = 'Advanced' + ImageIndex = 2 + object Label1: TLabel + Left = 8 + Top = 12 + Width = 110 + Height = 24 + AutoSize = False + Caption = 'Control Directory' + end + object Label6: TLabel + Left = 8 + Top = 44 + Width = 110 + Height = 24 + AutoSize = False + Caption = 'Hostname' + end + object CtrlDirEdit: TEdit + Left = 120 + Top = 12 + Width = 169 + Height = 24 + Hint = 'Control directory (e.g. c:\sbbs\ctrl)' + ParentShowHint = False + ShowHint = True + TabOrder = 0 + end + object HostnameEdit: TEdit + Left = 120 + Top = 44 + Width = 169 + Height = 24 + Hint = 'Control directory (e.g. c:\sbbs\ctrl)' + ParentShowHint = False + ShowHint = True + TabOrder = 1 + end + end end object FontDialog1: TFontDialog Font.Charset = DEFAULT_CHARSET diff --git a/src/sbbs3/ctrl/PropertiesDlgUnit.h b/src/sbbs3/ctrl/PropertiesDlgUnit.h index 2f4bb16772..3468a26e05 100644 --- a/src/sbbs3/ctrl/PropertiesDlgUnit.h +++ b/src/sbbs3/ctrl/PropertiesDlgUnit.h @@ -26,8 +26,6 @@ __published: TEdit *LoginCmdEdit; TLabel *Label2; TEdit *ConfigCmdEdit; - TLabel *Label1; - TEdit *CtrlDirEdit; TLabel *Label4; TEdit *NodeIntEdit; TUpDown *NodeIntUpDown; @@ -47,6 +45,11 @@ __published: TButton *ApplyButton; TComboBox *TargetComboBox; TColorDialog *ColorDialog1; + TTabSheet *AdvancedTabSheet; + TLabel *Label1; + TEdit *CtrlDirEdit; + TLabel *Label6; + TEdit *HostnameEdit; void __fastcall FormShow(TObject *Sender); void __fastcall TrayIconCheckBoxClick(TObject *Sender); void __fastcall SourceComboBoxChange(TObject *Sender); -- GitLab