summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-19 09:56:21 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-19 09:56:21 +0800
commit3fb733dd415e5f0fd762e5f14272e400b20ca990 (patch)
tree9d847f03d38dad3421449969f47ccd476cd67058
parent17799f4670364f95b26c99a68a5fb44a5470a721 (diff)
downloadpttbbs-3fb733dd415e5f0fd762e5f14272e400b20ca990.tar
pttbbs-3fb733dd415e5f0fd762e5f14272e400b20ca990.tar.gz
pttbbs-3fb733dd415e5f0fd762e5f14272e400b20ca990.tar.bz2
pttbbs-3fb733dd415e5f0fd762e5f14272e400b20ca990.tar.lz
pttbbs-3fb733dd415e5f0fd762e5f14272e400b20ca990.tar.xz
pttbbs-3fb733dd415e5f0fd762e5f14272e400b20ca990.tar.zst
pttbbs-3fb733dd415e5f0fd762e5f14272e400b20ca990.zip
- exp: edit/upload now enabled for special boards
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3707 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/common.h9
-rw-r--r--include/proto.h2
-rw-r--r--mbbsd/bbs.c26
-rw-r--r--mbbsd/edit.c32
-rw-r--r--sample/pttbbs.conf6
5 files changed, 54 insertions, 21 deletions
diff --git a/include/common.h b/include/common.h
index a94829c8..dcdfb8ad 100644
--- a/include/common.h
+++ b/include/common.h
@@ -235,7 +235,16 @@
#define REPLYING 0
#define RECVINREPLYING 1
+/* ----------------------------------------------------- */
+/* 編輯器選項 */
+/* ----------------------------------------------------- */
+#define EDITFLAG_TEXTONLY (0x00000001)
+#define EDITFLAG_UPLOAD (0x00000002)
+
+/* ----------------------------------------------------- */
+/* Macros */
+/* ----------------------------------------------------- */
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
#define __builtin_expect(exp,c) (exp)
diff --git a/include/proto.h b/include/proto.h
index 806cb94f..2746a05b 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -222,7 +222,7 @@ int dice_main(void);
/* edit */
int vedit(char *fpath, int saveheader, int *islocal);
-int vedit2(char *fpath, int saveheader, int *islocal, int textOnly);
+int vedit2(char *fpath, int saveheader, int *islocal, int flags);
void write_header(FILE *fp, char *mytitle);
void addsignature(FILE *fp, int ifuseanony);
void auto_backup(void);
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 1d10941d..0baf6de9 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -856,7 +856,7 @@ do_general(int isbid)
char ctype[8][5] = {"問題", "建議", "討論", "心得",
"閒聊", "請益", "公告", "情報"};
boardheader_t *bp;
- int islocal, posttype=-1;
+ int islocal, posttype=-1, edflags = 0;
ifuseanony = 0;
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
@@ -970,8 +970,15 @@ do_general(int isbid)
setbnfile(genbuf, bp->brdname, "postsample", posttype);
Copy(genbuf, fpath);
}
+
+#ifdef EXP_EDIT_UPLOAD
+# ifdef GLOBAL_BBSMOVIE
+ if (strcmp(currboard, GLOBAL_BBSMOVIE) == 0)
+ edflags |= EDITFLAG_UPLOAD;
+# endif // GLOBAL_BBSMOVIE
+#endif // EXP_EDIT_UPLOAD
- aborted = vedit(fpath, YEA, &islocal);
+ aborted = vedit2(fpath, YEA, &islocal, edflags);
if (aborted == -1) {
unlink(fpath);
pressanykey();
@@ -1327,11 +1334,17 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
// int recordTouched = 0;
time4_t oldmt, newmt;
off_t oldsz;
+ int edflags = 0;
#ifdef EDITPOST_SMARTMERGE
char canDoSmartMerge = 1;
#endif // EDITPOST_SMARTMERGE
+#ifdef EXP_EDITPOST_TEXTONLY
+ // experimental: "text only" editing
+ edflags |= EXP_EDITPOST_TEXTONLY;
+#endif
+
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
if (strcmp(bp->brdname, GLOBAL_SECURITY) == 0)
return DONOTHING;
@@ -1397,14 +1410,9 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
#endif // EDITPOST_SMARTMERGE
-#ifdef EXP_EDITPOST_TEXTONLY
- // experimental: "text only" editing
- if (vedit2(fpath, 0, NULL, 1) == -1)
- break;
-#else
- if (vedit(fpath, 0, NULL) == -1)
+
+ if (vedit2(fpath, 0, NULL, edflags) == -1)
break;
-#endif
newmt = dasht(genbuf);
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index a5044dc5..813bda39 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1639,7 +1639,7 @@ static void upload_file(void);
#endif // EXP_EDIT_UPLOAD
static int
-write_file(char *fpath, int saveheader, int *islocal, char *mytitle)
+write_file(char *fpath, int saveheader, int *islocal, char *mytitle, int upload)
{
struct tm *ptime;
FILE *fp = NULL;
@@ -1648,15 +1648,24 @@ write_file(char *fpath, int saveheader, int *islocal, char *mytitle)
int aborted = 0, line = 0, checksum[3], sum = 0, po = 1;
stand_title("檔案處理");
+ move(1,0);
+
+ // common trail
+
if (currstat == SMAIL)
- msg = "[S]儲存 (A)放棄 (T)改標題 (E)繼續 (R/W/D)讀寫刪暫存檔?";
+ outs("[S]儲存");
else if (local_article)
- msg = "[L]站內信件 (S)儲存 (A)放棄 (T)改標題 (E)繼續 "
- "(R/W/D)讀寫刪暫存檔?";
+ outs("[L]站內信件 (S)儲存");
else
- msg = "[S]儲存 (L)站內信件 (A)放棄 (T)改標題 (E)繼續 "
- "(R/W/D)讀寫刪暫存檔?";
- getdata(1, 0, msg, ans, 2, LCECHO);
+ outs("[S]儲存 (L)站內信件");
+#ifdef EXP_EDIT_UPLOAD
+ if (upload)
+ outs(" (U)上傳資料");
+#endif // EXP_EDIT_UPLOAD
+
+ outs(" (A)放棄 (T)改標題 (E)繼續 (R/W/D)讀寫刪暫存檔");
+
+ getdata(2, 0, "確定要儲存檔案嗎? ", ans, 2, LCECHO);
// avoid lots pots
sleep(1);
@@ -2794,7 +2803,7 @@ upload_file(void)
"請在您的電腦本機端複製好內容後貼上即可開始傳送。\n");
do {
- // if (promptmsg)
+ if (!num_in_buf())
{
move(10, 0); clrtobot();
prints("\n\n資料接收中... %u 位元組。\n", (unsigned int)szdata);
@@ -2845,7 +2854,7 @@ upload_file(void)
/* 編輯處理:主程式、鍵盤處理 */
int
-vedit2(char *fpath, int saveheader, int *islocal, int textOnly)
+vedit2(char *fpath, int saveheader, int *islocal, int flags)
{
char last = 0; /* the last key you press */
int ch, tmp;
@@ -2875,7 +2884,7 @@ vedit2(char *fpath, int saveheader, int *islocal, int textOnly)
curr_buf->firstline = curr_buf->lastline = alloc_line(WRAPMARGIN);
if (*fpath) {
- read_file(fpath, textOnly);
+ read_file(fpath, (flags & EDITFLAG_TEXTONLY) ? 1 : 0);
}
if (*quote_file) {
@@ -3017,7 +3026,8 @@ vedit2(char *fpath, int saveheader, int *islocal, int textOnly)
switch (ch) {
case KEY_F10:
case Ctrl('X'): /* Save and exit */
- tmp = write_file(fpath, saveheader, islocal, mytitle);
+ tmp = write_file(fpath, saveheader, islocal, mytitle,
+ (flags & EDITFLAG_UPLOAD) ? 1 : 0);
if (tmp != KEEP_EDITING) {
strlcpy(save_title, mytitle, sizeof(save_title));
save_title[STRLEN-1] = 0;
diff --git a/sample/pttbbs.conf b/sample/pttbbs.conf
index 7e023e0b..37b416a5 100644
--- a/sample/pttbbs.conf
+++ b/sample/pttbbs.conf
@@ -55,9 +55,15 @@
/* 若定義, 提供美工特別用板 */
#define GLOBAL_ARTDSN "Artdsn"
+/* 若定義,該板發文不受行限或是可上傳 */
+#define GLOBAL_BBSMOVIE "BBSmovie"
+
/* 若定義, 則以此為版名提供全站文摘 */
#define GLOBAL_DIGEST BBSMNAME "Digest"
+// /* 若定義,則.... */
+// #define GLOBAL_WHOAMI "WhoAmI"
+
/* 若定義, 則全站所有五子棋/象棋棋譜都會紀錄在此板 */
//#define GLOBAL_FIVECHESS_LOG BBSMNAME "Five"
//#define GLOBAL_CCHESS_LOG BBSMNAME "CChess"