Added archived echoes support

This commit is contained in:
Alexander S. Aganichev
2001-12-17 15:44:55 +00:00
parent f8a2159f0a
commit 4d4f620053
23 changed files with 265 additions and 17 deletions

View File

@@ -115,14 +115,15 @@ const gdirentry *gposixdir::nextentry(const char *mask, bool nameonly)
}
ret.name = entries[last_entry];
ret.dirname = dirname.c_str();
std::string pn = ret.dirname;
pn += "/";
pn += ret.name;
size_t skipfrom;
while((skipfrom=pn.find("//")) != pn.npos)
pn.erase(skipfrom, 1);
if(!nameonly)
if(!nameonly) {
std::string pn = ret.dirname;
pn += "/";
pn += ret.name;
size_t skipfrom;
while((skipfrom=pn.find("//")) != pn.npos)
pn.erase(skipfrom, 1);
stat(pn.c_str(), &ret.stat_info);
}
++last_entry;
return &ret;
}

View File

@@ -81,6 +81,8 @@ void ftn_attr::add(const ftn_attr& b) {
if(b.nok()) nok1();
if(b.fax()) fax1();
if(b.prn()) prn1();
if(b.pkd()) pkd1();
}
@@ -188,6 +190,7 @@ void ftn_attr::get(const std::string& __s) {
if(striinc("NOK", s)) nok1();
if(striinc("FAX", s)) fax1();
if(striinc("PRN", s)) prn1();
if(striinc("PKD", s)) pkd1();
}

View File

@@ -114,6 +114,8 @@ const ulong GATTR_FWD = 0x02000000UL; // forwarded (wildcat)
const ulong GATTR_EFL = 0x04000000UL; // echoflag (wildcat)
const ulong GATTR_HRP = 0x08000000UL; // has replies (wildcat)
const ulong GATTR_PKD = 0x10000000UL; // Archived
class ftn_attr {
protected:
@@ -219,6 +221,8 @@ public:
int efl() const { return (attr2 & GATTR_EFL) != 0; }
int hrp() const { return (attr2 & GATTR_HRP) != 0; }
int pkd() const { return (attr2 & GATTR_PKD) != 0; }
// ----------------------------------------------------------------
void pvt(ulong x) { if(x) attr1 |= GATTR_PVT; else attr1 &= ~GATTR_PVT; }
@@ -296,6 +300,8 @@ public:
void efl(ulong x) { if(x) attr2 |= GATTR_EFL; else attr2 &= ~GATTR_EFL; }
void hrp(ulong x) { if(x) attr2 |= GATTR_HRP; else attr2 &= ~GATTR_HRP; }
void pkd(ulong x) { if(x) attr2 |= GATTR_PKD; else attr2 &= ~GATTR_PKD; }
// -------------------------------------------------------------
void pvt0() { attr1 &= ~GATTR_PVT; }
@@ -414,6 +420,8 @@ public:
void prn1() { attr2 |= GATTR_PRN; }
void pkd1() { attr2 |= GATTR_PKD; }
// ----------------------------------------------------------------
void pvtX() { attr1 ^= GATTR_PVT; }

View File

@@ -86,6 +86,7 @@ public:
const ftn_addr& aka() const { return cfg.aka; }
int originno() const { return cfg.originno; }
Attr& attr() { return cfg.attr; }
bool ispacked() const { return cfg.attr.pkd(); }
bool ascan() { return (bool)cfg.scan; }
bool ascanexcl() { return (bool)cfg.scanexcl; }
@@ -185,6 +186,11 @@ public:
virtual void set_highwater_mark() { }
virtual void reset_highwater_mark() { }
protected:
Path realpath;
const char* real_path() const { return ispacked() ? realpath : path(); }
void set_real_path(const char* newpath) { strxcpy(realpath, newpath, sizeof(Path)); }
};
@@ -281,6 +287,8 @@ extern int WidePersonalmail;
// ------------------------------------------------------------------
int PopupLocked(long __tries, int __isopen, const char* __file);
const char* Unpack(const char* archive);
void CleanUnpacked(const char* unpacked);
// ------------------------------------------------------------------

View File

@@ -338,6 +338,12 @@ void EzycomArea::open() {
TestErrorExit();
}
if(isopen == 1) {
if(ispacked()) {
isopen--;
const char* newpath = Unpack(path());
set_real_path(newpath ? newpath : path());
isopen++;
}
data_open();
test_raw_open(__LINE__);
scan();
@@ -390,6 +396,9 @@ void EzycomArea::close() {
raw_close();
Msgn->Reset();
data_close();
if(ispacked()) {
CleanUnpacked(real_path());
}
}
isopen--;
}

View File

@@ -170,6 +170,12 @@ void FidoArea::open() {
TestErrorExit();
}
if(isopen == 1) {
if(ispacked()) {
isopen--;
const char* newpath = Unpack(path());
set_real_path(newpath ? newpath : path());
isopen++;
}
data_open();
scan();
}
@@ -207,6 +213,9 @@ void FidoArea::close() {
save_lastread();
Msgn->Reset();
data_close();
if(ispacked()) {
CleanUnpacked(real_path());
}
}
isopen--;
}

View File

@@ -93,6 +93,12 @@ void JamArea::open() {
TestErrorExit();
}
if(isopen == 1) {
if(ispacked()) {
isopen--;
const char* newpath = Unpack(path());
set_real_path(newpath ? newpath : path());
isopen++;
}
data_open();
open_area();
scan();
@@ -161,6 +167,9 @@ void JamArea::close() {
raw_close();
Msgn->Reset();
data_close();
if(ispacked()) {
CleanUnpacked(real_path());
}
}
isopen--;
}

View File

@@ -181,6 +181,12 @@ void PcbArea::open() {
TestErrorExit();
}
if(isopen == 1) {
if(ispacked()) {
isopen--;
const char* newpath = Unpack(path());
set_real_path(newpath ? newpath : path());
isopen++;
}
PcbWideOpen();
data_open();
raw_open();
@@ -237,6 +243,9 @@ void PcbArea::close() {
Msgn->Reset();
data_close();
PcbWideClose();
if(ispacked()) {
CleanUnpacked(real_path());
}
}
isopen--;
}

View File

@@ -93,6 +93,12 @@ void SMBArea::open() {
TestErrorExit();
}
if(isopen == 1) {
if(ispacked()) {
isopen--;
const char* newpath = Unpack(path());
set_real_path(newpath ? newpath : path());
isopen++;
}
data_open();
int _tries = 0;
@@ -150,6 +156,9 @@ void SMBArea::close()
if(isopen == 1) {
smb_close(data);
data_close();
if(ispacked()) {
CleanUnpacked(real_path());
}
}
isopen--;
}

View File

@@ -162,8 +162,8 @@ void SquishArea::raw_open() {
GFTRK("SquishRawOpen");
data->fhsqd = test_open(AddPath(path(), ".sqd"));
data->fhsqi = test_open(AddPath(path(), ".sqi"));
data->fhsqd = test_open(AddPath(real_path(), ".sqd"));
data->fhsqi = test_open(AddPath(real_path(), ".sqi"));
GFTRK(NULL);
}
@@ -186,6 +186,12 @@ void SquishArea::open() {
TestErrorExit();
}
if(isopen == 1) {
if(ispacked()) {
isopen--;
const char* newpath = Unpack(path());
set_real_path(newpath ? newpath : path());
isopen++;
}
data_open();
raw_open();
refresh();
@@ -202,7 +208,7 @@ void SquishArea::save_lastread() {
GFTRK("SquishSaveLastread");
int _fh = ::sopen(AddPath(path(), ".sql"), O_RDWR|O_CREAT|O_BINARY, WideSharemode, S_STDRW);
int _fh = ::sopen(AddPath(real_path(), ".sql"), O_RDWR|O_CREAT|O_BINARY, WideSharemode, S_STDRW);
if(_fh != -1) {
lseekset(_fh, wide->userno, sizeof(dword));
dword _lastread = Msgn->CvtReln(lastread);
@@ -227,6 +233,9 @@ void SquishArea::close() {
Msgn->Reset();
throw_xrelease(data->idx);
data_close();
if(ispacked()) {
CleanUnpacked(real_path());
}
}
isopen--;
}

View File

@@ -45,7 +45,7 @@ void SquishArea::refresh() {
SqshBase& _base = data->base;
memset(&_base, 0, sizeof(SqshBase));
_base.size = sizeof(SqshBase);
strxcpy(_base.name, path(), sizeof(_base.name));
strxcpy(_base.name, real_path(), sizeof(_base.name));
_base.endframe = _base.size;
_base.framesize = sizeof(SqshFrm);
_base.nextmsgno = 2;
@@ -85,7 +85,7 @@ void SquishArea::raw_scan(int __keep_index, int __scanpm) {
// Load the lastread
dword _lastread = 0;
int _fh = ::sopen(AddPath(path(), ".sql"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD);
int _fh = ::sopen(AddPath(real_path(), ".sql"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD);
if(_fh != -1) {
lseekset(_fh, wide->userno, sizeof(dword));
read(_fh, &_lastread, sizeof(dword));
@@ -99,7 +99,7 @@ void SquishArea::raw_scan(int __keep_index, int __scanpm) {
data->base.totalmsgs = 0;
// Open index file
data->fhsqi = ::sopen(AddPath(path(), ".sqi"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD);
data->fhsqi = ::sopen(AddPath(real_path(), ".sqi"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD);
if(data->fhsqi != -1) {
// Get the number of index records
@@ -111,7 +111,7 @@ void SquishArea::raw_scan(int __keep_index, int __scanpm) {
if((data->base.totalmsgs == 1) or (wide->squishscan == SQS_API)) {
// Open, read and close data file
data->fhsqd = ::sopen(AddPath(path(), ".sqd"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD);
data->fhsqd = ::sopen(AddPath(real_path(), ".sqd"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD);
if(data->fhsqd != -1) {
read(data->fhsqd, &data->base, sizeof(SqshBase));
::close(data->fhsqd);

View File

@@ -46,11 +46,11 @@ void SquishArea::lock() {
if(WideCanLock) {
long _tries = 0;
while(::lock(data->fhsqd, 0, 1) == -1) {
if(PopupLocked(++_tries, true, path()) == false) {
if(PopupLocked(++_tries, true, real_path()) == false) {
WideLog->ErrLock();
raw_close();
WideLog->printf("! A Squish msgbase file could not be locked.");
WideLog->printf(": %s.SQD.", path());
WideLog->printf(": %s.sqd.", real_path());
WideLog->ErrOSInfo();
LockErrorExit();
}

View File

@@ -154,6 +154,12 @@ void WCatArea::open() {
TestErrorExit();
}
if(isopen == 1) {
if(ispacked()) {
isopen--;
const char* newpath = Unpack(path());
set_real_path(newpath ? newpath : path());
isopen++;
}
data_open();
raw_open();
refresh();
@@ -195,6 +201,9 @@ void WCatArea::close() {
Msgn->Reset();
throw_release(data->idx);
data_close();
if(ispacked()) {
CleanUnpacked(real_path());
}
}
isopen--;
}

View File

@@ -198,6 +198,12 @@ void XbbsArea::open() {
TestErrorExit();
}
if(isopen == 1) {
if(ispacked()) {
isopen--;
const char* newpath = Unpack(path());
set_real_path(newpath ? newpath : path());
isopen++;
}
data_open();
raw_open();
refresh();
@@ -239,6 +245,9 @@ void XbbsArea::close() {
Msgn->Reset();
throw_release(data->idx);
data_close();
if(ispacked()) {
CleanUnpacked(real_path());
}
}
isopen--;
}