diff options
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/menu.c | 3 | ||||
-rw-r--r-- | mbbsd/talk.c | 92 |
2 files changed, 84 insertions, 11 deletions
diff --git a/mbbsd/menu.c b/mbbsd/menu.c index 7860f02f..407206cf 100644 --- a/mbbsd/menu.c +++ b/mbbsd/menu.c @@ -171,7 +171,7 @@ domenu(int cmdmode, char *cmdtitle, int cmd, const commands_t cmdtable[]) int lastcmdptr; int n, pos, total, i; int err; - static char cmd0[LOGIN]; + static char cmd0[MODE_MAX]; /* XXX: ¶Ç¶i¨Óªº cmd YÅv¤£¨¬, «h¤£ª¾ cursor ¦bþ, ¾ÉP crash */ if (cmd0[cmdmode]) @@ -347,6 +347,7 @@ const static commands_t talklist[] = { {t_chat, PERM_CHAT, "CChat §ä®a¯ù§{³ð¯ù¥h"}, #ifdef PLAY_ANGEL {t_changeangel, PERM_LOGINOK, "UAChange Angel §ó´«¤p¤Ñ¨Ï"}, + {t_angelmsg, PERM_ANGEL, "LLeave message ¯d¨¥µ¹¤p¥D¤H"}, #endif {t_display, 0, "DDisplay Åã¥Ü¤W´X¦¸¼ö°T"}, {NULL, 0, NULL} diff --git a/mbbsd/talk.c b/mbbsd/talk.c index 69262ac5..3bda708a 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -2856,6 +2856,37 @@ t_changeangel(){ return XEASY; } +int t_angelmsg(){ + char msg[3][74]; + char buf[512]; + int i; + do { + move(12, 0); + clrtobot(); + outs("¤£¦bªº®ÉÔn¸ò¤p¤Ñ¨Ï»¡¤°»ò©O¡H" + "³Ì¦h¤T¦æ¡A«ö[Enter]µ²§ô"); + for (i = 0; i < 3 && + getdata(14 + i, 0, "¡G", msg[i], sizeof(msg[i]), DOECHO); + ++i); + getdata(b_lines - 2, 0, "(S)Àx¦s (E)«·s¨Ó¹L (Q)¨ú®ø¡H[S]", + buf, 4, LCECHO); + } while (buf[0] == 'E' || buf[0] == 'e'); + if (buf[0] == 'Q' || buf[0] == 'q') + return 0; + setuserfile(buf, "angelmsg"); + if (msg[0][0] == 0) + unlink(buf); + else { + FILE* fp = fopen(buf, "w"); + for (i = 0; i < 3 && msg[i][0]; ++i) { + fputs(msg[i], fp); + fputc('\n', fp); + } + fclose(fp); + } + return 0; +} + static int FindAngel(void){ int nAngel; @@ -2899,15 +2930,8 @@ FindAngel(void){ return 0; } -static void -NoAngelFound(const char* msg){ - move(b_lines, 0); - outs(msg); - if (currutmp->mode != EDITING) - outs("¡A½Ð¥ý¦b·s¤âªO¤W´M§äµª®×©Î«ö Ctrl-P µo°Ý"); - clrtoeol(); - refresh(); - sleep(1); +static inline void +GotoNewHand(){ if (currutmp->mode != EDITING){ char old_board[IDLEN + 1] = ""; if (currboard) @@ -2919,9 +2943,57 @@ NoAngelFound(const char* msg){ if (old_board[0]) brc_initial_board(old_board); } +} + +static inline void +NoAngelFound(const char* msg){ + move(b_lines, 0); + outs(msg); + if (currutmp->mode != EDITING) + outs("¡A½Ð¥ý¦b·s¤âªO¤W´M§äµª®×©Î«ö Ctrl-P µo°Ý"); + clrtoeol(); + refresh(); + sleep(1); + GotoNewHand(); return; } +static inline void +AngelNotOnline(){ + char buf[256]; + const static char* const not_online_message = "±zªº¤p¤Ñ¨Ï²{¦b¤£¦b½u¤W"; + sethomefile(buf, cuser.myangel, "angelmsg"); + if (!dashf(buf)) + NoAngelFound(not_online_message); + else { + FILE* fp = fopen(buf, "r"); + clear(); + showtitle("¤p¤Ñ¨Ï¯d¨¥", BBSNAME); + move(4, 0); + clrtobot(); + outs(not_online_message); + outs("\nÍ¢¯d¨¥µ¹§A¡G\n"); + outs("\033[1;31;44m¡ó¢s¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢t\033[37m" + "¤p¤Ñ¨Ï¯d¨¥\033[31m¢u¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢s¡ó\033[m\n"); + outs("\033[1;31mùú¢t\033[32m ¤p¤Ñ¨Ï " + " \033[31m¢uùû\033[m\n"); + while (fgets(buf, sizeof(buf), fp)) { + buf[strlen(buf) - 1] = 0; + prints("\033[1;31m¢x\033[m%-74.74s\033[1;31m¢x\033[m\n", buf); + } + outs("\033[1;31mùü¢s¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w" + "¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢sùý\033[m\n"); + outs("\033[1;31;44m¡ó¢r¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w" + "¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢r¡ó\033[m\n"); + + move(b_lines - 1, 0); + outs("½Ð¥ý¦b·s¤âªO¤W´M§äµª®×©Î«ö Ctrl-P µo°Ý"); + pressanykey(); + + GotoNewHand(); + } +} + static void TalkToAngel(){ userinfo_t* uent; @@ -2933,7 +3005,7 @@ TalkToAngel(){ uent = search_ulist_userid(cuser.myangel); if (uent == 0 || (uent->angel & 1) || he_reject_me(uent)){ - NoAngelFound("±zªº¤p¤Ñ¨Ï²{¦b¤£¦b½u¤W"); + AngelNotOnline(); return; } |