Loading...
Searching...
No Matches
QXmppUri.h
// SPDX-FileCopyrightText: 2019 Linus Jahn <lnj@kaidan.im>
// SPDX-FileCopyrightText: 2019 Melvin Keskin <melvo@olomono.de>
// SPDX-FileCopyrightText: 2020 Jonah Brüchert <jbb@kaidan.im>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef QXMPPURI_H
#define QXMPPURI_H
#include <QXmppError.h>
#include <QXmppMessage.h>
#include <variant>
class QUrlQuery;
struct QXmppUriPrivate;
namespace QXmpp::Uri {
struct Command {
QString node;
QString action;
bool operator==(const Command &) const = default;
};
struct Invite {
QString inviteeJid;
QString password;
bool operator==(const Invite &) const = default;
};
struct Join {
QString password;
bool operator==(const Join &) const = default;
};
struct Login {
QString password;
bool operator==(const Login &) const = default;
};
struct Message {
QString subject;
QString body;
QString thread;
QString id;
QString from;
std::optional<QXmppMessage::Type> type;
bool operator==(const Message &) const = default;
};
struct Unregister {
bool operator==(const Unregister &) const = default;
};
struct Unsubscribe {
bool operator==(const Unsubscribe &) const = default;
};
struct Register {
bool operator==(const Register &) const = default;
};
struct Remove {
bool operator==(const Remove &) const = default;
};
struct Roster {
QString name;
QString group;
bool operator==(const Roster &) const = default;
};
struct Subscribe {
bool operator==(const Subscribe &) const = default;
};
struct TrustMessage {
QString encryption;
QList<QString> trustKeyIds;
QList<QString> distrustKeyIds;
bool operator==(const TrustMessage &) const = default;
};
struct CustomQuery {
QString query;
QList<std::pair<QString, QString>> parameters;
bool operator==(const CustomQuery &) const = default;
};
} // namespace QXmpp::Uri
class QXMPP_EXPORT QXmppUri
{
public:
QXmppUri();
QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppUri)
static std::variant<QXmppUri, QXmppError> fromString(const QString &);
QString toString();
QString jid() const;
void setJid(const QString &jid);
std::any query() const;
void setQuery(QXmpp::Uri::Command &&q) { setQuery(std::any(std::move(q))); }
void setQuery(QXmpp::Uri::Invite &&q) { setQuery(std::any(std::move(q))); }
void setQuery(QXmpp::Uri::Join &&q) { setQuery(std::any(std::move(q))); }
void setQuery(QXmpp::Uri::Login &&q) { setQuery(std::any(std::move(q))); }
void setQuery(QXmpp::Uri::Message &&q) { setQuery(std::any(std::move(q))); }
void setQuery(QXmpp::Uri::Unregister &&q) { setQuery(std::any(std::move(q))); }
void setQuery(QXmpp::Uri::Register &&q) { setQuery(std::any(std::move(q))); }
void setQuery(QXmpp::Uri::Remove &&q) { setQuery(std::any(std::move(q))); }
void setQuery(QXmpp::Uri::Roster &&q) { setQuery(std::any(std::move(q))); }
void setQuery(QXmpp::Uri::Subscribe &&q) { setQuery(std::any(std::move(q))); }
void setQuery(QXmpp::Uri::TrustMessage &&q) { setQuery(std::any(std::move(q))); }
void setQuery(QXmpp::Uri::CustomQuery &&q) { setQuery(std::any(std::move(q))); }
void resetQuery() { setQuery(std::any()); }
private:
void setQuery(std::any &&);
QSharedDataPointer<QXmppUriPrivate> d;
};
#endif // QXMPPURI_H
QXmppUri::setQuery
void setQuery(QXmpp::Uri::Subscribe &&q)
Sets a subscribe query.
Definition QXmppUri.h:167
QXmppUri::setQuery
void setQuery(QXmpp::Uri::CustomQuery &&q)
Sets a query with custom name and key-value pairs.
Definition QXmppUri.h:171
QXmppUri::setQuery
void setQuery(QXmpp::Uri::Message &&q)
Sets a message query.
Definition QXmppUri.h:157
QXmppUri::fromString
static std::variant< QXmppUri, QXmppError > fromString(const QString &)
Definition QXmppUri.cpp:374
QXmppUri::setJid
void setJid(const QString &jid)
Definition QXmppUri.cpp:493
QXmppUri::setQuery
void setQuery(QXmpp::Uri::Command &&q)
Sets a "command" query.
Definition QXmppUri.h:149
QXmppUri::query
std::any query() const
Definition QXmppUri.cpp:504
QXmppUri::setQuery
void setQuery(QXmpp::Uri::Register &&q)
Sets a register query.
Definition QXmppUri.h:161
QXmppUri::setQuery
void setQuery(QXmpp::Uri::Join &&q)
Sets a MUC join query.
Definition QXmppUri.h:153
QXmppUri::setQuery
void setQuery(QXmpp::Uri::Unregister &&q)
Sets a unregister query.
Definition QXmppUri.h:159
QXmppUri::setQuery
void setQuery(QXmpp::Uri::Invite &&q)
Sets a MUC invite query.
Definition QXmppUri.h:151
QXmppUri::setQuery
void setQuery(QXmpp::Uri::Remove &&q)
Sets a remove query.
Definition QXmppUri.h:163
QXmppUri::setQuery
void setQuery(QXmpp::Uri::Roster &&q)
Sets a roster query.
Definition QXmppUri.h:165
QXmppUri::setQuery
void setQuery(QXmpp::Uri::Login &&q)
Sets a login query.
Definition QXmppUri.h:155
QXmppUri::resetQuery
void resetQuery()
Removes any query from the URI.
Definition QXmppUri.h:173
QXmppUri::setQuery
void setQuery(QXmpp::Uri::TrustMessage &&q)
Sets a trust message query.
Definition QXmppUri.h:169
QXmppUri::QXmppUri
QXmppUri()
Definition QXmppUri.cpp:362
QXmppUri::toString
QString toString()
Definition QXmppUri.cpp:449
QXmppUri::jid
QString jid() const
Definition QXmppUri.cpp:485
QXmpp::Uri
QXmpp::Uri::Command
Definition QXmppUri.h:21
QXmpp::Uri::Command::operator==
bool operator==(const Command &) const =default
Default comparison operator.
QXmpp::Uri::Command::action
QString action
the ad-hoc commands action type
Definition QXmppUri.h:25
QXmpp::Uri::Command::node
QString node
the command node
Definition QXmppUri.h:23
QXmpp::Uri::CustomQuery
Definition QXmppUri.h:122
QXmpp::Uri::CustomQuery::query
QString query
query name as string
Definition QXmppUri.h:124
QXmpp::Uri::CustomQuery::parameters
QList< std::pair< QString, QString > > parameters
list of parameters as key-value pairs
Definition QXmppUri.h:126
QXmpp::Uri::CustomQuery::operator==
bool operator==(const CustomQuery &) const =default
Default comparison operator.
QXmpp::Uri::Invite
Definition QXmppUri.h:31
QXmpp::Uri::Invite::operator==
bool operator==(const Invite &) const =default
Default comparison operator.
QXmpp::Uri::Invite::password
QString password
the password required to enter a multi-user chat room
Definition QXmppUri.h:35
QXmpp::Uri::Invite::inviteeJid
QString inviteeJid
the JID of the invitee
Definition QXmppUri.h:33
QXmpp::Uri::Join
Definition QXmppUri.h:41
QXmpp::Uri::Join::operator==
bool operator==(const Join &) const =default
Default comparison operator.
QXmpp::Uri::Join::password
QString password
the password required to enter a multi-user chat room
Definition QXmppUri.h:43
QXmpp::Uri::Login
Definition QXmppUri.h:49
QXmpp::Uri::Login::password
QString password
the password required to connect to the account
Definition QXmppUri.h:51
QXmpp::Uri::Login::operator==
bool operator==(const Login &) const =default
Default comparison operator.
QXmpp::Uri::Message
Definition QXmppUri.h:57
QXmpp::Uri::Message::subject
QString subject
a subject for the message per the "jabber:client" schema
Definition QXmppUri.h:59
QXmpp::Uri::Message::from
QString from
an ID for the message per the "jabber:client" schema
Definition QXmppUri.h:67
QXmpp::Uri::Message::id
QString id
a from address for the message per the "jabber:client" schema
Definition QXmppUri.h:65
QXmpp::Uri::Message::thread
QString thread
a Thread ID for the message per the "jabber:client" schema
Definition QXmppUri.h:63
QXmpp::Uri::Message::operator==
bool operator==(const Message &) const =default
Default comparison operator.
QXmpp::Uri::Message::type
std::optional< QXmppMessage::Type > type
the message type per the "jabber:client" schema
Definition QXmppUri.h:69
QXmpp::Uri::Message::body
QString body
a body for the message per the "jabber:client" schema
Definition QXmppUri.h:61
QXmpp::Uri::Register
Definition QXmppUri.h:85
QXmpp::Uri::Register::operator==
bool operator==(const Register &) const =default
Default comparison operator.
QXmpp::Uri::Remove
Definition QXmppUri.h:90
QXmpp::Uri::Remove::operator==
bool operator==(const Remove &) const =default
Default comparison operator.
QXmpp::Uri::Roster
Definition QXmppUri.h:95
QXmpp::Uri::Roster::name
QString name
the user-assigned group for the roster item
Definition QXmppUri.h:97
QXmpp::Uri::Roster::operator==
bool operator==(const Roster &) const =default
Default comparison operator.
QXmpp::Uri::Roster::group
QString group
the user-assigned name for the roster item
Definition QXmppUri.h:99
QXmpp::Uri::Subscribe
Definition QXmppUri.h:105
QXmpp::Uri::Subscribe::operator==
bool operator==(const Subscribe &) const =default
Default comparison operator.
QXmpp::Uri::TrustMessage
Definition QXmppUri.h:110
QXmpp::Uri::TrustMessage::trustKeyIds
QList< QString > trustKeyIds
list of Base16 encoded key identifiers to be trusted
Definition QXmppUri.h:114
QXmpp::Uri::TrustMessage::encryption
QString encryption
encryption of the keys to trust or distrust
Definition QXmppUri.h:112
QXmpp::Uri::TrustMessage::distrustKeyIds
QList< QString > distrustKeyIds
list of Base16 encoded key identifiers to be distrusted
Definition QXmppUri.h:116
QXmpp::Uri::TrustMessage::operator==
bool operator==(const TrustMessage &) const =default
Default comparison operator.
QXmpp::Uri::Unregister
Definition QXmppUri.h:75
QXmpp::Uri::Unregister::operator==
bool operator==(const Unregister &) const =default
Default comparison operator.
QXmpp::Uri::Unsubscribe
Definition QXmppUri.h:80
QXmpp::Uri::Unsubscribe::operator==
bool operator==(const Unsubscribe &) const =default
Default comparison operator.