From 4fc14f392e953ee2309312d9d8a07dc01303c838 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Thu, 26 Apr 2012 10:44:51 +0100
Subject: Mark recent chats offline when Swift is offline.

Resolves: #999

diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index aea5ef4..b0aef95 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -403,6 +403,14 @@ void ChatsManager::handleUIEvent(boost::shared_ptr<UIEvent> event) {
 	}
 }
 
+void ChatsManager::markAllRecentsOffline() {
+	foreach (ChatListWindow::Chat& chat, recentChats_) {
+		chat.setStatusType(StatusShow::None);
+	}
+
+	chatListWindow_->setRecents(recentChats_);
+}
+
 /**
  * If a resource goes offline, release bound chatdialog to that resource.
  */
@@ -477,6 +485,7 @@ void ChatsManager::setOnline(bool enabled) {
 		delete mucBookmarkManager_;
 		mucBookmarkManager_ = NULL;
 		chatListWindow_->setBookmarksEnabled(false);
+		markAllRecentsOffline();
 	} else {
 		setupBookmarks();
 	}
diff --git a/Swift/Controllers/Chat/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h
index e6666fa..a8c69c4 100644
--- a/Swift/Controllers/Chat/ChatsManager.h
+++ b/Swift/Controllers/Chat/ChatsManager.h
@@ -88,6 +88,7 @@ namespace Swift {
 			void handleJIDUpdatedInRoster(const JID&);
 			void handleRosterCleared();
 			void handleSettingChanged(const std::string& settingPath);
+			void markAllRecentsOffline();
 
 			void updatePresenceReceivingStateOnChatController(const JID&);
 
-- 
cgit v0.10.2-6-g49f6