diff --git a/docs/notework.txt b/docs/notework.txt index 1ca3224..210b6a3 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -12,6 +12,10 @@ ______________________________________________________________________ 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 no valid address defined in the origin. diff --git a/golded3/gecarb.cpp b/golded3/gecarb.cpp index 15d53ce..a6729b6 100644 --- a/golded3/gecarb.cpp +++ b/golded3/gecarb.cpp @@ -143,7 +143,7 @@ int DoCarboncopy(GMsg* msg, GMsg** carbon) { HeaderView->Paint(); GMenuCarbon MenuCarbon; ignorecc = MenuCarbon.Run(msg) ? false : true; - if(ignorecc) // Do not process carcon copies + if(ignorecc) // Do not process carbon copies break; if(newline) ccline = newline->prev; // Store the position of first line @@ -196,9 +196,10 @@ int DoCarboncopy(GMsg* msg, GMsg** carbon) { newline = newline->next; } while(newline != NULL); - std::string temp; // Fix the CC list in the message - if(cc and ccline) { + if(not ignorecc and cc and ccline) { + std::string temp; + switch(CFG->carboncopylist) { case CC_REMOVE: // No list @@ -413,7 +414,7 @@ void DoCrosspost(GMsg* msg, std::vector &postareas) { } while(newline != NULL); // 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) { case CC_REMOVE: // No list @@ -455,20 +456,19 @@ void DoCrosspost(GMsg* msg, std::vector &postareas) { break; case CC_NAMES: // Expand in column - { - if(not hideoriginal) { - sprintf(buf, LNG->Originallyin, AA->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); - } + if(not hideoriginal) { + sprintf(buf, LNG->Originallyin, AA->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; } } } diff --git a/golded3/gecmfd.cpp b/golded3/gecmfd.cpp index 65ccd2e..2b3febe 100644 --- a/golded3/gecmfd.cpp +++ b/golded3/gecmfd.cpp @@ -28,9 +28,10 @@ // ------------------------------------------------------------------ -// Global data from GEREAD +// Global data from GEREAD & GECTRL extern GMsg* reader_msg; +extern int _use_fwd; // ------------------------------------------------------------------ @@ -357,7 +358,6 @@ void CmfMsgs(GMsg* msg) { // Handle a forward if(cmf == MODE_FORWARD) { - extern int _use_fwd; _use_fwd = orig_adat->usefwd; if(_use_fwd == ASK) { GMenuForward MenuForward; diff --git a/golded3/gectrl.cpp b/golded3/gectrl.cpp index 932ab38..cf5204a 100644 --- a/golded3/gectrl.cpp +++ b/golded3/gectrl.cpp @@ -32,6 +32,7 @@ // ------------------------------------------------------------------ +static ulong msgcount = 0; 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(AA->isnet()) @@ -434,6 +437,62 @@ void DoKludges(int mode, GMsg* msg, int kludges) { 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) { mime_header_encode(buf2, msg->by, msg); strxcpy(msg->by, buf2, sizeof(INam)); diff --git a/golded3/geglob.h b/golded3/geglob.h index d4f0045..6655744 100644 --- a/golded3/geglob.h +++ b/golded3/geglob.h @@ -73,10 +73,6 @@ extern FileSpec* fspec; // GEMENU.CPP extern GMsg* MenuMsgPtr; -// GEPOST.CPP -extern uint position; -extern ulong msgcount; - // GEREAD.CPP extern int reader_finished; extern int reader_done; diff --git a/golded3/geline.cpp b/golded3/geline.cpp index b4d2c4a..6c457d7 100644 --- a/golded3/geline.cpp +++ b/golded3/geline.cpp @@ -613,11 +613,30 @@ static void KludgeTO(GMsg* msg, const char* ptr) { static void KludgeBCC(GMsg* msg, const char* ptr) { - char* ibcc = msg->ibcc; - char* buf = (char*)throw_malloc(strlen(ibcc) + strlen(ptr) + 3); - strcpy(stpcpy(stpcpy(buf, ibcc), *ibcc ? ", " : ""), ptr); - strxmimecpy(msg->ibcc, buf, 0, sizeof(msg->ibcc), true); - throw_free(buf); + INam _toname; + IAdr _toaddr, buf; + + gstrarray bccs; + 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) { - char* icc = msg->icc; - char* buf = (char*)throw_malloc(strlen(icc) + strlen(ptr) + 3); - strcpy(stpcpy(stpcpy(buf, icc), *icc ? ", " : ""), ptr); - strxcpy(icc, buf, sizeof(msg->icc)); - throw_free(buf); + INam _toname; + IAdr _toaddr, buf; + + gstrarray ccs; + 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: line->kludge = GKLUD_RFC; - if(getvalue) { + if(true /* getvalue */) { char* tmp = UnwrapLine(line, ptr); KludgeBCC(msg, tmp ? tmp : ptr); if(tmp) @@ -1157,7 +1195,7 @@ int HandleRFCs(GMsg* msg, Line* line, int kludgenum, const char* ptr, int getval case RFC_CC: line->kludge = GKLUD_RFC; - if(getvalue) { + if(true /* getvalue */) { char* tmp = UnwrapLine(line, ptr); KludgeCC(msg, tmp ? tmp : ptr); if(tmp) @@ -1880,6 +1918,9 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) { line = nextline; } + msg->icc[0] = NUL; + msg->ibcc[0] = NUL; + msg->lines = 0; msg->lin = NULL; @@ -2513,7 +2554,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) { } } } - else if(--irfcbody == 0) + else break; } } @@ -2599,7 +2640,6 @@ void MsgLineReIndex(GMsg* msg, int viewhidden, int viewkludge, int viewquote) { x = 0; msg->lines = 0; - line = msg->lin; char qbuf[MAXQUOTELEN]; char qbuf0[MAXQUOTELEN]; @@ -2607,12 +2647,11 @@ void MsgLineReIndex(GMsg* msg, int viewhidden, int viewkludge, int viewquote) { int qmatches = 0; *qbuf0 = NUL; - while(line) { + for(line = msg->lin; line != NULL; line = line->next) { if(line->type & GLINE_KLUD) { *qbuf0 = NUL; qmatches = 0; if(not viewkludge) { - line = line->next; continue; } } @@ -2620,7 +2659,6 @@ void MsgLineReIndex(GMsg* msg, int viewhidden, int viewkludge, int viewquote) { *qbuf0 = NUL; qmatches = 0; if(not viewhidden) { - line = line->next; continue; } } @@ -2640,7 +2678,6 @@ void MsgLineReIndex(GMsg* msg, int viewhidden, int viewkludge, int viewquote) { ++p; } if(qmatches != 1) { - line = line->next; continue; } } @@ -2651,7 +2688,6 @@ void MsgLineReIndex(GMsg* msg, int viewhidden, int viewkludge, int viewquote) { } msg->line[x++] = line; msg->lines++; - line = line->next; } msg->line[x] = NULL; // Mark end of index diff --git a/golded3/gepost.cpp b/golded3/gepost.cpp index a724346..0b5b0f4 100644 --- a/golded3/gepost.cpp +++ b/golded3/gepost.cpp @@ -29,9 +29,7 @@ // ------------------------------------------------------------------ -std::vector post_xparea; -uint position; -ulong msgcount = 0; +static std::vector post_xparea; // ------------------------------------------------------------------ @@ -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->attr.pos0(); } - uint lineno = position = reader_topline+1; - line = msg->lin; - while(line) { - if(not (line->type & GLINE_QUOT)) - if(line->type & GLINE_POSI) - position = lineno; - lineno++; - line = line->next; + uint lineno, position = reader_topline+1; + for(lineno = 0; lineno < msg->lines; lineno++) { + if(not (msg->line[lineno]->type & GLINE_QUOT)) + if(msg->line[lineno]->type & GLINE_POSI) + position = lineno+reader_topline+1; } if(*EDIT->External() and not EDIT->Internal()) { 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; while(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); else { 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())); if(mode == MODE_FORWARD) 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 + AA->adat->viewhidden = adat_viewhidden; + AA->adat->viewkludge = adat_viewkludge; + AA->adat->viewquote = adat_viewquote; msg->attr.pos0(); if(not savedirect) { diff --git a/golded3/geprot.h b/golded3/geprot.h index 2e64c9d..aaa73f2 100644 --- a/golded3/geprot.h +++ b/golded3/geprot.h @@ -101,6 +101,7 @@ void GetRandom(int mode, GMsg* msg); char* GetRandomLine(char* __buf, size_t __bufsize, const char* __file); char* HandleRandomLine(char* buf, size_t bufsize); const char* get_informative_string(void); +char* mime_header_encode(char* dest, const char* source, GMsg* msg); // ------------------------------------------------------------------ diff --git a/golded3/geread.cpp b/golded3/geread.cpp index 1a0c606..f0656da 100644 --- a/golded3/geread.cpp +++ b/golded3/geread.cpp @@ -34,13 +34,13 @@ extern bool cmdlinenoscan; extern bool cmdlineexportsoup; GMsg* reader_msg; -int reader_gen_confirm = false; +bool reader_gen_confirm = false; int reader_finished; int reader_done = false; int reader_topline; int reader_keyok; int reader_direction; -int reader_rcv_noise = false; +int reader_rcv_noise = 0; gkey reader_keycode; gkey reader_lastcode = 0; bool reader_msglistfirst = false; diff --git a/golded3/getpls.cpp b/golded3/getpls.cpp index b6320c9..e4643e1 100644 --- a/golded3/getpls.cpp +++ b/golded3/getpls.cpp @@ -31,7 +31,7 @@ // ------------------------------------------------------------------ extern GMsg* reader_msg; -extern int reader_gen_confirm; +extern bool reader_gen_confirm; // ------------------------------------------------------------------ @@ -926,7 +926,7 @@ void ConfirmMsg() { 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())) { int a = AL.AreaEchoToNo(CFG->areacfmreplyto); if(a != -1) { @@ -986,9 +986,9 @@ void OtherAreaReplyMsg() { destarea = AreaPick(LNG->ReplyArea, 6, &destarea); } if(destarea != -1) { - int adat_viewhidden = AA->adat->viewhidden; - int adat_viewkludge = AA->adat->viewkludge; - int adat_viewquote = AA->adat->viewquote; + int adat_viewhidden = AA->Viewhidden(); + int adat_viewkludge = AA->Viewkludge(); + int adat_viewquote = AA->Viewquote(); AL.SetActiveAreaId(destarea); if(CurrArea != OrigArea) { AA->Open(); @@ -1142,9 +1142,9 @@ void OtherAreaQuoteMsg(bool ignore_replyto) { destarea = AreaPick(LNG->ReplyArea, 6, &destarea); } if(destarea != -1) { - int adat_viewhidden = AA->adat->viewhidden; - int adat_viewkludge = AA->adat->viewkludge; - int adat_viewquote = AA->adat->viewquote; + int adat_viewhidden = AA->Viewhidden(); + int adat_viewkludge = AA->Viewkludge(); + int adat_viewquote = AA->Viewquote(); AL.SetActiveAreaId(destarea); if(CurrArea != OrigArea) { AA->Open(); @@ -1192,9 +1192,9 @@ void OtherAreaCommentMsg() { destarea = AreaPick(LNG->ReplyArea, 6, &destarea); } if(destarea != -1) { - int adat_viewhidden = AA->adat->viewhidden; - int adat_viewkludge = AA->adat->viewkludge; - int adat_viewquote = AA->adat->viewquote; + int adat_viewhidden = AA->Viewhidden(); + int adat_viewkludge = AA->Viewkludge(); + int adat_viewquote = AA->Viewquote(); AL.SetActiveAreaId(destarea); if(CurrArea != OrigArea) { AA->Open();