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.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1295 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-12-20 19:59:36 +00:00
parent d254240866
commit baab007f2b
2 changed files with 24 additions and 5 deletions
+23
View File
@@ -768,6 +768,29 @@ bool CUser::AddServer(const CString& sName, unsigned short uPort, const CString&
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);