Bug Fixes and Minor Changes

- fixed the bug related to ELHO message: "ELHO SmtpClient for Qt/C++"
changed to "ELHO " + name, the name is now by default "localhost"
  - added setter and getter for the name used in the ELHO message
  - added virtual attribute to prepare() method in all classes
  - added virtual attribute to toString() in the MimeMessage and
MimePart classes
This commit is contained in:
bluetiger9 2012-03-20 13:30:49 +02:00
parent 871a1f5daa
commit 3d26948cdd
9 changed files with 26 additions and 8 deletions

View File

@ -37,7 +37,7 @@ protected:
/* [2] Protected methods */
void prepare();
virtual void prepare();
/* [2] --- */
};

View File

@ -48,7 +48,7 @@ protected:
/* [4] Protected methods */
void prepare();
virtual void prepare();
/* [4] --- */

View File

@ -49,7 +49,7 @@ protected:
/* [4] Protected methods */
void prepare();
virtual void prepare();
/* [4] --- */
};

View File

@ -44,7 +44,7 @@ protected:
/* [4] Protected methods */
void prepare();
virtual void prepare();
/* [4] --- */
};

View File

@ -21,7 +21,8 @@
/* [1] Constructors and Destructors */
MimeMessage::MimeMessage()
MimeMessage::MimeMessage() :
hEncoding(MimePart::_8Bit)
{
}

View File

@ -52,7 +52,7 @@ public:
/* [3] Public methods */
QString toString();
virtual QString toString();
/* [3] --- */

View File

@ -74,7 +74,7 @@ public:
/* [3] Public methods */
QString toString();
virtual QString toString();
virtual void prepare();

View File

@ -23,6 +23,7 @@
/* [1] Constructors and destructors */
SmtpClient::SmtpClient(const QString & host, int port, ConnectionType ct) :
name("localhost"),
authMethod(AuthPlain),
connectionTimeout(5000),
responseTimeout(5000)
@ -126,6 +127,16 @@ SmtpClient::ConnectionType SmtpClient::getConnectionType() const
return TcpConnection;
}
const QString& SmtpClient::getName() const
{
return this->name;
}
void SmtpClient::setName(const QString &name)
{
this->name = name;
}
/* [2] --- */
@ -160,7 +171,7 @@ bool SmtpClient::connectToHost()
// Send a EHLO/HELO message to the server
// The client's first command must be EHLO/HELO
sendMessage("EHLO SmtpClient for Qt/C++");
sendMessage("EHLO " + name);
// Wait for the server's response
waitForResponse();

View File

@ -71,6 +71,9 @@ public:
int getPort() const;
void setPort(int port);
const QString& getName() const;
void setName(const QString &name);
ConnectionType getConnectionType() const;
void setConnectionType(ConnectionType ct);
@ -97,6 +100,7 @@ public:
void quit();
/* [3] --- */
protected:
@ -108,6 +112,7 @@ protected:
QString host;
int port;
bool useSsl;
QString name;
QString user;
QString password;
@ -119,6 +124,7 @@ protected:
QString responseText;
int responseCode;
class ResponseTimeoutException {};
/* [4] --- */