Skip to content

Commit

Permalink
Merge branch '1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
lnjX committed Nov 27, 2024
2 parents b9bfb32 + 1fd87ab commit 67e9849
Show file tree
Hide file tree
Showing 3 changed files with 641 additions and 486 deletions.
27 changes: 20 additions & 7 deletions src/client/QXmppMixManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,30 @@ static void serializeMixData(const MixData &d, QXmlStreamWriter &writer)
/// connection:
/// * participantSupport()
/// * messageArchivingSupport()
/// That is done via QXmppDiscoveryManager::requestInfo():
/// That is done via QXmppDiscoveryManager::requestInfo() for the user JID (i.e., no recipient JID):
/// \code
/// client->findExtension<QXmppDiscoveryManager>()->requestInfo(client->configuration().domain());
/// client->findExtension<QXmppDiscoveryManager>()->requestInfo({});
/// \endcode
///
/// Before calling one of the following methods, you need to request the information once per
/// connection:
/// * services()
/// That is done via QXmppDiscoveryManager::requestItems():
/// That is done via QXmppDiscoveryManager::requestDiscoItems() for the server JID and
/// QXmppDiscoveryManager::requestInfo() for each item it provides:
/// \code
/// client->findExtension<QXmppDiscoveryManager>()->requestItems(client->configuration().domain());
/// const auto *discoveryManager = client->findExtension<QXmppDiscoveryManager>();
/// discoveryManager->requestDiscoItems(client->configuration().domain())
/// .then(this, [this](QXmppDiscoveryManager::ItemsResult &&result) {
/// if (const auto *error = std::get_if<QXmppError>(&result)) {
/// // Handle the error.
/// } else {
/// const auto items = std::get<QList<QXmppDiscoveryIq::Item>>(std::move(result));
/// for (const auto &item : items) {
/// discoveryManager->requestInfo(item.jid());
/// }
/// }
/// }
/// );
/// \endcode
///
/// If you want to be informed about updates of the channel (e.g., its configuration or allowed
Expand Down Expand Up @@ -1394,7 +1407,7 @@ QXmppTask<QXmppClient::EmptyResult> QXmppMixManager::addJidToNode(const QString
void QXmppMixManager::handleDiscoInfo(const QXmppDiscoveryIq &iq)
{
// Check the server's functionality to support MIX clients.
if (iq.from().isEmpty() || iq.from() == client()->configuration().domain()) {
if (iq.from().isEmpty() || iq.from() == client()->configuration().jidBare()) {
// Check whether MIX is supported.
if (iq.features().contains(ns_mix_pam)) {
setParticipantSupport(QXmppMixManager::Support::Supported);
Expand All @@ -1409,7 +1422,7 @@ void QXmppMixManager::handleDiscoInfo(const QXmppDiscoveryIq &iq)
}
}

const auto jid = iq.from().isEmpty() ? client()->configuration().domain() : iq.from();
const auto jid = iq.from();

// If no MIX service is provided by the JID, remove it from the cache.
if (!iq.features().contains(ns_mix)) {
Expand All @@ -1424,7 +1437,7 @@ void QXmppMixManager::handleDiscoInfo(const QXmppDiscoveryIq &iq)
// ' || identity.type() == u"text"' is a workaround for older ejabberd versions.
if (identity.category() == u"conference" && (identity.type() == MIX_SERVICE_DISCOVERY_NODE || identity.type() == u"text")) {
Service service;
service.jid = iq.from().isEmpty() ? client()->configuration().domain() : iq.from();
service.jid = jid;
service.channelsSearchable = iq.features().contains(ns_mix_searchable);
service.channelCreationAllowed = iq.features().contains(ns_mix_create_channel);

Expand Down
2 changes: 1 addition & 1 deletion src/client/QXmppMixManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class QXMPP_EXPORT QXmppMixManager : public QXmppClientExtension, public QXmppPu
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<SubscriptionResult> updateSubscriptions(const QString &channelJid, QXmppMixConfigItem::Nodes subscriptionAdditions = ~QXmppMixConfigItem::Nodes(), QXmppMixConfigItem::Nodes subscriptionRemovals = {});

QXmppTask<InvitationResult> requestInvitation(const QString &channelJid, const QString &inviteeJid);

Expand Down
Loading

0 comments on commit 67e9849

Please sign in to comment.