]> jfr.im git - irc/rizon/znc.git/commitdiff
Add a message sent to user in case of redirect.
authorAlexey Sokolov <redacted>
Wed, 31 Aug 2011 19:41:12 +0000 (02:41 +0700)
committerUli Schlachter <redacted>
Sun, 1 Jan 2012 13:16:55 +0000 (14:16 +0100)
IRCSock.cpp

index b045fde343437a68c6d4d168d28d10b332135828..a62ce009f141790121524415892b3491481ce2c7 100644 (file)
@@ -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 <hostname> <port> :<info>
+                               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: