## CamelIMAPXJob

CamelIMAPXJob

## Synopsis

    #define             CAMEL_IS_IMAPX_JOB                  (job)
    struct              CamelIMAPXJob;
    CamelIMAPXJob *     camel_imapx_job_new                 (GCancellable *cancellable);
    CamelIMAPXJob *     camel_imapx_job_ref                 (CamelIMAPXJob *job);
    void                camel_imapx_job_unref               (CamelIMAPXJob *job);
    gboolean            camel_imapx_job_check               (CamelIMAPXJob *job);
    void                camel_imapx_job_cancel              (CamelIMAPXJob *job);
    gboolean            camel_imapx_job_wait                (CamelIMAPXJob *job,
                                                             GError **error);
    void                camel_imapx_job_done                (CamelIMAPXJob *job);
    gboolean            camel_imapx_job_run                 (CamelIMAPXJob *job,
                                                             CamelIMAPXServer *is,
                                                             GError **error);
    gboolean            camel_imapx_job_matches             (CamelIMAPXJob *job,
                                                             CamelIMAPXMailbox *mailbox,
                                                             const gchar *uid);
    gpointer            camel_imapx_job_get_data            (CamelIMAPXJob *job);
    void                camel_imapx_job_set_data            (CamelIMAPXJob *job,
                                                             gpointer data,
                                                             GDestroyNotify destroy_data);
    gboolean            camel_imapx_job_has_mailbox         (CamelIMAPXJob *job,
                                                             CamelIMAPXMailbox *mailbox);
    CamelIMAPXMailbox * camel_imapx_job_ref_mailbox         (CamelIMAPXJob *job);
    void                camel_imapx_job_set_mailbox         (CamelIMAPXJob *job,
                                                             CamelIMAPXMailbox *mailbox);
    GCancellable *      camel_imapx_job_get_cancellable     (CamelIMAPXJob *job);
    void                camel_imapx_job_take_error          (CamelIMAPXJob *job,
                                                             GError *error);

## Description

## Details

### CAMEL_IS_IMAPX_JOB()

    #define             CAMEL_IS_IMAPX_JOB(job)

### struct CamelIMAPXJob

    struct CamelIMAPXJob {
    	/* Whether to pop a status message off the
    	 * GCancellable when the job is finalized. */
    	gboolean pop_operation_msg;

    	gboolean (*start)		(CamelIMAPXJob *job,
    						 CamelIMAPXServer *is,
    						 GCancellable *cancellable,
    						 GError **error);
    	gboolean (*matches)		(CamelIMAPXJob *job,
    						 CamelIMAPXMailbox *mailbox,
    						 const gchar *uid);

    	guint noreply:1; /* dont wait for reply */
    	guint32 type;		/* operation type */
    	gint pri;		/* the command priority */
    	volatile gint commands; /* counts how many commands are outstanding */
    };

### camel_imapx_job_new ()

    CamelIMAPXJob *     camel_imapx_job_new                 (GCancellable *cancellable);

### camel_imapx_job_ref ()

    CamelIMAPXJob *     camel_imapx_job_ref                 (CamelIMAPXJob *job);

### camel_imapx_job_unref ()

    void                camel_imapx_job_unref               (CamelIMAPXJob *job);

### camel_imapx_job_check ()

    gboolean            camel_imapx_job_check               (CamelIMAPXJob *job);

### camel_imapx_job_cancel ()

    void                camel_imapx_job_cancel              (CamelIMAPXJob *job);

### camel_imapx_job_wait ()

    gboolean            camel_imapx_job_wait                (CamelIMAPXJob *job,
                                                             GError **error);

Blocks until `job` completes by way of `camel_imapx_job_done()`. If `job` completed successfully, the function returns `TRUE`. If `job` was given a GError by way of `camel_imapx_job_take_error()`, or its GCancellable was cancelled, the function sets `error` and returns `FALSE`.

`job` : | a CamelIMAPXJob
`error` : | return location for a GError, or `NULL`
Returns : | whether `job` completed successfully

Since 3.10

### camel_imapx_job_done ()

    void                camel_imapx_job_done                (CamelIMAPXJob *job);

### camel_imapx_job_run ()

    gboolean            camel_imapx_job_run                 (CamelIMAPXJob *job,
                                                             CamelIMAPXServer *is,
                                                             GError **error);

### camel_imapx_job_matches ()

    gboolean            camel_imapx_job_matches             (CamelIMAPXJob *job,
                                                             CamelIMAPXMailbox *mailbox,
                                                             const gchar *uid);

### camel_imapx_job_get_data ()

    gpointer            camel_imapx_job_get_data            (CamelIMAPXJob *job);

### camel_imapx_job_set_data ()

    void                camel_imapx_job_set_data            (CamelIMAPXJob *job,
                                                             gpointer data,
                                                             GDestroyNotify destroy_data);

### camel_imapx_job_has_mailbox ()

    gboolean            camel_imapx_job_has_mailbox         (CamelIMAPXJob *job,
                                                             CamelIMAPXMailbox *mailbox);

### camel_imapx_job_ref_mailbox ()

    CamelIMAPXMailbox * camel_imapx_job_ref_mailbox         (CamelIMAPXJob *job);

### camel_imapx_job_set_mailbox ()

    void                camel_imapx_job_set_mailbox         (CamelIMAPXJob *job,
                                                             CamelIMAPXMailbox *mailbox);

### camel_imapx_job_get_cancellable ()

    GCancellable *      camel_imapx_job_get_cancellable     (CamelIMAPXJob *job);

### camel_imapx_job_take_error ()

    void                camel_imapx_job_take_error          (CamelIMAPXJob *job,
                                                             GError *error);

Takes over the caller's ownership of `error`, so the caller does not need to free it any more. Call this when a CamelIMAPXCommand fails and the `job` is to be aborted.

The `error` will be returned to callers of `camel_imapx_job_wait()` or `camel_imapx_job_run()`.

`job` : | a CamelIMAPXJob
`error` : | a GError

Since 3.10