From 54e47b7b0a3200e8372acc5623f62348218f8ff6 Mon Sep 17 00:00:00 2001 From: "Alexander S. Aganichev" Date: Sun, 8 Apr 2001 08:02:01 +0000 Subject: [PATCH] Fixes --- docs/notework.txt | 12 +++- golded3/gemenu.cpp | 2 +- golded3/gemlst.cpp | 6 +- goldlib/gcfg/gxhpt.cpp | 121 ++++++++++++++++++++++---------------- goldlib/gmb3/gmojamm.h | 24 +++++++- goldlib/gmb3/gmojamm4.cpp | 32 ++++++---- 6 files changed, 128 insertions(+), 69 deletions(-) diff --git a/docs/notework.txt b/docs/notework.txt index 8c69c6b..f166503 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -9,16 +9,24 @@ ______________________________________________________________________ ______________________________________________________________________ - Notes for GoldED+ 1.1.5, March xx 2001 + Notes for GoldED+ 1.1.5, April xx 2001 ______________________________________________________________________ +- Fixed cursor position in XlatImport menu when Auto encoding + selected. + +- Added support for CommentChar token in FidoConfig (untested). + +- Added code for trimming particular subfields in JAM as required by + JAM specification. + - Fixed users.bbs handling for *.msg and Squish areas. - Soft-deleted messages no longer hidden from messagelist right after deletion any more. + Added new switch JamSMAPIHighwater. If defined GoldED+ will handle - highwaters just like SMAPI did. Recommended for use with HPT. + highwaters just like SMAPI do. Recommended for use with HPT. Defaults to No. Support for Crashmail II style highwaters added as well. diff --git a/golded3/gemenu.cpp b/golded3/gemenu.cpp index c9fe4ba..986b28e 100644 --- a/golded3/gemenu.cpp +++ b/golded3/gemenu.cpp @@ -905,7 +905,7 @@ int ChangeXlatImport() { if(strieql(xlt->exp, CFG->xlatlocalset)) { maximport = MaxV(maximport, (int)strlen(xlt->imp)); maxexport = MaxV(maxexport, (int)strlen(xlt->exp)); - if(strieql(xlt->imp, AA->Xlatimport())) + if((CFG->ignorecharset == true) and strieql(xlt->imp, AA->Xlatimport())) startat = xlatimports; xlatimports++; } diff --git a/golded3/gemlst.cpp b/golded3/gemlst.cpp index 8762613..588936c 100644 --- a/golded3/gemlst.cpp +++ b/golded3/gemlst.cpp @@ -195,8 +195,10 @@ void GMsgList::do_delayed() { wactiv_(mlstwh); } - if(CFG->switches.get(msglistviewsubj)) - wtitle(msg.re, TCENTER|TBOTTOM, tattr); + if(CFG->switches.get(msglistviewsubj)) { + ReadMlst(index); + wtitle(mlst[index].re, TCENTER|TBOTTOM, tattr); + } if(CFG->switches.get(msglistpagebar)) wscrollbar(W_VERT, maximum_index+1, maximum_index, index); diff --git a/goldlib/gcfg/gxhpt.cpp b/goldlib/gcfg/gxhpt.cpp index 560d640..af555d7 100644 --- a/goldlib/gcfg/gxhpt.cpp +++ b/goldlib/gcfg/gxhpt.cpp @@ -35,7 +35,7 @@ // ------------------------------------------------------------------ static bool lame = false; - +static bool comment_char = '#'; // ------------------------------------------------------------------ @@ -64,59 +64,70 @@ bool gareafile::ReadHPTLine(FILE* f, string* s, bool add, int state) { // 2: end // 3: whitespace while((ptr != str.end()) and (state != 2)) { - switch(*ptr) { - case '\\': - if(lame) - break; - if(ptr == str.end()-1) { - str.erase(ptr); - const char *p = strskip_wht(str.c_str()); - if(add) - *s += p; - else - *s = p; - ReadHPTLine(f, s, true, state); - return true; - } else - switch(ptr[1]) { - case ' ': - case '\t': - { - string::iterator i = ptr; - while((i != str.end()) and isspace(*i)) - ++i; - if(*i != '#') - break; - } - case '#': - case NUL: - case '\n': + if(*ptr == comment_char) { + if(state != 1) { + str.erase(ptr, str.end()); + state = 2; + } + } + else { + switch(*ptr) { + case '\\': + if(lame) + break; + if(ptr == str.end()-1) { + str.erase(ptr); + const char *p = strskip_wht(str.c_str()); + if(add) + *s += p; + else + *s = p; + ReadHPTLine(f, s, true, state); + return true; + } else + if(ptr[1] == comment_char) { str.erase(ptr, str.end()); - { - const char *p = strskip_wht(str.c_str()); - if(add) - *s += p; - else - *s = p; - } + const char *p = strskip_wht(str.c_str()); + if(add) + *s += p; + else + *s = p; ReadHPTLine(f, s, true, state); return true; - default: - break; - } - ++ptr; - break; - case '\"': - state = 1; - break; - case '#': - if(state != 1) { - str.erase(ptr, str.end()); - state = 2; - } - break; - default: - break; + } + switch(ptr[1]) { + case ' ': + case '\t': + { + string::iterator i = ptr; + while((i != str.end()) and isspace(*i)) + ++i; + if(*i != '#') + break; + } + case NUL: + case '\n': + str.erase(ptr, str.end()); + { + const char *p = strskip_wht(str.c_str()); + if(add) + *s += p; + else + *s = p; + } + ReadHPTLine(f, s, true, state); + return true; + default: + break; + } + ++ptr; + break; + case '\"': + state = 1; + break; + default: + break; + } } ++ptr; } @@ -241,6 +252,7 @@ void gareafile::ReadHPTFile(char* path, char* file, char* options, char* origin, const word CRC_BADAREA = 0x8DA5; const word CRC_SYSOP = 0x967F; const word CRC_VERSION = 0xF78F; + const word CRC_COMMENTCHAR = 0xE2CC; AreaCfg aa; Path buf2; @@ -294,6 +306,13 @@ void gareafile::ReadHPTFile(char* path, char* file, char* options, char* origin, MakePathname(buf2, path, buf2); ReadHPTFile(path, buf2, options, origin, group); break; + case CRC_COMMENTCHAR: + replace_slashes(&val); + if((strlen(val) == 3) and (val[0] == val[2]) and strpbrk(val, "\'\"")) + comment_char = val[1]; + else if(*val) + comment_char = val[0]; + break; case CRC_NETAREA: aa.type = GMB_NET; break; diff --git a/goldlib/gmb3/gmojamm.h b/goldlib/gmb3/gmojamm.h index f9cb928..fbf60b0 100644 --- a/goldlib/gmb3/gmojamm.h +++ b/goldlib/gmb3/gmojamm.h @@ -118,7 +118,27 @@ #define JAMSUB_PATH2D 2002 #define JAMSUB_FLAGS 2003 #define JAMSUB_TZUTCINFO 2004 -#define JAMSUB_UNKNOWN 0xFFFF + +#define JAMSUB_OADDRESS_LEN 100 +#define JAMSUB_DADDRESS_LEN 100 +#define JAMSUB_SENDERNAME_LEN 100 +#define JAMSUB_RECEIVERNAME_LEN 100 +#define JAMSUB_MSGID_LEN 100 +#define JAMSUB_REPLYID_LEN 100 +#define JAMSUB_SUBJECT_LEN 100 +#define JAMSUB_PID_LEN 40 +#define JAMSUB_TRACE_LEN ((ulong)(-1)) +#define JAMSUB_ENCLOSEDFILE_LEN ((ulong)(-1)) +#define JAMSUB_ENCLOSEDFILEWALIAS_LEN ((ulong)(-1)) +#define JAMSUB_ENCLOSEDFREQ_LEN ((ulong)(-1)) +#define JAMSUB_ENCLOSEDFILEWCARD_LEN ((ulong)(-1)) +#define JAMSUB_ENCLOSEDINDIRECFILE_LEN ((ulong)(-1)) +#define JAMSUB_EMBINDAT_LEN ((ulong)(-1)) +#define JAMSUB_FTSKLUDGE_LEN 255 +#define JAMSUB_SEENBY2D_LEN ((ulong)(-1)) +#define JAMSUB_PATH2D_LEN ((ulong)(-1)) +#define JAMSUB_FLAGS_LEN ((ulong)(-1)) +#define JAMSUB_TZUTCINFO_LEN ((ulong)(-1)) // ------------------------------------------------------------------ @@ -273,7 +293,7 @@ protected: int load_message(int __mode, gmsg* __msg, JamHdr& __hdr); - void add_subfield(JamHdr& __hdr, byte*& __subfield, word __loid, word __hiid, char* __data); + void add_subfield(JamHdr& __hdr, byte*& __subfield, word __loid, word __hiid, char* __data, ulong maxlen); void save_message(int __mode, gmsg* __msg, JamHdr& __hdr); diff --git a/goldlib/gmb3/gmojamm4.cpp b/goldlib/gmb3/gmojamm4.cpp index 4660ac0..4a9dc88 100644 --- a/goldlib/gmb3/gmojamm4.cpp +++ b/goldlib/gmb3/gmojamm4.cpp @@ -103,16 +103,16 @@ void JamArea::unlock() { // ------------------------------------------------------------------ -void JamArea::add_subfield(JamHdr& __hdr, byte*& __subfield, word __loid, word __hiid, char* __data) { +void JamArea::add_subfield(JamHdr& __hdr, byte*& __subfield, word __loid, word __hiid, char* __data, ulong __maxlen) { - uint _datlen = strlen(__data); + ulong _datlen = strlen(__data); __subfield = (byte*)throw_realloc(__subfield, (uint)__hdr.subfieldlen+sizeof(JamSubFieldHdr)+_datlen); JamSubField* _subfieldptr = (JamSubField*)(__subfield + (uint)__hdr.subfieldlen); _subfieldptr->loid = __loid; _subfieldptr->hiid = __hiid; - _subfieldptr->datlen = _datlen; - memcpy(_subfieldptr->buffer, __data, _datlen); - __hdr.subfieldlen += sizeof(JamSubFieldHdr) + _datlen; + _subfieldptr->datlen = MinV(_datlen, __maxlen); + memcpy(_subfieldptr->buffer, __data, _subfieldptr->datlen); + __hdr.subfieldlen += sizeof(JamSubFieldHdr) + _subfieldptr->datlen; } @@ -196,23 +196,23 @@ void JamArea::save_message(int __mode, gmsg* __msg, JamHdr& __hdr) { } if(*__msg->by) - add_subfield(__hdr, _subfield, JAMSUB_SENDERNAME, 0, __msg->by); + add_subfield(__hdr, _subfield, JAMSUB_SENDERNAME, 0, __msg->by, JAMSUB_SENDERNAME_LEN); if(__msg->orig.net) { __msg->orig.make_string(_buf, __msg->odom); - add_subfield(__hdr, _subfield, JAMSUB_OADDRESS, 0, _buf); + add_subfield(__hdr, _subfield, JAMSUB_OADDRESS, 0, _buf, JAMSUB_OADDRESS_LEN); } if(*__msg->to) - add_subfield(__hdr, _subfield, JAMSUB_RECEIVERNAME, 0, __msg->to); + add_subfield(__hdr, _subfield, JAMSUB_RECEIVERNAME, 0, __msg->to, JAMSUB_RECEIVERNAME_LEN); if(__msg->dest.net) { __msg->dest.make_string(_buf, __msg->ddom); - add_subfield(__hdr, _subfield, JAMSUB_DADDRESS, 0, _buf); + add_subfield(__hdr, _subfield, JAMSUB_DADDRESS, 0, _buf, JAMSUB_DADDRESS_LEN); } if(*__msg->re) - add_subfield(__hdr, _subfield, JAMSUB_SUBJECT, 0, __msg->re); + add_subfield(__hdr, _subfield, JAMSUB_SUBJECT, 0, __msg->re, JAMSUB_SUBJECT_LEN); // Convert kludges _line = 0; @@ -221,6 +221,7 @@ void JamArea::save_message(int __mode, gmsg* __msg, JamHdr& __hdr) { if(_pdptr->control > CTRL_KLUDGE) { uint _offset = 0; word _loid = 0; + ulong _maxlen = 0; switch(_pdptr->control) { case CTRL_INTL: case CTRL_FMPT: @@ -229,44 +230,53 @@ void JamArea::save_message(int __mode, gmsg* __msg, JamHdr& __hdr) { break; case CTRL_MSGID: _loid = JAMSUB_MSGID; + _maxlen = JAMSUB_MSGID_LEN; _offset = 8; strxcpy(__msg->msgids, _pdptr->text+_offset, sizeof(__msg->msgids)); break; case CTRL_REPLY: _loid = JAMSUB_REPLYID; + _maxlen = JAMSUB_REPLYID_LEN; _offset = 8; strxcpy(__msg->replys, _pdptr->text+_offset, sizeof(__msg->replys)); break; case CTRL_PID: _loid = JAMSUB_PID; + _maxlen = JAMSUB_PID_LEN; _offset = 6; break; case CTRL_VIA: _loid = JAMSUB_TRACE; + _maxlen = JAMSUB_TRACE_LEN; _offset = 6; break; case CTRL_SEENBY: _loid = JAMSUB_SEENBY2D; + _maxlen = JAMSUB_SEENBY2D_LEN; _offset = 9; break; case CTRL_SEENBY1: _loid = JAMSUB_SEENBY2D; + _maxlen = JAMSUB_SEENBY2D_LEN; _offset = 10; break; case CTRL_PATH: _loid = JAMSUB_PATH2D; + _maxlen = JAMSUB_PATH2D_LEN; _offset = 7; break; case CTRL_FLAGS: _loid = JAMSUB_FLAGS; + _maxlen = JAMSUB_FLAGS_LEN; _offset = 7; break; default: _loid = JAMSUB_FTSKLUDGE; + _maxlen = JAMSUB_FTSKLUDGE_LEN; _offset = 1; } if(_offset) - add_subfield(__hdr, _subfield, _loid, 0, _pdptr->text+_offset); + add_subfield(__hdr, _subfield, _loid, 0, _pdptr->text+_offset, _maxlen); } _pdptr++; _line++;