Mercurial > hg
comparison mcabber/src/screen.c @ 332:a1901741890e
scr_LogPrint() can be called before ncurses initialization
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 18 Jul 2005 18:57:50 +0100 |
parents | a9013124ede6 |
children | eb994ee40029 |
comparison
equal
deleted
inserted
replaced
331:1510dda4ad71 | 332:a1901741890e |
---|---|
68 static int multimode; | 68 static int multimode; |
69 static char *multiline; | 69 static char *multiline; |
70 int update_roster; | 70 int update_roster; |
71 int utf8_mode = 0; | 71 int utf8_mode = 0; |
72 static bool Autoaway; | 72 static bool Autoaway; |
73 static bool Curses; | |
73 | 74 |
74 static char inputLine[INPUTLINE_LENGTH+1]; | 75 static char inputLine[INPUTLINE_LENGTH+1]; |
75 static char *ptr_inputline; | 76 static char *ptr_inputline; |
76 static short int inputline_offset; | 77 static short int inputline_offset; |
77 static int completion_started; | 78 static int completion_started; |
467 noecho(); | 468 noecho(); |
468 raw(); | 469 raw(); |
469 halfdelay(5); | 470 halfdelay(5); |
470 start_color(); | 471 start_color(); |
471 use_default_colors(); | 472 use_default_colors(); |
473 Curses = TRUE; | |
472 | 474 |
473 ParseColors(); | 475 ParseColors(); |
474 | 476 |
475 getmaxyx(stdscr, maxY, maxX); | 477 getmaxyx(stdscr, maxY, maxX); |
476 if (maxY < LOG_WIN_HEIGHT+2) | 478 if (maxY < LOG_WIN_HEIGHT+2) |
487 void scr_TerminateCurses(void) | 489 void scr_TerminateCurses(void) |
488 { | 490 { |
489 clear(); | 491 clear(); |
490 refresh(); | 492 refresh(); |
491 endwin(); | 493 endwin(); |
494 Curses = FALSE; | |
492 return; | 495 return; |
493 } | 496 } |
494 | 497 |
495 void inline set_autoaway(bool setaway) | 498 void inline set_autoaway(bool setaway) |
496 { | 499 { |
1103 buffer = (char *) calloc(1, 1024); | 1106 buffer = (char *) calloc(1, 1024); |
1104 } while (!buffer); | 1107 } while (!buffer); |
1105 | 1108 |
1106 timestamp = time(NULL); | 1109 timestamp = time(NULL); |
1107 strftime(buffer, 64, "[%H:%M:%S] ", localtime(×tamp)); | 1110 strftime(buffer, 64, "[%H:%M:%S] ", localtime(×tamp)); |
1108 wprintw(logWnd, "\n%s", buffer); | 1111 if (Curses) |
1112 wprintw(logWnd, "\n%s", buffer); | |
1113 else | |
1114 printf("%s", buffer); | |
1109 | 1115 |
1110 va_start(ap, fmt); | 1116 va_start(ap, fmt); |
1111 vsnprintf(buffer, 1024, fmt, ap); | 1117 vsnprintf(buffer, 1024, fmt, ap); |
1112 va_end(ap); | 1118 va_end(ap); |
1113 | 1119 |
1114 wprintw(logWnd, "%s", buffer); | 1120 if (Curses) { |
1121 wprintw(logWnd, "%s", buffer); | |
1122 update_panels(); | |
1123 doupdate(); | |
1124 } else { | |
1125 printf("%s\n", buffer); | |
1126 } | |
1115 free(buffer); | 1127 free(buffer); |
1116 | |
1117 update_panels(); | |
1118 doupdate(); | |
1119 } | 1128 } |
1120 | 1129 |
1121 // scr_set_chatmode() | 1130 // scr_set_chatmode() |
1122 // Public function to (un)set chatmode... | 1131 // Public function to (un)set chatmode... |
1123 inline void scr_set_chatmode(int enable) | 1132 inline void scr_set_chatmode(int enable) |