summaryrefslogtreecommitdiff
path: root/vchat-ui.c
diff options
context:
space:
mode:
Diffstat (limited to 'vchat-ui.c')
-rwxr-xr-xvchat-ui.c41
1 files changed, 37 insertions, 4 deletions
diff --git a/vchat-ui.c b/vchat-ui.c
index 15623e2..4eb625e 100755
--- a/vchat-ui.c
+++ b/vchat-ui.c
@@ -317,7 +317,7 @@ int writecf (formtstr id,unsigned char *str) {
317 if( getintoption( CF_KEEPLOG ) && vchat_logfile ) { 317 if( getintoption( CF_KEEPLOG ) && vchat_logfile ) {
318 char date[16]; 318 char date[16];
319 strftime( date, sizeof(date), "%Y%m%d%H%M%S", localtime(&now)); 319 strftime( date, sizeof(date), "%Y%m%d%H%M%S", localtime(&now));
320 fprintf( vchat_logfile, "%s0%s\n", date, str); 320 fprintf( vchat_logfile, "%s0%s\n", date, tmpstr);
321 } 321 }
322 322
323 if ( (sb_pub->scroll == sb_pub->count) && 323 if ( (sb_pub->scroll == sb_pub->count) &&
@@ -1185,16 +1185,38 @@ initui (void)
1185 writeout (vchat_cm_version); 1185 writeout (vchat_cm_version);
1186 showout( ); 1186 showout( );
1187*/ 1187*/
1188 resize(0);
1189 1188
1190 if( getintoption( CF_KEEPLOG ) ) { 1189 if( getintoption( CF_KEEPLOG ) ) {
1191 unsigned char *logfile = getstroption( CF_LOGFILE ); 1190 unsigned char *logfile = getstroption( CF_LOGFILE );
1192 if( logfile && *logfile ) { 1191 if( logfile && *logfile ) {
1193 if( *logfile == '~' ) 1192 if( *logfile == '~' )
1194 logfile = tilde_expand( logfile ); 1193 logfile = tilde_expand( logfile );
1195 vchat_logfile = fopen( logfile, "a+" ); 1194 vchat_logfile = fopen( logfile, "r+" );
1195 if( vchat_logfile ) {
1196 char date[16];
1197 time_t now; struct tm now_tm;
1198 int dst, lenstr;
1199 char *str;
1200 while( !feof( vchat_logfile)) {
1201 if( (fread( date, 14, 1, vchat_logfile) == 1) &&
1202 (strptime( date, "%Y%m%d%H%M%S", &now_tm)) &&
1203 (((dst = fgetc( vchat_logfile )) == '0') || (dst == '1')) &&
1204 (str = fgetln(vchat_logfile, &lenstr))&&
1205 (str[lenstr-1] == '\n'))
1206 {
1207 str[lenstr-1] = 0;
1208 now = mktime( &now_tm );
1209 sb_add( dst == '0' ? sb_pub : sb_priv, str, now);
1210 } else {
1211 fseek( vchat_logfile, 0, SEEK_END);
1212 fgetc( vchat_logfile );
1213 }
1214 }
1215 }
1196 } 1216 }
1197 } 1217 }
1218
1219 resize(0);
1198} 1220}
1199 1221
1200/* render colorized line to window */ 1222/* render colorized line to window */
@@ -1236,7 +1258,18 @@ consoleline (unsigned char *message)
1236 1258
1237 for (i = 0; i < console->_maxx; i++) 1259 for (i = 0; i < console->_maxx; i++)
1238 waddch (console, ' '); 1260 waddch (console, ' ');
1239 mvwaddnstr (console, 0, 0, message ? message : consolestr, console->_maxx); 1261
1262 if( !message && usetime )
1263 {
1264 char date[10];
1265 time_t now = time(NULL);
1266 strftime( date, sizeof(date), getformatstr(FS_CONSOLETIME), localtime(&now));
1267 snprintf( tmpstr, TMPSTRSIZE, "%s%s", date, consolestr);
1268 mvwaddnstr (console, 0, 0, tmpstr, console->_maxx);
1269 } else {
1270 mvwaddnstr (console, 0, 0, message ? message : consolestr, console->_maxx);
1271 }
1272
1240 snprintf(tmpstr,TMPSTRSIZE,getformatstr(FS_SBINF),sb_pub->scroll,sb_pub->count); 1273 snprintf(tmpstr,TMPSTRSIZE,getformatstr(FS_SBINF),sb_pub->scroll,sb_pub->count);
1241 mvwaddstr (console, 0, console->_maxx - (strlen(tmpstr)-1),tmpstr); 1274 mvwaddstr (console, 0, console->_maxx - (strlen(tmpstr)-1),tmpstr);
1242 if (sb_win == 0) mvwaddch (console, 0, console->_maxx,'*'); 1275 if (sb_win == 0) mvwaddch (console, 0, console->_maxx,'*');