summaryrefslogtreecommitdiff
path: root/user/kmailtransport/degoogled.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/kmailtransport/degoogled.patch')
-rw-r--r--user/kmailtransport/degoogled.patch222
1 files changed, 222 insertions, 0 deletions
diff --git a/user/kmailtransport/degoogled.patch b/user/kmailtransport/degoogled.patch
new file mode 100644
index 000000000..1bb7086c5
--- /dev/null
+++ b/user/kmailtransport/degoogled.patch
@@ -0,0 +1,222 @@
+diff -Naur kmailtransport-20.04.3/CMakeLists.txt kmailtransport-degoogled/CMakeLists.txt
+--- kmailtransport-20.04.3/CMakeLists.txt 2020-07-18 22:38:18.572259714 +0000
++++ kmailtransport-degoogled/CMakeLists.txt 2020-07-18 22:38:06.963507959 +0000
+@@ -29,7 +29,6 @@
+ set(AKONADI_LIB_VERSION "5.14.3")
+ set(AKONADIMIME_LIB_VERSION "5.14.3")
+ set(KSMTP_LIB_VERSION "5.14.3")
+-set(KGAPI_LIB_VERSION "5.14.3")
+
+ set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5MailTransport")
+
+@@ -43,7 +42,6 @@
+ find_package(KF5Akonadi ${AKONADI_LIB_VERSION} CONFIG REQUIRED)
+ find_package(KF5AkonadiMime ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED)
+ find_package(KPimSMTP ${KSMTP_LIB_VERSION} CONFIG REQUIRED)
+-find_package(KPimGAPI ${KGAPI_LIB_VERSION} CONFIG REQUIRED)
+
+ option(KDEPIM_RUN_AKONADI_TEST "Enable autotest based on Akonadi." TRUE)
+ if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
+diff -Naur kmailtransport-20.04.3/src/kmailtransport/mailtransport.kcfg kmailtransport-degoogled/src/kmailtransport/mailtransport.kcfg
+--- kmailtransport-20.04.3/src/kmailtransport/mailtransport.kcfg 2020-06-18 06:30:31.000000000 +0000
++++ kmailtransport-degoogled/src/kmailtransport/mailtransport.kcfg 2020-07-18 22:35:49.028339597 +0000
+@@ -79,7 +79,6 @@
+ <choice name="APOP" />
+ <choice name="CLEAR" />
+ <choice name="ANONYMOUS" />
+- <choice name="XOAUTH2" />
+ </choices>
+ <default>PLAIN</default>
+ </entry>
+diff -Naur kmailtransport-20.04.3/src/kmailtransport/plugins/smtp/CMakeLists.txt kmailtransport-degoogled/src/kmailtransport/plugins/smtp/CMakeLists.txt
+--- kmailtransport-20.04.3/src/kmailtransport/plugins/smtp/CMakeLists.txt 2020-06-18 06:30:31.000000000 +0000
++++ kmailtransport-degoogled/src/kmailtransport/plugins/smtp/CMakeLists.txt 2020-07-18 22:37:43.696009823 +0000
+@@ -27,5 +27,4 @@
+ KF5::ConfigWidgets
+ KF5::KIOWidgets
+ KPim::SMTP
+- KPim::GAPICore
+ )
+diff -Naur kmailtransport-20.04.3/src/kmailtransport/plugins/smtp/autotests/CMakeLists.txt kmailtransport-degoogled/src/kmailtransport/plugins/smtp/autotests/CMakeLists.txt
+--- kmailtransport-20.04.3/src/kmailtransport/plugins/smtp/autotests/CMakeLists.txt 2020-06-18 06:30:31.000000000 +0000
++++ kmailtransport-degoogled/src/kmailtransport/plugins/smtp/autotests/CMakeLists.txt 2020-07-18 22:37:50.785247545 +0000
+@@ -15,6 +15,5 @@
+ KF5::ConfigWidgets
+ KF5::KIOWidgets
+ KPim::SMTP
+- KPim::GAPICore
+ TEST_NAME smtpjobtest
+ )
+diff -Naur kmailtransport-20.04.3/src/kmailtransport/plugins/smtp/smtpconfigwidget.cpp kmailtransport-degoogled/src/kmailtransport/plugins/smtp/smtpconfigwidget.cpp
+--- kmailtransport-20.04.3/src/kmailtransport/plugins/smtp/smtpconfigwidget.cpp 2020-06-18 06:30:31.000000000 +0000
++++ kmailtransport-degoogled/src/kmailtransport/plugins/smtp/smtpconfigwidget.cpp 2020-07-18 22:37:12.009416961 +0000
+@@ -70,8 +70,7 @@
+ << Transport::EnumAuthenticationType::CRAM_MD5
+ << Transport::EnumAuthenticationType::DIGEST_MD5
+ << Transport::EnumAuthenticationType::NTLM
+- << Transport::EnumAuthenticationType::GSSAPI
+- << Transport::EnumAuthenticationType::XOAUTH2;
++ << Transport::EnumAuthenticationType::GSSAPI;
+ sslCapa = tlsCapa = noEncCapa;
+ updateAuthCapbilities();
+ }
+diff -Naur kmailtransport-20.04.3/src/kmailtransport/plugins/smtp/smtpjob.cpp kmailtransport-degoogled/src/kmailtransport/plugins/smtp/smtpjob.cpp
+--- kmailtransport-20.04.3/src/kmailtransport/plugins/smtp/smtpjob.cpp 2020-06-18 06:30:31.000000000 +0000
++++ kmailtransport-degoogled/src/kmailtransport/plugins/smtp/smtpjob.cpp 2020-07-18 22:37:25.447971965 +0000
+@@ -38,13 +38,6 @@
+ #include <KSMTP/LoginJob>
+ #include <KSMTP/SendJob>
+
+-#include <KGAPI/Account>
+-#include <KGAPI/AuthJob>
+-#include <KGAPI/AccountManager>
+-
+-#define GOOGLE_API_KEY QStringLiteral("554041944266.apps.googleusercontent.com")
+-#define GOOGLE_API_SECRET QStringLiteral("mdT1DjzohxN3npUUzkENT0gO")
+-
+ using namespace MailTransport;
+
+ class SessionPool
+@@ -196,50 +189,9 @@
+ return;
+ }
+
+- if (transport()->authenticationType() == TransportBase::EnumAuthenticationType::XOAUTH2) {
+- auto promise = KGAPI2::AccountManager::instance()->findAccount(
+- GOOGLE_API_KEY, transport()->userName(), { KGAPI2::Account::mailScopeUrl() });
+- connect(promise, &KGAPI2::AccountPromise::finished,
+- this, [forceRefresh, this](KGAPI2::AccountPromise *promise) {
+- if (promise->account()) {
+- if (forceRefresh) {
+- promise = KGAPI2::AccountManager::instance()->refreshTokens(
+- GOOGLE_API_KEY, GOOGLE_API_SECRET, transport()->userName());
+- } else {
+- onTokenRequestFinished(promise);
+- return;
+- }
+- } else {
+- promise = KGAPI2::AccountManager::instance()->getAccount(
+- GOOGLE_API_KEY, GOOGLE_API_SECRET, transport()->userName(),
+- { KGAPI2::Account::mailScopeUrl() });
+- }
+- connect(promise, &KGAPI2::AccountPromise::finished,
+- this, &SmtpJob::onTokenRequestFinished);
+- });
+- } else {
+- startLoginJob();
+- }
+-}
+-
+-void SmtpJob::onTokenRequestFinished(KGAPI2::AccountPromise *promise)
+-{
+- if (promise->hasError()) {
+- qCWarning(MAILTRANSPORT_SMTP_LOG) << "Error obtaining XOAUTH2 token:" << promise->errorText();
+- setError(KJob::UserDefinedError);
+- setErrorText(promise->errorText());
+- emitResult();
+- return;
+- }
+-
+- const auto account = promise->account();
+- const QString tokens = QStringLiteral("%1\001%2").arg(account->accessToken(),
+- account->refreshToken());
+- transport()->setPassword(tokens);
+ startLoginJob();
+ }
+
+-
+ void SmtpJob::startLoginJob()
+ {
+ if (!transport()->requiresAuthentication()) {
+@@ -281,11 +233,7 @@
+ }
+ }
+
+- if (transport()->authenticationType() == Transport::EnumAuthenticationType::XOAUTH2) {
+- passwd = passwd.left(passwd.indexOf(QLatin1Char('\001')));
+- } else {
+- passwd = transport()->password();
+- }
++ passwd = transport()->password();
+ login->setUserName(transport()->userName());
+ login->setPassword(passwd);
+ switch (transport()->authenticationType()) {
+@@ -298,9 +246,6 @@
+ case TransportBase::EnumAuthenticationType::CRAM_MD5:
+ login->setPreferedAuthMode(KSmtp::LoginJob::CramMD5);
+ break;
+- case TransportBase::EnumAuthenticationType::XOAUTH2:
+- login->setPreferedAuthMode(KSmtp::LoginJob::XOAuth2);
+- break;
+ case TransportBase::EnumAuthenticationType::DIGEST_MD5:
+ login->setPreferedAuthMode(KSmtp::LoginJob::DigestMD5);
+ break;
+diff -Naur kmailtransport-20.04.3/src/kmailtransport/plugins/smtp/smtpjob.h kmailtransport-degoogled/src/kmailtransport/plugins/smtp/smtpjob.h
+--- kmailtransport-20.04.3/src/kmailtransport/plugins/smtp/smtpjob.h 2020-06-18 06:30:31.000000000 +0000
++++ kmailtransport-degoogled/src/kmailtransport/plugins/smtp/smtpjob.h 2020-07-18 22:37:38.056616206 +0000
+@@ -31,10 +31,6 @@
+ class Slave;
+ }
+
+-namespace KGAPI2 {
+-class AccountPromise;
+-}
+-
+ class SmtpJobPrivate;
+
+ namespace MailTransport {
+@@ -74,7 +70,6 @@
+
+ private:
+ void startPasswordRetrieval(bool forceRefresh = false);
+- void onTokenRequestFinished(KGAPI2::AccountPromise *result);
+ void startSmtpJob();
+ void startLoginJob();
+ void startSendJob();
+diff -Naur kmailtransport-20.04.3/src/kmailtransport/servertest.cpp kmailtransport-degoogled/src/kmailtransport/servertest.cpp
+--- kmailtransport-20.04.3/src/kmailtransport/servertest.cpp 2020-06-18 06:30:31.000000000 +0000
++++ kmailtransport-degoogled/src/kmailtransport/servertest.cpp 2020-07-18 22:36:05.166604311 +0000
+@@ -80,10 +80,6 @@
+ bool handleNntpConversation(MailTransport::Socket *socket, int type, int *stage, const QString &response, bool *shouldStartTLS);
+ QVector<int> parseAuthenticationList(const QStringList &authentications);
+
+- inline bool isGmail(const QString &server) const {
+- return server.endsWith(QLatin1String("gmail.com")) || server.endsWith(QLatin1String("googlemail.com"));
+- }
+-
+ // slots
+ void slotNormalPossible();
+ void slotNormalNotPossible();
+@@ -156,10 +152,6 @@
+ result << Transport::EnumAuthenticationType::GSSAPI;
+ } else if (current == QLatin1String("ANONYMOUS")) {
+ result << Transport::EnumAuthenticationType::ANONYMOUS;
+- } else if (current == QLatin1String("XOAUTH2")) {
+- if (isGmail(server)) {
+- result << Transport::EnumAuthenticationType::XOAUTH2;
+- }
+ }
+ // APOP is handled by handlePopConversation()
+ }
+@@ -183,9 +175,6 @@
+ }
+
+ QStringList protocols;
+- if (isGmail(server)) {
+- protocols << QStringLiteral("XOAUTH2");
+- }
+
+ protocols << QStringLiteral("LOGIN")
+ << QStringLiteral("PLAIN") << QStringLiteral("CRAM-MD5")
+diff -Naur kmailtransport-20.04.3/src/kmailtransport/transport.cpp kmailtransport-degoogled/src/kmailtransport/transport.cpp
+--- kmailtransport-20.04.3/src/kmailtransport/transport.cpp 2020-06-18 06:30:31.000000000 +0000
++++ kmailtransport-degoogled/src/kmailtransport/transport.cpp 2020-07-18 22:35:40.749229818 +0000
+@@ -142,8 +142,6 @@
+ return QStringLiteral("APOP");
+ case EnumAuthenticationType::ANONYMOUS:
+ return i18nc("Authentication method", "Anonymous");
+- case EnumAuthenticationType::XOAUTH2:
+- return QStringLiteral("XOAUTH2");
+ }
+ Q_ASSERT(false);
+ return QString();