File indexing completed on 2024-11-03 07:43:44
0001 /* 0002 * SPDX-FileCopyrightText: 2003-2008 Albert Astals Cid <aacid@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef __kio_gopher_h__ 0008 #define __kio_gopher_h__ 0009 0010 #include <KIO/WorkerBase> 0011 #include <kiconloader.h> 0012 0013 #include <QTcpSocket> 0014 0015 class gopher : public KIO::WorkerBase 0016 { 0017 public: 0018 gopher(const QByteArray &pool_socket, const QByteArray &app_socket); 0019 0020 KIO::WorkerResult get(const QUrl &url) override; 0021 0022 private: 0023 void processDirectory(QByteArray *received, const QString &host, const QString &path); 0024 void processDirectoryLine(const QByteArray &data, QByteArray &show, QByteArray &info); 0025 QByteArray parsePort(QByteArray *received); 0026 void findLine(QByteArray *received, int *i, int *remove); 0027 void handleSearch(const QString &host, const QString &path, int port); 0028 void addIcon(const QString &type, const QByteArray &url, QByteArray &show); 0029 KIO::WorkerResult connectToHost(const QString &protocol, const QString &host, quint16 port); 0030 int connectToHost(const QString &host, quint16 port, QString *errorString = nullptr); 0031 void disconnectFromHost(); 0032 ssize_t socketWrite(const char *data, ssize_t len); 0033 ssize_t socketRead(char *data, ssize_t len); 0034 0035 QTcpSocket socket; 0036 KIconLoader m_iconLoader; 0037 }; 0038 0039 #endif