Mercurial > hg
comparison mcabber/src/screen.c @ 850:d0781ca2dd08
Use new status buffer window
Update scr_LogPrint() to use the new status buffer.
Introduce HBB_PREFIX_SPECIAL flag which changes the prefix field in the
special buffers.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 08 May 2006 23:46:42 +0200 |
parents | 42c43a88d823 |
children | da03534e46c7 |
comparison
equal
deleted
inserted
replaced
849:42c43a88d823 | 850:d0781ca2dd08 |
---|---|
98 gint value; | 98 gint value; |
99 } keyseq; | 99 } keyseq; |
100 | 100 |
101 GSList *keyseqlist; | 101 GSList *keyseqlist; |
102 static void add_keyseq(char *seqstr, guint mkeycode, gint value); | 102 static void add_keyseq(char *seqstr, guint mkeycode, gint value); |
103 | |
104 void scr_WriteInWindow(const char *winId, const char *text, time_t timestamp, | |
105 unsigned int prefix_flags, int force_show); | |
103 | 106 |
104 | 107 |
105 /* Functions */ | 108 /* Functions */ |
106 | 109 |
107 static int scr_WindowWidth(WINDOW * win) | 110 static int scr_WindowWidth(WINDOW * win) |
355 if (!(flag & LPRINT_NOTUTF8)) | 358 if (!(flag & LPRINT_NOTUTF8)) |
356 buffer_locale = from_utf8(buffer); | 359 buffer_locale = from_utf8(buffer); |
357 else | 360 else |
358 buffer_locale = buffer; | 361 buffer_locale = buffer; |
359 if (Curses) { | 362 if (Curses) { |
363 char *buf_specialwindow; | |
360 wprintw(logWnd, "\n%s", buffer_locale); | 364 wprintw(logWnd, "\n%s", buffer_locale); |
361 update_panels(); | 365 update_panels(); |
362 doupdate(); | 366 doupdate(); |
367 if (flag & LPRINT_NOTUTF8) | |
368 buf_specialwindow = to_utf8(b2); | |
369 else | |
370 buf_specialwindow = b2; | |
371 scr_WriteInWindow(NULL, buf_specialwindow, timestamp, | |
372 HBB_PREFIX_SPECIAL, FALSE); | |
373 if (buf_specialwindow != b2) | |
374 g_free(buf_specialwindow); | |
363 } else { | 375 } else { |
364 printf("%s\n", buffer_locale); | 376 printf("%s\n", buffer_locale); |
365 } | 377 } |
366 if (!(flag & LPRINT_NOTUTF8)) | 378 if (!(flag & LPRINT_NOTUTF8)) |
367 g_free(buffer_locale); | 379 g_free(buffer_locale); |
458 { | 470 { |
459 int n; | 471 int n; |
460 int width; | 472 int width; |
461 hbb_line **lines, *line; | 473 hbb_line **lines, *line; |
462 GList *hbuf_head; | 474 GList *hbuf_head; |
463 char date[32]; | 475 char date[64]; |
464 | 476 |
465 width = scr_WindowWidth(win_entry->win); | 477 width = scr_WindowWidth(win_entry->win); |
466 | 478 |
467 // Should the window be empty? | 479 // Should the window be empty? |
468 if (win_entry->cleared) { | 480 if (win_entry->cleared) { |
500 // You need to set it to the whole prefix length + 1 | 512 // You need to set it to the whole prefix length + 1 |
501 if (line) { | 513 if (line) { |
502 if (line->flags & HBB_PREFIX_HLIGHT) | 514 if (line->flags & HBB_PREFIX_HLIGHT) |
503 wattrset(win_entry->win, get_color(COLOR_MSGOUT)); | 515 wattrset(win_entry->win, get_color(COLOR_MSGOUT)); |
504 | 516 |
505 if (line->timestamp) { | 517 if (line->timestamp && !(line->flags & HBB_PREFIX_SPECIAL)) { |
506 strftime(date, 30, "%m-%d %H:%M", localtime(&line->timestamp)); | 518 strftime(date, 30, "%m-%d %H:%M", localtime(&line->timestamp)); |
507 } else | 519 } else |
508 strcpy(date, " "); | 520 strcpy(date, " "); |
509 if (line->flags & HBB_PREFIX_INFO) { | 521 if (line->flags & HBB_PREFIX_INFO) { |
510 char dir = '*'; | 522 char dir = '*'; |
522 wprintw(win_entry->win, "%.11s #%c# ", date, dir); | 534 wprintw(win_entry->win, "%.11s #%c# ", date, dir); |
523 } else if (line->flags & HBB_PREFIX_IN) { | 535 } else if (line->flags & HBB_PREFIX_IN) { |
524 wprintw(win_entry->win, "%.11s <== ", date); | 536 wprintw(win_entry->win, "%.11s <== ", date); |
525 } else if (line->flags & HBB_PREFIX_OUT) { | 537 } else if (line->flags & HBB_PREFIX_OUT) { |
526 wprintw(win_entry->win, "%.11s --> ", date); | 538 wprintw(win_entry->win, "%.11s --> ", date); |
539 } else if (line->flags & HBB_PREFIX_SPECIAL) { | |
540 strftime(date, 30, "%m-%d %H:%M:%S", localtime(&line->timestamp)); | |
541 wprintw(win_entry->win, "%.14s ", date); | |
527 } else { | 542 } else { |
528 wprintw(win_entry->win, "%.11s ", date); | 543 wprintw(win_entry->win, "%.11s ", date); |
529 } | 544 } |
530 | 545 |
531 wprintw(win_entry->win, "%s", line->text); // Display text line | 546 wprintw(win_entry->win, "%s", line->text); // Display text line |
611 // Write some text in the winId window (this usually is a jid). | 626 // Write some text in the winId window (this usually is a jid). |
612 // Use winId == NULL for the special status buffer. | 627 // Use winId == NULL for the special status buffer. |
613 // Lines are splitted when they are too long to fit in the chat window. | 628 // Lines are splitted when they are too long to fit in the chat window. |
614 // If this window doesn't exist, it is created. | 629 // If this window doesn't exist, it is created. |
615 void scr_WriteInWindow(const char *winId, const char *text, time_t timestamp, | 630 void scr_WriteInWindow(const char *winId, const char *text, time_t timestamp, |
616 unsigned int prefix_flags, int force_show) | 631 unsigned int prefix_flags, int force_show) |
617 { | 632 { |
618 winbuf *win_entry; | 633 winbuf *win_entry; |
619 char *text_locale; | 634 char *text_locale; |
620 int dont_show = FALSE; | 635 int dont_show = FALSE; |
621 int special; | 636 int special; |