diff options
-rw-r--r-- | include/proto.h | 1 | ||||
-rw-r--r-- | mbbsd/bbs.c | 26 | ||||
-rw-r--r-- | mbbsd/board.c | 12 | ||||
-rw-r--r-- | mbbsd/mail.c | 15 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 22 | ||||
-rw-r--r-- | mbbsd/talk.c | 18 |
6 files changed, 70 insertions, 24 deletions
diff --git a/include/proto.h b/include/proto.h index 8dc9e27f..bc4a2b08 100644 --- a/include/proto.h +++ b/include/proto.h @@ -704,6 +704,7 @@ int isvisible_uid(int tuid); int friend_stat(const userinfo_t *me, const userinfo_t * ui); int call_in(const userinfo_t *uentp, int fri_stat); int make_connection_to_somebody(userinfo_t *uin, int timeout); +int query_online(const char *userid); #ifdef PLAY_ANGEL int t_changeangel(void); int t_angelmsg(void); diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 38cabddd..51f45a54 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -302,7 +302,6 @@ readdoent(int num, fileheader_t * ent) int type; char *mark, *title, color, special = 0, isonline = 0, recom[8]; - userinfo_t *uentp; type = brc_unread(currbid, ent->filename) ? '+' : ' '; if ((currmode & MODE_BOARD) && (ent->filemode & FILE_DIGEST)) type = (type == ' ') ? '*' : '#'; @@ -349,16 +348,9 @@ readdoent(int num, fileheader_t * ent) if (!strncmp(title, "[公告]", 6)) special = 1; -#if 1 - if (!strchr(ent->owner, '.') && !SHM->GV2.e.noonlineuser && - (uentp = search_ulist_userid(ent->owner)) && isvisible(currutmp, uentp)) - isonline = 1; -#else - if (!strchr(ent->owner, '.') && (uid = searchuser(ent->owner, NULL)) && - !SHM->GV2.e.noonlineuser && - (uentp = search_ulist(uid)) && isvisible(currutmp, uentp)) - isonline = 1; -#endif + + isonline = query_online(ent->owner); + if(ent->recommend>99) strcpy(recom,"1m爆"); else if(ent->recommend>9) @@ -1147,7 +1139,7 @@ invalid_brdname(const char *brd) return rv; } -static int +int b_call_in(int ent, const fileheader_t * fhdr, const char *direct) { userinfo_t *u = search_ulist(searchuser(fhdr->owner, NULL)); @@ -2318,6 +2310,7 @@ recommend(int ent, fileheader_t * fhdr, const char *direct) } #ifndef DEBUG + // 下面這什麼鬼,麻煩好心人把它拆出去 if ( !((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP)) && (cuser.firstlogin > (now - (time4_t)bcache[currbid - 1].post_limit_regtime * 2592000) || cuser.badpost > (255 - (unsigned int)(bcache[currbid - 1].post_limit_badpost)) || @@ -2387,12 +2380,13 @@ recommend(int ent, fileheader_t * fhdr, const char *direct) move(b_lines, 0); clrtoeol(); - if (fhdr->recommend == 0 && strcmp(cuser.userid, fhdr->owner) == 0) + if (strcmp(cuser.userid, fhdr->owner) == 0) { - // owner recomment first time + // owner recomment + // no matter it is first time or not. type = 2; move(b_lines-1, 0); clrtoeol(); - outs("本人推薦第一次, 使用 → 加註方式\n"); + outs("作者本人, 使用 → 加註方式\n"); } #ifndef DEBUG else if (!(currmode & MODE_BOARD) && @@ -2407,7 +2401,7 @@ recommend(int ent, fileheader_t * fhdr, const char *direct) // too close type = 2; move(b_lines-1, 0); clrtoeol(); - outs("推薦時間太近, 使用 → 加註方式\n"); + outs("時間太近, 使用 → 加註方式\n"); } #endif diff --git a/mbbsd/board.c b/mbbsd/board.c index 90482d17..51e46819 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -606,7 +606,17 @@ show_brdlist(int head, int clsflag, int newflag) char *unread[2] = {ANSI_COLOR(37) " " ANSI_RESET, ANSI_COLOR(1;31) "ˇ" ANSI_RESET}; if (IS_LISTING_FAV() && brdnum == 1 && get_fav_type(&nbrd[0]) == 0) { - mouts(3, 0, " --- 空目錄 - 請按 a (add) 或 i (insert) 加入看板 ---"); + + // (a) or (i) needs HasUserPerm(PERM_LOGINOK)). + if (!HasUserPerm(PERM_LOGINOK)) + { + mouts(10, 0, + "--- 抱歉,註冊完成的使用者才能新增看板喔 (可按 s 手動選取) ---"); + } else { + // normal user. tell him what to do. + mouts(10, 0, + "--- 空目錄,請按 a 新增或用 y 列出全部看板後按 z 增刪 ---"); + } return; } diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 49d66859..a34eea30 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -954,6 +954,7 @@ maildoent(int num, fileheader_t * ent) { char *title, *mark, *color = NULL, type = ' '; char datepart[6]; + char isonline = 0; if (ent->filemode & FILE_MARKED) { @@ -985,6 +986,8 @@ maildoent(int num, fileheader_t * ent) strlcpy(datepart, ent->date, sizeof(datepart)); + isonline = query_online(ent->owner); + switch(showmail_mode) { case SHOWMAIL_SUM: @@ -1027,8 +1030,12 @@ maildoent(int num, fileheader_t * ent) color = ""; } - prints("%6d %c %-6s%-15.14s%s %s%-*.*s%s\n", - num, type, datepart, ent->owner, mark, color, + prints("%6d %c %-6s%s%-15.14s%s%s %s%-*.*s%s\n", + num, type, datepart, + isonline ? ANSI_COLOR(1) : "", + ent->owner, + isonline ? ANSI_RESET : "", + mark, color, t_columns - 34, t_columns - 34, title, *color ? ANSI_RESET : ""); @@ -1060,6 +1067,8 @@ mail_del(int ent, const fileheader_t * fhdr, const char *direct) return READ_REDRAW; } +int b_call_in(int ent, const fileheader_t * fhdr, const char *direct); + static int mail_read(int ent, fileheader_t * fhdr, const char *direct) { @@ -1632,7 +1641,7 @@ static const onekey_t mail_comms[] = { { 0, NULL }, // 'u' #endif { 0, NULL }, // 'v' - { 0, NULL }, // 'w' + { 1, b_call_in }, // 'w' { 1, m_forward }, // 'x' { 1, multi_reply }, // 'y' { 0, mail_man }, // 'z' 122 diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 8bceabc9..31cf0bc7 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -257,8 +257,17 @@ abort_bbs_debug(int sig) sigaddset(&sigset, SIGXCPU); sigprocmask(SIG_UNBLOCK, &sigset, NULL); -#define CRASH_MSG ANSI_COLOR(0) "\r\n程式異常, 立刻斷線. 請洽 PttBug 板詳述你發生的問題.\r\n" -#define XCPU_MSG ANSI_COLOR(0) "\r\n程式耗用過多計算資源, 立刻斷線. 可能是 (a)執行太多耗用資源的動作 或 (b)程式掉入無窮迴圈. 請洽 PttBug 板詳述你發生的問題.\r\n" + // TODO change the PttBug to some other names for non-PTT sites? + +#define CRASH_MSG ANSI_COLOR(0) \ + "\r\n程式異常, 立刻斷線. \r\n" \ + "請洽 PttBug 板詳述問題發生經過。\r\n" + +#define XCPU_MSG ANSI_COLOR(0) \ + "\r\n程式耗用過多計算資源, 立刻斷線。\r\n" \ + "可能是 (a)執行太多耗用資源的動作 或 (b)程式掉入無窮迴圈. "\ + "請洽 PttBug 板詳述問題發生經過。\r\n" + if(sig==SIGXCPU) write(1, XCPU_MSG, sizeof(XCPU_MSG)); else @@ -684,8 +693,13 @@ login_query(void) move(19, 0); prints("current pid: %d ", getpid()); #endif - getdata(20, 0, "請輸入代號,或以[guest]參觀,以[new]註冊:", - uid, sizeof(uid), DOECHO); + while (getdata(20, 0, "請輸入代號,或以[guest]參觀,以[new]註冊:", + uid, sizeof(uid), DOECHO) < 1) + { + // got nothing + outs("請重新輸入。\n"); + } + #ifdef CONVERT /* switch to gb mode if uid end with '.' */ len = strlen(uid); diff --git a/mbbsd/talk.c b/mbbsd/talk.c index 50be465c..d7eccb6a 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -82,6 +82,24 @@ isvisible_stat(const userinfo_t * me, const userinfo_t * uentp, int fri_stat) return !(fri_stat & HRM); } +int query_online(const char *userid) +{ + userinfo_t *uentp; + + if (!userid || !*userid || *userid == '-') + return 0; + + if (strchr(userid, '.') || SHM->GV2.e.noonlineuser) + return 0; + + uentp = search_ulist_userid(userid); + + if (!uentp ||!isvisible(currutmp, uentp)) + return 0; + + return 1; +} + const char * modestring(const userinfo_t * uentp, int simple) { |