QXmpp Version: 1.10.0
QXmppUtils.h
1// SPDX-FileCopyrightText: 2009 Manjeet Dahiya <manjeetdahiya@gmail.com>
2// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
3//
4// SPDX-License-Identifier: LGPL-2.1-or-later
5
6#ifndef QXMPPUTILS_H
7#define QXMPPUTILS_H
8
9// forward declarations of QXmlStream* classes will not work on Mac, we need to
10// include the whole header.
11// See http://lists.trolltech.com/qt-interest/2008-07/thread00798-0.html
12// for an explanation.
13#include "QXmppGlobal.h"
14
15#include <QXmlStreamWriter>
16
17class QByteArray;
18class QDateTime;
19class QDomElement;
20class QString;
21
24class QXMPP_EXPORT QXmppUtils
25{
26public:
27 // XEP-0082: XMPP Date and Time Profiles
28 static QDateTime datetimeFromString(QStringView str);
30 static QDateTime datetimeFromString(const QString &str);
32 static QString datetimeToString(const QDateTime &dt);
33 static int timezoneOffsetFromString(const QString &str);
34 static QString timezoneOffsetToString(int secs);
35
36 static QString jidToDomain(const QString &jid);
37 static QString jidToResource(const QString &jid);
38 static QString jidToUser(const QString &jid);
39 static QString jidToBareJid(const QString &jid);
40
41 static quint32 generateCrc32(const QByteArray &input);
42 static QByteArray generateHmacMd5(const QByteArray &key, const QByteArray &text);
43 static QByteArray generateHmacSha1(const QByteArray &key, const QByteArray &text);
44 static int generateRandomInteger(int N);
45 static QByteArray generateRandomBytes(int length);
46 static QString generateStanzaUuid();
47 static QString generateStanzaHash(int length = 36);
48};
49
50#endif // QXMPPUTILS_H
The QXmppUtils class contains static utility functions.
Definition: QXmppUtils.h:25