From 264399a2ecdebf939ae778a990315908e0fbdad0 Mon Sep 17 00:00:00 2001 From: "Alexander S. Aganichev" Date: Thu, 29 Mar 2001 18:55:31 +0000 Subject: [PATCH] Fixes, added highwater support for Jam --- docs/notework.txt | 8 ++++++++ golded3/gccfgg.h | 1 + golded3/gccfgg0.cpp | 1 + golded3/gckeys.cpp | 2 +- golded3/gcprot.h | 1 - golded3/gecfgg.h | 1 + golded3/gecmfd.cpp | 6 ++++-- golded3/gehdre.cpp | 1 - golded3/geinit.cpp | 2 +- golded3/gemenu.cpp | 2 -- golded3/gemlst.cpp | 1 - golded3/gmarea.h | 2 ++ goldlib/gmb3/gmoarea.h | 2 ++ goldlib/gmb3/gmojamm.h | 5 ++++- goldlib/gmb3/gmojamm1.cpp | 3 ++- goldlib/gmb3/gmojamm2.cpp | 19 ++++++++++++++----- goldlib/gmb3/gmojamm4.cpp | 25 +++++++++++++++++++++++++ goldlib/gmb3/gmojamm5.cpp | 7 ++++++- goldlib/gmb3/gmoprot.h | 2 +- 19 files changed, 73 insertions(+), 18 deletions(-) diff --git a/docs/notework.txt b/docs/notework.txt index 891962e..7d696a3 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -12,6 +12,14 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, March xx 2001 ______________________________________________________________________ +- Soft-deleted messages now not hided 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. + Defaults to No. Support for Crashmail II style highwaters added as + well. + ! Message lister redesigned. Should be quicker if you roll up and down but consumes more memory. diff --git a/golded3/gccfgg.h b/golded3/gccfgg.h index bb2f253..713d8f9 100644 --- a/golded3/gccfgg.h +++ b/golded3/gccfgg.h @@ -226,6 +226,7 @@ const word CRC_INTERNETSERVER = 0xA01B; const word CRC_INVALIDATE = 0x69CB; const word CRC_JAMHARDDELETE = 0xE2D5; const word CRC_JAMPATH = 0x1200; +const word CRC_JAMSMAPIHIGHWATER= 0x74A4; const word CRC_KEYBCLEAR = 0xD407; const word CRC_KEYBDEFAULTS = 0x9FAE; const word CRC_KEYBEXT = 0xC48A; diff --git a/golded3/gccfgg0.cpp b/golded3/gccfgg0.cpp index dbe7f5f..488d7fb 100644 --- a/golded3/gccfgg0.cpp +++ b/golded3/gccfgg0.cpp @@ -66,6 +66,7 @@ tglobalbool globalbool[gswitches_last] = { { CRC_AREALISTPAGEBAR }, // 0x6C37; { CRC_USEMSGID }, // 0x6FDB; { CRC_LOOKUPNET }, // 0x7359; + { CRC_JAMSMAPIHIGHWATER }, // 0x74A4; { CRC_SQUISHDIRECT }, // 0x7C35; { CRC_FIDOHWMARKS }, // 0x7E07; { CRC_MSGLISTPAGEBAR }, // 0x8041; diff --git a/golded3/gckeys.cpp b/golded3/gckeys.cpp index 91feb3e..41ade68 100644 --- a/golded3/gckeys.cpp +++ b/golded3/gckeys.cpp @@ -1120,7 +1120,7 @@ int ReadKeysCfg(int force) { vector::iterator k; for(k=CFG->macro.begin(), n=0; k != CFG->macro.end(); k++, n++) { if(k->type == 0) { - if((k->key == KK_Auto) or (k->key == 0x0300)) { + if(k->key == KK_Auto) { // Start automacro mac = k->buf; while(*mac) { diff --git a/golded3/gcprot.h b/golded3/gcprot.h index 3913cea..69f5ba0 100644 --- a/golded3/gcprot.h +++ b/golded3/gcprot.h @@ -216,7 +216,6 @@ void CfgInternetreply (); void CfgInternetrfcbody (); void CfgInternetserver (); void CfgInvalidate (); -void CfgJamharddelete (); void CfgJampath (); void CfgKeybclear (); void CfgKeybdefaults (); diff --git a/golded3/gecfgg.h b/golded3/gecfgg.h index 48a8c49..2dd4886 100644 --- a/golded3/gecfgg.h +++ b/golded3/gecfgg.h @@ -53,6 +53,7 @@ enum en_gswitches { arealistpagebar, usemsgid, lookupnet, + jamsmapihw, squishdirect, fidohwmarks, msglistpagebar, diff --git a/golded3/gecmfd.cpp b/golded3/gecmfd.cpp index e5728a6..5d87b3e 100644 --- a/golded3/gecmfd.cpp +++ b/golded3/gecmfd.cpp @@ -120,8 +120,10 @@ void Area::DeleteMsg(GMsg* msg, int direction) { if(isnet() and isfido()) TouchNetscan(false); - // Remove message from internal table - Msgn.Del(msg->msgno); + if(not issmb() and not (isjam() and not CFG->switches.get(jamharddelete))) { + // Remove message from internal table + Msgn.Del(msg->msgno); + } // Update lastreads if(Msgn.Count()) diff --git a/golded3/gehdre.cpp b/golded3/gehdre.cpp index 7364e9d..bea7fbb 100644 --- a/golded3/gehdre.cpp +++ b/golded3/gehdre.cpp @@ -427,7 +427,6 @@ int EditHeaderinfo(int mode, GMsgHeaderView &view) { ChgAttrs(YES, msg); - whelpdef(CFG->helpged, Key_F1, C_HELPB, C_HELPW, C_HELPQ, C_HELPS, NULL); vcurshow(); if(not (hedit.lookup or AA->isnet())) { char date2[25] = {""}; diff --git a/golded3/geinit.cpp b/golded3/geinit.cpp index 37d6537..8e7ac68 100644 --- a/golded3/geinit.cpp +++ b/golded3/geinit.cpp @@ -1033,7 +1033,7 @@ void Initialize(int argc, char* argv[]) { #ifndef GMB_NOJAM if(AL.msgbases & MT_JAM) { update_statuslinef("%s JAM", LNG->Checking); - JamInit(CFG->jampath, CFG->switches.get(jamharddelete)); + JamInit(CFG->jampath, CFG->switches.get(jamharddelete), CFG->switches.get(jamsmapihw)); } #endif #ifndef GMB_NOPCB diff --git a/golded3/gemenu.cpp b/golded3/gemenu.cpp index 89892d4..c9fe4ba 100644 --- a/golded3/gemenu.cpp +++ b/golded3/gemenu.cpp @@ -571,7 +571,6 @@ void ChgAttrs(int mode, GMsg* __msg) { } else { DispAttrWindow(false); - freonkey(); } } @@ -582,7 +581,6 @@ void AskAttributes(GMsg* __msg) { ChgAttrs(ALWAYS, __msg); update_statusline(LNG->ChangeAttrs); - whelpdef(CFG->helpged, Key_F1, C_HELPB, C_HELPW, C_HELPQ, C_HELPS, NULL); whelppcat(H_Attributes); gkey key; diff --git a/golded3/gemlst.cpp b/golded3/gemlst.cpp index a38b932..8762613 100644 --- a/golded3/gemlst.cpp +++ b/golded3/gemlst.cpp @@ -340,7 +340,6 @@ bool GMsgList::handle_key() { break; case KK_ListGotoNext: - listgotonext: key = Key_Dwn; default_handle_key(); break; diff --git a/golded3/gmarea.h b/golded3/gmarea.h index 8381773..2a07e4d 100644 --- a/golded3/gmarea.h +++ b/golded3/gmarea.h @@ -444,6 +444,7 @@ public: int isjam() const; int ispcboard() const; int issquish() const; + int issmb() const; int iswildcat() const; int isadeptxbbs() const; int isseparator() const; @@ -607,6 +608,7 @@ inline int Area::ishudson() const { return area->ishudson(); } inline int Area::isjam() const { return area->isjam(); } inline int Area::ispcboard() const { return area->ispcboard(); } inline int Area::issquish() const { return area->issquish(); } +inline int Area::issmb() const { return area->issmb(); } inline int Area::iswildcat() const { return area->iswildcat(); } inline int Area::isadeptxbbs() const { return area->isadeptxbbs(); } inline int Area::isseparator() const { return area->isseparator(); } diff --git a/goldlib/gmb3/gmoarea.h b/goldlib/gmb3/gmoarea.h index c3748e6..4e2a7b1 100644 --- a/goldlib/gmb3/gmoarea.h +++ b/goldlib/gmb3/gmoarea.h @@ -132,6 +132,7 @@ public: int isjam() const; int ispcboard() const; int issquish() const; + int issmb() const; int iswildcat() const; int isadeptxbbs() const; int isseparator() const; @@ -199,6 +200,7 @@ inline int gmo_area::ishudson() const { return cfg.ishudson(); } inline int gmo_area::isjam() const { return cfg.isjam(); } inline int gmo_area::ispcboard() const { return cfg.ispcboard(); } inline int gmo_area::issquish() const { return cfg.issquish(); } +inline int gmo_area::issmb() const { return cfg.issmb(); } inline int gmo_area::iswildcat() const { return cfg.iswildcat(); } inline int gmo_area::isadeptxbbs() const { return cfg.isadeptxbbs(); } inline int gmo_area::isseparator() const { return cfg.isseparator(); } diff --git a/goldlib/gmb3/gmojamm.h b/goldlib/gmb3/gmojamm.h index 38f40dd..f9cb928 100644 --- a/goldlib/gmb3/gmojamm.h +++ b/goldlib/gmb3/gmojamm.h @@ -224,9 +224,11 @@ struct JamData { int fhjdt; int fhjdx; int fhjlr; + int fhjhw; // highwater if available int islocked; // Area is locked? int timesposted; - long lastpos; // Lastread position + long lastpos; // Lastread position + long highwater; JamLast lastrec; // .JLR Lastread record JamHdrInfo hdrinfo; // .JHR Header info record }; @@ -240,6 +242,7 @@ struct JamWide { int lookreplies; const char* jampath; int harddelete; + int smapihw; }; diff --git a/goldlib/gmb3/gmojamm1.cpp b/goldlib/gmb3/gmojamm1.cpp index c72b2eb..e3bb9c0 100644 --- a/goldlib/gmb3/gmojamm1.cpp +++ b/goldlib/gmb3/gmojamm1.cpp @@ -54,7 +54,7 @@ void JamExit() { // ------------------------------------------------------------------ -void JamInit(const char* jampath, int harddelete) { +void JamInit(const char* jampath, int harddelete, int jamsmapihw) { GFTRK("JamInit"); @@ -63,6 +63,7 @@ void JamInit(const char* jampath, int harddelete) { jamwide->jampath = jampath; jamwide->harddelete = harddelete; + jamwide->smapihw = jamsmapihw; // Calculate CRC32 of our username for the lastreads INam _name; diff --git a/goldlib/gmb3/gmojamm2.cpp b/goldlib/gmb3/gmojamm2.cpp index 523688d..4007216 100644 --- a/goldlib/gmb3/gmojamm2.cpp +++ b/goldlib/gmb3/gmojamm2.cpp @@ -39,7 +39,7 @@ void JamArea::data_open() { wide = jamwide; data = jamdata + (jamdatano++); - data->fhjhr = data->fhjdt = data->fhjdx = data->fhjlr = -1; + data->fhjhr = data->fhjdt = data->fhjdx = data->fhjlr = data->fhjhw = -1; data->islocked = false; data->timesposted = 0; data->lastpos = 0; @@ -102,6 +102,9 @@ void JamArea::raw_open() { sprintf(file, "%s.jlr", path()); data->fhjlr = test_open(file); if(NOT just_scanning) { sprintf(file, "%s.jdt", path()); data->fhjdt = test_open(file); + if(not jamwide->smapihw) { + sprintf(file, "%s.cmhw", path()); data->fhjhw = ::sopen(file, O_RDWR|O_BINARY, WideSharemode, S_STDRW); + } } GFTRK(NULL); @@ -114,10 +117,11 @@ void JamArea::raw_close() { GFTRK("JamArea::raw_close"); - if(data->fhjlr != -1) ::close(data->fhjlr); data->fhjlr = -1; - if(data->fhjdx != -1) ::close(data->fhjdx); data->fhjdx = -1; - if(data->fhjdt != -1) ::close(data->fhjdt); data->fhjdt = -1; - if(data->fhjhr != -1) ::close(data->fhjhr); data->fhjhr = -1; + if(data->fhjlr != -1) { ::close(data->fhjlr); data->fhjlr = -1; } + if(data->fhjdx != -1) { ::close(data->fhjdx); data->fhjdx = -1; } + if(data->fhjdt != -1) { ::close(data->fhjdt); data->fhjdt = -1; } + if(data->fhjhr != -1) { ::close(data->fhjhr); data->fhjhr = -1; } + if(data->fhjhw != -1) { ::close(data->fhjhw); data->fhjhw = -1; } GFTRK(NULL); } @@ -136,6 +140,11 @@ void JamArea::open_area() { memset(&data->hdrinfo, 0, sizeof(JamHdrInfo)); read(data->fhjhr, &data->hdrinfo, sizeof(JamHdrInfo)); + if(not jamwide->smapihw and (data->fhjhw != -1)) + read(data->fhjhw, &data->highwater, sizeof(long)); + else + data->highwater = -1; + // Is the signature invalid? if(memcmp(data->hdrinfo.signature, JAM_SIGNATURE, 4)) { diff --git a/goldlib/gmb3/gmojamm4.cpp b/goldlib/gmb3/gmojamm4.cpp index 9240dc6..4660ac0 100644 --- a/goldlib/gmb3/gmojamm4.cpp +++ b/goldlib/gmb3/gmojamm4.cpp @@ -69,6 +69,19 @@ void JamArea::lock() { lseekset(data->fhjhr, 0); read(data->fhjhr, &data->hdrinfo, sizeof(JamHdrInfo)); + if(not jamwide->smapihw) { + if(data->fhjhw == -1) { + Path file; + sprintf(file, "%s.cmhw", path()); data->fhjhw = ::sopen(file, O_RDWR|O_BINARY, WideSharemode, S_STDRW); + } + if(data->fhjhw != -1) + read(data->fhjhw, &data->highwater, sizeof(long)); + else + data->highwater = -1; + } + else + data->highwater = -1; + GFTRK(NULL); } @@ -407,6 +420,18 @@ void JamArea::save_message(int __mode, gmsg* __msg, JamHdr& __hdr) { // Update internal array Msgn->Append(__msg->msgno); } + + // Adjust the highwatermark if required + if(jamwide->smapihw and __msg->attr.uns()) { + if(data->hdrinfo.highwatermark >= __msg->msgno) + data->hdrinfo.highwatermark = __msg->msgno - 1; + } + else if((data->highwater != -1) and (data->fhjhw != -1)) { + if(data->highwater >= __msg->msgno) { + data->highwater = __msg->msgno - 1; + write(data->fhjhw, &data->highwater, sizeof(long)); + } + } } else { scan(); diff --git a/goldlib/gmb3/gmojamm5.cpp b/goldlib/gmb3/gmojamm5.cpp index 16a426e..a676c2a 100644 --- a/goldlib/gmb3/gmojamm5.cpp +++ b/goldlib/gmb3/gmojamm5.cpp @@ -135,7 +135,12 @@ Line* JamArea::make_dump_msg(Line*& lin, gmsg* __msg, char* lng_head) { AddLineF(line, "ActiveMsgs : %lu", _base->activemsgs); AddLineF(line, "PasswordCRC : %08lXh", _base->passwordcrc); AddLineF(line, "BaseMsgNum : %lu", _base->basemsgnum); - AddLineF(line, "HighWaterMark : %lu", _base->highwatermark); + if(jamwide->smapihw) + AddLineF(line, "HighWaterMark : %lu", _base->highwatermark); + else if(data->highwater != -1) + AddLineF(line, "HighWaterMark : %lu", data->highwater); + else + AddLineF(line, "HighWaterMark : unknown"); line = AddLine(line, ""); AddLineF(line, "Subfields:"); line = AddLine(line, ""); diff --git a/goldlib/gmb3/gmoprot.h b/goldlib/gmb3/gmoprot.h index 2a81c9c..27fbd0e 100644 --- a/goldlib/gmb3/gmoprot.h +++ b/goldlib/gmb3/gmoprot.h @@ -72,7 +72,7 @@ void HGWarnRebuild(); // ------------------------------------------------------------------ -void JamInit(const char* jampath, int harddelete); +void JamInit(const char* jampath, int harddelete, int smapihw); void JamExit(); void JamWideOpen();