QXmpp Version: 1.5.6
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
QXmppAttentionManager Class Reference

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

Inheritance diagram for QXmppAttentionManager:
Inheritance graph
[legend]
Collaboration diagram for QXmppAttentionManager:
Collaboration graph
[legend]

Public Slots

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

Signals

void attentionRequested (const QXmppMessage &message, bool isTrusted)
 
void attentionRequestRateLimited (const QXmppMessage &message)
 
- Signals inherited from QXmppLoggable
void setGauge (const QString &gauge, double value)
 Sets the given gauge to value.
 
void logMessage (QXmppLogger::MessageType type, const QString &msg)
 This signal is emitted to send logging messages.
 
void updateCounter (const QString &counter, qint64 amount=1)
 Updates the given counter by amount.
 

Public Member Functions

 QXmppAttentionManager (quint8 allowedAttempts=3, QTime timeFrame=QTime(0, 15, 0))
 QXmppAttentionManager::QXmppAttentionManager.
 
QStringList discoveryFeatures () const override
 
quint8 allowedAttempts () const
 
void setAllowedAttempts (quint8 allowedAttempts)
 
QTime allowedAttemptsTimeInterval () const
 
void setAllowedAttemptsTimeInterval (QTime interval)
 
- Public Member Functions inherited from QXmppClientExtension
 QXmppClientExtension ()
 
virtual QList< QXmppDiscoveryIq::IdentitydiscoveryIdentities () const
 
virtual bool handleStanza (const QDomElement &stanza)
 You need to implement this method to process incoming XMPP stanzas.
 
virtual bool handleStanza (const QDomElement &stanza, const std::optional< QXmppE2eeMetadata > &e2eeMetadata)
 You need to implement this method to process incoming XMPP stanzas.
 
- Public Member Functions inherited from QXmppLoggable
 QXmppLoggable (QObject *parent=nullptr)
 

Protected Member Functions

void setClient (QXmppClient *client) override
 
- Protected Member Functions inherited from QXmppClientExtension
QXmppClientclient ()
 
void injectIq (const QDomElement &element, const std::optional< QXmppE2eeMetadata > &e2eeMetadata)
 
bool injectMessage (QXmppMessage &&message)
 
- Protected Member Functions inherited from QXmppLoggable
void debug (const QString &message)
 
void info (const QString &message)
 
void warning (const QString &message)
 
void logReceived (const QString &message)
 
void logSent (const QString &message)
 

Detailed Description

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

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);
The QXmppAttentionManager class manages attention requests as defined by XEP-0224: Attention.
Definition QXmppAttentionManager.h:16
QXmppClient * client()
Definition QXmppClientExtension.cpp:78
bool addExtension(QXmppClientExtension *extension)
Definition QXmppClient.cpp:263
Since
QXmpp 1.4

Constructor & Destructor Documentation

◆ QXmppAttentionManager()

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

QXmppAttentionManager::QXmppAttentionManager.

Parameters
allowedAttempts
timeFrame

Member Function Documentation

◆ allowedAttempts()

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()
setAllowedAttemptsTimeInterval()

◆ allowedAttemptsTimeInterval()

QTime QXmppAttentionManager::allowedAttemptsTimeInterval ( ) const

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

See also
setAllowedAttemptsTimeInterval()
allowedAttempts()
setAllowedAttemptsTimeInterval()

◆ attentionRequested

QXmppAttentionManager::attentionRequested ( const QXmppMessage message,
bool  isTrusted 
)
signal

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

Parameters
messageThe message with the attention request that was received.
isTrustedWhether the sender of the message exists in the user's roster.

◆ attentionRequestRateLimited

QXmppAttentionManager::attentionRequestRateLimited ( const QXmppMessage message)
signal

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

Parameters
messageThe message with the attention request that did not pass the rate limiter.

◆ discoveryFeatures()

QStringList QXmppAttentionManager::discoveryFeatures ( ) const
overridevirtual

Returns the XEP-0224: Attention feature.

Reimplemented from QXmppClientExtension.

◆ requestAttention

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

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

XEP-0224 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.

Parameters
jidThe address to which the request should be sent.
messageThe 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.

◆ setAllowedAttempts()

void QXmppAttentionManager::setAllowedAttempts ( quint8  allowedAttempts)

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

See also
allowedAttempts()
allowedAttemptsTimeInterval()
setAllowedAttemptsTimeInterval()

◆ setAllowedAttemptsTimeInterval()

void QXmppAttentionManager::setAllowedAttemptsTimeInterval ( QTime  interval)

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

See also
allowedAttemptsTimeInterval()
allowedAttempts()
setAllowedAttempts()

◆ setClient()

void QXmppAttentionManager::setClient ( QXmppClient client)
overrideprotectedvirtual

Sets the client which loaded this extension.

Parameters
client

Reimplemented from QXmppClientExtension.


The documentation for this class was generated from the following files: