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:
parent
871a1f5daa
commit
3d26948cdd
@ -37,7 +37,7 @@ protected:
|
|||||||
|
|
||||||
/* [2] Protected methods */
|
/* [2] Protected methods */
|
||||||
|
|
||||||
void prepare();
|
virtual void prepare();
|
||||||
|
|
||||||
/* [2] --- */
|
/* [2] --- */
|
||||||
};
|
};
|
||||||
|
@ -48,7 +48,7 @@ protected:
|
|||||||
|
|
||||||
/* [4] Protected methods */
|
/* [4] Protected methods */
|
||||||
|
|
||||||
void prepare();
|
virtual void prepare();
|
||||||
|
|
||||||
/* [4] --- */
|
/* [4] --- */
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ protected:
|
|||||||
|
|
||||||
/* [4] Protected methods */
|
/* [4] Protected methods */
|
||||||
|
|
||||||
void prepare();
|
virtual void prepare();
|
||||||
|
|
||||||
/* [4] --- */
|
/* [4] --- */
|
||||||
};
|
};
|
||||||
|
@ -44,7 +44,7 @@ protected:
|
|||||||
|
|
||||||
/* [4] Protected methods */
|
/* [4] Protected methods */
|
||||||
|
|
||||||
void prepare();
|
virtual void prepare();
|
||||||
|
|
||||||
/* [4] --- */
|
/* [4] --- */
|
||||||
};
|
};
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
|
|
||||||
/* [1] Constructors and Destructors */
|
/* [1] Constructors and Destructors */
|
||||||
|
|
||||||
MimeMessage::MimeMessage()
|
MimeMessage::MimeMessage() :
|
||||||
|
hEncoding(MimePart::_8Bit)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
|
|
||||||
/* [3] Public methods */
|
/* [3] Public methods */
|
||||||
|
|
||||||
QString toString();
|
virtual QString toString();
|
||||||
|
|
||||||
/* [3] --- */
|
/* [3] --- */
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
/* [3] Public methods */
|
/* [3] Public methods */
|
||||||
|
|
||||||
QString toString();
|
virtual QString toString();
|
||||||
|
|
||||||
virtual void prepare();
|
virtual void prepare();
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
/* [1] Constructors and destructors */
|
/* [1] Constructors and destructors */
|
||||||
|
|
||||||
SmtpClient::SmtpClient(const QString & host, int port, ConnectionType ct) :
|
SmtpClient::SmtpClient(const QString & host, int port, ConnectionType ct) :
|
||||||
|
name("localhost"),
|
||||||
authMethod(AuthPlain),
|
authMethod(AuthPlain),
|
||||||
connectionTimeout(5000),
|
connectionTimeout(5000),
|
||||||
responseTimeout(5000)
|
responseTimeout(5000)
|
||||||
@ -126,6 +127,16 @@ SmtpClient::ConnectionType SmtpClient::getConnectionType() const
|
|||||||
return TcpConnection;
|
return TcpConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString& SmtpClient::getName() const
|
||||||
|
{
|
||||||
|
return this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SmtpClient::setName(const QString &name)
|
||||||
|
{
|
||||||
|
this->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
/* [2] --- */
|
/* [2] --- */
|
||||||
|
|
||||||
|
|
||||||
@ -160,7 +171,7 @@ bool SmtpClient::connectToHost()
|
|||||||
|
|
||||||
// Send a EHLO/HELO message to the server
|
// Send a EHLO/HELO message to the server
|
||||||
// The client's first command must be EHLO/HELO
|
// The client's first command must be EHLO/HELO
|
||||||
sendMessage("EHLO SmtpClient for Qt/C++");
|
sendMessage("EHLO " + name);
|
||||||
|
|
||||||
// Wait for the server's response
|
// Wait for the server's response
|
||||||
waitForResponse();
|
waitForResponse();
|
||||||
|
@ -71,6 +71,9 @@ public:
|
|||||||
int getPort() const;
|
int getPort() const;
|
||||||
void setPort(int port);
|
void setPort(int port);
|
||||||
|
|
||||||
|
const QString& getName() const;
|
||||||
|
void setName(const QString &name);
|
||||||
|
|
||||||
ConnectionType getConnectionType() const;
|
ConnectionType getConnectionType() const;
|
||||||
void setConnectionType(ConnectionType ct);
|
void setConnectionType(ConnectionType ct);
|
||||||
|
|
||||||
@ -97,6 +100,7 @@ public:
|
|||||||
|
|
||||||
void quit();
|
void quit();
|
||||||
|
|
||||||
|
|
||||||
/* [3] --- */
|
/* [3] --- */
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -108,6 +112,7 @@ protected:
|
|||||||
QString host;
|
QString host;
|
||||||
int port;
|
int port;
|
||||||
bool useSsl;
|
bool useSsl;
|
||||||
|
QString name;
|
||||||
|
|
||||||
QString user;
|
QString user;
|
||||||
QString password;
|
QString password;
|
||||||
@ -119,6 +124,7 @@ protected:
|
|||||||
QString responseText;
|
QString responseText;
|
||||||
int responseCode;
|
int responseCode;
|
||||||
|
|
||||||
|
|
||||||
class ResponseTimeoutException {};
|
class ResponseTimeoutException {};
|
||||||
|
|
||||||
/* [4] --- */
|
/* [4] --- */
|
||||||
|
Loading…
Reference in New Issue
Block a user