mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Print timestamps correctly with /SB REDRAW
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@926 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
47eda740cc
commit
fab312dde3
@ -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)
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 &&
|
||||
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 {
|
||||
/* FIXME: ugly ugly .. at least timestamps should be
|
||||
printed by GUI itself.. server tags are also a bit
|
||||
problematic.. */
|
||||
} 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,
|
||||
|
Loading…
Reference in New Issue
Block a user