27 #include "imap4-config.h"
28 #include "imapparser.h"
31 #include <kio/tcpslavebase.h>
36 #define IMAP_BUFFER 8192
60 IMAP4Protocol (
const QByteArray & pool,
const QByteArray & app,
bool isSSL);
63 virtual void openConnection();
64 virtual void closeConnection();
66 virtual void setHost (
const QString & _host, quint16 _port,
const QString & _user,
67 const QString & _pass);
75 virtual void get (
const KUrl & _url);
79 virtual void stat (
const KUrl & _url);
80 virtual void slave_status ();
84 virtual void del (
const KUrl & _url,
bool isFile);
89 virtual void special (
const QByteArray & data);
93 virtual void listDir (
const KUrl & _url);
94 virtual void setSubURL (
const KUrl & _url);
95 virtual void dispatch (
int command,
const QByteArray & data);
99 virtual void mkdir (
const KUrl & url,
int permissions);
100 virtual void put (
const KUrl & url,
int permissions, KIO::JobFlags flags);
101 virtual void rename (
const KUrl & src,
const KUrl & dest, KIO::JobFlags flags);
102 virtual void copy (
const KUrl & src,
const KUrl & dest,
int permissions,
103 KIO::JobFlags flags);
108 virtual void parseRelay (
const QByteArray & buffer);
117 virtual bool parseRead (QByteArray &buffer,
long len,
long relay=0);
121 virtual bool parseReadLine (QByteArray & buffer,
long relay = 0);
128 virtual int outputLine (
const QByteArray & _str,
int len = -1);
131 virtual void flushOutput(
const QString &contentEncoding = QString());
136 bool assureBox (
const QString & aBox,
bool readonly);
138 ssize_t myRead(
void *data, ssize_t len);
148 parseURL (
const KUrl & _url, QString & _box, QString & _section,
149 QString & _type, QString & _uid, QString & _validity,
150 QString & _hierarchyDelimiter, QString & _info,
152 QString getMimeType (
enum IMAP_TYPE);
156 void outputLineStr (
const QString & _str)
158 outputLine( _str.toLatin1 (), _str.length() );
160 void doListEntry (
const KUrl & _url,
int stretch, imapCache * cache = NULL,
161 bool withFlags =
false,
bool withSubject =
false);
168 void doListEntry (
const KUrl & url,
const QString & myBox,
169 const imapList & item,
bool appendPath =
true);
176 void specialQuotaCommand(
int command, QDataStream& stream );
188 void doListEntry (
const QString & encodedUrl,
int stretch, imapCache * cache = NULL,
189 bool withFlags =
false,
bool withSubject =
false);
191 QString myHost, myUser, myPass, myAuth, myTLS;
195 bool relayEnabled, cacheOutput, decodeContent;
196 QByteArray outputCache;
197 QBuffer outputBuffer;
198 int outputBufferIndex;
199 KIO::filesize_t mProcessedSize;
201 char readBuffer[IMAP_BUFFER];
202 ssize_t readBufferLen;
204 QDateTime mTimeOfLastNoop;
virtual void listDir(const KUrl &_url)
list a directory/mailbox
virtual void stat(const KUrl &_url)
stat a mailbox, message, attachment
virtual void flushOutput(const QString &contentEncoding=QString())
send out cached data to the application
virtual void del(const KUrl &_url, bool isFile)
delete a mailbox
void specialSearchCommand(QDataStream &)
Search current folder, the search string is passed as SECTION.
virtual bool parseRead(QByteArray &buffer, long len, long relay=0)
reimplement the parser read at least len bytes
virtual int outputLine(const QByteArray &_str, int len=-1)
reimplement the mimeIO
void specialCustomCommand(QDataStream &)
Send a custom command to the server.
virtual void special(const QByteArray &data)
Capabilities, NOOP, (Un)subscribe, Change status, Change ACL.
void specialACLCommand(int command, QDataStream &stream)
Send an ACL command which is identified by command.
virtual void mkdir(const KUrl &url, int permissions)
create a mailbox
void specialAnnotateMoreCommand(int command, QDataStream &stream)
Send an annotation command which is identified by command.
virtual void parseWriteLine(const QString &)
reimplement the parser
virtual bool parseReadLine(QByteArray &buffer, long relay=0)
reimplement the parser
virtual void parseRelay(const QByteArray &buffer)
reimplement the parser relay hook to send the fetched data directly to an upper level ...
enum IMAP_TYPE parseURL(const KUrl &_url, QString &_box, QString &_section, QString &_type, QString &_uid, QString &_validity, QString &_hierarchyDelimiter, QString &_info, bool cache=false)
Parses the given URL The return values are set by parsing the URL and querying the server...