Пример #1
0
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;
}
Пример #2
0
TEST(MessageTest, PrivAction) {
	CActionMessage msg;
	msg.Parse(":sender PRIVMSG receiver :\001ACTION ACTS\001");
	EXPECT_EQ("sender", msg.GetNick().GetNick());
	EXPECT_EQ("PRIVMSG", msg.GetCommand());
	EXPECT_EQ("receiver", msg.GetTarget());
	EXPECT_EQ("ACTS", msg.GetText());
	EXPECT_EQ(CMessage::Type::Action, msg.GetType());

	msg.SetText("foo bar");
	EXPECT_EQ("foo bar", msg.GetText());
	EXPECT_EQ(":sender PRIVMSG receiver :\001ACTION foo bar\001", msg.ToString());
}
Пример #3
0
	EModRet OnChanActionMessage(CActionMessage& msg) override { vsHooks.push_back("OnChanActionMessage"); vsMessages.push_back(msg.ToString()); vNetworks.push_back(msg.GetNetwork()); vChannels.push_back(msg.GetChan()); return eAction; }