1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 15:53:12 +02:00

Added "Day changed to [date]" message when day changes

This commit is contained in:
Sebastien Helleu
2005-10-18 17:46:54 +00:00
parent 1e382ab9bd
commit a9f04c5fd9
28 changed files with 2848 additions and 2598 deletions
+10
View File
@@ -92,6 +92,8 @@ int cfg_look_infobar_delay_highlight;
int cfg_look_hotlist_names_count;
int cfg_look_hotlist_names_level;
int cfg_look_hotlist_names_length;
int cfg_look_day_change;
char *cfg_look_day_change_timestamp;
t_config_option weechat_options_look[] =
{ { "look_set_title", N_("set title for window (terminal for Curses GUI) with name & version"),
@@ -206,6 +208,14 @@ t_config_option weechat_options_look[] =
N_("max length of names in hotlist (0 = no limit)"),
OPTION_TYPE_INT, 0, 32, 0,
NULL, NULL, &cfg_look_hotlist_names_length, NULL, config_change_buffer_content },
{ "look_day_change", N_("display special message when day changes"),
N_("display special message when day changes"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_day_change, NULL, config_change_noop },
{ "look_day_change_timestamp", N_("timestamp for date displayed when day changed"),
N_("timestamp for date displayed when day changed"),
OPTION_TYPE_STRING, 0, 0, 0,
"%a, %d %b %Y", NULL, NULL, &cfg_look_day_change_timestamp, config_change_noop },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
+2
View File
@@ -106,6 +106,8 @@ extern int cfg_look_infobar_delay_highlight;
extern int cfg_look_hotlist_names_count;
extern int cfg_look_hotlist_names_level;
extern int cfg_look_hotlist_names_length;
extern int cfg_look_day_change;
extern char *cfg_look_day_change_timestamp;
extern int cfg_col_title;
extern int cfg_col_title_bg;
+9 -5
View File
@@ -2751,14 +2751,16 @@ gui_add_message (t_gui_buffer *buffer, int type, int color, char *message)
}
/*
* gui_printf_type_color: display a message in a buffer
* gui_printf_internal: display a message in a buffer
* This function should NEVER be called directly.
* You should use macros defined in gui.h
*/
void
gui_printf_type_color (t_gui_buffer *buffer, int type, int color, char *message, ...)
gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, int color, char *message, ...)
{
static char buf[8192];
char text_time[1024 + 1];
char text_time[1024];
char text_time_char[2];
time_t time_seconds;
struct tm *local_time;
@@ -2847,11 +2849,13 @@ gui_printf_type_color (t_gui_buffer *buffer, int type, int color, char *message,
pos = buf3 - 1;
while (pos)
{
if ((!buffer->last_line) || (buffer->line_complete))
if (display_time
&& cfg_look_buffer_timestamp && cfg_look_buffer_timestamp[0]
&& ((!buffer->last_line) || (buffer->line_complete)))
{
time_seconds = time (NULL);
local_time = localtime (&time_seconds);
strftime (text_time, 1024, cfg_look_buffer_timestamp, local_time);
strftime (text_time, sizeof (text_time), cfg_look_buffer_timestamp, local_time);
time_first_digit = -1;
time_last_digit = -1;
+26 -1
View File
@@ -242,11 +242,18 @@ gui_main_loop ()
static struct timeval timeout, tv;
static struct timezone tz;
t_irc_server *ptr_server;
int old_min, old_sec, diff;
t_gui_buffer *ptr_buffer;
int old_day, old_min, old_sec, diff;
char text_time[1024];
time_t new_time;
struct tm *local_time;
quit_weechat = 0;
new_time = time (NULL);
local_time = localtime (&new_time);
old_day = local_time->tm_mday;
old_min = -1;
old_sec = -1;
check_away = 0;
@@ -260,6 +267,24 @@ gui_main_loop ()
{
old_min = local_time->tm_min;
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
if (cfg_look_day_change
&& (local_time->tm_mday != old_day))
{
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
if (!ptr_buffer->dcc)
{
strftime (text_time, sizeof (text_time),
cfg_look_day_change_timestamp, local_time);
gui_printf_nolog_notime (ptr_buffer,
_("Day changed to %s\n"),
text_time);
}
}
}
old_day = local_time->tm_mday;
}
/* second has changed ? */
+11 -5
View File
@@ -93,16 +93,22 @@
#define MSG_TYPE_NOLOG 64
#define gui_printf_color(buffer, color, fmt, argz...) \
gui_printf_type_color(buffer, MSG_TYPE_INFO, color, fmt, ##argz)
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, color, fmt, ##argz)
#define gui_printf_type(buffer, type, fmt, argz...) \
gui_printf_type_color(buffer, type, -1, fmt, ##argz)
gui_printf_internal(buffer, 1, type, -1, fmt, ##argz)
#define gui_printf_type_color(buffer, type, color, fmt, argz...) \
gui_printf_internal(buffer, 1, type, color, fmt, ##argz)
#define gui_printf(buffer, fmt, argz...) \
gui_printf_type_color(buffer, MSG_TYPE_INFO, -1, fmt, ##argz)
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, -1, fmt, ##argz)
#define gui_printf_nolog(buffer, fmt, argz...) \
gui_printf_type_color(buffer, MSG_TYPE_INFO | MSG_TYPE_NOLOG, -1, fmt, ##argz)
gui_printf_internal(buffer, 1, MSG_TYPE_INFO | MSG_TYPE_NOLOG, -1, fmt, ##argz)
#define gui_printf_nolog_notime(buffer, fmt, argz...) \
gui_printf_internal(buffer, 0, MSG_TYPE_INFO | MSG_TYPE_NOLOG, -1, fmt, ##argz)
#define NOTIFY_LEVEL_MIN 0
#define NOTIFY_LEVEL_MAX 3
@@ -416,7 +422,7 @@ extern void gui_init_colors ();
extern void gui_set_window_title ();
extern void gui_init ();
extern void gui_end ();
extern void gui_printf_type_color (/*@null@*/ t_gui_buffer *, int, int, char *, ...);
extern void gui_printf_internal (t_gui_buffer *, int, int, int, char *, ...);
extern void gui_input_default_key_bindings ();
extern void gui_main_loop ();