/***************************************************************************
- * 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 *
#include <QAbstractItemView>
#include <QMimeData>
-#if QT_VERSION < 0x050000
-#include <QTextDocument> // for Qt::escape()
-#endif
+#include <utility>
#include "buffermodel.h"
#include "buffersettings.h"
#include "ircchannel.h"
#include "network.h"
#include "signalproxy.h"
+#include "buffersyncer.h"
/*****************************************
* Network Items
*****************************************/
NetworkItem::NetworkItem(const NetworkId &netid, AbstractTreeItem *parent)
- : PropertyMapItem(QList<QString>() << "networkName" << "currentServer" << "nickCount", parent),
+ : PropertyMapItem(parent),
_networkId(netid),
- _statusBufferItem(0)
+ _statusBufferItem(nullptr)
{
// DO NOT EMIT dataChanged() DIRECTLY IN NetworkItem
// use networkDataChanged() instead. Otherwise you will end up in a infinite loop
}
+QStringList NetworkItem::propertyOrder() const
+{
+ static QStringList order{"networkName", "currentServer", "nickCount"};
+ return order;
+}
+
+
QVariant NetworkItem::data(int column, int role) const
{
switch (role) {
QString NetworkItem::escapeHTML(const QString &string, bool useNonbreakingSpaces)
{
- // QString.replace() doesn't guarentee the source string will remain constant.
+ // QString.replace() doesn't guarantee the source string will remain constant.
// Use a local variable to avoid compiler errors.
-#if QT_VERSION < 0x050000
- QString formattedString = Qt::escape(string);
-#else
QString formattedString = string.toHtmlEscaped();
-#endif
return (useNonbreakingSpaces ? formattedString.replace(" ", " ") : formattedString);
}
// FIXME shouldn't we check the bufferItemCache here?
BufferItem *NetworkItem::findBufferItem(BufferId bufferId)
{
- BufferItem *bufferItem = 0;
+ BufferItem *bufferItem = nullptr;
for (int i = 0; i < childCount(); i++) {
bufferItem = qobject_cast<BufferItem *>(child(i));
if (bufferItem->bufferId() == bufferId)
return bufferItem;
}
- return 0;
+ return nullptr;
}
break;
}
+ BufferSyncer *bufferSyncer = Client::bufferSyncer();
+ if (bufferSyncer) {
+ bufferItem->addActivity(
+ bufferSyncer->activity(bufferItem->bufferId()),
+ bufferSyncer->highlightCount(bufferItem->bufferId()) > 0
+ );
+ }
+
return bufferItem;
}
void NetworkItem::attachIrcUser(IrcUser *ircUser)
{
- QueryBufferItem *queryItem = 0;
+ QueryBufferItem *queryItem = nullptr;
for (int i = 0; i < childCount(); i++) {
queryItem = qobject_cast<QueryBufferItem *>(child(i));
if (!queryItem)
Q_UNUSED(column);
QString strTooltip;
QTextStream tooltip( &strTooltip, QIODevice::WriteOnly );
- tooltip << "<qt><style>.bold { font-weight: bold; }</style>";
+ tooltip << "<qt><style>.bold { font-weight: bold; } .italic { font-style: italic; }</style>";
// Function to add a row to the tooltip table
auto addRow = [&](const QString& key, const QString& value, bool condition) {
};
tooltip << "<p class='bold' align='center'>" << NetworkItem::escapeHTML(networkName(), true) << "</p>";
- tooltip << "<table cellspacing='5' cellpadding='0'>";
- addRow(tr("Server"), NetworkItem::escapeHTML(currentServer(), true), true);
-
- addRow(tr("Users"), QString::number(nickCount()), true);
-
- if (_network)
- addRow(tr("Lag"), NetworkItem::escapeHTML(tr("%1 msecs").arg(_network->latency()), true), true);
+ if (isActive()) {
+ tooltip << "<table cellspacing='5' cellpadding='0'>";
+ addRow(tr("Server"), NetworkItem::escapeHTML(currentServer(), true), !currentServer().isEmpty());
+ addRow(tr("Users"), QString::number(nickCount()), true);
+ if (_network)
+ addRow(tr("Lag"), NetworkItem::escapeHTML(tr("%1 msecs").arg(_network->latency()), true), true);
- tooltip << "</table></qt>";
+ tooltip << "</table>";
+ } else {
+ tooltip << "<p class='italic' align='center'>" << tr("Not connected") << "</p>";
+ }
+ tooltip << "</qt>";
return strTooltip;
}
for (int i = start; i <= end; i++) {
StatusBufferItem *statusBufferItem = qobject_cast<StatusBufferItem *>(child(i));
if (statusBufferItem) {
- _statusBufferItem = 0;
+ _statusBufferItem = nullptr;
break;
}
}
void NetworkItem::onNetworkDestroyed()
{
- _network = 0;
+ _network = nullptr;
emit networkDataChanged();
removeAllChilds();
}
/*****************************************
* Fancy Buffer Items
*****************************************/
-BufferItem::BufferItem(const BufferInfo &bufferInfo, AbstractTreeItem *parent)
- : PropertyMapItem(QStringList() << "bufferName" << "topic" << "nickCount", parent),
- _bufferInfo(bufferInfo),
+BufferItem::BufferItem(BufferInfo bufferInfo, AbstractTreeItem *parent)
+ : PropertyMapItem(parent),
+ _bufferInfo(std::move(bufferInfo)),
_activity(BufferInfo::NoActivity)
{
setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled);
}
+QStringList BufferItem::propertyOrder() const
+{
+ static QStringList order{"bufferName", "topic", "nickCount"};
+ return order;
+}
+
+
void BufferItem::setActivityLevel(BufferInfo::ActivityLevel level)
{
if (_activity != level) {
void BufferItem::clearActivityLevel()
{
- _activity = BufferInfo::NoActivity;
+ if (Client::isCoreFeatureEnabled(Quassel::Feature::BufferActivitySync)) {
+ // If the core handles activity sync, clear only the highlight flag
+ _activity &= ~BufferInfo::Highlight;
+ } else {
+ _activity = BufferInfo::NoActivity;
+ }
_firstUnreadMsgId = MsgId();
// FIXME remove with core proto v11
- if (!(Client::coreFeatures() & Quassel::SynchronizedMarkerLine)) {
+ if (!Client::isCoreFeatureEnabled(Quassel::Feature::SynchronizedMarkerLine)) {
_markerLineMsgId = _lastSeenMsgId;
}
void BufferItem::updateActivityLevel(const Message &msg)
{
+ // If the core handles activity, and this message is not a highlight, ignore this
+ if (Client::isCoreFeatureEnabled(Quassel::Feature::BufferActivitySync) && !msg.flags().testFlag(Message::Highlight)) {
+ return;
+ }
+
if (isCurrentBuffer()) {
return;
}
_firstUnreadMsgId = msg.msgId();
}
+ Message::Types type;
+ // If the core handles activities, ignore types
+ if (Client::isCoreFeatureEnabled(Quassel::Feature::BufferActivitySync)) {
+ type = Message::Types();
+ } else {
+ type = msg.type();
+ }
+
+ if (addActivity(type, msg.flags().testFlag(Message::Highlight)) || stateChanged) {
+ emit dataChanged();
+ }
+}
+
+void BufferItem::setActivity(Message::Types type, bool highlight) {
BufferInfo::ActivityLevel oldLevel = activityLevel();
- _activity |= BufferInfo::OtherActivity;
- if (msg.type() & (Message::Plain | Message::Notice | Message::Action))
+ _activity &= BufferInfo::Highlight;
+ addActivity(type, highlight);
+
+ if (_activity != oldLevel) {
+ emit dataChanged();
+ }
+}
+
+bool BufferItem::addActivity(Message::Types type, bool highlight) {
+ auto oldActivity = activityLevel();
+
+ if (type != Message::Types())
+ _activity |= BufferInfo::OtherActivity;
+
+ if (type.testFlag(Message::Plain) || type.testFlag(Message::Notice) || type.testFlag(Message::Action))
_activity |= BufferInfo::NewMessage;
- if (msg.flags() & Message::Highlight)
+ if (highlight)
_activity |= BufferInfo::Highlight;
- stateChanged |= (oldLevel != _activity);
-
- if (stateChanged)
- emit dataChanged();
+ return oldActivity != _activity;
}
_lastSeenMsgId = msgId;
// FIXME remove with core protocol v11
- if (!(Client::coreFeatures() & Quassel::SynchronizedMarkerLine)) {
+ if (!Client::isCoreFeatureEnabled(Quassel::Feature::SynchronizedMarkerLine)) {
if (!isCurrentBuffer())
_markerLineMsgId = msgId;
}
*****************************************/
QueryBufferItem::QueryBufferItem(const BufferInfo &bufferInfo, NetworkItem *parent)
: BufferItem(bufferInfo, parent),
- _ircUser(0)
+ _ircUser(nullptr)
{
setFlags(flags() | Qt::ItemIsDropEnabled | Qt::ItemIsEditable);
Q_UNUSED(column);
QString strTooltip;
QTextStream tooltip( &strTooltip, QIODevice::WriteOnly );
- tooltip << "<qt><style>.bold { font-weight: bold; }</style>"
- << "<style>.italic { font-style: italic; }</style>";
+ tooltip << "<qt><style>.bold { font-weight: bold; } .italic { font-style: italic; }</style>";
// Keep track of whether or not information has been added
bool infoAdded = false;
tooltip << "<table cellspacing='5' cellpadding='0'>";
if (_ircUser->isAway()) {
- QString awayMessage(tr("(unknown)"));
- if(!_ircUser->awayMessage().isEmpty()) {
- awayMessage = _ircUser->awayMessage();
+ QString awayMessageHTML = QString("<p class='italic'>%1</p>").arg(tr("Unknown"));
+
+ // If away message is known, replace with the escaped message.
+ if (!_ircUser->awayMessage().isEmpty()) {
+ awayMessageHTML = NetworkItem::escapeHTML(_ircUser->awayMessage());
}
- addRow(NetworkItem::escapeHTML(tr("Away message"), true), NetworkItem::escapeHTML(awayMessage), true);
+ addRow(NetworkItem::escapeHTML(tr("Away message"), true), awayMessageHTML, true);
}
addRow(tr("Realname"),
NetworkItem::escapeHTML(_ircUser->realName()),
NetworkItem::escapeHTML(_ircUser->suserHost()),
!_ircUser->suserHost().isEmpty());
}
+
+ // Keep track of whether or not the account information's been added. Don't show it twice.
+ bool accountAdded = false;
+ if(!_ircUser->account().isEmpty()) {
+ // IRCv3 account-notify is supported by the core and IRC server.
+ // Assume logged out (seems to be more common)
+ QString accountHTML = QString("<p class='italic'>%1</p>").arg(tr("Not logged in"));
+
+ // If account is logged in, replace with the escaped account name.
+ if (_ircUser->account() != "*") {
+ accountHTML = NetworkItem::escapeHTML(_ircUser->account());
+ }
+ addRow(NetworkItem::escapeHTML(tr("Account"), true),
+ accountHTML,
+ true);
+ // Mark the row as added
+ accountAdded = true;
+ }
// whoisServiceReply may return "<nick> is identified for this nick", which should be translated.
// See https://www.alien.net.au/irc/irc2numerics.html
if(_ircUser->whoisServiceReply().endsWith("identified for this nick")) {
addRow(NetworkItem::escapeHTML(tr("Account"), true),
NetworkItem::escapeHTML(tr("Identified for this nick")),
- true);
+ !accountAdded);
+ // Don't add the account row again if information's already added via account-notify
+ // Not used further down...
+ // accountAdded = true;
} else {
addRow(NetworkItem::escapeHTML(tr("Service Reply"), true),
NetworkItem::escapeHTML(_ircUser->whoisServiceReply()),
// If no further information found, offer an explanatory message
if (!infoAdded)
- tooltip << "<p class='italic'>" << tr("No information available") << "</p>";
+ tooltip << "<p class='italic' align='center'>" << tr("No information available") << "</p>";
tooltip << "</qt>";
return strTooltip;
return;
if (_ircUser) {
- disconnect(_ircUser, 0, this, 0);
+ disconnect(_ircUser, nullptr, this, nullptr);
}
if (ircUser) {
void QueryBufferItem::removeIrcUser()
{
- _ircUser = 0;
- emit dataChanged();
+ if (_ircUser) {
+ // Disconnect the active IrcUser before removing it, otherwise it will fire removeIrcUser()
+ // a second time when the object's destroyed due to QueryBufferItem::setIrcUser() connecting
+ // SIGNAL destroyed(QObject*) to SLOT removeIrcUser().
+ // This fixes removing an active IrcUser if the user had quit then rejoined in a nonstandard
+ // manner (e.g. updateNickFromHost calling newIrcUser, triggered by an away-notify message).
+ disconnect(_ircUser, nullptr, this, nullptr);
+
+ // Clear IrcUser (only set to 0 if not already 0)
+ _ircUser = nullptr;
+
+ // Only emit dataChanged() if data actually changed. This might serve as a small
+ // optimization, but it can be moved outside the if statement if other behavior depends on
+ // it always being called.
+ emit dataChanged();
+ }
}
*****************************************/
ChannelBufferItem::ChannelBufferItem(const BufferInfo &bufferInfo, AbstractTreeItem *parent)
: BufferItem(bufferInfo, parent),
- _ircChannel(0)
+ _ircChannel(nullptr)
{
+ setFlags(flags() | Qt::ItemIsDropEnabled);
}
Q_UNUSED(column);
QString strTooltip;
QTextStream tooltip( &strTooltip, QIODevice::WriteOnly );
- tooltip << "<qt><style>.bold { font-weight: bold; }</style>"
- << "<qt><style>.italic { font-style: italic; }</style>";
+ tooltip << "<qt><style>.bold { font-weight: bold; } .italic { font-style: italic; }</style>";
// Function to add a row to the tooltip table
auto addRow = [&](const QString& key, const QString& value, bool condition) {
tooltip << "</table>";
} else {
- tooltip << "<p class='italic'>" << tr("Not active, double-click to join") << "</p>";
+ tooltip << "<p class='italic' align='center'>" << tr("Not active, double-click to join") << "</p>";
}
tooltip << "</qt>";
{
if (_ircChannel) {
qWarning() << Q_FUNC_INFO << "IrcChannel already set; cleanup failed!?";
- disconnect(_ircChannel, 0, this, 0);
+ disconnect(_ircChannel, nullptr, this, nullptr);
}
_ircChannel = ircChannel;
emit dataChanged();
}
+QString ChannelBufferItem::nickChannelModes(const QString &nick) const
+{
+ if (!_ircChannel) {
+ qDebug() << Q_FUNC_INFO << "IrcChannel not set, can't get user modes";
+ return QString();
+ }
+
+ return _ircChannel->userModes(nick);
+}
+
void ChannelBufferItem::ircChannelParted()
{
Q_CHECK_PTR(_ircChannel);
- disconnect(_ircChannel, 0, this, 0);
- _ircChannel = 0;
+ disconnect(_ircChannel, nullptr, this, nullptr);
+ _ircChannel = nullptr;
emit dataChanged();
removeAllChilds();
}
void ChannelBufferItem::ircChannelDestroyed()
{
if (_ircChannel) {
- _ircChannel = 0;
+ _ircChannel = nullptr;
emit dataChanged();
removeAllChilds();
}
UserCategoryItem *ChannelBufferItem::findCategoryItem(int categoryId)
{
- UserCategoryItem *categoryItem = 0;
+ UserCategoryItem *categoryItem = nullptr;
for (int i = 0; i < childCount(); i++) {
categoryItem = qobject_cast<UserCategoryItem *>(child(i));
if (categoryItem->categoryId() == categoryId)
return categoryItem;
}
- return 0;
+ return nullptr;
}
QHash<UserCategoryItem *, QList<IrcUser *> > categories;
int categoryId = -1;
- UserCategoryItem *categoryItem = 0;
+ UserCategoryItem *categoryItem = nullptr;
foreach(IrcUser *ircUser, ircUsers) {
categoryId = UserCategoryItem::categoryFromModes(_ircChannel->userModes(ircUser));
return;
}
- disconnect(ircUser, 0, this, 0);
+ disconnect(ircUser, nullptr, this, nullptr);
removeUserFromCategory(ircUser);
emit dataChanged(2);
}
return;
}
- UserCategoryItem *categoryItem = 0;
+ UserCategoryItem *categoryItem = nullptr;
for (int i = 0; i < childCount(); i++) {
categoryItem = qobject_cast<UserCategoryItem *>(child(i));
if (categoryItem->removeUser(ircUser)) {
}
// find the item that needs reparenting
- IrcUserItem *ircUserItem = 0;
+ IrcUserItem *ircUserItem = nullptr;
for (int i = 0; i < childCount(); i++) {
UserCategoryItem *oldCategoryItem = qobject_cast<UserCategoryItem *>(child(i));
Q_ASSERT(oldCategoryItem);
const QList<QChar> UserCategoryItem::categories = QList<QChar>() << 'q' << 'a' << 'o' << 'h' << 'v';
UserCategoryItem::UserCategoryItem(int category, AbstractTreeItem *parent)
- : PropertyMapItem(QStringList() << "categoryName", parent),
+ : PropertyMapItem(parent),
_category(category)
{
setFlags(Qt::ItemIsEnabled);
}
+QStringList UserCategoryItem::propertyOrder() const
+{
+ static QStringList order{"categoryName"};
+ return order;
+}
+
+
// caching this makes no sense, since we display the user number dynamically
QString UserCategoryItem::categoryName() const
{
int n = childCount();
switch (_category) {
case 0:
- return tr("%n Owner(s)", 0, n);
+ return tr("%n Owner(s)", "", n);
case 1:
- return tr("%n Admin(s)", 0, n);
+ return tr("%n Admin(s)", "", n);
case 2:
- return tr("%n Operator(s)", 0, n);
+ return tr("%n Operator(s)", "", n);
case 3:
- return tr("%n Half-Op(s)", 0, n);
+ return tr("%n Half-Op(s)", "", n);
case 4:
- return tr("%n Voiced", 0, n);
+ return tr("%n Voiced", "", n);
default:
- return tr("%n User(s)", 0, n);
+ return tr("%n User(s)", "", n);
}
}
IrcUserItem *UserCategoryItem::findIrcUser(IrcUser *ircUser)
{
- IrcUserItem *userItem = 0;
+ IrcUserItem *userItem = nullptr;
for (int i = 0; i < childCount(); i++) {
userItem = qobject_cast<IrcUserItem *>(child(i));
if (userItem->ircUser() == ircUser)
return userItem;
}
- return 0;
+ return nullptr;
}
* Irc User Items
*****************************************/
IrcUserItem::IrcUserItem(IrcUser *ircUser, AbstractTreeItem *parent)
- : PropertyMapItem(QStringList() << "nickName", parent),
+ : PropertyMapItem(parent),
_ircUser(ircUser)
{
setObjectName(ircUser->nick());
}
+QStringList IrcUserItem::propertyOrder() const
+{
+ static QStringList order{"nickName"};
+ return order;
+}
+
+
QVariant IrcUserItem::data(int column, int role) const
{
switch (role) {
Q_UNUSED(column);
QString strTooltip;
QTextStream tooltip( &strTooltip, QIODevice::WriteOnly );
- tooltip << "<qt><style>.bold { font-weight: bold; }</style>"
- << "<style>.italic { font-style: italic; }</style>";
+ tooltip << "<qt><style>.bold { font-weight: bold; } .italic { font-style: italic; }</style>";
// Keep track of whether or not information has been added
bool infoAdded = false;
};
tooltip << "<table cellspacing='5' cellpadding='0'>";
+ addRow(tr("Modes"),
+ NetworkItem::escapeHTML(channelModes()),
+ !channelModes().isEmpty());
if (_ircUser->isAway()) {
- QString awayMessage(tr("(unknown)"));
- if(!_ircUser->awayMessage().isEmpty()) {
- awayMessage = _ircUser->awayMessage();
+ QString awayMessageHTML = QString("<p class='italic'>%1</p>").arg(tr("Unknown"));
+
+ // If away message is known, replace with the escaped message.
+ if (!_ircUser->awayMessage().isEmpty()) {
+ awayMessageHTML = NetworkItem::escapeHTML(_ircUser->awayMessage());
}
- addRow(NetworkItem::escapeHTML(tr("Away message"), true), NetworkItem::escapeHTML(awayMessage), true);
+ addRow(NetworkItem::escapeHTML(tr("Away message"), true), awayMessageHTML, true);
}
addRow(tr("Realname"),
NetworkItem::escapeHTML(_ircUser->realName()),
NetworkItem::escapeHTML(_ircUser->suserHost()),
!_ircUser->suserHost().isEmpty());
}
+
+ // Keep track of whether or not the account information's been added. Don't show it twice.
+ bool accountAdded = false;
+ if(!_ircUser->account().isEmpty()) {
+ // IRCv3 account-notify is supported by the core and IRC server.
+ // Assume logged out (seems to be more common)
+ QString accountHTML = QString("<p class='italic'>%1</p>").arg(tr("Not logged in"));
+
+ // If account is logged in, replace with the escaped account name.
+ if (_ircUser->account() != "*") {
+ accountHTML = NetworkItem::escapeHTML(_ircUser->account());
+ }
+ addRow(NetworkItem::escapeHTML(tr("Account"), true),
+ accountHTML,
+ true);
+ // Mark the row as added
+ accountAdded = true;
+ }
// whoisServiceReply may return "<nick> is identified for this nick", which should be translated.
// See https://www.alien.net.au/irc/irc2numerics.html
if(_ircUser->whoisServiceReply().endsWith("identified for this nick")) {
addRow(NetworkItem::escapeHTML(tr("Account"), true),
NetworkItem::escapeHTML(tr("Identified for this nick")),
- true);
+ !accountAdded);
+ // Don't add the account row again if information's already added via account-notify
+ // Not used further down...
+ // accountAdded = true;
} else {
addRow(NetworkItem::escapeHTML(tr("Service Reply"), true),
NetworkItem::escapeHTML(_ircUser->whoisServiceReply()),
// If no further information found, offer an explanatory message
if (!infoAdded)
- tooltip << "<p class='italic'>" << tr("No information available") << "</p>";
+ tooltip << "<p class='italic' align='center'>" << tr("No information available") << "</p>";
tooltip << "</qt>";
return strTooltip;
}
+QString IrcUserItem::channelModes() const
+{
+ // IrcUserItems are parented to UserCategoryItem, which are parented to ChannelBufferItem.
+ // We want the channel buffer item in order to get the channel-specific user modes.
+ UserCategoryItem *category = qobject_cast<UserCategoryItem *>(parent());
+ if (!category)
+ return QString();
+
+ ChannelBufferItem *channel = qobject_cast<ChannelBufferItem *>(category->parent());
+ if (!channel)
+ return QString();
+
+ return channel->nickChannelModes(nickName());
+}
+
/*****************************************
* NetworkModel
int NetworkModel::networkRow(NetworkId networkId) const
{
- NetworkItem *netItem = 0;
+ NetworkItem *netItem = nullptr;
for (int i = 0; i < rootItem->childCount(); i++) {
netItem = qobject_cast<NetworkItem *>(rootItem->child(i));
if (!netItem)
{
int netRow = networkRow(networkId);
if (netRow == -1)
- return 0;
+ return nullptr;
else
return qobject_cast<NetworkItem *>(rootItem->child(netRow));
}
{
NetworkItem *netItem = findNetworkItem(networkId);
- if (netItem == 0) {
+ if (netItem == nullptr) {
netItem = new NetworkItem(networkId, rootItem);
rootItem->newChild(netItem);
}
if (_bufferItemCache.contains(bufferId))
return _bufferItemCache[bufferId];
else
- return 0;
+ return nullptr;
}
case Message::Action:
if (bufferType(msg.bufferId()) == BufferInfo::ChannelBuffer) {
const Network *net = Client::network(msg.bufferInfo().networkId());
- IrcUser *user = net ? net->ircUser(nickFromMask(msg.sender())) : 0;
+ IrcUser *user = net ? net->ircUser(nickFromMask(msg.sender())) : nullptr;
if (user)
user->setLastChannelActivity(msg.bufferId(), msg.timestamp());
}
{
QVariant netVariant = index.data(NetworkIdRole);
if (!netVariant.isValid())
- return 0;
+ return nullptr;
NetworkId networkId = netVariant.value<NetworkId>();
return Client::network(networkId);
_serverNoticesTarget = bufferSettings.serverNoticesTarget();
_errorMsgsTarget = bufferSettings.errorMsgsTarget();
}
+
+void NetworkModel::bufferActivityChanged(BufferId bufferId, const Message::Types activity) {
+ auto _bufferItem = findBufferItem(bufferId);
+ if (!_bufferItem) {
+ qDebug() << "NetworkModel::bufferActivityChanged(): buffer is unknown:" << bufferId;
+ return;
+ }
+ auto hiddenTypes = BufferSettings(bufferId).messageFilter();
+ auto visibleTypes = ~hiddenTypes;
+ auto activityVisibleTypesIntersection = activity & visibleTypes;
+ _bufferItem->setActivity(activityVisibleTypesIntersection, false);
+}
+
+void NetworkModel::highlightCountChanged(BufferId bufferId, int count) {
+ auto _bufferItem = findBufferItem(bufferId);
+ if (!_bufferItem) {
+ qDebug() << "NetworkModel::highlightCountChanged(): buffer is unknown:" << bufferId;
+ return;
+ }
+ _bufferItem->addActivity(Message::Types{}, count > 0);
+}