Skip to content

Commit

Permalink
Merge pull request #65 from nemomobile-packages/smtpRecreate
Browse files Browse the repository at this point in the history
Smtp recreate
  • Loading branch information
VDVsx committed Jan 19, 2015
2 parents 5c5428f + 52b5e8c commit 4fb106c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions qmf/src/plugins/messageservices/smtp/smtpclient.cpp
Expand Up @@ -115,6 +115,8 @@ SmtpClient::SmtpClient(QObject* parent)
, ssoSessionManager(0)
, loginFailed(false)
, sendLogin(false)
, recreateIdentity(false)
, recreateIdentityCount(0)
{
connect(QMailStore::instance(), SIGNAL(accountsUpdated(const QMailAccountIdList&)),
this, SLOT(accountsUpdated(const QMailAccountIdList&)));
Expand Down Expand Up @@ -659,6 +661,9 @@ void SmtpClient::nextAction(const QString &response)
operationFailed(QMailServiceAction::Status::ErrLoginFailed, response);
}
}
} else if (recreateIdentity && recreateIdentityCount < 5) {
sendLogin = true;
ssoSessionManager->recreateSsoIdentity();
} else {
if (!ssoSessionManager->waitForSso()) {
QByteArray authCmd(SmtpAuthenticator::getAuthentication(config.serviceConfiguration("smtp"), capabilities, ssoLogin));
Expand Down Expand Up @@ -1186,6 +1191,8 @@ void SmtpClient::onSsoSessionResponse(const QMap<QString, QList<QByteArray> > &s
ssoLogin = ssoCredentials;
if (sendLogin) {
sendLogin = false;
recreateIdentity = false;
recreateIdentityCount = 0;
QByteArray authCmd(SmtpAuthenticator::getAuthentication(config.serviceConfiguration("smtp"), capabilities, ssoLogin));
if (!authCmd.isEmpty()) {
sendCommand(authCmd);
Expand All @@ -1203,6 +1210,9 @@ void SmtpClient::onSsoSessionError(const QString &error)
// Reset vars
loginFailed = false;
sendLogin = false;
recreateIdentity = true;
// used to prevent a potencial error loop and mutiple calls to sso
recreateIdentityCount++;
qMailLog(SMTP) << "Got SSO error:" << error;
operationFailed(QMailServiceAction::Status::ErrLoginFailed, error);
}
Expand Down
2 changes: 2 additions & 0 deletions qmf/src/plugins/messageservices/smtp/smtpclient.h
Expand Up @@ -178,6 +178,8 @@ private slots:
SSOSessionManager* ssoSessionManager;
bool loginFailed;
bool sendLogin;
bool recreateIdentity;
int recreateIdentityCount;
QMap<QString, QList<QByteArray> > ssoLogin;
#endif
};
Expand Down
2 changes: 1 addition & 1 deletion rpm/qmf-qt5.spec
@@ -1,6 +1,6 @@
Name: qmf-qt5
Summary: Qt Messaging Framework (QMF) Qt5
Version: 4.0.4+git38
Version: 4.0.4+git39
Release: 1
Group: System/Libraries
License: LGPLv2.1 with exception or GPLv3
Expand Down

0 comments on commit 4fb106c

Please sign in to comment.