[evolution-exchange] Migrate from CamelException to GError.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-exchange] Migrate from CamelException to GError.
- Date: Thu, 8 Jul 2010 18:37:35 +0000 (UTC)
commit 4c352c04d803bcac8e45e13d6ca8076229f350a7
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Jul 5 09:12:28 2010 -0400
Migrate from CamelException to GError.
addressbook/e-book-backend-exchange.c | 10 +-
calendar/e-cal-backend-exchange.c | 12 +-
camel/camel-exchange-folder.c | 260 ++++++++++++++++++---------------
camel/camel-exchange-folder.h | 2 +-
camel/camel-exchange-journal.c | 181 +++++++++++++----------
camel/camel-exchange-journal.h | 33 +++--
camel/camel-exchange-provider.c | 2 +-
camel/camel-exchange-store.c | 159 +++++++++++---------
camel/camel-exchange-store.h | 2 +-
camel/camel-exchange-summary.c | 35 ++---
camel/camel-exchange-transport.c | 36 +++--
camel/camel-exchange-utils.c | 186 ++++++++++++------------
camel/camel-exchange-utils.h | 40 +++---
eplugin/exchange-delegates-user.c | 4 +-
eplugin/exchange-folder.c | 2 -
15 files changed, 528 insertions(+), 436 deletions(-)
---
diff --git a/addressbook/e-book-backend-exchange.c b/addressbook/e-book-backend-exchange.c
index 765d43e..4dfc027 100644
--- a/addressbook/e-book-backend-exchange.c
+++ b/addressbook/e-book-backend-exchange.c
@@ -520,7 +520,7 @@ e_contact_from_props (EBookBackendExchange *be, E2kResult *result)
stream = camel_stream_mem_new_with_buffer (response->data, response->length);
soup_buffer_free (response);
msg = camel_mime_message_new ();
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), stream);
+ camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), stream, NULL);
g_object_unref (stream);
content = camel_medium_get_content (CAMEL_MEDIUM (msg));
@@ -543,7 +543,7 @@ e_contact_from_props (EBookBackendExchange *be, E2kResult *result)
byte_array = g_byte_array_new ();
stream = camel_stream_mem_new_with_byte_array (byte_array);
- camel_data_wrapper_decode_to_stream (content, stream);
+ camel_data_wrapper_decode_to_stream (content, stream, NULL);
photo.type = E_CONTACT_PHOTO_TYPE_INLINED;
photo.data.inlined.mime_type = NULL;
@@ -1363,7 +1363,7 @@ build_message (const gchar *from_name, const gchar *from_email,
if (note) {
stream = camel_stream_mem_new_with_buffer (note, strlen (note));
wrapper = camel_data_wrapper_new ();
- camel_data_wrapper_construct_from_stream (wrapper, stream);
+ camel_data_wrapper_construct_from_stream (wrapper, stream, NULL);
g_object_unref (stream);
type = camel_content_type_new ("text", "plain");
@@ -1417,7 +1417,7 @@ build_message (const gchar *from_name, const gchar *from_email,
stream = camel_stream_mem_new_with_byte_array (photo_ba);
wrapper = camel_data_wrapper_new ();
- camel_data_wrapper_construct_from_stream (wrapper, stream);
+ camel_data_wrapper_construct_from_stream (wrapper, stream, NULL);
g_object_unref (stream);
camel_data_wrapper_set_mime_type (wrapper, content_type);
@@ -1448,7 +1448,7 @@ build_message (const gchar *from_name, const gchar *from_email,
buffer = g_byte_array_new();
stream = camel_stream_mem_new ();
camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), buffer);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (msg), stream);
+ camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (msg), stream, NULL);
g_object_unref (stream);
g_object_unref (msg);
diff --git a/calendar/e-cal-backend-exchange.c b/calendar/e-cal-backend-exchange.c
index 77d641a..0d217de 100644
--- a/calendar/e-cal-backend-exchange.c
+++ b/calendar/e-cal-backend-exchange.c
@@ -1684,7 +1684,7 @@ save_attach_file (const gchar *dest_file, gchar *file_contents, gint len)
goto end;
}
- if (camel_write (fd, file_contents, len) < 0) {
+ if (camel_write (fd, file_contents, len, NULL) < 0) {
d(printf ("camel write to attach file failed\n"));
goto end;
}
@@ -1713,7 +1713,7 @@ get_attachment (ECalBackendExchange *cbex, const gchar *uid,
stream = camel_stream_mem_new_with_buffer (body, len);
msg = camel_mime_message_new ();
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), stream);
+ camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), stream, NULL);
g_object_unref (stream);
msg_content = camel_medium_get_content (CAMEL_MEDIUM (msg));
@@ -1730,7 +1730,7 @@ get_attachment (ECalBackendExchange *cbex, const gchar *uid,
byte_array = g_byte_array_new ();
stream = camel_stream_mem_new_with_byte_array (byte_array);
- camel_data_wrapper_decode_to_stream (content, stream);
+ camel_data_wrapper_decode_to_stream (content, stream, NULL);
attach_data = g_memdup (byte_array->data, byte_array->len);
attach_file = g_strdup_printf ("%s/%s-%s", cbex->priv->local_attachment_store, uid, filename);
// Attach
@@ -1770,7 +1770,7 @@ get_attach_file_contents (const gchar *filename, gint *length)
if (len > 0) {
file_contents = g_malloc0 (len + 1);
- if (camel_read (fd, file_contents, len) < 0) {
+ if (camel_read (fd, file_contents, len, NULL) < 0) {
d(printf ("reading from the attachment file failed\n"));
g_free (file_contents);
file_contents = NULL;
@@ -2009,7 +2009,7 @@ build_msg ( ECalBackendExchange *cbex, ECalComponent *comp, const gchar *subject
/* Content */
stream = camel_stream_mem_new_with_buffer (file_contents, len);
wrapper = camel_data_wrapper_new ();
- camel_data_wrapper_construct_from_stream (wrapper, stream);
+ camel_data_wrapper_construct_from_stream (wrapper, stream, NULL);
g_object_unref (stream);
mime_type = get_mime_type (dest_url);
@@ -2049,7 +2049,7 @@ build_msg ( ECalBackendExchange *cbex, ECalComponent *comp, const gchar *subject
byte_array = g_byte_array_new ();
stream = camel_stream_mem_new_with_byte_array (byte_array);
dw = camel_medium_get_content (CAMEL_MEDIUM (msg));
- camel_data_wrapper_decode_to_stream (dw, stream);
+ camel_data_wrapper_decode_to_stream (dw, stream, NULL);
buffer = g_memdup (byte_array->data, byte_array->len);
buffer[byte_array->len] = '\0';
d(printf ("|| Buffer: \n%s\n", buffer));
diff --git a/camel/camel-exchange-folder.c b/camel/camel-exchange-folder.c
index 0b3abae..eb3501c 100644
--- a/camel/camel-exchange-folder.c
+++ b/camel/camel-exchange-folder.c
@@ -51,19 +51,20 @@ static const gchar *mailing_list_headers =
G_DEFINE_TYPE (CamelExchangeFolder, camel_exchange_folder, CAMEL_TYPE_OFFLINE_FOLDER)
-static void
+static gboolean
exchange_folder_append_message_data (CamelFolder *folder,
GByteArray *message,
const gchar *subject,
const CamelMessageInfo *info,
gchar **appended_uid,
- CamelException *ex)
+ GError **error)
{
CamelExchangeFolder *exch = CAMEL_EXCHANGE_FOLDER (folder);
CamelStream *stream_cache;
CamelStore *parent_store;
const gchar *full_name;
gchar *new_uid;
+ gboolean success;
full_name = camel_folder_get_full_name (folder);
parent_store = camel_folder_get_parent_store (folder);
@@ -73,17 +74,19 @@ exchange_folder_append_message_data (CamelFolder *folder,
if (!subject)
subject = _("No Subject");
- if (camel_exchange_utils_append_message (
- CAMEL_SERVICE (parent_store), full_name,
- info ? camel_message_info_flags (info) : 0,
- subject, message, &new_uid, ex)) {
+ success = camel_exchange_utils_append_message (
+ CAMEL_SERVICE (parent_store), full_name,
+ info ? camel_message_info_flags (info) : 0,
+ subject, message, &new_uid, error);
+
+ if (success) {
stream_cache = camel_data_cache_add (
exch->cache, "cache", new_uid, NULL);
if (stream_cache) {
camel_stream_write (stream_cache,
(gchar *) message->data,
- message->len);
- camel_stream_flush (stream_cache);
+ message->len, NULL);
+ camel_stream_flush (stream_cache, NULL);
g_object_unref (stream_cache);
}
if (appended_uid)
@@ -92,12 +95,14 @@ exchange_folder_append_message_data (CamelFolder *folder,
g_free (new_uid);
} else if (appended_uid)
*appended_uid = NULL;
+
+ return success;
}
static GByteArray *
exchange_folder_get_message_data (CamelFolder *folder,
const gchar *uid,
- CamelException *ex)
+ GError **error)
{
CamelExchangeFolder *exch;
CamelExchangeStore *store;
@@ -117,32 +122,34 @@ exchange_folder_get_message_data (CamelFolder *folder,
ba = g_byte_array_new ();
stream_mem = camel_stream_mem_new ();
camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream_mem), ba);
- camel_stream_reset (stream);
- camel_stream_write_to_stream (stream, stream_mem);
+ camel_stream_reset (stream, NULL);
+ camel_stream_write_to_stream (stream, stream_mem, NULL);
g_object_unref (CAMEL_OBJECT (stream_mem));
g_object_unref (CAMEL_OBJECT (stream));
return ba;
}
- if (!camel_exchange_store_connected (store, ex)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("This message is not available in offline mode."));
+ if (!camel_exchange_store_connected (store, NULL)) {
+ g_set_error (
+ error, CAMEL_SERVICE_ERROR,
+ CAMEL_SERVICE_ERROR_UNAVAILABLE,
+ _("This message is not available in offline mode."));
return NULL;
}
if (!camel_exchange_utils_get_message (
- CAMEL_SERVICE (parent_store), full_name, uid, &ba, ex))
+ CAMEL_SERVICE (parent_store), full_name, uid, &ba, error))
return NULL;
- stream = camel_data_cache_add (exch->cache, "cache", uid, ex);
+ stream = camel_data_cache_add (exch->cache, "cache", uid, error);
if (!stream) {
g_byte_array_free (ba, TRUE);
return NULL;
}
- camel_stream_write (stream, (gchar *) ba->data, ba->len);
- camel_stream_flush (stream);
+ camel_stream_write (stream, (gchar *) ba->data, ba->len, NULL);
+ camel_stream_flush (stream, NULL);
g_object_unref (stream);
return ba;
@@ -202,19 +209,19 @@ fix_broken_multipart_related (CamelMimePart *part)
}
}
-static void
+static gboolean
exchange_folder_transfer_messages_the_hard_way (CamelFolder *source,
GPtrArray *uids,
CamelFolder *dest,
GPtrArray **transferred_uids,
gboolean delete_originals,
- CamelException *ex)
+ GError **error)
{
- CamelException local_ex;
CamelMessageInfo *info;
CamelStore *parent_store;
GByteArray *ba;
const gchar *full_name;
+ gboolean success = TRUE;
gchar *ret_uid;
gint i;
@@ -223,7 +230,6 @@ exchange_folder_transfer_messages_the_hard_way (CamelFolder *source,
if (transferred_uids)
*transferred_uids = g_ptr_array_new ();
- camel_exception_init (&local_ex);
for (i = 0; i < uids->len; i++) {
info = camel_folder_summary_uid (source->summary, uids->pdata[i]);
@@ -231,18 +237,19 @@ exchange_folder_transfer_messages_the_hard_way (CamelFolder *source,
continue;
ba = exchange_folder_get_message_data (
- source, uids->pdata[i], &local_ex);
+ source, uids->pdata[i], error);
if (!ba) {
camel_message_info_free(info);
+ success = FALSE;
break;
}
- exchange_folder_append_message_data (
- dest, ba, NULL, info, &ret_uid, &local_ex);
+ success = exchange_folder_append_message_data (
+ dest, ba, NULL, info, &ret_uid, error);
camel_message_info_free(info);
g_byte_array_free (ba, TRUE);
- if (camel_exception_is_set (&local_ex))
+ if (!success)
break;
if (transferred_uids)
@@ -251,14 +258,11 @@ exchange_folder_transfer_messages_the_hard_way (CamelFolder *source,
g_free (ret_uid);
}
- if (camel_exception_is_set (&local_ex)) {
- camel_exception_xfer (ex, &local_ex);
- return;
- }
+ if (success && delete_originals)
+ success = camel_exchange_utils_expunge_uids (
+ CAMEL_SERVICE (parent_store), full_name, uids, error);
- if (delete_originals)
- camel_exchange_utils_expunge_uids (
- CAMEL_SERVICE (parent_store), full_name, uids, ex);
+ return success;
}
static void
@@ -283,7 +287,7 @@ exchange_folder_cache_xfer (CamelExchangeFolder *folder_source,
dest = camel_data_cache_add (folder_dest->cache, "cache",
dest_uids->pdata[i], NULL);
if (dest) {
- camel_stream_write_to_stream (src, dest);
+ camel_stream_write_to_stream (src, dest, NULL);
g_object_unref (dest);
}
g_object_unref (src);
@@ -325,13 +329,14 @@ exchange_folder_finalize (GObject *object)
static gboolean
exchange_folder_refresh_info (CamelFolder *folder,
- CamelException *ex)
+ GError **error)
{
CamelExchangeFolder *exch;
CamelExchangeStore *store;
CamelStore *parent_store;
guint32 unread_count, visible_count;
const gchar *full_name;
+ gboolean success = TRUE;
full_name = camel_folder_get_full_name (folder);
parent_store = camel_folder_get_parent_store (folder);
@@ -339,42 +344,46 @@ exchange_folder_refresh_info (CamelFolder *folder,
exch = CAMEL_EXCHANGE_FOLDER (folder);
store = CAMEL_EXCHANGE_STORE (parent_store);
- if (camel_exchange_store_connected (store, ex)) {
+ if (camel_exchange_store_connected (store, NULL)) {
camel_offline_journal_replay (exch->journal, NULL);
camel_exchange_utils_refresh_folder (
- CAMEL_SERVICE (parent_store), full_name, ex);
+ CAMEL_SERVICE (parent_store), full_name, NULL);
}
/* sync up the counts now */
if (!camel_exchange_utils_sync_count (
CAMEL_SERVICE (parent_store), full_name,
- &unread_count, &visible_count, ex)) {
+ &unread_count, &visible_count, error)) {
g_print("\n Error syncing up the counts");
+ success = FALSE;
}
folder->summary->unread_count = unread_count;
folder->summary->visible_count = visible_count;
- return !camel_exception_is_set (ex);
+ return success;
}
static gboolean
exchange_folder_expunge (CamelFolder *folder,
- CamelException *ex)
+ GError **error)
{
CamelFolder *trash;
GPtrArray *uids;
CamelExchangeStore *store;
CamelStore *parent_store;
const gchar *full_name;
+ gboolean success;
parent_store = camel_folder_get_parent_store (folder);
store = CAMEL_EXCHANGE_STORE (parent_store);
- if (!camel_exchange_store_connected (store, ex)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("You cannot expunge in offline mode."));
+ if (!camel_exchange_store_connected (store, NULL)) {
+ g_set_error (
+ error, CAMEL_SERVICE_ERROR,
+ CAMEL_SERVICE_ERROR_UNAVAILABLE,
+ _("You cannot expunge in offline mode."));
return FALSE;
}
@@ -386,25 +395,23 @@ exchange_folder_expunge (CamelFolder *folder,
uids = camel_folder_get_uids (trash);
full_name = camel_folder_get_full_name (trash);
- camel_exchange_utils_expunge_uids (
- CAMEL_SERVICE (parent_store), full_name, uids, ex);
+ success = camel_exchange_utils_expunge_uids (
+ CAMEL_SERVICE (parent_store), full_name, uids, error);
camel_folder_free_uids (trash, uids);
g_object_unref (trash);
- return TRUE;
+ return success;
}
static gboolean
exchange_folder_sync (CamelFolder *folder,
gboolean expunge,
- CamelException *ex)
+ GError **error)
{
if (expunge)
- exchange_folder_expunge (folder, ex);
-
- camel_folder_summary_save_to_db (folder->summary, ex);
+ exchange_folder_expunge (folder, NULL);
- return !camel_exception_is_set (ex);
+ return camel_folder_summary_save_to_db (folder->summary, error);
}
static gboolean
@@ -412,7 +419,7 @@ exchange_folder_append_message (CamelFolder *folder,
CamelMimeMessage *message,
const CamelMessageInfo *info,
gchar **appended_uid,
- CamelException *ex)
+ GError **error)
{
CamelStream *stream;
CamelExchangeStore *store;
@@ -421,6 +428,7 @@ exchange_folder_append_message (CamelFolder *folder,
gchar *old_subject = NULL;
GString *new_subject;
gint i, len;
+ gboolean success;
parent_store = camel_folder_get_parent_store (folder);
store = CAMEL_EXCHANGE_STORE (parent_store);
@@ -448,30 +456,32 @@ exchange_folder_append_message (CamelFolder *folder,
g_string_free (new_subject, TRUE);
}
- if (!camel_exchange_store_connected (store, ex)) {
- camel_exchange_journal_append ((CamelExchangeJournal *) ((CamelExchangeFolder *)folder)->journal, message, info, appended_uid, ex);
- return !camel_exception_is_set (ex);
- }
+ if (!camel_exchange_store_connected (store, NULL))
+ return camel_exchange_journal_append (
+ (CamelExchangeJournal *)
+ ((CamelExchangeFolder *)folder)->journal,
+ message, info, appended_uid, error);
byte_array = g_byte_array_new ();
stream = camel_stream_mem_new_with_byte_array (byte_array);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream);
- camel_stream_flush (stream);
+ camel_data_wrapper_write_to_stream (
+ CAMEL_DATA_WRAPPER (message), stream, NULL);
+ camel_stream_flush (stream, NULL);
- exchange_folder_append_message_data (
+ success = exchange_folder_append_message_data (
folder, byte_array,
camel_mime_message_get_subject (message),
- info, appended_uid, ex);
+ info, appended_uid, error);
g_object_unref (stream);
- return !camel_exception_is_set (ex);
+ return success;
}
static CamelMimeMessage *
exchange_folder_get_message (CamelFolder *folder,
const gchar *uid,
- CamelException *ex)
+ GError **error)
{
CamelExchangeFolder *exch = CAMEL_EXCHANGE_FOLDER (folder);
CamelMimeMessage *msg;
@@ -482,7 +492,7 @@ exchange_folder_get_message (CamelFolder *folder,
gchar **list_headers = NULL;
gboolean found_list = FALSE;
- ba = exchange_folder_get_message_data (folder, uid, ex);
+ ba = exchange_folder_get_message_data (folder, uid, error);
if (!ba)
return NULL;
@@ -511,8 +521,9 @@ exchange_folder_get_message (CamelFolder *folder,
g_object_unref (stream);
msg = camel_mime_message_new ();
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg),
- CAMEL_STREAM (filtered_stream));
+ camel_data_wrapper_construct_from_stream (
+ CAMEL_DATA_WRAPPER (msg),
+ CAMEL_STREAM (filtered_stream), NULL);
g_object_unref (filtered_stream);
camel_mime_message_set_source (msg, exch->source);
@@ -552,14 +563,16 @@ exchange_folder_cmp_uids (CamelFolder *folder,
static GPtrArray *
exchange_folder_search_by_expression (CamelFolder *folder,
const gchar *expression,
- CamelException *ex)
+ GError **error)
{
CamelFolderSearch *search;
GPtrArray *matches;
search = camel_exchange_search_new ();
camel_folder_search_set_folder (search, folder);
- matches = camel_folder_search_search (search, expression, NULL, ex);
+
+ matches = camel_folder_search_search (
+ search, expression, NULL, error);
g_object_unref (search);
@@ -570,7 +583,7 @@ static GPtrArray *
exchange_folder_search_by_uids (CamelFolder *folder,
const gchar *expression,
GPtrArray *uids,
- CamelException *ex)
+ GError **error)
{
CamelFolderSearch *search;
GPtrArray *matches;
@@ -578,7 +591,9 @@ exchange_folder_search_by_uids (CamelFolder *folder,
search = camel_exchange_search_new ();
camel_folder_search_set_folder (search, folder);
camel_folder_search_set_summary (search, uids);
- matches = camel_folder_search_execute_expression (search, expression, ex);
+
+ matches = camel_folder_search_execute_expression (
+ search, expression, error);
g_object_unref (search);
@@ -591,7 +606,7 @@ exchange_folder_transfer_messages_to (CamelFolder *source,
CamelFolder *dest,
GPtrArray **transferred_uids,
gboolean delete_originals,
- CamelException *ex)
+ GError **error)
{
CamelExchangeFolder *exch_source = CAMEL_EXCHANGE_FOLDER (source);
CamelExchangeFolder *exch_dest = CAMEL_EXCHANGE_FOLDER (dest);
@@ -602,6 +617,8 @@ exchange_folder_transfer_messages_to (CamelFolder *source,
const gchar *source_full_name;
const gchar *dest_full_name;
gint hier_len, i;
+ gboolean success = TRUE;
+ GError *local_error = NULL;
parent_store = camel_folder_get_parent_store (source);
store = CAMEL_EXCHANGE_STORE (parent_store);
@@ -610,28 +627,39 @@ exchange_folder_transfer_messages_to (CamelFolder *source,
_("Copying messages"));
/* Check for offline operation */
- if (!camel_exchange_store_connected (store, ex)) {
- CamelExchangeJournal *journal = (CamelExchangeJournal *) exch_dest->journal;
+ if (!camel_exchange_store_connected (store, &local_error)) {
+ CamelExchangeJournal *journal;
CamelMimeMessage *message;
- for (i = 0; i < uids->len; i++) {
- info = camel_folder_summary_uid (source->summary, uids->pdata[i]);
+ if (local_error != NULL) {
+ g_propagate_error (error, local_error);
+ success = FALSE;
+ goto end;
+ }
+
+ journal = (CamelExchangeJournal *) exch_dest->journal;
+
+ for (i = 0; i < uids->len && success; i++) {
+ info = camel_folder_summary_uid (
+ source->summary, uids->pdata[i]);
if (!info)
continue;
- if (!(message = exchange_folder_get_message (
- source, camel_message_info_uid (info), ex)))
+ message = exchange_folder_get_message (
+ source, camel_message_info_uid (info), error);
+ if (message == NULL) {
+ success = FALSE;
break;
+ }
- camel_exchange_journal_transfer (journal, exch_source, message,
- info, uids->pdata[i], NULL,
- delete_originals, ex);
+ success = camel_exchange_journal_transfer (
+ journal, exch_source, message,
+ info, uids->pdata[i], NULL,
+ delete_originals, error);
g_object_unref (message);
-
- if (camel_exception_is_set (ex))
- break;
}
+
goto end;
}
@@ -639,20 +667,17 @@ exchange_folder_transfer_messages_to (CamelFolder *source,
dest_full_name = camel_folder_get_full_name (dest);
hier_len = strcspn (source_full_name, "/");
- if (strncmp (source_full_name, dest_full_name, hier_len) != 0) {
- exchange_folder_transfer_messages_the_hard_way (
+ if (strncmp (source_full_name, dest_full_name, hier_len) != 0)
+ return exchange_folder_transfer_messages_the_hard_way (
source, uids, dest, transferred_uids,
- delete_originals, ex);
- return !camel_exception_is_set (ex);
- }
+ delete_originals, error);
+
+ success = camel_exchange_utils_transfer_messages (
+ CAMEL_SERVICE (store),
+ source_full_name, dest_full_name,
+ uids, delete_originals, &ret_uids, error);
- if (camel_exchange_utils_transfer_messages (CAMEL_SERVICE (store),
- source_full_name,
- dest_full_name,
- uids,
- delete_originals,
- &ret_uids,
- ex)) {
+ if (success) {
if (ret_uids->len != 0)
exchange_folder_cache_xfer (
exch_source, exch_dest, uids, ret_uids, FALSE);
@@ -665,23 +690,24 @@ exchange_folder_transfer_messages_to (CamelFolder *source,
}
} else if (transferred_uids)
*transferred_uids = NULL;
+
end:
camel_operation_end (NULL);
- return !camel_exception_is_set (ex);
+ return success;
}
static guint32
exchange_folder_count_by_expression (CamelFolder *folder,
const gchar *expression,
- CamelException *ex)
+ GError **error)
{
CamelFolderSearch *search;
guint32 matches;
search = camel_exchange_search_new ();
camel_folder_search_set_folder (search, folder);
- matches = camel_folder_search_count (search, expression, ex);
+ matches = camel_folder_search_count (search, expression, error);
g_object_unref (search);
@@ -691,7 +717,7 @@ exchange_folder_count_by_expression (CamelFolder *folder,
static gchar *
exchange_folder_get_filename (CamelFolder *folder,
const gchar *uid,
- CamelException *ex)
+ GError **error)
{
CamelExchangeFolder *exch = CAMEL_EXCHANGE_FOLDER (folder);
@@ -798,7 +824,7 @@ camel_exchange_folder_add_message (CamelExchangeFolder *exch,
stream = camel_stream_mem_new_with_buffer (headers, strlen (headers));
msg = camel_mime_message_new ();
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), stream);
+ camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), stream, NULL);
g_object_unref (stream);
info = camel_folder_summary_info_new_from_message (folder->summary, msg, NULL);
@@ -1012,7 +1038,7 @@ camel_exchange_folder_update_message_tag (CamelExchangeFolder *exch,
* @camel_flags: the folder flags passed to camel_store_get_folder().
* @folder_dir: local directory this folder can cache data into
* @offline_state : offline status
- * @ex: a #CamelException
+ * @error: return location for a #GError, or %NULL
*
* Return value: success or failure.
**/
@@ -1021,7 +1047,7 @@ camel_exchange_folder_construct (CamelFolder *folder,
guint32 camel_flags,
const gchar *folder_dir,
gint offline_state,
- CamelException *ex)
+ GError **error)
{
CamelExchangeFolder *exch = (CamelExchangeFolder *)folder;
gchar *summary_file, *journal_file, *path;
@@ -1038,9 +1064,11 @@ camel_exchange_folder_construct (CamelFolder *folder,
parent_store = camel_folder_get_parent_store (folder);
if (g_mkdir_with_parents (folder_dir, S_IRWXU) != 0) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create directory %s: %s"),
- folder_dir, g_strerror (errno));
+ g_set_error (
+ error, G_IO_ERROR,
+ g_io_error_from_errno (errno),
+ _("Could not create directory %s: %s"),
+ folder_dir, g_strerror (errno));
return FALSE;
}
@@ -1048,17 +1076,17 @@ camel_exchange_folder_construct (CamelFolder *folder,
folder->summary = camel_exchange_summary_new (folder, summary_file);
g_free (summary_file);
if (!folder->summary) {
- camel_exception_setv (
- ex, CAMEL_EXCEPTION_SYSTEM,
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
_("Could not load summary for %s"), full_name);
return FALSE;
}
- exch->cache = camel_data_cache_new (folder_dir, ex);
+ exch->cache = camel_data_cache_new (folder_dir, error);
if (!exch->cache) {
- camel_exception_setv (
- ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create cache for %s"), full_name);
+ g_prefix_error (
+ error, _("Could not create cache for %s: "),
+ full_name);
return FALSE;
}
@@ -1066,8 +1094,8 @@ camel_exchange_folder_construct (CamelFolder *folder,
exch->journal = camel_exchange_journal_new (exch, journal_file);
g_free (journal_file);
if (!exch->journal) {
- camel_exception_setv (
- ex, CAMEL_EXCEPTION_SYSTEM,
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
_("Could not create journal for %s"), full_name);
return FALSE;
}
@@ -1097,7 +1125,7 @@ camel_exchange_folder_construct (CamelFolder *folder,
if (parent_store != NULL) {
gboolean ok, create = camel_flags & CAMEL_STORE_FOLDER_CREATE, readonly = FALSE;
- camel_folder_summary_prepare_fetch_all (folder->summary, ex);
+ camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
summary = camel_folder_get_summary (folder);
uids = g_ptr_array_new ();
@@ -1120,7 +1148,7 @@ camel_exchange_folder_construct (CamelFolder *folder,
CAMEL_SERVICE (parent_store),
full_name, create, uids, flags, hrefs,
CAMEL_EXCHANGE_SUMMARY (folder->summary)->high_article_num,
- &folder_flags, &exch->source, &readonly, ex);
+ &folder_flags, &exch->source, &readonly, error);
camel_operation_end (NULL);
g_ptr_array_free (uids, TRUE);
g_byte_array_free (flags, TRUE);
@@ -1144,12 +1172,12 @@ camel_exchange_folder_construct (CamelFolder *folder,
camel_operation_start (NULL, _("Fetching summary information for new messages"));
ok = camel_exchange_utils_refresh_folder (
- CAMEL_SERVICE (parent_store), full_name, ex);
+ CAMEL_SERVICE (parent_store), full_name, error);
camel_operation_end (NULL);
if (!ok)
return FALSE;
- camel_folder_summary_save_to_db (folder->summary, ex);
+ camel_folder_summary_save_to_db (folder->summary, NULL);
}
if (camel_exchange_summary_get_readonly (folder->summary))
diff --git a/camel/camel-exchange-folder.h b/camel/camel-exchange-folder.h
index 8e77485..5007559 100644
--- a/camel/camel-exchange-folder.h
+++ b/camel/camel-exchange-folder.h
@@ -52,7 +52,7 @@ gboolean camel_exchange_folder_construct (CamelFolder *folder,
guint32 camel_flags,
const gchar *folder_dir,
gint offline_state,
- CamelException *ex);
+ GError **error);
void camel_exchange_folder_add_message (CamelExchangeFolder *exch,
const gchar *uid,
diff --git a/camel/camel-exchange-journal.c b/camel/camel-exchange-journal.c
index 15c7b85..67b3cb5 100644
--- a/camel/camel-exchange-journal.c
+++ b/camel/camel-exchange-journal.c
@@ -57,22 +57,21 @@ exchange_message_info_dup_to (CamelMessageInfoBase *dest,
static gint
exchange_entry_play_append (CamelOfflineJournal *journal,
CamelExchangeJournalEntry *entry,
- CamelException *ex)
+ GError **error)
{
CamelExchangeFolder *exchange_folder = (CamelExchangeFolder *) journal->folder;
CamelFolder *folder = journal->folder;
CamelMimeMessage *message;
CamelMessageInfo *info, *real;
CamelStream *stream;
- CamelException lex;
gchar *uid = NULL;
/* if the message isn't in the cache, the user went behind our backs so "not our problem" */
- if (!exchange_folder->cache || !(stream = camel_data_cache_get (exchange_folder->cache, "cache", entry->uid, ex)))
+ if (!exchange_folder->cache || !(stream = camel_data_cache_get (exchange_folder->cache, "cache", entry->uid, NULL)))
goto done;
message = camel_mime_message_new ();
- if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream) == -1) {
+ if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream, NULL) == -1) {
g_object_unref (message);
g_object_unref (stream);
goto done;
@@ -85,13 +84,8 @@ exchange_entry_play_append (CamelOfflineJournal *journal,
info = camel_message_info_new (NULL);
}
- camel_exception_init (&lex);
- camel_folder_append_message (folder, message, info, &uid, &lex);
-
- if (camel_exception_is_set (&lex)) {
- camel_exception_xfer (ex, &lex);
+ if (!camel_folder_append_message (folder, message, info, &uid, error))
return -1;
- }
real = camel_folder_summary_info_new_from_message (folder->summary, message, NULL);
g_object_unref (message);
@@ -115,24 +109,23 @@ exchange_entry_play_append (CamelOfflineJournal *journal,
static gint
exchange_entry_play_transfer (CamelOfflineJournal *journal,
CamelExchangeJournalEntry *entry,
- CamelException *ex)
+ GError **error)
{
CamelExchangeFolder *exchange_folder = (CamelExchangeFolder *) journal->folder;
CamelFolder *folder = journal->folder;
CamelMessageInfo *info, *real;
GPtrArray *xuids, *uids;
- CamelException lex;
CamelFolder *src;
CamelExchangeStore *store;
CamelStream *stream;
CamelMimeMessage *message;
CamelStore *parent_store;
- if (!exchange_folder->cache || !(stream = camel_data_cache_get (exchange_folder->cache, "cache", entry->uid, ex)))
+ if (!exchange_folder->cache || !(stream = camel_data_cache_get (exchange_folder->cache, "cache", entry->uid, NULL)))
goto done;
message = camel_mime_message_new ();
- if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream) == -1) {
+ if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream, NULL) == -1) {
g_object_unref (message);
g_object_unref (stream);
goto done;
@@ -146,7 +139,9 @@ exchange_entry_play_transfer (CamelOfflineJournal *journal,
}
if (!entry->folder_name) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("No folder name found\n"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("No folder name found"));
goto exception;
}
@@ -158,30 +153,36 @@ exchange_entry_play_transfer (CamelOfflineJournal *journal,
g_mutex_unlock (store->folders_lock);
if (src) {
+ gboolean success;
uids = g_ptr_array_sized_new (1);
g_ptr_array_add (uids, entry->original_uid);
- camel_exception_init (&lex);
- camel_folder_transfer_messages_to (src, uids, folder, &xuids, entry->delete_original, &lex);
- if (!camel_exception_is_set (&lex)) {
- real = camel_folder_summary_info_new_from_message (folder->summary, message, NULL);
- g_object_unref (message);
- real->uid = camel_pstring_strdup ((gchar *)xuids->pdata[0]);
- /* Transfer flags */
- exchange_message_info_dup_to ((CamelMessageInfoBase *) real, (CamelMessageInfoBase *) info);
- camel_folder_summary_add (folder->summary, real);
- /* FIXME: should a folder_changed event be triggered? */
- } else {
- camel_exception_xfer (ex, &lex);
+ success = camel_folder_transfer_messages_to (
+ src, uids, folder, &xuids,
+ entry->delete_original, error);
+ if (!success)
goto exception;
- }
+
+ real = camel_folder_summary_info_new_from_message (
+ folder->summary, message, NULL);
+ g_object_unref (message);
+ real->uid = camel_pstring_strdup (
+ (gchar *)xuids->pdata[0]);
+ /* Transfer flags */
+ exchange_message_info_dup_to (
+ (CamelMessageInfoBase *) real,
+ (CamelMessageInfoBase *) info);
+ camel_folder_summary_add (folder->summary, real);
+ /* FIXME: should a folder_changed event be triggered? */
g_ptr_array_free (xuids, TRUE);
g_ptr_array_free (uids, TRUE);
/* g_object_unref (src); FIXME: should we? */
- }
- else {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Folder doesn't exist"));
+
+ } else {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("Folder doesn't exist"));
goto exception;
}
@@ -201,21 +202,22 @@ exception:
static gint
exchange_entry_play_delete (CamelOfflineJournal *journal,
CamelExchangeJournalEntry *entry,
- CamelException *ex)
+ GError **error)
{
CamelFolder *folder;
CamelStore *parent_store;
const gchar *full_name;
+ gboolean success;
folder = CAMEL_FOLDER (journal->folder);
full_name = camel_folder_get_full_name (folder);
parent_store = camel_folder_get_parent_store (folder);
- camel_exchange_utils_set_message_flags (
+ success = camel_exchange_utils_set_message_flags (
CAMEL_SERVICE (parent_store), full_name,
- entry->uid, entry->set, entry->flags, ex);
+ entry->uid, entry->set, entry->flags, error);
- return 0;
+ return success ? 0 : -1;
}
static void
@@ -344,17 +346,20 @@ exchange_journal_entry_write (CamelOfflineJournal *journal,
static gint
exchange_journal_entry_play (CamelOfflineJournal *journal,
CamelDListNode *entry,
- CamelException *ex)
+ GError **error)
{
CamelExchangeJournalEntry *exchange_entry = (CamelExchangeJournalEntry *) entry;
switch (exchange_entry->type) {
case CAMEL_EXCHANGE_JOURNAL_ENTRY_APPEND:
- return exchange_entry_play_append (journal, exchange_entry, ex);
+ return exchange_entry_play_append (
+ journal, exchange_entry, error);
case CAMEL_EXCHANGE_JOURNAL_ENTRY_TRANSFER:
- return exchange_entry_play_transfer (journal, exchange_entry, ex);
+ return exchange_entry_play_transfer (
+ journal, exchange_entry, error);
case CAMEL_EXCHANGE_JOURNAL_ENTRY_DELETE:
- return exchange_entry_play_delete (journal, exchange_entry, ex);
+ return exchange_entry_play_delete (
+ journal, exchange_entry, error);
default:
g_critical ("%s: Uncaught case (%d)", G_STRLOC, exchange_entry->type);
return -1;
@@ -392,8 +397,11 @@ camel_exchange_journal_new (CamelExchangeFolder *folder, const gchar *filename)
}
static gboolean
-update_cache (CamelExchangeJournal *exchange_journal, CamelMimeMessage *message,
- const CamelMessageInfo *mi, gchar **updated_uid, CamelException *ex)
+update_cache (CamelExchangeJournal *exchange_journal,
+ CamelMimeMessage *message,
+ const CamelMessageInfo *mi,
+ gchar **updated_uid,
+ GError **error)
{
CamelOfflineJournal *journal = (CamelOfflineJournal *) exchange_journal;
CamelExchangeFolder *exchange_folder = (CamelExchangeFolder *) journal->folder;
@@ -404,26 +412,31 @@ update_cache (CamelExchangeJournal *exchange_journal, CamelMimeMessage *message,
gchar *uid;
if (exchange_folder->cache == NULL) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot append message in offline mode: cache unavailable"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("Cannot append message in offline mode: "
+ "cache unavailable"));
return FALSE;
}
nextuid = camel_folder_summary_next_uid (folder->summary);
uid = g_strdup_printf ("-%u", nextuid);
- if (!(cache = camel_data_cache_add (exchange_folder->cache, "cache", uid, ex))) {
+ cache = camel_data_cache_add (
+ exchange_folder->cache, "cache", uid, error);
+ if (cache == NULL) {
folder->summary->nextuid--;
g_free (uid);
return FALSE;
}
- if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *) message, cache) == -1
- || camel_stream_flush (cache) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot append message in offline mode: %s"),
- g_strerror (errno));
- camel_data_cache_remove (exchange_folder->cache, "cache", uid, NULL);
+ if (camel_data_wrapper_write_to_stream (
+ (CamelDataWrapper *) message, cache, error) == -1
+ || camel_stream_flush (cache, error) == -1) {
+ g_prefix_error (
+ error, _("Cannot append message in offline mode: "));
+ camel_data_cache_remove (
+ exchange_folder->cache, "cache", uid, NULL);
folder->summary->nextuid--;
g_object_unref (cache);
g_free (uid);
@@ -432,10 +445,13 @@ update_cache (CamelExchangeJournal *exchange_journal, CamelMimeMessage *message,
g_object_unref (cache);
- info = camel_folder_summary_info_new_from_message (folder->summary, message, NULL);
+ info = camel_folder_summary_info_new_from_message (
+ folder->summary, message, NULL);
info->uid = camel_pstring_strdup (uid);
- exchange_message_info_dup_to ((CamelMessageInfoBase *) info, (CamelMessageInfoBase *) mi);
+ exchange_message_info_dup_to (
+ (CamelMessageInfoBase *) info,
+ (CamelMessageInfoBase *) mi);
camel_folder_summary_add (folder->summary, info);
@@ -447,16 +463,19 @@ update_cache (CamelExchangeJournal *exchange_journal, CamelMimeMessage *message,
return TRUE;
}
-void
-camel_exchange_journal_append (CamelExchangeJournal *exchange_journal, CamelMimeMessage *message,
- const CamelMessageInfo *mi, gchar **appended_uid, CamelException *ex)
+gboolean
+camel_exchange_journal_append (CamelExchangeJournal *exchange_journal,
+ CamelMimeMessage *message,
+ const CamelMessageInfo *mi,
+ gchar **appended_uid,
+ GError **error)
{
CamelOfflineJournal *journal = (CamelOfflineJournal *) exchange_journal;
CamelExchangeJournalEntry *entry;
gchar *uid;
- if (!update_cache (exchange_journal, message, mi, &uid, ex))
- return;
+ if (!update_cache (exchange_journal, message, mi, &uid, error))
+ return FALSE;
entry = g_new (CamelExchangeJournalEntry, 1);
entry->type = CAMEL_EXCHANGE_JOURNAL_ENTRY_APPEND;
@@ -467,13 +486,14 @@ camel_exchange_journal_append (CamelExchangeJournal *exchange_journal, CamelMime
if (appended_uid)
*appended_uid = g_strdup (uid);
+ return TRUE;
}
static gint
find_real_source_for_message (CamelExchangeFolder *folder,
- const gchar **folder_name,
- const gchar **uid,
- gboolean delete_original)
+ const gchar **folder_name,
+ const gchar **uid,
+ gboolean delete_original)
{
CamelOfflineJournal *journal = folder->journal;
CamelDListNode *entry, *next;
@@ -510,11 +530,15 @@ find_real_source_for_message (CamelExchangeFolder *folder,
return type;
}
-void
-camel_exchange_journal_transfer (CamelExchangeJournal *exchange_journal, CamelExchangeFolder *source_folder,
- CamelMimeMessage *message, const CamelMessageInfo *mi,
- const gchar *original_uid, gchar **transferred_uid, gboolean delete_original,
- CamelException *ex)
+gboolean
+camel_exchange_journal_transfer (CamelExchangeJournal *exchange_journal,
+ CamelExchangeFolder *source_folder,
+ CamelMimeMessage *message,
+ const CamelMessageInfo *mi,
+ const gchar *original_uid,
+ gchar **transferred_uid,
+ gboolean delete_original,
+ GError **error)
{
CamelOfflineJournal *journal = (CamelOfflineJournal *) exchange_journal;
CamelExchangeJournalEntry *entry;
@@ -522,19 +546,20 @@ camel_exchange_journal_transfer (CamelExchangeJournal *exchange_journal, CamelEx
const gchar *real_source_folder = NULL, *real_uid = NULL;
gint type;
- if (!update_cache (exchange_journal, message, mi, &uid, ex))
- return;
+ if (!update_cache (exchange_journal, message, mi, &uid, error))
+ return FALSE;
real_uid = original_uid;
real_source_folder = camel_folder_get_full_name (
CAMEL_FOLDER (source_folder));
- type = find_real_source_for_message (source_folder, &real_source_folder,
- &real_uid, delete_original);
+ type = find_real_source_for_message (
+ source_folder, &real_source_folder,
+ &real_uid, delete_original);
- if (delete_original) {
- camel_exchange_folder_remove_message (source_folder, original_uid);
- }
+ if (delete_original)
+ camel_exchange_folder_remove_message (
+ source_folder, original_uid);
entry = g_new (CamelExchangeJournalEntry, 1);
entry->type = type;
@@ -550,12 +575,16 @@ camel_exchange_journal_transfer (CamelExchangeJournal *exchange_journal, CamelEx
if (transferred_uid)
*transferred_uid = g_strdup (uid);
+
+ return TRUE;
}
-void
+gboolean
camel_exchange_journal_delete (CamelExchangeJournal *exchange_journal,
- const gchar *uid, guint32 flags, guint32 set,
- CamelException *ex)
+ const gchar *uid,
+ guint32 flags,
+ guint32 set,
+ GError **error)
{
CamelOfflineJournal *journal = (CamelOfflineJournal *) exchange_journal;
CamelExchangeFolder *exchange_folder = (CamelExchangeFolder *) journal->folder;
@@ -571,5 +600,7 @@ camel_exchange_journal_delete (CamelExchangeJournal *exchange_journal,
entry->set = set;
camel_dlist_addtail (&journal->queue, (CamelDListNode *) entry);
+
+ return TRUE;
}
diff --git a/camel/camel-exchange-journal.h b/camel/camel-exchange-journal.h
index 0e2e5b1..c7b6ab5 100644
--- a/camel/camel-exchange-journal.h
+++ b/camel/camel-exchange-journal.h
@@ -83,19 +83,30 @@ struct _CamelExchangeJournalClass {
GType camel_exchange_journal_get_type (void);
-CamelOfflineJournal *camel_exchange_journal_new (CamelExchangeFolder *folder, const gchar *filename);
+CamelOfflineJournal *
+ camel_exchange_journal_new (CamelExchangeFolder *folder,
+ const gchar *filename);
/* interfaces for adding a journal entry */
-void camel_exchange_journal_append (CamelExchangeJournal *journal, CamelMimeMessage *message,
- const CamelMessageInfo *mi, gchar **appended_uid, CamelException *ex);
-
-void camel_exchange_journal_transfer (CamelExchangeJournal *journal, CamelExchangeFolder *source_folder,
- CamelMimeMessage *message, const CamelMessageInfo *mi,
- const gchar *original_uid, gchar **transferred_uid,
- gboolean delete_original, CamelException *ex);
-
-void camel_exchange_journal_delete (CamelExchangeJournal *journal, const gchar *uid,
- guint32 flags, guint32 set, CamelException *ex);
+gboolean camel_exchange_journal_append (CamelExchangeJournal *journal,
+ CamelMimeMessage *message,
+ const CamelMessageInfo *mi,
+ gchar **appended_uid,
+ GError **error);
+
+gboolean camel_exchange_journal_transfer (CamelExchangeJournal *journal,
+ CamelExchangeFolder *source_folder,
+ CamelMimeMessage *message,
+ const CamelMessageInfo *mi,
+ const gchar *original_uid,
+ gchar **transferred_uid,
+ gboolean delete_original,
+ GError **error);
+gboolean camel_exchange_journal_delete (CamelExchangeJournal *journal,
+ const gchar *uid,
+ guint32 flags,
+ guint32 set,
+ GError **error);
G_END_DECLS
diff --git a/camel/camel-exchange-provider.c b/camel/camel-exchange-provider.c
index 8e6ca1f..83f1986 100644
--- a/camel/camel-exchange-provider.c
+++ b/camel/camel-exchange-provider.c
@@ -148,7 +148,7 @@ CamelServiceAuthType camel_exchange_password_authtype = {
static gint
exchange_auto_detect_cb (CamelURL *url, GHashTable **auto_detected,
- CamelException *ex)
+ GError **error)
{
*auto_detected = g_hash_table_new (g_str_hash, g_str_equal);
diff --git a/camel/camel-exchange-store.c b/camel/camel-exchange-store.c
index fe974ec..ea7d8dd 100644
--- a/camel/camel-exchange-store.c
+++ b/camel/camel-exchange-store.c
@@ -252,7 +252,7 @@ exchange_store_construct (CamelService *service,
CamelSession *session,
CamelProvider *provider,
CamelURL *url,
- CamelException *ex)
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (service);
CamelServiceClass *service_class;
@@ -261,7 +261,7 @@ exchange_store_construct (CamelService *service,
service_class = CAMEL_SERVICE_CLASS (
camel_exchange_store_parent_class);
- if (!service_class->construct (service, session, provider, url, ex))
+ if (!service_class->construct (service, session, provider, url, error))
return FALSE;
exch->base_url = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
@@ -273,15 +273,15 @@ exchange_store_construct (CamelService *service,
*p = '\0';
}
- if (!(exch->storage_path = camel_session_get_storage_path (session, service, ex)))
- return FALSE;
+ exch->storage_path = camel_session_get_storage_path (
+ session, service, error);
- return TRUE;
+ return (exch->storage_path != NULL);
}
static GList *
exchange_store_query_auth_types (CamelService *service,
- CamelException *ex)
+ GError **error)
{
GList *list = NULL;
@@ -308,13 +308,14 @@ exchange_store_get_name (CamelService *service,
static gboolean
exchange_store_connect (CamelService *service,
- CamelException *ex)
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (service);
gchar *password = NULL;
guint32 connect_status;
gboolean online_mode = FALSE;
CamelSession *session = camel_service_get_session (service);
+ GError *local_error = NULL;
/* This lock is only needed for offline operation.
* exchange_store_connect() is called many times in offline. */
@@ -336,25 +337,30 @@ exchange_store_connect (CamelService *service,
service->url->passwd = camel_session_get_password (
session, service, "Exchange", prompt,
- "password", prompt_flags, ex);
+ "password", prompt_flags, error);
g_free (prompt);
exch->reprompt_password = service->url->passwd == NULL;
}
- if (camel_exception_is_set (ex)) {
+ if (service->url->passwd == NULL) {
g_mutex_unlock (exch->connect_lock);
return FALSE;
}
+
password = service->url->passwd;
}
/* Initialize the stub connection */
- if (!camel_exchange_utils_connect (service, password, &connect_status, ex)) {
+ if (!camel_exchange_utils_connect (service, password, &connect_status, &local_error)) {
/* The user cancelled the connection attempt. */
- if (!camel_exception_is_set (ex))
- camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, "Cancelled");
+ if (local_error == NULL)
+ g_set_error (
+ error, G_IO_ERROR,
+ G_IO_ERROR_CANCELLED,
+ "Cancelled");
+ g_propagate_error (error, local_error);
g_mutex_unlock (exch->connect_lock);
return FALSE;
}
@@ -367,9 +373,10 @@ exchange_store_connect (CamelService *service,
service->url->passwd = NULL;
}
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not authenticate to server. "
- "(Password incorrect?)\n\n"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("Could not authenticate to server. "
+ "(Password incorrect?)"));
g_mutex_unlock (exch->connect_lock);
return FALSE;
}
@@ -382,7 +389,7 @@ exchange_store_connect (CamelService *service,
static gboolean
exchange_store_disconnect (CamelService *service,
gboolean clean,
- CamelException *ex)
+ GError **error)
{
/* CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (service); */
/* keep account connect as it can be used for other parts like cal, gal or addressbook? */
@@ -391,32 +398,33 @@ exchange_store_disconnect (CamelService *service,
static CamelFolder *
exchange_store_get_trash (CamelStore *store,
- CamelException *ex)
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
- RETURN_VAL_IF_NOT_CONNECTED (exch, ex, NULL);
+ RETURN_VAL_IF_NOT_CONNECTED (exch, error, NULL);
if (!exch->trash_name) {
- if (!camel_exchange_utils_get_trash_name (CAMEL_SERVICE (store), &exch->trash_name, ex))
+ if (!camel_exchange_utils_get_trash_name (
+ CAMEL_SERVICE (store), &exch->trash_name, error))
return NULL;
}
- return camel_store_get_folder (store, exch->trash_name, 0, ex);
+ return camel_store_get_folder (store, exch->trash_name, 0, error);
}
static CamelFolder *
exchange_store_get_folder (CamelStore *store,
const gchar *folder_name,
guint32 flags,
- CamelException *ex)
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
CamelFolder *folder;
const gchar *short_name;
gchar *folder_dir;
- RETURN_VAL_IF_NOT_CONNECTED (exch, ex, NULL);
+ RETURN_VAL_IF_NOT_CONNECTED (exch, error, NULL);
if (!folder_name || !*folder_name || g_ascii_strcasecmp (folder_name, "inbox") == 0)
folder_name = "personal/Inbox";
@@ -424,11 +432,13 @@ exchange_store_get_folder (CamelStore *store,
folder_dir = exchange_store_path_to_physical (
exch->storage_path, folder_name);
- if (!camel_exchange_store_connected (exch, ex)) {
+ if (!camel_exchange_store_connected (exch, NULL)) {
if (!folder_dir || !g_file_test (folder_dir, G_FILE_TEST_IS_DIR)) {
g_free (folder_dir);
- camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("No such folder %s"), folder_name);
+ g_set_error (
+ error, CAMEL_STORE_ERROR,
+ CAMEL_STORE_ERROR_NO_FOLDER,
+ _("No such folder %s"), folder_name);
return NULL;
}
}
@@ -458,7 +468,7 @@ exchange_store_get_folder (CamelStore *store,
if (!camel_exchange_folder_construct (
folder, flags, folder_dir,
- ((CamelOfflineStore *) store)->state, ex)) {
+ ((CamelOfflineStore *) store)->state, error)) {
gchar *key;
g_mutex_lock (exch->folders_lock);
@@ -487,7 +497,7 @@ static CamelFolderInfo *
exchange_store_get_folder_info (CamelStore *store,
const gchar *top,
guint32 flags,
- CamelException *ex)
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
GPtrArray *folders, *folder_names = NULL, *folder_uris = NULL;
@@ -496,18 +506,12 @@ exchange_store_get_folder_info (CamelStore *store,
CamelFolderInfo *info;
guint32 store_flags = 0;
gint i;
-#if 0
- if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot get folder info in offline mode."));
- return NULL;
- }
-#endif
/* If the backend crashed, don't keep returning an error
* each time auto-send/recv runs.
*/
- RETURN_VAL_IF_NOT_CONNECTED (exch, ex, NULL);
+ RETURN_VAL_IF_NOT_CONNECTED (exch, error, NULL);
if (flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE)
store_flags |= CAMEL_STORE_FOLDER_INFO_RECURSIVE;
@@ -516,9 +520,11 @@ exchange_store_get_folder_info (CamelStore *store,
if (flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST)
store_flags |= CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST;
- if (!camel_exchange_utils_get_folder_info (CAMEL_SERVICE (store), top, store_flags, &folder_names, &folder_uris, &unread_counts, &folder_flags, ex)) {
+ if (!camel_exchange_utils_get_folder_info (
+ CAMEL_SERVICE (store), top, store_flags, &folder_names,
+ &folder_uris, &unread_counts, &folder_flags, error))
return NULL;
- }
+
if (!folder_names) {
/* This means the storage hasn't finished scanning yet.
* We return NULL for now and will emit folder_created
@@ -555,23 +561,29 @@ static CamelFolderInfo *
exchange_store_create_folder (CamelStore *store,
const gchar *parent_name,
const gchar *folder_name,
- CamelException *ex)
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
gchar *folder_uri;
guint32 unread_count, flags;
CamelFolderInfo *info;
- if (!camel_exchange_store_connected (exch, ex)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot create folder in offline mode."));
+ if (!camel_exchange_store_connected (exch, NULL)) {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("Cannot create folder in offline mode."));
return NULL;
}
- if (!camel_exchange_utils_create_folder (CAMEL_SERVICE (store), parent_name, folder_name, &folder_uri, &unread_count, &flags, ex))
+ if (!camel_exchange_utils_create_folder (
+ CAMEL_SERVICE (store), parent_name, folder_name,
+ &folder_uri, &unread_count, &flags, error))
return NULL;
- info = make_folder_info (exch, g_strdup (folder_name),
- folder_uri, unread_count, flags);
+ info = make_folder_info (
+ exch, g_strdup (folder_name),
+ folder_uri, unread_count, flags);
+
info->flags |= CAMEL_FOLDER_NOCHILDREN;
g_free (folder_uri);
@@ -582,25 +594,26 @@ exchange_store_create_folder (CamelStore *store,
static gboolean
exchange_store_delete_folder (CamelStore *store,
const gchar *folder_name,
- CamelException *ex)
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
- if (!camel_exchange_store_connected (exch, ex)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot delete folder in offline mode."));
+ if (!camel_exchange_store_connected (exch, NULL)) {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("Cannot delete folder in offline mode."));
return FALSE;
}
- camel_exchange_utils_delete_folder (CAMEL_SERVICE (store), folder_name, ex);
-
- return !camel_exception_is_set (ex);
+ return camel_exchange_utils_delete_folder (
+ CAMEL_SERVICE (store), folder_name, error);
}
static gboolean
exchange_store_rename_folder (CamelStore *store,
const gchar *old_name,
const gchar *new_name,
- CamelException *ex)
+ GError **error)
{
GPtrArray *folders = NULL, *folder_names = NULL, *folder_uris = NULL;
GArray *unread_counts = NULL;
@@ -611,13 +624,17 @@ exchange_store_rename_folder (CamelStore *store,
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
- if (!camel_exchange_store_connected (exch, ex)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot rename folder in offline mode."));
+ if (!camel_exchange_store_connected (exch, NULL))
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("Cannot rename folder in offline mode."));
return FALSE;
- }
- if (!camel_exchange_utils_rename_folder (CAMEL_SERVICE (store), old_name, new_name, &folder_names, &folder_uris, &unread_counts, &folder_flags, ex)) {
+
+ if (!camel_exchange_utils_rename_folder (
+ CAMEL_SERVICE (store), old_name, new_name,
+ &folder_names, &folder_uris, &unread_counts,
+ &folder_flags, error))
return FALSE;
- }
if (!folder_names) {
/* This means the storage hasn't finished scanning yet.
@@ -683,50 +700,52 @@ exchange_store_folder_is_subscribed (CamelStore *store,
static gboolean
exchange_store_subscribe_folder (CamelStore *store,
const gchar *folder_name,
- CamelException *ex)
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
d(printf ("subscribe folder : %s\n", folder_name));
- if (!camel_exchange_store_connected (exch, ex)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot subscribe folder in offline mode."));
+ if (!camel_exchange_store_connected (exch, NULL)) {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("Cannot subscribe folder in offline mode."));
return FALSE;
}
- camel_exchange_utils_subscribe_folder (CAMEL_SERVICE (store), folder_name, ex);
-
- return !camel_exception_is_set (ex);
+ return camel_exchange_utils_subscribe_folder (
+ CAMEL_SERVICE (store), folder_name, error);
}
static gboolean
exchange_store_unsubscribe_folder (CamelStore *store,
const gchar *folder_name,
- CamelException *ex)
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
d(printf ("unsubscribe folder : %s\n", folder_name));
- if (!camel_exchange_store_connected (exch, ex)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot unsubscribe folder in offline mode."));
+ if (!camel_exchange_store_connected (exch, NULL)) {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("Cannot unsubscribe folder in offline mode."));
return FALSE;
}
- camel_exchange_utils_unsubscribe_folder (CAMEL_SERVICE (store), folder_name, ex);
-
- return !camel_exception_is_set (ex);
+ return camel_exchange_utils_unsubscribe_folder (
+ CAMEL_SERVICE (store), folder_name, error);
}
static gboolean
exchange_store_can_refresh_folder (CamelStore *store,
CamelFolderInfo *info,
- CamelException *ex)
+ GError **error)
{
CamelStoreClass *store_class;
gboolean res;
store_class = CAMEL_STORE_CLASS (camel_exchange_store_parent_class);
- res = store_class->can_refresh_folder (store, info, ex) ||
+ res = store_class->can_refresh_folder (store, info, error) ||
(camel_url_get_param (((CamelService *)store)->url, "check_all") != NULL);
return res;
@@ -783,7 +802,7 @@ camel_exchange_store_init (CamelExchangeStore *exch)
/* Use this to ensure that the camel session is online and we are connected
too. Also returns the current status of the store */
gboolean
-camel_exchange_store_connected (CamelExchangeStore *store, CamelException *ex)
+camel_exchange_store_connected (CamelExchangeStore *store, GError **error)
{
CamelService *service;
CamelSession *session;
@@ -795,7 +814,7 @@ camel_exchange_store_connected (CamelExchangeStore *store, CamelException *ex)
if (service->status != CAMEL_SERVICE_CONNECTED &&
camel_session_get_online (session) &&
- !camel_service_connect (service, ex)) {
+ !camel_service_connect (service, error)) {
return FALSE;
}
diff --git a/camel/camel-exchange-store.h b/camel/camel-exchange-store.h
index c41d32e..488ec98 100644
--- a/camel/camel-exchange-store.h
+++ b/camel/camel-exchange-store.h
@@ -50,7 +50,7 @@ struct _CamelExchangeStoreClass {
GType camel_exchange_store_get_type (void);
gboolean camel_exchange_store_connected (CamelExchangeStore *store,
- CamelException *ex);
+ GError **error);
void camel_exchange_store_folder_created
(CamelExchangeStore *estore,
const gchar *name,
diff --git a/camel/camel-exchange-summary.c b/camel/camel-exchange-summary.c
index aa9e1fd..b9d08a9 100644
--- a/camel/camel-exchange-summary.c
+++ b/camel/camel-exchange-summary.c
@@ -48,14 +48,11 @@ exchange_summary_check_for_trash (CamelFolder *folder)
{
CamelStore *parent_store;
CamelFolder *trash;
- CamelException lex;
-
- camel_exception_init (&lex);
parent_store = camel_folder_get_parent_store (folder);
- trash = camel_store_get_trash (parent_store, &lex);
+ trash = camel_store_get_trash (parent_store, NULL);
- if (camel_exception_is_set (&lex) || !trash)
+ if (trash == NULL)
return FALSE;
return folder == trash;
@@ -63,27 +60,26 @@ exchange_summary_check_for_trash (CamelFolder *folder)
static gboolean
exchange_summary_expunge_mail (CamelFolder *folder,
- CamelMessageInfo *info)
+ CamelMessageInfo *info,
+ GError **error)
{
GPtrArray *uids = g_ptr_array_new ();
CamelStore *parent_store;
gchar *uid = g_strdup (info->uid);
- CamelException lex;
const gchar *full_name;
-
- camel_exception_init (&lex);
+ gboolean success;
full_name = camel_folder_get_full_name (folder);
parent_store = camel_folder_get_parent_store (folder);
g_ptr_array_add (uids, uid);
- camel_exchange_utils_expunge_uids (
- CAMEL_SERVICE (parent_store), full_name, uids, &lex);
+ success = camel_exchange_utils_expunge_uids (
+ CAMEL_SERVICE (parent_store), full_name, uids, error);
g_ptr_array_free (uids, TRUE);
- return camel_exception_is_set (&lex);
+ return success;
}
static gint
@@ -242,7 +238,7 @@ exchange_summary_message_info_free (CamelFolderSummary *summary,
static CamelFIRecord *
exchange_summary_summary_header_to_db (CamelFolderSummary *s,
- CamelException *ex)
+ GError **error)
{
CamelExchangeSummary *exchange = (CamelExchangeSummary *) s;
CamelFolderSummaryClass *folder_summary_class;
@@ -251,7 +247,7 @@ exchange_summary_summary_header_to_db (CamelFolderSummary *s,
folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (
camel_exchange_summary_parent_class);
- fir = folder_summary_class->summary_header_to_db (s, ex);
+ fir = folder_summary_class->summary_header_to_db (s, error);
if (!fir)
return NULL;
fir->bdata = g_strdup_printf ("%u %u %u", exchange->version, exchange->readonly, exchange->high_article_num);
@@ -358,7 +354,7 @@ exchange_summary_info_set_flags (CamelMessageInfo *info,
if (folder && info->uid) {
if ((flags & set & CAMEL_MESSAGE_DELETED) &&
exchange_summary_check_for_trash (folder)) {
- return exchange_summary_expunge_mail (folder, info);
+ return exchange_summary_expunge_mail (folder, info, NULL);
} else {
camel_exchange_utils_set_message_flags (
CAMEL_SERVICE (parent_store),
@@ -453,22 +449,21 @@ CamelFolderSummary *
camel_exchange_summary_new (struct _CamelFolder *folder, const gchar *filename)
{
CamelFolderSummary *summary;
- CamelException lex;
+ GError *local_error = NULL;
- camel_exception_init (&lex);
summary = g_object_new (CAMEL_TYPE_EXCHANGE_SUMMARY, NULL);
summary->folder = folder;
camel_folder_summary_set_filename (summary, filename);
- if (camel_folder_summary_load_from_db (summary, &lex) == -1) {
+ if (camel_folder_summary_load_from_db (summary, &local_error) == -1) {
g_warning (
"Unable to load Exchage summary for folder %s: %s\n",
camel_folder_get_full_name (folder),
- camel_exception_get_description(&lex));
+ local_error->message);
camel_folder_summary_clear_db (summary);
camel_folder_summary_touch (summary);
+ g_error_free (local_error);
}
- camel_exception_clear (&lex);
return summary;
}
diff --git a/camel/camel-exchange-transport.c b/camel/camel-exchange-transport.c
index 501949c..f22f098 100644
--- a/camel/camel-exchange-transport.c
+++ b/camel/camel-exchange-transport.c
@@ -36,7 +36,7 @@ exchange_transport_send_to (CamelTransport *transport,
CamelMimeMessage *message,
CamelAddress *from,
CamelAddress *recipients,
- CamelException *ex)
+ GError **error)
{
CamelService *service = CAMEL_SERVICE (transport);
CamelStore *store = NULL;
@@ -53,13 +53,16 @@ exchange_transport_send_to (CamelTransport *transport,
GSList *h, *bcc = NULL;
gint len, i;
- url_string = camel_session_get_password (service->session, service, NULL,
- "ignored", "popb4smtp_uri", 0, ex);
+ url_string = camel_session_get_password (
+ service->session, service, NULL,
+ "ignored", "popb4smtp_uri", 0, error);
if (!url_string)
return FALSE;
if (strncmp (url_string, "exchange:", 9) != 0) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Exchange transport can only be used with Exchange mail source"));
+ g_set_error (
+ error, CAMEL_SERVICE_ERROR,
+ CAMEL_SERVICE_ERROR_UNAVAILABLE,
+ _("Exchange transport can only be used with Exchange mail source"));
g_free (url_string);
return FALSE;
}
@@ -71,8 +74,9 @@ exchange_transport_send_to (CamelTransport *transport,
cia = CAMEL_INTERNET_ADDRESS (recipients);
for (i = 0; i < len; i++) {
if (!camel_internet_address_get (cia, i, NULL, &addr)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot send message: one or more invalid recipients"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("Cannot send message: one or more invalid recipients"));
g_ptr_array_free (recipients_array, TRUE);
return FALSE;
}
@@ -80,8 +84,10 @@ exchange_transport_send_to (CamelTransport *transport,
}
if (!camel_internet_address_get (CAMEL_INTERNET_ADDRESS (from), 0, NULL, &addr)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Could not find 'From' address in message"));
+ g_set_error (
+ error, CAMEL_SERVICE_ERROR,
+ CAMEL_SERVICE_ERROR_UNAVAILABLE,
+ _("Could not find 'From' address in message"));
g_ptr_array_free (recipients_array, TRUE);
return FALSE;
}
@@ -106,9 +112,10 @@ exchange_transport_send_to (CamelTransport *transport,
camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc");
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message),
- CAMEL_STREAM (filtered_stream));
- camel_stream_flush (CAMEL_STREAM (filtered_stream));
+ camel_data_wrapper_write_to_stream (
+ CAMEL_DATA_WRAPPER (message),
+ CAMEL_STREAM (filtered_stream), NULL);
+ camel_stream_flush (CAMEL_STREAM (filtered_stream), NULL);
g_object_unref (CAMEL_OBJECT (filtered_stream));
/* add the bcc headers back */
@@ -122,13 +129,16 @@ exchange_transport_send_to (CamelTransport *transport,
g_slist_free (bcc);
}
- success = camel_exchange_utils_send_message (CAMEL_SERVICE (transport), addr, recipients_array, byte_array, ex);
+ success = camel_exchange_utils_send_message (
+ CAMEL_SERVICE (transport), addr,
+ recipients_array, byte_array, error);
g_ptr_array_free (recipients_array, TRUE);
g_object_unref (stream);
if (store)
g_object_unref (CAMEL_OBJECT (store));
+
return success;
}
diff --git a/camel/camel-exchange-utils.c b/camel/camel-exchange-utils.c
index 51a7fac..2ad5e1a 100644
--- a/camel/camel-exchange-utils.c
+++ b/camel/camel-exchange-utils.c
@@ -210,12 +210,11 @@ is_online (ExchangeData *ed)
}
static void
-set_exception (CamelException *ex, const gchar *err)
+set_exception (GError **error, const gchar *err)
{
g_return_if_fail (err != NULL);
- if (ex && !camel_exception_is_set (ex))
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, err);
+ g_set_error (error, CAMEL_ERROR, CAMEL_ERROR_GENERIC, "%s", err);
}
static CamelFolder *
@@ -400,7 +399,7 @@ change_flags (ExchangeFolder *mfld, CamelFolder *folder, ExchangeMessage *mmsg,
}
static void
-refresh_folder_internal (ExchangeFolder *mfld, CamelException *ex)
+refresh_folder_internal (ExchangeFolder *mfld, GError **error)
{
static const gchar *new_message_props[] = {
E2K_PR_REPL_UID,
@@ -527,7 +526,7 @@ refresh_folder_internal (ExchangeFolder *mfld, CamelException *ex)
if (!E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) {
g_warning ("got_new_smtp_messages: %d", status);
- set_exception (ex, _("Could not get new messages"));
+ set_exception (error, _("Could not get new messages"));
goto done;
}
@@ -566,7 +565,7 @@ refresh_folder_internal (ExchangeFolder *mfld, CamelException *ex)
if (!E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) {
g_warning ("got_new_mapi_messages: %d", status);
- set_exception (ex, _("Could not get new messages"));
+ set_exception (error, _("Could not get new messages"));
goto done;
}
@@ -821,9 +820,9 @@ free_folder (gpointer value)
}
static void
-got_folder_error (ExchangeFolder *mfld, CamelException *ex, const gchar *err)
+got_folder_error (ExchangeFolder *mfld, GError **error, const gchar *err)
{
- set_exception (ex, err);
+ set_exception (error, err);
free_folder (mfld);
}
@@ -868,7 +867,7 @@ mfld_get_folder_online_sync_updates (gpointer key, gpointer value, gpointer user
}
static gboolean
-get_folder_contents_online (ExchangeFolder *mfld, CamelException *ex)
+get_folder_contents_online (ExchangeFolder *mfld, GError **error)
{
static const gchar *open_folder_sync_props[] = {
E2K_PR_REPL_UID,
@@ -1054,7 +1053,7 @@ get_folder_contents_online (ExchangeFolder *mfld, CamelException *ex)
status = e2k_result_iter_free (iter);
if (!E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) {
g_warning ("got_folder: %d", status);
- got_folder_error (mfld, ex, _("Could not open folder"));
+ got_folder_error (mfld, error, _("Could not open folder"));
return FALSE;
}
@@ -1181,7 +1180,7 @@ notify_cb (E2kContext *ctx, const gchar *uri, E2kContextChangeType type, gpointe
}
static gboolean
-get_folder_online (ExchangeFolder *mfld, CamelException *ex)
+get_folder_online (ExchangeFolder *mfld, GError **error)
{
static const gchar *open_folder_props[] = {
PR_ACCESS,
@@ -1201,11 +1200,11 @@ get_folder_online (ExchangeFolder *mfld, CamelException *ex)
G_N_ELEMENTS (open_folder_props),
&results, &nresults);
if (status == E2K_HTTP_UNAUTHORIZED) {
- got_folder_error (mfld, ex, _("Could not open folder: Permission denied"));
+ got_folder_error (mfld, error, _("Could not open folder: Permission denied"));
return FALSE;
} else if (!E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) {
g_warning ("got_folder_props: %d", status);
- got_folder_error (mfld, ex, _("Could not open folder"));
+ got_folder_error (mfld, error, _("Could not open folder"));
return FALSE;
}
@@ -1219,7 +1218,7 @@ get_folder_online (ExchangeFolder *mfld, CamelException *ex)
mfld->access = ~0;
if (!(mfld->access & MAPI_ACCESS_READ)) {
- got_folder_error (mfld, ex, _("Could not open folder: Permission denied"));
+ got_folder_error (mfld, error, _("Could not open folder: Permission denied"));
if (nresults)
e2k_results_free (results, nresults);
return FALSE;
@@ -1238,7 +1237,7 @@ get_folder_online (ExchangeFolder *mfld, CamelException *ex)
change the PR_LAST_MODIFICATION_TIME property of a message.
*/
if (g_hash_table_size (mfld->messages_by_href) < 1) {
- if (!get_folder_contents_online (mfld, ex))
+ if (!get_folder_contents_online (mfld, error))
return FALSE;
} else {
/* FIXME: Pass a GError and handle the error */
@@ -1262,13 +1261,13 @@ get_folder_online (ExchangeFolder *mfld, CamelException *ex)
}
static ExchangeFolder *
-folder_from_name (ExchangeData *ed, const gchar *folder_name, guint32 perms, CamelException *ex)
+folder_from_name (ExchangeData *ed, const gchar *folder_name, guint32 perms, GError **error)
{
ExchangeFolder *mfld;
mfld = g_hash_table_lookup (ed->folders_by_name, folder_name);
if (!mfld) {
- set_exception (ex, _("No such folder"));
+ set_exception (error, _("No such folder"));
return NULL;
}
@@ -1290,7 +1289,7 @@ folder_from_name (ExchangeData *ed, const gchar *folder_name, guint32 perms, Cam
}
if (perms && !(mfld->access & perms)) {
- set_exception (ex, _("Permission denied"));
+ set_exception (error, _("Permission denied"));
return NULL;
}
@@ -2077,7 +2076,7 @@ struct update_linestatus
{
CamelExchangeStore *estore;
gint linestatus;
- CamelException *ex;
+ GError **error;
};
static void
@@ -2092,7 +2091,7 @@ folder_update_linestatus (gpointer key, gpointer value, gpointer data)
if (ul->linestatus == ONLINE_MODE) {
CamelFolder *folder;
- get_folder_online (mfld, ul->ex);
+ get_folder_online (mfld, ul->error);
readonly = (mfld->access & (MAPI_ACCESS_MODIFY | MAPI_ACCESS_CREATE_CONTENTS)) ? 0 : 1;
@@ -2109,7 +2108,7 @@ gboolean
camel_exchange_utils_connect (CamelService *service,
const gchar *pwd,
guint32 *status, /* out */
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeAccount *account;
@@ -2156,7 +2155,7 @@ camel_exchange_utils_connect (CamelService *service,
the first time */
ul.estore = ed->estore;
- ul.ex = ex;
+ ul.error = error;
g_hash_table_foreach (ed->folders_by_name,
(GHFunc) folder_update_linestatus,
&ul);
@@ -2177,7 +2176,7 @@ camel_exchange_utils_get_folder (CamelService *service,
guint32 *folder_flags, /* out */
gchar **folder_uri, /* out */
gboolean *readonly, /* out */
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeFolder *mfld;
@@ -2197,7 +2196,7 @@ camel_exchange_utils_get_folder (CamelService *service,
path = g_strdup_printf ("/%s", name);
folder = exchange_account_get_folder (ed->account, path);
if (!folder && !create) {
- set_exception (ex, _("No such folder"));
+ set_exception (error, _("No such folder"));
g_free (path);
return FALSE;
} else if (!folder) {
@@ -2206,7 +2205,7 @@ camel_exchange_utils_get_folder (CamelService *service,
result = exchange_account_create_folder (ed->account, path, "mail");
folder = exchange_account_get_folder (ed->account, path);
if (result != EXCHANGE_ACCOUNT_FOLDER_OK || !folder) {
- set_exception (ex, _("Could not create folder."));
+ set_exception (error, _("Could not create folder."));
g_free (path);
return FALSE;
}
@@ -2254,9 +2253,8 @@ camel_exchange_utils_get_folder (CamelService *service,
mfld->high_article_num = high_article_num;
if (is_online (ed) == ONLINE_MODE) {
- if (!get_folder_online (mfld, ex)) {
+ if (!get_folder_online (mfld, error))
return FALSE;
- }
}
g_signal_connect (mfld->folder, "changed",
G_CALLBACK (storage_folder_changed), mfld);
@@ -2287,7 +2285,7 @@ camel_exchange_utils_get_folder (CamelService *service,
gboolean
camel_exchange_utils_get_trash_name (CamelService *service,
gchar **trash_name, /* out */
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
@@ -2295,7 +2293,7 @@ camel_exchange_utils_get_trash_name (CamelService *service,
g_return_val_if_fail (trash_name != NULL, FALSE);
if (!ed->deleted_items) {
- set_exception (ex, _("Could not open Deleted Items folder"));
+ set_exception (error, _("Could not open Deleted Items folder"));
return FALSE;
}
@@ -2307,19 +2305,18 @@ camel_exchange_utils_get_trash_name (CamelService *service,
gboolean
camel_exchange_utils_refresh_folder (CamelService *service,
const gchar *folder_name,
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeFolder *mfld;
g_return_val_if_fail (ed != NULL, FALSE);
- mfld = folder_from_name (ed, folder_name, 0, ex);
- if (!mfld) {
+ mfld = folder_from_name (ed, folder_name, 0, error);
+ if (!mfld)
return FALSE;
- }
- refresh_folder_internal (mfld, ex);
+ refresh_folder_internal (mfld, NULL);
sync_deletions (mfld);
return TRUE;
@@ -2330,7 +2327,7 @@ camel_exchange_utils_sync_count (CamelService *service,
const gchar *folder_name,
guint32 *unread_count, /* out */
guint32 *visible_count, /* out */
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeFolder *mfld;
@@ -2339,7 +2336,7 @@ camel_exchange_utils_sync_count (CamelService *service,
g_return_val_if_fail (unread_count != NULL, FALSE);
g_return_val_if_fail (visible_count != NULL, FALSE);
- mfld = folder_from_name (ed, folder_name, 0, ex);
+ mfld = folder_from_name (ed, folder_name, 0, error);
if (mfld) {
*unread_count = mfld->unread_count;
*visible_count = mfld->messages->len;
@@ -2355,7 +2352,7 @@ gboolean
camel_exchange_utils_expunge_uids (CamelService *service,
const gchar *folder_name,
GPtrArray *uids,
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeFolder *mfld;
@@ -2373,7 +2370,7 @@ camel_exchange_utils_expunge_uids (CamelService *service,
if (!uids->len)
return TRUE;
- mfld = folder_from_name (ed, folder_name, MAPI_ACCESS_DELETE, ex);
+ mfld = folder_from_name (ed, folder_name, MAPI_ACCESS_DELETE, error);
if (!mfld)
return FALSE;
@@ -2422,9 +2419,9 @@ camel_exchange_utils_expunge_uids (CamelService *service,
if (!E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) {
g_warning ("expunged: %d", status);
some_error = TRUE;
- set_exception (ex, _("Could not empty Deleted Items folder"));
+ set_exception (error, _("Could not empty Deleted Items folder"));
} else if (some_error) {
- set_exception (ex, _("Permission denied. Could not delete certain messages."));
+ set_exception (error, _("Permission denied. Could not delete certain messages."));
}
g_ptr_array_free (hrefs, TRUE);
@@ -2445,7 +2442,7 @@ camel_exchange_utils_append_message (CamelService *service,
const gchar *subject,
const GByteArray *message,
gchar **new_uid, /* out */
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeFolder *mfld;
@@ -2456,7 +2453,8 @@ camel_exchange_utils_append_message (CamelService *service,
g_return_val_if_fail (new_uid != NULL, FALSE);
g_return_val_if_fail (message != NULL, FALSE);
- mfld = folder_from_name (ed, folder_name, MAPI_ACCESS_CREATE_CONTENTS, ex);
+ mfld = folder_from_name (
+ ed, folder_name, MAPI_ACCESS_CREATE_CONTENTS, error);
if (!mfld)
return FALSE;
@@ -2466,7 +2464,7 @@ camel_exchange_utils_append_message (CamelService *service,
&location, &ru_header);
if (status != E2K_HTTP_CREATED) {
g_warning ("appended_message: %d", status);
- set_exception (ex, status == E2K_HTTP_INSUFFICIENT_SPACE_ON_RESOURCE ?
+ set_exception (error, status == E2K_HTTP_INSUFFICIENT_SPACE_ON_RESOURCE ?
_("Could not append message; mailbox is over quota") :
_("Could not append message"));
return FALSE;
@@ -2522,7 +2520,7 @@ camel_exchange_utils_set_message_flags (CamelService *service,
const gchar *uid,
guint32 flags,
guint32 mask,
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeFolder *mfld;
@@ -2530,7 +2528,7 @@ camel_exchange_utils_set_message_flags (CamelService *service,
g_return_val_if_fail (ed != NULL, FALSE);
- mfld = folder_from_name (ed, folder_name, MAPI_ACCESS_MODIFY, ex);
+ mfld = folder_from_name (ed, folder_name, MAPI_ACCESS_MODIFY, error);
if (!mfld)
return FALSE;
@@ -2598,7 +2596,7 @@ camel_exchange_utils_set_message_tag (CamelService *service,
const gchar *uid,
const gchar *name,
const gchar *value,
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeFolder *mfld;
@@ -2606,7 +2604,7 @@ camel_exchange_utils_set_message_tag (CamelService *service,
g_return_val_if_fail (ed != NULL, FALSE);
- mfld = folder_from_name (ed, folder_name, MAPI_ACCESS_MODIFY, ex);
+ mfld = folder_from_name (ed, folder_name, MAPI_ACCESS_MODIFY, error);
if (!mfld)
return FALSE;
@@ -2626,7 +2624,7 @@ camel_exchange_utils_get_message (CamelService *service,
const gchar *folder_name,
const gchar *uid,
GByteArray **message_bytes, /* out */
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeFolder *mfld;
@@ -2641,7 +2639,7 @@ camel_exchange_utils_get_message (CamelService *service,
g_return_val_if_fail (ed != NULL, FALSE);
g_return_val_if_fail (message_bytes != NULL, FALSE);
- mfld = folder_from_name (ed, folder_name, MAPI_ACCESS_READ, ex);
+ mfld = folder_from_name (ed, folder_name, MAPI_ACCESS_READ, error);
if (!mfld)
return FALSE;
@@ -2654,7 +2652,7 @@ camel_exchange_utils_get_message (CamelService *service,
camel_exchange_folder_remove_message (CAMEL_EXCHANGE_FOLDER (folder), uid);
}
- set_exception (ex, _("No such message"));
+ set_exception (error, _("No such message"));
return FALSE;
}
@@ -2726,9 +2724,9 @@ camel_exchange_utils_get_message (CamelService *service,
* time we recorded that.
*/
message_removed (mfld, folder, mmsg->href);
- set_exception (ex, _("Message has been deleted"));
+ set_exception (error, _("Message has been deleted"));
} else
- set_exception (ex, _("Error retrieving message"));
+ set_exception (error, _("Error retrieving message"));
cleanup:
g_free (body);
@@ -2743,7 +2741,7 @@ camel_exchange_utils_search (CamelService *service,
const gchar *folder_name,
const gchar *text,
GPtrArray **found_uids, /* out */
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeFolder *mfld;
@@ -2757,7 +2755,7 @@ camel_exchange_utils_search (CamelService *service,
g_return_val_if_fail (ed != NULL, FALSE);
g_return_val_if_fail (found_uids != NULL, FALSE);
- mfld = folder_from_name (ed, folder_name, 0, ex);
+ mfld = folder_from_name (ed, folder_name, 0, error);
if (!mfld)
return FALSE;
@@ -2777,7 +2775,7 @@ camel_exchange_utils_search (CamelService *service,
status = e2k_result_iter_free (iter);
if (status == E2K_HTTP_UNPROCESSABLE_ENTITY) {
- set_exception (ex, _("Mailbox does not support full-text searching"));
+ set_exception (error, _("Mailbox does not support full-text searching"));
g_ptr_array_foreach (matches, (GFunc) g_free, NULL);
g_ptr_array_free (matches, TRUE);
@@ -2796,7 +2794,7 @@ camel_exchange_utils_transfer_messages (CamelService *service,
GPtrArray *uids,
gboolean delete_originals,
GPtrArray **ret_uids, /* out */
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeFolder *source, *dest;
@@ -2814,10 +2812,14 @@ camel_exchange_utils_transfer_messages (CamelService *service,
g_return_val_if_fail (ed != NULL, FALSE);
g_return_val_if_fail (ret_uids != NULL, FALSE);
- source = folder_from_name (ed, source_name, delete_originals ? MAPI_ACCESS_DELETE : 0, ex);
+ source = folder_from_name (
+ ed, source_name, delete_originals ?
+ MAPI_ACCESS_DELETE : 0, error);
if (!source)
return FALSE;
- dest = folder_from_name (ed, dest_name, MAPI_ACCESS_CREATE_CONTENTS, ex);
+
+ dest = folder_from_name (
+ ed, dest_name, MAPI_ACCESS_CREATE_CONTENTS, error);
if (!dest)
return FALSE;
@@ -2885,7 +2887,7 @@ camel_exchange_utils_transfer_messages (CamelService *service,
*ret_uids = new_uids;
} else {
g_warning ("transferred_messages: %d", status);
- set_exception (ex, _("Unable to move/copy messages"));
+ set_exception (error, _("Unable to move/copy messages"));
g_ptr_array_free (new_uids, TRUE);
new_uids = NULL;
}
@@ -2954,7 +2956,7 @@ camel_exchange_utils_get_folder_info (CamelService *service,
GPtrArray **folder_uris, /* out */
GArray **unread_counts, /* out */
GArray **folder_flags, /* out */
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
GHashTable *known_uris;
@@ -2995,7 +2997,7 @@ camel_exchange_utils_send_message (CamelService *service,
const gchar *from,
GPtrArray *recipients,
const GByteArray *message,
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
SoupMessage *msg;
@@ -3013,7 +3015,7 @@ camel_exchange_utils_send_message (CamelService *service,
g_return_val_if_fail (ed->estore != NULL, FALSE);
if (!ed->mail_submission_uri) {
- set_exception (ex, _("No mail submission URI for this mailbox"));
+ set_exception (error, _("No mail submission URI for this mailbox"));
return FALSE;
}
@@ -3046,12 +3048,12 @@ camel_exchange_utils_send_message (CamelService *service,
if (E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) {
res = TRUE;
} else if (status == E2K_HTTP_NOT_FOUND) {
- set_exception (ex, _("Server won't accept mail via Exchange transport"));
+ set_exception (error, _("Server won't accept mail via Exchange transport"));
} else if (status == E2K_HTTP_FORBIDDEN) {
errmsg = g_strdup_printf (_("Your account does not have permission "
"to use <%s>\nas a From address."),
from);
- set_exception (ex, errmsg);
+ set_exception (error, errmsg);
g_free (errmsg);
} else if (status == E2K_HTTP_INSUFFICIENT_SPACE_ON_RESOURCE ||
status == E2K_HTTP_INTERNAL_SERVER_ERROR) {
@@ -3060,11 +3062,11 @@ camel_exchange_utils_send_message (CamelService *service,
* changes in the future.)
*/
E2K_KEEP_PRECEDING_COMMENT_OUT_OF_PO_FILES;
- set_exception (ex, _("Could not send message.\n"
+ set_exception (error, _("Could not send message.\n"
"This might mean that your account is over quota."));
} else {
g_warning ("sent_message: %d", status);
- set_exception (ex, _("Could not send message"));
+ set_exception (error, _("Could not send message"));
}
return res;
@@ -3077,7 +3079,7 @@ camel_exchange_utils_create_folder (CamelService *service,
gchar **folder_uri, /* out */
guint32 *unread_count, /* out */
guint32 *flags, /* out */
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeAccountFolderResult result;
@@ -3100,15 +3102,15 @@ camel_exchange_utils_create_folder (CamelService *service,
break;
/* fall through */
default:
- set_exception (ex, _("Generic error"));
+ set_exception (error, _("Generic error"));
return FALSE;
case EXCHANGE_ACCOUNT_FOLDER_ALREADY_EXISTS:
- set_exception (ex, _("Folder already exists"));
+ set_exception (error, _("Folder already exists"));
return FALSE;
case EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED:
- set_exception (ex, _("Permission denied"));
+ set_exception (error, _("Permission denied"));
return FALSE;
}
@@ -3122,7 +3124,7 @@ camel_exchange_utils_create_folder (CamelService *service,
gboolean
camel_exchange_utils_delete_folder (CamelService *service,
const gchar *folder_name,
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeAccountFolderResult result;
@@ -3134,7 +3136,7 @@ camel_exchange_utils_delete_folder (CamelService *service,
path = g_build_filename ("/", folder_name, NULL);
folder = exchange_account_get_folder (ed->account, path);
if (!folder) {
- set_exception (ex, _("Folder doesn't exist"));
+ set_exception (error, _("Folder doesn't exist"));
g_free (path);
return FALSE;
}
@@ -3151,12 +3153,12 @@ camel_exchange_utils_delete_folder (CamelService *service,
case EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED: /* Fall through */
case EXCHANGE_ACCOUNT_FOLDER_UNSUPPORTED_OPERATION:
- set_exception (ex, _("Permission denied"));
+ set_exception (error, _("Permission denied"));
g_object_unref (folder);
return FALSE;
default:
- set_exception (ex, _("Generic error"));
+ set_exception (error, _("Generic error"));
g_object_unref (folder);
return FALSE;
@@ -3175,7 +3177,7 @@ camel_exchange_utils_rename_folder (CamelService *service,
GPtrArray **folder_uris, /* out */
GArray **unread_counts, /* out */
GArray **folder_flags, /* out */
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeFolder *mfld;
@@ -3198,7 +3200,7 @@ camel_exchange_utils_rename_folder (CamelService *service,
old_path = g_build_filename ("/", old_name, NULL);
folder = exchange_account_get_folder (ed->account, old_path);
if (!folder) {
- set_exception (ex, _("Folder doesn't exist"));
+ set_exception (error, _("Folder doesn't exist"));
g_free (old_path);
return FALSE;
}
@@ -3237,9 +3239,8 @@ camel_exchange_utils_rename_folder (CamelService *service,
}
if (is_online (ed) == ONLINE_MODE) {
- if (!get_folder_online (mfld, ex)) {
+ if (!get_folder_online (mfld, error))
return FALSE;
- }
}
for (i = 0; i < uris->len; i++) {
@@ -3299,9 +3300,8 @@ camel_exchange_utils_rename_folder (CamelService *service,
}
if (is_online (ed) == ONLINE_MODE) {
- if (!get_folder_online (mfld, ex)) {
+ if (!get_folder_online (mfld, error))
return FALSE;
- }
}
g_free (old_path);
@@ -3318,15 +3318,15 @@ camel_exchange_utils_rename_folder (CamelService *service,
break;
case EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST:
- set_exception (ex, _("Folder doesn't exist"));
+ set_exception (error, _("Folder doesn't exist"));
return FALSE;
case EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED:
- set_exception (ex, _("Permission denied"));
+ set_exception (error, _("Permission denied"));
return FALSE;
default:
- set_exception (ex, _("Generic error"));
+ set_exception (error, _("Generic error"));
return FALSE;
}
@@ -3337,7 +3337,7 @@ camel_exchange_utils_rename_folder (CamelService *service,
gboolean
camel_exchange_utils_subscribe_folder (CamelService *service,
const gchar *folder_name,
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeAccountFolderResult result;
@@ -3349,7 +3349,7 @@ camel_exchange_utils_subscribe_folder (CamelService *service,
path = g_build_filename ("/", folder_name, NULL);
folder = exchange_account_get_folder (ed->account, path);
if (!folder) {
- set_exception (ex, _("Folder doesn't exist"));
+ set_exception (error, _("Folder doesn't exist"));
g_free (path);
return FALSE;
}
@@ -3375,11 +3375,11 @@ camel_exchange_utils_subscribe_folder (CamelService *service,
break;
case EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED:
- set_exception (ex, _("Permission denied"));
+ set_exception (error, _("Permission denied"));
return FALSE;
default:
- set_exception (ex, _("Generic error"));
+ set_exception (error, _("Generic error"));
return FALSE;
}
@@ -3389,7 +3389,7 @@ camel_exchange_utils_subscribe_folder (CamelService *service,
gboolean
camel_exchange_utils_unsubscribe_folder (CamelService *service,
const gchar *folder_name,
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
ExchangeAccountFolderResult result;
@@ -3401,7 +3401,7 @@ camel_exchange_utils_unsubscribe_folder (CamelService *service,
path = g_build_filename ("/", folder_name, NULL);
folder = exchange_account_get_folder (ed->account, path);
if (!folder) {
- set_exception (ex, _("Folder doesn't exist"));
+ set_exception (error, _("Folder doesn't exist"));
g_free (path);
return FALSE;
}
@@ -3422,7 +3422,7 @@ camel_exchange_utils_unsubscribe_folder (CamelService *service,
path = g_build_filename ("/favorites", pub_name, NULL);
folder = exchange_account_get_folder (ed->account, path);
if (!folder) {
- set_exception (ex, _("Folder doesn't exist"));
+ set_exception (error, _("Folder doesn't exist"));
g_free (path);
return FALSE;
}
@@ -3437,13 +3437,13 @@ camel_exchange_utils_unsubscribe_folder (CamelService *service,
break;
case EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED:
- set_exception (ex, _("Permission denied"));
+ set_exception (error, _("Permission denied"));
g_object_unref (folder);
g_free (path);
return FALSE;
default:
- set_exception (ex, _("Generic error"));
+ set_exception (error, _("Generic error"));
g_object_unref (folder);
g_free (path);
return FALSE;
@@ -3460,7 +3460,7 @@ gboolean
camel_exchange_utils_is_subscribed_folder (CamelService *service,
const gchar *folder_name,
gboolean *is_subscribed, /* out */
- CamelException *ex)
+ GError **error)
{
ExchangeData *ed = get_data_for_service (service);
EFolder *folder;
diff --git a/camel/camel-exchange-utils.h b/camel/camel-exchange-utils.h
index 848dcc4..22617f6 100644
--- a/camel/camel-exchange-utils.h
+++ b/camel/camel-exchange-utils.h
@@ -11,7 +11,7 @@ G_BEGIN_DECLS
gboolean camel_exchange_utils_connect (CamelService *service,
const gchar *pwd,
guint32 *status, /* out */
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_get_folder (CamelService *service,
const gchar *name,
@@ -23,26 +23,26 @@ gboolean camel_exchange_utils_get_folder (CamelService *service,
guint32 *folder_flags, /* out */
gchar **folder_uri, /* out */
gboolean *readonly, /* out */
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_get_trash_name (CamelService *service,
gchar **trash_name, /* out */
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_refresh_folder (CamelService *service,
const gchar *folder_name,
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_sync_count (CamelService *service,
const gchar *folder_name,
guint32 *unread_count, /* out */
guint32 *visible_count, /* out */
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_expunge_uids (CamelService *service,
const gchar *folder_name,
GPtrArray *uids,
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_append_message (CamelService *service,
const gchar *folder_name,
@@ -50,33 +50,33 @@ gboolean camel_exchange_utils_append_message (CamelService *service,
const gchar *subject,
const GByteArray *message,
gchar **new_uid, /* out */
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_set_message_flags (CamelService *service,
const gchar *folder_name,
const gchar *uid,
guint32 flags,
guint32 mask,
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_set_message_tag (CamelService *service,
const gchar *folder_name,
const gchar *uid,
const gchar *name,
const gchar *value,
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_get_message (CamelService *service,
const gchar *folder_name,
const gchar *uid,
GByteArray **message_bytes, /* out */
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_search (CamelService *service,
const gchar *folder_name,
const gchar *text,
GPtrArray **found_uids, /* out */
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_transfer_messages (CamelService *service,
const gchar *source_name,
@@ -84,7 +84,7 @@ gboolean camel_exchange_utils_transfer_messages (CamelService *service,
GPtrArray *uids,
gboolean delete_originals,
GPtrArray **ret_uids, /* out */
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_get_folder_info (CamelService *service,
const gchar *top,
@@ -93,13 +93,13 @@ gboolean camel_exchange_utils_get_folder_info (CamelService *service,
GPtrArray **folder_uris, /* out */
GArray **unread_counts, /* out */
GArray **folder_flags, /* out */
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_send_message (CamelService *service,
const gchar *from,
GPtrArray *recipients,
const GByteArray *message,
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_create_folder (CamelService *service,
const gchar *parent_name,
@@ -107,11 +107,11 @@ gboolean camel_exchange_utils_create_folder (CamelService *service,
gchar **folder_uri, /* out */
guint32 *unread_count, /* out */
guint32 *flags, /* out */
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_delete_folder (CamelService *service,
const gchar *folder_name,
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_rename_folder (CamelService *service,
const gchar *old_name,
@@ -120,20 +120,20 @@ gboolean camel_exchange_utils_rename_folder (CamelService *service,
GPtrArray **folder_uris, /* out */
GArray **unread_counts, /* out */
GArray **folder_flags, /* out */
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_subscribe_folder (CamelService *service,
const gchar *folder_name,
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_unsubscribe_folder (CamelService *service,
const gchar *folder_name,
- CamelException *ex);
+ GError **error);
gboolean camel_exchange_utils_is_subscribed_folder (CamelService *service,
const gchar *folder_name,
gboolean *is_subscribed, /* out */
- CamelException *ex);
+ GError **error);
G_END_DECLS
diff --git a/eplugin/exchange-delegates-user.c b/eplugin/exchange-delegates-user.c
index 9cd24f8..5408bcd 100644
--- a/eplugin/exchange-delegates-user.c
+++ b/eplugin/exchange-delegates-user.c
@@ -464,7 +464,7 @@ exchange_delegates_user_edit (ExchangeAccount *account,
*/
camel_stream_printf (stream, "<br>%s", _("However, you are not permitted "
"to see my private items."));
- camel_data_wrapper_construct_from_stream (delegate_mail_text, stream);
+ camel_data_wrapper_construct_from_stream (delegate_mail_text, stream, NULL);
g_free (role_name);
g_string_free (role_name_final, TRUE);
g_object_unref (stream);
@@ -483,7 +483,7 @@ exchange_delegates_user_edit (ExchangeAccount *account,
stream = camel_stream_mem_new ();
part = camel_mime_part_new ();
- camel_data_wrapper_construct_from_stream (delegate_mail_data, stream);
+ camel_data_wrapper_construct_from_stream (delegate_mail_data, stream, NULL);
g_object_unref (stream);
camel_medium_set_content (CAMEL_MEDIUM (part), delegate_mail_data);
g_object_unref (delegate_mail_data);
diff --git a/eplugin/exchange-folder.c b/eplugin/exchange-folder.c
index 940b57c..1b83345 100644
--- a/eplugin/exchange-folder.c
+++ b/eplugin/exchange-folder.c
@@ -67,7 +67,6 @@ static void
exchange_get_folder (gchar *uri, CamelFolder *folder, gpointer data)
{
CamelStore *store;
- CamelException ex;
CamelFolderInfo *info;
gchar *name = NULL;
gchar *stored_name = NULL;
@@ -95,7 +94,6 @@ exchange_get_folder (gchar *uri, CamelFolder *folder, gpointer data)
if (stored_name)
name[stored_name - name] = '\0';
- camel_exception_init (&ex);
store = camel_folder_get_parent_store (folder);
/* Construct the CamelFolderInfo */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]