Skip to content

Commit

Permalink
Merge branch '1.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
lnjX committed Feb 3, 2024
2 parents e0b549f + 3b58c9a commit af3a42e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ option(BUILD_EXAMPLES "Build examples." ON)
option(BUILD_OMEMO "Build the OMEMO module" OFF)
option(WITH_GSTREAMER "Build with GStreamer support for Jingle" OFF)
option(WITH_QCA "Build with QCA for OMEMO or encrypted file sharing" ${Qca-qt${QT_VERSION_MAJOR}_FOUND})
option(ENABLE_ASAN "Build with address sanitizer" OFF)

set(QXMPP_TARGET QXmppQt${QT_VERSION_MAJOR})
set(QXMPPOMEMO_TARGET QXmppOmemoQt${QT_VERSION_MAJOR})
Expand All @@ -52,6 +53,12 @@ add_definitions(
-DQT_NO_KEYWORDS
)

# Address sanitizer
if(ENABLE_ASAN)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()

if(BUILD_OMEMO)
add_definitions(-DBUILD_OMEMO)

Expand Down
7 changes: 7 additions & 0 deletions src/base/QXmppStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class QXmppStreamPrivate
{
public:
QXmppStreamPrivate(QXmppStream *stream);
~QXmppStreamPrivate();

QString dataBuffer;
QSslSocket *socket;
Expand All @@ -59,6 +60,12 @@ QXmppStreamPrivate::QXmppStreamPrivate(QXmppStream *stream)
{
}

QXmppStreamPrivate::~QXmppStreamPrivate()
{
// causes access to runningIqs, so call here
streamManager.resetCache();
}

///
/// \typedef QXmppStream::IqResult
///
Expand Down
1 change: 0 additions & 1 deletion src/base/QXmppStreamManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ QXmppStreamManager::QXmppStreamManager(QXmppStream *stream)

QXmppStreamManager::~QXmppStreamManager()
{
resetCache();
}

bool QXmppStreamManager::enabled() const
Expand Down
14 changes: 7 additions & 7 deletions tests/qxmpppubsubmanager/tst_qxmpppubsubmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ using PSManager = QXmppPubSubManager;
using Affiliation = QXmppPubSubAffiliation;
using AffiliationType = QXmppPubSubAffiliation::Affiliation;

const char *ns_pubsub = "http://jabber.org/protocol/pubsub";
const char *ns_pubsub_auto_create = "http://jabber.org/protocol/pubsub#auto-create";
const char *XMLNS_PUBSUB = "http://jabber.org/protocol/pubsub";
const char *XMLNS_PUBSUB_AUTO_CREATE = "http://jabber.org/protocol/pubsub#auto-create";

class TestEventManager : public QXmppClientExtension, public QXmppPubSubEventHandler
{
Expand Down Expand Up @@ -148,7 +148,7 @@ void tst_QXmppPubSubManager::testRequestFeatures()
"</query></iq>"));

auto features = expectFutureVariant<QVector<QString>>(future);
QCOMPARE(features, (QVector<QString> { ns_pubsub, ns_pubsub_auto_create }));
QCOMPARE(features, (QVector<QString> { XMLNS_PUBSUB, XMLNS_PUBSUB_AUTO_CREATE }));

future = psManager->requestFeatures("[email protected]");
test.expect(QStringLiteral("<iq id='qxmpp1' to='[email protected]' type='get'>"
Expand All @@ -162,7 +162,7 @@ void tst_QXmppPubSubManager::testRequestFeatures()
"</query></iq>"));

features = expectFutureVariant<QVector<QString>>(future);
QCOMPARE(features, (QVector<QString> { ns_pubsub, ns_pubsub_auto_create }));
QCOMPARE(features, (QVector<QString> { XMLNS_PUBSUB, XMLNS_PUBSUB_AUTO_CREATE }));

future = psManager->requestFeatures("[email protected]", QXmppPubSubManager::PubSub);
test.expect(QStringLiteral("<iq id='qxmpp1' to='[email protected]' type='get'>"
Expand All @@ -189,7 +189,7 @@ void tst_QXmppPubSubManager::testRequestFeatures()
"</query></iq>"));

features = expectFutureVariant<QVector<QString>>(future);
QCOMPARE(features, (QVector<QString> { ns_pubsub, ns_pubsub_auto_create }));
QCOMPARE(features, (QVector<QString> { XMLNS_PUBSUB, XMLNS_PUBSUB_AUTO_CREATE }));

future = psManager->requestFeatures("pubsub.shakespeare.lit", QXmppPubSubManager::Pep);
test.expect(QStringLiteral("<iq id='qxmpp1' to='pubsub.shakespeare.lit' type='get'>"
Expand All @@ -216,7 +216,7 @@ void tst_QXmppPubSubManager::testRequestFeatures()
"</query></iq>"));

features = expectFutureVariant<QVector<QString>>(future);
QCOMPARE(features, (QVector<QString> { ns_pubsub, ns_pubsub_auto_create }));
QCOMPARE(features, (QVector<QString> { XMLNS_PUBSUB, XMLNS_PUBSUB_AUTO_CREATE }));
}

void tst_QXmppPubSubManager::testRequestPepFeatures()
Expand All @@ -236,7 +236,7 @@ void tst_QXmppPubSubManager::testRequestPepFeatures()
"</query></iq>"));

auto features = expectFutureVariant<QVector<QString>>(future);
QCOMPARE(features, (QVector<QString> { ns_pubsub, ns_pubsub_auto_create }));
QCOMPARE(features, (QVector<QString> { XMLNS_PUBSUB, XMLNS_PUBSUB_AUTO_CREATE }));
}

void tst_QXmppPubSubManager::testFetchNodes()
Expand Down

0 comments on commit af3a42e

Please sign in to comment.