summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-config.c16
-rw-r--r--src/core/wee-config.h1
-rw-r--r--src/gui/curses/gui-curses-chat.c30
3 files changed, 36 insertions, 11 deletions
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 0e217deaf..f2a86341d 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -100,6 +100,7 @@ struct t_config_option *config_look_command_chars;
struct t_config_option *config_look_confirm_quit;
struct t_config_option *config_look_day_change;
struct t_config_option *config_look_day_change_message;
+struct t_config_option *config_look_day_change_message2;
struct t_config_option *config_look_eat_newline_glitch;
struct t_config_option *config_look_emphasized_attributes;
struct t_config_option *config_look_highlight;
@@ -2072,10 +2073,23 @@ config_weechat_init_options ()
weechat_config_file, ptr_section,
"day_change_message", "string",
/* TRANSLATORS: string "${color:xxx}" must NOT be translated */
- N_("message displayed when the day has changed (see man strftime for "
+ N_("message displayed when the day has changed, with one date displayed "
+ "(for example at beginning of buffer) (see man strftime for "
"date/time specifiers) (note: content is evaluated, so you can use "
"colors with format \"${color:xxx}\", see /help eval)"),
NULL, 0, 0, "-- %a, %d %b %Y --", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
+ config_look_day_change_message2 = config_file_new_option (
+ weechat_config_file, ptr_section,
+ "day_change_message2", "string",
+ /* TRANSLATORS: string "${color:xxx}" must NOT be translated */
+ N_("message displayed when the day has changed, with two dates displayed "
+ "(between two messages); the second date specifiers must start with "
+ "two \"%\" because strftime is called two times on this string "
+ "(see man strftime for date/time specifiers) (note: content is "
+ "evaluated, so you can use colors with format \"${color:xxx}\", "
+ "see /help eval)"),
+ NULL, 0, 0, "-- %%a, %%d %%b %%Y (%a, %d %b %Y) --", NULL, 0, NULL, NULL,
+ &config_change_buffers, NULL, NULL, NULL);
config_look_eat_newline_glitch = config_file_new_option (
weechat_config_file, ptr_section,
"eat_newline_glitch", "boolean",
diff --git a/src/core/wee-config.h b/src/core/wee-config.h
index a3d13ec03..77200875d 100644
--- a/src/core/wee-config.h
+++ b/src/core/wee-config.h
@@ -117,6 +117,7 @@ extern struct t_config_option *config_look_command_chars;
extern struct t_config_option *config_look_confirm_quit;
extern struct t_config_option *config_look_day_change;
extern struct t_config_option *config_look_day_change_message;
+extern struct t_config_option *config_look_day_change_message2;
extern struct t_config_option *config_look_eat_newline_glitch;
extern struct t_config_option *config_look_emphasized_attributes;
extern struct t_config_option *config_look_highlight;
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index e7be8fe11..5756efd5d 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -594,21 +594,29 @@ gui_chat_display_word (struct t_gui_window *window,
void
gui_chat_display_day_changed (struct t_gui_window *window,
- struct tm *date, int simulate)
+ struct tm *date1, struct tm *date2,
+ int simulate)
{
- char message[1024], *message_with_color;
+ char temp_message[1024], message[1024], *message_with_color;
if (simulate)
return;
- message_with_color = NULL;
-
/* build the message to display */
- strftime (message, sizeof (message),
- CONFIG_STRING(config_look_day_change_message), date);
+ if (date1)
+ {
+ strftime (temp_message, sizeof (temp_message),
+ CONFIG_STRING(config_look_day_change_message2), date1);
+ strftime (message, sizeof (message), temp_message, date2);
+ }
+ else
+ {
+ strftime (message, sizeof (message),
+ CONFIG_STRING(config_look_day_change_message), date2);
+ }
- if (strstr (message, "${"))
- message_with_color = eval_expression (message, NULL, NULL, NULL);
+ message_with_color = (strstr (message, "${")) ?
+ eval_expression (message, NULL, NULL, NULL) : NULL;
/* display the message */
gui_window_coords_init_line (window, window->win_chat_cursor_y);
@@ -1241,7 +1249,8 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
|| (local_time.tm_mon != local_time2.tm_mon)
|| (local_time.tm_year != local_time2.tm_year))
{
- gui_chat_display_day_changed (window, &local_time2, simulate);
+ gui_chat_display_day_changed (window, NULL, &local_time2,
+ simulate);
gui_chat_display_new_line (window, num_lines, count,
&lines_displayed, simulate);
pre_lines_displayed++;
@@ -1438,7 +1447,8 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
|| (local_time.tm_mon != local_time2.tm_mon)
|| (local_time.tm_year != local_time2.tm_year))
{
- gui_chat_display_day_changed (window, &local_time2, simulate);
+ gui_chat_display_day_changed (window, &local_time, &local_time2,
+ simulate);
gui_chat_display_new_line (window, num_lines, count,
&lines_displayed, simulate);
}