Commit b88658cd authored by rswindell's avatar rswindell
Browse files

Use the new smb msghdr_t.priority scheme (following X-Priority from email

headers).
Don't reference the (currently unused) times_downloaded and last_downloaded
msghdr_t elements/properties.
Set the current node action value *before* calling the scanposts_mod
("Scan Msgs module") in sbbs_t::scanposts().
parent c8a8ddec
......@@ -922,6 +922,12 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
msg->hdr.thread_first=i32;
}
if(JS_GetProperty(cx, hdr, "priority", &val) && !JSVAL_NULL_OR_VOID(val)) {
if(!JS_ValueToInt32(cx,val,&i32))
goto err;
msg->hdr.priority=i32;
}
if(JS_GetProperty(cx, hdr, "field_list", &val) && JSVAL_IS_OBJECT(val)) {
array=JSVAL_TO_OBJECT(val);
len=0;
......@@ -1381,7 +1387,6 @@ static JSBool js_get_msg_header_resolve(JSContext *cx, JSObject *obj, jsid id)
LAZY_STRING_COND("sender_time", (val=smb_get_hfield(&(p->msg),SENDERTIME,NULL))!=NULL, val, JSPROP_ENUMERATE);
LAZY_UINTEGER_EXPAND("forwarded", p->msg.forwarded, JSPROP_ENUMERATE);
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);
......@@ -1407,12 +1412,11 @@ static JSBool js_get_msg_header_resolve(JSContext *cx, JSObject *obj, jsid id)
LAZY_UINTEGER("thread_next", p->msg.hdr.thread_next, JSPROP_ENUMERATE);
LAZY_UINTEGER("thread_first", p->msg.hdr.thread_first, JSPROP_ENUMERATE);
LAZY_UINTEGER("delivery_attempts", p->msg.hdr.delivery_attempts, JSPROP_ENUMERATE);
LAZY_UINTEGER("last_downloaded", p->msg.hdr.last_downloaded, JSPROP_ENUMERATE);
LAZY_UINTEGER("times_downloaded", p->msg.hdr.times_downloaded, JSPROP_ENUMERATE);
LAZY_UINTEGER("data_length", smb_getmsgdatlen(&(p->msg)), JSPROP_ENUMERATE|JSPROP_READONLY);
LAZY_UINTEGER("text_length", smb_getmsgtxtlen(&(p->msg)), JSPROP_ENUMERATE|JSPROP_READONLY);
LAZY_STRING("date", msgdate((p->msg).hdr.when_written,date), JSPROP_ENUMERATE);
LAZY_UINTEGER("votes", p->msg.hdr.votes, JSPROP_ENUMERATE);
LAZY_UINTEGER_COND("priority", p->msg.hdr.priority != SMB_PRIORITY_UNSPECIFIED, p->msg.hdr.priority, JSPROP_ENUMERATE);
// Convenience (not technically part of header: */
LAZY_UINTEGER("upvotes", p->msg.upvotes, JSPROP_ENUMERATE|JSPROP_READONLY);
......
......@@ -733,6 +733,10 @@ static ulong sockmimetext(SOCKET socket, const char* prot, CRYPT_SESSION sess, s
if(!sockprintf(socket,prot,sess,"In-Reply-To: %s",msg->reply_id))
return(0);
if(msg->hdr.priority != SMB_PRIORITY_UNSPECIFIED)
if(!sockprintf(socket,prot,sess,"X-Priority: %u", (uint)msg->hdr.priority))
return(0);
originator_info(socket, prot, sess, msg);
/* Include all possible FidoNet header fields here */
......@@ -2432,6 +2436,14 @@ static int parse_header_field(char* buf, smbmsg_t* msg, ushort* type)
return SMB_SUCCESS; /* Ignore existing "Return-Path" header fields */
}
if(!stricmp(field, "X-PRIORITY")) {
msg->hdr.priority = atoi(p);
if(msg->hdr.priority > SMB_PRIORITY_LOWEST)
msg->hdr.priority = SMB_PRIORITY_UNSPECIFIED;
*type=UNKNOWN;
return SMB_SUCCESS;
}
/* Fall-through */
return smb_hfield_str(msg, *type=RFC822HEADER, buf);
}
......
......@@ -168,10 +168,8 @@ void sbbs_t::msghdr(smbmsg_t* msg)
bprintf("%-16.16s %d\r\n" ,"thread_first" ,msg->hdr.thread_first);
if(msg->hdr.delivery_attempts)
bprintf("%-16.16s %hu\r\n" ,"delivery_attempts" ,msg->hdr.delivery_attempts);
if(msg->hdr.times_downloaded)
bprintf("%-16.16s %u\r\n" ,"times_downloaded" ,msg->hdr.times_downloaded);
if(msg->hdr.last_downloaded)
bprintf("%-16.16s %s\r\n" ,"last_downloaded" ,timestr(msg->hdr.last_downloaded));
if(msg->hdr.priority)
bprintf("%-16.16s %u\r\n" ,"priority" ,msg->hdr.priority);
if(msg->hdr.votes)
bprintf("%-16.16s %hu\r\n" ,"votes" ,msg->hdr.votes);
......@@ -179,8 +177,6 @@ void sbbs_t::msghdr(smbmsg_t* msg)
if(msg->expiration)
bprintf("%-16.16s %s\r\n" ,"expiration"
,timestr(msg->expiration));
if(msg->priority)
bprintf("%-16.16s %u\r\n" ,"priority" ,msg->priority);
if(msg->cost)
bprintf("%-16.16s %u\r\n" ,"cost" ,msg->cost);
......@@ -513,6 +509,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
smbmsg_t msg;
bool thread_mode = false;
action=NODE_RMSG;
cursubnum=subnum; /* for ARS */
if(cfg.scanposts_mod[0] && !scanposts_inside) {
char cmdline[256];
......@@ -648,7 +645,6 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
smb_unlocksmbhdr(&smb);
last=smb.status.last_msg;
action=NODE_RMSG;
if(mode&SCAN_CONST) { /* update action */
getnodedat(cfg.node_num,&thisnode,1);
thisnode.action=NODE_RMSG;
......
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