From 0f4fad3929097dca24d1ca92b06283811661e1f4 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Sun, 14 Nov 2010 23:14:13 +0000
Subject: Don't show unread events after signout.

Resolves: #685
Release-Notes: Signing out with unread events will no longer trap your system tray with unread messages.

diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 165e87d..b8ba289 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -469,6 +469,7 @@ void MainController::handleCancelLoginRequest() {
 }
 
 void MainController::signOut() {
+	eventController_->clear();
 	logout();
 	loginWindow_->loggedOut();
 	resetClient();
diff --git a/Swift/Controllers/XMPPEvents/EventController.cpp b/Swift/Controllers/XMPPEvents/EventController.cpp
index f2fdcfe..8e31d30 100644
--- a/Swift/Controllers/XMPPEvents/EventController.cpp
+++ b/Swift/Controllers/XMPPEvents/EventController.cpp
@@ -47,4 +47,9 @@ void EventController::disconnectAll() {
 	onEventQueueEventAdded.disconnect_all_slots();
 }
 
+void EventController::clear() {
+	events_.clear();
+	onEventQueueLengthChange(0);
+}
+
 }
diff --git a/Swift/Controllers/XMPPEvents/EventController.h b/Swift/Controllers/XMPPEvents/EventController.h
index 1e0a069..827dce8 100644
--- a/Swift/Controllers/XMPPEvents/EventController.h
+++ b/Swift/Controllers/XMPPEvents/EventController.h
@@ -28,6 +28,7 @@ namespace Swift {
 			boost::signal<void (boost::shared_ptr<StanzaEvent>)> onEventQueueEventAdded;
 			const EventList& getEvents() const {return events_;}
 			void disconnectAll();
+			void clear();
 
 		private:
 			void handleEventConcluded(boost::shared_ptr<StanzaEvent> event);
-- 
cgit v0.10.2-6-g49f6