bool isChannelName(const QString &str)
{
- static constexpr std::array<QChar, 4> prefixes{{'#', '&', '!', '+'}};
- return std::any_of(prefixes.cbegin(), prefixes.cend(), [&str](QChar c) { return c == str[0]; });
+ if (str.isEmpty())
+ return false;
+ static constexpr std::array<quint8, 4> prefixes{{'#', '&', '!', '+'}};
+ return std::any_of(prefixes.cbegin(), prefixes.cend(), [&str](quint8 c) { return c == str[0]; });
}
QString stripFormatCodes(QString message)
{
- static QRegExp regEx{"\x03(\\d\\d?(,\\d\\d?)?)?|[\x02\x0f\x12\x16\x1d\x1f]"};
+ static QRegExp regEx{"\x03(\\d\\d?(,\\d\\d?)?)?|\x04([\\da-fA-F]{6}(,[\\da-fA-F]{6})?)?|[\x02\x0f\x11\x12\x16\x1d\x1e\x1f]"};
return message.remove(regEx);
}