diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd.c | 10 | ||||
| -rw-r--r-- | src/irc.c | 8 |
2 files changed, 14 insertions, 4 deletions
@@ -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(); @@ -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 { |
