summaryrefslogtreecommitdiff
path: root/legacy/kmailtransport
diff options
context:
space:
mode:
Diffstat (limited to 'legacy/kmailtransport')
-rw-r--r--legacy/kmailtransport/APKBUILD44
-rw-r--r--legacy/kmailtransport/degoogled.patch222
2 files changed, 266 insertions, 0 deletions
diff --git a/legacy/kmailtransport/APKBUILD b/legacy/kmailtransport/APKBUILD
new file mode 100644
index 000000000..3b80ed99d
--- /dev/null
+++ b/legacy/kmailtransport/APKBUILD
@@ -0,0 +1,44 @@
+# Contributor: A. Wilcox <awilfox@adelielinux.org>
+# Maintainer: A. Wilcox <awilfox@adelielinux.org>
+pkgname=kmailtransport
+pkgver=20.08.1
+pkgrel=0
+pkgdesc="KDE email transport library"
+url="https://kde.org/"
+arch="all"
+license="LGPL-2.1+"
+depends=""
+makedepends="qt5-qtbase-dev cmake extra-cmake-modules kcmutils-dev kmime-dev
+ kwallet-dev akonadi-dev akonadi-mime-dev ksmtp-dev"
+subpackages="$pkgname-dev $pkgname-lang"
+source="https://download.kde.org/stable/release-service/$pkgver/src/kmailtransport-$pkgver.tar.xz
+ degoogled.patch
+ "
+
+build() {
+ if [ "$CBUILD" != "$CHOST" ]; then
+ CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
+ fi
+ cmake \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_INSTALL_LIBDIR=lib \
+ -DBUILD_SHARED_LIBS=True \
+ -DCMAKE_BUILD_TYPE=RelWithDebugInfo \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
+ -DCMAKE_C_FLAGS="$CFLAGS" \
+ ${CMAKE_CROSSOPTS} \
+ .
+ make
+}
+
+check() {
+ # Akonadi tests require D-Bus.
+ QT_QPA_PLATFORM=offscreen CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E 'akonadi-*'
+}
+
+package() {
+ make DESTDIR="$pkgdir" install
+}
+
+sha512sums="409475cf4a34b15f7f2bed4d5e7612c8c72e90cb39cc778ce79f1132180cde311a2d490e2172787c1461ca017348faff74fc10203aa482f51ef81550a15e310e kmailtransport-20.08.1.tar.xz
+0fbde4a8983be652ee10cd1c64391240c80ccaae697c77c43f8c9bc0bfd85cbe0dd37a5fc6860185ed15575c8bfcd198276c8291bbfc83bb1811a57eea5ea6a7 degoogled.patch"
diff --git a/legacy/kmailtransport/degoogled.patch b/legacy/kmailtransport/degoogled.patch
new file mode 100644
index 000000000..52199c040
--- /dev/null
+++ b/legacy/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.15.1")
+ set(AKONADIMIME_LIB_VERSION "5.15.1")
+ set(KSMTP_LIB_VERSION "5.15.1")
+-set(KGAPI_LIB_VERSION "5.15.1")
+
+ 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();