QXmpp  Version:1.3.1
QXmppOutgoingClient.h
1 /*
2  * Copyright (C) 2008-2020 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 #ifndef QXMPPOUTGOINGCLIENT_H
26 #define QXMPPOUTGOINGCLIENT_H
27 
28 #include "QXmppClient.h"
29 #include "QXmppStanza.h"
30 #include "QXmppStream.h"
31 
32 class QDomElement;
33 class QSslError;
34 
35 class QXmppConfiguration;
36 class QXmppPresence;
37 class QXmppIq;
38 class QXmppMessage;
39 
40 class QXmppOutgoingClientPrivate;
41 
45 
46 class QXMPP_EXPORT QXmppOutgoingClient : public QXmppStream
47 {
48  Q_OBJECT
49 
50 public:
51  QXmppOutgoingClient(QObject *parent);
52  ~QXmppOutgoingClient() override;
53 
54  void connectToHost();
55  bool isAuthenticated() const;
56  bool isConnected() const override;
57  bool isClientStateIndicationEnabled() const;
58 
59  QSslSocket *socket() const { return QXmppStream::socket(); };
60  QXmppStanza::Error::Condition xmppStreamError();
61 
62  QXmppConfiguration &configuration();
63 
64 Q_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  void handleStart() override;
87  void handleStanza(const QDomElement &element) override;
88  void handleStream(const QDomElement &element) override;
90 
91 public Q_SLOTS:
92  void disconnectFromHost() override;
93 
94 private Q_SLOTS:
95  void _q_dnsLookupFinished();
96  void _q_socketDisconnected();
97  void socketError(QAbstractSocket::SocketError);
98  void socketSslErrors(const QList<QSslError> &);
99 
100  void pingStart();
101  void pingStop();
102  void pingSend();
103  void pingTimeout();
104 
105 private:
106  friend class QXmppOutgoingClientPrivate;
107  QXmppOutgoingClientPrivate *const d;
108 };
109 
110 #endif // QXMPPOUTGOINGCLIENT_H
QXmppStream::handleStart
virtual void handleStart()
Definition: QXmppStream.cpp:119
QXmppStream::disconnectFromHost
virtual void disconnectFromHost()
Definition: QXmppStream.cpp:99
QXmppPresence
The QXmppPresence class represents an XMPP presence stanza.
Definition: QXmppPresence.h:35
QXmppStream::socket
QSslSocket * socket() const
Definition: QXmppStream.cpp:174
QXmppStream::handleStanza
virtual void handleStanza(const QDomElement &element)=0
QXmppStream::isConnected
virtual bool isConnected() const
Definition: QXmppStream.cpp:129
QXmppOutgoingClient
The QXmppOutgoingClient class represents an outgoing XMPP stream to an XMPP server.
Definition: QXmppOutgoingClient.h:46
QXmppClient::Error
Error
Definition: QXmppClient.h:106
QXmppConfiguration
The QXmppConfiguration class holds configuration options.
Definition: QXmppConfiguration.h:47
QXmppStream
The QXmppStream class is the base class for all XMPP streams.
Definition: QXmppStream.h:41
QXmppStanza::Error::Condition
Condition
A detailed condition of the error.
Definition: QXmppStanza.h:121
QXmppStream::handleStream
virtual void handleStream(const QDomElement &element)=0
QXmppIq
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:41
QXmppMessage
The QXmppMessage class represents an XMPP message.
Definition: QXmppMessage.h:42