X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fauthhandler.cpp;h=7172a60070b58a781e5e0bd667f9ce60386f4251;hp=9148e2143db5b8a32435c20d0aa1a5c3893ec553;hb=b06a827aea68b050bf23c37e0162189a94595ee9;hpb=b654b2f908590b6f69a7edadf9dacf1277a4493b diff --git a/src/common/authhandler.cpp b/src/common/authhandler.cpp index 9148e214..7172a600 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-2016 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -18,6 +18,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include + #include "authhandler.h" AuthHandler::AuthHandler(QObject *parent) @@ -43,6 +45,16 @@ void AuthHandler::setSocket(QTcpSocket *socket) } +bool AuthHandler::isLocal() const +{ + if (socket()) { + if (socket()->peerAddress() == QHostAddress::LocalHost || socket()->peerAddress() == QHostAddress::LocalHostIPv6) + return true; + } + return false; +} + + // Some errors (e.g. connection refused) don't trigger a disconnected() from the socket, so send this explicitly // (but make sure it's only sent once!) void AuthHandler::onSocketError(QAbstractSocket::SocketError error)