]> jfr.im git - irc/rizon/znc.git/commitdiff
Make CClient::GetNickMask() always return a valid nickmask
authorpsychon <redacted>
Mon, 14 Jul 2008 10:44:37 +0000 (10:44 +0000)
committerpsychon <redacted>
Mon, 14 Jul 2008 10:44:37 +0000 (10:44 +0000)
The recent removal of CUser::m_bIRCConnected lead to a bug here which is now
fixed.
In addition to this, this function now also works properly for users without
a vhost.

Oh and in User.cpp: Make sure CUser::GetIRCServer() returns an empty string
when we are no longer connected to an IRCd.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1134 726aef4b-f618-498e-8847-2d620e286838

Client.cpp
IRCSock.h
User.cpp

index d269e414f4ff138f6bb42aa633d4ef96c6618639..88aa22e1ed5d7f66430927a59d87d017d47a3e30 100644 (file)
@@ -1979,9 +1979,14 @@ CString CClient::GetNick(bool bAllowIRCNick) const {
 }
 
 CString CClient::GetNickMask() const {
-       if (m_pIRCSock) {
+       if (m_pIRCSock && m_pIRCSock->IsAuthed()) {
                return m_pIRCSock->GetNickMask();
        }
 
-       return GetNick() + "!" + m_pUser->GetIdent() + "@" + m_pUser->GetVHost();
+       CString sHost = m_pUser->GetVHost();
+       if (sHost.empty()) {
+               sHost = "irc.znc.com";
+       }
+
+       return GetNick() + "!" + m_pUser->GetIdent() + "@" + sHost;
 }
index 9df048d3c8a0d641522fe46eca8a84803e84693f..9c7ac20d494147cbce07b091a9b03b96913d9725 100644 (file)
--- a/IRCSock.h
+++ b/IRCSock.h
@@ -77,6 +77,8 @@ public:
        bool HasNamesx() const { return m_bNamesx; }
        bool HasUHNames() const { return m_bUHNames; }
        const set<unsigned char>& GetUserModes() const { return m_scUserModes; }
+       // This is true if we are past raw 001
+       bool IsAuthed() const { return m_bAuthed; }
        // !Getters
 private:
        void SetNick(const CString& sNick);
index 3d50f995b68800c92a6d292ffcb2d867143d9f1b..93bd282d657e50d67f6348ccd7734d7c1f04d69c 100644 (file)
--- a/User.cpp
+++ b/User.cpp
@@ -119,6 +119,8 @@ void CUser::IRCDisconnected() {
                m_vClients[a]->IRCDisconnected();
        }
 
+       SetIRCServer("");
+
        // Get the reconnect going
        CZNC::Get().EnableConnectUser();
 }