From: <ps...@us...> - 2008-12-20 19:59:39
|
Revision: 1295 http://znc.svn.sourceforge.net/znc/?rev=1295&view=rev Author: psychon Date: 2008-12-20 19:59:36 +0000 (Sat, 20 Dec 2008) Log Message: ----------- Allow adding a server multiple times if a different port or pass is used This also moves the check for multiple servers from CClient to CUser::AddServer(). The idea for this is from cnu, thanks. Modified Paths: -------------- trunk/ClientCommand.cpp trunk/User.cpp Modified: trunk/ClientCommand.cpp =================================================================== --- trunk/ClientCommand.cpp 2008-12-19 13:43:56 UTC (rev 1294) +++ trunk/ClientCommand.cpp 2008-12-20 19:59:36 UTC (rev 1295) @@ -321,15 +321,11 @@ return; } - if (m_pUser->FindServer(sServer)) { - PutStatus("That server already exists"); - return; - } - if (m_pUser->AddServer(sLine.Token(1, true))) { PutStatus("Server added"); } else { PutStatus("Unable to add that server"); + PutStatus("Perhaps the server is already added or openssl is disabled?"); } } else if (sCommand.Equals("REMSERVER") || sCommand.Equals("DELSERVER")) { CString sServer = sLine.Token(1); Modified: trunk/User.cpp =================================================================== --- trunk/User.cpp 2008-12-19 13:43:56 UTC (rev 1294) +++ trunk/User.cpp 2008-12-20 19:59:36 UTC (rev 1295) @@ -768,6 +768,29 @@ uPort = 6667; } + // Check if server is already added + for (unsigned int a = 0; a < m_vServers.size(); a++) { + CServer* pServer = m_vServers[a]; + + if (!sName.Equals(pServer->GetName())) + continue; + + if (uPort != pServer->GetPort()) + continue; + + if (sPass != pServer->GetPass()) + continue; + + if (bSSL != pServer->IsSSL()) + continue; + + if (bIPV6 != pServer->IsIPV6()) + continue; + + // Server is already added + return false; + } + CServer* pServer = new CServer(sName, uPort, sPass, bSSL); m_vServers.push_back(pServer); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |