mirror of
https://github.com/znc/znc.git
synced 2026-08-08 09:52:55 +02:00
Make CModule::PutModule use CUser::PutModule
This commit is contained in:
+6
-12
@@ -539,31 +539,25 @@ bool CModule::PutUser(const CString& sLine) {
|
|||||||
bool CModule::PutStatus(const CString& sLine) {
|
bool CModule::PutStatus(const CString& sLine) {
|
||||||
return (m_pUser) ? m_pUser->PutStatus(sLine, m_pClient) : false;
|
return (m_pUser) ? m_pUser->PutStatus(sLine, m_pClient) : false;
|
||||||
}
|
}
|
||||||
unsigned int CModule::PutModule(const CTable& table, const CString& sIdent, const CString& sHost) {
|
unsigned int CModule::PutModule(const CTable& table) {
|
||||||
if (!m_pUser)
|
if (!m_pUser)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
unsigned int idx = 0;
|
unsigned int idx = 0;
|
||||||
CString sLine;
|
CString sLine;
|
||||||
while (table.GetLine(idx++, sLine))
|
while (table.GetLine(idx++, sLine))
|
||||||
PutModule(sLine, sIdent, sHost);
|
PutModule(sLine);
|
||||||
return idx - 1;
|
return idx - 1;
|
||||||
}
|
}
|
||||||
bool CModule::PutModule(const CString& sLine, const CString& sIdent, const CString& sHost) {
|
bool CModule::PutModule(const CString& sLine) {
|
||||||
if (!m_pUser)
|
if (!m_pUser)
|
||||||
return false;
|
return false;
|
||||||
return m_pUser->PutUser(":" + GetModNick() + "!" +
|
return m_pUser->PutModule(GetModName(), sLine, m_pClient);
|
||||||
(sIdent.empty() ? GetModName() : sIdent) + "@" + sHost +
|
|
||||||
" PRIVMSG " + m_pUser->GetCurNick() + " :" + sLine,
|
|
||||||
m_pClient);
|
|
||||||
}
|
}
|
||||||
bool CModule::PutModNotice(const CString& sLine, const CString& sIdent, const CString& sHost) {
|
bool CModule::PutModNotice(const CString& sLine) {
|
||||||
if (!m_pUser)
|
if (!m_pUser)
|
||||||
return false;
|
return false;
|
||||||
return m_pUser->PutUser(":" + GetModNick() + "!" +
|
return m_pUser->PutModNotice(GetModName(), sLine, m_pClient);
|
||||||
(sIdent.empty() ? GetModName() : sIdent) + "@" + sHost +
|
|
||||||
" NOTICE " + m_pUser->GetCurNick() + " :" + sLine,
|
|
||||||
m_pClient);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////
|
///////////////////
|
||||||
|
|||||||
@@ -757,28 +757,22 @@ public:
|
|||||||
* module hook for a specific client, only that client gets this
|
* module hook for a specific client, only that client gets this
|
||||||
* message, else all connected clients will receive it.
|
* message, else all connected clients will receive it.
|
||||||
* @param sLine The message which should be sent.
|
* @param sLine The message which should be sent.
|
||||||
* @param sIdent The ident for the module nick. Defaults to the module name.
|
|
||||||
* @param sHost The hostname for the module nick. Defaults to znc.in
|
|
||||||
* @return true if the line was sent to at least one client.
|
* @return true if the line was sent to at least one client.
|
||||||
*/
|
*/
|
||||||
virtual bool PutModule(const CString& sLine, const CString& sIdent = "", const CString& sHost = "znc.in");
|
virtual bool PutModule(const CString& sLine);
|
||||||
/** This function calls CModule::PutModule(const CString&, const
|
/** This function calls CModule::PutModule(const CString&, const
|
||||||
* CString&, const CString&) for each line in the table.
|
* CString&, const CString&) for each line in the table.
|
||||||
* @param table The table which should be send.
|
* @param table The table which should be send.
|
||||||
* @param sIdent The ident which should be used.
|
|
||||||
* @param sHost The hostname used for the query.
|
|
||||||
* @return The number of lines sent.
|
* @return The number of lines sent.
|
||||||
*/
|
*/
|
||||||
virtual unsigned int PutModule(const CTable& table, const CString& sIdent = "", const CString& sHost = "znc.in");
|
virtual unsigned int PutModule(const CTable& table);
|
||||||
/** Send a notice from your module nick. If we are in a module hook for
|
/** Send a notice from your module nick. If we are in a module hook for
|
||||||
* a specific client, only that client gets this notice, else all
|
* a specific client, only that client gets this notice, else all
|
||||||
* clients will receive it.
|
* clients will receive it.
|
||||||
* @param sLine The line which should be sent.
|
* @param sLine The line which should be sent.
|
||||||
* @param sIdent The ident used for the notice.
|
|
||||||
* @param sHost The host name used for the notice.
|
|
||||||
* @return true if the line was sent to at least one client.
|
* @return true if the line was sent to at least one client.
|
||||||
*/
|
*/
|
||||||
virtual bool PutModNotice(const CString& sLine, const CString& sIdent = "", const CString& sHost = "znc.in");
|
virtual bool PutModNotice(const CString& sLine);
|
||||||
|
|
||||||
/** @returns The name of the module. */
|
/** @returns The name of the module. */
|
||||||
const CString& GetModName() const { return m_sModName; }
|
const CString& GetModName() const { return m_sModName; }
|
||||||
|
|||||||
@@ -1104,6 +1104,20 @@ bool CUser::PutModule(const CString& sModule, const CString& sLine, CClient* pCl
|
|||||||
return (pClient == NULL);
|
return (pClient == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CUser::PutModNotice(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]->PutModNotice(sModule, sLine);
|
||||||
|
|
||||||
|
if (pClient) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (pClient == NULL);
|
||||||
|
}
|
||||||
|
|
||||||
bool CUser::ResumeFile(unsigned short uPort, unsigned long uFileSize) {
|
bool CUser::ResumeFile(unsigned short uPort, unsigned long uFileSize) {
|
||||||
CSockManager& Manager = CZNC::Get().GetManager();
|
CSockManager& Manager = CZNC::Get().GetManager();
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public:
|
|||||||
bool PutStatus(const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
bool PutStatus(const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
||||||
bool PutStatusNotice(const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
bool PutStatusNotice(const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
||||||
bool PutModule(const CString& sModule, const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
bool PutModule(const CString& sModule, const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
||||||
|
bool PutModNotice(const CString& sModule, const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
||||||
|
|
||||||
bool IsUserAttached() const { return !m_vClients.empty(); }
|
bool IsUserAttached() const { return !m_vClients.empty(); }
|
||||||
void UserConnected(CClient* pClient);
|
void UserConnected(CClient* pClient);
|
||||||
|
|||||||
Reference in New Issue
Block a user