From 5940d582db2b6630b39d44afde475d86c63dcf47 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Windows 11)" <rob@synchro.net>
Date: Sat, 10 Feb 2024 21:06:36 -0800
Subject: [PATCH] Separate "natural" (no sort) order from "Date ascending" sort
 order for dirs

Since it is possible for someone to change the add/import date of a file
after it's been added to the filebase, the natural/unsorted order might not
actually be the same as "date ascending", so let the sysop/script-author
really re-sort by date ascending if that's what they're trying to do.

I think this is addresses the issue that Nightfox and Nelgin were describing
in #synchronet.
---
 src/sbbs3/js_filebase.c   | 2 +-
 src/sbbs3/sbbsdefs.h      | 2 +-
 src/sbbs3/scfg/scfgxfr2.c | 6 ++++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/sbbs3/js_filebase.c b/src/sbbs3/js_filebase.c
index b4c61f2192..cf6a4dae9c 100644
--- a/src/sbbs3/js_filebase.c
+++ b/src/sbbs3/js_filebase.c
@@ -1851,7 +1851,7 @@ static const char* filebase_detail_prop_desc[] = {
 };
 
 static const char* filebase_sort_prop_desc[] = {
-	"Natural sort order (same as DATE_A)",
+	"Natural/index order (no sorting)",
 	"Filename ascending, case insensitive sort order",
 	"Filename descending, case insensitive sort order",
 	"Filename ascending, case sensitive sort order",
diff --git a/src/sbbs3/sbbsdefs.h b/src/sbbs3/sbbsdefs.h
index 0a9d03fbbb..3f156263c2 100644
--- a/src/sbbs3/sbbsdefs.h
+++ b/src/sbbs3/sbbsdefs.h
@@ -307,7 +307,7 @@ enum file_sort {                    /* Values for dir[x].sort */
     ,FILE_SORT_DATE_D   = 3         /* Sort by upload date, descending */
 	,FILE_SORT_SIZE_A	= 6			/* Sort by file size, ascending */
 	,FILE_SORT_SIZE_D	= 7			/* Sort by file size, descending */
-	,FILE_SORT_NATURAL  = FILE_SORT_DATE_A
+	,FILE_SORT_NATURAL  = 8			/* No sorting */
 };
 
 /* Values for grp[x].sort */
diff --git a/src/sbbs3/scfg/scfgxfr2.c b/src/sbbs3/scfg/scfgxfr2.c
index f8d6804f6b..dbf680781d 100644
--- a/src/sbbs3/scfg/scfgxfr2.c
+++ b/src/sbbs3/scfg/scfgxfr2.c
@@ -35,6 +35,7 @@ char* file_sort_desc[] = {
 	"Name Descending (case-sensitive)",
 	"Size Ascending",
 	"Size Descending",
+	"None (unsorted natural index order)",
 	NULL
 };
 
@@ -127,7 +128,8 @@ static char* sort_help =
 	"\n"
 	"The dates available for sorting are the file import/upload date/time.\n"
 	"\n"
-	"The natural (and thus fastest) sort order is `Date Ascending`."
+	"The natural (and thus fastest) sort order is `None`, which is normally\n"
+	"the order in which the files were added/imported into the filebase."
 	;
 
 static bool new_dir(unsigned new_dirnum, unsigned libnum)
@@ -2076,7 +2078,7 @@ void dir_cfg(int libnum)
 						"\n"
 						"This is the advanced options menu for the selected file directory.\n"
 					;
-						n=uifc.list(WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT,3,4,65,&adv_dflt,0
+						n=uifc.list(WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT,3,4,66,&adv_dflt,0
 							,"Advanced Options",opt);
 						if(n==-1)
 							break;
-- 
GitLab