summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2010-10-21 23:26:33 +0200
committerSebastien Helleu <flashcode@flashtux.org>2010-10-21 23:26:33 +0200
commit6e126937bc2fd5ee7333f557887e9d422bb84ca5 (patch)
tree6b5ed9f35535e865f7a3dc4acf15f13c04c86962 /src
parente867e96587fb261457f310d650cc80ad0755ec71 (diff)
downloadweechat-6e126937bc2fd5ee7333f557887e9d422bb84ca5.zip
Fix problem with day change message, which can be displayed twice
Day of month is saved in a variable to be used later (after signal is sent). So that is content of static structure has changed, it will not be a problem, it will not be used any more after signal.
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-config.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 0aaf3a629..871da9158 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -377,6 +377,7 @@ config_day_change_timer_cb (void *data, int remaining_calls)
{
struct timeval tv_time;
struct tm *local_time;
+ int new_mday;
char text_time[256], *text_time2;
struct t_gui_buffer *ptr_buffer;
@@ -386,9 +387,10 @@ config_day_change_timer_cb (void *data, int remaining_calls)
gettimeofday (&tv_time, NULL);
local_time = localtime (&tv_time.tv_sec);
-
+ new_mday = local_time->tm_mday;
+
if ((config_day_change_old_day >= 0)
- && (local_time->tm_mday != config_day_change_old_day))
+ && (new_mday != config_day_change_old_day))
{
if (CONFIG_BOOLEAN(config_look_day_change))
{
@@ -401,10 +403,12 @@ config_day_change_timer_cb (void *data, int remaining_calls)
ptr_buffer = ptr_buffer->next_buffer)
{
if (ptr_buffer->type == GUI_BUFFER_TYPE_FORMATTED)
+ {
gui_chat_printf (ptr_buffer,
_("\t\tDay changed to %s"),
(text_time2) ?
text_time2 : text_time);
+ }
}
if (text_time2)
free (text_time2);
@@ -416,7 +420,7 @@ config_day_change_timer_cb (void *data, int remaining_calls)
hook_signal_send ("day_changed", WEECHAT_HOOK_SIGNAL_STRING, text_time);
}
- config_day_change_old_day = local_time->tm_mday;
+ config_day_change_old_day = new_mday;
return WEECHAT_RC_OK;
}