Fix compilation under OSX with homebrew's qt5.5

This commit is contained in:
Fabio Bas 2015-07-25 19:28:30 +02:00
parent 1ffc9b4561
commit c714932e25
3 changed files with 1 additions and 23 deletions

View file

@ -38,9 +38,7 @@
#include <QStringList> #include <QStringList>
#include <QTcpSocket> #include <QTcpSocket>
#include <QNetworkInterface> #include <QNetworkInterface>
#ifndef QT_NO_OPENSSL #include <QSslSocket>
# include <QSslSocket>
#endif
QxtSmtpPrivate::QxtSmtpPrivate() : QObject(0) QxtSmtpPrivate::QxtSmtpPrivate() : QObject(0)
{ {
@ -52,13 +50,9 @@ QxtSmtp::QxtSmtp(QObject* parent) : QObject(parent)
QXT_INIT_PRIVATE(QxtSmtp); QXT_INIT_PRIVATE(QxtSmtp);
qxt_d().state = QxtSmtpPrivate::Disconnected; qxt_d().state = QxtSmtpPrivate::Disconnected;
qxt_d().nextID = 0; qxt_d().nextID = 0;
#ifndef QT_NO_OPENSSL
qxt_d().socket = new QSslSocket(this); qxt_d().socket = new QSslSocket(this);
QObject::connect(socket(), SIGNAL(encrypted()), this, SIGNAL(encrypted())); QObject::connect(socket(), SIGNAL(encrypted()), this, SIGNAL(encrypted()));
//QObject::connect(socket(), SIGNAL(encrypted()), &qxt_d(), SLOT(ehlo())); //QObject::connect(socket(), SIGNAL(encrypted()), &qxt_d(), SLOT(ehlo()));
#else
qxt_d().socket = new QTcpSocket(this);
#endif
QObject::connect(socket(), SIGNAL(connected()), this, SIGNAL(connected())); QObject::connect(socket(), SIGNAL(connected()), this, SIGNAL(connected()));
QObject::connect(socket(), SIGNAL(disconnected()), this, SIGNAL(disconnected())); QObject::connect(socket(), SIGNAL(disconnected()), this, SIGNAL(disconnected()));
QObject::connect(socket(), SIGNAL(error(QAbstractSocket::SocketError)), &qxt_d(), SLOT(socketError(QAbstractSocket::SocketError))); QObject::connect(socket(), SIGNAL(error(QAbstractSocket::SocketError)), &qxt_d(), SLOT(socketError(QAbstractSocket::SocketError)));
@ -132,7 +126,6 @@ void QxtSmtp::setStartTlsDisabled(bool disable)
qxt_d().disableStartTLS = disable; qxt_d().disableStartTLS = disable;
} }
#ifndef QT_NO_OPENSSL
QSslSocket* QxtSmtp::sslSocket() const QSslSocket* QxtSmtp::sslSocket() const
{ {
return qxt_d().socket; return qxt_d().socket;
@ -149,7 +142,6 @@ void QxtSmtp::connectToSecureHost(const QHostAddress& address, quint16 port)
{ {
connectToSecureHost(address.toString(), port); connectToSecureHost(address.toString(), port);
} }
#endif
bool QxtSmtp::hasExtension(const QString& extension) bool QxtSmtp::hasExtension(const QString& extension)
{ {
@ -202,7 +194,6 @@ void QxtSmtpPrivate::socketRead()
case EhloGreetReceived: case EhloGreetReceived:
parseEhlo(code, (line[3] != ' '), line.mid(4)); parseEhlo(code, (line[3] != ' '), line.mid(4));
break; break;
#ifndef QT_NO_OPENSSL
case StartTLSSent: case StartTLSSent:
if (code == "220") if (code == "220")
{ {
@ -214,7 +205,6 @@ void QxtSmtpPrivate::socketRead()
authenticate(); authenticate();
} }
break; break;
#endif
case AuthRequestSent: case AuthRequestSent:
case AuthUsernameSent: case AuthUsernameSent:
if (authType == AuthPlain) authPlain(); if (authType == AuthPlain) authPlain();
@ -359,12 +349,8 @@ void QxtSmtpPrivate::parseEhlo(const QByteArray& code, bool cont, const QString&
void QxtSmtpPrivate::startTLS() void QxtSmtpPrivate::startTLS()
{ {
#ifndef QT_NO_OPENSSL
socket->write("starttls\r\n"); socket->write("starttls\r\n");
state = StartTLSSent; state = StartTLSSent;
#else
authenticate();
#endif
} }
void QxtSmtpPrivate::authenticate() void QxtSmtpPrivate::authenticate()

View file

@ -33,9 +33,7 @@
#include "qxtmailmessage.h" #include "qxtmailmessage.h"
class QTcpSocket; class QTcpSocket;
#ifndef QT_NO_OPENSSL
class QSslSocket; class QSslSocket;
#endif
class QxtSmtpPrivate; class QxtSmtpPrivate;
class QXT_NETWORK_EXPORT QxtSmtp : public QObject class QXT_NETWORK_EXPORT QxtSmtp : public QObject
@ -77,11 +75,9 @@ public:
bool startTlsDisabled() const; bool startTlsDisabled() const;
void setStartTlsDisabled(bool disable); void setStartTlsDisabled(bool disable);
#ifndef QT_NO_OPENSSL
QSslSocket* sslSocket() const; QSslSocket* sslSocket() const;
void connectToSecureHost(const QString& hostName, quint16 port = 465); void connectToSecureHost(const QString& hostName, quint16 port = 465);
void connectToSecureHost(const QHostAddress& address, quint16 port = 465); void connectToSecureHost(const QHostAddress& address, quint16 port = 465);
#endif
bool hasExtension(const QString& extension); bool hasExtension(const QString& extension);
QString extensionData(const QString& extension); QString extensionData(const QString& extension);

View file

@ -78,11 +78,7 @@ public:
int nextID, rcptNumber, rcptAck; int nextID, rcptNumber, rcptAck;
bool mailAck; bool mailAck;
#ifndef QT_NO_OPENSSL
QSslSocket* socket; QSslSocket* socket;
#else
QTcpSocket* socket;
#endif
void parseEhlo(const QByteArray& code, bool cont, const QString& line); void parseEhlo(const QByteArray& code, bool cont, const QString& line);
void startTLS(); void startTLS();