diff --git a/src/sbbs3/writemsg.cpp b/src/sbbs3/writemsg.cpp index 7e554578cb0431a748e7ebdb89dfb6cf74e60fa7..1dd96f518358014bbfcd05810717e5eec2711d6b 100644 --- a/src/sbbs3/writemsg.cpp +++ b/src/sbbs3/writemsg.cpp @@ -57,8 +57,10 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum char tmp[512]; int i,j,file,linesquoted=0; long length,qlen=0,qtime=0,ex_mode=0; + int max_title_len=LEN_TITLE; ulong l; - FILE * stream; + FILE* stream; + FILE* fp; useron_level=useron.level; @@ -242,19 +244,19 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum if(!(mode&WM_EXTDESC)) { if(mode&WM_FILE) { - c=12; + max_title_len=12; /* ToDo: implied 8.3 filename limit! */ CRLF; bputs(text[Filename]); } else { - c=LEN_TITLE; + max_title_len=LEN_TITLE; if(mode&WM_QWKNET || (subnum!=INVALID_SUB && (cfg.sub[subnum]->misc&(SUB_QNET|SUB_INET|SUB_FIDO))==SUB_QNET)) - c=25; + max_title_len=25; bputs(text[SubjectPrompt]); } - if(!getstr(title,c,mode&WM_FILE ? K_LINE : K_LINE|K_EDIT|K_AUTODEL) + if(!getstr(title,max_title_len,mode&WM_FILE ? K_LINE : K_LINE|K_EDIT|K_AUTODEL) && useron_level && useron.logons) { free(buf); return(false); @@ -273,17 +275,6 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum return(false); } - /* Create WWIV compatible EDITOR.INF file */ - - if(useron.xedit) { - editor_inf(useron.xedit,dest,title,mode,subnum); - if(cfg.xedit[useron.xedit-1]->type) { - gettimeleft(); - xtrndat(useron.alias,cfg.node_dir,cfg.xedit[useron.xedit-1]->type - ,timeleft,cfg.xedit[useron.xedit-1]->misc); - } - } - if(console&CON_RAW_IN) { bprintf(text[EnterMsgNowRaw] ,(ulong)cfg.level_linespermsg[useron_level]*MAX_LINE_LEN); @@ -317,14 +308,21 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum else if(useron.xedit) { - if(useron.xedit && cfg.xedit[useron.xedit-1]->misc&IO_INTS) { + editor_inf(useron.xedit,dest,title,mode,subnum); + if(cfg.xedit[useron.xedit-1]->type) { + gettimeleft(); + xtrndat(useron.alias,cfg.node_dir,cfg.xedit[useron.xedit-1]->type + ,timeleft,cfg.xedit[useron.xedit-1]->misc); + } + + if(cfg.xedit[useron.xedit-1]->misc&IO_INTS) { ex_mode|=(EX_OUTR|EX_INR); if(cfg.xedit[useron.xedit-1]->misc&WWIVCOLOR) ex_mode|=EX_WWIV; } - if(useron.xedit && cfg.xedit[useron.xedit-1]->misc&XTRN_NATIVE) + if(cfg.xedit[useron.xedit-1]->misc&XTRN_NATIVE) ex_mode|=EX_NATIVE; - if(useron.xedit && cfg.xedit[useron.xedit-1]->misc&XTRN_SH) + if(cfg.xedit[useron.xedit-1]->misc&XTRN_SH) ex_mode|=EX_SH; if(!linesquoted && fexistcase(msgtmp)) @@ -345,6 +343,19 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum free(buf); return(false); } + SAFEPRINTF(str,"%sRESULT.ED",cfg.node_dir); + if(!(mode&(WM_EXTDESC|WM_FILE)) + && !(cfg.xedit[useron.xedit-1]->misc&QUICKBBS) + && fexistcase(str)) { + if((fp=fopen(str,"r")) != NULL) { + fgets(str,sizeof(str),fp); + fgets(str,sizeof(str),fp); + truncsp(str); + sprintf(title,"%.*s",max_title_len,str); + fclose(fp); + } + } + buf[0]=0; if(!(mode&WM_NOTOP)) strcpy((char *)buf,top); @@ -493,6 +504,9 @@ void sbbs_t::editor_inf(int xeditnum,char *dest, char *title, long mode close(file); } else { + SAFEPRINTF(str,"%sRESULT.ED",cfg.node_dir); + if(fexistcase(str)) + remove(str); strcpy(tmp,"EDITOR.INF"); if(cfg.xedit[xeditnum]->misc&XTRN_LWRCASE) strlwr(tmp);