Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #204 from kylef/nick

Send a nick change to clients connecting with a different nick
  • Loading branch information...
commit e54f423acebe07896dd58a0ac735ba642d409b32 2 parents 7a4aa74 + 85a3115
@kylef kylef authored
Showing with 13 additions and 4 deletions.
  1. +13 −4 src/IRCNetwork.cpp
View
17 src/IRCNetwork.cpp
@@ -452,21 +452,30 @@ void CIRCNetwork::ClientConnected(CClient *pClient) {
m_vClients.push_back(pClient);
unsigned int uIdx, uSize;
- MCString msParams;
- msParams["target"] = GetIRCNick().GetNick();
if (m_RawBuffer.IsEmpty()) {
pClient->PutClient(":irc.znc.in 001 " + pClient->GetNick() + " :- Welcome to ZNC -");
} else {
+ const CString& sClientNick = pClient->GetNick(false);
+ MCString msParams;
+ msParams["target"] = sClientNick;
+
uSize = m_RawBuffer.Size();
for (uIdx = 0; uIdx < uSize; uIdx++) {
pClient->PutClient(m_RawBuffer.GetLine(uIdx, *pClient, msParams));
}
- // The assumption is that the client got this nick from the 001 reply
- pClient->SetNick(GetIRCNick().GetNick());
+ const CNick& Nick = GetIRCNick();
+ if (!sClientNick.Equals(Nick.GetNick())) {
+ pClient->PutClient(":" + sClientNick + "!" + Nick.GetIdent() +
+ "@" + Nick.GetHost() + " NICK :" + Nick.GetNick());
+ pClient->SetNick(Nick.GetNick());
+ }
}
+ MCString msParams;
+ msParams["target"] = GetIRCNick().GetNick();
+
// Send the cached MOTD
uSize = m_MotdBuffer.Size();
if (uSize > 0) {
Please sign in to comment.
Something went wrong with that request. Please try again.