summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pttbbs/include/proto.h2
-rw-r--r--pttbbs/mbbsd/bbs.c31
-rw-r--r--pttbbs/mbbsd/mail.c14
-rw-r--r--pttbbs/mbbsd/stuff.c3
4 files changed, 20 insertions, 30 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h
index ee79ffd3..47050b43 100644
--- a/pttbbs/include/proto.h
+++ b/pttbbs/include/proto.h
@@ -75,7 +75,7 @@ int CheckModifyPerm(void);
int CheckPostRestriction(int);
void anticrosspost(void);
int Select(void);
-void do_reply_title(int row, const char *title, char result[STRLEN]);
+void do_reply_title(int row, const char *title, const char *prefix, char *result, int len);
void outgo_post(const fileheader_t *fh, const char *board, const char *userid, const char *username);
int edit_title(int ent, fileheader_t *fhdr, const char *direct);
int whereami(void);
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c
index 90217583..ba068121 100644
--- a/pttbbs/mbbsd/bbs.c
+++ b/pttbbs/mbbsd/bbs.c
@@ -1033,17 +1033,20 @@ solveEdFlagByBoard(const char *bn, int flags)
}
void
-do_reply_title(int row, const char *title, char result[STRLEN])
-{
- char genbuf[200];
- char genbuf2[4];
+do_reply_title(int row, const char *title, const char *prefix,
+ char *result, int len) {
+ char ans[4];
- snprintf(result, STRLEN, "%s %s", str_reply, subject(title));
+ snprintf(result, len, "%s %s", prefix, subject(title));
+ if (len > TTLEN)
+ len = TTLEN;
result[TTLEN - 1] = '\0';
+ DBCS_safe_trim(result);
mvouts(row++, 0, "原標題: "); outs(result);
- getdata(row, 0, "採用原標題[Y/n]? ", genbuf2, 3, LCECHO);
- if (genbuf2[0] == 'n')
- getdata(row, 0, "新標題:", result, TTLEN, DOECHO);
+ getdata(row, 0, "採用原標題[Y/n]? ", ans, 3, LCECHO);
+ if (ans[0] == 'n')
+ getdata_str(row, 0, "新標題:", result, len, DOECHO, result);
+
}
void
@@ -1190,7 +1193,8 @@ do_general(int garbage)
currboard, bp->title + 7);
if (quote_file[0])
- do_reply_title(20, currtitle, save_title);
+ do_reply_title(20, currtitle, str_reply, save_title,
+ sizeof(save_title));
else {
char tmp_title[STRLEN]="";
move(21,0);
@@ -2036,15 +2040,8 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct)
if (ans[0] != 'n')
author = '1';
};
- snprintf(xtitle, sizeof(xtitle), "%s %.66s",
- str_forward, subject(fhdr->title));
- mvouts(2, 0, "原標題: "); outs(xtitle);
- getdata(3, 0, "採用原標題[Y/n]? ", genbuf2, 3, LCECHO);
- if (genbuf2[0] == 'n') {
- if (getdata_str(3, 0, "新標題:", genbuf, TTLEN, DOECHO, xtitle))
- strlcpy(xtitle, genbuf, sizeof(xtitle));
- }
+ do_reply_title(2, fhdr->title, str_forward, xtitle, sizeof(xtitle));
// FIXME 這裡可能會有人偷偷生出保留標題(如[公告])
// 不過算了,直接劣退這種人比較方便
// 反正本來就只是想解決「不小心」或是「假裝不小心」用到的情形。
diff --git a/pttbbs/mbbsd/mail.c b/pttbbs/mbbsd/mail.c
index 475c9060..865e0c89 100644
--- a/pttbbs/mbbsd/mail.c
+++ b/pttbbs/mbbsd/mail.c
@@ -712,7 +712,7 @@ multi_send(const char *title)
char save_title[STRLEN];
setutmpmode(SMAIL);
if (title)
- do_reply_title(2, title, save_title);
+ do_reply_title(2, title, str_reply, save_title, sizeof(save_title));
else {
getdata(2, 0, "主題:", fpath, sizeof(fpath), DOECHO);
snprintf(save_title, sizeof(save_title), "[通告] %s", fpath);
@@ -1364,7 +1364,7 @@ mail_reply(int ent, fileheader_t * fhdr, const char *direct)
strlcpy(uid, quote_user, sizeof(uid));
/* make the title */
- do_reply_title(3, fhdr->title, save_title);
+ do_reply_title(3, fhdr->title, str_reply, save_title, sizeof(save_title));
prints("\n收信人: %s\n標 題: %s\n", uid, save_title);
/* edit, then send the mail */
@@ -1587,15 +1587,7 @@ mail_cross_post(int unused_arg, fileheader_t * fhdr, const char *direct)
if (ans[0] != 'n')
author = '1';
}
- snprintf(xtitle, sizeof(xtitle), "%s %.66s",
- str_forward, fhdr->title);
-
- mvouts(2, 0, "原標題: "); outs(xtitle);
- getdata(3, 0, "採用原標題[Y/n]? ", genbuf2, 3, LCECHO);
- if (genbuf2[0] == 'n') {
- if (getdata(3, 0, "新標題:", genbuf, TTLEN, DOECHO))
- strlcpy(xtitle, genbuf, sizeof(xtitle));
- }
+ do_reply_title(2, fhdr->title, str_forward, xtitle, sizeof(xtitle));
getdata(2, 0, "(S)存檔 (L)站內 (Q)取消?[Q] ", genbuf, 3, LCECHO);
if (genbuf[0] == 'l' || genbuf[0] == 's') {
diff --git a/pttbbs/mbbsd/stuff.c b/pttbbs/mbbsd/stuff.c
index 4e1740b2..ebc72cc7 100644
--- a/pttbbs/mbbsd/stuff.c
+++ b/pttbbs/mbbsd/stuff.c
@@ -384,7 +384,8 @@ getdata_buf(int line, int col, const char *prompt, char *buf, int len, int echo)
}
int
-getdata_str(int line, int col, const char *prompt, char *buf, int len, int echo, const char *defaultstr)
+getdata_str(int line, int col, const char *prompt, char *buf, int len, int echo,
+ const char *defaultstr)
{
move(line, col);
if(prompt && *prompt) outs(prompt);