diff options
-rw-r--r-- | pttbbs/include/pttstruct.h | 1 | ||||
-rw-r--r-- | pttbbs/mbbsd/io.c | 1 | ||||
-rw-r--r-- | pttbbs/mbbsd/mbbsd.c | 16 | ||||
-rw-r--r-- | pttbbs/mbbsd/talk.c | 31 |
4 files changed, 30 insertions, 19 deletions
diff --git a/pttbbs/include/pttstruct.h b/pttbbs/include/pttstruct.h index 597a8b83..2af6d7e1 100644 --- a/pttbbs/include/pttstruct.h +++ b/pttbbs/include/pttstruct.h @@ -310,6 +310,7 @@ typedef struct fileheader_t { /* 128 bytes */ #define MSGMODE_WRITE 1 #define MSGMODE_FROMANGEL 2 #define MSGMODE_TOANGEL 3 +#define MSGMODE_ALOHA 4 typedef struct msgque_t { pid_t pid; diff --git a/pttbbs/mbbsd/io.c b/pttbbs/mbbsd/io.c index a67eea55..a3c2934a 100644 --- a/pttbbs/mbbsd/io.c +++ b/pttbbs/mbbsd/io.c @@ -236,6 +236,7 @@ process_pager_keys(int ch) switch (currutmp->msgs[0].msgmode) { case MSGMODE_TALK: case MSGMODE_WRITE: + case MSGMODE_ALOHA: my_write(currutmp->msgs[0].pid, "水球丟過去: ", currutmp->msgs[0].userid, WATERBALL_GENERAL, NULL); break; diff --git a/pttbbs/mbbsd/mbbsd.c b/pttbbs/mbbsd/mbbsd.c index 354ee39c..5047d0ac 100644 --- a/pttbbs/mbbsd/mbbsd.c +++ b/pttbbs/mbbsd/mbbsd.c @@ -17,7 +17,7 @@ #define SOCKET_QLEN 4 -static void do_aloha(const char *hello); +void do_aloha(const char *hello); static void getremotename(const struct in_addr from, char *rhost); ////////////////////////////////////////////////////////////////// @@ -397,9 +397,11 @@ talk_request(int sig GCC_UNUSED) void show_call_in(int save, int which) { - char buf[200]; + char buf[200]; + int mode = currutmp->msgs[which].msgmode; + #ifdef PLAY_ANGEL - if (currutmp->msgs[which].msgmode == MSGMODE_TOANGEL) + if (mode == MSGMODE_TOANGEL) snprintf(buf, sizeof(buf), ANSI_COLOR(1;37;46) "★%s" ANSI_COLOR(37;45) " %s " ANSI_RESET, currutmp->msgs[which].userid, @@ -411,7 +413,7 @@ show_call_in(int save, int which) currutmp->msgs[which].last_call_in); outmsg(buf); - if (save) { + if (save && mode != MSGMODE_ALOHA) { char genbuf[200]; if (!fp_writelog) { sethomefile(genbuf, cuser.userid, fn_writelog); @@ -1359,7 +1361,7 @@ user_login(void) } } -static void +void do_aloha(const char *hello) { FILE *fp; @@ -1370,10 +1372,12 @@ do_aloha(const char *hello) if ((fp = fopen(genbuf, "r"))) { while (fgets(userid, 80, fp)) { userinfo_t *uentp; + chomp(userid); if ((uentp = (userinfo_t *) search_ulist_userid(userid)) && isvisible(uentp, currutmp) && strcasecmp(uentp->userid, cuser.userid) != 0) { - my_write(uentp->pid, hello, uentp->userid, WATERBALL_ALOHA, uentp); + my_write(uentp->pid, hello, uentp->userid, WATERBALL_ALOHA, + uentp); } } fclose(fp); diff --git a/pttbbs/mbbsd/talk.c b/pttbbs/mbbsd/talk.c index 76c09f4b..02cda2d8 100644 --- a/pttbbs/mbbsd/talk.c +++ b/pttbbs/mbbsd/talk.c @@ -687,10 +687,7 @@ my_write2(void) SOLVE_ANSI_CACHE(); outs(ANSI_RESET); clrtoeol(); -#ifndef PLAY_ANGEL - snprintf(genbuf, sizeof(genbuf), "攻擊 %s:", tw->userid); - i = WATERBALL_CONFIRM; -#else +#ifdef PLAY_ANGEL if (tw->msg[0].msgmode == MSGMODE_WRITE) { snprintf(genbuf, sizeof(genbuf), "攻擊 %s:", tw->userid); i = WATERBALL_CONFIRM; @@ -701,6 +698,9 @@ my_write2(void) strlcpy(genbuf, "再問他一次:", sizeof(genbuf)); i = WATERBALL_CONFIRM_ANGEL; } +#else + snprintf(genbuf, sizeof(genbuf), "攻擊 %s:", tw->userid); + i = WATERBALL_CONFIRM; #endif if (!getdata_buf(0, 0, genbuf, msg, 80 - strlen(tw->userid) - 6, DOECHO)) @@ -871,7 +871,8 @@ my_write(pid_t pid, const char *prompt, const char *id, int flag, userinfo_t * p // check if user is changed of angelpause. // XXX if flag == WATERBALL_ANGEL, shuold be (uin->angelpause) only. ((flag == WATERBALL_ANGEL || flag == WATERBALL_CONFIRM_ANGEL) - && (strcasecmp(cuser.myangel, uin->userid) || uin->angelpause >= ANGELPAUSE_REJALL) + && (strcasecmp(cuser.myangel, uin->userid) || + uin->angelpause >= ANGELPAUSE_REJALL) #endif )) { bell(); @@ -940,26 +941,30 @@ my_write(pid_t pid, const char *prompt, const char *id, int flag, userinfo_t * p sizeof(uin->msgs[write_pos].userid)); else #endif - strlcpy(uin->msgs[write_pos].userid, cuser.userid, - sizeof(uin->msgs[write_pos].userid)); + strlcpy(uin->msgs[write_pos].userid, cuser.userid, + sizeof(uin->msgs[write_pos].userid)); strlcpy(uin->msgs[write_pos].last_call_in, msg, sizeof(uin->msgs[write_pos].last_call_in)); -#ifndef PLAY_ANGEL - uin->msgs[write_pos].msgmode = MSGMODE_WRITE; -#else switch (flag) { +#ifdef PLAY_ANGEL case WATERBALL_ANGEL: case WATERBALL_CONFIRM_ANGEL: uin->msgs[write_pos].msgmode = MSGMODE_TOANGEL; break; + case WATERBALL_ANSWER: case WATERBALL_CONFIRM_ANSWER: uin->msgs[write_pos].msgmode = MSGMODE_FROMANGEL; break; - default: - uin->msgs[write_pos].msgmode = MSGMODE_WRITE; - } #endif + case WATERBALL_ALOHA: + uin->msgs[write_pos].msgmode = MSGMODE_ALOHA; + break; + + default: + uin->msgs[write_pos].msgmode = MSGMODE_WRITE; + break; + } uin->pager = pager0; } else if (flag != WATERBALL_ALOHA) outmsg(ANSI_COLOR(1;33;41) "糟糕! 對方不行了! (收到太多水球) " ANSI_COLOR(37) "@_@" ANSI_RESET); |