diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2010-10-10 19:55:17 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2010-10-10 19:55:17 +0800 |
commit | a39618bd2edb8db3ff486dc7912037728f355158 (patch) | |
tree | 8725cf6d045a37bad55f2e5c8afe28a628a6db4a | |
parent | 5b66d9bc4e9353db61d35a8f2769321362df5206 (diff) | |
download | pttbbs-a39618bd2edb8db3ff486dc7912037728f355158.tar pttbbs-a39618bd2edb8db3ff486dc7912037728f355158.tar.gz pttbbs-a39618bd2edb8db3ff486dc7912037728f355158.tar.bz2 pttbbs-a39618bd2edb8db3ff486dc7912037728f355158.tar.lz pttbbs-a39618bd2edb8db3ff486dc7912037728f355158.tar.xz pttbbs-a39618bd2edb8db3ff486dc7912037728f355158.tar.zst pttbbs-a39618bd2edb8db3ff486dc7912037728f355158.zip |
add log to internet mails
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5115 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/include/proto.h | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/bbs.c | 6 | ||||
-rw-r--r-- | pttbbs/mbbsd/mail.c | 23 | ||||
-rw-r--r-- | pttbbs/mbbsd/ordersong.c | 7 | ||||
-rw-r--r-- | pttbbs/mbbsd/record.c | 6 | ||||
-rw-r--r-- | pttbbs/mbbsd/xyz.c | 2 |
6 files changed, 39 insertions, 7 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h index d586829c..7ed488c9 100644 --- a/pttbbs/include/proto.h +++ b/pttbbs/include/proto.h @@ -353,7 +353,7 @@ int mail_mbox(void); int built_mail_index(void); int mail_all(void); int invalidaddr(const char *addr); -int do_send(const char *userid, const char *title); +int do_send(const char *userid, const char *title, const char *log_source); int do_innersend(const char *userid, char *mfpath, const char *title, char *newtitle); void my_send(const char *uident); void setupmailusage(void); diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c index 3daed26e..014e112f 100644 --- a/pttbbs/mbbsd/bbs.c +++ b/pttbbs/mbbsd/bbs.c @@ -1284,6 +1284,12 @@ do_general(int garbage) else sendalert(quote_user, ALERT_NEW_MAIL); } else if ((str = strchr(quote_user, '.'))) { +#ifdef USE_LOG_INTERNETMAIL + log_filef("log/internet_mail.log", LOG_CREAT, + "%s [%s (%s)] %s -> %s: %s\n", + Cdatelite(&now), "do_general_reply_to_author", + currboard, cuser.userid, str + 1, save_title); +#endif if ( bsmtp(fpath, save_title, str + 1, NULL) < 0) msg = "作者無法收信"; } else { diff --git a/pttbbs/mbbsd/mail.c b/pttbbs/mbbsd/mail.c index 8267e705..76ae08e6 100644 --- a/pttbbs/mbbsd/mail.c +++ b/pttbbs/mbbsd/mail.c @@ -256,7 +256,7 @@ m_internet(void) trim(receiver); if (strchr(receiver, '@') && !invalidaddr(receiver) && getdata(21, 0, "主 題:", title, sizeof(title), DOECHO)) - do_send(receiver, title); + do_send(receiver, title, "m_internet"); else { vmsg("收信人或主題不正確,請重新選取指令"); } @@ -443,7 +443,7 @@ do_innersend(const char *userid, char *mfpath, const char *title, char *newtitle } int -do_send(const char *userid, const char *title) +do_send(const char *userid, const char *title, const char *log_source) { fileheader_t mhdr; char fpath[STRLEN]; @@ -497,6 +497,12 @@ do_send(const char *userid, const char *title) default: outs("Y\n請稍候, 信件傳遞中...\n"); ret = bsmtp(fpath, save_title, userid, NULL); +#ifdef USE_LOG_INTERNETMAIL + log_filef("log/internet_mail.log", LOG_CREAT, + "%s [%s] %s -> %s: %s\n", + Cdatelite(&now), log_source, + cuser.userid, userid, save_title); +#endif hold_mail(fpath, userid, save_title); break; } @@ -517,7 +523,7 @@ do_send(const char *userid, const char *title) void my_send(const char *uident) { - switch (do_send(uident, NULL)) { + switch (do_send(uident, NULL, "my_send")) { case -1: outs(err_uid); break; @@ -906,7 +912,7 @@ m_forward(int ent GCC_UNUSED, fileheader_t * fhdr, const char *direct GCC_UNUSED prints("轉信給: %s\n標 題: %s\n", uid, save_title); showplans(uid); - switch (do_send(uid, save_title)) { + switch (do_send(uid, save_title, "m_forward")) { case -1: outs(err_uid); break; @@ -1358,7 +1364,7 @@ mail_reply(int ent, fileheader_t * fhdr, const char *direct) /* edit, then send the mail */ ent = curredit; - switch (do_send(uid, save_title)) { + switch (do_send(uid, save_title, "mail_reply")) { case -1: outs(err_uid); break; @@ -2218,6 +2224,13 @@ doforward(const char *direct, const fileheader_t * fh, int mode) } else return -1; +#ifdef USE_LOG_INTERNETMAIL + if (strchr(address, '@')) + log_filef("log/internet_mail.log", LOG_CREAT, + "%s [%s] %s -> %s: %s %s\n", + Cdatelite(&now), "mail_doforward", + cuser.userid, address, fh->title, fname); +#endif return_no = bsmtp(fname, fh->title, address, NULL); unlink(fname); return (return_no); diff --git a/pttbbs/mbbsd/ordersong.c b/pttbbs/mbbsd/ordersong.c index 489cbab0..e7a97156 100644 --- a/pttbbs/mbbsd/ordersong.c +++ b/pttbbs/mbbsd/ordersong.c @@ -197,6 +197,13 @@ do_order_song(void) if (address[0]) { bsmtp(filename, save_title, address, NULL); +#ifdef USE_LOG_INTERNETMAIL + if (strchr(address, '@')) + log_filef("log/internet_mail.log", LOG_CREAT, + "%s [%s] %s -> %s: %s\n", + Cdatelite(&now), "do_order_song", + cuser.userid, address, save_title); +#endif } clear(); outs( diff --git a/pttbbs/mbbsd/record.c b/pttbbs/mbbsd/record.c index afcd5e58..672c0062 100644 --- a/pttbbs/mbbsd/record.c +++ b/pttbbs/mbbsd/record.c @@ -427,6 +427,12 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char * snprintf(fwd_title, sizeof(fwd_title)-1, "[自動轉寄] %s", record->title); bsmtp(buf, fwd_title, address, origid); +#ifdef USE_LOG_INTERNETMAIL + log_filef("log/internet_mail.log", LOG_CREAT, + "%s [%s] %s -> (%s) %s: %s\n", + Cdatelite(&now), "auto_forward", + cuser.userid, origid, address, fwd_title); +#endif return 0; } } diff --git a/pttbbs/mbbsd/xyz.c b/pttbbs/mbbsd/xyz.c index 96fd55d7..cce44e1e 100644 --- a/pttbbs/mbbsd/xyz.c +++ b/pttbbs/mbbsd/xyz.c @@ -117,7 +117,7 @@ mail_sysop(void) char *suser = sysoplist[i].userid; clear(); showplans(suser); - do_send(suser, NULL); + do_send(suser, NULL, "mail_sysop"); } } } |