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 ...@@ -31,6 +31,7 @@ typedef struct
smb_t smb; smb_t smb;
int smb_result; int smb_result;
BOOL debug; BOOL debug;
uint32_t first_msg;
} private_t; } private_t;
...@@ -2994,11 +2995,16 @@ static JSBool js_msgbase_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp) ...@@ -2994,11 +2995,16 @@ static JSBool js_msgbase_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
*vp = INT_TO_JSVAL(p->debug); *vp = INT_TO_JSVAL(p->debug);
break; break;
case SMB_PROP_FIRST_MSG: case SMB_PROP_FIRST_MSG:
rc=JS_SUSPENDREQUEST(cx); if(SMB_IS_OPEN(&(p->smb))) {
memset(&idx,0,sizeof(idx)); rc=JS_SUSPENDREQUEST(cx);
smb_getfirstidx(&(p->smb),&idx); memset(&idx,0,sizeof(idx));
JS_RESUMEREQUEST(cx, rc); smb_getfirstidx(&(p->smb),&idx);
*vp=UINT_TO_JSVAL(idx.number); JS_RESUMEREQUEST(cx, rc);
p->first_msg = idx.number;
*vp=UINT_TO_JSVAL(idx.number);
} else {
*vp = UINT_TO_JSVAL(p->first_msg);
}
break; break;
case SMB_PROP_LAST_MSG: case SMB_PROP_LAST_MSG:
rc=JS_SUSPENDREQUEST(cx); rc=JS_SUSPENDREQUEST(cx);
......