summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Client/Client.h')
-rw-r--r--Swiften/Client/Client.h99
1 files changed, 2 insertions, 97 deletions
diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h
index 4319eaa..7609eb8 100644
--- a/Swiften/Client/Client.h
+++ b/Swiften/Client/Client.h
@@ -6,106 +6,11 @@
#pragma once
-#include "Swiften/Base/boost_bsignals.h"
-#include <boost/shared_ptr.hpp>
-
-#include "Swiften/Network/PlatformDomainNameResolver.h"
-#include "Swiften/Network/Connector.h"
-#include "Swiften/Base/Error.h"
-#include "Swiften/Client/ClientSession.h"
-#include "Swiften/Client/ClientError.h"
-#include "Swiften/Elements/Presence.h"
-#include "Swiften/Elements/Message.h"
-#include "Swiften/JID/JID.h"
-#include "Swiften/Base/String.h"
-#include "Swiften/Client/StanzaChannel.h"
-#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
-#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h"
-#include "Swiften/Base/Shared.h"
-#include "Swiften/Client/ClientSessionStanzaChannel.h"
+#include "Swiften/Client/CoreClient.h"
namespace Swift {
- class IQRouter;
- class TLSLayerFactory;
- class ConnectionFactory;
- class TimerFactory;
- class ClientSession;
- class BasicSessionStream;
-
- class Client {
+ class Client : public CoreClient {
public:
Client(const JID& jid, const String& password);
- ~Client();
-
- void setCertificate(const String& certificate);
-
- void connect();
- void connect(const JID& jid);
- void connect(const String& host);
- void disconnect();
-
- void sendMessage(boost::shared_ptr<Message>);
- void sendPresence(boost::shared_ptr<Presence>);
-
- IQRouter* getIQRouter() const {
- return iqRouter_;
- }
-
- StanzaChannel* getStanzaChannel() const {
- return stanzaChannel_;
- }
-
- bool isAvailable() const {
- return stanzaChannel_->isAvailable();
- }
-
- /**
- * Returns the JID of the client.
- * After the session was initialized, this returns the bound JID.
- */
- const JID& getJID() const {
- if (session_) {
- return session_->getLocalJID();
- }
- else {
- return jid_;
- }
- }
-
- public:
- boost::signal<void (const ClientError&)> onError;
- boost::signal<void ()> onConnected;
- boost::signal<void (const String&)> onDataRead;
- boost::signal<void (const String&)> onDataWritten;
-
- boost::signal<void (boost::shared_ptr<Message>)> onMessageReceived;
- boost::signal<void (boost::shared_ptr<Presence>) > onPresenceReceived;
- boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaAcked;
-
- private:
- void handleConnectorFinished(boost::shared_ptr<Connection>);
- void handleStanzaChannelAvailableChanged(bool available);
- void handleSessionFinished(boost::shared_ptr<Error>);
- void handleNeedCredentials();
- void handleDataRead(const String&);
- void handleDataWritten(const String&);
-
- private:
- PlatformDomainNameResolver resolver_;
- JID jid_;
- String password_;
- ClientSessionStanzaChannel* stanzaChannel_;
- IQRouter* iqRouter_;
- Connector::ref connector_;
- ConnectionFactory* connectionFactory_;
- TimerFactory* timerFactory_;
- TLSLayerFactory* tlsLayerFactory_;
- FullPayloadParserFactoryCollection payloadParserFactories_;
- FullPayloadSerializerCollection payloadSerializers_;
- boost::shared_ptr<Connection> connection_;
- boost::shared_ptr<BasicSessionStream> sessionStream_;
- boost::shared_ptr<ClientSession> session_;
- String certificate_;
- bool disconnectRequested_;
};
}