Fix valueless message tags (closes #684)

This commit is contained in:
J-P Nurmi
2014-09-29 13:08:51 +02:00
parent 227f2cfb29
commit 615801c40e
2 changed files with 13 additions and 1 deletions
+3 -1
View File
@@ -502,7 +502,9 @@ void CUtils::SetMessageTags(CString& sLine, const MCString& mssTags) {
if (!sTags.empty()) {
sTags += ";";
}
sTags += it->first + "=" + it->second;
sTags += it->first;
if (!it->second.empty())
sTags += "=" + it->second;
}
sLine = "@" + sTags + " " + sLine;
}
+10
View File
@@ -37,6 +37,12 @@ TEST(IRC32, GetMessageTags) {
exp["a"] = "==b==";
EXPECT_EQ(exp, CUtils::GetMessageTags("@a===b== :rest"));
exp.clear();
exp["a"] = "";
exp["b"] = "c";
exp["d"] = "";
EXPECT_EQ(exp, CUtils::GetMessageTags("@a;b=c;d :rest"));
exp.clear();
}
TEST(IRC32, SetMessageTags) {
@@ -54,5 +60,9 @@ TEST(IRC32, SetMessageTags) {
tags["c"] = "d";
CUtils::SetMessageTags(sLine, tags);
EXPECT_EQ("@a=b;c=d :rest", sLine);
tags["e"] = "";
CUtils::SetMessageTags(sLine, tags);
EXPECT_EQ("@a=b;c=d;e :rest", sLine);
}