diff --git a/src/sbbs3/ctrl/MainFormUnit.cpp b/src/sbbs3/ctrl/MainFormUnit.cpp index 09003cf32c21a912b18b9033ec14d508ca5ff7fc..647e86ba55c9d9b3a7ded9ad7146a5455bb9d1ae 100644 --- a/src/sbbs3/ctrl/MainFormUnit.cpp +++ b/src/sbbs3/ctrl/MainFormUnit.cpp @@ -126,6 +126,9 @@ DWORD services_svc_config_size; DWORD MaxLogLen=20000; int threads=1; +time_t initialized=0; +static str_list_t recycle_semfiles; +static str_list_t shutdown_semfiles; static void thread_up(void* p, BOOL up, BOOL setuid) { @@ -2224,6 +2227,12 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender) return; } + recycle_semfiles=semfile_list_init(cfg.ctrl_dir,"recycle","ctrl"); + semfile_list_check(&initialized,recycle_semfiles); + + shutdown_semfiles=semfile_list_init(cfg.ctrl_dir,"shutdown","ctrl"); + semfile_list_check(&initialized,shutdown_semfiles); + if(!(cfg.sys_misc&SM_LOCAL_TZ)) { if(putenv("TZ=UTC0")) { Application->MessageBox("Error setting timezone" @@ -2335,6 +2344,9 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender) NodeForm->Timer->Enabled=true; ClientForm->Timer->Enabled=true; + SemFileTimer->Interval=global.sem_chk_freq; + SemFileTimer->Enabled=true; + StatsTimer->Interval=cfg.node_stat_check*1000; StatsTimer->Enabled=true; Initialized=true; @@ -3131,6 +3143,7 @@ void __fastcall TMainForm::PropertiesExecute(TObject *Sender) SAFECOPY(global.ctrl_dir,PropertiesDlg->CtrlDirEdit->Text.c_str()); SAFECOPY(global.temp_dir,PropertiesDlg->TempDirEdit->Text.c_str()); global.sem_chk_freq=PropertiesDlg->SemFreqUpDown->Position; + SemFileTimer->Interval=global.sem_chk_freq; /* Copy global values to server startup structs */ /* We don't support per-server unique values here (yet) */ @@ -3262,6 +3275,7 @@ void __fastcall TMainForm::ReloadConfigExecute(TObject *Sender) FtpRecycleExecute(Sender); WebRecycleExecute(Sender); MailRecycleExecute(Sender); + TelnetRecycleExecute(Sender); ServicesRecycleExecute(Sender); char error[256]; @@ -3271,7 +3285,9 @@ void __fastcall TMainForm::ReloadConfigExecute(TObject *Sender) ,MB_OK|MB_ICONEXCLAMATION); Application->Terminate(); } + semfile_list_check(&initialized,recycle_semfiles); +#if 0 /* This appears to be redundant */ node_t node; for(int i=0;i<cfg.sys_nodes;i++) { int file; @@ -3281,6 +3297,7 @@ void __fastcall TMainForm::ReloadConfigExecute(TObject *Sender) if(NodeForm->putnodedat(i+1,&node,file)) break; } +#endif } //--------------------------------------------------------------------------- @@ -3682,3 +3699,20 @@ void __fastcall TMainForm::ViewFile(AnsiString filename, AnsiString Caption) } //--------------------------------------------------------------------------- + + +void __fastcall TMainForm::SemFileTimerTick(TObject *Sender) +{ + char* p; + + if((p=semfile_list_check(&initialized,shutdown_semfiles))!=NULL) { + StatusBar->Panels->Items[4]->Text=AnsiString(p) + " signaled"; + Close(); + } + else if((p=semfile_list_check(&initialized,recycle_semfiles))!=NULL) { + StatusBar->Panels->Items[4]->Text=AnsiString(p) + " signaled"; + ReloadConfigExecute(Sender); + } +} +//--------------------------------------------------------------------------- + diff --git a/src/sbbs3/ctrl/MainFormUnit.dfm b/src/sbbs3/ctrl/MainFormUnit.dfm index 5a3fb7fa775165e8d44a8ff15c79ee67733ae1be..5033ddb3b246a67a02fdedfa86676b5a672d4d39 100644 --- a/src/sbbs3/ctrl/MainFormUnit.dfm +++ b/src/sbbs3/ctrl/MainFormUnit.dfm @@ -10,7 +10,7 @@ object MainForm: TMainForm DragMode = dmAutomatic Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText - Font.Height = -14 + Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] Icon.Data = { @@ -46,11 +46,11 @@ object MainForm: TMainForm OnCloseQuery = FormCloseQuery OnCreate = FormCreate OnShow = FormShow - PixelsPerInch = 120 - TextHeight = 16 + PixelsPerInch = 96 + TextHeight = 13 object HorizontalSplitter: TSplitter Left = 0 - Top = 195 + Top = 164 Width = 632 Height = 1 Cursor = crVSplit @@ -61,9 +61,9 @@ object MainForm: TMainForm end object Logo: TImage Left = 0 - Top = 196 + Top = 165 Width = 632 - Height = 121 + Height = 162 Align = alClient AutoSize = True Center = True @@ -13499,7 +13499,7 @@ object MainForm: TMainForm Left = 0 Top = 30 Width = 632 - Height = 165 + Height = 134 Align = alTop BevelOuter = bvNone Constraints.MinHeight = 100 @@ -13507,18 +13507,18 @@ object MainForm: TMainForm TabOrder = 1 Visible = False object TopVerticalSplitter: TSplitter - Left = 289 + Left = 235 Top = 0 - Width = 3 - Height = 165 + Width = 2 + Height = 134 Cursor = crHSplit MinSize = 1 end object UpperLeftPageControl: TPageControl Left = 0 Top = 0 - Width = 289 - Height = 165 + Width = 235 + Height = 134 Align = alLeft DockSite = True TabOrder = 0 @@ -13526,10 +13526,10 @@ object MainForm: TMainForm OnUnDock = PageControlUnDock end object UpperRightPageControl: TPageControl - Left = 292 + Left = 237 Top = 0 - Width = 340 - Height = 165 + Width = 395 + Height = 134 Align = alClient DockSite = True TabOrder = 1 @@ -13539,26 +13539,26 @@ object MainForm: TMainForm end object BottomPanel: TPanel Left = 0 - Top = 196 + Top = 165 Width = 632 - Height = 121 + Height = 162 Align = alClient BevelOuter = bvNone TabOrder = 2 Visible = False object BottomVerticalSplitter: TSplitter - Left = 289 + Left = 235 Top = 0 - Width = 3 - Height = 121 + Width = 2 + Height = 162 Cursor = crHSplit MinSize = 1 end object LowerLeftPageControl: TPageControl Left = 0 Top = 0 - Width = 289 - Height = 121 + Width = 235 + Height = 162 Align = alLeft DockSite = True TabOrder = 0 @@ -13566,10 +13566,10 @@ object MainForm: TMainForm OnUnDock = PageControlUnDock end object LowerRightPageControl: TPageControl - Left = 292 + Left = 237 Top = 0 - Width = 340 - Height = 121 + Width = 395 + Height = 162 Align = alClient DockSite = True TabOrder = 1 @@ -13579,7 +13579,7 @@ object MainForm: TMainForm end object StatusBar: TStatusBar Left = 0 - Top = 317 + Top = 327 Width = 632 Height = 25 Panels = < @@ -16995,4 +16995,11 @@ object MainForm: TMainForm Left = 504 Top = 40 end + object SemFileTimer: TTimer + Enabled = False + Interval = 5000 + OnTimer = SemFileTimerTick + Left = 472 + Top = 40 + end end diff --git a/src/sbbs3/ctrl/MainFormUnit.h b/src/sbbs3/ctrl/MainFormUnit.h index af58f0b15f9c9f07fc72084e822b0105f219d810..a5be4e304df27aaccc399d9f314874a99bafa599 100644 --- a/src/sbbs3/ctrl/MainFormUnit.h +++ b/src/sbbs3/ctrl/MainFormUnit.h @@ -302,6 +302,7 @@ __published: // IDE-managed Components TMenuItem *ConfigureWebTrayMenuItem; TMenuItem *ConfigureServicesTrayMenuItem; TMenuItem *HelpTechnicalSupportMenuItem; + TTimer *SemFileTimer; void __fastcall FileExitMenuItemClick(TObject *Sender); void __fastcall ViewToolbarMenuItemClick(TObject *Sender); void __fastcall FormClose(TObject *Sender, TCloseAction &Action); @@ -390,6 +391,7 @@ __published: // IDE-managed Components void __fastcall WebRecycleExecute(TObject *Sender); void __fastcall WebConfigureExecute(TObject *Sender); void __fastcall ViewServicesExecute(TObject *Sender); + void __fastcall SemFileTimerTick(TObject *Sender); private: // User declarations public: // User declarations __fastcall TMainForm(TComponent* Owner);