From c780c203a091fa500b91fe010ad5152412746339 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Debian Linux)" <rob@synchro.net>
Date: Tue, 15 Oct 2024 00:44:15 -0700
Subject: [PATCH] New user properties: batch_upload_list and
 batch_download_list

For exposing the list path/file for a user's batch up/download lists
---
 src/sbbs3/js_user.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/sbbs3/js_user.c b/src/sbbs3/js_user.c
index efe032148c..4f0e7239eb 100644
--- a/src/sbbs3/js_user.c
+++ b/src/sbbs3/js_user.c
@@ -20,6 +20,7 @@
  ****************************************************************************/
 
 #include "sbbs.h"
+#include "filedat.h"
 #include "js_request.h"
 
 #ifdef JAVASCRIPT
@@ -120,6 +121,8 @@ enum {
 	,USER_PROP_FREECDTPERDAY
 	,USER_PROP_CACHED
 	,USER_PROP_IS_SYSOP
+	,USER_PROP_BATUPLST
+	,USER_PROP_BATDNLST
 };
 
 static void js_getuserdat(scfg_t* scfg, private_t* p)
@@ -425,6 +428,13 @@ static JSBool js_user_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 			JS_RESUMEREQUEST(cx, rc);
 			return(JS_TRUE);	/* intentional early return */
 
+		case USER_PROP_BATUPLST:
+			s = batch_list_name(scfg, p->user->number, XFER_BATCH_UPLOAD, tmp, sizeof tmp);
+			break;
+		case USER_PROP_BATDNLST:
+			s = batch_list_name(scfg, p->user->number, XFER_BATCH_DOWNLOAD, tmp, sizeof tmp);
+			break;
+
 		default:
 			/* This must not set vp in order for child objects to work (stats and security) */
 			JS_RESUMEREQUEST(cx, rc);
@@ -843,6 +853,8 @@ static jsSyncPropertySpec js_user_properties[] = {
 	{	"logontime"			,USER_PROP_LOGONTIME 	,USER_PROP_FLAGS,		310},
 	{	"cached"			,USER_PROP_CACHED		,USER_PROP_FLAGS,		314},
 	{	"is_sysop"			,USER_PROP_IS_SYSOP		,JSPROP_ENUMERATE|JSPROP_READONLY,	315},
+	{	"batch_upload_list"	,USER_PROP_BATUPLST		,JSPROP_ENUMERATE|JSPROP_READONLY,	320},
+	{	"batch_download_list",USER_PROP_BATDNLST	,JSPROP_ENUMERATE|JSPROP_READONLY,	320},
 	{0}
 };
 
@@ -888,6 +900,8 @@ static const char* user_prop_desc[] = {
 	,"Logon time (time_t format)"
 	,"Record is currently cached in memory"
 	,"User has a System Operator's security level"
+	,"Batch upload list file path/name"
+	,"Batch download list file path/name"
 	,NULL
 };
 #endif
-- 
GitLab