QXmpp  Version:1.0.0
QXmppOutgoingClient.h
1 /*
2  * Copyright (C) 2008-2019 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  bool isClientStateIndicationEnabled() const;
59 
60  QSslSocket *socket() const { return QXmppStream::socket(); };
61  QXmppStanza::Error::Condition xmppStreamError();
62 
63  QXmppConfiguration& configuration();
64 
65 signals:
67  void error(QXmppClient::Error);
68 
70  void elementReceived(const QDomElement &element, bool &handled);
71 
73  void presenceReceived(const QXmppPresence&);
74 
76  void messageReceived(const QXmppMessage&);
77 
79  void iqReceived(const QXmppIq&);
80 
82  void sslErrors(const QList<QSslError> &errors);
83 
84 protected:
86  // Overridable methods
87  virtual void handleStart();
88  virtual void handleStanza(const QDomElement &element);
89  virtual void handleStream(const QDomElement &element);
91 
92 public slots:
93  virtual void disconnectFromHost();
94 
95 private slots:
96  void _q_dnsLookupFinished();
97  void _q_socketDisconnected();
98  void socketError(QAbstractSocket::SocketError);
99  void socketSslErrors(const QList<QSslError>&);
100 
101  void pingStart();
102  void pingStop();
103  void pingSend();
104  void pingTimeout();
105 
106 private:
107  friend class QXmppOutgoingClientPrivate;
108  QXmppOutgoingClientPrivate * const d;
109 };
110 
111 #endif // QXMPPOUTGOINGCLIENT_H
QXmppStream::handleStart
virtual void handleStart()
Definition: QXmppStream.cpp:113
QXmppStream::disconnectFromHost
virtual void disconnectFromHost()
Definition: QXmppStream.cpp:94
QXmppPresence
The QXmppPresence class represents an XMPP presence stanza.
Definition: QXmppPresence.h:36
QXmppStream::socket
QSslSocket * socket() const
Definition: QXmppStream.cpp:166
QXmppStream::handleStanza
virtual void handleStanza(const QDomElement &element)=0
QXmppStream::isConnected
virtual bool isConnected() const
Definition: QXmppStream.cpp:123
QXmppOutgoingClient
The QXmppOutgoingClient class represents an outgoing XMPP stream to an XMPP server.
Definition: QXmppOutgoingClient.h:47
QXmppClient::Error
Error
Definition: QXmppClient.h:90
QXmppConfiguration
The QXmppConfiguration class holds configuration options.
Definition: QXmppConfiguration.h:48
QXmppStream
The QXmppStream class is the base class for all XMPP streams.
Definition: QXmppStream.h:41
QXmppStream::handleStream
virtual void handleStream(const QDomElement &element)=0
QXmppIq
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:42
QXmppMessage
The QXmppMessage class represents an XMPP message.
Definition: QXmppMessage.h:38