From 7cb49cb679156151f19a556de76274c5a25e6de2 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Sat, 29 Oct 2011 11:40:12 +0100
Subject: Don't save message content of recents to disk in --eagle-mode


diff --git a/Documentation/SConscript b/Documentation/SConscript
index da93894..03305a7 100644
--- a/Documentation/SConscript
+++ b/Documentation/SConscript
@@ -1,4 +1,4 @@
 Import("env")
 
 if env["SCONS_STAGE"] == "build" :
-	SConscript(dirs = ["SwiftenDevelopersGuide", "API"])
+	SConscript(dirs = ["SwiftenDevelopersGuide", "SwiftUserGuide", "API"])
diff --git a/Documentation/SwiftUserGuide/.gitignore b/Documentation/SwiftUserGuide/.gitignore
new file mode 100644
index 0000000..6f7b520
--- /dev/null
+++ b/Documentation/SwiftUserGuide/.gitignore
@@ -0,0 +1,5 @@
+catalog.xml
+fop.cfg
+*.pdf
+*.html
+*.fo
diff --git a/Documentation/SwiftUserGuide/SConscript b/Documentation/SwiftUserGuide/SConscript
new file mode 100644
index 0000000..50f60bc
--- /dev/null
+++ b/Documentation/SwiftUserGuide/SConscript
@@ -0,0 +1,15 @@
+Import("env")
+
+env.Tool("DocBook", toolpath = ["#/BuildTools/DocBook/SCons"])
+
+################################################################################
+# Code generation helper
+################################################################################
+
+import sys, re, os.path
+
+################################################################################
+
+if "doc" in ARGUMENTS :
+	env.DocBook("Swift Users Guide.xml")
+
diff --git a/Documentation/SwiftUserGuide/Swift Users Guide.xml b/Documentation/SwiftUserGuide/Swift Users Guide.xml
new file mode 100644
index 0000000..7cbec60
--- /dev/null
+++ b/Documentation/SwiftUserGuide/Swift Users Guide.xml	
@@ -0,0 +1,94 @@
+<?xml version="1.0" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+
+<book>
+  <title>Swift User Guide</title>
+
+  <chapter>
+    <title>Introduction</title>
+    <section>
+      <title>Swift</title>
+      <para>
+        Swift is a chat client using the XMPP protocol. This document describes use of the client for end users; for a further description of the protocol read 
+        <citetitle>XMPP: The Definitive Guide</citetitle> 
+        <citation><biblioref linkend="XMPP-TDG"/></citation>
+        or for development using XMPP see the
+        <citetitle>Swiften Developer's Guide</citetitle>
+        <citation><biblioref linkend="Swiften-Developers-Guide" /></citation>
+      </para>
+    </section>
+  </chapter>
+
+  <chapter>
+    <title>Getting Started</title>
+    <para>
+    </para>
+  </chapter>
+
+  <chapter>
+    <title>Managing Contacts</title>
+    <para>
+    </para>
+  </chapter>
+
+  <chapter>
+    <title>Chatting to Contacts</title>
+    <para>
+    </para>
+  </chapter>
+
+  <chapter>
+    <title>Chatting in Rooms (MUCs)</title>
+    <para>
+    </para>
+  </chapter>
+
+  <chapter>
+    <title>Room (MUC) Administration</title>
+    <para>
+    </para>
+  </chapter>
+
+  <chapter>
+    <title>Server Configuration</title>
+    <para>
+    </para>
+  </chapter>
+
+  <chapter>
+    <title>Eagle Mode</title>
+    <para>
+    </para>
+  </chapter>
+
+  <bibliography>
+    <title>Bibliography</title>
+
+    <biblioentry id="XMPP-TDG">
+      <abbrev>XMPP-TDG</abbrev>
+      <title><ulink url="http://oreilly.com/catalog/9780596157197/">XMPP: The
+      Definitive Guide</ulink></title>
+      <author>
+        <firstname>Peter</firstname>
+        <surname>Saint-Andre</surname>
+      </author>
+      <author>
+        <firstname>Kevin</firstname>
+        <surname>Smith</surname>
+      </author>
+      <author>
+        <firstname>Remko</firstname>
+        <surname>Tronçon</surname>
+      </author>
+    </biblioentry>
+
+    <biblioentry id='Swiften-Developers-Guide'>
+      <abbrev>Swiften-dev</abbrev>
+      <title><ulink url='http://swift.im/swiften/guide/'>Swiften Developer's Guide</ulink></title>
+      <author>
+        <firstname>Remko</firstname>
+        <surname>Tronçon</surname>
+      </author>
+    </biblioentry>
+  </bibliography>
+</book>
\ No newline at end of file
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index e6441e1..83a09d4 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -60,14 +60,16 @@ ChatsManager::ChatsManager(
 		MUCManager* mucManager,
 		MUCSearchWindowFactory* mucSearchWindowFactory,
 		ProfileSettingsProvider* settings,
-		FileTransferOverview* ftOverview) :
+		FileTransferOverview* ftOverview,
+		bool eagleMode) :
 			jid_(jid), 
 			joinMUCWindowFactory_(joinMUCWindowFactory), 
 			useDelayForLatency_(useDelayForLatency), 
 			mucRegistry_(mucRegistry), 
 			entityCapsProvider_(entityCapsProvider), 
 			mucManager(mucManager),
-			ftOverview_(ftOverview) {
+			ftOverview_(ftOverview),
+			eagleMode_(eagleMode) {
 	timerFactory_ = timerFactory;
 	eventController_ = eventController;
 	stanzaChannel_ = stanzaChannel;
@@ -119,7 +121,7 @@ void ChatsManager::saveRecents() {
 			/* Work around Boost bug https://svn.boost.org/trac/boost/ticket/4751 */
 			activity.push_back("");
 		}
-		std::string recent = chat.jid.toString() + "\t" + activity[0] + "\t" + (chat.isMUC ? "true" : "false") +  "\t" + chat.nick;
+		std::string recent = chat.jid.toString() + "\t" + (eagleMode_ ? "" : activity[0]) + "\t" + (chat.isMUC ? "true" : "false") +  "\t" + chat.nick;
 		recents += recent + "\n";
 		if (i++ > 25) {
 			break;
diff --git a/Swift/Controllers/Chat/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h
index 8e94d9a..5d8d555 100644
--- a/Swift/Controllers/Chat/ChatsManager.h
+++ b/Swift/Controllers/Chat/ChatsManager.h
@@ -48,7 +48,7 @@ namespace Swift {
 	
 	class ChatsManager {
 		public:
-			ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRouter, EventController* eventController, ChatWindowFactory* chatWindowFactory, JoinMUCWindowFactory* joinMUCWindowFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, PresenceSender* presenceSender, UIEventStream* uiEventStream, ChatListWindowFactory* chatListWindowFactory, bool useDelayForLatency, TimerFactory* timerFactory, MUCRegistry* mucRegistry, EntityCapsProvider* entityCapsProvider, MUCManager* mucManager, MUCSearchWindowFactory* mucSearchWindowFactory, ProfileSettingsProvider* settings, FileTransferOverview* ftOverview);
+			ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRouter, EventController* eventController, ChatWindowFactory* chatWindowFactory, JoinMUCWindowFactory* joinMUCWindowFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, PresenceSender* presenceSender, UIEventStream* uiEventStream, ChatListWindowFactory* chatListWindowFactory, bool useDelayForLatency, TimerFactory* timerFactory, MUCRegistry* mucRegistry, EntityCapsProvider* entityCapsProvider, MUCManager* mucManager, MUCSearchWindowFactory* mucSearchWindowFactory, ProfileSettingsProvider* settings, FileTransferOverview* ftOverview, bool eagleMode);
 			virtual ~ChatsManager();
 			void setAvatarManager(AvatarManager* avatarManager);
 			void setOnline(bool enabled);
@@ -115,5 +115,6 @@ namespace Swift {
 			std::list<ChatListWindow::Chat> recentChats_;
 			ProfileSettingsProvider* profileSettings_;
 			FileTransferOverview* ftOverview_;
+			bool eagleMode_;
 	};
 }
diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
index 5339703..df519e8 100644
--- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
+++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
@@ -94,7 +94,7 @@ public:
 		ftManager_ = new DummyFileTransferManager();
 		ftOverview_ = new FileTransferOverview(ftManager_);
 		mocks_->ExpectCall(chatListWindowFactory_, ChatListWindowFactory::createChatListWindow).With(uiEventStream_).Return(chatListWindow_);
-		manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, joinMUCWindowFactory_, nickResolver_, presenceOracle_, directedPresenceSender_, uiEventStream_, chatListWindowFactory_, true, NULL, mucRegistry_, entityCapsManager_, mucManager_, mucSearchWindowFactory_, profileSettings_, ftOverview_);
+		manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, joinMUCWindowFactory_, nickResolver_, presenceOracle_, directedPresenceSender_, uiEventStream_, chatListWindowFactory_, true, NULL, mucRegistry_, entityCapsManager_, mucManager_, mucSearchWindowFactory_, profileSettings_, ftOverview_, false);
 
 		avatarManager_ = new NullAvatarManager();
 		manager_->setAvatarManager(avatarManager_);
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index c1ba9d0..f4e7adc 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -293,7 +293,7 @@ void MainController::handleConnected() {
 
 		contactEditController_ = new ContactEditController(rosterController_, uiFactory_, uiEventStream_);
 
-		chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager(), uiFactory_, profileSettings_, ftOverview_);
+		chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager(), uiFactory_, profileSettings_, ftOverview_, eagleMode_);
 		
 		client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1));
 		chatsManager_->setAvatarManager(client_->getAvatarManager());
-- 
cgit v0.10.2-6-g49f6