Beispiel #1
0
    EModRet OnTopicMessage(CTopicMessage& Message) override {
        const CNick& Nick = Message.GetNick();
        CChan& Channel = *Message.GetChan();
        const CString sTopic = Message.GetTopic();
        AddBuffer(Channel,
                  Nick.GetNickMask() + " changed the topic to: " + sTopic,
                  &Message.GetTime(), Message.GetTags());

        return CONTINUE;
    }
Beispiel #2
0
TEST(MessageTest, Topic) {
	CTopicMessage msg;
	msg.Parse(":nick TOPIC #chan :topic");
	EXPECT_EQ("nick", msg.GetNick().GetNick());
	EXPECT_EQ("TOPIC", msg.GetCommand());
	EXPECT_EQ("#chan", msg.GetTarget());
	EXPECT_EQ("topic", msg.GetTopic());
	EXPECT_EQ(CMessage::Type::Topic, msg.GetType());

	msg.SetTopic("test");
	EXPECT_EQ("test", msg.GetTopic());
	EXPECT_EQ(":nick TOPIC #chan :test", msg.ToString());
}
Beispiel #3
0
bool CIRCSock::OnTopicMessage(CTopicMessage& Message) {
    const CNick& Nick = Message.GetNick();
    CChan* pChan = m_pNetwork->FindChan(Message.GetParam(0));

    if (pChan) {
        Message.SetChan(pChan);
        bool bReturn = false;
        IRCSOCKMODULECALL(OnTopicMessage(Message), &bReturn);
        if (bReturn) return true;

        pChan->SetTopicOwner(Nick.GetNick());
        pChan->SetTopicDate((unsigned long)time(nullptr));
        pChan->SetTopic(Message.GetTopic());
    }

    return (pChan && pChan->IsDetached());
}