diff options
Diffstat (limited to 'mbbsd/talk.c')
-rw-r--r-- | mbbsd/talk.c | 51 |
1 files changed, 16 insertions, 35 deletions
diff --git a/mbbsd/talk.c b/mbbsd/talk.c index d667fb0a..8c0c2ec3 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -58,7 +58,7 @@ iswritable_stat(userinfo_t * uentp, int fri_stat) int isvisible_stat(userinfo_t * me, userinfo_t * uentp, int fri_stat) { - if (uentp->userid[0] == 0) + if (!uentp || uentp->userid[0] == 0) return 0; if (PERM_HIDE(uentp) && !(PERM_HIDE(me))) /* 對方紫色隱形而你沒有 */ @@ -512,7 +512,7 @@ my_write2(void) which = 0; do { - switch ((ch = igetkey())) { + switch ((ch = igetch())) { case Ctrl('T'): case KEY_UP: if (water_usies != 1) { @@ -592,9 +592,7 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) strlcpy(destid, id, sizeof(destid)); if (!uin && !(flag == 0 && water_which->count > 0)) { - outmsg("\033[1;33;41m糟糕! 對方已落跑了(不在站上)! \033[37m~>_<~\033[m"); - clrtoeol(); - refresh(); + vmsg("糟糕! 對方已落跑了(不在站上)! "); watermode = -1; return 0; } @@ -608,9 +606,6 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) /* 一般水球 */ watermode = 0; if (!(len = getdata(0, 0, prompt, msg, 56, DOECHO))) { - outmsg("\033[1;33;42m算了! 放你一馬...\033[m"); - clrtoeol(); - refresh(); currutmp->chatid[0] = c0; currutmp->mode = mode0; currstat = currstat0; @@ -635,9 +630,6 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) snprintf(buf, sizeof(buf), "丟給 %s : %s [Y/n]?", uin->userid, msg); getdata(0, 0, buf, genbuf, 3, LCECHO); if (genbuf[0] == 'n') { - outmsg("\033[1;33;42m算了! 放你一馬...\033[m"); - clrtoeol(); - refresh(); currutmp->chatid[0] = c0; currutmp->mode = mode0; currstat = currstat0; @@ -647,9 +639,7 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) } watermode = -1; if (!uin || !*uin->userid || strcasecmp(destid, uin->userid)) { - outmsg("\033[1;33;41m糟糕! 對方已落跑了(不在站上)! \033[37m~>_<~\033[m"); - clrtoeol(); - refresh(); + vmsg("糟糕! 對方已落跑了(不在站上)! "); currutmp->chatid[0] = c0; currutmp->mode = mode0; currstat = currstat0; @@ -712,7 +702,6 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) } clrtoeol(); - refresh(); currutmp->chatid[0] = c0; currutmp->mode = mode0; @@ -1055,7 +1044,7 @@ do_talk(int fd) add_io(fd, 0); while (1) { - ch = igetkey(); + ch = igetch(); if (ch == I_OTHERDATA) { datac = recv(fd, data, sizeof(data), 0); if (datac <= 0) @@ -1765,7 +1754,6 @@ draw_pickup(int drawall, pickup_t * pickup, int pickup_way, "%-2d\033[m\n", msg_pickup_way[pickup_way], SHM->UTMPnumber, myfriend, friendme, currutmp->brc_id ? (bfriend + 1) : 0, badfriend); - for (i = 0, ch = page * nPickups + 1; i < nPickups; ++i, ++ch) { move(i + 3, 0); prints("a"); @@ -1854,7 +1842,7 @@ draw_pickup(int drawall, pickup_t * pickup, int pickup_way, #endif ); - refresh(); + //refresh(); } } @@ -1965,7 +1953,7 @@ userlist(void) case 'H': if (HAS_PERM(PERM_SYSOP)) { - currutmp->userlevel ^= PERM_DENYPOST; + currutmp->userlevel ^= PERM_SYSOPHIDE; redrawall = redraw = 1; } break; @@ -2308,7 +2296,7 @@ userlist(void) case 'g': if (HAS_PERM(PERM_LOGINOK) && strcmp(uentp->userid, cuser.userid) != 0) { - char genbuf[128]; + char genbuf[10]; move(b_lines - 2, 0); prints("要給 %s 多少錢呢? ", uentp->userid); if (getdata(b_lines - 1, 0, "[銀行轉帳]: ", @@ -2318,8 +2306,8 @@ userlist(void) redrawall = redraw = 1; break; } - sprintf(genbuf, "確定要給 %s %d Ptt 幣嗎? [N/y]", uentp->userid, ch); - if (getans(genbuf) != 'y'){ + if (getans("確定要給 %s %d Ptt 幣嗎? [N/y]", + uentp->userid, ch) != 'y'){ redrawall = redraw = 1; break; } @@ -2329,19 +2317,16 @@ userlist(void) outs("\033[41m 現金不足~~\033[m"); } else { deumoney(uentp->uid, ch - give_tax(ch)); - prints("\033[44m 嗯..還剩下 %d 錢.." - "\033[m", demoney(-ch)); - snprintf(genbuf, sizeof(genbuf), - "%s\t給%s\t%d\t%s\n", cuser.userid, - uentp->userid, ch, - ctime(&currutmp->lastact)); - log_file(FN_MONEY, genbuf, 1); + log_file(FN_MONEY, 1, + "%s\t給%s\t%d\t%s\n", cuser.userid, + uentp->userid, ch, ctime(&currutmp->lastact)); mail_redenvelop(cuser.userid, uentp->userid, ch - give_tax(ch), 'Y'); + vmsg(" 嗯..還剩下 %d 錢..", demoney(-ch)); } } else { clrtoeol(); - outs("\033[41m 交易取消! \033[m"); + vmsg(" 交易取消! "); } redrawall = redraw = 1; } @@ -2398,12 +2383,9 @@ userlist(void) cuser.uflag2 -= tmp; tmp = (tmp + 1) % 3; cuser.uflag2 |= tmp; - move(4, 0); - prints("系統提供 一般 進階 未來 三種模式\n" + vmsg("系統提供 一般 進階 未來 三種模式\n" "在切換後請正常下線再重新登入, 以確保結構正確\n" "目前切換到 %s 水球模式\n", wm[tmp]); - refresh(); - sleep(2); redrawall = redraw = 1; } break; @@ -2617,7 +2599,6 @@ talkreply(void) char genbuf[200]; int a, sig = currutmp->sig; - talkrequest = NA; uip = &SHM->uinfo[currutmp->destuip]; snprintf(page_requestor, sizeof(page_requestor), "%s (%s)", uip->userid, uip->username); |