summaryrefslogtreecommitdiffstats
path: root/mbbsd/board.c
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-26 09:12:48 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-26 09:12:48 +0800
commit963fef9b70263e62d5e693b5609890a3cec7e31e (patch)
tree479f7dd02af60ea4afa858a8e98369129da5f48c /mbbsd/board.c
parent8c775648395ae91a9e5d81b6da3ca713085cc321 (diff)
downloadpttbbs-963fef9b70263e62d5e693b5609890a3cec7e31e.tar
pttbbs-963fef9b70263e62d5e693b5609890a3cec7e31e.tar.gz
pttbbs-963fef9b70263e62d5e693b5609890a3cec7e31e.tar.bz2
pttbbs-963fef9b70263e62d5e693b5609890a3cec7e31e.tar.lz
pttbbs-963fef9b70263e62d5e693b5609890a3cec7e31e.tar.xz
pttbbs-963fef9b70263e62d5e693b5609890a3cec7e31e.tar.zst
pttbbs-963fef9b70263e62d5e693b5609890a3cec7e31e.zip
re-format, board friend
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@350 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/board.c')
-rw-r--r--mbbsd/board.c68
1 files changed, 33 insertions, 35 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c
index 1d19f36b..9b6130b7 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -1,4 +1,4 @@
-/* $Id: board.c,v 1.36 2002/06/19 13:23:54 lwms Exp $ */
+/* $Id: board.c,v 1.37 2002/06/26 01:12:48 in2 Exp $ */
#include "bbs.h"
#define BRC_STRLEN 15 /* Length of board name */
#define BRC_MAXSIZE 24576
@@ -393,7 +393,7 @@ static boardstat_t * addnewbrdstat(int n, int state)
return ptr;
}
-static int cmpboardname(const void *brd, const void *tmp)
+static int cmpboardfriends(const void *brd, const void *tmp)
{
return ((boardstat_t *)tmp)->bh->nuser - ((boardstat_t *)brd)->bh->nuser;
}
@@ -411,40 +411,38 @@ static void load_boards(char *key) {
load_uidofgid(class_bid,type);
}
brdnum = 0;
- if(class_bid<=0)
- {
- nbrd = (boardstat_t *)malloc(numboards * sizeof(boardstat_t));
- for(i=0 ; i < numboards; i++)
- {
- if( (bptr = SHM->bsorted[type][i]) == NULL )
- continue;
- n = (int)( bptr - bcache);
- if(!bptr->brdname[0] || bptr->brdattr & BRD_GROUPBOARD ||
- !((state = Ben_Perm(bptr)) || (currmode & MODE_MENU)) ||
- (yank_flag == 0 && !(favbuf[n]&BRD_FAV)) ||
- (yank_flag == 1 && !zapbuf[n]) ||
- (key[0] && !strcasestr(bptr->title, key)) ||
- (class_bid==-1 && bptr->nuser<5)
- ) continue;
- addnewbrdstat(n, state);
- if(class_bid==-1)
- qsort(nbrd, brdnum, sizeof(boardstat_t), cmpboardname);
+ if(class_bid<=0){
+ nbrd = (boardstat_t *)malloc(numboards * sizeof(boardstat_t));
+ for(i=0 ; i < numboards; i++){
+ if( (bptr = SHM->bsorted[type][i]) == NULL )
+ continue;
+ n = (int)(bptr - bcache);
+ if( !bptr->brdname[0] || bptr->brdattr & BRD_GROUPBOARD ||
+ !((state = Ben_Perm(bptr)) || (currmode & MODE_MENU)) ||
+ (yank_flag == 0 && !(favbuf[n] & BRD_FAV)) ||
+ (yank_flag == 1 && !zapbuf[n]) ||
+ (key[0] && !strcasestr(bptr->title, key)) ||
+ (class_bid == -1 && bptr->nuser < 5) )
+ continue;
+ addnewbrdstat(n, state);
+
+ if( class_bid == -1 )
+ qsort(nbrd, brdnum, sizeof(boardstat_t), cmpboardfriends);
}
- }
- else
- {
- nbrd = (boardstat_t *)malloc( bptr->childcount * sizeof(boardstat_t));
- for(bptr=bptr->firstchild[type]; bptr!=(boardheader_t *)~0;
- bptr=bptr->next[type])
- {
- n = (int)( bptr - bcache);
- if(!((state = Ben_Perm(bptr)) || (currmode & MODE_MENU))
- ||(yank_flag == 0 && !(favbuf[n]&BRD_FAV))
- ||(yank_flag == 1 && !zapbuf[n]) ||
- (key[0] && !strcasestr(bptr->title, key))) continue;
- addnewbrdstat(n, state);
- }
- }
+ }
+ else{
+ nbrd = (boardstat_t *)malloc(bptr->childcount * sizeof(boardstat_t));
+ for(bptr=bptr->firstchild[type]; bptr!=(boardheader_t *)~0;
+ bptr=bptr->next[type]) {
+ n = (int)( bptr - bcache);
+ if(!((state = Ben_Perm(bptr)) || (currmode & MODE_MENU))
+ ||(yank_flag == 0 && !(favbuf[n] & BRD_FAV))
+ ||(yank_flag == 1 && !zapbuf[n]) ||
+ (key[0] && !strcasestr(bptr->title, key)))
+ continue;
+ addnewbrdstat(n, state);
+ }
+ }
}
static int search_board() {