diff --git a/src/sbbs3/bulkmail.cpp b/src/sbbs3/bulkmail.cpp index a9e28a43fd36fa36c1b3ffb2cbb385a9fe49ebf4..6fc1de0f010c38595c4e668331140ca4015b862a 100644 --- a/src/sbbs3/bulkmail.cpp +++ b/src/sbbs3/bulkmail.cpp @@ -43,6 +43,7 @@ bool sbbs_t::bulkmail(uchar *ar) char str[256],title[LEN_TITLE+1]; char msgpath[MAX_PATH+1]; char* msgbuf; + char* editor=NULL; char tmp[512]; int i,j,x; long msgs=0; @@ -63,7 +64,7 @@ bool sbbs_t::bulkmail(uchar *ar) msg.hdr.attr|=MSG_ANONYMOUS; msg_tmp_fname(useron.xedit, msgpath, sizeof(msgpath)); - if(!writemsg(msgpath,nulstr,title,WM_EMAIL,INVALID_SUB,"Bulk Mailing")) { + if(!writemsg(msgpath,nulstr,title,WM_EMAIL,INVALID_SUB,"Bulk Mailing",&editor)) { bputs(text[Aborted]); return(false); } @@ -104,6 +105,9 @@ bool sbbs_t::bulkmail(uchar *ar) msg.hdr.when_written.time=time(NULL); msg.hdr.when_written.zone=sys_timezone(&cfg); + if(editor!=NULL) + smb_hfield_str(&msg,SMB_EDITOR,editor); + memset(&smb,0,sizeof(smb)); smb.subnum=INVALID_SUB; /* mail database */ i=savemsg(&cfg, &smb, &msg, &client, msgbuf); diff --git a/src/sbbs3/email.cpp b/src/sbbs3/email.cpp index ea13838273f435b2c563327640bb55feb0719dcb..831c06bdf129147e3694a41e105b1843728335b8 100644 --- a/src/sbbs3/email.cpp +++ b/src/sbbs3/email.cpp @@ -48,6 +48,8 @@ bool sbbs_t::email(int usernumber, const char *top, const char *subj, long mode) char str[256],str2[256],msgpath[256],title[LEN_TITLE+1],ch ,buf[SDT_BLOCK_LEN]; char tmp[512]; + char pid[128]; + char* editor=NULL; ushort msgattr=0; uint16_t xlat=XLAT_NONE; ushort nettype; @@ -111,7 +113,7 @@ bool sbbs_t::email(int usernumber, const char *top, const char *subj, long mode) msg_tmp_fname(useron.xedit, msgpath, sizeof(msgpath)); username(&cfg,usernumber,str2); - if(!writemsg(msgpath,top,title,mode,INVALID_SUB,str2)) { + if(!writemsg(msgpath,top,title,mode,INVALID_SUB,str2,&editor)) { bputs(text[Aborted]); return(false); } @@ -305,6 +307,12 @@ bool sbbs_t::email(int usernumber, const char *top, const char *subj, long mode) smb_hfield_str(&msg,SUBJECT,title); + /* Generate FidoNet Program Identifier */ + smb_hfield_str(&msg,FIDOPID,msg_program_id(pid)); + + if(editor!=NULL) + smb_hfield_str(&msg,SMB_EDITOR,editor); + smb_dfield(&msg,TEXT_BODY,length); i=smb_addmsghdr(&smb,&msg,SMB_SELFPACK); // calls smb_unlocksmbhdr() diff --git a/src/sbbs3/msgtoqwk.cpp b/src/sbbs3/msgtoqwk.cpp index 6cea0121e35b65126b0354870e087d3bf73afbc0..1f3270c1a95e798f34434f1c89f5af276624afdc 100644 --- a/src/sbbs3/msgtoqwk.cpp +++ b/src/sbbs3/msgtoqwk.cpp @@ -146,6 +146,10 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, int subnum if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOTID,NULL))!=NULL) fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); + /* Synchronet */ + if((p=(char*)smb_get_hfield(msg,hfield_type=SMB_EDITOR,NULL))!=NULL) + fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); + /* USENET */ if((p=(char*)smb_get_hfield(msg,hfield_type=USENETPATH,NULL))!=NULL) fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); diff --git a/src/sbbs3/netmail.cpp b/src/sbbs3/netmail.cpp index cbb1fbac2614e36c4df07067a74b53c626bbf676..d24e12208df1f6cf77c41de75776d1073ee6921a 100644 --- a/src/sbbs3/netmail.cpp +++ b/src/sbbs3/netmail.cpp @@ -45,6 +45,8 @@ bool sbbs_t::inetmail(const char *into, const char *subj, long mode) char str[256],str2[256],msgpath[256],title[256],name[256],ch ,buf[SDT_BLOCK_LEN],*p,addr[256]; char tmp[512]; + char pid[128]; + char* editor=NULL; char your_addr[128]; ushort xlat=XLAT_NONE,net=NET_INTERNET; int i,j,x,file; @@ -95,7 +97,7 @@ bool sbbs_t::inetmail(const char *into, const char *subj, long mode) nodesync(); sprintf(msgpath,"%snetmail.msg",cfg.node_dir); - if(!writemsg(msgpath,nulstr,title,mode,INVALID_SUB,into)) { + if(!writemsg(msgpath,nulstr,title,mode,INVALID_SUB,into,&editor)) { bputs(text[Aborted]); return(false); } @@ -256,7 +258,12 @@ bool sbbs_t::inetmail(const char *into, const char *subj, long mode) msg_client_hfields(&msg,&client); smb_hfield_str(&msg,SUBJECT,title); - SAFECOPY(str,title); + + /* Generate FidoNet Program Identifier */ + smb_hfield_str(&msg,FIDOPID,msg_program_id(pid)); + + if(editor!=NULL) + smb_hfield_str(&msg,SMB_EDITOR,editor); smb_dfield(&msg,TEXT_BODY,length); @@ -297,6 +304,8 @@ bool sbbs_t::qnetmail(const char *into, const char *subj, long mode) char str[256],msgpath[128],title[128],to[128],fulladdr[128] ,buf[SDT_BLOCK_LEN],*addr; char tmp[512]; + char pid[128]; + char* editor=NULL; ushort xlat=XLAT_NONE,net=NET_QWK,touser; int i,j,x,file; ulong length,offset; @@ -342,7 +351,7 @@ bool sbbs_t::qnetmail(const char *into, const char *subj, long mode) nodesync(); sprintf(msgpath,"%snetmail.msg",cfg.node_dir); - if(!writemsg(msgpath,nulstr,title,mode|WM_QWKNET,INVALID_SUB,to)) { + if(!writemsg(msgpath,nulstr,title,mode|WM_QWKNET,INVALID_SUB,to,&editor)) { bputs(text[Aborted]); return(false); } @@ -457,6 +466,12 @@ bool sbbs_t::qnetmail(const char *into, const char *subj, long mode) smb_hfield_str(&msg,SUBJECT,title); + /* Generate FidoNet Program Identifier */ + smb_hfield_str(&msg,FIDOPID,msg_program_id(pid)); + + if(editor!=NULL) + smb_hfield_str(&msg,SMB_EDITOR,editor); + smb_dfield(&msg,TEXT_BODY,length); i=smb_addmsghdr(&smb,&msg,SMB_SELFPACK); // calls smb_unlocksmbhdr() diff --git a/src/sbbs3/postmsg.cpp b/src/sbbs3/postmsg.cpp index 2a04bc7f2ff56cf7b9f8481a1801cef621d47792..77df2da583e919ffdab1d4c80478f347d7f848a9 100644 --- a/src/sbbs3/postmsg.cpp +++ b/src/sbbs3/postmsg.cpp @@ -37,7 +37,9 @@ #include "sbbs.h" -static char* program_id(char* pid) +/****************************************************************************/ +/****************************************************************************/ +extern "C" char* DLLCALL msg_program_id(char* pid) { char compiler[64]; @@ -65,6 +67,7 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode) char touser[64]; char from[64]; char pid[128]; + char* editor=NULL; uint16_t xlat; ushort msgattr; int i,j,x,file,storage; @@ -181,7 +184,7 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode) bputs(text[UsingRealName]); msg_tmp_fname(useron.xedit, str, sizeof(str)); - if(!writemsg(str,top,title,wm_mode,subnum,touser) + if(!writemsg(str,top,title,wm_mode,subnum,touser,&editor) || (long)(length=flength(str))<1) { /* Bugfix Aug-20-2003: Reject negative length */ bputs(text[Aborted]); return(false); @@ -293,6 +296,18 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode) fclose(instream); crc=~crc; + if(cfg.sub[subnum]->maxcrcs) { + i=smb_addcrc(&smb,crc); + if(i) { + smb_freemsgdat(&smb,offset,length,1); + smb_close(&smb); + smb_stack(&smb,SMB_STACK_POP); + attr(cfg.color[clr_err]); + bputs(text[CantPostMsg]); + return(false); + } + } + memset(&msg,0,sizeof(smbmsg_t)); msg.hdr.version=smb_ver(); msg.hdr.attr=msgattr; @@ -301,17 +316,6 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode) msg.hdr.number=smb.status.last_msg+1; /* this *should* be the new message number */ - smb_hfield_str(&msg,FIDOPID,program_id(pid)); - - /* Generate default (RFC822) message-id (always) */ - get_msgid(&cfg,subnum,&msg,msg_id,sizeof(msg_id)); - smb_hfield_str(&msg,RFC822MSGID,msg_id); - - /* Generate FTN (FTS-9) MSGID */ - if(cfg.sub[subnum]->misc&SUB_FIDO) { - ftn_msgid(cfg.sub[subnum],&msg,msg_id,sizeof(msg_id)); - smb_hfield_str(&msg,FIDOMSGID,msg_id); - } if(remsg) { msg.hdr.thread_back=remsg->hdr.number; /* needed for threading backward */ @@ -328,27 +332,12 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode) errormsg(WHERE,"updating thread",smb.file,i,smb.last_error); } - - if(cfg.sub[subnum]->maxcrcs) { - i=smb_addcrc(&smb,crc); - if(i) { - smb_freemsgdat(&smb,offset,length,1); - smb_close(&smb); - smb_stack(&smb,SMB_STACK_POP); - attr(cfg.color[clr_err]); - bputs(text[CantPostMsg]); - return(false); - } - } - msg.hdr.offset=offset; smb_hfield_str(&msg,RECIPIENT,touser); - strlwr(touser); SAFECOPY(str,cfg.sub[subnum]->misc&SUB_NAME ? useron.name : useron.alias); smb_hfield_str(&msg,SENDER,str); - strlwr(str); sprintf(str,"%u",useron.number); smb_hfield_str(&msg,SENDEREXT,str); @@ -358,6 +347,22 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode) smb_hfield_str(&msg,SUBJECT,title); + /* Generate default (RFC822) message-id (always) */ + get_msgid(&cfg,subnum,&msg,msg_id,sizeof(msg_id)); + smb_hfield_str(&msg,RFC822MSGID,msg_id); + + /* Generate FTN (FTS-9) MSGID */ + if(cfg.sub[subnum]->misc&SUB_FIDO) { + ftn_msgid(cfg.sub[subnum],&msg,msg_id,sizeof(msg_id)); + smb_hfield_str(&msg,FIDOMSGID,msg_id); + } + + /* Generate FidoNet Program Identifier */ + smb_hfield_str(&msg,FIDOPID,msg_program_id(pid)); + + if(editor!=NULL) + smb_hfield_str(&msg,SMB_EDITOR,editor); + smb_dfield(&msg,TEXT_BODY,length); i=smb_addmsghdr(&smb,&msg,storage); // calls smb_unlocksmbhdr() @@ -500,10 +505,6 @@ extern "C" int DLLCALL savemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, client_t* if(client!=NULL) msg_client_hfields(msg,client); - /* Generate FidoNet Program Identifier */ - if(msg->ftn_pid==NULL) - smb_hfield_str(msg,FIDOPID,program_id(pid)); - /* Generate RFC-822 Message-id */ if(msg->id==NULL) { get_msgid(cfg,smb->subnum,msg,msg_id,sizeof(msg_id)); @@ -517,6 +518,10 @@ extern "C" int DLLCALL savemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, client_t* smb_hfield_str(msg,FIDOMSGID,msg_id); } + /* Generate FidoNet Program Identifier */ + if(msg->ftn_pid==NULL) + smb_hfield_str(msg,FIDOPID,msg_program_id(pid)); + if((i=smb_addmsg(smb,msg,storage,dupechk_hashes,xlat,(uchar*)msgbuf,NULL))==SMB_SUCCESS && msg->to!=NULL /* no recipient means no header created at this stage */) signal_sub_sem(cfg,smb->subnum); diff --git a/src/sbbs3/qwktomsg.cpp b/src/sbbs3/qwktomsg.cpp index 1cc4df9404db9149841cb08842341de610b181b6..0dfbad16ddf1b61973db1942618e05bea9218d3f 100644 --- a/src/sbbs3/qwktomsg.cpp +++ b/src/sbbs3/qwktomsg.cpp @@ -135,6 +135,10 @@ static void qwk_parse_header_list(smbmsg_t* msg, str_list_t* headers, bool parse while((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=FIDOCTRL),value))!=NULL) smb_hfield_str(msg,hfield_type,p); + /* Synchronet */ + while((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=SMB_EDITOR),value))!=NULL) + smb_hfield_str(msg,hfield_type,p); + /* USENET */ while((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=USENETPATH),value))!=NULL) smb_hfield_str(msg,hfield_type,p); diff --git a/src/sbbs3/sbbs.h b/src/sbbs3/sbbs.h index 75a016551f8fbf04eae4a19f860f7a205a463e8d..00c6dbdc4d741d41feba88a0576efbab259bb0b5 100644 --- a/src/sbbs3/sbbs.h +++ b/src/sbbs3/sbbs.h @@ -469,7 +469,7 @@ public: /* writemsg.cpp */ void automsg(void); bool writemsg(const char *str, const char *top, char *title, long mode, int subnum - ,const char *dest); + ,const char *dest, char** editor=NULL); char* quotes_fname(int xedit, char* buf, size_t len); char* msg_tmp_fname(int xedit, char* fname, size_t len); char putmsg(const char *str, long mode); @@ -835,6 +835,7 @@ extern "C" { DLLEXPORT int DLLCALL savemsg(scfg_t*, smb_t*, smbmsg_t*, client_t*, char* msgbuf); DLLEXPORT void DLLCALL signal_sub_sem(scfg_t*, uint subnum); DLLEXPORT int DLLCALL msg_client_hfields(smbmsg_t*, client_t*); + DLLEXPORT char* DLLCALL msg_program_id(char* pid); /* filedat.c */ DLLEXPORT BOOL DLLCALL getfileixb(scfg_t* cfg, file_t* f); diff --git a/src/sbbs3/writemsg.cpp b/src/sbbs3/writemsg.cpp index 76be26c1cd2aab2a676a9ba5ae9be81315c566d7..5d8942ceeb8438f92dda2bc132f10cc8e76815b9 100644 --- a/src/sbbs3/writemsg.cpp +++ b/src/sbbs3/writemsg.cpp @@ -166,7 +166,7 @@ int sbbs_t::process_edited_file(const char* src, const char* dest, long mode, un /* 'dest' contains a text description of where the message is going. */ /****************************************************************************/ bool sbbs_t::writemsg(const char *fname, const char *top, char *title, long mode, int subnum - ,const char *dest) + ,const char *dest, char** editor) { char str[256],quote[128],c,*buf,*p,*tp ,useron_level; @@ -182,6 +182,9 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *title, long mode useron_level=useron.level; + if(editor!=NULL) + *editor=NULL; + if((buf=(char*)malloc(cfg.level_linespermsg[useron_level]*MAX_LINE_LEN)) ==NULL) { errormsg(WHERE,ERR_ALLOC,fname @@ -416,6 +419,9 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *title, long mode else if(useron.xedit) { + if(editor!=NULL) + *editor=cfg.xedit[useron.xedit-1]->name; + editor_inf(useron.xedit,dest,title,mode,subnum); if(cfg.xedit[useron.xedit-1]->type) { gettimeleft();