From 3e780e8058db324f800c54283f554a1abae072d5 Mon Sep 17 00:00:00 2001 From: psychon Date: Sun, 7 Mar 2010 13:24:14 +0000 Subject: [PATCH] route_replies: Send 353 through ForwardRaw353() Before, route_replies bypassed this function which caused "wrong" replies to /names, because clients who didnt understand it still got NAMESX and UHNAMES replies. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1811 726aef4b-f618-498e-8847-2d620e286838 --- IRCSock.h | 6 ++++-- modules/route_replies.cpp | 11 ++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/IRCSock.h b/IRCSock.h index e86caab0..9bad80a5 100644 --- a/IRCSock.h +++ b/IRCSock.h @@ -76,11 +76,13 @@ public: // This is true if we are past raw 001 bool IsAuthed() const { return m_bAuthed; } // !Getters + + // This handles NAMESX and UHNAMES in a raw 353 reply + void ForwardRaw353(const CString& sLine) const; + void ForwardRaw353(const CString& sLine, CClient* pClient) const; private: void SetNick(const CString& sNick); void ParseISupport(const CString& sLine); - void ForwardRaw353(const CString& sLine) const; - void ForwardRaw353(const CString& sLine, CClient* pClient) const; // This is called when we connect and the nick we want is already taken void SendAltNick(const CString& sBadNick); protected: diff --git a/modules/route_replies.cpp b/modules/route_replies.cpp index 8c38b091..772196f3 100644 --- a/modules/route_replies.cpp +++ b/modules/route_replies.cpp @@ -8,6 +8,7 @@ #include "znc.h" #include "User.h" +#include "IRCSock.h" struct reply { const char *szReply; @@ -214,7 +215,7 @@ public: while (m_pReplies[i].szReply != NULL) { if (m_pReplies[i].szReply == sCmd) { - if (RouteReply(sLine, m_pReplies[i].bLastResponse)) + if (RouteReply(sLine, m_pReplies[i].bLastResponse, sCmd == "353")) return HALTCORE; return CONTINUE; } @@ -277,12 +278,16 @@ public: } private: - bool RouteReply(const CString& sLine, bool bFinished = false) + bool RouteReply(const CString& sLine, bool bFinished = false, bool bIsRaw353 = false) { if (!m_pDoing) return false; - m_pDoing->PutClient(sLine); + // 353 needs special treatment due to NAMESX and UHNAMES + if (bIsRaw353) + GetUser()->GetIRCSock()->ForwardRaw353(sLine, m_pDoing); + else + m_pDoing->PutClient(sLine); if (bFinished) { // Stop the timeout