Few fixes to hidden lines edition, formatting

This commit is contained in:
Alexander S. Aganichev 2001-11-19 15:20:35 +00:00
parent 71c0ee1b4e
commit f3ff51d354
10 changed files with 168 additions and 68 deletions

View File

@ -12,6 +12,10 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/ Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________ ______________________________________________________________________
! GoldED+ will now show hidden lines and RFC header in the message
editor. This is primarily to be able to add cc:, copy:, etc. lines
in the Internet areas.
- Fixed old bug with ADDRESSLOOKUPFIRST when it set to the ORIGIN and - Fixed old bug with ADDRESSLOOKUPFIRST when it set to the ORIGIN and
no valid address defined in the origin. no valid address defined in the origin.

View File

@ -143,7 +143,7 @@ int DoCarboncopy(GMsg* msg, GMsg** carbon) {
HeaderView->Paint(); HeaderView->Paint();
GMenuCarbon MenuCarbon; GMenuCarbon MenuCarbon;
ignorecc = MenuCarbon.Run(msg) ? false : true; ignorecc = MenuCarbon.Run(msg) ? false : true;
if(ignorecc) // Do not process carcon copies if(ignorecc) // Do not process carbon copies
break; break;
if(newline) if(newline)
ccline = newline->prev; // Store the position of first line ccline = newline->prev; // Store the position of first line
@ -196,9 +196,10 @@ int DoCarboncopy(GMsg* msg, GMsg** carbon) {
newline = newline->next; newline = newline->next;
} while(newline != NULL); } while(newline != NULL);
std::string temp;
// Fix the CC list in the message // Fix the CC list in the message
if(cc and ccline) { if(not ignorecc and cc and ccline) {
std::string temp;
switch(CFG->carboncopylist) { switch(CFG->carboncopylist) {
case CC_REMOVE: case CC_REMOVE:
// No list // No list
@ -413,7 +414,7 @@ void DoCrosspost(GMsg* msg, std::vector<int> &postareas) {
} while(newline != NULL); } while(newline != NULL);
// Fix the XC list in the message, ignore crossposting to itself only // Fix the XC list in the message, ignore crossposting to itself only
if((local_xps < postareas.size()+1) and xcline) { if(not ignorexc and (local_xps < postareas.size()+1) and xcline) {
switch(CFG->crosspostlist) { switch(CFG->crosspostlist) {
case CC_REMOVE: case CC_REMOVE:
// No list // No list
@ -455,20 +456,19 @@ void DoCrosspost(GMsg* msg, std::vector<int> &postareas) {
break; break;
case CC_NAMES: case CC_NAMES:
// Expand in column // Expand in column
{ if(not hideoriginal) {
if(not hideoriginal) { sprintf(buf, LNG->Originallyin, AA->echoid());
sprintf(buf, LNG->Originallyin, AA->echoid()); xcline = AddLine(xcline, buf);
xcline = AddLine(xcline, buf);
}
for(int i=local_xps; i < postareas.size(); i++) {
const char *echoid = AL[postareas[i]]->echoid();
if(postareas_attrs[i] or strieql(AA->echoid(), echoid))
continue;
sprintf(buf, LNG->Crosspostedin, echoid);
xcline = AddLine(xcline, buf);
}
} }
for(int i=local_xps; i < postareas.size(); i++) {
const char *echoid = AL[postareas[i]]->echoid();
if(postareas_attrs[i] or strieql(AA->echoid(), echoid))
continue;
sprintf(buf, LNG->Crosspostedin, echoid);
xcline = AddLine(xcline, buf);
}
break;
} }
} }
} }

View File

@ -28,9 +28,10 @@
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Global data from GEREAD // Global data from GEREAD & GECTRL
extern GMsg* reader_msg; extern GMsg* reader_msg;
extern int _use_fwd;
// ------------------------------------------------------------------ // ------------------------------------------------------------------
@ -357,7 +358,6 @@ void CmfMsgs(GMsg* msg) {
// Handle a forward // Handle a forward
if(cmf == MODE_FORWARD) { if(cmf == MODE_FORWARD) {
extern int _use_fwd;
_use_fwd = orig_adat->usefwd; _use_fwd = orig_adat->usefwd;
if(_use_fwd == ASK) { if(_use_fwd == ASK) {
GMenuForward MenuForward; GMenuForward MenuForward;

View File

@ -32,6 +32,7 @@
// ------------------------------------------------------------------ // ------------------------------------------------------------------
static ulong msgcount = 0;
int _use_fwd = true; int _use_fwd = true;
@ -256,7 +257,9 @@ void DoKludges(int mode, GMsg* msg, int kludges) {
} }
} }
line = msg->lin; for(line = msg->lin; line; line = line->next)
if(not (line->type & (GLINE_HIDD|GLINE_KLUD)))
break;
if(kludges == GKLUD_FLAGS) { if(kludges == GKLUD_FLAGS) {
if(AA->isnet()) if(AA->isnet())
@ -434,6 +437,62 @@ void DoKludges(int mode, GMsg* msg, int kludges) {
line->kludge = GKLUD_RFC; line->kludge = GKLUD_RFC;
} }
if(AA->isemail()) {
if(*msg->icc) {
int i = 0;
while(strlen(msg->icc + i) > CFG->soupexportmargin) {
char *prev = strchr(msg->icc+i, ',');
if(prev == NULL)
break;
else {
char *curr = prev;
while((curr - (msg->icc + i)) < CFG->soupexportmargin) {
prev = curr;
curr = strchr(prev+1, ',');
if(curr == NULL)
break;
}
*prev = NUL;
sprintf(buf, "%sCc: %s", rfc, msg->icc + i);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
*prev = ',';
i = prev + 2 - msg->icc;
}
}
sprintf(buf, "%sCc: %s", rfc, msg->icc + i);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
if(*msg->ibcc) {
int i = 0;
while(strlen(msg->ibcc + i) > CFG->soupexportmargin) {
char *prev = strchr(msg->ibcc+i, ',');
if(prev == NULL)
break;
else {
char *curr = prev;
while((curr - (msg->ibcc + i)) < CFG->soupexportmargin) {
prev = curr;
curr = strchr(prev+1, ',');
if(curr == NULL)
break;
}
*prev = NUL;
sprintf(buf, "%sBcc: %s", rfc, msg->ibcc + i);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
*prev = ',';
i = prev + 2 - msg->ibcc;
}
}
sprintf(buf, "%sBcc: %s", rfc, msg->ibcc + i);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
}
if(CFG->internetviagate) { if(CFG->internetviagate) {
mime_header_encode(buf2, msg->by, msg); mime_header_encode(buf2, msg->by, msg);
strxcpy(msg->by, buf2, sizeof(INam)); strxcpy(msg->by, buf2, sizeof(INam));

View File

@ -73,10 +73,6 @@ extern FileSpec* fspec;
// GEMENU.CPP // GEMENU.CPP
extern GMsg* MenuMsgPtr; extern GMsg* MenuMsgPtr;
// GEPOST.CPP
extern uint position;
extern ulong msgcount;
// GEREAD.CPP // GEREAD.CPP
extern int reader_finished; extern int reader_finished;
extern int reader_done; extern int reader_done;

View File

@ -613,11 +613,30 @@ static void KludgeTO(GMsg* msg, const char* ptr) {
static void KludgeBCC(GMsg* msg, const char* ptr) { static void KludgeBCC(GMsg* msg, const char* ptr) {
char* ibcc = msg->ibcc; INam _toname;
char* buf = (char*)throw_malloc(strlen(ibcc) + strlen(ptr) + 3); IAdr _toaddr, buf;
strcpy(stpcpy(stpcpy(buf, ibcc), *ibcc ? ", " : ""), ptr);
strxmimecpy(msg->ibcc, buf, 0, sizeof(msg->ibcc), true); gstrarray bccs;
throw_free(buf); tokenize(bccs, ptr, ",");
for(int i=0; i < bccs.size(); i++) {
strxcpy(buf, strskip_wht(bccs[i].c_str()), sizeof(IAdr));
ParseInternetAddr(buf, _toname, _toaddr);
if(*_toaddr and not striinc(_toaddr, msg->ibcc)) {
if(*msg->ibcc)
strxcat(msg->ibcc, ", ", sizeof(msg->ibcc));
if(_toname[0] != NUL) {
IAdr buf2;
mime_header_encode(buf2, _toname, msg);
char quot[2] = "\"";
if((buf2[0] == '\"') or (strpbrk(buf2, " \t") == NULL))
quot[0] = NUL;
sprintf(buf, "%s%s%s <%s>", quot, buf2, quot, _toaddr);
}
else
sprintf(buf, "%s", _toaddr);
strxcat(msg->ibcc, buf, sizeof(msg->ibcc));
}
}
} }
@ -625,11 +644,30 @@ static void KludgeBCC(GMsg* msg, const char* ptr) {
static void KludgeCC(GMsg* msg, const char* ptr) { static void KludgeCC(GMsg* msg, const char* ptr) {
char* icc = msg->icc; INam _toname;
char* buf = (char*)throw_malloc(strlen(icc) + strlen(ptr) + 3); IAdr _toaddr, buf;
strcpy(stpcpy(stpcpy(buf, icc), *icc ? ", " : ""), ptr);
strxcpy(icc, buf, sizeof(msg->icc)); gstrarray ccs;
throw_free(buf); tokenize(ccs, ptr, ",");
for(int i=0; i < ccs.size(); i++) {
strxcpy(buf, strskip_wht(ccs[i].c_str()), sizeof(IAdr));
ParseInternetAddr(buf, _toname, _toaddr);
if(*_toaddr and not striinc(_toaddr, msg->icc)) {
if(*msg->icc)
strxcat(msg->icc, ", ", sizeof(msg->icc));
if(_toname[0] != NUL) {
IAdr buf2;
mime_header_encode(buf2, _toname, msg);
char quot[2] = "\"";
if((buf[0] == '\"') or (strpbrk(buf2, " \t") == NULL))
quot[0] = NUL;
sprintf(buf, "%s%s%s <%s>", quot, buf2, quot, _toaddr);
}
else
sprintf(buf, "%s", _toaddr);
strxcat(msg->icc, buf, sizeof(msg->icc));
}
}
} }
@ -1147,7 +1185,7 @@ int HandleRFCs(GMsg* msg, Line* line, int kludgenum, const char* ptr, int getval
case RFC_BCC: case RFC_BCC:
line->kludge = GKLUD_RFC; line->kludge = GKLUD_RFC;
if(getvalue) { if(true /* getvalue */) {
char* tmp = UnwrapLine(line, ptr); char* tmp = UnwrapLine(line, ptr);
KludgeBCC(msg, tmp ? tmp : ptr); KludgeBCC(msg, tmp ? tmp : ptr);
if(tmp) if(tmp)
@ -1157,7 +1195,7 @@ int HandleRFCs(GMsg* msg, Line* line, int kludgenum, const char* ptr, int getval
case RFC_CC: case RFC_CC:
line->kludge = GKLUD_RFC; line->kludge = GKLUD_RFC;
if(getvalue) { if(true /* getvalue */) {
char* tmp = UnwrapLine(line, ptr); char* tmp = UnwrapLine(line, ptr);
KludgeCC(msg, tmp ? tmp : ptr); KludgeCC(msg, tmp ? tmp : ptr);
if(tmp) if(tmp)
@ -1880,6 +1918,9 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) {
line = nextline; line = nextline;
} }
msg->icc[0] = NUL;
msg->ibcc[0] = NUL;
msg->lines = 0; msg->lines = 0;
msg->lin = NULL; msg->lin = NULL;
@ -2513,7 +2554,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) {
} }
} }
} }
else if(--irfcbody == 0) else
break; break;
} }
} }
@ -2599,7 +2640,6 @@ void MsgLineReIndex(GMsg* msg, int viewhidden, int viewkludge, int viewquote) {
x = 0; x = 0;
msg->lines = 0; msg->lines = 0;
line = msg->lin;
char qbuf[MAXQUOTELEN]; char qbuf[MAXQUOTELEN];
char qbuf0[MAXQUOTELEN]; char qbuf0[MAXQUOTELEN];
@ -2607,12 +2647,11 @@ void MsgLineReIndex(GMsg* msg, int viewhidden, int viewkludge, int viewquote) {
int qmatches = 0; int qmatches = 0;
*qbuf0 = NUL; *qbuf0 = NUL;
while(line) { for(line = msg->lin; line != NULL; line = line->next) {
if(line->type & GLINE_KLUD) { if(line->type & GLINE_KLUD) {
*qbuf0 = NUL; *qbuf0 = NUL;
qmatches = 0; qmatches = 0;
if(not viewkludge) { if(not viewkludge) {
line = line->next;
continue; continue;
} }
} }
@ -2620,7 +2659,6 @@ void MsgLineReIndex(GMsg* msg, int viewhidden, int viewkludge, int viewquote) {
*qbuf0 = NUL; *qbuf0 = NUL;
qmatches = 0; qmatches = 0;
if(not viewhidden) { if(not viewhidden) {
line = line->next;
continue; continue;
} }
} }
@ -2640,7 +2678,6 @@ void MsgLineReIndex(GMsg* msg, int viewhidden, int viewkludge, int viewquote) {
++p; ++p;
} }
if(qmatches != 1) { if(qmatches != 1) {
line = line->next;
continue; continue;
} }
} }
@ -2651,7 +2688,6 @@ void MsgLineReIndex(GMsg* msg, int viewhidden, int viewkludge, int viewquote) {
} }
msg->line[x++] = line; msg->line[x++] = line;
msg->lines++; msg->lines++;
line = line->next;
} }
msg->line[x] = NULL; // Mark end of index msg->line[x] = NULL; // Mark end of index

View File

@ -29,9 +29,7 @@
// ------------------------------------------------------------------ // ------------------------------------------------------------------
std::vector<int> post_xparea; static std::vector<int> post_xparea;
uint position;
ulong msgcount = 0;
// ------------------------------------------------------------------ // ------------------------------------------------------------------
@ -514,14 +512,11 @@ static void MakeMsg2(int& mode, int& status, int& forwstat, int& topline, GMsg*
msg->TextToLines(CFG->dispmargin-1, false); // Ignore any kludge address found msg->TextToLines(CFG->dispmargin-1, false); // Ignore any kludge address found
msg->attr.pos0(); msg->attr.pos0();
} }
uint lineno = position = reader_topline+1; uint lineno, position = reader_topline+1;
line = msg->lin; for(lineno = 0; lineno < msg->lines; lineno++) {
while(line) { if(not (msg->line[lineno]->type & GLINE_QUOT))
if(not (line->type & GLINE_QUOT)) if(msg->line[lineno]->type & GLINE_POSI)
if(line->type & GLINE_POSI) position = lineno+reader_topline+1;
position = lineno;
lineno++;
line = line->next;
} }
if(*EDIT->External() and not EDIT->Internal()) { if(*EDIT->External() and not EDIT->Internal()) {
SaveLines(MODE_NEW, AddPath(CFG->goldpath, EDIT->File()), msg, 79); SaveLines(MODE_NEW, AddPath(CFG->goldpath, EDIT->File()), msg, 79);
@ -568,7 +563,7 @@ static void MakeMsg2(int& mode, int& status, int& forwstat, int& topline, GMsg*
newline = line = msg->lin; newline = line = msg->lin;
while(line) { while(line) {
newline = line; newline = line;
if(((line->type & GLINE_HIDD) and not AA->Viewhidden()) or ((line->type & GLINE_KLUD) and not AA->Viewkludge())) if((line->type & GLINE_KLUD) and not AA->Viewkludge() and not (line->kludge & GKLUD_RFC))
newline = line = DeleteLine(line); newline = line = DeleteLine(line);
else { else {
strtrimline(line->txt); strtrimline(line->txt);
@ -621,7 +616,16 @@ static void MakeMsg2(int& mode, int& status, int& forwstat, int& topline, GMsg*
LoadText(msg, AddPath(CFG->goldpath, EDIT->File())); LoadText(msg, AddPath(CFG->goldpath, EDIT->File()));
if(mode == MODE_FORWARD) if(mode == MODE_FORWARD)
msg->attr.pos1(); msg->attr.pos1();
int adat_viewhidden = AA->Viewhidden();
int adat_viewkludge = AA->Viewkludge();
int adat_viewquote = AA->Viewquote();
AA->adat->viewhidden = true;
AA->adat->viewkludge = true;
AA->adat->viewquote = true;
msg->TextToLines(CFG->dispmargin-1, false); // Ignore any kludge address found msg->TextToLines(CFG->dispmargin-1, false); // Ignore any kludge address found
AA->adat->viewhidden = adat_viewhidden;
AA->adat->viewkludge = adat_viewkludge;
AA->adat->viewquote = adat_viewquote;
msg->attr.pos0(); msg->attr.pos0();
if(not savedirect) { if(not savedirect) {

View File

@ -101,6 +101,7 @@ void GetRandom(int mode, GMsg* msg);
char* GetRandomLine(char* __buf, size_t __bufsize, const char* __file); char* GetRandomLine(char* __buf, size_t __bufsize, const char* __file);
char* HandleRandomLine(char* buf, size_t bufsize); char* HandleRandomLine(char* buf, size_t bufsize);
const char* get_informative_string(void); const char* get_informative_string(void);
char* mime_header_encode(char* dest, const char* source, GMsg* msg);
// ------------------------------------------------------------------ // ------------------------------------------------------------------

View File

@ -34,13 +34,13 @@ extern bool cmdlinenoscan;
extern bool cmdlineexportsoup; extern bool cmdlineexportsoup;
GMsg* reader_msg; GMsg* reader_msg;
int reader_gen_confirm = false; bool reader_gen_confirm = false;
int reader_finished; int reader_finished;
int reader_done = false; int reader_done = false;
int reader_topline; int reader_topline;
int reader_keyok; int reader_keyok;
int reader_direction; int reader_direction;
int reader_rcv_noise = false; int reader_rcv_noise = 0;
gkey reader_keycode; gkey reader_keycode;
gkey reader_lastcode = 0; gkey reader_lastcode = 0;
bool reader_msglistfirst = false; bool reader_msglistfirst = false;

View File

@ -31,7 +31,7 @@
// ------------------------------------------------------------------ // ------------------------------------------------------------------
extern GMsg* reader_msg; extern GMsg* reader_msg;
extern int reader_gen_confirm; extern bool reader_gen_confirm;
// ------------------------------------------------------------------ // ------------------------------------------------------------------
@ -926,7 +926,7 @@ void ConfirmMsg() {
doit = MenuConfirm.Run(); doit = MenuConfirm.Run();
} }
reader_gen_confirm = NO; reader_gen_confirm = false;
if(doit and AA->isnet() and (reader_msg->attr.cfm() or reader_msg->attr.rrq())) { if(doit and AA->isnet() and (reader_msg->attr.cfm() or reader_msg->attr.rrq())) {
int a = AL.AreaEchoToNo(CFG->areacfmreplyto); int a = AL.AreaEchoToNo(CFG->areacfmreplyto);
if(a != -1) { if(a != -1) {
@ -986,9 +986,9 @@ void OtherAreaReplyMsg() {
destarea = AreaPick(LNG->ReplyArea, 6, &destarea); destarea = AreaPick(LNG->ReplyArea, 6, &destarea);
} }
if(destarea != -1) { if(destarea != -1) {
int adat_viewhidden = AA->adat->viewhidden; int adat_viewhidden = AA->Viewhidden();
int adat_viewkludge = AA->adat->viewkludge; int adat_viewkludge = AA->Viewkludge();
int adat_viewquote = AA->adat->viewquote; int adat_viewquote = AA->Viewquote();
AL.SetActiveAreaId(destarea); AL.SetActiveAreaId(destarea);
if(CurrArea != OrigArea) { if(CurrArea != OrigArea) {
AA->Open(); AA->Open();
@ -1142,9 +1142,9 @@ void OtherAreaQuoteMsg(bool ignore_replyto) {
destarea = AreaPick(LNG->ReplyArea, 6, &destarea); destarea = AreaPick(LNG->ReplyArea, 6, &destarea);
} }
if(destarea != -1) { if(destarea != -1) {
int adat_viewhidden = AA->adat->viewhidden; int adat_viewhidden = AA->Viewhidden();
int adat_viewkludge = AA->adat->viewkludge; int adat_viewkludge = AA->Viewkludge();
int adat_viewquote = AA->adat->viewquote; int adat_viewquote = AA->Viewquote();
AL.SetActiveAreaId(destarea); AL.SetActiveAreaId(destarea);
if(CurrArea != OrigArea) { if(CurrArea != OrigArea) {
AA->Open(); AA->Open();
@ -1192,9 +1192,9 @@ void OtherAreaCommentMsg() {
destarea = AreaPick(LNG->ReplyArea, 6, &destarea); destarea = AreaPick(LNG->ReplyArea, 6, &destarea);
} }
if(destarea != -1) { if(destarea != -1) {
int adat_viewhidden = AA->adat->viewhidden; int adat_viewhidden = AA->Viewhidden();
int adat_viewkludge = AA->adat->viewkludge; int adat_viewkludge = AA->Viewkludge();
int adat_viewquote = AA->adat->viewquote; int adat_viewquote = AA->Viewquote();
AL.SetActiveAreaId(destarea); AL.SetActiveAreaId(destarea);
if(CurrArea != OrigArea) { if(CurrArea != OrigArea) {
AA->Open(); AA->Open();