summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2010-05-22 16:54:39 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2010-05-22 16:54:39 +0800
commit99108425526ec14e4e9fabb716a2355eb82433a8 (patch)
tree3247df359d2ff431ae522ae7a5f4005be1d9d6de
parentdc9f4aaaf52284e8df2eae4d6a57494ada5c3177 (diff)
downloadpttbbs-99108425526ec14e4e9fabb716a2355eb82433a8.tar
pttbbs-99108425526ec14e4e9fabb716a2355eb82433a8.tar.gz
pttbbs-99108425526ec14e4e9fabb716a2355eb82433a8.tar.bz2
pttbbs-99108425526ec14e4e9fabb716a2355eb82433a8.tar.lz
pttbbs-99108425526ec14e4e9fabb716a2355eb82433a8.tar.xz
pttbbs-99108425526ec14e4e9fabb716a2355eb82433a8.tar.zst
pttbbs-99108425526ec14e4e9fabb716a2355eb82433a8.zip
* add prompt for kind of 'post/mail/reply' (idea from PttSuggest)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5050 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/include/common.h3
-rw-r--r--pttbbs/mbbsd/bbs.c7
-rw-r--r--pttbbs/mbbsd/edit.c25
-rw-r--r--pttbbs/mbbsd/mail.c7
4 files changed, 39 insertions, 3 deletions
diff --git a/pttbbs/include/common.h b/pttbbs/include/common.h
index 3da493dd..6e3c8540 100644
--- a/pttbbs/include/common.h
+++ b/pttbbs/include/common.h
@@ -223,6 +223,9 @@
#define EDITFLAG_ALLOWLARGE (0x00000004)
#define EDITFLAG_ALLOWTITLE (0x00000008)
// #define EDITFLAG_ANONYMOUS (0x00000010)
+#define EDITFLAG_KIND_NEWPOST (0x00000010)
+#define EDITFLAG_KIND_REPLYPOST (0x00000020)
+#define EDITFLAG_KIND_SENDMAIL (0x00000040)
#define EDIT_ABORTED -1
/* ----------------------------------------------------- */
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c
index 7fe3f5fe..6b7e753e 100644
--- a/pttbbs/mbbsd/bbs.c
+++ b/pttbbs/mbbsd/bbs.c
@@ -1095,6 +1095,13 @@ do_general(int garbage)
};
#endif
+ // XXX I think the 'kind' determination looks really weird here.
+ // However legacy BBS code here was a mass... so let's workaround it.
+ edflags |= (quote_file[0] ?
+ EDITFLAG_KIND_REPLYPOST : EDITFLAG_KIND_NEWPOST);
+ if (curredit & EDIT_BOTH)
+ edflags |= EDITFLAG_KIND_SENDMAIL;
+
money = vedit2(fpath, YEA, &islocal, save_title, edflags);
if (money == EDIT_ABORTED) {
unlink(fpath);
diff --git a/pttbbs/mbbsd/edit.c b/pttbbs/mbbsd/edit.c
index c11480e9..9f61c15e 100644
--- a/pttbbs/mbbsd/edit.c
+++ b/pttbbs/mbbsd/edit.c
@@ -459,6 +459,25 @@ edit_msg(void)
vs_footer(" 編輯文章 ", buf);
}
+static const char *
+get_edit_kind_prompt(int flags)
+{
+ int has_reply_post = (flags & EDITFLAG_KIND_REPLYPOST),
+ has_reply_mail = (flags & EDITFLAG_KIND_SENDMAIL),
+ has_new_post = (flags & EDITFLAG_KIND_NEWPOST);
+
+ if (has_reply_post && has_reply_mail)
+ return ANSI_COLOR(0;1;37;45)
+ "注意:您即將 回信給原作者 並同時 回覆文章至看板上" ANSI_RESET;
+ if (has_reply_mail)
+ return ANSI_COLOR(0;1;31) "注意:您即將 寄出 私人信件" ANSI_RESET;
+ if (has_reply_post)
+ return ANSI_COLOR(0;1;33) "注意:您即將 回覆 文章至看板上" ANSI_RESET;
+ if (has_new_post)
+ return ANSI_COLOR(0;1;32) "注意:您即將 發表 新文章至看板上" ANSI_RESET;
+ return NULL;
+}
+
//#define SLOW_CHECK_DETAIL
static void
edit_buffer_check_healthy(textline_t *line)
@@ -1811,7 +1830,8 @@ static void upload_file(void);
// KEEP_EDITING if keep editing
// 0 if write ok & exit
static int
-write_file(const char *fpath, int saveheader, int *islocal, char mytitle[STRLEN], int upload, int chtitle, int *pentropy)
+write_file(const char *fpath, int saveheader, int *islocal, char mytitle[STRLEN],
+ int upload, int chtitle, const char *kind_prompt, int *pentropy)
{
FILE *fp = NULL;
textline_t *p;
@@ -1846,6 +1866,8 @@ write_file(const char *fpath, int saveheader, int *islocal, char mytitle[STRLEN]
outs(" (A)放棄 (E)繼續 (R/W/D)讀寫刪暫存檔");
+ if (kind_prompt)
+ mvouts(4, 0, kind_prompt);
getdata(2, 0, "確定要儲存檔案嗎? ", ans, 2, LCECHO);
// avoid lots pots
@@ -3643,6 +3665,7 @@ vedit2(const char *fpath, int saveheader, int *islocal, char title[STRLEN], int
tmp = write_file(fpath, saveheader, islocal, title,
(flags & EDITFLAG_UPLOAD) ? 1 : 0,
(flags & EDITFLAG_ALLOWTITLE) ? 1 : 0,
+ get_edit_kind_prompt(flags),
&entropy);
if (tmp != KEEP_EDITING) {
currutmp->mode = mode0;
diff --git a/pttbbs/mbbsd/mail.c b/pttbbs/mbbsd/mail.c
index 39049777..6e368a4d 100644
--- a/pttbbs/mbbsd/mail.c
+++ b/pttbbs/mbbsd/mail.c
@@ -413,7 +413,9 @@ do_innersend(const char *userid, char *mfpath, const char *title, char *newtitle
strlcpy(mhdr.owner, cuser.userid, sizeof(mhdr.owner));
strlcpy(save_title, title, sizeof(save_title));
- if (vedit(mfpath, YEA, NULL, save_title) == EDIT_ABORTED) {
+ if (vedit2(mfpath, YEA, NULL, save_title,
+ EDITFLAG_ALLOWTITLE | EDITFLAG_KIND_SENDMAIL) == EDIT_ABORTED)
+ {
unlink(mfpath);
setutmpmode(oldstat);
return -2;
@@ -476,7 +478,8 @@ do_send(const char *userid, const char *title)
sethomepath(fpath, cuser.userid);
stampfile(fpath, &mhdr);
- if (vedit(fpath, NA, NULL, save_title) == EDIT_ABORTED) {
+ if (vedit2(fpath, NA, NULL, save_title,
+ EDITFLAG_ALLOWTITLE | EDITFLAG_KIND_SENDMAIL) == EDIT_ABORTED) {
unlink(fpath);
clear();
return -2;