Fixes, added highwater support for Jam
This commit is contained in:
@@ -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(); }
|
||||
|
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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)) {
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -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, "");
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user