virtual EModRet OnTopic(CNick& Nick, CChan& Channel, CString& sTopic) { PutModule("* " + Nick.GetNick() + " changes topic on " + Channel.GetName() + " to '" + sTopic + "'"); return CONTINUE; }
CModule::EModRet CLogMod::OnTopic(CNick& Nick, CChan& Channel, CString& sTopic) { PutLog("*** " + Nick.GetNick() + " changes topic to '" + sTopic + "'", Channel); return CONTINUE; }
CModule::EModRet CLogMod::OnChanNotice(CNick& Nick, CChan& Channel, CString& sMessage) { PutLog("-" + Nick.GetNick() + "- " + sMessage, Channel); return CONTINUE; }
void CLogMod::OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans) { for (std::vector<CChan*>::const_iterator pChan = vChans.begin(); pChan != vChans.end(); ++pChan) PutLog("*** Quits: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" + Nick.GetHost() + ") (" + sMessage + ")", **pChan); }
void CLogMod::OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) { PutLog("*** Parts: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" + Nick.GetHost() + ") (" + sMessage + ")", Channel); }
virtual void OnPart(const CNick& cNick, CChan& cChannel) { AddBuffer(cChannel, SpoofChanMsg(cChannel.GetName(), cNick.GetNickMask() + " PART")); if (cNick.GetNick().Equals(m_pUser->GetNick())) SaveBufferToDisk(); // need to force a save here to see this! }
void CLogMod::OnRawMode(const CNick& OpNick, CChan& Channel, const CString& sModes, const CString& sArgs) { PutLog("*** " + OpNick.GetNick() + " sets mode: " + sModes + " " + sArgs, Channel); }
void CChan::ModeChange(const CString& sModes, const CNick* pOpNick) { CString sModeArg = sModes.Token(0); CString sArgs = sModes.Token(1, true); bool bAdd = true; /* Try to find a CNick* from this channel so that pOpNick->HasPerm() * works as expected. */ if (pOpNick) { CNick* OpNick = FindNick(pOpNick->GetNick()); /* If nothing was found, use the original pOpNick, else use the * CNick* from FindNick() */ if (OpNick) pOpNick = OpNick; } if (pOpNick) { NETWORKMODULECALL(OnRawMode(*pOpNick, *this, sModeArg, sArgs), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING); } for (unsigned int a = 0; a < sModeArg.size(); a++) { const unsigned char& uMode = sModeArg[a]; if (uMode == '+') { bAdd = true; } else if (uMode == '-') { bAdd = false; } else if (m_pNetwork->GetIRCSock()->IsPermMode(uMode)) { CString sArg = GetModeArg(sArgs); CNick* pNick = FindNick(sArg); if (pNick) { unsigned char uPerm = m_pNetwork->GetIRCSock()->GetPermFromMode(uMode); if (uPerm) { bool bNoChange = (pNick->HasPerm(uPerm) == bAdd); if (bAdd) { pNick->AddPerm(uPerm); if (pNick->GetNick().Equals(m_pNetwork->GetCurNick())) { AddPerm(uPerm); } } else { pNick->RemPerm(uPerm); if (pNick->GetNick().Equals(m_pNetwork->GetCurNick())) { RemPerm(uPerm); } } if (uMode && pOpNick) { NETWORKMODULECALL(OnChanPermission(*pOpNick, *pNick, *this, uMode, bAdd, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING); if (uMode == CChan::M_Op) { if (bAdd) { NETWORKMODULECALL(OnOp(*pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING); } else { NETWORKMODULECALL(OnDeop(*pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING); } } else if (uMode == CChan::M_Voice) { if (bAdd) { NETWORKMODULECALL(OnVoice(*pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING); } else { NETWORKMODULECALL(OnDevoice(*pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING); } } } } } } else { bool bList = false; CString sArg; switch (m_pNetwork->GetIRCSock()->GetModeType(uMode)) { case CIRCSock::ListArg: bList = true; sArg = GetModeArg(sArgs); break; case CIRCSock::HasArg: sArg = GetModeArg(sArgs); break; case CIRCSock::NoArg: break; case CIRCSock::ArgWhenSet: if (bAdd) { sArg = GetModeArg(sArgs); } break; } bool bNoChange; if (bList) { bNoChange = false; } else if (bAdd) { bNoChange = HasMode(uMode) && GetModeArg(uMode) == sArg; } else { bNoChange = !HasMode(uMode); } NETWORKMODULECALL(OnMode(*pOpNick, *this, uMode, sArg, bAdd, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING); if (!bList) { (bAdd) ? AddMode(uMode, sArg) : RemMode(uMode); } } } }
bool IsMatch(const CNick& Nick, const CString& sType) const { return (GetType().Equals("all") || GetType().Equals(sType)) && (Nick.GetHostMask().WildCmp(m_sHostMask)); }
virtual void OnRawMode(const CNick& OpNick, CChan& Channel, const CString& sModes, const CString& sArgs) { PutModule("* " + OpNick.GetNick() + " sets mode: " + sModes + " " + sArgs + " (" + Channel.GetName() + ")"); }
EModRet OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage) { if (IsCtcpNotifier(sMessage.Token(0))) PutModule("Replying to CTCP " + sMessage.Token(0) + " by " + Nick.GetNick() + " (" + Nick.GetHostMask() + ") to " + Channel.GetName() + "."); return CONTINUE; }
virtual void OnDevoice(const CNick& OpNick, const CNick& Nick, CChan& Channel, bool bNoChange) { PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() + "] devoiced [" + Nick.GetNick() + "] on [" + Channel.GetName() + "]"); }
virtual void OnChanPermission(const CNick& OpNick, const CNick& Nick, CChan& Channel, unsigned char uMode, bool bAdded, bool bNoChange) { PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() + "] set mode [" + Channel.GetName() + ((bAdded) ? "] +" : "] -") + CString(uMode) + " " + Nick.GetNick()); }
virtual EModRet OnPrivMsg(CNick& Nick, CString& sMessage) { PutModule("[" + Nick.GetNick() + "] privmsg [" + sMessage + "]"); sMessage = "\002" + sMessage + "\002"; return CONTINUE; }
virtual void OnRawMode(const CNick& cOpNick, CChan& cChannel, const CString& sModes, const CString& sArgs) { AddBuffer(cChannel, SpoofChanMsg(cChannel.GetName(), cOpNick.GetNickMask() + " MODE " + sModes + " " + sArgs)); }
virtual void OnRawMode(const CNick& OpNick, CChan& Channel, const CString& sModes, const CString& sArgs) { AddBuffer(Channel, OpNick.GetNickMask() + " set mode: " + sModes + " " + sArgs); }
virtual void OnKick(const CNick& cNick, const CString& sOpNick, CChan& cChannel, const CString& sMessage) { AddBuffer(cChannel, SpoofChanMsg(cChannel.GetName(), sOpNick + " KICK " + cNick.GetNickMask() + " " + sMessage)); }
virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) { AddBuffer(Channel, OpNick.GetNickMask() + " kicked " + sKickedNick + " Reason: [" + sMessage + "]"); }
void CLogMod::PutLog(const CString& sLine, const CNick& Nick) { PutLog(sLine, Nick.GetNick()); }
virtual void OnJoin(const CNick& Nick, CChan& Channel) { AddBuffer(Channel, Nick.GetNickMask() + " joined"); }
void CLogMod::OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) { PutLog("*** " + sKickedNick + " was kicked by " + OpNick.GetNick() + " (" + sMessage + ")", Channel); }
virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) { AddBuffer(Channel, Nick.GetNickMask() + " parted with message: [" + sMessage + "]"); }
void CLogMod::OnJoin(const CNick& Nick, CChan& Channel) { PutLog("*** Joins: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" + Nick.GetHost() + ")", Channel); }
virtual EModRet OnTopic(CNick& Nick, CChan& Channel, CString& sTopic) { AddBuffer(Channel, Nick.GetNickMask() + " changed the topic to: " + sTopic); return CONTINUE; }
void CLogMod::OnNick(const CNick& OldNick, const CString& sNewNick, const vector<CChan*>& vChans) { for (std::vector<CChan*>::const_iterator pChan = vChans.begin(); pChan != vChans.end(); ++pChan) PutLog("*** " + OldNick.GetNick() + " is now known as " + sNewNick, **pChan); }
virtual void OnJoin(const CNick& Nick, CChan& Channel) { if (Nick.GetNick() == m_pUser->GetIRCNick().GetNick()) { Channel.SetInConfig(true); CZNC::Get().WriteConfig(); } }
CModule::EModRet CLogMod::OnPrivNotice(CNick& Nick, CString& sMessage) { PutLog("-" + Nick.GetNick() + "- " + sMessage, Nick); return CONTINUE; }
virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) { if (Nick.GetNick() == m_pUser->GetIRCNick().GetNick()) { Channel.SetInConfig(false); CZNC::Get().WriteConfig(); } }
CModule::EModRet CLogMod::OnPrivAction(CNick& Nick, CString& sMessage) { PutLog("* " + Nick.GetNick() + " " + sMessage, Nick); return CONTINUE; }
virtual EModRet OnChanNotice(CNick& Nick, CChan& Channel, CString& sMessage) { PutModule("[" + Nick.GetNick() + "] channotice [" + sMessage + "] to [" + Channel.GetName() + "]"); sMessage = "\00311,5 " + sMessage + " \003"; return CONTINUE; }