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()); }
bool CClient::OnTopicMessage(CTopicMessage& Message) { bool bReturn = false; CString sChan = Message.GetTarget(); CString sTopic = Message.GetTopic(); if (!sTopic.empty()) { NETWORKMODULECALL(OnUserTopicMessage(Message), m_pUser, m_pNetwork, this, &bReturn); } else { NETWORKMODULECALL(OnUserTopicRequest(sChan), m_pUser, m_pNetwork, this, &bReturn); Message.SetTarget(sChan); } return bReturn; }