This commit is contained in:
Alexander S. Aganichev 2001-03-03 13:16:14 +00:00
parent feb27a793a
commit b7e2b155af
24 changed files with 239 additions and 219 deletions

View File

@ -12,6 +12,13 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, March xx 2001
______________________________________________________________________
- Fixed EDITHARDLINE keyword operation.
- Fixed QUOTEWRAPHARD keyword operation.
! Freed lot of stack on displaying message header. Please report
(cosmetic?) bugs if any.
- Fixed small bug in parser.
+ Added new keyword INTERNETGATEEXP to configure expansion of UUCP

View File

@ -77,15 +77,13 @@ assistance!
*Q:* € £¤¥ ¬®¦­® ¢§ïâì GoldED+? € ¬®¦­® ¯®¨¬¥âì ¨á室­¨ª¨? € 祬 ¯®â®¬
ᮡ¨à âì?
*A:* <20>®¤¨­  GoldED+ ­ å®¤¨âáï ­  http://asa.i-connect.com. ’ ¬ ¦¥ ¢ë ¬®¦¥â¥
­ ©â¨ ᯨ᮪ ¬¨àà®à®¢ ¨ ¢§ïâì ¨á室­¨ª¨. ‘®¡¨à âì ­ ¤® GNU C/C++ (­¥ ­ ¤®
¡à âì ­¥çâ® ¤à¥¢­¥¥ 2.8.x, «ãçè¥ ¢á¥£® ª ªãî-­¨¡ã¤ì ᢥ¦ãî ¢¥àá¨î) ¨ ¥£®
¯à®¨§¢®¤­ë¬¨ (djgpp, emx, mingw32). „à㣨¥ ª®¬¯¨«ïâ®àë ¡®«¥¥ ­¥
¯®¤¤¥à¦¨¢ îâáï. —â®¡ë ¢á¥ ª®¬¯¨«¨à®¢ «®áì ¡¥§ ª ª¨å-«¨¡® ¯à®¡«¥¬ - ¡¥à¨â¥
çâ®-â® ­®¢¥¥ gcc 2.95 (¨«¨ ⥠egcs, ¢ ª®â®àëå #pragma implementaion,
#pragma interface 㦥 ¡ë«¨ obsolete). ‚®¢á¥ ­¥ ­ ¤® ª®¬¯¨«¨à®¢ âì ¢á¥
ª®¬ ­¤®© "make 2>&1 | mail -s VERSION asa@eed.miee.ru", ¢á¥ à ¢­® ï íâ®
ç¨â âì ­¥ ¡ã¤ã - ¬­¥ «¥­ì à §¡¨à âì íâ®â ᯠ¬.
*A:* <20>®¤¨­  GoldED+ ­ å®¤¨âáï ­  http://golded-plus.sourceforge.net. ’ ¬ ¦¥ ¢ë
¬®¦¥â¥ ­ ©â¨ ᯨ᮪ ¬¨àà®à®¢ ¨ ¢§ïâì ¨á室­¨ª¨. ‘®¡¨à âì ­ ¤® GNU C/C++
(­¥ ­ ¤® ¡à âì ­¥çâ® ¤à¥¢­¥¥ 2.8.x, «ãçè¥ ¢á¥£® ª ªãî-­¨¡ã¤ì ᢥ¦ãî
¢¥àá¨î) ¨ ¥£® ¯à®¨§¢®¤­ë¬¨ (djgpp, emx, mingw32). „à㣨¥ ª®¬¯¨«ïâ®àë ¡®«¥¥
­¥ ¯®¤¤¥à¦¨¢ îâáï. —â®¡ë ¢á¥ ª®¬¯¨«¨à®¢ «®áì ¡¥§ ª ª¨å-«¨¡® ¯à®¡«¥¬ -
¡¥à¨â¥ çâ®-â® ­®¢¥¥ gcc 2.95 (¨«¨ ⥠egcs, ¢ ª®â®àëå #pragma
implementaion, #pragma interface 㦥 ¡ë«¨ obsolete).
*Q:* € ª ª-â® ¯®¨áª ­¥âਢ¨ «ì­® à ¡®â ¥â...
*A:* € ¢ë 㢥७ë, çâ® ¯à®ç¨â «¨ Notework.txt ¤® ¯à¥¤ë¤ã饩 ¢¥àᨨ, ¢ ª®â®à®©

View File

@ -296,7 +296,7 @@ void AreaList::WriteAreaDef(const char* file) {
strcpy(addr, ".");
tmp = strlen(addr);
maxaddr = MaxV(maxaddr, tmp);
tmp = strlen(MakeAttrStr(attr, &(*aa)->attr()));
tmp = strlen(MakeAttrStr(attr, sizeof(attr), &(*aa)->attr()));
maxattr = MaxV(maxattr, tmp+2);
}
@ -371,7 +371,7 @@ void AreaList::WriteAreaDef(const char* file) {
else
strcpy(addr, ".");
*attr = '('; /*)*/
MakeAttrStr(attr+1, &(*aa)->attr());
MakeAttrStr(attr+1, sizeof(attr)-2, &(*aa)->attr());
strcat(attr, /*(*/ ")");
if((*aa)->originno())
sprintf(origin, " \"%.*s\"", (int)sizeof(origin)-4, CFG->origin[(*aa)->originno()].c_str());

View File

@ -51,7 +51,7 @@ void CfgDispmsgsize() {
else if(strieql("KBYTES", val))
CFG->dispmsgsize = DISPMSGSIZE_KBYTES;
else if(strieql("LINES", val))
CFG->dispmsgsize = DISPMSGSIZE_KBYTES+1;
CFG->dispmsgsize = DISPMSGSIZE_LINES;
}
// ------------------------------------------------------------------

View File

@ -222,6 +222,7 @@ const int BLANK_SLIDEWIN = 1;
const int DISPMSGSIZE_BYTES = 1;
const int DISPMSGSIZE_KBYTES = 2;
const int DISPMSGSIZE_LINES = 3;
// ------------------------------------------------------------------

View File

@ -27,6 +27,18 @@
#include "golded.h"
// ------------------------------------------------------------------
bool strncont(const char *beginword, const char *stylestopchars, int n)
{
for(; (n > 0) and (*beginword != NUL); n--, beginword++) {
if(strchr(stylestopchars, *beginword) != NULL)
return true;
}
return false;
}
// ------------------------------------------------------------------
inline int isstylechar(char c) { return (c == '*') or (c == '/') or (c == '_') or (c == '#'); }
@ -34,7 +46,7 @@ inline int isstylechar(char c) { return (c == '*') or (c == '/') or (c == '_') o
void Container::StyleCodeHighlight(const char* text, int row, int col, bool dohide, int color) {
uint sclen = 0;
char* txptr = text;
const char* txptr = text;
char buf[200];
const char* ptr = text;
const char* stylemargins = " -|\\"; // we probably have to make a keyword for it
@ -59,19 +71,15 @@ void Container::StyleCodeHighlight(const char* text, int row, int col, bool dohi
}
if((bb <= 1) and (bi <= 1) and (br <= 1) and (bu <= 1) and *ptr) {
const char* beginword = ptr; // _/*>another*/_
char endchar = NUL;
char* end = ptr;
const char* end = ptr;
do {
end = strpbrk(++end, punctchars);
} while ((end) and not isstylechar(*(end-1)));
if(end)
endchar = *end;
else
} while ((end != NULL) and not isstylechar(*(end-1)));
if(end == NULL)
end = ptr+strlen(ptr);
*end = NUL;
char* endstyle = end-1; // _/*another*/>_
const char* endstyle = end-1; // _/*another*/>_
if(isstylechar(*endstyle) and not strchr(stylemargins, *beginword)) {
char* endword = endstyle;
const char* endword = endstyle;
int eb = 0, ei = 0, eu = 0, er = 0;
while(isstylechar(*endword)) {
switch(*endword) {
@ -84,10 +92,7 @@ void Container::StyleCodeHighlight(const char* text, int row, int col, bool dohi
} // _/*anothe>r*/_
if(endword >= beginword and not strchr(stylemargins, *endword)) {
if((bb == eb) and (bi == ei) and (bu == eu) and (br == er)) {
char endwordchar = *endword;
*endword = NUL;
char* style_stops_present = strpbrk(beginword, stylestopchars);
*endword = endwordchar;
bool style_stops_present = strncont(beginword, stylestopchars, endword-beginword);
if(not style_stops_present) {
int colorindex = (bb ? 1 : 0) | (bi ? 2 : 0) | (bu ? 4 : 0) | (br ? 8 : 0);
strxcpy(buf, txptr, (uint)(beginstyle-txptr)+1);
@ -104,7 +109,6 @@ void Container::StyleCodeHighlight(const char* text, int row, int col, bool dohi
}
}
}
*end = endchar;
ptr = end-1;
}
}

View File

@ -30,21 +30,18 @@
// ------------------------------------------------------------------
static FILE* prnfp;
static int prnmargin;
static int prnheader;
// ------------------------------------------------------------------
void SaveLines(int mode, const char* savefile, GMsg* msg, bool clip) {
void SaveLines(int mode, const char* savefile, GMsg* msg, int margin, bool clip) {
int prn=NO;
char fnam[GMAXPATH];
char* prnacc;
if(mode == MODE_SAVE or mode == MODE_SAVENOCTRL)
prnacc = "wt";
else if(mode == MODE_APPEND) {
if(mode == MODE_APPEND) {
prnacc = "at";
mode = MODE_WRITE;
}
@ -63,18 +60,19 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, bool clip) {
if(prnfp) {
#ifdef OLD_STYLE_HEADER
if(mode == MODE_WRITE) {
if(prnheader)
DispHeader(msg, prn, prnfp, prnmargin);
if(prnheader) {
DispHeader(msg, prn, prnfp, margin);
if(prn)
lines = 6;
}
}
#else
TemplateToText(((mode == MODE_WRITE) && prnheader) ? MODE_WRITEHEADER : ((prnheader & WRITE_ONLY_HEADER) ? MODE_HEADER : MODE_WRITE), msg, msg, AA->Tpl(), CurrArea);
msg->TextToLines(-prnmargin);
TemplateToText(((mode == MODE_WRITE) and prnheader) ? ((prnheader & WRITE_ONLY_HEADER) ? MODE_HEADER : MODE_WRITEHEADER) : MODE_WRITE, msg, msg, AA->Tpl(), CurrArea);
msg->TextToLines(-margin);
#endif
int n = 0;
Line** lin = msg->line;
if(lin and not (prnheader & WRITE_ONLY_HEADER)) {
if(lin) {
Line* line = lin[n];
while(line) {
uint lineisctrl = line->type & (GLINE_TEAR|GLINE_ORIG|GLINE_KLUDGE);
@ -142,6 +140,8 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, bool clip) {
static void WriteMsgs(GMsg* msg) {
int prnmargin;
if(AA->Msgn.Tags() == 0)
return;
@ -222,10 +222,10 @@ static void WriteMsgs(GMsg* msg) {
AA->LoadMsg(msg, AA->Mark[n], prnmargin);
if(target & WRITE_PRINTER) {
if(prnfp)
SaveLines(MODE_WRITE, "\001PRN", msg);
SaveLines(MODE_WRITE, "\001PRN", msg, prnmargin);
}
else {
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, AA->Outputfile(), msg, (target & WRITE_CLIPBRD) ? true : false);
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, AA->Outputfile(), msg, prnmargin, (target & WRITE_CLIPBRD) ? true : false);
}
}
if(prnfp)
@ -277,7 +277,7 @@ static void WriteMsgs(GMsg* msg) {
sprintf(buf, LNG->WritingFile, AA->Outputfile());
w_info(buf);
AA->LoadMsg(msg, msg->msgno, prnmargin);
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, AA->Outputfile(), msg);
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, AA->Outputfile(), msg, prnmargin);
w_info(NULL);
}
} while(overwrite == -1);
@ -292,7 +292,7 @@ static void WriteMsgs(GMsg* msg) {
#endif
if(prnfp) {
fwrite(CFG->printinit+1, CFG->printinit[0], 1, prnfp);
SaveLines(MODE_WRITE, "\001PRN", msg);
SaveLines(MODE_WRITE, "\001PRN", msg, prnmargin);
fwrite(CFG->printreset+1, CFG->printreset[0], 1, prnfp);
}
w_info(NULL);
@ -303,7 +303,7 @@ static void WriteMsgs(GMsg* msg) {
mktemp(strcpy(fname, AddPath(CFG->goldpath, "GDXXXXXX")));
AA->LoadMsg(msg, msg->msgno, prnmargin);
SaveLines(MODE_WRITE, fname, msg, true);
SaveLines(MODE_WRITE, fname, msg, prnmargin, true);
gclipbrd clipbrd;
gfile fp;

View File

@ -313,7 +313,7 @@ bool GMsgHeaderEdit::validate() {
vcurshow();
char bot2[200];
MakeAttrStr(bot2, &msg->attr);
MakeAttrStr(bot2, sizeof(bot2), &msg->attr);
strsetsz(bot2, EDIT->HdrNodeLen());
window.prints(1, EDIT->HdrNodePos(), C_HEADW, bot2);

View File

@ -108,7 +108,7 @@ void DispHeader(GMsg* msg, bool prn, FILE* fp, int width) {
fwrite(buf, strlen(buf), 1, fp);
// Generate message attributes string
MakeAttrStr(buf2, &msg->attr);
MakeAttrStr(buf2, sizeof(buf2), &msg->attr);
int len2 = strlen(buf2);
if(len2 > width-CFG->disphdrnodeset.pos) {
len2 = width-CFG->disphdrnodeset.pos;

View File

@ -1962,7 +1962,10 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
for(n=0; n<qlen; n++) {
*(++bp) = *qptr++;
}
if(quotewraphard) {
*qbuf = NUL;
qlen = 0;
}
ptr = spanfeeds(ptr);
line->type |= GLINE_QUOT|GLINE_HARD;
}
@ -2372,7 +2375,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
else {
wraps++;
if(para == GLINE_QUOT)
reflow = quotewraphard;
reflow = true;
line->type |= GLINE_WRAP;
ptr = spanfeeds(ptr);
if((*bp == ' ') or (isspace(*ptr) && (*ptr != LF)))
@ -2388,10 +2391,10 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
else
line->type |= GLINE_HARD;
*(++bp/*+1*/) = NUL;
*(++bp) = NUL;
// Get line length
uint tmplinelength = (uint)((long)bp-(long)bptr);
uint tmplinelength = (uint)(bp-bptr);
if(tmplinelength > (uint)(margin + 512)) {
LOG.ErrPointer();
LOG.printf("! A message line length (%u bytes) exceeded an internal buffer limit of %u bytes", tmplinelength, margin+512);
@ -2400,7 +2403,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
}
// Store line
line->txt = linetmp+1; // .assign(linetmp+1, tmplinelength+5);
line->txt = linetmp+1;
prev_ptr[0] = line->txt.empty() ? 0xFF : line->txt[0];
prev_ptr[1] = line->txt.length() < 2 ? 0xFF : line->txt[1];

View File

@ -37,7 +37,7 @@ GMsg* MenuMsgPtr;
void DispHeadAttrs(GMsg* msg) {
char atrs[200];
MakeAttrStr(atrs, &msg->attr);
MakeAttrStr(atrs, sizeof(atrs), &msg->attr);
strsetsz(atrs, MAXCOL-CFG->disphdrnodeset.pos);
HeaderView->window.prints(1, CFG->disphdrnodeset.pos, HeaderView->window_color, atrs);

View File

@ -215,7 +215,7 @@ static void mlst_get_mlst(MLst* ml, PInf* p, int n) {
AA->LoadHdr(msg, ml->msgno);
}
else {
AA->LoadMsg(msg, ml->msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar));
AA->LoadMsg(msg, ml->msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar), GMSG_COPY); // do quick load
}
ml->goldmark = goldmark;

View File

@ -96,7 +96,7 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea)
sprintf(revbuf, "%02d%02d", str2mon(__gver_date__), atoi(&__gver_date__[4]));
char attr[80];
MakeAttrStr(attr, &msg->attr);
MakeAttrStr(attr, sizeof(attr), &msg->attr);
const char *xmailer = get_informative_string();

View File

@ -526,7 +526,7 @@ static void MakeMsg2(int& mode, int& status, int& forwstat, int& topline, GMsg*
line = line->next;
}
if(*EDIT->External() and not EDIT->Internal()) {
SaveLines(MODE_SAVE, AddPath(CFG->goldpath, EDIT->File()), msg);
SaveLines(MODE_NEW, AddPath(CFG->goldpath, EDIT->File()), msg, 79);
}
int loop = 0;
w_info(NULL);

View File

@ -108,7 +108,7 @@ const char* get_informative_string(void);
void CmfMsgs(GMsg* msg);
void LoadText(GMsg* msg, const char* textfile);
void SaveLines(int mode, const char* savefile, GMsg* msg, bool clip=false);
void SaveLines(int mode, const char* savefile, GMsg* msg, int margin, bool clip=false);
// ------------------------------------------------------------------

View File

@ -1141,7 +1141,7 @@ void GotoReplies() {
uint reln = AA->Msgn.ToReln(msgn);
if(reln) {
if(CFG->replylinklist == REPLYLINKLIST_FULL)
AA->LoadMsg(rmsg, msgn, CFG->dispmargin-(int)CFG->switches.get(disppagebar));
AA->LoadMsg(rmsg, msgn, CFG->dispmargin-(int)CFG->switches.get(disppagebar), GMSG_COPY); // do quick load
else
AA->LoadHdr(rmsg, msgn);
rlist[replies].isread = ((0 == rmsg->timesread) and CFG->switches.get(highlightunread)) ? '\x10' : ' ';

View File

@ -534,9 +534,9 @@ int ExternUtil(GMsg* msg, int utilno) {
strcpy(cmdline, extutil->cmdline);
int mode = (extutil->options & EXTUTIL_KEEPCTRL) ? MODE_SAVE : MODE_SAVENOCTRL;
SaveLines(mode, editorfile, msg);
SaveLines(mode, editorfile, msg, 79);
if(striinc("@tmpfile", cmdline))
SaveLines(mode, tmpfile, msg);
SaveLines(mode, tmpfile, msg, 79);
strcpy(buf, CFG->goldpath);
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
@ -633,13 +633,13 @@ void UUDecode(GMsg* msg) {
overwrite = false; // Overwrite only the first time
w_progress(MODE_UPDATE, C_INFOW, n+1, AA->Mark.Count(), LNG->Preparing);
AA->LoadMsg(msg, AA->Mark[n], 79);
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, infile, msg);
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, infile, msg, 79);
}
if(AA->Mark.Count())
w_progress(MODE_QUIT, 0, 0, 0, NULL);
}
else if(source == WRITE_CURRENT)
SaveLines(MODE_WRITE, infile, msg);
SaveLines(MODE_WRITE, infile, msg, 79);
uulist* item;
int i, res;

View File

@ -203,7 +203,10 @@ 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);
fputs("@header From : @_oname @_oaddr @odate @otime\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);
fputs("@header Subj : @subject\n", fp);
fputs("@header@align{79}{=}\n", fp);
@ -759,7 +762,7 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
}
}
if((mode == MODE_CHANGE) or (mode == MODE_WRITEHEADER) or (mode == MODE_WRITE))
if((mode == MODE_CHANGE) or (mode == MODE_WRITEHEADER) or (mode == MODE_WRITE) or (mode == MODE_HEADER))
if(chg == NO)
continue;
if((mode == MODE_QUOTEBUF) and not quotebufline)

View File

@ -754,12 +754,16 @@ void guserbase::update_addressbook(GMsg* msg, bool reverse, bool force) {
return;
}
// 6. If it is already an email address
// 6. It's a UUCP name
if(strieql("UUCP", name) or (*AA->Internetgate().name and strieql(AA->Internetgate().name, name)))
return;
// 7. If it is already an email address
if(AA->isemail() and strchr(name, '@'))
return;
// 7. User listed in nodelist
// 8. User listed in nodelist
const char *nlname = lookup_nodelist(&fidoaddr);
if(nlname and strieql(nlname, name))
return;
@ -845,6 +849,9 @@ bool guserbase::lookup_addressbook(GMsg* msg, char* name, char* aka, bool browse
void guserbase::build_pseudo(GMsg* msg, char* name, char* aka, bool direction) {
if(*msg->iaddr and strieql("UUCP", name) or (*AA->Internetgate().name and strieql(AA->Internetgate().name, name)))
strcpy(direction ? msg->pseudoto : msg->pseudofrom, strlword(msg->iaddr, " @"));
else
strcpy(direction ? msg->pseudoto : msg->pseudofrom, strlword(name, " @"));
if(find_entry(name, true) and not entry.is_deleted) {
@ -864,7 +871,6 @@ void guserbase::build_pseudo(GMsg* msg, char* name, char* aka, bool direction) {
}
strcpy(direction ? msg->pseudoto : msg->pseudofrom, entry.pseudo);
}
}
}

View File

@ -91,76 +91,56 @@ void GMsgHeaderView::Use(Area *areaptr, GMsg *msgptr) {
void GMsgHeaderView::Paint() {
ISub buf;
int namewidth = CFG->disphdrnodeset.pos - CFG->disphdrnameset.pos;
int nodewidth = CFG->disphdrdateset.pos - CFG->disphdrnodeset.pos;
int datewidth = width - CFG->disphdrdateset.pos;
vchar headerline[200];
for(int c = 0; c < width; c++)
headerline[c] = _box_table(W_BHEAD, 1);
headerline[width] = NUL;
INam whofrom;
if(not area->isecho() and *msg->ifrom and *msg->realby)
sprintf(whofrom, "%s <%s>", msg->realby, msg->iorig);
else if(not area->isecho() and *msg->ifrom and *msg->iorig)
strcpy(whofrom, msg->iorig);
else
strcpy(whofrom, msg->By());
strsetsz(whofrom, (area->isinternet() or *msg->ifrom) ? (namewidth+nodewidth) : namewidth);
INam whoto;
if(not area->isecho() and *msg->ito and *msg->realto)
sprintf(whoto, "%s <%s>", msg->realto, msg->idest);
else if(not area->isecho() and *msg->ito and *msg->idest)
strcpy(whoto, msg->idest);
else
strcpy(whoto, msg->To());
strsetsz(whoto, (area->isinternet() or *msg->ito) ? (namewidth+nodewidth) : namewidth);
// Generate top line fields
ISub buf;
char top1[200];
strtrim(strcpy(buf, area->desc()));
if((CFG->dispareano == ALWAYS) or (CFG->dispareano and area->board()))
sprintf(top1, " [%u] %s ", area->board(), buf);
else
sprintf(top1, " %s ", buf);
strtrim(top1);
strcat(top1, " (" /*)*/);
if(area->isinternet())
strcpy(buf, area->Internetaddress());
else
area->Aka().addr.make_string(buf);
strcat(top1, buf);
strcat(top1, /*(*/ ") ");
char top2[200];
if(msg->areakludgeid)
sprintf(top2, " %s (%s) ", area->echoid(), msg->areakludgeid);
else
sprintf(top2, " %s ", area->echoid());
int datewidth = MinV(width - CFG->disphdrdateset.pos, CFG->disphdrdateset.len);
#if defined(GUTLOS_FUNCS)
g_set_ostitle_name(struplow(strtmp(area->echoid())), 0);
#endif
// Get marks
int bookmark = (area->bookmark == msg->msgno);
int markmark = (area->Mark.Count() ? (area->Mark.Find(msg->msgno) ? 1 : 0) : NO);
// Generate top line fields
char buf1[16];
if((CFG->dispareano == ALWAYS) or (CFG->dispareano and area->board()))
sprintf(buf1, "[%u] ", area->board());
else
*buf1 = NUL;
__extension__ char top[width+1];
strxmerge(top, width+1, " ", buf1, strtrim(strtmp(area->desc())), " (",
area->isinternet() ? area->Internetaddress() : area->Aka().addr.make_string(buf),
") ", NULL);
int desclen = strlen(top);
window.printc(0, 0, border_color|ACSET, _box_table(W_BHEAD, 1));
window.prints(0, 1, title_color, top);
if(msg->areakludgeid)
strxmerge(top, width+1, " ", area->echoid(), " (", msg->areakludgeid, ") ", NULL);
else
strxmerge(top, width+1, " ", area->echoid(), " ", NULL);
int taglen = strlen(top);
if((width - (desclen + taglen + 2)) > 0)
window.fill(0, desclen+1, 0, width-(taglen+1)-1, _box_table(W_BHEAD, 1), border_color|ACSET);
window.prints(0, width-taglen-1, title_color, top);
window.printc(0, width-1, border_color|ACSET, _box_table(W_BHEAD, 1));
// Generate message attributes string
char bot2[200];
MakeAttrStr(bot2, &msg->attr);
int len2 = strlen(bot2);
if(len2 > width-CFG->disphdrnodeset.pos) {
len2 = width-CFG->disphdrnodeset.pos;
strsetsz(bot2, len2);
bool attrsgenerated = false;
MakeAttrStr(buf, width-CFG->disphdrnodeset.pos, &msg->attr);
if(*buf) {
attrsgenerated = true;
strsetsz(buf, width-CFG->disphdrnodeset.pos);
window.prints(1, CFG->disphdrnodeset.pos, window_color, buf);
}
// Generate message number and reply links string
char bot1[200];
char* ptr = bot1;
char* ptr = buf;
int list_max = msg->link.list_max();
ulong* replies = (ulong*)throw_calloc(list_max+1, sizeof(ulong));
ulong replyto, replynext;
@ -183,98 +163,106 @@ void GMsgHeaderView::Paint() {
}
if(replyto)
ptr += sprintf(ptr, " -%lu", replyto);
for(int replyn=0,plus=0; replyn<list_max+1; replyn++)
for(int replyn=0,plus=0; (replyn<(list_max+1)) and (not attrsgenerated or ((ptr-buf)<CFG->disphdrnodeset.pos)); replyn++)
if(replies[replyn])
ptr += sprintf(ptr, " %s%lu", (plus++?"":"+"), replies[replyn]);
if(replynext)
if(replynext and (not attrsgenerated or ((ptr-buf)<CFG->disphdrnodeset.pos)))
sprintf(ptr, " *%lu", replynext);
int len1 = strlen(bot1) - 8;
if((CFG->disphdrnameset.pos + len1) > CFG->disphdrnodeset.pos) {
if(8 + len1 + len2 > width) {
strsetsz(bot1, width-len2-1);
strtrim(bot1);
}
strcat(bot1, " ");
strcat(bot1, bot2);
*bot2 = NUL;
}
else {
strsetsz(bot1, namewidth+8);
strcat(bot1, bot2);
*bot2 = NUL;
}
strsetsz(bot1, width);
throw_free(replies);
// Generate orig node data
char node1[200];
if(msg->orig.net)
msg->orig.make_string(node1);
else
*node1 = NUL;
strsetsz(node1, nodewidth);
strsetsz(buf, attrsgenerated ? CFG->disphdrnodeset.pos : width);
window.prints(1, 0, window_color, buf);
char date1[25] = "";
// Get marks
if(area->bookmark == msg->msgno)
window.prints(1, 5, highlight_color, "\x11");
if(area->Mark.Count() and area->Mark.Find(msg->msgno))
window.prints(1, 7, highlight_color, "\x10");
// Generate from info
bool nodegenerated = false;
if(not area->isinternet()) {
if(area->isecho() or not (*msg->ifrom and (*msg->realby or *msg->iorig))) {
// Generate orig node data
if(msg->orig.net)
msg->orig.make_string(buf);
else
*buf = NUL;
nodegenerated = true;
strsetsz(buf, nodewidth);
window.prints(2, CFG->disphdrnodeset.pos, from_color, buf);
}
}
if(not area->isecho() 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)
strxcpy(buf, msg->iorig, (namewidth+nodewidth));
else
strxcpy(buf, msg->By(), (namewidth+nodewidth));
strsetsz(buf, nodegenerated ? namewidth : (namewidth+nodewidth));
window.prints(2, 0, window_color, LNG->From);
window.prints(2, CFG->disphdrnameset.pos, ((msg->foundwhere&GFIND_FROM) or msg->attr.fmu() or (msg->attr.loc() and CFG->switches.get(displocalhigh))) ? highlight_color : from_color, buf);
if(datewidth > 0) {
if(msg->written)
strftimei(date1, CFG->disphdrdateset.len, LNG->DateTimeFmt, gmtime(&msg->written));
strsetsz(date1, datewidth);
strftimei(buf, datewidth, LNG->DateTimeFmt, gmtime(&msg->written));
else
*buf = NUL;
strsetsz(buf, datewidth);
window.prints(2, CFG->disphdrdateset.pos, from_color, buf);
}
// Generate dest node data
char node2[200];
nodegenerated = false;
if(not area->isinternet()) {
if(area->isecho() or not (*msg->ito and (*msg->realto or *msg->idest))) {
if(msg->dest.net and area->isnet()) {
msg->dest.make_string(node2);
msg->dest.make_string(buf);
if(msg->odest.net) {
if(msg->odest.net != msg->dest.net or msg->odest.node != msg->dest.node) {
sprintf(buf, " %s %u/%u", LNG->Via, msg->odest.net, msg->odest.node);
strcat(node2, buf);
if((msg->odest.net != msg->dest.net) or (msg->odest.node != msg->dest.node)) {
sprintf(buf+strlen(buf), " %s %u/%u", LNG->Via, msg->odest.net, msg->odest.node);
}
}
nodegenerated = true;
strsetsz(buf, nodewidth);
window.prints(3, CFG->disphdrnodeset.pos, to_color, buf);
}
}
}
else
*node2 = NUL;
strsetsz(node2, nodewidth);
char date2[25] = "";
if(not area->isecho() 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)
strxcpy(buf, msg->idest, (namewidth+nodewidth));
else
strxcpy(buf, msg->To(), (namewidth+nodewidth));
strsetsz(buf, nodegenerated ? namewidth : (namewidth+nodewidth));
window.prints(3, 0, window_color, LNG->To);
window.prints(3, CFG->disphdrnameset.pos, ((msg->foundwhere&GFIND_TO) or msg->attr.tou()) ? highlight_color : to_color, buf);
if(datewidth > 0) {
if(msg->arrived)
strftimei(date2, CFG->disphdrdateset.len, LNG->DateTimeFmt, gmtime(&msg->arrived));
strsetsz(date2, datewidth);
strftimei(buf, datewidth, LNG->DateTimeFmt, gmtime(&msg->arrived));
else
*buf = NUL;
strsetsz(buf, datewidth);
window.prints(3, CFG->disphdrdateset.pos, to_color, buf);
}
// Generate subjectline
char subj[200], lngsubj[10];
strcpy(lngsubj, (msg->attr.att() or msg->attr.frq() or msg->attr.urq()) ? LNG->File : LNG->Subj);
strxcpy(subj, msg->re, sizeof(subj));
strsetsz(subj, width-strlen(lngsubj));
strxcpy(buf, (msg->attr.att() or msg->attr.frq() or msg->attr.urq()) ? LNG->File : LNG->Subj, 10);
int lngsubjlen = strlen(buf);
window.prints(4, 0, window_color, buf);
// Paint the total header in the window
vchar borderchar[2] = { (vchar)' ', 0 };
*borderchar = _box_table(W_BHEAD, 1);
window.printvs(0, 0, border_color|ACSET, borderchar);
window.prints(0, 1, title_color, top1);
window.printvs(0, strlen(top1)+1, border_color|ACSET, headerline+strlen(top1)+strlen(top2)-2);
window.prints(0, width-strlen(top2)-1, title_color, top2);
window.printvs(0, width-1, border_color|ACSET, borderchar);
window.printvs(5, 0, border_color|ACSET, headerline);
window.prints(1, 0, window_color, bot1);
if(bookmark)
window.prints(1, 5, highlight_color, "\x11");
if(markmark)
window.prints(1, 7, highlight_color, "\x10");
if(*bot2)
window.prints(1, CFG->disphdrnodeset.pos, window_color, bot2);
window.prints(2, 0, window_color, LNG->From);
window.prints(2, CFG->disphdrnameset.pos, ((msg->foundwhere&GFIND_FROM) or msg->attr.fmu() or (msg->attr.loc() and CFG->switches.get(displocalhigh))) ? highlight_color : from_color, whofrom);
window.prints(3, 0, window_color, LNG->To);
window.prints(3, CFG->disphdrnameset.pos, ((msg->foundwhere&GFIND_TO) or msg->attr.tou()) ? highlight_color : to_color, whoto);
if(not area->isinternet()) {
if(area->isecho() or not (*msg->ifrom and (*msg->realby or *msg->iorig)))
window.prints(2, CFG->disphdrnodeset.pos, from_color, node1);
if(area->isecho() or not (*msg->ito and (*msg->realto or *msg->idest)))
window.prints(3, CFG->disphdrnodeset.pos, to_color, node2);
}
window.prints(2, CFG->disphdrdateset.pos, from_color, date1);
window.prints(3, CFG->disphdrdateset.pos, to_color, date2);
window.prints(4, 0, window_color, lngsubj);
window.prints(4, strlen(lngsubj), (msg->foundwhere&GFIND_SUBJECT) ? highlight_color : subject_color, subj);
strxcpy(buf, msg->re, width-lngsubjlen);
strsetsz(buf, width-lngsubjlen);
window.prints(4, lngsubjlen, (msg->foundwhere&GFIND_SUBJECT) ? highlight_color : subject_color, buf);
// Generate bottom line
window.fill(5, 0, 5, width-1, _box_table(W_BHEAD, 1), border_color|ACSET);
// Calculate attach file sizes
if(msg->attr.att()) {
@ -292,18 +280,18 @@ void GMsgHeaderView::Paint() {
sprintf(buf2, "%s%s", CFG->inboundpath, ptr);
long sz = GetFilesize(MapPath(buf2));
if(sz == -1)
sprintf(subj, " %s ", LNG->n_a);
sprintf(buf1, " %s ", LNG->n_a);
else {
switch(CFG->dispattachsize) {
case ATTACH_BYTES:
sprintf(subj, " %li ", sz);
sprintf(buf1, " %li ", sz);
break;
case ATTACH_KBYTES:
sprintf(subj, " %lik ", (sz+512L)/1024L);
sprintf(buf1, " %lik ", (sz+512L)/1024L);
break;
}
}
window.prints(5, begpos+int(ptr-buf)-1, title_color, subj);
window.prints(5, begpos+int(ptr-buf)-1, title_color, buf1);
ptr = strtok(NULL, " ");
}
}
@ -313,19 +301,19 @@ void GMsgHeaderView::Paint() {
uint len = strlen(msg->txt);
switch(CFG->dispmsgsize) {
case DISPMSGSIZE_BYTES:
sprintf(subj, "%u", len);
sprintf(buf1, "%u", len);
break;
case DISPMSGSIZE_KBYTES:
sprintf(subj, "%uk", (len+512)/1024);
sprintf(buf1, "%uk", (len+512)/1024);
break;
case DISPMSGSIZE_KBYTES+1:
sprintf(subj, "%u", msg->lines);
case DISPMSGSIZE_LINES:
sprintf(buf1, "%u", msg->lines);
break;
default:
*subj = NUL;
*buf1 = NUL;
}
if(*subj)
window.prints(5, 1, title_color, subj);
if(*buf1)
window.prints(5, 1, title_color, buf1);
}
}

View File

@ -38,11 +38,14 @@
// ------------------------------------------------------------------
// Define portability and shorthand notation
// GCC after 2.95.x have "and", "not", and "or" predefined
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
#ifndef and
#define not !
#define and &&
#define or ||
#endif
#endif
#ifndef true
#define true 1

View File

@ -1189,7 +1189,7 @@ gkey kbxget_raw(int mode) {
if(alt_pressed)
special_key = is_numpad_key(inp); // Alt-<numpad key>
else if(not gkbd_nt and not (CKS & ENHANCED_KEY) and (ascii and not ctrl_pressed) and not (iscntrl(ascii) and shift_pressed))
else if(not gkbd_nt and not (CKS & ENHANCED_KEY) and not (VKC == VK_CLEAR) and (ascii and not ctrl_pressed) and not (iscntrl(ascii) and shift_pressed))
special_key = true; // It is alphanumeric key under Win9x
if(special_key) {
ReadConsole(gkbd_hin, &ascii, 1, &nread, NULL);

View File

@ -33,6 +33,7 @@
#include <string>
#include <gdefs.h>
#include <gstrall.h>
// ------------------------------------------------------------------
@ -484,7 +485,7 @@ typedef ftn_attr Attr;
inline void AttrAdd(Attr* a, Attr* b) { a->add(*b); }
inline void GetAttribstr(Attr* attr, const char* attrs) { attr->get(attrs); }
inline char* MakeAttrStr(char* str, const Attr* attr) { string tmp; attr->make_string(tmp); strcpy(str, tmp.c_str()); return str; }
inline char* MakeAttrStr(char* str, size_t maxlen, const Attr* attr) { string tmp; attr->make_string(tmp); strxcpy(str, tmp.c_str(), maxlen); return str; }
// ------------------------------------------------------------------

View File

@ -1204,11 +1204,17 @@ vatch vgetw(int row, int col) {
void vgetc(int row, int col, int* atr, vchar* chr) {
if((row < 0) || (row > gvid->numrows-1) || (col < 0) || (col > gvid->numcols-1)) {
*chr = ' ';
*atr = 0;
}
else {
vatch tmp = vgetw(row, col);
*chr = vgchar(tmp);
*atr = vgattr(tmp);
}
}
// ------------------------------------------------------------------