Removed Random token for changing/header/body

This commit is contained in:
Alexander S. Aganichev 2001-07-23 03:59:42 +00:00
parent d7e93f01e7
commit 2fb0403106

View File

@ -80,7 +80,6 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
char initials[10]; char initials[10];
char quotestr[100]; char quotestr[100];
char qbuf[100]; char qbuf[100];
int chg;
uint len; uint len;
int y; int y;
int tmptpl = NO; int tmptpl = NO;
@ -309,7 +308,7 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
while(fgets(buf, sizeof(buf), fp)) { while(fgets(buf, sizeof(buf), fp)) {
ptr = strskip_wht(buf); ptr = strskip_wht(buf);
if(*ptr != ';') { if(*ptr != ';') {
chg = NO; bool chg = false;
quotebufline = NO; quotebufline = NO;
ptr = buf; ptr = buf;
int token = end_token; int token = end_token;
@ -352,21 +351,21 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
case TPLTOKEN_CHANGED: case TPLTOKEN_CHANGED:
if(mode != MODE_CHANGE) if(mode != MODE_CHANGE)
goto loop_next; goto loop_next;
chg = YES; chg = true;
token = end_token; token = end_token;
break; break;
case TPLTOKEN_HEADER: case TPLTOKEN_HEADER:
if((mode != MODE_HEADER) and (mode != MODE_WRITEHEADER)) if((mode != MODE_HEADER) and (mode != MODE_WRITEHEADER))
goto loop_next; goto loop_next;
chg = YES; chg = true;
token = end_token; token = end_token;
break; break;
case TPLTOKEN_WRITE: case TPLTOKEN_WRITE:
if((mode != MODE_WRITE) and (mode != MODE_WRITEHEADER)) if((mode != MODE_WRITE) and (mode != MODE_WRITEHEADER))
goto loop_next; goto loop_next;
chg = YES; chg = true;
token = end_token; token = end_token;
break; break;
@ -506,7 +505,11 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
continue; continue;
case TPLTOKEN_RANDOM: case TPLTOKEN_RANDOM:
if(mode != MODE_QUOTEBUF) { if((mode != MODE_QUOTEBUF) and
(not chg and ((mode != MODE_CHANGE) and
(mode != MODE_WRITEHEADER) and
(mode != MODE_WRITE) and
(mode != MODE_HEADER)))) {
strtrim(ptr); strtrim(ptr);
ptr = strskip_wht(strskip_txt(ptr)); ptr = strskip_wht(strskip_txt(ptr));
if(*ptr) { if(*ptr) {
@ -605,7 +608,8 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
continue; continue;
case TPLTOKEN_QUOTE: case TPLTOKEN_QUOTE:
if(mode == MODE_QUOTE or mode == MODE_REPLYCOMMENT or mode == MODE_QUOTEBUF) { if((mode == MODE_QUOTE) or (mode == MODE_REPLYCOMMENT) or
(mode == MODE_QUOTEBUF)) {
y = 0; y = 0;
ptr = strskip_wht(oldmsg->By()); ptr = strskip_wht(oldmsg->By());
while(*ptr) { while(*ptr) {
@ -771,9 +775,9 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
} }
} }
if((mode == MODE_CHANGE) or (mode == MODE_WRITEHEADER) or (mode == MODE_WRITE) or (mode == MODE_HEADER)) if(not chg and ((mode == MODE_CHANGE) or (mode == MODE_WRITEHEADER) or
if(chg == NO) (mode == MODE_WRITE) or (mode == MODE_HEADER)))
continue; continue;
if((mode == MODE_QUOTEBUF) and not quotebufline) if((mode == MODE_QUOTEBUF) and not quotebufline)
continue; continue;
TokenXlat(mode, buf, msg, oldmsg, origarea); TokenXlat(mode, buf, msg, oldmsg, origarea);
@ -794,6 +798,13 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
ctrlinfo = AA->Ctrlinfo(); ctrlinfo = AA->Ctrlinfo();
ctrlinfo |= CI_TAGL; ctrlinfo |= CI_TAGL;
if(ctrlinfo & (CI_TAGL|CI_TEAR|CI_ORIG)) { if(ctrlinfo & (CI_TAGL|CI_TEAR|CI_ORIG)) {
// Add CR if it missed in template
if(msg->txt[pos-1] != CR) {
size++;
msg->txt[pos++] = CR;
}
do { do {
if((ctrlinfo & CI_ORIG) and not (ctrlinfo & CI_TEAR) and not (ctrlinfo & CI_TAGL)) { if((ctrlinfo & CI_ORIG) and not (ctrlinfo & CI_TEAR) and not (ctrlinfo & CI_TAGL)) {
sprintf(buf, " * Origin: %s", msg->origin); sprintf(buf, " * Origin: %s", msg->origin);