Fix CModeMessage::GetModes()

Thanks to KindOne for finding the bug. CModeMessage::GetModes()
must trim the colon that CMessage::GetParams() may include.
This commit is contained in:
J-P Nurmi
2015-09-17 13:26:24 +02:00
parent 2c0dfbbe18
commit 57fb58bf71
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -144,7 +144,7 @@ public:
class CModeMessage : public CTargetMessage {
public:
CString GetModes() const { return GetParams(1); }
CString GetModes() const { return GetParams(1).TrimPrefix_n(":"); }
};
class CNickMessage : public CMessage {
+5
View File
@@ -249,6 +249,11 @@ TEST(MessageTest, Mode) {
EXPECT_EQ("+k foo", msg.GetModes());
EXPECT_EQ(":nick MODE #chan +k foo", msg.ToString());
msg.Parse(":nick MODE nick :+i");
EXPECT_EQ("+i", msg.GetModes());
EXPECT_EQ(":nick MODE nick :+i", msg.ToString());
}
TEST(MessageTest, Nick) {