From 2a901da4659c624dd450285e87e789c378e4ab36 Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Tue, 7 Feb 2012 19:24:56 +0000 Subject: [PATCH] partyline: Use the clients nickname in the channel, not PREFIX+username This means that every reference to my own user will instead show my clients nickname. This will prevent the client from seeing itself, and the real nick for your client in the channel. --- modules/partyline.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/modules/partyline.cpp b/modules/partyline.cpp index df1cfe90..41b0f013 100644 --- a/modules/partyline.cpp +++ b/modules/partyline.cpp @@ -73,9 +73,11 @@ public: // Kick all clients who are in partyline channels for (set::iterator it = m_ssChannels.begin(); it != m_ssChannels.end(); ++it) { set ssNicks = (*it)->GetNicks(); + for (set::const_iterator it2 = ssNicks.begin(); it2 != ssNicks.end(); ++it2) { CUser* pUser = CZNC::Get().FindUser(*it2); vector vClients = pUser->GetAllClients(); + for (vector::const_iterator it3 = vClients.begin(); it3 != vClients.end(); ++it3) { CClient* pClient = *it3; pClient->PutClient( ":*" + GetModName() + "!znc@znc.in KICK " + (*it)->GetName() + " " + pClient->GetNick() + " :" + GetModName() + " unloaded"); @@ -233,7 +235,7 @@ public: } SendNickList(m_pUser, m_pNetwork, ssNicks, (*it)->GetName()); - PutChan(ssNicks, ":*" + GetModName() + "!znc@znc.in MODE " + (*it)->GetName() + " +" + CString(m_pUser->IsAdmin() ? "o" : "v") + " " + NICK_PREFIX + m_pUser->GetUserName(), true); + PutChan(ssNicks, ":*" + GetModName() + "!znc@znc.in MODE " + (*it)->GetName() + " +" + CString(m_pUser->IsAdmin() ? "o" : "v") + " " + NICK_PREFIX + m_pUser->GetUserName(), false); } } } @@ -244,7 +246,7 @@ public: const set& ssNicks = (*it)->GetNicks(); if (ssNicks.find(m_pUser->GetUserName()) != ssNicks.end()) { - PutChan(ssNicks, ":*" + GetModName() + "!znc@znc.in MODE " + (*it)->GetName() + " -ov " + NICK_PREFIX + m_pUser->GetUserName() + " " + NICK_PREFIX + m_pUser->GetUserName(), true); + PutChan(ssNicks, ":*" + GetModName() + "!znc@znc.in MODE " + (*it)->GetName() + " -ov " + NICK_PREFIX + m_pUser->GetUserName() + " " + NICK_PREFIX + m_pUser->GetUserName(), false); } } } @@ -339,7 +341,7 @@ public: for (vector::const_iterator it = vClients.begin(); it != vClients.end(); ++it) { CClient* pClient = *it; - pClient->PutClient(":" + pClient->GetNickMask() + sCmd + pChannel->GetName() + sMsg); + pClient->PutClient(":" + pClient->GetNickMask() + sCmd + pChannel->GetName() + " " + pClient->GetNick() + sMsg); } PutChan(ssNicks, ":" + NICK_PREFIX + pUser->GetUserName() + "!" + pUser->GetIdent() + "@" + sHost @@ -410,9 +412,13 @@ public: SendNickList(pUser, NULL, ssNicks, pChannel->GetName()); + /* Tell the other clients we have op or voice, the current user's clients already know from NAMES list */ + if (pUser->IsAdmin()) { - PutChan(ssNicks, ":*" + GetModName() + "!znc@znc.in MODE " + pChannel->GetName() + " +o " + NICK_PREFIX + pUser->GetUserName(), false, true, pUser); + PutChan(ssNicks, ":*" + GetModName() + "!znc@znc.in MODE " + pChannel->GetName() + " +o " + NICK_PREFIX + pUser->GetUserName(), false, false, pUser); } + + PutChan(ssNicks, ":*" + GetModName() + "!znc@znc.in MODE " + pChannel->GetName() + " +v " + NICK_PREFIX + pUser->GetUserName(), false, false, pUser); } } @@ -542,6 +548,10 @@ public: for (set::const_iterator it = ssNicks.begin(); it != ssNicks.end(); ++it) { CUser* pChanUser = CZNC::Get().FindUser(*it); + if (pChanUser == pUser) { + continue; + } + if (pChanUser && pChanUser->IsUserAttached()) { sNickList += (pChanUser->IsAdmin()) ? "@" : "+"; } @@ -558,6 +568,12 @@ public: PutUserIRCNick(pUser, ":" + GetIRCServer(pNetwork) + " 353 ", " @ " + sChan + " :" + sNickList); } + vector vClients = pUser->GetAllClients(); + for (vector::const_iterator it = vClients.begin(); it != vClients.end(); ++it) { + CClient* pClient = *it; + pClient->PutClient(":" + GetIRCServer(pNetwork) + " 353 " + pClient->GetNick() + " @ " + sChan + " :" + ((pUser->IsAdmin()) ? "@" : "+") + pClient->GetNick()); + } + PutUserIRCNick(pUser, ":" + GetIRCServer(pNetwork) + " 366 ", " " + sChan + " :End of /NAMES list."); }