CamelIMAP4Engine
3
CAMEL Library

# CamelIMAP4Engine

## Synopsis

                        CamelIMAP4Engine;
    enum                camel_imap4_engine_t;
    enum                camel_imap4_level_t;
    enum                camel_imap4_resp_code_t;
                        CamelIMAP4RespCode;
                        CamelIMAP4Namespace;
                        CamelIMAP4NamespaceList;
    gboolean            (*CamelIMAP4ReconnectFunc)          (CamelIMAP4Engine *engine,
                                                             CamelException *ex);
    CamelIMAP4Engine*   camel_imap4_engine_new              (CamelService *service,
                                                             CamelIMAP4ReconnectFunc reconnect);
    int                 camel_imap4_engine_take_stream      (CamelIMAP4Engine *engine,
                                                             CamelStream *stream,
                                                             CamelException *ex);
    int                 camel_imap4_engine_capability       (CamelIMAP4Engine *engine,
                                                             CamelException *ex);
    int                 camel_imap4_engine_namespace        (CamelIMAP4Engine *engine,
                                                             CamelException *ex);
    int                 camel_imap4_engine_select_folder    (CamelIMAP4Engine *engine,
                                                             CamelFolder *folder,
                                                             CamelException *ex);

## Description

## Details

### CamelIMAP4Engine

    typedef struct {
    	CamelObject parent_object;

    	CamelIMAP4ReconnectFunc reconnect;
    	gboolean reconnecting;

    	CamelSession *session;
    	CamelService *service;
    	CamelURL *url;

    	camel_imap4_engine_t state;
    	camel_imap4_level_t level;
    	guint32 capa;

    	guint32 maxlen:31;
    	guint32 maxlentype:1;

    	CamelIMAP4NamespaceList namespaces;
    	GHashTable *authtypes;                    /* supported authtypes */

    	struct _CamelIMAP4Stream *istream;
    	CamelStream *ostream;

    	unsigned char tagprefix;             /* 'A'..'Z' */
    	unsigned int tag;                    /* next command tag */
    	int nextid;

    	struct _CamelIMAP4Folder *folder;    /* currently selected folder */

    	EDList queue;                          /* queue of waiting commands */
    	struct _CamelIMAP4Command *current;
    } CamelIMAP4Engine;

### enum camel_imap4_engine_t

    typedef enum {
    	CAMEL_IMAP4_ENGINE_DISCONNECTED,
    	CAMEL_IMAP4_ENGINE_CONNECTED,
    	CAMEL_IMAP4_ENGINE_PREAUTH,
    	CAMEL_IMAP4_ENGINE_AUTHENTICATED,
    	CAMEL_IMAP4_ENGINE_SELECTED,
    } camel_imap4_engine_t;

### enum camel_imap4_level_t

    typedef enum {
    	CAMEL_IMAP4_LEVEL_UNKNOWN,
    	CAMEL_IMAP4_LEVEL_IMAP4,
    	CAMEL_IMAP4_LEVEL_IMAP4REV1
    } camel_imap4_level_t;

### enum camel_imap4_resp_code_t

    typedef enum {
    	CAMEL_IMAP4_RESP_CODE_ALERT,
    	CAMEL_IMAP4_RESP_CODE_BADCHARSET,
    	CAMEL_IMAP4_RESP_CODE_CAPABILITY,
    	CAMEL_IMAP4_RESP_CODE_PARSE,
    	CAMEL_IMAP4_RESP_CODE_PERM_FLAGS,
    	CAMEL_IMAP4_RESP_CODE_READONLY,
    	CAMEL_IMAP4_RESP_CODE_READWRITE,
    	CAMEL_IMAP4_RESP_CODE_TRYCREATE,
    	CAMEL_IMAP4_RESP_CODE_UIDNEXT,
    	CAMEL_IMAP4_RESP_CODE_UIDVALIDITY,
    	CAMEL_IMAP4_RESP_CODE_UNSEEN,
    	CAMEL_IMAP4_RESP_CODE_NEWNAME,
    	CAMEL_IMAP4_RESP_CODE_APPENDUID,
    	CAMEL_IMAP4_RESP_CODE_COPYUID,
    	CAMEL_IMAP4_RESP_CODE_UNKNOWN,
    } camel_imap4_resp_code_t;

### CamelIMAP4RespCode

    typedef struct {
    	camel_imap4_resp_code_t code;
    	union {
    		guint32 flags;
    		char *parse;
    		guint32 uidnext;
    		guint32 uidvalidity;
    		guint32 unseen;
    		char *newname[2];
    		struct {
    			guint32 uidvalidity;
    			guint32 uid;
    		} appenduid;
    		struct {
    			guint32 uidvalidity;
    			char *srcset;
    			char *destset;
    		} copyuid;
    	} v;
    } CamelIMAP4RespCode;

### CamelIMAP4Namespace

    typedef struct {
    	struct _CamelIMAP4Namespace *next;
    	char *path;
    	char sep;
    } CamelIMAP4Namespace;

### CamelIMAP4NamespaceList

    typedef struct {
    	CamelIMAP4Namespace *personal;
    	CamelIMAP4Namespace *other;
    	CamelIMAP4Namespace *shared;
    } CamelIMAP4NamespaceList;

### CamelIMAP4ReconnectFunc ()

    gboolean            (*CamelIMAP4ReconnectFunc)          (CamelIMAP4Engine *engine,
                                                             CamelException *ex);

`engine` :

`ex` :

Returns :

### camel_imap4_engine_new ()

    CamelIMAP4Engine*   camel_imap4_engine_new              (CamelService *service,
                                                             CamelIMAP4ReconnectFunc reconnect);

`service` :

  service

`reconnect` :

  reconnect callback function

Returns :

  a new imap4 engine

### camel_imap4_engine_take_stream ()

    int                 camel_imap4_engine_take_stream      (CamelIMAP4Engine *engine,
                                                             CamelStream *stream,
                                                             CamelException *ex);

Gives ownership of `stream` to `engine` and reads the greeting from the stream.

`engine` :

  imap4 engine

`stream` :

  tcp stream

`ex` :

  exception

Returns :

  0 on success or -1 on fail.

  Note: on error, `stream` will be unref'd.

### camel_imap4_engine_capability ()

    int                 camel_imap4_engine_capability       (CamelIMAP4Engine *engine,
                                                             CamelException *ex);

Forces the IMAP4 engine to query the IMAP4 server for a list of capabilities.

`engine` :

  IMAP4 engine

`ex` :

  exception

Returns :

  0 on success or -1 on fail.

### camel_imap4_engine_namespace ()

    int                 camel_imap4_engine_namespace        (CamelIMAP4Engine *engine,
                                                             CamelException *ex);

Forces the IMAP4 engine to query the IMAP4 server for a list of namespaces.

`engine` :

  IMAP4 engine

`ex` :

  exception

Returns :

  0 on success or -1 on fail.

### camel_imap4_engine_select_folder ()

    int                 camel_imap4_engine_select_folder    (CamelIMAP4Engine *engine,
                                                             CamelFolder *folder,
                                                             CamelException *ex);

Convenience function to select `folder`.

`engine` :

  IMAP4 engine

`folder` :

  folder to select

`ex` :

  exception

Returns :

  0 on success or -1 on fail.