Skip to content
Snippets Groups Projects
Commit c9051a51 authored by rswindell's avatar rswindell
Browse files

MSGTMP is now created in the node_dir (again), as some QuickBBS editors are dumb.

parent 400a53c0
No related branches found
No related tags found
No related merge requests found
...@@ -51,8 +51,9 @@ void quotestr(char *str); ...@@ -51,8 +51,9 @@ void quotestr(char *str);
bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum
,char *dest) ,char *dest)
{ {
char str[256],quote[128],msgtmp[32],c,HUGE16 *buf,ex_mode=0,*p,*tp char str[256],quote[128],c,HUGE16 *buf,ex_mode=0,*p,*tp
,useron_level; ,useron_level;
char msgtmp[MAX_PATH+1];
char tmp[512]; char tmp[512];
int i,j,file,linesquoted=0; int i,j,file,linesquoted=0;
long length,qlen,qtime; long length,qlen,qtime;
...@@ -72,9 +73,9 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum ...@@ -72,9 +73,9 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum
mode|=WM_NOTOP; mode|=WM_NOTOP;
if(useron.xedit && cfg.xedit[useron.xedit-1]->misc&QUICKBBS) if(useron.xedit && cfg.xedit[useron.xedit-1]->misc&QUICKBBS)
strcpy(msgtmp,"MSGTMP"); sprintf(msgtmp,"%sMSGTMP",cfg.node_dir); /* QuickBBS editors are dumb */
else else
strcpy(msgtmp,"INPUT.MSG"); sprintf(msgtmp,"%sINPUT.MSG",cfg.temp_dir);
if(mode&WM_QUOTE && !(useron.rest&FLAG('J')) if(mode&WM_QUOTE && !(useron.rest&FLAG('J'))
&& ((mode&(WM_EMAIL|WM_NETMAIL) && cfg.sys_misc&SM_QUOTE_EM) && ((mode&(WM_EMAIL|WM_NETMAIL) && cfg.sys_misc&SM_QUOTE_EM)
...@@ -91,9 +92,8 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum ...@@ -91,9 +92,8 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum
return(false); return(false);
} }
sprintf(str,"%s%s",cfg.temp_dir,msgtmp); /* file for quoted msg */ if((file=nopen(msgtmp,O_WRONLY|O_CREAT|O_TRUNC))==-1) {
if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1) { errormsg(WHERE,ERR_OPEN,msgtmp,O_WRONLY|O_CREAT|O_TRUNC);
errormsg(WHERE,ERR_OPEN,str,O_WRONLY|O_CREAT|O_TRUNC);
LFREE(buf); LFREE(buf);
fclose(stream); fclose(stream);
return(false); return(false);
...@@ -123,9 +123,8 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum ...@@ -123,9 +123,8 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum
LFREE(buf); LFREE(buf);
return(false); } return(false); }
sprintf(str,"%s%s",cfg.temp_dir,msgtmp); /* file for quoted msg */ if((file=nopen(msgtmp,O_WRONLY|O_CREAT|O_TRUNC))==-1) {
if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1) { errormsg(WHERE,ERR_OPEN,msgtmp,O_WRONLY|O_CREAT|O_TRUNC);
errormsg(WHERE,ERR_OPEN,str,O_WRONLY|O_CREAT|O_TRUNC);
LFREE(buf); LFREE(buf);
fclose(stream); fclose(stream);
return(false); } return(false); }
...@@ -286,34 +285,33 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum ...@@ -286,34 +285,33 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum
if(cfg.xedit[useron.xedit-1]->misc&WWIVCOLOR) if(cfg.xedit[useron.xedit-1]->misc&WWIVCOLOR)
ex_mode|=EX_WWIV; } ex_mode|=EX_WWIV; }
sprintf(str,"%s%s",cfg.temp_dir,msgtmp); /* temporary file for input */ if(!linesquoted && fexist(msgtmp))
if(!linesquoted && fexist(str)) remove(msgtmp);
remove(str);
if(linesquoted) { if(linesquoted) {
qlen=flength(str); qlen=flength(msgtmp);
qtime=fdate(str); } qtime=fdate(msgtmp); }
if(online==ON_LOCAL) { if(online==ON_LOCAL) {
if(cfg.node_misc&NM_LCL_EDIT && cfg.node_editor[0]) if(cfg.node_misc&NM_LCL_EDIT && cfg.node_editor[0])
external(cmdstr(cfg.node_editor,str,nulstr,NULL) external(cmdstr(cfg.node_editor,msgtmp,nulstr,NULL)
,0,cfg.node_dir); ,0,cfg.node_dir);
else else
external(cmdstr(cfg.xedit[useron.xedit-1]->lcmd,str,nulstr,NULL) external(cmdstr(cfg.xedit[useron.xedit-1]->lcmd,msgtmp,nulstr,NULL)
,ex_mode,cfg.node_dir); } ,ex_mode,cfg.node_dir); }
else { else {
rioctl(IOCM|PAUSE|ABORT); rioctl(IOCM|PAUSE|ABORT);
external(cmdstr(cfg.xedit[useron.xedit-1]->rcmd,str,nulstr,NULL),ex_mode,cfg.node_dir); external(cmdstr(cfg.xedit[useron.xedit-1]->rcmd,msgtmp,nulstr,NULL),ex_mode,cfg.node_dir);
rioctl(IOSM|PAUSE|ABORT); } rioctl(IOSM|PAUSE|ABORT); }
checkline(); checkline();
if(!fexist(str) || !online if(!fexist(msgtmp) || !online
|| (linesquoted && qlen==flength(str) && qtime==fdate(str))) { || (linesquoted && qlen==flength(msgtmp) && qtime==fdate(msgtmp))) {
LFREE(buf); LFREE(buf);
return(false); } return(false); }
buf[0]=0; buf[0]=0;
if(!(mode&WM_NOTOP)) if(!(mode&WM_NOTOP))
strcpy((char *)buf,top); strcpy((char *)buf,top);
if((file=nopen(str,O_RDONLY))==-1) { if((file=nopen(msgtmp,O_RDONLY))==-1) {
errormsg(WHERE,ERR_OPEN,str,O_RDONLY); errormsg(WHERE,ERR_OPEN,msgtmp,O_RDONLY);
LFREE(buf); LFREE(buf);
return(false); } return(false); }
length=filelength(file); length=filelength(file);
...@@ -324,20 +322,19 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum ...@@ -324,20 +322,19 @@ bool sbbs_t::writemsg(char *fname, char *top, char *title, long mode, int subnum
bputs(text[OutOfBytes]); } bputs(text[OutOfBytes]); }
lread(file,buf+l,length); lread(file,buf+l,length);
close(file); close(file);
// remove(str); /* no need to save the temp input file */ // remove(msgtmp); /* no need to save the temp input file */
buf[l+length]=0; } buf[l+length]=0; }
else { else {
buf[0]=0; buf[0]=0;
if(linesquoted) { if(linesquoted) {
sprintf(str,"%s%s",cfg.temp_dir,msgtmp); if((file=nopen(msgtmp,O_RDONLY))!=-1) {
if((file=nopen(str,O_RDONLY))!=-1) {
length=filelength(file); length=filelength(file);
l=length>cfg.level_linespermsg[useron_level]*MAX_LINE_LEN l=length>cfg.level_linespermsg[useron_level]*MAX_LINE_LEN
? cfg.level_linespermsg[useron_level]*MAX_LINE_LEN : length; ? cfg.level_linespermsg[useron_level]*MAX_LINE_LEN : length;
lread(file,buf,l); lread(file,buf,l);
buf[l]=0; buf[l]=0;
close(file); close(file);
// remove(str); // remove(msgtmp);
} } } }
if(!(msgeditor((char *)buf,mode&WM_NOTOP ? nulstr : top,title))) { if(!(msgeditor((char *)buf,mode&WM_NOTOP ? nulstr : top,title))) {
LFREE(buf); LFREE(buf);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment