summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-07-25 13:39:58 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-07-25 13:39:58 +0800
commit67ffc7654419486b0874fc25f23545e477be2682 (patch)
treec3ea292b92a2b6e16221c82b98ab292ec2f695ae
parent1da6e876431475755e1fb84f4920a0cb19134bdb (diff)
downloadpttbbs-67ffc7654419486b0874fc25f23545e477be2682.tar
pttbbs-67ffc7654419486b0874fc25f23545e477be2682.tar.gz
pttbbs-67ffc7654419486b0874fc25f23545e477be2682.tar.bz2
pttbbs-67ffc7654419486b0874fc25f23545e477be2682.tar.lz
pttbbs-67ffc7654419486b0874fc25f23545e477be2682.tar.xz
pttbbs-67ffc7654419486b0874fc25f23545e477be2682.tar.zst
pttbbs-67ffc7654419486b0874fc25f23545e477be2682.zip
make recommendation system better
- prevent waterball overwrites recommendation - eliminate confirm scroll git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2952 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/bbs.c12
-rw-r--r--mbbsd/io.c8
-rw-r--r--mbbsd/screen.c2
-rw-r--r--mbbsd/var.c5
4 files changed, 22 insertions, 5 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 2528b407..6202ef53 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1922,10 +1922,20 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
if (!getdata(b_lines, 0, buf, msg, maxlength, DOECHO))
return FULLUPDATE;
+#if 0
scroll();
if(getans("確定要%s嗎? 請仔細考慮[y/N]: ", ctype[type]) != 'y')
return FULLUPDATE;
-
+#else
+ {
+ char ans[3];
+ sprintf(buf+strlen(buf), ANSI_COLOR(7) "%-*s"
+ ANSI_RESET " 確定嗎?[y/N]: ", maxlength, msg);
+ if(!getdata(b_lines, 0, buf, ans, sizeof(ans), LCECHO) ||
+ ans[0] != 'y')
+ return FULLUPDATE;
+ }
+#endif
STATINC(STAT_RECOMMEND);
#ifdef OLDRECOMMEND
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 3fcbf359..a7042ad5 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -766,6 +766,7 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
int dirty_line = 0; /* if this line contains ansi escapes,
we have to dirty entire line. */
static char lastcmd[MAXLASTCMD][80];
+ unsigned char occupy_msg = 0;
#ifdef DBCSAWARE_GETDATA
unsigned int dbcsincomplete = 0;
@@ -773,6 +774,9 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
strip_ansi(buf, buf, STRIP_ALL);
+ if(line == b_lines-msg_occupied)
+ occupy_msg=1, msg_occupied ++;
+
if (prompt) {
x += strip_ansi(NULL, prompt, STRIP_ALL);
if(strlen(prompt) + col != x)
@@ -1007,13 +1011,15 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
strlcpy(lastcmd[0], buf, sizeof(lastcmd[0]));
memmove(lastcmd+1, lastcmd, (MAXLASTCMD-1)*sizeof(lastcmd[0]));
}
- /* why return here? */
+ /* why return here? because some code then outs.*/
// outc('\n');
move(y+1, 0);
refresh();
}
if ((echo == LCECHO) && isupper((int)buf[0]))
buf[0] = tolower(buf[0]);
+
+ if(occupy_msg) msg_occupied --;
return clen;
}
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index 175921f1..6613085a 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -388,7 +388,7 @@ out_lines(const char *str, int line)
void
outmsg(const char *msg)
{
- move(b_lines, 0);
+ move(b_lines - msg_occupied, 0);
clrtoeol();
outs(msg);
}
diff --git a/mbbsd/var.c b/mbbsd/var.c
index 989d2a15..fb6c707c 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -382,7 +382,7 @@ char real_name[IDLEN + 1];
char local_article;
/* mbbsd.c */
-int raw_connection = 0;
+char raw_connection = 0;
char fromhost[STRLEN] = "\0";
char water_usies = 0;
FILE *fp_writelog = NULL;
@@ -404,7 +404,8 @@ int user_query_mode;
#define scr_lns t_lines
#define scr_cols ANSILINELEN
screenline_t *big_picture = NULL;
-char roll;
+char roll = 0;
+char msg_occupied = 0;
/* gomo.c */
const char * const bw_chess[] = {"●", "○"};