mirror of
https://github.com/znc/znc.git
synced 2026-06-30 23:11:28 +02:00
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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user