Older clients don't report the features they support, which resulted
in a log message listing all features as missing if such a client
connected.
Handle this special case by checking if any client feature is enabled,
and if not, providing a different log message to avoid user
confusion.
#include <signal.h>
#if !defined Q_OS_WIN && !defined Q_OS_MAC
# include <sys/types.h>
#include <signal.h>
#if !defined Q_OS_WIN && !defined Q_OS_MAC
# include <sys/types.h>
QStringList Quassel::Features::toStringList(bool enabled) const
{
QStringList Quassel::Features::toStringList(bool enabled) const
{
+ // Check if any feature is enabled
+ if (!enabled && std::all_of(_features.cbegin(), _features.cend(), [](bool feature) { return !feature; })) {
+ return QStringList{} << "NoFeatures";
+ }
+
// TODO Qt5: Use QMetaEnum::fromType()
auto featureEnum = Quassel::staticMetaObject.enumerator(Quassel::staticMetaObject.indexOfEnumerator("Feature"));
for (quint32 i = 0; i < _features.size(); ++i) {
// TODO Qt5: Use QMetaEnum::fromType()
auto featureEnum = Quassel::staticMetaObject.enumerator(Quassel::staticMetaObject.indexOfEnumerator("Feature"));
for (quint32 i = 0; i < _features.size(); ++i) {
const auto &clientFeatures = _peer->features();
auto unsupported = clientFeatures.toStringList(false);
if (!unsupported.isEmpty()) {
const auto &clientFeatures = _peer->features();
auto unsupported = clientFeatures.toStringList(false);
if (!unsupported.isEmpty()) {
- quInfo() << qPrintable(tr("Client does not support the following features: %1").arg(unsupported.join(", ")));
+ if (unsupported.contains("NoFeatures"))
+ quInfo() << qPrintable(tr("Client does not support extended features."));
+ else
+ quInfo() << qPrintable(tr("Client does not support the following features: %1").arg(unsupported.join(", ")));
if (!clientFeatures.unknownFeatures().isEmpty()) {
quInfo() << qPrintable(tr("Client supports unknown features: %1").arg(clientFeatures.unknownFeatures().join(", ")));
}
if (!clientFeatures.unknownFeatures().isEmpty()) {
quInfo() << qPrintable(tr("Client supports unknown features: %1").arg(clientFeatures.unknownFeatures().join(", ")));
}