From 1c1056b42d092f943735a1fe033f295ac5b27a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Thu, 15 Aug 2013 16:22:38 +0200 Subject: Make (Core)Component constructor consistent with (Core)Client. Change-Id: I268e15b6fbf54d9b188a699d26d2bb1042174f5f diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp index 397bc21..a6e6ca0 100644 --- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp +++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2013 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -14,9 +14,8 @@ using namespace boost; class EchoComponent { public: - EchoComponent(EventLoop* eventLoop, NetworkFactories* networkFactories) : jid("echo.wonderland.lit") { - component = new Component(eventLoop, networkFactories, - jid, "EchoSecret"); + EchoComponent(NetworkFactories* networkFactories) : jid("echo.wonderland.lit") { + component = new Component(jid, "EchoSecret", networkFactories); component->onConnected.connect(bind(&EchoComponent::handleConnected, this)); component->onMessageReceived.connect( bind(&EchoComponent::handleMessageReceived, this, _1)); @@ -62,7 +61,7 @@ int main(int, char**) { SimpleEventLoop eventLoop; BoostNetworkFactories networkFactories(&eventLoop); - EchoComponent bot(&eventLoop, &networkFactories); + EchoComponent bot(&networkFactories); eventLoop.run(); return 0; diff --git a/Swiften/Client/CoreClient.h b/Swiften/Client/CoreClient.h index 16f7cb1..eadfd9d 100644 --- a/Swiften/Client/CoreClient.h +++ b/Swiften/Client/CoreClient.h @@ -50,7 +50,6 @@ namespace Swift { public: /** * Constructs a client for the given JID with the given password. - * The given eventLoop will be used to post events to. */ CoreClient(const JID& jid, const SafeByteArray& password, NetworkFactories* networkFactories); ~CoreClient(); diff --git a/Swiften/Component/Component.cpp b/Swiften/Component/Component.cpp index af378a7..a53f514 100644 --- a/Swiften/Component/Component.cpp +++ b/Swiften/Component/Component.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2013 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -10,7 +10,7 @@ namespace Swift { -Component::Component(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const std::string& secret) : CoreComponent(eventLoop, networkFactories, jid, secret) { +Component::Component(const JID& jid, const std::string& secret, NetworkFactories* networkFactories) : CoreComponent(jid, secret, networkFactories) { softwareVersionResponder = new SoftwareVersionResponder(getIQRouter()); softwareVersionResponder->start(); } diff --git a/Swiften/Component/Component.h b/Swiften/Component/Component.h index f3ae9e8..3ead1a5 100644 --- a/Swiften/Component/Component.h +++ b/Swiften/Component/Component.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2013 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -20,7 +20,7 @@ namespace Swift { */ class SWIFTEN_API Component : public CoreComponent { public: - Component(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const std::string& secret); + Component(const JID& jid, const std::string& secret, NetworkFactories* networkFactories); ~Component(); /** diff --git a/Swiften/Component/CoreComponent.cpp b/Swiften/Component/CoreComponent.cpp index de3b66e..eabe3f6 100644 --- a/Swiften/Component/CoreComponent.cpp +++ b/Swiften/Component/CoreComponent.cpp @@ -20,7 +20,7 @@ namespace Swift { -CoreComponent::CoreComponent(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const std::string& secret) : eventLoop(eventLoop), networkFactories(networkFactories), jid_(jid), secret_(secret), disconnectRequested_(false) { +CoreComponent::CoreComponent(const JID& jid, const std::string& secret, NetworkFactories* networkFactories) : networkFactories(networkFactories), jid_(jid), secret_(secret), disconnectRequested_(false) { stanzaChannel_ = new ComponentSessionStanzaChannel(); stanzaChannel_->onMessageReceived.connect(boost::ref(onMessageReceived)); stanzaChannel_->onPresenceReceived.connect(boost::ref(onPresenceReceived)); diff --git a/Swiften/Component/CoreComponent.h b/Swiften/Component/CoreComponent.h index 6f5231f..63b68f6 100644 --- a/Swiften/Component/CoreComponent.h +++ b/Swiften/Component/CoreComponent.h @@ -43,7 +43,7 @@ namespace Swift { */ class SWIFTEN_API CoreComponent : public Entity { public: - CoreComponent(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const std::string& secret); + CoreComponent(const JID& jid, const std::string& secret, NetworkFactories* networkFactories); ~CoreComponent(); void connect(const std::string& host, int port); @@ -88,7 +88,6 @@ namespace Swift { void handleDataWritten(const SafeByteArray&); private: - EventLoop* eventLoop; NetworkFactories* networkFactories; JID jid_; std::string secret_; diff --git a/Swiften/Component/UnitTest/ComponentSessionTest.cpp b/Swiften/Component/UnitTest/ComponentSessionTest.cpp index 97fde63..0533645 100644 --- a/Swiften/Component/UnitTest/ComponentSessionTest.cpp +++ b/Swiften/Component/UnitTest/ComponentSessionTest.cpp @@ -213,7 +213,6 @@ class ComponentSessionTest : public CppUnit::TestFixture { boost::shared_ptr server; bool sessionFinishedReceived; - bool needCredentials; boost::shared_ptr sessionFinishedError; boost::shared_ptr crypto; }; -- cgit v0.10.2-6-g49f6