mirror of
https://github.com/znc/znc.git
synced 2026-08-06 08:52:57 +02:00
Remove some IMHO dangerous functions
Instead, these functions are now inlined into their only caller. This should make the user and network destruction a little saner. At least I hope so... Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
+22
-26
@@ -134,15 +134,33 @@ CIRCNetwork::CIRCNetwork(CUser *pUser, const CIRCNetwork *pNetwork, bool bCloneC
|
||||
}
|
||||
|
||||
CIRCNetwork::~CIRCNetwork() {
|
||||
DelClients();
|
||||
// Delete modules (this unloads all modules)
|
||||
delete m_pModules;
|
||||
m_pModules = NULL;
|
||||
|
||||
// Delete clients
|
||||
for (vector<CClient*>::const_iterator it = m_vClients.begin(); it != m_vClients.end(); ++it) {
|
||||
CZNC::Get().GetManager().DelSockByAddr(*it);
|
||||
}
|
||||
m_vClients.clear();
|
||||
|
||||
// Delete servers
|
||||
DelServers();
|
||||
DelModules();
|
||||
|
||||
// Delete Channels
|
||||
for (vector<CChan*>::const_iterator it = m_vChans.begin(); it != m_vChans.end(); ++it) {
|
||||
delete *it;
|
||||
}
|
||||
m_vChans.clear();
|
||||
|
||||
SetUser(NULL);
|
||||
}
|
||||
|
||||
for (unsigned int b = 0; b < m_vChans.size(); b++) {
|
||||
delete m_vChans[b];
|
||||
void CIRCNetwork::DelServers() {
|
||||
for (vector<CServer*>::const_iterator it = m_vServers.begin(); it != m_vServers.end(); ++it) {
|
||||
delete *it;
|
||||
}
|
||||
m_vServers.clear();
|
||||
}
|
||||
|
||||
CString CIRCNetwork::GetNetworkPath() {
|
||||
@@ -155,28 +173,6 @@ CString CIRCNetwork::GetNetworkPath() {
|
||||
return sNetworkPath;
|
||||
}
|
||||
|
||||
void CIRCNetwork::DelClients() {
|
||||
for (unsigned int c = 0; c < m_vClients.size(); c++) {
|
||||
CClient* pClient = m_vClients[c];
|
||||
CZNC::Get().GetManager().DelSockByAddr(pClient);
|
||||
}
|
||||
|
||||
m_vClients.clear();
|
||||
}
|
||||
|
||||
void CIRCNetwork::DelServers() {
|
||||
for (unsigned int a = 0; a < m_vServers.size(); a++) {
|
||||
delete m_vServers[a];
|
||||
}
|
||||
|
||||
m_vServers.clear();
|
||||
}
|
||||
|
||||
void CIRCNetwork::DelModules() {
|
||||
delete m_pModules;
|
||||
m_pModules = NULL;
|
||||
}
|
||||
|
||||
bool CIRCNetwork::ParseConfig(CConfig *pConfig, CString& sError, bool bUpgrade) {
|
||||
VCString vsList;
|
||||
VCString::const_iterator vit;
|
||||
|
||||
Reference in New Issue
Block a user