From 6a3334a3e4e785e17792bd541f86195c5c406ad0 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Wed, 31 Oct 2018 08:13:07 +0000
Subject: [PATCH] New BBS Option flag: NO_NEWDAY_EVENTS, which when set will
 cause daily maintenance and any system daily event to *not* execute in the
 event thread (i.e. very soon after midnight), but instead require a BBS user
 logon/off to initiate these daily tasks, or (as I use it) another instance of
 sbbs which is better suited to these daily tasks.

---
 src/sbbs3/main.cpp  | 9 +++++----
 src/sbbs3/startup.h | 2 ++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index bff9ff8883..5edad5e139 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -2810,10 +2810,11 @@ void event_thread(void* arg)
 
 			/* Run daily maintenance? */
 			sbbs->cfg.node_num=0;
-			sbbs->logonstats();
-			if(sbbs->sys_status&SS_DAILY)
-				sbbs->daily_maint();
-
+			if(!(startup->options&BBS_OPT_NO_NEWDAY_EVENTS)) {
+				sbbs->logonstats();
+				if(sbbs->sys_status&SS_DAILY)
+					sbbs->daily_maint();
+			}
 			/* Node Daily Events */
 			sbbs->event_code = "DAILY";
 			for(i=first_node;i<=last_node;i++) {
diff --git a/src/sbbs3/startup.h b/src/sbbs3/startup.h
index 0dcda62426..0ac4822ec7 100644
--- a/src/sbbs3/startup.h
+++ b/src/sbbs3/startup.h
@@ -189,6 +189,7 @@ static struct init_field {
 #define BBS_OPT_NO_HOST_LOOKUP		(1<<11)
 #define BBS_OPT_ALLOW_SSH			(1<<12)	/* Allow logins via BSD SSH			*/
 #define BBS_OPT_NO_DOS				(1<<13) /* Don't attempt to run 16-bit DOS programs */
+#define BBS_OPT_NO_NEWDAY_EVENTS	(1<<14)	/* Don't check for a new day in event thread */
 #define BBS_OPT_NO_RECYCLE			(1<<27)	/* Disable recycling of server		*/
 #define BBS_OPT_GET_IDENT			(1<<28)	/* Get Identity (RFC 1413)			*/
 #define BBS_OPT_NO_JAVASCRIPT		(1<<29)	/* JavaScript disabled				*/
@@ -213,6 +214,7 @@ static ini_bitdesc_t bbs_options[] = {
 	{ BBS_OPT_NO_SPY_SOCKETS		,"NO_SPY_SOCKETS"		},
 	{ BBS_OPT_ALLOW_SSH				,"ALLOW_SSH"			},
 	{ BBS_OPT_NO_DOS				,"NO_DOS"				},
+	{ BBS_OPT_NO_NEWDAY_EVENTS		,"NO_NEWDAY_EVENTS"		},
 	{ BBS_OPT_NO_RECYCLE			,"NO_RECYCLE"			},
 	{ BBS_OPT_GET_IDENT				,"GET_IDENT"			},
 	{ BBS_OPT_NO_JAVASCRIPT			,"NO_JAVASCRIPT"		},
-- 
GitLab