summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-06-16 15:26:12 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-06-16 15:26:12 +0800
commita4ca9945a1f90b2c65d73ecc454d98028a4ea0d7 (patch)
tree1ab335a00de543d08d02e62d89d53796ec0f5c6d
parentf7f94492d83cd0a7f70f4eda0f64e208aa8084fa (diff)
downloadpttbbs-a4ca9945a1f90b2c65d73ecc454d98028a4ea0d7.tar
pttbbs-a4ca9945a1f90b2c65d73ecc454d98028a4ea0d7.tar.gz
pttbbs-a4ca9945a1f90b2c65d73ecc454d98028a4ea0d7.tar.bz2
pttbbs-a4ca9945a1f90b2c65d73ecc454d98028a4ea0d7.tar.lz
pttbbs-a4ca9945a1f90b2c65d73ecc454d98028a4ea0d7.tar.xz
pttbbs-a4ca9945a1f90b2c65d73ecc454d98028a4ea0d7.tar.zst
pttbbs-a4ca9945a1f90b2c65d73ecc454d98028a4ea0d7.zip
1.remove str_checksum() (use StringHash() now)
2.prevent cross posting from mail git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3371 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/bbs.c2
-rw-r--r--mbbsd/edit.c2
-rw-r--r--mbbsd/mail.c18
-rw-r--r--mbbsd/stuff.c11
4 files changed, 20 insertions, 13 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 9b0d736c..e31138a5 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1323,7 +1323,7 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct)
}
/* 借用變數 */
- ent = str_checksum(fhdr->title);
+ ent = StringHash(fhdr->title);
author = getbnum(xboard);
assert(0<=author-1 && author-1<MAX_BOARD);
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index dc537f44..cf7ff8c1 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1645,7 +1645,7 @@ write_file(char *fpath, int saveheader, int *islocal, char *mytitle)
line++;
/* check crosspost */
if (currstat == POSTING && po ) {
- int msgsum = str_checksum(msg);
+ int msgsum = StringHash(msg);
if (msgsum) {
if (postrecord.last_bid != currbid &&
postrecord.checksum[po] == msgsum) {
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index b7011872..638dd393 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -1262,6 +1262,10 @@ mail_cross_post(int ent, fileheader_t * fhdr, const char *direct)
char genbuf[200];
char genbuf2[4];
+ if (!CheckPostPerm()) {
+ vmsg("對不起,您目前無法轉錄文章!");
+ return FULLUPDATE;
+ }
move(2, 0);
clrtoeol();
move(1, 0);
@@ -1269,6 +1273,20 @@ mail_cross_post(int ent, fileheader_t * fhdr, const char *direct)
if (*xboard == '\0' || !haspostperm(xboard))
return FULLUPDATE;
+ /* 借用變數 */
+ ent = StringHash(fhdr->title);
+ /* 同樣 title 不管對哪個板都算 cross post , 所以不用檢查 author */
+
+ if ((ent != 0 && ent == postrecord.checksum[0])) {
+ /* 檢查 cross post 次數 */
+ if (postrecord.times++ > MAX_CROSSNUM)
+ anticrosspost();
+ } else {
+ postrecord.times = 0;
+ postrecord.last_bid = 0;
+ postrecord.checksum[0] = ent;
+ }
+
ent = getbnum(xboard);
assert(0<=ent-1 && ent-1<MAX_BOARD);
if ( !(HasUserPerm(PERM_SYSOP)) &&
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index b4b479f2..6a37d816 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -131,17 +131,6 @@ subject(char *title)
/* ----------------------------------------------------- */
/* 字串轉換檢查函數 */
/* ----------------------------------------------------- */
-int
-str_checksum(const char *str)
-{
- int n = 1;
- if (strlen(str) < 6)
- return 0;
- while (*str)
- n += *(str++) * (n);
- return n;
-}
-
/**
* 將字串 s 轉為小寫存回 t
* @param t allocated char array