From 100d92dff02437d39d3593795e8a0db0aed82917 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 18 Nov 2001 12:35:19 +0000 Subject: [PATCH] Reply to PINGs ourself if destination was proxy's address, our own nick or no destination at all. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2048 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/irc/proxy/listen.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/irc/proxy/listen.c b/src/irc/proxy/listen.c index e30cc9ba..7874ed60 100644 --- a/src/irc/proxy/listen.c +++ b/src/irc/proxy/listen.c @@ -126,6 +126,21 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args, if (strcmp(cmd, "QUIT") == 0) { remove_client(client); return; + } if (strcmp(cmd, "PING") == 0) { + /* Reply to PING, if the parameter is either proxy_adress, + our own nick or empty. */ + char *server = args; + if (*server == ':') server++; + + if (*server == '\0' || + g_strncasecmp(server, client->proxy_address, + strlen(client->proxy_address)) == 0 || + g_strncasecmp(server, client->nick, + strlen(client->nick)) == 0) { + if (*server == '\0') args = client->nick; + proxy_outdata(client, ":%s PONG %s\n", client->proxy_address, args); + return; + } } if (client->server == NULL || !client->server->connected) {