QXmpp::Messages::SelectEncryption Struct
struct QXmpp::Messages::SelectEncryption| Header: | #include <QXmppMessages.h> |
Detailed Description
Asynchronous hook selecting the end-to-end encryption of an outgoing message.
It runs for every message, also for messages sent by managers on their own (e.g. receipts), except for messages that already contain encrypted elements, e.g. a key exchange created by a provider. They are sent as they are. Handlers run in order and may override the encryption set by earlier ones. Handlers that need to wait, e.g. for a database, return a QXmppTask, others can return void:
client->hooks(this).add<QXmpp::Messages::SelectEncryption>([this](QXmpp::Messages::EncryptionSelection &selection) {
if (isEncryptionEnabled(selection.to())) {
selection.setEncryption(QXmpp::E2ee::Omemo2);
}
});
If no encryption is selected, sensitive stanzas sent by QXmpp's managers (and via the deprecated QXmppClient::sendSensitive()) are encrypted with the deprecated encryption extension (QXmppClient::setEncryptionExtension()) as in earlier versions.