Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions cmake/modules/IrisSCTP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ else()
if(NOT Git_FOUND)
message(FATAL_ERROR "Git not found! Bundled UsrSCTP needs Git utility.\nPlease set GIT_EXECUTABLE variable or add git to PATH")
endif()
# When using the "cmake --build . -t clean" command, it cleans the built files, but the next time it builds, it crashes with a patch error.
# As an attempt to avoid this crash the last line of patch_command was added
set(patch_command
${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/usrsctp.patch <SOURCE_DIR> &&
${GIT_EXECUTABLE} checkout <SOURCE_DIR>/usrsctplib/netinet/sctp_output.c &&
${GIT_EXECUTABLE} apply <SOURCE_DIR>/usrsctp.patch)
${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/usrsctp.patch <SOURCE_DIR> &&
${GIT_EXECUTABLE} checkout <SOURCE_DIR>/usrsctplib/netinet/sctp_output.c &&
${GIT_EXECUTABLE} apply <SOURCE_DIR>/usrsctp.patch ||
${CMAKE_COMMAND} -E echo "USRSCTP Sources already patched"
)
ExternalProject_Add(UsrSCTPProject
PREFIX ${USRSCTP_PREFIX}
BINARY_DIR ${USRSCTP_BUILD_DIR}
Expand Down
10 changes: 9 additions & 1 deletion src/xmpp/xmpp-im/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@

#include <optional>

#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
#include <QTimeZone>
#endif

#define NS_XML "http://www.w3.org/XML/1998/namespace"

namespace XMPP {
Expand Down Expand Up @@ -1482,7 +1486,7 @@ Stanza Message::toStanza(Stream *stream) const
if (!d->reactions.targetId.isEmpty()) {
auto e = s.createElement(reactionsNS, QStringLiteral("reactions"));
e.setAttribute(QLatin1String("id"), d->reactions.targetId);
for (const QString &reaction : d->reactions.reactions) {
for (const QString &reaction : std::as_const(d->reactions.reactions)) {
e.appendChild(s.createTextElement(reactionsNS, QStringLiteral("reaction"), reaction));
}
s.appendChild(e);
Expand Down Expand Up @@ -1656,7 +1660,11 @@ bool Message::fromStanza(const Stanza &s, bool useTimeZoneOffset, int timeZoneOf
if (useTimeZoneOffset) {
d->timeStamp = stamp.addSecs(timeZoneOffset * 3600);
} else {
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
stamp.setTimeSpec(Qt::UTC);
#else
stamp.setTimeZone(QTimeZone::UTC);
#endif
d->timeStamp = stamp.toLocalTime();
}
d->timeStampSend = true;
Expand Down
31 changes: 21 additions & 10 deletions src/xmpp/xmpp-im/xmpp_mamtask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/

#include "xmpp_mamtask.h"
#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
#include <QTimeZone>
#endif

using namespace XMLHelper;
using namespace XMPP;
Expand All @@ -38,9 +41,9 @@ class MAMTask::Private {
QString lastArchiveID;
QString fromID;
QString toID;
QString mainQueryID;
QString mainQueryID;
QString currentPageQueryID;
QString currentPageQueryIQID;
QString currentPageQueryIQID;
QDateTime from;
QDateTime to;
QList<QDomElement> archive;
Expand Down Expand Up @@ -76,7 +79,11 @@ XData MAMTask::Private::makeMAMFilter()
XData::Field start;
start.setType(XData::Field::Field_TextSingle);
start.setVar(QLatin1String("start"));
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
from.setTimeSpec(Qt::UTC);
#else
from.setTimeZone(QTimeZone::UTC);
#endif
start.setValue(QStringList(from.toString()));
fl.append(start);
}
Expand All @@ -85,7 +92,11 @@ XData MAMTask::Private::makeMAMFilter()
XData::Field end;
end.setType(XData::Field::Field_TextSingle);
end.setVar(QLatin1String("end"));
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
to.setTimeSpec(Qt::UTC);
#else
to.setTimeZone(QTimeZone::UTC);
#endif
end.setValue(QStringList(to.toString()));
fl.append(end);
}
Expand Down Expand Up @@ -117,9 +128,9 @@ XData MAMTask::Private::makeMAMFilter()
void MAMTask::Private::getPage()
{
currentPageQueryIQID = q->genUniqueID();
QDomElement iq = createIQ(q->doc(), QLatin1String("set"), QLatin1String(), currentPageQueryIQID);
QDomElement query = q->doc()->createElementNS(XMPP_MAM_NAMESPACE, QLatin1String("query"));
currentPageQueryID = q->genUniqueID();
QDomElement iq = createIQ(q->doc(), QLatin1String("set"), QLatin1String(), currentPageQueryIQID);
QDomElement query = q->doc()->createElementNS(XMPP_MAM_NAMESPACE, QLatin1String("query"));
currentPageQueryID = q->genUniqueID();
query.setAttribute(QLatin1String("queryid"), currentPageQueryID);
XData x = makeMAMFilter();

Expand Down Expand Up @@ -154,7 +165,7 @@ void MAMTask::Private::getPage()
void MAMTask::Private::getArchiveMetadata()
{
// Craft a query to get the first and last messages in an archive
mainQueryID = q->genUniqueID();
mainQueryID = q->genUniqueID();
QDomElement iq = createIQ(q->doc(), QLatin1String("get"), QLatin1String(), mainQueryID);
QDomElement metadata = emptyTag(q->doc(), QLatin1String("metadata"));
metadata.setAttribute(QLatin1String("xmlns"), XMPP_MAM_NAMESPACE);
Expand Down Expand Up @@ -216,8 +227,8 @@ bool MAMTask::take(const QDomElement &x)
return true;
} else if (!x.elementsByTagNameNS(XMPP_MAM_NAMESPACE, QLatin1String("fin")).isEmpty()) {
// We are done?
//setSuccess();
//return true;
// setSuccess();
// return true;
return false; // TODO: testing
}
// Probably ignore it
Expand Down Expand Up @@ -245,7 +256,7 @@ bool MAMTask::take(const QDomElement &x)

// Return if the archive is empty
QDomElement queryMetadata = x.firstChildElement(QLatin1String("metadata"));
if(queryMetadata == QDomElement()) {
if (queryMetadata == QDomElement()) {
setError(1, "Malformed server metadata response");
return true;
}
Expand All @@ -256,7 +267,7 @@ bool MAMTask::take(const QDomElement &x)
}

QDomElement start_id = queryMetadata.firstChildElement(QLatin1String("start"));
QDomElement end_id = queryMetadata.firstChildElement(QLatin1String("end"));
QDomElement end_id = queryMetadata.firstChildElement(QLatin1String("end"));

if (start_id.isNull() || end_id.isNull()) {
setError(1, "Malformed server metadata response");
Expand Down
7 changes: 7 additions & 0 deletions src/xmpp/xmpp-im/xmpp_tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
#include <QList>
#include <QRegularExpression>
#include <QTimer>
#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
#include <QTimeZone>
#endif

using namespace XMPP;

Expand Down Expand Up @@ -776,7 +779,11 @@ bool JT_PushPresence::take(const QDomElement &e)
if (client()->manualTimeZoneOffset()) {
stamp = stamp.addSecs(client()->timeZoneOffset() * 3600);
} else {
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
stamp.setTimeSpec(Qt::UTC);
#else
stamp.setTimeZone(QTimeZone::UTC);
#endif
stamp = stamp.toLocalTime();
}
p.setTimeStamp(stamp);
Expand Down