The QXmppUtils class contains static utility functions.
More...
#include <QXmppUtils.h>
|
static QDateTime | datetimeFromString (QStringView str) |
|
static QString | datetimeToString (const QDateTime &dt) |
|
static int | timezoneOffsetFromString (const QString &str) |
|
static QString | timezoneOffsetToString (int secs) |
|
static QString | jidToDomain (const QString &jid) |
| Returns the domain for the given jid.
|
|
static QString | jidToResource (const QString &jid) |
| Returns the resource for the given jid.
|
|
static QString | jidToUser (const QString &jid) |
| Returns the user for the given jid.
|
|
static QString | jidToBareJid (const QString &jid) |
| Returns the bare jid (i.e. without resource) for the given jid.
|
|
static quint32 | generateCrc32 (const QByteArray &input) |
| Calculates the CRC32 checksum for the given input.
|
|
static QByteArray | generateHmacMd5 (const QByteArray &key, const QByteArray &text) |
| Generates the MD5 HMAC for the given key and text.
|
|
static QByteArray | generateHmacSha1 (const QByteArray &key, const QByteArray &text) |
| Generates the SHA1 HMAC for the given key and text.
|
|
static int | generateRandomInteger (int N) |
|
static QByteArray | generateRandomBytes (int length) |
|
static QString | generateStanzaUuid () |
|
static QString | generateStanzaHash (int length=36) |
|
The QXmppUtils class contains static utility functions.
◆ datetimeFromString()
QDateTime QXmppUtils::datetimeFromString |
( |
QStringView |
str | ) |
|
|
static |
◆ datetimeToString()
QString QXmppUtils::datetimeToString |
( |
const QDateTime & |
dt | ) |
|
|
static |
Serializes a date-time to a string according to XEP-0082: XMPP Date and Time Profiles.
◆ generateRandomBytes()
QByteArray QXmppUtils::generateRandomBytes |
( |
int |
length | ) |
|
|
static |
Returns a random byte array of the specified size.
- Parameters
-
◆ generateRandomInteger()
int QXmppUtils::generateRandomInteger |
( |
int |
N | ) |
|
|
static |
Generates a random integer x between 0 and N-1.
- Parameters
-
◆ generateStanzaHash()
QString QXmppUtils::generateStanzaHash |
( |
int |
length = 36 | ) |
|
|
static |
Returns a random alphanumerical string of the specified size.
Since QXmpp 1.3 this will generate a UUID, if the specified length
is 36 which is also the new default value. The returned string is still 36 characters long, but will contain dashes (as specified in the UUID format).
- Note
- It is recommended to use UUIDs for cases where IDs must be unique and are possibly stored permanently. This can be done using QXmppUtils::generateStanzaUuid(). However, since that function is only available since QXmpp 1.3, you may also want to continue to use this function because of compatibility reasons.
- Parameters
-
◆ generateStanzaUuid()
QString QXmppUtils::generateStanzaUuid |
( |
| ) |
|
|
static |
Creates a new stanza id in the UUID format.
- Since
- QXmpp 1.3
◆ timezoneOffsetFromString()
int QXmppUtils::timezoneOffsetFromString |
( |
const QString & |
str | ) |
|
|
static |
Parses a timezone offset (in seconds) from a string according to XEP-0082: XMPP Date and Time Profiles.
◆ timezoneOffsetToString()
QString QXmppUtils::timezoneOffsetToString |
( |
int |
secs | ) |
|
|
static |
Serializes a timezone offset (in seconds) to a string according to XEP-0082: XMPP Date and Time Profiles.
The documentation for this class was generated from the following files: