From 71cdfc6df1eac3e18bb99a3717c677a88851f079 Mon Sep 17 00:00:00 2001 From: ptt Date: Fri, 24 May 2002 17:44:39 +0000 Subject: boardfriend git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@200 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/bbs.c | 12 +++++------- mbbsd/board.c | 45 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 602e3bb4..bd37b7d7 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -1,4 +1,4 @@ -/* $Id: bbs.c,v 1.10 2002/05/16 21:54:56 in2 Exp $ */ +/* $Id: bbs.c,v 1.11 2002/05/24 17:44:39 ptt Exp $ */ #include #include #include @@ -271,8 +271,7 @@ static int do_select(int ent, fileheader_t *fhdr, char *direct) { outs(err_bid); return FULLUPDATE; } - - currutmp->brc_id = currbid; + setutmpbid(currbid); brc_initial(bname); set_board(); @@ -1865,7 +1864,7 @@ int Read() { more(buf, NA); pressanykey(); } - currutmp->brc_id = currbid; + setutmpbid(currbid); setbdir(buf, currboard); curredit &= ~EDIT_MAIL; i_read(READING, buf, readtitle, readdoent, read_comms, @@ -1874,8 +1873,7 @@ int Read() { log_board(currboard, now - usetime); #endif brc_update(); - - currutmp->brc_id =tmpbid; + setutmpbid(tmpbid); currutmp->mode = mode0; currstat = stat0; return 0; @@ -1889,7 +1887,7 @@ void ReadSelect() { currstat = XMODE; if(do_select(0, 0, genbuf) == NEWDIRECT) Read(); - currutmp->brc_id=0; + setutmpbid(0); currutmp->mode = mode0; currstat = stat0; } diff --git a/mbbsd/board.c b/mbbsd/board.c index e5996ec5..af0ee171 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -1,4 +1,4 @@ -/* $Id: board.c,v 1.9 2002/05/24 16:34:16 ptt Exp $ */ +/* $Id: board.c,v 1.10 2002/05/24 17:44:39 ptt Exp $ */ #include #include #include @@ -564,7 +564,7 @@ static void show_brdlist(int head, int clsflag, int newflag) { showtitle("看板列表", BBSName); prints("[←]主選單 [→]閱\讀 [↑↓]選擇 [y]載入 [S]排序 [/]搜尋 " "[TAB]文摘•看板 [h]求助\n" - "\033[7m%-20s 類別 轉信%-31s投票 板 主 \033[m", + "\033[7m%-20s 類別 轉信%-31s人氣 板 主 \033[m", newflag ? "總數 未讀 看 板" : " 編號 看 板", " 中 文 敘 述"); move(b_lines, 0); @@ -607,7 +607,7 @@ static void show_brdlist(int head, int clsflag, int newflag) { } if(class_bid != 1) { prints("%s%-13s\033[m%s%5.5s\033[0;37m%2.2s\033[m" - "%-35.35s%c %.13s", + "%-34.34s%3d%.13s", (ptr->myattr & BRD_FAV)?"\033[1;36m":"", ptr->bh->brdname, color[(unsigned int) @@ -615,7 +615,7 @@ static void show_brdlist(int head, int clsflag, int newflag) { ptr->bh->title[3] + ptr->bh->title[0]) & 07], ptr->bh->title, ptr->bh->title+5, ptr->bh->title+7, (ptr->bh->brdattr & BRD_BAD) ? 'X' : - " ARBCDEFGHI"[ptr->bh->bvote], + ptr->bh->nuser, ptr->bh->BM); refresh(); } else { @@ -672,6 +672,39 @@ static void dozap(int num){ if(!(ptr->myattr & BRD_ZAP) ) check_newpost(ptr); zapbuf[ptr->bid-1] = (ptr->myattr&BRD_ZAP?0:login_start_time); } + +void setutmpbid(int bid) +{ + int id=currutmp->brc_id; + userinfo_t *u; + if(id) + { + u=bcache[id-1].u; + if (brdshm->busystate!=1 && brdshm->busystate_b[id-1]!=1) + { + brdshm->busystate_b[id-1]=1; + for(u; u && u->nextbfriend != (void*)currutmp; u=u->nextbfriend); + if(u) + { + bcache[id-1].nuser--; + u->nextbfriend = currutmp->nextbfriend; + } + brdshm->busystate_b[id-1]=0; + } + } + if(bid) + { + bcache[bid-1].nuser++; + currutmp->nextbfriend=bcache[bid-1].u; + bcache[bid-1].u=(void*)currutmp; + } + else + { + currutmp->nextbfriend=0; + } + currutmp->brc_id=bid; +} + static void choose_board(int newflag) { static int num = 0; boardstat_t *ptr; @@ -1028,13 +1061,13 @@ static void choose_board(int newflag) { pressanykey(); } tmp=currutmp->brc_id; - currutmp->brc_id=ptr->bid; + setutmpbid(ptr->bid); free(nbrd); choose_board(0); currmode = currmodetmp; /* 離開版版後就把權限拿掉喔 */ num=tmp1; class_bid = bidtmp; - currutmp->brc_id=tmp; + setutmpbid(tmp); brdnum = -1; } } -- cgit v1.2.3