diff options
author | jantje_85 <jantje_85@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-10-03 15:34:52 +0000 |
---|---|---|
committer | jantje_85 <jantje_85@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-10-03 15:34:52 +0000 |
commit | f553583f36254123792d01b90b5c168575d882cf (patch) | |
tree | 69781454dbab22edd166fd5620d31b65d90456c5 /src | |
parent | b22091e8fa3e2eeb67a14f7ce56b8b91fb4b0059 (diff) |
Fix bug #1109. Anopes now replies with proper PONGs to rfc compliant PINGs .
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2529 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/protocol.cpp | 12 | ||||
-rw-r--r-- | src/protocol/inspircd12.cpp | 7 | ||||
-rw-r--r-- | src/protocol/ratbox.c | 6 |
3 files changed, 17 insertions, 8 deletions
diff --git a/src/protocol.cpp b/src/protocol.cpp index 3b75b29f3..4f8603368 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -160,9 +160,19 @@ void IRCDProto::SendQuit(BotInfo *bi, const char *fmt, ...) va_end(args); SendQuitInternal(bi, buf); } + +/** + * Send a PONG reply to a received PING. + * servname should be left NULL to send a one param reply. + * @param servname Daemon or client that is responding to the PING. + * @param who Origin of the PING and destination of the PONG message. + **/ void IRCDProto::SendPong(const char *servname, const char *who) { - send_cmd(servname, "PONG %s", who); + if (!servname) + send_cmd(ircd->ts6 ? TS6SID : ServerName, "PONG %s", who); + else + send_cmd(ircd->ts6 ? TS6SID : ServerName, "PONG %s %s", servname, who); } void IRCDProto::SendInvite(BotInfo *bi, const char *chan, const char *nick) diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp index 72a64770f..8140d73a8 100644 --- a/src/protocol/inspircd12.cpp +++ b/src/protocol/inspircd12.cpp @@ -951,7 +951,12 @@ endnick: /* Events */ int anope_event_ping(const char *source, int ac, const char **av) { - ircdproto->SendPong(TS6SID, av[0]); + if (ac == 1) + ircdproto->SendPong(NULL, av[0]); + + if (ac == 2) + ircdproto->SendPong(av[1], av[0]); + return MOD_CONT; } diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c index 33eb88570..58efa0cc2 100644 --- a/src/protocol/ratbox.c +++ b/src/protocol/ratbox.c @@ -648,12 +648,6 @@ class RatboxProto : public IRCDTS6Proto else send_cmd(bi->uid, "QUIT"); } - /* PONG */ - void SendPong(const char *servname, const char *who) - { - send_cmd(TS6SID, "PONG %s", who); - } - /* INVITE */ void SendInvite(BotInfo *source, const char *chan, const char *nick) { |