diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-05-23 12:18:45 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-05-23 12:18:45 +0200 |
commit | 64d7fa7e51b8b6fbaf6d332b8854c7615889b63d (patch) | |
tree | d33b22e4974abd6d5152abb93b075db536426f05 /src | |
parent | f51ec651d37845da30414d58eb55af340dcaee17 (diff) | |
download | weechat-64d7fa7e51b8b6fbaf6d332b8854c7615889b63d.zip |
Fix bug with option irc.network.lag_check when value is 0 (zero)
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/irc/irc-config.c | 29 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 3 |
2 files changed, 30 insertions, 2 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 1501c3f3b..2da039ecd 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -439,6 +439,32 @@ irc_config_change_network_away_check (void *data, } /* + * irc_config_change_network_lag_check: called when lag check is changed + */ + +void +irc_config_change_network_lag_check (void *data, + struct t_config_option *option) +{ + time_t time_next_check; + struct t_irc_server *ptr_server; + + /* make C compiler happy */ + (void) data; + (void) option; + + time_next_check = (weechat_config_integer (irc_config_network_lag_check) > 0) ? + time (NULL) : 0; + + for (ptr_server = irc_servers; ptr_server; + ptr_server = ptr_server->next_server) + { + if (ptr_server->is_connected) + ptr_server->lag_next_check = time_next_check; + } +} + +/* * irc_config_change_network_send_unknown_commands: called when "send_unknown_commands" * is changed */ @@ -1709,7 +1735,8 @@ irc_config_init () "lag_check", "integer", N_("interval between two checks for lag (in seconds, 0 = never " "check)"), - NULL, 0, INT_MAX, "60", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, INT_MAX, "60", NULL, 0, NULL, NULL, + &irc_config_change_network_lag_check, NULL, NULL, NULL); irc_config_network_lag_min_show = weechat_config_new_option ( irc_config_file, ptr_section, "lag_min_show", "integer", diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 50a0cfa58..3976ff21d 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -1925,7 +1925,8 @@ irc_server_timer_cb (void *data, int remaining_calls) irc_server_outqueue_send (ptr_server); /* check for lag */ - if ((ptr_server->lag_check_time.tv_sec == 0) + if ((weechat_config_integer (irc_config_network_lag_check) > 0) + && (ptr_server->lag_check_time.tv_sec == 0) && (new_time >= ptr_server->lag_next_check)) { irc_server_sendf (ptr_server, 0, "PING %s", |