kioslaves
sieve.hGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __sieve_h__
00017 #define __sieve_h__
00018
00019 #include <kio/tcpslavebase.h>
00020 #include <kio/authinfo.h>
00021
00022 #include <qstring.h>
00023 #include <qcstring.h>
00024 #include <qstringlist.h>
00025
00026 class KDESasl;
00027 class KURL;
00028
00029
00030 class kio_sieveResponse
00031 {
00032 public:
00033 enum responses { NONE, KEY_VAL_PAIR, ACTION, QUANTITY };
00034
00035 kio_sieveResponse();
00036
00037 const uint& getType() const;
00038
00039 const QCString& getAction() const;
00040 const uint getQuantity() const;
00041 const QCString& getKey() const;
00042 const QCString& getVal() const;
00043 const QCString& getExtra() const;
00044
00045 void setQuantity(const uint& quantity);
00046 void setAction(const QCString& newAction);
00047 void setKey(const QCString& newKey);
00048 void setVal(const QCString& newVal);
00049 void setExtra(const QCString& newExtra);
00050
00051 void clear();
00052
00053 protected:
00054 uint rType;
00055 uint quantity;
00056 QCString key;
00057 QCString val;
00058 QCString extra;
00059 };
00060
00061 class kio_sieveProtocol : public KIO::TCPSlaveBase
00062 {
00063
00064 public:
00065 enum connectionModes { NORMAL, CONNECTION_ORIENTED };
00066 enum Results { OK, NO, BYE, OTHER };
00067
00068 kio_sieveProtocol(const QCString &pool_socket, const QCString &app_socket);
00069 virtual ~kio_sieveProtocol();
00070
00071 virtual void mimetype(const KURL& url);
00072 virtual void get(const KURL& url);
00073 virtual void put(const KURL& url, int permissions, bool overwrite, bool resume);
00074 virtual void del(const KURL &url, bool isfile);
00075
00076 virtual void listDir(const KURL& url);
00077 virtual void chmod(const KURL& url, int permissions);
00078 virtual void stat(const KURL& url);
00079
00080 virtual void setHost(const QString &host, int port, const QString &user, const QString &pass);
00081 virtual void openConnection();
00082 virtual void closeConnection();
00083
00084
00091 virtual void special(const QByteArray &data);
00092 bool activate(const KURL& url);
00093 bool deactivate();
00094
00095 protected:
00096 bool connect(bool useTLSIfAvailable = true);
00097 bool authenticate();
00098 void disconnect(bool forcibly = false);
00099 void changeCheck( const KURL &url );
00100
00101 bool sendData(const QCString &data);
00102 bool receiveData(bool waitForData = true, QCString *reparse = 0);
00103 bool operationSuccessful();
00104 int operationResult();
00105
00106 bool parseCapabilities(bool requestCapabilities = false);
00107 bool saslInteract( void *in, KIO::AuthInfo &ai );
00108
00109
00110 uint m_connMode;
00111
00112
00113 QStringList m_sasl_caps;
00114 bool m_supportsTLS;
00115
00116
00117 kio_sieveResponse r;
00118
00119
00120 QString m_sServer;
00121 QString m_sUser;
00122 QString m_sPass;
00123 QString m_sAuth;
00124 bool m_shouldBeConnected;
00125
00126 private:
00127 bool requestCapabilitiesAfterStartTLS() const;
00128
00129 QString m_implementation;
00130 };
00131
00132 #endif
|