Commits (1)
  • Rob Swindell's avatar
    Remember the last 'first_msg' property value after msgbase is closed · 323ff1e8
    Rob Swindell authored
    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)
    323ff1e8
......@@ -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);
......