aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2020-10-10 19:56:52 +0200
committerLNJ <lnj@kaidan.im>2020-10-10 20:12:09 +0200
commita982cd02ec3e1ff37c248ea0d3c36e79f3a45ad5 (patch)
tree45c86227ae89e05f80e64a5017edd73359a91d46
parent2298886f4d75adbc351b448274b39edf54da38ee (diff)
downloadqxmpp-a982cd02ec3e1ff37c248ea0d3c36e79f3a45ad5.tar.gz
Disable foreach also in examples and tests
-rw-r--r--CMakeLists.txt6
-rw-r--r--examples/example_7_archiveHandling/example_7_archiveHandling.cpp9
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--tests/qxmppregistrationmanager/tst_qxmppregistrationmanager.cpp4
4 files changed, 13 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54665ec8..ccdeab65 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,7 +35,11 @@ option(BUILD_EXAMPLES "Build examples." ON)
option(WITH_GSTREAMER "Build with GStreamer support for Jingle" OFF)
-add_definitions(-DQURL_NO_CAST_FROM_STRING -DQT_NO_CAST_TO_ASCII)
+add_definitions(
+ -DQURL_NO_CAST_FROM_STRING
+ -DQT_NO_CAST_TO_ASCII
+ -DQT_NO_FOREACH
+)
add_subdirectory(src)
diff --git a/examples/example_7_archiveHandling/example_7_archiveHandling.cpp b/examples/example_7_archiveHandling/example_7_archiveHandling.cpp
index 282ec0df..d3968fb4 100644
--- a/examples/example_7_archiveHandling/example_7_archiveHandling.cpp
+++ b/examples/example_7_archiveHandling/example_7_archiveHandling.cpp
@@ -104,7 +104,7 @@ void xmppClient::archiveListReceived(const QList<QXmppArchiveChat> &chats, const
logEnd("no items");
} else {
logEnd(QString("items %1 to %2 of %3").arg(QString::number(rsmReply.index()), QString::number(rsmReply.index() + chats.size() - 1), QString::number(rsmReply.count())));
- foreach (const QXmppArchiveChat &chat, chats) {
+ for (const auto &chat : chats) {
qDebug("chat start %s", qPrintable(chat.start().toString()));
// NOTE: to actually retrieve conversations, uncomment this
//archiveManager->retrieveCollection(chat.with(), chat.start());
@@ -127,8 +127,11 @@ void xmppClient::archiveListReceived(const QList<QXmppArchiveChat> &chats, const
void xmppClient::archiveChatReceived(const QXmppArchiveChat &chat, const QXmppResultSetReply &rsmReply)
{
- logEnd(QString("chat received, RSM count %1").arg(QString::number(rsmReply.count())));
- foreach (const QXmppArchiveMessage &msg, chat.messages()) {
+ logEnd(QString("chat received, RSM count %1")
+ .arg(QString::number(rsmReply.count())));
+
+ const auto messages = chat.messages();
+ for (const auto &msg : messages) {
qDebug("example_7_archiveHandling : %s", qPrintable(msg.body()));
}
}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fd50d39d..e35e2c57 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,9 +2,6 @@ option(BUILD_SHARED "Build SHARED library" ON)
add_definitions(-DQXMPP_BUILD)
-# disable Q_FOREACH()
-add_definitions(-DQT_NO_FOREACH)
-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/base)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/client)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/server)
diff --git a/tests/qxmppregistrationmanager/tst_qxmppregistrationmanager.cpp b/tests/qxmppregistrationmanager/tst_qxmppregistrationmanager.cpp
index 497560f7..34cd3ff5 100644
--- a/tests/qxmppregistrationmanager/tst_qxmppregistrationmanager.cpp
+++ b/tests/qxmppregistrationmanager/tst_qxmppregistrationmanager.cpp
@@ -510,7 +510,7 @@ void tst_QXmppRegistrationManager::sendStreamFeaturesToManager(bool registration
// hacky hack to include stream namespace
QByteArray manipulatedXml = buffer.data();
manipulatedXml.replace("stream:", QByteArray());
- manipulatedXml.insert(9, QStringLiteral(" xmlns=\"%1\"").arg("http://etherx.jabber.org/streams"));
+ manipulatedXml.insert(9, QByteArrayLiteral(" xmlns=\"http://etherx.jabber.org/streams\""));
QDomDocument doc;
doc.setContent(manipulatedXml, true);
@@ -522,7 +522,7 @@ void tst_QXmppRegistrationManager::sendStreamFeaturesToManager(bool registration
void tst_QXmppRegistrationManager::setManagerConfig(const QString &username, const QString &server, const QString &password)
{
- client.connectToServer(username + QStringLiteral("@") + server, password);
+ client.connectToServer(username + u'@' + server, password);
client.disconnectFromServer();
}