summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/pttstruct.h3
-rw-r--r--mbbsd/bbs.c13
-rw-r--r--mbbsd/record.c29
3 files changed, 25 insertions, 20 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index f6803dcc..42729372 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -350,7 +350,8 @@ typedef int (* onekey_t)();
/* anti_crosspost */
typedef struct crosspost_t {
int checksum[4]; /* 0 -> 'X' cross post 1-3 -> 簡查文章行 */
- int times; /* 第幾次 */
+ short times; /* 第幾次 */
+ short last_bid; /* crossport to which board */
} crosspost_t;
#define SORT_BY_ID 0
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index c6efd63e..707dd98f 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -934,6 +934,7 @@ edit_post(int ent, fileheader_t * fhdr, char *direct)
Rename(fpath, genbuf);
if(strcmp(save_title, fhdr->title)){
// Ptt: here is the black hole problem
+ // (try getindex)
strcpy(fhdr->title, save_title);
substitute_ref_record(direct, fhdr, ent);
}
@@ -950,7 +951,7 @@ cross_post(int ent, fileheader_t * fhdr, char *direct)
char inputbuf[10], genbuf[200], genbuf2[4];
fileheader_t xfile;
FILE *xptr;
- int author = 0;
+ int author;
boardheader_t *bp;
if (!CheckPostPerm()) {
@@ -973,17 +974,23 @@ cross_post(int ent, fileheader_t * fhdr, char *direct)
if (*xboard == '\0' || !haspostperm(xboard))
return FULLUPDATE;
- if ((ent = str_checksum(fhdr->title)) != 0 &&
- ent == postrecord.checksum[0]) {
+ /* 借用變數 */
+ ent = str_checksum(fhdr->title);
+ author = getbnum(xboard);
+
+ if ((ent != 0 && ent == postrecord.checksum[0]) &&
+ (author != 0 && author != postrecord.last_bid)) {
/* 檢查 cross post 次數 */
if (postrecord.times++ > MAX_CROSSNUM)
anticrosspost();
} else {
postrecord.times = 0;
+ postrecord.last_bid = author;
postrecord.checksum[0] = ent;
}
ent = 1;
+ author = 0;
if (HAS_PERM(PERM_SYSOP) || !strcmp(fhdr->owner, cuser.userid)) {
getdata(2, 0, "(1)原文轉載 (2)舊轉錄格式?[1] ",
genbuf, 3, DOECHO);
diff --git a/mbbsd/record.c b/mbbsd/record.c
index 616c8425..1ff65353 100644
--- a/mbbsd/record.c
+++ b/mbbsd/record.c
@@ -137,22 +137,19 @@ substitute_ref_record(char *direct, fileheader_t * fhdr, int ent)
/* rocker.011018: 串接模式用reference增進效率 */
if (!(fhdr->filemode & FILE_BOTTOM) && (fhdr->money & FHR_REFERENCE) &&
- (num = fhdr->money & ~FHR_REFERENCE)){
- setdirpath(genbuf, direct, ".DIR");
- get_record(genbuf, &hdr, sizeof(hdr), num);
- if (strcmp(hdr.filename, fhdr->filename))
- {
- if((num = getindex(genbuf, fhdr, num))>0)
- {
- substitute_record(genbuf, fhdr, sizeof(*fhdr), num);
- }
- }
- else if(num>0)
- {
- fhdr->money = hdr.money;
- substitute_record(genbuf, fhdr, sizeof(*fhdr), num);
- }
- fhdr->money = FHR_REFERENCE | num ; // Ptt: update now!
+ (num = fhdr->money & ~FHR_REFERENCE)){
+ setdirpath(genbuf, direct, ".DIR");
+ get_record(genbuf, &hdr, sizeof(hdr), num);
+ if (strcmp(hdr.filename, fhdr->filename)) {
+ if((num = getindex(genbuf, fhdr, num))>0) {
+ substitute_record(genbuf, fhdr, sizeof(*fhdr), num);
+ }
+ }
+ else if(num>0) {
+ fhdr->money = hdr.money;
+ substitute_record(genbuf, fhdr, sizeof(*fhdr), num);
+ }
+ fhdr->money = FHR_REFERENCE | num ; // Ptt: update now!
}
substitute_record(direct, fhdr, sizeof(*fhdr), ent);
return num;