X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fauthhandler.cpp;h=ddc8fcfbe5a38aecfa47b5e4aa60694875ab4fce;hp=9148e2143db5b8a32435c20d0aa1a5c3893ec553;hb=6eefdfc697067d184a589fc8a231b16316c09106;hpb=b654b2f908590b6f69a7edadf9dacf1277a4493b diff --git a/src/common/authhandler.cpp b/src/common/authhandler.cpp index 9148e214..ddc8fcfb 100644 --- a/src/common/authhandler.cpp +++ b/src/common/authhandler.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -18,12 +18,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include + #include "authhandler.h" +#include "util.h" AuthHandler::AuthHandler(QObject *parent) - : QObject(parent), - _socket(0), - _disconnectedSent(false) + : QObject(parent) { } @@ -38,8 +39,18 @@ QTcpSocket *AuthHandler::socket() const void AuthHandler::setSocket(QTcpSocket *socket) { _socket = socket; - connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(onSocketError(QAbstractSocket::SocketError))); - connect(socket, SIGNAL(disconnected()), SLOT(onSocketDisconnected())); + connect(socket, selectOverload(&QTcpSocket::error), this, &AuthHandler::onSocketError); + connect(socket, &QAbstractSocket::disconnected, this, &AuthHandler::onSocketDisconnected); +} + + +bool AuthHandler::isLocal() const +{ + if (socket()) { + if (socket()->peerAddress() == QHostAddress::LocalHost || socket()->peerAddress() == QHostAddress::LocalHostIPv6) + return true; + } + return false; }