CamelIMAPXServer *is = NULL;
CamelIMAPXStore *imapx_store;
CamelStore *store = con_man->priv->store;
- CamelService *service;
ConnectionInfo *cinfo = NULL;
gboolean success;
/* Caller must be holding CON_WRITE_LOCK. */
- service = CAMEL_SERVICE (store);
-
imapx_store = CAMEL_IMAPX_STORE (store);
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
/* Check if we got cancelled while we were waiting. */
if (g_cancellable_set_error_if_cancelled (cancellable, error))
- goto exit;
+ return NULL;
is = camel_imapx_server_new (store);
if (!success) {
g_object_unref (is);
- is = NULL;
- goto exit;
+ return NULL;
}
g_signal_connect (
c(is->tagprefix, "Created new connection for %s and total connections %d \n", folder_name, g_list_length (con_man->priv->connections));
-exit:
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return is;
}
GCancellable *cancellable,
GError **error)
{
- CamelIMAPXServer *server = NULL;
-
- camel_service_lock (CAMEL_SERVICE (istore), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- server = camel_imapx_conn_manager_get_connection (istore->con_man, folder_name, cancellable, error);
-
- camel_service_unlock (CAMEL_SERVICE (istore), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- return server;
+ return camel_imapx_conn_manager_get_connection (
+ istore->con_man, folder_name, cancellable, error);
}
void
{
g_return_if_fail (server != NULL);
- camel_imapx_conn_manager_update_con_info (istore->con_man, server, folder_name);
+ camel_imapx_conn_manager_update_con_info (
+ istore->con_man, server, folder_name);
}
static gboolean
if (!service_class->disconnect_sync (service, clean, cancellable, error))
return FALSE;
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- if (istore->con_man) {
+ if (istore->con_man != NULL)
camel_imapx_conn_manager_close_connections (istore->con_man);
- }
-
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
return TRUE;
}
return NULL;
}
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
server = camel_imapx_server_new (CAMEL_STORE (istore));
connected = server->stream != NULL;
if (!connected)
connected = imapx_connect_to_server (server, cancellable, error);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
if (!connected)
return NULL;
gchar *uid;
gchar *password;
- GStaticRecMutex connect_lock; /* for locking connection operations */
- GStaticMutex connect_op_lock; /* for locking the connection_op */
-
GMutex *connection_lock;
ConnectionOp *connection_op;
CamelServiceConnectionStatus status;
g_free (priv->uid);
g_free (priv->password);
- g_static_rec_mutex_free (&priv->connect_lock);
- g_static_mutex_free (&priv->connect_op_lock);
-
/* There should be no outstanding connection operations. */
g_warn_if_fail (priv->connection_op == NULL);
g_mutex_free (priv->connection_lock);
{
service->priv = CAMEL_SERVICE_GET_PRIVATE (service);
- g_static_rec_mutex_init (&service->priv->connect_lock);
- g_static_mutex_init (&service->priv->connect_op_lock);
-
service->priv->connection_lock = g_mutex_new ();
service->priv->status = CAMEL_SERVICE_DISCONNECTED;
}
}
/**
- * camel_service_lock:
- * @service: a #CamelService
- * @lock: lock type to lock
- *
- * Locks @service's @lock. Unlock it with camel_service_unlock().
- *
- * Since: 2.32
- **/
-void
-camel_service_lock (CamelService *service,
- CamelServiceLock lock)
-{
- g_return_if_fail (CAMEL_IS_SERVICE (service));
-
- switch (lock) {
- case CAMEL_SERVICE_REC_CONNECT_LOCK:
- g_static_rec_mutex_lock (&service->priv->connect_lock);
- break;
- case CAMEL_SERVICE_CONNECT_OP_LOCK:
- g_static_mutex_lock (&service->priv->connect_op_lock);
- break;
- default:
- g_return_if_reached ();
- }
-}
-
-/**
- * camel_service_unlock:
- * @service: a #CamelService
- * @lock: lock type to unlock
- *
- * Unlocks @service's @lock, previously locked with camel_service_lock().
- *
- * Since: 2.32
- **/
-void
-camel_service_unlock (CamelService *service,
- CamelServiceLock lock)
-{
- g_return_if_fail (CAMEL_IS_SERVICE (service));
-
- switch (lock) {
- case CAMEL_SERVICE_REC_CONNECT_LOCK:
- g_static_rec_mutex_unlock (&service->priv->connect_lock);
- break;
- case CAMEL_SERVICE_CONNECT_OP_LOCK:
- g_static_mutex_unlock (&service->priv->connect_op_lock);
- break;
- default:
- g_return_if_reached ();
- }
-}
-
-/**
* camel_service_connect_sync:
* @service: a #CamelService
* @cancellable: optional #GCancellable object, or %NULL
GError **error)
{
CamelServiceClass *class;
- GList *list;
g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL);
class = CAMEL_SERVICE_GET_CLASS (service);
g_return_val_if_fail (class->query_auth_types_sync != NULL, NULL);
- /* Note that we get the connect lock here, which means the
- * callee must not call the connect functions itself. */
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
- list = class->query_auth_types_sync (service, cancellable, error);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- return list;
+ return class->query_auth_types_sync (service, cancellable, error);
}
/**
CAMEL_SERVICE_ERROR_NOT_CONNECTED
} CamelServiceError;
-/**
- * CamelServiceLock:
- *
- * Since: 2.32
- **/
-typedef enum {
- CAMEL_SERVICE_REC_CONNECT_LOCK,
- CAMEL_SERVICE_CONNECT_OP_LOCK
-} CamelServiceLock;
-
struct _CamelService {
CamelObject parent;
CamelServicePrivate *priv;
void camel_service_set_settings (CamelService *service,
CamelSettings *settings);
const gchar * camel_service_get_uid (CamelService *service);
-void camel_service_lock (CamelService *service,
- CamelServiceLock lock);
-void camel_service_unlock (CamelService *service,
- CamelServiceLock lock);
gboolean camel_service_connect_sync (CamelService *service,
GCancellable *cancellable,
* Also, if this is the INBOX, some servers (cryus) wont tell
* us with a NOOP of new messages, so force a reselect which
* should do it. */
- camel_service_lock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
if (camel_application_is_exiting || !camel_imap_store_connected (imap_store, &local_error))
goto done;
folder, camel_folder_summary_count (
folder->summary), cancellable, &local_error);
}
-done:
- camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
+done:
camel_folder_summary_save_to_db (folder->summary, NULL);
camel_store_summary_save ((CamelStoreSummary *)((CamelImapStore *) parent_store)->summary);
if (summary_got == 0 && summary_len == 0) {
camel_operation_pop_message (cancellable);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
g_free (new);
g_free (resp);
g_free (new);
g_free (resp);
- if (type != CAMEL_IMAP_RESPONSE_ERROR && type != CAMEL_IMAP_RESPONSE_TAGGED)
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
camel_folder_summary_free_array (known_uids);
return TRUE;
}
CamelImapStore *store;
CamelImapMessageInfo *info;
CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
- gboolean success, is_gmail;
+ gboolean is_gmail;
CamelFolder *real_junk = NULL;
CamelFolder *real_trash = NULL;
gchar *folder_path;
return imap_sync_offline (folder, error);
}
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
/* write local changes first */
replay_offline_journal (store, imap_folder, cancellable, NULL);
}
g_ptr_array_free (matches, TRUE);
- /* We unlock here so that other threads can have a chance to grab the connect_lock */
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
/* check for an exception */
if (local_error != NULL) {
g_propagate_error (error, local_error);
g_object_unref (real_junk);
return FALSE;
}
-
- /* Re-lock the connect_lock */
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
}
if (local_error == NULL)
g_ptr_array_free (summary, TRUE);
/* Save the summary */
- success = imap_sync_offline (folder, error);
-
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- return success;
+ return imap_sync_offline (folder, error);
}
static gint
store = CAMEL_IMAP_STORE (parent_store);
full_expunge = (store->capabilities & IMAP_CAPABILITY_UIDPLUS) == 0;
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if ((store->capabilities & IMAP_CAPABILITY_UIDPLUS) == 0) {
if (!CAMEL_FOLDER_GET_CLASS (folder)->synchronize_sync (
folder, 0, cancellable, error)) {
- camel_service_unlock (
- CAMEL_SERVICE (store),
- CAMEL_SERVICE_REC_CONNECT_LOCK);
return FALSE;
}
}
if (response)
camel_imap_response_free (store, response);
else {
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
g_free (set);
return FALSE;
}
g_free (set);
}
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
changes = camel_folder_change_info_new ();
for (i = 0; i < uids->len; i++) {
camel_folder_summary_remove_uid (folder->summary, uids->pdata[i]);
* marked un-deleted.
*/
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (!CAMEL_FOLDER_GET_CLASS (folder)->synchronize_sync (
- folder, 0, cancellable, error)) {
- camel_service_unlock (
- CAMEL_SERVICE (store),
- CAMEL_SERVICE_REC_CONNECT_LOCK);
+ folder, 0, cancellable, error))
return FALSE;
- }
response = camel_imap_command (store, folder, cancellable, error, "UID SEARCH DELETED");
- if (!response) {
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
+ if (!response)
return FALSE;
- }
+
result = camel_imap_response_extract (store, response, "SEARCH", error);
- if (!result) {
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
+ if (!result)
return FALSE;
- }
if (result[8] == ' ') {
gchar *uid, *lasts = NULL;
if (!response) {
g_ptr_array_free (keep_uids, TRUE);
g_ptr_array_free (mark_uids, TRUE);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
return FALSE;
}
camel_imap_response_free (store, response);
if (!response) {
g_ptr_array_free (keep_uids, TRUE);
g_ptr_array_free (mark_uids, TRUE);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
return FALSE;
}
camel_imap_response_free (store, response);
/* now we can free this, now that we're done with keep_uids */
g_free (result);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return TRUE;
}
camel_imap_response_free (store, response);
/* Make sure a "folder_changed" is emitted. */
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
if (store->current_folder != folder ||
camel_folder_summary_count (folder->summary) == count)
success = imap_refresh_info_sync (folder, cancellable, error);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
return success;
}
GCancellable *cancellable,
GError **error)
{
- CamelStore *parent_store;
- CamelImapStore *store;
CamelImapMessageCache *sc = CAMEL_IMAP_FOLDER (source)->cache;
CamelImapMessageCache *dc = CAMEL_IMAP_FOLDER (dest)->cache;
CamelFolderChangeInfo *changes;
gint i;
GError *local_error = NULL;
- parent_store = camel_folder_get_parent_store (source);
- store = CAMEL_IMAP_STORE (parent_store);
-
/* We grab the store's command lock first, and then grab the
* source and destination cache_locks. This way we can't
* deadlock in the case where we're simultaneously also trying
* to copy messages in the other direction from another thread.
*/
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
CAMEL_IMAP_FOLDER_REC_LOCK (source, cache_lock);
CAMEL_IMAP_FOLDER_REC_LOCK (dest, cache_lock);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
if (transferred_uids) {
*transferred_uids = g_ptr_array_new ();
/* use XGWMOVE only when none of the moving messages has set any user tag */
if ((store->capabilities & IMAP_CAPABILITY_XGWMOVE) != 0 && delete_originals && !any_has_user_tag (source, uidset)) {
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
response = camel_imap_command (
store, source, cancellable, &local_error,
"UID XGWMOVE %s %F", uidset, full_name);
/* returns only 'A00012 OK UID XGWMOVE completed' '* 2 XGWMOVE' so nothing useful */
camel_imap_response_free (store, response);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
} else {
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
response = camel_imap_command (
store, source, cancellable, &local_error,
"UID COPY %s %F", uidset, full_name);
response, source, destination,
cancellable);
camel_imap_response_free (store, response);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
}
if (local_error == NULL && delete_originals && (mark_moved || !trash_path)) {
gchar *body, *found_uid;
gint i;
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
if (!camel_imap_store_connected (store, NULL)) {
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
g_set_error (
error, CAMEL_SERVICE_ERROR,
CAMEL_SERVICE_ERROR_UNAVAILABLE,
} else {
g_clear_error (&local_error);
}
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
}
if (camel_debug_start("imap:folder")) {
camel_operation_pop_message (cancellable);
if (type == CAMEL_IMAP_RESPONSE_ERROR || camel_application_is_exiting) {
- if (type != CAMEL_IMAP_RESPONSE_ERROR && type != CAMEL_IMAP_RESPONSE_TAGGED)
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
g_string_free (header_spec, TRUE);
goto lose;
}
g_string_free (header_spec, TRUE);
camel_operation_pop_message (cancellable);
- if (type != CAMEL_IMAP_RESPONSE_ERROR && type != CAMEL_IMAP_RESPONSE_TAGGED)
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
goto lose;
}
}
if (stream || cache_only)
return stream;
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);
if (!camel_imap_store_connected (store, NULL)) {
CAMEL_SERVICE_ERROR_UNAVAILABLE,
_("This message is not currently available"));
CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
return NULL;
}
if (!response) {
CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
return NULL;
}
}
camel_imap_response_free (store, response);
CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
if (!stream) {
g_set_error (
error, CAMEL_ERROR,
if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (imap_store)))
return NULL;
- camel_service_lock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (!camel_imap_store_connected (imap_store, NULL))
- goto done;
+ return NULL;
if (imap_store->capabilities & IMAP_CAPABILITY_QUOTA) {
const gchar *full_name = camel_folder_get_full_name (folder);
g_free (folder_name);
}
-done:
- camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
+
return res;
}
if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store)))
return TRUE;
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
if (!connect_to_server_wrapper (service, cancellable, error) ||
!imap_auth_loop (service, cancellable, error)) {
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
camel_service_disconnect_sync (
service, TRUE, cancellable, NULL);
return FALSE;
/* save any changes we had */
camel_store_summary_save ((CamelStoreSummary *) store->summary);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (local_error != NULL) {
camel_service_disconnect_sync (
service, TRUE, cancellable, NULL);
return NULL;
}
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
connected = store->istream != NULL && store->connected;
if (!connected)
connected = connect_to_server_wrapper (
service, cancellable, error);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
if (!connected)
return NULL;
GCancellable *cancellable,
GError **error)
{
- CamelService *service;
CamelImapStore *imap_store;
CamelImapResponse *response;
CamelFolderInfo *fi;
CamelStoreInfo *si;
- gboolean success = TRUE;
- service = CAMEL_SERVICE (subscribable);
imap_store = CAMEL_IMAP_STORE (subscribable);
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- if (!camel_imap_store_connected (imap_store, error)) {
- success = FALSE;
- goto done;
- }
+ if (!camel_imap_store_connected (imap_store, error))
+ return FALSE;
response = camel_imap_command (imap_store, NULL, cancellable, error,
"SUBSCRIBE %F", folder_name);
- if (!response) {
- success = FALSE;
- goto done;
- }
+ if (!response)
+ return FALSE;
camel_imap_response_free (imap_store, response);
/* we don't need to emit a "folder_subscribed" signal
* if we are in the process of renaming folders, so we
* are done here... */
- goto done;
+ return TRUE;
}
fi = imap_build_folder_info (imap_store, folder_name);
camel_subscribable_folder_subscribed (subscribable, fi);
camel_folder_info_free (fi);
-done:
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- return success;
+ return TRUE;
}
static gboolean
GCancellable *cancellable,
GError **error)
{
- CamelService *service;
CamelImapStore *imap_store;
CamelImapResponse *response;
- gboolean success = TRUE;
- service = CAMEL_SERVICE (subscribable);
imap_store = CAMEL_IMAP_STORE (subscribable);
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- if (!camel_imap_store_connected (imap_store, error)) {
- success = FALSE;
- goto done;
- }
+ if (!camel_imap_store_connected (imap_store, error))
+ return FALSE;
response = camel_imap_command (imap_store, NULL, cancellable, error,
"UNSUBSCRIBE %F", folder_name);
- if (!response) {
- success = FALSE;
- goto done;
- }
+ if (!response)
+ return FALSE;
camel_imap_response_free (imap_store, response);
- success = imap_folder_effectively_unsubscribed (imap_store, folder_name, error);
-
-done:
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- return success;
+ return imap_folder_effectively_unsubscribed (
+ imap_store, folder_name, error);
}
static void
CamelFolder *current_folder;
gboolean success = TRUE;
- camel_service_lock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- if (!camel_imap_store_connected (imap_store, error)) {
- success = FALSE;
- goto done;
- }
+ if (!camel_imap_store_connected (imap_store, error))
+ return FALSE;
current_folder = imap_store->current_folder;
if (current_folder && imap_summary_is_dirty (current_folder->summary)) {
else
success = FALSE;
}
-done:
- camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
return success;
}
return NULL;
}
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- if (!camel_imap_store_connected (imap_store, error)) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
+ if (!camel_imap_store_connected (imap_store, error))
return NULL;
- }
if (!g_ascii_strcasecmp (folder_name, "INBOX"))
folder_name = "INBOX";
const gchar *c;
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
g_propagate_error (error, local_error);
return NULL;
}
g_clear_error (&local_error);
if (!(flags & CAMEL_STORE_FOLDER_CREATE)) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
g_set_error (
error, CAMEL_STORE_ERROR,
CAMEL_STORE_ERROR_NO_FOLDER,
c++;
if (*c != '\0') {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
g_set_error (
error, CAMEL_FOLDER_ERROR,
CAMEL_FOLDER_ERROR_INVALID_PATH,
gint i;
if (!(response = camel_imap_command (imap_store, NULL, cancellable, error, "LIST \"\" %G", parent_real))) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
g_free (parent_name);
g_free (parent_real);
return NULL;
error, CAMEL_FOLDER_ERROR,
CAMEL_FOLDER_ERROR_INVALID_STATE,
_("The parent folder is not allowed to contain subfolders"));
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
g_free (parent_name);
g_free (parent_real);
return NULL;
/* delete the old parent and recreate it */
if (!imap_store_delete_folder_sync (
store, parent_name, cancellable, error)) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
g_free (parent_name);
g_free (parent_real);
return NULL;
g_free (name);
if (!response) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
g_free (parent_name);
g_free (parent_real);
return NULL;
}
g_free (folder_real);
if (!response) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
return NULL;
}
} else if (flags & CAMEL_STORE_FOLDER_EXCL) {
camel_imap_response_free_without_processing (imap_store, response);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return NULL;
}
}
camel_imap_response_free_without_processing (imap_store, response);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return new_folder;
}
CamelImapResponse *response;
gboolean success = TRUE;
- camel_service_lock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- if (!camel_imap_store_connected (imap_store, error)) {
- success = FALSE;
- goto fail;
- }
+ if (!camel_imap_store_connected (imap_store, error))
+ return FALSE;
/* make sure this folder isn't currently SELECTed */
response = camel_imap_command (imap_store, NULL, cancellable, error, "SELECT INBOX");
- if (!response) {
- success = FALSE;
- goto fail;
- }
+ if (!response)
+ return FALSE;
camel_imap_response_free_without_processing (imap_store, response);
if (imap_store->current_folder)
} else
success = FALSE;
-fail:
- camel_service_unlock (CAMEL_SERVICE (imap_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return success;
}
use_subscriptions = camel_imap_settings_get_use_subscriptions (
CAMEL_IMAP_SETTINGS (settings));
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (!camel_imap_store_connected (imap_store, error)) {
success = FALSE;
goto fail;
g_free (newpath);
fail:
imap_store->renaming = FALSE;
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
return success;
}
namespace = camel_imap_settings_dup_namespace (
CAMEL_IMAP_SETTINGS (settings));
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
camel_operation_push_message (cancellable,
_("Retrieving list of folders at '%s'"),
camel_service_get_display_name (service));
done:
camel_operation_pop_message (cancellable);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
g_free (namespace);
}
now = time (NULL);
ref = now > imap_store->refresh_stamp + 60 * 60 * 1;
if (ref) {
- camel_service_lock (
- service, CAMEL_SERVICE_REC_CONNECT_LOCK);
ref = now > imap_store->refresh_stamp + 60 * 60 * 1;
if (ref) {
imap_store->refresh_stamp = now;
g_object_ref (store),
(GDestroyNotify) g_object_unref);
}
- camel_service_unlock (
- service, CAMEL_SERVICE_REC_CONNECT_LOCK);
}
} else {
gchar *pattern;
gint i;
CamelImapStoreNamespace *ns;
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (!camel_imap_store_connected ((CamelImapStore *) store, error))
- goto fail;
+ return NULL;
if (top[0] == 0) {
pattern = g_alloca (3);
ns = camel_imap_store_summary_get_main_namespace (imap_store->summary);
if (!get_folders_sync (imap_store, pattern, cancellable, error))
- goto fail;
+ return NULL;
if (pattern[0] != '*' && ns) {
pattern[i] = ns->sep;
pattern[i + 1] = (flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) ? '*':'%';
get_folders_sync (imap_store, pattern, cancellable, NULL);
}
camel_store_summary_save ((CamelStoreSummary *) imap_store->summary);
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
}
tree = get_folder_info_offline (store, top, flags, error);
return tree;
-
-fail:
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
- return NULL;
}
static CamelFolderInfo *
nntp_folder = CAMEL_NNTP_FOLDER (folder);
nntp_store = CAMEL_NNTP_STORE (parent_store);
- camel_service_lock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
/* When invoked with no fmt, camel_nntp_command() just selects the folder
* and should return zero. */
success = !camel_nntp_command (
nntp_folder->changes = camel_folder_change_info_new ();
}
- camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (changes) {
camel_folder_changed (folder, changes);
camel_folder_change_info_free (changes);
nntp_folder_sync (CamelFolder *folder,
GError **error)
{
- CamelStore *parent_store;
GPtrArray *changed;
- gboolean success;
-
- parent_store = camel_folder_get_parent_store (folder);
-
- camel_service_lock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
changed = camel_folder_summary_get_changed (folder->summary);
if (changed) {
g_ptr_array_free (changed, TRUE);
camel_folder_summary_touch (folder->summary);
}
- success = camel_folder_summary_save_to_db (folder->summary, error);
- camel_service_unlock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
- return success;
+ return camel_folder_summary_save_to_db (folder->summary, error);
}
static gboolean
GCancellable *cancellable,
GError **error)
{
- CamelFolder *folder;
- CamelStore *parent_store;
- CamelNNTPStore *nntp_store;
CamelStream *stream;
gchar *article, *msgid;
gboolean success = TRUE;
- folder = CAMEL_FOLDER (disco_folder);
- parent_store = camel_folder_get_parent_store (folder);
- nntp_store = CAMEL_NNTP_STORE (parent_store);
-
article = alloca (strlen (uid) + 1);
strcpy (article, uid);
msgid = strchr (article, ',');
}
*msgid++ = 0;
- camel_service_lock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
stream = nntp_folder_download_message (
(CamelNNTPFolder *) disco_folder, article, msgid, cancellable, error);
if (stream)
else
success = FALSE;
- camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return success;
}
}
*msgid++ = 0;
- camel_service_lock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
/* Lookup in cache, NEWS is global messageid's so use a global cache path */
stream = camel_data_cache_get (nntp_store->cache, "cache", msgid, NULL);
if (stream == NULL) {
changes = NULL;
}
- camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (changes) {
camel_folder_changed (folder, changes);
camel_folder_change_info_free (changes);
nntp_store = CAMEL_NNTP_STORE (parent_store);
stream = CAMEL_STREAM (nntp_store->stream);
- camel_service_lock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
/* send 'POST' command */
ret = camel_nntp_command (nntp_store, cancellable, error, NULL, &line, "post");
if (ret != 340) {
_("Posting failed: %s"), line);
success = FALSE;
}
- camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
return success;
}
g_free (group);
header->next = savedhdrs;
- camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return success;
}
host = camel_network_settings_dup_host (network_settings);
user = camel_network_settings_dup_user (network_settings);
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
tcp_stream = camel_network_service_connect_sync (
CAMEL_NETWORK_SERVICE (service), cancellable, error);
store->current_folder = NULL;
fail:
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
g_free (host);
g_free (user);
store->capabilities = 0;
/* disconnect and reconnect without capability check */
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
if (store->stream)
g_object_unref (store->stream);
g_free (store->current_folder);
store->current_folder = NULL;
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return connect_to_server (service, cancellable, error);
}
CamelNNTPStore *store = CAMEL_NNTP_STORE (service);
gchar *line;
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (clean)
camel_nntp_raw_command (store, cancellable, NULL, &line, "quit");
g_free (store->current_folder);
store->current_folder = NULL;
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return TRUE;
}
GCancellable *cancellable,
GError **error)
{
- CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (store);
- CamelFolder *folder;
-
- camel_service_lock (
- CAMEL_SERVICE (nntp_store),
- CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- folder = camel_nntp_folder_new (
+ return camel_nntp_folder_new (
store, folder_name, cancellable, error);
-
- camel_service_unlock (
- CAMEL_SERVICE (nntp_store),
- CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- return folder;
}
/*
if (folder) {
CamelFolderChangeInfo *changes = NULL;
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
if (camel_nntp_command (store, cancellable, NULL, folder, &line, NULL) != -1) {
if (camel_folder_change_info_changed (folder->changes)) {
changes = folder->changes;
folder->changes = camel_folder_change_info_new ();
}
}
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
if (changes) {
camel_folder_changed (CAMEL_FOLDER (folder), changes);
camel_folder_change_info_free (changes);
gint ret = -1;
CamelFolderInfo *fi = NULL;
- camel_service_lock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (top == NULL)
top = "";
}
fi = nntp_store_get_cached_folder_info (nntp_store, top, flags, error);
- error:
- camel_service_unlock (CAMEL_SERVICE (nntp_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
+error:
return fi;
}
short_folder_names = camel_nntp_settings_get_short_folder_names (
CAMEL_NNTP_SETTINGS (settings));
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
si = camel_store_summary_path (CAMEL_STORE_SUMMARY (nntp_store->summary), folder_name);
if (!si) {
g_set_error (
fi->flags |= CAMEL_FOLDER_NOINFERIORS | CAMEL_FOLDER_NOCHILDREN;
camel_store_summary_touch ((CamelStoreSummary *) nntp_store->summary);
camel_store_summary_save ((CamelStoreSummary *) nntp_store->summary);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
camel_subscribable_folder_subscribed (subscribable, fi);
camel_folder_info_free (fi);
- return TRUE;
}
}
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return success;
}
short_folder_names = camel_nntp_settings_get_short_folder_names (
CAMEL_NNTP_SETTINGS (settings));
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
fitem = camel_store_summary_path (CAMEL_STORE_SUMMARY (nntp_store->summary), folder_name);
if (!fitem) {
fi = nntp_folder_info_from_store_info (nntp_store, short_folder_names, fitem);
camel_store_summary_touch ((CamelStoreSummary *) nntp_store->summary);
camel_store_summary_save ((CamelStoreSummary *) nntp_store->summary);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
camel_subscribable_folder_unsubscribed (subscribable, fi);
camel_folder_info_free (fi);
- return TRUE;
}
}
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return success;
}
camel_service_get_settings
camel_service_set_settings
camel_service_get_uid
-CamelServiceLock
-camel_service_lock
-camel_service_unlock
camel_service_connect_sync
camel_service_connect
camel_service_connect_finish