void OnKickMessage(CKickMessage& Message) override { const CNick& OpNick = Message.GetNick(); const CString sKickedNick = Message.GetKickedNick(); CChan& Channel = *Message.GetChan(); const CString sMessage = Message.GetReason(); AddBuffer(Channel, OpNick.GetNickMask() + " kicked " + sKickedNick + " Reason: [" + sMessage + "]", &Message.GetTime(), Message.GetTags()); }
void OnKickMessage(CKickMessage& Message) override { const CNick& OpNick = Message.GetNick(); const CString sKickedNick = Message.GetKickedNick(); CChan& Channel = *Message.GetChan(); const CString sMessage = Message.GetReason(); AddBuffer(Channel, t_f("{1} kicked {2} with reason: {3}")( OpNick.GetNickMask(), sKickedNick, sMessage), &Message.GetTime(), Message.GetTags()); }
TEST(MessageTest, Kick) { CKickMessage msg; msg.Parse(":nick KICK #chan person :reason"); EXPECT_EQ("nick", msg.GetNick().GetNick()); EXPECT_EQ("KICK", msg.GetCommand()); EXPECT_EQ("#chan", msg.GetTarget()); EXPECT_EQ("person", msg.GetKickedNick()); EXPECT_EQ("reason", msg.GetReason()); EXPECT_EQ(CMessage::Type::Kick, msg.GetType()); msg.SetKickedNick("noone"); EXPECT_EQ("noone", msg.GetKickedNick()); msg.SetReason("test"); EXPECT_EQ("test", msg.GetReason()); EXPECT_EQ(":nick KICK #chan noone :test", msg.ToString()); }