作者hawkes.bbs@bbs.wretch.cc (浩克) 看板: itoc
標題Re: 請問版友停留時間
時間無名小站 (2008/03/01 Sat 10:28:27)
因為原來的版本好像是舊的,所以試著去改一下,
可以在新的版本跑
: board.c:mantime_add()
//因為新版好像是呼叫這個函式來做,所以就只改這個函式
if (outbno >= 0)
+ {
bshm->mantime[outbno]--; /* 退出上一個板 */
+ brd_usies(currbno, 0);
+ }
if (inbno >= 0)
+ {
bshm->mantime[inbno]++; /* 進入新的板 */
+ brd_usies(inbno, 1);
+ }
: board.c:XoPost()
if (currbno >= 0)
+ {
bshm->mantime[currbno]--; /* 退出上一個板 */
+ brd_usies(currbno, 0);
+ }
bshm->mantime[bno]++; /* 進入新的板 */
+ brd_usies(bno, 1);
: board.c:brd_usies() 新增此函式在 XoPost() 前面
void
brd_usies(bno, in)
int bno;
int in;
{
static time_t start;
time_t now;
char fpath[64], buf[80];
if (in) /* 進入看板,開始計算時間 */
{
time(&start);
}
else /* 離開看板,結算時間 */
{
time(&now);
brd_fpath(fpath, (bshm->bcache + bno)->brdname, "board_usies");
sprintf(buf, "%s %s 停留%d秒", cuser.userid, Btime(&now), now - start);
f_cat(fpath, buf);
}
}
//再來下面這一段是我接精華區的"板主觀看該看板的閱讀記錄"
: manage.c:post_usies() 新增函式於 post_manage() 前面
static int
post_usies(xo)
XO *xo;
{
char fpath[64];
brd_fpath(fpath, currboard, "usies");
if (more(fpath, (char *) -1) >= 0 &&
vans("請問是否刪除這些看板閱讀記錄(Y/N)?[N] ") == 'y')
unlink(fpath);
return XO_HEAD;
}
: manage.c:post_manage()
"Manager 增減副板主",
+ "Usies 觀察看板閱\讀記錄",
...
...
- char *menu = "◎ 板主選單 (B)主題 (W)進板 (M)副板"
+ char *menu = "◎ 板主選單 (B)主題 (W)進板 (M)副板 (U)記錄"
...
...
case 'm':
return post_changeBM(xo);
+ case 'u':
+ return post_usies(xo);
: expire.c:main()
do
{
bname = brdp->brdname;
if (!*bname)
continue;
+ {
+ struct tm *ptime;
+ time_t now;
+ time(&now);
+ ptime = localtime(&now);
+ if (ptime->tm_wday == 0) /* 每週一砍 usies */
+ {
+ sprintf(buf, "%s/%s", bname, "usies");
+ unlink(buf);
+ }
+ }
//make之後就出現
gcc -DBSD44 -O2 -pipe -fomit-frame-pointer -Wunused -I../include -c board.c
board.c:798: error: conflicting types for 'brd_usies'
board.c:783: error: previous implicit declaration of 'brd_usies' was here
*** Error code 1
Stop in /home/bbs/src/maple.
*** Error code 1
Stop in /home/bbs/src/maple.
用了一整晚了,還是找不到哪裡有問題,請版上的大大幫我解決一下,謝謝~~
--
夫兵者不祥之器物或惡之故有道者不處君子居則貴左用兵則貴右兵者不祥之器非君子
之器不得已而用之恬淡為上勝而不美而美之者是樂殺人夫樂殺人者則不可得志於天下
矣吉事尚左凶事尚右偏將軍居左上將軍居右言以喪禮處之殺人之眾以哀悲泣之戰勝以
喪禮處之道常無名樸雖小天下莫能臣侯王若能守之萬物將自賓天地相合以降甘露民莫
之令而自均始制有名名亦既有夫亦將知止知止可以不殆譬道之在天61.230.219.226海