diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-03-15 22:39:25 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-03-15 22:39:25 +0800 |
commit | dea4689dc8a0ddd0aef678b2ae651039d048fa85 (patch) | |
tree | ba3f9102c317af30b5c58e472e8295ca656d64ce | |
parent | d133742fac6c71dd64568b9a23911b2a9a1e0335 (diff) | |
download | pttbbs-dea4689dc8a0ddd0aef678b2ae651039d048fa85.tar pttbbs-dea4689dc8a0ddd0aef678b2ae651039d048fa85.tar.gz pttbbs-dea4689dc8a0ddd0aef678b2ae651039d048fa85.tar.bz2 pttbbs-dea4689dc8a0ddd0aef678b2ae651039d048fa85.tar.lz pttbbs-dea4689dc8a0ddd0aef678b2ae651039d048fa85.tar.xz pttbbs-dea4689dc8a0ddd0aef678b2ae651039d048fa85.tar.zst pttbbs-dea4689dc8a0ddd0aef678b2ae651039d048fa85.zip |
fix bug
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@27 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/io.c | 12 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 82 | ||||
-rw-r--r-- | mbbsd/talk.c | 19 |
3 files changed, 21 insertions, 92 deletions
@@ -1,4 +1,4 @@ -/* $Id: io.c,v 1.4 2002/03/14 20:49:38 in2 Exp $ */ +/* $Id: io.c,v 1.5 2002/03/15 14:39:25 in2 Exp $ */ #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -123,7 +123,7 @@ int num_in_buf() { return icurrchar - ibufsize; } -int watermode = -1; +int watermode = -1, wmofo = -1; /* WATERMODE(WATER_ORIG) | WATERMODE(WATER_NEW): Ptt 水球回顧用的參數 @@ -132,10 +132,10 @@ int watermode = -1; > 0 在回前 n 顆水球 (Ctrl-R Ctrl-R) WATERMODE(WATER_OFO) by in2 - watermode = -1 沒在回水球 + wmofo = -1 沒在回水球 = 0 正在回水球 = 1 回水球間又接到水球 - watermode >=0 時收到水球將只顯示, 不會到water[]裡, + wmofo >=0 時收到水球將只顯示, 不會到water[]裡, 待回完水球的時候一次寫入. */ @@ -284,7 +284,7 @@ int igetch() { } if( currutmp->msgs[0].pid && - WATERMODE(WATER_OFO) && watermode == -1 ){ + WATERMODE(WATER_OFO) && wmofo == -1 ){ int y, x, my_newfd; screenline_t *screen0 = calloc(t_lines, sizeof(screenline_t)); memcpy(screen0, big_picture, t_lines * sizeof(screenline_t)); @@ -317,7 +317,7 @@ int igetch() { return (ch); case Ctrl('E'): - if( WATERMODE(WATER_ORIG) || WATERMODE(WATER_NEW) ){ + if( WATERMODE(WATER_NEW) ){ if(watermode >0){ if( water_which_flag == (int)water_usies ) water_which_flag = 0; diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 975e2b3c..5ed7dcdf 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1,4 +1,4 @@ -/* $Id: mbbsd.c,v 1.7 2002/03/14 10:14:55 in2 Exp $ */ +/* $Id: mbbsd.c,v 1.8 2002/03/15 14:39:25 in2 Exp $ */ #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -347,7 +347,7 @@ show_call_in(int save, int which) extern unsigned int currstat; water_t water[6], *swater[6], *water_which=&water[0]; char water_usies=0; -extern int watermode; +extern int watermode, wmofo; static int add_history_water(water_t *w, msgque_t *msg, char mode) { // mode: 1: all data(including userid, pid); @@ -420,27 +420,21 @@ void write_request (int sig) { int i; - /* - struct tm *ptime; - time_t now; - - time (&now); - ptime = localtime (&now); - */ + if( WATERMODE(WATER_OFO) ){ /* sig = SIGUSR2 waterball come in 0 flush to water[] (by my_write2()) */ if( sig != 0 ){ - if( watermode == 0 ) /* 正在回水球 */ - watermode = 1; + if( wmofo == 0 ) /* 正在回水球 */ + wmofo = 1; bell (); show_call_in(1, currutmp->msgcount - 1); refresh (); } - if( sig == 0 || /* 回水球的時候又有水球進來, 回完後一次寫回去 */ - watermode == -1 ){ /* 不在回水球模式 */ + if( sig == 0 || /* 回水球的時候又有水球進來, 回完後一次寫回去 */ + wmofo == -1 ){ /* 不在回水球模式 */ do{ add_history(&currutmp->msgs[0]); if( currutmp->msgcount-- ) @@ -500,68 +494,6 @@ write_request (int sig) } } -#if 0 -void -write_request (int sig) -{ - int i, mtimemin, wu; - static char inlock = 0; - if( inlock ) /* 如果已經進來了 (表示上個水球還沒有處理完, - 新的水球又進來) 則不做任何事直接 return */ - return; - inlock = 1; - do{ - for( wu = 0 ; wu < 5 ; ++wu ) - if( water[wu].pid == currutmp->msgs[0].pid ) - break; - if( wu == 5 ){ - for( i = 0, mtimemin = INT_MAX ; i < 5 ; ++i ) - if( water[i].pid == 0 ){ - ++water_usies; - wu = i; - break; - } - else if( water[i].mtime < mtimemin ){ - mtimemin = water[i].mtime; - wu = i; - } - water[wu].pid = currutmp->msgs[0].pid; - strcpy(water[wu].userid, currutmp->msgs[0].userid); - water[wu].msgtop = 0; - for( i = 0 ; i < 5 ; ++i ) - water[wu].msg[i][0] = 0; - } - water[wu].mtime = time(NULL); - strncpy(water[wu].msg[ (int)water[wu].msgtop ], - currutmp->msgs[0].last_call_in, 64); - ++water[wu].msgtop; - water[wu].msgtop %= 5; - - bell (); - show_call_in(1, 0); - refresh(); - - if( watermode == 0 ){ /* in waterball selection mode - if( wu != 0 ){ - water_scr(water_which, 0); - qsort(water, 5, sizeof(water_t), cmpwatermtime); - for( i = 0 ; i < 5 ; ++i ) - if( water[i].pid == 0 ) - break; - else - water_scr(i, 0); - water_scr(water_which = 0, 1); - refresh(); - } */ - } - --currutmp->msgcount; - for( i = 0 ; i < currutmp->msgcount - 1 ; ++i ) - currutmp->msgs[i] = currutmp->msgs[i + 1]; - } while( currutmp->msgcount > 0 ); - inlock = 0; -} -#endif - static void multi_user_check () { diff --git a/mbbsd/talk.c b/mbbsd/talk.c index c87277d6..7af93287 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -1,4 +1,4 @@ -/* $Id: talk.c,v 1.9 2002/03/14 20:49:38 in2 Exp $ */ +/* $Id: talk.c,v 1.10 2002/03/15 14:39:25 in2 Exp $ */ #include <stdio.h> #include <string.h> #include <errno.h> @@ -76,7 +76,7 @@ typedef struct pickup_t { extern int bind( /* int,struct sockaddr *, int */ ); extern char *getuserid(); extern struct utmpfile_t *utmpshm; -extern int watermode; +extern int watermode, wmofo; extern water_t water[6], *swater[5], *water_which; extern char *friend_file[8], water_usies; @@ -486,7 +486,7 @@ void my_write2(void) water_t *tw; unsigned char mode0; - watermode = 0; + wmofo = 0; currstat0 = currstat; c0 = currutmp->chatid[0]; mode0 = currutmp->mode; @@ -577,9 +577,9 @@ void my_write2(void) currstat = currstat0; currutmp->chatid[0] = c0; currutmp->mode = mode0; - if( watermode == 1 ) + if( wmofo == 1 ) write_request(0); - watermode = -1; + wmofo = -1; } /* @@ -607,8 +607,7 @@ int my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t *puin) outmsg("\033[1;33;41m糟糕! 對方已落跑了(不在站上)! \033[37m~>_<~\033[m"); clrtoeol(); refresh(); - if( !WATERMODE(WATER_OFO) ) - watermode = -1; + watermode = -1; return 0; } currutmp->mode = 0; @@ -656,14 +655,12 @@ int my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t *puin) currutmp->chatid[0] = c0; currutmp->mode = mode0; currstat = currstat0; - if( !WATERMODE(WATER_OFO) ) - watermode = -1; + watermode = -1; return 0; } } - if( !WATERMODE(WATER_OFO) ) - watermode = -1; + watermode = -1; if(!uin || !*uin->userid || strcasecmp(destid, uin->userid)) { outmsg("\033[1;33;41m糟糕! 對方已落跑了(不在站上)! \033[37m~>_<~\033[m"); clrtoeol(); |