diff options
Diffstat (limited to 'mbbsd/bbs.c')
-rw-r--r-- | mbbsd/bbs.c | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 4343cccb..4f197b3e 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -15,13 +15,13 @@ mail_by_link(char *owner, char *title, char *path) char genbuf[200]; fileheader_t mymail; - sethomepath(genbuf, cuser->userid); + sethomepath(genbuf, cuser.userid); stampfile(genbuf, &mymail); strlcpy(mymail.owner, owner, sizeof(mymail.owner)); snprintf(mymail.title, sizeof(mymail.title), title); unlink(genbuf); Link(path, genbuf); - sethomedir(genbuf, cuser->userid); + sethomedir(genbuf, cuser.userid); append_record(genbuf, &mymail, sizeof(mymail)); } @@ -34,12 +34,12 @@ anticrosspost() snprintf(buf, sizeof(buf), "\033[1;33;46m%s \033[37;45mcross post 文章 \033[37m %s\033[m\n", - cuser->userid, ctime(&now)); + cuser.userid, ctime(&now)); log_file("etc/illegal_money", buf, 1); - post_violatelaw(cuser->userid, "Ptt系統警察", "Cross-post", "罰單處份"); - cuser->userlevel |= PERM_VIOLATELAW; - cuser->vl_count++; + post_violatelaw(cuser.userid, "Ptt系統警察", "Cross-post", "罰單處份"); + cuser.userlevel |= PERM_VIOLATELAW; + cuser.vl_count++; mail_by_link("Ptt警察部隊", "Cross-Post罰單", BBSHOME "/etc/crosspost.txt"); u_exit("Cross Post"); @@ -56,16 +56,16 @@ save_violatelaw() clear(); stand_title("繳罰單中心"); - if (!(cuser->userlevel & PERM_VIOLATELAW)) { + if (!(cuser.userlevel & PERM_VIOLATELAW)) { mprints(22, 0, "\033[1;31m你無聊啊? 你又沒有被開罰單~~\033[m"); pressanykey(); return 0; } reload_money(); - if (cuser->money < (int)cuser->vl_count * 1000) { + if (cuser.money < (int)cuser.vl_count * 1000) { snprintf(buf, sizeof(buf), "\033[1;31m這是你第 %d 次違反本站法規" "必須繳出 %d $Ptt ,你只有 %d 元, 錢不夠啦!!\033[m", - (int)cuser->vl_count, (int)cuser->vl_count * 1000, cuser->money); + (int)cuser.vl_count, (int)cuser.vl_count * 1000, cuser.money); mprints(22, 0, buf); pressanykey(); return 0; @@ -83,7 +83,7 @@ save_violatelaw() return 0; } snprintf(buf, sizeof(buf), "這是你第 %d 次違法 必須繳出 %d $Ptt", - cuser->vl_count, cuser->vl_count * 1000); + cuser.vl_count, cuser.vl_count * 1000); mprints(11, 0, buf); if (!getdata(10, 0, "要付錢[y/n]:", ok, sizeof(ok), LCECHO) || @@ -93,9 +93,9 @@ save_violatelaw() pressanykey(); return 0; } - demoney(-1000 * cuser->vl_count); - cuser->userlevel &= (~PERM_VIOLATELAW); - passwd_update(usernum, cuser); + demoney(-1000 * cuser.vl_count); + cuser.userlevel &= (~PERM_VIOLATELAW); + passwd_update(usernum, &cuser); return 0; } @@ -357,7 +357,7 @@ outgo_post(fileheader_t * fh, char *board) if ((foo = fopen("innd/out.bntp", "a"))) { fprintf(foo, "%s\t%s\t%s\t%s\t%s\n", board, - fh->filename, cuser->userid, cuser->username, fh->title); + fh->filename, cuser.userid, cuser.username, fh->title); fclose(foo); } } @@ -395,7 +395,7 @@ cancelpost(fileheader_t * fh, int by_BM, char *newpath) if ((fout = fopen("innd/cancel.bntp", "a"))) { fprintf(fout, "%s\t%s\t%s\t%s\t%s\n", currboard, fh->filename, - cuser->userid, nick, fh->title); + cuser.userid, nick, fh->title); fclose(fout); } fclose(fin); @@ -438,7 +438,7 @@ do_unanonymous_post(char *fpath) stampfile(genbuf, &mhdr); unlink(genbuf); Link(fpath, genbuf); - strlcpy(mhdr.owner, cuser->userid, sizeof(mhdr.owner)); + strlcpy(mhdr.owner, cuser.userid, sizeof(mhdr.owner)); strlcpy(mhdr.title, save_title, sizeof(mhdr.title)); mhdr.filemode = 0; setbdir(title, "UnAnonymous"); @@ -547,7 +547,7 @@ do_general(int isbid) if (!CheckPostPerm() #ifdef FOREIGN_REG // 不是外籍使用者在 PttForeign 板 - && !((cuser->uflag2 & FOREIGN) && strcmp(bp->brdname, "PttForeign") == 0) + && !((cuser.uflag2 & FOREIGN) && strcmp(bp->brdname, "PttForeign") == 0) #endif ) { vmsg("對不起,您目前無法在此發表文章!"); @@ -670,9 +670,9 @@ do_general(int isbid) owner = real_name; ifuseanony = 1; } else - owner = cuser->userid; + owner = cuser.userid; #else - owner = cuser->userid; + owner = cuser.userid; #endif /* 錢 */ aborted = (aborted > MAX_POST_MONEY * 2) ? MAX_POST_MONEY : aborted / 2; @@ -715,7 +715,7 @@ do_general(int isbid) aborted = (aborted > MAX_POST_MONEY) ? MAX_POST_MONEY : aborted; #endif if (strcmp(currboard, "Test") && !ifuseanony) { - prints("這是您的第 %d 篇文章。",++cuser->numposts); + prints("這是您的第 %d 篇文章。",++cuser.numposts); if(postfile.filemode&FILE_BID) prints("招標文章沒有稿酬。"); else if(currbrdattr&BRD_BAD) @@ -748,7 +748,7 @@ do_general(int isbid) unlink(genbuf); Link(fpath, genbuf); - strlcpy(postfile.owner, cuser->userid, sizeof(postfile.owner)); + strlcpy(postfile.owner, cuser.userid, sizeof(postfile.owner)); strlcpy(postfile.title, save_title, sizeof(postfile.title)); sethomedir(genbuf, quote_user); if (append_record(genbuf, &postfile, sizeof(postfile)) == -1) @@ -955,7 +955,7 @@ edit_post(int ent, fileheader_t * fhdr, char *direct) return DONOTHING; if( !HAS_PERM(PERM_SYSOP) && - (!CheckPostPerm() || strcmp(fhdr->owner, cuser->userid) != 0) ) + (!CheckPostPerm() || strcmp(fhdr->owner, cuser.userid) != 0) ) return DONOTHING; if( currmode & MODE_SELECT ) @@ -1060,7 +1060,7 @@ cross_post(int ent, fileheader_t * fhdr, char *direct) } ent = 1; - if (HAS_PERM(PERM_SYSOP) || !strcmp(fhdr->owner, cuser->userid)) { + if (HAS_PERM(PERM_SYSOP) || !strcmp(fhdr->owner, cuser.userid)) { getdata(2, 0, "(1)原文轉載 (2)舊轉錄格式?[1] ", genbuf, 3, DOECHO); if (genbuf[0] != '2') { @@ -1092,7 +1092,7 @@ cross_post(int ent, fileheader_t * fhdr, char *direct) if (author) strlcpy(xfile.owner, fhdr->owner, sizeof(xfile.owner)); else - strlcpy(xfile.owner, cuser->userid, sizeof(xfile.owner)); + strlcpy(xfile.owner, cuser.userid, sizeof(xfile.owner)); strlcpy(xfile.title, xtitle, sizeof(xfile.title)); if (genbuf[0] == 'l') { xfile.filemode = FILE_LOCAL; @@ -1120,7 +1120,7 @@ cross_post(int ent, fileheader_t * fhdr, char *direct) if (!xfile.filemode && !(bp->brdattr & BRD_NOTRAN)) outgo_post(&xfile, xboard); setbtotal(getbnum(xboard)); - cuser->numposts++; + cuser.numposts++; UPDATE_USEREC; outs("文章轉錄完成"); pressanykey(); @@ -1386,7 +1386,7 @@ hold_gamble(int ent, fileheader_t * fhdr, char *direct) move(8 + i, 0); prints("賭盤設定完成"); snprintf(genbuf, sizeof(genbuf), "[公告] %s 板 開始賭博!", currboard); - post_msg(currboard, genbuf, msg, cuser->userid); + post_msg(currboard, genbuf, msg, cuser.userid); post_msg("Record", genbuf + 7, msg, "[馬路探子]"); /* Tim 控制CS, 以免正在玩的user把資料已經寫進來 */ rename(fn_ticket_end, fn_ticket); @@ -1418,7 +1418,7 @@ edit_title(int ent, fileheader_t * fhdr, char *direct) fileheader_t tmpfhdr = *fhdr; int dirty = 0; - if (currmode & MODE_BOARD || !strcmp(cuser->userid, fhdr->owner)) { + if (currmode & MODE_BOARD || !strcmp(cuser.userid, fhdr->owner)) { if (getdata(b_lines - 1, 0, "標題:", genbuf, TTLEN, DOECHO)) { strlcpy(tmpfhdr.title, genbuf, sizeof(tmpfhdr.title)); dirty++; @@ -1434,7 +1434,7 @@ edit_title(int ent, fileheader_t * fhdr, char *direct) dirty++; } } - if (currmode & MODE_BOARD || !strcmp(cuser->userid, fhdr->owner)) { + if (currmode & MODE_BOARD || !strcmp(cuser.userid, fhdr->owner)) { getdata(b_lines - 1, 0, "確定(Y/N)?[n] ", genbuf, 3, DOECHO); if ((genbuf[0] == 'y' || genbuf[0] == 'Y') && dirty) { *fhdr = tmpfhdr; @@ -1574,13 +1574,13 @@ do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp, char *direct, struct t prints("起標價: %d", bidinfo.high); next=bidinfo.high; } - if(!strcmp(cuser->userid,bidinfo.userid)) + if(!strcmp(cuser.userid,bidinfo.userid)) { prints("你是最高得標者!"); pressanykey(); return FULLUPDATE; } - if (strcmp(cuser->userid, fhdr->owner) == 0){ + if (strcmp(cuser.userid, fhdr->owner) == 0){ vmsg("警告! 本人不能出價!"); return FULLUPDATE; } @@ -1603,7 +1603,7 @@ do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp, char *direct, struct t next=bidinfo.high + bidinfo.increment; - if(mymax< next || (bidinfo.payby==0 && cuser->money<mymax )) + if(mymax< next || (bidinfo.payby==0 && cuser.money<mymax )) { vmsg("取消下標或標金不足搶標"); return FULLUPDATE; @@ -1611,8 +1611,8 @@ do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp, char *direct, struct t snprintf(genbuf, sizeof(genbuf), "\033[1;31m→ \033[33m%s\033[m\033[33m:%s\033[m%*s %s%-15d標%15s %02d/%02d\n", - cuser->userid,say, - 31 - strlen(cuser->userid) - strlen(say), " ", + cuser.userid,say, + 31 - strlen(cuser.userid) - strlen(say), " ", money, next, fromhost, ptime->tm_mon + 1, ptime->tm_mday); @@ -1621,19 +1621,19 @@ do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp, char *direct, struct t { bidinfo.usermax=mymax; bidinfo.high=next; - strcpy(bidinfo.userid,cuser->userid); + strcpy(bidinfo.userid,cuser.userid); } else if(mymax>bidinfo.usermax) { bidinfo.high=bidinfo.usermax+bidinfo.increment; if(bidinfo.high>mymax) bidinfo.high=mymax; bidinfo.usermax=mymax; - strcpy(bidinfo.userid,cuser->userid); + strcpy(bidinfo.userid,cuser.userid); snprintf(genbuf, sizeof(genbuf), "\033[1;31m→ \033[33m自動競標%s勝出\033[m\033[33m\033[m%*s%s%-15d標 %02d/%02d\n", - cuser->userid, - 20 - strlen(cuser->userid) , " ",money, + cuser.userid, + 20 - strlen(cuser.userid) , " ",money, bidinfo.high, ptime->tm_mon + 1, ptime->tm_mday); do_add_recommend(direct, fhdr, ent, genbuf); @@ -1686,12 +1686,12 @@ recommend(int ent, fileheader_t * fhdr, char *direct) } setdirpath(path, direct, fhdr->filename); - if (fhdr->recommend == 0 && strcmp(cuser->userid, fhdr->owner) == 0){ + if (fhdr->recommend == 0 && strcmp(cuser.userid, fhdr->owner) == 0){ vmsg("警告! 本人不能推薦第一次!"); return FULLUPDATE; } #ifndef DEBUG - if (!(currmode & MODE_BOARD) && getuser(cuser->userid) && + if (!(currmode & MODE_BOARD) && getuser(cuser.userid) && now - lastrecommend < 40) { move(b_lines - 1, 0); prints("離上次推薦時間太近囉, 請多花點時間仔細閱\讀文章!"); @@ -1710,8 +1710,8 @@ recommend(int ent, fileheader_t * fhdr, char *direct) snprintf(buf, sizeof(buf), "\033[1;31m→ \033[33m%s\033[m\033[33m:%s\033[m%*s推%15s %02d/%02d\n", - cuser->userid, path, - 51 - strlen(cuser->userid) - strlen(path), " ", fromhost, + cuser.userid, path, + 51 - strlen(cuser.userid) - strlen(path), " ", fromhost, ptime->tm_mon + 1, ptime->tm_mday); do_add_recommend(direct, fhdr, ent, buf); #ifdef ASSESS @@ -1802,7 +1802,7 @@ del_range(int ent, fileheader_t *fhdr, char *direct) fileheader_t rsfh; int i = inum1, now; if (currstat == RMAIL) - sethomedir(genbuf, cuser->userid); + sethomedir(genbuf, cuser.userid); else setbdir(genbuf, currboard); if ((fd = (open(direct, O_RDONLY, 0))) != -1) { @@ -1856,10 +1856,10 @@ del_post(int ent, fileheader_t * fhdr, char *direct) (fhdr->owner[0] == '-')) return DONOTHING; - not_owned = strcmp(fhdr->owner, cuser->userid); + not_owned = strcmp(fhdr->owner, cuser.userid); if ((!(currmode & MODE_BOARD) && not_owned) || ((bp->brdattr & BRD_VOTEBOARD) && !HAS_PERM(PERM_SYSOP)) || - !strcmp(cuser->userid, STR_GUEST)) + !strcmp(cuser.userid, STR_GUEST)) return DONOTHING; getdata(1, 0, msg_del_ny, genbuf, 3, LCECHO); @@ -1923,7 +1923,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct) xuser.userlevel |= PERM_VIOLATELAW; } sprintf(genbuf,"劣文退回(%s):%-40.40s", reason, fhdr->title); - mail_id(xuser.userid, genbuf, newpath, cuser->userid); + mail_id(xuser.userid, genbuf, newpath, cuser.userid); } } #undef SIZE @@ -1936,14 +1936,14 @@ del_post(int ent, fileheader_t * fhdr, char *direct) deumoney(num, -fhdr->money); } if (!not_owned && strcmp(currboard, "Test")) { - if (cuser->numposts) - cuser->numposts--; + if (cuser.numposts) + cuser.numposts--; if (!(currmode & MODE_DIGEST && currmode & MODE_BOARD)){ move(b_lines - 1, 0); clrtoeol(); demoney(-fhdr->money); prints("%s,您的文章減為 %d 篇,支付清潔費 %d 銀", msg_del_ok, - cuser->numposts, fhdr->money); + cuser.numposts, fhdr->money); refresh(); pressanykey(); } @@ -2030,7 +2030,7 @@ tar_addqueue(int ent, fileheader_t * fhdr, char *direct) return FULLUPDATE; } fp = fopen(qfn, "w"); - fprintf(fp, "%s\n", cuser->userid); + fprintf(fp, "%s\n", cuser.userid); fprintf(fp, "%s\n", email); fprintf(fp, "%d,%d\n", bakboard, bakman); fclose(fp); @@ -2272,11 +2272,11 @@ board_select() char genbuf[100]; currmode &= ~MODE_SELECT; - snprintf(fpath, sizeof(fpath), "SR.%s", cuser->userid); + snprintf(fpath, sizeof(fpath), "SR.%s", cuser.userid); setbfile(genbuf, currboard, fpath); unlink(genbuf); if (currstat == RMAIL) - sethomedir(currdirect, cuser->userid); + sethomedir(currdirect, cuser.userid); else setbdir(currdirect, currboard); return NEWDIRECT; @@ -2718,7 +2718,7 @@ log_board(char *mode, time_t usetime) if (usetime > 30) { snprintf(buf, sizeof(buf), "USE %-20.20s Stay: %5ld (%s) %s\n", - mode, usetime, cuser->userid, ctime(&now)); + mode, usetime, cuser.userid, ctime(&now)); log_file(FN_USEBOARD, buf, 1); } } |