Skip to content
Snippets Groups Projects
js_user.c 47.1 KiB
Newer Older
static void js_user_finalize(JSContext *cx, JSObject *obj)
{
	private_t* p = (private_t*)JS_GetPrivate(cx,obj);
	if(p!=NULL) {
		if(p->file > 0)
			closeuserdat(p->file);
js_chk_ar(JSContext *cx, uintN argc, jsval *arglist)
	JSObject *obj=JS_THIS_OBJECT(cx, arglist);
	jsval *argv=JS_ARGV(cx, arglist);
	uchar*		ar;
deuce's avatar
deuce committed
	jsrefcount	rc;
	scfg_t*		scfg;

	scfg=JS_GetRuntimePrivate(JS_GetRuntime(cx));
	JS_SET_RVAL(cx, arglist, JSVAL_VOID);

	if((p=(private_t*)js_GetClassPrivate(cx, obj, &js_user_class))==NULL)
deuce's avatar
deuce committed
	JSVALUE_TO_MSTRING(cx,argv[0], ars, NULL);
	HANDLE_PENDING(cx, ars);
deuce's avatar
deuce committed
	free(ars);
	JS_SET_RVAL(cx, arglist, BOOLEAN_TO_JSVAL(chk_ar(scfg,ar,p->user,p->client)));
js_posted_msg(JSContext *cx, uintN argc, jsval *arglist)
	JSObject *obj=JS_THIS_OBJECT(cx, arglist);
	jsval *argv=JS_ARGV(cx, arglist);
deuce's avatar
deuce committed
	jsrefcount	rc;
	scfg_t*		scfg;

	scfg=JS_GetRuntimePrivate(JS_GetRuntime(cx));
	JS_SET_RVAL(cx, arglist, JSVAL_VOID);

	if((p=(private_t*)js_GetClassPrivate(cx, obj, &js_user_class))==NULL)
		if(!JS_ValueToECMAUint32(cx, argv[0], &count))
	JS_SET_RVAL(cx, arglist, BOOLEAN_TO_JSVAL(user_posted_msg(scfg, p->user, count)));
js_sent_email(JSContext *cx, uintN argc, jsval *arglist)
	JSObject *obj=JS_THIS_OBJECT(cx, arglist);
	jsval *argv=JS_ARGV(cx, arglist);
deuce's avatar
deuce committed
	jsrefcount	rc;
	scfg_t*		scfg;

	scfg=JS_GetRuntimePrivate(JS_GetRuntime(cx));
	JS_SET_RVAL(cx, arglist, JSVAL_VOID);

	if((p=(private_t*)js_GetClassPrivate(cx, obj, &js_user_class))==NULL)
		if(!JS_ValueToECMAUint32(cx, argv[0], &count))
	if(argc>1)
		JS_ValueToBoolean(cx, argv[1], &feedback);

	JS_SET_RVAL(cx, arglist, BOOLEAN_TO_JSVAL(user_sent_email(scfg, p->user, count, feedback)));
js_downloaded_file(JSContext *cx, uintN argc, jsval *arglist)
	JSObject *obj=JS_THIS_OBJECT(cx, arglist);
	jsval *argv=JS_ARGV(cx, arglist);
deuce's avatar
deuce committed
	jsrefcount	rc;
	uint dirnum=INVALID_DIR;
	char*	fname = NULL;

	scfg=JS_GetRuntimePrivate(JS_GetRuntime(cx));
	JS_SET_RVAL(cx, arglist, JSVAL_VOID);

	if((p=(private_t*)js_GetClassPrivate(cx, obj, &js_user_class))==NULL)
	uintN argn = 0;
	if(argc > argn && JSVAL_IS_STRING(argv[argn])) {
		char	*p;
		JSSTRING_TO_ASTRING(cx, JSVAL_TO_STRING(argv[argn]), p, LEN_EXTCODE+2, NULL);
		for(dirnum = 0; dirnum < scfg->total_dirs; dirnum++)
			if(!stricmp(scfg->dir[dirnum]->code,p))
				break;
		argn++;
	}
	if(argc > argn && JSVAL_IS_STRING(argv[argn])) {
		JSSTRING_TO_ASTRING(cx, JSVAL_TO_STRING(argv[argn]), fname, MAX_PATH + 1, NULL);
		argn++;
	}
	if(argc > argn && JSVAL_IS_NUMBER(argv[argn])) {
		if(!JS_ValueToECMAUint32(cx, argv[argn], &bytes))
	if(argc > argn && JSVAL_IS_NUMBER(argv[argn])) {
		if(!JS_ValueToECMAUint32(cx, argv[argn], &files))
	if(fname != NULL && dirnum != INVALID_DIR && dirnum < scfg->total_dirs) {
		JS_SET_RVAL(cx, arglist, BOOLEAN_TO_JSVAL(user_downloaded_file(scfg, p->user, p->client, dirnum, fname, bytes)));
	} else {
		JS_SET_RVAL(cx, arglist, BOOLEAN_TO_JSVAL(user_downloaded(scfg, p->user, files, bytes)));
	}
js_uploaded_file(JSContext *cx, uintN argc, jsval *arglist)
	JSObject *obj=JS_THIS_OBJECT(cx, arglist);
	jsval *argv=JS_ARGV(cx, arglist);
deuce's avatar
deuce committed
	jsrefcount	rc;
	scfg_t*		scfg;

	scfg=JS_GetRuntimePrivate(JS_GetRuntime(cx));
	JS_SET_RVAL(cx, arglist, JSVAL_VOID);

	if((p=(private_t*)js_GetClassPrivate(cx, obj, &js_user_class))==NULL)
		if(!JS_ValueToECMAUint32(cx, argv[0], &bytes))
		if(!JS_ValueToECMAUint32(cx, argv[1], &files))
	JS_SET_RVAL(cx, arglist, BOOLEAN_TO_JSVAL(user_uploaded(scfg, p->user, files, bytes)));
js_adjust_credits(JSContext *cx, uintN argc, jsval *arglist)
	JSObject *obj=JS_THIS_OBJECT(cx, arglist);
	jsval *argv=JS_ARGV(cx, arglist);
deuce's avatar
deuce committed
	jsrefcount	rc;
	scfg_t*		scfg;

	scfg=JS_GetRuntimePrivate(JS_GetRuntime(cx));
	JS_SET_RVAL(cx, arglist, JSVAL_VOID);

	if((p=(private_t*)js_GetClassPrivate(cx, obj, &js_user_class))==NULL)
		if(!JS_ValueToECMAInt32(cx, argv[0], &count))
	JS_SET_RVAL(cx, arglist, BOOLEAN_TO_JSVAL(user_adjust_credits(scfg, p->user, count)));
js_adjust_minutes(JSContext *cx, uintN argc, jsval *arglist)
	JSObject *obj=JS_THIS_OBJECT(cx, arglist);
	jsval *argv=JS_ARGV(cx, arglist);
deuce's avatar
deuce committed
	jsrefcount	rc;
	scfg_t*		scfg;

	scfg=JS_GetRuntimePrivate(JS_GetRuntime(cx));
	JS_SET_RVAL(cx, arglist, JSVAL_VOID);

	if((p=(private_t*)js_GetClassPrivate(cx, obj, &js_user_class))==NULL)
		if(!JS_ValueToECMAInt32(cx, argv[0], &count))	
	JS_SET_RVAL(cx, arglist, BOOLEAN_TO_JSVAL(user_adjust_minutes(scfg, p->user, count)));
js_get_time_left(JSContext *cx, uintN argc, jsval *arglist)
	JSObject *obj=JS_THIS_OBJECT(cx, arglist);
	jsval *argv=JS_ARGV(cx, arglist);
deuce's avatar
deuce committed
	jsrefcount	rc;
	time_t		tl;

	scfg=JS_GetRuntimePrivate(JS_GetRuntime(cx));
	JS_SET_RVAL(cx, arglist, JSVAL_VOID);

	if((p=(private_t*)js_GetClassPrivate(cx, obj, &js_user_class))==NULL)
		if(!JS_ValueToECMAUint32(cx, argv[0], &start_time))
	tl = gettimeleft(scfg, p->user, start_time);
	JS_SET_RVAL(cx, arglist, INT_TO_JSVAL(tl > INT32_MAX ? INT32_MAX : (int32) tl));
Rob Swindell's avatar
Rob Swindell committed
static JSBool
js_user_close(JSContext *cx, uintN argc, jsval *arglist)
{
	JSObject *obj=JS_THIS_OBJECT(cx, arglist);
	private_t*	p;
	jsrefcount	rc;

	JS_SET_RVAL(cx, arglist, JSVAL_VOID);

	if((p=(private_t*)js_GetClassPrivate(cx, obj, &js_user_class))==NULL)
		return JS_FALSE;

	rc=JS_SUSPENDREQUEST(cx);
	if(p->file > 0)
		closeuserdat(p->file);
	p->file = -1;
	JS_RESUMEREQUEST(cx, rc);

	return JS_TRUE;
}
static jsSyncMethodSpec js_user_functions[] = {
	{"compare_ars",		js_chk_ar,			1,	JSTYPE_BOOLEAN,	JSDOCSTR("string ars")
rswindell's avatar
rswindell committed
	,JSDOCSTR("Verify user meets access requirements string<br>"
deuce's avatar
deuce committed
		"Note: For the current user of the terminal server, use <tt>bbs.compare_ars()</tt> instead.")
	{"adjust_credits",	js_adjust_credits,	1,	JSTYPE_BOOLEAN,	JSDOCSTR("count")
	,JSDOCSTR("Adjust user's credits by <i>count</i> (negative to subtract)")
rswindell's avatar
rswindell committed
	,314
	},		
	{"adjust_minutes",	js_adjust_minutes,	1,	JSTYPE_BOOLEAN,	JSDOCSTR("count")
	,JSDOCSTR("Adjust user's extra minutes <i>count</i> (negative to subtract)")
rswindell's avatar
rswindell committed
	,314
	},		
	{"posted_message",	js_posted_msg,		1,	JSTYPE_BOOLEAN,	JSDOCSTR("[count]")
	,JSDOCSTR("Adjust user's posted-messages statistics by <i>count</i> (default: 1) (negative to subtract)")
rswindell's avatar
rswindell committed
	,314
	},		
	{"sent_email",		js_sent_email,		1,	JSTYPE_BOOLEAN,	JSDOCSTR("[count] [,bool feedback]")
	,JSDOCSTR("Adjust user's email/feedback-sent statistics by <i>count</i> (default: 1) (negative to subtract)")
rswindell's avatar
rswindell committed
	,314
	},		
	{"uploaded_file",	js_uploaded_file,	1,	JSTYPE_BOOLEAN,	JSDOCSTR("[bytes] [,files]")
	,JSDOCSTR("Adjust user's files/bytes-uploaded statistics")
rswindell's avatar
rswindell committed
	,314
	{"downloaded_file",	js_downloaded_file,	1,	JSTYPE_BOOLEAN,	JSDOCSTR("[dir-code] [file path | name] [bytes] [,file-count]")
	,JSDOCSTR("Handle the full or partial successful download of a file.<br>"
		"Adjust user's files/bytes-downloaded statistics and credits, file's stats, system's stats, and uploader's stats and credits.")
	,31800
	},
	{"get_time_left",	js_get_time_left,	1,	JSTYPE_NUMBER,	JSDOCSTR("start_time")
	,JSDOCSTR("Returns the user's available remaining time online, in seconds,<br>"
	"based on the passed <i>start_time</i> value (in time_t format)<br>"
	"Note: this method does not account for pending forced timed events<br>"
	"Note: for the pre-defined user object on the BBS, you almost certainly want bbs.get_time_left() instead.")
Rob Swindell's avatar
Rob Swindell committed
	{"close",			js_user_close,		0,	JSTYPE_VOID,	JSDOCSTR("")
	,JSDOCSTR("Close the <tt>user.tab</tt> file, if open. The file will be auto-reopened if necessary.")
Rob Swindell's avatar
Rob Swindell committed
	,31902
	},
static JSBool js_user_stats_resolve(JSContext *cx, JSObject *obj, jsid id)
deuce's avatar
deuce committed
{
	char*			name=NULL;
deuce's avatar
deuce committed
	JSBool			ret;
deuce's avatar
deuce committed

deuce's avatar
deuce committed
	if(id != JSID_VOID && id != JSID_EMPTY) {
		jsval idval;
		
		JS_IdToValue(cx, id, &idval);
deuce's avatar
deuce committed
		if(JSVAL_IS_STRING(idval)) {
			JSSTRING_TO_MSTRING(cx, JSVAL_TO_STRING(idval), name, NULL);
			HANDLE_PENDING(cx, name);
deuce's avatar
deuce committed
	}
deuce's avatar
deuce committed

deuce's avatar
deuce committed
	ret=js_SyncResolve(cx, obj, name, js_user_stats_properties, NULL, NULL, 0);
	if(name)
		free(name);
	return ret;
deuce's avatar
deuce committed
}

static JSBool js_user_stats_enumerate(JSContext *cx, JSObject *obj)
{
deuce's avatar
deuce committed
	return(js_user_stats_resolve(cx, obj, JSID_VOID));
deuce's avatar
deuce committed
}

static JSBool js_user_security_resolve(JSContext *cx, JSObject *obj, jsid id)
deuce's avatar
deuce committed
{
	char*			name=NULL;
deuce's avatar
deuce committed
	JSBool			ret;
deuce's avatar
deuce committed

deuce's avatar
deuce committed
	if(id != JSID_VOID && id != JSID_EMPTY) {
		jsval idval;
		
		JS_IdToValue(cx, id, &idval);
deuce's avatar
deuce committed
		if(JSVAL_IS_STRING(idval)) {
			JSSTRING_TO_MSTRING(cx, JSVAL_TO_STRING(idval), name, NULL);
			HANDLE_PENDING(cx, name);
deuce's avatar
deuce committed
	}
deuce's avatar
deuce committed

deuce's avatar
deuce committed
	ret=js_SyncResolve(cx, obj, name, js_user_security_properties, NULL, NULL, 0);
	if(name)
		free(name);
	return ret;
deuce's avatar
deuce committed
}

static JSBool js_user_security_enumerate(JSContext *cx, JSObject *obj)
{
deuce's avatar
deuce committed
	return(js_user_security_resolve(cx, obj, JSID_VOID));
deuce's avatar
deuce committed
}

static JSBool js_user_limits_resolve(JSContext *cx, JSObject *obj, jsid id)
deuce's avatar
deuce committed
{
	char*			name=NULL;
deuce's avatar
deuce committed
	JSBool			ret;
deuce's avatar
deuce committed

deuce's avatar
deuce committed
	if(id != JSID_VOID && id != JSID_EMPTY) {
		jsval idval;
		
		JS_IdToValue(cx, id, &idval);
deuce's avatar
deuce committed
		if(JSVAL_IS_STRING(idval)) {
deuce's avatar
deuce committed
			JSSTRING_TO_MSTRING(cx, JSVAL_TO_STRING(idval), name, NULL);
			HANDLE_PENDING(cx, name);
deuce's avatar
deuce committed
	}
deuce's avatar
deuce committed

deuce's avatar
deuce committed
	ret=js_SyncResolve(cx, obj, name, js_user_limits_properties, NULL, NULL, 0);
	if(name)
		free(name);
	return ret;
deuce's avatar
deuce committed
}

static JSBool js_user_limits_enumerate(JSContext *cx, JSObject *obj)
{
deuce's avatar
deuce committed
	return(js_user_limits_resolve(cx, obj, JSID_VOID));
deuce's avatar
deuce committed
}

static JSClass js_user_stats_class = {
     "UserStats"			/* name			*/
    ,JSCLASS_HAS_PRIVATE	/* flags		*/
	,JS_PropertyStub		/* addProperty	*/
	,JS_PropertyStub		/* delProperty	*/
	,js_user_get			/* getProperty	*/
	,js_user_set			/* setProperty	*/
	,js_user_stats_enumerate		/* enumerate	*/
	,js_user_stats_resolve	/* resolve		*/
	,JS_ConvertStub			/* convert		*/
deuce's avatar
deuce committed
	,JS_FinalizeStub        /* finalize		*/
deuce's avatar
deuce committed
static JSClass js_user_security_class = {
     "UserSecurity"			/* name			*/
    ,JSCLASS_HAS_PRIVATE	/* flags		*/
	,JS_PropertyStub		/* addProperty	*/
	,JS_PropertyStub		/* delProperty	*/
	,js_user_get			/* getProperty	*/
	,js_user_set			/* setProperty	*/
	,js_user_security_enumerate		/* enumerate	*/
	,js_user_security_resolve		/* resolve		*/
	,JS_ConvertStub			/* convert		*/
	,JS_FinalizeStub        /* finalize		*/
};

deuce's avatar
deuce committed
static JSClass js_user_limits_class = {
     "UserLimits"			/* name			*/
    ,JSCLASS_HAS_PRIVATE	/* flags		*/
	,JS_PropertyStub		/* addProperty	*/
	,JS_PropertyStub		/* delProperty	*/
	,js_user_get			/* getProperty	*/
	,js_user_set			/* setProperty	*/
	,js_user_limits_enumerate		/* enumerate	*/
	,js_user_limits_resolve			/* resolve		*/
	,JS_ConvertStub			/* convert		*/
	,JS_FinalizeStub        /* finalize		*/
};

static JSBool js_user_resolve(JSContext *cx, JSObject *obj, jsid id)
deuce's avatar
deuce committed
{
	char*			name=NULL;
	JSObject*		newobj;
	private_t*		p;
deuce's avatar
deuce committed
	JSBool			ret;
deuce's avatar
deuce committed

	if((p=(private_t*)JS_GetPrivate(cx,obj))==NULL)
		return(JS_TRUE);

deuce's avatar
deuce committed
	if(id != JSID_VOID && id != JSID_EMPTY) {
		jsval idval;
		
		JS_IdToValue(cx, id, &idval);
deuce's avatar
deuce committed
		if(JSVAL_IS_STRING(idval)) {
			JSSTRING_TO_MSTRING(cx, JSVAL_TO_STRING(idval), name, NULL);
			HANDLE_PENDING(cx, name);
deuce's avatar
deuce committed
	}
deuce's avatar
deuce committed

	if(name==NULL || strcmp(name, "stats")==0) {
deuce's avatar
deuce committed
		if(name)
			free(name);
deuce's avatar
deuce committed
		/* user.stats */
		if((newobj=JS_DefineObject(cx, obj, "stats"
			,&js_user_stats_class, NULL, JSPROP_ENUMERATE|JSPROP_READONLY))==NULL) 
			return(JS_FALSE);
		JS_SetPrivate(cx, newobj, p);
#ifdef BUILD_JSDOCS
		js_DescribeSyncObject(cx,newobj,"User statistics (all <small>READ ONLY</small>)",310);
		js_CreateArrayOfStrings(cx, newobj, "_property_desc_list", user_stats_prop_desc, JSPROP_READONLY);
#endif
		if(name)
			return(JS_TRUE);

	}

	if(name==NULL || strcmp(name, "security")==0) {
deuce's avatar
deuce committed
		if(name)
			free(name);
deuce's avatar
deuce committed
		/* user.security */
		if((newobj=JS_DefineObject(cx, obj, "security"
			,&js_user_security_class, NULL, JSPROP_ENUMERATE|JSPROP_READONLY))==NULL) 
			return(JS_FALSE);
		JS_SetPrivate(cx, newobj, p);
#ifdef BUILD_JSDOCS
		js_DescribeSyncObject(cx,newobj,"User security settings",310);
		js_CreateArrayOfStrings(cx, newobj, "_property_desc_list", user_security_prop_desc, JSPROP_READONLY);
deuce's avatar
deuce committed
#endif
		if(name)
			return(JS_TRUE);
	}

	if(name==NULL || strcmp(name, "limits")==0) {
deuce's avatar
deuce committed
		if(name)
			free(name);
deuce's avatar
deuce committed
		/* user.limits */
		if((newobj=JS_DefineObject(cx, obj, "limits"
			,&js_user_limits_class, NULL, JSPROP_ENUMERATE|JSPROP_READONLY))==NULL) 
			return(JS_FALSE);
		JS_SetPrivate(cx, newobj, p);
#ifdef BUILD_JSDOCS
		js_DescribeSyncObject(cx,newobj,"User limitations based on security level (all <small>READ ONLY</small>)",311);
		js_CreateArrayOfStrings(cx, newobj, "_property_desc_list", user_limits_prop_desc, JSPROP_READONLY);
deuce's avatar
deuce committed
#endif
		if(name)
			return(JS_TRUE);
	}

deuce's avatar
deuce committed
	ret=js_SyncResolve(cx, obj, name, js_user_properties, js_user_functions, NULL, 0);
	if(name)
		free(name);
	return ret;
deuce's avatar
deuce committed
}

static JSBool js_user_enumerate(JSContext *cx, JSObject *obj)
{
deuce's avatar
deuce committed
	return(js_user_resolve(cx, obj, JSID_VOID));
deuce's avatar
deuce committed
}

deuce's avatar
deuce committed
     "User"					/* name			*/
    ,JSCLASS_HAS_PRIVATE	/* flags		*/
	,JS_PropertyStub		/* addProperty	*/
	,JS_PropertyStub		/* delProperty	*/
	,js_user_get			/* getProperty	*/
	,js_user_set			/* setProperty	*/
	,js_user_enumerate		/* enumerate	*/
	,js_user_resolve		/* resolve		*/
	,JS_ConvertStub			/* convert		*/
deuce's avatar
deuce committed
	,js_user_finalize		/* finalize		*/
rswindell's avatar
rswindell committed
/* User Constructor (creates instance of user class) */

static JSBool
js_user_constructor(JSContext *cx, uintN argc, jsval *arglist)
	JSObject *obj;
	jsval *argv=JS_ARGV(cx, arglist);
	int32		val=0;
rswindell's avatar
rswindell committed
	user_t		user;
	private_t*	p;
	scfg_t*			scfg;

	scfg=JS_GetRuntimePrivate(JS_GetRuntime(cx));
	obj=JS_NewObject(cx, &js_user_class, NULL, NULL);
	JS_SET_RVAL(cx, arglist, OBJECT_TO_JSVAL(obj));

	if(argc && (!JS_ValueToInt32(cx,argv[0],&val)))
		return JS_FALSE;
	memset(&user, 0, sizeof(user));
	user.number=(ushort)val;
	if(user.number!=0 && (i=getuserdat(scfg,&user))!=0) {
		JS_ReportError(cx,"Error %d reading user number %d",i,val);
rswindell's avatar
rswindell committed
		return(JS_FALSE);
rswindell's avatar
rswindell committed

	if((p=(private_t*)malloc(sizeof(private_t)))==NULL)
		return(JS_FALSE);

	memset(p,0,sizeof(private_t));

	p->storage = user;
	p->user = &p->storage;
	p->cached = (user.number==0 ? FALSE : TRUE);
deuce's avatar
deuce committed
	JS_SetPrivate(cx, obj, p);
JSObject* js_CreateUserClass(JSContext* cx, JSObject* parent, scfg_t* cfg)
rswindell's avatar
rswindell committed
{
	JSObject*	userclass;

	userclass = JS_InitClass(cx, parent, NULL
		,&js_user_class
		,js_user_constructor
		,1	/* number of constructor args */
		,NULL /* props, defined in constructor */
		,NULL /* funcs, defined in constructor */
rswindell's avatar
rswindell committed
		,NULL,NULL);

	return(userclass);
}

JSObject* js_CreateUserObject(JSContext* cx, JSObject* parent, scfg_t* cfg, char* name
									  ,user_t* user, client_t* client, BOOL global_user)
{
	JSObject*	userobj;
	if(name==NULL)
	    userobj = JS_NewObject(cx, &js_user_class, NULL, parent);
	else if(JS_GetProperty(cx,parent,name,&val) && val!=JSVAL_VOID)
		userobj = JSVAL_TO_OBJECT(val);	/* Return existing user object */
	else
		userobj = JS_DefineObject(cx, parent, name, &js_user_class
								, NULL, JSPROP_ENUMERATE|JSPROP_READONLY);
	if(userobj==NULL)
		return(NULL);

	if((p=JS_GetPrivate(cx, userobj)) == NULL) {	/* Uses existing private pointer: Fix memory leak? */
		if((p=(private_t*)malloc(sizeof(private_t)))==NULL)
			return(NULL);
rswindell's avatar
rswindell committed
	p->client = client;
	p->user = &p->storage;
	if(user!=NULL) {
		p->storage = *user;
		if(global_user)
			p->user = user;
	js_DescribeSyncObject(cx,userobj
		,"Instance of <i>User</i> class, representing current user online"
		,310);
	js_DescribeSyncConstructor(cx,userobj
		,"To create a new user object: <tt>var u = new User;</tt> or: <tt>var u = new User(<i>number</i>);</tt>");
	js_CreateArrayOfStrings(cx, userobj
		,"_property_desc_list", user_prop_desc, JSPROP_READONLY);
/****************************************************************************/
/* Creates all the user-specific objects: user, msg_area, file_area			*/
/****************************************************************************/
rswindell's avatar
rswindell committed
js_CreateUserObjects(JSContext* cx, JSObject* parent, scfg_t* cfg, user_t* user, client_t* client
					 ,const char* web_file_vpath_prefix, subscan_t* subscan)
	if(js_CreateUserObject(cx,parent,cfg,"user",user,client,/* global_user */TRUE)==NULL)
	if(js_CreateFileAreaObject(cx,parent,cfg,user,client,web_file_vpath_prefix)==NULL) 
rswindell's avatar
rswindell committed
	if(js_CreateMsgAreaObject(cx,parent,cfg,user,client,subscan)==NULL) 
rswindell's avatar
rswindell committed
	if(js_CreateXtrnAreaObject(cx,parent,cfg,user,client)==NULL)
		return(JS_FALSE);
#endif	/* JAVSCRIPT */