From c876b5327229175e098c2c6490d01c28c71a08b3 Mon Sep 17 00:00:00 2001 From: in2 Date: Mon, 6 Dec 2004 05:24:34 +0000 Subject: lightweight sysop broadcast git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2370 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/talk.c | 24 +++++++++++++++++++----- 1 file 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; -- cgit v1.2.3