summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-09-30 21:03:51 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-09-30 21:04:33 (GMT)
commitbbe47f55d18b6f9e530ac2c8d0d3aebb0ec72f8c (patch)
treecaa9d573abfc8e4c8e24d4de62580f3dd8696bfa /Swift/Controllers/Chat/ChatControllerBase.cpp
parenta1b590f2e469191381b5eb8613b5618ffbcafcc4 (diff)
downloadswift-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.
Diffstat (limited to 'Swift/Controllers/Chat/ChatControllerBase.cpp')
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.cpp12
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() {