00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _NNTP_H
00012 #define _NNTP_H
00013
00014 #include <tqstring.h>
00015 #include <kio/global.h>
00016 #include <kio/tcpslavebase.h>
00017
00018 #define MAX_PACKET_LEN 4096
00019
00020
00021
00022
00023
00024
00025
00026 class NNTPProtocol:public KIO::TCPSlaveBase
00027 {
00028
00029 public:
00033 NNTPProtocol ( const TQCString & pool, const TQCString & app, bool isSSL );
00034 virtual ~NNTPProtocol();
00035
00036 virtual void get(const KURL& url );
00037 virtual void put( const KURL& url, int permissions, bool overwrite, bool resume );
00038 virtual void stat(const KURL& url );
00039 virtual void listDir(const KURL& url );
00040 virtual void setHost(const TQString& host, int port,
00041 const TQString& user, const TQString& pass);
00042
00050 virtual void special(const TQByteArray& data);
00051
00052 protected:
00053
00058 int sendCommand( const TQString &cmd );
00059
00064 void nntp_close ();
00065
00070 bool nntp_open();
00071
00075 bool post_article();
00076
00077
00078 private:
00079 TQString mHost, mUser, mPass;
00080 bool postingAllowed, opened;
00081 char readBuffer[MAX_PACKET_LEN];
00082 ssize_t readBufferLen;
00083
00089 void fetchGroups( const TQString &since );
00098 bool fetchGroup ( TQString &group, unsigned long first = 0 );
00105 bool fetchGroupRFC977( unsigned long first );
00116 bool fetchGroupXOVER( unsigned long first, bool ¬Supported );
00118 void fillUDSEntry ( KIO::UDSEntry & entry, const TQString & name, long size,
00119 bool postingAllowed, bool is_article );
00121 void unexpected_response ( int res_code, const TQString & command );
00127 int evalResponse ( char *data, ssize_t &len );
00128 };
00129
00130 #endif