QXmpp Version: 1.10.0
|
Uses XEP-0191: Blocking Command to manage blocked accounts and services. More...
Public Types | |
using | BlocklistResult = std::variant< QXmppBlocklist, QXmppError > |
using | Result = std::variant< QXmpp::Success, QXmppError > |
Public Member Functions | |
bool | isSubscribed () const |
Returns whether the blocking manager currently receives updates of the blocklist. More... | |
Q_SIGNAL void | subscribedChanged () |
QXmppTask< BlocklistResult > | fetchBlocklist () |
Fetches the list of blocked JIDs and subscribes to blocklist updates. More... | |
QXmppTask< Result > | block (QString jid) |
QXmppTask< Result > | block (QVector< QString > jids) |
QXmppTask< Result > | unblock (QString jid) |
QXmppTask< Result > | unblock (QVector< QString > jids) |
Q_SIGNAL void | blocked (const QVector< QString > &jids) |
Q_SIGNAL void | unblocked (const QVector< QString > &jids) |
Public Member Functions inherited from QXmppClientExtension | |
QXmppClientExtension () | |
virtual QStringList | discoveryFeatures () const |
virtual QList< QXmppDiscoveryIq::Identity > | discoveryIdentities () const |
virtual bool | handleStanza (const QDomElement &stanza) |
You need to implement this method to process incoming XMPP stanzas. More... | |
virtual bool | handleStanza (const QDomElement &stanza, const std::optional< QXmppE2eeMetadata > &e2eeMetadata) |
You need to implement this method to process incoming XMPP stanzas. More... | |
Public Member Functions inherited from QXmppLoggable | |
QXmppLoggable (QObject *parent=nullptr) | |
Properties | |
bool | subscribed |
Whether the blocking manager is currently receiving updates of the blocklist. | |
Additional Inherited Members | |
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. | |
Protected Member Functions inherited from QXmppClientExtension | |
QXmppClient * | client () const |
virtual void | setClient (QXmppClient *client) |
virtual void | onRegistered (QXmppClient *client) |
virtual void | onUnregistered (QXmppClient *client) |
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) |
Uses XEP-0191: Blocking Command to manage blocked accounts and services.
You can receive a list of blocked JIDs by using fetchBlocklist().
The server will send updates to us for the rest of the stream. You can listen to the updates by connecting to blocked() and unblocked().
You can use block() and unblock() for this purpose.
unblock() works likewise.
You will automatically receive blocklist updates after you requested the blocklist. You can connect to the blocked() and unblocked() signals.
It is important to notice that the blocked JIDs are not limited to accounts, allowed are the following formats:
user@domain/resource
user@domain
domain/resource
domain
It is not possible to block a domain without blocking a specific account though (or another combination).
The blocking manager is not enabled by default and needs to be registered with your QXmppClient.
Contains a QXmppBlocklist or an error.
Contains QXmpp::Success or an error.
|
inline |
Blocks a JID.
QXmppTask< QXmppBlockingManager::Result > QXmppBlockingManager::block | ( | QVector< QString > | jids | ) |
Blocks a list of JIDs.
QXmppBlockingManager::blocked | ( | const QVector< QString > & | jids | ) |
Emitted when a blocklist update with new blocked JIDs has been received.
This is also emitted when you call block().
QXmppTask< QXmppBlockingManager::BlocklistResult > QXmppBlockingManager::fetchBlocklist | ( | ) |
Fetches the list of blocked JIDs and subscribes to blocklist updates.
The manager will cache the blocklist and keep track of updates for the rest of the session. Later calls of this function will report the cached result immediately. Even calling this function multiple times before the first request has finished, will not trigger more than one IQ request being sent.
bool QXmppBlockingManager::isSubscribed | ( | ) | const |
Returns whether the blocking manager currently receives updates of the blocklist.
The subscription is enabled automatically after fetching the blocklist using fetchBlocklist().
QXmppBlockingManager::subscribedChanged | ( | ) |
Called whenever the state of the subscription to blocklist updates has changed.
|
inline |
Unblocks a JID.
QXmppTask< QXmppBlockingManager::Result > QXmppBlockingManager::unblock | ( | QVector< QString > | jids | ) |
Unblocks a list of JIDs.
QXmppBlockingManager::unblocked | ( | const QVector< QString > & | jids | ) |
Emitted when a blocklist update with new unblocked JIDs has been received.
This is also emitted when you call unblock().