diff options
author | Timo Sirainen <cras@irssi.org> | 2000-12-02 22:08:07 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-12-02 22:08:07 +0000 |
commit | fab312dde39a1ccead87fcd0d76dbf7d645cdda5 (patch) | |
tree | 9bec5ebe6f38b2837286f5056b745b4ba0a01b8c /src | |
parent | 47eda740cca35dcd5987e38af573a9bf9af39a15 (diff) | |
download | irssi-fab312dde39a1ccead87fcd0d76dbf7d645cdda5.zip |
Print timestamps correctly with /SB REDRAW
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@926 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/formats.c | 9 | ||||
-rw-r--r-- | src/fe-common/core/formats.h | 2 | ||||
-rw-r--r-- | src/fe-common/core/printtext.c | 2 | ||||
-rw-r--r-- | src/fe-text/gui-windows.c | 21 |
4 files changed, 14 insertions, 20 deletions
diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c index a369c209..469c20c4 100644 --- a/src/fe-common/core/formats.c +++ b/src/fe-common/core/formats.c @@ -390,17 +390,14 @@ char *format_get_level_tag(THEME_REC *theme, TEXT_DEST_REC *dest) ((level & (MSGLEVEL_NEVER|MSGLEVEL_LASTLOG)) == 0 && \ (timestamps || (msgs_timestamps && ((level) & MSGLEVEL_MSGS)))) -static char *get_timestamp(THEME_REC *theme, TEXT_DEST_REC *dest) +static char *get_timestamp(THEME_REC *theme, TEXT_DEST_REC *dest, time_t t) { struct tm *tm; - time_t t; int diff; if (!show_timestamp(dest->level)) return NULL; - t = time(NULL); - if (timestamp_timeout > 0) { diff = t - dest->window->last_timestamp; dest->window->last_timestamp = t; @@ -442,12 +439,12 @@ static char *get_server_tag(THEME_REC *theme, TEXT_DEST_REC *dest) IRCTXT_SERVERTAG, server->tag); } -char *format_get_line_start(THEME_REC *theme, TEXT_DEST_REC *dest) +char *format_get_line_start(THEME_REC *theme, TEXT_DEST_REC *dest, time_t t) { char *timestamp, *servertag; char *linestart; - timestamp = get_timestamp(theme, dest); + timestamp = get_timestamp(theme, dest, t); servertag = get_server_tag(theme, dest); if (timestamp == NULL && servertag == NULL) diff --git a/src/fe-common/core/formats.h b/src/fe-common/core/formats.h index 7038b5ae..94bb100a 100644 --- a/src/fe-common/core/formats.h +++ b/src/fe-common/core/formats.h @@ -65,7 +65,7 @@ char *format_add_linestart(const char *text, const char *linestart); char *format_get_level_tag(THEME_REC *theme, TEXT_DEST_REC *dest); /* return timestamp + server tag */ -char *format_get_line_start(THEME_REC *theme, TEXT_DEST_REC *dest); +char *format_get_line_start(THEME_REC *theme, TEXT_DEST_REC *dest, time_t t); /* "private" functions for printtext */ diff --git a/src/fe-common/core/printtext.c b/src/fe-common/core/printtext.c index f5bde71d..17111c5e 100644 --- a/src/fe-common/core/printtext.c +++ b/src/fe-common/core/printtext.c @@ -287,7 +287,7 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text) /* add timestamp/server tag here - if it's done in print_line() it would be written to log files too */ - tmp = format_get_line_start(current_theme, dest); + tmp = format_get_line_start(current_theme, dest, time(NULL)); str = format_add_linestart(text, tmp); g_free_not_null(tmp); diff --git a/src/fe-text/gui-windows.c b/src/fe-text/gui-windows.c index 885139aa..5ed1bd88 100644 --- a/src/fe-text/gui-windows.c +++ b/src/fe-text/gui-windows.c @@ -1021,17 +1021,14 @@ void gui_window_reformat_line(WINDOW_REC *window, LINE_REC *line) raw = g_string_new(NULL); str = gui_window_line_get_format(window, line, raw); - if (str == NULL) { - if (raw->len == 2 && - raw->str[1] == (char)LINE_CMD_FORMAT_CONT) { - /* multiline format, format explained in one the - following lines. remove this line. */ - gui_window_line_remove(window, line); - } - } else { - /* FIXME: ugly ugly .. at least timestamps should be - printed by GUI itself.. server tags are also a bit - problematic.. */ + if (str == NULL && raw->len == 2 && + raw->str[1] == (char)LINE_CMD_FORMAT_CONT) { + /* multiline format, format explained in one the + following lines. remove this line. */ + gui_window_line_remove(window, line); + } else if (str != NULL) { + /* FIXME: ugly ugly .. and this can't handle + non-formatted lines.. */ g_string_append_c(raw, '\0'); g_string_append_c(raw, (char)LINE_CMD_EOL); @@ -1044,7 +1041,7 @@ void gui_window_reformat_line(WINDOW_REC *window, LINE_REC *line) format_create_dest(&dest, NULL, NULL, line->level, window); - linestart = format_get_line_start(current_theme, &dest); + linestart = format_get_line_start(current_theme, &dest, line->time); leveltag = format_get_level_tag(current_theme, &dest); prestr = g_strconcat(linestart == NULL ? "" : linestart, |