QXmpp  Version: 1.15.1
Stream.h
1 // SPDX-FileCopyrightText: 2024 Linus Jahn <lnj@kaidan.im>
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 
5 #ifndef STREAM_H
6 #define STREAM_H
7 
8 #include "QXmppConstants_p.h"
9 
10 #include <optional>
11 
12 #include <QMetaType>
13 #include <QString>
14 
15 class QDomElement;
16 class QXmlStreamReader;
17 namespace QXmpp::Private {
18 class XmlWriter;
19 }
20 
21 namespace QXmpp::Private {
22 
23 struct StreamOpen {
24  static StreamOpen fromXml(QXmlStreamReader &reader);
25  void toXml(XmlWriter &) const;
26 
27  QString to;
28  QString from;
29  QString id;
30  QString version;
31  QString xmlns;
32  QString xmlLang;
33 };
34 
35 struct StarttlsRequest {
36  static constexpr std::tuple XmlTag = { u"starttls", ns_tls };
37  static std::optional<StarttlsRequest> fromDom(const QDomElement &);
38  void toXml(XmlWriter &) const;
39 };
40 
41 struct StarttlsProceed {
42  static constexpr std::tuple XmlTag = { u"proceed", ns_tls };
43  static std::optional<StarttlsProceed> fromDom(const QDomElement &);
44  void toXml(XmlWriter &) const;
45 };
46 
47 struct BindElement {
48  QString jid;
49  QString resource;
50 
51  static constexpr std::tuple XmlTag = { u"bind", ns_bind };
52  static std::optional<BindElement> fromDom(const QDomElement &el);
53  void toXml(XmlWriter &w) const;
54 };
55 
56 struct CsiActive {
57  static constexpr std::tuple XmlTag = { u"active", ns_csi };
58  void toXml(XmlWriter &) const;
59 };
60 
61 struct CsiInactive {
62  static constexpr std::tuple XmlTag = { u"inactive", ns_csi };
63  void toXml(XmlWriter &) const;
64 };
65 
66 } // namespace QXmpp::Private
67 
68 Q_DECLARE_METATYPE(QXmpp::Private::StreamOpen)
69 
70 #endif // STREAM_H
Definition: Algorithms.h:14