diff options
author | erdgeist <> | 2003-05-25 15:06:30 +0000 |
---|---|---|
committer | erdgeist <> | 2003-05-25 15:06:30 +0000 |
commit | 18de21a2765f1fa33ef313fb20f5baad510cd86d (patch) | |
tree | b351c27a6c97712540db0832dc29aea64a8022ee | |
parent | a66217bdd998bee8cce8670b149f1bf08c1b2bdc (diff) |
encoding, time, logging, params
-rwxr-xr-x | Makefile | 4 | ||||
-rwxr-xr-x | sample-count.fmt | 2 | ||||
-rwxr-xr-x | sample-devlog.fmt | 2 | ||||
-rwxr-xr-x | sample-erdgeist.fmt | 3 | ||||
-rwxr-xr-x | sample-mAsq.fmt | 2 | ||||
-rwxr-xr-x | vchat-client.c | 36 | ||||
-rwxr-xr-x | vchat-config.h | 4 | ||||
-rwxr-xr-x | vchat-messages.h | 3 | ||||
-rwxr-xr-x | vchat-protocol.c | 1 | ||||
-rwxr-xr-x | vchat-ui.c | 41 | ||||
-rwxr-xr-x | vchat.h | 12 |
11 files changed, 85 insertions, 25 deletions
@@ -6,8 +6,8 @@ | |||
6 | # configuration # | 6 | # configuration # |
7 | ############################################## | 7 | ############################################## |
8 | 8 | ||
9 | CFLAGS = -Wall -Os | 9 | #CFLAGS = -Wall -Os |
10 | #CFLAGS = -Wall -g -ggdb | 10 | CFLAGS = -Wall -g -ggdb |
11 | 11 | ||
12 | ## use this line when you've got an readline before 4.(x|2) | 12 | ## use this line when you've got an readline before 4.(x|2) |
13 | #CFLAGS += -DOLDREADLINE | 13 | #CFLAGS += -DOLDREADLINE |
diff --git a/sample-count.fmt b/sample-count.fmt index 019c46e..d008991 100755 --- a/sample-count.fmt +++ b/sample-count.fmt | |||
@@ -42,7 +42,7 @@ FS_IDLE = "^8%s" | |||
42 | FS_TIME = "^5[%H:%M]-- ^0" | 42 | FS_TIME = "^5[%H:%M]-- ^0" |
43 | FS_TOPICW = "[ Channel %d: %s" | 43 | FS_TOPICW = "[ Channel %d: %s" |
44 | FS_NOTOPICW = "[ Channel %d has no topic" | 44 | FS_NOTOPICW = "[ Channel %d has no topic" |
45 | FS_CONSOLE = "[ %s@%s:%d, use .h to get help, send bugs reports and feature requests to vchat@pulse.flatline.de ..." | 45 | FS_CONSOLE = "%s@%s:%d, use .h to get help" |
46 | FS_CONNECTED = "^2# Connected to '^6%s^2', port ^6%d^2 ..." | 46 | FS_CONNECTED = "^2# Connected to '^6%s^2', port ^6%d^2 ..." |
47 | FS_TOPIC = "^2# Channel ^6%d^2 topic is: '^0%s^2'" | 47 | FS_TOPIC = "^2# Channel ^6%d^2 topic is: '^0%s^2'" |
48 | FS_NOTOPIC = "^2# Channel ^6%d^2 has no topic" | 48 | FS_NOTOPIC = "^2# Channel ^6%d^2 has no topic" |
diff --git a/sample-devlog.fmt b/sample-devlog.fmt index 56d67f7..e70364d 100755 --- a/sample-devlog.fmt +++ b/sample-devlog.fmt | |||
@@ -47,7 +47,7 @@ FS_IDLE = "^8%s" | |||
47 | FS_TIME = "^2[%H:%M]^0 " | 47 | FS_TIME = "^2[%H:%M]^0 " |
48 | FS_TOPICW = "[ Channel %d: %s" | 48 | FS_TOPICW = "[ Channel %d: %s" |
49 | FS_NOTOPICW = "[ Channel %d has no topic" | 49 | FS_NOTOPICW = "[ Channel %d has no topic" |
50 | FS_CONSOLE = "[ %s@%s:%d, use .h to get help" | 50 | FS_CONSOLE = "%s@%s:%d, use .h to get help" |
51 | FS_CONNECTED = "^2# Connected to '^0%s^2', port ^0%d^2 ..." | 51 | FS_CONNECTED = "^2# Connected to '^0%s^2', port ^0%d^2 ..." |
52 | FS_TOPIC = "^1# Channel ^6%d^2 topic is: '^0%s^2'" | 52 | FS_TOPIC = "^1# Channel ^6%d^2 topic is: '^0%s^2'" |
53 | FS_NOTOPIC = "^1# Channel ^6%d^2 has no topic" | 53 | FS_NOTOPIC = "^1# Channel ^6%d^2 has no topic" |
diff --git a/sample-erdgeist.fmt b/sample-erdgeist.fmt index cce9ef2..5fc87e1 100755 --- a/sample-erdgeist.fmt +++ b/sample-erdgeist.fmt | |||
@@ -39,9 +39,10 @@ FS_DBG = "^3%s" | |||
39 | FS_ERR = "^1%s" | 39 | FS_ERR = "^1%s" |
40 | FS_IDLE = "^8%s" | 40 | FS_IDLE = "^8%s" |
41 | FS_TIME = "^9[%H:%M]^0 " | 41 | FS_TIME = "^9[%H:%M]^0 " |
42 | FS_CONSOLETIME = "[%H:%M] " | ||
42 | FS_TOPICW = "[ Channel %d: %s" | 43 | FS_TOPICW = "[ Channel %d: %s" |
43 | FS_NOTOPICW = "[ Channel %d has no topic" | 44 | FS_NOTOPICW = "[ Channel %d has no topic" |
44 | FS_CONSOLE = "[ %s@%s:%d, use .h to get help" | 45 | FS_CONSOLE = "%s@%s:%d, use .h to get help" |
45 | FS_CONNECTED = "^2# Connected to '^0%s^2', port ^0%d^2 ..." | 46 | FS_CONNECTED = "^2# Connected to '^0%s^2', port ^0%d^2 ..." |
46 | FS_TOPIC = "^1# Channel ^6%d^2 topic is: '^0%s^2'" | 47 | FS_TOPIC = "^1# Channel ^6%d^2 topic is: '^0%s^2'" |
47 | FS_NOTOPIC = "^1# Channel ^6%d^2 has no topic" | 48 | FS_NOTOPIC = "^1# Channel ^6%d^2 has no topic" |
diff --git a/sample-mAsq.fmt b/sample-mAsq.fmt index 02908b0..9bed139 100755 --- a/sample-mAsq.fmt +++ b/sample-mAsq.fmt | |||
@@ -42,7 +42,7 @@ FS_IDLE = "^8%s" | |||
42 | FS_TIME = "^5%H:%M^0 " | 42 | FS_TIME = "^5%H:%M^0 " |
43 | FS_TOPICW = "[ Channel %d: %s" | 43 | FS_TOPICW = "[ Channel %d: %s" |
44 | FS_NOTOPICW = "[ Channel %d has no topic" | 44 | FS_NOTOPICW = "[ Channel %d has no topic" |
45 | FS_CONSOLE = "[ %s@%s:%d, use .h to get help, send bugs reports and feature requests to vchat@pulse.flatline.de ..." | 45 | FS_CONSOLE = "%s@%s:%d, use .h to get help" |
46 | FS_CONNECTED = "^2*^0C^2* Connected to '^6%s^2', port ^6%d^2 ..." | 46 | FS_CONNECTED = "^2*^0C^2* Connected to '^6%s^2', port ^6%d^2 ..." |
47 | FS_TOPIC = "^2*^0T^2* Channel ^6%d^2 topic is: '^0%s^2'" | 47 | FS_TOPIC = "^2*^0T^2* Channel ^6%d^2 topic is: '^0%s^2'" |
48 | FS_NOTOPIC = "^2*^0T^2* Channel ^6%d^2 has no topic" | 48 | FS_NOTOPIC = "^2*^0T^2* Channel ^6%d^2 has no topic" |
diff --git a/vchat-client.c b/vchat-client.c index 039301e..2fc1ea9 100755 --- a/vchat-client.c +++ b/vchat-client.c | |||
@@ -386,15 +386,24 @@ cleanup (int signal) | |||
386 | exit (0); | 386 | exit (0); |
387 | } | 387 | } |
388 | 388 | ||
389 | static int oldseconds = 0; | ||
390 | |||
389 | void calleverysecond( void ) { | 391 | void calleverysecond( void ) { |
390 | /* timetriggered execution, don't rely on being called every 1000us */ | 392 | /* timetriggered execution, don't rely on being called every 1000us */ |
391 | /* rather see it as a chance for being called 9 times in 10 seconds */ | 393 | /* rather see it as a chance for being called 9 times in 10 seconds */ |
392 | /* so check time() */ | 394 | /* so check time() */ |
395 | time_t now = time( NULL ); | ||
396 | struct tm *mytime = localtime( &now ); | ||
397 | if( mytime->tm_sec < oldseconds ) { | ||
398 | consoleline( NULL ); | ||
399 | } | ||
400 | oldseconds = mytime->tm_sec; | ||
393 | 401 | ||
394 | if(quitrequest) | 402 | if(quitrequest) |
395 | quitrequest--; | 403 | quitrequest--; |
396 | if(outputcountdown && !--outputcountdown) | 404 | if(outputcountdown && !--outputcountdown) |
397 | hideout( ); | 405 | hideout( ); |
406 | |||
398 | } | 407 | } |
399 | 408 | ||
400 | /* this function is called in the master loop */ | 409 | /* this function is called in the master loop */ |
@@ -437,19 +446,23 @@ eventloop (void) | |||
437 | } | 446 | } |
438 | 447 | ||
439 | void usage(unsigned char *name) { | 448 | void usage(unsigned char *name) { |
440 | printf ("usage: %s [-C config-file] [-l] [-z] [-s host] [-p port] [-c channel] [-n nickname]\n",name); | 449 | printf ("usage: %s [-C config-file] [-F formats] [-l] [-z] [-s host] [-p port] [-c channel] [-n nickname] [-k] [-K] [-L logfile]\n",name); |
441 | puts (" -C load a second config-file, overriding the first one\n"); | 450 | puts (" -C load a second config-file, overriding the first one"); |
442 | puts (" -l local connect (no SSL + connects localhost:2323)\n"); | 451 | puts (" -F load format strings (skins) from this file"); |
443 | puts (" -z don't use certificate files\n"); | 452 | puts (" -l local connect (no SSL + connects localhost:2323)"); |
453 | puts (" -z don't use certificate files"); | ||
444 | printf (" -s set server (default \"%s\")\n",getstroption(CF_SERVERHOST)); | 454 | printf (" -s set server (default \"%s\")\n",getstroption(CF_SERVERHOST)); |
445 | printf (" -p set port (default %d)\n",getintoption(CF_SERVERPORT)); | 455 | printf (" -p set port (default %d)\n",getintoption(CF_SERVERPORT)); |
446 | printf (" -c set channel (default %d)\n",getintoption(CF_CHANNEL)); | 456 | printf (" -c set channel (default %d)\n",getintoption(CF_CHANNEL)); |
447 | if (nick) | 457 | if (nick) |
448 | printf(" -n set nickname (default \"%s\")\n",nick); | 458 | printf(" -n set nickname (default \"%s\")\n",nick); |
449 | else | 459 | else |
450 | puts (" -n set nickname\n"); | 460 | puts (" -n set nickname"); |
451 | printf (" -f set from (default \"%s\")\n",getstroption(CF_FROM)); | 461 | printf (" -f set from (default \"%s\")\n",getstroption(CF_FROM)); |
452 | puts (" -h gives this help\n"); | 462 | puts (" -k keep autolog"); |
463 | puts (" -K don't keep autolog"); | ||
464 | printf (" -L use this file as logfile (default \"%s\")\n",getstroption(CF_LOGFILE)); | ||
465 | puts (" -h gives this help"); | ||
453 | } | 466 | } |
454 | 467 | ||
455 | /* main - d'oh */ | 468 | /* main - d'oh */ |
@@ -461,12 +474,10 @@ main (int argc, char **argv) | |||
461 | 474 | ||
462 | loadconfig (GLOBAL_CONFIG_FILE); | 475 | loadconfig (GLOBAL_CONFIG_FILE); |
463 | loadconfig (getstroption (CF_CONFIGFILE)); | 476 | loadconfig (getstroption (CF_CONFIGFILE)); |
464 | loadformats(GLOBAL_FORMAT_FILE); | ||
465 | loadformats(getstroption (CF_FORMFILE)); | ||
466 | 477 | ||
467 | /* parse commandline */ | 478 | /* parse commandline */ |
468 | while (cmdsunparsed) { | 479 | while (cmdsunparsed) { |
469 | pchar = getopt(argc,argv,"C:lzs:p:c:n:f:h"); | 480 | pchar = getopt(argc,argv,"C:F:lzs:p:c:n:f:kKL:h"); |
470 | #ifdef DEBUG | 481 | #ifdef DEBUG |
471 | fprintf(stderr,"parse commandline: %d ('%c'): %s\n",pchar,pchar,optarg); | 482 | fprintf(stderr,"parse commandline: %d ('%c'): %s\n",pchar,pchar,optarg); |
472 | #endif | 483 | #endif |
@@ -474,6 +485,7 @@ main (int argc, char **argv) | |||
474 | switch (pchar) { | 485 | switch (pchar) { |
475 | case -1 : cmdsunparsed = 0; break; | 486 | case -1 : cmdsunparsed = 0; break; |
476 | case 'C': loadconfig(optarg); break; | 487 | case 'C': loadconfig(optarg); break; |
488 | case 'F': setstroption(CF_FORMFILE,optarg); break; | ||
477 | case 'l': setintoption(CF_USESSL,0); break; | 489 | case 'l': setintoption(CF_USESSL,0); break; |
478 | case 'z': setintoption(CF_USECERT,0); break; | 490 | case 'z': setintoption(CF_USECERT,0); break; |
479 | case 's': setstroption(CF_SERVERHOST,optarg); break; | 491 | case 's': setstroption(CF_SERVERHOST,optarg); break; |
@@ -481,6 +493,9 @@ main (int argc, char **argv) | |||
481 | case 'c': setintoption(CF_CHANNEL,strtol(optarg,NULL,10)); break; | 493 | case 'c': setintoption(CF_CHANNEL,strtol(optarg,NULL,10)); break; |
482 | case 'n': setstroption(CF_NICK,optarg); break; | 494 | case 'n': setstroption(CF_NICK,optarg); break; |
483 | case 'f': setstroption(CF_FROM,optarg); break; | 495 | case 'f': setstroption(CF_FROM,optarg); break; |
496 | case 'k': setintoption(CF_KEEPLOG,1); break; | ||
497 | case 'K': setintoption(CF_KEEPLOG,0); break; | ||
498 | case 'L': setstroption(CF_LOGFILE,optarg); break; | ||
484 | case 'h': usage(argv[0]); exit(0); break; | 499 | case 'h': usage(argv[0]); exit(0); break; |
485 | default : usage(argv[0]); exit(1); | 500 | default : usage(argv[0]); exit(1); |
486 | } | 501 | } |
@@ -488,6 +503,9 @@ main (int argc, char **argv) | |||
488 | 503 | ||
489 | if (optind < argc) { usage(argv[0]); exit(1); } | 504 | if (optind < argc) { usage(argv[0]); exit(1); } |
490 | 505 | ||
506 | loadformats(GLOBAL_FORMAT_FILE); | ||
507 | loadformats(getstroption (CF_FORMFILE)); | ||
508 | |||
491 | if (!getintoption(CF_USESSL)) { | 509 | if (!getintoption(CF_USESSL)) { |
492 | setstroption(CF_SERVERHOST,"localhost"); | 510 | setstroption(CF_SERVERHOST,"localhost"); |
493 | setintoption(CF_SERVERPORT,2323); | 511 | setintoption(CF_SERVERPORT,2323); |
diff --git a/vchat-config.h b/vchat-config.h index 85db619..ca938b7 100755 --- a/vchat-config.h +++ b/vchat-config.h | |||
@@ -39,6 +39,7 @@ static volatile configoption configoptions[] = { | |||
39 | {CF_KEYFILE, CO_STR, "keyfile", "~/.vchat/key", NULL, NULL }, | 39 | {CF_KEYFILE, CO_STR, "keyfile", "~/.vchat/key", NULL, NULL }, |
40 | {CF_FORMFILE, CO_STR, "formatfile", "~/.vchat/formats", NULL, NULL }, | 40 | {CF_FORMFILE, CO_STR, "formatfile", "~/.vchat/formats", NULL, NULL }, |
41 | {CF_LOGFILE, CO_STR, "logfile", "~/.vchat/log", NULL, NULL, }, | 41 | {CF_LOGFILE, CO_STR, "logfile", "~/.vchat/log", NULL, NULL, }, |
42 | {CF_ENCODING, CO_STR, "encoding", NULL, NULL, &encoding }, | ||
42 | {CF_USESSL, CO_INT, "usessl", (char *) 1, (char *)-1, (unsigned char **)&usessl }, | 43 | {CF_USESSL, CO_INT, "usessl", (char *) 1, (char *)-1, (unsigned char **)&usessl }, |
43 | {CF_USECERT, CO_INT, "usecert", (char *) 1, (char *)-1, NULL }, | 44 | {CF_USECERT, CO_INT, "usecert", (char *) 1, (char *)-1, NULL }, |
44 | {CF_USETIME, CO_INT, "usetime", (char *) 1, (char *)-1, (unsigned char **)&usetime }, | 45 | {CF_USETIME, CO_INT, "usetime", (char *) 1, (char *)-1, (unsigned char **)&usetime }, |
@@ -91,9 +92,10 @@ static formatstring formatstrings[] = { | |||
91 | FE( FS_ERR_STRING, "\0011%s %s"), | 92 | FE( FS_ERR_STRING, "\0011%s %s"), |
92 | FE( FS_IDLE, "\0018%s"), | 93 | FE( FS_IDLE, "\0018%s"), |
93 | FE( FS_TIME, "\0015[%H:%M]\0010 "), | 94 | FE( FS_TIME, "\0015[%H:%M]\0010 "), |
95 | FE( FS_CONSOLETIME, "[%H:%M] "), | ||
94 | FE( FS_TOPICW, "[ Channel %d: %s"), | 96 | FE( FS_TOPICW, "[ Channel %d: %s"), |
95 | FE( FS_NOTOPICW, "[ Channel %d has no topic"), | 97 | FE( FS_NOTOPICW, "[ Channel %d has no topic"), |
96 | FE( FS_CONSOLE, "[ %s@%s:%d, use .h to get help, send bugs reports and feature requests to vchat@pulse.flatline.de ..."), | 98 | FE( FS_CONSOLE, "%s@%s:%d, use .h to get help "), |
97 | FE( FS_CONNECTED, "\0012# Connected to '\0016%s\0012', port \0016%d\0012 ..."), | 99 | FE( FS_CONNECTED, "\0012# Connected to '\0016%s\0012', port \0016%d\0012 ..."), |
98 | FE( FS_TOPIC, "\0012# Channel \0016%d\0012 topic is: '\0010%s\0012'"), | 100 | FE( FS_TOPIC, "\0012# Channel \0016%d\0012 topic is: '\0010%s\0012'"), |
99 | FE( FS_NOTOPIC, "\0012# Channel \0016%d\0012 has no topic"), | 101 | FE( FS_NOTOPIC, "\0012# Channel \0016%d\0012 has no topic"), |
diff --git a/vchat-messages.h b/vchat-messages.h index 08114d5..e73e567 100755 --- a/vchat-messages.h +++ b/vchat-messages.h | |||
@@ -56,6 +56,9 @@ servermessage servermessages[] = { | |||
56 | /* 123 <user login [user logout]> | 56 | /* 123 <user login [user logout]> |
57 | User Login / Logout Information */ | 57 | User Login / Logout Information */ |
58 | {"123", SM_USERINFO, NULL, NULL}, | 58 | {"123", SM_USERINFO, NULL, NULL}, |
59 | /* 169 <encoding> | ||
60 | List of known encodings */ | ||
61 | {"169", SM_INFO, NULL, NULL}, | ||
59 | /* 201 <protocol> <server-name> | 62 | /* 201 <protocol> <server-name> |
60 | Server signon */ | 63 | Server signon */ |
61 | {"201", SM_IGNORE, NULL, NULL}, | 64 | {"201", SM_IGNORE, NULL, NULL}, |
diff --git a/vchat-protocol.c b/vchat-protocol.c index 05abc26..d04d9b0 100755 --- a/vchat-protocol.c +++ b/vchat-protocol.c | |||
@@ -73,6 +73,7 @@ static void pmnotsent (unsigned char *message); | |||
73 | extern int status; | 73 | extern int status; |
74 | 74 | ||
75 | int usessl = 1; | 75 | int usessl = 1; |
76 | unsigned char *encoding; | ||
76 | 77 | ||
77 | /* connects to server */ | 78 | /* connects to server */ |
78 | int | 79 | int |
@@ -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,'*'); |
@@ -38,14 +38,15 @@ typedef enum { CO_NIL, CO_STR, CO_INT } conftype; | |||
38 | typedef enum { CF_NIL, CF_NICK, CF_FROM, CF_SERVERHOST, CF_SERVERPORT, | 38 | typedef enum { CF_NIL, CF_NICK, CF_FROM, CF_SERVERHOST, CF_SERVERPORT, |
39 | CF_CIPHERSUITE, CF_CONFIGFILE, CF_CERTFILE, CF_KEYFILE, CF_FORMFILE, CF_LOGFILE, | 39 | CF_CIPHERSUITE, CF_CONFIGFILE, CF_CERTFILE, CF_KEYFILE, CF_FORMFILE, CF_LOGFILE, |
40 | CF_USESSL, CF_USECERT, CF_PRIVHEIGHT, CF_HSCROLL, CF_CHANNEL, CF_USETIME, | 40 | CF_USESSL, CF_USECERT, CF_PRIVHEIGHT, CF_HSCROLL, CF_CHANNEL, CF_USETIME, |
41 | CF_SCROLLBPRIV, CF_SCROLLBACK, CF_SCROLLBPRIVT, CF_SCROLLBACKT, CF_KEEPLOG } confopt; | 41 | CF_SCROLLBPRIV, CF_SCROLLBACK, CF_SCROLLBPRIVT, CF_SCROLLBACKT, CF_KEEPLOG, |
42 | CF_ENCODING } confopt; | ||
42 | 43 | ||
43 | /* format strings */ | 44 | /* format strings */ |
44 | typedef enum { FS_PLAIN, FS_CHAN, FS_PRIV, FS_SERV, FS_GLOB, FS_DBG, FS_ERR, | 45 | typedef enum { FS_PLAIN, FS_CHAN, FS_PRIV, FS_SERV, FS_GLOB, FS_DBG, FS_ERR, |
45 | FS_IDLE, FS_TIME, FS_TOPICW, FS_NOTOPICW, FS_CONSOLE, FS_CONNECTED, FS_TOPIC, | 46 | FS_IDLE, FS_TIME, FS_CONSOLETIME, FS_TOPICW, FS_NOTOPICW, FS_CONSOLE, FS_CONNECTED, |
46 | FS_NOTOPIC, FS_CHGTOPIC, FS_USONLINE, FS_USMATCH, FS_SIGNON, FS_SIGNOFF, FS_JOIN, | 47 | FS_TOPIC, FS_NOTOPIC, FS_CHGTOPIC, FS_USONLINE, FS_USMATCH, FS_SIGNON, FS_SIGNOFF, |
47 | FS_LEAVE, FS_NICKCHANGE, FS_UNKNOWNMSG, FS_BOGUSMSG, FS_RXPUBURL, FS_MYPUBURL, | 48 | FS_JOIN, FS_LEAVE, FS_NICKCHANGE, FS_UNKNOWNMSG, FS_BOGUSMSG, FS_RXPUBURL, |
48 | FS_RXPUBMSG, FS_MYPUBMSG, FS_TXPUBMSG, FS_RXPRIVMSG, FS_TXPRIVMSG, | 49 | FS_MYPUBURL, FS_RXPUBMSG, FS_MYPUBMSG, FS_TXPUBMSG, FS_RXPRIVMSG, FS_TXPRIVMSG, |
49 | FS_BGPRIVMSG, FS_PUBACTION, FS_TXPUBACTION, FS_BGTXPUBACTION, FS_COMMAND, | 50 | FS_BGPRIVMSG, FS_PUBACTION, FS_TXPUBACTION, FS_BGTXPUBACTION, FS_COMMAND, |
50 | FS_LOCALCOMMAND, FS_BOGUSCOMMAND, FS_SBINF, FS_MISSTYPED, FS_UNKNCMD, FS_BADREGEX, | 51 | FS_LOCALCOMMAND, FS_BOGUSCOMMAND, FS_SBINF, FS_MISSTYPED, FS_UNKNCMD, FS_BADREGEX, |
51 | FS_ERR_STRING } formtstr; | 52 | FS_ERR_STRING } formtstr; |
@@ -134,6 +135,7 @@ extern unsigned char *vchat_ui_version; | |||
134 | #define CONSOLESTRSIZE 1024 | 135 | #define CONSOLESTRSIZE 1024 |
135 | extern unsigned char topicstr[]; | 136 | extern unsigned char topicstr[]; |
136 | extern unsigned char consolestr[]; | 137 | extern unsigned char consolestr[]; |
138 | extern unsigned char *encoding; | ||
137 | 139 | ||
138 | /* init / exit functions */ | 140 | /* init / exit functions */ |
139 | void initui (void); | 141 | void initui (void); |