kioslave/nntp
nntp.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _NNTP_H
00012 #define _NNTP_H
00013
00014
00015 #include <kio/global.h>
00016 #include <kio/tcpslavebase.h>
00017
00018 #define MAX_PACKET_LEN 8192
00019
00020
00021
00022
00023
00024
00034 class NNTPProtocol:public KIO::TCPSlaveBase
00035 {
00036
00037 public:
00041 NNTPProtocol ( const QByteArray & pool, const QByteArray & app, bool isSSL );
00042 virtual ~NNTPProtocol();
00043
00044 virtual void get(const KUrl& url );
00045 virtual void put( const KUrl& url, int permissions, KIO::JobFlags flags );
00046 virtual void stat(const KUrl& url );
00047 virtual void listDir(const KUrl& url );
00048 virtual void setHost(const QString& host, quint16 port,
00049 const QString& user, const QString& pass);
00050
00058 virtual void special(const QByteArray& data);
00059
00060 protected:
00061
00066 int sendCommand( const QString &cmd );
00067
00072 void nntp_close ();
00073
00078 bool nntp_open();
00079
00083 bool post_article();
00084
00085
00086 private:
00087 QString mHost, mUser, mPass;
00088 quint16 m_port, m_defaultPort;
00089 bool postingAllowed, isAuthenticated;
00090 char readBuffer[MAX_PACKET_LEN];
00091 ssize_t readBufferLen;
00093 QString mCurrentGroup;
00094
00101 void fetchGroups( const QString &since, bool desc );
00111 bool fetchGroup ( QString &group, unsigned long first = 0, unsigned long max = 0 );
00118 bool fetchGroupRFC977( unsigned long first );
00129 bool fetchGroupXOVER( unsigned long first, bool ¬Supported );
00131 void fillUDSEntry ( KIO::UDSEntry & entry, const QString & name, long size,
00132 bool is_article, long access = 0 );
00134 void unexpected_response ( int res_code, const QString & command );
00140 int evalResponse ( char *data, ssize_t &len );
00146 int authenticate();
00147 };
00148
00149 #endif