-// no longer needed
-// back reference:
-// void Buffer::setTopic(QString t) {
-// _topic = t;
-// emit topicSet(t);
-// emit bufferUpdated(this);
-// }
-
-// void Buffer::addNick(QString nick, QVariantMap props) {
-// if(nick == ownNick()) setActive(true);
-// nicks[nick] = props;
-// emit nickListChanged(nicks);
-// }
-
-// void Buffer::updateNick(QString nick, QVariantMap props) {
-// nicks[nick] = props;
-// emit nickListChanged(nicks);
-// }
-
-// void Buffer::renameNick(QString oldnick, QString newnick) {
-// QVariant v = nicks.take(oldnick);
-// nicks[newnick] = v;
-// emit nickListChanged(nicks);
-// }
-
-// void Buffer::removeNick(QString nick) {
-// if(nick == ownNick()) setActive(false);
-// nicks.remove(nick);
-// emit nickListChanged(nicks);
-// }
-
-// void Buffer::setOwnNick(QString nick) {
-// _ownNick = nick;
-// emit ownNickSet(nick);
-// }
+void Buffer::updateActivityLevel(const Message &msg) {
+ if(isVisible())
+ return;
+
+ if(msg.flags() & Message::Self) // don't update activity for our own messages
+ return;
+
+ if(lastSeen().isValid() && lastSeen() >= msg.timestamp())
+ return;
+
+ ActivityLevel level = activityLevel() | OtherActivity;
+ if(msg.type() == Message::Plain || msg.type() == Message::Notice) level |= NewMessage;
+ if(msg.flags() & Message::Highlight) level |= Highlight;
+
+ if(level != activityLevel()) setActivityLevel(level);
+}