summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-10-13 23:22:21 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-10-13 23:22:21 +0800
commit4bc35b3870807886f1019cf52ad8e91d150774ef (patch)
tree72d8a05b274b439c175486d086e0ceeb3f811c34
parenta3b209f669a99367136225cf890487df69dfabe0 (diff)
downloadpttbbs-4bc35b3870807886f1019cf52ad8e91d150774ef.tar
pttbbs-4bc35b3870807886f1019cf52ad8e91d150774ef.tar.gz
pttbbs-4bc35b3870807886f1019cf52ad8e91d150774ef.tar.bz2
pttbbs-4bc35b3870807886f1019cf52ad8e91d150774ef.tar.lz
pttbbs-4bc35b3870807886f1019cf52ad8e91d150774ef.tar.xz
pttbbs-4bc35b3870807886f1019cf52ad8e91d150774ef.tar.zst
pttbbs-4bc35b3870807886f1019cf52ad8e91d150774ef.zip
changes mailalert to 1 bit only.
reserved other 7 trigers for updating current status on the fly when user is online. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3223 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/pttstruct.h6
-rw-r--r--mbbsd/chat.c6
-rw-r--r--mbbsd/mail.c8
-rw-r--r--mbbsd/mbbsd.c2
-rw-r--r--mbbsd/menu.c4
-rw-r--r--mbbsd/register.c2
-rw-r--r--mbbsd/talk.c2
-rw-r--r--util/angel.c2
-rw-r--r--util/bbsmail.c2
-rw-r--r--util/chkhbf.c3
-rw-r--r--util/mailangel.c2
11 files changed, 21 insertions, 18 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 3da51384..a8e9c568 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -330,6 +330,10 @@ typedef struct msgque_t {
int msgmode;
} msgque_t;
+#define ALERT_NEW_MAIL 1
+#define ISNEWMAIL(utmp) utmp->alerts & ALERT_NEW_MAIL
+#define ALERT_RELOAD_PASSWD 2
+
/* user data in shm */
/* use GAP to detect and avoid data overflow and overriding */
typedef struct userinfo_t {
@@ -374,7 +378,7 @@ typedef struct userinfo_t {
unsigned char mode; /* UL/DL, Talk Mode, Chat Mode, ... */
unsigned char pager; /* pager toggle, YEA, or NA */
time4_t lastact; /* 上次使用者動的時間 */
- char mailalert;
+ char alerts; /* mail alert, passwd update... */
char mind[4];
/* chatroom/talk/games calling */
diff --git a/mbbsd/chat.c b/mbbsd/chat.c
index e736e387..917f8c8d 100644
--- a/mbbsd/chat.c
+++ b/mbbsd/chat.c
@@ -314,7 +314,6 @@ t_chat(void)
struct hostent *h;
int cfd, cmdpos, ch;
int currchar;
- int newmail;
int chatting = YEA;
char fpath[80];
struct ChatBuf chatbuf;
@@ -375,7 +374,7 @@ t_chat(void)
add_io(cfd, 0);
- newmail = currchar = 0;
+ currchar = 0;
cmdpos = -1;
memset(lastcmd, 0, sizeof(lastcmd));
@@ -440,8 +439,7 @@ t_chat(void)
continue;
}
- if (!newmail && currutmp->mailalert) {
- newmail = 1;
+ if (ISNEWMAIL(currutmp)) {
printchatline("◆ 噹!郵差又來了...");
}
if (ch == I_OTHERDATA) {/* incoming */
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 56784a24..0b04a245 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -103,7 +103,7 @@ mailalert(const char *userid)
n = count_logins(tuid, 0);
for (i = 1; i <= n; i++)
if ((uentp = (userinfo_t *) search_ulistn(tuid, i)))
- uentp->mailalert = 1;
+ uentp->alerts |= ALERT_NEW_MAIL;
return 0;
}
@@ -880,7 +880,7 @@ m_new(void)
return -1;
}
curredit = 0;
- currutmp->mailalert = load_mailalert(cuser.userid);
+ currutmp->alerts |= load_mailalert(cuser.userid);
while (arg.delcnt--)
delete_record(currmaildir, sizeof(fileheader_t), arg.delmsgs[arg.delcnt]);
if(arg.delmsgs)
@@ -1597,7 +1597,7 @@ m_read(void)
i_read(RMAIL, currmaildir, mailtitle, maildoent, mail_comms, -1);
currbid = back_bid;
curredit = 0;
- currutmp->mailalert = load_mailalert(cuser.userid);
+ currutmp->alerts |= load_mailalert(cuser.userid);
return 0;
} else {
outs("您沒有來信");
@@ -1879,7 +1879,7 @@ load_mailalert(const char *userid)
read(fd, &my_mail, sizeof(fileheader_t));
if (!(my_mail.filemode & FILE_READ)) {
close(fd);
- return 1;
+ return ALERT_NEW_MAIL;
}
lseek(fd, -(off_t) 2 * sizeof(fileheader_t), SEEK_CUR);
}
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 593208d5..15625061 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -838,7 +838,7 @@ setup_utmp(int mode)
uinfo.pid = currpid = getpid();
uinfo.uid = usernum;
uinfo.mode = currstat = mode;
- uinfo.mailalert = load_mailalert(cuser.userid);
+ uinfo.alerts |= load_mailalert(cuser.userid);
uinfo.userlevel = cuser.userlevel;
uinfo.sex = cuser.sex % 8;
diff --git a/mbbsd/menu.c b/mbbsd/menu.c
index 5b4c8494..17d51a8b 100644
--- a/mbbsd/menu.c
+++ b/mbbsd/menu.c
@@ -66,7 +66,7 @@ showtitle(const char *title, const char *mid)
mlen = strlen(mid);
}
#else
- if (currutmp->mailalert) {
+ if (ISNEWMAIL(currutmp)) {
mid = " 郵差來按鈴囉 ";
mid_attr = ANSI_COLOR(41;5);
mlen = strlen(mid);
@@ -548,7 +548,7 @@ static const commands_t moneylist[] = {
};
int main_menu(void) {
- domenu(M_MMENU, "主功\能表", (currutmp->mailalert ? 'M' : 'C'), cmdlist);
+ domenu(M_MMENU, "主功\能表", (ISNEWMAIL(currutmp) ? 'M' : 'C'), cmdlist);
return 0;
}
diff --git a/mbbsd/register.c b/mbbsd/register.c
index 2ec74ff6..1a35c7bc 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -301,7 +301,7 @@ check_register(void)
* 避免使用者被退回註冊單後,在知道退回的原因之前,
* 又送出一次註冊單。
*/
- if (currutmp->mailalert)
+ if (ISNEWMAIL(currutmp))
m_read();
stand_title("請詳細填寫個人資料");
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 2c5d7527..91cb17cc 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -454,7 +454,7 @@ my_query(const char *uident)
(uentp && isvisible_stat(currutmp, uentp, fri_stat)) ?
modestring(uentp, 0) : "不在站上");
- outs(((uentp && uentp->mailalert) || load_mailalert(muser.userid))
+ outs(((uentp && ISNEWMAIL(uentp)) || load_mailalert(muser.userid))
? "《私人信箱》有新進信件還沒看\n" :
"《私人信箱》所有信件都看過了\n");
prints("《上次上站》%-28.28s《上次故鄉》%s\n",
diff --git a/util/angel.c b/util/angel.c
index 9e1f3880..e434a46b 100644
--- a/util/angel.c
+++ b/util/angel.c
@@ -107,7 +107,7 @@ int mailalertuser(char* userid)
{
userinfo_t *uentp=NULL;
if (userid[0] && (uentp = search_ulist_userid(userid)))
- uentp->mailalert=1;
+ uentp->alerts|=ALERT_NEW_MAIL;
return 0;
}
diff --git a/util/bbsmail.c b/util/bbsmail.c
index 06b9fefe..4cc441f2 100644
--- a/util/bbsmail.c
+++ b/util/bbsmail.c
@@ -47,7 +47,7 @@ int mailalertuid(int tuid)
{
userinfo_t *uentp=NULL;
if(tuid>0 && (uentp = (userinfo_t *)search_ulist(tuid)) )
- uentp->mailalert=1;
+ uentp->alerts|=ALERT_NEW_MAIL;
return 0;
}
diff --git a/util/chkhbf.c b/util/chkhbf.c
index 3203a3d0..90c28d56 100644
--- a/util/chkhbf.c
+++ b/util/chkhbf.c
@@ -1,4 +1,5 @@
/* $Id$ */
+#define _UTIL_C_
#include "bbs.h"
struct {
@@ -16,7 +17,7 @@ int mailalertuid(int tuid)
{
userinfo_t *uentp=NULL;
if(tuid>0 && (uentp = (userinfo_t *)search_ulist(tuid)) )
- uentp->mailalert=1;
+ uentp->alerts |=ALERT_NEW_MAIL;
return 0;
}
diff --git a/util/mailangel.c b/util/mailangel.c
index f873188c..93d9524b 100644
--- a/util/mailangel.c
+++ b/util/mailangel.c
@@ -46,7 +46,7 @@ int mailalertuser(char* userid)
{
userinfo_t *uentp=NULL;
if (userid[0] && (uentp = search_ulist_userid(userid)))
- uentp->mailalert=1;
+ uentp->alerts|=ALERT_NEW_MAIL;
return 0;
}