#define STARTTLS_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_TLS)
static void imapx_select (CamelIMAPXServer *is,
+ CamelIMAPXJob *job,
CamelFolder *folder);
G_DEFINE_TYPE (CamelIMAPXServer, camel_imapx_server, CAMEL_TYPE_OBJECT)
/* Hand the error off to the command that we failed to start. */
camel_imapx_command_failed (ic, local_error);
- /* Send a NULL GError since we've already set a
- * GError to get here, and we're not interested
- * in individual command errors. */
if (ic->complete != NULL)
- ic->complete (is, ic, NULL);
+ ic->complete (is, ic);
g_error_free (local_error);
/* If we need to select a folder for the first command, do it now,
* once it is complete it will re-call us if it succeeded. */
if (first_ic->select) {
+ CamelIMAPXJob *job;
+
c (
is->tagprefix, "Selecting folder '%s' for command '%s'(%p)\n",
camel_folder_get_full_name (first_ic->select),
first_ic->name, first_ic);
- imapx_select (is, first_ic->select);
+
+ /* Associate the SELECT command with the CamelIMAPXJob
+ * that triggered it. Then if the SELECT command fails
+ * we have some destination to propagate the GError to. */
+ job = camel_imapx_command_get_job (first_ic);
+ imapx_select (is, job, first_ic->select);
+
} else {
GQueue start = G_QUEUE_INIT;
GList *head, *link;
QUEUE_UNLOCK (is);
- /* Send a NULL GError since we've already set the
- * GError, and we're not interested in individual
- * command errors at this point. */
if (ic->complete != NULL)
- ic->complete (is, ic, NULL);
+ ic->complete (is, ic);
return;
}
goto exit;
if (ic->complete != NULL)
- if (!ic->complete (is, ic, error))
- goto exit;
+ ic->complete (is, ic);
QUEUE_LOCK (is);
imapx_command_start_next (is);
return success;
}
-static gboolean
+static void
imapx_command_complete (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
camel_imapx_command_done (ic);
camel_imapx_command_unref (ic);
-
- return TRUE;
}
static void
return success;
}
-static gboolean
+static void
imapx_command_idle_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXIdle *idle = is->idle;
CamelIMAPXJob *job;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error performing IDLE"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
}
IDLE_LOCK (idle);
IDLE_UNLOCK (idle);
imapx_unregister_job (is, job);
-
- return success;
}
static gboolean
// end IDLE
/* ********************************************************************** */
-static gboolean
+static void
imapx_command_select_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
- gboolean success = TRUE;
+ CamelIMAPXJob *job;
GError *local_error = NULL;
+ job = camel_imapx_command_get_job (ic);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
+
if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
GQueue failed = G_QUEUE_INIT;
GQueue trash = G_QUEUE_INIT;
while (!g_queue_is_empty (&failed)) {
CamelIMAPXCommand *cw;
- CamelIMAPXJob *job;
+ CamelIMAPXJob *failed_job;
cw = g_queue_pop_head (&failed);
- job = camel_imapx_command_get_job (cw);
+ failed_job = camel_imapx_command_get_job (cw);
- if (!CAMEL_IS_IMAPX_JOB (job)) {
+ if (!CAMEL_IS_IMAPX_JOB (failed_job)) {
g_warn_if_reached ();
continue;
}
- camel_imapx_job_cancel (job);
+ camel_imapx_job_cancel (failed_job);
if (ic->status)
cw->status = imapx_copy_status (ic->status);
- cw->complete (is, cw, NULL);
+ cw->complete (is, cw);
}
- g_propagate_error (error, local_error);
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
+ imapx_unregister_job (is, job);
} else {
CamelFolder *folder;
/* We should have a strong reference
* on the newly-selected CamelFolder. */
- g_return_val_if_fail (folder != NULL, FALSE);
+ g_return_if_fail (folder != NULL);
ifolder = CAMEL_IMAPX_FOLDER (folder);
ifolder->exists_on_server = is->exists;
g_object_unref (folder);
}
-
- return success;
}
/* Should have a queue lock. TODO Change the way select is written */
static void
imapx_select (CamelIMAPXServer *is,
+ CamelIMAPXJob *job,
CamelFolder *folder)
{
CamelIMAPXCommand *ic;
camel_imapx_command_add_qresync_parameter (ic, folder);
ic->complete = imapx_command_select_done;
+ camel_imapx_command_set_job (ic, job);
+
imapx_command_start (is, ic);
camel_imapx_command_unref (ic);
/* ********************************************************************** */
-static gboolean
+static void
imapx_command_fetch_message_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
CamelFolder *folder;
GetMessageData *data;
CamelIMAPXFolder *ifolder;
GCancellable *cancellable;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
/* This is only for pushing status messages. */
cancellable = camel_imapx_job_get_cancellable (job);
data = camel_imapx_job_get_data (job);
- g_return_val_if_fail (data != NULL, FALSE);
+ g_return_if_fail (data != NULL);
folder = camel_imapx_job_ref_folder (job);
- g_return_val_if_fail (folder != NULL, FALSE);
+ g_return_if_fail (folder != NULL);
/* We either have more to fetch (partial mode?), we are complete,
* or we failed. Failure is handled in the fetch code, so
job->commands--;
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error fetching message"));
+ camel_imapx_job_take_error (job, local_error);
data->body_len = -1;
- success = FALSE;
} else if (data->use_multi_fetch) {
gsize really_fetched = g_seekable_tell (G_SEEKABLE (data->stream));
ifolder = CAMEL_IMAPX_FOLDER (folder);
- if (success) {
- success = camel_stream_flush (
- data->stream, cancellable, error) == 0;
+ if (local_error == NULL) {
+ camel_stream_flush (data->stream, cancellable, &local_error);
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Failed to close the tmp stream"));
}
- if (success) {
- success = camel_stream_close (
- data->stream, cancellable, error) == 0;
+ if (local_error == NULL) {
+ camel_stream_close (data->stream, cancellable, &local_error);
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Failed to close the tmp stream"));
}
- if (success) {
+ if (local_error == NULL) {
gchar *cur_filename;
gchar *tmp_filename;
gchar *dirname;
/* Exchange the "tmp" stream for the "cur" stream. */
g_clear_object (&data->stream);
data->stream = camel_data_cache_get (
- ifolder->cache, "cur", data->uid, error);
- success = (data->stream != NULL);
+ ifolder->cache, "cur",
+ data->uid, &local_error);
} else {
g_set_error (
- error, G_FILE_ERROR,
+ &local_error, G_FILE_ERROR,
g_file_error_from_errno (errno),
"%s: %s",
_("Failed to copy the tmp file"),
g_strerror (errno));
- success = FALSE;
}
g_free (cur_filename);
g_free (tmp_filename);
}
+ if (local_error != NULL)
+ camel_imapx_job_take_error (job, local_error);
+
camel_data_cache_remove (ifolder->cache, "tmp", data->uid, NULL);
imapx_unregister_job (is, job);
exit:
g_object_unref (folder);
-
- return success;
}
static gboolean
/* ********************************************************************** */
-static gboolean
+static void
imapx_command_copy_messages_step_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
CamelFolder *folder;
CopyMessagesData *data;
GPtrArray *uids;
gint i;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
data = camel_imapx_job_get_data (job);
- g_return_val_if_fail (data != NULL, FALSE);
+ g_return_if_fail (data != NULL);
folder = camel_imapx_job_ref_folder (job);
- g_return_val_if_fail (folder != NULL, FALSE);
+ g_return_if_fail (folder != NULL);
uids = data->uids;
i = data->index;
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
if (data->use_move_command)
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error moving messages"));
else
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error copying messages"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
goto exit;
}
}
if (i < uids->len) {
- g_object_unref (folder);
+ imapx_command_copy_messages_step_start (
+ is, job, i, &local_error);
- return imapx_command_copy_messages_step_start (
- is, job, i, error);
+ if (local_error != NULL)
+ camel_imapx_job_take_error (job, local_error);
}
exit:
g_object_unref (folder);
imapx_unregister_job (is, job);
-
- return success;
}
static gboolean
/* ********************************************************************** */
-static gboolean
+static void
imapx_command_append_message_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
CamelIMAPXFolder *ifolder;
CamelMessageInfo *mi;
AppendMessageData *data;
gchar *cur, *old_uid;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
data = camel_imapx_job_get_data (job);
- g_return_val_if_fail (data != NULL, FALSE);
+ g_return_if_fail (data != NULL);
folder = camel_imapx_job_ref_folder (job);
- g_return_val_if_fail (folder != NULL, FALSE);
+ g_return_if_fail (folder != NULL);
ifolder = CAMEL_IMAPX_FOLDER (folder);
mi = camel_message_info_clone (data->info);
old_uid = g_strdup (data->info->uid);
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error appending message"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
} else if (ic->status && ic->status->condition == IMAPX_APPENDUID) {
c (is->tagprefix, "Got appenduid %d %d\n", (gint) ic->status->u.appenduid.uidvalidity, (gint) ic->status->u.appenduid.uid);
g_object_unref (folder);
imapx_unregister_job (is, job);
-
- return success;
}
static gboolean
return index;
}
-static gboolean
+static void
imapx_command_step_fetch_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXFolder *ifolder;
CamelIMAPXSummary *isum;
CamelFolder *folder;
RefreshInfoData *data;
gint i;
- gboolean success = TRUE;
CamelIMAPXSettings *settings;
guint batch_count;
gboolean mobile_mode;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
data = camel_imapx_job_get_data (job);
- g_return_val_if_fail (data != NULL, FALSE);
+ g_return_if_fail (data != NULL);
folder = camel_imapx_job_ref_folder (job);
- g_return_val_if_fail (folder != NULL, FALSE);
+ g_return_if_fail (folder != NULL);
data->scan_changes = FALSE;
i = data->index;
- //printf ("%s: Mobile mode: %d Fetch Count %d\n", camel_folder_get_display_name (folder), mobile_mode, batch_count);
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error fetching message headers"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
goto exit;
}
g_object_unref (folder);
- return TRUE;
+ return;
}
}
}
g_object_unref (folder);
- return TRUE;
+ return;
}
/* XXX What fate for our newly-created but unsubmitted
g_object_unref (folder);
imapx_unregister_job (is, job);
-
- return success;
}
static gint
return strcmp (ae, be);
}
-static gboolean
+static void
imapx_job_scan_changes_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
CamelIMAPXSettings *settings;
RefreshInfoData *data;
GCancellable *cancellable;
guint uidset_size;
- gboolean success = TRUE;
gboolean mobile_mode;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
/* This is only for pushing status messages. */
cancellable = camel_imapx_job_get_cancellable (job);
data = camel_imapx_job_get_data (job);
- g_return_val_if_fail (data != NULL, FALSE);
+ g_return_if_fail (data != NULL);
folder = camel_imapx_job_ref_folder (job);
- g_return_val_if_fail (folder != NULL, FALSE);
+ g_return_if_fail (folder != NULL);
data->scan_changes = FALSE;
mobile_mode = camel_imapx_settings_get_mobile_mode (settings);
g_object_unref (settings);
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error retrieving message"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
} else {
GCompareDataFunc uid_cmp = imapx_uid_cmp;
g_object_unref (folder);
- return imapx_command_step_fetch_done (is, ic, error);
+ return imapx_command_step_fetch_done (is, ic);
}
}
g_object_unref (folder);
imapx_unregister_job (is, job);
-
- return success;
}
static gboolean
return TRUE;
}
-static gboolean
+static void
imapx_command_fetch_new_messages_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
CamelIMAPXSummary *isum;
CamelIMAPXFolder *ifolder;
CamelFolder *folder;
RefreshInfoData *data;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
data = camel_imapx_job_get_data (job);
- g_return_val_if_fail (data != NULL, FALSE);
+ g_return_if_fail (data != NULL);
folder = camel_imapx_job_ref_folder (job);
- g_return_val_if_fail (folder != NULL, FALSE);
+ g_return_if_fail (folder != NULL);
ifolder = CAMEL_IMAPX_FOLDER (folder);
isum = CAMEL_IMAPX_SUMMARY (folder->summary);
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error fetching new messages"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
goto exit;
}
g_object_unref (folder);
imapx_unregister_job (is, job);
-
- return success;
}
-static gboolean
+static void
imapx_command_fetch_new_uids_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
RefreshInfoData *data;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
data = camel_imapx_job_get_data (job);
- g_return_val_if_fail (data != NULL, FALSE);
+ g_return_if_fail (data != NULL);
data->scan_changes = FALSE;
sizeof (struct _refresh_info),
imapx_refresh_info_cmp_descending);
- return imapx_command_step_fetch_done (is, ic, error);
+ imapx_command_step_fetch_done (is, ic);
}
static gboolean
/* ********************************************************************** */
-static gboolean
+static void
imapx_command_expunge_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
CamelFolder *folder;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
folder = camel_imapx_job_ref_folder (job);
- g_return_val_if_fail (folder != NULL, FALSE);
+ g_return_if_fail (folder != NULL);
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error expunging message"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
} else {
GPtrArray *uids;
camel_folder_summary_save_to_db (folder->summary, NULL);
uids = camel_db_get_folder_deleted_uids (parent_store->cdb_r, full_name, NULL);
- if (uids && uids->len) {
+ if (uids && uids->len) {
CamelFolderChangeInfo *changes;
GList *removed = NULL;
gint i;
g_object_unref (folder);
imapx_unregister_job (is, job);
-
- return success;
}
static gboolean
/* ********************************************************************** */
-static gboolean
+static void
imapx_command_list_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error fetching folders"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
}
e (is->tagprefix, "==== list or lsub completed ==== \n");
imapx_unregister_job (is, job);
-
- return success;
}
static gboolean
return encoded;
}
-static gboolean
+static void
imapx_command_subscription_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error subscribing to folder"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
}
imapx_unregister_job (is, job);
-
- return success;
}
static gboolean
/* ********************************************************************** */
-static gboolean
+static void
imapx_command_create_folder_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error creating folder"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
}
imapx_unregister_job (is, job);
-
- return success;
}
static gboolean
/* ********************************************************************** */
-static gboolean
+static void
imapx_command_delete_folder_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error deleting folder"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
}
imapx_unregister_job (is, job);
-
- return success;
}
static gboolean
/* ********************************************************************** */
-static gboolean
+static void
imapx_command_rename_folder_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error renaming folder"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
}
imapx_unregister_job (is, job);
-
- return success;
}
static gboolean
/* ********************************************************************** */
-static gboolean
+static void
imapx_command_update_quota_info_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error retrieving quota information"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
}
imapx_unregister_job (is, job);
-
- return success;
}
static gboolean
/* ********************************************************************** */
-static gboolean
+static void
imapx_command_uid_search_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
SearchData *data;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
data = camel_imapx_job_get_data (job);
- g_return_val_if_fail (data != NULL, FALSE);
+ g_return_if_fail (data != NULL);
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
- g_prefix_error (error, "%s: ", _("Search failed"));
- success = FALSE;
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
+ g_prefix_error (&local_error, "%s: ", _("Search failed"));
+ camel_imapx_job_take_error (job, local_error);
}
/* Don't worry about the success state and presence of search
g_mutex_unlock (&is->priv->search_results_lock);
imapx_unregister_job (is, job);
-
- return success;
}
static gboolean
/* ********************************************************************** */
-static gboolean
+static void
imapx_command_noop_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error performing NOOP"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
}
imapx_unregister_job (is, job);
-
- return success;
}
static gboolean
* &flags 00100000
*/
-static gboolean
+static void
imapx_command_sync_changes_done (CamelIMAPXServer *is,
- CamelIMAPXCommand *ic,
- GError **error)
+ CamelIMAPXCommand *ic)
{
CamelIMAPXJob *job;
CamelFolder *folder;
const gchar *full_name;
CamelIMAPXSettings *settings;
gboolean mobile_mode;
- gboolean success = TRUE;
+ GError *local_error = NULL;
job = camel_imapx_command_get_job (ic);
- g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), FALSE);
+ g_return_if_fail (CAMEL_IS_IMAPX_JOB (job));
data = camel_imapx_job_get_data (job);
- g_return_val_if_fail (data != NULL, FALSE);
+ g_return_if_fail (data != NULL);
folder = camel_imapx_job_ref_folder (job);
- g_return_val_if_fail (folder != NULL, FALSE);
+ g_return_if_fail (folder != NULL);
settings = camel_imapx_server_ref_settings (is);
mobile_mode = camel_imapx_settings_get_mobile_mode (settings);
* that what we just set is actually what is on the server now .. but
* if it isn't, i guess we'll fix up next refresh */
- if (camel_imapx_command_set_error_if_failed (ic, error)) {
+ if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
g_prefix_error (
- error, "%s: ",
+ &local_error, "%s: ",
_("Error syncing changes"));
- success = FALSE;
+ camel_imapx_job_take_error (job, local_error);
+ imapx_unregister_job (is, job);
+ goto exit;
/* lock cache ? */
} else {
imapx_unregister_job (is, job);
}
+exit:
g_object_unref (folder);
-
- return success;
}
static gboolean
/* Invoke the completion callback function so it can
* perform any cleanup processing and unregister its
* CamelIMAPXJob. */
- ic->complete (is, ic, NULL);
+ ic->complete (is, ic);
}
camel_imapx_command_queue_free (queue);