mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Fix GetClients() const correctness
It’s dangerous to give a non-const reference to an internal container that the API users are not supposed to modify.
This commit is contained in:
@@ -271,7 +271,7 @@ void CClient::ReadLine(const CString& sData) {
|
||||
|
||||
// Relay to the rest of the clients that may be connected to this user
|
||||
if (m_pNetwork->IsChan(sTarget)) {
|
||||
vector<CClient*>& vClients = GetClients();
|
||||
const vector<CClient*>& vClients = GetClients();
|
||||
|
||||
for (unsigned int a = 0; a < vClients.size(); a++) {
|
||||
CClient* pClient = vClients[a];
|
||||
@@ -325,7 +325,7 @@ void CClient::ReadLine(const CString& sData) {
|
||||
}
|
||||
|
||||
// Relay to the rest of the clients that may be connected to this user
|
||||
vector<CClient*>& vClients = GetClients();
|
||||
const vector<CClient*>& vClients = GetClients();
|
||||
|
||||
for (unsigned int a = 0; a < vClients.size(); a++) {
|
||||
CClient* pClient = vClients[a];
|
||||
@@ -394,7 +394,7 @@ void CClient::ReadLine(const CString& sData) {
|
||||
// Relay to the rest of the clients that may be connected to this user
|
||||
|
||||
if (m_pNetwork->IsChan(sTarget)) {
|
||||
vector<CClient*>& vClients = GetClients();
|
||||
const vector<CClient*>& vClients = GetClients();
|
||||
|
||||
for (unsigned int a = 0; a < vClients.size(); a++) {
|
||||
CClient* pClient = vClients[a];
|
||||
@@ -575,7 +575,7 @@ void CClient::SetNetwork(CIRCNetwork* pNetwork, bool bDisconnect, bool bReconnec
|
||||
}
|
||||
}
|
||||
|
||||
vector<CClient*>& CClient::GetClients() {
|
||||
const vector<CClient*>& CClient::GetClients() const {
|
||||
if (m_pNetwork) {
|
||||
return m_pNetwork->GetClients();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user