summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-07-23 00:57:36 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-07-23 00:57:36 +0800
commit83431f2cd992c38eb2fbc3b5095c52034fd2ff3f (patch)
tree6ee954826c28f78a972cbd622ffa0ddb6586553c
parentecb8b2d326822691b2633451732f8d7685353383 (diff)
downloadpttbbs-83431f2cd992c38eb2fbc3b5095c52034fd2ff3f.tar
pttbbs-83431f2cd992c38eb2fbc3b5095c52034fd2ff3f.tar.gz
pttbbs-83431f2cd992c38eb2fbc3b5095c52034fd2ff3f.tar.bz2
pttbbs-83431f2cd992c38eb2fbc3b5095c52034fd2ff3f.tar.lz
pttbbs-83431f2cd992c38eb2fbc3b5095c52034fd2ff3f.tar.xz
pttbbs-83431f2cd992c38eb2fbc3b5095c52034fd2ff3f.tar.zst
pttbbs-83431f2cd992c38eb2fbc3b5095c52034fd2ff3f.zip
sync with PTT1 local modified source:
- debug with msgfwderr - enlarge thread search range - more verbose board info git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2942 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/pttbbs.conf1
-rw-r--r--mbbsd/mail.c37
-rw-r--r--mbbsd/read.c23
-rw-r--r--sample/pttbbs.conf7
-rw-r--r--util/shmctl.c34
5 files changed, 91 insertions, 11 deletions
diff --git a/include/pttbbs.conf b/include/pttbbs.conf
index f4ed772a..3017382d 100644
--- a/include/pttbbs.conf
+++ b/include/pttbbs.conf
@@ -7,6 +7,7 @@
#define BBSUID 9999
#define BBSGID 99
+#define THREAD_SEARCH_RANGE (500)
#define MAX_USERS 150000
#define MAX_ACTIVE 4096
#define MAX_CPULOAD 50
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 59b1c30b..8d863d63 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -120,11 +120,42 @@ mail_id(const char *id, const char *title, const char *src, const char *owner)
int
invalidaddr(const char *addr)
{
+#ifdef DEBUG_FWDADDRERR
+ const char *origaddr = addr;
+ char errmsg[PATHLEN];
+#endif
+
if (*addr == '\0')
return 1; /* blank */
+
while (*addr) {
+#ifdef DEBUG_FWDADDRERR
if (not_alnum(*addr) && !strchr("[].@-_", *addr))
+ {
+ int c = (*addr) & 0xff;
+ clear();
+ move(2,0);
+ outs(
+ "您輸入的位址錯誤 (address error)。 \n\n"
+ "由於最近許\多人反應打入正確的位址(id或email)後系統會判斷錯誤\n"
+ "但檢查不出原因,所以我們需要正確的錯誤回報。\n\n"
+ "如果你確實打錯了,請直接略過下面的說明。\n"
+ "如果你認為你輸入的位址確實是對的,請把下面的訊息複製起來\n"
+ "並貼到 SYSOP 或 PttBug 板。本站為造成不便深感抱歉。\n\n"
+ ANSI_COLOR(1;33));
+ sprintf(errmsg, "原始輸入位址: [%s]\n"
+ "錯誤位置: 第 %d 字元: 0x%02X [ %c ]\n",
+ origaddr, (int)(addr - origaddr+1), c, c);
+ outs(errmsg);
+ outs(ANSI_RESET);
+ vmsg("請按任意鍵繼續");
+ clear();
return 1;
+ }
+#else
+ if (not_alnum(*addr) && !strchr("[].@-_", *addr))
+ return 1;
+#endif
addr++;
}
return 0;
@@ -1607,10 +1638,10 @@ bsmtp(const char *fpath, const char *title, const char *rcpt, int method)
int
doforward(const char *direct, const fileheader_t * fh, int mode)
{
- static char address[60];
- char fname[500];
+ static char address[STRLEN] = "";
+ char fname[PATHLEN];
+ char genbuf[PATHLEN];
int return_no;
- char genbuf[200];
if (!address[0])
strlcpy(address, cuser.email, sizeof(address));
diff --git a/mbbsd/read.c b/mbbsd/read.c
index 62d9acdb..0e9974e7 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -313,7 +313,7 @@ static int
thread(const keeploc_t * locmem, int stypen)
{
fileheader_t fh;
- int pos = locmem->crs_ln, jump = 200, new_ln;
+ int pos = locmem->crs_ln, jump = THREAD_SEARCH_RANGE, new_ln;
int fd = -1, amatch = -1;
int step = (stypen & RS_FORWARD) ? 1 : -1;
char *key;
@@ -336,7 +336,8 @@ thread(const keeploc_t * locmem, int stypen)
break;
else if( !strncmp(&fh.title[4], key, PROPER_TITLE_LEN) ) {
amatch = new_ln;
- jump = 200; /* 當搜尋同主題第一篇, 連續找不到 200 篇才停 */
+ jump = THREAD_SEARCH_RANGE;
+ /* 當搜尋同主題第一篇, 連續找不到多少篇才停 */
}
}
else if( !strncmp(subject(fh.title), key, PROPER_TITLE_LEN) )
@@ -366,7 +367,8 @@ mail_forward(const fileheader_t * fhdr, const char *direct, int mode)
char buf[STRLEN];
char *p;
- strncpy(buf, direct, sizeof(buf));
+ strncpy(buf, direct, sizeof(buf)-1);
+ buf[sizeof(buf)-1] = 0;
if ((p = strrchr(buf, '/')))
*p = '\0';
switch (i = doforward(buf, fhdr, mode)) {
@@ -377,7 +379,9 @@ mail_forward(const fileheader_t * fhdr, const char *direct, int mode)
vmsg(msg_fwd_err1);
break;
case -2:
+#ifndef DEBUG_FWDADDRERR
vmsg(msg_fwd_err2);
+#endif
break;
default:
break;
@@ -696,7 +700,8 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
mail_forward(&headers[locmem->crs_ln - locmem->top_ln],
currdirect, ch /* == 'U' */ );
/* by CharlieL */
- mode = READ_REDRAW;
+ // mode = READ_REDRAW;
+ return FULLUPDATE;
}
break;
@@ -918,9 +923,19 @@ i_read(int cmdmode, const char *direct, void (*dotitle) (),
if (bidcache > 0 && !(currmode & (MODE_SELECT | MODE_DIGEST))){
bottom_line = getbtotal(currbid);
num = bottom_line+getbottomtotal(currbid);
+ if(num == 0)
+ {
+ recbase = -1;
+ }
}
else
+ {
num = get_num_records(currdirect, FHSZ);
+ if(num == 0)
+ {
+ recbase = -1;
+ }
+ }
if (last_line != num) {
last_line = num;
diff --git a/sample/pttbbs.conf b/sample/pttbbs.conf
index 0d728b61..3ec5fe88 100644
--- a/sample/pttbbs.conf
+++ b/sample/pttbbs.conf
@@ -43,6 +43,9 @@
/* 最大開板個數, 每個會用掉 6420 bytes 的 shared-memory */
#define MAX_BOARD (8192)
+/* 主題式閱讀搜尋範圍,文章多可試著加大,但小心對效能影響 */
+#define THREAD_SEARCH_RANGE (500)
+
/* 幫忙寄信的 server, 一般設成自己(即ip: 127.0.0.1)就可以 */
#define RELAY_SERVER_IP "127.0.0.1"
@@ -79,6 +82,10 @@
/* 若定義, 若程式失敗, 會等待 86400 秒以讓 gdb來 attach */
#define DEBUGSLEEP
+/* 若定義, 在轉寄位址輸入錯誤時會有讓使用者回報訊息的提示 */
+/* 這個選項存在的原因是因為有部份使用者信誓旦旦說他們沒打錯但看不出程式錯誤 */
+//#define DEBUG_FWDADDRERR
+
/* 若定義, 用一個奇怪的數字來檢查我的最愛和看板列表是否錯誤 */
#define MEM_CHECK 0x98761234
diff --git a/util/shmctl.c b/util/shmctl.c
index 0430f4f1..8629fc4f 100644
--- a/util/shmctl.c
+++ b/util/shmctl.c
@@ -600,10 +600,36 @@ int listbrd(int argc, char **argv)
/* print details */
boardheader_t b = bcache[di-1];
- printf("brdname(bid):\t%s\n", b.brdname);
- printf("title:\t%s\n", b.title);
- printf("BM:\t%s\n", b.BM);
- printf("brdattr:\t%08x\n", b.brdattr);
+ printf("brdname(bid):\t%s\n", b.brdname);
+ printf("title:\t%s\n", b.title);
+ printf("BM:\t%s\n", b.BM);
+ printf("brdattr:\t%08x ", b.brdattr);
+
+ if (b.brdattr & BRD_NOZAP) printf("BRD_NOZAP ");
+ if (b.brdattr & BRD_NOCOUNT) printf("BRD_NOCOUNT ");
+ if (b.brdattr & BRD_NOTRAN) printf("BRD_NOTRAN ");
+ if (b.brdattr & BRD_GROUPBOARD) printf("BRD_GROUPBOARD ");
+ if (b.brdattr & BRD_HIDE) printf("BRD_HIDE ");
+ if (b.brdattr & BRD_POSTMASK) printf("BRD_POSTMASK ");
+ if (b.brdattr & BRD_ANONYMOUS) printf("BRD_ANONYMOUS ");
+ if (b.brdattr & BRD_DEFAULTANONYMOUS) printf("BRD_DEFAULTANONYMOUS ");
+ if (b.brdattr & BRD_BAD) printf("BRD_BAD ");
+ if (b.brdattr & BRD_VOTEBOARD) printf("BRD_VOTEBOARD ");
+ if (b.brdattr & BRD_WARNEL) printf("BRD_WARNEL ");
+ if (b.brdattr & BRD_TOP) printf("BRD_TOP ");
+ if (b.brdattr & BRD_NORECOMMEND) printf("BRD_NORECOMMEND ");
+ if (b.brdattr & BRD_BLOG) printf("BRD_BLOG ");
+ if (b.brdattr & BRD_BMCOUNT) printf("BRD_BMCOUNT ");
+ if (b.brdattr & BRD_SYMBOLIC) printf("BRD_SYMBOLIC ");
+ if (b.brdattr & BRD_NOBOO) printf("BRD_NOBOO ");
+ if (b.brdattr & BRD_LOCALSAVE) printf("BRD_LOCALSAVE ");
+ if (b.brdattr & BRD_RESTRICTEDPOST) printf("BRD_RESTRICTEDPOST ");
+ if (b.brdattr & BRD_GUESTPOST) printf("BRD_GUESTPOST ");
+#ifdef USE_COOLDOWN
+ if (b.brdattr & BRD_COOLDOWN) printf("BRD_COOLDOWN ");
+#endif
+ printf("\n");
+
printf("post_limit_posts:\t%d\n", b.post_limit_posts);
printf("post_limit_logins:\t%d\n", b.post_limit_logins);
printf("post_limit_regtime:\t%d\n", b.post_limit_regtime);