summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/mbbsd.c31
-rw-r--r--mbbsd/talk.c19
-rw-r--r--mbbsd/var.c6
3 files changed, 44 insertions, 12 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index d2f4aa87..2c2d6cbf 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -365,15 +365,38 @@ write_request(int sig)
reentrant_write_request = 1;
#endif
if (WATERMODE(WATER_OFO)) {
- if( (msgcount = currutmp->msgcount) > 0 ){
- for( i = 0 ; i < msgcount ; ++i ){
+ /* 如果目前正在回水球模式的話, 就不能進行 add_history() ,
+ 因為會改寫 water[], 而使回水球目的爛掉, 所以分成幾種情況考慮.
+ sig != 0表真的有水球進來, 故顯示.
+ sig == 0表示沒有水球進來, 不過之前尚有水球還沒寫到 water[].
+ */
+ static int alreadyshow = 0;
+
+ if( sig ){ /* 真的有水球進來 */
+
+ /* 若原來正在 REPLYING , 則改成 RECVINREPLYING,
+ 這樣在回水球結束後, 會再呼叫一次 write_request(0) */
+ if( wmofo == REPLYING )
+ wmofo = RECVINREPLYING;
+
+ /* 顯示 */
+ for( ; alreadyshow < currutmp->msgcount && alreadyshow < MAX_MSGS
+ ; ++alreadyshow ){
bell();
- show_call_in(1, i);
+ show_call_in(1, alreadyshow);
refresh();
- add_history(&currutmp->msgs[i]);
}
+ }
+
+ /* 看看是不是要把 currutmp->msg 拿回 water[] (by add_history())
+ 須要是不在回水球中 (NOTREPLYING) */
+ if( wmofo == NOTREPLYING &&
+ (msgcount = currutmp->msgcount) > 0 ){
+ for( i = 0 ; i < msgcount ; ++i )
+ add_history(&currutmp->msgs[i]);
if( (currutmp->msgcount -= msgcount) < 0 )
currutmp->msgcount = 0;
+ alreadyshow = 0;
}
} else {
if (currutmp->mode != 0 &&
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index f44b69b9..4af0fa92 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -105,7 +105,16 @@ modestring(userinfo_t * uentp, int simple)
"回應 %s", getuserid(uentp->destuid));
else
snprintf(modestr, sizeof(modestr), "回應呼叫");
- } else if (!mode && *uentp->chatid == 2)
+ }
+ else if (!mode && *uentp->chatid == 3)
+ snprintf(modestr, sizeof(modestr), "水球準備中");
+ else if (
+#ifdef NOKILLWATERBALL
+ uentp->msgcount > 0
+#else
+ (!mode) && *uentp->chatid == 2
+#endif
+ )
if (uentp->msgcount < 10) {
char *cnum[10] =
{"", "一", "兩", "三", "四", "五", "六", "七",
@@ -114,8 +123,6 @@ modestring(userinfo_t * uentp, int simple)
"中%s顆水球", cnum[(int)(uentp->msgcount)]);
} else
snprintf(modestr, sizeof(modestr), "不行了 @_@");
- else if (!mode && *uentp->chatid == 3)
- snprintf(modestr, sizeof(modestr), "水球準備中");
else if (!mode)
return (uentp->destuid == 6) ? uentp->chatid :
IdleTypeTable[(0 <= uentp->destuid && uentp->destuid < 6) ?
@@ -540,9 +547,11 @@ my_write2(void)
currstat = currstat0;
currutmp->chatid[0] = c0;
currutmp->mode = mode0;
- if (wmofo == 1)
+ if (wmofo == RECVINREPLYING){
+ wmofo = NOTREPLYING;
write_request(0);
- wmofo = -1;
+ }
+ wmofo = NOTREPLYING;
}
/*
diff --git a/mbbsd/var.c b/mbbsd/var.c
index e657aa68..89a88244 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -343,9 +343,9 @@ int wmofo = -1;
* Ctrl-R)
*
* WATERMODE(WATER_OFO) by in2
- * wmofo = -1 沒在回水球
- * = 0 正在回水球
- * = 1 回水球間又接到水球
+ * wmofo = NOTREPLYING 沒在回水球
+ * = REPLYING 正在回水球
+ * = RECVINREPLYING 回水球間又接到水球
*
* wmofo >=0 時收到水球將只顯示, 不會到water[]裡,
* 待回完水球的時候一次寫入.