Random fixes

This commit is contained in:
Alexander S. Aganichev
2002-11-09 21:08:34 +00:00
parent a39960cd13
commit 428385bc1e
14 changed files with 102 additions and 30 deletions

View File

@@ -60,22 +60,28 @@ void FidoArea::raw_scan(bool __scanpm) {
register ulong* _msgndx = Msgn->tag;
gposixdir d(real_path());
if(WideDebug)
WideLog->printf("- %s/*.msg", d.fullpath());
const gdirentry *de;
while((de = d.nextentry("*.msg", true)) != NULL) {
if(d.ok) {
if(WideDebug)
WideLog->printf("- %s", de->name.c_str());
register ulong _msgno = (ulong)atol(de->name.c_str());
if(_msgno) {
if((_active % FIDO_SCANBUFSIZE) == 0) {
_msgndx = Msgn->Resize(_active+FIDO_SCANBUFSIZE);
_msgnoptr = _msgndx + _active;
WideLog->printf("- %s/*.msg", d.fullpath());
const gdirentry *de;
while((de = d.nextentry("*.msg", true)) != NULL) {
if(WideDebug)
WideLog->printf("- %s", de->name.c_str());
register ulong _msgno = (ulong)atol(de->name.c_str());
if(_msgno) {
if((_active % FIDO_SCANBUFSIZE) == 0) {
_msgndx = Msgn->Resize(_active+FIDO_SCANBUFSIZE);
_msgnoptr = _msgndx + _active;
}
*_msgnoptr++ = _msgno;
_active++;
}
*_msgnoptr++ = _msgno;
_active++;
}
}
else {
if(WideDebug)
WideLog->printf("- Invalid path: %s", real_path());
}
// Sort the index
Msgn->SetCount(_active);

View File

@@ -343,6 +343,11 @@ extern JamData* jamdata;
extern int jamdatano;
// ------------------------------------------------------------------
char *jamstrlwr(char *str);
// ------------------------------------------------------------------
#endif

View File

@@ -67,7 +67,7 @@ void JamInit(const char* jampath, int harddelete, int jamsmapihw) {
// Calculate CRC32 of our username for the lastreads
INam _name;
strlwr(strcpy(_name, WideUsername[0]));
jamstrlwr(strcpy(_name, WideUsername[0]));
jamwide->userid = jamwide->usercrc = strCrc32(_name, NO, CRC32_MASK_CCITT);
// Enable replies lookahead feature
@@ -216,3 +216,15 @@ void JamArea::resume() {
// ------------------------------------------------------------------
char *jamstrlwr(char *str) {
char *p = str;
while(*p) {
if((*p >= 'A') && (*p <= 'Z'))
*p = *p - 'A' + 'a';
++p;
}
return str;
}
// ------------------------------------------------------------------

View File

@@ -287,7 +287,7 @@ void JamArea::raw_scan(int __keep_index, int __scanpm) {
int umax = (WidePersonalmail & PM_ALLNAMES) ? WideUsernames : 1;
dword* ucrc = (dword*)throw_calloc(umax, sizeof(dword));
for(int uc=0; uc<umax; uc++) {
strlwr(strcpy(uname, WideUsername[uc]));
jamstrlwr(strcpy(uname, WideUsername[uc]));
ucrc[uc] = strCrc32(uname, NO, CRC32_MASK_CCITT);
}
PMrk->ResetAll();

View File

@@ -324,9 +324,9 @@ void JamArea::save_message(int __mode, gmsg* __msg, JamHdr& __hdr) {
__hdr.timesread = __msg->timesread;
__hdr.passwordcrc = 0xFFFFFFFFL;
__hdr.msgidcrc = strCrc32(strlwr(strcpy(_buf, __msg->msgids)), NO, CRC32_MASK_CCITT);
__hdr.replycrc = strCrc32(strlwr(strcpy(_buf, __msg->replys)), NO, CRC32_MASK_CCITT);
_idx.usercrc = strCrc32(strlwr(strcpy(_buf, __msg->to)), NO, CRC32_MASK_CCITT);
__hdr.msgidcrc = strCrc32(jamstrlwr(strcpy(_buf, __msg->msgids)), NO, CRC32_MASK_CCITT);
__hdr.replycrc = strCrc32(jamstrlwr(strcpy(_buf, __msg->replys)), NO, CRC32_MASK_CCITT);
_idx.usercrc = strCrc32(jamstrlwr(strcpy(_buf, __msg->to)), NO, CRC32_MASK_CCITT);
__hdr.datewritten = __msg->written;
__hdr.datereceived = __msg->received;

View File

@@ -222,8 +222,24 @@ void SquishArea::raw_scan(int __keep_index, int __scanpm) {
for(int u=0; u<umax; u++) {
if((idx->hash & 0x80000000LU) == 0) {
if(idx->hash == uhash[u]) {
gotpm = true;
break;
// Open, read and close data file
if(not isopen)
data->fhsqd = ::sopen(AddPath(real_path(), ".sqd"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD);
if(data->fhsqd != -1) {
lseekset(data->fhsqd, idx->offset + sizeof(SqshFrm));
// Load the message header
SqshHdr __hdr;
memset(&__hdr, 0, sizeof(SqshHdr));
read(data->fhsqd, &__hdr, sizeof(SqshHdr));
if(not isopen) {
::close(data->fhsqd);
data->fhsqd = -1;
}
if(streql(__hdr.to, WideUsername[u])) {
gotpm = true;
break;
}
}
}
}
}