From 23b741a1c94ac4f2d023f2aba414383b75b606cf Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Wed, 12 May 2021 21:12:11 -0700
Subject: [PATCH] Remove the archive contents in SMB file "tail" thing

This was really slowing down the upgrade_to_v319 and there's no current consumer of the data.

Consider adding back in JSON format later or just leave it to JS things to use for JSON-formatted metadata.
---
 src/sbbs3/filedat.c         |  5 +----
 src/sbbs3/js_filebase.c     | 11 ++---------
 src/sbbs3/upgrade_to_v319.c |  5 +----
 3 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/src/sbbs3/filedat.c b/src/sbbs3/filedat.c
index 36af4f7ad5..4081c92c82 100644
--- a/src/sbbs3/filedat.c
+++ b/src/sbbs3/filedat.c
@@ -638,11 +638,8 @@ bool addfile(scfg_t* cfg, uint dirnum, file_t* f, const char* extdesc, client_t*
 	getfilepath(cfg, f, fpath);
 	if(f->from_ip == NULL)
 		file_client_hfields(f, client);
-	str_list_t list = list_archive_contents(fpath, /* pattern: */NULL
-		,(cfg->dir[dirnum]->misc & DIR_NOHASH) == 0, /* sort: */TRUE, /* error: */NULL, /* size: */0);
-	int result = smb_addfile_withlist(&smb, f, SMB_SELFPACK, extdesc, list, fpath);
+	int result = smb_addfile(&smb, f, SMB_SELFPACK, extdesc, /* contents: */NULL, fpath);
 	smb_close(&smb);
-	strListFree(&list);
 	return result == SMB_SUCCESS;
 }
 
diff --git a/src/sbbs3/js_filebase.c b/src/sbbs3/js_filebase.c
index b60634b837..efeb32ed4d 100644
--- a/src/sbbs3/js_filebase.c
+++ b/src/sbbs3/js_filebase.c
@@ -1236,10 +1236,7 @@ js_add_file(JSContext *cx, uintN argc, jsval *arglist)
 		getfilepath(scfg, &file, fpath);
 		if(file.from_ip == NULL)
 			file_client_hfields(&file, client);
-		str_list_t list = list_archive_contents(fpath, /* pattern: */NULL
-			,(scfg->dir[file.dir]->misc & DIR_NOHASH) == 0, /* sort: */TRUE, /* error: */NULL, /* size: */0);
-		p->smb_result = smb_addfile_withlist(&p->smb, &file, SMB_SELFPACK, extdesc, list, fpath);
-		strListFree(&list);
+		p->smb_result = smb_addfile(&p->smb, &file, SMB_SELFPACK, extdesc, /* contents: */NULL, fpath);
 		JS_SET_RVAL(cx, arglist, BOOLEAN_TO_JSVAL(p->smb_result == SMB_SUCCESS));
 	}
 	JS_RESUMEREQUEST(cx, rc);
@@ -1327,11 +1324,7 @@ js_update_file(JSContext *cx, uintN argc, jsval *arglist)
 					p->smb_result = smb_putfile(&p->smb, &file);
 				else {
 					if((p->smb_result = smb_removefile(&p->smb, &file)) == SMB_SUCCESS) {
-						str_list_t list = list_archive_contents(newfname, /* pattern: */NULL
-							,file.dir < scfg->total_dirs && (scfg->dir[file.dir]->misc & DIR_NOHASH) == 0
-							,/* sort: */TRUE, /* error: */NULL, /* size: */0);
-						p->smb_result = smb_addfile_withlist(&p->smb, &file, SMB_SELFPACK, extdesc, list, newfname);
-						strListFree(&list);
+						p->smb_result = smb_addfile(&p->smb, &file, SMB_SELFPACK, extdesc, /* contents: */NULL, newfname);
 					}
 				}
 			}
diff --git a/src/sbbs3/upgrade_to_v319.c b/src/sbbs3/upgrade_to_v319.c
index ee6d151b0f..072132ffe0 100644
--- a/src/sbbs3/upgrade_to_v319.c
+++ b/src/sbbs3/upgrade_to_v319.c
@@ -660,10 +660,7 @@ bool upgrade_file_bases(bool hash)
 					if(*extdesc)
 						body = extdesc;
 				}
-				str_list_t list = list_archive_contents(fpath, /* pattern: */NULL
-					,(scfg.dir[i]->misc & DIR_NOHASH) == 0, /* sort: */TRUE, /* error: */NULL, /* size: */0);
-				result = smb_addfile_withlist(&smb, &file, SMB_FASTALLOC, body, list, fpath);
-				strListFree(&list);
+				result = smb_addfile(&smb, &file, SMB_FASTALLOC, body, /* contents: */NULL, fpath);
 			}
 			if(result != SMB_SUCCESS) {
 				fprintf(stderr, "\n!Error %d (%s) adding file to %s\n", result, smb.last_error, smb.file);
-- 
GitLab