QXmppUtils Class
The QXmppUtils class contains static utility functions. More...
| Header: | #include <QXmppUtils.h> |
Static Public Members
| QDateTime | datetimeFromString(QStringView str) |
| QString | datetimeToString(const QDateTime &dt) |
| quint32 | generateCrc32(const QByteArray &in) |
| QByteArray | generateHmacMd5(const QByteArray &key, const QByteArray &text) |
| QByteArray | generateHmacSha1(const QByteArray &key, const QByteArray &text) |
| QByteArray | generateRandomBytes(int length) |
| int | generateRandomInteger(int N) |
| QString | generateStanzaHash(int length = 36) |
(since QXmpp 1.3) QString | generateStanzaUuid() |
| QString | jidToBareJid(const QString &jid) |
| QString | jidToDomain(const QString &jid) |
| QString | jidToResource(const QString &jid) |
| QString | jidToUser(const QString &jid) |
| int | timezoneOffsetFromString(const QString &str) |
| QString | timezoneOffsetToString(int secs) |
Detailed Description
Member Function Documentation
[static] QDateTime QXmppUtils::datetimeFromString(QStringView str)
Parses a date-time from the string str according to XEP-0082: XMPP Date and Time Profiles.
Takes QStringView since QXmpp 1.8. Returns true on success.
[static] QString QXmppUtils::datetimeToString(const QDateTime &dt)
Serializes a date-time to a string according to XEP-0082: XMPP Date and Time Profiles.
dt.
[static] quint32 QXmppUtils::generateCrc32(const QByteArray &in)
Calculates the CRC32 checksum for the given input.
in.
[static] QByteArray QXmppUtils::generateHmacMd5(const QByteArray &key, const QByteArray &text)
Generates the MD5 HMAC for the given key and text.
[static] QByteArray QXmppUtils::generateHmacSha1(const QByteArray &key, const QByteArray &text)
Generates the SHA1 HMAC for the given key and text.
[static] QByteArray QXmppUtils::generateRandomBytes(int length)
Returns a random byte array of the size specified by length.
[static] int QXmppUtils::generateRandomInteger(int N)
Generates a random integer x between 0 and N - 1.
[static] QString QXmppUtils::generateStanzaHash(int length = 36)
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.
[static, since QXmpp 1.3] QString QXmppUtils::generateStanzaUuid()
Creates a new stanza id in the UUID format.
This function was introduced in QXmpp 1.3.
[static] QString QXmppUtils::jidToBareJid(const QString &jid)
Returns the bare jid (i.e. without resource) for the given jid.
[static] QString QXmppUtils::jidToDomain(const QString &jid)
Returns the domain for the given jid.
[static] QString QXmppUtils::jidToResource(const QString &jid)
Returns the resource for the given jid.
[static] QString QXmppUtils::jidToUser(const QString &jid)
Returns the user for the given jid.
[static] int QXmppUtils::timezoneOffsetFromString(const QString &str)
Parses a timezone offset (in seconds) from the string str according to XEP-0082: XMPP Date and Time Profiles. Returns true on success.
[static] QString QXmppUtils::timezoneOffsetToString(int secs)
Serializes a timezone offset (in seconds) to a string according to XEP-0082: XMPP Date and Time Profiles.
secs.