Commit 628fc0ff authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Implement auth support

parent 8991e13a
Pipeline #27106 passed with stage
in 59 minutes and 54 seconds
......@@ -72,6 +72,7 @@ void DKIMUtilTest::shouldConvertAuthenticationMethodEnumToString()
QCOMPARE(MessageViewer::DKIMUtil::convertAuthenticationMethodEnumToString(MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Spf), QStringLiteral("spf"));
QCOMPARE(MessageViewer::DKIMUtil::convertAuthenticationMethodEnumToString(MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Dmarc), QStringLiteral("dmarc"));
QCOMPARE(MessageViewer::DKIMUtil::convertAuthenticationMethodEnumToString(MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Dkimatps), QStringLiteral("dkim-atps"));
QCOMPARE(MessageViewer::DKIMUtil::convertAuthenticationMethodEnumToString(MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Auth), QStringLiteral("auth"));
}
void DKIMUtilTest::shouldConvertAuthenticationMethodToString()
......@@ -80,6 +81,7 @@ void DKIMUtilTest::shouldConvertAuthenticationMethodToString()
QCOMPARE(MessageViewer::DKIMUtil::convertAuthenticationMethodStringToEnum(QStringLiteral("spf")), MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Spf);
QCOMPARE(MessageViewer::DKIMUtil::convertAuthenticationMethodStringToEnum(QStringLiteral("dmarc")), MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Dmarc);
QCOMPARE(MessageViewer::DKIMUtil::convertAuthenticationMethodStringToEnum(QStringLiteral("dkim-atps")), MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Dkimatps);
QCOMPARE(MessageViewer::DKIMUtil::convertAuthenticationMethodStringToEnum(QStringLiteral("auth")), MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Auth);
QCOMPARE(MessageViewer::DKIMUtil::convertAuthenticationMethodStringToEnum(QStringLiteral("sdfsdf")), MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Unknown);
QCOMPARE(MessageViewer::DKIMUtil::convertAuthenticationMethodStringToEnum(QString()), MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Unknown);
}
......@@ -74,6 +74,7 @@ public:
Spf = 2,
Dmarc = 3,
Dkimatps = 4,
Auth =5
};
Q_ENUM(AuthenticationMethod)
......
......@@ -173,6 +173,9 @@ QString MessageViewer::DKIMUtil::convertAuthenticationMethodEnumToString(Message
case MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Dkimatps:
methodStr = QStringLiteral("dkim-atps");
break;
case MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Auth:
methodStr = QStringLiteral("auth");
break;
}
return methodStr;
}
......@@ -187,6 +190,8 @@ MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod MessageViewer::DKIMUt
return MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Dmarc;
} else if (str == QLatin1String("dkim-atps")) {
return MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Dkimatps;
} else if (str == QLatin1String("auth")) {
return MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Auth;
} else {
qCWarning(MESSAGEVIEWER_DKIMCHECKER_LOG) << "Undefined type " << str;
return MessageViewer::DKIMCheckSignatureJob::AuthenticationMethod::Unknown;
......
......@@ -217,6 +217,7 @@ void DKIMWidgetInfo::updateToolTip()
case DKIMCheckSignatureJob::AuthenticationMethod::Spf:
case DKIMCheckSignatureJob::AuthenticationMethod::Dkim:
case DKIMCheckSignatureJob::AuthenticationMethod::Dmarc:
case DKIMCheckSignatureJob::AuthenticationMethod::Auth:
case DKIMCheckSignatureJob::AuthenticationMethod::Dkimatps: {
const QString str = i18nc("method name: info about it from parsing", "%1: %2", MessageViewer::DKIMUtil::convertAuthenticationMethodEnumToString(result.method), result.infoResult);
if (!tooltipList.contains(str)) {
......@@ -237,6 +238,7 @@ void DKIMWidgetInfo::updateToolTip()
case DKIMCheckSignatureJob::AuthenticationMethod::Spf:
case DKIMCheckSignatureJob::AuthenticationMethod::Dkim:
case DKIMCheckSignatureJob::AuthenticationMethod::Dmarc:
case DKIMCheckSignatureJob::AuthenticationMethod::Auth:
case DKIMCheckSignatureJob::AuthenticationMethod::Dkimatps: {
const QString str = i18n("%1: None", MessageViewer::DKIMUtil::convertAuthenticationMethodEnumToString(result.method));
if (!tooltipList.contains(str)) {
......@@ -267,6 +269,8 @@ void DKIMWidgetInfo::updateToolTip()
break;
}
case DKIMCheckSignatureJob::AuthenticationMethod::Auth:
case DKIMCheckSignatureJob::AuthenticationMethod::Dkimatps:
case DKIMCheckSignatureJob::AuthenticationMethod::Dmarc: {
const QString str = i18n("%1: Valid", MessageViewer::DKIMUtil::convertAuthenticationMethodEnumToString(result.method));
if (!tooltipList.contains(str)) {
......@@ -275,14 +279,6 @@ void DKIMWidgetInfo::updateToolTip()
break;
}
case DKIMCheckSignatureJob::AuthenticationMethod::Dkimatps: {
const QString str = i18n("%1: Valid", MessageViewer::DKIMUtil::convertAuthenticationMethodEnumToString(result.method));
if (!tooltipList.contains(str)) {
tooltipList.append(str);
}
break;
}
}
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment