QXmpp Version: 1.10.0
|
Classes | |
struct | Participation |
struct | Service |
struct | Subscription |
Public Types | |
enum class | Support { Unknown , Unsupported , Supported } |
using | Jid = QString |
using | ChannelJid = QString |
using | Nickname = QString |
using | CreationResult = std::variant< ChannelJid, QXmppError > |
using | ChannelJidResult = std::variant< QVector< ChannelJid >, QXmppError > |
using | ChannelNodeResult = std::variant< QXmppMixConfigItem::Nodes, QXmppError > |
using | ConfigurationResult = std::variant< QXmppMixConfigItem, QXmppError > |
using | InformationResult = std::variant< QXmppMixInfoItem, QXmppError > |
using | JoiningResult = std::variant< Participation, QXmppError > |
using | NicknameResult = std::variant< Nickname, QXmppError > |
using | InvitationResult = std::variant< QXmppMixInvitation, QXmppError > |
using | SubscriptionResult = std::variant< Subscription, QXmppError > |
using | JidResult = std::variant< QVector< Jid >, QXmppError > |
using | ParticipantResult = std::variant< QVector< QXmppMixParticipantItem >, QXmppError > |
Public Member Functions | |
QXmppMixManager () | |
QStringList | discoveryFeatures () const override |
Support | participantSupport () const |
Q_SIGNAL void | participantSupportChanged () |
Support | messageArchivingSupport () const |
Q_SIGNAL void | messageArchivingSupportChanged () |
QList< Service > | services () const |
Q_SIGNAL void | servicesChanged () |
QXmppTask< CreationResult > | createChannel (const QString &serviceJid, const QString &channelId={}) |
QXmppTask< ChannelJidResult > | requestChannelJids (const QString &serviceJid) |
QXmppTask< ChannelNodeResult > | requestChannelNodes (const QString &channelJid) |
QXmppTask< ConfigurationResult > | requestChannelConfiguration (const QString &channelJid) |
QXmppTask< QXmppClient::EmptyResult > | updateChannelConfiguration (const QString &channelJid, QXmppMixConfigItem configuration) |
Q_SIGNAL void | channelConfigurationUpdated (const QString &channelJid, const QXmppMixConfigItem &configuration) |
QXmppTask< InformationResult > | requestChannelInformation (const QString &channelJid) |
QXmppTask< QXmppClient::EmptyResult > | updateChannelInformation (const QString &channelJid, QXmppMixInfoItem information) |
Q_SIGNAL void | channelInformationUpdated (const QString &channelJid, const QXmppMixInfoItem &information) |
QXmppTask< JoiningResult > | joinChannel (const QString &channelJid, const QString &nickname={}, QXmppMixConfigItem::Nodes nodes=~QXmppMixConfigItem::Nodes()) |
QXmppTask< JoiningResult > | joinChannel (const QXmppMixInvitation &invitation, const QString &nickname={}, QXmppMixConfigItem::Nodes nodes=~QXmppMixConfigItem::Nodes()) |
QXmppTask< NicknameResult > | updateNickname (const QString &channelJid, const QString &nickname) |
QXmppTask< SubscriptionResult > | updateSubscriptions (const QString &channelJid, QXmppMixConfigItem::Nodes subscriptionAdditions=~QXmppMixConfigItem::Nodes(), QXmppMixConfigItem::Nodes subscriptionRemovals=~QXmppMixConfigItem::Nodes()) |
QXmppTask< InvitationResult > | requestInvitation (const QString &channelJid, const QString &inviteeJid) |
QXmppTask< JidResult > | requestAllowedJids (const QString &channelJid) |
QXmppTask< QXmppClient::EmptyResult > | allowJid (const QString &channelJid, const QString &jid) |
Q_SIGNAL void | jidAllowed (const QString &channelJid, const QString &jid) |
Q_SIGNAL void | allJidsAllowed (const QString &channelJid) |
QXmppTask< QXmppClient::EmptyResult > | disallowJid (const QString &channelJid, const QString &jid) |
Q_SIGNAL void | jidDisallowed (const QString &channelJid, const QString &jid) |
QXmppTask< QXmppClient::EmptyResult > | disallowAllJids (const QString &channelJid) |
Q_SIGNAL void | allJidsDisallowed (const QString &channelJid) |
QXmppTask< JidResult > | requestBannedJids (const QString &channelJid) |
QXmppTask< QXmppClient::EmptyResult > | banJid (const QString &channelJid, const QString &jid) |
Q_SIGNAL void | jidBanned (const QString &channelJid, const QString &jid) |
QXmppTask< QXmppClient::EmptyResult > | unbanJid (const QString &channelJid, const QString &jid) |
Q_SIGNAL void | jidUnbanned (const QString &channelJid, const QString &jid) |
QXmppTask< QXmppClient::EmptyResult > | unbanAllJids (const QString &channelJid) |
Q_SIGNAL void | allJidsUnbanned (const QString &channelJid) |
QXmppTask< ParticipantResult > | requestParticipants (const QString &channelJid) |
Q_SIGNAL void | participantReceived (const QString &channelJid, const QXmppMixParticipantItem &participant) |
Q_SIGNAL void | participantLeft (const QString &channelJid, const QString &participantId) |
QXmppTask< QXmppClient::EmptyResult > | leaveChannel (const QString &channelJid) |
QXmppTask< QXmppClient::EmptyResult > | deleteChannel (const QString &channelJid) |
Q_SIGNAL void | channelDeleted (const QString &channelJid) |
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) | |
Public Member Functions inherited from QXmppPubSubEventHandler | |
virtual bool | handlePubSubEvent (const QDomElement &element, const QString &pubSubService, const QString &nodeName)=0 |
Properties | |
Support | participantSupport |
Support | messageArchivingSupport |
QList< Service > | services |
Friends | |
class | tst_QXmppMixManager |
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) |
This class manages group chat communication as specified in the following XEPs:
In order to use this manager, make sure to add all managers needed by this manager:
Afterwards, you need to add this manager to the client:
Before calling one of the following methods, you need to request the information once per connection:
Before calling one of the following methods, you need to request the information once per connection:
If you want to be informed about updates of the channel (e.g., its configuration or allowed JIDs), make sure to subscribe to the corresponding nodes.
In order to send a message to a MIX channel, you have to set the type QXmppMessage::GroupChat.
Example for an unencrypted message:
Example for an encrypted message decryptable by Alice and Bob:
If you receive a message, you can check whether it contains an invitation to a MIX channel and use that invitation to join the channel:
In order to invite someone to a MIX channel that allows the invitee to participate, you can create an invitation on your own.
That can be done in the following cases:
Invitations are sent as regular messages. They are not meant to be read by a human. Instead, the receiving client needs to support it. But you can add an appropriate text to the body of the invitation message to enable human users of clients that do not support that feature to join the channel manually. For example, you could add the JID of the channel or an XMPP URI to the body.
If the body (i.e., the invitation text) is empty, the message would neither be delivered to all clients via XEP-0280: Message Carbons nor delivered to clients which are currently offline via XEP-0313: Message Archive Management. To enforce that behavior, set a corresponding message type and message processing hint:
In order to invite someone to a MIX channel that does not yet allow the invitee to participate, you can request an invitation from the channel (if permitted to do so):
JID of a MIX channel.
Contains the JIDs of all discoverable MIX channels of a MIX service or a QXmppError if it failed.
Contains all nodes of the requested MIX channel that can be subscribed by the user or a QXmppError on failure.
Contains the configuration of the MIX channel or a QXmppError on failure.
Contains the JID of the created MIX channel or a QXmppError on failure.
Contains the information of the MIX channel or a QXmppError on failure.
Contains the requested invitation to a MIX channel or a QXmppError on failure.
JID of a user or domain.
Contains the JIDs of users or domains that are allowed to participate resp. banned from participating in a MIX channel or a QXmppError on failure.
Contains the result of the joined MIX channel or a QXmppError on failure.
Nickname of the user within a MIX channel.
If the server modified the desired nickname, this is the modified one.
Contains the new nickname within a joined MIX channel or a QXmppError on failure.
Contains the participants of a MIX channel or a QXmppError on failure.
Contains the result of the subscribed/unsubscribed nodes belonging to a MIX channel or a QXmppError on failure.
|
strong |
Server support for a feature.
The information is cached until a new connection is established. That makes it possible to retrieve the latest state even while the client is disconnected.
QXmppMixManager::QXmppMixManager | ( | ) |
Constructs a MIX manager.
QXmppMixManager::allJidsAllowed | ( | const QString & | channelJid | ) |
Emitted when all JIDs are allowed to participate in a MIX channel.
That happens if QXmppMixConfigItem::Node::AllowedJids is removed from a channel.
channelJid | JID of the channel |
QXmppMixManager::allJidsDisallowed | ( | const QString & | channelJid | ) |
Emitted when no JID is allowed to participate in a MIX channel anymore.
That happens if disallowAllJids() was successful or if another resource or user did that.
channelJid | JID of the channel |
QXmppMixManager::allJidsUnbanned | ( | const QString & | channelJid | ) |
Emitted when all JIDs are unbanned from participating in a MIX channel.
That happens if unbanAllJids() was successful or if another resource or user did that. Furthermore, that happens if QXmppMixConfigItem::Node::BannedJids is removed from a channel.
channelJid | JID of the channel |
QXmppTask< QXmppClient::EmptyResult > QXmppMixManager::allowJid | ( | const QString & | channelJid, |
const QString & | jid | ||
) |
Allows a JID to participate in a MIX channel.
The JID can specify a user (e.g., "alice@example.org") or a group of users (e.g., "example.org") for allowing all users to participate that have a JID containing the specified domain.
Allowing a JID is only needed if the channel does not allow anyone to participate. That is the case when QXmppMixConfigItem::Node::AllowedJids exists for the channel. Use requestChannelConfiguration() and QXmppMixConfigItem::nodes() to determine that. Call updateChannelConfiguration() and QXmppMixConfigItem::setNodes() to update it accordingly. In order to allow all JIDs to participate in a channel, you need to remove QXmppMixConfigItem::Node::AllowedJids from the channel's nodes.
channelJid | JID of the channel |
jid | bare JID to be allowed |
QXmppTask< QXmppClient::EmptyResult > QXmppMixManager::banJid | ( | const QString & | channelJid, |
const QString & | jid | ||
) |
Bans a JID from participating in a MIX channel.
The JID can specify a user (e.g., "alice@example.org") or a group of users (e.g., "example.org") for banning all users that have a JID containing the specified domain.
Before calling this, make sure that QXmppMixConfigItem::Node::BannedJids exists for the channel. Use requestChannelConfiguration() and QXmppMixConfigItem::nodes() to determine that. Call updateChannelConfiguration() and QXmppMixConfigItem::setNodes() to update it accordingly.
channelJid | JID of the channel |
jid | bare JID to be banned |
QXmppMixManager::channelConfigurationUpdated | ( | const QString & | channelJid, |
const QXmppMixConfigItem & | configuration | ||
) |
Emitted when the configuration of a MIX channel is updated.
channelJid | JID of the channel whose configuration is updated |
configuration | new channel configuration |
QXmppMixManager::channelDeleted | ( | const QString & | channelJid | ) |
Emitted when a MIX channel is deleted.
channelJid | JID of the deleted channel |
QXmppMixManager::channelInformationUpdated | ( | const QString & | channelJid, |
const QXmppMixInfoItem & | information | ||
) |
Emitted when the information of a MIX channel is updated.
channelJid | JID of the channel whose information is updated |
information | new channel information |
QXmppTask< QXmppMixManager::CreationResult > QXmppMixManager::createChannel | ( | const QString & | serviceJid, |
const QString & | channelId = {} |
||
) |
Creates a MIX channel.
If no channel ID is passed, the channel is created with an ID provided by the MIX service. Furthermore, the channel cannot be discovered by anyone. A channel with the mentioned properties is called an "ad-hoc channel".
The channel ID is the local part of the channel JID. The MIX service JID is the domain part of the channel JID. Example: "channel" is the channel ID and "mix.example.org" the service JID of the channel JID "channel@mix.example.org".
serviceJid | JID of the service |
channelId | ID of the channel (default: provided by the server) |
QXmppTask< QXmppClient::EmptyResult > QXmppMixManager::deleteChannel | ( | const QString & | channelJid | ) |
Deletes a MIX channel.
channelJid | JID of the channel to be deleted |
QXmppTask< QXmppClient::EmptyResult > QXmppMixManager::disallowAllJids | ( | const QString & | channelJid | ) |
Disallows all formerly allowed JIDs to participate in a MIX channel.
Only allowed JIDs can be disallowed via this method. In order to disallow other JIDs, use banJid().
channelJid | JID of the channel |
QXmppTask< QXmppClient::EmptyResult > QXmppMixManager::disallowJid | ( | const QString & | channelJid, |
const QString & | jid | ||
) |
Disallows a formerly allowed JID to participate in a MIX channel.
Only allowed JIDs can be disallowed via this method. In order to disallow other JIDs, use banJid().
channelJid | JID of the channel |
jid | bare JID to be disallowed |
|
overridevirtual |
Returns the discovery features to add to the client.
Reimplemented from QXmppClientExtension.
QXmppMixManager::jidAllowed | ( | const QString & | channelJid, |
const QString & | jid | ||
) |
Emitted when a JID is allowed to participate in a MIX channel.
That happens if allowJid() was successful or if another resource or user did that.
channelJid | JID of the channel |
jid | allowed bare JID |
QXmppMixManager::jidBanned | ( | const QString & | channelJid, |
const QString & | jid | ||
) |
Emitted when a JID is banned from participating in a MIX channel.
That happens if banJid() was successful or if another resource or user did that.
channelJid | JID of the channel |
jid | banned bare JID |
QXmppMixManager::jidDisallowed | ( | const QString & | channelJid, |
const QString & | jid | ||
) |
Emitted when a fomerly allowed JID is disallowed to participate in a MIX channel anymore.
That happens if disallowJid() was successful or if another resource or user did that.
channelJid | JID of the channel |
jid | disallowed bare JID |
QXmppMixManager::jidUnbanned | ( | const QString & | channelJid, |
const QString & | jid | ||
) |
Emitted when a formerly banned JID is unbanned from participating in a MIX channel.
That happens if unbanJid() was successful or if another resource or user did that.
channelJid | JID of the channel |
jid | unbanned bare JID |
QXmppTask< QXmppMixManager::JoiningResult > QXmppMixManager::joinChannel | ( | const QString & | channelJid, |
const QString & | nickname = {} , |
||
QXmppMixConfigItem::Nodes | nodes = ~QXmppMixConfigItem::Nodes() |
||
) |
Joins a MIX channel to become a participant of it.
channelJid | JID of the channel being joined |
nickname | nickname of the user which is usually required by the server (default: no nickname is set) |
nodes | nodes of the channel that are subscribed to for receiving their updates (default: all nodes are subcribed to) |
QXmppTask< QXmppMixManager::JoiningResult > QXmppMixManager::joinChannel | ( | const QXmppMixInvitation & | invitation, |
const QString & | nickname = {} , |
||
QXmppMixConfigItem::Nodes | nodes = ~QXmppMixConfigItem::Nodes() |
||
) |
Joins a MIX channel via an invitation to become a participant of it.
invitation | invitation to the channel |
nickname | nickname of the user which is usually required by the server (default: no nickname is set) |
nodes | nodes of the channel that are subscribed to for receiving their updates (default: all nodes are subcribed to) |
QXmppTask< QXmppClient::EmptyResult > QXmppMixManager::leaveChannel | ( | const QString & | channelJid | ) |
Leaves a MIX channel.
channelJid | JID of the channel to be left |
QXmppMixManager::Support QXmppMixManager::messageArchivingSupport | ( | ) | const |
Returns the server's support for archiving messages via XEP-0313: Message Archive Management of MIX channels the user participates in as specified in XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements.
QXmppMixManager::messageArchivingSupportChanged | ( | ) |
Emitted when the server's support for archiving MIX messages changed.
QXmppMixManager::participantLeft | ( | const QString & | channelJid, |
const QString & | participantId | ||
) |
Emitted when a participant left the MIX channel.
channelJid | JID of the channel that is left by the participant |
participantId | ID of the left participant |
QXmppMixManager::participantReceived | ( | const QString & | channelJid, |
const QXmppMixParticipantItem & | participant | ||
) |
Emitted when a user joined a MIX channel or a participant is updated.
channelJid | JID of the channel that the user joined or whose participant is updated |
participant | new or updated participant |
QXmppMixManager::Support QXmppMixManager::participantSupport | ( | ) | const |
Returns the server's support for MIX channel participants as specified in XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements.
If the server supports it, the server interacts between a client and a MIX channel that the user participates in. E.g., the server adds the MIX channel to the user's roster after joining it.
QXmppMixManager::participantSupportChanged | ( | ) |
Emitted when the server's support for MIX channel participants changed.
QXmppTask< QXmppMixManager::JidResult > QXmppMixManager::requestAllowedJids | ( | const QString & | channelJid | ) |
Requests all JIDs which are allowed to participate in a MIX channel.
The JIDs can specify users (e.g., "alice@example.org") or groups of users (e.g., "example.org") for allowing all users to participate that have a JID containing the specified domain.
channelJid | JID of the channel |
QXmppTask< QXmppMixManager::JidResult > QXmppMixManager::requestBannedJids | ( | const QString & | channelJid | ) |
Requests all JIDs which are not allowed to participate in a MIX channel.
channelJid | JID of the corresponding channel |
QXmppTask< QXmppMixManager::ConfigurationResult > QXmppMixManager::requestChannelConfiguration | ( | const QString & | channelJid | ) |
Requests the configuration of a MIX channel.
channelJid | JID of the channel whose configuration is requested |
QXmppTask< QXmppMixManager::InformationResult > QXmppMixManager::requestChannelInformation | ( | const QString & | channelJid | ) |
Requests the information of a MIX channel.
channelJid | JID of the channel whose information is requested |
QXmppTask< QXmppMixManager::ChannelJidResult > QXmppMixManager::requestChannelJids | ( | const QString & | serviceJid | ) |
Requests the JIDs of all discoverable MIX channels of a MIX service.
serviceJid | JID of the service that provides the channels |
QXmppTask< QXmppMixManager::ChannelNodeResult > QXmppMixManager::requestChannelNodes | ( | const QString & | channelJid | ) |
Requests all nodes of a MIX channel that can be subscribed by the user.
channelJid | JID of the channel |
QXmppTask< QXmppMixManager::InvitationResult > QXmppMixManager::requestInvitation | ( | const QString & | channelJid, |
const QString & | inviteeJid | ||
) |
Requests an invitation to a MIX channel that the invitee is not yet allowed to participate in.
The invitee can use the invitation to join the channel.
That invitation mechanism avoids storing allowed JIDs for an indefinite time if the corresponding user never joins the channel. By using this method, there is no need to allow the invitee to participate in the channel via allowJid().
This method can be used in the following cases:
channelJid | JID of the channel that the invitee is invited to |
inviteeJid | JID of the invitee |
QXmppTask< QXmppMixManager::ParticipantResult > QXmppMixManager::requestParticipants | ( | const QString & | channelJid | ) |
Requests all participants of a MIX channel.
In the case of a channel that not everybody is allowed to participate in, the participants are a subset of the allowed JIDs.
channelJid | JID of the channel |
QList< QXmppMixManager::Service > QXmppMixManager::services | ( | ) | const |
Returns the services providing MIX on the own server.
Such services provide MIX channels and their nodes. It interacts directly with clients or with their servers.
QXmppMixManager::servicesChanged | ( | ) |
Emitted when the services providing MIX on the own server changed.
QXmppTask< QXmppClient::EmptyResult > QXmppMixManager::unbanAllJids | ( | const QString & | channelJid | ) |
Unbans all formerly banned JIDs from participating in a MIX channel.
channelJid | JID of the channel |
QXmppTask< QXmppClient::EmptyResult > QXmppMixManager::unbanJid | ( | const QString & | channelJid, |
const QString & | jid | ||
) |
Unbans a formerly banned JID from participating in a MIX channel.
channelJid | JID of the channel |
jid | bare JID to be unbanned |
QXmppTask< QXmppClient::EmptyResult > QXmppMixManager::updateChannelConfiguration | ( | const QString & | channelJid, |
QXmppMixConfigItem | configuration | ||
) |
Updates the configuration of a MIX channel.
In order to use this method, retrieve the current configuration via requestChannelConfiguration() first, change the desired attributes and pass the configuration to this method.
channelJid | JID of the channel whose configuration is to be updated |
configuration | new configuration of the channel |
QXmppTask< QXmppClient::EmptyResult > QXmppMixManager::updateChannelInformation | ( | const QString & | channelJid, |
QXmppMixInfoItem | information | ||
) |
Updates the information of a MIX channel.
In order to use this method, retrieve the current information via requestChannelInformation() first, change the desired attributes and pass the information to this method.
channelJid | JID of the channel whose information is to be updated |
information | new information of the channel |
QXmppTask< QXmppMixManager::NicknameResult > QXmppMixManager::updateNickname | ( | const QString & | channelJid, |
const QString & | nickname | ||
) |
Updates the nickname within a channel.
If the update succeeded, the new nickname is returned which may differ from the requested one.
channelJid | JID of the channel |
nickname | nickname to be set |
QXmppTask< QXmppMixManager::SubscriptionResult > QXmppMixManager::updateSubscriptions | ( | const QString & | channelJid, |
QXmppMixConfigItem::Nodes | subscriptionAdditions = ~QXmppMixConfigItem::Nodes() , |
||
QXmppMixConfigItem::Nodes | subscriptionRemovals = ~QXmppMixConfigItem::Nodes() |
||
) |
Updates the subscriptions to nodes of a MIX channel.
channelJid | JID of the channel |
subscriptionAdditions | nodes to subscribe to |
subscriptionRemovals | nodes to unsubscribe from |
|
read |
|
read |
|
read |