bool CClient::OnActionMessage(CActionMessage& Message) { CString sTargets = Message.GetTarget(); VCString vTargets; sTargets.Split(",", vTargets, false); for (CString& sTarget : vTargets) { Message.SetTarget(sTarget); if (m_pNetwork) { // May be nullptr. Message.SetChan(m_pNetwork->FindChan(sTarget)); } bool bContinue = false; NETWORKMODULECALL(OnUserActionMessage(Message), m_pUser, m_pNetwork, this, &bContinue); if (bContinue) continue; if (m_pNetwork) { AddBuffer(Message); EchoMessage(Message); PutIRC(Message.ToString(CMessage::ExcludePrefix | CMessage::ExcludeTags)); } } return true; }
bool CIRCSock::OnActionMessage(CActionMessage& Message) { bool bResult = false; CChan* pChan = nullptr; CString sTarget = Message.GetTarget(); if (sTarget.Equals(GetNick())) { IRCSOCKMODULECALL(OnPrivCTCPMessage(Message), &bResult); if (bResult) return true; IRCSOCKMODULECALL(OnPrivActionMessage(Message), &bResult); if (bResult) return true; if (!m_pNetwork->IsUserOnline() || !m_pNetwork->GetUser()->AutoClearQueryBuffer()) { const CNick& Nick = Message.GetNick(); CQuery* pQuery = m_pNetwork->AddQuery(Nick.GetNick()); if (pQuery) { CActionMessage Format; Format.Clone(Message); Format.SetNick(_NAMEDFMT(Nick.GetNickMask())); Format.SetTarget("{target}"); Format.SetText("{text}"); pQuery->AddBuffer(Format, Message.GetText()); } } } else { pChan = m_pNetwork->FindChan(sTarget); if (pChan) { Message.SetChan(pChan); FixupChanNick(Message.GetNick(), pChan); IRCSOCKMODULECALL(OnChanCTCPMessage(Message), &bResult); if (bResult) return true; IRCSOCKMODULECALL(OnChanActionMessage(Message), &bResult); if (bResult) return true; if (!pChan->AutoClearChanBuffer() || !m_pNetwork->IsUserOnline() || pChan->IsDetached()) { CActionMessage Format; Format.Clone(Message); Format.SetNick(_NAMEDFMT(Message.GetNick().GetNickMask())); Format.SetTarget(_NAMEDFMT(Message.GetTarget())); Format.SetText("{text}"); pChan->AddBuffer(Format, Message.GetText()); } } } return (pChan && pChan->IsDetached()); }