summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2010-10-21 19:25:52 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2010-10-21 19:25:52 +0800
commit721ddbc0f0016dbe05fc8987bf00dd358e6af2e8 (patch)
treecbec60f6020105304f2253efe049b66f05e5b33a
parentc7180de55f1d0cdbfa2ecb9e0309b4c01d454945 (diff)
downloadpttbbs-721ddbc0f0016dbe05fc8987bf00dd358e6af2e8.tar
pttbbs-721ddbc0f0016dbe05fc8987bf00dd358e6af2e8.tar.gz
pttbbs-721ddbc0f0016dbe05fc8987bf00dd358e6af2e8.tar.bz2
pttbbs-721ddbc0f0016dbe05fc8987bf00dd358e6af2e8.tar.lz
pttbbs-721ddbc0f0016dbe05fc8987bf00dd358e6af2e8.tar.xz
pttbbs-721ddbc0f0016dbe05fc8987bf00dd358e6af2e8.tar.zst
pttbbs-721ddbc0f0016dbe05fc8987bf00dd358e6af2e8.zip
change 'mailing to rejected recipients' to report, including the red-envelop
when giving money git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5137 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/mbbsd/bbs.c1
-rw-r--r--pttbbs/mbbsd/cal.c52
-rw-r--r--pttbbs/mbbsd/mail.c96
3 files changed, 100 insertions, 49 deletions
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c
index ccaa3161..e73e7d2f 100644
--- a/pttbbs/mbbsd/bbs.c
+++ b/pttbbs/mbbsd/bbs.c
@@ -1281,6 +1281,7 @@ do_general(int garbage)
/* 回應到原作者信箱 */
+ // TODO should we take care of the reject list here?
if (curredit & EDIT_BOTH) {
char *str, *msg = "回應至作者信箱";
diff --git a/pttbbs/mbbsd/cal.c b/pttbbs/mbbsd/cal.c
index 6c65da3a..c3e0bc51 100644
--- a/pttbbs/mbbsd/cal.c
+++ b/pttbbs/mbbsd/cal.c
@@ -346,7 +346,7 @@ p_give(void)
int
give_money_ui(const char *userid)
{
- int uid;
+ int uid, can_send_mail = 1;
char id[IDLEN + 1], money_buf[20];
char passbuf[PASSLEN];
int m = 0, mtax = 0, tries = 3, skipauth = 0;
@@ -430,6 +430,23 @@ give_money_ui(const char *userid)
}
#endif // PLAY_ANGEL
+ {
+ char fpath[PATHLEN];
+ int in_list;
+
+ // check reject
+ sethomefile(fpath, id, FN_REJECT);
+ in_list = file_exist_record(fpath, cuser.userid);
+ sethomefile(fpath, id, FN_OVERRIDES);
+ if (in_list && !file_exist_record(fpath, cuser.userid)) {
+ move(13, 0);
+ outs(ANSI_COLOR(1;35)
+ "對方拒絕收信,完成交易後將不寄送紅包袋。" ANSI_RESET);
+ can_send_mail = 0;
+ }
+ }
+
+
// safe context starts at (7, 0)
move(7, 0);
if (now - lastauth >= 15*60) // valid through 15 minutes
@@ -443,6 +460,7 @@ give_money_ui(const char *userid)
skipauth = 1;
else
tries = -1;
+ move(7, 0);
}
// safe context starts at (7, 0)
@@ -482,26 +500,26 @@ give_money_ui(const char *userid)
outs(ANSI_COLOR(1;33) "交易完成!" ANSI_RESET "\n");
// transaction complete.
- {
+ if (can_send_mail) {
char fpath[PATHLEN];
- if (mail_redenvelop( myid, id, m - mtax, fpath) < 0)
- {
-#ifdef USE_RECENTPAY
- outs("您可於下列位置找到最近的交易記錄:\n"
- "主選單 => (U)ser個人設定 => (L)MyLogs 個人記錄 => "
- "(P)Recent Pay 最近交易記錄\n");
-#endif
- vmsg("交易完成。");
- return 0;
- }
- // TODO 若是壞人,禁止編輯內文?
- if (vans("交易已完成,要修改紅包袋嗎?[y/N] ") == 'y')
+ if (mail_redenvelop( myid, id, m - mtax, fpath) < 0)
{
- veditfile(fpath);
- }
- sendalert(id, ALERT_NEW_MAIL);
+ outs(ANSI_COLOR(1;31) "已轉入對方帳戶但紅包袋寄送失敗()。"
+ ANSI_RESET);
+ } else {
+ if (vans("交易已完成,要修改紅包袋嗎?[y/N] ") == 'y')
+ veditfile(fpath);
+ sendalert(id, ALERT_NEW_MAIL);
+ }
}
+#ifdef USE_RECENTPAY
+ move(b_lines-5, 0); clrtobot();
+ outs("\n您可於下列位置找到最近的交易記錄:\n"
+ "主選單 => (U)ser個人設定 => (L)MyLogs 個人記錄 => "
+ "(P)Recent Pay 最近交易記錄\n");
+#endif
+ vmsg("交易完成。");
return 0;
}
diff --git a/pttbbs/mbbsd/mail.c b/pttbbs/mbbsd/mail.c
index ed02d913..0ddc60fc 100644
--- a/pttbbs/mbbsd/mail.c
+++ b/pttbbs/mbbsd/mail.c
@@ -404,6 +404,16 @@ do_innersend(const char *userid, char *mfpath, const char *title, char *newtitle
int oldstat = currstat;
char save_title[STRLEN];
+ // check friend
+ sethomefile(fpath, userid, FN_REJECT);
+ i = file_exist_record(fpath, cuser.userid);
+ sethomefile(fpath, userid, FN_OVERRIDES);
+ if (i && !file_exist_record(fpath, cuser.userid)) {
+ // in reject list
+ vmsg("對方拒收。");
+ return -2;
+ }
+
if (!mfpath)
mfpath = _mfpath;
@@ -424,20 +434,14 @@ do_innersend(const char *userid, char *mfpath, const char *title, char *newtitle
strlcpy(mhdr.title, save_title, sizeof(mhdr.title));
if (newtitle) strlcpy(newtitle, save_title, STRLEN);
- sethomefile(fpath, userid, FN_OVERRIDES);
- i = file_exist_record(fpath, cuser.userid);
- sethomefile(fpath, userid, FN_REJECT);
-
- if (i || !file_exist_record(fpath, cuser.userid)) {/* Ptt: 用belong有點討厭 */
- sethomedir(fpath, userid);
- if (append_record_forward(fpath, &mhdr, sizeof(mhdr), userid) == -1)
- {
- unlink(mfpath);
- setutmpmode(oldstat);
- return -1;
- }
- sendalert(userid, ALERT_NEW_MAIL);
+ sethomedir(fpath, userid);
+ if (append_record_forward(fpath, &mhdr, sizeof(mhdr), userid) == -1)
+ {
+ unlink(mfpath);
+ setutmpmode(oldstat);
+ return -1;
}
+ sendalert(userid, ALERT_NEW_MAIL);
setutmpmode(oldstat);
return 0;
}
@@ -563,6 +567,7 @@ multi_list(struct Vector *namelist, int *recipient)
{
char uid[16];
char genbuf[200];
+ int i, cRemoved;
while (1) {
vs_hdr("群組寄信名單");
@@ -627,9 +632,39 @@ multi_list(struct Vector *namelist, int *recipient)
*recipient = 0;
return;
default:
- return;
- }
- }
+ vs_hdr("群組寄信名單");
+ outs("\n正在檢查名單... \n"); doupdate();
+ cRemoved = 0;
+ for (i = 0; i < Vector_length(namelist); i++) {
+ const char *p = Vector_get(namelist, i);
+ if (searchuser(p, uid) && strcmp(STR_GUEST, uid)) {
+ // check rejected list
+ sethomefile(genbuf, uid, FN_REJECT);
+ if (!file_exist_record(genbuf, cuser.userid))
+ continue;
+ // check if that's friend+reject
+ sethomefile(genbuf, uid, FN_OVERRIDES);
+ if (file_exist_record(genbuf, cuser.userid))
+ continue;
+ }
+ // ok, bad guys exist.
+ if (!cRemoved)
+ outs("下列 ID 無法收到信件,已自名單移除;"
+ "請重新確認名單。\n\n");
+ cRemoved ++;
+ prints("%-.*s ", IDLEN, uid);
+ Vector_remove(namelist, p);
+ i--; // this is a hack. currently vector index is stable after remove.
+ if ((cRemoved + 1) * (IDLEN + 1) >= t_columns)
+ outs("\n");
+ }
+ if (cRemoved) {
+ pressanykey();
+ continue;
+ }
+ return;
+ }
+ }
}
static void
@@ -733,17 +768,8 @@ multi_send(const char *title)
listing += recipient;
outc(' ');
}
- outs(p);
- if (searchuser(p, buf) && strcmp(STR_GUEST, buf)) {
- sethomefile(genbuf, buf, FN_OVERRIDES);
- if (!file_exist_record(genbuf, cuser.userid)) { // not friend, check if rejected
- sethomefile(genbuf, buf, FN_REJECT);
- if (file_exist_record(genbuf, cuser.userid))
- continue;
- }
- sethomepath(genbuf, buf);
- } else
- continue;
+ searchuser(p, buf);
+ sethomepath(genbuf, buf);
stampfile(genbuf, &mymail);
unlink(genbuf);
Copy(fpath, genbuf);
@@ -2186,12 +2212,18 @@ doforward(const char *direct, const fileheader_t * fh, int mode)
if (strcasecmp(xid, cuser.userid) == 0)
break;
- sethomefile(fpath, xid, FN_OVERRIDES);
- i = file_exist_record(fpath, cuser.userid);
sethomefile(fpath, xid, FN_REJECT);
- // XXX check do_send - they simply ignore it.
- if (!i && file_exist_record(fpath, cuser.userid))
- return 0;
+ i = file_exist_record(fpath, cuser.userid);
+ sethomefile(fpath, xid, FN_OVERRIDES);
+
+ if (i && !file_exist_record(fpath, cuser.userid)) {
+ // We used to simply ignore here, and then people (especially those
+ // in BuyTogether and similiars) say "my mail is lost".
+ // After notifying SYSOPs, we believe it will be better to let all
+ // users know what's going on.
+ vmsg("無法寄信給此使用者");
+ return 1;
+ }
} while (0);
if (mode == 'Z') {