summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-06-24 16:13:56 +0800
committerscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-06-24 16:13:56 +0800
commit724516f9d41111196505d07d7deb9c84ec2dca81 (patch)
treedeeeabb05f17dc4f6b9021203b7c2225c0e4bf17
parent0bd0de593521362768058dbb6847b888a02562c0 (diff)
downloadpttbbs-724516f9d41111196505d07d7deb9c84ec2dca81.tar
pttbbs-724516f9d41111196505d07d7deb9c84ec2dca81.tar.gz
pttbbs-724516f9d41111196505d07d7deb9c84ec2dca81.tar.bz2
pttbbs-724516f9d41111196505d07d7deb9c84ec2dca81.tar.lz
pttbbs-724516f9d41111196505d07d7deb9c84ec2dca81.tar.xz
pttbbs-724516f9d41111196505d07d7deb9c84ec2dca81.tar.zst
pttbbs-724516f9d41111196505d07d7deb9c84ec2dca81.zip
Angel leaving message.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2079 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/modes.h3
-rw-r--r--include/proto.h1
-rw-r--r--mbbsd/menu.c3
-rw-r--r--mbbsd/talk.c92
4 files changed, 87 insertions, 12 deletions
diff --git a/include/modes.h b/include/modes.h
index a2de94a0..6d0cacf6 100644
--- a/include/modes.h
+++ b/include/modes.h
@@ -59,7 +59,7 @@
#define MAILALL 39
#define MJ 40
#define P_FRIEND 41
-#define LOGIN 42 /* main menu *//* ©Ò¦³¨ä¥L¿ï³æ°ÊºA¶·¦b¦¹¤§«e */
+#define LOGIN 42 /* main menu */
#define DICT 43
#define BRIDGE 44
#define ARCHIE 45
@@ -99,6 +99,7 @@
#define REEDIT 79
#define BLOGGING 80
#define CHESSWATCHING 81
+#define MODE_MAX 81 /* ©Ò¦³¨ä¥L¿ï³æ°ÊºA¶·¦b¦¹¤§«e */
/* menu.c ¤¤ªº¼Ò¦¡ */
#define QUIT 0x666 /* Return value to abort recursive functions */
diff --git a/include/proto.h b/include/proto.h
index 3d349611..a554bddf 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -552,6 +552,7 @@ int call_in(userinfo_t *uentp, int fri_stat);
int make_connection_to_somebody(userinfo_t *uin, int timeout);
#ifdef PLAY_ANGEL
int t_changeangel(void);
+int t_angelmsg(void);
void CallAngel(void);
void SwitchBeingAngel(void);
void SwitchAngelSex(int);
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;
}