aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd.c10
-rw-r--r--src/irc.c8
2 files changed, 14 insertions, 4 deletions
diff --git a/src/cmd.c b/src/cmd.c
index 362cfa8..56e5f16 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -239,10 +239,6 @@ static void do_server_info(void) {
txbuf_send_str("INFO");
}
-static void do_server_ping(void) {
- txbuf_send_str("PING 0xdeadbeef");
-}
-
/* arg1 = nick
arg2 = CTCP type
arg3 = optional data */
@@ -264,6 +260,12 @@ static void rtclok_to_numbuf(void) {
itoa(read_rtclok(), numbuf, 10);
}
+static void do_server_ping(void) {
+ rtclok_to_numbuf();
+ txbuf_set_str2("PING ", numbuf);
+ txbuf_send();
+}
+
static void do_ctcp_ping(void) {
arg2 = "PING";
rtclok_to_numbuf();
diff --git a/src/irc.c b/src/irc.c
index 9f8118f..e2b8afa 100644
--- a/src/irc.c
+++ b/src/irc.c
@@ -139,6 +139,12 @@ static void print_ping_time(char *p) {
*/
}
+static void do_server_pong(void) {
+ msg_src = "Server";
+ // FIXME: what if the server doesn't :-quote the response?
+ print_ping_time(msg_text);
+}
+
/* FIXME: this isn't very fast */
static void do_ctcp(int is_notice) {
static char *p, *ctcp_type, *resp;
@@ -493,6 +499,8 @@ static void dispatch_msg(void) {
do_kick();
} else if(streq_i(msg_cmd, "MODE")) {
do_mode();
+ } else if(streq_i(msg_cmd, "PONG")) {
+ do_server_pong();
} else if(isdigit(msg_cmd[0])) {
do_numeric();
} else {