QXmpp  Version:0.9.1
QXmppOutgoingClient.h
1 /*
2  * Copyright (C) 2008-2014 The QXmpp developers
3  *
4  * Authors:
5  * Manjeet Dahiya
6  * Jeremy LainĂ©
7  *
8  * Source:
9  * https://github.com/qxmpp-project/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 isAuthenticated() const;
57  bool isConnected() const;
58 
59  QSslSocket *socket() const { return QXmppStream::socket(); };
60  QXmppStanza::Error::Condition xmppStreamError();
61 
62  QXmppConfiguration& configuration();
63 
64 signals:
66  void error(QXmppClient::Error);
67 
69  void elementReceived(const QDomElement &element, bool &handled);
70 
72  void presenceReceived(const QXmppPresence&);
73 
75  void messageReceived(const QXmppMessage&);
76 
78  void iqReceived(const QXmppIq&);
79 
81  void sslErrors(const QList<QSslError> &errors);
82 
83 protected:
85  // Overridable methods
86  virtual void handleStart();
87  virtual void handleStanza(const QDomElement &element);
88  virtual void handleStream(const QDomElement &element);
90 
91 private slots:
92  void _q_dnsLookupFinished();
93  void _q_socketDisconnected();
94  void socketError(QAbstractSocket::SocketError);
95  void socketSslErrors(const QList<QSslError>&);
96 
97  void pingStart();
98  void pingStop();
99  void pingSend();
100  void pingTimeout();
101 
102 private:
103  void sendNonSASLAuth(bool plaintext);
104  void sendNonSASLAuthQuery();
105 
106  friend class QXmppOutgoingClientPrivate;
107  QXmppOutgoingClientPrivate * const d;
108 };
109 
110 #endif // QXMPPOUTGOINGCLIENT_H
The QXmppConfiguration class holds configuration options.
Definition: QXmppConfiguration.h:48
virtual bool isConnected() const
Definition: QXmppStream.cpp:114
virtual void handleStanza(const QDomElement &element)=0
Error
Definition: QXmppClient.h:90
QSslSocket * socket() const
Definition: QXmppStream.cpp:150
The QXmppStream class is the base class for all XMPP streams.
Definition: QXmppStream.h:41
virtual void handleStream(const QDomElement &element)=0
The QXmppPresence class represents an XMPP presence stanza.
Definition: QXmppPresence.h:36
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:42
The QXmppMessage class represents an XMPP message.
Definition: QXmppMessage.h:38
The QXmppOutgoingClient class represents an outgoing XMPP stream to an XMPP server.
Definition: QXmppOutgoingClient.h:47
virtual void handleStart()
Definition: QXmppStream.cpp:105