diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-09-30 21:03:51 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-09-30 21:04:33 (GMT) |
commit | bbe47f55d18b6f9e530ac2c8d0d3aebb0ec72f8c (patch) | |
tree | caa9d573abfc8e4c8e24d4de62580f3dd8696bfa | |
parent | a1b590f2e469191381b5eb8613b5618ffbcafcc4 (diff) | |
download | swift-contrib-bbe47f55d18b6f9e530ac2c8d0d3aebb0ec72f8c.zip swift-contrib-bbe47f55d18b6f9e530ac2c8d0d3aebb0ec72f8c.tar.bz2 |
Only do the "Mark unread messages as read" dance if there are unread messages.
This should avoid some juddery scrolling.
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index 802a7cb..df59c2f 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -90,12 +90,14 @@ void ChatControllerBase::setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> } void ChatControllerBase::handleAllMessagesRead() { - foreach (boost::shared_ptr<MessageEvent> messageEvent, unreadMessages_) { - messageEvent->read(); + if (!unreadMessages_.empty()) { + foreach (boost::shared_ptr<MessageEvent> messageEvent, unreadMessages_) { + messageEvent->read(); + } + unreadMessages_.clear(); + chatWindow_->setUnreadMessageCount(0); + onUnreadCountChanged(); } - unreadMessages_.clear(); - chatWindow_->setUnreadMessageCount(0); - onUnreadCountChanged(); } int ChatControllerBase::getUnreadCount() { |