QssParser: Interpret "oblique" as italic
[quassel.git] / src / client / networkmodel.cpp
index 526781f..8214966 100644 (file)
@@ -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  *
@@ -34,6 +34,7 @@
 #include "ircchannel.h"
 #include "network.h"
 #include "signalproxy.h"
+#include "buffersyncer.h"
 
 /*****************************************
 *  Network Items
@@ -145,6 +146,14 @@ BufferItem *NetworkItem::bufferItem(const BufferInfo &bufferInfo)
         break;
     }
 
+    BufferSyncer *bufferSyncer = Client::bufferSyncer();
+    if (bufferSyncer) {
+        bufferItem->addActivity(
+                bufferSyncer->activity(bufferItem->bufferId()),
+                bufferSyncer->highlightCount(bufferItem->bufferId()) > 0
+        );
+    }
+
     return bufferItem;
 }
 
@@ -293,7 +302,7 @@ void BufferItem::setActivityLevel(BufferInfo::ActivityLevel level)
 
 void BufferItem::clearActivityLevel()
 {
-    if (Client::coreFeatures().testFlag(Quassel::Feature::BufferActivitySync)) {
+    if (Client::isCoreFeatureEnabled(Quassel::Feature::BufferActivitySync)) {
         // If the core handles activity sync, clear only the highlight flag
         _activity &= ~BufferInfo::Highlight;
     } else {
@@ -302,7 +311,7 @@ void BufferItem::clearActivityLevel()
     _firstUnreadMsgId = MsgId();
 
     // FIXME remove with core proto v11
-    if (!(Client::coreFeatures() & Quassel::SynchronizedMarkerLine)) {
+    if (!Client::isCoreFeatureEnabled(Quassel::Feature::SynchronizedMarkerLine)) {
         _markerLineMsgId = _lastSeenMsgId;
     }
 
@@ -313,7 +322,7 @@ void BufferItem::clearActivityLevel()
 void BufferItem::updateActivityLevel(const Message &msg)
 {
     // If the core handles activity, and this message is not a highlight, ignore this
-    if (Client::coreFeatures().testFlag(Quassel::Feature::BufferActivitySync) && !msg.flags().testFlag(Message::Highlight)) {
+    if (Client::isCoreFeatureEnabled(Quassel::Feature::BufferActivitySync) && !msg.flags().testFlag(Message::Highlight)) {
         return;
     }
 
@@ -339,7 +348,7 @@ void BufferItem::updateActivityLevel(const Message &msg)
 
     Message::Types type;
     // If the core handles activities, ignore types
-    if (!Client::coreFeatures().testFlag(Quassel::Feature::BufferActivitySync)) {
+    if (Client::isCoreFeatureEnabled(Quassel::Feature::BufferActivitySync)) {
         type = Message::Types();
     } else {
         type = msg.type();
@@ -429,7 +438,7 @@ void BufferItem::setLastSeenMsgId(MsgId msgId)
     _lastSeenMsgId = msgId;
 
     // FIXME remove with core protocol v11
-    if (!(Client::coreFeatures() & Quassel::SynchronizedMarkerLine)) {
+    if (!Client::isCoreFeatureEnabled(Quassel::Feature::SynchronizedMarkerLine)) {
         if (!isCurrentBuffer())
             _markerLineMsgId = msgId;
     }
@@ -1752,3 +1761,12 @@ void NetworkModel::bufferActivityChanged(BufferId bufferId, const Message::Types
     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);
+}