qBittorrent
|
#include <smtp.h>
Public Member Functions | |
Smtp (QObject *parent=nullptr) | |
~Smtp () | |
void | sendMail (const QString &from, const QString &to, const QString &subject, const QString &body) |
Private Types | |
enum | States { Rcpt , EhloSent , HeloSent , EhloDone , EhloGreetReceived , AuthRequestSent , AuthSent , AuthUsernameSent , Authenticated , StartTLSSent , Data , Init , Body , Quit , Close } |
enum | AuthType { AuthPlain , AuthLogin , AuthCramMD5 } |
Private Slots | |
void | readyRead () |
void | error (QAbstractSocket::SocketError socketError) |
Private Member Functions | |
QByteArray | encodeMimeHeader (const QString &key, const QString &value, const QByteArray &prefix={}) |
void | ehlo () |
void | helo () |
void | parseEhloResponse (const QByteArray &code, bool continued, const QString &line) |
void | authenticate () |
void | startTLS () |
void | authCramMD5 (const QByteArray &challenge={}) |
void | authPlain () |
void | authLogin () |
void | logError (const QString &msg) |
QString | getCurrentDateTime () const |
Private Attributes | |
QByteArray | m_message |
QSslSocket * | m_socket |
QString | m_from |
QString | m_rcpt |
QString | m_response |
int | m_state |
QHash< QString, QString > | m_extensions |
QByteArray | m_buffer |
bool | m_useSsl |
AuthType | m_authType |
QString | m_username |
QString | m_password |
|
private |
|
private |
Smtp::Smtp | ( | QObject * | parent = nullptr | ) |
Definition at line 103 of file smtp.cpp.
References error(), anonymous_namespace{smtp.cpp}::hmacMD5(), m_socket, and readyRead().
|
private |
Definition at line 496 of file smtp.cpp.
References AuthCramMD5, AuthRequestSent, AuthSent, anonymous_namespace{smtp.cpp}::hmacMD5(), m_authType, m_password, m_socket, m_state, and m_username.
Referenced by authenticate(), and readyRead().
|
private |
Definition at line 436 of file smtp.cpp.
References authCramMD5(), Authenticated, authLogin(), authPlain(), logError(), m_buffer, m_extensions, m_password, m_state, and m_username.
Referenced by parseEhloResponse(), readyRead(), and startTLS().
|
private |
Definition at line 535 of file smtp.cpp.
References AuthLogin, AuthRequestSent, AuthSent, AuthUsernameSent, m_authType, m_password, m_socket, m_state, and m_username.
Referenced by authenticate(), and readyRead().
|
private |
Definition at line 515 of file smtp.cpp.
References AuthPlain, AuthRequestSent, AuthSent, m_authType, m_password, m_socket, m_state, and m_username.
Referenced by authenticate(), and readyRead().
|
private |
Definition at line 361 of file smtp.cpp.
References anonymous_namespace{smtp.cpp}::determineFQDN(), EhloSent, m_socket, and m_state.
Referenced by readyRead().
|
private |
Definition at line 316 of file smtp.cpp.
References asConst(), anonymous_namespace{smtp.cpp}::canEncodeAsLatin1(), and anonymous_namespace{preferences.cpp}::value().
Referenced by sendMail().
|
privateslot |
Definition at line 591 of file smtp.cpp.
References logError(), and m_socket.
Referenced by nova3.sgmllib3.SGMLParser::goahead(), nova3.sgmllib3.SGMLParser::parse_pi(), nova3.sgmllib3.SGMLParser::parse_starttag(), and Smtp().
|
private |
Definition at line 564 of file smtp.cpp.
Referenced by sendMail().
|
private |
Definition at line 369 of file smtp.cpp.
References anonymous_namespace{smtp.cpp}::determineFQDN(), HeloSent, m_socket, and m_state.
Referenced by parseEhloResponse().
|
private |
Definition at line 558 of file smtp.cpp.
References Logger::addMessage(), Log::CRITICAL, and Logger::instance().
Referenced by authenticate(), error(), parseEhloResponse(), and readyRead().
|
private |
Definition at line 377 of file smtp.cpp.
References authenticate(), Close, EhloDone, EhloGreetReceived, EhloSent, helo(), logError(), m_extensions, m_state, m_useSsl, and startTLS().
Referenced by readyRead().
|
privateslot |
Definition at line 182 of file smtp.cpp.
References authCramMD5(), authenticate(), Authenticated, AuthLogin, authLogin(), AuthPlain, authPlain(), AuthRequestSent, AuthSent, AuthUsernameSent, Body, Close, Data, ehlo(), EhloGreetReceived, EhloSent, HeloSent, Init, logError(), m_authType, m_buffer, m_from, m_message, m_rcpt, m_socket, m_state, parseEhloResponse(), Quit, Rcpt, and StartTLSSent.
Referenced by Smtp().
void Smtp::sendMail | ( | const QString & | from, |
const QString & | to, | ||
const QString & | subject, | ||
const QString & | body | ||
) |
Definition at line 139 of file smtp.cpp.
References anonymous_namespace{smtp.cpp}::DEFAULT_PORT, anonymous_namespace{smtp.cpp}::DEFAULT_PORT_SSL, encodeMimeHeader(), getCurrentDateTime(), Preferences::getMailNotificationSMTP(), Preferences::getMailNotificationSMTPAuth(), Preferences::getMailNotificationSMTPPassword(), Preferences::getMailNotificationSMTPSSL(), Preferences::getMailNotificationSMTPUsername(), Preferences::instance(), m_from, m_message, m_password, m_rcpt, m_socket, m_username, and m_useSsl.
|
private |
Definition at line 484 of file smtp.cpp.
References authenticate(), m_socket, m_state, and StartTLSSent.
Referenced by parseEhloResponse().
|
private |
Definition at line 116 of file smtp.h.
Referenced by authCramMD5(), authLogin(), authPlain(), and readyRead().
|
private |
Definition at line 114 of file smtp.h.
Referenced by authenticate(), and readyRead().
|
private |
Definition at line 113 of file smtp.h.
Referenced by authenticate(), and parseEhloResponse().
|
private |
Definition at line 109 of file smtp.h.
Referenced by readyRead(), and sendMail().
|
private |
Definition at line 103 of file smtp.h.
Referenced by readyRead(), and sendMail().
|
private |
Definition at line 118 of file smtp.h.
Referenced by authCramMD5(), authenticate(), authLogin(), authPlain(), and sendMail().
|
private |
Definition at line 110 of file smtp.h.
Referenced by readyRead(), and sendMail().
|
private |
Definition at line 105 of file smtp.h.
Referenced by authCramMD5(), authLogin(), authPlain(), ehlo(), error(), helo(), readyRead(), sendMail(), Smtp(), and startTLS().
|
private |
Definition at line 112 of file smtp.h.
Referenced by authCramMD5(), authenticate(), authLogin(), authPlain(), ehlo(), helo(), parseEhloResponse(), readyRead(), and startTLS().
|
private |
Definition at line 117 of file smtp.h.
Referenced by authCramMD5(), authenticate(), authLogin(), authPlain(), and sendMail().
|
private |
Definition at line 115 of file smtp.h.
Referenced by parseEhloResponse(), and sendMail().