Skip to content

Commit

Permalink
irc: store lag in channel and private buffers (local variable "lag"),…
Browse files Browse the repository at this point in the history
… in addition to the server buffer
  • Loading branch information
flashcode committed May 16, 2024
1 parent 5c79933 commit 839ffc4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ New features::
* api: add support of specifier `%!` for timestamp in function util_strftimeval
* api: add support of base64url in encode/decode functions
* fset: add option `-import` in command `/fset`
* irc: store lag in channel and private buffers (local variable "lag"), in addition to the server buffer
* irc: allow range in commands `/unban` and `/unquiet` (issue #2113)
* irc: rename option irc.color.item_channel_modes to weechat.color.status_modes
* irc: add option `-all` in command `/allchan`, do not execute command on parted channels by default (issue #2085)
Expand Down
21 changes: 19 additions & 2 deletions src/plugins/irc/irc-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1268,20 +1268,37 @@ irc_server_set_clienttagdeny (struct t_irc_server *server,
void
irc_server_set_lag (struct t_irc_server *server)
{
struct t_irc_channel *ptr_channel;
char str_lag[32];

str_lag[0] = '\0';

if (server->lag >= weechat_config_integer (irc_config_network_lag_min_show))
{
snprintf (str_lag, sizeof (str_lag),
((server->lag_check_time.tv_sec == 0) || (server->lag < 1000)) ?
"%.3f" : "%.0f",
((float)(server->lag)) / 1000);
weechat_buffer_set (server->buffer, "localvar_set_lag", str_lag);

}

if (str_lag[0])
weechat_buffer_set (server->buffer, "localvar_set_lag", str_lag);
else
{
weechat_buffer_set (server->buffer, "localvar_del_lag", "");

for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
if (ptr_channel->buffer)
{
if (str_lag[0])
weechat_buffer_set (ptr_channel->buffer, "localvar_set_lag", str_lag);
else
weechat_buffer_set (ptr_channel->buffer, "localvar_del_lag", "");
}
}

weechat_hook_signal_send ("irc_server_lag_changed",
WEECHAT_HOOK_SIGNAL_STRING,
server->name);
Expand Down

0 comments on commit 839ffc4

Please sign in to comment.