mailnotification: Add Qt6 support

master
Simon Stürz 2025-08-08 14:43:17 +02:00
parent 9e5b735e14
commit 202e726df4
5 changed files with 18 additions and 18 deletions

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright 2013 - 2020, nymea GmbH
* Copyright 2013 - 2025, nymea GmbH
* Contact: contact@nymea.io
*
* This file is part of nymea.
@ -29,10 +29,10 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "integrationpluginmailnotification.h"
#include "integrations/thing.h"
#include "plugininfo.h"
#include <integrations/thing.h>
#include <QDebug>
#include <QJsonDocument>
#include <QVariantMap>

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright 2013 - 2020, nymea GmbH
* Copyright 2013 - 2025, nymea GmbH
* Contact: contact@nymea.io
*
* This file is part of nymea.
@ -31,7 +31,8 @@
#ifndef INTEGRATIONPLUGINMAILNOTIFICATION_H
#define INTEGRATIONPLUGINMAILNOTIFICATION_H
#include "integrations/integrationplugin.h"
#include <integrations/integrationplugin.h>
#include "smtpclient.h"
class IntegrationPluginMailNotification : public IntegrationPlugin
@ -52,7 +53,7 @@ public:
void thingRemoved(Thing *thing) override;
private:
QHash <SmtpClient*, Thing*> m_clients;
QHash <SmtpClient *, Thing *> m_clients;
};

View File

@ -1,8 +1,6 @@
include(../plugins.pri)
TARGET = $$qtLibraryTarget(nymea_integrationpluginmailnotification)
QT+= network
QT *= network
SOURCES += \
integrationpluginmailnotification.cpp \

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright 2013 - 2020, nymea GmbH
* Copyright 2013 - 2025, nymea GmbH
* Contact: contact@nymea.io
*
* This file is part of nymea.
@ -42,7 +42,11 @@ SmtpClient::SmtpClient(QObject *parent):
connect(m_socket, &QSslSocket::readyRead, this, &SmtpClient::readData);
connect(m_socket, &QSslSocket::disconnected, this, &SmtpClient::disconnected);
connect(m_socket, &QSslSocket::encrypted, this, &SmtpClient::onEncrypted);
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
connect(m_socket, &QTcpSocket::errorOccurred, this, &SmtpClient::onSocketError);
#else
connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onSocketError(QAbstractSocket::SocketError)));
#endif
}
void SmtpClient::connectToHost()
@ -247,9 +251,9 @@ void SmtpClient::processServerResponse(int responseCode, const QString &response
if (m_authenticationMethod == AuthenticationMethodPlain) {
send("AUTH PLAIN " + QByteArray().append(static_cast<char>(0))
.append(m_user)
.append(m_user.toUtf8())
.append(static_cast<char>(0))
.append(m_password)
.append(m_password.toUtf8())
.toBase64());
// If we just want to test the Login, we are almost done here
@ -266,7 +270,7 @@ void SmtpClient::processServerResponse(int responseCode, const QString &response
break;
case StateUser:
if (responseCode == 334) {
send(QByteArray().append(m_user).toBase64());
send(QByteArray().append(m_user.toUtf8()).toBase64());
setState(StatePassword);
} else {
handleUnexpectedSmtpCode(responseCode, response);
@ -274,7 +278,7 @@ void SmtpClient::processServerResponse(int responseCode, const QString &response
break;
case StatePassword:
if (responseCode == 334) {
send(QByteArray().append(m_password).toBase64());
send(QByteArray().append(m_password.toUtf8()).toBase64());
// if we just want to test the Login, we are almost done here
if (!m_testLogin) {
setState(StateMail);

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright 2013 - 2020, nymea GmbH
* Copyright 2013 - 2025, nymea GmbH
* Contact: contact@nymea.io
*
* This file is part of nymea.
@ -39,8 +39,6 @@
#include <QStringList>
#include <QLoggingCategory>
//#include "integrations/integrationplugin.h"
Q_DECLARE_LOGGING_CATEGORY(dcSmtpClient)
struct Message {
@ -49,7 +47,6 @@ struct Message {
int id;
};
class SmtpClient : public QObject
{
Q_OBJECT