QXmpp  Version:0.9.3
QXmppOutgoingClient.h
00001 /*
00002  * Copyright (C) 2008-2014 The QXmpp developers
00003  *
00004  * Authors:
00005  *  Manjeet Dahiya
00006  *  Jeremy Lainé
00007  *
00008  * Source:
00009  *  https://github.com/qxmpp-project/qxmpp
00010  *
00011  * This file is a part of QXmpp library.
00012  *
00013  * This library is free software; you can redistribute it and/or
00014  * modify it under the terms of the GNU Lesser General Public
00015  * License as published by the Free Software Foundation; either
00016  * version 2.1 of the License, or (at your option) any later version.
00017  *
00018  * This library is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021  * Lesser General Public License for more details.
00022  *
00023  */
00024 
00025 
00026 #ifndef QXMPPOUTGOINGCLIENT_H
00027 #define QXMPPOUTGOINGCLIENT_H
00028 
00029 #include "QXmppClient.h"
00030 #include "QXmppStanza.h"
00031 #include "QXmppStream.h"
00032 
00033 class QDomElement;
00034 class QSslError;
00035 
00036 class QXmppConfiguration;
00037 class QXmppPresence;
00038 class QXmppIq;
00039 class QXmppMessage;
00040 
00041 class QXmppOutgoingClientPrivate;
00042 
00046 
00047 class QXMPP_EXPORT QXmppOutgoingClient : public QXmppStream
00048 {
00049     Q_OBJECT
00050 
00051 public:
00052     QXmppOutgoingClient(QObject *parent);
00053     ~QXmppOutgoingClient();
00054 
00055     void connectToHost();
00056     bool isAuthenticated() const;
00057     bool isConnected() const;
00058 
00059     QSslSocket *socket() const { return QXmppStream::socket(); };
00060     QXmppStanza::Error::Condition xmppStreamError();
00061 
00062     QXmppConfiguration& configuration();
00063 
00064 signals:
00066     void error(QXmppClient::Error);
00067 
00069     void elementReceived(const QDomElement &element, bool &handled);
00070 
00072     void presenceReceived(const QXmppPresence&);
00073 
00075     void messageReceived(const QXmppMessage&);
00076 
00078     void iqReceived(const QXmppIq&);
00079 
00081     void sslErrors(const QList<QSslError> &errors);
00082 
00083 protected:
00085     // Overridable methods
00086     virtual void handleStart();
00087     virtual void handleStanza(const QDomElement &element);
00088     virtual void handleStream(const QDomElement &element);
00090 
00091 private slots:
00092     void _q_dnsLookupFinished();
00093     void _q_socketDisconnected();
00094     void socketError(QAbstractSocket::SocketError);
00095     void socketSslErrors(const QList<QSslError>&);
00096 
00097     void pingStart();
00098     void pingStop();
00099     void pingSend();
00100     void pingTimeout();
00101 
00102 private:
00103     void sendNonSASLAuth(bool plaintext);
00104     void sendNonSASLAuthQuery();
00105 
00106     friend class QXmppOutgoingClientPrivate;
00107     QXmppOutgoingClientPrivate * const d;
00108 };
00109 
00110 #endif // QXMPPOUTGOINGCLIENT_H
 All Classes Functions Enumerations Enumerator Properties