summaryrefslogtreecommitdiff
path: root/src/irc/irc-send.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2003-10-12 17:03:38 +0000
committerSebastien Helleu <flashcode@flashtux.org>2003-10-12 17:03:38 +0000
commit836d7a139a0c60e66bd003bcce299f23065ca75a (patch)
tree797a9ea1fc5649932cefe34df595fd02d176afee /src/irc/irc-send.c
parentc67cfeaa87ea30747c0dbfe1737b7ff43b12cf0e (diff)
downloadweechat-836d7a139a0c60e66bd003bcce299f23065ca75a.zip
Added CTCP Ping command (and display correctly when reply is received).
Diffstat (limited to 'src/irc/irc-send.c')
-rw-r--r--src/irc/irc-send.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c
index f27edbf72..c672f7fbb 100644
--- a/src/irc/irc-send.c
+++ b/src/irc/irc-send.c
@@ -28,6 +28,7 @@
#include <unistd.h>
#include <stdio.h>
#include <string.h>
+#include <sys/time.h>
#include <time.h>
#include <sys/utsname.h>
@@ -126,6 +127,8 @@ int
irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
{
char *pos, *pos2;
+ struct timeval tv;
+ struct timezone tz;
pos = strchr (arguments, ' ');
if (pos)
@@ -163,6 +166,12 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
server_sendf (server, "PRIVMSG %s :\01ACTION\01\r\n",
arguments);
}
+ if (strcasecmp (pos, "ping") == 0)
+ {
+ gettimeofday (&tv, &tz);
+ server_sendf (server, "PRIVMSG %s :\01PING %d %d\01\r\n",
+ arguments, tv.tv_sec, tv.tv_usec);
+ }
}
return 0;