diff options
-rw-r--r-- | pttbbs/mbbsd/bbs.c | 13 | ||||
-rw-r--r-- | pttbbs/mbbsd/mail.c | 30 |
2 files changed, 28 insertions, 15 deletions
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c index e3c96c4f..d5aa167a 100644 --- a/pttbbs/mbbsd/bbs.c +++ b/pttbbs/mbbsd/bbs.c @@ -670,7 +670,7 @@ readdoent(int num, fileheader_t * ent) else if (title == ent->title) color = '1', mark = "□"; else if (ent->title[0] == str_forward[0]) - color = '3', mark = "F:"; + color = '6', mark = "轉"; else // if (ent->title[0] == str_reply[0]) color = '3', mark = "R:"; @@ -1042,9 +1042,14 @@ log_crosspost_in_allpost(const char *brd, const fileheader_t *postfile) { memcpy(&fh, postfile, sizeof(fileheader_t)); fh.filemode = FILE_LOCAL; + // TODO trust fh.owner? strlcpy(fh.owner, cuser.userid, sizeof(fh.owner)); - strlcpy(genbuf, title, len); - DBCS_safe_trim(genbuf); + strlcpy(genbuf, title, len + 1); + if (strlen(title) > len) { + genbuf[len-2] = 0; + DBCS_safe_trim(genbuf); + strcat(genbuf, "…"); + } snprintf(fh.title, sizeof(fh.title), "%s%-*.*s.%s板", str_forward, len, len, genbuf, brd); @@ -1998,7 +2003,7 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct) if (genbuf[0] == '2') break; ent = 0; - if (is_owner) + if (!HasUserPerm(PERM_SYSOP)) break; getdata(2, 0, "保留原作者名稱嗎?[Y] ", inputbuf, 3, DOECHO); if (inputbuf[0] != 'n' && inputbuf[0] != 'N') diff --git a/pttbbs/mbbsd/mail.c b/pttbbs/mbbsd/mail.c index f445b861..31799e90 100644 --- a/pttbbs/mbbsd/mail.c +++ b/pttbbs/mbbsd/mail.c @@ -1570,19 +1570,27 @@ mail_cross_post(int unused_arg, fileheader_t * fhdr, const char *direct) return READ_REDRAW; #endif + // TODO reuse the code in bbs.c cross_post ans = 1; - if (HasUserPerm(PERM_SYSOP) || !strcmp(fhdr->owner, cuser.userid)) { - getdata(2, 0, "(1)原文轉載 (2)舊轉錄格式?[1] ", - genbuf, 3, DOECHO); - if (genbuf[0] != '2') { - ans = 0; - getdata(2, 0, "保留原作者名稱嗎?[Y] ", inputbuf, 3, DOECHO); - if (inputbuf[0] != 'n' && inputbuf[0] != 'N') - author = 1; - } - } + author = 0; + do { + int is_owner = is_file_owner(fhdr, &cuser); + if (!HasUserPerm(PERM_SYSOP) && !is_owner) + break; + getdata(2, 0, "(1)原文轉載 (2)標為轉錄文章?[1] ", genbuf, 3, DOECHO); + if (genbuf[0] == '2') + break; + ans = 0; + if (!HasUserPerm(PERM_SYSOP)) + break; + getdata(2, 0, "保留原作者名稱嗎?[Y] ", inputbuf, 3, DOECHO); + if (inputbuf[0] != 'n' && inputbuf[0] != 'N') + author = '1'; + } while (0); + if (ans) - snprintf(xtitle, sizeof(xtitle), "[轉錄]%.66s", fhdr->title); + snprintf(xtitle, sizeof(xtitle), "%s%.66s", + str_forward, fhdr->title); else strlcpy(xtitle, fhdr->title, sizeof(xtitle)); |