diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2012-04-02 14:35:18 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2012-04-02 14:35:18 +0800 |
commit | 9daff7e4c7e0320a163e0e4a3c7f142c1394afd4 (patch) | |
tree | 96af6067d1b51f4cff4ea90c58345f2cb3c585d4 | |
parent | ebf6f1476fa16f7bdf572939ef6b8c525fce6382 (diff) | |
download | pttbbs-9daff7e4c7e0320a163e0e4a3c7f142c1394afd4.tar pttbbs-9daff7e4c7e0320a163e0e4a3c7f142c1394afd4.tar.gz pttbbs-9daff7e4c7e0320a163e0e4a3c7f142c1394afd4.tar.bz2 pttbbs-9daff7e4c7e0320a163e0e4a3c7f142c1394afd4.tar.lz pttbbs-9daff7e4c7e0320a163e0e4a3c7f142c1394afd4.tar.xz pttbbs-9daff7e4c7e0320a163e0e4a3c7f142c1394afd4.tar.zst pttbbs-9daff7e4c7e0320a163e0e4a3c7f142c1394afd4.zip |
refine aloha/alohaed (simply replace hard-coded string by macros)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5590 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/include/common.h | 4 | ||||
-rw-r--r-- | pttbbs/mbbsd/friend.c | 14 | ||||
-rw-r--r-- | pttbbs/mbbsd/mail.c | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/mbbsd.c | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/var.c | 4 |
5 files changed, 14 insertions, 12 deletions
diff --git a/pttbbs/include/common.h b/pttbbs/include/common.h index 8a875cf7..8787f20a 100644 --- a/pttbbs/include/common.h +++ b/pttbbs/include/common.h @@ -26,6 +26,8 @@ #define FN_BANNED_HISTORY "banned.history" // 新水桶之歷史記錄 #define FN_CANVOTE "can_vote" #define FN_VISABLE "visable" // 不知道是誰拼錯的,將錯就錯吧... +#define FN_ALOHAED "alohaed" // 上站要通知我的名單 (編輯用) +#define FN_ALOHA "aloha" // 我上站要通知的名單 (自動產生) #define FN_USIES "usies" /* BBS log */ #define FN_DIR ".DIR" #define FN_BOARD ".BRD" /* board list */ @@ -299,7 +301,7 @@ #define __toSTR(x) #x #define char_lower(c) ((c >= 'A' && c <= 'Z') ? c|32 : c) -#define LOG_IF(x, y) { if (x) { y; } else {} } +#define LOG_IF(x, y) { if ((x)) { y; } else {} } #endif diff --git a/pttbbs/mbbsd/friend.c b/pttbbs/mbbsd/friend.c index 6827f7b6..fdbba9e7 100644 --- a/pttbbs/mbbsd/friend.c +++ b/pttbbs/mbbsd/friend.c @@ -40,7 +40,7 @@ static char * const friend_list[8] = { "好友名單", "壞人名單", "上線通知", - "新文章通知", + "", "其它特別名單", "私人投票名單", "看板舊水桶名單", @@ -139,7 +139,7 @@ friend_append(int type, int count) move(2, 0); clrtobot(); outs("要引入哪一個名單?\n"); - for (j = i = 0; i <= 4; i++) + for (j = i = 0; i < 4; i++) if (i != type) { ++j; prints(" (%d) %-s\n", j, friend_list[(int)i]); @@ -329,7 +329,7 @@ delete_user_friend(const char *uident, const char *thefriend, int type GCC_UNUSE // some stupid user simply set themselves and caused recursion here. if (strcasecmp(uident, thefriend) == 0) return; - sethomefile(fn, uident, "aloha"); + sethomefile(fn, uident, FN_ALOHA); delete_friend_from_file(fn, thefriend, 0); } @@ -595,7 +595,7 @@ friend_edit(int type) if ((fp = fopen(genbuf, "r"))) { while (fgets(line, sizeof(line), fp)) { sscanf(line, "%" toSTR(IDLEN) "s", uident); - sethomefile(genbuf, uident, "aloha"); + sethomefile(genbuf, uident, FN_ALOHA); del_distinct(genbuf, cuser.userid, 0); } fclose(fp); @@ -604,7 +604,7 @@ friend_edit(int type) if ((fp = fopen(genbuf, "r"))) { while (fgets(line, 80, fp)) { sscanf(line, "%" toSTR(IDLEN) "s", uident); - sethomefile(genbuf, uident, "aloha"); + sethomefile(genbuf, uident, FN_ALOHA); add_distinct(genbuf, cuser.userid); } fclose(fp); @@ -678,7 +678,7 @@ t_fix_aloha() outs("檢查中...\n"); // xid in my override list? - setuserfile(fn, "alohaed"); + setuserfile(fn, FN_ALOHAED); if (file_exist_record(fn, xid)) { prints(ANSI_COLOR(1;32) "[%s] 確實在你的上站通知名單內。" @@ -687,7 +687,7 @@ t_fix_aloha() return 0; } - sethomefile(fn, xid, "aloha"); + sethomefile(fn, xid, FN_ALOHA); if (delete_friend_from_file(fn, cuser.userid, 0)) { outs(ANSI_COLOR(1;33) "已找到錯誤並修復完成。" ANSI_RESET "\n"); diff --git a/pttbbs/mbbsd/mail.c b/pttbbs/mbbsd/mail.c index c8ab10c5..df76faf3 100644 --- a/pttbbs/mbbsd/mail.c +++ b/pttbbs/mbbsd/mail.c @@ -913,7 +913,7 @@ multi_list(struct Vector *namelist, int *recipient) ToggleVector(namelist, recipient, genbuf, msg_cc); break; case 'o': - setuserfile(genbuf, "alohaed"); + setuserfile(genbuf, FN_ALOHAED); ToggleVector(namelist, recipient, genbuf, msg_cc); break; case 'q': diff --git a/pttbbs/mbbsd/mbbsd.c b/pttbbs/mbbsd/mbbsd.c index 6da70921..12ad2d8b 100644 --- a/pttbbs/mbbsd/mbbsd.c +++ b/pttbbs/mbbsd/mbbsd.c @@ -1457,7 +1457,7 @@ do_aloha(const char *hello) char userid[80]; char genbuf[200]; - setuserfile(genbuf, "aloha"); + setuserfile(genbuf, FN_ALOHA); if ((fp = fopen(genbuf, "r"))) { while (fgets(userid, 80, fp)) { userinfo_t *uentp; diff --git a/pttbbs/mbbsd/var.c b/pttbbs/mbbsd/var.c index 497f03e0..9f9a7ea4 100644 --- a/pttbbs/mbbsd/var.c +++ b/pttbbs/mbbsd/var.c @@ -417,8 +417,8 @@ const char * const bw_chess[] = {"○", "●", "。", "•"}; char *friend_file[8] = { FN_OVERRIDES, FN_REJECT, - "alohaed", - "postlist", + FN_ALOHAED + "", /* deprecated: post list */ "", /* may point to other filename */ FN_CANVOTE, FN_WATER, |