-void BufferItem::updateActivityLevel(Buffer::ActivityLevel level) {
- Buffer::ActivityLevel oldActivity = _activity;
- _activity |= level;
- if(oldActivity != _activity)
+void BufferItem::updateActivityLevel(const Message &msg) {
+ if(isCurrentBuffer())
+ return;
+
+ if(msg.flags() & Message::Self) // don't update activity for our own messages
+ return;
+
+ if(lastSeenMsgId() >= msg.msgId())
+ return;
+
+ BufferInfo::ActivityLevel oldLevel = activityLevel();
+
+ _activity |= BufferInfo::OtherActivity;
+ if(msg.type() & (Message::Plain | Message::Notice | Message::Action))
+ _activity |= BufferInfo::NewMessage;
+
+ if(msg.flags() & Message::Highlight)
+ _activity |= BufferInfo::Highlight;
+
+ if(oldLevel != _activity)