summaryrefslogtreecommitdiff
path: root/src/irc/irc-recv.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-01-23 02:14:37 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-01-23 02:14:37 +0000
commit9d0b6fad72c3381af5397ee3549f9987194892aa (patch)
treecf10b9098baff3beba4bc582944e7d8183efe42d /src/irc/irc-recv.c
parent63d6ee1007d7038cbd4f86f41909cab67f5d0152 (diff)
downloadweechat-9d0b6fad72c3381af5397ee3549f9987194892aa.zip
Added lag indicator
Diffstat (limited to 'src/irc/irc-recv.c')
-rw-r--r--src/irc/irc-recv.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c
index 8b193ca99..dbd7bda7b 100644
--- a/src/irc/irc-recv.c
+++ b/src/irc/irc-recv.c
@@ -938,6 +938,37 @@ irc_cmd_recv_ping (t_irc_server *server, char *host, char *arguments)
}
/*
+ * irc_cmd_recv_pong: 'pong' command received
+ */
+
+int
+irc_cmd_recv_pong (t_irc_server *server, char *host, char *arguments)
+{
+ struct timeval tv;
+ struct timezone tz;
+ int old_lag;
+
+ (void)host;
+ (void)arguments;
+
+ if (server->lag_check_time.tv_sec != 0)
+ {
+ /* calculate lag (time diff with lag check) */
+ old_lag = server->lag;
+ gettimeofday (&tv, &tz);
+ server->lag = (int) get_timeval_diff (&(server->lag_check_time), &tv);
+ if (old_lag != server->lag)
+ gui_draw_buffer_status (gui_current_window->buffer, 1);
+
+ /* schedule next lag check */
+ server->lag_check_time.tv_sec = 0;
+ server->lag_check_time.tv_usec = 0;
+ server->lag_next_check = time (NULL) + cfg_irc_lag_check;
+ }
+ return 0;
+}
+
+/*
* irc_cmd_recv_privmsg: 'privmsg' command received
*/