From 960a4498f7b04f652462dfbff131a4d7c4701fdb Mon Sep 17 00:00:00 2001 From: TorrentialStorm Date: Wed, 24 Aug 2011 13:15:20 +0100 Subject: [PATCH 1/3] Don't send server redirects to client [TorrentialStorm] --- IRCSock.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/IRCSock.cpp b/IRCSock.cpp index 81f29862..d8ef4992 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -121,6 +121,8 @@ void CIRCSock::ReadLine(const CString& sData) { CString sRest = sLine.Token(3, true); switch (uRaw) { + case 10: // Don't send server redirects to the client + break; case 1: { // :irc.server.com 001 nick :Welcome to the Internet Relay Network nick if (m_bAuthed && sServer == "irc.znc.in") { // m_bAuthed == true => we already received another 001 => we might be in a traffic loop From 5512ed2ea061b2951ae9e24e89537f8ccb021944 Mon Sep 17 00:00:00 2001 From: TorrentialStorm Date: Wed, 24 Aug 2011 17:55:59 +0100 Subject: [PATCH 2/3] Don't forward server redirects to client. --- IRCSock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRCSock.cpp b/IRCSock.cpp index d8ef4992..b045fde3 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -122,7 +122,7 @@ void CIRCSock::ReadLine(const CString& sData) { switch (uRaw) { case 10: // Don't send server redirects to the client - break; + return; case 1: { // :irc.server.com 001 nick :Welcome to the Internet Relay Network nick if (m_bAuthed && sServer == "irc.znc.in") { // m_bAuthed == true => we already received another 001 => we might be in a traffic loop From 8f98384512decb5292e8504e0cfb9ba7fad9b48f Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Thu, 1 Sep 2011 02:41:12 +0700 Subject: [PATCH 3/3] Add a message sent to user in case of redirect. --- IRCSock.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/IRCSock.cpp b/IRCSock.cpp index b045fde3..a62ce009 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -11,6 +11,7 @@ #include "Client.h" #include "User.h" #include "znc.h" +#include "Server.h" // These are used in OnGeneralCTCP() const time_t CIRCSock::m_uCTCPFloodTime = 5; @@ -121,8 +122,6 @@ void CIRCSock::ReadLine(const CString& sData) { CString sRest = sLine.Token(3, true); switch (uRaw) { - case 10: // Don't send server redirects to the client - return; case 1: { // :irc.server.com 001 nick :Welcome to the Internet Relay Network nick if (m_bAuthed && sServer == "irc.znc.in") { // m_bAuthed == true => we already received another 001 => we might be in a traffic loop @@ -163,6 +162,16 @@ void CIRCSock::ReadLine(const CString& sData) { ParseISupport(sRest); m_pUser->UpdateExactRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest); break; + case 10: { // :irc.server.com 010 nick : + CString sHost = sRest.Token(0); + CString sPort = sRest.Token(1); + CString sInfo = sRest.Token(2, true).TrimPrefix_n(":"); + m_pUser->PutStatus("Server [" + m_pUser->GetCurrentServer()->GetString(false) + + "] redirects us to [" + sHost + ":" + sPort + "] with reason [" + sInfo + "]"); + m_pUser->PutStatus("Perhaps you want to add it as a new server."); + // Don't send server redirects to the client + return; + } case 2: case 3: case 4: