QXmpp: QXmppByteStreamIq.h Source File

QXmpp Version: 1.14.2

Loading...
Searching...
No Matches
QXmppByteStreamIq.h
1// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef QXMPPBYTESTREAMIQ_H
6#define QXMPPBYTESTREAMIQ_H
7
8#include "QXmppConstants_p.h"
9#include "QXmppIq.h"
10
11#include <QHostAddress>
12
13 class QXMPP_EXPORT QXmppByteStreamIq : public QXmppIq
14{
15public:
16 enum Mode {
17 None = 0,
18 Tcp,
19 Udp
20 };
21
22 class QXMPP_EXPORT StreamHost
23 {
24 public:
25 QString jid() const;
26 void setJid(const QString &jid);
27
28 QString host() const;
29 void setHost(const QString &host);
30
31 quint16 port() const;
32 void setPort(quint16 port);
33
34 QString zeroconf() const;
35 void setZeroconf(const QString &zeroconf);
36
38 static constexpr std::tuple XmlTag = { u"streamhost", QXmpp::Private::ns_bytestreams };
39 static std::optional<StreamHost> fromDom(const QDomElement &el);
40 void toXml(QXmlStreamWriter *writer) const;
42
43 private:
44 QString m_host;
45 QString m_jid;
46 quint16 m_port;
47 QString m_zeroconf;
48 };
49
50 QXmppByteStreamIq::Mode mode() const;
51 void setMode(QXmppByteStreamIq::Mode mode);
52
53 QString sid() const;
54 void setSid(const QString &sid);
55
56 QString activate() const;
57 void setActivate(const QString &activate);
58
59 QList<QXmppByteStreamIq::StreamHost> streamHosts() const;
60 void setStreamHosts(const QList<QXmppByteStreamIq::StreamHost> &streamHosts);
61
62 QString streamHostUsed() const;
63 void setStreamHostUsed(const QString &jid);
64
66 static constexpr std::tuple PayloadXmlTag = { u"query", QXmpp::Private::ns_bytestreams };
67 [[deprecated("Use QXmpp::isIqElement()")]]
68 static bool isByteStreamIq(const QDomElement &element);
69
70protected:
71 void parseElementFromChild(const QDomElement &element) override;
72 void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
74
75private:
76 Mode m_mode = None;
77 QString m_sid;
78
79 QString m_activate;
80 QList<StreamHost> m_streamHosts;
81 QString m_streamHostUsed;
82};
83
84#endif
QXmppByteStreamIq::StreamHost
Definition QXmppByteStreamIq.h:23
QXmppByteStreamIq::StreamHost::setZeroconf
void setZeroconf(const QString &zeroconf)
Definition QXmppByteStreamIq.cpp:98
QXmppByteStreamIq::StreamHost::setPort
void setPort(quint16 port)
Definition QXmppByteStreamIq.cpp:82
QXmppByteStreamIq::StreamHost::zeroconf
QString zeroconf() const
Definition QXmppByteStreamIq.cpp:90
QXmppByteStreamIq::StreamHost::port
quint16 port() const
Definition QXmppByteStreamIq.cpp:74
QXmppByteStreamIq::StreamHost::setJid
void setJid(const QString &jid)
Definition QXmppByteStreamIq.cpp:66
QXmppByteStreamIq::StreamHost::jid
QString jid() const
Definition QXmppByteStreamIq.cpp:58
QXmppByteStreamIq::StreamHost::setHost
void setHost(const QString &host)
Definition QXmppByteStreamIq.cpp:50
QXmppByteStreamIq::StreamHost::host
QString host() const
Definition QXmppByteStreamIq.cpp:42
QXmppByteStreamIq
Definition QXmppByteStreamIq.h:14
QXmppByteStreamIq::streamHostUsed
QString streamHostUsed() const
Definition QXmppByteStreamIq.cpp:200
QXmppByteStreamIq::setActivate
void setActivate(const QString &activate)
Definition QXmppByteStreamIq.cpp:176
QXmppByteStreamIq::setSid
void setSid(const QString &sid)
Definition QXmppByteStreamIq.cpp:160
QXmppByteStreamIq::setStreamHostUsed
void setStreamHostUsed(const QString &jid)
Definition QXmppByteStreamIq.cpp:208
QXmppByteStreamIq::mode
QXmppByteStreamIq::Mode mode() const
Definition QXmppByteStreamIq.cpp:136
QXmppByteStreamIq::Mode
Mode
Definition QXmppByteStreamIq.h:16
QXmppByteStreamIq::setMode
void setMode(QXmppByteStreamIq::Mode mode)
Definition QXmppByteStreamIq.cpp:144
QXmppByteStreamIq::activate
QString activate() const
Definition QXmppByteStreamIq.cpp:168
QXmppByteStreamIq::streamHosts
QList< QXmppByteStreamIq::StreamHost > streamHosts() const
Definition QXmppByteStreamIq.cpp:184
QXmppByteStreamIq::sid
QString sid() const
Definition QXmppByteStreamIq.cpp:152
QXmppByteStreamIq::setStreamHosts
void setStreamHosts(const QList< QXmppByteStreamIq::StreamHost > &streamHosts)
Definition QXmppByteStreamIq.cpp:192
QXmppIq::QXmppIq
QXmppIq(QXmppIq::Type type=QXmppIq::Get)
Definition QXmppIq.cpp:39
QXmppNonza::toXml
virtual void toXml(QXmlStreamWriter *writer) const =0