diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-08 00:30:32 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-08 00:30:32 +0200 |
| commit | f02ccb928fd4ed591d2efe118a571e154f5df68a (patch) | |
| tree | 2fc7c4037423d074c410f4c53714ddc842d33351 /src/gopherclient.hpp | |
| parent | 425f9d41cd337133d5677744eef937a8a2a61212 (diff) | |
| download | kristall-f02ccb928fd4ed591d2efe118a571e154f5df68a.tar.gz | |
Starts to implement gopher protocol and gophermap support. Heavily WIP, but you can already surf on gopherspace!
Diffstat (limited to 'src/gopherclient.hpp')
| -rw-r--r-- | src/gopherclient.hpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/gopherclient.hpp b/src/gopherclient.hpp new file mode 100644 index 0000000..2bf98fc --- /dev/null +++ b/src/gopherclient.hpp @@ -0,0 +1,40 @@ +#ifndef GOPHERCLIENT_HPP +#define GOPHERCLIENT_HPP + +#include <QObject> +#include <QTcpSocket> +#include <QUrl> + +class GopherClient : public QObject +{ + Q_OBJECT +public: + explicit GopherClient(QObject *parent = nullptr); + + ~GopherClient() override; + + bool startRequest(QUrl const & url); + + bool isInProgress() const; + + bool cancelRequest(); + +signals: + void requestComplete(QByteArray const & data, QString const & mime); + + void requestFailed(QString const & message); + +private slots: + void on_connected(); + void on_readRead(); + void on_finished(); + +private: + QTcpSocket socket; + QByteArray body; + QUrl requested_url; + bool was_cancelled; + QString mime; +}; + +#endif // GOPHERCLIENT_HPP |
