From 326c0620a103d621bcdd74341cd0117816acca03 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sun, 12 Sep 2010 23:37:23 +0200
Subject: Remove IQRouter from client inheritance list.


diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 04112ea..d4222e3 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -240,27 +240,27 @@ void MainController::handleConnected() {
 		xmppRoster_ = boost::shared_ptr<XMPPRoster>(new XMPPRoster());
 		presenceOracle_ = new PresenceOracle(client_);
 		mucRegistry_ = new MUCRegistry();
-		vcardManager_ = new VCardManager(jid_, client_, getVCardStorageForProfile(jid_));
+		vcardManager_ = new VCardManager(jid_, client_->getIQRouter(), getVCardStorageForProfile(jid_));
 		vcardManager_->onVCardChanged.connect(boost::bind(&MainController::handleVCardReceived, this, _1, _2));
 		avatarManager_ = new AvatarManagerImpl(vcardManager_, client_, avatarStorage_, mucRegistry_);
-		capsManager_ = new CapsManager(capsStorage_, client_, client_);
+		capsManager_ = new CapsManager(capsStorage_, client_, client_->getIQRouter());
 		entityCapsManager_ = new EntityCapsManager(capsManager_, client_);
 
 		nickResolver_ = new NickResolver(this->jid_.toBare(), xmppRoster_, vcardManager_, mucRegistry_);
 
-		rosterController_ = new RosterController(jid_, xmppRoster_, avatarManager_, mainWindowFactory_, nickResolver_, presenceOracle_, eventController_, uiEventStream_, client_);
+		rosterController_ = new RosterController(jid_, xmppRoster_, avatarManager_, mainWindowFactory_, nickResolver_, presenceOracle_, eventController_, uiEventStream_, client_->getIQRouter());
 		rosterController_->onChangeStatusRequest.connect(boost::bind(&MainController::handleChangeStatusRequest, this, _1, _2));
 		rosterController_->onSignOutRequest.connect(boost::bind(&MainController::signOut, this));
 
-		chatsManager_ = new ChatsManager(jid_, client_, client_, eventController_, chatWindowFactory_, nickResolver_, presenceOracle_, serverDiscoInfo_, presenceSender_, uiEventStream_, chatListWindowFactory_, useDelayForLatency_, &timerFactory_, mucRegistry_);
+		chatsManager_ = new ChatsManager(jid_, client_, client_->getIQRouter(), eventController_, chatWindowFactory_, nickResolver_, presenceOracle_, serverDiscoInfo_, presenceSender_, uiEventStream_, chatListWindowFactory_, useDelayForLatency_, &timerFactory_, mucRegistry_);
 		client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1));
 		chatsManager_->setAvatarManager(avatarManager_);
 
-		xmppRosterController_ = new XMPPRosterController(client_, xmppRoster_);
+		xmppRosterController_ = new XMPPRosterController(client_->getIQRouter(), xmppRoster_);
 
 		eventWindowController_ = new EventWindowController(eventController_, eventWindowFactory_);
 
-		clientVersionResponder_ = new SoftwareVersionResponder(CLIENT_NAME, buildVersion, client_);
+		clientVersionResponder_ = new SoftwareVersionResponder(CLIENT_NAME, buildVersion, client_->getIQRouter());
 		loginWindow_->morphInto(rosterController_->getWindow());
 
 		DiscoInfo discoInfo;
@@ -268,17 +268,17 @@ void MainController::handleConnected() {
 		discoInfo.addFeature("urn:xmpp:sec-label:0");
 		capsInfo_ = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator(CLIENT_NODE).generateCapsInfo(discoInfo)));
 
-		discoResponder_ = new DiscoInfoResponder(client_);
+		discoResponder_ = new DiscoInfoResponder(client_->getIQRouter());
 		discoResponder_->setDiscoInfo(discoInfo);
 		discoResponder_->setDiscoInfo(capsInfo_->getNode() + "#" + capsInfo_->getVersion(), discoInfo);
 		serverDiscoInfo_ = boost::shared_ptr<DiscoInfo>(new DiscoInfo());
 
-		mucSearchController_ = new MUCSearchController(jid_, uiEventStream_, mucSearchWindowFactory_, client_);
+		mucSearchController_ = new MUCSearchController(jid_, uiEventStream_, mucSearchWindowFactory_, client_->getIQRouter());
 	}
 	
 	xmppRosterController_->requestRoster();
 
-	boost::shared_ptr<GetDiscoInfoRequest> discoInfoRequest(new GetDiscoInfoRequest(JID(), client_));
+	boost::shared_ptr<GetDiscoInfoRequest> discoInfoRequest(new GetDiscoInfoRequest(JID(), client_->getIQRouter()));
 	discoInfoRequest->onResponse.connect(boost::bind(&MainController::handleServerDiscoInfoResponse, this, _1, _2));
 	discoInfoRequest->send();
 
diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp
index bf651cc..13e7a9b 100644
--- a/Swiften/Client/Client.cpp
+++ b/Swiften/Client/Client.cpp
@@ -17,11 +17,12 @@
 #include "Swiften/Network/BoostTimerFactory.h"
 #include "Swiften/TLS/PKCS12Certificate.h"
 #include "Swiften/Session/BasicSessionStream.h"
+#include "Swiften/Queries/IQRouter.h"
 
 namespace Swift {
 
-Client::Client(const JID& jid, const String& password) :
-		IQRouter(this), jid_(jid), password_(password) {
+Client::Client(const JID& jid, const String& password) : jid_(jid), password_(password) {
+	iqRouter_ = new IQRouter(this);
 	connectionFactory_ = new BoostConnectionFactory(&MainBoostIOServiceThread::getInstance().getIOService());
 	timerFactory_ = new BoostTimerFactory(&MainBoostIOServiceThread::getInstance().getIOService());
 	tlsLayerFactory_ = new PlatformTLSLayerFactory();
@@ -34,6 +35,7 @@ Client::~Client() {
 	delete tlsLayerFactory_;
 	delete timerFactory_;
 	delete connectionFactory_;
+	delete iqRouter_;
 }
 
 bool Client::isAvailable() {
diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h
index 1023108..cb07036 100644
--- a/Swiften/Client/Client.h
+++ b/Swiften/Client/Client.h
@@ -20,18 +20,18 @@
 #include "Swiften/Base/String.h"
 #include "Swiften/Base/IDGenerator.h"
 #include "Swiften/Client/StanzaChannel.h"
-#include "Swiften/Queries/IQRouter.h"
 #include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
 #include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h"
 
 namespace Swift {
+	class IQRouter;
 	class TLSLayerFactory;
 	class ConnectionFactory;
 	class TimerFactory;
 	class ClientSession;
 	class BasicSessionStream;
 
-	class Client : public StanzaChannel, public IQRouter, public boost::bsignals::trackable {
+	class Client : public StanzaChannel, public boost::bsignals::trackable {
 		public:
 			Client(const JID& jid, const String& password);
 			~Client();
@@ -50,6 +50,10 @@ namespace Swift {
 			virtual void sendMessage(boost::shared_ptr<Message>);
 			virtual void sendPresence(boost::shared_ptr<Presence>);
 
+			IQRouter* getIQRouter() const {
+				return iqRouter_;
+			}
+
 		public:
 			boost::signal<void (const ClientError&)> onError;
 			boost::signal<void ()> onConnected;
@@ -75,6 +79,7 @@ namespace Swift {
 			JID jid_;
 			String password_;
 			IDGenerator idGenerator_;
+			IQRouter* iqRouter_;
 			Connector::ref connector_;
 			ConnectionFactory* connectionFactory_;
 			TimerFactory* timerFactory_;
diff --git a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
index 049802f..af08a9c 100644
--- a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
+++ b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
@@ -41,7 +41,7 @@ void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> /*info*/, const
 
 void handleConnected() {
 	exitCode = NO_RESPONSE;
-	boost::shared_ptr<GetDiscoInfoRequest> discoInfoRequest(new GetDiscoInfoRequest(JID(), client));
+	boost::shared_ptr<GetDiscoInfoRequest> discoInfoRequest(new GetDiscoInfoRequest(JID(), client->getIQRouter()));
 	discoInfoRequest->onResponse.connect(handleServerDiscoInfoResponse);
 	discoInfoRequest->send();
 }
diff --git a/Swiften/Examples/EchoBot/EchoBot.cpp b/Swiften/Examples/EchoBot/EchoBot.cpp
index 1c576c9..0474287 100644
--- a/Swiften/Examples/EchoBot/EchoBot.cpp
+++ b/Swiften/Examples/EchoBot/EchoBot.cpp
@@ -29,7 +29,7 @@ class EchoBot {
 
 	private:
 		void handleConnected() {
-			shared_ptr<GetRosterRequest> rosterRequest(new GetRosterRequest(client));
+			shared_ptr<GetRosterRequest> rosterRequest(new GetRosterRequest(client->getIQRouter()));
 			rosterRequest->onResponse.connect(bind(&EchoBot::handleRosterReceived, this, _2));
 			rosterRequest->send();
 		}
-- 
cgit v0.10.2-6-g49f6