QXmpp  Version:0.4.0
QXmppOutgoingClient.h
00001 /*
00002  * Copyright (C) 2008-2011 The QXmpp developers
00003  *
00004  * Authors:
00005  *  Manjeet Dahiya
00006  *  Jeremy Lainé
00007  *
00008  * Source:
00009  *  http://code.google.com/p/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 QXmppOutgoingClient : public QXmppStream
00048 {
00049     Q_OBJECT
00050 
00051 public:
00052     QXmppOutgoingClient(QObject *parent);
00053     ~QXmppOutgoingClient();
00054 
00055     void connectToHost();
00056     bool isConnected() const;
00057 
00058     QSslSocket *socket() const { return QXmppStream::socket(); };
00059     QXmppStanza::Error::Condition xmppStreamError();
00060 
00061     QXmppConfiguration& configuration();
00062 
00063 signals:
00065     void error(QXmppClient::Error);
00066 
00068     void elementReceived(const QDomElement &element, bool &handled);
00069 
00071     void presenceReceived(const QXmppPresence&);
00072 
00074     void messageReceived(const QXmppMessage&);
00075 
00077     void iqReceived(const QXmppIq&);
00078 
00079 protected:
00081     // Overridable methods
00082     virtual void handleStart();
00083     virtual void handleStanza(const QDomElement &element);
00084     virtual void handleStream(const QDomElement &element);
00086 
00087 private slots:
00088     void _q_dnsLookupFinished();
00089     void socketError(QAbstractSocket::SocketError);
00090     void socketSslErrors(const QList<QSslError>&);
00091 
00092     void pingStart();
00093     void pingStop();
00094     void pingSend();
00095     void pingTimeout();
00096 
00097 private:
00098     void sendAuthDigestMD5ResponseStep1(const QString& challenge);
00099     void sendAuthDigestMD5ResponseStep2(const QString& challenge);
00100     void sendAuthXFacebookResponse(const QString& challenge);
00101     void sendNonSASLAuth(bool plaintext);
00102     void sendNonSASLAuthQuery();
00103 
00104     QXmppOutgoingClientPrivate * const d;
00105 };
00106 
00107 #endif // QXMPPOUTGOINGCLIENT_H
 All Classes Functions Enumerations Enumerator Properties