You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
134 lines
3.7 KiB
134 lines
3.7 KiB
15 years ago
|
/***************************************************************************
|
||
|
sieve.h - description
|
||
|
-------------------
|
||
|
begin : Thu Dec 20 18:47:08 EST 2001
|
||
|
copyright : (C) 2001 by Hamish Rodda
|
||
|
email : meddie@yoyo.cc.monash.edu.au
|
||
|
***************************************************************************/
|
||
|
|
||
|
/***************************************************************************
|
||
|
* *
|
||
|
* This program is free software; you can redistribute it and/or modify *
|
||
|
* it under the terms of the GNU General Public License version 2 as *
|
||
|
* published by the Free Software Foundation. *
|
||
|
* *
|
||
|
***************************************************************************/
|
||
|
#ifndef __sieve_h__
|
||
|
#define __sieve_h__
|
||
|
|
||
12 years ago
|
#include <tdeio/tcpslavebase.h>
|
||
|
#include <tdeio/authinfo.h>
|
||
15 years ago
|
|
||
15 years ago
|
#include <tqstring.h>
|
||
|
#include <tqcstring.h>
|
||
|
#include <tqstringlist.h>
|
||
15 years ago
|
|
||
|
class KDESasl;
|
||
|
class KURL;
|
||
|
|
||
|
|
||
12 years ago
|
class tdeio_sieveResponse
|
||
15 years ago
|
{
|
||
|
public:
|
||
13 years ago
|
enum responses { NONE, KEY_VAL_PAIR, ACTION, QUANTITY };
|
||
15 years ago
|
|
||
12 years ago
|
tdeio_sieveResponse();
|
||
15 years ago
|
|
||
|
const uint& getType() const;
|
||
|
|
||
15 years ago
|
const TQCString& getAction() const;
|
||
15 years ago
|
const uint getQuantity() const;
|
||
15 years ago
|
const TQCString& getKey() const;
|
||
|
const TQCString& getVal() const;
|
||
|
const TQCString& getExtra() const;
|
||
15 years ago
|
|
||
|
void setQuantity(const uint& quantity);
|
||
15 years ago
|
void setAction(const TQCString& newAction);
|
||
|
void setKey(const TQCString& newKey);
|
||
|
void setVal(const TQCString& newVal);
|
||
|
void setExtra(const TQCString& newExtra);
|
||
15 years ago
|
|
||
|
void clear();
|
||
|
|
||
|
protected:
|
||
|
uint rType;
|
||
|
uint quantity;
|
||
14 years ago
|
TQCString key;
|
||
|
TQCString val;
|
||
|
TQCString extra;
|
||
15 years ago
|
};
|
||
|
|
||
12 years ago
|
class tdeio_sieveProtocol : public TDEIO::TCPSlaveBase
|
||
15 years ago
|
{
|
||
|
|
||
|
public:
|
||
|
enum connectionModes { NORMAL, CONNECTION_ORIENTED };
|
||
|
enum Results { OK, NO, BYE, OTHER };
|
||
|
|
||
12 years ago
|
tdeio_sieveProtocol(const TQCString &pool_socket, const TQCString &app_socket);
|
||
|
virtual ~tdeio_sieveProtocol();
|
||
15 years ago
|
|
||
|
virtual void mimetype(const KURL& url);
|
||
|
virtual void get(const KURL& url);
|
||
|
virtual void put(const KURL& url, int permissions, bool overwrite, bool resume);
|
||
|
virtual void del(const KURL &url, bool isfile);
|
||
|
|
||
|
virtual void listDir(const KURL& url);
|
||
|
virtual void chmod(const KURL& url, int permissions);
|
||
|
virtual void stat(const KURL& url);
|
||
|
|
||
15 years ago
|
virtual void setHost(const TQString &host, int port, const TQString &user, const TQString &pass);
|
||
15 years ago
|
virtual void openConnection();
|
||
|
virtual void closeConnection();
|
||
|
//virtual void slave_status();
|
||
|
|
||
|
/**
|
||
|
* Special commands supported by this slave:
|
||
|
* 1 - activate script
|
||
|
* 2 - deactivate (all - only one active at any one time) scripts
|
||
|
* 3 - request capabilities, returned as metadata
|
||
|
*/
|
||
15 years ago
|
virtual void special(const TQByteArray &data);
|
||
15 years ago
|
bool activate(const KURL& url);
|
||
|
bool deactivate();
|
||
|
|
||
|
protected:
|
||
|
bool connect(bool useTLSIfAvailable = true);
|
||
|
bool authenticate();
|
||
|
void disconnect(bool forcibly = false);
|
||
|
void changeCheck( const KURL &url );
|
||
|
|
||
15 years ago
|
bool sendData(const TQCString &data);
|
||
|
bool receiveData(bool waitForData = true, TQCString *reparse = 0);
|
||
15 years ago
|
bool operationSuccessful();
|
||
|
int operationResult();
|
||
|
|
||
|
bool parseCapabilities(bool requestCapabilities = false);
|
||
12 years ago
|
bool saslInteract( void *in, TDEIO::AuthInfo &ai );
|
||
15 years ago
|
|
||
|
// IOSlave global data
|
||
|
uint m_connMode;
|
||
|
|
||
|
// Host-specific data
|
||
14 years ago
|
TQStringList m_sasl_caps;
|
||
15 years ago
|
bool m_supportsTLS;
|
||
|
|
||
|
// Global server respose class
|
||
12 years ago
|
tdeio_sieveResponse r;
|
||
15 years ago
|
|
||
|
// connection details
|
||
14 years ago
|
TQString m_sServer;
|
||
|
TQString m_sUser;
|
||
|
TQString m_sPass;
|
||
|
TQString m_sAuth;
|
||
15 years ago
|
bool m_shouldBeConnected;
|
||
14 years ago
|
bool m_allowUnencrypted;
|
||
15 years ago
|
|
||
|
private:
|
||
|
bool requestCapabilitiesAfterStartTLS() const;
|
||
|
|
||
15 years ago
|
TQString m_implementation;
|
||
15 years ago
|
};
|
||
|
|
||
|
#endif
|