QXmpp Version:0.7.6

- Main Page
- Modules
- Classes
- Files

- File List

All Classes Functions Variables Enumerations Enumerator Properties Groups
QXmppStream.h
1 /*
2 * Copyright (C) 2008-2012 The QXmpp developers
3 *
4 * Authors:
5 * Manjeet Dahiya
6 * Jeremy Lainé
7 *
8 * Source:
9 * http://code.google.com/p/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
33 class QDomElement;
34 class QSslSocket;
35 class QXmppStanza;
36 class QXmppStreamPrivate;
37
40
41 class QXMPP_EXPORT QXmppStream : public QXmppLoggable
42 {
43 Q_OBJECT
44
45 public:
46 QXmppStream(QObject *parent);
47 ~QXmppStream();
48
49 virtual bool isConnected() const;
50 bool sendPacket(const QXmppStanza&);
51
52 signals:
54 void connected();
55
57 void disconnected();
58
59 protected:
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
77 public slots:
78 virtual void disconnectFromHost();
79 virtual bool sendData(const QByteArray&);
80
81 private slots:
82 void _q_socketConnected();
83 void _q_socketEncrypted();
84 void _q_socketError(QAbstractSocket::SocketError error);
85 void _q_socketReadyRead();
86
87 private:
88 QXmppStreamPrivate * const d;
89 };
90
91 #endif // QXMPPSTREAM_H