diff --git a/src/sbbs3/js_msgbase.c b/src/sbbs3/js_msgbase.c index c747e85c1ca25d5c77c276e775b6728cb69518ca..60afbf90d3bd85e2c8f736074b27f88342aa37c3 100644 --- a/src/sbbs3/js_msgbase.c +++ b/src/sbbs3/js_msgbase.c @@ -59,8 +59,6 @@ js_msgbase_constructor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js JSString* js_str; private_t* p; -// *rval = JSVAL_FALSE; - if((p=(private_t*)malloc(sizeof(private_t)))==NULL) return(JS_FALSE); @@ -146,7 +144,7 @@ static JSClass js_msghdr_class = { ,JS_EnumerateStub /* enumerate */ ,JS_ResolveStub /* resolve */ ,JS_ConvertStub /* convert */ - ,js_finalize_msgbase /* finalize */ + ,JS_FinalizeStub /* finalize */ }; static BOOL parse_header_object(JSContext* cx, JSObject* hdr, uint subnum, smbmsg_t* msg) @@ -806,6 +804,24 @@ js_save_msg(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) return(JS_TRUE); } +static JSBool +js_get_msg_area_info(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + private_t* p; + + *rval = BOOLEAN_TO_JSVAL(JS_FALSE); + + if((p=(private_t*)JS_GetPrivate(cx,obj))==NULL) + return(JS_FALSE); + + if(p->smb.subnum==INVALID_SUB || p->smb.subnum>scfg->total_subs) + return(JS_TRUE); + + js_CreateMsgAreaProperties(cx, obj, scfg->sub[p->smb.subnum]); + + *rval = BOOLEAN_TO_JSVAL(JS_TRUE); + return(JS_TRUE); +} /* MsgBase Object Properites */ enum { @@ -937,12 +953,13 @@ static JSClass js_msgbase_class = { }; static JSFunctionSpec js_msgbase_functions[] = { - {"close", js_close, 0}, /* close msgbase */ - {"get_msg_header", js_get_msg_header, 2}, /* get_msg_header(by_offset, number) */ - {"put_msg_header", js_put_msg_header, 2}, /* put_msg_header(by_offset, number, hdrObj) */ - {"get_msg_body", js_get_msg_body, 2}, /* get_msg_body(by_offset, number, [strip_ctrl_a]) */ - {"get_msg_tail", js_get_msg_tail, 2}, /* get_msg_body(by_offset, number, [strip_ctrl_a]) */ - {"save_msg", js_save_msg, 2}, /* save_msg(code, hdr, body) */ + {"close", js_close, 0}, /* close msgbase */ + {"get_msg_header", js_get_msg_header, 2}, /* get_msg_header(by_offset, number) */ + {"put_msg_header", js_put_msg_header, 2}, /* put_msg_header(by_offset, number, hdrObj) */ + {"get_msg_body", js_get_msg_body, 2}, /* get_msg_body(by_offset, number, [strip_ctrl_a]) */ + {"get_msg_tail", js_get_msg_tail, 2}, /* get_msg_body(by_offset, number, [strip_ctrl_a]) */ + {"get_msg_area_info", js_get_msg_area_info, 0}, + {"save_msg", js_save_msg, 2}, /* save_msg(code, hdr, body) */ {0} };