diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2013-03-18 01:14:08 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2013-03-18 01:14:08 +0800 |
commit | a69760c32a629bf057636bed4abbafa90f949c5f (patch) | |
tree | ea07afba8aad6b71e6bca93be0b267a5cc757cd5 | |
parent | f06f06d9213258e866dc9d9d300b2850d6375d90 (diff) | |
download | pttbbs-a69760c32a629bf057636bed4abbafa90f949c5f.tar pttbbs-a69760c32a629bf057636bed4abbafa90f949c5f.tar.gz pttbbs-a69760c32a629bf057636bed4abbafa90f949c5f.tar.bz2 pttbbs-a69760c32a629bf057636bed4abbafa90f949c5f.tar.lz pttbbs-a69760c32a629bf057636bed4abbafa90f949c5f.tar.xz pttbbs-a69760c32a629bf057636bed4abbafa90f949c5f.tar.zst pttbbs-a69760c32a629bf057636bed4abbafa90f949c5f.zip |
Allow loggint "edit title" operations.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5807 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/include/config.h | 3 | ||||
-rw-r--r-- | pttbbs/mbbsd/bbs.c | 17 |
2 files changed, 18 insertions, 2 deletions
diff --git a/pttbbs/include/config.h b/pttbbs/include/config.h index 437c19d7..8bcfa22c 100644 --- a/pttbbs/include/config.h +++ b/pttbbs/include/config.h @@ -462,6 +462,9 @@ #ifndef LOG_CONF_OSONG_VERBOSE // �Բ��I���O�� #define LOG_CONF_OSONG_VERBOSE (0) #endif +#ifndef LOG_CONF_EDIT_TITLE // �s����D�O�� +#define LOG_CONF_EDIT_TITLE (0) +#endif ///////////////////////////////////////////////////////////////////////////// // Default Configurations �w�]�Ѽ� diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c index 092dc38c..0c2e4bda 100644 --- a/pttbbs/mbbsd/bbs.c +++ b/pttbbs/mbbsd/bbs.c @@ -1947,7 +1947,14 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct) #endif fhdr->modified = dasht(genbuf); - strlcpy(fhdr->title, save_title, sizeof(fhdr->title)); + if (strcmp(save_title, fhdr->title) != 0) { + LOG_IF(LOG_CONF_EDIT_TITLE, + log_filef("log/edit_title.log", LOG_CREAT, + "%s %s(E) %s(%s) %s => %s\n", Cdatelite(&now), + cuser.userid, currboard, fhdr->title, fhdr->owner, + save_title)); + strlcpy(fhdr->title, save_title, sizeof(fhdr->title)); + } // substitute_ref_record(direct, fhdr, ent); modify_dir_lite(direct, ent, fhdr->filename, fhdr->modified, save_title, 0); @@ -2584,7 +2591,8 @@ edit_title(int ent, fileheader_t * fhdr, const char *direct) // check TN_ANNOUNCE again for non-BMs... tn_safe_strip(genbuf); strlcpy(tmpfhdr.title, genbuf, sizeof(tmpfhdr.title)); - dirty++; + if (strcmp(tmpfhdr.title, fhdr->title) != 0) + dirty++; } if (allow >= 2) @@ -2616,6 +2624,11 @@ edit_title(int ent, fileheader_t * fhdr, const char *direct) *fhdr = tmpfhdr; // TODO fix race condition here. substitute_ref_record(direct, fhdr, ent); + LOG_IF(LOG_CONF_EDIT_TITLE, + log_filef("log/edit_title.log", LOG_CREAT, + "%s %s(T) %s(%s) %s => %s\n", Cdatelite(&now), + cuser.userid, currboard, curr.title, curr.owner, + fhdr->title)); } } return FULLUPDATE; |