summaryrefslogtreecommitdiff
path: root/src/common
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/common
parent63d6ee1007d7038cbd4f86f41909cab67f5d0152 (diff)
downloadweechat-9d0b6fad72c3381af5397ee3549f9987194892aa.zip
Added lag indicator
Diffstat (limited to 'src/common')
-rw-r--r--src/common/completion.c2
-rw-r--r--src/common/weechat.c19
-rw-r--r--src/common/weechat.h2
-rw-r--r--src/common/weeconfig.c15
-rw-r--r--src/common/weeconfig.h3
5 files changed, 39 insertions, 2 deletions
diff --git a/src/common/completion.c b/src/common/completion.c
index e065b12fe..e28c4286f 100644
--- a/src/common/completion.c
+++ b/src/common/completion.c
@@ -261,8 +261,6 @@ completion_build_list (t_completion *completion, void *channel)
|| (strcasecmp (completion->base_command, "lusers") == 0)
|| (strcasecmp (completion->base_command, "motd") == 0)
|| (strcasecmp (completion->base_command, "oper") == 0)
- || (strcasecmp (completion->base_command, "ping") == 0)
- || (strcasecmp (completion->base_command, "pong") == 0)
|| (strcasecmp (completion->base_command, "rehash") == 0)
|| (strcasecmp (completion->base_command, "restart") == 0)
|| (strcasecmp (completion->base_command, "service") == 0)
diff --git a/src/common/weechat.c b/src/common/weechat.c
index 95a468bfa..b5629268a 100644
--- a/src/common/weechat.c
+++ b/src/common/weechat.c
@@ -124,6 +124,25 @@ weechat_convert_encoding (char *from_code, char *to_code, char *string)
}
/*
+ * get_timeval_diff: calculates difference between two times (return in milliseconds)
+ */
+
+long get_timeval_diff(struct timeval *tv1, struct timeval *tv2)
+{
+ long diff_sec, diff_usec;
+
+ diff_sec = tv2->tv_sec - tv1->tv_sec;
+ diff_usec = tv2->tv_usec - tv1->tv_usec;
+
+ if (diff_usec < 0)
+ {
+ diff_usec += 1000000;
+ diff_sec--;
+ }
+ return ((diff_usec / 1000) + (diff_sec * 1000));
+}
+
+/*
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
*/
diff --git a/src/common/weechat.h b/src/common/weechat.h
index acc416ea5..95e5a1fad 100644
--- a/src/common/weechat.h
+++ b/src/common/weechat.h
@@ -26,6 +26,7 @@
#endif
#include <stdio.h>
+#include <sys/time.h>
#if defined(ENABLE_NLS) && !defined(_)
#include <locale.h>
@@ -102,6 +103,7 @@ extern char *weechat_home;
extern char *local_charset;
extern char *weechat_convert_encoding (char *, char *, char *);
+extern long get_timeval_diff (struct timeval *, struct timeval *);
extern void wee_log_printf (char *, ...);
extern void wee_shutdown ();
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c
index 6875e8df9..df1aa67e6 100644
--- a/src/common/weeconfig.c
+++ b/src/common/weeconfig.c
@@ -460,6 +460,9 @@ int cfg_irc_display_away;
char *cfg_irc_default_msg_away;
char *cfg_irc_default_msg_part;
char *cfg_irc_default_msg_quit;
+int cfg_irc_lag_check;
+int cfg_irc_lag_min_show;
+int cfg_irc_lag_disconnect;
t_config_option weechat_options_irc[] =
{ { "irc_display_away", N_("display message to all channels when away"),
@@ -478,6 +481,18 @@ t_config_option weechat_options_irc[] =
N_("default quit message ('%v' will be replaced by WeeChat version in string)"),
OPTION_TYPE_STRING, 0, 0, 0,
"WeeChat %v", NULL, NULL, &cfg_irc_default_msg_quit, config_change_noop },
+ { "irc_lag_check", N_("interval between two checks for lag"),
+ N_("interval between two checks for lag (in seconds)"),
+ OPTION_TYPE_INT, 30, INT_MAX, 60,
+ NULL, NULL, &cfg_irc_lag_check, NULL, config_change_noop },
+ { "irc_lag_min_show", N_("minimum lag to show"),
+ N_("minimum lag to show (in seconds)"),
+ OPTION_TYPE_INT, 1, INT_MAX, 1,
+ NULL, NULL, &cfg_irc_lag_min_show, NULL, config_change_noop },
+ { "irc_lag_disconnect", N_("disconnect after important lag"),
+ N_("disconnect after important lag (in minutes, 0 = never disconnect)"),
+ OPTION_TYPE_INT, 0, INT_MAX, 5,
+ NULL, NULL, &cfg_irc_lag_disconnect, NULL, config_change_noop },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
diff --git a/src/common/weeconfig.h b/src/common/weeconfig.h
index 7e10c4255..85681dafe 100644
--- a/src/common/weeconfig.h
+++ b/src/common/weeconfig.h
@@ -154,6 +154,9 @@ extern int cfg_irc_display_away;
extern char *cfg_irc_default_msg_away;
extern char *cfg_irc_default_msg_part;
extern char *cfg_irc_default_msg_quit;
+extern int cfg_irc_lag_check;
+extern int cfg_irc_lag_min_show;
+extern int cfg_irc_lag_disconnect;
extern int cfg_dcc_auto_accept_files;
extern int cfg_dcc_auto_accept_chats;