diff options
-rw-r--r-- | include/pttstruct.h | 6 | ||||
-rw-r--r-- | mbbsd/Makefile | 4 | ||||
-rw-r--r-- | mbbsd/io.c | 6 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 24 | ||||
-rw-r--r-- | mbbsd/talk.c | 25 |
5 files changed, 27 insertions, 38 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h index ea1e7d78..1fb3fc24 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -1,4 +1,4 @@ -/* $Id: pttstruct.h,v 1.2 2002/03/09 10:34:56 in2 Exp $ */ +/* $Id: pttstruct.h,v 1.3 2002/03/16 13:18:53 ptt Exp $ */ #ifndef INCLUDE_STRUCT_H #define INCLUDE_STRUCT_H @@ -253,10 +253,10 @@ typedef struct userinfo_t { typedef struct water_t { pid_t pid; - char userid[IDLEN + 1], alive; + char userid[IDLEN + 1]; int top, count; msgque_t msg[MAX_REVIEW]; - userinfo_t *uin; + userinfo_t *uin; // Ptt:這可以取代alive } water_t; typedef struct { diff --git a/mbbsd/Makefile b/mbbsd/Makefile index 61690e6c..6281e2fe 100644 --- a/mbbsd/Makefile +++ b/mbbsd/Makefile @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.2 2002/03/07 15:24:32 bbs Exp $ +# $Id: Makefile,v 1.3 2002/03/16 13:19:46 ptt Exp $ BBSHOME?=$(HOME) -OSTYPE=FreeBSD +OSTYPE=linux # FreeBSD CFLAGS_FreeBSD= -pipe -Wall -g -O3 -DHAVE_SETPROCTITLE -DBBSHOME='"$(BBSHOME)"' -DFreeBSD -I../include @@ -1,4 +1,4 @@ -/* $Id: io.c,v 1.5 2002/03/15 14:39:25 in2 Exp $ */ +/* $Id: io.c,v 1.6 2002/03/16 13:18:59 ptt Exp $ */ #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -316,7 +316,7 @@ int igetch() { } return (ch); - case Ctrl('E'): + case Ctrl('F'): if( WATERMODE(WATER_NEW) ){ if(watermode >0){ if( water_which_flag == (int)water_usies ) @@ -335,7 +335,7 @@ int igetch() { } return ch; - case Ctrl('W'): + case Ctrl('G'): if( WATERMODE(WATER_NEW) ){ if( watermode > 0 ){ water_which_flag=(water_which_flag+water_usies)%(water_usies+1); diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 5ed7dcdf..b55cbe23 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1,4 +1,4 @@ -/* $Id: mbbsd.c,v 1.8 2002/03/15 14:39:25 in2 Exp $ */ +/* $Id: mbbsd.c,v 1.9 2002/03/16 13:18:59 ptt Exp $ */ #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -348,15 +348,11 @@ extern unsigned int currstat; water_t water[6], *swater[6], *water_which=&water[0]; char water_usies=0; extern int watermode, wmofo; -static int add_history_water(water_t *w, msgque_t *msg, char mode) +static int add_history_water(water_t *w, msgque_t *msg) { // mode: 1: all data(including userid, pid); - // 0: only last_call_in - if( mode ) - memcpy(&w->msg[w->top], msg, sizeof(msgque_t)); - else - memcpy(&w->msg[w->top].last_call_in, msg->last_call_in, - sizeof(msg->last_call_in)); + // 0: only last_call_in Ptt:先改回來 省不多 進階會有問題 + memcpy(&w->msg[w->top], msg, sizeof(msgque_t)); w->top++; w->top %= WATERMODE(WATER_OFO) ? 5 : MAX_REVIEW; @@ -372,7 +368,7 @@ add_history(msgque_t *msg) int i = 0, j; water_t *tmp; if( WATERMODE(WATER_ORIG) || WATERMODE(WATER_NEW) ) - add_history_water(&water[0], msg, 1); + add_history_water(&water[0], msg); if( WATERMODE(WATER_NEW) || WATERMODE(WATER_OFO) ){ for(i = 0 ; i < 5 && swater[i] ; i++ ) if( swater[i]->pid == msg->pid ) @@ -397,7 +393,7 @@ add_history(msgque_t *msg) for( j = i ; j > 0 ; j-- ) swater[j] = swater[j - 1]; swater[0] = tmp; - add_history_water(swater[0], msg, 0); + add_history_water(swater[0], msg); } if(WATERMODE(WATER_ORIG) || WATERMODE(WATER_NEW) ){ @@ -407,12 +403,8 @@ add_history(msgque_t *msg) watermode++; t_display_new(); } - } - - if( WATERMODE(WATER_OFO) ){ - swater[0]->uin = (userinfo_t *)search_ulist_pid(swater[0]->pid); - swater[0]->alive = (swater[0]->uin != NULL); - } + }else + swater[0]->uin = (userinfo_t *)search_ulist_pid(swater[0]->pid); return i; } diff --git a/mbbsd/talk.c b/mbbsd/talk.c index 7af93287..a00b49ef 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -1,4 +1,4 @@ -/* $Id: talk.c,v 1.10 2002/03/15 14:39:25 in2 Exp $ */ +/* $Id: talk.c,v 1.11 2002/03/16 13:18:59 ptt Exp $ */ #include <stdio.h> #include <string.h> #include <errno.h> @@ -443,7 +443,7 @@ void water_scr(water_t *tw, int which, char type) move(8 + which, 28);prints(" "); move(8 + which, 28); prints("\033[1;37;45m %c %-14s \033[0m", - tw->alive ? ' ' : 'x', + tw->uin ? ' ' : 'x', tw->userid); for( i = 0 ; i < 5 ; ++i ){ move(16 + i, 4); @@ -473,7 +473,7 @@ void water_scr(water_t *tw, int which, char type) // refresh(); move(8 + which, 28); prints("\033[1;37;44m %c %-13s \033[0m", - tw->alive ? ' ' : 'x', + tw->uin ? ' ' : 'x', tw->userid); // refresh(); } @@ -501,10 +501,10 @@ void my_write2(void) if( swater[i] == NULL || swater[i]->pid == 0 ) break; else{ - if( swater[i]->alive && + if( swater[i]->uin && (swater[i]->pid != swater[i]->uin->pid || strcmp(swater[i]->userid, swater[i]->uin->userid)) ) - swater[i]->alive = 0; + swater[i]->uin = NULL; water_scr(swater[i], i, 0); } move(15, 4); @@ -513,11 +513,6 @@ void my_write2(void) move(22, 4); prints(" \033[1;35m◇\033[1;36m────────────────" "─────────────────\033[1;35m◇\033[0m "); - /* - move(21, 4);prints(" "); - move(21, 4); - prints("\033[0m \033[1;37;46m%-66s\033[0m \n", t_last_write); - */ water_scr(swater[0], 0, 1); refresh(); @@ -552,7 +547,7 @@ void my_write2(void) done = 1; tw = swater[(int)which]; - if( !tw->alive ) + if( !tw->uin ) break; if( ch != '\r' && ch != '\n' ){ @@ -753,13 +748,15 @@ void t_display_new(void) for (i = 0; i<6 ; i++){ if(i>0) prints("%s%-13.13s\033[m", + !swater[i-1]->uin?"\033[1;33;45mX": swater[i-1]==water_which?"\033[1;33;47m ": - " ", + "", swater[i-1] ? swater[i-1]->userid:""); else prints("%s 全部 \033[m", - water_which==&water[0]?"\033[1;33;45m ": - " "); + water_which==&water[0]?"\033[1;33;47m ": + " " + ); } } |