Skip to content
Browse files

PutModule should try sending the line to all clients connected to the…

… same network before the user clients
  • Loading branch information...
1 parent cd1192e commit 9e3dc0bf4ee3c64d84984b97c1dfc66bd1443733 @kylef kylef committed Sep 18, 2011
Showing with 24 additions and 4 deletions.
  1. +14 −0 IRCNetwork.cpp
  2. +1 −0 IRCNetwork.h
  3. +9 −4 Modules.cpp
View
14 IRCNetwork.cpp
@@ -460,6 +460,20 @@ bool CIRCNetwork::PutStatus(const CString& sLine, CClient* pClient, CClient* pSk
return (pClient == NULL);
}
+bool CIRCNetwork::PutModule(const CString& sModule, const CString& sLine, CClient* pClient, CClient* pSkipClient) {
+ for (unsigned int a = 0; a < m_vClients.size(); a++) {
+ if ((!pClient || pClient == m_vClients[a]) && pSkipClient != m_vClients[a]) {
+ m_vClients[a]->PutModule(sModule, sLine);
+
+ if (pClient) {
+ return true;
+ }
+ }
+ }
+
+ return (pClient == NULL);
+}
+
// Channels
const vector<CChan*>& CIRCNetwork::GetChans() const { return m_vChans; }
View
1 IRCNetwork.h
@@ -61,6 +61,7 @@ class CIRCNetwork {
bool PutUser(const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
bool PutStatus(const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
+ bool PutModule(const CString& sModule, const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
const vector<CChan*>& GetChans() const;
CChan* FindChan(const CString& sName) const;
View
13 Modules.cpp
@@ -567,15 +567,20 @@ unsigned int CModule::PutModule(const CTable& table) {
return idx - 1;
}
bool CModule::PutModule(const CString& sLine) {
- if (!m_pUser)
- return false;
-
if (m_pClient) {
m_pClient->PutModule(GetModName(), sLine);
return true;
}
- return m_pUser->PutModule(GetModName(), sLine);
+ if (m_pNetwork) {
+ return m_pNetwork->PutModule(GetModName(), sLine);
+ }
+
+ if (m_pUser) {
+ return m_pUser->PutModule(GetModName(), sLine);
+ }
+
+ return false;
}
bool CModule::PutModNotice(const CString& sLine) {
if (!m_pUser)

0 comments on commit 9e3dc0b

Please sign in to comment.
Something went wrong with that request. Please try again.