This commit is contained in:
Alexander S. Aganichev 2001-03-04 11:03:12 +00:00
parent d69ba8b37a
commit a01074ec94
6 changed files with 93 additions and 70 deletions

View File

@ -12,6 +12,10 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, March xx 2001 Notes for GoldED+ 1.1.5, March xx 2001
______________________________________________________________________ ______________________________________________________________________
- Fixed "Via" kludge handling in JAM areas.
! Quote wrapping algorithm slightly changed.
- Fixed some quirks in internal editor. - Fixed some quirks in internal editor.
- Fixed EDITHARDLINE keyword operation. - Fixed EDITHARDLINE keyword operation.

View File

@ -68,7 +68,9 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, int margin, bool clip)
} }
#else #else
TemplateToText(((mode == MODE_WRITE) and prnheader) ? ((prnheader & WRITE_ONLY_HEADER) ? MODE_HEADER : MODE_WRITEHEADER) : MODE_WRITE, msg, msg, AA->Tpl(), CurrArea); TemplateToText(((mode == MODE_WRITE) and prnheader) ? ((prnheader & WRITE_ONLY_HEADER) ? MODE_HEADER : MODE_WRITEHEADER) : MODE_WRITE, msg, msg, AA->Tpl(), CurrArea);
msg->attr.tou1();
msg->TextToLines(margin); msg->TextToLines(margin);
msg->attr.tou0();
#endif #endif
int n = 0; int n = 0;
Line** lin = msg->line; Line** lin = msg->line;

View File

@ -1841,6 +1841,19 @@ bool check_multipart(const char* ptr, const char* keptr, char* boundary) {
} }
// ------------------------------------------------------------------
inline bool put_on_new_line(const char *ptr, const char *prev_ptr) {
if(((ptr[0] == ptr[1]) and (ptr[0] == ptr[2])) or
strneql(ptr, " * Origin: ", 11) or
strneql(ptr, "SEEN-BY:", 8) or
(ptr[0] == prev_ptr[0]) and (ptr[1] == prev_ptr[1]))
return true;
return false;
}
// ------------------------------------------------------------------ // ------------------------------------------------------------------
void MakeLineIndex(GMsg* msg, int margin, bool header_recode) { void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
@ -1864,12 +1877,13 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
char* tmp=NULL; char* tmp=NULL;
char* linetmp=NULL; char* linetmp=NULL;
uint qlen=0, qlen2=0; uint qlen=0, qlen2=0;
int wraps=0, para=0, reflow=NO, quoteflag=NO, chslev; int wraps=0, para=0, chslev;
int getvalue = not msg->attr.tou(); bool reflow = false, quoteflag = false;
bool getvalue = not msg->attr.tou();
bool quotewraphard = AA->Quotewraphard(); bool quotewraphard = AA->Quotewraphard();
int qpencoded = strieql(AA->Xlatimport(), "LATIN1QP") ? true : false; bool qpencoded = getvalue and (strieql(AA->Xlatimport(), "LATIN1QP") ? true : false);
int gotmime = false; bool gotmime = false;
int firstemptyline = false; bool firstemptyline = false;
bool gotmultipart = false; bool gotmultipart = false;
bool inheader = false; bool inheader = false;
char boundary[100]; char boundary[100];
@ -1878,7 +1892,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
if(margin < 0) { if(margin < 0) {
margin = -margin; margin = -margin;
quoteflag = YES; quoteflag = true;
} }
// Free all previously allocated lines // Free all previously allocated lines
@ -1955,7 +1969,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
if(reflow) { if(reflow) {
len = qlen; len = qlen;
qptr = qbuf; qptr = qbuf;
reflow = NO; reflow = false;
// Insert previous quotestring // Insert previous quotestring
for(n=0; n<qlen; n++) { for(n=0; n<qlen; n++) {
*(++bp) = *qptr++; *(++bp) = *qptr++;
@ -2111,7 +2125,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
// Get one line // Get one line
ch = 0; ch = '\0';
tmp = NULL; tmp = NULL;
while(*ptr and (len < (uint)margin)) { while(*ptr and (len < (uint)margin)) {
switch(*ptr) { switch(*ptr) {
@ -2123,28 +2137,20 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
if(wraps and not ((line->type & GLINE_HARD) and not (line->type & GLINE_QUOT))) { if(wraps and not ((line->type & GLINE_HARD) and not (line->type & GLINE_QUOT))) {
if(para != GLINE_QUOT) { if(para != GLINE_QUOT) {
if(quoteflag) { if(quoteflag) {
if(prevline and *prevline->txt.c_str() == CTRL_A and prevline->type & GLINE_WRAP) { if(prevline and (*prevline->txt.c_str() == CTRL_A) and (prevline->type & GLINE_WRAP)) {
wraps = 0; wraps = 0;
break; break;
} }
if(*ptr == CR or is_quote(ptr) or *ptr == CTRL_A) { if((*ptr == CR) or is_quote(ptr) or (*ptr == CTRL_A)) {
wraps = 0; wraps = 0;
break; break;
} }
if(((ptr[0] == ptr[1]) and (ptr[0] == ptr[2])) or strneql(ptr, " * Origin: ", 11)) { if(put_on_new_line(ptr, prev_ptr)) {
wraps = 0;
break;
}
if(strneql(ptr, "SEEN-BY:", 8)) {
wraps = 0;
break;
}
if((ptr[0] == prev_ptr[0]) and (ptr[1] == prev_ptr[1])) {
wraps = 0; wraps = 0;
break; break;
} }
char* lp = ptr; char* lp = ptr;
while(*lp == ' ') while((*lp == ' ') or (*lp == '\t'))
lp++; lp++;
if(*lp == CR) { if(*lp == CR) {
wraps = 0; wraps = 0;
@ -2152,12 +2158,12 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
} }
else { else {
ptr = lp; ptr = lp;
if(*bp != ' ') {
*(++bp) = ' ';
len++;
}
} }
if(*ptr != ' ' and *ptr != '\t' and *bp != ' ') { ch = '\0';
*(++bp) = ' ';
len++;
}
ch = 0;
continue; continue;
} }
else { else {
@ -2167,12 +2173,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
} }
else { else {
GetQuotestr(ptr, qbuf2, &qlen2); GetQuotestr(ptr, qbuf2, &qlen2);
if(*ptr == CR) { if((*ptr != CR) and cmp_quotes(qbuf2, qbuf)) {
wraps = 0;
para = 0;
break;
}
else if(cmp_quotes(qbuf2, qbuf)) {
char* lp = ptr + qlen2; char* lp = ptr + qlen2;
if(is_quote(lp)) { if(is_quote(lp)) {
wraps = 0; wraps = 0;
@ -2182,10 +2183,22 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
else { else {
ptr = lp; ptr = lp;
para = GLINE_QUOT; para = GLINE_QUOT;
if(*ptr != ' ' and *bp != ' ') { if((*ptr != ' ') and (*bp != ' ')) {
if(put_on_new_line(ptr, prev_ptr)) {
ptr -= qlen2;
wraps = 0;
break;
}
tmp = ptr-1;
btmp = bp;
*(++bp) = ' '; *(++bp) = ' ';
len++; len++;
} }
else if(*ptr == ' ') {
ptr -= qlen2;
wraps = 0;
break;
}
ch = 0; ch = 0;
continue; continue;
} }
@ -2301,7 +2314,37 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
*(++bp) = *ptr++; *(++bp) = *ptr++;
++len; ++len;
break; break;
case '=':
if(qpencoded) {
if(isxdigit(ptr[1]) and isxdigit(ptr[2])) {
// Decode the character
dochar = (char)((xtoi(ptr[1]) << 4) | xtoi(ptr[2]));
ptr += 3;
if(dochar == '\t') {
if(len >= qlen) {
tmp = ptr-3;
btmp = bp;
}
goto do_ht;
}
else if(dochar == CR)
goto do_cr;
goto chardo;
}
else if((ptr[1] == CR) or (ptr[1] == LF)) {
// Skip soft line break
ptr++;
while((*ptr == CR) or (*ptr == LF))
ptr++;
break;
}
}
goto defaultchardo;
case '\t': case '\t':
if(len >= qlen) {
tmp = ptr;
btmp = bp;
}
ptr++; ptr++;
do_ht: do_ht:
if(CFG->disptabsize) { if(CFG->disptabsize) {
@ -2316,27 +2359,6 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
len++; len++;
} }
break; break;
case '=':
if(qpencoded) {
if(isxdigit(ptr[1]) and isxdigit(ptr[2])) {
// Decode the character
dochar = (char)((xtoi(ptr[1]) << 4) | xtoi(ptr[2]));
ptr += 3;
if(dochar == '\t')
goto do_ht;
else if(dochar == CR)
goto do_cr;
goto chardo;
}
else if((ptr[1] == CR) or (ptr[1] == LF)) {
// Skip soft line break
ptr++;
while((*ptr == CR) or (*ptr == LF))
ptr++;
break;
}
}
goto defaultchardo;
case ' ': case ' ':
if(len >= qlen) { if(len >= qlen) {
tmp = ptr; tmp = ptr;
@ -2430,8 +2452,11 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
tptr = strchr(tptr, ' '); tptr = strchr(tptr, ' ');
if(tptr) { if(tptr) {
tptr = strskip_wht(tptr); tptr = strskip_wht(tptr);
if(kludgetype == RFC_CONTENT_TYPE) { if(kludgetype == HEADERLINE) {
if(getvalue) { linep->type |= GLINE_HIDD;
}
else if(getvalue) {
if(kludgetype == RFC_CONTENT_TYPE) {
if(striinc("iso-8859-1", tptr)) { if(striinc("iso-8859-1", tptr)) {
strcpy(chsbuf, "LATIN-1"); strcpy(chsbuf, "LATIN-1");
chslev = LoadCharset(chsbuf, CFG->xlatlocalset); chslev = LoadCharset(chsbuf, CFG->xlatlocalset);
@ -2449,9 +2474,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
} }
} }
} }
} else if(kludgetype == RFC_CONTENT_TRANSFER_ENCODING) {
else if(kludgetype == RFC_CONTENT_TRANSFER_ENCODING) {
if(getvalue) {
if(striinc("quoted-printable", tptr)) { if(striinc("quoted-printable", tptr)) {
qpencoded = true; qpencoded = true;
msg->charsetencoding |= GCHENC_QP; msg->charsetencoding |= GCHENC_QP;
@ -2465,9 +2488,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
} }
} }
} }
} else if(kludgetype == RFC_X_CHARSET) {
else if(kludgetype == RFC_X_CHARSET) {
if(getvalue) {
if(not gotmime) { if(not gotmime) {
strcpy(chsbuf, (striinc("8859-1", tptr) or striinc("Latin1", tptr)) ? "LATIN-1" : CFG->xlatlocalset); strcpy(chsbuf, (striinc("8859-1", tptr) or striinc("Latin1", tptr)) ? "LATIN-1" : CFG->xlatlocalset);
chslev = LoadCharset(chsbuf, CFG->xlatlocalset); chslev = LoadCharset(chsbuf, CFG->xlatlocalset);
@ -2477,14 +2498,10 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
} }
} }
} }
} else if(kludgetype == RFC_X_CHAR_ESC) {
else if(kludgetype == RFC_X_CHAR_ESC) {
if(getvalue)
if(not gotmime) if(not gotmime)
msg->charsetencoding |= GCHENC_MNE; msg->charsetencoding |= GCHENC_MNE;
} }
else if(kludgetype == HEADERLINE) {
linep->type |= GLINE_HIDD;
} }
} }
headerlines++; headerlines++;

View File

@ -146,7 +146,7 @@ uint GParagraph::CheckCtrlLines() {
case CHR4_CHARSET: if(strneql(_ptr, "\001CHARSET: ", 10)) _pdptr->control = CTRL_CHARSET; break; case CHR4_CHARSET: if(strneql(_ptr, "\001CHARSET: ", 10)) _pdptr->control = CTRL_CHARSET; break;
case CHR4_CHRS: if(strneql(_ptr, "\001CHRS: ", 7)) _pdptr->control = CTRL_CHRS; break; case CHR4_CHRS: if(strneql(_ptr, "\001CHRS: ", 7)) _pdptr->control = CTRL_CHRS; break;
case CHR4_TZUTC: if(strneql(_ptr, "\001TZUTC: ", 8)) _pdptr->control = CTRL_TZUTC; break; case CHR4_TZUTC: if(strneql(_ptr, "\001TZUTC: ", 8)) _pdptr->control = CTRL_TZUTC; break;
case CHR4_VIA: if(strneql(_ptr, "\001VIA: ", 6)) _pdptr->control = CTRL_VIA; break; case CHR4_VIA: if(strneql(_ptr, "\001Via ", 5)) _pdptr->control = CTRL_VIA; break;
case CHR4_FLAGS: if(strneql(_ptr, "\001FLAGS ", 7)) _pdptr->control = CTRL_FLAGS; break; case CHR4_FLAGS: if(strneql(_ptr, "\001FLAGS ", 7)) _pdptr->control = CTRL_FLAGS; break;
} }

View File

@ -63,7 +63,7 @@ const dword CHR4_PATH = MK_CHR4('\001','P','A','T');
const dword CHR4_CHARSET = MK_CHR4('\001','C','H','A'); const dword CHR4_CHARSET = MK_CHR4('\001','C','H','A');
const dword CHR4_CHRS = MK_CHR4('\001','C','H','R'); const dword CHR4_CHRS = MK_CHR4('\001','C','H','R');
const dword CHR4_TZUTC = MK_CHR4('\001','T','Z','U'); const dword CHR4_TZUTC = MK_CHR4('\001','T','Z','U');
const dword CHR4_VIA = MK_CHR4('\001','V','I','A'); const dword CHR4_VIA = MK_CHR4('\001','V','i','a');
const dword CHR4_FLAGS = MK_CHR4('\001','F','L','A'); const dword CHR4_FLAGS = MK_CHR4('\001','F','L','A');

View File

@ -204,7 +204,7 @@ int JamArea::load_message(int __mode, gmsg* __msg, JamHdr& __hdr) {
break; break;
case JAMSUB_TRACE: case JAMSUB_TRACE:
sprintf(_kludges+strlen(_kludges2), "\001Via %s\r", _buf); sprintf(_kludges2+strlen(_kludges2), "\001Via %s\r", _buf);
// Not processed // Not processed
break; break;