summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-12-06 13:24:34 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-12-06 13:24:34 +0800
commitc876b5327229175e098c2c6490d01c28c71a08b3 (patch)
treea7d09c82f68cb13b48513d46d8f18a01a1e896a2 /mbbsd
parent2b8e9c06b9d3749071d4d3d35af70bc06bc99345 (diff)
downloadpttbbs-c876b5327229175e098c2c6490d01c28c71a08b3.tar
pttbbs-c876b5327229175e098c2c6490d01c28c71a08b3.tar.gz
pttbbs-c876b5327229175e098c2c6490d01c28c71a08b3.tar.bz2
pttbbs-c876b5327229175e098c2c6490d01c28c71a08b3.tar.lz
pttbbs-c876b5327229175e098c2c6490d01c28c71a08b3.tar.xz
pttbbs-c876b5327229175e098c2c6490d01c28c71a08b3.tar.zst
pttbbs-c876b5327229175e098c2c6490d01c28c71a08b3.zip
lightweight sysop broadcast
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2370 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/talk.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index dd1fd3d5..d67d8c16 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -2378,20 +2378,34 @@ userlist(void)
*ans == 'n')
break;
if (!(cuser.uflag & FRIEND_FLAG) && HAS_PERM(PERM_SYSOP)) {
+ msgque_t msg;
getdata(1, 0, "再次確定站長廣播? [N]",
ans, sizeof(ans), LCECHO);
if( *ans != 'y' && *ans != 'Y' ){
vmsg("abort");
break;
}
+
+ msg.pid = currpid;
+ strncpy(msg.userid, cuser.userid, sizeof(msg.userid));
+ snprintf(msg.last_call_in, sizeof(msg.last_call_in),
+ "[廣播]%s", genbuf);
for (i = 0; i < SHM->UTMPnumber; ++i) {
uentp = &SHM->uinfo[
SHM->sorted[SHM->currsorted][0][i]];
- if (uentp->pid && kill(uentp->pid, 0) != -1)
- my_write(uentp->pid, genbuf,
- uentp->userid, WATERBALL_PREEDIT, NULL);
- if (i % 100 == 0)
- sleep(1);
+ if (uentp->pid && kill(uentp->pid, 0) != -1){
+ int write_pos = uentp->msgcount;
+ if( write_pos < (MAX_MSGS - 1) ){
+ uentp->msgcount = write_pos + 1;
+ memcpy(&uentp->msgs[write_pos], &msg,
+ sizeof(msg));
+#ifdef NOKILLWATERBALL
+ uentp->wbtime = now;
+#else
+ kill(uentp->pid, SIGUSR2);
+#endif
+ }
+ }
}
} else {
userinfo_t *uentp;