From fafe4c7e70de4e770f6bf7f42306957330aaadea Mon Sep 17 00:00:00 2001 From: ptt Date: Tue, 15 Nov 2005 16:51:33 +0000 Subject: PERMISSION can be changed even if the user is online. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3241 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/bbs.c | 2 +- mbbsd/mail.c | 10 +++++----- mbbsd/passwd.c | 6 ++++++ mbbsd/syspost.c | 2 ++ mbbsd/user.c | 2 ++ 5 files changed, 16 insertions(+), 6 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 89fd9684..96a66624 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -916,7 +916,7 @@ do_general(int isbid) if (append_record(genbuf, &postfile, sizeof(postfile)) == -1) msg = err_uid; else - mailalert(quote_user); + sendalert(quote_user, ALERT_NEW_MAIL); } outs(msg); curredit ^= EDIT_BOTH; diff --git a/mbbsd/mail.c b/mbbsd/mail.c index b0d9941b..da8f2a1c 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -92,7 +92,7 @@ built_mail_index(void) } int -mailalert(const char *userid) +sendalert(const char *userid, int alert) { userinfo_t *uentp = NULL; int n, tuid, i; @@ -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->alerts |= ALERT_NEW_MAIL; + uentp->alerts |= alert; return 0; } @@ -128,7 +128,7 @@ mail_id(const char *id, const char *title, const char *src, const char *owner) sethomedir(dirf, id); append_record_forward(dirf, &mhdr, sizeof(mhdr), id); - mailalert(id); + sendalert(id, ALERT_NEW_MAIL); return 0; } @@ -392,7 +392,7 @@ do_send(const char *userid, const char *title) sethomedir(fpath, userid); if (append_record_forward(fpath, &mhdr, sizeof(mhdr), userid) == -1) return -1; - mailalert(userid); + sendalert(userid,ALERT_NEW_MAIL); } hold_mail(genbuf, userid); return 0; @@ -614,7 +614,7 @@ multi_send(char *title) sethomedir(genbuf, p->word); if (append_record_forward(genbuf, &mymail, sizeof(mymail), p->word) == -1) vmsg(err_uid); - mailalert(p->word); + sendalert(p->word, ALERT_NEW_MAIL); } hold_mail(fpath, NULL); unlink(fpath); diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c index 809edc2d..d0d6eb28 100644 --- a/mbbsd/passwd.c +++ b/mbbsd/passwd.c @@ -76,6 +76,12 @@ passwd_update(int num, userec_t * buf) if (num < 1 || num > MAX_USERS) return -1; buf->money = moneyof(num); + if(usernum ==num && (currutmp->alerts & ALERT_RELOAD_PERM)) + { + userec_t u; + passwd_query(num, &u); + buf->userlevel = u.userlevel; + } if ((pwdfd = open(fn_passwd, O_WRONLY)) < 0) exit(1); lseek(pwdfd, sizeof(userec_t) * (num - 1), SEEK_SET); diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c index 447e00e3..8c8e3d12 100644 --- a/mbbsd/syspost.c +++ b/mbbsd/syspost.c @@ -62,6 +62,8 @@ post_change_perm(int oldperm, int newperm, const char *sysopid, const char *user char genbuf[200], reason[30]; int i, flag = 0; + sendalert(userid, ALERT_RELOAD_PERM); + setbpath(genbuf, "Security"); stampfile(genbuf, &fhdr); if (!(fp = fopen(genbuf, "w"))) diff --git a/mbbsd/user.c b/mbbsd/user.c index 12c8ce04..2cda7201 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -187,6 +187,8 @@ mail_violatelaw(const char *crime, const char *police, const char *reason, const fileheader_t fhdr; FILE *fp; + sendalert(crime, ALERT_RELOAD_PERM); + sethomepath(genbuf, crime); stampfile(genbuf, &fhdr); if (!(fp = fopen(genbuf, "w"))) -- cgit v1.2.3