aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/imap')
-rw-r--r--camel/providers/imap/camel-imap-folder.c11
-rw-r--r--camel/providers/imap/camel-imap-store.c11
2 files changed, 20 insertions, 2 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 813a82ee89..6895a6bf0b 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -471,12 +471,15 @@ imap_refresh_info (CamelFolder *folder, CamelException *ex)
/* If the folder isn't selected, select it (which will force
* a rescan if one is needed.
*/
+ CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
if (imap_store->current_folder != folder) {
+ CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
response = camel_imap_command (imap_store, folder, ex, NULL);
camel_imap_response_free (imap_store, response);
return;
}
-
+ CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
+
/* Otherwise, if we need a rescan, do it, and if not, just do
* a NOOP to give the server a chance to tell us about new
* messages.
@@ -1156,9 +1159,11 @@ imap_append_online (CamelFolder *folder, CamelMimeMessage *message,
camel_imap_response_free (store, response);
/* Make sure a "folder_changed" is emitted. */
+ CAMEL_IMAP_STORE_LOCK (store, command_lock);
if (store->current_folder != folder ||
camel_folder_summary_count (folder->summary) == count)
imap_refresh_info (folder, ex);
+ CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
}
static void
@@ -1360,10 +1365,12 @@ imap_transfer_online (CamelFolder *source, GPtrArray *uids,
return;
/* Make the destination notice its new messages */
+ CAMEL_IMAP_STORE_LOCK (store, command_lock);
if (store->current_folder != dest ||
camel_folder_summary_count (dest->summary) == count)
camel_folder_refresh_info (dest, ex);
-
+ CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+
if (delete_originals) {
for (i = 0; i < uids->len; i++)
camel_folder_delete_message (source, uids->pdata[i]);
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 1e6284b572..f899168595 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -1409,10 +1409,14 @@ delete_folder (CamelStore *store, const char *folder_name, CamelException *ex)
if (response) {
camel_imap_response_free_without_processing (imap_store, response);
+ CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
+
if (imap_store->current_folder)
camel_object_unref (CAMEL_OBJECT (imap_store->current_folder));
/* no need to actually create a CamelFolder for INBOX */
imap_store->current_folder = NULL;
+
+ CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
} else
return;
@@ -1544,10 +1548,14 @@ rename_folder (CamelStore *store, const char *old_name, const char *new_name, Ca
if (response) {
camel_imap_response_free_without_processing (imap_store, response);
+ CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
+
if (imap_store->current_folder)
camel_object_unref (CAMEL_OBJECT (imap_store->current_folder));
/* no need to actually create a CamelFolder for INBOX */
imap_store->current_folder = NULL;
+
+ CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
} else
return;
@@ -1993,6 +2001,7 @@ get_folder_info_online (CamelStore *store, const char *top,
continue;
}
+ CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
/* For the current folder, poke it to check for new
* messages and then report that number, rather than
* doing a STATUS command.
@@ -2003,6 +2012,8 @@ get_folder_info_online (CamelStore *store, const char *top,
fi->unread_message_count = camel_folder_get_unread_message_count (imap_store->current_folder);
} else
fi->unread_message_count = get_folder_status (imap_store, fi->full_name, "UNSEEN");
+
+ CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
}
g_ptr_array_free (folders, TRUE);