QXmppMixManager Class

Header: #include <QXmppMixManager>
Since: QXmpp 1.7
Inherits: QXmppClientExtension and QXmppPubSubEventHandler

Public Types

Properties

Public Functions

QXmppMixManager()
QXmppTask<QXmppClient::EmptyResult> allowJid(const QString &channelJid, const QString &jid)
QXmppTask<QXmppClient::EmptyResult> banJid(const QString &channelJid, const QString &jid)
QXmppTask<QXmppMixManager::CreationResult> createChannel(const QString &serviceJid, const QString &channelId = {})
QXmppTask<QXmppClient::EmptyResult> deleteChannel(const QString &channelJid)
QXmppTask<QXmppClient::EmptyResult> disallowAllJids(const QString &channelJid)
QXmppTask<QXmppClient::EmptyResult> disallowJid(const QString &channelJid, const QString &jid)
QXmppTask<QXmppMixManager::JoiningResult> joinChannel(const QString &channelJid, const QString &nickname = {}, QXmppMixConfigItem::Nodes nodes = ~QXmppMixConfigItem::Nodes())
QXmppTask<QXmppMixManager::JoiningResult> joinChannel(const QXmppMixInvitation &invitation, const QString &nickname = {}, QXmppMixConfigItem::Nodes nodes = ~QXmppMixConfigItem::Nodes())
QXmppTask<QXmppClient::EmptyResult> leaveChannel(const QString &channelJid)
QXmppMixManager::Support messageArchivingSupport() const
QXmppMixManager::Support participantSupport() const
QXmppTask<QXmppMixManager::JidResult> requestAllowedJids(const QString &channelJid)
QXmppTask<QXmppMixManager::JidResult> requestBannedJids(const QString &channelJid)
QXmppTask<QXmppMixManager::ConfigurationResult> requestChannelConfiguration(const QString &channelJid)
QXmppTask<QXmppMixManager::InformationResult> requestChannelInformation(const QString &channelJid)
QXmppTask<QXmppMixManager::ChannelJidResult> requestChannelJids(const QString &serviceJid)
QXmppTask<QXmppMixManager::ChannelNodeResult> requestChannelNodes(const QString &channelJid)
QXmppTask<QXmppMixManager::InvitationResult> requestInvitation(const QString &channelJid, const QString &inviteeJid)
QXmppTask<QXmppMixManager::ParticipantResult> requestParticipants(const QString &channelJid)
QList<QXmppMixManager::Service> services() const
QXmppTask<QXmppClient::EmptyResult> unbanAllJids(const QString &channelJid)
QXmppTask<QXmppClient::EmptyResult> unbanJid(const QString &channelJid, const QString &jid)
QXmppTask<QXmppClient::EmptyResult> updateChannelConfiguration(const QString &channelJid, QXmppMixConfigItem configuration)
QXmppTask<QXmppClient::EmptyResult> updateChannelInformation(const QString &channelJid, QXmppMixInfoItem information)
QXmppTask<QXmppMixManager::NicknameResult> updateNickname(const QString &channelJid, const QString &nickname)
QXmppTask<QXmppMixManager::SubscriptionResult> updateSubscriptions(const QString &channelJid, QXmppMixConfigItem::Nodes subscriptionAdditions = ~QXmppMixConfigItem::Nodes(), QXmppMixConfigItem::Nodes subscriptionRemovals = {})

Signals

void allJidsAllowed(const QString &channelJid)
void allJidsDisallowed(const QString &channelJid)
void allJidsUnbanned(const QString &channelJid)
void channelConfigurationUpdated(const QString &channelJid, const QXmppMixConfigItem &configuration)
void channelDeleted(const QString &channelJid)
void channelInformationUpdated(const QString &channelJid, const QXmppMixInfoItem &information)
void jidAllowed(const QString &channelJid, const QString &jid)
void jidBanned(const QString &channelJid, const QString &jid)
void jidDisallowed(const QString &channelJid, const QString &jid)
void jidUnbanned(const QString &channelJid, const QString &jid)
void messageArchivingSupportChanged()
void participantLeft(const QString &channelJid, const QString &participantId)
void participantReceived(const QString &channelJid, const QXmppMixParticipantItem &participant)
void participantSupportChanged()
void servicesChanged()

Detailed Description

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:

 client->addNewExtension<QXmppDiscoveryManager>();
 client->addNewExtension<QXmppPubSubManager>();

Afterwards, you need to add this manager to the client:

 auto *manager = client->addNewExtension<QXmppMixManager>();

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:

 message->setType(QXmppMessage::GroupChat);
 message->setTo("group@mix.example.org")
 client->send(std::move(message));

Example for an encrypted message decryptable by Alice and Bob:

 message->setType(QXmppMessage::GroupChat);
 message->setTo("group@mix.example.org")

 QXmppSendStanzaParams params;
 params.setEncryptionJids({ "alice@example.org", "bob@example.com" })

 client->sendSensitive(std::move(message), params);

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:

 if (auto invitation = message.mixInvitation()) {
 manager->joinChannel(*invitation, nickname, nodes);
 }

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:

  • Everybody is allowed to participate in the channel.
  • The invitee is explicitly allowed to participate in the channel. That is particularly relevant if the channel does not support invitations received via requestInvitation() but the inviter is permitted to allow JIDs via allowJid(). In that case, the invitee's JID has to be allowed before the invitee tries to join the channel.

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:

 QXmppMixInvitation invitation;

 invitation.setInviterJid(client->configuration().jidBare());
 invitation.setInviteeJid(inviteeJid);
 invitation.setChannelJid(channelJid);

 QXmppMessage message;

 message.setTo(inviteeJid);
 message.setMixInvitation(invitation);

 if (messageBody.isEmpty()) {
 message.setType(QXmppMessage::Chat);
 message.addHint(QXmppMessage::Store);
 } else {
 message.setBody(messageBody);
 }

 client()->sendSensitive(std::move(message));

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):

 manager->requestInvitation().then(this, [](QXmppMixManager::InvitationResult &&result) mutable {
 if (QXmpp::hasError(result)) {
 // Handle the error.
 } else {
 auto invitation = QXmpp::getValue(std::move(result));
 // Create and send the invitation.
 }
 });

Member Type Documentation

[alias] QXmppMixManager::ChannelJid

JID of a MIX channel.

[alias] QXmppMixManager::ChannelJidResult

Contains the JIDs of all discoverable MIX channels of a MIX service or a QXmppError if it failed.

[alias] QXmppMixManager::ChannelNodeResult

Contains all nodes of the requested MIX channel that can be subscribed by the user or a QXmppError on failure.

[alias] QXmppMixManager::ConfigurationResult

Contains the configuration of the MIX channel or a QXmppError on failure.

[alias] QXmppMixManager::CreationResult

Contains the JID of the created MIX channel or a QXmppError on failure.

[alias] QXmppMixManager::InformationResult

Contains the information of the MIX channel or a QXmppError on failure.

[alias] QXmppMixManager::InvitationResult

Contains the requested invitation to a MIX channel or a QXmppError on failure.

[alias] QXmppMixManager::Jid

JID of a user or domain.

[alias] QXmppMixManager::JidResult

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.

[alias] QXmppMixManager::JoiningResult

Contains the result of the joined MIX channel or a QXmppError on failure.

[alias] QXmppMixManager::Nickname

Nickname of the user within a MIX channel.

If the server modified the desired nickname, this is the modified one.

[alias] QXmppMixManager::NicknameResult

Contains the new nickname within a joined MIX channel or a QXmppError on failure.

[alias] QXmppMixManager::ParticipantResult

Contains the participants of a MIX channel or a QXmppError on failure.

[alias] QXmppMixManager::SubscriptionResult

Contains the result of the subscribed/unsubscribed nodes belonging to a MIX channel or a QXmppError on failure.

enum class QXmppMixManager::Support

Describes whether a feature is supported by the server.

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.

ConstantValueDescription
QXmppMixManager::Support::Unknown0Whether the server supports the feature is not known. That means, there is no corresponding information from the server (yet).
QXmppMixManager::Support::Unsupported1The server does not support the feature.
QXmppMixManager::Support::Supported2The server supports the feature.

Property Documentation

[read-only] messageArchivingSupport : const Support

Access functions:

QXmppMixManager::Support messageArchivingSupport() const

Notifier signal:

See also QXmppMixManager::messageArchivingSupport().

[read-only] participantSupport : const Support

Access functions:

QXmppMixManager::Support participantSupport() const

Notifier signal:

See also QXmppMixManager::participantSupport().

[read-only] services : const QList<Service>

Access functions:

QList<QXmppMixManager::Service> services() const

Notifier signal:

See also QXmppMixManager::services().

Member Function Documentation

QXmppMixManager::QXmppMixManager()

Constructs a MIX manager.

[signal] void 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 is the JID of the channel.

[signal] void 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 is the JID of the channel.

[signal] void 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 is the 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 is the JID of the channel. jid is the bare JID to be allowed.

Returns the result of the action.

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 is the JID of the channel. jid is the bare JID to be banned.

Returns the result of the action.

[signal] void QXmppMixManager::channelConfigurationUpdated(const QString &channelJid, const QXmppMixConfigItem &configuration)

Emitted when the configuration of a MIX channel is updated.

channelJid is the JID of the channel whose configuration is updated. configuration is the new channel configuration.

[signal] void QXmppMixManager::channelDeleted(const QString &channelJid)

Emitted when a MIX channel is deleted.

channelJid is the JID of the deleted channel.

[signal] void QXmppMixManager::channelInformationUpdated(const QString &channelJid, const QXmppMixInfoItem &information)

Emitted when the information of a MIX channel is updated.

channelJid is the JID of the channel whose information is updated. information is the 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 is the JID of the service. channelId is the ID of the channel (default: provided by the server).

Returns the result of the action.

QXmppTask<QXmppClient::EmptyResult> QXmppMixManager::deleteChannel(const QString &channelJid)

Deletes the MIX channel with JID channelJid.

Returns the result of the action.

QXmppTask<QXmppClient::EmptyResult> QXmppMixManager::disallowAllJids(const QString &channelJid)

Disallows all formerly allowed JIDs to participate in the MIX channel with JID channelJid.

Only allowed JIDs can be disallowed via this method. In order to disallow other JIDs, use banJid().

Returns the result of the action.

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 is the JID of the channel. jid is the bare JID to be disallowed.

Returns the result of the action.

[signal] void 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 is the JID of the channel. jid is the allowed bare JID.

[signal] void 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 is the JID of the channel. jid is the banned bare JID.

[signal] void 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 is the JID of the channel. jid is the disallowed bare JID.

[signal] void 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 is the JID of the channel. jid is the 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 is the JID of the channel being joined. nickname is the nickname of the user which is usually required by the server (default: no nickname is set). nodes are the nodes of the channel that are subscribed to for receiving their updates (default: all nodes are subcribed to).

Returns the result of the action.

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 is the invitation to the channel. nickname is the nickname of the user which is usually required by the server (default: no nickname is set). nodes are the nodes of the channel that are subscribed to for receiving their updates (default: all nodes are subcribed to).

Returns the result of the action.

QXmppTask<QXmppClient::EmptyResult> QXmppMixManager::leaveChannel(const QString &channelJid)

Leaves the MIX channel with JID channelJid.

Returns the result of the action.

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.

Note: Getter function for property messageArchivingSupport.

[signal] void QXmppMixManager::messageArchivingSupportChanged()

Emitted when the server's support for archiving MIX messages changed.

Note: Notifier signal for property messageArchivingSupport.

[signal] void QXmppMixManager::participantLeft(const QString &channelJid, const QString &participantId)

Emitted when a participant left the MIX channel.

channelJid is the JID of the channel that is left by the participant. participantId is the ID of the left participant.

[signal] void QXmppMixManager::participantReceived(const QString &channelJid, const QXmppMixParticipantItem &participant)

Emitted when a user joined a MIX channel or a participant is updated.

channelJid is the JID of the channel that the user joined or whose participant is updated. participant is the 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.

Returns the server support for MIX channel participants.

Note: Getter function for property participantSupport.

[signal] void QXmppMixManager::participantSupportChanged()

Emitted when the server's support for MIX channel participants changed.

Note: Notifier signal for property participantSupport.

QXmppTask<QXmppMixManager::JidResult> QXmppMixManager::requestAllowedJids(const QString &channelJid)

Requests all JIDs which are allowed to participate in the MIX channel with JID channelJid.

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.

Returns the result of the action.

QXmppTask<QXmppMixManager::JidResult> QXmppMixManager::requestBannedJids(const QString &channelJid)

Requests all JIDs which are not allowed to participate in the MIX channel with JID channelJid.

Returns the result of the action.

QXmppTask<QXmppMixManager::ConfigurationResult> QXmppMixManager::requestChannelConfiguration(const QString &channelJid)

Requests the configuration of the MIX channel with JID channelJid.

Returns the result of the action.

QXmppTask<QXmppMixManager::InformationResult> QXmppMixManager::requestChannelInformation(const QString &channelJid)

Requests the information of the MIX channel with JID channelJid.

Returns the result of the action.

QXmppTask<QXmppMixManager::ChannelJidResult> QXmppMixManager::requestChannelJids(const QString &serviceJid)

Requests the JIDs of all discoverable MIX channels of a MIX service.

serviceJid is the JID of the service that provides the channels.

Returns the result of the action.

QXmppTask<QXmppMixManager::ChannelNodeResult> QXmppMixManager::requestChannelNodes(const QString &channelJid)

Requests all nodes of the MIX channel with JID channelJid that can be subscribed by the user.

Returns the result of the action.

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:

  • The inviter is an administrator of the channel.
  • The inviter is a participant of the channel and the channel allows all participants to invite new users.

channelJid is the JID of the channel that the invitee is invited to. inviteeJid is the JID of the invitee.

Returns the result of the action.

QXmppTask<QXmppMixManager::ParticipantResult> QXmppMixManager::requestParticipants(const QString &channelJid)

Requests all participants of the MIX channel with JID channelJid.

In the case of a channel that not everybody is allowed to participate in, the participants are a subset of the allowed JIDs.

Returns the result of the action.

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.

Note: Getter function for property services.

[signal] void QXmppMixManager::servicesChanged()

Emitted when the services providing MIX on the own server changed.

Note: Notifier signal for property services.

QXmppTask<QXmppClient::EmptyResult> QXmppMixManager::unbanAllJids(const QString &channelJid)

Unbans all formerly banned JIDs from participating in the MIX channel with JID channelJid.

Returns the result of the action.

QXmppTask<QXmppClient::EmptyResult> QXmppMixManager::unbanJid(const QString &channelJid, const QString &jid)

Unbans a formerly banned JID from participating in a MIX channel.

channelJid is the JID of the channel. jid is the bare JID to be unbanned.

Returns the result of the action.

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 is the JID of the channel whose configuration is to be updated. configuration is the new configuration of the channel.

Returns the result of the action.

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 is the JID of the channel whose information is to be updated. information is the new information of the channel.

Returns the result of the action.

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 is the JID of the channel. nickname is the nickname to be set.

Returns the result of the action.

QXmppTask<QXmppMixManager::SubscriptionResult> QXmppMixManager::updateSubscriptions(const QString &channelJid, QXmppMixConfigItem::Nodes subscriptionAdditions = ~QXmppMixConfigItem::Nodes(), QXmppMixConfigItem::Nodes subscriptionRemovals = {})

Updates the subscriptions to nodes of a MIX channel.

channelJid is the JID of the channel. subscriptionAdditions are the nodes to subscribe to. subscriptionRemovals are the nodes to unsubscribe from.

Returns the result of the action.