- if((flags & Message::Highlight || bufType == BufferInfo::QueryBuffer)
- && !(Client::ignoreListManager() && Client::ignoreListManager()->match(idx.data(MessageModel::MessageRole).value<Message>(),
- Client::networkModel()->networkName(bufId))))
- {
- QModelIndex senderIdx = Client::messageModel()->index(i, ChatLineModel::SenderColumn);
- QString sender = senderIdx.data(ChatLineModel::EditRole).toString();
- QString contents = idx.data(ChatLineModel::DisplayRole).toString();
- AbstractNotificationBackend::NotificationType type;
-
- if(bufType == BufferInfo::QueryBuffer && !hasFocus)
- type = AbstractNotificationBackend::PrivMsg;
- else if(bufType == BufferInfo::QueryBuffer && hasFocus)
- type = AbstractNotificationBackend::PrivMsgFocused;
- else if(flags & Message::Highlight && !hasFocus)
- type = AbstractNotificationBackend::Highlight;
- else
- type = AbstractNotificationBackend::HighlightFocused;
-
- QtUi::instance()->invokeNotification(bufId, type, sender, contents);
- }
+ // only show notifications for higlights or queries
+ if(bufType != BufferInfo::QueryBuffer && !(flags & Message::Highlight))
+ continue;
+
+ // and of course: don't notify for ignored messages
+ if(Client::ignoreListManager() && Client::ignoreListManager()->match(idx.data(MessageModel::MessageRole).value<Message>(), Client::networkModel()->networkName(bufId)))
+ continue;
+
+ // seems like we have a legit notification candidate!
+ QModelIndex senderIdx = Client::messageModel()->index(i, ChatLineModel::SenderColumn);
+ QString sender = senderIdx.data(ChatLineModel::EditRole).toString();
+ QString contents = idx.data(ChatLineModel::DisplayRole).toString();
+ AbstractNotificationBackend::NotificationType type;
+
+ if(bufType == BufferInfo::QueryBuffer && !hasFocus)
+ type = AbstractNotificationBackend::PrivMsg;
+ else if(bufType == BufferInfo::QueryBuffer && hasFocus)
+ type = AbstractNotificationBackend::PrivMsgFocused;
+ else if(flags & Message::Highlight && !hasFocus)
+ type = AbstractNotificationBackend::Highlight;
+ else
+ type = AbstractNotificationBackend::HighlightFocused;
+
+ QtUi::instance()->invokeNotification(bufId, type, sender, contents);