From d69ba8b37a1fe91aefa60b11bda43a43243cbb62 Mon Sep 17 00:00:00 2001 From: "Alexander S. Aganichev" Date: Sat, 3 Mar 2001 20:35:09 +0000 Subject: [PATCH] fixes --- docs/notework.txt | 18 +++--- golded3/gedoit.cpp | 2 +- golded3/geedit.cpp | 12 +--- golded3/geline.cpp | 4 +- golded3/gemsgs.cpp | 134 ++++++++++++++++++++-------------------- golded3/getpls.cpp | 13 ++-- golded3/geview.cpp | 10 +-- golded3/gmarea.h | 2 - goldlib/gall/gkbdcode.h | 2 +- 9 files changed, 97 insertions(+), 100 deletions(-) diff --git a/docs/notework.txt b/docs/notework.txt index 562a131..bc275f9 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -12,6 +12,8 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, March xx 2001 ______________________________________________________________________ +- Fixed some quirks in internal editor. + - Fixed EDITHARDLINE keyword operation. - Fixed QUOTEWRAPHARD keyword operation. @@ -24,9 +26,9 @@ ______________________________________________________________________ + Added new keyword INTERNETGATEEXP to configure expansion of UUCP gated e-mail into To: line: - INTERNETGATEEXP Address // To: bob@fisher.com - INTERNETGATEEXP Address,Name // To: bob@fisher.com (Bob Fisher) - INTERNETGATEEXP Name,Address // To: "Bob Fisher" + INTERNETGATEEXP Address // To: bob@fisher.com + INTERNETGATEEXP Address, Name // To: bob@fisher.com (Bob Fisher) + INTERNETGATEEXP Name, Address // To: "Bob Fisher" Other combinations treated as "Address, Name". Default assignment "Name, Address". @@ -39,9 +41,6 @@ ______________________________________________________________________ - Template keyword now properly extracts filename within random system groups. -+ @cfrom and @cto macroses added. Same as @ofrom and @oto but for - current message. - ! If @ofrom or @oto is about to expanding to nothing they expanded to real name of person (if available). @@ -55,7 +54,7 @@ ______________________________________________________________________ @header= @oecho (@caddr) @align{79}{=} @header Msg : @msgno of @msgs@align{44}@attr - @header From : @_oname @_oaddr @odate @otime + @header From : @_oname @_oaddr @odtime @header To : @dname @header Subj : @subject @header@align{79}{=} @@ -73,6 +72,11 @@ ______________________________________________________________________ @msgs number of messages in current messagebase @attr attribute string @align{pos}{char} align to `pos' with `char' + @cfrom same as @ofrom but for current message + @cto same as @oto but for current message + @odtime expanded according to MS_DateTimeFmt for original + message time + @cdtime current time in MS_DateTimeFmt format - Fixed bug in expanding fixed lenght macroses. diff --git a/golded3/gedoit.cpp b/golded3/gedoit.cpp index c3cd564..19f64cf 100644 --- a/golded3/gedoit.cpp +++ b/golded3/gedoit.cpp @@ -68,7 +68,7 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, int margin, bool clip) } #else TemplateToText(((mode == MODE_WRITE) and prnheader) ? ((prnheader & WRITE_ONLY_HEADER) ? MODE_HEADER : MODE_WRITEHEADER) : MODE_WRITE, msg, msg, AA->Tpl(), CurrArea); - msg->TextToLines(-margin); + msg->TextToLines(margin); #endif int n = 0; Line** lin = msg->line; diff --git a/golded3/geedit.cpp b/golded3/geedit.cpp index dd6a761..ef7486a 100644 --- a/golded3/geedit.cpp +++ b/golded3/geedit.cpp @@ -472,8 +472,6 @@ void IEclass::GoEOL() { // Move cursor to the last char on the line col = currline->txt.length(); - if(col) - col--; // String must not be longer than the window width _test_haltab(col > maxcol, col, maxcol); @@ -631,7 +629,7 @@ Line* IEclass::wrapit(Line** __currline, uint* __curr_col, uint* __curr_row, int uint _wrapmargin = (_thisline->type & GLINE_QUOT) ? marginquotes : margintext; // Does this line need wrapping? - if(_thislen > _wrapmargin or (_thislen == _wrapmargin and not isspace(_thisline->txt[_thislen-1]))) { + if(_thislen >= _wrapmargin) { // Reset quote string length _quotelen = 0; @@ -678,7 +676,7 @@ Line* IEclass::wrapit(Line** __currline, uint* __curr_col, uint* __curr_row, int // Keep copy of original pointer int _atmargin = _wrappos; - // Search backwards until a space or the beginning of the line is found + // Search backwards until a space or the beginning of the line is found while(_wrappos > 0 and (_thisline->txt[_wrappos-1] != ' ')) _wrappos--; @@ -727,7 +725,7 @@ Line* IEclass::wrapit(Line** __currline, uint* __curr_col, uint* __curr_row, int // and length. While in Undo, appends the copied part to previous line and deletes // it on current, moving the rest over deleted. Undo->PushItem(EDIT_UNDO_WRAP_TEXT|BATCH_MODE, _thisline, _quotelen, _wraplen); - + _wrapline->type = _thisline->type; // Make sure the type of the line is correct setlinetype(_wrapline); @@ -943,8 +941,6 @@ void IEclass::insertchar(char __ch) { if((selecting ? (BlockCut(true), batch_mode = BATCH_MODE) : false) or (col >= _currline_len) or (currline->txt[col] == '\n') or insert) { Undo->PushItem(EDIT_UNDO_INS_CHAR|batch_mode); - if((col == _currline_len) and (__ch != ' ') and (__ch != '\n')) - currline->txt += ' '; currline->txt.insert(col, 1, __ch); } else { Undo->PushItem(EDIT_UNDO_OVR_CHAR|batch_mode); @@ -2524,8 +2520,6 @@ void UndoStack::PlayItem() { currline->txt.erase(last_item->col.num,1); break; case EDIT_UNDO_DEL_CHAR: - if((last_item->col.num == currline->txt.length()) and (last_item->data.char_int != ' ') and (last_item->data.char_int != '\n')) - currline->txt += ' '; currline->txt.insert(last_item->col.num, 1, last_item->data.char_int); break; case EDIT_UNDO_OVR_CHAR: diff --git a/golded3/geline.cpp b/golded3/geline.cpp index 38a2d8f..633ebae 100644 --- a/golded3/geline.cpp +++ b/golded3/geline.cpp @@ -1809,9 +1809,7 @@ static int cmp_quotes(char* q1, char* q2) { void GMsg::TextToLines(int __line_width, bool header_recode) { - line_width = __line_width; - - MakeLineIndex(this, line_width, header_recode); + MakeLineIndex(this, __line_width, header_recode); } diff --git a/golded3/gemsgs.cpp b/golded3/gemsgs.cpp index d733eb6..6ec5469 100644 --- a/golded3/gemsgs.cpp +++ b/golded3/gemsgs.cpp @@ -82,9 +82,10 @@ static bool tokenxchg(char*& dst, char* tok, const char* src, int len = 0, int c // ------------------------------------------------------------------ -static bool domain_requested(const char *str) { +inline bool domain_requested(const char *str, size_t pos) { - return strnieql(str, "{domain}", 8); + if(str[1] == '_') pos++; + return strnieql(str+pos, "{domain}", 8); } // ------------------------------------------------------------------ @@ -106,11 +107,15 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea) strftimei(cdate, 80, LNG->DateFmt, written_tm); char ctime[80]; strftimei(ctime, 80, LNG->TimeFmt, written_tm); + char cdtime[80]; + strftimei(cdtime, 80, LNG->DateTimeFmt, written_tm); written_tm = gmtime(&oldmsg->written); char odate[80]; strftimei(odate, 80, LNG->DateFmt, written_tm); char otime[80]; strftimei(otime, 80, LNG->TimeFmt, written_tm); + char odtime[80]; + strftimei(odtime, 80, LNG->DateTimeFmt, written_tm); const char* origareaid = AL.AreaIdToPtr(__origarea)->echoid(); bool origareaisinet = AL.AreaIdToPtr(__origarea)->isinternet(); @@ -152,20 +157,6 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea) continue; if(tokenxchg(dst, "@odesc", AL.AreaEchoToPtr(origareaid)->desc())) continue; - if(origareaisinet) { - if(tokenxchg(dst, "@oaddr", oldmsg->iorig, 19, 1, 0)) - continue; - } - else { - if(tokenxchg(dst, "@oaddr", oldmsg->orig.make_string(buf, domain_requested(dst+6) ? oldmsg->odom : NULL), 19, 1, 0)) - continue; - if(strnieql(dst, "@o3daddr", 8)) { - ftn_addr boss = oldmsg->orig; - boss.point = 0; - tokenxchg(dst, "@o3daddr", boss.make_string(buf, domain_requested(dst+8) ? oldmsg->odom : NULL), 19, 1, 0); - continue; - } - } if(tokenxchg(dst, "@oname", strbtrim(strtmp(oldmsg->By())), 34, 2, msg->by_me(), msg->by_you())) continue; @@ -179,6 +170,8 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea) continue; if(tokenxchg(dst, "@otime", otime)) continue; + if(tokenxchg(dst, "@odtime", odtime)) + continue; if(tokenxchg(dst, "@otzoffset", (oldmsg->tzutc == -32767) ? "" : (sprintf(buf, " %+05d", oldmsg->tzutc), buf))) continue; if(tokenxchg(dst, "@ofrom", *oldmsg->ifrom ? oldmsg->ifrom : oldmsg->By())) @@ -189,20 +182,6 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea) continue; if(tokenxchg(dst, "@omsgid", *msg->replys ? msg->replys : "")) continue; - if(origareaisinet) { - if(tokenxchg(dst, "@daddr", oldmsg->iaddr, 19, 1, 0)) - continue; - } - else { - if(tokenxchg(dst, "@daddr", oldmsg->dest.make_string(buf, domain_requested(dst+6) ? oldmsg->ddom : NULL), 19, 1, 0)) - continue; - if(strnieql(dst, "@d3daddr", 8)) { - ftn_addr boss = oldmsg->dest; - boss.point = 0; - tokenxchg(dst, "@d3daddr", boss.make_string(buf, domain_requested(dst+8) ? oldmsg->ddom : NULL), 19, 1, 0); - continue; - } - } if(tokenxchg(dst, "@dname", strbtrim(strtmp(oldmsg->To())), 34, 3, msg->to_me(), msg->to_you(), oldmsg->to_all())) continue; @@ -212,18 +191,66 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea) if(tokenxchg(dst, "@dlname", strrword(oldmsg->To()), 0, 3, msg->to_me(), msg->to_you(), oldmsg->to_all())) continue; + if(origareaisinet) { + if(tokenxchg(dst, "@oaddr", oldmsg->iorig, 19, 1, 0)) + continue; + if(tokenxchg(dst, "@daddr", oldmsg->iaddr, 19, 1, 0)) + continue; + } if(currareaisinet) { + if(tokenxchg(dst, "@caddr", AA->Internetaddress(), 19, 1, 0)) + continue; + if(tokenxchg(dst, "@faddr", msg->iorig, 19, 1, 0)) + continue; if(tokenxchg(dst, "@taddr", msg->iaddr, 19, 1, 0)) continue; } - else { - if(tokenxchg(dst, "@taddr", msg->dest.make_string(buf, domain_requested(dst+6) ? msg->ddom : NULL), 19, 1, 0)) - continue; - if(strnieql(dst, "@t3daddr", 8)) { - ftn_addr boss = msg->dest; - boss.point = 0; - tokenxchg(dst, "@t3daddr", boss.make_string(buf, domain_requested(dst+8) ? msg->ddom : NULL), 19, 1, 0); - continue; + if((not origareaisinet or not currareaisinet) and (strlen(dst) >= 6)) { + bool dr = domain_requested(dst, 6); + if(not origareaisinet) { + if(tokenxchg(dst, "@oaddr", oldmsg->orig.make_string(buf, dr ? oldmsg->odom : NULL), 19, 1, 0)) + continue; + if(strnieql(dst, "@o3daddr", 8)) { + ftn_addr boss = oldmsg->orig; + boss.point = 0; + tokenxchg(dst, "@o3daddr", boss.make_string(buf, domain_requested(dst, 8) ? oldmsg->odom : NULL), 19, 1, 0); + continue; + } + if(tokenxchg(dst, "@daddr", oldmsg->dest.make_string(buf, dr ? oldmsg->ddom : NULL), 19, 1, 0)) + continue; + if(strnieql(dst, "@d3daddr", 8)) { + ftn_addr boss = oldmsg->dest; + boss.point = 0; + tokenxchg(dst, "@d3daddr", boss.make_string(buf, domain_requested(dst, 8) ? oldmsg->ddom : NULL), 19, 1, 0); + continue; + } + } + if(not currareaisinet) { + const gaka &caka=AA->Aka(); + if(tokenxchg(dst, "@caddr", caka.addr.make_string(buf, dr ? caka.domain : NULL), 19, 1, 0)) + continue; + if(strnieql(dst, "@c3daddr", 8)) { + ftn_addr boss = caka.addr; + boss.point = 0; + tokenxchg(dst, "@c3daddr", boss.make_string(buf, domain_requested(dst, 8) ? caka.domain : NULL), 19, 1, 0); + continue; + } + if(tokenxchg(dst, "@taddr", msg->dest.make_string(buf, dr ? msg->ddom : NULL), 19, 1, 0)) + continue; + if(strnieql(dst, "@t3daddr", 8)) { + ftn_addr boss = msg->dest; + boss.point = 0; + tokenxchg(dst, "@t3daddr", boss.make_string(buf, domain_requested(dst, 8) ? msg->ddom : NULL), 19, 1, 0); + continue; + } + if(tokenxchg(dst, "@faddr", msg->orig.make_string(buf, dr ? msg->odom : NULL), 19, 1, 0)) + continue; + if(strnieql(dst, "@f3daddr", 8)) { + ftn_addr boss = msg->orig; + boss.point = 0; + tokenxchg(dst, "@f3daddr", boss.make_string(buf, domain_requested(dst, 8) ? msg->odom : NULL), 19, 1, 0); + continue; + } } } if(tokenxchg(dst, "@tname", strbtrim(strtmp(msg->To())), 34, 3, @@ -235,21 +262,6 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea) if(tokenxchg(dst, "@tlname", strrword(msg->To()), 0, 3, false, false, msg->to_all())) continue; - if(currareaisinet) { - if(tokenxchg(dst, "@caddr", AA->Internetaddress(), 19, 1, 0)) - continue; - } - else { - const gaka &caka=AA->Aka(); - if(tokenxchg(dst, "@caddr", caka.addr.make_string(buf, domain_requested(dst+6) ? caka.domain : NULL), 19, 1, 0)) - continue; - if(strnieql(dst, "@c3daddr", 8)) { - ftn_addr boss = caka.addr; - boss.point = 0; - tokenxchg(dst, "@c3daddr", boss.make_string(buf, domain_requested(dst+8) ? caka.domain : NULL), 19, 1, 0); - continue; - } - } if(tokenxchg(dst, "@cname", AA->Username().name, 34)) continue; if(tokenxchg(dst, "@cfname", strlword(strcpy(buf, AA->Username().name)))) @@ -264,22 +276,10 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea) continue; if(tokenxchg(dst, "@ctime", ctime)) continue; + if(tokenxchg(dst, "@cdtime", cdtime)) + continue; if(tokenxchg(dst, "@ctzoffset", AA->Usetzutc() ? (sprintf(buf, " %+05d", tzoffset()), buf) : "")) continue; - if(currareaisinet) { - if(tokenxchg(dst, "@faddr", msg->iorig, 19, 1, 0)) - continue; - } - else { - if(tokenxchg(dst, "@faddr", msg->orig.make_string(buf, domain_requested(dst+6) ? msg->odom : NULL), 19, 1, 0)) - continue; - if(strnieql(dst, "@f3daddr", 8)) { - ftn_addr boss = msg->orig; - boss.point = 0; - tokenxchg(dst, "@f3daddr", boss.make_string(buf, domain_requested(dst+8) ? msg->odom : NULL), 19, 1, 0); - continue; - } - } if(tokenxchg(dst, "@fname", strbtrim(strtmp(msg->By())), 34)) continue; if(tokenxchg(dst, "@ffname", strlword(msg->By()))) diff --git a/golded3/getpls.cpp b/golded3/getpls.cpp index 346f1ae..4d81faf 100644 --- a/golded3/getpls.cpp +++ b/golded3/getpls.cpp @@ -203,11 +203,14 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa if(fp) { fputs("@header= @oecho (@caddr) @align{79}{=}\n", fp); fputs("@header Msg : @msgno of @msgs@align{44}@attr\n", fp); - if(AA->isinternet()) - fputs("@header From : @ofrom@align{64}@odate @otime\n", fp); - else - fputs("@header From : @oname@align{44}@oaddr@align{64}@odate @otime\n", fp); - fputs("@header To : @dname\n", fp); + if(AA->isinternet()) { + fputs("@header From : @ofrom@align{64}@odtime\n", fp); + fputs("@header From : @oto\n", fp); + } + else { + fputs("@header From : @oname@align{44}@oaddr@align{64}@odtime\n", fp); + fputs("@header To : @dname\n", fp); + } fputs("@header Subj : @subject\n", fp); fputs("@header@align{79}{=}\n", fp); fputs("@moved* Replying to a msg in @oecho (@odesc)\n@moved\n", fp); diff --git a/golded3/geview.cpp b/golded3/geview.cpp index 6461d00..42c307b 100644 --- a/golded3/geview.cpp +++ b/golded3/geview.cpp @@ -194,9 +194,9 @@ void GMsgHeaderView::Paint() { } } - if(not area->isecho() and *msg->ifrom and *msg->realby) + if((not area->isecho() or area->isnewsgroup()) and *msg->ifrom and *msg->realby) strxmerge(buf, (namewidth+nodewidth), msg->realby, " <", msg->iorig, ">", NULL); - else if(not area->isecho() and *msg->ifrom and *msg->iorig) + else if((not area->isecho() or area->isnewsgroup()) and *msg->ifrom and *msg->iorig) strxcpy(buf, msg->iorig, (namewidth+nodewidth)); else strxcpy(buf, msg->By(), (namewidth+nodewidth)); @@ -217,7 +217,7 @@ void GMsgHeaderView::Paint() { // Generate dest node data nodegenerated = false; if(not area->isinternet()) { - if(area->isecho() or not (*msg->ito and (*msg->realto or *msg->idest))) { + if(not (*msg->ito and (*msg->realto or *msg->idest))) { if(msg->dest.net and area->isnet()) { msg->dest.make_string(buf); if(msg->odest.net) { @@ -232,9 +232,9 @@ void GMsgHeaderView::Paint() { } } - if(not area->isecho() and *msg->ito and *msg->realto) + if((not area->isecho() or area->isnewsgroup()) and *msg->ito and *msg->realto) strxmerge(buf, (namewidth+nodewidth), msg->realto, " <", msg->idest, ">", NULL); - else if(not area->isecho() and *msg->ito and *msg->idest) + else if((not area->isecho() or area->isnewsgroup()) and *msg->ito and *msg->idest) strxcpy(buf, msg->idest, (namewidth+nodewidth)); else strxcpy(buf, msg->To(), (namewidth+nodewidth)); diff --git a/golded3/gmarea.h b/golded3/gmarea.h index a98a062..5451573 100644 --- a/golded3/gmarea.h +++ b/golded3/gmarea.h @@ -92,8 +92,6 @@ public: char* inreplyto; // Internet In-Reply-To (allocated) char* references; // Internet References (allocated) - int line_width; // Line width used - const char* areakludgeid; // Echoid from AREA: kludge or NULL char* By() { return *realby ? realby : by; } diff --git a/goldlib/gall/gkbdcode.h b/goldlib/gall/gkbdcode.h index 8d33d0f..3bd24b6 100644 --- a/goldlib/gall/gkbdcode.h +++ b/goldlib/gall/gkbdcode.h @@ -207,7 +207,7 @@ #define Key_S_Bsl 0x2B7C // <\ |> - - - - #define Key_S_Rbr 0x1B7D // <] }> - - - - #define Key_S_Grv 0x297E // <` ~> - - - - -#define Key_S_Num5 0x4C35 // S N - - - +#define Key_S_5Num 0x4C35 // S N - - - #define Key_S_F1 0x5400 // S - - - - #define Key_S_F2 0x5500 // S - - - - #define Key_S_F3 0x5600 // S - - - -