diff options
-rw-r--r-- | include/modes.h | 1 | ||||
-rw-r--r-- | mbbsd/crypt.c | 2 | ||||
-rw-r--r-- | mbbsd/mail.c | 32 | ||||
-rw-r--r-- | mbbsd/pmore.c | 4 | ||||
-rw-r--r-- | mbbsd/stuff.c | 22 |
5 files changed, 44 insertions, 17 deletions
diff --git a/include/modes.h b/include/modes.h index 9f6efa17..0c79bb3c 100644 --- a/include/modes.h +++ b/include/modes.h @@ -26,6 +26,7 @@ #define RET_DOBBSLUA (994) #define RET_COPY2TMP (993) #define RET_SELECTBRD (992) +#define RET_DOREPLYALL (991) /* user 操作狀態與模式 */ #define IDLE 0 diff --git a/mbbsd/crypt.c b/mbbsd/crypt.c index 57d78533..7283c8a6 100644 --- a/mbbsd/crypt.c +++ b/mbbsd/crypt.c @@ -2,7 +2,7 @@ /* This file is crypt.c taken from ssh 1.2.33, only modified for compile */ /** * FreeBSD 及 Linux glibc 附的 crypt() 都會用到大 table 加速多次 crypt(). - * 但 bbs 僅上站檢查密碼時使用一次, 不值得為此花 100kb memory. + * 但 bbs 僅上站檢查密碼時使用一次, 不值得為此花 100kb memory. (non-const memory) * libdes 的 crypt() 僅需 4kb 的 constant lookup table. * * 不過要注意 libdes 4.01 的 license 跟 GPL 不合, 因此此處採用 ssh 1.2.33 裡頭 diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 39df2ea4..fe5b9704 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -851,8 +851,14 @@ read_new_mail(void * voidfptr, void *optarg) int more_result = more(fname, YEA); switch (more_result) { - case 999: - return mail_reply(arg->idc, fptr, currmaildir); + case RET_DOREPLY: + mail_reply(arg->idc, fptr, currmaildir); + return FULLUPDATE; + case RET_DOREPLYALL: + multi_reply(arg->idc, fptr, currmaildir); + return FULLUPDATE; + case RET_DORECOMMEND: // we don't accept this. + return FULLUPDATE; case -1: return READ_SKIP; case 0: @@ -868,12 +874,12 @@ read_new_mail(void * voidfptr, void *optarg) case 'R': mail_reply(arg->idc, fptr, currmaildir); break; - case 'x': - m_forward(arg->idc, fptr, currmaildir); - break; case 'y': multi_reply(arg->idc, fptr, currmaildir); break; + case 'x': + m_forward(arg->idc, fptr, currmaildir); + break; case 'd': case 'D': delete_it = YEA; @@ -1123,8 +1129,14 @@ mail_read(int ent, fileheader_t * fhdr, const char *direct) clear(); vmsg("此封信無內容。"); return FULLUPDATE; - case 999: - return mail_reply(ent, fhdr, direct); + case RET_DOREPLY: + mail_reply(ent, fhdr, direct); + return FULLUPDATE; + case RET_DOREPLYALL: + multi_reply(ent, fhdr, direct); + return FULLUPDATE; + case RET_DORECOMMEND: // we don't accept this. + return FULLUPDATE; case 0: break; default: @@ -1138,12 +1150,12 @@ mail_read(int ent, fileheader_t * fhdr, const char *direct) replied = YEA; mail_reply(ent, fhdr, direct); break; - case 'x': - m_forward(ent, fhdr, direct); - break; case 'y': multi_reply(ent, fhdr, direct); break; + case 'x': + m_forward(ent, fhdr, direct); + break; case 'd': delete_it = YEA; default: diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c index 0d79a7f1..ea460ea4 100644 --- a/mbbsd/pmore.c +++ b/mbbsd/pmore.c @@ -2102,9 +2102,11 @@ pmore(char *fpath, int promptend) /* -------------- NEW EXITING KEYS ------------------ */ #ifdef RET_DOREPLY case 'r': case 'R': - case 'Y': case 'y': flExit = 1, retval = RET_DOREPLY; break; + case 'Y': case 'y': + flExit = 1, retval = RET_DOREPLYALL; + break; #endif #ifdef RET_DORECOMMEND // recommend diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c index 9156fd3f..7f2ddd04 100644 --- a/mbbsd/stuff.c +++ b/mbbsd/stuff.c @@ -401,13 +401,15 @@ vmsgf(const char *fmt,...) * @param x * @param lines * @param mode - * @return 失敗傳回 0,否則為 1。 + * @return 失敗傳回 0,否則為 1。 + * 2 表示有 PttPrints 碼 */ int show_file(const char *filename, int y, int lines, int mode) { - FILE *fp; - char buf[1024]; + FILE *fp; + char buf[1024]; + int ret = 1; if (y >= 0) move(y, 0); @@ -416,13 +418,23 @@ show_file(const char *filename, int y, int lines, int mode) while (fgets(buf, sizeof(buf), fp) && lines--) { move(y++, 0); - outs(Ptt_prints(buf, sizeof(buf), mode)); + // because Ptt_prints escapes are not so often, + // let's try harder to detect it. + if (strstr(buf, ESC_STR "*") != NULL) + { + outs(Ptt_prints(buf, sizeof(buf), mode)); + ret = 2; + } else { + // ESC is very common... + strip_ansi(buf, buf, mode); + outs(buf); + } } fclose(fp); outs(ANSI_RESET); // prevent some broken Welcome file } else return 0; - return 1; + return ret; } void |