diff --git a/src/sbbs3/js_file_area.c b/src/sbbs3/js_file_area.c index 2d742aa50bb866e1e9802d4ba1a711d50c502330..f5c03b57b58c41c7fa9442b3ba094b338d22b15c 100644 --- a/src/sbbs3/js_file_area.c +++ b/src/sbbs3/js_file_area.c @@ -42,7 +42,7 @@ #ifdef _DEBUG static char* lib_prop_desc[] = { - "index into lib_list array" + "index into lib_list array (or -1 if not in array)" ,"unique number for this library" ,"library name" ,"library description" @@ -53,7 +53,7 @@ static char* lib_prop_desc[] = { static char* dir_prop_desc[] = { - "index into dir_list array" + "index into dir_list array (or -1 if not in array)" ,"unique number for this directory" ,"library index" ,"library number" @@ -156,22 +156,20 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_ return(NULL); for(l=0;l<cfg->total_libs;l++) { -#if 0 - if(user==NULL && (*cfg->lib[l]->ar)!=AR_NULL) - continue; -#endif - if(user!=NULL && !chk_ar(cfg,cfg->lib[l]->ar,user)) - continue; if((libobj=JS_NewObject(cx, NULL, NULL, NULL))==NULL) return(NULL); - if(!JS_GetArrayLength(cx, lib_list, &lib_index)) - return(NULL); + lib_index=-1; + if(user==NULL || chk_ar(cfg,cfg->lib[l]->ar,user)) { - val=OBJECT_TO_JSVAL(libobj); - if(!JS_SetElement(cx, lib_list, lib_index, &val)) - return(NULL); + if(!JS_GetArrayLength(cx, lib_list, &lib_index)) + return(NULL); + + val=OBJECT_TO_JSVAL(libobj); + if(!JS_SetElement(cx, lib_list, lib_index, &val)) + return(NULL); + } /* Add as property (associative array element) */ if(!JS_DefineProperty(cx, alllibs, cfg->lib[l]->sname, val @@ -212,7 +210,7 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_ return(NULL); #ifdef _DEBUG - js_DescribeSyncObject(cx,libobj,"File Transfer Libraries",310); + js_DescribeSyncObject(cx,libobj,"File Transfer Libraries (current user has access to)",310); #endif /* dir_list[] */ @@ -226,22 +224,20 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_ for(d=0;d<cfg->total_dirs;d++) { if(cfg->dir[d]->lib!=l) continue; -#if 0 - if(user==NULL && (*cfg->dir[d]->ar)!=AR_NULL) - continue; -#endif - if(user!=NULL && !chk_ar(cfg,cfg->dir[d]->ar,user)) - continue; if((dirobj=JS_NewObject(cx, NULL, NULL, NULL))==NULL) return(NULL); - if(!JS_GetArrayLength(cx, dir_list, &dir_index)) - return(NULL); + dir_index=-1; + if(user==NULL || chk_ar(cfg,cfg->dir[d]->ar,user)) { - val=OBJECT_TO_JSVAL(dirobj); - if(!JS_SetElement(cx, dir_list, dir_index, &val)) - return(NULL); + if(!JS_GetArrayLength(cx, dir_list, &dir_index)) + return(NULL); + + val=OBJECT_TO_JSVAL(dirobj); + if(!JS_SetElement(cx, dir_list, dir_index, &val)) + return(NULL); + } /* Add as property (associative array element) */ if(!JS_DefineProperty(cx, alldirs, cfg->dir[d]->code, val @@ -414,7 +410,7 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_ #ifdef _DEBUG js_CreateArrayOfStrings(cx, dirobj, "_property_desc_list", dir_prop_desc, JSPROP_READONLY); - js_DescribeSyncObject(cx,dirobj,"File Transfer Directories",310); + js_DescribeSyncObject(cx,dirobj,"File Transfer Directories (current user has access to)",310); #endif } diff --git a/src/sbbs3/js_msg_area.c b/src/sbbs3/js_msg_area.c index 0cd9cfe16cfa925d794d3493af7671691c36a356..880a54a60b9ebca30ee31e74356384ccdce4983b 100644 --- a/src/sbbs3/js_msg_area.c +++ b/src/sbbs3/js_msg_area.c @@ -46,7 +46,7 @@ enum { /* msg_area Object Properties */ #ifdef _DEBUG static char* msg_grp_prop_desc[] = { - "index into grp_list array" + "index into grp_list array (or -1 if not in array)" ,"unique number for this message group" ,"group name" ,"group description" @@ -56,7 +56,7 @@ static char* msg_grp_prop_desc[] = { static char* msg_area_prop_desc[] = { - "index into sub_list array" + "index into sub_list array (or -1 if not in array)" ,"group's index into grp_list array" ,"unique number for this sub-board" ,"group number" @@ -379,22 +379,19 @@ JSObject* DLLCALL js_CreateMsgAreaObject(JSContext* cx, JSObject* parent, scfg_t for(l=0;l<cfg->total_grps;l++) { -#if 0 - if(user==NULL && (*cfg->grp[l]->ar)!=AR_NULL) - continue; -#endif - if(user!=NULL && !chk_ar(cfg,cfg->grp[l]->ar,user)) - continue; - if((grpobj=JS_NewObject(cx, NULL, NULL, NULL))==NULL) return(NULL); - if(!JS_GetArrayLength(cx, grp_list, &grp_index)) - return(NULL); + grp_index=-1; + if(user==NULL || chk_ar(cfg,cfg->grp[l]->ar,user)) { - val=OBJECT_TO_JSVAL(grpobj); - if(!JS_SetElement(cx, grp_list, grp_index, &val)) - return(NULL); + if(!JS_GetArrayLength(cx, grp_list, &grp_index)) + return(NULL); + + val=OBJECT_TO_JSVAL(grpobj); + if(!JS_SetElement(cx, grp_list, grp_index, &val)) + return(NULL); + } /* Add as property (associative array element) */ if(!JS_DefineProperty(cx, allgrps, cfg->grp[l]->sname, val @@ -428,7 +425,7 @@ JSObject* DLLCALL js_CreateMsgAreaObject(JSContext* cx, JSObject* parent, scfg_t return(NULL); #ifdef _DEBUG - js_DescribeSyncObject(cx,grpobj,"Message Groups",310); + js_DescribeSyncObject(cx,grpobj,"Message Groups (current user has access to)",310); #endif /* sub_list[] */ @@ -442,12 +439,6 @@ JSObject* DLLCALL js_CreateMsgAreaObject(JSContext* cx, JSObject* parent, scfg_t for(d=0;d<cfg->total_subs;d++) { if(cfg->sub[d]->grp!=l) continue; -#if 0 - if(user==NULL && (*cfg->sub[d]->ar)!=AR_NULL) - continue; -#endif - if(user!=NULL && !chk_ar(cfg,cfg->sub[d]->ar,user)) - continue; if((subobj=JS_NewObject(cx, &js_sub_class, NULL, NULL))==NULL) return(NULL); @@ -455,12 +446,17 @@ JSObject* DLLCALL js_CreateMsgAreaObject(JSContext* cx, JSObject* parent, scfg_t if(subscan!=NULL) JS_SetPrivate(cx,subobj,&subscan[d]); - if(!JS_GetArrayLength(cx, sub_list, &sub_index)) - return(NULL); + sub_index=-1; - val=OBJECT_TO_JSVAL(subobj); - if(!JS_SetElement(cx, sub_list, sub_index, &val)) - return(NULL); + if(user==NULL || chk_ar(cfg,cfg->sub[d]->ar,user)) { + + if(!JS_GetArrayLength(cx, sub_list, &sub_index)) + return(NULL); + + val=OBJECT_TO_JSVAL(subobj); + if(!JS_SetElement(cx, sub_list, sub_index, &val)) + return(NULL); + } /* Add as property (associative array element) */ if(!JS_DefineProperty(cx, allsubs, cfg->sub[d]->code, val @@ -519,7 +515,7 @@ JSObject* DLLCALL js_CreateMsgAreaObject(JSContext* cx, JSObject* parent, scfg_t return(NULL); #ifdef _DEBUG - js_DescribeSyncObject(cx,subobj,"Message Sub-boards</h2>" + js_DescribeSyncObject(cx,subobj,"Message Sub-boards (current user has access to)</h2>" "(all properties are <small>READ ONLY</small> except for " "<i>scan_ptr</i>, <i>scan_cfg</i>, and <i>last_read</i>)" ,310); diff --git a/src/sbbs3/js_xtrn_area.c b/src/sbbs3/js_xtrn_area.c index 4ef19099ddb6b65c64a57a0f894a597606fc8324..1db0489d6fff9ae0bc520e18276b6d2a08f6130f 100644 --- a/src/sbbs3/js_xtrn_area.c +++ b/src/sbbs3/js_xtrn_area.c @@ -43,7 +43,7 @@ static char* xtrn_sec_prop_desc[] = { - "index into sec_list array" + "index into sec_list array (or -1 if not in index)" ,"unique number for this external program section" ,"external program section internal code" ,"external program section name" @@ -53,7 +53,7 @@ static char* xtrn_sec_prop_desc[] = { static char* xtrn_prog_prop_desc[] = { - "index into prog_list array" + "index into prog_list array (or -1 if not in index)" ,"program number" ,"progarm section index" ,"program section number" @@ -240,18 +240,19 @@ JSObject* DLLCALL js_CreateXtrnAreaObject(JSContext* cx, JSObject* parent, scfg_ for(l=0;l<cfg->total_xtrnsecs;l++) { - if(user!=NULL && !chk_ar(cfg,cfg->xtrnsec[l]->ar,user)) - continue; - if((secobj=JS_NewObject(cx, NULL, NULL, NULL))==NULL) return(NULL); - if(!JS_GetArrayLength(cx, sec_list, &sec_index)) - return(NULL); + sec_index=-1; + if(user==NULL || chk_ar(cfg,cfg->xtrnsec[l]->ar,user)) { - val=OBJECT_TO_JSVAL(secobj); - if(!JS_SetElement(cx, sec_list, sec_index, &val)) - return(NULL); + if(!JS_GetArrayLength(cx, sec_list, &sec_index)) + return(NULL); + + val=OBJECT_TO_JSVAL(secobj); + if(!JS_SetElement(cx, sec_list, sec_index, &val)) + return(NULL); + } /* Add as property (associative array element) */ if(!JS_DefineProperty(cx, allsec, cfg->xtrnsec[l]->code, val @@ -293,28 +294,27 @@ JSObject* DLLCALL js_CreateXtrnAreaObject(JSContext* cx, JSObject* parent, scfg_ return(NULL); #ifdef _DEBUG - js_DescribeSyncObject(cx,secobj,"Online Program (door) Sections",310); + js_DescribeSyncObject(cx,secobj,"Online Program (door) Sections (current user has access to)",310); #endif for(d=0;d<cfg->total_xtrns;d++) { if(cfg->xtrn[d]->sec!=l) continue; - if(user!=NULL && !chk_ar(cfg,cfg->xtrn[d]->ar,user)) - continue; - - if(cfg->xtrn[d]->misc&EVENTONLY) - continue; - if((progobj=JS_NewObject(cx, NULL, NULL, NULL))==NULL) return(NULL); - if(!JS_GetArrayLength(cx, prog_list, &prog_index)) - return(NULL); + prog_index=-1; + if((user==NULL || chk_ar(cfg,cfg->xtrn[d]->ar,user)) + && !(cfg->xtrn[d]->misc&EVENTONLY)) { - val=OBJECT_TO_JSVAL(progobj); - if(!JS_SetElement(cx, prog_list, prog_index, &val)) - return(NULL); + if(!JS_GetArrayLength(cx, prog_list, &prog_index)) + return(NULL); + + val=OBJECT_TO_JSVAL(progobj); + if(!JS_SetElement(cx, prog_list, prog_index, &val)) + return(NULL); + } /* Add as property (associative array element) */ if(!JS_DefineProperty(cx, allprog, cfg->xtrn[d]->code, val @@ -352,7 +352,7 @@ JSObject* DLLCALL js_CreateXtrnAreaObject(JSContext* cx, JSObject* parent, scfg_ return(NULL); #ifdef _DEBUG - js_DescribeSyncObject(cx,progobj,"Online External Programs (doors)",310); + js_DescribeSyncObject(cx,progobj,"Online External Programs (doors) (current user has access to)",310); #endif } @@ -447,10 +447,7 @@ JSObject* DLLCALL js_CreateXtrnAreaObject(JSContext* cx, JSObject* parent, scfg_ return(NULL); for(l=0;l<cfg->total_xedits;l++) { -#if 0 - if(user==NULL && (*cfg->xedit[l]->ar)!=AR_NULL) - continue; -#endif + if(user!=NULL && !chk_ar(cfg,cfg->xedit[l]->ar,user)) continue;