QXmpp  Version:0.4.92
 All Classes Functions Enumerations Enumerator Properties Groups
QXmppOutgoingClient.h
1 /*
2  * Copyright (C) 2008-2011 The QXmpp developers
3  *
4  * Authors:
5  * Manjeet Dahiya
6  * Jeremy LainĂ©
7  *
8  * Source:
9  * http://code.google.com/p/qxmpp
10  *
11  * This file is a part of QXmpp library.
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Lesser General Public
15  * License as published by the Free Software Foundation; either
16  * version 2.1 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  * Lesser General Public License for more details.
22  *
23  */
24 
25 
26 #ifndef QXMPPOUTGOINGCLIENT_H
27 #define QXMPPOUTGOINGCLIENT_H
28 
29 #include "QXmppClient.h"
30 #include "QXmppStanza.h"
31 #include "QXmppStream.h"
32 
33 class QDomElement;
34 class QSslError;
35 
36 class QXmppConfiguration;
37 class QXmppPresence;
38 class QXmppIq;
39 class QXmppMessage;
40 
41 class QXmppOutgoingClientPrivate;
42 
46 
47 class QXMPP_EXPORT QXmppOutgoingClient : public QXmppStream
48 {
49  Q_OBJECT
50 
51 public:
52  QXmppOutgoingClient(QObject *parent);
54 
55  void connectToHost();
56  bool isConnected() const;
57 
58  QSslSocket *socket() const { return QXmppStream::socket(); };
59  QXmppStanza::Error::Condition xmppStreamError();
60 
61  QXmppConfiguration& configuration();
62 
63 signals:
65  void error(QXmppClient::Error);
66 
68  void elementReceived(const QDomElement &element, bool &handled);
69 
71  void presenceReceived(const QXmppPresence&);
72 
74  void messageReceived(const QXmppMessage&);
75 
77  void iqReceived(const QXmppIq&);
78 
79 protected:
81  // Overridable methods
82  virtual void handleStart();
83  virtual void handleStanza(const QDomElement &element);
84  virtual void handleStream(const QDomElement &element);
86 
87 private slots:
88  void _q_dnsLookupFinished();
89  void socketError(QAbstractSocket::SocketError);
90  void socketSslErrors(const QList<QSslError>&);
91 
92  void pingStart();
93  void pingStop();
94  void pingSend();
95  void pingTimeout();
96 
97 private:
98  void sendAuthDigestMD5ResponseStep1(const QString& challenge);
99  void sendAuthDigestMD5ResponseStep2(const QString& challenge);
100  void sendAuthXFacebookResponse(const QString& challenge);
101  void sendNonSASLAuth(bool plaintext);
102  void sendNonSASLAuthQuery();
103 
104  QXmppOutgoingClientPrivate * const d;
105 };
106 
107 #endif // QXMPPOUTGOINGCLIENT_H