-bool ChatMonitorFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
- Q_UNUSED(sourceParent)
-
- QModelIndex source_index = sourceModel()->index(sourceRow, 0);
-
- Message::Flags flags = (Message::Flags)source_index.data(MessageModel::FlagsRole).toInt();
- if(flags & Message::Backlog || (!_showOwnMessages && flags & Message::Self))
- return false;
-
- Message::Type type = (Message::Type)source_index.data(MessageModel::TypeRole).toInt();
- if(!(type & (Message::Plain | Message::Notice | Message::Action)))
- return false;
-
- BufferId bufferId = source_index.data(MessageModel::BufferIdRole).value<BufferId>();
-
- // ChatMonitorSettingsPage
- if(_operationMode == ChatViewSettings::OptOut
- && !(_showHighlights && flags & Message::Highlight)
- && _bufferIds.contains(bufferId))
- return false;
- if(_operationMode == ChatViewSettings::OptIn
- && !(_showHighlights && flags & Message::Highlight)
- && !_bufferIds.contains(bufferId))
- return false;
-
- // ignorelist handling
- // only match if message is not flagged as server msg
- if(!(flags & Message::ServerMsg) &&
- Client::ignoreListManager()->match(source_index.data(MessageModel::MessageRole).value<Message>(), Client::networkModel()->networkName(bufferId)))
- return false;
- return true;
+
+bool ChatMonitorFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
+{
+ Q_UNUSED(sourceParent)
+
+ QModelIndex source_index = sourceModel()->index(sourceRow, 0);
+ BufferId bufferId = source_index.data(MessageModel::BufferIdRole).value<BufferId>();
+
+ Message::Flags flags = (Message::Flags)source_index.data(MessageModel::FlagsRole).toInt();
+ if ((flags & Message::Backlog) && (!_showBacklog || (!_includeRead &&
+ (Client::networkModel()->lastSeenMsgId(bufferId) >= sourceModel()->data(source_index, MessageModel::MsgIdRole).value<MsgId>()))))
+ return false;
+
+ if (!_showOwnMessages && flags & Message::Self)
+ return false;
+
+ Message::Type type = (Message::Type)source_index.data(MessageModel::TypeRole).toInt();
+ if (!(type & (Message::Plain | Message::Notice | Message::Action)))
+ return false;
+
+ // ChatMonitorSettingsPage
+ if (_operationMode == ChatViewSettings::OptOut
+ && !(_showHighlights && flags & Message::Highlight)
+ && _bufferIds.contains(bufferId))
+ return false;
+ if (_operationMode == ChatViewSettings::OptIn
+ && !(_showHighlights && flags & Message::Highlight)
+ && !_bufferIds.contains(bufferId))
+ return false;
+
+ // ignorelist handling
+ // only match if message is not flagged as server msg
+ if (!(flags & Message::ServerMsg) && Client::ignoreListManager()
+ && Client::ignoreListManager()->match(source_index.data(MessageModel::MessageRole).value<Message>(), Client::networkModel()->networkName(bufferId)))
+ return false;
+ return true;