aboutsummaryrefslogtreecommitdiff
path: root/src/protocols/gopherclient.hpp
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-06-22 21:10:04 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-06-22 21:10:04 +0200
commit75ec461eeaa851cb5c53f4cfffc434e3e529ed1d (patch)
tree3944737340718ca3675381aa06636045d397e780 /src/protocols/gopherclient.hpp
parent8dbfb0890560fd1cd698d06fa05ac868c4db8576 (diff)
downloadkristall-75ec461eeaa851cb5c53f4cfffc434e3e529ed1d.tar.gz
Restructures the project source and cleans up a bit
Diffstat (limited to 'src/protocols/gopherclient.hpp')
-rw-r--r--src/protocols/gopherclient.hpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/protocols/gopherclient.hpp b/src/protocols/gopherclient.hpp
new file mode 100644
index 0000000..888ebd8
--- /dev/null
+++ b/src/protocols/gopherclient.hpp
@@ -0,0 +1,42 @@
+#ifndef GOPHERCLIENT_HPP
+#define GOPHERCLIENT_HPP
+
+#include <QObject>
+#include <QTcpSocket>
+#include <QUrl>
+
+#include "protocolhandler.hpp"
+
+class GopherClient : public ProtocolHandler
+{
+ Q_OBJECT
+public:
+ explicit GopherClient(QObject *parent = nullptr);
+
+ ~GopherClient() override;
+
+ bool supportsScheme(QString const & scheme) const override;
+
+ bool startRequest(QUrl const & url, RequestOptions options) override;
+
+ bool isInProgress() const override;
+
+ bool cancelRequest() override;
+
+private: // slots
+ void on_connected();
+ void on_readRead();
+ void on_finished();
+ void on_socketError(QAbstractSocket::SocketError errorCode);
+
+
+private:
+ QTcpSocket socket;
+ QByteArray body;
+ QUrl requested_url;
+ bool was_cancelled;
+ QString mime;
+ bool is_processing_binary;
+};
+
+#endif // GOPHERCLIENT_HPP