Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KMailTransport
Commits
bfa9ccce
Commit
bfa9ccce
authored
Sep 07, 2020
by
Ahmad Samir
Browse files
Revert wrong commit, bad merge
This reverts commit
e15cd5ec
.
parent
e15cd5ec
Pipeline
#33398
passed with stage
in 10 minutes and 11 seconds
Changes
28
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
bfa9ccce
...
...
@@ -3,7 +3,7 @@ set(PIM_VERSION "5.15.2")
project
(
MailTransport VERSION
${
PIM_VERSION
}
)
# ECM setup
set
(
KF5_MIN_VERSION
"5.7
3
.0"
)
set
(
KF5_MIN_VERSION
"5.7
1
.0"
)
find_package
(
ECM
${
KF5_MIN_VERSION
}
CONFIG REQUIRED
)
set
(
CMAKE_MODULE_PATH
${
ECM_MODULE_PATH
}
)
...
...
@@ -39,7 +39,6 @@ find_package(KF5ConfigWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package
(
KF5Wallet
${
KF5_MIN_VERSION
}
CONFIG REQUIRED
)
find_package
(
KF5I18n
${
KF5_MIN_VERSION
}
CONFIG REQUIRED
)
find_package
(
KF5KIO
${
KF5_MIN_VERSION
}
CONFIG REQUIRED
)
find_package
(
KF5Service
${
KF5_MIN_VERSION
}
CONFIG REQUIRED
)
find_package
(
KF5Mime
${
KMIME_LIB_VERSION
}
CONFIG REQUIRED
)
find_package
(
KF5Akonadi
${
AKONADI_LIB_VERSION
}
CONFIG REQUIRED
)
find_package
(
KF5AkonadiMime
${
AKONADIMIME_LIB_VERSION
}
CONFIG REQUIRED
)
...
...
@@ -48,7 +47,7 @@ find_package(KPimGAPI ${KGAPI_LIB_VERSION} CONFIG REQUIRED)
option
(
KDEPIM_RUN_AKONADI_TEST
"Enable autotest based on Akonadi."
TRUE
)
add_definitions
(
-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00
)
add_definitions
(
-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054
A
00
)
add_definitions
(
-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054
8
00
)
add_definitions
(
-DQT_NO_FOREACH
)
add_definitions
(
-DQT_NO_KEYWORDS
)
...
...
src/kmailtransport/CMakeLists.txt
View file @
bfa9ccce
...
...
@@ -59,6 +59,7 @@ target_link_libraries(KF5MailTransport
KF5::Wallet
PRIVATE
KF5::I18n
KF5::KIOCore
KF5::ConfigGui
KF5::WidgetsAddons
KF5::CoreAddons
...
...
src/kmailtransport/mailtransport_defs.h
View file @
bfa9ccce
/*
SPDX-File
Copyright
Text:
2006
-
2007 Volker Krause <vkrause@kde.org>
Copyright
(c)
2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
...
...
src/kmailtransport/plugins/smtp/autotests/fakeserver.cpp
View file @
bfa9ccce
...
...
@@ -34,9 +34,9 @@ QList<QByteArray> FakeServer::greetingAndEhlo(bool multiline)
QList
<
QByteArray
>
FakeServer
::
bye
()
{
return
{
"C: QUIT"
,
"S: 221 So long, and thanks for all the fish"
,
"X: "
"C: QUIT"
,
"S: 221 So long, and thanks for all the fish"
,
"X: "
};
}
...
...
src/kmailtransport/plugins/smtp/smtpconfigwidget.cpp
View file @
bfa9ccce
...
...
@@ -2,7 +2,7 @@
SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
Based on MailTransport code by:
SPDX-FileCopyrightText: 2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2007 KovoKs <kovoks@kovoks.nl>
Based on KMail code by:
...
...
src/kmailtransport/plugins/smtp/smtpconfigwidget.h
View file @
bfa9ccce
...
...
@@ -2,7 +2,7 @@
SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
Based on MailTransport code by:
SPDX-FileCopyrightText: 2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006
-
2007 Volker Krause <vkrause@kde.org>
Based on KMail code by:
SPDX-FileCopyrightText: 2001-2002 Michael Haeckel <haeckel@kde.org>
...
...
src/kmailtransport/plugins/smtp/smtpjob.cpp
View file @
bfa9ccce
...
...
@@ -74,8 +74,6 @@ public:
{
}
void
doLogin
();
SmtpJob
*
q
;
KSmtp
::
Session
*
session
=
nullptr
;
KSmtp
::
SessionUiProxy
::
Ptr
uiProxy
;
...
...
@@ -190,22 +188,22 @@ void SmtpJob::startPasswordRetrieval(bool forceRefresh)
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
);
});
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
();
}
...
...
@@ -228,6 +226,7 @@ void SmtpJob::onTokenRequestFinished(KGAPI2::AccountPromise *promise)
startLoginJob
();
}
void
SmtpJob
::
startLoginJob
()
{
if
(
!
transport
()
->
requiresAuthentication
())
{
...
...
@@ -235,16 +234,16 @@ void SmtpJob::startLoginJob()
return
;
}
auto
login
=
new
KSmtp
::
LoginJob
(
d
->
session
);
auto
user
=
transport
()
->
userName
();
auto
passwd
=
transport
()
->
password
();
if
((
user
.
isEmpty
()
||
passwd
.
isEmpty
())
&&
transport
()
->
authenticationType
()
!=
Transport
::
EnumAuthenticationType
::
GSSAPI
)
{
QPointer
<
KPasswordDialog
>
dlg
=
new
KPasswordDialog
(
nullptr
,
KPasswordDialog
::
ShowUsernameLine
|
KPasswordDialog
::
ShowKeepPassword
);
dlg
->
setAttribute
(
Qt
::
WA_DeleteOnClose
,
true
);
nullptr
,
KPasswordDialog
::
ShowUsernameLine
|
KPasswordDialog
::
ShowKeepPassword
);
dlg
->
setPrompt
(
i18n
(
"You need to supply a username and a password "
"to use this SMTP server."
));
dlg
->
setKeepPassword
(
transport
()
->
storePassword
());
...
...
@@ -252,41 +251,31 @@ void SmtpJob::startLoginJob()
dlg
->
setUsername
(
user
);
dlg
->
setPassword
(
passwd
);
connect
(
this
,
&
KJob
::
result
,
dlg
,
&
QDialog
::
reject
);
connect
(
dlg
,
&
QDialog
::
finished
,
this
,
[
this
,
dlg
](
const
int
result
)
{
if
(
result
==
QDialog
::
Rejected
)
{
setError
(
KilledJobError
);
emitResult
();
return
;
}
bool
gotIt
=
false
;
if
(
dlg
->
exec
())
{
transport
()
->
setUserName
(
dlg
->
username
());
transport
()
->
setPassword
(
dlg
->
password
());
transport
()
->
setStorePassword
(
dlg
->
keepPassword
());
transport
()
->
save
();
gotIt
=
true
;
}
delete
dlg
;
d
->
doLogin
();
}
);
dlg
->
open
();
return
;
if
(
!
gotIt
)
{
setError
(
KilledJobError
);
emitResult
();
return
;
}
}
d
->
doLogin
();
}
void
SmtpJobPrivate
::
doLogin
()
{
QString
passwd
=
q
->
transport
()
->
password
();
if
(
q
->
transport
()
->
authenticationType
()
==
Transport
::
EnumAuthenticationType
::
XOAUTH2
)
{
if
(
transport
()
->
authenticationType
()
==
Transport
::
EnumAuthenticationType
::
XOAUTH2
)
{
passwd
=
passwd
.
left
(
passwd
.
indexOf
(
QLatin1Char
(
'\001'
)));
}
else
{
passwd
=
transport
()
->
password
();
}
auto
login
=
new
KSmtp
::
LoginJob
(
session
);
login
->
setUserName
(
q
->
transport
()
->
userName
());
login
->
setUserName
(
transport
()
->
userName
());
login
->
setPassword
(
passwd
);
switch
(
q
->
transport
()
->
authenticationType
())
{
switch
(
transport
()
->
authenticationType
())
{
case
TransportBase
::
EnumAuthenticationType
::
PLAIN
:
login
->
setPreferedAuthMode
(
KSmtp
::
LoginJob
::
Plain
);
break
;
...
...
@@ -309,11 +298,11 @@ void SmtpJobPrivate::doLogin()
login
->
setPreferedAuthMode
(
KSmtp
::
LoginJob
::
GSSAPI
);
break
;
default:
qCWarning
(
MAILTRANSPORT_SMTP_LOG
)
<<
"Unknown authentication mode"
<<
q
->
transport
()
->
authenticationTypeString
();
qCWarning
(
MAILTRANSPORT_SMTP_LOG
)
<<
"Unknown authentication mode"
<<
transport
()
->
authenticationTypeString
();
break
;
}
switch
(
q
->
transport
()
->
encryption
())
{
switch
(
transport
()
->
encryption
())
{
case
Transport
::
EnumEncryption
::
None
:
login
->
setEncryptionMode
(
KSmtp
::
LoginJob
::
Unencrypted
);
break
;
...
...
@@ -324,12 +313,12 @@ void SmtpJobPrivate::doLogin()
login
->
setEncryptionMode
(
KSmtp
::
LoginJob
::
SSLorTLS
);
break
;
default:
qCWarning
(
MAILTRANSPORT_SMTP_LOG
)
<<
"Unknown encryption mode"
<<
q
->
transport
()
->
encryption
();
qCWarning
(
MAILTRANSPORT_SMTP_LOG
)
<<
"Unknown encryption mode"
<<
transport
()
->
encryption
();
break
;
}
q
->
connect
(
login
,
&
KJob
::
result
,
q
,
&
SmtpJob
::
slotResult
);
q
->
addSubjob
(
login
);
connect
(
login
,
&
KJob
::
result
,
this
,
&
SmtpJob
::
slotResult
);
addSubjob
(
login
);
login
->
start
();
qCDebug
(
MAILTRANSPORT_SMTP_LOG
)
<<
"Login started"
;
}
...
...
@@ -374,7 +363,7 @@ void SmtpJob::slotResult(KJob *job)
return
;
}
if
(
qobject_cast
<
KSmtp
::
LoginJob
*>
(
job
))
{
if
(
qobject_cast
<
KSmtp
::
LoginJob
*>
(
job
))
{
if
(
job
->
error
()
==
KSmtp
::
LoginJob
::
TokenExpired
)
{
startPasswordRetrieval
(
/*force refresh */
true
);
return
;
...
...
src/kmailtransport/plugins/smtp/smtpmailtransportplugin.h
View file @
bfa9ccce
...
...
@@ -14,7 +14,8 @@ class SMTPMailTransportPlugin : public MailTransport::TransportAbstractPlugin
{
Q_OBJECT
public:
explicit
SMTPMailTransportPlugin
(
QObject
*
parent
=
nullptr
,
const
QList
<
QVariant
>
&
=
{
explicit
SMTPMailTransportPlugin
(
QObject
*
parent
=
nullptr
,
const
QList
<
QVariant
>
&
=
{
});
~
SMTPMailTransportPlugin
()
override
;
...
...
src/kmailtransport/precommandjob.cpp
View file @
bfa9ccce
...
...
@@ -71,7 +71,7 @@ void PrecommandJob::start()
void
PreCommandJobPrivate
::
slotStarted
()
{
Q_EMIT
q
->
infoMessage
(
q
,
i18n
(
"Executing precommand"
),
i18n
(
"Executing precommand '%1'."
,
precommand
));
i18n
(
"Executing precommand '%1'."
,
precommand
));
}
void
PreCommandJobPrivate
::
slotError
(
QProcess
::
ProcessError
error
)
...
...
src/kmailtransport/servertest.cpp
View file @
bfa9ccce
/*
SPDX-File
Copyright
Text:
2006
-
2007 Volker Krause <vkrause@kde.org>
Copyright
(c)
2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2007 KovoKs <info@kovoks.nl>
SPDX-FileCopyrightText: 2008 Thomas McGuire <thomas.mcguire@gmx.net>
...
...
@@ -17,7 +17,6 @@
#include
<QHash>
#include
<QHostInfo>
#include
<QProgressBar>
#include
<QRegularExpression>
#include
<QTimer>
#include
<QSet>
...
...
@@ -68,8 +67,7 @@ public:
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
{
inline
bool
isGmail
(
const
QString
&
server
)
const
{
return
server
.
endsWith
(
QLatin1String
(
"gmail.com"
))
||
server
.
endsWith
(
QLatin1String
(
"googlemail.com"
));
}
...
...
@@ -244,9 +242,10 @@ bool ServerTestPrivate::handlePopConversation(MailTransport::Socket *socket, int
// Initial Greeting
if
(
stage
==
0
)
{
//Regexp taken from POP3 ioslave
const
QString
responseWithoutCRLF
=
response
.
chopped
(
2
);
const
QRegularExpression
re
(
QStringLiteral
(
"<[A-Za-z0-9
\\
.
\\
-_]+@[A-Za-z0-9
\\
.
\\
-_]+>$"
),
QRegularExpression
::
CaseInsensitiveOption
);
QString
responseWithoutCRLF
=
response
;
responseWithoutCRLF
.
chop
(
2
);
QRegExp
re
(
QStringLiteral
(
"<[A-Za-z0-9
\\
.
\\
-_]+@[A-Za-z0-9
\\
.
\\
-_]+>$"
),
Qt
::
CaseInsensitive
);
if
(
responseWithoutCRLF
.
indexOf
(
re
)
!=
-
1
)
{
authenticationResults
[
type
]
<<
Transport
::
EnumAuthenticationType
::
APOP
;
}
...
...
src/kmailtransport/tests/transportmgr.cpp
View file @
bfa9ccce
/*
SPDX-File
Copyright
Text:
2006
-
2007 Volker Krause <vkrause@kde.org>
Copyright
(c)
2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
...
...
src/kmailtransport/tests/transportmgr.h
View file @
bfa9ccce
/*
SPDX-File
Copyright
Text:
2006
-
2007 Volker Krause <vkrause@kde.org>
Copyright
(c)
2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
...
...
src/kmailtransport/transport.cpp
View file @
bfa9ccce
/*
SPDX-File
Copyright
Text:
2006
-
2007 Volker Krause <vkrause@kde.org>
Copyright
(c)
2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
...
...
src/kmailtransport/transport.h
View file @
bfa9ccce
/*
SPDX-File
Copyright
Text:
2006
-
2007 Volker Krause <vkrause@kde.org>
Copyright
(c)
2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
...
...
src/kmailtransport/transport_p.h
View file @
bfa9ccce
/*
SPDX-File
Copyright
Text:
2006
-
2007 Volker Krause <vkrause@kde.org>
Copyright
(c)
2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
...
...
src/kmailtransport/transportmanager.cpp
View file @
bfa9ccce
/*
SPDX-File
Copyright
Text:
2006
-
2007 Volker Krause <vkrause@kde.org>
Copyright
(c)
2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
...
...
@@ -623,9 +623,7 @@ void TransportManager::loadPasswordsAsync()
d
->
wallet
=
Wallet
::
openWallet
(
Wallet
::
NetworkWallet
(),
window
,
Wallet
::
Asynchronous
);
if
(
d
->
wallet
)
{
connect
(
d
->
wallet
,
&
KWallet
::
Wallet
::
walletOpened
,
this
,
[
this
](
bool
status
)
{
d
->
slotWalletOpened
(
status
);
});
connect
(
d
->
wallet
,
&
KWallet
::
Wallet
::
walletOpened
,
this
,
[
this
](
bool
status
)
{
d
->
slotWalletOpened
(
status
);});
d
->
walletAsyncOpen
=
true
;
}
else
{
d
->
walletOpenFailed
=
true
;
...
...
src/kmailtransport/transportmanager.h
View file @
bfa9ccce
/*
SPDX-File
Copyright
Text:
2006
-
2007 Volker Krause <vkrause@kde.org>
Copyright
(c)
2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
...
...
@@ -13,6 +13,7 @@
#include
<QList>
#include
<QObject>
namespace
KWallet
{
class
Wallet
;
}
...
...
src/kmailtransport/widgets/transportcombobox.cpp
View file @
bfa9ccce
/*
SPDX-File
Copyright
Text:
2006
-
2007 Volker Krause <vkrause@kde.org>
Copyright
(c)
2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
...
...
src/kmailtransport/widgets/transportcombobox.h
View file @
bfa9ccce
/*
SPDX-File
Copyright
Text:
2006
-
2007 Volker Krause <vkrause@kde.org>
Copyright
(c)
2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
...
...
src/kmailtransport/widgets/transportconfigwidget.cpp
View file @
bfa9ccce
...
...
@@ -2,7 +2,7 @@
SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
Based on MailTransport code by:
SPDX-FileCopyrightText: 2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2006
-
2007 Volker Krause <vkrause@kde.org>
SPDX-FileCopyrightText: 2007 KovoKs <kovoks@kovoks.nl>
Based on KMail code by:
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment