QXmpp Version: 1.4.0
Loading...
Searching...
No Matches
QXmppOutgoingClient.h
1/*
2 * Copyright (C) 2008-2021 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
32class QDomElement;
33class QSslError;
34
36class QXmppPresence;
37class QXmppIq;
38class QXmppMessage;
39
40class QXmppOutgoingClientPrivate;
41
45
46class QXMPP_EXPORT QXmppOutgoingClient : public QXmppStream
47{
48 Q_OBJECT
49
50public:
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 bool isStreamManagementEnabled() const;
59 bool isStreamResumed() const;
60
61 QSslSocket *socket() const { return QXmppStream::socket(); };
62 QXmppStanza::Error::Condition xmppStreamError();
63
64 QXmppConfiguration &configuration();
65
66Q_SIGNALS:
69
71 void elementReceived(const QDomElement &element, bool &handled);
72
75
78
81 void iqReceived(const QXmppIq &);
82
84 void sslErrors(const QList<QSslError> &errors);
85
86protected:
88 // Overridable methods
89 void handleStart() override;
90 void handleStanza(const QDomElement &element) override;
91 void handleStream(const QDomElement &element) override;
93
94public Q_SLOTS:
95 void disconnectFromHost() override;
96
97private Q_SLOTS:
98 void _q_dnsLookupFinished();
99 void _q_socketDisconnected();
100 void socketError(QAbstractSocket::SocketError);
101 void socketSslErrors(const QList<QSslError> &);
102
103 void pingStart();
104 void pingStop();
105 void pingSend();
106 void pingTimeout();
107
108private:
109 bool setResumeAddress(const QString &address);
110 static std::pair<QString, int> parseHostAddress(const QString &address);
111
112 friend class QXmppOutgoingClientPrivate;
113 friend class tst_QXmppOutgoingClient;
114
115 QXmppOutgoingClientPrivate *const d;
116};
117
118#endif // QXMPPOUTGOINGCLIENT_H
Error
Definition QXmppClient.h:105
The QXmppConfiguration class holds configuration options.
Definition QXmppConfiguration.h:48
The QXmppIq class is the base class for all IQs.
Definition QXmppIq.h:42
The QXmppMessage class represents an XMPP message.
Definition QXmppMessage.h:46
The QXmppOutgoingClient class represents an outgoing XMPP stream to an XMPP server.
Definition QXmppOutgoingClient.h:47
void error(QXmppClient::Error)
This signal is emitted when an error is encountered.
void presenceReceived(const QXmppPresence &)
This signal is emitted when a presence is received.
void messageReceived(const QXmppMessage &)
This signal is emitted when a message is received.
void sslErrors(const QList< QSslError > &errors)
This signal is emitted when SSL errors are encountered.
void elementReceived(const QDomElement &element, bool &handled)
This signal is emitted when an element is received.
void iqReceived(const QXmppIq &)
The QXmppPresence class represents an XMPP presence stanza.
Definition QXmppPresence.h:36
Condition
A detailed condition of the error.
Definition QXmppStanza.h:121
The QXmppStream class is the base class for all XMPP streams.
Definition QXmppStream.h:42
virtual void disconnectFromHost()
Definition QXmppStream.cpp:97
QSslSocket * socket() const
Definition QXmppStream.cpp:184
virtual void handleStart()
Definition QXmppStream.cpp:118
virtual bool isConnected() const
Definition QXmppStream.cpp:128
virtual void handleStream(const QDomElement &element)=0
virtual void handleStanza(const QDomElement &element)=0