summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-03 20:48:41 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-03 20:48:41 +0800
commitaf16dfc53f004ad3515296daff9156ec0751b0b5 (patch)
treef69dc74bd928ef447b24ccc95e14001db89cf3b2
parent59865815bbd0227f71941e82c37e5fe1d34c1b1f (diff)
downloadpttbbs-af16dfc53f004ad3515296daff9156ec0751b0b5.tar
pttbbs-af16dfc53f004ad3515296daff9156ec0751b0b5.tar.gz
pttbbs-af16dfc53f004ad3515296daff9156ec0751b0b5.tar.bz2
pttbbs-af16dfc53f004ad3515296daff9156ec0751b0b5.tar.lz
pttbbs-af16dfc53f004ad3515296daff9156ec0751b0b5.tar.xz
pttbbs-af16dfc53f004ad3515296daff9156ec0751b0b5.tar.zst
pttbbs-af16dfc53f004ad3515296daff9156ec0751b0b5.zip
- add option "default to backup" (from PttSuggest@ptt2)
- user/reg: prevent ambigious regcode. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3962 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/uflags.h9
-rw-r--r--mbbsd/chess.c7
-rw-r--r--mbbsd/mail.c7
-rw-r--r--mbbsd/talk.c7
-rw-r--r--mbbsd/user.c10
5 files changed, 31 insertions, 9 deletions
diff --git a/include/uflags.h b/include/uflags.h
index ea27bee5..dcc4c84e 100644
--- a/include/uflags.h
+++ b/include/uflags.h
@@ -36,8 +36,15 @@
#define NO_MODMARK_FLAG 0x00001000 /* true if modified files are NOT marked */
#define COLORED_MODMARK 0x00002000 /* true if mod-mark is coloured. */
+/* Backup Preference */
+#define DEFBACKUP_FLAG 0x00010000 /* true if user defaults to backup */
+
+#define TOBACKUP(x) ((cuser.uflag & DEFBACKUP_FLAG) ? \
+ (x != 'n') : \
+ (x == 'y') )
+
/* NEW ENTRY HERE */
-// #define ??__??? 0x00010000
+// #define ??__??? 0x00100000
/* -------------------- userec_t.uflag2 (unsigned int) */
diff --git a/mbbsd/chess.c b/mbbsd/chess.c
index 6d28e603..a86ca766 100644
--- a/mbbsd/chess.c
+++ b/mbbsd/chess.c
@@ -1003,12 +1003,17 @@ ChessGenLogUser(ChessInfo* info, ChessGameResult result)
static void
ChessGenLog(ChessInfo* info, ChessGameResult result)
{
+ char a = 0;
if (info->mode == CHESS_MODE_VERSUS && info->myturn == 0 &&
info->constants->log_board) {
ChessGenLogGlobal(info, result);
}
- if (getans("是否將棋譜寄回信箱?[N/y]") == 'y')
+ a = getans((cuser.uflag & DEFBACKUP_FLAG) ?
+ "是否將棋譜寄回信箱? [Y/n]" :
+ "是否將棋譜寄回信箱? [y/N]");
+
+ if (TOBACKUP(a))
ChessGenLogUser(info, result);
}
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index a7e7504e..2fdfd491 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -317,10 +317,13 @@ hold_mail(const char *fpath, const char *receiver)
{
char buf[4];
- getdata(b_lines - 1, 0, "已順利寄出,是否自存底稿(Y/N)?[N] ",
+ getdata(b_lines - 1, 0,
+ (cuser.uflag & DEFBACKUP_FLAG) ?
+ "已順利寄出,是否自存底稿(Y/N)?[Y] " :
+ "已順利寄出,是否自存底稿(Y/N)?[N] ",
buf, sizeof(buf), LCECHO);
- if (buf[0] == 'y')
+ if (TOBACKUP(buf[0]))
do_hold_mail(fpath, receiver, cuser.userid);
}
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 122bf6ea..7c19c5de 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1513,8 +1513,11 @@ do_talk(int fd)
fclose(flog);
redrawwin();
more(fpath, NA);
- getdata(b_lines - 1, 0, "清除(C) 移至備忘錄(M). (C/M)?[C]",
- ans, sizeof(ans), LCECHO);
+ ans[0] = 0;
+ // force user decide how to deal with the log
+ while (ans[0] != 'c' && ans[0] != 'm')
+ getdata(b_lines - 1, 0, "清除(C) 移至備忘錄(M). (c/m)? ",
+ ans, sizeof(ans), LCECHO);
if (*ans == 'm') {
fileheader_t mymail;
char title[128];
diff --git a/mbbsd/user.c b/mbbsd/user.c
index d0ea5875..91f5f0cf 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -343,6 +343,7 @@ void Customize(void)
DBCSAWARE_FLAG,
DBCS_NOINTRESC,
#endif
+ DEFBACKUP_FLAG,
0,
};
@@ -354,6 +355,7 @@ void Customize(void)
"自動偵測雙位元字集(如全型中文)",
"禁止在雙位元中使用色碼(去一字雙色)",
#endif
+ "預設備份信件與其它記錄", //"與聊天記錄",
0,
};
@@ -536,14 +538,15 @@ makeregcode(char *buf)
{
char fpath[PATHLEN];
int fd, i;
- const char *alphabet = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
+ // prevent ambigious characters: oOlI
+ const char *alphabet = "qwertyuipasdfghjkzxcvbnmoQWERTYUPASDFGHJKLZXCVBNM";
/* generate a new regcode */
buf[13] = 0;
buf[0] = REGCODE_INITIAL[0];
buf[1] = REGCODE_INITIAL[1];
for( i = 2 ; i < 13 ; ++i )
- buf[i] = alphabet[random() % 52];
+ buf[i] = alphabet[random() % strlen(alphabet)];
getregfile(fpath);
if( (fd = open(fpath, O_WRONLY | O_CREAT, 0600)) == -1 ){
@@ -1810,7 +1813,8 @@ u_register(void)
break;
} while( 1 );
- if (strcmp(inregcode, getregcode(regcode)) == 0) {
+ // make it case insensitive.
+ if (strcasecmp(inregcode, getregcode(regcode)) == 0) {
int unum;
delregcodefile();
if ((unum = searchuser(cuser.userid, NULL)) == 0) {