summaryrefslogtreecommitdiffstats
path: root/mbbsd/mail.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-18 11:47:32 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-18 11:47:32 +0800
commit1ec23af080cec423ced22f77d2fccdb87c8feba9 (patch)
tree76d12061c970a01931ce7276f21a971f542055b2 /mbbsd/mail.c
parentdf5492a36f163bb6dd7649bcde7bfdb237f84bf6 (diff)
downloadpttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.tar
pttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.tar.gz
pttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.tar.bz2
pttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.tar.lz
pttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.tar.xz
pttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.tar.zst
pttbbs-1ec23af080cec423ced22f77d2fccdb87c8feba9.zip
some idiots autoforward to themselves
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2845 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mail.c')
-rw-r--r--mbbsd/mail.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 5c4cdf3e..aab8e145 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -11,6 +11,8 @@ setforward(void)
{
char buf[80], ip[50] = "", yn[4];
FILE *fp;
+ int flIdiotSent2Self = 0;
+ int oidlen = strlen(cuser.userid);
sethomepath(buf, cuser.userid);
strcat(buf, "/.forward");
@@ -20,7 +22,18 @@ setforward(void)
}
getdata_buf(b_lines - 1, 0, "請輸入信箱自動轉寄的email地址:",
ip, sizeof(ip), DOECHO);
- if (ip[0] && ip[0] != ' ' && strcmp(cuser.userid, ip) != 0) {
+
+ /* anti idiots */
+ if (strncasecmp(ip, cuser.userid, oidlen) == 0)
+ {
+ int addrlen = strlen(ip);
+ if( addrlen == oidlen ||
+ (addrlen > oidlen &&
+ strcasecmp(ip + oidlen, str_mail_address) == 0))
+ flIdiotSent2Self = 1;
+ }
+
+ if (ip[0] && ip[0] != ' ' && !flIdiotSent2Self) {
getdata(b_lines, 0, "確定開啟自動轉信功\能?(Y/n)", yn, sizeof(yn),
LCECHO);
if (yn[0] != 'n' && (fp = fopen(buf, "w"))) {
@@ -31,7 +44,10 @@ setforward(void)
}
}
unlink(buf);
- vmsg("取消自動轉信!");
+ if(flIdiotSent2Self)
+ vmsg("自動轉寄是不會設定給自己的,想取消用空白就可以了。");
+ else
+ vmsg("取消自動轉信!");
return 0;
}