mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
CIRCSock::OnQuitMessage() handler
This commit is contained in:
@@ -515,34 +515,7 @@ void CIRCSock::ReadLine(const CString& sData) {
|
||||
}
|
||||
} else if (Message.GetType() == CMessage::Type::Quit) {
|
||||
CQuitMessage& QuitMsg = static_cast<CQuitMessage&>(Message);
|
||||
bool bIsVisible = false;
|
||||
|
||||
// :nick!ident@host.com QUIT :message
|
||||
|
||||
if (Nick.NickEquals(GetNick())) {
|
||||
m_pNetwork->PutStatus("You quit [" + QuitMsg.GetReason() + "]");
|
||||
// We don't call module hooks and we don't
|
||||
// forward this quit to clients (Some clients
|
||||
// disconnect if they receive such a QUIT)
|
||||
return;
|
||||
}
|
||||
|
||||
vector<CChan*> vFoundChans;
|
||||
const vector<CChan*>& vChans = m_pNetwork->GetChans();
|
||||
|
||||
for (CChan* pChan : vChans) {
|
||||
if (pChan->RemNick(Nick.GetNick())) {
|
||||
vFoundChans.push_back(pChan);
|
||||
|
||||
if (!pChan->IsDetached()) {
|
||||
bIsVisible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IRCSOCKMODULECALL(OnQuitMessage(QuitMsg, vFoundChans), NOTHING);
|
||||
|
||||
if (!bIsVisible) {
|
||||
if (OnQuitMessage(QuitMsg)) {
|
||||
return;
|
||||
}
|
||||
} else if (Message.GetType() == CMessage::Type::Join) {
|
||||
@@ -1089,6 +1062,36 @@ bool CIRCSock::OnNickMessage(CNickMessage& Message) {
|
||||
return !bIsVisible;
|
||||
}
|
||||
|
||||
bool CIRCSock::OnQuitMessage(CQuitMessage& Message) {
|
||||
const CNick& Nick = Message.GetNick();
|
||||
bool bIsVisible = false;
|
||||
|
||||
if (Nick.NickEquals(GetNick())) {
|
||||
m_pNetwork->PutStatus("You quit [" + Message.GetReason() + "]");
|
||||
// We don't call module hooks and we don't
|
||||
// forward this quit to clients (Some clients
|
||||
// disconnect if they receive such a QUIT)
|
||||
return true;
|
||||
}
|
||||
|
||||
vector<CChan*> vFoundChans;
|
||||
const vector<CChan*>& vChans = m_pNetwork->GetChans();
|
||||
|
||||
for (CChan* pChan : vChans) {
|
||||
if (pChan->RemNick(Nick.GetNick())) {
|
||||
vFoundChans.push_back(pChan);
|
||||
|
||||
if (!pChan->IsDetached()) {
|
||||
bIsVisible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IRCSOCKMODULECALL(OnQuitMessage(Message, vFoundChans), NOTHING);
|
||||
|
||||
return !bIsVisible;
|
||||
}
|
||||
|
||||
void CIRCSock::PutIRC(const CString& sLine) {
|
||||
// Only print if the line won't get sent immediately (same condition as in TrySend()!)
|
||||
if (m_bFloodProtection && m_iSendsAllowed <= 0) {
|
||||
|
||||
Reference in New Issue
Block a user