Hopefully last fix to Arealistsort

This commit is contained in:
Alexander S. Aganichev 2001-12-27 10:30:14 +00:00
parent 34270a36bb
commit 4ec345818b
2 changed files with 72 additions and 46 deletions

View File

@ -12,8 +12,14 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/ Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________ ______________________________________________________________________
- Fixed arealist sorting so the TYUE in AREALISTSORT will not cause ! AREALISTSORT letters a bit changed in the way they processed:
ugly screen when AREASEP is used. P - sort by personal mail count, not by the presence
Y - sort by changing from last scan (the same criteria as used for
'*' in AREALIST screen) with ignoring unread mail count
Also there's a new change to the AREASEP sorting: all letters that
could not be applied to the AREASEP (f.e. Y) are ignored during
sorting and finally AREASEP winning if no explicit criteria found in
the AREALISTSORT specification.
+ Added ability to READ packed messagebases. You need to add PKD + Added ability to READ packed messagebases. You need to add PKD
attribute to such echo definition and specify UNPACKER for the attribute to such echo definition and specify UNPACKER for the
@ -36,6 +42,9 @@ ______________________________________________________________________
This feature is not supported for Hudson and GoldBase messagebases. This feature is not supported for Hudson and GoldBase messagebases.
IMPORTANT: AREADEF should contain pathname to the archive WITH
extension!
! AREAPATH now used as default path for all SEMAPHOREs rather than ! AREAPATH now used as default path for all SEMAPHOREs rather than
occasionally. occasionally.

View File

@ -56,12 +56,16 @@ int AreaTypeOrder[17] = {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Areagroups compare // Areagroups compare
int compare_groups(int ga, int gb) int compare_groups(int _ga, int _gb)
{ {
char *gap, *gbp; char *gap, *gbp;
register int ga = _ga ? _ga : INT_MAX;
register int gb = _gb ? _gb : INT_MAX;
if((ga > 0xff) || (gb > 0xff)) if((ga > 0xff) || (gb > 0xff))
return compare_two(ga, gb); return compare_two(ga, gb);
gap = strchr(CFG->arealistgrouporder, (char)ga); gap = strchr(CFG->arealistgrouporder, (char)ga);
gbp = strchr(CFG->arealistgrouporder, (char)gb); gbp = strchr(CFG->arealistgrouporder, (char)gb);
if(gap == NULL) { if(gap == NULL) {
@ -89,8 +93,6 @@ extern "C" int AreaListCmp(const Area** __a, const Area** __b) {
const Area* A = a; const Area* A = a;
const Area* B = b; const Area* B = b;
int cmp = 0; int cmp = 0;
int aunread;
int bunread;
bool rev = false; bool rev = false;
char* ptr = AL.sortspec; char* ptr = AL.sortspec;
@ -106,10 +108,14 @@ extern "C" int AreaListCmp(const Area** __a, const Area** __b) {
A = a; B = b; A = a; B = b;
break; break;
case 'A': case 'A':
if(a->isseparator() or b->isseparator())
break;
if((cmp = A->aka().compare(B->aka())) != 0) if((cmp = A->aka().compare(B->aka())) != 0)
return cmp; return cmp;
break; break;
case 'B': case 'B':
if(a->isseparator() or b->isseparator())
break;
if((cmp = compare_two(A->board(), B->board())) != 0) if((cmp = compare_two(A->board(), B->board())) != 0)
return cmp; return cmp;
break; break;
@ -123,34 +129,35 @@ extern "C" int AreaListCmp(const Area** __a, const Area** __b) {
break; break;
case 'F': case 'F':
if(*area_maybe) { if(*area_maybe) {
if(striinc(area_maybe, A->echoid()) and not striinc(area_maybe, B->echoid())) register bool amay = striinc(area_maybe, A->echoid()) ? true : false;
return -1; register bool bmay = striinc(area_maybe, B->echoid()) ? true : false;
if(striinc(area_maybe, B->echoid()) and not striinc(area_maybe, A->echoid()))
return 1; if((cmp = compare_two(amay, bmay)) != 0)
return cmp;
} }
break; break;
case 'G': case 'G':
{ if((cmp = compare_groups(A->groupid(), B->groupid())) != 0)
register int ga = A->groupid(); return cmp;
register int gb = B->groupid();
if((cmp = compare_groups(ga ? ga : INT_MAX, gb ? gb : INT_MAX)) != 0)
return cmp;
if(strpbrk(ptr+1, "tT") != NULL)
break;
if((cmp = compare_two(b->isseparator(), a->isseparator())) != 0)
return cmp;
}
break; break;
case 'M': case 'M':
if(A->ismarked() and not B->ismarked()) if(a->isseparator() or b->isseparator())
return -1; break;
if(B->ismarked() and not A->ismarked()) if((cmp = compare_two(A->ismarked(), B->ismarked())) != 0)
return 1; return cmp;
break; break;
case 'P': case 'P':
if((cmp = compare_two(B->PMrk.Count()?1:0, A->PMrk.Count()?1:0)) != 0) if(a->isseparator() or b->isseparator())
return cmp; break;
else {
register int aunread = A->PMrk.Count();
register int bunread = B->PMrk.Count();
aunread = (rev or aunread) ? aunread : INT_MAX;
bunread = (rev or bunread) ? bunread : INT_MAX;
if((cmp = compare_two(aunread, bunread)) != 0)
return cmp;
}
break; break;
case 'O': case 'O':
if((cmp = compare_two(A->areaid(), B->areaid())) != 0) if((cmp = compare_two(A->areaid(), B->areaid())) != 0)
@ -159,41 +166,51 @@ extern "C" int AreaListCmp(const Area** __a, const Area** __b) {
case 'T': case 'T':
if((cmp = compare_two(CFG->areatypeorder[A->type()&0xFF], CFG->areatypeorder[B->type()&0xFF])) != 0) if((cmp = compare_two(CFG->areatypeorder[A->type()&0xFF], CFG->areatypeorder[B->type()&0xFF])) != 0)
return cmp; return cmp;
if(strpbrk(ptr+1, "gG") != NULL)
break;
if((cmp = compare_two(b->isseparator(), a->isseparator())) != 0)
return cmp;
break; break;
case 'U': case 'U':
aunread = A->Msgn.Count() - A->lastread(); if(a->isseparator() or b->isseparator())
bunread = B->Msgn.Count() - B->lastread(); break;
if(rev) else {
cmp = compare_two(aunread, bunread); register int aunread = A->unread;
else register int bunread = B->unread;
cmp = compare_two(aunread ? aunread : INT_MAX, bunread ? bunread : INT_MAX);
if(cmp != 0) aunread = (rev or aunread) ? aunread : INT_MAX;
return cmp; bunread = (rev or bunread) ? bunread : INT_MAX;
if((cmp = compare_two(aunread, bunread)) != 0)
return cmp;
}
break; break;
case 'X': case 'X':
if((cmp = compare_two(A->msgbase(), A->msgbase())) != 0) if(a->isseparator() or b->isseparator())
break;
if((cmp = compare_two(A->msgbase(), B->msgbase())) != 0)
return cmp; return cmp;
break; break;
case 'Y': case 'Y':
aunread = A->Msgn.Count() - A->lastread(); if(a->isseparator() or b->isseparator())
bunread = B->Msgn.Count() - B->lastread(); break;
if(aunread and not bunread) else {
return -1; register bool anew = A->isvalidchg and A->isunreadchg;
if(bunread and not aunread) register bool bnew = B->isvalidchg and B->isunreadchg;
return 1;
// New mail _first_
if((cmp = compare_two(bnew, anew)) != 0)
return cmp;
}
break; break;
case 'Z': case 'Z':
if((cmp = stricmp(A->path(), B->path())) != 0) if(a->isseparator() or b->isseparator())
break;
else if((cmp = stricmp(A->path(), B->path())) != 0)
return cmp; return cmp;
break; break;
} }
ptr++; ptr++;
} }
if(cmp == 0)
return compare_two(b->isseparator(), a->isseparator());
return cmp; return cmp;
} }