diff --git a/src/sbbs3/js_msgbase.c b/src/sbbs3/js_msgbase.c index 9dd49638f9de782da96eb98cf00a969d84a5f904..fdde31ba8cb6dc00ae381c7113bfb9afb1e586cd 100644 --- a/src/sbbs3/js_msgbase.c +++ b/src/sbbs3/js_msgbase.c @@ -1,8 +1,5 @@ /* Synchronet JavaScript "MsgBase" Object */ -/* $Id: js_msgbase.c,v 1.262 2020/05/07 21:58:37 rswindell Exp $ */ -// vi: tabstop=4 - /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * @@ -16,21 +13,9 @@ * See the GNU General Public License for more details: gpl.txt or * * http://www.fsf.org/copyleft/gpl.html * * * - * Anonymous FTP access to the most recent released source is available at * - * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net * - * * - * Anonymous CVS access to the development source and modification history * - * is available at cvs.synchro.net:/cvsroot/sbbs, example: * - * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login * - * (just hit return, no password is necessary) * - * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src * - * * * For Synchronet coding style and modification guidelines, see * * http://www.synchro.net/source.html * * * - * You are encouraged to submit any modifications (preferably in Unix diff * - * format) via e-mail to mods@synchro.net * - * * * Note: If this box doesn't appear square, then you need to fix your tabs. * ****************************************************************************/ @@ -795,6 +780,19 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm } } + if(JS_GetProperty(cx, hdr, "ftn_bbsid", &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 \"ftn_bbsid\" string in header object"); + goto err; + } + if((smb_result = smb_hfield_str(msg, FIDOBBSID, cp))!=SMB_SUCCESS) { + JS_ReportError(cx, "Error %d adding FIDOBBSID field to message header", smb_result); + goto err; + } + } + if(JS_GetProperty(cx, hdr, "date", &val) && !JSVAL_NULL_OR_VOID(val)) { JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL); HANDLE_PENDING(cx, cp); @@ -1522,6 +1520,7 @@ static JSBool js_get_msg_header_resolve(JSContext *cx, JSObject *obj, jsid id) LAZY_STRING_TRUNCSP_NULL("ftn_area", p->msg.ftn_area, JSPROP_ENUMERATE); LAZY_STRING_TRUNCSP_NULL("ftn_flags", p->msg.ftn_flags, JSPROP_ENUMERATE); LAZY_STRING_TRUNCSP_NULL("ftn_charset", p->msg.ftn_charset, JSPROP_ENUMERATE); + LAZY_STRING_TRUNCSP_NULL("ftn_bbsid", p->msg.ftn_bbsid, JSPROP_ENUMERATE); if(name==NULL || strcmp(name,"field_list")==0) { if(name) free(name); diff --git a/src/sbbs3/sbbsecho.c b/src/sbbs3/sbbsecho.c index ef34fff7211754133e0cbcaa9d9c1c7999b8541c..b0431a0a713d23a95417c6a408ff57d60ba67110 100644 --- a/src/sbbs3/sbbsecho.c +++ b/src/sbbs3/sbbsecho.c @@ -1232,6 +1232,8 @@ int create_netmail(const char *to, const smbmsg_t* msg, const char *subject, con fprintf(fp, "\1MSGID: %.256s\r", msg->ftn_msgid); if(msg->ftn_reply != NULL) fprintf(fp, "\1REPLY: %.256s\r", msg->ftn_reply); + if(msg->ftn_bbsid != NULL) + fprintf(fp, "\1BBSID: %.256s\r", msg->ftn_bbsid); if(msg->ftn_flags != NULL) fprintf(fp, "\1FLAGS %s\r", msg->ftn_flags); else if(msg->hdr.auxattr&MSG_KILLFILE) @@ -3493,6 +3495,15 @@ int fmsgtosmsg(char* fbuf, fmsghdr_t* hdr, uint usernumber, uint subnum) smb_hfield_bin(&msg, SMB_COLUMNS, columns); } + else if(!strncmp(fbuf+l+1,"BBSID:",6)) { + l+=7; + while(l<length && fbuf[l]<=' ' && fbuf[l]>=0) l++; + m=l; + while(m<length && fbuf[m]!='\r') m++; + if(m>l) + smb_hfield(&msg,FIDOBBSID,(ushort)(m-l),fbuf+l); + } + else { /* Unknown kludge line */ while(l<length && fbuf[l]<=' ' && fbuf[l]>=0) l++; m=l; @@ -4912,6 +4923,11 @@ void export_echomail(const char* sub_code, const nodecfg_t* nodecfg, bool rescan if(msg.columns) f += sprintf(fmsgbuf+f, "\1COLS: %u\r", (unsigned int)msg.columns); + if(msg.ftn_bbsid != NULL) /* use original BBSID */ + f += sprintf(fmsgbuf + f, "\1BBSID: %.256s\r", msg.ftn_bbsid); + else if(msg.from_net.type != NET_FIDO) + f += sprintf(fmsgbuf + f, "\1BBSID: %.256s\r", scfg.sys_id); + if(rescan) f+=sprintf(fmsgbuf+f,"\1RESCANNED %s\r", smb_faddrtoa(&scfg.sub[subnum]->faddr,NULL)); diff --git a/src/smblib/smbdefs.h b/src/smblib/smbdefs.h index 9210897a6a560f16d531b28393982add0b35eb1c..89d195f53dfbf80f672839e719a16b7f6c8b6bcc 100644 --- a/src/smblib/smbdefs.h +++ b/src/smblib/smbdefs.h @@ -1,36 +1,21 @@ /* Synchronet message base constant and structure definitions */ -/* $Id: smbdefs.h,v 1.119 2019/07/30 10:20:20 rswindell Exp $ */ -// vi: tabstop=4 - /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * * Copyright Rob Swindell - http://www.synchro.net/copyright.html * * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public License * * as published by the Free Software Foundation; either version 2 * * of the License, or (at your option) any later version. * - * See the GNU General Public License for more details: gpl.txt or * - * http://www.fsf.org/copyleft/gpl.html * - * * - * Anonymous FTP access to the most recent released source is available at * - * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net * - * * - * Anonymous CVS access to the development source and modification history * - * is available at cvs.synchro.net:/cvsroot/sbbs, example: * - * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login * - * (just hit return, no password is necessary) * - * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src * + * See the GNU Lesser General Public License for more details: lgpl.txt or * + * http://www.fsf.org/copyleft/lesser.html * * * * For Synchronet coding style and modification guidelines, see * * http://www.synchro.net/source.html * * * - * You are encouraged to submit any modifications (preferably in Unix diff * - * format) via e-mail to mods@synchro.net * - * * * Note: If this box doesn't appear square, then you need to fix your tabs. * ****************************************************************************/ @@ -224,6 +209,7 @@ #define FIDOFLAGS 0xa7 #define FIDOTID 0xa8 #define FIDOCHARSET 0xa9 // CHRS or CHARSET control line +#define FIDOBBSID 0xaa // RFC822* header field values are strings of US-ASCII chars, but potentially MIME-encoded (RFC2047) // (i.e. base64 or Q-encoded UTF-8, ISO-8859-1, etc.) @@ -563,6 +549,7 @@ typedef struct { /* Message */ *ftn_area, /* FTN AREA */ *ftn_flags, /* FTN FLAGS */ *ftn_charset, /* FTN CHRS */ + *ftn_bbsid, /* FTN BBSID */ *ftn_msgid, /* FTN MSGID */ *ftn_reply; /* FTN REPLY */ char* summary; /* Summary */ diff --git a/src/smblib/smblib.c b/src/smblib/smblib.c index 552b02bfdb5ca31f678ccc5e26ecc0cdd1a592b6..a670a1262acaa013c1b415d88ddaa55317d2e63b 100644 --- a/src/smblib/smblib.c +++ b/src/smblib/smblib.c @@ -840,6 +840,9 @@ static void set_convenience_ptr(smbmsg_t* msg, uint16_t hfield_type, void* hfiel case FIDOCHARSET: msg->ftn_charset=(char*)hfield_dat; break; + case FIDOBBSID: + msg->ftn_bbsid=(char*)hfield_dat; + break; case RFC822HEADER: { char* p = (char*)hfield_dat; diff --git a/src/smblib/smbstr.c b/src/smblib/smbstr.c index fe99b826453c3ca1302e3843f8bbf000d9ae2e7b..245f4ef4020e3039830a4d52dd6c352988362819 100644 --- a/src/smblib/smbstr.c +++ b/src/smblib/smbstr.c @@ -81,6 +81,7 @@ char* SMBCALL smb_hfieldtype(uint16_t type) case FIDOFLAGS: return("X-FTN-Flags"); case FIDOTID: return("X-FTN-TID"); case FIDOCHARSET: return("X-FTN-CHRS"); + case FIDOBBSID: return("X-FTN-BBSID"); case RFC822HEADER: return("OtherHeader"); case RFC822MSGID: return("Message-ID"); /* RFC-compliant */