From 949e1ee82a8cf6658b1459f250bd0e707e9313d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C5=91k=C3=A9s=20Attila?= Date: Sun, 28 Oct 2012 21:48:04 +0200 Subject: [PATCH] Maked setHost() and setPassword() deprecated. Some bug fixes. --- src/smtpclient.cpp | 11 ++++++++++- src/smtpclient.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/smtpclient.cpp b/src/smtpclient.cpp index 230d967..cbbcd5f 100644 --- a/src/smtpclient.cpp +++ b/src/smtpclient.cpp @@ -32,7 +32,9 @@ SmtpClient::SmtpClient(const QString & host, int port, ConnectionType connection authMethod(AuthPlain), connectionTimeout(5000), responseTimeout(5000), - isReadyConnected(false) + isReadyConnected(false), + isAuthenticated(false), + isMailSent(false) { setConnectionType(connectionType); @@ -80,6 +82,7 @@ void SmtpClient::setAuthMethod(AuthMethod method) /** * @brief Sets the host of connection. + * @deprecated Use the constructor. */ void SmtpClient::setHost(QString &host) { @@ -89,6 +92,7 @@ void SmtpClient::setHost(QString &host) /** * @brief Sets the connection port to the specified value. * @param port + * @deprecated Use the constructor. */ void SmtpClient::setPort(int port) { @@ -212,6 +216,7 @@ bool SmtpClient::login(const QString &user, const QString &password, AuthMethod this->user = user; this->password = password; this->authMethod = method; + clearUserDataAfterLogin = true; return login(); } @@ -407,6 +412,10 @@ void SmtpClient::changeState(ClientState state) { case _READY_Authenticated: isAuthenticated = true; + if (clearUserDataAfterLogin) { + password = ""; user = ""; + clearUserDataAfterLogin = false; + } changeState(ReadyState); emit authenticated(); break; diff --git a/src/smtpclient.h b/src/smtpclient.h index 3555451..9673a5b 100644 --- a/src/smtpclient.h +++ b/src/smtpclient.h @@ -169,6 +169,7 @@ protected: QString user; QString password; AuthMethod authMethod; + bool clearUserDataAfterLogin; int connectionTimeout; int responseTimeout;