Commit 002c7358 authored by rswindell's avatar rswindell
Browse files

Added support for new(ish) msg header fields: 'editor' and 'columns'.

parent b4dd2d82
......@@ -775,6 +775,35 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
}
}
prop_name = "editor";
hfield_type = SMB_EDITOR;
if(JS_GetProperty(cx, hdr, prop_name, &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"%s\" string in header object", prop_name);
goto err;
}
if((p->smb_result=smb_hfield_str(msg, hfield_type, cp))!=SMB_SUCCESS) {
JS_ReportError(cx, "Error %d adding %s field to message header", p->smb_result, smb_hfieldtype(hfield_type));
goto err;
}
}
prop_name = "columns";
hfield_type = SMB_COLUMNS;
if(JS_GetProperty(cx, hdr, prop_name, &val) && !JSVAL_NULL_OR_VOID(val)) {
if(!JS_ValueToUint32(cx, val, &u32)) {
JS_ReportError(cx, "Invalid \"%s\" number in header object", prop_name);
goto err;
}
uint8_t u8 = u32;
if((p->smb_result=smb_hfield_bin(msg, hfield_type, u8))!=SMB_SUCCESS) {
JS_ReportError(cx, "Error %d adding %s field to message header", p->smb_result, smb_hfieldtype(hfield_type));
goto err;
}
}
/* Numeric Header Fields */
if(JS_GetProperty(cx, hdr, "attr", &val) && !JSVAL_NULL_OR_VOID(val)) {
if(!JS_ValueToInt32(cx,val,&i32))
......@@ -1191,6 +1220,8 @@ static JSBool js_get_msg_header_resolve(JSContext *cx, JSObject *obj, jsid id)
LAZY_UINTEGER_EXPAND("expiration", p->msg.expiration, JSPROP_ENUMERATE);
LAZY_UINTEGER_EXPAND("priority", p->msg.priority, JSPROP_ENUMERATE);
LAZY_UINTEGER_EXPAND("cost", p->msg.cost, JSPROP_ENUMERATE);
LAZY_STRING_TRUNCSP_NULL("editor", p->msg.editor, JSPROP_ENUMERATE);
LAZY_UINTEGER_EXPAND("columns", p->msg.columns, JSPROP_ENUMERATE);
/* Fixed length portion of msg header */
LAZY_UINTEGER("type", p->msg.hdr.type, JSPROP_ENUMERATE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment