diff --git a/include/znc/IRCNetwork.h b/include/znc/IRCNetwork.h index 162a456d..ccb35def 100644 --- a/include/znc/IRCNetwork.h +++ b/include/znc/IRCNetwork.h @@ -76,6 +76,7 @@ public: const CString& GetName() const; bool IsNetworkAttached() const { return !m_vClients.empty(); } const std::vector& GetClients() const { return m_vClients; } + CClient* FindClient(const CString& sIdentifier) const; void SetUser(CUser *pUser); bool SetName(const CString& sName); diff --git a/src/IRCNetwork.cpp b/src/IRCNetwork.cpp index ea260c13..e809d243 100644 --- a/src/IRCNetwork.cpp +++ b/src/IRCNetwork.cpp @@ -669,6 +669,16 @@ const CString& CIRCNetwork::GetName() const { return m_sName; } +CClient* CIRCNetwork::FindClient(const CString& sIdentifier) const { + for (CClient* pClient : m_vClients) { + if (pClient->GetIdentifier().Equals(sIdentifier)) { + return pClient; + } + } + + return NULL; +} + void CIRCNetwork::SetUser(CUser *pUser) { for (unsigned int a = 0; a < m_vClients.size(); a++) { m_vClients[a]->PutStatus("This network is being deleted or moved to another user.");