X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Futil.cpp;h=e3c1159d1b60d6c4ba55a437603319f9ae3c95b3;hb=68878dc8366f2f4a0afe132847aad9a51a80cdbf;hp=3d199a1281c0151026b5ded23f8068926cb0aa9e;hpb=0fa9ff5b58bf321654204867bb118a8d727d7b16;p=quassel.git diff --git a/src/common/util.cpp b/src/common/util.cpp index 3d199a12..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,6 +64,8 @@ QString hostFromMask(const QString &mask) bool isChannelName(const QString &str) { + 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]; }); } @@ -71,7 +73,7 @@ bool isChannelName(const QString &str) 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); }