Move the check if the core handles activities to the right place
authorJanne Koschinski <janne@kuschku.de>
Sun, 27 Aug 2017 01:54:28 +0000 (03:54 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 19 Dec 2017 20:09:05 +0000 (21:09 +0100)
src/client/networkmodel.cpp

index 1f8306d..be0c0f9 100644 (file)
@@ -337,7 +337,15 @@ void BufferItem::updateActivityLevel(const Message &msg)
         _firstUnreadMsgId = msg.msgId();
     }
 
         _firstUnreadMsgId = msg.msgId();
     }
 
-    if (addActivity(Message::Types(msg.type()), msg.flags().testFlag(Message::Highlight)) || stateChanged) {
+    Message::Types type;
+    // If the core handles activities, ignore types
+    if (!Client::coreFeatures().testFlag(Quassel::Feature::BufferActivitySync)) {
+        type = Message::Types();
+    } else {
+        type = msg.type();
+    }
+
+    if (addActivity(type, msg.flags().testFlag(Message::Highlight)) || stateChanged) {
         emit dataChanged();
     }
 }
         emit dataChanged();
     }
 }
@@ -356,14 +364,11 @@ void BufferItem::setActivity(Message::Types type, bool highlight) {
 bool BufferItem::addActivity(Message::Types type, bool highlight) {
     auto oldActivity = activityLevel();
 
 bool BufferItem::addActivity(Message::Types type, bool highlight) {
     auto oldActivity = activityLevel();
 
-    // If the core handles activities, only handle highlights
-    if (!Client::coreFeatures().testFlag(Quassel::Feature::BufferActivitySync)) {
-        if (type != 0)
-            _activity |= BufferInfo::OtherActivity;
+    if (type != 0)
+        _activity |= BufferInfo::OtherActivity;
 
 
-        if (type.testFlag(Message::Plain) || type.testFlag(Message::Notice) || type.testFlag(Message::Action))
-            _activity |= BufferInfo::NewMessage;
-    }
+    if (type.testFlag(Message::Plain) || type.testFlag(Message::Notice) || type.testFlag(Message::Action))
+        _activity |= BufferInfo::NewMessage;
 
     if (highlight)
         _activity |= BufferInfo::Highlight;
 
     if (highlight)
         _activity |= BufferInfo::Highlight;
@@ -1737,13 +1742,14 @@ void NetworkModel::messageRedirectionSettingsChanged()
 }
 
 void NetworkModel::bufferActivityChanged(BufferId bufferId, const Message::Types activity) {
 }
 
 void NetworkModel::bufferActivityChanged(BufferId bufferId, const Message::Types activity) {
-    auto bufferItem = findBufferItem(bufferId);
-    if (!bufferItem) {
+    qWarning() << "bufferActivityChanged(" << bufferId << ", " << 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;
         qDebug() << "NetworkModel::bufferActivityChanged(): buffer is unknown:" << bufferId;
         return;
     }
     auto hiddenTypes = BufferSettings(bufferId).messageFilter();
     auto visibleTypes = ~hiddenTypes;
     auto activityVisibleTypesIntersection = activity & visibleTypes;
-    bufferItem->setActivity(activityVisibleTypesIntersection, false);
+    _bufferItem->setActivity(activityVisibleTypesIntersection, false);
 }
 }