QXmpp Version: 0.9.3
QXmppStream.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 QXMPPSTREAM_H
27#define QXMPPSTREAM_H
28
29#include <QAbstractSocket>
30#include <QObject>
31#include "QXmppLogger.h"
32
33class QDomElement;
34class QSslSocket;
35class QXmppStanza;
36class QXmppStreamPrivate;
37
40
41class QXMPP_EXPORT QXmppStream : public QXmppLoggable
42{
43 Q_OBJECT
44
45public:
46 QXmppStream(QObject *parent);
48
49 virtual bool isConnected() const;
50 bool sendPacket(const QXmppStanza&);
51
52signals:
54 void connected();
55
58
59protected:
60 // Access to underlying socket
61 QSslSocket *socket() const;
62 void setSocket(QSslSocket *socket);
63
64 // Overridable methods
65 virtual void handleStart();
66
70 virtual void handleStanza(const QDomElement &element) = 0;
71
75 virtual void handleStream(const QDomElement &element) = 0;
76
77public slots:
78 virtual void disconnectFromHost();
79 virtual bool sendData(const QByteArray&);
80
81private slots:
82 void _q_socketConnected();
83 void _q_socketEncrypted();
84 void _q_socketError(QAbstractSocket::SocketError error);
85 void _q_socketReadyRead();
86
87private:
88 QXmppStreamPrivate * const d;
89};
90
91#endif // QXMPPSTREAM_H
The QXmppLoggable class represents a source of logging messages.
Definition: QXmppLogger.h:112
The QXmppStanza class is the base class for all XMPP stanzas.
Definition: QXmppStanza.h:91
The QXmppStream class is the base class for all XMPP streams.
Definition: QXmppStream.h:42
void connected()
This signal is emitted when the stream is connected.
void disconnected()
This signal is emitted when the stream is disconnected.
virtual void handleStream(const QDomElement &element)=0
virtual void handleStanza(const QDomElement &element)=0