X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Futil.cpp;h=e3c1159d1b60d6c4ba55a437603319f9ae3c95b3;hp=695ca4ad87b273087aaf19436453b7cf8239a129;hb=0dbec2cfc937857d66a9645249f876f1e6b3f05e;hpb=b06a827aea68b050bf23c37e0162189a94595ee9 diff --git a/src/common/util.cpp b/src/common/util.cpp index 695ca4ad..e3c1159d 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -64,14 +64,16 @@ QString hostFromMask(const QString &mask) bool isChannelName(const QString &str) { - static constexpr std::array 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 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); }