summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2013-02-18 14:14:22 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2013-02-18 14:14:22 +0800
commit3317ea21a43e3756905884577bd627a8451f457e (patch)
tree2f24e1aea1a178c566421c087eab8fccb51a779d
parent12477938807e5f2852dcfadc8798f35f587a8fba (diff)
downloadpttbbs-3317ea21a43e3756905884577bd627a8451f457e.tar
pttbbs-3317ea21a43e3756905884577bd627a8451f457e.tar.gz
pttbbs-3317ea21a43e3756905884577bd627a8451f457e.tar.bz2
pttbbs-3317ea21a43e3756905884577bd627a8451f457e.tar.lz
pttbbs-3317ea21a43e3756905884577bd627a8451f457e.tar.xz
pttbbs-3317ea21a43e3756905884577bd627a8451f457e.tar.zst
pttbbs-3317ea21a43e3756905884577bd627a8451f457e.zip
Record last time talking to angel.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5789 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/include/proto.h1
-rw-r--r--pttbbs/include/pttstruct.h2
-rw-r--r--pttbbs/mbbsd/passwd.c8
-rw-r--r--pttbbs/mbbsd/talk.c5
4 files changed, 15 insertions, 1 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h
index 908fe9fd..f60e6fb4 100644
--- a/pttbbs/include/proto.h
+++ b/pttbbs/include/proto.h
@@ -787,6 +787,7 @@ int pwcuToggleOutMail (void);
int pwcuSetLoginView (unsigned int bits);
int pwcuSetLastSongTime (time4_t clk);
int pwcuSetMyAngel (const char *angel_uid);
+int pwcuPlayAngel (void);
int pwcuSetNickname (const char *nickname);
int pwcuChessResult (int sigType, ChessGameResult);
int pwcuSetChessEloRating(uint16_t elo_rating);
diff --git a/pttbbs/include/pttstruct.h b/pttbbs/include/pttstruct.h
index 83039215..c81a75d5 100644
--- a/pttbbs/include/pttstruct.h
+++ b/pttbbs/include/pttstruct.h
@@ -93,7 +93,7 @@ typedef struct userec_t {
char chkpad1[48];
time4_t lastseen; /* 最近上站時間(隱身不計) */
time4_t timesetangel; /* 上次得到天使時間 */
- time4_t _unused7; /* in case 有人忘了把 time4_t 調好... */
+ time4_t timeplayangel; /* 上次與天使互動時間 (by day) */
// 以上應為 sizeof(chicken_t) 同等大小
time4_t lastsong; /* 上次點歌時間 */
diff --git a/pttbbs/mbbsd/passwd.c b/pttbbs/mbbsd/passwd.c
index b0f5fdcd..3b33a529 100644
--- a/pttbbs/mbbsd/passwd.c
+++ b/pttbbs/mbbsd/passwd.c
@@ -200,6 +200,14 @@ int pwcuSetMyAngel (const char *angel_uid)
PWCU_END();
}
+int pwcuPlayAngel (void)
+{
+ syncnow();
+ PWCU_START();
+ u.timeplayangel = cuser.timeplayangel = now;
+ PWCU_END();
+}
+
int pwcuSetNickname (const char *nickname)
{
PWCU_START();
diff --git a/pttbbs/mbbsd/talk.c b/pttbbs/mbbsd/talk.c
index 4a495e9c..a1c133ec 100644
--- a/pttbbs/mbbsd/talk.c
+++ b/pttbbs/mbbsd/talk.c
@@ -961,6 +961,11 @@ my_write(pid_t pid, const char *prompt, const char *id, int flag, userinfo_t * p
switch (flag) {
#ifdef PLAY_ANGEL
case WATERBALL_ANGEL:
+ if ((now - cuser.timeplayangel) >= DAY_SECONDS)
+ pwcuPlayAngel();
+ uin->msgs[write_pos].msgmode = MSGMODE_TOANGEL;
+ break;
+
case WATERBALL_CONFIRM_ANGEL:
uin->msgs[write_pos].msgmode = MSGMODE_TOANGEL;
break;