CamelIMAPXCommand

## CamelIMAPXCommand CamelIMAPXCommand |

## Synopsis

    #define             CAMEL_IS_IMAPX_COMMAND              (command)
    enum                CamelIMAPXCommandPartType;
    void                (*CamelIMAPXCommandFunc)            (struct _CamelIMAPXServer *is,
                                                             CamelIMAPXCommand *ic);
    struct              CamelIMAPXCommand;
    struct              CamelIMAPXCommandPart;
    CamelIMAPXCommand * camel_imapx_command_new             (struct _CamelIMAPXServer *is,
                                                             const gchar *name,
                                                             CamelFolder *select,
                                                             const gchar *format,
                                                             ...);
    CamelIMAPXCommand * camel_imapx_command_ref             (CamelIMAPXCommand *ic);
    void                camel_imapx_command_unref           (CamelIMAPXCommand *ic);
    gboolean            camel_imapx_command_check           (CamelIMAPXCommand *ic);
    gint                camel_imapx_command_compare         (CamelIMAPXCommand *ic1,
                                                             CamelIMAPXCommand *ic2);
    struct _CamelIMAPXJob * camel_imapx_command_get_job     (CamelIMAPXCommand *ic);
    void                camel_imapx_command_set_job         (CamelIMAPXCommand *ic,
                                                             struct _CamelIMAPXJob *job);
    void                camel_imapx_command_add             (CamelIMAPXCommand *ic,
                                                             const gchar *format,
                                                             ...);
    void                camel_imapx_command_addv            (CamelIMAPXCommand *ic,
                                                             const gchar *format,
                                                             va_list ap);
    void                camel_imapx_command_add_part        (CamelIMAPXCommand *ic,
                                                             CamelIMAPXCommandPartType type,
                                                             gpointer data);
    void                camel_imapx_command_close           (CamelIMAPXCommand *ic);
    void                camel_imapx_command_wait            (CamelIMAPXCommand *ic);
    void                camel_imapx_command_done            (CamelIMAPXCommand *ic);
    void                camel_imapx_command_failed          (CamelIMAPXCommand *ic,
                                                             const GError *error);
    gboolean            camel_imapx_command_set_error_if_failed
                                                            (CamelIMAPXCommand *ic,
                                                             GError **error);
                        CamelIMAPXCommandQueue;
    CamelIMAPXCommandQueue * camel_imapx_command_queue_new  (void);
    void                camel_imapx_command_queue_free      (CamelIMAPXCommandQueue *queue);
    void                camel_imapx_command_queue_transfer  (CamelIMAPXCommandQueue *from,
                                                             CamelIMAPXCommandQueue *to);
    void                camel_imapx_command_queue_push_tail (CamelIMAPXCommandQueue *queue,
                                                             CamelIMAPXCommand *ic);
    void                camel_imapx_command_queue_insert_sorted
                                                            (CamelIMAPXCommandQueue *queue,
                                                             CamelIMAPXCommand *ic);
    gboolean            camel_imapx_command_queue_is_empty  (CamelIMAPXCommandQueue *queue);
    guint               camel_imapx_command_queue_get_length
                                                            (CamelIMAPXCommandQueue *queue);
    CamelIMAPXCommand * camel_imapx_command_queue_peek_head (CamelIMAPXCommandQueue *queue);
    GList *             camel_imapx_command_queue_peek_head_link
                                                            (CamelIMAPXCommandQueue *queue);
    gboolean            camel_imapx_command_queue_remove    (CamelIMAPXCommandQueue *queue,
                                                             CamelIMAPXCommand *ic);
    void                camel_imapx_command_queue_delete_link
                                                            (CamelIMAPXCommandQueue *queue,
                                                             GList *link);
    CamelIMAPXCommand * camel_imapx_command_queue_ref_by_tag
                                                            (CamelIMAPXCommandQueue *queue,
                                                             guint32 tag);

## Description

## Details

### CAMEL_IS_IMAPX_COMMAND()

    #define             CAMEL_IS_IMAPX_COMMAND(command)

### enum CamelIMAPXCommandPartType

    typedef enum {
    	CAMEL_IMAPX_COMMAND_SIMPLE = 0,
    	CAMEL_IMAPX_COMMAND_DATAWRAPPER,
    	CAMEL_IMAPX_COMMAND_STREAM,
    	CAMEL_IMAPX_COMMAND_AUTH,
    	CAMEL_IMAPX_COMMAND_FILE,
    	CAMEL_IMAPX_COMMAND_STRING,
    	CAMEL_IMAPX_COMMAND_MASK = 0xff,

    	/* Continuation with LITERAL+ */
    	CAMEL_IMAPX_COMMAND_LITERAL_PLUS = 1 << 14,

    	/* Does this command expect continuation? */
    	CAMEL_IMAPX_COMMAND_CONTINUATION = 1 << 15
    } CamelIMAPXCommandPartType;

`CAMEL_IMAPX_COMMAND_SIMPLE` |
`CAMEL_IMAPX_COMMAND_DATAWRAPPER` |
`CAMEL_IMAPX_COMMAND_STREAM` |
`CAMEL_IMAPX_COMMAND_AUTH` |
`CAMEL_IMAPX_COMMAND_FILE` |
`CAMEL_IMAPX_COMMAND_STRING` |
`CAMEL_IMAPX_COMMAND_MASK` |
`CAMEL_IMAPX_COMMAND_LITERAL_PLUS` |
`CAMEL_IMAPX_COMMAND_CONTINUATION` |

### CamelIMAPXCommandFunc ()

    void                (*CamelIMAPXCommandFunc)            (struct _CamelIMAPXServer *is,
                                                             CamelIMAPXCommand *ic);

### struct CamelIMAPXCommand

    struct CamelIMAPXCommand {
    	struct _CamelIMAPXServer *is;
    	gint pri;

    	/* Command name/type (e.g. FETCH) */
    	const gchar *name;

    	/* Folder to select */
    	CamelFolder *select;

    	/* Status for command, indicates it is complete if != NULL. */
    	struct _status_info *status;

    	guint32 tag;

    	GQueue parts;
    	GList *current_part;

    	/* Responsible for free'ing the command. */
    	CamelIMAPXCommandFunc complete;
    };

### struct CamelIMAPXCommandPart

    struct CamelIMAPXCommandPart {
    	gint data_size;
    	gchar *data;

    	CamelIMAPXCommandPartType type;

    	gint ob_size;
    	gpointer ob;
    };

### camel_imapx_command_new ()

    CamelIMAPXCommand * camel_imapx_command_new             (struct _CamelIMAPXServer *is,
                                                             const gchar *name,
                                                             CamelFolder *select,
                                                             const gchar *format,
                                                             ...);

### camel_imapx_command_ref ()

    CamelIMAPXCommand * camel_imapx_command_ref             (CamelIMAPXCommand *ic);

### camel_imapx_command_unref ()

    void                camel_imapx_command_unref           (CamelIMAPXCommand *ic);

### camel_imapx_command_check ()

    gboolean            camel_imapx_command_check           (CamelIMAPXCommand *ic);

### camel_imapx_command_compare ()

    gint                camel_imapx_command_compare         (CamelIMAPXCommand *ic1,
                                                             CamelIMAPXCommand *ic2);

### camel_imapx_command_get_job ()

    struct _CamelIMAPXJob * camel_imapx_command_get_job     (CamelIMAPXCommand *ic);

### camel_imapx_command_set_job ()

    void                camel_imapx_command_set_job         (CamelIMAPXCommand *ic,
                                                             struct _CamelIMAPXJob *job);

### camel_imapx_command_add ()

    void                camel_imapx_command_add             (CamelIMAPXCommand *ic,
                                                             const gchar *format,
                                                             ...);

### camel_imapx_command_addv ()

    void                camel_imapx_command_addv            (CamelIMAPXCommand *ic,
                                                             const gchar *format,
                                                             va_list ap);

### camel_imapx_command_add_part ()

    void                camel_imapx_command_add_part        (CamelIMAPXCommand *ic,
                                                             CamelIMAPXCommandPartType type,
                                                             gpointer data);

### camel_imapx_command_close ()

    void                camel_imapx_command_close           (CamelIMAPXCommand *ic);

### camel_imapx_command_wait ()

    void                camel_imapx_command_wait            (CamelIMAPXCommand *ic);

### camel_imapx_command_done ()

    void                camel_imapx_command_done            (CamelIMAPXCommand *ic);

### camel_imapx_command_failed ()

    void                camel_imapx_command_failed          (CamelIMAPXCommand *ic,
                                                             const GError *error);

Copies `error` to be returned in `camel_imapx_command_set_error_if_failed()`. Call this function if a networking or parsing error occurred to force all active IMAP commands to abort processing.

`ic` : | a CamelIMAPXCommand
`error` : | the error which caused the failure

Since 3.10

### camel_imapx_command_set_error_if_failed ()

    gboolean            camel_imapx_command_set_error_if_failed
                                                            (CamelIMAPXCommand *ic,
                                                             GError **error);

### CamelIMAPXCommandQueue

    typedef struct _CamelIMAPXCommandQueue CamelIMAPXCommandQueue;

### camel_imapx_command_queue_new ()

    CamelIMAPXCommandQueue * camel_imapx_command_queue_new  (void);

### camel_imapx_command_queue_free ()

    void                camel_imapx_command_queue_free      (CamelIMAPXCommandQueue *queue);

### camel_imapx_command_queue_transfer ()

    void                camel_imapx_command_queue_transfer  (CamelIMAPXCommandQueue *from,
                                                             CamelIMAPXCommandQueue *to);

### camel_imapx_command_queue_push_tail ()

    void                camel_imapx_command_queue_push_tail (CamelIMAPXCommandQueue *queue,
                                                             CamelIMAPXCommand *ic);

### camel_imapx_command_queue_insert_sorted ()

    void                camel_imapx_command_queue_insert_sorted
                                                            (CamelIMAPXCommandQueue *queue,
                                                             CamelIMAPXCommand *ic);

### camel_imapx_command_queue_is_empty ()

    gboolean            camel_imapx_command_queue_is_empty  (CamelIMAPXCommandQueue *queue);

### camel_imapx_command_queue_get_length ()

    guint               camel_imapx_command_queue_get_length
                                                            (CamelIMAPXCommandQueue *queue);

### camel_imapx_command_queue_peek_head ()

    CamelIMAPXCommand * camel_imapx_command_queue_peek_head (CamelIMAPXCommandQueue *queue);

### camel_imapx_command_queue_peek_head_link ()

    GList *             camel_imapx_command_queue_peek_head_link
                                                            (CamelIMAPXCommandQueue *queue);

### camel_imapx_command_queue_remove ()

    gboolean            camel_imapx_command_queue_remove    (CamelIMAPXCommandQueue *queue,
                                                             CamelIMAPXCommand *ic);

### camel_imapx_command_queue_delete_link ()

    void                camel_imapx_command_queue_delete_link
                                                            (CamelIMAPXCommandQueue *queue,
                                                             GList *link);

### camel_imapx_command_queue_ref_by_tag ()

    CamelIMAPXCommand * camel_imapx_command_queue_ref_by_tag
                                                            (CamelIMAPXCommandQueue *queue,
                                                             guint32 tag);

`queue` : | a CamelIMAPXCommandQueue
`tag` : | a CamelIMAPXCommand tag
Returns : | the CamelIMAPXCommand in `queue` with a matching `tag`, or `NULL` if no match is found. The returned CamelIMAPXCommand is referenced for thread-safety and should be unreferenced with `camel_imapx_command_unref()` when finished with it.

Since 3.10