summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-05-02 21:22:09 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-05-02 21:22:09 +0800
commit071a67366207fd12a90d4848fa129646e2fa98a9 (patch)
treec48770feb02ee9c9bfe130d67e0cdba961bbab2d
parente150b4eea55036c3c8686badf6140d845255e4c6 (diff)
downloadpttbbs-071a67366207fd12a90d4848fa129646e2fa98a9.tar
pttbbs-071a67366207fd12a90d4848fa129646e2fa98a9.tar.gz
pttbbs-071a67366207fd12a90d4848fa129646e2fa98a9.tar.bz2
pttbbs-071a67366207fd12a90d4848fa129646e2fa98a9.tar.lz
pttbbs-071a67366207fd12a90d4848fa129646e2fa98a9.tar.xz
pttbbs-071a67366207fd12a90d4848fa129646e2fa98a9.tar.zst
pttbbs-071a67366207fd12a90d4848fa129646e2fa98a9.zip
implement favchange
fix Ctrl('D') git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@819 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/board.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c
index 131c9e8e..2dba2da1 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -1,4 +1,4 @@
-/* $Id: board.c,v 1.125 2003/04/15 09:31:46 in2 Exp $ */
+/* $Id: board.c,v 1.126 2003/05/02 13:22:09 victor Exp $ */
#include "bbs.h"
#define BRC_STRLEN 15 /* Length of board name */
#define BRC_MAXSIZE 24576
@@ -287,6 +287,7 @@ void movefav(int old, int new)
int i, src = -1, des = -1;
fav_board_t tmp;
+ favchange = 1;
for(i = 0; i < fav->nDatas; i++){
if(nbrd[old].bid == fav->b[i].bid)
@@ -332,6 +333,9 @@ void setfav(short bid, char attr, char mode, time_t t)
{
/* mode: 0: 設成 off, 1: 設成 on, 2: 反相 */
fav_board_t *ptr = getfav(bid);
+
+ favchange = 1;
+
if( ptr != NULL ){
if( mode == 2 )
ptr->attr ^= attr;
@@ -506,11 +510,10 @@ save_brdbuf(void)
char fname[80];
if( !fav )
return;
- /*
- favchange is not implement yet
- if( !favchange )
- return;
- */
+
+ if( !favchange )
+ return;
+
#ifdef MEM_CHECK
if( fav->memcheck != MEM_CHECK )
return;
@@ -527,7 +530,7 @@ save_brdbuf(void)
}
fav->nDatas = w;
setuserfile(fname, FAV3);
- if( (fd = open(fname, O_WRONLY | O_CREAT, 0600)) != -1 ){
+ if( (fd = open(fname, O_WRONLY | O_CREAT | O_TRUNC, 0600)) != -1 ){
int i;
write(fd, &fav->nDatas, sizeof(short));
write(fd, &fav->nLines, sizeof(char));
@@ -1136,7 +1139,6 @@ choose_board(int newflag)
break;
case 't':
ptr = &nbrd[num];
- favchange = 1;
setfav(ptr->bid, BRD_TAG, 2, 0);
ptr->myattr ^= BRD_TAG;
head = 9999;
@@ -1197,6 +1199,7 @@ choose_board(int newflag)
}
else
cuser.uflag ^= BRDSORT_FLAG;
+ favchange = 1;
brdnum = -1;
break;
case 'y':
@@ -1209,7 +1212,6 @@ choose_board(int newflag)
favchange = 1;
fav->b[tmp].attr &= ~BRD_FAV;
fav->b[tmp].attr &= ~BRD_TAG;
- fav->nDatas--;
}
}
brdnum = -1;
@@ -1264,7 +1266,6 @@ choose_board(int newflag)
setfav(0, BRD_FAV | BRD_LINE, 1, 0);
nbrd[brdnum].bid = fav->nLines;
movefav(brdnum, num);
- favchange = 1;
brdnum = -1;
head = 9999;
}
@@ -1283,14 +1284,12 @@ choose_board(int newflag)
setfav(nbrd[num].bid, BRD_FAV, 2, 0);
nbrd[num].myattr ^= BRD_FAV;
}
- favchange = 1;
head = 9999;
}
break;
case 'M':
if (HAS_PERM(PERM_BASIC)) {
imovefav(num);
- favchange = 1;
head = 9999;
}
break;
@@ -1378,11 +1377,9 @@ choose_board(int newflag)
brc_initial(B_BH(ptr)->brdname);
if (ch == 'v') {
ptr->myattr &= ~BRD_UNREAD;
- favchange = 1;
brc_list[0] = now;
setfav(ptr->bid, 0, 0, now);
} else {
- favchange = 1;
brc_list[0] = 1;
setfav(ptr->bid, 0, 0, 1);
ptr->myattr |= BRD_UNREAD;