- tweak the timestamp format - timestamp all lines (dunno why they wouldn't timestamp some of them) - format output according to screen width, and handle width changes -dean Index: cicb/icb/c_time.c diff -u cicb/icb/c_time.c:1.1.1.1 cicb/icb/c_time.c:1.2 --- cicb/icb/c_time.c:1.1.1.1 Wed Feb 21 23:05:11 2001 +++ cicb/icb/c_time.c Wed Feb 21 23:06:15 2001 @@ -192,7 +192,7 @@ now = localtime(&t); sprintf(tsbuf, - "%s[%02d:%02d]%s ", + "%s%02d:%02d%s ", printcolor(ColTIMESTAMP, ColSANE), now->tm_hour, now->tm_min, Index: cicb/icb/externs.h diff -u cicb/icb/externs.h:1.1.1.1 cicb/icb/externs.h:1.2 --- cicb/icb/externs.h:1.1.1.1 Wed Feb 21 23:05:11 2001 +++ cicb/icb/externs.h Wed Feb 21 23:06:15 2001 @@ -46,3 +46,5 @@ extern int last_command_was_kill; extern struct COLORTABLE colortable[]; + +extern unsigned window_columns; /* number of columns in the window */ Index: cicb/icb/globals.c diff -u cicb/icb/globals.c:1.1.1.1 cicb/icb/globals.c:1.2 --- cicb/icb/globals.c:1.1.1.1 Wed Feb 21 23:05:11 2001 +++ cicb/icb/globals.c Wed Feb 21 23:06:15 2001 @@ -94,3 +94,6 @@ { "\x1b[0m", 0 }, /* persfromhilite : personal from hilite */ { "\x1b[0m", 0 }, /* timestamp : message timestamp */ }; + + +unsigned window_columns = 80; /* number of columns in the window */ Index: cicb/icb/print.c diff -u cicb/icb/print.c:1.1.1.1 cicb/icb/print.c:1.2 --- cicb/icb/print.c:1.1.1.1 Wed Feb 21 23:05:11 2001 +++ cicb/icb/print.c Wed Feb 21 23:06:15 2001 @@ -75,7 +75,7 @@ } /* write to the screen */ - if (gv.timestamp && (flags & PL_TS)) + if (gv.timestamp) write(1, timestamp, strlen(timestamp)); write(1, s, strlen(s)); write(1, "\r\n", 2); @@ -83,7 +83,7 @@ /* put line into session log */ if ((flags & PL_LOG) && logfp != NULL) { - if (gv.timestamp && (flags & PL_TS)) + if (gv.timestamp) fputs(timestamp, logfp); fputs(s, logfp); putc('\n', logfp); Index: cicb/icb/protocol.h diff -u cicb/icb/protocol.h:1.1.1.1 cicb/icb/protocol.h:1.2 --- cicb/icb/protocol.h:1.1.1.1 Wed Feb 21 23:05:11 2001 +++ cicb/icb/protocol.h Wed Feb 21 23:06:15 2001 @@ -15,7 +15,6 @@ #define MAX_NOPONG 600 /* seconds a client may not PONG a PING */ #define MAX_PASSWDLEN 12 /* chars in a user password */ #define MAX_REALLEN 64 /* chars in a real life name */ -#define MAX_TEXTLEN (80 - MAX_NICKLEN - 5) /* max chars in a message */ #define MAX_TOPICLEN 32 /* chars in a group topic */ #define MAX_IDLE 3600 /* maximum idle seconds before disconnect */ Index: cicb/icb/strings.c diff -u cicb/icb/strings.c:1.1.1.1 cicb/icb/strings.c:1.2 --- cicb/icb/strings.c:1.1.1.1 Wed Feb 21 23:05:11 2001 +++ cicb/icb/strings.c Wed Feb 21 23:06:15 2001 @@ -175,7 +175,16 @@ int count = 0; char *p, *lastw; char tmp1, tmp2; + unsigned break_at; + /* the 4 accounts for the "<" and "> " around the nick, and a + * space at the end of the line. + */ + break_at = window_columns - strlen(from) - 4; + if (gv.timestamp) { + break_at -= 6; + } + /* traverse s and try to break on a word */ p = s; lastw = p; @@ -193,8 +202,8 @@ lastw = p; /* break line if we are at max length */ - if (count == (MAX_TEXTLEN - 1)) { - if ((p - lastw) > 40) { + if (count == break_at) { + if ((p - lastw) > break_at/2) { /* have to break in the middle of a word */ tmp1 = *(p - 1); tmp2 = *p; Index: cicb/icb/unix.c diff -u cicb/icb/unix.c:1.1.1.1 cicb/icb/unix.c:1.2 --- cicb/icb/unix.c:1.1.1.1 Wed Feb 21 23:05:11 2001 +++ cicb/icb/unix.c Wed Feb 21 23:06:15 2001 @@ -31,20 +31,30 @@ void getwinsize() { +#ifndef TIOCGWINSZ if (gv.pagesize < 0) - { -#ifdef TIOCGWINSZ - struct winsize win; - if (ioctl (0, TIOCGWINSZ, &win) == 0) { + gv.pagesize = -24; +#else + struct winsize win; + + if (ioctl (0, TIOCGWINSZ, &win) == 0) { + if (gv.pagesize < 0) { if (win.ws_row > 0) gv.pagesize = -win.ws_row; else gv.pagesize = 0; - return; } -#endif + if (win.ws_col > 0) { + window_columns = win.ws_col; + } + else { + window_columns = 80; + } + } + else if (gv.pagesize < 0) { gv.pagesize = -24; } +#endif }