|
|
9cfe9a |
diff -up evolution-data-server-3.8.5/camel/camel.h.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel.h
|
|
|
9cfe9a |
--- evolution-data-server-3.8.5/camel/camel.h.kill-imapx-conn-manager 2013-07-23 07:57:56.000000000 -0400
|
|
|
9cfe9a |
+++ evolution-data-server-3.8.5/camel/camel.h 2013-09-12 15:51:33.362412243 -0400
|
|
|
9cfe9a |
@@ -144,7 +144,6 @@
|
|
|
9cfe9a |
#include <camel/camel-vtrash-folder.h>
|
|
|
9cfe9a |
#include <camel/camel-imapx-command.h>
|
|
|
9cfe9a |
#include <camel/camel-imapx-job.h>
|
|
|
9cfe9a |
-#include <camel/camel-imapx-conn-manager.h>
|
|
|
9cfe9a |
#include <camel/camel-imapx-folder.h>
|
|
|
9cfe9a |
#include <camel/camel-imapx-search.h>
|
|
|
9cfe9a |
#include <camel/camel-imapx-server.h>
|
|
|
9cfe9a |
diff -up evolution-data-server-3.8.5/camel/camel-imapx-conn-manager.c.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-conn-manager.c
|
|
|
9cfe9a |
diff -up evolution-data-server-3.8.5/camel/camel-imapx-conn-manager.h.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-conn-manager.h
|
|
|
9cfe9a |
diff -up evolution-data-server-3.8.5/camel/camel-imapx-folder.c.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-folder.c
|
|
|
9cfe9a |
--- evolution-data-server-3.8.5/camel/camel-imapx-folder.c.kill-imapx-conn-manager 2013-07-23 08:01:51.000000000 -0400
|
|
|
9cfe9a |
+++ evolution-data-server-3.8.5/camel/camel-imapx-folder.c 2013-09-12 15:51:33.323412254 -0400
|
|
|
9cfe9a |
@@ -178,7 +178,7 @@ static void
|
|
|
9cfe9a |
imapx_folder_dispose (GObject *object)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
CamelIMAPXFolder *folder = CAMEL_IMAPX_FOLDER (object);
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
if (folder->cache != NULL) {
|
|
|
9cfe9a |
g_object_unref (folder->cache);
|
|
|
9cfe9a |
@@ -190,10 +190,10 @@ imapx_folder_dispose (GObject *object)
|
|
|
9cfe9a |
folder->search = NULL;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (CAMEL_FOLDER (folder));
|
|
|
9cfe9a |
- if (parent_store) {
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (CAMEL_FOLDER (folder));
|
|
|
9cfe9a |
+ if (store != NULL) {
|
|
|
9cfe9a |
camel_store_summary_disconnect_folder_summary (
|
|
|
9cfe9a |
- (CamelStoreSummary *) ((CamelIMAPXStore *) parent_store)->summary,
|
|
|
9cfe9a |
+ (CamelStoreSummary *) ((CamelIMAPXStore *) store)->summary,
|
|
|
9cfe9a |
CAMEL_FOLDER (folder)->summary);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -283,15 +283,17 @@ static void
|
|
|
9cfe9a |
imapx_search_free (CamelFolder *folder,
|
|
|
9cfe9a |
GPtrArray *uids)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXFolder *ifolder = CAMEL_IMAPX_FOLDER (folder);
|
|
|
9cfe9a |
+ CamelIMAPXFolder *imapx_folder;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_return_if_fail (ifolder->search);
|
|
|
9cfe9a |
+ imapx_folder = CAMEL_IMAPX_FOLDER (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_mutex_lock (&ifolder->search_lock);
|
|
|
9cfe9a |
+ g_return_if_fail (imapx_folder->search);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- camel_folder_search_free_result (ifolder->search, uids);
|
|
|
9cfe9a |
+ g_mutex_lock (&imapx_folder->search_lock);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_mutex_unlock (&ifolder->search_lock);
|
|
|
9cfe9a |
+ camel_folder_search_free_result (imapx_folder->search, uids);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_mutex_unlock (&imapx_folder->search_lock);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
static GPtrArray *
|
|
|
9cfe9a |
@@ -301,48 +303,37 @@ imapx_search_by_uids (CamelFolder *folde
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXFolder *ifolder;
|
|
|
9cfe9a |
- CamelIMAPXSearch *isearch;
|
|
|
9cfe9a |
- CamelIMAPXServer *server = NULL;
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXFolder *imapx_folder;
|
|
|
9cfe9a |
+ CamelIMAPXSearch *imapx_search;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
GPtrArray *matches;
|
|
|
9cfe9a |
- const gchar *folder_name;
|
|
|
9cfe9a |
- gboolean online;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
if (uids->len == 0)
|
|
|
9cfe9a |
return g_ptr_array_new ();
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- ifolder = CAMEL_IMAPX_FOLDER (folder);
|
|
|
9cfe9a |
- folder_name = camel_folder_get_full_name (folder);
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- online = camel_offline_store_get_online (
|
|
|
9cfe9a |
- CAMEL_OFFLINE_STORE (parent_store));
|
|
|
9cfe9a |
+ imapx_folder = CAMEL_IMAPX_FOLDER (folder);
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (online) {
|
|
|
9cfe9a |
- /* do not panic when the server cannot be reached for whatever reason,
|
|
|
9cfe9a |
- * show offline data at least */
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (
|
|
|
9cfe9a |
- CAMEL_IMAPX_STORE (parent_store),
|
|
|
9cfe9a |
- folder_name, cancellable, NULL);
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, NULL);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_mutex_lock (&ifolder->search_lock);
|
|
|
9cfe9a |
+ g_mutex_lock (&imapx_folder->search_lock);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- isearch = CAMEL_IMAPX_SEARCH (ifolder->search);
|
|
|
9cfe9a |
- camel_imapx_search_set_server (isearch, server);
|
|
|
9cfe9a |
+ imapx_search = CAMEL_IMAPX_SEARCH (imapx_folder->search);
|
|
|
9cfe9a |
+ camel_imapx_search_set_server (imapx_search, imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- camel_folder_search_set_folder (ifolder->search, folder);
|
|
|
9cfe9a |
+ camel_folder_search_set_folder (imapx_folder->search, folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
matches = camel_folder_search_search (
|
|
|
9cfe9a |
- ifolder->search, expression, uids, cancellable, error);
|
|
|
9cfe9a |
+ imapx_folder->search, expression, uids, cancellable, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- camel_imapx_search_set_server (isearch, NULL);
|
|
|
9cfe9a |
+ camel_imapx_search_set_server (imapx_search, NULL);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_mutex_unlock (&ifolder->search_lock);
|
|
|
9cfe9a |
+ g_mutex_unlock (&imapx_folder->search_lock);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (server != NULL)
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
return matches;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
@@ -353,45 +344,34 @@ imapx_count_by_expression (CamelFolder *
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXFolder *ifolder;
|
|
|
9cfe9a |
- CamelIMAPXSearch *isearch;
|
|
|
9cfe9a |
- CamelIMAPXServer *server = NULL;
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
- const gchar *folder_name;
|
|
|
9cfe9a |
- gboolean online;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXFolder *imapx_folder;
|
|
|
9cfe9a |
+ CamelIMAPXSearch *imapx_search;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
guint32 matches;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- ifolder = CAMEL_IMAPX_FOLDER (folder);
|
|
|
9cfe9a |
- folder_name = camel_folder_get_full_name (folder);
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- online = camel_offline_store_get_online (
|
|
|
9cfe9a |
- CAMEL_OFFLINE_STORE (parent_store));
|
|
|
9cfe9a |
+ imapx_folder = CAMEL_IMAPX_FOLDER (folder);
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (online) {
|
|
|
9cfe9a |
- /* do not panic when the server cannot be reached for whatever reason,
|
|
|
9cfe9a |
- * show offline data at least */
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (
|
|
|
9cfe9a |
- CAMEL_IMAPX_STORE (parent_store),
|
|
|
9cfe9a |
- folder_name, cancellable, NULL);
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, NULL);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_mutex_lock (&ifolder->search_lock);
|
|
|
9cfe9a |
+ g_mutex_lock (&imapx_folder->search_lock);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- isearch = CAMEL_IMAPX_SEARCH (ifolder->search);
|
|
|
9cfe9a |
- camel_imapx_search_set_server (isearch, server);
|
|
|
9cfe9a |
+ imapx_search = CAMEL_IMAPX_SEARCH (imapx_folder->search);
|
|
|
9cfe9a |
+ camel_imapx_search_set_server (imapx_search, imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- camel_folder_search_set_folder (ifolder->search, folder);
|
|
|
9cfe9a |
+ camel_folder_search_set_folder (imapx_folder->search, folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
matches = camel_folder_search_count (
|
|
|
9cfe9a |
- ifolder->search, expression, cancellable, error);
|
|
|
9cfe9a |
+ imapx_folder->search, expression, cancellable, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- camel_imapx_search_set_server (isearch, NULL);
|
|
|
9cfe9a |
+ camel_imapx_search_set_server (imapx_search, NULL);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_mutex_unlock (&ifolder->search_lock);
|
|
|
9cfe9a |
+ g_mutex_unlock (&imapx_folder->search_lock);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (server != NULL)
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
return matches;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
@@ -402,45 +382,34 @@ imapx_search_by_expression (CamelFolder
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXFolder *ifolder;
|
|
|
9cfe9a |
- CamelIMAPXSearch *isearch;
|
|
|
9cfe9a |
- CamelIMAPXServer *server = NULL;
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXFolder *imapx_folder;
|
|
|
9cfe9a |
+ CamelIMAPXSearch *imapx_search;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
GPtrArray *matches;
|
|
|
9cfe9a |
- const gchar *folder_name;
|
|
|
9cfe9a |
- gboolean online;
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- ifolder = CAMEL_IMAPX_FOLDER (folder);
|
|
|
9cfe9a |
- folder_name = camel_folder_get_full_name (folder);
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- online = camel_offline_store_get_online (
|
|
|
9cfe9a |
- CAMEL_OFFLINE_STORE (parent_store));
|
|
|
9cfe9a |
+ imapx_folder = CAMEL_IMAPX_FOLDER (folder);
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (online) {
|
|
|
9cfe9a |
- /* do not panic when the server cannot be reached for whatever reason,
|
|
|
9cfe9a |
- * show offline data at least */
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (
|
|
|
9cfe9a |
- CAMEL_IMAPX_STORE (parent_store),
|
|
|
9cfe9a |
- folder_name, cancellable, NULL);
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, NULL);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_mutex_lock (&ifolder->search_lock);
|
|
|
9cfe9a |
+ g_mutex_lock (&imapx_folder->search_lock);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- isearch = CAMEL_IMAPX_SEARCH (ifolder->search);
|
|
|
9cfe9a |
- camel_imapx_search_set_server (isearch, server);
|
|
|
9cfe9a |
+ imapx_search = CAMEL_IMAPX_SEARCH (imapx_folder->search);
|
|
|
9cfe9a |
+ camel_imapx_search_set_server (imapx_search, imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- camel_folder_search_set_folder (ifolder->search, folder);
|
|
|
9cfe9a |
+ camel_folder_search_set_folder (imapx_folder->search, folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
matches = camel_folder_search_search (
|
|
|
9cfe9a |
- ifolder->search, expression, NULL, cancellable, error);
|
|
|
9cfe9a |
+ imapx_folder->search, expression, NULL, cancellable, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- camel_imapx_search_set_server (isearch, NULL);
|
|
|
9cfe9a |
+ camel_imapx_search_set_server (imapx_search, NULL);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_mutex_unlock (&ifolder->search_lock);
|
|
|
9cfe9a |
+ g_mutex_unlock (&imapx_folder->search_lock);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (server != NULL)
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
return matches;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
@@ -450,9 +419,12 @@ imapx_get_filename (CamelFolder *folder,
|
|
|
9cfe9a |
const gchar *uid,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *) folder;
|
|
|
9cfe9a |
+ CamelIMAPXFolder *imapx_folder;
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ imapx_folder = CAMEL_IMAPX_FOLDER (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- return camel_data_cache_get_filename (ifolder->cache, "cache", uid);
|
|
|
9cfe9a |
+ return camel_data_cache_get_filename (
|
|
|
9cfe9a |
+ imapx_folder->cache, "cache", uid);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
static gboolean
|
|
|
9cfe9a |
@@ -463,32 +435,27 @@ imapx_append_message_sync (CamelFolder *
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
- CamelIMAPXStore *istore;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
gboolean success = FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
- istore = CAMEL_IMAPX_STORE (parent_store);
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
|
|
|
9cfe9a |
- g_set_error (
|
|
|
9cfe9a |
- error, CAMEL_SERVICE_ERROR,
|
|
|
9cfe9a |
- CAMEL_SERVICE_ERROR_UNAVAILABLE,
|
|
|
9cfe9a |
- _("You must be working online to complete this operation"));
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (appended_uid)
|
|
|
9cfe9a |
+ if (appended_uid != NULL)
|
|
|
9cfe9a |
*appended_uid = NULL;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (istore, NULL, cancellable, error);
|
|
|
9cfe9a |
- if (server) {
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
success = camel_imapx_server_append_message (
|
|
|
9cfe9a |
- server, folder, message, info, appended_uid, cancellable, error);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ imapx_server, folder, message, info,
|
|
|
9cfe9a |
+ appended_uid, cancellable, error);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -497,33 +464,23 @@ imapx_expunge_sync (CamelFolder *folder,
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
- CamelIMAPXStore *istore;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
- const gchar *folder_name;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
gboolean success = FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- folder_name = camel_folder_get_full_name (folder);
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
- istore = CAMEL_IMAPX_STORE (parent_store);
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
|
|
|
9cfe9a |
- g_set_error (
|
|
|
9cfe9a |
- error, CAMEL_SERVICE_ERROR,
|
|
|
9cfe9a |
- CAMEL_SERVICE_ERROR_UNAVAILABLE,
|
|
|
9cfe9a |
- _("You must be working online to complete this operation"));
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (
|
|
|
9cfe9a |
- istore, folder_name, cancellable, error);
|
|
|
9cfe9a |
- if (server != NULL) {
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
success = camel_imapx_server_expunge (
|
|
|
9cfe9a |
- server, folder, cancellable, error);
|
|
|
9cfe9a |
- camel_imapx_store_op_done (istore, server, folder_name);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ imapx_server, folder, cancellable, error);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -534,38 +491,23 @@ imapx_fetch_messages_sync (CamelFolder *
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelService *service;
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
- CamelIMAPXStore *istore;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
- const gchar *folder_name;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
gboolean success = FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- folder_name = camel_folder_get_full_name (folder);
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
- istore = CAMEL_IMAPX_STORE (parent_store);
|
|
|
9cfe9a |
- service = CAMEL_SERVICE (parent_store);
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
|
|
|
9cfe9a |
- g_set_error (
|
|
|
9cfe9a |
- error, CAMEL_SERVICE_ERROR,
|
|
|
9cfe9a |
- CAMEL_SERVICE_ERROR_UNAVAILABLE,
|
|
|
9cfe9a |
- _("You must be working online to complete this operation"));
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_service_connect_sync (service, cancellable, error))
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (
|
|
|
9cfe9a |
- istore, folder_name, cancellable, error);
|
|
|
9cfe9a |
- if (server != NULL) {
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
success = camel_imapx_server_fetch_messages (
|
|
|
9cfe9a |
- server, folder, type, limit, cancellable, error);
|
|
|
9cfe9a |
- camel_imapx_store_op_done (istore, server, folder_name);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ imapx_server, folder, type, limit, cancellable, error);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -577,17 +519,13 @@ imapx_get_message_sync (CamelFolder *fol
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
CamelMimeMessage *msg = NULL;
|
|
|
9cfe9a |
CamelStream *stream = NULL;
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
- CamelIMAPXStore *istore;
|
|
|
9cfe9a |
- CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *) folder;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
- const gchar *folder_name;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
+ CamelIMAPXFolder *imapx_folder;
|
|
|
9cfe9a |
const gchar *path = NULL;
|
|
|
9cfe9a |
gboolean offline_message = FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- folder_name = camel_folder_get_full_name (folder);
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
- istore = CAMEL_IMAPX_STORE (parent_store);
|
|
|
9cfe9a |
+ imapx_folder = CAMEL_IMAPX_FOLDER (folder);
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
if (!strchr (uid, '-'))
|
|
|
9cfe9a |
path = "cur";
|
|
|
9cfe9a |
@@ -596,8 +534,10 @@ imapx_get_message_sync (CamelFolder *fol
|
|
|
9cfe9a |
offline_message = TRUE;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- stream = camel_data_cache_get (ifolder->cache, path, uid, NULL);
|
|
|
9cfe9a |
+ stream = camel_data_cache_get (imapx_folder->cache, path, uid, NULL);
|
|
|
9cfe9a |
if (stream == NULL) {
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
if (offline_message) {
|
|
|
9cfe9a |
g_set_error (
|
|
|
9cfe9a |
error, CAMEL_FOLDER_ERROR,
|
|
|
9cfe9a |
@@ -606,23 +546,15 @@ imapx_get_message_sync (CamelFolder *fol
|
|
|
9cfe9a |
return NULL;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
|
|
|
9cfe9a |
- g_set_error (
|
|
|
9cfe9a |
- error, CAMEL_SERVICE_ERROR,
|
|
|
9cfe9a |
- CAMEL_SERVICE_ERROR_UNAVAILABLE,
|
|
|
9cfe9a |
- _("You must be working online to complete this operation"));
|
|
|
9cfe9a |
- return NULL;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (
|
|
|
9cfe9a |
+ CAMEL_IMAPX_STORE (store), error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (
|
|
|
9cfe9a |
- istore, folder_name, cancellable, error);
|
|
|
9cfe9a |
- if (server == NULL)
|
|
|
9cfe9a |
- return NULL;
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
+ stream = camel_imapx_server_get_message (
|
|
|
9cfe9a |
+ imapx_server, folder, uid, cancellable, error);
|
|
|
9cfe9a |
+ }
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- stream = camel_imapx_server_get_message (
|
|
|
9cfe9a |
- server, folder, uid, cancellable, error);
|
|
|
9cfe9a |
- camel_imapx_store_op_done (istore, server, folder_name);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
if (stream != NULL) {
|
|
|
9cfe9a |
@@ -630,14 +562,14 @@ imapx_get_message_sync (CamelFolder *fol
|
|
|
9cfe9a |
|
|
|
9cfe9a |
msg = camel_mime_message_new ();
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_mutex_lock (&ifolder->stream_lock);
|
|
|
9cfe9a |
+ g_mutex_lock (&imapx_folder->stream_lock);
|
|
|
9cfe9a |
success = camel_data_wrapper_construct_from_stream_sync (
|
|
|
9cfe9a |
CAMEL_DATA_WRAPPER (msg), stream, cancellable, error);
|
|
|
9cfe9a |
if (!success) {
|
|
|
9cfe9a |
g_object_unref (msg);
|
|
|
9cfe9a |
msg = NULL;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
- g_mutex_unlock (&ifolder->stream_lock);
|
|
|
9cfe9a |
+ g_mutex_unlock (&imapx_folder->stream_lock);
|
|
|
9cfe9a |
g_object_unref (stream);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -670,26 +602,27 @@ imapx_get_quota_info_sync (CamelFolder *
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
CamelFolderQuotaInfo *quota_info = NULL;
|
|
|
9cfe9a |
const gchar *folder_name;
|
|
|
9cfe9a |
gchar **quota_root_names;
|
|
|
9cfe9a |
gboolean success = FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
folder_name = camel_folder_get_full_name (folder);
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (
|
|
|
9cfe9a |
- CAMEL_IMAPX_STORE (parent_store),
|
|
|
9cfe9a |
- folder_name, cancellable, error);
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (server != NULL) {
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
success = camel_imapx_server_update_quota_info (
|
|
|
9cfe9a |
- server, folder_name, cancellable, error);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ imapx_server, folder_name, cancellable, error);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
if (!success)
|
|
|
9cfe9a |
return NULL;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -699,7 +632,7 @@ imapx_get_quota_info_sync (CamelFolder *
|
|
|
9cfe9a |
/* XXX Just return info for the first quota root name, I guess. */
|
|
|
9cfe9a |
if (quota_root_names != NULL && quota_root_names[0] != NULL)
|
|
|
9cfe9a |
quota_info = camel_imapx_store_dup_quota_info (
|
|
|
9cfe9a |
- CAMEL_IMAPX_STORE (parent_store),
|
|
|
9cfe9a |
+ CAMEL_IMAPX_STORE (store),
|
|
|
9cfe9a |
quota_root_names[0]);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
g_strfreev (quota_root_names);
|
|
|
9cfe9a |
@@ -729,44 +662,29 @@ imapx_refresh_info_sync (CamelFolder *fo
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelService *service;
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
- CamelIMAPXStore *istore;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
- const gchar *folder_name;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
gboolean success = FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- folder_name = camel_folder_get_full_name (folder);
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
- istore = CAMEL_IMAPX_STORE (parent_store);
|
|
|
9cfe9a |
- service = CAMEL_SERVICE (parent_store);
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
|
|
|
9cfe9a |
- g_set_error (
|
|
|
9cfe9a |
- error, CAMEL_SERVICE_ERROR,
|
|
|
9cfe9a |
- CAMEL_SERVICE_ERROR_UNAVAILABLE,
|
|
|
9cfe9a |
- _("You must be working online to complete this operation"));
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_service_connect_sync (service, cancellable, error))
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (
|
|
|
9cfe9a |
- istore, folder_name, cancellable, error);
|
|
|
9cfe9a |
- if (server != NULL) {
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
success = camel_imapx_server_refresh_info (
|
|
|
9cfe9a |
- server, folder, cancellable, error);
|
|
|
9cfe9a |
- camel_imapx_store_op_done (istore, server, folder_name);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ imapx_server, folder, cancellable, error);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
/* Helper for imapx_synchronize_sync() */
|
|
|
9cfe9a |
static gboolean
|
|
|
9cfe9a |
-imapx_move_to_real_junk (CamelIMAPXServer *server,
|
|
|
9cfe9a |
+imapx_move_to_real_junk (CamelIMAPXServer *imapx_server,
|
|
|
9cfe9a |
CamelFolder *folder,
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
gboolean *out_need_to_expunge,
|
|
|
9cfe9a |
@@ -782,7 +700,7 @@ imapx_move_to_real_junk (CamelIMAPXServe
|
|
|
9cfe9a |
uids_to_copy = g_ptr_array_new_with_free_func (
|
|
|
9cfe9a |
(GDestroyNotify) camel_pstring_free);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- settings = camel_imapx_server_ref_settings (server);
|
|
|
9cfe9a |
+ settings = camel_imapx_server_ref_settings (imapx_server);
|
|
|
9cfe9a |
if (camel_imapx_settings_get_use_real_junk_path (settings)) {
|
|
|
9cfe9a |
real_junk_path =
|
|
|
9cfe9a |
camel_imapx_settings_dup_real_junk_path (settings);
|
|
|
9cfe9a |
@@ -795,7 +713,7 @@ imapx_move_to_real_junk (CamelIMAPXServe
|
|
|
9cfe9a |
CamelFolder *destination = NULL;
|
|
|
9cfe9a |
CamelIMAPXStore *store;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- store = camel_imapx_server_ref_store (server);
|
|
|
9cfe9a |
+ store = camel_imapx_server_ref_store (imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
if (real_junk_path != NULL) {
|
|
|
9cfe9a |
destination = camel_store_get_folder_sync (
|
|
|
9cfe9a |
@@ -814,7 +732,8 @@ imapx_move_to_real_junk (CamelIMAPXServe
|
|
|
9cfe9a |
success = TRUE;
|
|
|
9cfe9a |
} else if (destination != NULL) {
|
|
|
9cfe9a |
success = camel_imapx_server_copy_message (
|
|
|
9cfe9a |
- server, folder, destination,
|
|
|
9cfe9a |
+ imapx_server,
|
|
|
9cfe9a |
+ folder, destination,
|
|
|
9cfe9a |
uids_to_copy, TRUE,
|
|
|
9cfe9a |
cancellable, error);
|
|
|
9cfe9a |
*out_need_to_expunge = success;
|
|
|
9cfe9a |
@@ -839,7 +758,7 @@ imapx_move_to_real_junk (CamelIMAPXServe
|
|
|
9cfe9a |
|
|
|
9cfe9a |
/* Helper for imapx_synchronize_sync() */
|
|
|
9cfe9a |
static gboolean
|
|
|
9cfe9a |
-imapx_move_to_real_trash (CamelIMAPXServer *server,
|
|
|
9cfe9a |
+imapx_move_to_real_trash (CamelIMAPXServer *imapx_server,
|
|
|
9cfe9a |
CamelFolder *folder,
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
gboolean *out_need_to_expunge,
|
|
|
9cfe9a |
@@ -855,7 +774,7 @@ imapx_move_to_real_trash (CamelIMAPXServ
|
|
|
9cfe9a |
uids_to_copy = g_ptr_array_new_with_free_func (
|
|
|
9cfe9a |
(GDestroyNotify) camel_pstring_free);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- settings = camel_imapx_server_ref_settings (server);
|
|
|
9cfe9a |
+ settings = camel_imapx_server_ref_settings (imapx_server);
|
|
|
9cfe9a |
if (camel_imapx_settings_get_use_real_trash_path (settings)) {
|
|
|
9cfe9a |
real_trash_path =
|
|
|
9cfe9a |
camel_imapx_settings_dup_real_trash_path (settings);
|
|
|
9cfe9a |
@@ -868,7 +787,7 @@ imapx_move_to_real_trash (CamelIMAPXServ
|
|
|
9cfe9a |
CamelFolder *destination = NULL;
|
|
|
9cfe9a |
CamelIMAPXStore *store;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- store = camel_imapx_server_ref_store (server);
|
|
|
9cfe9a |
+ store = camel_imapx_server_ref_store (imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
if (real_trash_path != NULL) {
|
|
|
9cfe9a |
destination = camel_store_get_folder_sync (
|
|
|
9cfe9a |
@@ -887,7 +806,8 @@ imapx_move_to_real_trash (CamelIMAPXServ
|
|
|
9cfe9a |
success = TRUE;
|
|
|
9cfe9a |
} else if (destination != NULL) {
|
|
|
9cfe9a |
success = camel_imapx_server_copy_message (
|
|
|
9cfe9a |
- server, folder, destination,
|
|
|
9cfe9a |
+ imapx_server,
|
|
|
9cfe9a |
+ folder, destination,
|
|
|
9cfe9a |
uids_to_copy, TRUE,
|
|
|
9cfe9a |
cancellable, error);
|
|
|
9cfe9a |
*out_need_to_expunge = success;
|
|
|
9cfe9a |
@@ -916,42 +836,32 @@ imapx_synchronize_sync (CamelFolder *fol
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
- CamelIMAPXStore *istore;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
- const gchar *folder_name;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
gboolean success = FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- folder_name = camel_folder_get_full_name (folder);
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
- istore = CAMEL_IMAPX_STORE (parent_store);
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
|
|
|
9cfe9a |
- g_set_error (
|
|
|
9cfe9a |
- error, CAMEL_SERVICE_ERROR,
|
|
|
9cfe9a |
- CAMEL_SERVICE_ERROR_UNAVAILABLE,
|
|
|
9cfe9a |
- _("You must be working online to complete this operation"));
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (
|
|
|
9cfe9a |
- istore, folder_name, cancellable, error);
|
|
|
9cfe9a |
- if (server != NULL) {
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
gboolean need_to_expunge;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
success = camel_imapx_server_sync_changes (
|
|
|
9cfe9a |
- server, folder, cancellable, error);
|
|
|
9cfe9a |
+ imapx_server, folder, cancellable, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
if (success) {
|
|
|
9cfe9a |
success = imapx_move_to_real_junk (
|
|
|
9cfe9a |
- server, folder, cancellable,
|
|
|
9cfe9a |
+ imapx_server, folder, cancellable,
|
|
|
9cfe9a |
&need_to_expunge, error);
|
|
|
9cfe9a |
expunge |= need_to_expunge;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
if (success) {
|
|
|
9cfe9a |
success = imapx_move_to_real_trash (
|
|
|
9cfe9a |
- server, folder, cancellable,
|
|
|
9cfe9a |
+ imapx_server, folder, cancellable,
|
|
|
9cfe9a |
&need_to_expunge, error);
|
|
|
9cfe9a |
expunge |= need_to_expunge;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
@@ -961,12 +871,11 @@ imapx_synchronize_sync (CamelFolder *fol
|
|
|
9cfe9a |
|
|
|
9cfe9a |
if (success && expunge)
|
|
|
9cfe9a |
success = camel_imapx_server_expunge (
|
|
|
9cfe9a |
- server, folder, cancellable, error);
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- camel_imapx_store_op_done (istore, server, folder_name);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ imapx_server, folder, cancellable, error);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -976,33 +885,23 @@ imapx_synchronize_message_sync (CamelFol
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
- CamelIMAPXStore *istore;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
- const gchar *folder_name;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
gboolean success = FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- folder_name = camel_folder_get_full_name (folder);
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
- istore = CAMEL_IMAPX_STORE (parent_store);
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
|
|
|
9cfe9a |
- g_set_error (
|
|
|
9cfe9a |
- error, CAMEL_SERVICE_ERROR,
|
|
|
9cfe9a |
- CAMEL_SERVICE_ERROR_UNAVAILABLE,
|
|
|
9cfe9a |
- _("You must be working online to complete this operation"));
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (
|
|
|
9cfe9a |
- istore, folder_name, cancellable, error);
|
|
|
9cfe9a |
- if (server != NULL) {
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
success = camel_imapx_server_sync_message (
|
|
|
9cfe9a |
- server, folder, uid, cancellable, error);
|
|
|
9cfe9a |
- camel_imapx_store_op_done (istore, server, folder_name);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ imapx_server, folder, uid, cancellable, error);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -1015,39 +914,29 @@ imapx_transfer_messages_to_sync (CamelFo
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
- CamelIMAPXStore *istore;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
- const gchar *folder_name;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
gboolean success = FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- folder_name = camel_folder_get_full_name (source);
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (source);
|
|
|
9cfe9a |
- istore = CAMEL_IMAPX_STORE (parent_store);
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (source);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (istore))) {
|
|
|
9cfe9a |
- g_set_error (
|
|
|
9cfe9a |
- error, CAMEL_SERVICE_ERROR,
|
|
|
9cfe9a |
- CAMEL_SERVICE_ERROR_UNAVAILABLE,
|
|
|
9cfe9a |
- _("You must be working online to complete this operation"));
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (
|
|
|
9cfe9a |
- istore, folder_name, cancellable, error);
|
|
|
9cfe9a |
- if (server != NULL) {
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
success = camel_imapx_server_copy_message (
|
|
|
9cfe9a |
- server, source, dest, uids,
|
|
|
9cfe9a |
+ imapx_server, source, dest, uids,
|
|
|
9cfe9a |
delete_originals, cancellable, error);
|
|
|
9cfe9a |
- camel_imapx_store_op_done (istore, server, folder_name);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ /* Update destination folder only if it's not frozen,
|
|
|
9cfe9a |
+ * to avoid updating for each "move" action on a single
|
|
|
9cfe9a |
+ * message while filtering. */
|
|
|
9cfe9a |
+ if (!camel_folder_is_frozen (dest))
|
|
|
9cfe9a |
+ imapx_refresh_info_sync (dest, cancellable, NULL);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- /* update destination folder only if not frozen, to not update
|
|
|
9cfe9a |
- * for each single message transfer during filtering
|
|
|
9cfe9a |
- */
|
|
|
9cfe9a |
- if (!camel_folder_is_frozen (dest))
|
|
|
9cfe9a |
- imapx_refresh_info_sync (dest, cancellable, NULL);
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
@@ -1056,15 +945,15 @@ static void
|
|
|
9cfe9a |
imapx_rename (CamelFolder *folder,
|
|
|
9cfe9a |
const gchar *new_name)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelStore *parent_store;
|
|
|
9cfe9a |
- CamelIMAPXStore *istore;
|
|
|
9cfe9a |
+ CamelStore *store;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
const gchar *folder_name;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- parent_store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
- istore = CAMEL_IMAPX_STORE (parent_store);
|
|
|
9cfe9a |
+ store = camel_folder_get_parent_store (folder);
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
camel_store_summary_disconnect_folder_summary (
|
|
|
9cfe9a |
- CAMEL_STORE_SUMMARY (istore->summary),
|
|
|
9cfe9a |
+ CAMEL_STORE_SUMMARY (imapx_store->summary),
|
|
|
9cfe9a |
folder->summary);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
/* Chain up to parent's rename() method. */
|
|
|
9cfe9a |
@@ -1074,7 +963,7 @@ imapx_rename (CamelFolder *folder,
|
|
|
9cfe9a |
folder_name = camel_folder_get_full_name (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
camel_store_summary_connect_folder_summary (
|
|
|
9cfe9a |
- CAMEL_STORE_SUMMARY (istore->summary),
|
|
|
9cfe9a |
+ CAMEL_STORE_SUMMARY (imapx_store->summary),
|
|
|
9cfe9a |
folder_name, folder->summary);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -1182,7 +1071,7 @@ camel_imapx_folder_new (CamelStore *stor
|
|
|
9cfe9a |
CamelFolder *folder;
|
|
|
9cfe9a |
CamelService *service;
|
|
|
9cfe9a |
CamelSettings *settings;
|
|
|
9cfe9a |
- CamelIMAPXFolder *ifolder;
|
|
|
9cfe9a |
+ CamelIMAPXFolder *imapx_folder;
|
|
|
9cfe9a |
const gchar *short_name;
|
|
|
9cfe9a |
gchar *state_file;
|
|
|
9cfe9a |
gboolean filter_all;
|
|
|
9cfe9a |
@@ -1217,12 +1106,9 @@ camel_imapx_folder_new (CamelStore *stor
|
|
|
9cfe9a |
"display-name", short_name,
|
|
|
9cfe9a |
"full_name", folder_name,
|
|
|
9cfe9a |
"parent-store", store, NULL);
|
|
|
9cfe9a |
- ifolder = (CamelIMAPXFolder *) folder;
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- ((CamelIMAPXFolder *) folder)->raw_name = g_strdup (folder_name);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
folder->summary = camel_imapx_summary_new (folder);
|
|
|
9cfe9a |
- if (!folder->summary) {
|
|
|
9cfe9a |
+ if (folder->summary == NULL) {
|
|
|
9cfe9a |
g_set_error (
|
|
|
9cfe9a |
error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
|
|
|
9cfe9a |
_("Could not create folder summary for %s"),
|
|
|
9cfe9a |
@@ -1230,8 +1116,9 @@ camel_imapx_folder_new (CamelStore *stor
|
|
|
9cfe9a |
return NULL;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- ifolder->cache = camel_data_cache_new (folder_dir, error);
|
|
|
9cfe9a |
- if (!ifolder->cache) {
|
|
|
9cfe9a |
+ imapx_folder = CAMEL_IMAPX_FOLDER (folder);
|
|
|
9cfe9a |
+ imapx_folder->cache = camel_data_cache_new (folder_dir, error);
|
|
|
9cfe9a |
+ if (imapx_folder->cache == NULL) {
|
|
|
9cfe9a |
g_prefix_error (
|
|
|
9cfe9a |
error, _("Could not create cache for %s: "),
|
|
|
9cfe9a |
short_name);
|
|
|
9cfe9a |
@@ -1243,25 +1130,33 @@ camel_imapx_folder_new (CamelStore *stor
|
|
|
9cfe9a |
g_free (state_file);
|
|
|
9cfe9a |
camel_object_state_read (CAMEL_OBJECT (folder));
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- ifolder->search = camel_imapx_search_new ();
|
|
|
9cfe9a |
- g_mutex_init (&ifolder->search_lock);
|
|
|
9cfe9a |
- g_mutex_init (&ifolder->stream_lock);
|
|
|
9cfe9a |
- ifolder->ignore_recent = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
|
|
|
9cfe9a |
- ifolder->exists_on_server = 0;
|
|
|
9cfe9a |
- ifolder->unread_on_server = 0;
|
|
|
9cfe9a |
- ifolder->modseq_on_server = 0;
|
|
|
9cfe9a |
- ifolder->uidnext_on_server = 0;
|
|
|
9cfe9a |
+ imapx_folder->search = camel_imapx_search_new ();
|
|
|
9cfe9a |
+ g_mutex_init (&imapx_folder->search_lock);
|
|
|
9cfe9a |
+ g_mutex_init (&imapx_folder->stream_lock);
|
|
|
9cfe9a |
+ imapx_folder->ignore_recent = g_hash_table_new_full (
|
|
|
9cfe9a |
+ (GHashFunc) g_str_hash,
|
|
|
9cfe9a |
+ (GEqualFunc) g_str_equal,
|
|
|
9cfe9a |
+ (GDestroyNotify) g_free,
|
|
|
9cfe9a |
+ (GDestroyNotify) NULL);
|
|
|
9cfe9a |
+ imapx_folder->exists_on_server = 0;
|
|
|
9cfe9a |
+ imapx_folder->unread_on_server = 0;
|
|
|
9cfe9a |
+ imapx_folder->modseq_on_server = 0;
|
|
|
9cfe9a |
+ imapx_folder->uidnext_on_server = 0;
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ if (filter_all)
|
|
|
9cfe9a |
+ folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!g_ascii_strcasecmp (folder_name, "INBOX")) {
|
|
|
9cfe9a |
- if (filter_inbox || filter_all)
|
|
|
9cfe9a |
+ if (g_ascii_strcasecmp (folder_name, "INBOX") == 0) {
|
|
|
9cfe9a |
+ if (filter_inbox)
|
|
|
9cfe9a |
folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
if (filter_junk)
|
|
|
9cfe9a |
folder->folder_flags |= CAMEL_FOLDER_FILTER_JUNK;
|
|
|
9cfe9a |
} else {
|
|
|
9cfe9a |
if (filter_junk && !filter_junk_inbox)
|
|
|
9cfe9a |
folder->folder_flags |= CAMEL_FOLDER_FILTER_JUNK;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (filter_all || imapx_folder_get_apply_filters (ifolder))
|
|
|
9cfe9a |
+ if (imapx_folder_get_apply_filters (imapx_folder))
|
|
|
9cfe9a |
folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
diff -up evolution-data-server-3.8.5/camel/camel-imapx-folder.h.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-folder.h
|
|
|
9cfe9a |
--- evolution-data-server-3.8.5/camel/camel-imapx-folder.h.kill-imapx-conn-manager 2013-07-23 07:57:54.000000000 -0400
|
|
|
9cfe9a |
+++ evolution-data-server-3.8.5/camel/camel-imapx-folder.h 2013-09-12 15:51:33.331412252 -0400
|
|
|
9cfe9a |
@@ -62,7 +62,6 @@ struct _CamelIMAPXFolder {
|
|
|
9cfe9a |
CamelOfflineFolder parent;
|
|
|
9cfe9a |
CamelIMAPXFolderPrivate *priv;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- gchar *raw_name;
|
|
|
9cfe9a |
CamelDataCache *cache;
|
|
|
9cfe9a |
CamelFolderSearch *search;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
diff -up evolution-data-server-3.8.5/camel/camel-imapx-server.c.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-server.c
|
|
|
9cfe9a |
--- evolution-data-server-3.8.5/camel/camel-imapx-server.c.kill-imapx-conn-manager 2013-07-23 07:57:58.000000000 -0400
|
|
|
9cfe9a |
+++ evolution-data-server-3.8.5/camel/camel-imapx-server.c 2013-09-12 15:51:33.348412247 -0400
|
|
|
9cfe9a |
@@ -351,14 +351,6 @@ enum {
|
|
|
9cfe9a |
PROP_STORE
|
|
|
9cfe9a |
};
|
|
|
9cfe9a |
|
|
|
9cfe9a |
-enum {
|
|
|
9cfe9a |
- SELECT_CHANGED,
|
|
|
9cfe9a |
- SHUTDOWN,
|
|
|
9cfe9a |
- LAST_SIGNAL
|
|
|
9cfe9a |
-};
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
-static guint signals[LAST_SIGNAL];
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
static void imapx_uidset_init (struct _uidset_state *ss,
|
|
|
9cfe9a |
gint total,
|
|
|
9cfe9a |
gint limit);
|
|
|
9cfe9a |
@@ -2297,9 +2289,7 @@ imapx_untagged_bye (CamelIMAPXServer *is
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
- CamelService *service;
|
|
|
9cfe9a |
- CamelServiceConnectionStatus status;
|
|
|
9cfe9a |
+ CamelIMAPXStore *store;
|
|
|
9cfe9a |
guchar *token = NULL;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), FALSE);
|
|
|
9cfe9a |
@@ -2317,18 +2307,11 @@ imapx_untagged_bye (CamelIMAPXServer *is
|
|
|
9cfe9a |
|
|
|
9cfe9a |
is->state = IMAPX_SHUTDOWN;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- imapx_store = camel_imapx_server_ref_store (is);
|
|
|
9cfe9a |
- service = CAMEL_SERVICE (imapx_store);
|
|
|
9cfe9a |
- status = camel_service_get_connection_status (service);
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- /* Do not disconnect the service if we're still connecting.
|
|
|
9cfe9a |
- * camel_service_disconnect_sync() will cancel the connect
|
|
|
9cfe9a |
- * operation and the server message will get replaced with
|
|
|
9cfe9a |
- * a generic "Operation was cancelled" message. */
|
|
|
9cfe9a |
- if (status == CAMEL_SERVICE_CONNECTED)
|
|
|
9cfe9a |
- camel_service_disconnect_sync (service, FALSE, NULL, NULL);
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- g_object_unref (imapx_store);
|
|
|
9cfe9a |
+ /* Disconnect the CamelIMAPXStore. */
|
|
|
9cfe9a |
+ store = camel_imapx_server_ref_store (is);
|
|
|
9cfe9a |
+ camel_service_disconnect_sync (
|
|
|
9cfe9a |
+ CAMEL_SERVICE (store), FALSE, NULL, NULL);
|
|
|
9cfe9a |
+ g_object_unref (store);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
return FALSE;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
@@ -3469,7 +3452,6 @@ imapx_command_select_done (CamelIMAPXSer
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- const gchar *selected_folder = NULL;
|
|
|
9cfe9a |
gboolean success = TRUE;
|
|
|
9cfe9a |
GError *local_error = NULL;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -3580,7 +3562,6 @@ imapx_command_select_done (CamelIMAPXSer
|
|
|
9cfe9a |
;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
ifolder->uidvalidity_on_server = is->uidvalidity;
|
|
|
9cfe9a |
- selected_folder = camel_folder_get_full_name (folder);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
if (is->uidvalidity && is->uidvalidity != ((CamelIMAPXSummary *) folder->summary)->validity)
|
|
|
9cfe9a |
invalidate_local_cache (ifolder, is->uidvalidity);
|
|
|
9cfe9a |
@@ -3599,8 +3580,6 @@ imapx_command_select_done (CamelIMAPXSer
|
|
|
9cfe9a |
|
|
|
9cfe9a |
camel_imapx_command_unref (ic);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_signal_emit (is, signals[SELECT_CHANGED], 0, selected_folder);
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -6874,6 +6853,7 @@ imapx_parser_thread (gpointer d)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
CamelIMAPXServer *is = d;
|
|
|
9cfe9a |
CamelIMAPXStream *stream;
|
|
|
9cfe9a |
+ CamelIMAPXStore *store;
|
|
|
9cfe9a |
GCancellable *cancellable;
|
|
|
9cfe9a |
gboolean have_stream;
|
|
|
9cfe9a |
GError *local_error = NULL;
|
|
|
9cfe9a |
@@ -6965,8 +6945,6 @@ imapx_parser_thread (gpointer d)
|
|
|
9cfe9a |
|
|
|
9cfe9a |
cancel_all_jobs (is, local_error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_clear_error (&local_error);
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
QUEUE_LOCK (is);
|
|
|
9cfe9a |
if (is->cancellable != NULL) {
|
|
|
9cfe9a |
g_object_unref (is->cancellable);
|
|
|
9cfe9a |
@@ -6976,7 +6954,14 @@ imapx_parser_thread (gpointer d)
|
|
|
9cfe9a |
QUEUE_UNLOCK (is);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
is->parser_quit = FALSE;
|
|
|
9cfe9a |
- g_signal_emit (is, signals[SHUTDOWN], 0);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ /* Disconnect the CamelService. */
|
|
|
9cfe9a |
+ store = camel_imapx_server_ref_store (is);
|
|
|
9cfe9a |
+ camel_service_disconnect_sync (
|
|
|
9cfe9a |
+ CAMEL_SERVICE (store), FALSE, NULL, NULL);
|
|
|
9cfe9a |
+ g_object_unref (store);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_clear_error (&local_error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
return NULL;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
@@ -7141,9 +7126,6 @@ camel_imapx_server_class_init (CamelIMAP
|
|
|
9cfe9a |
object_class->dispose = imapx_server_dispose;
|
|
|
9cfe9a |
object_class->constructed = imapx_server_constructed;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- class->select_changed = NULL;
|
|
|
9cfe9a |
- class->shutdown = NULL;
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
g_object_class_install_property (
|
|
|
9cfe9a |
object_class,
|
|
|
9cfe9a |
PROP_STREAM,
|
|
|
9cfe9a |
@@ -7167,32 +7149,6 @@ camel_imapx_server_class_init (CamelIMAP
|
|
|
9cfe9a |
G_PARAM_CONSTRUCT_ONLY |
|
|
|
9cfe9a |
G_PARAM_STATIC_STRINGS));
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- /**
|
|
|
9cfe9a |
- * CamelIMAPXServer::select_changed
|
|
|
9cfe9a |
- * @server: the #CamelIMAPXServer which emitted the signal
|
|
|
9cfe9a |
- **/
|
|
|
9cfe9a |
- signals[SELECT_CHANGED] = g_signal_new (
|
|
|
9cfe9a |
- "select_changed",
|
|
|
9cfe9a |
- G_OBJECT_CLASS_TYPE (class),
|
|
|
9cfe9a |
- G_SIGNAL_RUN_FIRST,
|
|
|
9cfe9a |
- G_STRUCT_OFFSET (CamelIMAPXServerClass, select_changed),
|
|
|
9cfe9a |
- NULL, NULL,
|
|
|
9cfe9a |
- g_cclosure_marshal_VOID__STRING,
|
|
|
9cfe9a |
- G_TYPE_NONE, 1, G_TYPE_STRING);
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- /**
|
|
|
9cfe9a |
- * CamelIMAPXServer::shutdown
|
|
|
9cfe9a |
- * @server: the #CamelIMAPXServer which emitted the signal
|
|
|
9cfe9a |
- **/
|
|
|
9cfe9a |
- signals[SHUTDOWN] = g_signal_new (
|
|
|
9cfe9a |
- "shutdown",
|
|
|
9cfe9a |
- G_OBJECT_CLASS_TYPE (class),
|
|
|
9cfe9a |
- G_SIGNAL_RUN_FIRST,
|
|
|
9cfe9a |
- G_STRUCT_OFFSET (CamelIMAPXServerClass, shutdown),
|
|
|
9cfe9a |
- NULL, NULL,
|
|
|
9cfe9a |
- g_cclosure_marshal_VOID__VOID,
|
|
|
9cfe9a |
- G_TYPE_NONE, 0);
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
class->tagprefix = 'A';
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
diff -up evolution-data-server-3.8.5/camel/camel-imapx-server.h.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-server.h
|
|
|
9cfe9a |
--- evolution-data-server-3.8.5/camel/camel-imapx-server.h.kill-imapx-conn-manager 2013-07-23 07:57:54.000000000 -0400
|
|
|
9cfe9a |
+++ evolution-data-server-3.8.5/camel/camel-imapx-server.h 2013-09-12 15:51:33.350412247 -0400
|
|
|
9cfe9a |
@@ -164,11 +164,6 @@ struct _CamelIMAPXServer {
|
|
|
9cfe9a |
struct _CamelIMAPXServerClass {
|
|
|
9cfe9a |
CamelObjectClass parent_class;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- /* Signals */
|
|
|
9cfe9a |
- void (*select_changed) (CamelIMAPXServer *is,
|
|
|
9cfe9a |
- const gchar *selected_folder);
|
|
|
9cfe9a |
- void (*shutdown) (CamelIMAPXServer *is);
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
gchar tagprefix;
|
|
|
9cfe9a |
};
|
|
|
9cfe9a |
|
|
|
9cfe9a |
diff -up evolution-data-server-3.8.5/camel/camel-imapx-store.c.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-store.c
|
|
|
9cfe9a |
--- evolution-data-server-3.8.5/camel/camel-imapx-store.c.kill-imapx-conn-manager 2013-07-23 07:57:57.000000000 -0400
|
|
|
9cfe9a |
+++ evolution-data-server-3.8.5/camel/camel-imapx-store.c 2013-09-12 15:51:33.358412244 -0400
|
|
|
9cfe9a |
@@ -57,6 +57,10 @@
|
|
|
9cfe9a |
((obj), CAMEL_TYPE_IMAPX_STORE, CamelIMAPXStorePrivate))
|
|
|
9cfe9a |
|
|
|
9cfe9a |
struct _CamelIMAPXStorePrivate {
|
|
|
9cfe9a |
+ CamelIMAPXServer *connected_server;
|
|
|
9cfe9a |
+ CamelIMAPXServer *connecting_server;
|
|
|
9cfe9a |
+ GMutex server_lock;
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
GHashTable *quota_info;
|
|
|
9cfe9a |
GMutex quota_info_lock;
|
|
|
9cfe9a |
};
|
|
|
9cfe9a |
@@ -189,24 +193,10 @@ imapx_store_dispose (GObject *object)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
CamelIMAPXStore *imapx_store = CAMEL_IMAPX_STORE (object);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- /* Force disconnect so we dont have it run later,
|
|
|
9cfe9a |
- * after we've cleaned up some stuff. */
|
|
|
9cfe9a |
- if (imapx_store->con_man != NULL) {
|
|
|
9cfe9a |
- camel_service_disconnect_sync (
|
|
|
9cfe9a |
- CAMEL_SERVICE (imapx_store), TRUE, NULL, NULL);
|
|
|
9cfe9a |
- g_object_unref (imapx_store->con_man);
|
|
|
9cfe9a |
- imapx_store->con_man = NULL;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- if (imapx_store->authenticating_server != NULL) {
|
|
|
9cfe9a |
- g_object_unref (imapx_store->authenticating_server);
|
|
|
9cfe9a |
- imapx_store->authenticating_server = NULL;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- if (imapx_store->summary != NULL) {
|
|
|
9cfe9a |
- g_object_unref (imapx_store->summary);
|
|
|
9cfe9a |
- imapx_store->summary = NULL;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ g_clear_object (&imapx_store->summary);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_clear_object (&imapx_store->priv->connected_server);
|
|
|
9cfe9a |
+ g_clear_object (&imapx_store->priv->connecting_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
/* Chain up to parent's dispose() method. */
|
|
|
9cfe9a |
G_OBJECT_CLASS (camel_imapx_store_parent_class)->dispose (object);
|
|
|
9cfe9a |
@@ -219,6 +209,8 @@ imapx_store_finalize (GObject *object)
|
|
|
9cfe9a |
|
|
|
9cfe9a |
g_mutex_clear (&imapx_store->get_finfo_lock);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
+ g_mutex_clear (&imapx_store->priv->server_lock);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
g_hash_table_destroy (imapx_store->priv->quota_info);
|
|
|
9cfe9a |
g_mutex_clear (&imapx_store->priv->quota_info_lock);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -257,42 +249,48 @@ imapx_get_name (CamelService *service,
|
|
|
9cfe9a |
return name;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
-CamelIMAPXServer *
|
|
|
9cfe9a |
-camel_imapx_store_get_server (CamelIMAPXStore *istore,
|
|
|
9cfe9a |
- const gchar *folder_name,
|
|
|
9cfe9a |
- GCancellable *cancellable,
|
|
|
9cfe9a |
- GError **error)
|
|
|
9cfe9a |
-{
|
|
|
9cfe9a |
- return camel_imapx_conn_manager_get_connection (
|
|
|
9cfe9a |
- istore->con_man, folder_name, cancellable, error);
|
|
|
9cfe9a |
-}
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
-void
|
|
|
9cfe9a |
-camel_imapx_store_op_done (CamelIMAPXStore *istore,
|
|
|
9cfe9a |
- CamelIMAPXServer *server,
|
|
|
9cfe9a |
- const gchar *folder_name)
|
|
|
9cfe9a |
-{
|
|
|
9cfe9a |
- g_return_if_fail (server != NULL);
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- camel_imapx_conn_manager_update_con_info (
|
|
|
9cfe9a |
- istore->con_man, server, folder_name);
|
|
|
9cfe9a |
-}
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
static gboolean
|
|
|
9cfe9a |
imapx_connect_sync (CamelService *service,
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXStore *istore = (CamelIMAPXStore *) service;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
+ gboolean success;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (istore, NULL, cancellable, error);
|
|
|
9cfe9a |
- if (server) {
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
- return TRUE;
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (service);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_server_new (imapx_store);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_mutex_lock (&imapx_store->priv->server_lock);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ /* We need to share the CamelIMAPXServer instance with the
|
|
|
9cfe9a |
+ * authenticate_sync() method, but we don't want other parts
|
|
|
9cfe9a |
+ * getting at it just yet. So stash it in a special private
|
|
|
9cfe9a |
+ * variable while connecting to the IMAP server. */
|
|
|
9cfe9a |
+ g_warn_if_fail (imapx_store->priv->connecting_server == NULL);
|
|
|
9cfe9a |
+ imapx_store->priv->connecting_server = g_object_ref (imapx_server);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_mutex_unlock (&imapx_store->priv->server_lock);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ success = camel_imapx_server_connect (
|
|
|
9cfe9a |
+ imapx_server, cancellable, error);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_mutex_lock (&imapx_store->priv->server_lock);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_warn_if_fail (imapx_store->priv->connecting_server == imapx_server);
|
|
|
9cfe9a |
+ g_clear_object (&imapx_store->priv->connecting_server);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ if (success) {
|
|
|
9cfe9a |
+ g_clear_object (&imapx_store->priv->connected_server);
|
|
|
9cfe9a |
+ imapx_store->priv->connected_server = imapx_server;
|
|
|
9cfe9a |
+ g_object_ref (imapx_server);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
+ g_mutex_unlock (&imapx_store->priv->server_lock);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
static gboolean
|
|
|
9cfe9a |
@@ -301,15 +299,16 @@ imapx_disconnect_sync (CamelService *ser
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXStore *istore = CAMEL_IMAPX_STORE (service);
|
|
|
9cfe9a |
- CamelServiceClass *service_class;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- service_class = CAMEL_SERVICE_CLASS (camel_imapx_store_parent_class);
|
|
|
9cfe9a |
- if (!service_class->disconnect_sync (service, clean, cancellable, error))
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (service);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_mutex_lock (&imapx_store->priv->server_lock);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (istore->con_man != NULL)
|
|
|
9cfe9a |
- camel_imapx_conn_manager_close_connections (istore->con_man);
|
|
|
9cfe9a |
+ g_warn_if_fail (imapx_store->priv->connecting_server == NULL);
|
|
|
9cfe9a |
+ g_clear_object (&imapx_store->priv->connected_server);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_mutex_unlock (&imapx_store->priv->server_lock);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
return TRUE;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
@@ -320,23 +319,23 @@ imapx_authenticate_sync (CamelService *s
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXStore *istore = CAMEL_IMAPX_STORE (service);
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
+ CamelAuthenticationResult result;
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (service);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ /* This should have been set for us by connect_sync(). */
|
|
|
9cfe9a |
+ g_mutex_lock (&imapx_store->priv->server_lock);
|
|
|
9cfe9a |
+ imapx_server = g_object_ref (imapx_store->priv->connecting_server);
|
|
|
9cfe9a |
+ g_mutex_unlock (&imapx_store->priv->server_lock);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ result = camel_imapx_server_authenticate (
|
|
|
9cfe9a |
+ imapx_server, mechanism, cancellable, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- /* CamelIMAPXConnManager sets this before calling
|
|
|
9cfe9a |
- * camel_imapx_server_connect()(), and then clears it
|
|
|
9cfe9a |
- * immediately after, all while holding the recursive
|
|
|
9cfe9a |
- * connection lock (CAMEL_SERVICE_REC_CONNECT_LOCK).
|
|
|
9cfe9a |
- * Otherwise we'd have no way of knowing which server
|
|
|
9cfe9a |
- * is trying to authenticate. */
|
|
|
9cfe9a |
- server = istore->authenticating_server;
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- g_return_val_if_fail (
|
|
|
9cfe9a |
- CAMEL_IS_IMAPX_SERVER (server),
|
|
|
9cfe9a |
- CAMEL_AUTHENTICATION_REJECTED);
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- return camel_imapx_server_authenticate (
|
|
|
9cfe9a |
- server, mechanism, cancellable, error);
|
|
|
9cfe9a |
+ return result;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
CamelServiceAuthType camel_imapx_password_authtype = {
|
|
|
9cfe9a |
@@ -650,62 +649,64 @@ imapx_mark_folder_subscribed (CamelIMAPX
|
|
|
9cfe9a |
|
|
|
9cfe9a |
static gboolean
|
|
|
9cfe9a |
imapx_subscribe_folder (CamelStore *store,
|
|
|
9cfe9a |
- const gchar *folder_name,
|
|
|
9cfe9a |
+ const gchar *folder_path,
|
|
|
9cfe9a |
gboolean emit_signal,
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
- gboolean success;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
+ gboolean success = FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store)))
|
|
|
9cfe9a |
- return TRUE;
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (istore, NULL, cancellable, error);
|
|
|
9cfe9a |
- if (!server)
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
+ if (folder_path != NULL && *folder_path == '/')
|
|
|
9cfe9a |
+ folder_path++;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (folder_name && *folder_name == '/')
|
|
|
9cfe9a |
- folder_name++;
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
+ success = camel_imapx_server_manage_subscription (
|
|
|
9cfe9a |
+ imapx_server, folder_path, TRUE, cancellable, error);
|
|
|
9cfe9a |
+ }
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- success = camel_imapx_server_manage_subscription (
|
|
|
9cfe9a |
- server, folder_name, TRUE, cancellable, error);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ if (success) {
|
|
|
9cfe9a |
+ imapx_mark_folder_subscribed (
|
|
|
9cfe9a |
+ imapx_store, folder_path, emit_signal);
|
|
|
9cfe9a |
+ }
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (success)
|
|
|
9cfe9a |
- imapx_mark_folder_subscribed (istore, folder_name, emit_signal);
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
static gboolean
|
|
|
9cfe9a |
imapx_unsubscribe_folder (CamelStore *store,
|
|
|
9cfe9a |
- const gchar *folder_name,
|
|
|
9cfe9a |
+ const gchar *folder_path,
|
|
|
9cfe9a |
gboolean emit_signal,
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
- gboolean success;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
+ gboolean success = FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store)))
|
|
|
9cfe9a |
- return TRUE;
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (istore, NULL, cancellable, error);
|
|
|
9cfe9a |
- if (!server)
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
+ if (folder_path != NULL && *folder_path == '/')
|
|
|
9cfe9a |
+ folder_path++;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (folder_name && *folder_name == '/')
|
|
|
9cfe9a |
- folder_name++;
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
+ success = camel_imapx_server_manage_subscription (
|
|
|
9cfe9a |
+ imapx_server, folder_path, FALSE, cancellable, error);
|
|
|
9cfe9a |
+ }
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- success = camel_imapx_server_manage_subscription (
|
|
|
9cfe9a |
- server, folder_name, FALSE, cancellable, error);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ if (success) {
|
|
|
9cfe9a |
+ imapx_unmark_folder_subscribed (
|
|
|
9cfe9a |
+ imapx_store, folder_path, emit_signal);
|
|
|
9cfe9a |
+ }
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (success)
|
|
|
9cfe9a |
- imapx_unmark_folder_subscribed (istore, folder_name, emit_signal);
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
@@ -1043,7 +1044,7 @@ get_namespaces (CamelIMAPXStore *istore)
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
static GHashTable *
|
|
|
9cfe9a |
-fetch_folders_for_namespaces (CamelIMAPXStore *istore,
|
|
|
9cfe9a |
+fetch_folders_for_namespaces (CamelIMAPXStore *imapx_store,
|
|
|
9cfe9a |
const gchar *pattern,
|
|
|
9cfe9a |
gboolean sync,
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
@@ -1053,15 +1054,15 @@ fetch_folders_for_namespaces (CamelIMAPX
|
|
|
9cfe9a |
GHashTable *folders = NULL;
|
|
|
9cfe9a |
GList *namespaces = NULL, *l;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (istore, NULL, cancellable, error);
|
|
|
9cfe9a |
- if (!server)
|
|
|
9cfe9a |
+ server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ if (server == NULL)
|
|
|
9cfe9a |
return NULL;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
folders = g_hash_table_new (folder_hash, folder_eq);
|
|
|
9cfe9a |
- namespaces = get_namespaces (istore);
|
|
|
9cfe9a |
+ namespaces = get_namespaces (imapx_store);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- for (l = namespaces; l != NULL; l = g_list_next (l))
|
|
|
9cfe9a |
- {
|
|
|
9cfe9a |
+ for (l = namespaces; l != NULL; l = g_list_next (l)) {
|
|
|
9cfe9a |
CamelIMAPXStoreNamespace *ns = l->data;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
while (ns) {
|
|
|
9cfe9a |
@@ -1085,7 +1086,7 @@ fetch_folders_for_namespaces (CamelIMAPX
|
|
|
9cfe9a |
|
|
|
9cfe9a |
flags |= CAMEL_STORE_FOLDER_INFO_RECURSIVE;
|
|
|
9cfe9a |
if (!fetch_folders_for_pattern (
|
|
|
9cfe9a |
- istore, server, pat, flags, list_ext,
|
|
|
9cfe9a |
+ imapx_store, server, pat, flags, list_ext,
|
|
|
9cfe9a |
folders, cancellable, error)) {
|
|
|
9cfe9a |
g_free (pat);
|
|
|
9cfe9a |
goto exception;
|
|
|
9cfe9a |
@@ -1095,7 +1096,7 @@ fetch_folders_for_namespaces (CamelIMAPX
|
|
|
9cfe9a |
* issue LSUB to list the subscribed folders separately */
|
|
|
9cfe9a |
flags |= CAMEL_STORE_FOLDER_INFO_SUBSCRIBED;
|
|
|
9cfe9a |
if (!fetch_folders_for_pattern (
|
|
|
9cfe9a |
- istore, server, pat, flags, NULL,
|
|
|
9cfe9a |
+ imapx_store, server, pat, flags, NULL,
|
|
|
9cfe9a |
folders, cancellable, error)) {
|
|
|
9cfe9a |
g_free (pat);
|
|
|
9cfe9a |
goto exception;
|
|
|
9cfe9a |
@@ -1578,29 +1579,24 @@ imapx_store_create_folder_sync (CamelSto
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
CamelStoreInfo *si;
|
|
|
9cfe9a |
CamelIMAPXStoreNamespace *ns;
|
|
|
9cfe9a |
- CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
gchar *real_name, *full_name, *parent_real;
|
|
|
9cfe9a |
CamelFolderInfo *fi = NULL;
|
|
|
9cfe9a |
gchar dir_sep = 0;
|
|
|
9cfe9a |
gboolean success;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))) {
|
|
|
9cfe9a |
- g_set_error (
|
|
|
9cfe9a |
- error, CAMEL_SERVICE_ERROR,
|
|
|
9cfe9a |
- CAMEL_SERVICE_ERROR_UNAVAILABLE,
|
|
|
9cfe9a |
- _("You must be working online to complete this operation"));
|
|
|
9cfe9a |
- return NULL;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (istore, NULL, cancellable, error);
|
|
|
9cfe9a |
- if (!server)
|
|
|
9cfe9a |
+ if (imapx_server == NULL)
|
|
|
9cfe9a |
return NULL;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!parent_name)
|
|
|
9cfe9a |
+ if (parent_name == NULL)
|
|
|
9cfe9a |
parent_name = "";
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- ns = camel_imapx_store_summary_namespace_find_path (istore->summary, parent_name);
|
|
|
9cfe9a |
+ ns = camel_imapx_store_summary_namespace_find_path (
|
|
|
9cfe9a |
+ imapx_store->summary, parent_name);
|
|
|
9cfe9a |
if (ns)
|
|
|
9cfe9a |
dir_sep = ns->sep;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -1613,47 +1609,56 @@ imapx_store_create_folder_sync (CamelSto
|
|
|
9cfe9a |
CAMEL_FOLDER_ERROR_INVALID_PATH,
|
|
|
9cfe9a |
_("The folder name \"%s\" is invalid because it contains the character \"%c\""),
|
|
|
9cfe9a |
folder_name, dir_sep);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
- return NULL;
|
|
|
9cfe9a |
+ goto exit;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- parent_real = camel_imapx_store_summary_full_from_path (istore->summary, parent_name);
|
|
|
9cfe9a |
+ parent_real = camel_imapx_store_summary_full_from_path (
|
|
|
9cfe9a |
+ imapx_store->summary, parent_name);
|
|
|
9cfe9a |
if (parent_real == NULL) {
|
|
|
9cfe9a |
g_set_error (
|
|
|
9cfe9a |
error, CAMEL_FOLDER_ERROR,
|
|
|
9cfe9a |
CAMEL_FOLDER_ERROR_INVALID_STATE,
|
|
|
9cfe9a |
_("Unknown parent folder: %s"), parent_name);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
- return NULL;
|
|
|
9cfe9a |
+ goto exit;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- si = camel_store_summary_path ((CamelStoreSummary *) istore->summary, parent_name);
|
|
|
9cfe9a |
+ si = camel_store_summary_path (
|
|
|
9cfe9a |
+ (CamelStoreSummary *) imapx_store->summary, parent_name);
|
|
|
9cfe9a |
if (si && si->flags & CAMEL_STORE_INFO_FOLDER_NOINFERIORS) {
|
|
|
9cfe9a |
g_set_error (
|
|
|
9cfe9a |
error, CAMEL_FOLDER_ERROR,
|
|
|
9cfe9a |
CAMEL_FOLDER_ERROR_INVALID_STATE,
|
|
|
9cfe9a |
_("The parent folder is not allowed to contain subfolders"));
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
- return NULL;
|
|
|
9cfe9a |
+ goto exit;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
if (si)
|
|
|
9cfe9a |
- camel_store_summary_info_free ((CamelStoreSummary *) istore->summary, si);
|
|
|
9cfe9a |
+ camel_store_summary_info_free (
|
|
|
9cfe9a |
+ (CamelStoreSummary *) imapx_store->summary, si);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- real_name = camel_imapx_store_summary_path_to_full (istore->summary, folder_name, dir_sep);
|
|
|
9cfe9a |
- full_name = imapx_concat (istore, parent_real, real_name);
|
|
|
9cfe9a |
+ real_name = camel_imapx_store_summary_path_to_full (
|
|
|
9cfe9a |
+ imapx_store->summary, folder_name, dir_sep);
|
|
|
9cfe9a |
+ full_name = imapx_concat (imapx_store, parent_real, real_name);
|
|
|
9cfe9a |
g_free (real_name);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
success = camel_imapx_server_create_folder (
|
|
|
9cfe9a |
- server, full_name, cancellable, error);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ imapx_server, full_name, cancellable, error);
|
|
|
9cfe9a |
+ g_object_unref (imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
if (success) {
|
|
|
9cfe9a |
+ CamelStoreSummary *summary;
|
|
|
9cfe9a |
CamelIMAPXStoreInfo *si;
|
|
|
9cfe9a |
+ const gchar *folder_path;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- si = camel_imapx_store_summary_add_from_full (istore->summary, full_name, dir_sep);
|
|
|
9cfe9a |
- camel_store_summary_save ((CamelStoreSummary *) istore->summary);
|
|
|
9cfe9a |
- fi = imapx_build_folder_info (istore, camel_store_info_path (istore->summary, si));
|
|
|
9cfe9a |
+ summary = CAMEL_STORE_SUMMARY (imapx_store->summary);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ si = camel_imapx_store_summary_add_from_full (
|
|
|
9cfe9a |
+ imapx_store->summary, full_name, dir_sep);
|
|
|
9cfe9a |
+ camel_store_summary_save (summary);
|
|
|
9cfe9a |
+ folder_path = camel_store_info_path (
|
|
|
9cfe9a |
+ summary, (CamelStoreInfo *) si);
|
|
|
9cfe9a |
+ fi = imapx_build_folder_info (
|
|
|
9cfe9a |
+ imapx_store, folder_path);
|
|
|
9cfe9a |
fi->flags |= CAMEL_FOLDER_NOCHILDREN;
|
|
|
9cfe9a |
camel_store_folder_created (store, fi);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
@@ -1661,6 +1666,9 @@ imapx_store_create_folder_sync (CamelSto
|
|
|
9cfe9a |
g_free (full_name);
|
|
|
9cfe9a |
g_free (parent_real);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
+exit:
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
return fi;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -1670,29 +1678,23 @@ imapx_store_delete_folder_sync (CamelSto
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
- gboolean success;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
+ gboolean success = FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))) {
|
|
|
9cfe9a |
- g_set_error (
|
|
|
9cfe9a |
- error, CAMEL_SERVICE_ERROR,
|
|
|
9cfe9a |
- CAMEL_SERVICE_ERROR_UNAVAILABLE,
|
|
|
9cfe9a |
- _("You must be working online to complete this operation"));
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
+ success = camel_imapx_server_delete_folder (
|
|
|
9cfe9a |
+ imapx_server, folder_name, cancellable, error);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
- /* Use INBOX connection as the implementation would try to select inbox to ensure
|
|
|
9cfe9a |
- * we are not selected on the folder being deleted */
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (istore, "INBOX", cancellable, error);
|
|
|
9cfe9a |
- if (!server)
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- success = camel_imapx_server_delete_folder (
|
|
|
9cfe9a |
- server, folder_name, cancellable, error);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
+ if (success) {
|
|
|
9cfe9a |
+ imapx_delete_folder_from_cache (imapx_store, folder_name);
|
|
|
9cfe9a |
+ }
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (success)
|
|
|
9cfe9a |
- imapx_delete_folder_from_cache (istore, folder_name);
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
@@ -1704,12 +1706,11 @@ imapx_store_rename_folder_sync (CamelSto
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
|
|
|
9cfe9a |
- CamelIMAPXServer *server;
|
|
|
9cfe9a |
CamelService *service;
|
|
|
9cfe9a |
CamelSettings *settings;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
const gchar *user_cache_dir;
|
|
|
9cfe9a |
- gchar *oldpath, *newpath, *storage_path;
|
|
|
9cfe9a |
gboolean use_subscriptions;
|
|
|
9cfe9a |
gboolean success = FALSE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -1723,52 +1724,52 @@ imapx_store_rename_folder_sync (CamelSto
|
|
|
9cfe9a |
|
|
|
9cfe9a |
g_object_unref (settings);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))) {
|
|
|
9cfe9a |
- g_set_error (
|
|
|
9cfe9a |
- error, CAMEL_SERVICE_ERROR,
|
|
|
9cfe9a |
- CAMEL_SERVICE_ERROR_UNAVAILABLE,
|
|
|
9cfe9a |
- _("You must be working online to complete this operation"));
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (use_subscriptions)
|
|
|
9cfe9a |
- imapx_unsubscribe_folder (store, old, FALSE, cancellable, NULL);
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
+ gchar *oldpath;
|
|
|
9cfe9a |
+ gchar *newpath;
|
|
|
9cfe9a |
+ gchar *storage_path;
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ if (use_subscriptions)
|
|
|
9cfe9a |
+ imapx_unsubscribe_folder (
|
|
|
9cfe9a |
+ store, old, FALSE, cancellable, NULL);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- /* Use INBOX connection as the implementation would try to select inbox to ensure
|
|
|
9cfe9a |
- * we are not selected on the folder being renamed */
|
|
|
9cfe9a |
- server = camel_imapx_store_get_server (istore, "INBOX", cancellable, error);
|
|
|
9cfe9a |
- if (server) {
|
|
|
9cfe9a |
success = camel_imapx_server_rename_folder (
|
|
|
9cfe9a |
- server, old, new, cancellable, error);
|
|
|
9cfe9a |
- g_object_unref (server);
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- if (!success) {
|
|
|
9cfe9a |
- imapx_subscribe_folder (store, old, FALSE, cancellable, NULL);
|
|
|
9cfe9a |
- return FALSE;
|
|
|
9cfe9a |
- }
|
|
|
9cfe9a |
+ imapx_server, old, new, cancellable, error);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- /* rename summary, and handle broken server */
|
|
|
9cfe9a |
- rename_folder_info (istore, old, new);
|
|
|
9cfe9a |
+ if (!success) {
|
|
|
9cfe9a |
+ imapx_subscribe_folder (
|
|
|
9cfe9a |
+ store, old, FALSE, cancellable, NULL);
|
|
|
9cfe9a |
+ goto exit;
|
|
|
9cfe9a |
+ }
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (use_subscriptions)
|
|
|
9cfe9a |
- success = imapx_subscribe_folder (
|
|
|
9cfe9a |
- store, new, FALSE, cancellable, error);
|
|
|
9cfe9a |
+ /* Rename summary, and handle broken server. */
|
|
|
9cfe9a |
+ rename_folder_info (imapx_store, old, new);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- storage_path = g_build_filename (user_cache_dir, "folders", NULL);
|
|
|
9cfe9a |
- oldpath = imapx_path_to_physical (storage_path, old);
|
|
|
9cfe9a |
- newpath = imapx_path_to_physical (storage_path, new);
|
|
|
9cfe9a |
- g_free (storage_path);
|
|
|
9cfe9a |
+ if (use_subscriptions)
|
|
|
9cfe9a |
+ success = imapx_subscribe_folder (
|
|
|
9cfe9a |
+ store, new, FALSE, cancellable, error);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ storage_path = g_build_filename (user_cache_dir, "folders", NULL);
|
|
|
9cfe9a |
+ oldpath = imapx_path_to_physical (storage_path, old);
|
|
|
9cfe9a |
+ newpath = imapx_path_to_physical (storage_path, new);
|
|
|
9cfe9a |
+ g_free (storage_path);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ /* So do we care if this didn't work? Its just a cache? */
|
|
|
9cfe9a |
+ if (g_rename (oldpath, newpath) == -1) {
|
|
|
9cfe9a |
+ g_warning (
|
|
|
9cfe9a |
+ "Could not rename message cache '%s' to '%s': %s: cache reset",
|
|
|
9cfe9a |
+ oldpath, newpath, g_strerror (errno));
|
|
|
9cfe9a |
+ }
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- /* So do we care if this didn't work? Its just a cache? */
|
|
|
9cfe9a |
- if (g_rename (oldpath, newpath) == -1) {
|
|
|
9cfe9a |
- g_warning (
|
|
|
9cfe9a |
- "Could not rename message cache '%s' to '%s': %s: cache reset",
|
|
|
9cfe9a |
- oldpath, newpath, g_strerror (errno));
|
|
|
9cfe9a |
+ g_free (oldpath);
|
|
|
9cfe9a |
+ g_free (newpath);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_free (oldpath);
|
|
|
9cfe9a |
- g_free (newpath);
|
|
|
9cfe9a |
+exit:
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
@@ -1778,25 +1779,21 @@ imapx_store_noop_sync (CamelStore *store
|
|
|
9cfe9a |
GCancellable *cancellable,
|
|
|
9cfe9a |
GError **error)
|
|
|
9cfe9a |
{
|
|
|
9cfe9a |
- CamelIMAPXStore *istore = (CamelIMAPXStore *) store;
|
|
|
9cfe9a |
- GList *list, *link;
|
|
|
9cfe9a |
+ CamelIMAPXStore *imapx_store;
|
|
|
9cfe9a |
+ CamelIMAPXServer *imapx_server;
|
|
|
9cfe9a |
gboolean success = TRUE;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store)))
|
|
|
9cfe9a |
- return TRUE;
|
|
|
9cfe9a |
+ /* If we're not connected then this truly is a no-op. */
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- list = camel_imapx_conn_manager_get_connections (istore->con_man);
|
|
|
9cfe9a |
+ imapx_store = CAMEL_IMAPX_STORE (store);
|
|
|
9cfe9a |
+ imapx_server = camel_imapx_store_ref_server (imapx_store, NULL);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- for (link = list; link != NULL; link = g_list_next (link)) {
|
|
|
9cfe9a |
- CamelIMAPXServer *server = CAMEL_IMAPX_SERVER (link->data);
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
- /* we just return last noops value, technically not correct though */
|
|
|
9cfe9a |
- success = camel_imapx_server_noop (server, NULL, cancellable, error);
|
|
|
9cfe9a |
- if (!success)
|
|
|
9cfe9a |
- break;
|
|
|
9cfe9a |
+ if (imapx_server != NULL) {
|
|
|
9cfe9a |
+ success = camel_imapx_server_noop (
|
|
|
9cfe9a |
+ imapx_server, NULL, cancellable, error);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- g_list_free_full (list, (GDestroyNotify) g_object_unref);
|
|
|
9cfe9a |
+ g_clear_object (&imapx_server);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
return success;
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
@@ -2026,7 +2023,8 @@ camel_imapx_store_init (CamelIMAPXStore
|
|
|
9cfe9a |
g_mutex_init (&store->get_finfo_lock);
|
|
|
9cfe9a |
store->last_refresh_time = time (NULL) - (FINFO_REFRESH_INTERVAL + 10);
|
|
|
9cfe9a |
store->dir_sep = '/';
|
|
|
9cfe9a |
- store->con_man = camel_imapx_conn_manager_new (CAMEL_STORE (store));
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_mutex_init (&store->priv->server_lock);
|
|
|
9cfe9a |
|
|
|
9cfe9a |
store->priv->quota_info = g_hash_table_new_full (
|
|
|
9cfe9a |
(GHashFunc) g_str_hash,
|
|
|
9cfe9a |
@@ -2042,6 +2040,50 @@ camel_imapx_store_init (CamelIMAPXStore
|
|
|
9cfe9a |
G_CALLBACK (imapx_store_update_store_flags), NULL);
|
|
|
9cfe9a |
}
|
|
|
9cfe9a |
|
|
|
9cfe9a |
+/**
|
|
|
9cfe9a |
+ * camel_imapx_store_ref_server:
|
|
|
9cfe9a |
+ * @store: a #CamelIMAPXStore
|
|
|
9cfe9a |
+ * @error: return location for a #GError, or %NULL
|
|
|
9cfe9a |
+ *
|
|
|
9cfe9a |
+ * Returns the #CamelIMAPXServer for @store, if available.
|
|
|
9cfe9a |
+ *
|
|
|
9cfe9a |
+ * As a convenience, if the @store is not currently connected to an IMAP
|
|
|
9cfe9a |
+ * server, the function sets @error to %CAMEL_SERVER_ERROR_UNAVAILABLE and
|
|
|
9cfe9a |
+ * returns %NULL. If an operation can possibly be executed while offline,
|
|
|
9cfe9a |
+ * pass %NULL for @error.
|
|
|
9cfe9a |
+ *
|
|
|
9cfe9a |
+ * The returned #CamelIMAPXServer is referenced for thread-safety and must
|
|
|
9cfe9a |
+ * be unreferenced with g_object_unref() when finished with it.
|
|
|
9cfe9a |
+ *
|
|
|
9cfe9a |
+ * Returns: a #CamelIMAPXServer, or %NULL
|
|
|
9cfe9a |
+ *
|
|
|
9cfe9a |
+ * Since: 3.10
|
|
|
9cfe9a |
+ **/
|
|
|
9cfe9a |
+CamelIMAPXServer *
|
|
|
9cfe9a |
+camel_imapx_store_ref_server (CamelIMAPXStore *store,
|
|
|
9cfe9a |
+ GError **error)
|
|
|
9cfe9a |
+{
|
|
|
9cfe9a |
+ CamelIMAPXServer *server = NULL;
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_return_val_if_fail (CAMEL_IS_IMAPX_STORE (store), NULL);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_mutex_lock (&store->priv->server_lock);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ if (store->priv->connected_server != NULL) {
|
|
|
9cfe9a |
+ server = g_object_ref (store->priv->connected_server);
|
|
|
9cfe9a |
+ } else {
|
|
|
9cfe9a |
+ g_set_error (
|
|
|
9cfe9a |
+ error, CAMEL_SERVICE_ERROR,
|
|
|
9cfe9a |
+ CAMEL_SERVICE_ERROR_UNAVAILABLE,
|
|
|
9cfe9a |
+ _("You must be working online "
|
|
|
9cfe9a |
+ "to complete this operation"));
|
|
|
9cfe9a |
+ }
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ g_mutex_unlock (&store->priv->server_lock);
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
+ return server;
|
|
|
9cfe9a |
+}
|
|
|
9cfe9a |
+
|
|
|
9cfe9a |
CamelFolderQuotaInfo *
|
|
|
9cfe9a |
camel_imapx_store_dup_quota_info (CamelIMAPXStore *store,
|
|
|
9cfe9a |
const gchar *quota_root_name)
|
|
|
9cfe9a |
diff -up evolution-data-server-3.8.5/camel/camel-imapx-store.h.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/camel-imapx-store.h
|
|
|
9cfe9a |
--- evolution-data-server-3.8.5/camel/camel-imapx-store.h.kill-imapx-conn-manager 2013-07-23 07:57:56.000000000 -0400
|
|
|
9cfe9a |
+++ evolution-data-server-3.8.5/camel/camel-imapx-store.h 2013-09-12 15:51:33.360412244 -0400
|
|
|
9cfe9a |
@@ -32,7 +32,6 @@
|
|
|
9cfe9a |
|
|
|
9cfe9a |
#include "camel-imapx-server.h"
|
|
|
9cfe9a |
#include "camel-imapx-store-summary.h"
|
|
|
9cfe9a |
-#include "camel-imapx-conn-manager.h"
|
|
|
9cfe9a |
|
|
|
9cfe9a |
/* Standard GObject macros */
|
|
|
9cfe9a |
#define CAMEL_TYPE_IMAPX_STORE \
|
|
|
9cfe9a |
@@ -63,9 +62,6 @@ struct _CamelIMAPXStore {
|
|
|
9cfe9a |
CamelOfflineStore parent;
|
|
|
9cfe9a |
CamelIMAPXStorePrivate *priv;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
- CamelIMAPXConnManager *con_man;
|
|
|
9cfe9a |
- CamelIMAPXServer *authenticating_server;
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
CamelIMAPXStoreSummary *summary; /* in-memory list of folders */
|
|
|
9cfe9a |
gchar dir_sep;
|
|
|
9cfe9a |
|
|
|
9cfe9a |
@@ -91,13 +87,8 @@ struct _CamelIMAPXStoreClass {
|
|
|
9cfe9a |
|
|
|
9cfe9a |
GType camel_imapx_store_get_type (void);
|
|
|
9cfe9a |
CamelIMAPXServer *
|
|
|
9cfe9a |
- camel_imapx_store_get_server (CamelIMAPXStore *store,
|
|
|
9cfe9a |
- const gchar *folder_name,
|
|
|
9cfe9a |
- GCancellable *cancellable,
|
|
|
9cfe9a |
+ camel_imapx_store_ref_server (CamelIMAPXStore *store,
|
|
|
9cfe9a |
GError **error);
|
|
|
9cfe9a |
-void camel_imapx_store_op_done (CamelIMAPXStore *istore,
|
|
|
9cfe9a |
- CamelIMAPXServer *server,
|
|
|
9cfe9a |
- const gchar *folder_name);
|
|
|
9cfe9a |
CamelFolderQuotaInfo *
|
|
|
9cfe9a |
camel_imapx_store_dup_quota_info
|
|
|
9cfe9a |
(CamelIMAPXStore *store,
|
|
|
9cfe9a |
diff -up evolution-data-server-3.8.5/camel/Makefile.am.kill-imapx-conn-manager evolution-data-server-3.8.5/camel/Makefile.am
|
|
|
9cfe9a |
--- evolution-data-server-3.8.5/camel/Makefile.am.kill-imapx-conn-manager 2013-04-18 11:33:59.000000000 -0400
|
|
|
9cfe9a |
+++ evolution-data-server-3.8.5/camel/Makefile.am 2013-09-12 15:51:33.270412271 -0400
|
|
|
9cfe9a |
@@ -180,7 +180,6 @@ libcamel_1_2_la_SOURCES = \
|
|
|
9cfe9a |
camel-vee-summary.c \
|
|
|
9cfe9a |
camel-vtrash-folder.c \
|
|
|
9cfe9a |
camel-imapx-command.c \
|
|
|
9cfe9a |
- camel-imapx-conn-manager.c \
|
|
|
9cfe9a |
camel-imapx-folder.c \
|
|
|
9cfe9a |
camel-imapx-job.c \
|
|
|
9cfe9a |
camel-imapx-search.c \
|
|
|
9cfe9a |
@@ -315,7 +314,6 @@ libcamelinclude_HEADERS = \
|
|
|
9cfe9a |
camel-vee-summary.h \
|
|
|
9cfe9a |
camel-vtrash-folder.h \
|
|
|
9cfe9a |
camel-imapx-command.h \
|
|
|
9cfe9a |
- camel-imapx-conn-manager.h \
|
|
|
9cfe9a |
camel-imapx-folder.h \
|
|
|
9cfe9a |
camel-imapx-job.h \
|
|
|
9cfe9a |
camel-imapx-search.h \
|
|
|
9cfe9a |
diff -up evolution-data-server-3.8.5/docs/reference/camel/camel-docs.sgml.kill-imapx-conn-manager evolution-data-server-3.8.5/docs/reference/camel/camel-docs.sgml
|
|
|
9cfe9a |
--- evolution-data-server-3.8.5/docs/reference/camel/camel-docs.sgml.kill-imapx-conn-manager 2013-03-17 08:46:02.000000000 -0400
|
|
|
9cfe9a |
+++ evolution-data-server-3.8.5/docs/reference/camel/camel-docs.sgml 2013-09-12 15:51:33.397412234 -0400
|
|
|
9cfe9a |
@@ -202,7 +202,6 @@
|
|
|
9cfe9a |
<chapter id="IMAP">
|
|
|
9cfe9a |
<title>Extensible IMAP</title>
|
|
|
9cfe9a |
<xi:include href="xml/camel-imapx-command.xml"/>
|
|
|
9cfe9a |
- <xi:include href="xml/camel-imapx-conn-manager.xml"/>
|
|
|
9cfe9a |
<xi:include href="xml/camel-imapx-folder.xml"/>
|
|
|
9cfe9a |
<xi:include href="xml/camel-imapx-job.xml"/>
|
|
|
9cfe9a |
<xi:include href="xml/camel-imapx-search.xml"/>
|
|
|
9cfe9a |
diff -up evolution-data-server-3.8.5/docs/reference/camel/camel-sections.txt.kill-imapx-conn-manager evolution-data-server-3.8.5/docs/reference/camel/camel-sections.txt
|
|
|
9cfe9a |
--- evolution-data-server-3.8.5/docs/reference/camel/camel-sections.txt.kill-imapx-conn-manager 2013-08-11 07:26:25.000000000 -0400
|
|
|
9cfe9a |
+++ evolution-data-server-3.8.5/docs/reference/camel/camel-sections.txt 2013-09-12 15:51:33.407412231 -0400
|
|
|
9cfe9a |
@@ -770,29 +770,6 @@ camel_imapx_command_queue_delete_link
|
|
|
9cfe9a |
</SECTION>
|
|
|
9cfe9a |
|
|
|
9cfe9a |
<SECTION>
|
|
|
9cfe9a |
-<FILE>camel-imapx-conn-manager</FILE>
|
|
|
9cfe9a |
-<TITLE>CamelIMAPXConnManager</TITLE>
|
|
|
9cfe9a |
-CamelIMAPXConnManager
|
|
|
9cfe9a |
-camel_imapx_conn_manager_new
|
|
|
9cfe9a |
-camel_imapx_conn_manager_ref_store
|
|
|
9cfe9a |
-camel_imapx_conn_manager_get_connection
|
|
|
9cfe9a |
-camel_imapx_conn_manager_close_connections
|
|
|
9cfe9a |
-camel_imapx_conn_manager_get_connections
|
|
|
9cfe9a |
-camel_imapx_conn_manager_update_con_info
|
|
|
9cfe9a |
-<SUBSECTION Standard>
|
|
|
9cfe9a |
-CAMEL_IMAPX_CONN_MANAGER
|
|
|
9cfe9a |
-CAMEL_IS_IMAPX_CONN_MANAGER
|
|
|
9cfe9a |
-CAMEL_TYPE_IMAPX_CONN_MANAGER
|
|
|
9cfe9a |
-CAMEL_IMAPX_CONN_MANAGER_CLASS
|
|
|
9cfe9a |
-CAMEL_IS_IMAPX_CONN_MANAGER_CLASS
|
|
|
9cfe9a |
-CAMEL_IMAPX_CONN_MANAGER_GET_CLASS
|
|
|
9cfe9a |
-CamelIMAPXConnManagerClass
|
|
|
9cfe9a |
-camel_imapx_conn_manager_get_type
|
|
|
9cfe9a |
-<SUBSECTION Private>
|
|
|
9cfe9a |
-CamelIMAPXConnManagerPrivate
|
|
|
9cfe9a |
-</SECTION>
|
|
|
9cfe9a |
-
|
|
|
9cfe9a |
-<SECTION>
|
|
|
9cfe9a |
<FILE>camel-imapx-folder</FILE>
|
|
|
9cfe9a |
<TITLE>CamelIMAPXFolder</TITLE>
|
|
|
9cfe9a |
CamelIMAPXFolder
|
|
|
9cfe9a |
@@ -970,8 +947,7 @@ CamelIMAPXSettingsPrivate
|
|
|
9cfe9a |
<FILE>camel-imapx-store</FILE>
|
|
|
9cfe9a |
<TITLE>CamelIMAPXStore</TITLE>
|
|
|
9cfe9a |
CamelIMAPXStore
|
|
|
9cfe9a |
-camel_imapx_store_get_server
|
|
|
9cfe9a |
-camel_imapx_store_op_done
|
|
|
9cfe9a |
+camel_imapx_store_ref_server
|
|
|
9cfe9a |
camel_imapx_store_dup_quota_info
|
|
|
9cfe9a |
camel_imapx_store_set_quota_info
|
|
|
9cfe9a |
<SUBSECTION Standard>
|
|
|
9cfe9a |
diff -up evolution-data-server-3.8.5/docs/reference/camel/camel.types.kill-imapx-conn-manager evolution-data-server-3.8.5/docs/reference/camel/camel.types
|
|
|
9cfe9a |
--- evolution-data-server-3.8.5/docs/reference/camel/camel.types.kill-imapx-conn-manager 2013-08-11 07:26:25.000000000 -0400
|
|
|
9cfe9a |
+++ evolution-data-server-3.8.5/docs/reference/camel/camel.types 2013-09-12 15:51:33.417412228 -0400
|
|
|
9cfe9a |
@@ -16,7 +16,6 @@ camel_folder_search_get_type
|
|
|
9cfe9a |
camel_folder_summary_get_type
|
|
|
9cfe9a |
camel_gpg_context_get_type
|
|
|
9cfe9a |
camel_html_parser_get_type
|
|
|
9cfe9a |
-camel_imapx_conn_manager_get_type
|
|
|
9cfe9a |
camel_imapx_folder_get_type
|
|
|
9cfe9a |
camel_imapx_search_get_type
|
|
|
9cfe9a |
camel_imapx_server_get_type
|