1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
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();
|