Skip to content

Commit

Permalink
Merge branch '1.5' into 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
lnjX committed Oct 29, 2024
2 parents 00a34aa + c58b681 commit 56eaed2
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 45 deletions.
87 changes: 43 additions & 44 deletions src/client/QXmppMamManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,58 +321,57 @@ QXmppTask<QXmppMamManager::RetrieveResult> QXmppMamManager::retrieveMessages(con
// initialize processed messages (we need random access because
// decryptMessage() may finish in random order)
state.processedMessages.resize(state.messages.size());

// check for encrypted messages (once)
auto messagesEncrypted = transform(state.messages, [&](const auto &m) {
return e2eeExt->isEncrypted(m.element);
});
auto encryptedCount = sum(messagesEncrypted);

// We can't do this on the fly (with ++ and --) in the for loop
// because some decryptMessage() jobs could finish instantly
state.runningDecryptionJobs = encryptedCount;

int size = state.messages.size();
for (auto i = 0; i < size; i++) {
if (!messagesEncrypted[i]) {
continue;
}

e2eeExt->decryptMessage(parseMamMessage(state.messages.at(i), Encrypted)).then(this, [this, i, queryId](auto result) {
auto itr = d->ongoingRequests.find(queryId.toStdString());
Q_ASSERT(itr != d->ongoingRequests.end());

auto &state = itr->second;

// store decrypted message, fallback to encrypted message
if (std::holds_alternative<QXmppMessage>(result)) {
state.processedMessages[i] = std::get<QXmppMessage>(std::move(result));
} else {
warning(QStringLiteral("Error decrypting message."));
state.processedMessages[i] = parseMamMessage(state.messages[i], Unencrypted);
}

// finish promise if this was the last job
state.runningDecryptionJobs = state.messages.size();

const auto size = state.messages.size();
for (qsizetype i = 0; i < size; i++) {
const auto &message = state.messages.at(i);

// decrypt message if needed
if (e2eeExt->isEncrypted(message.element)) {
e2eeExt->decryptMessage(parseMamMessage(state.messages.at(i), Encrypted)).then(this, [this, i, queryId](auto result) {
// find state (again)
auto itr = d->ongoingRequests.find(queryId.toStdString());
Q_ASSERT(itr != d->ongoingRequests.end());

auto &state = itr->second;

// store decrypted message, fallback to encrypted message
if (std::holds_alternative<QXmppMessage>(result)) {
state.processedMessages[i] = std::get<QXmppMessage>(std::move(result));
} else {
warning("Error decrypting message.");
state.processedMessages[i] = parseMamMessage(state.messages[i], Unencrypted);
}

// finish promise on last job
state.runningDecryptionJobs--;
if (state.runningDecryptionJobs == 0) {
state.finish();
d->ongoingRequests.erase(itr);
}
});
} else {
state.processedMessages[i] = parseMamMessage(state.messages.at(i), Unencrypted);

// finish promise on last job (may be needed if no messages are encrypted or
// decryption finishes instantly)
state.runningDecryptionJobs--;
if (state.runningDecryptionJobs == 0) {
state.finish();
d->ongoingRequests.erase(itr);
}
});
}
}
} else {
// for the case without decryption
state.processedMessages = transform(state.messages, [](const auto &m) {
return parseMamMessage(m, Unencrypted);
});

// finishing the promise is done after decryptMessage()
if (encryptedCount > 0) {
return;
}
state.finish();
d->ongoingRequests.erase(itr);
}

// for the case without decryption, finish here
state.processedMessages = transform(state.messages, [](const auto &m) {
return parseMamMessage(m, Unencrypted);
});
state.finish();
d->ongoingRequests.erase(itr);
});

return task;
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ add_simple_test(qxmppiceconnection)
add_simple_test(qxmppiq)
add_simple_test(qxmppjingledata)
add_simple_test(qxmppjinglemessageinitiationmanager)
add_simple_test(qxmppmammanager)
add_simple_test(qxmppmammanager TestClient.h)
add_simple_test(qxmppmixinvitation)
add_simple_test(qxmppmixitems)
add_simple_test(qxmppmessage)
Expand Down
153 changes: 153 additions & 0 deletions tests/qxmppmammanager/tst_qxmppmammanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,45 @@
//
// SPDX-License-Identifier: LGPL-2.1-or-later

#include "QXmppE2eeExtension.h"
#include "QXmppFutureUtils_p.h"
#include "QXmppMamManager.h"
#include "QXmppMessage.h"

#include "TestClient.h"
#include "util.h"
#include <QObject>

using namespace QXmpp::Private;

class EncryptionExtension : public QXmppE2eeExtension
{
public:
QXmppTask<MessageEncryptResult> encryptMessage(QXmppMessage &&, const std::optional<QXmppSendStanzaParams> &) override
{
return makeReadyTask<MessageEncryptResult>(QXmppError { "it's only a test", QXmpp::SendError::EncryptionError });
}
QXmppTask<MessageDecryptResult> decryptMessage(QXmppMessage &&m) override
{
m.setBody(m.e2eeFallbackBody());
m.setE2eeFallbackBody({});
return makeReadyTask<MessageDecryptResult>(std::move(m));
}

QXmppTask<IqEncryptResult> encryptIq(QXmppIq &&, const std::optional<QXmppSendStanzaParams> &) override
{
return makeReadyTask<IqEncryptResult>(QXmppError { "it's only a test", QXmpp::SendError::EncryptionError });
}

QXmppTask<IqDecryptResult> decryptIq(const QDomElement &) override
{
return makeReadyTask<IqDecryptResult>(QXmppError { "it's only a test", QXmpp::SendError::EncryptionError });
}

bool isEncrypted(const QDomElement &e) override { return !e.firstChildElement("test-encrypted").isNull(); };
bool isEncrypted(const QXmppMessage &) override { return false; };
};

class QXmppMamTestHelper : public QObject
{
Q_OBJECT
Expand Down Expand Up @@ -39,6 +72,10 @@ class tst_QXmppMamManager : public QObject
Q_SLOT void testHandleResultIq_data();
Q_SLOT void testHandleResultIq();

// test for task-based API
Q_SLOT void retrieveMessagesUnencrypted();
Q_SLOT void retrieveMessagesEncrypted();

QXmppMamTestHelper m_helper;
QXmppMamManager m_manager;
};
Expand Down Expand Up @@ -205,6 +242,122 @@ void tst_QXmppMamManager::testHandleResultIq()
QCOMPARE(m_helper.m_signalTriggered, accept);
}

void tst_QXmppMamManager::retrieveMessagesUnencrypted()
{
TestClient test;
auto *mam = test.addNewExtension<QXmppMamManager>();
auto task = mam->retrieveMessages("mam.server.org");
test.expect("<iq id='qxmpp1' to='mam.server.org' type='set'>"
"<query xmlns='urn:xmpp:mam:2' queryid='qxmpp1'>"
"<x xmlns='jabber:x:data' type='submit'>"
"<field type='hidden' var='FORM_TYPE'><value>urn:xmpp:mam:2</value></field>"
"</x>"
"</query>"
"</iq>");
mam->handleStanza(xmlToDom("<message id='aeb213' to='[email protected]/chamber' from='mam.server.org'>"
"<result xmlns='urn:xmpp:mam:2' queryid='qxmpp1' id='28482-98726-73623'>"
"<forwarded xmlns='urn:xmpp:forward:0'>"
"<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:25Z'/>"
"<message xmlns='jabber:client'"
" to='[email protected]/balcony'"
" from='[email protected]/orchard'"
" type='chat'>"
"<body>Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.</body>"
"</message>"
"</forwarded>"
"</result>"
"</message>"));
mam->handleStanza(xmlToDom("<message id='aeb214' to='[email protected]/chamber' from='mam.server.org'>"
"<result xmlns='urn:xmpp:mam:2' queryid='qxmpp1' id='5d398-28273-f7382'>"
"<forwarded xmlns='urn:xmpp:forward:0'>"
"<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:09:32Z'/>"
"<message xmlns='jabber:client'"
" to='[email protected]/orchard'"
" from='[email protected]/balcony'"
" type='chat' id='8a54s'>"
"<body>What man art thou that thus bescreen'd in night so stumblest on my counsel?</body>"
"</message>"
"</forwarded>"
"</result>"
"</message>"));
test.inject("<iq type='result' id='qxmpp1'>"
"<fin xmlns='urn:xmpp:mam:2'>"
"<set xmlns='http://jabber.org/protocol/rsm'>"
"<first index='0'>28482-98726-73623</first>"
"<last>09af3-cc343-b409f</last>"
"</set>"
"</fin>"
"</iq>");

auto retrieved = expectFutureVariant<QXmppMamManager::RetrievedMessages>(task);
QCOMPARE(retrieved.messages.size(), 2);
QCOMPARE(retrieved.messages.at(0).body(), "Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.");
QCOMPARE(retrieved.messages.at(1).body(), "What man art thou that thus bescreen'd in night so stumblest on my counsel?");
QCOMPARE(retrieved.result.resultSetReply().first(), "28482-98726-73623");
}

void tst_QXmppMamManager::retrieveMessagesEncrypted()
{
TestClient test;
// e2ee
auto e2ee = std::make_unique<EncryptionExtension>();
test.setEncryptionExtension(e2ee.get());
// mam manager
auto *mam = test.addNewExtension<QXmppMamManager>();

// start request
auto task = mam->retrieveMessages("mam.server.org");
test.expect("<iq id='qxmpp1' to='mam.server.org' type='set'>"
"<query xmlns='urn:xmpp:mam:2' queryid='qxmpp1'>"
"<x xmlns='jabber:x:data' type='submit'>"
"<field type='hidden' var='FORM_TYPE'><value>urn:xmpp:mam:2</value></field>"
"</x>"
"</query>"
"</iq>");
mam->handleStanza(xmlToDom("<message id='aeb213' to='[email protected]/chamber' from='mam.server.org'>"
"<result xmlns='urn:xmpp:mam:2' queryid='qxmpp1' id='28482-98726-73623'>"
"<forwarded xmlns='urn:xmpp:forward:0'>"
"<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:25Z'/>"
"<message xmlns='jabber:client'"
" to='[email protected]/balcony'"
" from='[email protected]/orchard'"
" type='chat'>"
"<test-encrypted/>"
"<body>Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.</body>"
"</message>"
"</forwarded>"
"</result>"
"</message>"));
mam->handleStanza(xmlToDom("<message id='aeb214' to='[email protected]/chamber' from='mam.server.org'>"
"<result xmlns='urn:xmpp:mam:2' queryid='qxmpp1' id='5d398-28273-f7382'>"
"<forwarded xmlns='urn:xmpp:forward:0'>"
"<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:09:32Z'/>"
"<message xmlns='jabber:client'"
" to='[email protected]/orchard'"
" from='[email protected]/balcony'"
" type='chat' id='8a54s'>"
"<body>What man art thou that thus bescreen'd in night so stumblest on my counsel?</body>"
"</message>"
"</forwarded>"
"</result>"
"</message>"));
test.inject("<iq type='result' id='qxmpp1'>"
"<fin xmlns='urn:xmpp:mam:2'>"
"<set xmlns='http://jabber.org/protocol/rsm'>"
"<first index='0'>28482-98726-73623</first>"
"<last>09af3-cc343-b409f</last>"
"</set>"
"</fin>"
"</iq>");

// check results
auto retrieved = expectFutureVariant<QXmppMamManager::RetrievedMessages>(task);
QCOMPARE(retrieved.messages.size(), 2);
QCOMPARE(retrieved.messages.at(0).body(), "Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.");
QCOMPARE(retrieved.messages.at(1).body(), "What man art thou that thus bescreen'd in night so stumblest on my counsel?");
QCOMPARE(retrieved.result.resultSetReply().first(), "28482-98726-73623");
}

void QXmppMamTestHelper::archivedMessageReceived(const QString &queryId, const QXmppMessage &message)
{
m_signalTriggered = true;
Expand Down

1 comment on commit 56eaed2

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format (v15.0.7) reports: 4 file(s) not formatted
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp
  • tests/qxmppversionmanager/tst_qxmppversionmanager.cpp
  • src/base/QXmppPubSubIq_p.h
  • src/client/QXmppBlockingManager.h
clang-tidy (v15.0.7) reports: 4534 concern(s)
  • tests/qxmppclient/tst_qxmppclient.cpp:6:10: error: [clang-diagnostic-error]

    'QXmppClient.h' file not found

    #include "QXmppClient.h"
             ^~~~~~~~~~~~~~~
  • tests/qxmppclient/tst_qxmppclient.cpp:22:7: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: client

    class tst_QXmppClient : public QObject
          ^
  • tests/qxmppclient/tst_qxmppclient.cpp:29:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void handleMessageSent(QXmppLogger::MessageType type, const QString &text) const;
                    ^
  • tests/qxmppclient/tst_qxmppclient.cpp:30:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testSendMessage();
                    ^
  • tests/qxmppclient/tst_qxmppclient.cpp:31:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testIndexOfExtension();
                    ^
  • tests/qxmppclient/tst_qxmppclient.cpp:32:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testE2eeExtension();
                    ^
  • tests/qxmppclient/tst_qxmppclient.cpp:33:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testTaskDirect();
                    ^
  • tests/qxmppclient/tst_qxmppclient.cpp:34:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testTaskStore();
                    ^
  • tests/qxmppclient/tst_qxmppclient.cpp:39:23: warning: [readability-convert-member-functions-to-static]

    method 'handleMessageSent' can be made static

    void tst_QXmppClient::handleMessageSent(QXmppLogger::MessageType type, const QString &text) const
                          ^                                                                     ~~~~~
    static 
  • tests/qxmppclient/tst_qxmppclient.cpp:39:41: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'handleMessageSent' of similar type are easily swapped by mistake

    void tst_QXmppClient::handleMessageSent(QXmppLogger::MessageType type, const QString &text) const
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/qxmpp/qxmpp/tests/qxmppclient/tst_qxmppclient.cpp:39:66: note: the first parameter in the range is 'type'
    void tst_QXmppClient::handleMessageSent(QXmppLogger::MessageType type, const QString &text) const
                                                                     ^~~~
    /home/runner/work/qxmpp/qxmpp/tests/qxmppclient/tst_qxmppclient.cpp:39:87: note: the last parameter in the range is 'text'
    void tst_QXmppClient::handleMessageSent(QXmppLogger::MessageType type, const QString &text) const
                                                                                          ^~~~
    /home/runner/work/qxmpp/qxmpp/tests/qxmppclient/tst_qxmppclient.cpp:39:72: note: 'int' and 'const int &' parameters accept and bind the same kind of values
    void tst_QXmppClient::handleMessageSent(QXmppLogger::MessageType type, const QString &text) const
                                                                           ^
  • tests/qxmppclient/tst_qxmppclient.cpp:43:18: warning: [cppcoreguidelines-init-variables]

    variable 'msg' is not initialized

        QXmppMessage msg;
                     ^
                         = 0
  • tests/qxmppclient/tst_qxmppclient.cpp:56:23: warning: [readability-convert-member-functions-to-static]

    method 'testSendMessage' can be made static

    void tst_QXmppClient::testSendMessage()
                          ^
    static 
  • tests/qxmppclient/tst_qxmppclient.cpp:58:17: warning: [cppcoreguidelines-init-variables]

    variable 'logger' is not initialized

        QXmppLogger logger;
                    ^
                           = 0
  • tests/qxmppclient/tst_qxmppclient.cpp:73:23: warning: [readability-convert-member-functions-to-static]

    method 'testIndexOfExtension' can be made static

    void tst_QXmppClient::testIndexOfExtension()
                          ^
    static 
  • tests/qxmppclient/tst_qxmppclient.cpp:101:37: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        QXmppTask<MessageEncryptResult> encryptMessage(QXmppMessage &&, const std::optional<QXmppSendStanzaParams> &) override
                                        ^
  • tests/qxmppclient/tst_qxmppclient.cpp:101:67: warning: [readability-named-parameter]

    all parameters should be named in a function

        QXmppTask<MessageEncryptResult> encryptMessage(QXmppMessage &&, const std::optional<QXmppSendStanzaParams> &) override
                                                                      ^
                                                                       /*unused*/                                    /*unused*/
  • tests/qxmppclient/tst_qxmppclient.cpp:106:37: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        QXmppTask<MessageDecryptResult> decryptMessage(QXmppMessage &&) override
                                        ^
  • tests/qxmppclient/tst_qxmppclient.cpp:106:67: warning: [readability-named-parameter]

    all parameters should be named in a function

        QXmppTask<MessageDecryptResult> decryptMessage(QXmppMessage &&) override
                                                                      ^
                                                                       /*unused*/
  • tests/qxmppclient/tst_qxmppclient.cpp:111:32: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        QXmppTask<IqEncryptResult> encryptIq(QXmppIq &&, const std::optional<QXmppSendStanzaParams> &) override
                                   ^
  • tests/qxmppclient/tst_qxmppclient.cpp:111:52: warning: [readability-named-parameter]

    all parameters should be named in a function

        QXmppTask<IqEncryptResult> encryptIq(QXmppIq &&, const std::optional<QXmppSendStanzaParams> &) override
                                                       ^
                                                        /*unused*/                                    /*unused*/
  • tests/qxmppclient/tst_qxmppclient.cpp:117:32: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        QXmppTask<IqDecryptResult> decryptIq(const QDomElement &) override
                                   ^
  • tests/qxmppclient/tst_qxmppclient.cpp:117:61: warning: [readability-named-parameter]

    all parameters should be named in a function

        QXmppTask<IqDecryptResult> decryptIq(const QDomElement &) override
                                                                ^
                                                                 /*unused*/
  • tests/qxmppclient/tst_qxmppclient.cpp:122:10: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        bool isEncrypted(const QDomElement &) override { return false; };
        ~~~~ ^
        auto                                  -> bool
  • tests/qxmppclient/tst_qxmppclient.cpp:122:10: warning: [readability-convert-member-functions-to-static]

    method 'isEncrypted' can be made static

        bool isEncrypted(const QDomElement &) override { return false; };
             ^
        static 
  • tests/qxmppclient/tst_qxmppclient.cpp:122:41: warning: [readability-named-parameter]

    all parameters should be named in a function

        bool isEncrypted(const QDomElement &) override { return false; };
                                            ^
                                             /*unused*/
  • tests/qxmppclient/tst_qxmppclient.cpp:123:10: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        bool isEncrypted(const QXmppMessage &) override { return false; };
        ~~~~ ^
        auto                                   -> bool
  • tests/qxmppclient/tst_qxmppclient.cpp:123:10: warning: [readability-convert-member-functions-to-static]

    method 'isEncrypted' can be made static

        bool isEncrypted(const QXmppMessage &) override { return false; };
             ^
        static 
  • tests/qxmppclient/tst_qxmppclient.cpp:123:42: warning: [readability-named-parameter]

    all parameters should be named in a function

        bool isEncrypted(const QXmppMessage &) override { return false; };
                                             ^
                                              /*unused*/
  • tests/qxmppclient/tst_qxmppclient.cpp:126:23: warning: [readability-convert-member-functions-to-static]

    method 'testE2eeExtension' can be made static

    void tst_QXmppClient::testE2eeExtension()
                          ^
    static 
  • tests/qxmppclient/tst_qxmppclient.cpp:128:17: warning: [cppcoreguidelines-init-variables]

    variable 'client' is not initialized

        QXmppClient client;
                    ^
                           = 0
  • tests/qxmppclient/tst_qxmppclient.cpp:144:26: warning: [cppcoreguidelines-init-variables]

    variable 'request' is not initialized

            QXmppDiscoveryIq request;
                             ^
                                     = 0
  • tests/qxmppclient/tst_qxmppclient.cpp:170:27: warning: [cppcoreguidelines-init-variables]

    variable 'p' is not initialized

        QXmppPromise<QXmppIq> p;
                              ^
                                = 0
  • tests/qxmppclient/tst_qxmppclient.cpp:170:27: warning: [readability-identifier-length]

    variable name 'p' is too short, expected at least 3 characters

  • tests/qxmppclient/tst_qxmppclient.cpp:171:21: warning: [cppcoreguidelines-init-variables]

    variable 'iq' is not initialized

        QXmppRegisterIq iq;
                        ^
                           = 0
  • tests/qxmppclient/tst_qxmppclient.cpp:171:21: warning: [readability-identifier-length]

    variable name 'iq' is too short, expected at least 3 characters

  • tests/qxmppclient/tst_qxmppclient.cpp:175:49: warning: [readability-identifier-length]

    parameter name 'iq' is too short, expected at least 3 characters

        p.task().then(this, [&thenCalled](QXmppIq &&iq) {
                                                    ^
  • tests/qxmppclient/tst_qxmppclient.cpp:187:27: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

    static QXmppTask<QXmppIq> generateRegisterIq()
                              ^
  • tests/qxmppclient/tst_qxmppclient.cpp:189:27: warning: [cppcoreguidelines-init-variables]

    variable 'p' is not initialized

        QXmppPromise<QXmppIq> p;
                              ^
                                = 0
  • tests/qxmppclient/tst_qxmppclient.cpp:189:27: warning: [readability-identifier-length]

    variable name 'p' is too short, expected at least 3 characters

  • tests/qxmppclient/tst_qxmppclient.cpp:190:21: warning: [cppcoreguidelines-init-variables]

    variable 'iq' is not initialized

        QXmppRegisterIq iq;
                        ^
                           = 0
  • tests/qxmppclient/tst_qxmppclient.cpp:190:21: warning: [readability-identifier-length]

    variable name 'iq' is too short, expected at least 3 characters

  • tests/qxmppclient/tst_qxmppclient.cpp:202:45: warning: [readability-identifier-length]

    parameter name 'iq' is too short, expected at least 3 characters

        task.then(this, [&thenCalled](QXmppIq &&iq) {
                                                ^
  • tests/qxmppclient/tst_qxmppclient.cpp:211:27: warning: [cppcoreguidelines-init-variables]

    variable 'p' is not initialized

        QXmppPromise<QXmppIq> p;
                              ^
                                = 0
  • tests/qxmppclient/tst_qxmppclient.cpp:211:27: warning: [readability-identifier-length]

    variable name 'p' is too short, expected at least 3 characters

  • tests/qxmppclient/tst_qxmppclient.cpp:212:21: warning: [cppcoreguidelines-init-variables]

    variable 'iq' is not initialized

        QXmppRegisterIq iq;
                        ^
                           = 0
  • tests/qxmppclient/tst_qxmppclient.cpp:212:21: warning: [readability-identifier-length]

    variable name 'iq' is too short, expected at least 3 characters

  • tests/qxmppclient/tst_qxmppclient.cpp:220:49: warning: [readability-identifier-length]

    parameter name 'iq' is too short, expected at least 3 characters

        p.task().then(this, [&thenCalled](QXmppIq &&iq) {
                                                    ^
  • tests/qxmppclient/tst_qxmppclient.cpp:231:12: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'tst_QXmppClient' is non-const and globally accessible, consider making it const

    QTEST_MAIN(tst_QXmppClient)
               ^
  • tests/qxmpppubsubforms/tst_qxmpppubsubforms.cpp:5:10: error: [clang-diagnostic-error]

    'QXmppDataFormBase.h' file not found

    #include "QXmppDataFormBase.h"
             ^~~~~~~~~~~~~~~~~~~~~
  • tests/qxmpppubsubforms/tst_qxmpppubsubforms.cpp:19:28: warning: [readability-convert-member-functions-to-static]

    method 'subAuthorization' can be made static

    void tst_QXmppPubSubForms::subAuthorization()
                               ^
    static 
  • tests/qxmpppubsubforms/tst_qxmpppubsubforms.cpp:21:16: warning: [cppcoreguidelines-init-variables]

    variable 'xml' is not initialized

        QByteArray xml(R"(
                   ^
                       = 0
  • tests/qxmpppubsubforms/tst_qxmpppubsubforms.cpp:32:19: warning: [cppcoreguidelines-init-variables]

    variable 'form' is not initialized

        QXmppDataForm form;
                      ^
                           = 0
  • tests/qxmpppubsubforms/tst_qxmpppubsubforms.cpp:49:12: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'tst_QXmppPubSubForms' is non-const and globally accessible, consider making it const

    QTEST_MAIN(tst_QXmppPubSubForms)
               ^
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:5:10: error: [clang-diagnostic-error]

    'QXmppEntityTimeIq.h' file not found

    #include "QXmppEntityTimeIq.h"
             ^~~~~~~~~~~~~~~~~~~~~
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:10:20: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'QXmppEntityTimeIq' is non-const and globally accessible, consider making it const

    Q_DECLARE_METATYPE(QXmppEntityTimeIq)
                       ^
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:12:7: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: Q_SLOT

    class tst_QXmppEntityTimeManager : public QObject
          ^
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:16:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testSendRequest();
                    ^
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:17:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testHandleRequest();
                    ^
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:20:34: warning: [readability-convert-member-functions-to-static]

    method 'initTestCase' can be made static

    void tst_QXmppEntityTimeManager::initTestCase()
                                     ^
    static 
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:25:34: warning: [readability-convert-member-functions-to-static]

    method 'testSendRequest' can be made static

    void tst_QXmppEntityTimeManager::testSendRequest()
                                     ^
    static 
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:27:16: warning: [cppcoreguidelines-init-variables]

    variable 'test' is not initialized

        TestClient test;
                   ^
                        = 0
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:28:11: warning: [cppcoreguidelines-init-variables]

    variable 'manager' is not initialized

        auto *manager = test.addNewExtension<QXmppEntityTimeManager>();
              ^
                      = nullptr
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:30:16: warning: [cppcoreguidelines-init-variables]

    variable 'spy' is not initialized

        QSignalSpy spy(manager, &QXmppEntityTimeManager::timeReceived);
                   ^
                       = 0
    /home/runner/work/qxmpp/qxmpp/tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:44:27: warning: 6 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        QCOMPARE(time.tzo(), -6 * 60 * 60);
                              ^
    /home/runner/work/qxmpp/qxmpp/tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:44:31: warning: 60 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        QCOMPARE(time.tzo(), -6 * 60 * 60);
                                  ^
    /home/runner/work/qxmpp/qxmpp/tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:44:36: warning: 60 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        QCOMPARE(time.tzo(), -6 * 60 * 60);
                                       ^
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:47:34: warning: [readability-convert-member-functions-to-static]

    method 'testHandleRequest' can be made static

    void tst_QXmppEntityTimeManager::testHandleRequest()
                                     ^
    static 
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:49:16: warning: [cppcoreguidelines-init-variables]

    variable 'test' is not initialized

        TestClient test;
                   ^
                        = 0
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:52:11: warning: [cppcoreguidelines-init-variables]

    variable 'manager' is not initialized

        auto *manager = test.addNewExtension<QXmppEntityTimeManager>();
              ^
                      = nullptr
  • tests/qxmppentitytimemanager/tst_qxmppentitytimemanager.cpp:67:12: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'tst_QXmppEntityTimeManager' is non-const and globally accessible, consider making it const

    QTEST_MAIN(tst_QXmppEntityTimeManager)
               ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:6:10: error: [clang-diagnostic-error]

    'QXmppMessage.h' file not found

    #include "QXmppMessage.h"
             ^~~~~~~~~~~~~~~~
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:49:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testIsOmemoDeviceElement();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:50:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testOmemoDeviceElement_data();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:51:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testOmemoDeviceElement();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:52:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testIsOmemoDeviceList_data();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:53:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testIsOmemoDeviceList();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:54:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testOmemoDeviceList();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:55:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testIsOmemoDeviceBundle_data();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:56:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testIsOmemoDeviceBundle();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:57:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testOmemoDeviceBundle();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:58:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testIsOmemoEnvelope_data();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:59:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testIsOmemoEnvelope();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:60:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testOmemoEnvelope_data();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:61:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testOmemoEnvelope();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:62:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testIsOmemoElement_data();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:63:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testIsOmemoElement();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:64:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testOmemoElement();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:65:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testMessageOmemoElement();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:66:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testOmemoIq();
                    ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:85:26: warning: [readability-convert-member-functions-to-static]

    method 'testIsOmemoDeviceElement' can be made static

    void tst_QXmppOmemoData::testIsOmemoDeviceElement()
                             ^
    static 
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:90:18: warning: [cppcoreguidelines-init-variables]

    variable 'doc' is not initialized

        QDomDocument doc;
                     ^
                         = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:92:23: warning: [cppcoreguidelines-init-variables]

    variable 'element' is not initialized

        const QDomElement element = doc.documentElement();
                          ^
                                  = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:112:26: warning: [readability-convert-member-functions-to-static]

    method 'testOmemoDeviceElement' can be made static

    void tst_QXmppOmemoData::testOmemoDeviceElement()
                             ^
    static 
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:118:29: warning: [cppcoreguidelines-init-variables]

    variable 'deviceElement1' is not initialized

        QXmppOmemoDeviceElement deviceElement1;
                                ^
                                               = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:124:29: warning: [cppcoreguidelines-init-variables]

    variable 'deviceElement2' is not initialized

        QXmppOmemoDeviceElement deviceElement2;
                                ^
                                               = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:148:26: warning: [readability-convert-member-functions-to-static]

    method 'testIsOmemoDeviceList' can be made static

    void tst_QXmppOmemoData::testIsOmemoDeviceList()
                             ^
    static 
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:153:18: warning: [cppcoreguidelines-init-variables]

    variable 'doc' is not initialized

        QDomDocument doc;
                     ^
                         = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:155:23: warning: [cppcoreguidelines-init-variables]

    variable 'element' is not initialized

        const QDomElement element = doc.documentElement();
                          ^
                                  = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:159:26: warning: [readability-convert-member-functions-to-static]

    method 'testOmemoDeviceList' can be made static

    void tst_QXmppOmemoData::testOmemoDeviceList()
                             ^
    static 
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:161:22: warning: [cppcoreguidelines-init-variables]

    variable 'xml' is not initialized

        const QByteArray xml(QByteArrayLiteral(
                         ^
                             = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:167:29: warning: [cppcoreguidelines-init-variables]

    variable 'deviceElement1' is not initialized

        QXmppOmemoDeviceElement deviceElement1;
                                ^
                                               = 0
    /home/runner/work/qxmpp/qxmpp/tests/qxmppomemodata/tst_qxmppomemodata.cpp:168:26: warning: 12345 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        deviceElement1.setId(12345);
                             ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:170:29: warning: [cppcoreguidelines-init-variables]

    variable 'deviceElement2' is not initialized

        QXmppOmemoDeviceElement deviceElement2;
                                ^
                                               = 0
    /home/runner/work/qxmpp/qxmpp/tests/qxmppomemodata/tst_qxmppomemodata.cpp:171:26: warning: 4223 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        deviceElement2.setId(4223);
                             ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:174:26: warning: [cppcoreguidelines-init-variables]

    variable 'deviceList1' is not initialized

        QXmppOmemoDeviceList deviceList1;
                             ^
                                         = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:181:26: warning: [cppcoreguidelines-init-variables]

    variable 'deviceList2' is not initialized

        QXmppOmemoDeviceList deviceList2;
                             ^
                                         = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:206:26: warning: [readability-convert-member-functions-to-static]

    method 'testIsOmemoDeviceBundle' can be made static

    void tst_QXmppOmemoData::testIsOmemoDeviceBundle()
                             ^
    static 
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:211:18: warning: [cppcoreguidelines-init-variables]

    variable 'doc' is not initialized

        QDomDocument doc;
                     ^
                         = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:213:23: warning: [cppcoreguidelines-init-variables]

    variable 'element' is not initialized

        const QDomElement element = doc.documentElement();
                          ^
                                  = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:217:26: warning: [readability-convert-member-functions-to-static]

    method 'testOmemoDeviceBundle' can be made static

    void tst_QXmppOmemoData::testOmemoDeviceBundle()
                             ^
    static 
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:219:22: warning: [cppcoreguidelines-init-variables]

    variable 'xml1' is not initialized

        const QByteArray xml1(QByteArrayLiteral(
                         ^
                              = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:233:22: warning: [cppcoreguidelines-init-variables]

    variable 'xml2' is not initialized

        const QByteArray xml2(QByteArrayLiteral(
                         ^
                              = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:244:22: warning: [cppcoreguidelines-init-variables]

    variable 'xmlWithSinglePreKey' is not initialized

        const QByteArray xmlWithSinglePreKey(QByteArrayLiteral(
                         ^
                                             = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:254:25: warning: [cppcoreguidelines-init-variables]

    variable 'xmls' is not initialized

        QVector<QByteArray> xmls = { xml1, xml2 };
                            ^
                                 = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:256:33: warning: [cppcoreguidelines-init-variables]

    variable 'expectedPublicPreKeys' is not initialized

        QHash<uint32_t, QByteArray> expectedPublicPreKeys = {
                                    ^
                                                          = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:261:28: warning: [cppcoreguidelines-init-variables]

    variable 'deviceBundle1' is not initialized

        QXmppOmemoDeviceBundle deviceBundle1;
                               ^
                                             = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:270:28: warning: [cppcoreguidelines-init-variables]

    variable 'deviceBundle2' is not initialized

        QXmppOmemoDeviceBundle deviceBundle2;
                               ^
                                             = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:306:26: warning: [readability-convert-member-functions-to-static]

    method 'testIsOmemoEnvelope' can be made static

    void tst_QXmppOmemoData::testIsOmemoEnvelope()
                             ^
    static 
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:311:18: warning: [cppcoreguidelines-init-variables]

    variable 'doc' is not initialized

        QDomDocument doc;
                     ^
                         = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:313:23: warning: [cppcoreguidelines-init-variables]

    variable 'element' is not initialized

        const QDomElement element = doc.documentElement();
                          ^
                                  = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:336:26: warning: [readability-convert-member-functions-to-static]

    method 'testOmemoEnvelope' can be made static

    void tst_QXmppOmemoData::testOmemoEnvelope()
                             ^
    static 
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:343:24: warning: [cppcoreguidelines-init-variables]

    variable 'omemoEnvelope1' is not initialized

        QXmppOmemoEnvelope omemoEnvelope1;
                           ^
                                          = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:350:24: warning: [cppcoreguidelines-init-variables]

    variable 'omemoEnvelope2' is not initialized

        QXmppOmemoEnvelope omemoEnvelope2;
                           ^
                                          = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:376:26: warning: [readability-convert-member-functions-to-static]

    method 'testIsOmemoElement' can be made static

    void tst_QXmppOmemoData::testIsOmemoElement()
                             ^
    static 
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:381:18: warning: [cppcoreguidelines-init-variables]

    variable 'doc' is not initialized

        QDomDocument doc;
                     ^
                         = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:383:23: warning: [cppcoreguidelines-init-variables]

    variable 'element' is not initialized

        const QDomElement element = doc.documentElement();
                          ^
                                  = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:387:26: warning: [readability-convert-member-functions-to-static]

    method 'testOmemoElement' can be made static

    void tst_QXmppOmemoData::testOmemoElement()
                             ^
    static 
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:389:22: warning: [cppcoreguidelines-init-variables]

    variable 'xmlIn' is not initialized

        const QByteArray xmlIn(QByteArrayLiteral(
                         ^
                               = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:417:22: warning: [cppcoreguidelines-init-variables]

    variable 'xmlOut' is not initialized

        const QByteArray xmlOut(QByteArrayLiteral(
                         ^
                                = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:442:23: warning: [cppcoreguidelines-init-variables]

    variable 'omemoElement1' is not initialized

        QXmppOmemoElement omemoElement1;
                          ^
                                        = 0
    /home/runner/work/qxmpp/qxmpp/tests/qxmppomemodata/tst_qxmppomemodata.cpp:445:55: warning: 27183 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        QCOMPARE(omemoElement1.senderDeviceId(), uint32_t(27183));
                                                          ^
    /home/runner/work/qxmpp/qxmpp/tests/qxmppomemodata/tst_qxmppomemodata.cpp:449:60: warning: 31415 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        QCOMPARE(omemoEnvelope1->recipientDeviceId(), uint32_t(31415));
                                                               ^
    /home/runner/work/qxmpp/qxmpp/tests/qxmppomemodata/tst_qxmppomemodata.cpp:455:60: warning: 12321 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        QCOMPARE(omemoEnvelope2->recipientDeviceId(), uint32_t(12321));
                                                               ^
    /home/runner/work/qxmpp/qxmpp/tests/qxmppomemodata/tst_qxmppomemodata.cpp:461:60: warning: 1337 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        QCOMPARE(omemoEnvelope3->recipientDeviceId(), uint32_t(1337));
                                                               ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:481:23: warning: [cppcoreguidelines-init-variables]

    variable 'omemoElement2' is not initialized

        QXmppOmemoElement omemoElement2;
                          ^
                                        = 0
    /home/runner/work/qxmpp/qxmpp/tests/qxmppomemodata/tst_qxmppomemodata.cpp:482:37: warning: 27183 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        omemoElement2.setSenderDeviceId(27183);
                                        ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:496:24: warning: [cppcoreguidelines-init-variables]

    variable 'omemoEnvelope4' is not initialized

        QXmppOmemoEnvelope omemoEnvelope4;
                           ^
                                          = 0
    /home/runner/work/qxmpp/qxmpp/tests/qxmppomemodata/tst_qxmppomemodata.cpp:497:41: warning: 31415 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        omemoEnvelope4.setRecipientDeviceId(31415);
                                            ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:501:24: warning: [cppcoreguidelines-init-variables]

    variable 'omemoEnvelope5' is not initialized

        QXmppOmemoEnvelope omemoEnvelope5;
                           ^
                                          = 0
    /home/runner/work/qxmpp/qxmpp/tests/qxmppomemodata/tst_qxmppomemodata.cpp:502:41: warning: 12321 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        omemoEnvelope5.setRecipientDeviceId(12321);
                                            ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:507:24: warning: [cppcoreguidelines-init-variables]

    variable 'omemoEnvelope6' is not initialized

        QXmppOmemoEnvelope omemoEnvelope6;
                           ^
                                          = 0
    /home/runner/work/qxmpp/qxmpp/tests/qxmppomemodata/tst_qxmppomemodata.cpp:508:41: warning: 1337 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        omemoEnvelope6.setRecipientDeviceId(1337);
                                            ^
    /home/runner/work/qxmpp/qxmpp/tests/qxmppomemodata/tst_qxmppomemodata.cpp:512:55: warning: 27183 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        QCOMPARE(omemoElement2.senderDeviceId(), uint32_t(27183));
                                                          ^
    /home/runner/work/qxmpp/qxmpp/tests/qxmppomemodata/tst_qxmppomemodata.cpp:516:60: warning: 12321 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        QCOMPARE(omemoEnvelope7->recipientDeviceId(), uint32_t(12321));
                                                               ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:527:26: warning: [readability-convert-member-functions-to-static]

    method 'testMessageOmemoElement' can be made static

    void tst_QXmppOmemoData::testMessageOmemoElement()
                             ^
    static 
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:529:22: warning: [cppcoreguidelines-init-variables]

    variable 'xmlIn' is not initialized

        const QByteArray xmlIn(QByteArrayLiteral(
                         ^
                               = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:560:22: warning: [cppcoreguidelines-init-variables]

    variable 'xmlOut1' is not initialized

        const QByteArray xmlOut1(QByteArrayLiteral(
                         ^
                                 = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:588:22: warning: [cppcoreguidelines-init-variables]

    variable 'xmlOut2' is not initialized

        const QByteArray xmlOut2(QByteArrayLiteral(
                         ^
                                 = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:595:18: warning: [cppcoreguidelines-init-variables]

    variable 'message1' is not initialized

        QXmppMessage message1;
                     ^
                              = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:602:18: warning: [cppcoreguidelines-init-variables]

    variable 'message2' is not initialized

        QXmppMessage message2;
                     ^
                              = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:608:26: warning: [readability-convert-member-functions-to-static]

    method 'testOmemoIq' can be made static

    void tst_QXmppOmemoData::testOmemoIq()
                             ^
    static 
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:610:22: warning: [cppcoreguidelines-init-variables]

    variable 'xmlOtherIq' is not initialized

        const QByteArray xmlOtherIq(
                         ^
                                    = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:622:22: warning: [cppcoreguidelines-init-variables]

    variable 'xmlOmemoIq' is not initialized

        const QByteArray xmlOmemoIq(
                         ^
                                    = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:635:22: warning: [cppcoreguidelines-init-variables]

    variable 'omemoPayload' is not initialized

        const QByteArray omemoPayload(
                         ^
                                      = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:641:18: warning: [cppcoreguidelines-init-variables]

    variable 'doc' is not initialized

        QDomDocument doc;
                     ^
                         = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:643:17: warning: [cppcoreguidelines-init-variables]

    variable 'element' is not initialized

        QDomElement element = doc.documentElement();
                    ^
                            = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:650:18: warning: [cppcoreguidelines-init-variables]

    variable 'omemoIq1' is not initialized

        QXmppOmemoIq omemoIq1;
                     ^
                              = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:657:23: warning: [cppcoreguidelines-init-variables]

    variable 'omemoElement' is not initialized

        QXmppOmemoElement omemoElement;
                          ^
                                       = 0
    /home/runner/work/qxmpp/qxmpp/tests/qxmppomemodata/tst_qxmppomemodata.cpp:658:36: warning: 27183 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        omemoElement.setSenderDeviceId(27183);
                                       ^
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:661:18: warning: [cppcoreguidelines-init-variables]

    variable 'omemoIq2' is not initialized

        QXmppOmemoIq omemoIq2;
                     ^
                              = 0
  • tests/qxmppomemodata/tst_qxmppomemodata.cpp:667:12: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'tst_QXmppOmemoData' is non-const and globally accessible, consider making it const

    QTEST_MAIN(tst_QXmppOmemoData)
               ^
  • tests/qxmpppubsub/tst_qxmpppubsub.cpp:5:10: error: [clang-diagnostic-error]

    'QXmppPubSubAffiliation.h' file not found

    #include "QXmppPubSubAffiliation.h"
             ^~~~~~~~~~~~~~~~~~~~~~~~~~
  • tests/qxmpppubsub/tst_qxmpppubsub.cpp:23:20: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'PubSubNamespace' is non-const and globally accessible, consider making it const

    Q_DECLARE_METATYPE(PubSubNamespace)
                       ^
  • tests/qxmpppubsub/tst_qxmpppubsub.cpp:67:9: warning: [cppcoreguidelines-macro-usage]

    function-like macro 'ROW' used; consider a 'constexpr' template function

    #define ROW(name, xml, type, jid, node) \
            ^
  • tests/qxmpppubsub/tst_qxmpppubsub.cpp:68:54: warning: [bugprone-macro-parentheses]

    macro argument should be enclosed in parentheses

        QTest::newRow(name) << QByteArrayLiteral(xml) << type << jid << node
                                                         ^
                                                         (   )
  • tests/qxmpppubsub/tst_qxmpppubsub.cpp:68:62: warning: [bugprone-macro-parentheses]

    macro argument should be enclosed in parentheses

        QTest::newRow(name) << QByteArrayLiteral(xml) << type << jid << node
                                                                 ^
                                                                 (  )
  • tests/qxmpppubsub/tst_qxmpppubsub.cpp:147:9: warning: [cppcoreguidelines-macro-usage]

    function-like macro 'ROW' used; consider a 'constexpr' template function

    #define ROW(name, xmlns, xml, state, jid, node, subid, configSupport) \
            ^
  • tests/qxmpppubsub/tst_qxmpppubsub.cpp:148:54: warning: [bugprone-macro-parentheses]

    macro argument should be enclosed in parentheses

        QTest::newRow(name) << QByteArrayLiteral(xml) << xmlns << state << jid << node << subid << configSupport
                                                         ^
                                                         (    )
  • tests/qxmpppubsub/tst_qxmpppubsub.cpp:148:63: warning: [bugprone-macro-parentheses]

    macro argument should be enclosed in parentheses

        QTest::newRow(name) << QByteArrayLiteral(xml) << xmlns << state << jid << node << subid << configSupport
                                                                  ^
                                                                  (    )
  • tests/qxmpppubsub/tst_qxmpppubsub.cpp:148:72: warning: [bugprone-macro-parentheses]

    macro argument should be enclosed in parentheses

        QTest::newRow(name) << QByteArrayLiteral(xml) << xmlns << state << jid << node << subid << configSupport
                                                                           ^
                                                                           (  )
  • tests/qxmpppubsub/tst_qxmpppubsub.cpp:148:79: warning: [bugprone-macro-parentheses]

    macro argument should be enclosed in parentheses

        QTest::newRow(name) << QByteArrayLiteral(xml) << xmlns << state << jid << node << subid << configSupport
                                                                                  ^
                                                                                  (   )
  • tests/qxmpppubsub/tst_qxmpppubsub.cpp:148:87: warning: [bugprone-macro-parentheses]

    macro argument should be enclosed in parentheses

        QTest::newRow(name) << QByteArrayLiteral(xml) << xmlns << state << jid << node << subid << configSupport
                                                                                          ^
                                                                                          (    )
  • tests/qxmpppubsub/tst_qxmpppubsub.cpp:283:12: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'tst_QXmppPubSub' is non-const and globally accessible, consider making it const

    QTEST_MAIN(tst_QXmppPubSub)
               ^
  • tests/qxmppmixiq/tst_qxmppmixiq.cpp:5:10: error: [clang-diagnostic-error]

    'QXmppMixIq.h' file not found

    #include "QXmppMixIq.h"
             ^~~~~~~~~~~~~~
  • tests/qxmppmixiq/tst_qxmppmixiq.cpp:19:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testBase();
                    ^
  • tests/qxmppmixiq/tst_qxmppmixiq.cpp:20:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testDefaults();
                    ^
  • tests/qxmppmixiq/tst_qxmppmixiq.cpp:21:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testSetters();
                    ^
  • tests/qxmppmixiq/tst_qxmppmixiq.cpp:22:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testInvalidActionType();
                    ^
  • tests/qxmppmixiq/tst_qxmppmixiq.cpp:23:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Q_SLOT void testIsMixIq();
                    ^
  • tests/qxmppsasl/tst_qxmppsasl.cpp:5:10: error: [clang-diagnostic-error]

    'QXmppSasl_p.h' file not found

    #include "QXmppSasl_p.h"
             ^~~~~~~~~~~~~~~

Have any feedback or feature suggestions? Share it here.

Please sign in to comment.