IDLE_UNLOCK (idle);
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
success = imapx_command_start (is, ic, cancellable, error);
} else {
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
}
IDLE_UNLOCK (is->idle);
QUEUE_UNLOCK (is);
+ camel_imapx_command_unref (ic);
+
g_object_unref (folder);
return success;
g_object_unref (folder);
}
- camel_imapx_command_unref (ic);
-
return success;
}
CamelFolder *select_folder;
CamelFolder *select_pending;
gboolean nothing_to_do = FALSE;
+ gboolean success;
/* Select is complicated by the fact we may have commands
* active on the server for a different selection.
camel_imapx_command_add_qresync_parameter (ic, folder);
ic->complete = imapx_command_select_done;
- imapx_command_start (is, ic, cancellable, error);
+ success = imapx_command_start (is, ic, cancellable, error);
- return TRUE;
+ camel_imapx_command_unref (ic);
+
+ return success;
}
#ifndef G_OS_WIN32
if (!is->cinfo) {
ic = camel_imapx_command_new (
is, "CAPABILITY", NULL, "CAPABILITY");
- if (!imapx_command_run (is, ic, cancellable, error)) {
- camel_imapx_command_unref (ic);
- success = FALSE;
- goto exit;
- }
+
+ success = imapx_command_run (is, ic, cancellable, error);
/* Server reported error. */
- if (ic->status->result != IMAPX_OK) {
+ if (success && ic->status->result != IMAPX_OK) {
g_set_error (
error, CAMEL_ERROR,
CAMEL_ERROR_GENERIC,
"%s", ic->status->text);
- camel_imapx_command_unref (ic);
success = FALSE;
- goto exit;
}
camel_imapx_command_unref (ic);
+
+ if (!success)
+ goto exit;
}
if (method == CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT) {
ic = camel_imapx_command_new (
is, "STARTTLS", NULL, "STARTTLS");
- if (!imapx_command_run (is, ic, cancellable, error)) {
- camel_imapx_command_unref (ic);
- success = FALSE;
- goto exit;
- }
+
+ success = imapx_command_run (is, ic, cancellable, error);
/* Server reported error. */
- if (ic->status->result != IMAPX_OK) {
+ if (success && ic->status->result != IMAPX_OK) {
g_set_error (
error, CAMEL_ERROR,
CAMEL_ERROR_GENERIC,
"%s", ic->status->text);
- camel_imapx_command_unref (ic);
success = FALSE;
- goto exit;
}
- /* See if we got new capabilities in the STARTTLS response */
- imapx_free_capability (is->cinfo);
- is->cinfo = NULL;
- if (ic->status->condition == IMAPX_CAPABILITY) {
- is->cinfo = ic->status->u.cinfo;
- ic->status->u.cinfo = NULL;
- c (is->tagprefix, "got capability flags %08x\n", is->cinfo ? is->cinfo->capa : 0xFFFFFFFF);
+ if (success) {
+ /* See if we got new capabilities
+ * in the STARTTLS response. */
+ imapx_free_capability (is->cinfo);
+ is->cinfo = NULL;
+ if (ic->status->condition == IMAPX_CAPABILITY) {
+ is->cinfo = ic->status->u.cinfo;
+ ic->status->u.cinfo = NULL;
+ c (is->tagprefix, "got capability flags %08x\n", is->cinfo ? is->cinfo->capa : 0xFFFFFFFF);
+ }
}
camel_imapx_command_unref (ic);
+ if (!success)
+ goto exit;
+
if (camel_tcp_stream_ssl_enable_ssl (
CAMEL_TCP_STREAM_SSL (tcp_stream),
cancellable, &local_error) == -1) {
goto exit;
}
/* Get new capabilities if they weren't already given */
- if (!is->cinfo) {
+ if (is->cinfo == NULL) {
ic = camel_imapx_command_new (
is, "CAPABILITY", NULL, "CAPABILITY");
- if (!imapx_command_run (is, ic, cancellable, error)) {
- camel_imapx_command_unref (ic);
- success = FALSE;
- goto exit;
- }
-
+ success = imapx_command_run (is, ic, cancellable, error);
camel_imapx_command_unref (ic);
+
+ if (!success)
+ goto exit;
}
}
success = imapx_command_queue (
is, new_ic, cancellable, error);
+ camel_imapx_command_unref (new_ic);
+
goto exit;
}
}
exit:
g_object_unref (folder);
- camel_imapx_command_unref (ic);
-
return success;
}
success = imapx_command_queue (
is, ic, cancellable, error);
+
+ camel_imapx_command_unref (ic);
+
if (!success)
break;
}
job->commands++;
success = imapx_command_queue (is, ic, cancellable, error);
+
+ camel_imapx_command_unref (ic);
}
g_object_unref (folder);
if (i < uids->len) {
g_object_unref (folder);
- camel_imapx_command_unref (ic);
-
return imapx_command_copy_messages_step_start (
is, job, i, cancellable, error);
}
g_object_unref (folder);
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
CopyMessagesData *data;
GPtrArray *uids;
gint i = index;
+ gboolean success = TRUE;
data = camel_imapx_job_get_data (job);
g_return_val_if_fail (data != NULL, FALSE);
if (res == 1) {
camel_imapx_command_add (ic, " %f", data->dest);
data->index = i + 1;
- return imapx_command_queue (is, ic, cancellable, error);
+ success = imapx_command_queue (is, ic, cancellable, error);
+ goto exit;
}
}
data->index = i;
if (imapx_uidset_done (&data->uidset, ic)) {
camel_imapx_command_add (ic, " %f", data->dest);
- return imapx_command_queue (is, ic, cancellable, error);
+ success = imapx_command_queue (is, ic, cancellable, error);
+ goto exit;
}
- return TRUE;
+exit:
+ camel_imapx_command_unref (ic);
+
+ return success;
}
static gboolean
g_object_unref (folder);
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
CamelFolder *folder;
CamelIMAPXCommand *ic;
AppendMessageData *data;
+ gboolean success;
data = camel_imapx_job_get_data (job);
g_return_val_if_fail (data != NULL, FALSE);
ic->pri = job->pri;
job->commands++;
+ success = imapx_command_queue (is, ic, cancellable, error);
+
+ camel_imapx_command_unref (ic);
+
g_object_unref (folder);
- return imapx_command_queue (is, ic, cancellable, error);
+ return success;
}
/* ********************************************************************** */
gint total = camel_folder_summary_count (folder->summary);
gint fetch_limit = data->fetch_msg_limit;
- camel_imapx_command_unref (ic);
-
ic = camel_imapx_command_new (
is, "FETCH", folder, "UID FETCH ");
ic->complete = imapx_command_step_fetch_done;
if (!r->exists) {
res = imapx_uidset_add (&data->uidset, ic, r->uid);
if (res == 1) {
+ gboolean success;
+
camel_imapx_command_add (ic, " (RFC822.SIZE RFC822.HEADER)");
data->index = i + 1;
+ success = imapx_command_queue (
+ is, ic, cancellable, error);
+
+ camel_imapx_command_unref (ic);
+
g_object_unref (folder);
- return imapx_command_queue (is, ic, cancellable, error);
+ return success;
}
}
}
//printf ("Existing : %d Gonna fetch in %s for %d/%d\n", total, camel_folder_get_full_name (folder), i, data->infos->len);
data->index = data->infos->len;
if (imapx_uidset_done (&data->uidset, ic)) {
+ gboolean success;
+
camel_imapx_command_add (ic, " (RFC822.SIZE RFC822.HEADER)");
+ success = imapx_command_queue (
+ is, ic, cancellable, error);
+
+ camel_imapx_command_unref (ic);
+
g_object_unref (folder);
- return imapx_command_queue (is, ic, cancellable, error);
+ return success;
}
+
+ /* XXX What fate for our newly-created but unsubmitted
+ * CamelIMAPXCommand if we get here? I guess just
+ * discard it and move on? Also warn so I know if
+ * we're actually taking this branch for real. */
+ camel_imapx_command_unref (ic);
+ g_warn_if_reached ();
}
if (camel_folder_summary_count (folder->summary)) {
g_object_unref (folder);
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
g_object_unref (folder);
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
CamelIMAPXSettings *settings;
gboolean mobile_mode;
gchar *uid = NULL;
+ gboolean success;
data = camel_imapx_job_get_data (job);
g_return_val_if_fail (data != NULL, FALSE);
refresh_info_data_infos_free (data);
data->infos = g_array_new (0, 0, sizeof (struct _refresh_info));
+ success = imapx_command_queue (is, ic, cancellable, error);
+
+ camel_imapx_command_unref (ic);
+
g_free (uid);
g_object_unref (folder);
- return imapx_command_queue (is, ic, cancellable, error);
+ return success;
}
static gboolean
g_object_unref (folder);
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
guint32 total, diff;
guint uidset_size;
gchar *uid = NULL;
+ gboolean success;
data = camel_imapx_job_get_data (job);
g_return_val_if_fail (data != NULL, FALSE);
ic->complete = imapx_command_fetch_new_messages_done;
}
- g_free (uid);
-
camel_imapx_command_set_job (ic, job);
+ success = imapx_command_queue (is, ic, cancellable, error);
+
+ camel_imapx_command_unref (ic);
+
+ g_free (uid);
+
g_object_unref (folder);
- return imapx_command_queue (is, ic, cancellable, error);
+ return success;
}
static gboolean
CamelIMAPXSettings *settings;
guint uidset_size;
RefreshInfoData *data;
+ gboolean success;
data = camel_imapx_job_get_data (job);
g_return_val_if_fail (data != NULL, FALSE);
camel_imapx_command_set_job (ic, job);
+ success = imapx_command_queue (is, ic, cancellable, error);
+
+ camel_imapx_command_unref (ic);
+
g_object_unref (folder);
- return imapx_command_queue (is, ic, cancellable, error);
+ return success;
}
static gboolean
g_object_unref (folder);
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
ic->complete = imapx_command_expunge_done;
success = imapx_command_queue (is, ic, cancellable, error);
+
+ camel_imapx_command_unref (ic);
}
g_object_unref (folder);
e (is->tagprefix, "==== list or lsub completed ==== \n");
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
{
CamelIMAPXCommand *ic;
ListData *data;
+ gboolean success;
data = camel_imapx_job_get_data (job);
g_return_val_if_fail (data != NULL, FALSE);
camel_imapx_command_set_job (ic, job);
ic->complete = imapx_command_list_done;
- return imapx_command_queue (is, ic, cancellable, error);
+ success = imapx_command_queue (is, ic, cancellable, error);
+
+ camel_imapx_command_unref (ic);
+
+ return success;
}
static gboolean
}
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
CamelIMAPXStore *store;
ManageSubscriptionsData *data;
gchar *encoded_fname = NULL;
+ gboolean success;
data = camel_imapx_job_get_data (job);
g_return_val_if_fail (data != NULL, FALSE);
store = camel_imapx_server_ref_store (is);
-
encoded_fname = imapx_encode_folder_name (store, data->folder_name);
if (data->subscribe)
camel_imapx_command_set_job (ic, job);
ic->complete = imapx_command_subscription_done;
- g_free (encoded_fname);
+ success = imapx_command_queue (is, ic, cancellable, error);
+ camel_imapx_command_unref (ic);
+
+ g_free (encoded_fname);
g_object_unref (store);
- return imapx_command_queue (is, ic, cancellable, error);
+ return success;
}
/* ********************************************************************** */
}
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
CamelIMAPXCommand *ic;
CreateFolderData *data;
gchar *encoded_fname = NULL;
+ gboolean success;
data = camel_imapx_job_get_data (job);
g_return_val_if_fail (data != NULL, FALSE);
camel_imapx_command_set_job (ic, job);
ic->complete = imapx_command_create_folder_done;
+ success = imapx_command_queue (is, ic, cancellable, error);
+
+ camel_imapx_command_unref (ic);
+
g_free (encoded_fname);
- return imapx_command_queue (is, ic, cancellable, error);
+ return success;
}
/* ********************************************************************** */
}
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
g_return_val_if_fail (data != NULL, FALSE);
store = camel_imapx_server_ref_store (is);
-
encoded_fname = imapx_encode_folder_name (store, data->folder_name);
folder = camel_store_get_folder_sync (
success = imapx_command_queue (is, ic, cancellable, error);
+ camel_imapx_command_unref (ic);
+
g_object_unref (folder);
}
g_free (encoded_fname);
-
g_object_unref (store);
return success;
}
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
success = imapx_command_queue (is, ic, cancellable, error);
+ camel_imapx_command_unref (ic);
+
g_object_unref (folder);
}
}
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
CamelIMAPXCommand *ic;
CamelIMAPXStore *store;
QuotaData *data;
- gchar *encoded_folder_name;
+ gchar *encoded_fname;
gboolean success;
data = camel_imapx_job_get_data (job);
g_return_val_if_fail (data != NULL, FALSE);
store = camel_imapx_server_ref_store (is);
-
- encoded_folder_name =
- imapx_encode_folder_name (store, data->folder_name);
+ encoded_fname = imapx_encode_folder_name (store, data->folder_name);
ic = camel_imapx_command_new (
is, "GETQUOTAROOT", NULL,
- "GETQUOTAROOT %s", encoded_folder_name);
+ "GETQUOTAROOT %s", encoded_fname);
ic->pri = job->pri;
camel_imapx_command_set_job (ic, job);
ic->complete = imapx_command_update_quota_info_done;
success = imapx_command_queue (is, ic, cancellable, error);
- g_free (encoded_folder_name);
+ camel_imapx_command_unref (ic);
+ g_free (encoded_fname);
g_object_unref (store);
return success;
g_mutex_unlock (&is->priv->search_results_lock);
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
CamelFolder *folder;
CamelIMAPXCommand *ic;
SearchData *data;
+ gboolean success;
data = camel_imapx_job_get_data (job);
g_return_val_if_fail (data != NULL, FALSE);
camel_imapx_command_set_job (ic, job);
ic->complete = imapx_command_uid_search_done;
+ success = imapx_command_queue (is, ic, cancellable, error);
+
+ camel_imapx_command_unref (ic);
+
g_object_unref (folder);
- return imapx_command_queue (is, ic, cancellable, error);
+ return success;
}
/* ********************************************************************** */
}
imapx_unregister_job (is, job);
- camel_imapx_command_unref (ic);
return success;
}
{
CamelIMAPXCommand *ic;
CamelFolder *folder;
+ gboolean success;
folder = camel_imapx_job_ref_folder (job);
ic->pri = IMAPX_PRIORITY_NOOP;
}
- return imapx_command_queue (is, ic, cancellable, error);
+ success = imapx_command_queue (is, ic, cancellable, error);
+
+ camel_imapx_command_unref (ic);
+
+ return success;
}
/* ********************************************************************** */
g_object_unref (folder);
- camel_imapx_command_unref (ic);
-
return success;
}
struct _uidset_state ss;
GPtrArray *uids;
gint on;
+ gboolean success = TRUE;
data = camel_imapx_job_get_data (job);
g_return_val_if_fail (data != NULL, FALSE);
if (send == 1 || (i == uids->len - 1 && imapx_uidset_done (&ss, ic))) {
job->commands++;
camel_imapx_command_add (ic, " %tFLAGS.SILENT (%t)", on?"+":"-", flags_table[j].name);
- if (!imapx_command_queue (is, ic, cancellable, error)) {
+ success = imapx_command_queue (is, ic, cancellable, error);
+ camel_imapx_command_unref (ic);
+ ic = NULL;
+
+ if (!success) {
camel_message_info_free (info);
goto exit;
}
- ic = NULL;
}
if (flag == CAMEL_MESSAGE_SEEN) {
/* Remember how the server's unread count will change if this
|| (i == c->infos->len - 1 && imapx_uidset_done (&ss, ic))) {
job->commands++;
camel_imapx_command_add (ic, " %tFLAGS.SILENT (%t)", on?"+":"-", c->name);
- if (!imapx_command_queue (is, ic, cancellable, error))
- goto exit;
+ success = imapx_command_queue (is, ic, cancellable, error);
+ camel_imapx_command_unref (ic);
ic = NULL;
+
+ if (!success)
+ goto exit;
}
}
}
if (job->commands == 0)
imapx_unregister_job (is, job);
- return TRUE;
+ return success;
}
static gboolean