QXmppAttentionManager Class

The QXmppAttentionManager class manages attention requests as defined by XEP-0224: Attention. More...

Header: #include <QXmppAttentionManager>
Since: QXmpp 1.4
Inherits: QXmppClientExtension

Public Functions

QXmppAttentionManager(quint8 allowedAttempts = 3, QTime timeFrame = QTime(0, 15, 0))
quint8 allowedAttempts() const
QTime allowedAttemptsTimeInterval() const
void setAllowedAttempts(quint8 allowedAttempts)
void setAllowedAttemptsTimeInterval(QTime interval)

Reimplemented Public Functions

virtual QStringList discoveryFeatures() const override

Public Slots

QString requestAttention(const QString &jid, const QString &message = {})

Signals

void attentionRequestRateLimited(const QXmppMessage &message)
void attentionRequested(const QXmppMessage &message, bool isTrusted)

Detailed Description

The manager also does some checks, including rate limiting and checking whether the senders are trusted (aka. in the roster).

Rate limited messages are not emitted on the normal attentionRequested() signal and are sent on the attentionRequestRateLimited() signal instead.

To use this manager you still need to instantiate it and register it with the QXmppClient:

 auto *attentionManager = new QXmppAttentionManager();
 client->addExtension(attentionManager);

Member Function Documentation

QXmppAttentionManager::QXmppAttentionManager(quint8 allowedAttempts = 3, QTime timeFrame = QTime(0, 15, 0))

QXmppAttentionManager::QXmppAttentionManager

Constructs the manager with the given allowedAttempts and timeFrame.

quint8 QXmppAttentionManager::allowedAttempts() const

Returns the number of allowed attempts of attentions from a bare JID in the set time frame.

See also setAllowedAttempts(), allowedAttemptsTimeInterval(), and setAllowedAttemptsTimeInterval().

QTime QXmppAttentionManager::allowedAttemptsTimeInterval() const

Returns the time interval for the allowed attempts for rate limiting.

See also setAllowedAttemptsTimeInterval(), allowedAttempts(), and setAllowedAttemptsTimeInterval().

[signal] void QXmppAttentionManager::attentionRequestRateLimited(const QXmppMessage &message)

This signal is emitted when an attention request did not pass the rate limiter. message is the message with the attention request that did not pass the rate limiter.

[signal] void QXmppAttentionManager::attentionRequested(const QXmppMessage &message, bool isTrusted)

This signal is emitted when an attention request was received and it passed the rate limiter.

message is the message with the attention request that was received. isTrusted is whether the sender of the message exists in the user's roster.

[override virtual] QStringList QXmppAttentionManager::discoveryFeatures() const

Returns the XEP-0224: Attention feature.

[slot] QString QXmppAttentionManager::requestAttention(const QString &jid, const QString &message = {})

Sends a message of type chat with an attention request to the specified JID.

XEP-0224: Attention

allows to include other elements with an attention request, but the QXmppAttentionManager has no method for this purpose. However, such a request can still be made manually.

jid is the address to which the request should be sent. message is the message body to include in the attention request.

Returns the ID of the sent message, if sent successfully, a null string otherwise. In case an ID is returned, it also corresponds to the origin ID of the message as defined by XEP-0359: Unique and Stable Stanza IDs.

void QXmppAttentionManager::setAllowedAttempts(quint8 allowedAttempts)

Sets the number of allowed attempts of attentions from a bare JID in the set time frame.

allowedAttempts.

See also allowedAttempts(), allowedAttemptsTimeInterval(), and setAllowedAttemptsTimeInterval().

void QXmppAttentionManager::setAllowedAttemptsTimeInterval(QTime interval)

Returns the time interval for the allowed attempts for rate limiting.

interval.

See also allowedAttemptsTimeInterval(), allowedAttempts(), and setAllowedAttempts().