From baa3cb22937537f778463e8dec67c36afbb899eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C5=91k=C3=A9s=20Attila?= Date: Mon, 15 Oct 2012 21:24:39 +0300 Subject: [PATCH] Added some documentation. --- src/smtpclient.cpp | 90 +++++++++++++++++++++++++++++++++++----------- src/smtpclient.h | 4 +-- 2 files changed, 70 insertions(+), 24 deletions(-) diff --git a/src/smtpclient.cpp b/src/smtpclient.cpp index 27858f2..3eb9f79 100644 --- a/src/smtpclient.cpp +++ b/src/smtpclient.cpp @@ -23,8 +23,6 @@ #include #include -#include -using namespace std; /* [1] Constructors and destructors */ @@ -56,100 +54,132 @@ SmtpClient::~SmtpClient() {} /* [2] Getters and Setters */ +/** + * @brief Sets the username to the specified value. + */ void SmtpClient::setUser(const QString &user) { this->user = user; } +/** + * @brief Sets the password to the specified value + */ void SmtpClient::setPassword(const QString &password) { this->password = password; } +/** + * @brief Changes the authentication method to the specified. + */ void SmtpClient::setAuthMethod(AuthMethod method) { this->authMethod = method; } +/** + * @brief Sets the host of connection. + */ void SmtpClient::setHost(QString &host) { this->host = host; } +/** + * @brief Sets the connection port to the specified value. + * @param port + */ void SmtpClient::setPort(int port) { this->port = port; } -void SmtpClient::setConnectionType(ConnectionType ct) -{ - this->connectionType = ct; - - switch (connectionType) - { - case TcpConnection: - socket = new QTcpSocket(this); - break; - case SslConnection: - case TlsConnection: - socket = new QSslSocket(this); - //QSslSocket &s = *((QSslSocket*) socket); - connect(socket, SIGNAL(encrypted()), - this, SLOT(socketEncrypted())); - break; - } -} - +/** + * @brief Returns the host name of the server. + */ const QString& SmtpClient::getHost() const { return this->host; } +/** + * @brief Returns the username used for authenticating. + */ const QString& SmtpClient::getUser() const { return this->user; } +/** + * @brief Returns the password used for authenticating. + */ const QString& SmtpClient::getPassword() const { return this->password; } +/** + * @brief Returns the authentication method used. + */ SmtpClient::AuthMethod SmtpClient::getAuthMethod() const { return this->authMethod; } +/** + * @brief Return the port. + */ int SmtpClient::getPort() const { return this->port; } +/** + * @brief Returns the connection type used. + */ SmtpClient::ConnectionType SmtpClient::getConnectionType() const { return connectionType; } +/** + * @brief Returns the client's name. + */ const QString& SmtpClient::getName() const { return this->name; } +/** + * @brief Sets the client's name. This name is sent by the EHLO command. + */ void SmtpClient::setName(const QString &name) { this->name = name; } +/** + * @brief Returns the last response of the server. + */ const QString & SmtpClient::getResponseText() const { return responseText; } +/** + * @brief Returns the last response code recived by the client. + */ int SmtpClient::getResponseCode() const { return responseCode; } +/** + * @brief Return the socket used by the client. The type of the of the + * connection is QTcpConnection in case of TcpConnection, and QSslSocket + * for SslConnection and TlsConnection. + */ QTcpSocket* SmtpClient::getSocket() { return socket; } @@ -229,6 +259,24 @@ bool SmtpClient::waitForMailSent(int msec) { /* [4] Protected methods */ +void SmtpClient::setConnectionType(ConnectionType ct) +{ + this->connectionType = ct; + + switch (connectionType) + { + case TcpConnection: + socket = new QTcpSocket(this); + break; + case SslConnection: + case TlsConnection: + socket = new QSslSocket(this); + connect(socket, SIGNAL(encrypted()), + this, SLOT(socketEncrypted())); + break; + } +} + void SmtpClient::changeState(ClientState state) { this->state = state; diff --git a/src/smtpclient.h b/src/smtpclient.h index 74bbcae..3555451 100644 --- a/src/smtpclient.h +++ b/src/smtpclient.h @@ -120,7 +120,6 @@ public: void setName(const QString &name); ConnectionType getConnectionType() const; - void setConnectionType(ConnectionType ct); const QString & getUser() const; void setUser(const QString &host); @@ -193,10 +192,9 @@ protected: /* [5] Protected methods */ + void setConnectionType(ConnectionType ct); void changeState(ClientState state); - void processResponse(); - void sendMessage(const QString &text); /* [5] --- */