QXmpp  Version: 1.7.1
QXmppGlobal.h
1 // SPDX-FileCopyrightText: 2010 Manjeet Dahiya <manjeetdahiya@gmail.com>
2 // SPDX-FileCopyrightText: 2017 Niels Ole Salscheider <niels_ole@salscheider-online.de>
3 // SPDX-FileCopyrightText: 2019 Linus Jahn <lnj@kaidan.im>
4 // SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de>
5 //
6 // SPDX-License-Identifier: LGPL-2.1-or-later
7 
8 #ifndef QXMPPGLOBAL_H
9 #define QXMPPGLOBAL_H
10 
11 #include "qxmpp_export.h"
12 
13 #include <QString>
14 
15 #define QXMPP_AUTOTEST_EXPORT
16 
26 #define QXMPP_VERSION QT_VERSION_CHECK(QXMPP_VERSION_MAJOR, QXMPP_VERSION_MINOR, QXMPP_VERSION_PATCH)
27 
31 inline QLatin1String QXmppVersion()
32 {
33  return QLatin1String(
34  QT_STRINGIFY(QXMPP_VERSION_MAJOR) "." QT_STRINGIFY(QXMPP_VERSION_MINOR) "." QT_STRINGIFY(QXMPP_VERSION_PATCH));
35 }
36 
37 // This sets which deprecated functions should still be usable
38 // It works exactly like QT_DISABLE_DEPRECATED_BEFORE
39 #ifndef QXMPP_DISABLE_DEPRECATED_BEFORE
40 #define QXMPP_DISABLE_DEPRECATED_BEFORE 0x0
41 #endif
42 
43 // This works exactly like QT_DEPRECATED_SINCE, but checks QXMPP_DISABLE_DEPRECATED_BEFORE instead.
44 #define QXMPP_DEPRECATED_SINCE(major, minor) (QT_VERSION_CHECK(major, minor, 0) > QXMPP_DISABLE_DEPRECATED_BEFORE)
45 
46 // workaround for Qt < 5.12
47 #ifndef Q_DECL_ENUMERATOR_DEPRECATED_X
48 #define Q_DECL_ENUMERATOR_DEPRECATED_X(msg)
49 #endif
50 
51 #ifndef QT_WARNING_DISABLE_DEPRECATED
52 #define QT_WARNING_DISABLE_DEPRECATED
53 #endif
54 
55 // Adds constructor and operator declarations to a ".h" file corresponding to the rule of six.
56 // A default constructor has to be declared manually.
57 #define QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(name) \
58  name(const name &); \
59  name(name &&) noexcept; \
60  ~name(); \
61  name &operator=(const name &); \
62  name &operator=(name &&) noexcept;
63 
64 // Adds constructor and operator definitions to a ".cpp" file corresponding to the rule of six.
65 // A default constructor has to be defined manually.
66 #define QXMPP_PRIVATE_DEFINE_RULE_OF_SIX(name) \
67  name::name(const name &) = default; \
68  name::name(name &&) noexcept = default; \
69  name::~name() = default; \
70  name &name::operator=(const name &) = default; \
71  name &name::operator=(name &&) noexcept = default;
72 
80 namespace QXmpp {
81 
95  Otr,
99  Ox,
106 
107 // Keep in sync with namespaces and names in Global.cpp!
108 
109 #if QXMPP_DEPRECATED_SINCE(1, 5)
113  OTR = Otr,
121  OX = Ox,
126 #endif
127 };
128 
136 enum SceMode : uint8_t {
140 };
141 
150 inline constexpr bool operator&(SceMode mode1, SceMode mode2)
151 {
152  return mode1 == SceAll || mode1 == mode2;
153 }
154 
160 enum Cipher {
161  Aes128GcmNoPad,
162  Aes256GcmNoPad,
163  Aes256CbcPkcs7,
164 };
165 
171 struct Success { };
172 
178 struct Cancelled { };
179 
185 struct TimeoutError { };
186 
187 } // namespace QXmpp
188 
189 #endif // QXMPPGLOBAL_H
Definition: Algorithms.h:10
Cipher
Definition: QXmppGlobal.h:160
constexpr bool operator&(SceMode mode1, SceMode mode2)
Definition: QXmppGlobal.h:150
SceMode
Definition: QXmppGlobal.h:136
@ SceSensitive
Only processes sensitive elements that should be encrypted.
Definition: QXmppGlobal.h:139
@ SceAll
Processes all known elements.
Definition: QXmppGlobal.h:137
@ ScePublic
Only processes 'public' elements (e.g. needed for routing).
Definition: QXmppGlobal.h:138
EncryptionMethod
Definition: QXmppGlobal.h:89
@ LegacyOpenPgp
XEP-0027: Current Jabber OpenPGP Usage
Definition: QXmppGlobal.h:97
@ OMEMO
Definition: QXmppGlobal.h:125
@ Omemo0
XEP-0384: OMEMO Encryption
Definition: QXmppGlobal.h:101
@ Ox
XEP-0373: OpenPGP for XMPP
Definition: QXmppGlobal.h:99
@ Omemo2
XEP-0384: OMEMO Encryption since version 0.8
Definition: QXmppGlobal.h:105
@ OTR
Definition: QXmppGlobal.h:113
@ Otr
XEP-0364: Current Off-the-Record Messaging Usage
Definition: QXmppGlobal.h:95
@ NoEncryption
No encryption.
Definition: QXmppGlobal.h:91
@ OX
Definition: QXmppGlobal.h:121
@ LegacyOpenPGP
Definition: QXmppGlobal.h:117
@ Omemo1
XEP-0384: OMEMO Encryption since version 0.4
Definition: QXmppGlobal.h:103
@ UnknownEncryption
Unknown encryption.
Definition: QXmppGlobal.h:93
Definition: QXmppGlobal.h:178
Definition: QXmppGlobal.h:171
Definition: QXmppGlobal.h:185