From 3b56baa4e682cffd1d389a5b9d1ae593a7ee7f31 Mon Sep 17 00:00:00 2001 From: piaip Date: Wed, 12 Oct 2011 14:33:02 +0000 Subject: improve removebm when registering new char git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5415 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/mbbsd/register.c | 9 +++++++++ pttbbs/util/removebm.c | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pttbbs/mbbsd/register.c b/pttbbs/mbbsd/register.c index 2e14405d..f9fe7dcb 100644 --- a/pttbbs/mbbsd/register.c +++ b/pttbbs/mbbsd/register.c @@ -738,6 +738,15 @@ new_register(void) exit(1); } log_usies("REGISTER", fromhost); +#ifdef USE_REMOVEBM_ON_NEWREG + { + char buf[PATHLEN]; + snprintf(buf, sizeof(buf), + BBSHOME "bin/removebm '%s' >/dev/null 2>&1", + newuser.userid); + system(buf); + } +#endif } int diff --git a/pttbbs/util/removebm.c b/pttbbs/util/removebm.c index 5a3308e6..d04284c4 100644 --- a/pttbbs/util/removebm.c +++ b/pttbbs/util/removebm.c @@ -14,6 +14,9 @@ int check(void *data, int bid, boardheader_t *bh) if (!bh->brdname[0] || !bh->BM[0]) return 0; + if (!strcasestr(bh->BM, userid)) + return 0; + strlcpy(bmsrc, bh->BM, sizeof(bmsrc)); p = bmsrc; @@ -43,7 +46,11 @@ int check(void *data, int bid, boardheader_t *bh) if (!changed) return 0; - printf("%s: %s -> %s\n", bh->brdname, bh->BM, bmout); + now = time(0); + log_filef(BBSHOME "/log/removebm.log", LOG_CREAT, + "%s [%s] %s: %s->%s\n", + Cdatelite(&now), userid, + bh->brdname, bh->BM, bmout); if (has_quote) snprintf(bh->BM, sizeof(bh->BM), "[%s]", bmout); -- cgit v1.2.3