From 88449b337a0ab9926d6cc558ab659afc23f8d709 Mon Sep 17 00:00:00 2001 From: piaip Date: Wed, 12 Oct 2011 10:13:51 +0000 Subject: don't allow user adding his own signature when doing cross_post. git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5413 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/include/proto.h | 1 + pttbbs/mbbsd/bbs.c | 4 +++- pttbbs/mbbsd/edit.c | 23 ++++++++++++++--------- pttbbs/mbbsd/mail.c | 4 +++- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h index 3e862acf..c59320a0 100644 --- a/pttbbs/include/proto.h +++ b/pttbbs/include/proto.h @@ -194,6 +194,7 @@ int vedit2(const char *fpath, int saveheader, int *islocal, char save_title[STRL int veditfile(const char *fpath); void write_header(FILE *fp, const char *mytitle); void addsignature(FILE *fp, int ifuseanony); +void addsimplesignature(FILE *fp, const char *fromhost); void auto_backup(void); void restore_backup(void); const char *ask_tmpbuf(int y); diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c index a9ff44f2..bb192e52 100644 --- a/pttbbs/mbbsd/bbs.c +++ b/pttbbs/mbbsd/bbs.c @@ -2026,7 +2026,9 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct) b_suckinfile(xptr, fname); } - addsignature(xptr, 0); + addsimplesignature(xptr, NULL); + fprintf(xptr, "◆ 由 %s 轉錄,時間: %s\n", + cuser.userid, Cdatelite(&now)); fclose(xptr); #ifdef USE_AUTOCPLOG diff --git a/pttbbs/mbbsd/edit.c b/pttbbs/mbbsd/edit.c index a508f047..e041c984 100644 --- a/pttbbs/mbbsd/edit.c +++ b/pttbbs/mbbsd/edit.c @@ -1735,6 +1735,17 @@ loadsitesig(const char *fname) return ret; } +void +addsimplesignature(FILE *fp, const char *host) { + char temp[33]; + if (!host) + host = FROMHOST; + strlcpy(temp, host, sizeof(temp)); + fprintf(fp, + "\n--\n※ 發信站 :" BBSNAME "(" MYHOSTNAME ") \n" + "◆ From: %s\n", host); +} + void addsignature(FILE * fp, int ifuseanony) { @@ -1746,8 +1757,7 @@ addsignature(FILE * fp, int ifuseanony) char ch; if (!strcmp(cuser.userid, STR_GUEST)) { - fprintf(fp, "\n--\n※ 發信站 :" BBSNAME "(" MYHOSTNAME - ") \n◆ From: %s\n", FROMHOST); + addsimplesignature(fp, NULL); return; } if (!ifuseanony) { @@ -1812,16 +1822,11 @@ browse_sigs: #ifdef HAVE_ORIGIN #ifdef HAVE_ANONYMOUS if (ifuseanony) - fprintf(fp, "\n--\n※ 發信站: " BBSNAME "(" MYHOSTNAME - ") \n◆ From: %s\n", "匿名天使的家"); + addsimplesignature(fp, "匿名天使的家"); else #endif { - char temp[33]; - - strlcpy(temp, FROMHOST, sizeof(temp)); - fprintf(fp, "\n--\n※ 發信站: " BBSNAME "(" MYHOSTNAME - ") \n◆ From: %s\n", temp); + addsimplesignature(fp, NULL); } #endif } diff --git a/pttbbs/mbbsd/mail.c b/pttbbs/mbbsd/mail.c index f6b63248..92894cf2 100644 --- a/pttbbs/mbbsd/mail.c +++ b/pttbbs/mbbsd/mail.c @@ -1621,7 +1621,9 @@ mail_cross_post(int unused_arg, fileheader_t * fhdr, const char *direct) fprintf(xptr, "※ [本文轉錄自 %s 信箱]\n\n", cuser.userid); b_suckinfile(xptr, fname); - addsignature(xptr, 0); + addsimplesignature(xptr, NULL); + fprintf(xptr, "◆ 由 %s 轉錄,時間: %s\n", + cuser.userid, Cdatelite(&now)); fclose(xptr); } -- cgit v1.2.3