aboutsummaryrefslogtreecommitdiff
path: root/src/protocols/gopherclient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocols/gopherclient.cpp')
-rw-r--r--src/protocols/gopherclient.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/protocols/gopherclient.cpp b/src/protocols/gopherclient.cpp
index ec0fa70..af2b141 100644
--- a/src/protocols/gopherclient.cpp
+++ b/src/protocols/gopherclient.cpp
@@ -1,5 +1,6 @@
#include "gopherclient.hpp"
#include "ioutil.hpp"
+#include "kristall.hpp"
GopherClient::GopherClient(QObject *parent) : ProtocolHandler(parent)
{
@@ -12,6 +13,11 @@ GopherClient::GopherClient(QObject *parent) : ProtocolHandler(parent)
#else
connect(&socket, QOverload<QAbstractSocket::SocketError>::of(&QTcpSocket::error), this, &GopherClient::on_socketError);
#endif
+
+ connect(&socket, &QAbstractSocket::hostFound, this, [this]() {
+ emit this->requestStateChange(RequestState::HostFound);
+ });
+ emit this->requestStateChange(RequestState::None);
}
GopherClient::~GopherClient()
@@ -34,6 +40,8 @@ bool GopherClient::startRequest(const QUrl &url, RequestOptions options)
if(url.scheme() != "gopher")
return false;
+ emit this->requestStateChange(RequestState::Started);
+
// Second char on the URL path denotes the Gopher type
// See https://tools.ietf.org/html/rfc4266
QString type = url.path().mid(1, 1);
@@ -79,6 +87,8 @@ void GopherClient::on_connected()
auto blob = (requested_url.path().mid(2) + "\r\n").toUtf8();
IoUtil::writeAll(socket, blob);
+
+ emit this->requestStateChange(RequestState::Connected);
}
void GopherClient::on_readRead()
@@ -107,6 +117,8 @@ void GopherClient::on_finished()
was_cancelled = true;
}
body.clear();
+
+ emit this->requestStateChange(RequestState::None);
}
void GopherClient::on_socketError(QAbstractSocket::SocketError error_code)