Skip to content
Snippets Groups Projects
Commit 323ff1e8 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Remember the last 'first_msg' property value after msgbase is closed

The other msgbase property values are stored in the smb.status or other private_t members which retain their value when the message base is closed, unlike the 'first_msg' property which required a read of the message base index to get the value (and that doesn't work when the message base is closed, so would return 0).

for deon (ALTERANT)
parent b70d5898
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #3022 passed
......@@ -31,6 +31,7 @@ typedef struct
smb_t smb;
int smb_result;
BOOL debug;
uint32_t first_msg;
} private_t;
......@@ -2994,11 +2995,16 @@ static JSBool js_msgbase_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
*vp = INT_TO_JSVAL(p->debug);
break;
case SMB_PROP_FIRST_MSG:
rc=JS_SUSPENDREQUEST(cx);
memset(&idx,0,sizeof(idx));
smb_getfirstidx(&(p->smb),&idx);
JS_RESUMEREQUEST(cx, rc);
*vp=UINT_TO_JSVAL(idx.number);
if(SMB_IS_OPEN(&(p->smb))) {
rc=JS_SUSPENDREQUEST(cx);
memset(&idx,0,sizeof(idx));
smb_getfirstidx(&(p->smb),&idx);
JS_RESUMEREQUEST(cx, rc);
p->first_msg = idx.number;
*vp=UINT_TO_JSVAL(idx.number);
} else {
*vp = UINT_TO_JSVAL(p->first_msg);
}
break;
case SMB_PROP_LAST_MSG:
rc=JS_SUSPENDREQUEST(cx);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment