mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Make all the modules support networks
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "Modules.h"
|
||||
#include "User.h"
|
||||
#include "IRCNetwork.h"
|
||||
#include "IRCSock.h"
|
||||
|
||||
class CKeepNickMod;
|
||||
@@ -33,7 +34,7 @@ public:
|
||||
m_pTimer = NULL;
|
||||
|
||||
// Check if we need to start the timer
|
||||
if (m_pUser->IsIRCConnected())
|
||||
if (m_pNetwork->IsIRCConnected())
|
||||
OnIRCConnected();
|
||||
|
||||
return true;
|
||||
@@ -44,7 +45,7 @@ public:
|
||||
// No timer means we are turned off
|
||||
return;
|
||||
|
||||
CIRCSock* pIRCSock = GetUser()->GetIRCSock();
|
||||
CIRCSock* pIRCSock = m_pNetwork->GetIRCSock();
|
||||
|
||||
if (!pIRCSock)
|
||||
return;
|
||||
@@ -58,7 +59,7 @@ public:
|
||||
|
||||
CString GetNick() {
|
||||
CString sConfNick = m_pUser->GetNick();
|
||||
CIRCSock* pIRCSock = GetUser()->GetIRCSock();
|
||||
CIRCSock* pIRCSock = m_pNetwork->GetIRCSock();
|
||||
|
||||
if (pIRCSock)
|
||||
sConfNick = sConfNick.Left(pIRCSock->GetMaxNickLen());
|
||||
@@ -67,7 +68,7 @@ public:
|
||||
}
|
||||
|
||||
void OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& vChans) {
|
||||
if (sNewNick == GetUser()->GetIRCSock()->GetNick()) {
|
||||
if (sNewNick == m_pNetwork->GetIRCSock()->GetNick()) {
|
||||
// We are changing our own nick
|
||||
if (Nick.GetNick().Equals(GetNick())) {
|
||||
// We are changing our nick away from the conf setting.
|
||||
@@ -101,7 +102,7 @@ public:
|
||||
}
|
||||
|
||||
void OnIRCConnected() {
|
||||
if (!GetUser()->GetIRCSock()->GetNick().Equals(GetNick())) {
|
||||
if (!m_pNetwork->GetIRCSock()->GetNick().Equals(GetNick())) {
|
||||
// We don't have the nick we want, try to get it
|
||||
Enable();
|
||||
}
|
||||
@@ -126,7 +127,7 @@ public:
|
||||
|
||||
virtual EModRet OnUserRaw(CString& sLine) {
|
||||
// We dont care if we are not connected to IRC
|
||||
if (!m_pUser->IsIRCConnected())
|
||||
if (!m_pNetwork->IsIRCConnected())
|
||||
return CONTINUE;
|
||||
|
||||
// We are trying to get the config nick and this is a /nick?
|
||||
@@ -145,7 +146,7 @@ public:
|
||||
|
||||
// Indeed trying to change to this nick, generate a 433 for it.
|
||||
// This way we can *always* block incoming 433s from the server.
|
||||
PutUser(":" + m_pUser->GetIRCServer() + " 433 " + m_pUser->GetIRCNick().GetNick()
|
||||
PutUser(":" + m_pNetwork->GetIRCServer() + " 433 " + m_pNetwork->GetIRCNick().GetNick()
|
||||
+ " " + sNick + " :ZNC is already trying to get this nickname");
|
||||
return CONTINUE;
|
||||
}
|
||||
@@ -196,4 +197,4 @@ template<> void TModInfo<CKeepNickMod>(CModInfo& Info) {
|
||||
Info.SetWikiPage("keepnick");
|
||||
}
|
||||
|
||||
MODULEDEFS(CKeepNickMod, "Keep trying for your primary nick")
|
||||
NETWORKMODULEDEFS(CKeepNickMod, "Keep trying for your primary nick")
|
||||
|
||||
Reference in New Issue
Block a user