QXmpp Version:0.3.91
|
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 class QXmppSrvInfo; 00041 00042 class QXmppOutgoingClientPrivate; 00043 00047 00048 class QXmppOutgoingClient : public QXmppStream 00049 { 00050 Q_OBJECT 00051 00052 public: 00053 QXmppOutgoingClient(QObject *parent); 00054 ~QXmppOutgoingClient(); 00055 00056 void connectToHost(); 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 00080 protected: 00082 // Overridable methods 00083 virtual void handleStart(); 00084 virtual void handleStanza(const QDomElement &element); 00085 virtual void handleStream(const QDomElement &element); 00087 00088 private slots: 00089 void connectToHost(const QXmppSrvInfo &serviceInfo); 00090 void socketError(QAbstractSocket::SocketError); 00091 void socketSslErrors(const QList<QSslError>&); 00092 00093 void pingStart(); 00094 void pingStop(); 00095 void pingSend(); 00096 void pingTimeout(); 00097 00098 private: 00099 void sendAuthDigestMD5ResponseStep1(const QString& challenge); 00100 void sendAuthDigestMD5ResponseStep2(const QString& challenge); 00101 void sendAuthXFacebookResponse(const QString& challenge); 00102 void sendNonSASLAuth(bool plaintext); 00103 void sendNonSASLAuthQuery(); 00104 00105 QXmppOutgoingClientPrivate * const d; 00106 }; 00107 00108 #endif // QXMPPOUTGOINGCLIENT_H