various fixes
This commit is contained in:
@@ -166,7 +166,7 @@ extern "C" int AreaListCmp(const Area** __a, const Area** __b) {
|
||||
if(A->ismarked())
|
||||
return sepfirst?1:-1;
|
||||
}
|
||||
else if((cmp = compare_two(A->ismarked(), B->ismarked())) != 0)
|
||||
else if((cmp = compare_two(B->ismarked(), A->ismarked())) != 0)
|
||||
return cmp;
|
||||
break;
|
||||
case 'P':
|
||||
|
@@ -58,6 +58,7 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, int margin, bool clip)
|
||||
}
|
||||
int lines=0;
|
||||
if(prnfp) {
|
||||
char *old_msg_txt = throw_strdup(msg->txt);
|
||||
#ifdef OLD_STYLE_HEADER
|
||||
if(mode == MODE_WRITE) {
|
||||
if(prnheader) {
|
||||
@@ -134,6 +135,8 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, int margin, bool clip)
|
||||
fclose(prnfp);
|
||||
prnfp = NULL;
|
||||
}
|
||||
throw_release(msg->txt);
|
||||
msg->txt = old_msg_txt;
|
||||
}
|
||||
else {
|
||||
char buf[256];
|
||||
|
@@ -1525,10 +1525,10 @@ void ScanKludges(GMsg* msg, int getvalue) {
|
||||
}
|
||||
|
||||
// Check if it's a tearline
|
||||
else if(not (gottear or gottag) and strneql("---", ptr, 3) and (ptr[3] == ' ' or ptr[3] == NUL)) {
|
||||
else if(not (gottear or gottag) and strneql("---", ptr, 3) and (ptr[3] == ' ' or ptr[3] == NUL)) {
|
||||
|
||||
Line* nnel = next_non_empty(line->next);
|
||||
if(not lineno or ((lineno-1) == originlineno) or not nnel or nnel->type & GLINE_KLUDGE) {
|
||||
Line* nnel = next_non_empty(line->next);
|
||||
if(not lineno or ((lineno-1) == originlineno) or not nnel or nnel->type & GLINE_KLUDGE) {
|
||||
// Found Tearline
|
||||
gottear = YES;
|
||||
tearlineno = lineno;
|
||||
@@ -1536,7 +1536,7 @@ void ScanKludges(GMsg* msg, int getvalue) {
|
||||
line->color = C_READT;
|
||||
strbtrim(strcpy(msg->tearline, ptr+3));
|
||||
|
||||
if(getvalue and CFG->gedhandshake) {
|
||||
if(getvalue and CFG->gedhandshake) {
|
||||
char* tearid[] = {
|
||||
"GoldED",
|
||||
" GED ",
|
||||
@@ -1562,18 +1562,18 @@ void ScanKludges(GMsg* msg, int getvalue) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if it's an originline
|
||||
else if(not (gotorig or gottear or gottag) and strneql(" * Origin: ", ptr, 11)) {
|
||||
|
||||
// Found Origin line
|
||||
bool cnd = line->next != NULL;
|
||||
Line* nnel = next_non_empty(line->next);
|
||||
bool nextkl = cnd ? not nnel or nnel->type & GLINE_KLUDGE : false;
|
||||
nnel = cnd ? next_non_empty(line->next->next) : NULL;
|
||||
bool nextor = cnd ? (not nnel or nnel->type & GLINE_KLUDGE) and (line->next->txt.find(/*(*/')') != line->next->txt.npos) : false;
|
||||
if(not line->next or nextkl or nextor) {
|
||||
Line* nnel = next_non_empty(line->next);
|
||||
bool nextkl = cnd ? not nnel or nnel->type & GLINE_KLUDGE : false;
|
||||
nnel = cnd ? next_non_empty(line->next->next) : NULL;
|
||||
bool nextor = cnd ? (not nnel or nnel->type & GLINE_KLUDGE) and (line->next->txt.find(/*(*/')') != line->next->txt.npos) : false;
|
||||
if(not line->next or nextkl or nextor) {
|
||||
|
||||
gotorig = YES;
|
||||
originlineno = lineno;
|
||||
@@ -1857,13 +1857,18 @@ static bool check_multipart(const char* ptr, 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
|
||||
strneql(ptr, "Reply-To:", 9) or
|
||||
strneql(ptr, "To:", 3) or
|
||||
strneql(ptr, "From:", 5) or
|
||||
(ptr[0] == prev_ptr[0]) and (ptr[1] == prev_ptr[1]))
|
||||
if((*ptr == CR) or
|
||||
(*ptr == CTRL_A) or
|
||||
is_quote(ptr) or
|
||||
((ptr[0] == ptr[1]) and (ptr[0] == ptr[2])) or
|
||||
(strneql(ptr, "-- ", 3) and (ptr[3] == CR)) or
|
||||
strneql(ptr, " * Origin: ", 11) /*or
|
||||
(ptr[0] == prev_ptr[0]) and (ptr[1] == prev_ptr[1])*/)
|
||||
return true;
|
||||
// Put RFC kludges and SEEN-BY on new line
|
||||
while(*ptr and (isxalnum(*ptr) or (*ptr == '-')))
|
||||
ptr++;
|
||||
if(*ptr == ':')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -1880,7 +1885,6 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) {
|
||||
char ch, chln = 0, dochar;
|
||||
Line* line;
|
||||
Line* nextline=NULL;
|
||||
Line* prevline=NULL;
|
||||
char* bp;
|
||||
char* btmp=NULL;
|
||||
char* tptr;
|
||||
@@ -2030,6 +2034,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) {
|
||||
|
||||
para = 0;
|
||||
if(*ptr == CTRL_A or inheader) { // Found kludge/hidden line
|
||||
para = GLINE_KLUD;
|
||||
line->type |= GLINE_HARD;
|
||||
if(getvalue and not CFG->ignorecharset) {
|
||||
tptr = ptr;
|
||||
@@ -2204,11 +2209,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) {
|
||||
if(wraps and not ((line->type & GLINE_HARD) and not (line->type & GLINE_QUOT))) {
|
||||
if(para != GLINE_QUOT) {
|
||||
if(quoteflag) {
|
||||
if(prevline and (*prevline->txt.c_str() == CTRL_A) and (prevline->type & GLINE_WRAP)) {
|
||||
wraps = 0;
|
||||
break;
|
||||
}
|
||||
if((*ptr == CR) or is_quote(ptr) or (*ptr == CTRL_A)) {
|
||||
if(para == GLINE_KLUD) {
|
||||
wraps = 0;
|
||||
break;
|
||||
}
|
||||
@@ -2502,7 +2503,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) {
|
||||
else
|
||||
line->color = C_READW;
|
||||
|
||||
prevline = line;
|
||||
Line* prevline = line;
|
||||
line = new Line();
|
||||
throw_xnew(line);
|
||||
line->prev = prevline;
|
||||
|
@@ -882,7 +882,7 @@ void MakeMsg(int mode, GMsg* omsg, bool ignore_replyto) {
|
||||
strcpy(msg->to, omsg->By());
|
||||
strcpy(msg->realto, omsg->realby);
|
||||
msg->dest = omsg->orig;
|
||||
strcpy(msg->idest, *omsg->ireplyto ? omsg->ireplyto : omsg->iorig);
|
||||
strcpy(msg->idest, *omsg->ireplyto ? omsg->ireplyto : *omsg->iorig ? omsg->iorig : omsg->iaddr);
|
||||
}
|
||||
if(not *msg->iaddr)
|
||||
strcpy(msg->iaddr, msg->idest);
|
||||
|
@@ -579,8 +579,16 @@ int ExternUtil(GMsg *msg, ExtUtil *extutil) {
|
||||
int hardlines = EDIT->HardLines();
|
||||
EDIT->HardLines(false);
|
||||
LoadText(msg, editorfile);
|
||||
|
||||
EDIT->HardLines(hardlines);
|
||||
|
||||
// Prepend "@CHRS: XLATLOCALSET 2\n" to force proper encoding
|
||||
if(not AA->Viewkludge()) {
|
||||
char *msg_txt_chrs = (char *)throw_malloc(strlen(msg->txt)+strlen(CFG->xlatlocalset)+sizeof("\001CHRS: 2\r")+16);
|
||||
sprintf(msg_txt_chrs, "\001CHRS: %s 2\r%s", CFG->xlatlocalset, msg->txt);
|
||||
throw_free(msg->txt);
|
||||
msg->txt = msg_txt_chrs;
|
||||
}
|
||||
|
||||
// Ignore any kludge address found
|
||||
msg->TextToLines(CFG->dispmargin-(int)CFG->switches.get(disppagebar), false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user