[evolution-exchange/camel-gobject: 6/6] Get the rest of the module to build.
- From: Matthew Barnes <mbarnes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-exchange/camel-gobject: 6/6] Get the rest of the module to build.
- Date: Sun, 29 Nov 2009 18:39:48 +0000 (UTC)
commit 31bce47756d9955e491eb42d89639fd8f546db0a
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat Nov 28 19:26:38 2009 -0500
Get the rest of the module to build.
addressbook/e-book-backend-exchange-factory.c | 4 -
addressbook/e-book-backend-exchange.c | 10 +-
calendar/e-cal-backend-exchange-calendar.h | 4 +-
calendar/e-cal-backend-exchange-factory.c | 4 -
calendar/e-cal-backend-exchange-tasks.h | 4 +-
calendar/e-cal-backend-exchange.c | 23 +-
calendar/e-cal-backend-exchange.h | 4 +-
camel/camel-exchange-folder.c | 911 +++++++++++++-----------
camel/camel-exchange-folder.h | 116 ++--
camel/camel-exchange-journal.c | 496 +++++++-------
camel/camel-exchange-journal.h | 75 ++-
camel/camel-exchange-provider.c | 4 +-
camel/camel-exchange-search.c | 77 +-
camel/camel-exchange-search.h | 37 +-
camel/camel-exchange-store.c | 924 +++++++++++++------------
camel/camel-exchange-store.h | 63 ++-
camel/camel-exchange-summary.c | 366 +++++-----
camel/camel-exchange-summary.h | 81 ++-
camel/camel-exchange-transport.c | 136 ++--
camel/camel-exchange-transport.h | 44 +-
camel/camel-exchange-utils.c | 211 ++++--
eplugin/exchange-config-listener.h | 4 +-
eplugin/exchange-delegates-user.h | 4 +-
eplugin/exchange-folder.c | 2 -
eplugin/exchange-permissions-dialog.h | 4 +-
eplugin/exchange-send-options.h | 4 +-
eplugin/exchange-user-dialog.h | 4 +-
server/lib/e2k-context.h | 4 +-
server/lib/e2k-global-catalog.h | 4 +-
server/lib/e2k-security-descriptor.h | 4 +-
server/lib/e2k-sid.h | 4 +-
server/storage/e-folder-exchange.h | 4 +-
server/storage/e-folder-type-registry.h | 4 +-
server/storage/e-folder.h | 4 +-
server/storage/e-storage.h | 4 +-
server/storage/exchange-account.h | 4 +-
server/storage/exchange-folder-size.h | 4 +-
server/storage/exchange-hierarchy-favorites.h | 4 +-
server/storage/exchange-hierarchy-foreign.h | 4 +-
server/storage/exchange-hierarchy-gal.h | 4 +-
server/storage/exchange-hierarchy-somedav.h | 4 +-
server/storage/exchange-hierarchy-webdav.h | 4 +-
server/storage/exchange-hierarchy.h | 4 +-
tools/exchange-share-config-listener.h | 4 +-
44 files changed, 1994 insertions(+), 1690 deletions(-)
---
diff --git a/addressbook/e-book-backend-exchange-factory.c b/addressbook/e-book-backend-exchange-factory.c
index c398b0c..7b6dd04 100644
--- a/addressbook/e-book-backend-exchange-factory.c
+++ b/addressbook/e-book-backend-exchange-factory.c
@@ -39,10 +39,6 @@ static GType exchange_types[2];
void
eds_module_initialize (GTypeModule *type_module)
{
- /* to have a camel type initialized properly */
- camel_type_init ();
- camel_object_get_type ();
-
exchange_types[0] = _exchange_factory_get_type (type_module);
exchange_types[1] = _gal_factory_get_type (type_module);
}
diff --git a/addressbook/e-book-backend-exchange.c b/addressbook/e-book-backend-exchange.c
index 8047c14..2b96ef6 100644
--- a/addressbook/e-book-backend-exchange.c
+++ b/addressbook/e-book-backend-exchange.c
@@ -540,16 +540,16 @@ e_contact_from_props (EBookBackendExchange *be, E2kResult *result)
if (content) {
EContactPhoto photo;
- CamelStreamMem *stream_mem;
+ GByteArray *byte_array;
- stream = camel_stream_mem_new ();
- stream_mem = (CamelStreamMem *)stream;
+ byte_array = g_byte_array_new ();
+ stream = camel_stream_mem_new_with_byte_array (byte_array);
camel_data_wrapper_decode_to_stream (content, stream);
photo.type = E_CONTACT_PHOTO_TYPE_INLINED;
photo.data.inlined.mime_type = NULL;
- photo.data.inlined.data = stream_mem->buffer->data;
- photo.data.inlined.length = stream_mem->buffer->len;
+ photo.data.inlined.data = byte_array->data;
+ photo.data.inlined.length = byte_array->len;
e_contact_set (contact, E_CONTACT_PHOTO, &photo);
g_object_unref (stream);
diff --git a/calendar/e-cal-backend-exchange-calendar.h b/calendar/e-cal-backend-exchange-calendar.h
index 9c0b9c8..9d970d3 100644
--- a/calendar/e-cal-backend-exchange-calendar.h
+++ b/calendar/e-cal-backend-exchange-calendar.h
@@ -10,9 +10,9 @@ G_BEGIN_DECLS
#define E_TYPE_CAL_BACKEND_EXCHANGE_CALENDAR (e_cal_backend_exchange_calendar_get_type ())
#define E_CAL_BACKEND_EXCHANGE_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_BACKEND_EXCHANGE_CALENDAR, ECalBackendExchangeCalendar))
-#define E_CAL_BACKEND_EXCHANGE_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_BACKEND_EXCHANGE_CALENDAR, ECalBackendExchangeCalendarClass))
+#define E_CAL_BACKEND_EXCHANGE_CALENDAR_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), E_TYPE_CAL_BACKEND_EXCHANGE_CALENDAR, ECalBackendExchangeCalendarClass))
#define E_IS_CAL_BACKEND_EXCHANGE_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_BACKEND_EXCHANGE_CALENDAR))
-#define E_IS_CAL_BACKEND_EXCHANGE_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_BACKEND_EXCHANGE_CALENDAR))
+#define E_IS_CAL_BACKEND_EXCHANGE_CALENDAR_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((cls), E_TYPE_CAL_BACKEND_EXCHANGE_CALENDAR))
#define E_CAL_BACKEND_EXCHANGE_CALENDAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_CAL_BACKEND_EXCHANGE_CALENDAR, ECalBackendExchangeCalendarClass))
typedef struct ECalBackendExchangeCalendar ECalBackendExchangeCalendar;
diff --git a/calendar/e-cal-backend-exchange-factory.c b/calendar/e-cal-backend-exchange-factory.c
index b13ca05..f0e79a4 100644
--- a/calendar/e-cal-backend-exchange-factory.c
+++ b/calendar/e-cal-backend-exchange-factory.c
@@ -140,10 +140,6 @@ e_cal_backend_exchange_todos_factory_register_type (GTypeModule *type_module)
void
eds_module_initialize (GTypeModule *type_module)
{
- /* to have a camel type initialized properly */
- camel_type_init ();
- camel_object_get_type ();
-
e_cal_backend_exchange_events_factory_register_type (type_module);
e_cal_backend_exchange_todos_factory_register_type (type_module);
}
diff --git a/calendar/e-cal-backend-exchange-tasks.h b/calendar/e-cal-backend-exchange-tasks.h
index 1e7783c..148e3d4 100644
--- a/calendar/e-cal-backend-exchange-tasks.h
+++ b/calendar/e-cal-backend-exchange-tasks.h
@@ -10,9 +10,9 @@ G_BEGIN_DECLS
#define E_TYPE_CAL_BACKEND_EXCHANGE_TASKS (e_cal_backend_exchange_tasks_get_type ())
#define E_CAL_BACKEND_EXCHANGE_TASKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_BACKEND_EXCHANGE_TASKS, ECalBackendExchangeTasks))
-#define E_CAL_BACKEND_EXCHANGE_TASKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_BACKEND_EXCHANGE_TASKS, ECalBackendExchangeTasksClass))
+#define E_CAL_BACKEND_EXCHANGE_TASKS_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), E_TYPE_CAL_BACKEND_EXCHANGE_TASKS, ECalBackendExchangeTasksClass))
#define E_IS_CAL_BACKEND_EXCHANGE_TASKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_BACKEND_EXCHANGE_TASKS))
-#define E_IS_CAL_BACKEND_EXCHANGE_TASKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_BACKEND_EXCHANGE_TASKS))
+#define E_IS_CAL_BACKEND_EXCHANGE_TASKS_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((cls), E_TYPE_CAL_BACKEND_EXCHANGE_TASKS))
#define E_CAL_BACKEND_EXCHANGE_TASKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_CAL_BACKEND_EXCHANGE_TASKS, ECalBackendExchangeTasksClass))
typedef struct _ECalBackendExchangeTasks ECalBackendExchangeTasks;
diff --git a/calendar/e-cal-backend-exchange.c b/calendar/e-cal-backend-exchange.c
index ed48c1f..b82f2cd 100644
--- a/calendar/e-cal-backend-exchange.c
+++ b/calendar/e-cal-backend-exchange.c
@@ -1749,18 +1749,18 @@ get_attachment (ECalBackendExchange *cbex, const gchar *uid,
part = camel_multipart_get_part (multipart, i);
filename = camel_mime_part_get_filename (part);
if (filename) {
- CamelStreamMem *stream_mem;
+ GByteArray *byte_array;
content = camel_medium_get_content (CAMEL_MEDIUM (part));
- stream = camel_stream_mem_new ();
- stream_mem = (CamelStreamMem *)stream;
+ byte_array = g_byte_array_new ();
+ stream = camel_stream_mem_new_with_byte_array (byte_array);
camel_data_wrapper_decode_to_stream (content, stream);
- attach_data = g_memdup (stream_mem->buffer->data, stream_mem->buffer->len);
+ 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
- attach_file_url = save_attach_file (attach_file, (gchar *) attach_data, stream_mem->buffer->len);
+ attach_file_url = save_attach_file (attach_file, (gchar *) attach_data, byte_array->len);
g_free (attach_data);
g_free (attach_file);
d(printf ("attach file name : %s\n", attach_file_url));
@@ -1957,13 +1957,13 @@ gchar *
build_msg ( ECalBackendExchange *cbex, ECalComponent *comp, const gchar *subject, gchar **boundary)
{
CamelMimeMessage *msg;
- CamelStreamMem *content;
CamelMimePart *mime_part;
CamelDataWrapper *dw, *wrapper;
CamelMultipart *multipart;
CamelInternetAddress *from;
CamelStream *stream;
CamelContentType *type;
+ GByteArray *byte_array;
const gchar *uid;
gchar *buffer = NULL, *cid;
gchar *from_name = NULL, *from_email = NULL;
@@ -2072,13 +2072,14 @@ build_msg ( ECalBackendExchange *cbex, ECalComponent *comp, const gchar *subject
camel_medium_set_content (CAMEL_MEDIUM (msg), CAMEL_DATA_WRAPPER (multipart));
g_object_unref (multipart);
- content = (CamelStreamMem *)camel_stream_mem_new();
+ 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, (CamelStream *)content);
- buffer = g_memdup (content->buffer->data, content->buffer->len);
- buffer[content->buffer->len] = '\0';
+ camel_data_wrapper_decode_to_stream(dw, stream);
+ buffer = g_memdup (byte_array->data, byte_array->len);
+ buffer[byte_array->len] = '\0';
d(printf ("|| Buffer: \n%s\n", buffer));
- g_object_unref (content);
+ g_object_unref (stream);
g_object_unref (msg);
return buffer;
diff --git a/calendar/e-cal-backend-exchange.h b/calendar/e-cal-backend-exchange.h
index 03f8450..b61e0bf 100644
--- a/calendar/e-cal-backend-exchange.h
+++ b/calendar/e-cal-backend-exchange.h
@@ -14,9 +14,9 @@ G_BEGIN_DECLS
#define E_TYPE_CAL_BACKEND_EXCHANGE (e_cal_backend_exchange_get_type ())
#define E_CAL_BACKEND_EXCHANGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_BACKEND_EXCHANGE, ECalBackendExchange))
-#define E_CAL_BACKEND_EXCHANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_BACKEND_EXCHANGE, ECalBackendExchangeClass))
+#define E_CAL_BACKEND_EXCHANGE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), E_TYPE_CAL_BACKEND_EXCHANGE, ECalBackendExchangeClass))
#define E_IS_CAL_BACKEND_EXCHANGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_BACKEND_EXCHANGE))
-#define E_IS_CAL_BACKEND_EXCHANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_BACKEND_EXCHANGE))
+#define E_IS_CAL_BACKEND_EXCHANGE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((cls), E_TYPE_CAL_BACKEND_EXCHANGE))
#define E_CAL_BACKEND_EXCHANGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_CAL_BACKEND_EXCHANGE, ECalBackendExchangeClass))
typedef struct ECalBackendExchange ECalBackendExchange;
diff --git a/camel/camel-exchange-folder.c b/camel/camel-exchange-folder.c
index 59e2dda..056239e 100644
--- a/camel/camel-exchange-folder.c
+++ b/camel/camel-exchange-folder.c
@@ -39,255 +39,50 @@
#include "camel-exchange-journal.h"
#include "camel-exchange-utils.h"
-static CamelOfflineFolderClass *parent_class = NULL;
-
-/* Returns the class for a CamelFolder */
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static void exchange_expunge (CamelFolder *folder, GError **error);
-static void append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, gchar **appended_uid,
- GError **error);
-static CamelMimeMessage *get_message (CamelFolder *folder,
- const gchar *uid,
- GError **error);
-static GPtrArray *search_by_expression (CamelFolder *folder,
- const gchar *exp,
- GError **error);
-static guint32 count_by_expression (CamelFolder *folder,
- const gchar *exp,
- GError **error);
-
-static GPtrArray *search_by_uids (CamelFolder *folder,
- const gchar *expression,
- GPtrArray *uids,
- GError **error);
-static void transfer_messages_to (CamelFolder *source,
- GPtrArray *uids,
- CamelFolder *dest,
- GPtrArray **transferred_uids,
- gboolean delete_originals,
- GError **error);
-static void transfer_messages_the_hard_way (CamelFolder *source,
- GPtrArray *uids,
- CamelFolder *dest,
- GPtrArray **transferred_uids,
- gboolean delete_originals,
- GError **error);
-static void refresh_info (CamelFolder *folder, GError **error);
-static void exchange_sync (CamelFolder *folder, gboolean expunge, GError **error);
-static gchar * get_filename (CamelFolder *folder, const gchar *uid, GError **error);
-static gint cmp_uids (CamelFolder *folder, const gchar *uid1, const gchar *uid2);
+#define MAILING_LIST_HEADERS \
+ "X-MAILING-LIST " \
+ "X-LOOP LIST-ID " \
+ "LIST-POST " \
+ "MAILING-LIST " \
+ "ORIGINATOR " \
+ "X-LIST " \
+ "RETURN-PATH " \
+ "X-BEENTHERE "
+
+static gpointer parent_class;
static void
-class_init (CamelFolderClass *camel_folder_class)
+cache_xfer (CamelExchangeFolder *folder_source,
+ CamelExchangeFolder *folder_dest,
+ GPtrArray *src_uids,
+ GPtrArray *dest_uids,
+ gboolean delete)
{
- parent_class = CAMEL_OFFLINE_FOLDER_CLASS (camel_type_get_global_classfuncs (camel_offline_folder_get_type ()));
-
- /* virtual method definition */
- camel_folder_class->expunge = exchange_expunge;
- camel_folder_class->append_message = append_message;
- camel_folder_class->get_message = get_message;
- camel_folder_class->search_by_expression = search_by_expression;
- camel_folder_class->count_by_expression = count_by_expression;
-
- camel_folder_class->cmp_uids = cmp_uids;
- camel_folder_class->search_by_uids = search_by_uids;
- /* use the default function for the search_free */
- /* camel_folder_class->search_free = search_free; */
- camel_folder_class->transfer_messages_to = transfer_messages_to;
- camel_folder_class->refresh_info = refresh_info;
- camel_folder_class->sync = exchange_sync;
- camel_folder_class->get_filename = get_filename;
-}
-
-#define CAMEL_EXCHANGE_SERVER_FLAGS \
- (CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_ANSWERED_ALL | \
- CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN)
-
-static void
-init (CamelFolder *folder)
-{
- folder->folder_flags = CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY | CAMEL_FOLDER_HAS_SEARCH_CAPABILITY;
- folder->permanent_flags =
- CAMEL_EXCHANGE_SERVER_FLAGS | CAMEL_MESSAGE_FLAGGED |
- CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_USER;
-}
-
-static void
-free_index_and_mid (gpointer thread_index, gpointer message_id, gpointer d)
-{
- g_free (thread_index);
- g_free (message_id);
-}
-
-static void
-finalize (CamelExchangeFolder *exch)
-{
- g_object_unref (CAMEL_OBJECT (exch->cache));
-
- if (exch->thread_index_to_message_id) {
- g_hash_table_foreach (exch->thread_index_to_message_id,
- free_index_and_mid, NULL);
- g_hash_table_destroy (exch->thread_index_to_message_id);
- }
- g_free (exch->source);
-}
-
-CamelType
-camel_exchange_folder_get_type (void)
-{
- static CamelType camel_exchange_folder_type = CAMEL_INVALID_TYPE;
-
- if (camel_exchange_folder_type == CAMEL_INVALID_TYPE) {
- camel_exchange_folder_type = camel_type_register (
- camel_offline_folder_get_type (),
- "CamelExchangeFolder",
- sizeof (CamelExchangeFolder),
- sizeof (CamelExchangeFolderClass),
- (CamelObjectClassInitFunc) class_init,
- NULL,
- (CamelObjectInitFunc) init,
- (CamelObjectFinalizeFunc) finalize );
- }
-
- return camel_exchange_folder_type;
-}
-
-static void
-refresh_info (CamelFolder *folder, GError **error)
-{
- CamelExchangeFolder *exch = CAMEL_EXCHANGE_FOLDER (folder);
- CamelExchangeStore *store = CAMEL_EXCHANGE_STORE (folder->parent_store);
- guint32 unread_count, visible_count;
-
- if (camel_exchange_store_connected (store, ex)) {
- camel_offline_journal_replay (exch->journal, NULL);
-
- camel_exchange_utils_refresh_folder (CAMEL_SERVICE (folder->parent_store), folder->full_name, ex);
- }
-
- /* sync up the counts now */
- if (!camel_exchange_utils_sync_count (CAMEL_SERVICE (folder->parent_store), folder->full_name, &unread_count, &visible_count, ex)) {
- g_print("\n Error syncing up the counts");
- }
-
- folder->summary->unread_count = unread_count;
- folder->summary->visible_count = visible_count;
-}
-
-static void
-exchange_expunge (CamelFolder *folder, GError **error)
-{
- CamelFolder *trash;
- GPtrArray *uids;
- CamelExchangeStore *store = CAMEL_EXCHANGE_STORE (folder->parent_store);
-
- if (!camel_exchange_store_connected (store, ex)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("You cannot expunge in offline mode."));
- return;
- }
-
- trash = camel_store_get_trash (folder->parent_store, NULL);
- if (!trash) {
- printf ("Expunge failed, could not read trash folder\n");
- return;
- }
-
- uids = camel_folder_get_uids (trash);
- camel_exchange_utils_expunge_uids (CAMEL_SERVICE (trash->parent_store), trash->full_name, uids, ex);
- camel_folder_free_uids (trash, uids);
- g_object_unref (CAMEL_OBJECT (trash));
-}
+ CamelStream *src, *dest;
+ gint i;
-static void
-append_message_data (CamelFolder *folder, GByteArray *message,
- const gchar *subject, const CamelMessageInfo *info,
- gchar **appended_uid, GError **error)
-{
- CamelExchangeFolder *exch = CAMEL_EXCHANGE_FOLDER (folder);
- CamelStream *stream_cache;
- gchar *new_uid;
+ for (i = 0; i < src_uids->len; i++) {
+ if (!*(gchar *)dest_uids->pdata[i])
+ continue;
- if (!subject)
- subject = camel_message_info_subject (info);;
- if (!subject)
- subject = _("No Subject");
+ src = camel_data_cache_get (folder_source->cache, "cache",
+ src_uids->pdata[i], NULL);
+ if (!src)
+ continue;
- if (camel_exchange_utils_append_message (CAMEL_SERVICE (folder->parent_store),
- folder->full_name,
- info ? camel_message_info_flags (info) : 0,
- subject,
- message,
- &new_uid,
- ex)) {
- 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);
- g_object_unref (CAMEL_OBJECT (stream_cache));
+ dest = camel_data_cache_add (folder_dest->cache, "cache",
+ dest_uids->pdata[i], NULL);
+ if (dest) {
+ camel_stream_write_to_stream (src, dest);
+ g_object_unref (CAMEL_OBJECT (dest));
}
- if (appended_uid)
- *appended_uid = new_uid;
- else
- g_free (new_uid);
- } else if (appended_uid)
- *appended_uid = NULL;
-}
-
-static void
-append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, gchar **appended_uid,
- GError **error)
-{
- CamelStream *stream_mem;
- CamelExchangeStore *store = CAMEL_EXCHANGE_STORE (folder->parent_store);
-
- gchar *old_subject = NULL;
- GString *new_subject;
- gint i, len;
-
- /*
- FIXME: We should add a top-level camel API camel_mime_message_prune_invalid_chars
- which each of the provider will have to implement to remove things
- that are invalid for their Transport mechanism. This will help in
- avoiding duplication of work. Now Sending and Importing both requires
- substitution of \t and \n with blank.
- */
-
- old_subject = g_strdup(camel_mime_message_get_subject (message));
-
- if (old_subject) {
- len = strlen (old_subject);
- new_subject = g_string_new("");
- for (i = 0; i < len; i++)
- if ((old_subject[i] != '\t') && (old_subject[i] != '\n'))
- new_subject = g_string_append_c (new_subject, old_subject[i]);
- else
- new_subject = g_string_append_c (new_subject, ' ');
- camel_mime_message_set_subject (message, new_subject->str);
- g_free (old_subject);
- g_string_free (new_subject, TRUE);
- }
+ g_object_unref (CAMEL_OBJECT (src));
- if (!camel_exchange_store_connected (store, ex)) {
- camel_exchange_journal_append ((CamelExchangeJournal *) ((CamelExchangeFolder *)folder)->journal, message, info, appended_uid, ex);
- return;
+ if (delete) {
+ camel_data_cache_remove (folder_source->cache, "cache",
+ src_uids->pdata[i], NULL);
+ }
}
- stream_mem = camel_stream_mem_new ();
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message),
- stream_mem);
- camel_stream_flush (stream_mem);
-
- append_message_data (folder, CAMEL_STREAM_MEM (stream_mem)->buffer,
- camel_mime_message_get_subject (message),
- info, appended_uid, ex);
-
- g_object_unref (CAMEL_OBJECT (stream_mem));
}
static void
@@ -344,16 +139,55 @@ fix_broken_multipart_related (CamelMimePart *part)
}
}
-static gchar *
-get_filename (CamelFolder *folder, const gchar *uid, GError **error)
+static gboolean
+exchange_folder_append_message_data (CamelFolder *folder,
+ GByteArray *message,
+ const gchar *subject,
+ const CamelMessageInfo *info,
+ gchar **appended_uid,
+ GError **error)
{
CamelExchangeFolder *exch = CAMEL_EXCHANGE_FOLDER (folder);
+ CamelStream *stream_cache;
+ gchar *new_uid;
+ gboolean success;
- return camel_data_cache_get_filename (exch->cache, "cache", uid, NULL);
+ if (!subject)
+ subject = camel_message_info_subject (info);;
+ if (!subject)
+ subject = _("No Subject");
+
+ success = camel_exchange_utils_append_message (
+ CAMEL_SERVICE (folder->parent_store),
+ folder->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);
+ g_object_unref (stream_cache);
+ }
+ if (appended_uid)
+ *appended_uid = new_uid;
+ else
+ g_free (new_uid);
+ } else if (appended_uid)
+ *appended_uid = NULL;
+
+ return success;
}
static GByteArray *
-get_message_data (CamelFolder *folder, const gchar *uid, GError **error)
+exchange_folder_get_message_data (CamelFolder *folder,
+ const gchar *uid,
+ GError **error)
{
CamelExchangeFolder *exch = CAMEL_EXCHANGE_FOLDER (folder);
CamelExchangeStore *store = CAMEL_EXCHANGE_STORE (folder->parent_store);
@@ -373,16 +207,20 @@ get_message_data (CamelFolder *folder, const gchar *uid, GError **error)
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 (folder->parent_store), folder->full_name, uid, &ba, ex))
+ if (!camel_exchange_utils_get_message (
+ CAMEL_SERVICE (folder->parent_store),
+ folder->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;
@@ -395,35 +233,270 @@ get_message_data (CamelFolder *folder, const gchar *uid, GError **error)
return ba;
}
-#define MAILING_LIST_HEADERS "X-MAILING-LIST X-LOOP LIST-ID LIST-POST MAILING-LIST ORIGINATOR X-LIST RETURN-PATH X-BEENTHERE "
+static gboolean
+exchange_folder_transfer_messages_the_hard_way (CamelFolder *source,
+ GPtrArray *uids,
+ CamelFolder *dest,
+ GPtrArray **transferred_uids,
+ gboolean delete_originals,
+ GError **error)
+{
+ CamelMessageInfo *info;
+ GByteArray *ba;
+ gchar *ret_uid;
+ gboolean success = TRUE;
+ gint i;
+
+ if (transferred_uids)
+ *transferred_uids = g_ptr_array_new ();
+
+ for (i = 0; i < uids->len; i++) {
+ info = camel_folder_summary_uid (source->summary, uids->pdata[i]);
+ if (!info)
+ continue;
+
+ ba = exchange_folder_get_message_data (
+ source, uids->pdata[i], error);
+ if (!ba) {
+ camel_message_info_free (info);
+ success = FALSE;
+ break;
+ }
+
+ 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 (!success)
+ break;
+
+ if (transferred_uids)
+ g_ptr_array_add (*transferred_uids, ret_uid);
+ else
+ g_free (ret_uid);
+ }
+
+ if (success && delete_originals)
+ success = camel_exchange_utils_expunge_uids (
+ CAMEL_SERVICE (source->parent_store),
+ source->full_name, uids, error);
+
+ return success;
+}
+
+static void
+free_index_and_mid (gpointer thread_index, gpointer message_id, gpointer d)
+{
+ g_free (thread_index);
+ g_free (message_id);
+}
+
+static void
+exchange_folder_dispose (GObject *object)
+{
+ CamelExchangeFolder *folder;
+
+ folder = CAMEL_EXCHANGE_FOLDER (object);
+
+ if (folder->cache != NULL) {
+ g_object_unref (folder->cache);
+ folder->cache = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+exchange_folder_finalize (GObject *object)
+{
+ CamelExchangeFolder *folder;
+
+ folder = CAMEL_EXCHANGE_FOLDER (object);
+
+ if (folder->thread_index_to_message_id != NULL) {
+ g_hash_table_foreach (
+ folder->thread_index_to_message_id,
+ free_index_and_mid, NULL);
+ g_hash_table_destroy (folder->thread_index_to_message_id);
+ }
+
+ g_free (folder->source);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gboolean
+exchange_folder_refresh_info (CamelFolder *folder,
+ GError **error)
+{
+ CamelExchangeFolder *exch = CAMEL_EXCHANGE_FOLDER (folder);
+ CamelExchangeStore *store = CAMEL_EXCHANGE_STORE (folder->parent_store);
+ guint32 unread_count, visible_count;
+ gboolean success;
+
+ /* XXX Need to check for errors. */
+ if (camel_exchange_store_connected (store, NULL)) {
+ camel_offline_journal_replay (exch->journal, NULL);
+
+ camel_exchange_utils_refresh_folder (
+ CAMEL_SERVICE (folder->parent_store),
+ folder->full_name, NULL);
+ }
+
+ /* sync up the counts now */
+ success = camel_exchange_utils_sync_count (
+ CAMEL_SERVICE (folder->parent_store),
+ folder->full_name, &unread_count, &visible_count, error);
+
+ folder->summary->unread_count = unread_count;
+ folder->summary->visible_count = visible_count;
+
+ return success;
+}
+
+static gboolean
+exchange_folder_expunge (CamelFolder *folder,
+ GError **error)
+{
+ CamelFolder *trash;
+ GPtrArray *uids;
+ CamelExchangeStore *store = CAMEL_EXCHANGE_STORE (folder->parent_store);
+ gboolean success;
+
+ 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;
+ }
+
+ trash = camel_store_get_trash (folder->parent_store, error);
+ if (trash == NULL)
+ return FALSE;
+
+ uids = camel_folder_get_uids (trash);
+ success = camel_exchange_utils_expunge_uids (
+ CAMEL_SERVICE (trash->parent_store),
+ trash->full_name, uids, error);
+ camel_folder_free_uids (trash, uids);
+
+ g_object_unref (trash);
+
+ return success;
+}
+
+static gboolean
+exchange_folder_sync (CamelFolder *folder,
+ gboolean expunge,
+ GError **error)
+{
+ if (expunge && !exchange_folder_expunge (folder, error))
+ return FALSE;
+
+ camel_folder_summary_save_to_db (folder->summary, NULL);
+
+ return TRUE;
+}
+
+static gboolean
+exchange_folder_append_message (CamelFolder *folder,
+ CamelMimeMessage *message,
+ const CamelMessageInfo *info,
+ gchar **appended_uid,
+ GError **error)
+{
+ CamelStream *stream_mem;
+ CamelExchangeStore *store;
+ GByteArray *byte_array;
+ gchar *old_subject = NULL;
+ GString *new_subject;
+ gint i, len;
+ gboolean success;
+
+ store = CAMEL_EXCHANGE_STORE (folder->parent_store);
+
+ /*
+ FIXME: We should add a top-level camel API camel_mime_message_prune_invalid_chars
+ which each of the provider will have to implement to remove things
+ that are invalid for their Transport mechanism. This will help in
+ avoiding duplication of work. Now Sending and Importing both requires
+ substitution of \t and \n with blank.
+ */
+
+ old_subject = g_strdup(camel_mime_message_get_subject (message));
+
+ if (old_subject) {
+ len = strlen (old_subject);
+ new_subject = g_string_new("");
+ for (i = 0; i < len; i++)
+ if ((old_subject[i] != '\t') && (old_subject[i] != '\n'))
+ new_subject = g_string_append_c (new_subject, old_subject[i]);
+ else
+ new_subject = g_string_append_c (new_subject, ' ');
+ camel_mime_message_set_subject (message, new_subject->str);
+ g_free (old_subject);
+ g_string_free (new_subject, TRUE);
+ }
+
+ if (!camel_exchange_store_connected (store, NULL))
+ return camel_exchange_journal_append (
+ (CamelExchangeJournal *)
+ CAMEL_EXCHANGE_FOLDER (folder)->journal,
+ message, info, appended_uid, error);
+
+ byte_array = g_byte_array_new ();
+ stream_mem = camel_stream_mem_new_with_byte_array (byte_array);
+ camel_data_wrapper_write_to_stream (
+ CAMEL_DATA_WRAPPER (message), stream_mem);
+ camel_stream_flush (stream_mem);
+
+ success = exchange_folder_append_message_data (
+ folder, byte_array,
+ camel_mime_message_get_subject (message),
+ info, appended_uid, error);
+
+ g_object_unref (stream_mem);
+
+ return success;
+}
static CamelMimeMessage *
-get_message (CamelFolder *folder, const gchar *uid, GError **error)
+exchange_folder_get_message (CamelFolder *folder,
+ const gchar *uid,
+ GError **error)
{
CamelExchangeFolder *exch = CAMEL_EXCHANGE_FOLDER (folder);
CamelMimeMessage *msg;
CamelStream *stream;
- CamelStreamFilter *filtered_stream;
+ CamelStream *filtered_stream;
CamelMimeFilter *crlffilter;
GByteArray *ba;
gchar **list_headers = NULL;
gboolean found_list = FALSE;
- ba = get_message_data (folder, uid, ex);
+ ba = exchange_folder_get_message_data (folder, uid, error);
if (!ba)
return NULL;
stream = camel_stream_mem_new_with_byte_array (ba);
- crlffilter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_DECODE, CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
- filtered_stream = camel_stream_filter_new_with_stream (stream);
- camel_stream_filter_add (filtered_stream, crlffilter);
- g_object_unref (CAMEL_OBJECT (crlffilter));
- g_object_unref (CAMEL_OBJECT (stream));
+ crlffilter = camel_mime_filter_crlf_new (
+ CAMEL_MIME_FILTER_CRLF_DECODE,
+ CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
+ filtered_stream = camel_stream_filter_new (stream);
+ camel_stream_filter_add (
+ CAMEL_STREAM_FILTER (filtered_stream), crlffilter);
+ g_object_unref (crlffilter);
+ 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));
g_object_unref (CAMEL_OBJECT (filtered_stream));
camel_mime_message_set_source (msg, exch->source);
@@ -449,40 +522,10 @@ get_message (CamelFolder *folder, const gchar *uid, GError **error)
return msg;
}
-static GPtrArray *
-search_by_expression (CamelFolder *folder, const gchar *expression,
- 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);
-
- g_object_unref (CAMEL_OBJECT (search));
-
- return matches;
-}
-
-static guint32
-count_by_expression (CamelFolder *folder, const gchar *expression,
- 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);
-
- g_object_unref (CAMEL_OBJECT (search));
-
- return matches;
-}
-
static gint
-cmp_uids (CamelFolder *folder, const gchar *uid1, const gchar *uid2)
+exchange_folder_cmp_uids (CamelFolder *folder,
+ const gchar *uid1,
+ const gchar *uid2)
{
g_return_val_if_fail (uid1 != NULL, 0);
g_return_val_if_fail (uid2 != NULL, 0);
@@ -491,107 +534,52 @@ cmp_uids (CamelFolder *folder, const gchar *uid1, const gchar *uid2)
}
static GPtrArray *
-search_by_uids (CamelFolder *folder, const gchar *expression,
- GPtrArray *uids, GError **error)
+exchange_folder_search_by_expression (CamelFolder *folder,
+ const gchar *expression,
+ GError **error)
{
CamelFolderSearch *search;
GPtrArray *matches;
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);
-
- g_object_unref (CAMEL_OBJECT (search));
-
- return matches;
-}
-
-static void
-transfer_messages_the_hard_way (CamelFolder *source, GPtrArray *uids,
- CamelFolder *dest,
- GPtrArray **transferred_uids,
- gboolean delete_originals, GError **error)
-{
- CamelException local_ex;
- CamelMessageInfo *info;
- GByteArray *ba;
- gchar *ret_uid;
- gint i;
-
- 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]);
- if (!info)
- continue;
-
- ba = get_message_data (source, uids->pdata[i], &local_ex);
- if (!ba) {
- camel_message_info_free(info);
- break;
- }
-
- append_message_data (dest, ba, NULL, info, &ret_uid, &local_ex);
- camel_message_info_free(info);
- g_byte_array_free (ba, TRUE);
-
- if (camel_exception_is_set (&local_ex))
- break;
- if (transferred_uids)
- g_ptr_array_add (*transferred_uids, ret_uid);
- else
- g_free (ret_uid);
- }
+ matches = camel_folder_search_search (
+ search, expression, NULL, error);
- if (camel_exception_is_set (&local_ex)) {
- camel_exception_xfer (ex, &local_ex);
- return;
- }
+ g_object_unref (search);
- if (delete_originals) {
- camel_exchange_utils_expunge_uids (CAMEL_SERVICE (source->parent_store), source->full_name, uids, ex);
- }
+ return matches;
}
-static void
-cache_xfer (CamelExchangeFolder *folder_source, CamelExchangeFolder *folder_dest,
- GPtrArray *src_uids, GPtrArray *dest_uids, gboolean delete)
+static GPtrArray *
+exchange_folder_search_by_uids (CamelFolder *folder,
+ const gchar *expression,
+ GPtrArray *uids,
+ GError **error)
{
- CamelStream *src, *dest;
- gint i;
+ CamelFolderSearch *search;
+ GPtrArray *matches;
- for (i = 0; i < src_uids->len; i++) {
- if (!*(gchar *)dest_uids->pdata[i])
- continue;
+ search = camel_exchange_search_new ();
+ camel_folder_search_set_folder (search, folder);
+ camel_folder_search_set_summary (search, uids);
- src = camel_data_cache_get (folder_source->cache, "cache",
- src_uids->pdata[i], NULL);
- if (!src)
- continue;
+ matches = camel_folder_search_execute_expression (
+ search, expression, error);
- dest = camel_data_cache_add (folder_dest->cache, "cache",
- dest_uids->pdata[i], NULL);
- if (dest) {
- camel_stream_write_to_stream (src, dest);
- g_object_unref (CAMEL_OBJECT (dest));
- }
- g_object_unref (CAMEL_OBJECT (src));
+ g_object_unref (search);
- if (delete) {
- camel_data_cache_remove (folder_source->cache, "cache",
- src_uids->pdata[i], NULL);
- }
- }
+ return matches;
}
-static void
-transfer_messages_to (CamelFolder *source, GPtrArray *uids,
- CamelFolder *dest, GPtrArray **transferred_uids,
- gboolean delete_originals, GError **error)
+static gboolean
+exchange_folder_transfer_messages_to (CamelFolder *source,
+ GPtrArray *uids,
+ CamelFolder *dest,
+ GPtrArray **transferred_uids,
+ gboolean delete_originals,
+ GError **error)
{
CamelExchangeFolder *exch_source = CAMEL_EXCHANGE_FOLDER (source);
CamelExchangeFolder *exch_dest = CAMEL_EXCHANGE_FOLDER (dest);
@@ -599,12 +587,13 @@ transfer_messages_to (CamelFolder *source, GPtrArray *uids,
CamelMessageInfo *info;
GPtrArray *ret_uids = NULL;
gint hier_len, i;
+ gboolean success = TRUE;
camel_operation_start (NULL, delete_originals ? _("Moving messages") :
_("Copying messages"));
/* Check for offline operation */
- if (!camel_exchange_store_connected (store, ex)) {
+ if (!camel_exchange_store_connected (store, NULL)) {
CamelExchangeJournal *journal = (CamelExchangeJournal *) exch_dest->journal;
CamelMimeMessage *message;
@@ -613,36 +602,35 @@ transfer_messages_to (CamelFolder *source, GPtrArray *uids,
if (!info)
continue;
- if (!(message = get_message (source, camel_message_info_uid (info), ex)))
+ message = exchange_folder_get_message (
+ source, camel_message_info_uid (info), error);
+ if (message == NULL)
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))
+ if (!success)
break;
}
goto end;
}
hier_len = strcspn (source->full_name, "/");
- if (strncmp (source->full_name, dest->full_name, hier_len) != 0) {
- transfer_messages_the_hard_way (source, uids, dest,
- transferred_uids,
- delete_originals, ex);
- return;
- }
+ 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, error);
- if (camel_exchange_utils_transfer_messages (CAMEL_SERVICE (store),
- source->full_name,
- dest->full_name,
- uids,
- delete_originals,
- &ret_uids,
- ex)) {
+ success = camel_exchange_utils_transfer_messages (
+ CAMEL_SERVICE (store), source->full_name, dest->full_name,
+ uids, delete_originals, &ret_uids, error);
+
+ if (success) {
if (ret_uids->len != 0)
cache_xfer (exch_source, exch_dest, uids, ret_uids, FALSE);
@@ -654,8 +642,97 @@ transfer_messages_to (CamelFolder *source, GPtrArray *uids,
}
} else if (transferred_uids)
*transferred_uids = NULL;
+
end:
camel_operation_end (NULL);
+
+ return success;
+}
+
+static guint32
+exchange_folder_count_by_expression (CamelFolder *folder,
+ const gchar *expression,
+ 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, error);
+
+ g_object_unref (CAMEL_OBJECT (search));
+
+ return matches;
+}
+
+static gchar *
+exchange_folder_get_filename (CamelFolder *folder,
+ const gchar *uid,
+ GError **error)
+{
+ CamelExchangeFolder *exch = CAMEL_EXCHANGE_FOLDER (folder);
+
+ return camel_data_cache_get_filename (exch->cache, "cache", uid, NULL);
+}
+
+static void
+exchange_folder_class_init (CamelExchangeFolderClass *class)
+{
+ GObjectClass *object_class;
+ CamelFolderClass *folder_class;
+
+ parent_class = g_type_class_peek_parent (class);
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = exchange_folder_dispose;
+ object_class->finalize = exchange_folder_finalize;
+
+ folder_class = CAMEL_FOLDER_CLASS (class);
+ folder_class->refresh_info = exchange_folder_refresh_info;
+ folder_class->sync = exchange_folder_sync;
+ folder_class->expunge = exchange_folder_expunge;
+ folder_class->append_message = exchange_folder_append_message;
+ folder_class->get_message = exchange_folder_get_message;
+ folder_class->cmp_uids = exchange_folder_cmp_uids;
+ folder_class->search_by_expression = exchange_folder_search_by_expression;
+ folder_class->search_by_uids = exchange_folder_search_by_uids;
+ folder_class->transfer_messages_to = exchange_folder_transfer_messages_to;
+ folder_class->count_by_expression = exchange_folder_count_by_expression;
+ folder_class->get_filename = exchange_folder_get_filename;
+}
+
+#define CAMEL_EXCHANGE_SERVER_FLAGS \
+ (CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_ANSWERED_ALL | \
+ CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN)
+
+static void
+exchange_folder_init (CamelFolder *folder)
+{
+ folder->folder_flags =
+ CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY |
+ CAMEL_FOLDER_HAS_SEARCH_CAPABILITY;
+ folder->permanent_flags =
+ CAMEL_EXCHANGE_SERVER_FLAGS | CAMEL_MESSAGE_FLAGGED |
+ CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_USER;
+}
+
+GType
+camel_exchange_folder_get_type (void)
+{
+ static GType type = G_TYPE_INVALID;
+
+ if (G_UNLIKELY (type == G_TYPE_INVALID))
+ type = g_type_register_static_simple (
+ CAMEL_TYPE_OFFLINE_FOLDER,
+ "CamelExchangeFolder",
+ sizeof (CamelExchangeFolderClass),
+ (GClassInitFunc) exchange_folder_class_init,
+ sizeof (CamelExchangeFolder),
+ (GInstanceInitFunc) exchange_folder_init,
+ 0);
+
+ return type;
}
/* A new post to a folder gets a 27-byte-long thread index. (The value
@@ -968,9 +1045,11 @@ camel_exchange_folder_construct (CamelFolder *folder, CamelStore *parent,
camel_folder_construct (folder, parent, name, short_name);
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_FILE_ERROR,
+ g_file_error_from_errno (errno),
+ _("Could not create directory %s: %s"),
+ folder_dir, g_strerror (errno));
return FALSE;
}
@@ -978,17 +1057,17 @@ camel_exchange_folder_construct (CamelFolder *folder, CamelStore *parent,
folder->summary = camel_exchange_summary_new (folder, summary_file);
g_free (summary_file);
if (!folder->summary) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not load summary for %s"),
- name);
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Could not load summary for %s"), name);
return FALSE;
}
- exch->cache = camel_data_cache_new (folder_dir, 0, ex);
+ exch->cache = camel_data_cache_new (folder_dir, 0);
if (!exch->cache) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create cache for %s"),
- name);
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Could not create cache for %s"), name);
return FALSE;
}
@@ -996,9 +1075,9 @@ camel_exchange_folder_construct (CamelFolder *folder, CamelStore *parent,
exch->journal = camel_exchange_journal_new (exch, journal_file);
g_free (journal_file);
if (!exch->journal) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create journal for %s"),
- name);
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Could not create journal for %s"), name);
return FALSE;
}
@@ -1036,7 +1115,7 @@ camel_exchange_folder_construct (CamelFolder *folder, CamelStore *parent,
g_ptr_array_set_size (hrefs, summary->len);
if (summary->len - camel_folder_summary_cache_size (folder->summary) > 50)
- camel_folder_summary_reload_from_db (folder->summary, ex);
+ camel_folder_summary_reload_from_db (folder->summary, NULL);
for (i = 0; i < summary->len; i++) {
uids->pdata[i] = g_strdup(summary->pdata[i]);
@@ -1049,7 +1128,7 @@ camel_exchange_folder_construct (CamelFolder *folder, CamelStore *parent,
camel_operation_start (NULL, _("Scanning for changed messages"));
ok = camel_exchange_utils_get_folder (CAMEL_SERVICE (parent),
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);
@@ -1072,12 +1151,12 @@ camel_exchange_folder_construct (CamelFolder *folder, CamelStore *parent,
return TRUE;
camel_operation_start (NULL, _("Fetching summary information for new messages"));
- ok = camel_exchange_utils_refresh_folder (CAMEL_SERVICE (parent), folder->full_name, ex);
+ ok = camel_exchange_utils_refresh_folder (CAMEL_SERVICE (parent), folder->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))
@@ -1086,11 +1165,3 @@ camel_exchange_folder_construct (CamelFolder *folder, CamelStore *parent,
return TRUE;
}
-static void
-exchange_sync (CamelFolder *folder, gboolean expunge, GError **error)
-{
- if (expunge)
- exchange_expunge (folder, ex);
-
- camel_folder_summary_save_to_db (folder->summary, ex);
-}
diff --git a/camel/camel-exchange-folder.h b/camel/camel-exchange-folder.h
index 8259bc3..cf2b24f 100644
--- a/camel/camel-exchange-folder.h
+++ b/camel/camel-exchange-folder.h
@@ -4,69 +4,83 @@
/* camel-exchange-folder.h: class for a exchange folder */
#ifndef CAMEL_EXCHANGE_FOLDER_H
-#define CAMEL_EXCHANGE_FOLDER_H 1
-
-G_BEGIN_DECLS
+#define CAMEL_EXCHANGE_FOLDER_H
#include <camel/camel.h>
-#define CAMEL_EXCHANGE_FOLDER_TYPE (camel_exchange_folder_get_type ())
-#define CAMEL_EXCHANGE_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_EXCHANGE_FOLDER_TYPE, CamelExchangeFolder))
-#define CAMEL_EXCHANGE_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_EXCHANGE_FOLDER_TYPE, CamelExchangeFolderClass))
-#define CAMEL_IS_EXCHANGE_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_EXCHANGE_FOLDER_TYPE))
+/* Standard GObject macros */
+#define CAMEL_TYPE_EXCHANGE_FOLDER \
+ (camel_exchange_folder_get_type ())
+#define CAMEL_EXCHANGE_FOLDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_EXCHANGE_FOLDER, CamelExchangeFolder))
+#define CAMEL_EXCHANGE_FOLDER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_EXCHANGE_FOLDER, CamelExchangeFolderClass))
+#define CAMEL_IS_EXCHANGE_FOLDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_EXCHANGE_FOLDER))
+#define CAMEL_IS_EXCHANGE_FOLDER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_EXCHANGE_FOLDER))
+#define CAMEL_EXCHANGE_FOLDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_EXCHANGE_FOLDER, CamelExchangeFolderClass))
+
+G_BEGIN_DECLS
-typedef struct {
- CamelOfflineFolder parent_object;
+typedef struct _CamelExchangeFolder CamelExchangeFolder;
+typedef struct _CamelExchangeFolderClass CamelExchangeFolderClass;
+
+struct _CamelExchangeFolder {
+ CamelOfflineFolder parent;
CamelDataCache *cache;
CamelOfflineJournal *journal;
gchar *source;
GHashTable *thread_index_to_message_id;
-} CamelExchangeFolder;
+};
-typedef struct {
+struct _CamelExchangeFolderClass {
CamelOfflineFolderClass parent_class;
-
-} CamelExchangeFolderClass;
-
-/* Standard Camel function */
-CamelType camel_exchange_folder_get_type (void);
-
-gboolean camel_exchange_folder_construct (CamelFolder *folder,
- CamelStore *parent,
- const gchar *name,
- guint32 camel_flags,
- const gchar *folder_dir,
- gint offline_state,
- GError **error);
-
-void camel_exchange_folder_add_message (CamelExchangeFolder *exch,
- const gchar *uid,
- guint32 flags,
- guint32 size,
- const gchar *headers,
- const gchar *href);
-
-void camel_exchange_folder_remove_message (CamelExchangeFolder *exch,
- const gchar *uid);
-
-void camel_exchange_folder_uncache_message (CamelExchangeFolder *exch,
- const gchar *uid);
-
-void camel_exchange_folder_update_message_flags (CamelExchangeFolder *exch,
- const gchar *uid,
- guint32 flags);
-
-void camel_exchange_folder_update_message_flags_ex (CamelExchangeFolder *exch,
- const gchar *uid,
- guint32 flags,
- guint32 mask);
-
-void camel_exchange_folder_update_message_tag (CamelExchangeFolder *exch,
- const gchar *uid,
- const gchar *name,
- const gchar *value);
+};
+
+GType camel_exchange_folder_get_type (void);
+gboolean camel_exchange_folder_construct (CamelFolder *folder,
+ CamelStore *parent,
+ const gchar *name,
+ guint32 camel_flags,
+ const gchar *folder_dir,
+ gint offline_state,
+ GError **error);
+void camel_exchange_folder_add_message
+ (CamelExchangeFolder *exch,
+ const gchar *uid,
+ guint32 flags,
+ guint32 size,
+ const gchar *headers,
+ const gchar *href);
+void camel_exchange_folder_remove_message
+ (CamelExchangeFolder *exch,
+ const gchar *uid);
+void camel_exchange_folder_uncache_message
+ (CamelExchangeFolder *exch,
+ const gchar *uid);
+void camel_exchange_folder_update_message_flags
+ (CamelExchangeFolder *exch,
+ const gchar *uid,
+ guint32 flags);
+void camel_exchange_folder_update_message_flags_ex
+ (CamelExchangeFolder *exch,
+ const gchar *uid,
+ guint32 flags,
+ guint32 mask);
+void camel_exchange_folder_update_message_tag
+ (CamelExchangeFolder *exch,
+ const gchar *uid,
+ const gchar *name,
+ const gchar *value);
G_END_DECLS
diff --git a/camel/camel-exchange-journal.c b/camel/camel-exchange-journal.c
index 8b2033c..257af9f 100644
--- a/camel/camel-exchange-journal.c
+++ b/camel/camel-exchange-journal.c
@@ -42,65 +42,191 @@
#define d(x)
-static void camel_exchange_journal_class_init (CamelExchangeJournalClass *klass);
-static void camel_exchange_journal_init (CamelExchangeJournal *journal, CamelExchangeJournalClass *klass);
-static void camel_exchange_journal_finalize (CamelObject *object);
+static gpointer parent_class;
-static void exchange_entry_free (CamelOfflineJournal *journal, CamelDListNode *entry);
-static CamelDListNode *exchange_entry_load (CamelOfflineJournal *journal, FILE *in);
-static gint exchange_entry_write (CamelOfflineJournal *journal, CamelDListNode *entry, FILE *out);
-static gint exchange_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, GError **error);
-
-static CamelOfflineJournalClass *parent_class = NULL;
+static void
+exchange_message_info_dup_to (CamelMessageInfoBase *dest,
+ CamelMessageInfoBase *src)
+{
+ camel_flag_list_copy (&dest->user_flags, &src->user_flags);
+ camel_tag_list_copy (&dest->user_tags, &src->user_tags);
+ dest->date_received = src->date_received;
+ dest->date_sent = src->date_sent;
+ dest->flags = src->flags;
+ dest->size = src->size;
+}
-CamelType
-camel_exchange_journal_get_type (void)
+static gint
+exchange_journal_entry_play_append (CamelOfflineJournal *journal,
+ CamelExchangeJournalEntry *entry,
+ GError **error)
{
- static CamelType type = 0;
-
- if (!type) {
- type = camel_type_register (camel_offline_journal_get_type (),
- "CamelExchangeJournal",
- sizeof (CamelExchangeJournal),
- sizeof (CamelExchangeJournalClass),
- (CamelObjectClassInitFunc) camel_exchange_journal_class_init,
- NULL,
- (CamelObjectInitFunc) camel_exchange_journal_init,
- (CamelObjectFinalizeFunc) camel_exchange_journal_finalize);
+ CamelExchangeFolder *exchange_folder;
+ CamelFolder *folder;
+ CamelMimeMessage *message;
+ CamelMessageInfo *info, *real;
+ CamelStream *stream;
+ gchar *uid = NULL;
+
+ folder = journal->folder;
+ exchange_folder = CAMEL_EXCHANGE_FOLDER (folder);
+
+ if (exchange_folder->cache == NULL)
+ goto done;
+
+ stream = camel_data_cache_get (
+ exchange_folder->cache, "cache", entry->uid, error);
+ if (stream == NULL)
+ goto done;
+
+ message = camel_mime_message_new ();
+ if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream) == -1) {
+ g_object_unref (message);
+ g_object_unref (stream);
+ goto done;
}
- return type;
-}
+ g_object_unref (stream);
-static void
-camel_exchange_journal_class_init (CamelExchangeJournalClass *klass)
-{
- CamelOfflineJournalClass *journal_class = (CamelOfflineJournalClass *) klass;
+ if (!(info = camel_folder_summary_uid (folder->summary, entry->uid))) {
+ /* Should have never happened, but create a new info to avoid further crashes */
+ info = camel_message_info_new (NULL);
+ }
- parent_class = (CamelOfflineJournalClass *) camel_type_get_global_classfuncs (CAMEL_TYPE_OFFLINE_JOURNAL);
+ if (!camel_folder_append_message (folder, message, info, &uid, error))
+ return -1;
- journal_class->entry_free = exchange_entry_free;
- journal_class->entry_load = exchange_entry_load;
- journal_class->entry_write = exchange_entry_write;
- journal_class->entry_play = exchange_entry_play;
+ real = camel_folder_summary_info_new_from_message (folder->summary, message, NULL);
+ g_object_unref (message);
+
+ if (uid != NULL && real) {
+ real->uid = camel_pstring_strdup (uid);
+ exchange_message_info_dup_to ((CamelMessageInfoBase *) real, (CamelMessageInfoBase *) info);
+ camel_folder_summary_add (folder->summary, real);
+ /* FIXME: should a folder_changed event be triggered? */
+ }
+ camel_message_info_free (info);
+ g_free (uid);
+
+ done:
+
+ camel_exchange_folder_remove_message (exchange_folder, entry->uid);
+
+ return 0;
}
-static void
-camel_exchange_journal_init (CamelExchangeJournal *journal, CamelExchangeJournalClass *klass)
+static gint
+exchange_journal_entry_play_transfer (CamelOfflineJournal *journal,
+ CamelExchangeJournalEntry *entry,
+ GError **error)
{
+ CamelExchangeFolder *exchange_folder;
+ CamelFolder *folder;
+ CamelMessageInfo *info, *real;
+ GPtrArray *xuids, *uids;
+ CamelFolder *src;
+ CamelExchangeStore *store;
+ CamelStream *stream;
+ CamelMimeMessage *message;
+
+ folder = journal->folder;
+ exchange_folder = CAMEL_EXCHANGE_FOLDER (folder);
+
+ if (!exchange_folder->cache)
+ goto done;
+
+ stream = camel_data_cache_get (
+ exchange_folder->cache, "cache", entry->uid, error);
+ if (stream == NULL)
+ goto done;
+
+ message = camel_mime_message_new ();
+ if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream) == -1) {
+ g_object_unref (message);
+ g_object_unref (stream);
+ goto done;
+ }
+
+ g_object_unref (stream);
+
+ if (!(info = camel_folder_summary_uid (folder->summary, entry->uid))) {
+ /* Note: this should never happen, but rather than crash lets make a new info */
+ info = camel_message_info_new (NULL);
+ }
+
+ if (!entry->folder_name) {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("No folder name found"));
+ goto exception;
+ }
+
+ store = (CamelExchangeStore *) folder->parent_store;
+ g_mutex_lock (store->folders_lock);
+ src = (CamelFolder *) g_hash_table_lookup (store->folders, entry->folder_name);
+ g_mutex_unlock (store->folders_lock);
+
+ if (src) {
+ uids = g_ptr_array_sized_new (1);
+ g_ptr_array_add (uids, entry->original_uid);
+
+ if (!camel_folder_transfer_messages_to (
+ src, uids, folder, &xuids,
+ entry->delete_original, error))
+ 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 {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Folder doesn't exist"));
+ goto exception;
+ }
+
+ camel_message_info_free (info);
+done:
+ camel_exchange_folder_remove_message (exchange_folder, entry->uid);
+
+ return 0;
+
+exception:
+
+ camel_message_info_free (info);
+
+ return -1;
}
-static void
-camel_exchange_journal_finalize (CamelObject *object)
+static gint
+exchange_journal_entry_play_delete (CamelOfflineJournal *journal,
+ CamelExchangeJournalEntry *entry,
+ GError **error)
{
+ camel_exchange_utils_set_message_flags (
+ CAMEL_SERVICE (journal->folder->parent_store),
+ journal->folder->full_name, entry->uid,
+ entry->set, entry->flags, error);
+ return 0;
}
static void
-exchange_entry_free (CamelOfflineJournal *journal, CamelDListNode *entry)
+exchange_journal_entry_free (CamelOfflineJournal *journal,
+ CamelDListNode *entry)
{
- CamelExchangeJournalEntry *exchange_entry = (CamelExchangeJournalEntry *) entry;
+ CamelExchangeJournalEntry *exchange_entry;
+
+ exchange_entry = (CamelExchangeJournalEntry *) entry;
g_free (exchange_entry->uid);
g_free (exchange_entry->original_uid);
@@ -109,7 +235,8 @@ exchange_entry_free (CamelOfflineJournal *journal, CamelDListNode *entry)
}
static CamelDListNode *
-exchange_entry_load (CamelOfflineJournal *journal, FILE *in)
+exchange_journal_entry_load (CamelOfflineJournal *journal,
+ FILE *in)
{
CamelExchangeJournalEntry *entry;
gchar *tmp;
@@ -169,12 +296,16 @@ exchange_entry_load (CamelOfflineJournal *journal, FILE *in)
}
static gint
-exchange_entry_write (CamelOfflineJournal *journal, CamelDListNode *entry, FILE *out)
+exchange_journal_entry_write (CamelOfflineJournal *journal,
+ CamelDListNode *entry,
+ FILE *out)
{
- CamelExchangeJournalEntry *exchange_entry = (CamelExchangeJournalEntry *) entry;
+ CamelExchangeJournalEntry *exchange_entry;
const gchar *string;
gchar *tmp;
+ exchange_entry = (CamelExchangeJournalEntry *) entry;
+
if (camel_file_util_encode_uint32 (out, exchange_entry->type) == -1)
return -1;
@@ -214,202 +345,83 @@ exchange_entry_write (CamelOfflineJournal *journal, CamelDListNode *entry, FILE
return 0;
}
-static void
-exchange_message_info_dup_to (CamelMessageInfoBase *dest, CamelMessageInfoBase *src)
-{
- camel_flag_list_copy (&dest->user_flags, &src->user_flags);
- camel_tag_list_copy (&dest->user_tags, &src->user_tags);
- dest->date_received = src->date_received;
- dest->date_sent = src->date_sent;
- dest->flags = src->flags;
- dest->size = src->size;
-}
-
-static gint
-exchange_entry_play_delete (CamelOfflineJournal *journal, CamelExchangeJournalEntry *entry, GError **error)
-{
- CamelFolder *folder = (CamelFolder *) journal->folder;
-
- camel_exchange_utils_set_message_flags (CAMEL_SERVICE (folder->parent_store),
- folder->full_name,
- entry->uid,
- entry->set,
- entry->flags,
- ex);
- return 0;
-}
-
static gint
-exchange_entry_play_append (CamelOfflineJournal *journal, CamelExchangeJournalEntry *entry, GError **error)
+exchange_journal_entry_play (CamelOfflineJournal *journal,
+ CamelDListNode *entry,
+ GError **error)
{
- CamelExchangeFolder *exchange_folder = (CamelExchangeFolder *) journal->folder;
- CamelFolder *folder = journal->folder;
- CamelMimeMessage *message;
- CamelMessageInfo *info, *real;
- CamelStream *stream;
- CamelException lex;
- gchar *uid = NULL;
+ CamelExchangeJournalEntry *exchange_entry;
- /* 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)))
- goto done;
+ exchange_entry = (CamelExchangeJournalEntry *) entry;
- message = camel_mime_message_new ();
- if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream) == -1) {
- g_object_unref (message);
- g_object_unref (stream);
- goto done;
- }
-
- g_object_unref (stream);
-
- if (!(info = camel_folder_summary_uid (folder->summary, entry->uid))) {
- /* Should have never happened, but create a new info to avoid further crashes */
- 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);
+ switch (exchange_entry->type) {
+ case CAMEL_EXCHANGE_JOURNAL_ENTRY_APPEND:
+ return exchange_journal_entry_play_append (
+ journal, exchange_entry, error);
+ case CAMEL_EXCHANGE_JOURNAL_ENTRY_TRANSFER:
+ return exchange_journal_entry_play_transfer (
+ journal, exchange_entry, error);
+ case CAMEL_EXCHANGE_JOURNAL_ENTRY_DELETE:
+ return exchange_journal_entry_play_delete (
+ journal, exchange_entry, error);
+ default:
+ g_critical ("%s: Uncaught case (%d)", G_STRLOC, exchange_entry->type);
return -1;
}
-
- real = camel_folder_summary_info_new_from_message (folder->summary, message, NULL);
- g_object_unref (message);
-
- if (uid != NULL && real) {
- real->uid = camel_pstring_strdup (uid);
- exchange_message_info_dup_to ((CamelMessageInfoBase *) real, (CamelMessageInfoBase *) info);
- camel_folder_summary_add (folder->summary, real);
- /* FIXME: should a folder_changed event be triggered? */
- }
- camel_message_info_free (info);
- g_free (uid);
-
- done:
-
- camel_exchange_folder_remove_message (exchange_folder, entry->uid);
-
- return 0;
}
-static gint
-exchange_entry_play_transfer (CamelOfflineJournal *journal, CamelExchangeJournalEntry *entry, GError **error)
+static void
+exchange_journal_class_init (CamelExchangeJournalClass *class)
{
- 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;
-
- if (!exchange_folder->cache || !(stream = camel_data_cache_get (exchange_folder->cache, "cache", entry->uid, ex)))
- goto done;
+ CamelOfflineJournalClass *offline_journal_class;
- message = camel_mime_message_new ();
- if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream) == -1) {
- g_object_unref (message);
- g_object_unref (stream);
- goto done;
- }
-
- g_object_unref (stream);
-
- if (!(info = camel_folder_summary_uid (folder->summary, entry->uid))) {
- /* Note: this should never happen, but rather than crash lets make a new info */
- info = camel_message_info_new (NULL);
- }
-
- if (!entry->folder_name) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("No folder name found\n"));
- goto exception;
- }
-
- store = (CamelExchangeStore *) folder->parent_store;
- g_mutex_lock (store->folders_lock);
- src = (CamelFolder *) g_hash_table_lookup (store->folders, entry->folder_name);
- g_mutex_unlock (store->folders_lock);
-
- if (src) {
- 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);
- goto exception;
- }
-
- 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"));
- goto exception;
- }
+ parent_class = g_type_class_peek_parent (class);
- camel_message_info_free (info);
-done:
- camel_exchange_folder_remove_message (exchange_folder, entry->uid);
-
- return 0;
-
-exception:
-
- camel_message_info_free (info);
-
- return -1;
+ offline_journal_class = CAMEL_OFFLINE_JOURNAL_CLASS (class);
+ offline_journal_class->entry_free = exchange_journal_entry_free;
+ offline_journal_class->entry_load = exchange_journal_entry_load;
+ offline_journal_class->entry_write = exchange_journal_entry_write;
+ offline_journal_class->entry_play = exchange_journal_entry_play;
}
-static gint
-exchange_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, GError **error)
+GType
+camel_exchange_journal_get_type (void)
{
- CamelExchangeJournalEntry *exchange_entry = (CamelExchangeJournalEntry *) entry;
+ static GType type = G_TYPE_INVALID;
+
+ if (G_UNLIKELY (type == G_TYPE_INVALID))
+ type = g_type_register_static_simple (
+ CAMEL_TYPE_OFFLINE_JOURNAL,
+ "CamelExchangeJournal",
+ sizeof (CamelExchangeJournalClass),
+ (GClassInitFunc) exchange_journal_class_init,
+ sizeof (CamelExchangeJournal),
+ (GInstanceInitFunc) NULL,
+ 0);
- switch (exchange_entry->type) {
- case CAMEL_EXCHANGE_JOURNAL_ENTRY_APPEND:
- return exchange_entry_play_append (journal, exchange_entry, ex);
- case CAMEL_EXCHANGE_JOURNAL_ENTRY_TRANSFER:
- return exchange_entry_play_transfer (journal, exchange_entry, ex);
- case CAMEL_EXCHANGE_JOURNAL_ENTRY_DELETE:
- return exchange_entry_play_delete (journal, exchange_entry, ex);
- default:
- g_critical ("%s: Uncaught case (%d)", G_STRLOC, exchange_entry->type);
- return -1;
- }
+ return type;
}
CamelOfflineJournal *
-camel_exchange_journal_new (CamelExchangeFolder *folder, const gchar *filename)
+camel_exchange_journal_new (CamelExchangeFolder *folder,
+ const gchar *filename)
{
CamelOfflineJournal *journal;
g_return_val_if_fail (CAMEL_IS_EXCHANGE_FOLDER (folder), NULL);
- journal = (CamelOfflineJournal *) camel_object_new (camel_exchange_journal_get_type ());
+ journal = g_object_new (CAMEL_TYPE_EXCHANGE_JOURNAL, NULL);
camel_offline_journal_construct (journal, (CamelFolder *) folder, filename);
return journal;
}
static gboolean
-update_cache (CamelExchangeJournal *exchange_journal, CamelMimeMessage *message,
- const CamelMessageInfo *mi, gchar **updated_uid, GError **error)
+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;
@@ -420,15 +432,18 @@ 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_SYSTEM,
+ _("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;
@@ -436,10 +451,13 @@ update_cache (CamelExchangeJournal *exchange_journal, CamelMimeMessage *message,
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);
+ g_set_error (
+ error, G_FILE_ERROR,
+ g_file_error_from_errno (errno),
+ _("Cannot append message in offline mode: %s"),
+ g_strerror (errno));
+ camel_data_cache_remove (
+ exchange_folder->cache, "cache", uid, NULL);
folder->summary->nextuid--;
g_object_unref (cache);
g_free (uid);
@@ -463,16 +481,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, GError **error)
+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;
@@ -483,13 +504,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;
@@ -526,11 +548,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,
- GError **error)
+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;
@@ -538,8 +564,8 @@ 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 = ((CamelFolder *)source_folder)->full_name;
@@ -565,12 +591,16 @@ camel_exchange_journal_transfer (CamelExchangeJournal *exchange_journal, CamelEx
if (transferred_uid)
*transferred_uid = g_strdup (uid);
+
+ return TRUE;
}
void
camel_exchange_journal_delete (CamelExchangeJournal *exchange_journal,
- const gchar *uid, guint32 flags, guint32 set,
- GError **error)
+ const gchar *uid,
+ guint32 flags,
+ guint32 set,
+ GError **error)
{
CamelOfflineJournal *journal = (CamelOfflineJournal *) exchange_journal;
CamelExchangeFolder *exchange_folder = (CamelExchangeFolder *) journal->folder;
diff --git a/camel/camel-exchange-journal.h b/camel/camel-exchange-journal.h
index 4ae7e2f..9cee0cb 100644
--- a/camel/camel-exchange-journal.h
+++ b/camel/camel-exchange-journal.h
@@ -18,8 +18,8 @@
*
*/
-#ifndef __CAMEL_EXCHANGE_JOURNAL_H__
-#define __CAMEL_EXCHANGE_JOURNAL_H__
+#ifndef CAMEL_EXCHANGE_JOURNAL_H
+#define CAMEL_EXCHANGE_JOURNAL_H
#include <stdarg.h>
@@ -28,21 +28,31 @@
#include <camel/camel.h>
#include "camel-exchange-folder.h"
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define CAMEL_TYPE_EXCHANGE_JOURNAL \
+ (camel_exchange_journal_get_type ())
+#define CAMEL_EXCHANGE_JOURNAL(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_EXCHANGE_JOURNAL, CamelExchangeJournal))
+#define CAMEL_EXCHANGE_JOURNAL_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_EXCHANGE_JOURNAL, CamelExchangeJournalClass))
+#define CAMEL_IS_EXCHANGE_JOURNAL(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_EXCHANGE_JOURNAL))
+#define CAMEL_IS_EXCHANGE_JOURNAL_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_EXCHANGE_JOURNAL))
+#define CAMEL_EXCHANGE_JOURNAL_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_EXCHANGE_JOURNAL, CamelExchangeJournalClass))
-#define CAMEL_TYPE_EXCHANGE_JOURNAL (camel_exchange_journal_get_type ())
-#define CAMEL_EXCHANGE_JOURNAL(obj) (CAMEL_CHECK_CAST ((obj), CAMEL_TYPE_EXCHANGE_JOURNAL, CamelExchangeJournal))
-#define CAMEL_EXCHANGE_JOURNAL_CLASS(klass) (CAMEL_CHECK_CLASS_CAST ((klass), CAMEL_TYPE_EXCHANGE_JOURNAL, CamelExchangeJournalClass))
-#define CAMEL_IS_EXCHANGE_JOURNAL(obj) (CAMEL_CHECK_TYPE ((obj), CAMEL_TYPE_EXCHANGE_JOURNAL))
-#define CAMEL_IS_EXCHANGE_JOURNAL_CLASS(klass) (CAMEL_CHECK_CLASS_TYPE ((klass), CAMEL_TYPE_EXCHANGE_JOURNAL))
-#define CAMEL_EXCHANGE_JOURNAL_GET_CLASS(obj) (CAMEL_CHECK_GET_CLASS ((obj), CAMEL_TYPE_EXCHANGE_JOURNAL, CamelExchangeJournalClass))
+G_BEGIN_DECLS
typedef struct _CamelExchangeJournal CamelExchangeJournal;
typedef struct _CamelExchangeJournalClass CamelExchangeJournalClass;
typedef struct _CamelExchangeJournalEntry CamelExchangeJournalEntry;
-//struct CamelExchangeFolder;
-
enum {
CAMEL_EXCHANGE_JOURNAL_ENTRY_APPEND,
CAMEL_EXCHANGE_JOURNAL_ENTRY_TRANSFER,
@@ -63,31 +73,36 @@ struct _CamelExchangeJournalEntry {
};
struct _CamelExchangeJournal {
- CamelOfflineJournal parent_object;
-
+ CamelOfflineJournal parent;
};
struct _CamelExchangeJournalClass {
CamelOfflineJournalClass parent_class;
-
};
-CamelType camel_exchange_journal_get_type (void);
-
-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, GError **error);
-
-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, GError **error);
-
-void camel_exchange_journal_delete (CamelExchangeJournal *journal, const gchar *uid,
- guint32 flags, guint32 set, GError **error);
+GType camel_exchange_journal_get_type (void);
+CamelOfflineJournal *
+ camel_exchange_journal_new (CamelExchangeFolder *folder,
+ const gchar *filename);
+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);
+void camel_exchange_journal_delete (CamelExchangeJournal *journal,
+ const gchar *uid,
+ guint32 flags,
+ guint32 set,
+ GError **error);
G_END_DECLS
-#endif /* __CAMEL_EXCHANGE_JOURNAL_H__ */
+#endif /* CAMEL_EXCHANGE_JOURNAL_H */
diff --git a/camel/camel-exchange-provider.c b/camel/camel-exchange-provider.c
index 4bd060c..3c80830 100644
--- a/camel/camel-exchange-provider.c
+++ b/camel/camel-exchange-provider.c
@@ -168,8 +168,8 @@ camel_provider_module_init (void)
{
gint i;
- exchange_provider.object_types[CAMEL_PROVIDER_STORE] = camel_exchange_store_get_type ();
- exchange_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = camel_exchange_transport_get_type ();
+ exchange_provider.object_types[CAMEL_PROVIDER_STORE] = CAMEL_TYPE_EXCHANGE_STORE;
+ exchange_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = CAMEL_TYPE_EXCHANGE_TRANSPORT;
exchange_provider.authtypes = g_list_prepend (g_list_prepend (NULL, &camel_exchange_password_authtype), &camel_exchange_ntlm_authtype);
exchange_provider.url_hash = exchange_url_hash;
exchange_provider.url_equal = exchange_url_equal;
diff --git a/camel/camel-exchange-search.c b/camel/camel-exchange-search.c
index fdd241e..fb3e2ee 100644
--- a/camel/camel-exchange-search.c
+++ b/camel/camel-exchange-search.c
@@ -31,45 +31,13 @@
#include "camel-exchange-folder.h"
#include "camel-exchange-utils.h"
-static ESExpResult *
-exchange_body_contains (struct _ESExp *f, gint argc, struct _ESExpResult **argv,
- CamelFolderSearch *s);
-
-static CamelFolderSearchClass *parent_class = NULL;
-
-static void
-camel_exchange_search_class_init (CamelExchangeSearchClass *camel_exchange_search_class)
-{
- /* virtual method overload */
- CamelFolderSearchClass *camel_folder_search_class =
- CAMEL_FOLDER_SEARCH_CLASS (camel_exchange_search_class);
-
- parent_class = (CamelFolderSearchClass *) camel_folder_search_get_type ();
-
- /* virtual method overload */
- camel_folder_search_class->body_contains = exchange_body_contains;
-}
-
-CamelType
-camel_exchange_search_get_type (void)
-{
- static CamelType camel_exchange_search_type = CAMEL_INVALID_TYPE;
-
- if (camel_exchange_search_type == CAMEL_INVALID_TYPE) {
- camel_exchange_search_type = camel_type_register (
- CAMEL_FOLDER_SEARCH_TYPE, "CamelExchangeSearch",
- sizeof (CamelExchangeSearch),
- sizeof (CamelExchangeSearchClass),
- (CamelObjectClassInitFunc) camel_exchange_search_class_init,
- NULL, NULL, NULL);
- }
-
- return camel_exchange_search_type;
-}
+static gpointer parent_class;
static ESExpResult *
-exchange_body_contains (struct _ESExp *f, gint argc, struct _ESExpResult **argv,
- CamelFolderSearch *s)
+exchange_search_body_contains (struct _ESExp *f,
+ gint argc,
+ struct _ESExpResult **argv,
+ CamelFolderSearch *s)
{
gchar *value = argv[0]->value.string, *real_uid;
const gchar *uid;
@@ -80,7 +48,7 @@ exchange_body_contains (struct _ESExp *f, gint argc, struct _ESExpResult **argv,
gint i;
if (((CamelOfflineStore *) s->folder->parent_store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
- return parent_class->body_contains (f, argc, argv, s);
+ return CAMEL_FOLDER_SEARCH_CLASS (parent_class)->body_contains (f, argc, argv, s);
if (s->current) {
r = e_sexp_result_new (f, ESEXP_RES_BOOL);
@@ -150,6 +118,35 @@ exchange_body_contains (struct _ESExp *f, gint argc, struct _ESExpResult **argv,
return r;
}
+static void
+exchange_search_class_init (CamelExchangeSearchClass *class)
+{
+ CamelFolderSearchClass *folder_search_class;
+
+ parent_class = g_type_class_peek_parent (class);
+
+ folder_search_class = CAMEL_FOLDER_SEARCH_CLASS (class);
+ folder_search_class->body_contains = exchange_search_body_contains;
+}
+
+GType
+camel_exchange_search_get_type (void)
+{
+ static GType type = G_TYPE_INVALID;
+
+ if (G_UNLIKELY (type == G_TYPE_INVALID))
+ type = g_type_register_static_simple (
+ CAMEL_TYPE_FOLDER_SEARCH,
+ "CamelExchangeSearch",
+ sizeof (CamelExchangeSearchClass),
+ (GClassInitFunc) exchange_search_class_init,
+ sizeof (CamelExchangeSearch),
+ (GInstanceInitFunc) NULL,
+ 0);
+
+ return type;
+}
+
/**
* camel_exchange_search_new:
*
@@ -160,8 +157,10 @@ exchange_body_contains (struct _ESExp *f, gint argc, struct _ESExpResult **argv,
CamelFolderSearch *
camel_exchange_search_new (void)
{
- CamelFolderSearch *new = CAMEL_FOLDER_SEARCH (camel_object_new (camel_exchange_search_get_type ()));
+ CamelFolderSearch *new;
+ new = g_object_new (CAMEL_TYPE_EXCHANGE_SEARCH, NULL);
camel_folder_search_construct (new);
+
return new;
}
diff --git a/camel/camel-exchange-search.h b/camel/camel-exchange-search.h
index a0e43c5..e5bc27b 100644
--- a/camel/camel-exchange-search.h
+++ b/camel/camel-exchange-search.h
@@ -8,25 +8,42 @@
#include <camel/camel.h>
-#define CAMEL_EXCHANGE_SEARCH_TYPE (camel_exchange_search_get_type ())
-#define CAMEL_EXCHANGE_SEARCH(obj) CAMEL_CHECK_CAST (obj, camel_exchange_search_get_type (), CamelExchangeSearch)
-#define CAMEL_EXCHANGE_SEARCH_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_exchange_search_get_type (), CamelExchangeSearchClass)
-#define CAMEL_IS_EXCHANGE_SEARCH(obj) CAMEL_CHECK_TYPE (obj, camel_exchange_search_get_type ())
+/* Standard GObject macros */
+#define CAMEL_TYPE_EXCHANGE_SEARCH \
+ (camel_exchange_search_get_type ())
+#define CAMEL_EXCHANGE_SEARCH(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_EXCHANGE_SEARCH, CamelExchangeSearch))
+#define CAMEL_EXCHANGE_SEARCH_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_EXCHANGE_SEARCH, CamelExchangeSearchClass))
+#define CAMEL_IS_EXCHANGE_SEARCH(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_EXCHANGE_SEARCH))
+#define CAMEL_IS_EXCHANGE_SEARCH_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_EXCHANGE_SEARCH))
+#define CAMEL_EXCHANGE_SEARCH_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_EXCHANGE_SEARCH, CamelExchangeSearchClass))
+
+G_BEGIN_DECLS
-typedef struct _CamelExchangeSearchClass CamelExchangeSearchClass;
typedef struct _CamelExchangeSearch CamelExchangeSearch;
+typedef struct _CamelExchangeSearchClass CamelExchangeSearchClass;
struct _CamelExchangeSearch {
CamelFolderSearch parent;
-
};
struct _CamelExchangeSearchClass {
CamelFolderSearchClass parent_class;
-
};
-CamelType camel_exchange_search_get_type (void);
-CamelFolderSearch *camel_exchange_search_new (void);
+GType camel_exchange_search_get_type (void);
+CamelFolderSearch *
+ camel_exchange_search_new (void);
+
+G_END_DECLS
-#endif /* ! _CAMEL_EXCHANGE_SEARCH_H */
+#endif /* CAMEL_EXCHANGE_SEARCH_H */
diff --git a/camel/camel-exchange-store.c b/camel/camel-exchange-store.c
index 78a2246..71d537d 100644
--- a/camel/camel-exchange-store.c
+++ b/camel/camel-exchange-store.c
@@ -35,163 +35,103 @@
#include "camel-exchange-summary.h"
#include "camel-exchange-utils.h"
+#define EXCHANGE_STOREINFO_VERSION 1
+
+/* Even if we are disconnected, we need to exchange_connect
+ to get the offline data */
+#define RETURN_VAL_IF_NOT_CONNECTED(store, error, val)\
+ if (!camel_exchange_store_connected(store, error) && \
+ !exchange_store_connect (CAMEL_SERVICE (store), error)) \
+ return val;
+
#define SUBFOLDER_DIR_NAME "subfolders"
#define SUBFOLDER_DIR_NAME_LEN 10
#define d(x)
-//static CamelStoreClass *parent_class = NULL;
-static CamelOfflineStoreClass *parent_class = NULL;
-
-#define CS_CLASS(so) ((CamelStoreClass *)((CamelObject *)(so))->klass)
-
-static void construct (CamelService *service, CamelSession *session,
- CamelProvider *provider, CamelURL *url,
- GError **error);
-
-static GList *query_auth_types (CamelService *service, GError **error);
-static gchar *get_name (CamelService *service, gboolean brief);
-static CamelFolder *get_trash (CamelStore *store,
- GError **error);
-
-gchar * exchange_path_to_physical (const gchar *prefix, const gchar *vpath);
-static gboolean exchange_connect (CamelService *service, GError **error);
-static gboolean exchange_disconnect (CamelService *service, gboolean clean, GError **error);
-
-static CamelFolder *exchange_get_folder (CamelStore *store, const gchar *folder_name,
- guint32 flags, GError **error);
-
-static CamelFolderInfo *exchange_get_folder_info (CamelStore *store, const gchar *top,
- guint32 flags, GError **error);
-
-static CamelFolderInfo *exchange_create_folder (CamelStore *store,
- const gchar *parent_name,
- const gchar *folder_name,
- GError **error);
-static void exchange_delete_folder (CamelStore *store,
- const gchar *folder_name,
- GError **error);
-static void exchange_rename_folder (CamelStore *store,
- const gchar *old_name,
- const gchar *new_name,
- GError **error);
-static gboolean exchange_folder_subscribed (CamelStore *store,
- const gchar *folder_name);
-static void exchange_subscribe_folder (CamelStore *store,
- const gchar *folder_name,
- GError **error);
-static void exchange_unsubscribe_folder (CamelStore *store,
- const gchar *folder_name,
- GError **error);
-static gboolean exchange_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error);
+extern CamelServiceAuthType camel_exchange_password_authtype;
+extern CamelServiceAuthType camel_exchange_ntlm_authtype;
-static void
-class_init (CamelExchangeStoreClass *camel_exchange_store_class)
-{
- CamelServiceClass *camel_service_class =
- CAMEL_SERVICE_CLASS (camel_exchange_store_class);
- CamelStoreClass *camel_store_class =
- CAMEL_STORE_CLASS (camel_exchange_store_class);
-
- parent_class = CAMEL_OFFLINE_STORE_CLASS (camel_type_get_global_classfuncs (camel_offline_store_get_type ()));
-
- /* virtual method overload */
- camel_service_class->construct = construct;
- camel_service_class->query_auth_types = query_auth_types;
- camel_service_class->get_name = get_name;
- camel_service_class->connect = exchange_connect;
- camel_service_class->disconnect = exchange_disconnect;
-
- camel_store_class->get_trash = get_trash;
- camel_store_class->free_folder_info = camel_store_free_folder_info_full;
- camel_store_class->get_folder = exchange_get_folder;
- camel_store_class->get_folder_info = exchange_get_folder_info;
- camel_store_class->create_folder = exchange_create_folder;
- camel_store_class->delete_folder = exchange_delete_folder;
- camel_store_class->rename_folder = exchange_rename_folder;
-
- camel_store_class->folder_subscribed = exchange_folder_subscribed;
- camel_store_class->subscribe_folder = exchange_subscribe_folder;
- camel_store_class->unsubscribe_folder = exchange_unsubscribe_folder;
- camel_store_class->can_refresh_folder = exchange_can_refresh_folder;
-}
+static gpointer parent_class;
-static void
-init (CamelExchangeStore *exch, CamelExchangeStoreClass *klass)
+/* Note: steals @name and @uri */
+static CamelFolderInfo *
+exchange_store_make_folder_info (CamelExchangeStore *exch,
+ gchar *name,
+ const gchar *uri,
+ gint unread_count,
+ gint flags)
{
- CamelStore *store = CAMEL_STORE (exch);
-
- exch->folders_lock = g_mutex_new ();
- exch->folders = g_hash_table_new (g_str_hash, g_str_equal);
-
- store->flags |= CAMEL_STORE_SUBSCRIPTIONS;
- store->flags &= ~(CAMEL_STORE_VTRASH | CAMEL_STORE_VJUNK);
- /* FIXME: Like the GroupWise provider, Exchange should also
- have its own EXCAHNGE_JUNK flags so as to rightly handle
- the actual Junk & Trash folders */
+ CamelFolderInfo *info;
+ const gchar *path;
+ gchar **components;
+ gchar *new_uri;
+ gchar *temp;
- exch->connect_lock = g_mutex_new ();
-}
+ d(printf ("make folder info : %s flags : %d\n", name, flags));
+ path = strstr (uri, "://");
+ if (!path)
+ return NULL;
+ path = strstr (path + 3, "/;");
+ if (!path)
+ return NULL;
-static void
-finalize (CamelExchangeStore *exch)
-{
- g_free (exch->trash_name);
+ components = g_strsplit (uri, "/;", 2);
+ if (components[0] && components[1])
+ new_uri = g_strdup_printf ("%s/%s", components[0], components[1]);
+ else
+ new_uri = g_strdup (uri);
+ g_strfreev (components);
- if (exch->folders_lock)
- g_mutex_free (exch->folders_lock);
+ d(printf ("new_uri is : %s\n", new_uri));
+ info = camel_folder_info_new ();
+ info->name = name;
+ info->uri = new_uri;
- if (exch->connect_lock)
- g_mutex_free (exch->connect_lock);
-}
+ /* Process the full-path and decode if required */
+ temp = strrchr (path+2, '/');
+ if (temp) {
+ /* info->full_name should not have encoded path */
+ info->full_name = camel_url_decode_path (path+2);
+ } else {
+ /* If there are no sub-directories, decoded(name) will be
+ equal to that of path+2.
+ Ex: personal
+ */
+ info->full_name = g_strdup (path+2);
+ }
+ info->unread = unread_count;
-CamelType
-camel_exchange_store_get_type (void)
-{
- static CamelType camel_exchange_store_type = CAMEL_INVALID_TYPE;
+ if (flags & CAMEL_FOLDER_NOSELECT)
+ info->flags = CAMEL_FOLDER_NOSELECT;
- if (!camel_exchange_store_type) {
- camel_exchange_store_type = camel_type_register (
- camel_offline_store_get_type (),
- "CamelExchangeStore",
- sizeof (CamelExchangeStore),
- sizeof (CamelExchangeStoreClass),
- (CamelObjectClassInitFunc) class_init,
- NULL,
- (CamelObjectInitFunc) init,
- (CamelObjectFinalizeFunc) finalize);
- }
+ if (flags & CAMEL_FOLDER_SYSTEM)
+ info->flags |= CAMEL_FOLDER_SYSTEM;
- return camel_exchange_store_type;
-}
+ if ((flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX)
+ info->flags |= CAMEL_FOLDER_TYPE_INBOX;
-/* 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, GError **error)
-{
- CamelService *service;
- CamelSession *session;
+ if ((flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_TRASH)
+ info->flags |= CAMEL_FOLDER_TYPE_TRASH;
- g_return_val_if_fail (CAMEL_IS_EXCHANGE_STORE (store), FALSE);
+ if ((flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_SENT)
+ info->flags |= CAMEL_FOLDER_TYPE_SENT;
- service = CAMEL_SERVICE (store);
- session = service->session;
+ if (flags & CAMEL_FOLDER_SUBSCRIBED)
+ info->flags |= CAMEL_FOLDER_SUBSCRIBED;
- if (service->status != CAMEL_SERVICE_CONNECTED &&
- camel_session_is_online (session) &&
- !camel_service_connect (service, ex)) {
- return FALSE;
- }
+ if (flags & CAMEL_FOLDER_NOCHILDREN)
+ info->flags |= CAMEL_FOLDER_NOCHILDREN;
- return CAMEL_OFFLINE_STORE (store)->state != CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL;
+ return info;
}
/* This has been now removed from evolution/e-util. So implemented this here.
* Also note that this is similar to the call in e2k-path.c. The name of the
* function has been changed to avoid any conflicts.
*/
-gchar *
-exchange_path_to_physical (const gchar *prefix, const gchar *vpath)
+static gchar *
+exchange_store_path_to_physical (const gchar *prefix,
+ const gchar *vpath)
{
const gchar *p, *newp;
gchar *dp;
@@ -265,55 +205,55 @@ exchange_path_to_physical (const gchar *prefix, const gchar *vpath)
return ppath;
}
-static void
-construct (CamelService *service, CamelSession *session,
- CamelProvider *provider, CamelURL *url, GError **error)
+static CamelFolderInfo *
+exchange_store_postprocess_tree (CamelFolderInfo *info)
{
- CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (service);
- gchar *p;
+ CamelFolderInfo *sibling;
- CAMEL_SERVICE_CLASS (parent_class)->construct (service, session, provider, url, ex);
+ if (info->child)
+ info->child = exchange_store_postprocess_tree (info->child);
+ if (info->next)
+ info->next = exchange_store_postprocess_tree (info->next);
- exch->base_url = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
- /* Strip path */
- p = strstr (exch->base_url, "//");
- if (p) {
- p = strchr (p + 2, '/');
- if (p)
- *p = '\0';
- }
+ /* If the node still has children, keep it */
+ if (info->child)
+ return info;
- if (!(exch->storage_path = camel_session_get_storage_path (session, service, ex)))
- return;
-}
+ /* info->flags |= CAMEL_FOLDER_NOCHILDREN; */
-extern CamelServiceAuthType camel_exchange_password_authtype;
-extern CamelServiceAuthType camel_exchange_ntlm_authtype;
+ /* If it's a mail folder (not noselect), keep it */
+ if (!(info->flags & CAMEL_FOLDER_NOSELECT))
+ return info;
-static GList *
-query_auth_types (CamelService *service, GError **error)
-{
- return g_list_prepend (g_list_prepend (NULL, &camel_exchange_password_authtype),
- &camel_exchange_ntlm_authtype);
+ /* Otherwise delete it and return its sibling */
+ sibling = info->next;
+ info->next = NULL;
+ camel_folder_info_free (info);
+ return sibling;
}
-static gchar *
-get_name (CamelService *service, gboolean brief)
+static gboolean
+exchange_store_forget_password (CamelService *service,
+ GError **error)
{
- if (brief) {
- return g_strdup_printf (_("Exchange server %s"),
- service->url->host);
- } else {
- return g_strdup_printf (_("Exchange account for %s on %s"),
- service->url->user,
- service->url->host);
- }
-}
+ CamelSession *session = camel_service_get_session (service);
+ gboolean success = TRUE;
-#define EXCHANGE_STOREINFO_VERSION 1
+ if (service->url->passwd == NULL)
+ return TRUE;
-static void
-camel_exchange_get_password (CamelService *service, GError **error)
+ success = camel_session_forget_password (
+ session, service, "Exchange", "password", error);
+
+ g_free (service->url->passwd);
+ service->url->passwd = NULL;
+
+ return success;
+}
+
+static gboolean
+exchange_store_get_password (CamelService *service,
+ GError **error)
{
CamelSession *session = camel_service_get_session (service);
@@ -325,33 +265,73 @@ camel_exchange_get_password (CamelService *service, GError **error)
service->url->passwd = camel_session_get_password (
session, service, "Exchange", prompt,
- "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
+ "password", CAMEL_SESSION_PASSWORD_SECRET, error);
g_free (prompt);
}
+
+ return (service->url->passwd != NULL);
}
static void
-camel_exchange_forget_password (CamelService *service, GError **error)
+exchange_store_finalize (GObject *object)
{
- CamelSession *session = camel_service_get_session (service);
+ CamelExchangeStore *exch;
+
+ exch = CAMEL_EXCHANGE_STORE (object);
+
+ g_free (exch->trash_name);
+
+ if (exch->folders_lock)
+ g_mutex_free (exch->folders_lock);
+
+ if (exch->connect_lock)
+ g_mutex_free (exch->connect_lock);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gboolean
+exchange_store_construct (CamelService *service,
+ CamelSession *session,
+ CamelProvider *provider,
+ CamelURL *url,
+ GError **error)
+{
+ CamelServiceClass *service_class;
+ CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (service);
+ gchar *p;
- if (service->url->passwd) {
- camel_session_forget_password (session,
- service, "Exchange",
- "password", ex);
- g_free (service->url->passwd);
- service->url->passwd = NULL;
+ /* Chain up to parent's construct() method. */
+ service_class = CAMEL_SERVICE_CLASS (parent_class);
+ if (!service_class->construct (service, session, provider, url, error))
+ return FALSE;
+
+ exch->base_url = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
+ /* Strip path */
+ p = strstr (exch->base_url, "//");
+ if (p) {
+ p = strchr (p + 2, '/');
+ if (p)
+ *p = '\0';
}
+
+ exch->storage_path =
+ camel_session_get_storage_path (session, service, error);
+
+ return (exch->storage_path != NULL);
}
static gboolean
-exchange_connect (CamelService *service, GError **error)
+exchange_store_connect (CamelService *service,
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (service);
gchar *password = NULL;
guint32 connect_status;
gboolean online_mode = FALSE;
+ GError *local_error = NULL;
/* This lock is only needed for offline operation. exchange_connect
is called many times in offline. */
@@ -361,8 +341,7 @@ exchange_connect (CamelService *service, GError **error)
online_mode = camel_session_is_online (service->session);
if (online_mode) {
- camel_exchange_get_password (service, ex);
- if (camel_exception_is_set (ex)) {
+ if (!exchange_store_get_password (service, error)) {
g_mutex_unlock (exch->connect_lock);
return FALSE;
}
@@ -370,19 +349,24 @@ exchange_connect (CamelService *service, GError **error)
}
/* 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 (
+ &local_error, CAMEL_ERROR,
+ CAMEL_ERROR_USER_CANCEL,
+ "Cancelled");
+ g_propagate_error (error, local_error);
g_mutex_unlock (exch->connect_lock);
return FALSE;
}
if (!connect_status) {
- camel_exchange_forget_password (service, ex);
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not authenticate to server. "
- "(Password incorrect?)\n\n"));
+ exchange_store_forget_password (service, NULL);
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Could not authenticate to server. "
+ "(Password incorrect?)"));
g_mutex_unlock (exch->connect_lock);
return FALSE;
}
@@ -393,37 +377,64 @@ exchange_connect (CamelService *service, GError **error)
}
static gboolean
-exchange_disconnect (CamelService *service, gboolean clean, GError **error)
+exchange_store_disconnect (CamelService *service,
+ gboolean clean,
+ GError **error)
{
/* CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (service); */
/* keep account connect as it can be used for other parts like cal, gal or addressbook? */
return TRUE;
}
-/* Even if we are disconnected, we need to exchange_connect
- to get the offline data */
-#define RETURN_VAL_IF_NOT_CONNECTED(store, ex, val)\
- if (!camel_exchange_store_connected(store, ex) && \
- !exchange_connect (CAMEL_SERVICE (store), ex)) \
- return val;
+static GList *
+exchange_store_query_auth_types (CamelService *service,
+ GError **error)
+{
+ GList *list = NULL;
+
+ list = g_list_prepend (list, &camel_exchange_password_authtype);
+ list = g_list_prepend (list, &camel_exchange_ntlm_authtype);
+
+ return list;
+}
+
+static gchar *
+exchange_store_get_name (CamelService *service,
+ gboolean brief)
+{
+ if (brief)
+ return g_strdup_printf (
+ _("Exchange server %s"),
+ service->url->host);
+ else
+ return g_strdup_printf (
+ _("Exchange account for %s on %s"),
+ service->url->user,
+ service->url->host);
+}
static CamelFolder *
-exchange_get_folder (CamelStore *store, const gchar *folder_name,
- guint32 flags, GError **error)
+exchange_store_get_folder (CamelStore *store,
+ const gchar *folder_name,
+ guint32 flags,
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
CamelFolder *folder;
gchar *folder_dir;
- RETURN_VAL_IF_NOT_CONNECTED (exch, ex, NULL);
+ RETURN_VAL_IF_NOT_CONNECTED (exch, error, NULL);
- folder_dir = exchange_path_to_physical (exch->storage_path, folder_name);
+ 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;
}
}
@@ -440,13 +451,14 @@ exchange_get_folder (CamelStore *store, const gchar *folder_name,
return folder;
}
- folder = (CamelFolder *)camel_object_new (CAMEL_EXCHANGE_FOLDER_TYPE);
+ folder = g_object_new (CAMEL_TYPE_EXCHANGE_FOLDER, NULL);
g_hash_table_insert (exch->folders, g_strdup (folder_name), folder);
g_mutex_unlock (exch->folders_lock);
- if (!camel_exchange_folder_construct (folder, store, folder_name,
- flags, folder_dir, ((CamelOfflineStore *) store)->state,
- ex)) {
+ if (!camel_exchange_folder_construct (
+ folder, store, folder_name, flags, folder_dir,
+ ((CamelOfflineStore *) store)->state, error)) {
+
gchar *key;
g_mutex_lock (exch->folders_lock);
if (g_hash_table_lookup_extended (exch->folders, folder_name,
@@ -470,167 +482,154 @@ exchange_get_folder (CamelStore *store, const gchar *folder_name,
return folder;
}
-static gboolean
-exchange_folder_subscribed (CamelStore *store, const gchar *folder_name)
+static CamelFolder *
+exchange_store_get_trash (CamelStore *store,
+ GError **error)
{
- gboolean is_subscribed = FALSE;
+ CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
- d(printf ("is subscribed folder : %s\n", folder_name));
- if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
- return FALSE;
- }
+ RETURN_VAL_IF_NOT_CONNECTED (exch, error, NULL);
- if (!camel_exchange_utils_is_subscribed_folder (CAMEL_SERVICE (store), folder_name, &is_subscribed, NULL)) {
- return FALSE;
+ if (!exch->trash_name) {
+ if (!camel_exchange_utils_get_trash_name (CAMEL_SERVICE (store), &exch->trash_name, error))
+ return NULL;
}
- return is_subscribed;
+ return camel_store_get_folder (store, exch->trash_name, 0, error);
}
-static void
-exchange_subscribe_folder (CamelStore *store, const gchar *folder_name,
- GError **error)
+static CamelFolderInfo *
+exchange_store_create_folder (CamelStore *store,
+ const gchar *parent_name,
+ const gchar *folder_name,
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
+ gchar *folder_uri;
+ guint32 unread_count, flags;
+ CamelFolderInfo *info;
- 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."));
- return;
+ if (!camel_exchange_store_connected (exch, NULL)) {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Cannot create folder in offline mode."));
+ return NULL;
}
- camel_exchange_utils_subscribe_folder (CAMEL_SERVICE (store), folder_name, ex);
-}
+ if (!camel_exchange_utils_create_folder (
+ CAMEL_SERVICE (store), parent_name, folder_name,
+ &folder_uri, &unread_count, &flags, error))
+ return NULL;
-static void
-exchange_unsubscribe_folder (CamelStore *store, const gchar *folder_name,
- GError **error)
-{
- CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
+ info = exchange_store_make_folder_info (
+ exch, g_strdup (folder_name),
+ folder_uri, unread_count, flags);
+ info->flags |= CAMEL_FOLDER_NOCHILDREN;
- 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."));
- return;
- }
+ g_free (folder_uri);
- camel_exchange_utils_unsubscribe_folder (CAMEL_SERVICE (store), folder_name, ex);
+ return info;
}
-static CamelFolder *
-get_trash (CamelStore *store, GError **error)
+static gboolean
+exchange_store_delete_folder (CamelStore *store,
+ const gchar *folder_name,
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
- RETURN_VAL_IF_NOT_CONNECTED (exch, ex, NULL);
-
- if (!exch->trash_name) {
- if (!camel_exchange_utils_get_trash_name (CAMEL_SERVICE (store), &exch->trash_name, ex))
- return NULL;
+ if (!camel_exchange_store_connected (exch, NULL)) {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Cannot delete folder in offline mode."));
+ return FALSE;
}
- return camel_store_get_folder (store, exch->trash_name, 0, ex);
+ return camel_exchange_utils_delete_folder (
+ CAMEL_SERVICE (store), folder_name, error);
}
-/* Note: steals @name and @uri */
-static CamelFolderInfo *
-make_folder_info (CamelExchangeStore *exch, gchar *name, const gchar *uri,
- gint unread_count, gint flags)
+static gboolean
+exchange_store_rename_folder (CamelStore *store,
+ const gchar *old_name,
+ const gchar *new_name,
+ GError **error)
{
+ GPtrArray *folders = NULL, *folder_names = NULL, *folder_uris = NULL;
+ GArray *unread_counts = NULL;
+ GArray *folder_flags = NULL;
CamelFolderInfo *info;
- const gchar *path;
- gchar **components;
- gchar *new_uri;
- gchar *temp;
-
- d(printf ("make folder info : %s flags : %d\n", name, flags));
- path = strstr (uri, "://");
- if (!path)
- return NULL;
- path = strstr (path + 3, "/;");
- if (!path)
- return NULL;
-
- components = g_strsplit (uri, "/;", 2);
- if (components[0] && components[1])
- new_uri = g_strdup_printf ("%s/%s", components[0], components[1]);
- else
- new_uri = g_strdup (uri);
- g_strfreev (components);
+ gint i;
+ CamelRenameInfo reninfo;
+ CamelFolder *folder;
- d(printf ("new_uri is : %s\n", new_uri));
- info = camel_folder_info_new ();
- info->name = name;
- info->uri = new_uri;
+ CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
- /* Process the full-path and decode if required */
- temp = strrchr (path+2, '/');
- if (temp) {
- /* info->full_name should not have encoded path */
- info->full_name = camel_url_decode_path (path+2);
- } else {
- /* If there are no sub-directories, decoded(name) will be
- equal to that of path+2.
- Ex: personal
- */
- info->full_name = g_strdup (path+2);
+ if (!camel_exchange_store_connected (exch, NULL)) {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Cannot rename folder in offline mode."));
+ return FALSE;
}
- info->unread = unread_count;
-
- if (flags & CAMEL_FOLDER_NOSELECT)
- info->flags = CAMEL_FOLDER_NOSELECT;
-
- if (flags & CAMEL_FOLDER_SYSTEM)
- info->flags |= CAMEL_FOLDER_SYSTEM;
-
- if ((flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX)
- info->flags |= CAMEL_FOLDER_TYPE_INBOX;
- if ((flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_TRASH)
- info->flags |= CAMEL_FOLDER_TYPE_TRASH;
+ 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 ((flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_SENT)
- info->flags |= CAMEL_FOLDER_TYPE_SENT;
+ if (folder_names == NULL) {
+ /* This means the storage hasn't finished scanning yet.
+ * We return TRUE for now and will emit folder_created
+ * events later. */
+ return TRUE;
+ }
- if (flags & CAMEL_FOLDER_SUBSCRIBED) {
- info->flags |= CAMEL_FOLDER_SUBSCRIBED;
- d(printf ("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMmark as subscribed\n"));
+ folders = g_ptr_array_new ();
+ for (i = 0; i < folder_names->len; i++) {
+ info = exchange_store_make_folder_info (
+ exch, folder_names->pdata[i],
+ folder_uris->pdata[i],
+ g_array_index (unread_counts, int, i),
+ g_array_index (folder_flags, int, i));
+ if (info)
+ g_ptr_array_add (folders, info);
}
+ g_ptr_array_free (folder_names, TRUE);
+ g_ptr_array_foreach (folder_uris, (GFunc) g_free, NULL);
+ g_ptr_array_free (folder_uris, TRUE);
+ g_array_free (unread_counts, TRUE);
+ g_array_free (folder_flags, TRUE);
- if (flags & CAMEL_FOLDER_NOCHILDREN)
- info->flags |= CAMEL_FOLDER_NOCHILDREN;
- return info;
-}
+ info = camel_folder_info_build (folders, new_name, '/', TRUE);
-static CamelFolderInfo *
-postprocess_tree (CamelFolderInfo *info)
-{
- CamelFolderInfo *sibling;
+ if (info)
+ info = exchange_store_postprocess_tree (info);
+ g_ptr_array_free (folders, TRUE);
- if (info->child)
- info->child = postprocess_tree (info->child);
- if (info->next)
- info->next = postprocess_tree (info->next);
+ reninfo.new = info;
+ reninfo.old_base = (gchar *)old_name;
- /* If the node still has children, keep it */
- if (info->child)
- return info;
+ g_mutex_lock (exch->folders_lock);
+ folder = g_hash_table_lookup (exch->folders, reninfo.old_base);
+ if (folder) {
+ g_hash_table_remove (exch->folders, reninfo.old_base);
+ g_object_unref (CAMEL_OBJECT (folder));
+ }
+ g_mutex_unlock (exch->folders_lock);
- /* info->flags |= CAMEL_FOLDER_NOCHILDREN; */
+ camel_object_trigger_event (CAMEL_OBJECT (exch),
+ "folder_renamed", &reninfo);
+ camel_folder_info_free (reninfo.new);
- /* If it's a mail folder (not noselect), keep it */
- if (!(info->flags & CAMEL_FOLDER_NOSELECT))
- return info;
+ return TRUE;
- /* Otherwise delete it and return its sibling */
- sibling = info->next;
- info->next = NULL;
- camel_folder_info_free (info);
- return sibling;
}
static CamelFolderInfo *
-exchange_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, GError **error)
+exchange_store_get_folder_info (CamelStore *store,
+ const gchar *top,
+ guint32 flags,
+ GError **error)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
GPtrArray *folders, *folder_names = NULL, *folder_uris = NULL;
@@ -647,10 +646,9 @@ exchange_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, GE
#endif
/* If the backend crashed, don't keep returning an error
- * each time auto-send/recv runs.
- */
+ * 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;
@@ -659,23 +657,25 @@ exchange_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, GE
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
- * events later.
- */
+ * events later. */
return NULL;
}
folders = g_ptr_array_new ();
for (i = 0; i < folder_names->len; i++) {
- info = make_folder_info (exch, folder_names->pdata[i],
- folder_uris->pdata[i],
- g_array_index (unread_counts, gint, i),
- g_array_index (folder_flags, gint, i));
+ info = exchange_store_make_folder_info (
+ exch, folder_names->pdata[i],
+ folder_uris->pdata[i],
+ g_array_index (unread_counts, gint, i),
+ g_array_index (folder_flags, gint, i));
if (info)
g_ptr_array_add (folders, info);
}
@@ -688,167 +688,219 @@ exchange_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, GE
info = camel_folder_info_build (folders, top, '/', TRUE);
if (info)
- info = postprocess_tree (info);
+ info = exchange_store_postprocess_tree (info);
g_ptr_array_free (folders, TRUE);
return info;
}
-static CamelFolderInfo *
-exchange_create_folder (CamelStore *store, const gchar *parent_name,
- const gchar *folder_name, GError **error)
+static gboolean
+exchange_store_folder_subscribed (CamelStore *store,
+ const gchar *folder_name)
{
- CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
- gchar *folder_uri;
- guint32 unread_count, flags;
- CamelFolderInfo *info;
+ gboolean is_subscribed = FALSE;
- if (!camel_exchange_store_connected (exch, ex)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot create folder in offline mode."));
- return NULL;
+ d(printf ("is subscribed folder : %s\n", folder_name));
+ if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
+ return FALSE;
}
- if (!camel_exchange_utils_create_folder (CAMEL_SERVICE (store), parent_name, folder_name, &folder_uri, &unread_count, &flags, ex))
- return NULL;
+ if (!camel_exchange_utils_is_subscribed_folder (CAMEL_SERVICE (store), folder_name, &is_subscribed, NULL)) {
+ return FALSE;
+ }
- info = make_folder_info (exch, g_strdup (folder_name),
- folder_uri, unread_count, flags);
- info->flags |= CAMEL_FOLDER_NOCHILDREN;
+ return is_subscribed;
+}
- g_free (folder_uri);
+static gboolean
+exchange_store_subscribe_folder (CamelStore *store,
+ const gchar *folder_name,
+ GError **error)
+{
+ CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
- return info;
+ d(printf ("subscribe folder : %s\n", folder_name));
+ if (!camel_exchange_store_connected (exch, NULL)) {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Cannot subscribe folder in offline mode."));
+ return FALSE;
+ }
+
+ return camel_exchange_utils_subscribe_folder (
+ CAMEL_SERVICE (store), folder_name, error);
}
-static void
-exchange_delete_folder (CamelStore *store, const gchar *folder_name,
- GError **error)
+static gboolean
+exchange_store_unsubscribe_folder (CamelStore *store,
+ const gchar *folder_name,
+ 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."));
- return;
+ d(printf ("unsubscribe folder : %s\n", folder_name));
+ if (!camel_exchange_store_connected (exch, NULL)) {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Cannot unsubscribe folder in offline mode."));
+ return FALSE;
}
- camel_exchange_utils_delete_folder (CAMEL_SERVICE (store), folder_name, ex);
+ return camel_exchange_utils_unsubscribe_folder (
+ CAMEL_SERVICE (store), folder_name, error);
}
-static void
-exchange_rename_folder (CamelStore *store, const gchar *old_name,
- const gchar *new_name, GError **error)
+static gboolean
+exchange_store_can_refresh_folder (CamelStore *store,
+ CamelFolderInfo *info,
+ GError **error)
{
- GPtrArray *folders = NULL, *folder_names = NULL, *folder_uris = NULL;
- GArray *unread_counts = NULL;
- GArray *folder_flags = NULL;
- CamelFolderInfo *info;
- gint i;
- CamelRenameInfo reninfo;
- CamelFolder *folder;
+ CamelStoreClass *store_class;
+ CamelURL *url;
- CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (store);
+ /* Chain up to parent's can_refresh_folder() method. */
+ store_class = CAMEL_STORE_CLASS (parent_class);
+ if (store_class->can_refresh_folder (store, info, error))
+ return TRUE;
- if (!camel_exchange_store_connected (exch, ex)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot rename folder in offline mode."));
- return;
- }
- if (!camel_exchange_utils_rename_folder (CAMEL_SERVICE (store), old_name, new_name, &folder_names, &folder_uris, &unread_counts, &folder_flags, ex)) {
- return;
- }
+ url = CAMEL_SERVICE (store)->url;
- if (!folder_names) {
- /* This means the storage hasn't finished scanning yet.
- * We return NULL for now and will emit folder_created
- * events later.
- */
- return;
- }
+ return (camel_url_get_param (url, "check_all") != NULL);
+}
- folders = g_ptr_array_new ();
- for (i = 0; i < folder_names->len; i++) {
- info = make_folder_info (exch, folder_names->pdata[i],
- folder_uris->pdata[i],
- g_array_index (unread_counts, int, i),
- g_array_index (folder_flags, int, i));
- if (info)
- g_ptr_array_add (folders, info);
- }
- g_ptr_array_free (folder_names, TRUE);
- g_ptr_array_foreach (folder_uris, (GFunc) g_free, NULL);
- g_ptr_array_free (folder_uris, TRUE);
- g_array_free (unread_counts, TRUE);
- g_array_free (folder_flags, TRUE);
+static void
+exchange_store_class_init (CamelExchangeStoreClass *class)
+{
+ GObjectClass *object_class;
+ CamelServiceClass *service_class;
+ CamelStoreClass *store_class;
+
+ parent_class = g_type_class_peek_parent (class);
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = exchange_store_finalize;
+
+ service_class = CAMEL_SERVICE_CLASS (class);
+ service_class->construct = exchange_store_construct;
+ service_class->connect = exchange_store_connect;
+ service_class->disconnect = exchange_store_disconnect;
+ service_class->query_auth_types = exchange_store_query_auth_types;
+ service_class->get_name = exchange_store_get_name;
+
+ store_class = CAMEL_STORE_CLASS (class);
+ store_class->get_folder = exchange_store_get_folder;
+ store_class->get_trash = exchange_store_get_trash;
+ store_class->create_folder = exchange_store_create_folder;
+ store_class->delete_folder = exchange_store_delete_folder;
+ store_class->rename_folder = exchange_store_rename_folder;
+ store_class->get_folder_info = exchange_store_get_folder_info;
+ store_class->free_folder_info = camel_store_free_folder_info_full;
+ store_class->folder_subscribed = exchange_store_folder_subscribed;
+ store_class->subscribe_folder = exchange_store_subscribe_folder;
+ store_class->unsubscribe_folder = exchange_store_unsubscribe_folder;
+ store_class->can_refresh_folder = exchange_store_can_refresh_folder;
+}
- info = camel_folder_info_build (folders, new_name, '/', TRUE);
+static void
+exchange_store_init (CamelExchangeStore *exch)
+{
+ CamelStore *store = CAMEL_STORE (exch);
- if (info)
- info = postprocess_tree (info);
- g_ptr_array_free (folders, TRUE);
+ exch->folders_lock = g_mutex_new ();
+ exch->folders = g_hash_table_new (g_str_hash, g_str_equal);
- reninfo.new = info;
- reninfo.old_base = (gchar *)old_name;
+ store->flags |= CAMEL_STORE_SUBSCRIPTIONS;
+ store->flags &= ~(CAMEL_STORE_VTRASH | CAMEL_STORE_VJUNK);
+ /* FIXME: Like the GroupWise provider, Exchange should also
+ have its own EXCAHNGE_JUNK flags so as to rightly handle
+ the actual Junk & Trash folders */
- g_mutex_lock (exch->folders_lock);
- folder = g_hash_table_lookup (exch->folders, reninfo.old_base);
- if (folder) {
- g_hash_table_remove (exch->folders, reninfo.old_base);
- g_object_unref (CAMEL_OBJECT (folder));
- }
- g_mutex_unlock (exch->folders_lock);
+ exch->connect_lock = g_mutex_new ();
+}
- camel_object_trigger_event (CAMEL_OBJECT (exch),
- "folder_renamed", &reninfo);
- camel_folder_info_free (reninfo.new);
+GType
+camel_exchange_store_get_type (void)
+{
+ static GType type = G_TYPE_INVALID;
+ if (G_UNLIKELY (type == G_TYPE_INVALID))
+ type = g_type_register_static_simple (
+ CAMEL_TYPE_OFFLINE_STORE,
+ "CamelExchangeStore",
+ sizeof (CamelExchangeStoreClass),
+ (GClassInitFunc) exchange_store_class_init,
+ sizeof (CamelExchangeStore),
+ (GInstanceInitFunc) exchange_store_init,
+ 0);
+
+ return type;
}
-static gboolean
-exchange_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error)
+/* 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,
+ GError **error)
{
- gboolean res;
+ CamelService *service;
+ CamelSession *session;
+
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_STORE (store), FALSE);
+
+ service = CAMEL_SERVICE (store);
+ session = service->session;
- res = CAMEL_STORE_CLASS(parent_class)->can_refresh_folder (store, info, ex) ||
- (camel_url_get_param (((CamelService *)store)->url, "check_all") != NULL);
+ if (service->status != CAMEL_SERVICE_CONNECTED &&
+ camel_session_is_online (session) &&
+ !camel_service_connect (service, error)) {
+ return FALSE;
+ }
- return res;
+ return CAMEL_OFFLINE_STORE (store)->state != CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL;
}
void
-camel_exchange_store_folder_created (CamelExchangeStore *estore, const gchar *name, const gchar *uri)
+camel_exchange_store_folder_created (CamelExchangeStore *store,
+ const gchar *name,
+ const gchar *uri)
{
CamelFolderInfo *info;
- g_return_if_fail (estore != NULL);
- g_return_if_fail (CAMEL_IS_EXCHANGE_STORE (estore));
+ g_return_if_fail (CAMEL_IS_EXCHANGE_STORE (store));
- info = make_folder_info (estore, g_strdup (name), uri, -1, 0);
+ info = exchange_store_make_folder_info (
+ store, g_strdup (name), uri, -1, 0);
info->flags |= CAMEL_FOLDER_NOCHILDREN;
- camel_object_trigger_event (CAMEL_OBJECT (estore), "folder_subscribed", info);
+ camel_object_trigger_event (
+ CAMEL_OBJECT (store), "folder_subscribed", info);
camel_folder_info_free (info);
}
void
-camel_exchange_store_folder_deleted (CamelExchangeStore *estore, const gchar *name, const gchar *uri)
+camel_exchange_store_folder_deleted (CamelExchangeStore *store,
+ const gchar *name,
+ const gchar *uri)
{
CamelFolderInfo *info;
CamelFolder *folder;
- g_return_if_fail (estore != NULL);
- g_return_if_fail (CAMEL_IS_EXCHANGE_STORE (estore));
+ g_return_if_fail (CAMEL_IS_EXCHANGE_STORE (store));
- info = make_folder_info (estore, g_strdup (name), uri, -1, 0);
+ info = exchange_store_make_folder_info (
+ store, g_strdup (name), uri, -1, 0);
- g_mutex_lock (estore->folders_lock);
- folder = g_hash_table_lookup (estore->folders, info->full_name);
+ g_mutex_lock (store->folders_lock);
+ folder = g_hash_table_lookup (store->folders, info->full_name);
if (folder) {
- g_hash_table_remove (estore->folders, info->full_name);
+ g_hash_table_remove (store->folders, info->full_name);
g_object_unref (CAMEL_OBJECT (folder));
}
- g_mutex_unlock (estore->folders_lock);
+ g_mutex_unlock (store->folders_lock);
- camel_object_trigger_event (CAMEL_OBJECT (estore), "folder_unsubscribed", info);
+ camel_object_trigger_event (
+ CAMEL_OBJECT (store), "folder_unsubscribed", info);
camel_folder_info_free (info);
}
diff --git a/camel/camel-exchange-store.h b/camel/camel-exchange-store.h
index 707c839..bcfda3a 100644
--- a/camel/camel-exchange-store.h
+++ b/camel/camel-exchange-store.h
@@ -4,19 +4,36 @@
/* camel-exchange-store.h: class for a exchange store */
#ifndef CAMEL_EXCHANGE_STORE_H
-#define CAMEL_EXCHANGE_STORE_H 1
-
-G_BEGIN_DECLS
+#define CAMEL_EXCHANGE_STORE_H
#include <camel/camel.h>
-#define CAMEL_EXCHANGE_STORE_TYPE (camel_exchange_store_get_type ())
-#define CAMEL_EXCHANGE_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_EXCHANGE_STORE_TYPE, CamelExchangeStore))
-#define CAMEL_EXCHANGE_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_EXCHANGE_STORE_TYPE, CamelExchangeStoreClass))
-#define CAMEL_IS_EXCHANGE_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_EXCHANGE_STORE_TYPE))
+/* Standard GObject macros */
+#define CAMEL_TYPE_EXCHANGE_STORE \
+ (camel_exchange_store_get_type ())
+#define CAMEL_EXCHANGE_STORE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_EXCHANGE_STORE, CamelExchangeStore))
+#define CAMEL_EXCHANGE_STORE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_EXCHANGE_STORE, CamelExchangeStoreClass))
+#define CAMEL_IS_EXCHANGE_STORE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_EXCHANGE_STORE))
+#define CAMEL_IS_EXCHANGE_STORE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_EXCHANGE_STORE))
+#define CAMEL_EXCHANGE_STORE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_EXCHANGE_STORE, CamelExchangeStoreClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelExchangeStore CamelExchangeStore;
+typedef struct _CamelExchangeStoreClass CamelExchangeStoreClass;
-typedef struct {
- CamelOfflineStore parent_object;
+struct _CamelExchangeStore {
+ CamelOfflineStore parent;
gchar *storage_path, *base_url;
gchar *trash_name;
@@ -24,21 +41,23 @@ typedef struct {
GMutex *folders_lock;
GMutex *connect_lock;
+};
-} CamelExchangeStore;
-
-typedef struct {
+struct _CamelExchangeStoreClass {
CamelOfflineStoreClass parent_class;
-
-} CamelExchangeStoreClass;
-
-/* Standard Camel function */
-CamelType camel_exchange_store_get_type (void);
-
-gboolean camel_exchange_store_connected (CamelExchangeStore *store, GError **error);
-
-void camel_exchange_store_folder_created (CamelExchangeStore *estore, const gchar *name, const gchar *uri);
-void camel_exchange_store_folder_deleted (CamelExchangeStore *estore, const gchar *name, const gchar *uri);
+};
+
+GType camel_exchange_store_get_type (void);
+gboolean camel_exchange_store_connected (CamelExchangeStore *store,
+ GError **error);
+void camel_exchange_store_folder_created
+ (CamelExchangeStore *store,
+ const gchar *name,
+ const gchar *uri);
+void camel_exchange_store_folder_deleted
+ (CamelExchangeStore *store,
+ const gchar *name,
+ const gchar *uri);
G_END_DECLS
diff --git a/camel/camel-exchange-summary.c b/camel/camel-exchange-summary.c
index 9db2bea..d735f6d 100644
--- a/camel/camel-exchange-summary.c
+++ b/camel/camel-exchange-summary.c
@@ -43,140 +43,41 @@
#define d(x)
-static gint header_load (CamelFolderSummary *summary, FILE *in);
-static gint header_save (CamelFolderSummary *summary, FILE *out);
+static gpointer parent_class;
-static CamelMessageInfo *message_info_load (CamelFolderSummary *summary,
- FILE *in);
-static gint message_info_save (CamelFolderSummary *summary,
- FILE *out,
- CamelMessageInfo *info);
-static gint summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir);
-static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, GError **error);
-static CamelMIRecord * message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info);
-static CamelMessageInfo * message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir);
-static CamelMessageInfo *message_info_new_from_header (CamelFolderSummary *summary,
- struct _camel_header_raw *h);
-
-static void message_info_free (CamelFolderSummary *summary, CamelMessageInfo *info);
-
-static gboolean check_for_trash (CamelFolder *folder);
-static gboolean expunge_mail (CamelFolder *folder, CamelMessageInfo *info);
-
-static gboolean info_set_flags(CamelMessageInfo *info, guint32 flags, guint32 set);
-static gboolean info_set_user_tag(CamelMessageInfo *info, const gchar *name, const gchar *value);
-
-static CamelFolderSummaryClass *parent_class = NULL;
-
-static void
-exchange_summary_class_init (CamelObjectClass *klass)
-{
- CamelFolderSummaryClass *camel_folder_summary_class =
- (CamelFolderSummaryClass *) klass;
-
- parent_class = CAMEL_FOLDER_SUMMARY_CLASS (camel_type_get_global_classfuncs (camel_folder_summary_get_type()));
-
- camel_folder_summary_class->summary_header_load = header_load;
- camel_folder_summary_class->summary_header_save = header_save;
- camel_folder_summary_class->message_info_load = message_info_load;
- camel_folder_summary_class->message_info_save = message_info_save;
- camel_folder_summary_class->message_info_new_from_header = message_info_new_from_header;
- camel_folder_summary_class->message_info_free = message_info_free;
-
- camel_folder_summary_class->summary_header_to_db = summary_header_to_db;
- camel_folder_summary_class->summary_header_from_db = summary_header_from_db;
- camel_folder_summary_class->message_info_to_db = message_info_to_db;
- camel_folder_summary_class->message_info_from_db = message_info_from_db;
-
- camel_folder_summary_class->info_set_flags = info_set_flags;
- camel_folder_summary_class->info_set_user_tag = info_set_user_tag;
-}
-
-static void
-exchange_summary_init (CamelObject *obj, CamelObjectClass *klass)
-{
- CamelFolderSummary *summary = (CamelFolderSummary *)obj;
-
- summary->message_info_size = sizeof (CamelExchangeMessageInfo);
- summary->content_info_size = sizeof (CamelMessageContentInfo);
-}
-
-CamelType
-camel_exchange_summary_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register(
- camel_folder_summary_get_type (),
- "CamelExchangeSummary",
- sizeof (CamelExchangeSummary),
- sizeof (CamelExchangeSummaryClass),
- exchange_summary_class_init,
- NULL,
- exchange_summary_init,
- NULL);
- }
-
- return type;
-}
-
-/**
- * camel_exchange_summary_new:
- * @filename: filename to use for the summary
- *
- * Creates a new #CamelExchangeSummary based on @filename.
- *
- * Return value: the summary object.
- **/
-CamelFolderSummary *
-camel_exchange_summary_new (struct _CamelFolder *folder, const gchar *filename)
+static gboolean
+check_for_trash (CamelFolder *folder)
{
- CamelFolderSummary *summary;
- CamelException lex;
+ CamelStore *store = (CamelStore *) folder->parent_store;
+ CamelFolder *trash;
- camel_exception_init (&lex);
- summary = (CamelFolderSummary *)camel_object_new (CAMEL_EXCHANGE_SUMMARY_TYPE);
- summary->folder = folder;
- camel_folder_summary_set_filename (summary, filename);
- if (camel_folder_summary_load_from_db (summary, &lex) == -1) {
- g_warning ("Unable to load Exchage summary for folder %s: %s\n", folder->full_name, camel_exception_get_description(&lex));
- camel_folder_summary_clear_db (summary);
- camel_folder_summary_touch (summary);
- }
+ trash = camel_store_get_trash (store, NULL);
- camel_exception_clear (&lex);
- return summary;
+ return (folder == trash);
}
-static gint
-summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir)
+static gboolean
+expunge_mail (CamelFolder *folder,
+ CamelMessageInfo *info)
{
- CamelExchangeSummary *exchange = (CamelExchangeSummary *) s;
- gchar *part;
-
- if (CAMEL_FOLDER_SUMMARY_CLASS (parent_class)->summary_header_from_db (s, mir) == -1)
- return -1;
-
- part = mir->bdata;
+ GPtrArray *uids = g_ptr_array_new ();
+ gchar *uid = g_strdup (info->uid);
+ gboolean success;
- if (part) {
- EXTRACT_FIRST_DIGIT (exchange->version)
- }
+ g_ptr_array_add (uids, uid);
- if (part) {
- EXTRACT_DIGIT (exchange->readonly)
- }
+ success = camel_exchange_utils_expunge_uids (
+ CAMEL_SERVICE (folder->parent_store),
+ folder->full_name, uids, NULL);
- if (part) {
- EXTRACT_DIGIT (exchange->high_article_num)
- }
+ g_ptr_array_free (uids, TRUE);
- return 0;
+ return success;
}
static gint
-header_load (CamelFolderSummary *summary, FILE *in)
+exchange_summary_header_load (CamelFolderSummary *summary,
+ FILE *in)
{
CamelExchangeSummary *exchange = (CamelExchangeSummary *) summary;
guint32 version, readonly, high_article_num = 0;
@@ -210,22 +111,9 @@ header_load (CamelFolderSummary *summary, FILE *in)
return 0;
}
-static CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *s, GError **error)
-{
- CamelExchangeSummary *exchange = (CamelExchangeSummary *) s;
- struct _CamelFIRecord *fir;
-
- fir = CAMEL_FOLDER_SUMMARY_CLASS(parent_class)->summary_header_to_db (s, ex);
- if (!fir)
- return NULL;
- fir->bdata = g_strdup_printf ("%u %u %u", exchange->version, exchange->readonly, exchange->high_article_num);
-
- return fir;
-}
-
static gint
-header_save (CamelFolderSummary *summary, FILE *out)
+exchange_summary_header_save (CamelFolderSummary *summary,
+ FILE *out)
{
CamelExchangeSummary *exchange = (CamelExchangeSummary *) summary;
@@ -245,26 +133,10 @@ header_save (CamelFolderSummary *summary, FILE *out)
return 0;
}
-static CamelMessageInfo *
-message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
-{
- CamelMessageInfo *info;
- CamelExchangeMessageInfo *einfo;
-
- info = CAMEL_FOLDER_SUMMARY_CLASS(parent_class)->message_info_from_db (s, mir);
- if (info) {
- gchar *part = g_strdup (mir->bdata);
- gint len;
- einfo = (CamelExchangeMessageInfo *)info;
- EXTRACT_FIRST_STRING (einfo->thread_index)
- EXTRACT_FIRST_STRING (einfo->href)
- }
-
- return info;
-}
static CamelMessageInfo *
-message_info_load (CamelFolderSummary *summary, FILE *in)
+exchange_summary_message_info_load (CamelFolderSummary *summary,
+ FILE *in)
{
CamelMessageInfo *info;
CamelExchangeMessageInfo *einfo;
@@ -300,21 +172,10 @@ error:
return NULL;
}
-static CamelMIRecord *
-message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info)
-{
- CamelExchangeMessageInfo *einfo = (CamelExchangeMessageInfo *)info;
- struct _CamelMIRecord *mir;
-
- mir = CAMEL_FOLDER_SUMMARY_CLASS(parent_class)->message_info_to_db (s, info);
- if (mir)
- mir->bdata = g_strdup_printf ("%d-%s %d-%s", einfo->thread_index ? (gint)strlen(einfo->thread_index):0 , einfo->thread_index ? einfo->thread_index : "", einfo->href ? (gint)strlen(einfo->href):0, einfo->href ? einfo->href:"");
-
- return mir;
-}
-
static gint
-message_info_save (CamelFolderSummary *summary, FILE *out, CamelMessageInfo *info)
+exchange_summary_message_info_save (CamelFolderSummary *summary,
+ FILE *out,
+ CamelMessageInfo *info)
{
CamelExchangeMessageInfo *einfo = (CamelExchangeMessageInfo *)info;
@@ -333,18 +194,20 @@ message_info_save (CamelFolderSummary *summary, FILE *out, CamelMessageInfo *inf
}
static CamelMessageInfo *
-message_info_new_from_header (CamelFolderSummary *summary, struct _camel_header_raw *h)
+exchange_summary_message_info_new_from_header (CamelFolderSummary *summary,
+ GQueue *header_queue)
{
CamelMessageInfo *info;
CamelExchangeMessageInfo *einfo;
const gchar *thread_index;
- info = CAMEL_FOLDER_SUMMARY_CLASS (parent_class)->message_info_new_from_header (summary, h);
+ info = CAMEL_FOLDER_SUMMARY_CLASS (parent_class)->message_info_new_from_header (summary, header_queue);
if (!info)
return info;
einfo = (CamelExchangeMessageInfo *)info;
- thread_index = camel_header_raw_find (&h, "Thread-Index", NULL);
+ thread_index = camel_header_raw_find (
+ header_queue, "Thread-Index", NULL);
if (thread_index)
einfo->thread_index = g_strdup (thread_index + 1);
@@ -352,7 +215,8 @@ message_info_new_from_header (CamelFolderSummary *summary, struct _camel_header_
}
static void
-message_info_free (CamelFolderSummary *summary, CamelMessageInfo *info)
+exchange_summary_message_info_free (CamelFolderSummary *summary,
+ CamelMessageInfo *info)
{
CamelExchangeMessageInfo *einfo;
@@ -367,40 +231,85 @@ message_info_free (CamelFolderSummary *summary, CamelMessageInfo *info)
CAMEL_FOLDER_SUMMARY_CLASS (parent_class)->message_info_free (summary, info);
}
-static gboolean
-check_for_trash (CamelFolder *folder)
+static CamelFIRecord *
+exchange_summary_header_to_db (CamelFolderSummary *s,
+ GError **error)
{
- CamelStore *store = (CamelStore *) folder->parent_store;
- CamelException lex;
- CamelFolder *trash;
+ CamelExchangeSummary *exchange = (CamelExchangeSummary *) s;
+ struct _CamelFIRecord *fir;
- camel_exception_init (&lex);
- trash = camel_store_get_trash (store, &lex);
+ fir = CAMEL_FOLDER_SUMMARY_CLASS(parent_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);
- if (camel_exception_is_set (&lex) || !trash)
- return FALSE;
+ return fir;
+}
+
+static gint
+exchange_summary_header_from_db (CamelFolderSummary *s,
+ CamelFIRecord *mir)
+{
+ CamelExchangeSummary *exchange = (CamelExchangeSummary *) s;
+ gchar *part;
+
+ if (CAMEL_FOLDER_SUMMARY_CLASS (parent_class)->summary_header_from_db (s, mir) == -1)
+ return -1;
- return folder == trash;
+ part = mir->bdata;
+
+ if (part) {
+ EXTRACT_FIRST_DIGIT (exchange->version)
+ }
+
+ if (part) {
+ EXTRACT_DIGIT (exchange->readonly)
+ }
+
+ if (part) {
+ EXTRACT_DIGIT (exchange->high_article_num)
+ }
+
+ return 0;
}
-static gboolean
-expunge_mail (CamelFolder *folder, CamelMessageInfo *info)
+static CamelMIRecord *
+exchange_summary_message_info_to_db (CamelFolderSummary *s,
+ CamelMessageInfo *info)
{
- GPtrArray *uids = g_ptr_array_new ();
- gchar *uid = g_strdup (info->uid);
- CamelException lex;
+ CamelExchangeMessageInfo *einfo = (CamelExchangeMessageInfo *)info;
+ struct _CamelMIRecord *mir;
- g_ptr_array_add (uids, uid);
+ mir = CAMEL_FOLDER_SUMMARY_CLASS(parent_class)->message_info_to_db (s, info);
+ if (mir)
+ mir->bdata = g_strdup_printf ("%d-%s %d-%s", einfo->thread_index ? (gint)strlen(einfo->thread_index):0 , einfo->thread_index ? einfo->thread_index : "", einfo->href ? (gint)strlen(einfo->href):0, einfo->href ? einfo->href:"");
- camel_exception_init (&lex);
- camel_exchange_utils_expunge_uids (CAMEL_SERVICE (folder->parent_store), folder->full_name, uids, &lex);
+ return mir;
+}
- g_ptr_array_free (uids, TRUE);
- return camel_exception_is_set (&lex);
+static CamelMessageInfo *
+exchange_summary_message_info_from_db (CamelFolderSummary *s,
+ CamelMIRecord *mir)
+{
+ CamelMessageInfo *info;
+ CamelExchangeMessageInfo *einfo;
+
+ info = CAMEL_FOLDER_SUMMARY_CLASS(parent_class)->message_info_from_db (s, mir);
+ if (info) {
+ gchar *part = g_strdup (mir->bdata);
+ gint len;
+ einfo = (CamelExchangeMessageInfo *)info;
+ EXTRACT_FIRST_STRING (einfo->thread_index)
+ EXTRACT_FIRST_STRING (einfo->href)
+ }
+
+ return info;
}
static gboolean
-info_set_flags(CamelMessageInfo *info, guint32 flags, guint32 set)
+exchange_summary_info_set_flags (CamelMessageInfo *info,
+ guint32 flags,
+ guint32 set)
{
CamelFolder *folder = (CamelFolder *) info->summary->folder;
CamelOfflineStore *store = (CamelOfflineStore *) folder->parent_store;
@@ -436,7 +345,9 @@ info_set_flags(CamelMessageInfo *info, guint32 flags, guint32 set)
}
static gboolean
-info_set_user_tag(CamelMessageInfo *info, const gchar *name, const gchar *value)
+exchange_summary_info_set_user_tag (CamelMessageInfo *info,
+ const gchar *name,
+ const gchar *value)
{
gint res;
@@ -452,6 +363,75 @@ info_set_user_tag(CamelMessageInfo *info, const gchar *name, const gchar *value)
return res;
}
+static void
+exchange_summary_class_init (GObjectClass *class)
+{
+ CamelFolderSummaryClass *folder_summary_class;
+
+ parent_class = g_type_class_peek_parent (class);
+
+ folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
+ folder_summary_class->message_info_size = sizeof (CamelExchangeMessageInfo);
+ folder_summary_class->content_info_size = sizeof (CamelMessageContentInfo);
+ folder_summary_class->summary_header_load = exchange_summary_header_load;
+ folder_summary_class->summary_header_save = exchange_summary_header_save;
+ folder_summary_class->message_info_load = exchange_summary_message_info_load;
+ folder_summary_class->message_info_save = exchange_summary_message_info_save;
+ folder_summary_class->message_info_new_from_header = exchange_summary_message_info_new_from_header;
+ folder_summary_class->message_info_free = exchange_summary_message_info_free;
+
+ folder_summary_class->summary_header_to_db = exchange_summary_header_to_db;
+ folder_summary_class->summary_header_from_db = exchange_summary_header_from_db;
+ folder_summary_class->message_info_to_db = exchange_summary_message_info_to_db;
+ folder_summary_class->message_info_from_db = exchange_summary_message_info_from_db;
+
+ folder_summary_class->info_set_flags = exchange_summary_info_set_flags;
+ folder_summary_class->info_set_user_tag = exchange_summary_info_set_user_tag;
+}
+
+GType
+camel_exchange_summary_get_type (void)
+{
+ static GType type = G_TYPE_INVALID;
+
+ if (G_UNLIKELY (type == G_TYPE_INVALID))
+ type = g_type_register_static_simple (
+ CAMEL_TYPE_FOLDER_SUMMARY,
+ "CamelExchangeSummary",
+ sizeof (CamelExchangeSummaryClass),
+ (GClassInitFunc) exchange_summary_class_init,
+ sizeof (CamelExchangeSummary),
+ (GInstanceInitFunc) NULL,
+ 0);
+
+ return type;
+}
+
+/**
+ * camel_exchange_summary_new:
+ * @filename: filename to use for the summary
+ *
+ * Creates a new #CamelExchangeSummary based on @filename.
+ *
+ * Return value: the summary object.
+ **/
+CamelFolderSummary *
+camel_exchange_summary_new (CamelFolder *folder,
+ const gchar *filename)
+{
+ CamelFolderSummary *summary;
+
+ 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, NULL) == -1) {
+ camel_folder_summary_clear_db (summary);
+ camel_folder_summary_touch (summary);
+ }
+
+ return summary;
+}
+
/**
* camel_exchange_summary_get_readonly:
* @summary: the summary
diff --git a/camel/camel-exchange-summary.h b/camel/camel-exchange-summary.h
index 7b088f9..7d4ab36 100644
--- a/camel/camel-exchange-summary.h
+++ b/camel/camel-exchange-summary.h
@@ -1,25 +1,42 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* Copyright (C) 2001-2004 Novell, Inc. */
-#ifndef _CAMEL_EXCHANGE_SUMMARY_H
-#define _CAMEL_EXCHANGE_SUMMARY_H
+#ifndef CAMEL_EXCHANGE_SUMMARY_H
+#define CAMEL_EXCHANGE_SUMMARY_H
#include <camel/camel.h>
-#define CAMEL_EXCHANGE_SUMMARY_TYPE (camel_exchange_summary_get_type ())
-#define CAMEL_EXCHANGE_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_exchange_summary_get_type (), CamelExchangeSummary)
-#define CAMEL_EXCHANGE_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_exchange_summary_get_type (), CamelExchangeSummaryClass)
-#define CAMEL_IS_EXCHANGE_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_exchange_summary_get_type ())
+/* Standard GObject macros */
+#define CAMEL_TYPE_EXCHANGE_SUMMARY \
+ (camel_exchange_summary_get_type ())
+#define CAMEL_EXCHANGE_SUMMARY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_EXCHANGE_SUMMARY, CamelExchangeSummary))
+#define CAMEL_EXCHANGE_SUMMARY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_EXCHANGE_SUMMARY, CamelExchangeSummaryClass))
+#define CAMEL_IS_EXCHANGE_SUMMARY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_EXCHANGE_SUMMARY))
+#define CAMEL_IS_EXCHANGE_SUMMARY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_EXCHANGE_SUMMARY))
+#define CAMEL_EXCHANGE_SUMMARY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_EXCHANGE_SUMMARY, CamelExchangeSummaryClass))
+
+G_BEGIN_DECLS
typedef struct _CamelExchangeSummary CamelExchangeSummary;
typedef struct _CamelExchangeSummaryClass CamelExchangeSummaryClass;
+typedef struct _CamelExchangeMessageInfo CamelExchangeMessageInfo;
-typedef struct _CamelExchangeMessageInfo {
+struct _CamelExchangeMessageInfo {
CamelMessageInfoBase info;
gchar *thread_index;
gchar *href;
-} CamelExchangeMessageInfo;
+};
struct _CamelExchangeSummary {
CamelFolderSummary parent;
@@ -31,27 +48,33 @@ struct _CamelExchangeSummary {
struct _CamelExchangeSummaryClass {
CamelFolderSummaryClass parent_class;
-
};
-CamelType camel_exchange_summary_get_type (void);
-CamelFolderSummary *camel_exchange_summary_new (struct _CamelFolder *folder, const gchar *filename);
-
-gboolean camel_exchange_summary_get_readonly (CamelFolderSummary *summary);
-void camel_exchange_summary_set_readonly (CamelFolderSummary *summary,
- gboolean readonly);
-
-void camel_exchange_summary_add_offline (CamelFolderSummary *summary,
- const gchar *uid,
- CamelMimeMessage *message,
- CamelMessageInfo *info);
-void camel_exchange_summary_add_offline_uncached (CamelFolderSummary *summary,
- const gchar *uid,
- CamelMessageInfo *info);
-
-guint32 camel_exchange_summary_get_article_num (CamelFolderSummary *summary);
-void camel_exchange_summary_set_article_num (CamelFolderSummary *summary,
- guint32 high_article_num);
-
-#endif /* ! _CAMEL_EXCHANGE_SUMMARY_H */
+GType camel_exchange_summary_get_type (void);
+CamelFolderSummary *
+ camel_exchange_summary_new (CamelFolder *folder,
+ const gchar *filename);
+gboolean camel_exchange_summary_get_readonly
+ (CamelFolderSummary *summary);
+void camel_exchange_summary_set_readonly
+ (CamelFolderSummary *summary,
+ gboolean readonly);
+void camel_exchange_summary_add_offline
+ (CamelFolderSummary *summary,
+ const gchar *uid,
+ CamelMimeMessage *message,
+ CamelMessageInfo *info);
+void camel_exchange_summary_add_offline_uncached
+ (CamelFolderSummary *summary,
+ const gchar *uid,
+ CamelMessageInfo *info);
+guint32 camel_exchange_summary_get_article_num
+ (CamelFolderSummary *summary);
+void camel_exchange_summary_set_article_num
+ (CamelFolderSummary *summary,
+ guint32 high_article_num);
+
+G_END_DECLS
+
+#endif /* CAMEL_EXCHANGE_SUMMARY_H */
diff --git a/camel/camel-exchange-transport.c b/camel/camel-exchange-transport.c
index 71e8309..4ec76f6 100644
--- a/camel/camel-exchange-transport.c
+++ b/camel/camel-exchange-transport.c
@@ -32,51 +32,14 @@
#include <string.h>
-static gboolean exchange_send_to (CamelTransport *transport,
- CamelMimeMessage *message,
- CamelAddress *from,
- CamelAddress *recipients,
- GError **error);
-
-static void
-camel_exchange_transport_class_init (CamelExchangeTransportClass *camel_exchange_transport_class)
-{
- CamelTransportClass *camel_transport_class =
- CAMEL_TRANSPORT_CLASS (camel_exchange_transport_class);
-
- /* virtual method overload */
- camel_transport_class->send_to = exchange_send_to;
-}
-
-static void
-camel_exchange_transport_init (CamelTransport *transport)
-{
-}
-
-CamelType
-camel_exchange_transport_get_type (void)
-{
- static CamelType camel_exchange_transport_type = CAMEL_INVALID_TYPE;
-
- if (camel_exchange_transport_type == CAMEL_INVALID_TYPE) {
- camel_exchange_transport_type =
- camel_type_register (CAMEL_TRANSPORT_TYPE,
- "CamelExchangeTransport",
- sizeof (CamelExchangeTransport),
- sizeof (CamelExchangeTransportClass),
- (CamelObjectClassInitFunc) camel_exchange_transport_class_init,
- NULL,
- (CamelObjectInitFunc) camel_exchange_transport_init,
- NULL);
- }
-
- return camel_exchange_transport_type;
-}
+static gpointer parent_class;
static gboolean
-exchange_send_to (CamelTransport *transport, CamelMimeMessage *message,
- CamelAddress *from, CamelAddress *recipients,
- GError **error)
+exchange_transport_send_to (CamelTransport *transport,
+ CamelMimeMessage *message,
+ CamelAddress *from,
+ CamelAddress *recipients,
+ GError **error)
{
CamelService *service = CAMEL_SERVICE (transport);
CamelStore *store = NULL;
@@ -86,19 +49,24 @@ exchange_send_to (CamelTransport *transport, CamelMimeMessage *message,
GPtrArray *recipients_array;
gboolean success;
CamelStream *stream;
- CamelStreamFilter *filtered_stream;
+ CamelStream *filtered_stream;
CamelMimeFilter *crlffilter;
- struct _camel_header_raw *header;
+ GByteArray *byte_array;
+ GQueue *queue;
+ GList *link;
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;
}
@@ -110,8 +78,9 @@ exchange_send_to (CamelTransport *transport, CamelMimeMessage *message,
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_SYSTEM,
+ _("Cannot send message: one or more invalid recipients"));
g_ptr_array_free (recipients_array, TRUE);
return FALSE;
}
@@ -119,25 +88,37 @@ exchange_send_to (CamelTransport *transport, CamelMimeMessage *message,
}
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;
}
- stream = camel_stream_mem_new ();
+ byte_array = g_byte_array_new ();
+ stream = camel_stream_mem_new_with_byte_array (byte_array);
crlffilter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_ENCODE, CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
- filtered_stream = camel_stream_filter_new_with_stream (stream);
- camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (crlffilter));
+ filtered_stream = camel_stream_filter_new (stream);
+ camel_stream_filter_add (
+ CAMEL_STREAM_FILTER (filtered_stream),
+ CAMEL_MIME_FILTER (crlffilter));
g_object_unref (CAMEL_OBJECT (crlffilter));
/* Gross hack copied from camel-smtp-transport. ugh. FIXME */
/* copy and remove the bcc headers */
- header = CAMEL_MIME_PART (message)->headers;
- while (header) {
- if (!g_ascii_strcasecmp (header->name, "Bcc"))
- bcc = g_slist_append (bcc, g_strdup (header->value));
- header = header->next;
+ queue = camel_mime_part_get_raw_headers (CAMEL_MIME_PART (message));
+ link = g_queue_peek_head_link (queue);
+ while (link != NULL) {
+ CamelHeaderRaw *raw_header = link->data;
+ const gchar *name, *value;
+
+ name = camel_header_raw_get_name (raw_header);
+ value = camel_header_raw_get_value (raw_header);
+
+ if (!g_ascii_strcasecmp (name, "Bcc"))
+ bcc = g_slist_append (bcc, g_strdup (value));
+ link = g_list_next (link);
}
camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc");
@@ -158,12 +139,43 @@ exchange_send_to (CamelTransport *transport, CamelMimeMessage *message,
g_slist_free (bcc);
}
- success = camel_exchange_utils_send_message (CAMEL_SERVICE (transport), addr, recipients_array, CAMEL_STREAM_MEM (stream)->buffer, 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 (CAMEL_OBJECT (stream));
if (store)
g_object_unref (CAMEL_OBJECT (store));
+
return success;
}
+static void
+exchange_transport_class_init (CamelExchangeTransportClass *class)
+{
+ CamelTransportClass *transport_class;
+
+ parent_class = g_type_class_peek_parent (class);
+
+ transport_class = CAMEL_TRANSPORT_CLASS (class);
+ transport_class->send_to = exchange_transport_send_to;
+}
+
+GType
+camel_exchange_transport_get_type (void)
+{
+ static GType type = G_TYPE_INVALID;
+
+ if (G_UNLIKELY (type == G_TYPE_INVALID))
+ type = g_type_register_static_simple (
+ CAMEL_TYPE_TRANSPORT,
+ "CamelExchangeTransport",
+ sizeof (CamelExchangeTransportClass),
+ (GClassInitFunc) exchange_transport_class_init,
+ sizeof (CamelExchangeTransport),
+ (GInstanceInitFunc) NULL,
+ 0);
+
+ return type;
+}
diff --git a/camel/camel-exchange-transport.h b/camel/camel-exchange-transport.h
index cada5ad..155adc7 100644
--- a/camel/camel-exchange-transport.h
+++ b/camel/camel-exchange-transport.h
@@ -4,29 +4,43 @@
/* camel-exchange-transport.h: Exchange-based transport class */
#ifndef CAMEL_EXCHANGE_TRANSPORT_H
-#define CAMEL_EXCHANGE_TRANSPORT_H 1
-
-G_BEGIN_DECLS
+#define CAMEL_EXCHANGE_TRANSPORT_H
#include <camel/camel.h>
-#define CAMEL_EXCHANGE_TRANSPORT_TYPE (camel_exchange_transport_get_type ())
-#define CAMEL_EXCHANGE_TRANSPORT(obj) (CAMEL_CHECK_CAST((obj), CAMEL_EXCHANGE_TRANSPORT_TYPE, CamelExchangeTransport))
-#define CAMEL_EXCHANGE_TRANSPORT_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_EXCHANGE_TRANSPORT_TYPE, CamelExchangeTransportClass))
-#define CAMEL_IS_EXCHANGE_TRANSPORT(o) (CAMEL_CHECK_TYPE((o), CAMEL_EXCHANGE_TRANSPORT_TYPE))
+/* Standard GObject macros */
+#define CAMEL_TYPE_EXCHANGE_TRANSPORT \
+ (camel_exchange_transport_get_type ())
+#define CAMEL_EXCHANGE_TRANSPORT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_EXCHANGE_TRANSPORT, CamelExchangeTransport))
+#define CAMEL_EXCHANGE_TRANSPORT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_EXCHANGE_TRANSPORT, CamelExchangeTransportClass))
+#define CAMEL_IS_EXCHANGE_TRANSPORT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_EXCHANGE_TRANSPORT))
+#define CAMEL_IS_EXCHANGE_TRANSPORT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_EXCHANGE_TRANSPORT))
+#define CAMEL_EXCHANGE_TRANSPORT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_EXCHANGE_TRANSPORT, CamelExchangeTransportClass))
-typedef struct {
- CamelTransport parent_object;
+G_BEGIN_DECLS
-} CamelExchangeTransport;
+typedef struct _CamelExchangeTransport CamelExchangeTransport;
+typedef struct _CamelExchangeTransportClass CamelExchangeTransportClass;
-typedef struct {
- CamelTransportClass parent_class;
+struct _CamelExchangeTransport {
+ CamelTransport parent;
+};
-} CamelExchangeTransportClass;
+struct _CamelExchangeTransportClass {
+ CamelTransportClass parent_class;
+};
-/* Standard Camel function */
-CamelType camel_exchange_transport_get_type (void);
+GType camel_exchange_transport_get_type (void);
G_END_DECLS
diff --git a/camel/camel-exchange-utils.c b/camel/camel-exchange-utils.c
index c4f017d..1024723 100644
--- a/camel/camel-exchange-utils.c
+++ b/camel/camel-exchange-utils.c
@@ -211,15 +211,6 @@ is_online (ExchangeData *ed)
return camel_session_is_online (session) ? ONLINE_MODE : OFFLINE_MODE;
}
-static void
-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);
-}
-
static CamelFolder *
get_camel_folder (ExchangeFolder *mfld)
{
@@ -529,7 +520,9 @@ refresh_folder_internal (ExchangeFolder *mfld, GError **error)
if (!E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) {
g_warning ("got_new_smtp_messages: %d", status);
- set_exception (ex, _("Could not get new messages"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Could not get new messages"));
goto done;
}
@@ -568,7 +561,9 @@ refresh_folder_internal (ExchangeFolder *mfld, GError **error)
if (!E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) {
g_warning ("got_new_mapi_messages: %d", status);
- set_exception (ex, _("Could not get new messages"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Could not get new messages"));
goto done;
}
@@ -825,7 +820,7 @@ free_folder (gpointer value)
static void
got_folder_error (ExchangeFolder *mfld, GError **error, const gchar *err)
{
- set_exception (ex, err);
+ g_set_error (error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM, "%s", err);
free_folder (mfld);
}
@@ -1056,7 +1051,7 @@ get_folder_contents_online (ExchangeFolder *mfld, GError **error)
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;
}
@@ -1203,11 +1198,11 @@ get_folder_online (ExchangeFolder *mfld, GError **error)
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;
}
@@ -1221,7 +1216,7 @@ get_folder_online (ExchangeFolder *mfld, GError **error)
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;
@@ -1240,7 +1235,7 @@ get_folder_online (ExchangeFolder *mfld, GError **error)
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 */
@@ -1270,7 +1265,9 @@ folder_from_name (ExchangeData *ed, const gchar *folder_name, guint32 perms, GEr
mfld = g_hash_table_lookup (ed->folders_by_name, folder_name);
if (!mfld) {
- set_exception (ex, _("No such folder"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("No such folder"));
return NULL;
}
@@ -1292,7 +1289,9 @@ folder_from_name (ExchangeData *ed, const gchar *folder_name, guint32 perms, GEr
}
if (perms && !(mfld->access & perms)) {
- set_exception (ex, _("Permission denied"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Permission denied"));
return NULL;
}
@@ -2036,7 +2035,7 @@ struct update_linestatus
{
CamelExchangeStore *estore;
gint linestatus;
- GError **error;
+ GError *error;
};
static void
@@ -2051,7 +2050,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;
@@ -2115,7 +2114,7 @@ camel_exchange_utils_connect (CamelService *service,
the first time */
ul.estore = ed->estore;
- ul.ex = ex;
+ ul.error = NULL;
g_hash_table_foreach (ed->folders_by_name,
(GHFunc) folder_update_linestatus,
&ul);
@@ -2156,7 +2155,9 @@ 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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("No such folder"));
g_free (path);
return FALSE;
} else if (!folder) {
@@ -2165,7 +2166,9 @@ 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."));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Could not create folder"));
g_free (path);
return FALSE;
}
@@ -2213,7 +2216,7 @@ 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;
}
}
@@ -2254,7 +2257,9 @@ 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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Could not open Deleted Items folder"));
return FALSE;
}
@@ -2273,12 +2278,12 @@ camel_exchange_utils_refresh_folder (CamelService *service,
g_return_val_if_fail (ed != NULL, FALSE);
- mfld = folder_from_name (ed, folder_name, 0, ex);
+ mfld = folder_from_name (ed, folder_name, 0, error);
if (!mfld) {
return FALSE;
}
- refresh_folder_internal (mfld, ex);
+ refresh_folder_internal (mfld, error);
sync_deletions (mfld);
return TRUE;
@@ -2298,7 +2303,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;
@@ -2332,7 +2337,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;
@@ -2381,9 +2386,13 @@ 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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Could not empty Deleted Items folder"));
} else if (some_error) {
- set_exception (ex, _("Permission denied. Could not delete certain messages."));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Permission denied. Could not delete certain messages."));
}
g_ptr_array_free (hrefs, TRUE);
@@ -2415,7 +2424,7 @@ 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;
@@ -2425,9 +2434,14 @@ 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 ?
- _("Could not append message; mailbox is over quota") :
- _("Could not append message"));
+ if (status == E2K_HTTP_INSUFFICIENT_SPACE_ON_RESOURCE)
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Could not append message; mailbox is over quota"));
+ else
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Could not append message"));
return FALSE;
}
@@ -2489,7 +2503,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;
@@ -2565,7 +2579,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;
@@ -2600,7 +2614,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;
@@ -2613,7 +2627,9 @@ camel_exchange_utils_get_message (CamelService *service,
camel_exchange_folder_remove_message (CAMEL_EXCHANGE_FOLDER (folder), uid);
}
- set_exception (ex, _("No such message"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("No such message"));
return FALSE;
}
@@ -2685,9 +2701,13 @@ camel_exchange_utils_get_message (CamelService *service,
* time we recorded that.
*/
message_removed (mfld, folder, mmsg->href);
- set_exception (ex, _("Message has been deleted"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Message has been deleted"));
} else
- set_exception (ex, _("Error retrieving message"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Error retrieving message"));
cleanup:
g_free (body);
@@ -2716,7 +2736,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;
@@ -2736,7 +2756,9 @@ 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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Mailbox does not support full-text searching"));
g_ptr_array_foreach (matches, (GFunc) g_free, NULL);
g_ptr_array_free (matches, TRUE);
@@ -2773,10 +2795,10 @@ 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;
@@ -2844,7 +2866,9 @@ 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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Unable to move/copy messages"));
g_ptr_array_free (new_uids, TRUE);
new_uids = NULL;
}
@@ -2956,7 +2980,9 @@ 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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("No mail submission URI for this mailbox"));
return FALSE;
}
@@ -2989,12 +3015,15 @@ 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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("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);
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM, "%s", errmsg);
g_free (errmsg);
} else if (status == E2K_HTTP_INSUFFICIENT_SPACE_ON_RESOURCE ||
status == E2K_HTTP_INTERNAL_SERVER_ERROR) {
@@ -3003,11 +3032,15 @@ 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"
- "This might mean that your account is over quota."));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Could not send message"));
}
return res;
@@ -3043,15 +3076,21 @@ camel_exchange_utils_create_folder (CamelService *service,
break;
/* fall through */
default:
- set_exception (ex, _("Generic error"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Generic error"));
return FALSE;
case EXCHANGE_ACCOUNT_FOLDER_ALREADY_EXISTS:
- set_exception (ex, _("Folder already exists"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Folder already exists"));
return FALSE;
case EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED:
- set_exception (ex, _("Permission denied"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Permission denied"));
return FALSE;
}
@@ -3077,7 +3116,9 @@ 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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Folder doesn't exist"));
g_free (path);
return FALSE;
}
@@ -3094,12 +3135,16 @@ 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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Permission denied"));
g_object_unref (folder);
return FALSE;
default:
- set_exception (ex, _("Generic error"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Generic error"));
g_object_unref (folder);
return FALSE;
@@ -3141,7 +3186,9 @@ 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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Folder doesn't exist"));
g_free (old_path);
return FALSE;
}
@@ -3180,7 +3227,7 @@ 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;
}
}
@@ -3242,7 +3289,7 @@ 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;
}
}
@@ -3261,15 +3308,21 @@ camel_exchange_utils_rename_folder (CamelService *service,
break;
case EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST:
- set_exception (ex, _("Folder doesn't exist"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Folder doesn't exist"));
return FALSE;
case EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED:
- set_exception (ex, _("Permission denied"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Permission denied"));
return FALSE;
default:
- set_exception (ex, _("Generic error"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Generic error"));
return FALSE;
}
@@ -3292,7 +3345,9 @@ 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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Folder doesn't exist"));
g_free (path);
return FALSE;
}
@@ -3318,11 +3373,15 @@ camel_exchange_utils_subscribe_folder (CamelService *service,
break;
case EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED:
- set_exception (ex, _("Permission denied"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Permission denied"));
return FALSE;
default:
- set_exception (ex, _("Generic error"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Generic error"));
return FALSE;
}
@@ -3344,7 +3403,9 @@ 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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Folder doesn't exist"));
g_free (path);
return FALSE;
}
@@ -3365,7 +3426,9 @@ 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"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Folder doesn't exist"));
g_free (path);
return FALSE;
}
@@ -3380,13 +3443,17 @@ camel_exchange_utils_unsubscribe_folder (CamelService *service,
break;
case EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED:
- set_exception (ex, _("Permission denied"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Permission denied"));
g_object_unref (folder);
g_free (path);
return FALSE;
default:
- set_exception (ex, _("Generic error"));
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Generic error"));
g_object_unref (folder);
g_free (path);
return FALSE;
diff --git a/eplugin/exchange-config-listener.h b/eplugin/exchange-config-listener.h
index 07051bc..113cced 100644
--- a/eplugin/exchange-config-listener.h
+++ b/eplugin/exchange-config-listener.h
@@ -38,9 +38,9 @@ typedef enum {
#define EXCHANGE_TYPE_CONFIG_LISTENER (exchange_config_listener_get_type ())
#define EXCHANGE_CONFIG_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_CONFIG_LISTENER, ExchangeConfigListener))
-#define EXCHANGE_CONFIG_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_CONFIG_LISTENER, ExchangeConfigListenerClass))
+#define EXCHANGE_CONFIG_LISTENER_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), EXCHANGE_TYPE_CONFIG_LISTENER, ExchangeConfigListenerClass))
#define EXCHANGE_IS_CONFIG_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_CONFIG_LISTENER))
-#define EXCHANGE_IS_CONFIG_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_CONFIG_LISTENER))
+#define EXCHANGE_IS_CONFIG_LISTENER_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_CONFIG_LISTENER))
struct _ExchangeConfigListener {
EAccountList parent;
diff --git a/eplugin/exchange-delegates-user.h b/eplugin/exchange-delegates-user.h
index 3d886d7..38c9bf7 100644
--- a/eplugin/exchange-delegates-user.h
+++ b/eplugin/exchange-delegates-user.h
@@ -29,9 +29,9 @@ G_BEGIN_DECLS
#define EXCHANGE_TYPE_DELEGATES_USER (exchange_delegates_user_get_type ())
#define EXCHANGE_DELEGATES_USER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_DELEGATES_USER, ExchangeDelegatesUser))
-#define EXCHANGE_DELEGATES_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_DELEGATES_USER, ExchangeDelegatesUserClass))
+#define EXCHANGE_DELEGATES_USER_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), EXCHANGE_TYPE_DELEGATES_USER, ExchangeDelegatesUserClass))
#define EXCHANGE_IS_DELEGATES_USER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_DELEGATES_USER))
-#define EXCHANGE_IS_DELEGATES_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_DELEGATES_USER))
+#define EXCHANGE_IS_DELEGATES_USER_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_DELEGATES_USER))
typedef struct _ExchangeDelegatesUser ExchangeDelegatesUser;
diff --git a/eplugin/exchange-folder.c b/eplugin/exchange-folder.c
index 51ae374..d88dbf9 100644
--- a/eplugin/exchange-folder.c
+++ b/eplugin/exchange-folder.c
@@ -68,7 +68,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;
@@ -87,7 +86,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 */
diff --git a/eplugin/exchange-permissions-dialog.h b/eplugin/exchange-permissions-dialog.h
index ad2f47d..eb362c2 100644
--- a/eplugin/exchange-permissions-dialog.h
+++ b/eplugin/exchange-permissions-dialog.h
@@ -30,9 +30,9 @@ G_BEGIN_DECLS
#define EXCHANGE_TYPE_PERMISSIONS_DIALOG (exchange_permissions_dialog_get_type ())
#define EXCHANGE_PERMISSIONS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_PERMISSIONS_DIALOG, ExchangePermissionsDialog))
-#define EXCHANGE_PERMISSIONS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_PERMISSIONS_DIALOG, ExchangePermissionsDialogClass))
+#define EXCHANGE_PERMISSIONS_DIALOG_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), EXCHANGE_TYPE_PERMISSIONS_DIALOG, ExchangePermissionsDialogClass))
#define EXCHANGE_IS_PERMISSIONS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_PERMISSIONS_DIALOG))
-#define EXCHANGE_IS_PERMISSIONS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_PERMISSIONS_DIALOG))
+#define EXCHANGE_IS_PERMISSIONS_DIALOG_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_PERMISSIONS_DIALOG))
struct _ExchangePermissionsDialog {
GtkDialog parent;
diff --git a/eplugin/exchange-send-options.h b/eplugin/exchange-send-options.h
index 131fee0..9b6a471 100644
--- a/eplugin/exchange-send-options.h
+++ b/eplugin/exchange-send-options.h
@@ -28,9 +28,9 @@
#define EXCHANGE_TYPE_SENDOPTIONS_DIALOG (exchange_sendoptions_dialog_get_type ())
#define EXCHANGE_SENDOPTIONS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_SENDOPTIONS_DIALOG, ExchangeSendOptionsDialog))
-#define EXCHANGE_SENDOPTIONS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_SENDOPTIONS_DIALOG, ExchangeSendOptionsDialogClass))
+#define EXCHANGE_SENDOPTIONS_DIALOG_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), EXCHANGE_TYPE_SENDOPTIONS_DIALOG, ExchangeSendOptionsDialogClass))
#define EXCHANGE_IS_SENDOPTIONS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_SENDOPTIONS_DIALOG))
-#define EXCHANGE_IS_SENDOPTIONS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EXCHANGE_TYPE_SENDOPTIONS_DIALOG))
+#define EXCHANGE_IS_SENDOPTIONS_DIALOG_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((cls), EXCHANGE_TYPE_SENDOPTIONS_DIALOG))
typedef struct _ExchangeSendOptionsDialog ExchangeSendOptionsDialog;
typedef struct _ExchangeSendOptionsDialogClass ExchangeSendOptionsDialogClass;
diff --git a/eplugin/exchange-user-dialog.h b/eplugin/exchange-user-dialog.h
index 8b6134b..6a27bba 100644
--- a/eplugin/exchange-user-dialog.h
+++ b/eplugin/exchange-user-dialog.h
@@ -26,10 +26,10 @@
#define E2K_TYPE_USER_DIALOG (e2k_user_dialog_get_type ())
#define E2K_USER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E2K_TYPE_USER_DIALOG, E2kUserDialog))
-#define E2K_USER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E2K_TYPE_USER_DIALOG, \
+#define E2K_USER_DIALOG_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), E2K_TYPE_USER_DIALOG, \
E2kUserDialogClass))
#define E2K_IS_USER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E2K_TYPE_USER_DIALOG))
-#define E2K_IS_USER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E2K_TYPE_USER_DIALOG))
+#define E2K_IS_USER_DIALOG_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((cls), E2K_TYPE_USER_DIALOG))
typedef struct _E2kUserDialog E2kUserDialog;
typedef struct _E2kUserDialogClass E2kUserDialogClass;
diff --git a/server/lib/e2k-context.h b/server/lib/e2k-context.h
index e722d58..04acc26 100644
--- a/server/lib/e2k-context.h
+++ b/server/lib/e2k-context.h
@@ -19,9 +19,9 @@ G_BEGIN_DECLS
#define E2K_TYPE_CONTEXT (e2k_context_get_type ())
#define E2K_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E2K_TYPE_CONTEXT, E2kContext))
-#define E2K_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E2K_TYPE_CONTEXT, E2kContextClass))
+#define E2K_CONTEXT_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), E2K_TYPE_CONTEXT, E2kContextClass))
#define E2K_IS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E2K_TYPE_CONTEXT))
-#define E2K_IS_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E2K_TYPE_CONTEXT))
+#define E2K_IS_CONTEXT_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), E2K_TYPE_CONTEXT))
struct _E2kContext {
GObject parent;
diff --git a/server/lib/e2k-global-catalog.h b/server/lib/e2k-global-catalog.h
index 096f81f..755c1ac 100644
--- a/server/lib/e2k-global-catalog.h
+++ b/server/lib/e2k-global-catalog.h
@@ -13,9 +13,9 @@ G_BEGIN_DECLS
#define E2K_TYPE_GLOBAL_CATALOG (e2k_global_catalog_get_type ())
#define E2K_GLOBAL_CATALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E2K_TYPE_GLOBAL_CATALOG, E2kGlobalCatalog))
-#define E2K_GLOBAL_CATALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E2K_TYPE_GLOBAL_CATALOG, E2kGlobalCatalogClass))
+#define E2K_GLOBAL_CATALOG_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), E2K_TYPE_GLOBAL_CATALOG, E2kGlobalCatalogClass))
#define E2K_IS_GLOBAL_CATALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E2K_TYPE_GLOBAL_CATALOG))
-#define E2K_IS_GLOBAL_CATALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E2K_TYPE_GLOBAL_CATALOG))
+#define E2K_IS_GLOBAL_CATALOG_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), E2K_TYPE_GLOBAL_CATALOG))
struct _E2kGlobalCatalog {
GObject parent;
diff --git a/server/lib/e2k-security-descriptor.h b/server/lib/e2k-security-descriptor.h
index 4283391..5ba29be 100644
--- a/server/lib/e2k-security-descriptor.h
+++ b/server/lib/e2k-security-descriptor.h
@@ -10,9 +10,9 @@
#define E2K_TYPE_SECURITY_DESCRIPTOR (e2k_security_descriptor_get_type ())
#define E2K_SECURITY_DESCRIPTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E2K_TYPE_SECURITY_DESCRIPTOR, E2kSecurityDescriptor))
-#define E2K_SECURITY_DESCRIPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E2K_TYPE_SECURITY_DESCRIPTOR, E2kSecurityDescriptorClass))
+#define E2K_SECURITY_DESCRIPTOR_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), E2K_TYPE_SECURITY_DESCRIPTOR, E2kSecurityDescriptorClass))
#define E2K_IS_SECURITY_DESCRIPTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E2K_TYPE_SECURITY_DESCRIPTOR))
-#define E2K_IS_SECURITY_DESCRIPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E2K_TYPE_SECURITY_DESCRIPTOR))
+#define E2K_IS_SECURITY_DESCRIPTOR_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), E2K_TYPE_SECURITY_DESCRIPTOR))
struct _E2kSecurityDescriptor {
GObject parent;
diff --git a/server/lib/e2k-sid.h b/server/lib/e2k-sid.h
index ac17e3c..144a11a 100644
--- a/server/lib/e2k-sid.h
+++ b/server/lib/e2k-sid.h
@@ -11,9 +11,9 @@
#define E2K_TYPE_SID (e2k_sid_get_type ())
#define E2K_SID(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E2K_TYPE_SID, E2kSid))
-#define E2K_SID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E2K_TYPE_SID, E2kSidClass))
+#define E2K_SID_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), E2K_TYPE_SID, E2kSidClass))
#define E2K_IS_SID(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E2K_TYPE_SID))
-#define E2K_IS_SID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E2K_TYPE_SID))
+#define E2K_IS_SID_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), E2K_TYPE_SID))
typedef enum {
E2K_SID_TYPE_INVALID,
diff --git a/server/storage/e-folder-exchange.h b/server/storage/e-folder-exchange.h
index 975270e..524a5a4 100644
--- a/server/storage/e-folder-exchange.h
+++ b/server/storage/e-folder-exchange.h
@@ -12,9 +12,9 @@ G_BEGIN_DECLS
#define E_TYPE_FOLDER_EXCHANGE (e_folder_exchange_get_type ())
#define E_FOLDER_EXCHANGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_FOLDER_EXCHANGE, EFolderExchange))
-#define E_FOLDER_EXCHANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_FOLDER_EXCHANGE, EFolderExchangeClass))
+#define E_FOLDER_EXCHANGE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), E_TYPE_FOLDER_EXCHANGE, EFolderExchangeClass))
#define E_IS_FOLDER_EXCHANGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_FOLDER_EXCHANGE))
-#define E_IS_FOLDER_EXCHANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_FOLDER_EXCHANGE))
+#define E_IS_FOLDER_EXCHANGE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_FOLDER_EXCHANGE))
struct _EFolderExchange {
EFolder parent;
diff --git a/server/storage/e-folder-type-registry.h b/server/storage/e-folder-type-registry.h
index beede01..a09f0b7 100644
--- a/server/storage/e-folder-type-registry.h
+++ b/server/storage/e-folder-type-registry.h
@@ -30,9 +30,9 @@ G_BEGIN_DECLS
#define E_TYPE_FOLDER_TYPE_REGISTRY (e_folder_type_registry_get_type ())
#define E_FOLDER_TYPE_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_FOLDER_TYPE_REGISTRY, EFolderTypeRegistry))
-#define E_FOLDER_TYPE_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_FOLDER_TYPE_REGISTRY, EFolderTypeRegistryClass))
+#define E_FOLDER_TYPE_REGISTRY_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), E_TYPE_FOLDER_TYPE_REGISTRY, EFolderTypeRegistryClass))
#define E_IS_FOLDER_TYPE_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_FOLDER_TYPE_REGISTRY))
-#define E_IS_FOLDER_TYPE_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_FOLDER_TYPE_REGISTRY))
+#define E_IS_FOLDER_TYPE_REGISTRY_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_FOLDER_TYPE_REGISTRY))
typedef struct EFolderTypeRegistry EFolderTypeRegistry;
typedef struct EFolderTypeRegistryPrivate EFolderTypeRegistryPrivate;
diff --git a/server/storage/e-folder.h b/server/storage/e-folder.h
index 449e5ed..a2b2d73 100644
--- a/server/storage/e-folder.h
+++ b/server/storage/e-folder.h
@@ -30,9 +30,9 @@ G_BEGIN_DECLS
#define E_TYPE_FOLDER (e_folder_get_type ())
#define E_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_FOLDER, EFolder))
-#define E_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_FOLDER, EFolderClass))
+#define E_FOLDER_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), E_TYPE_FOLDER, EFolderClass))
#define E_IS_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_FOLDER))
-#define E_IS_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_FOLDER))
+#define E_IS_FOLDER_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_FOLDER))
#define E_FOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_FOLDER, EFolderClass))
typedef struct EFolder EFolder;
diff --git a/server/storage/e-storage.h b/server/storage/e-storage.h
index 78a449d..1570c47 100644
--- a/server/storage/e-storage.h
+++ b/server/storage/e-storage.h
@@ -30,9 +30,9 @@ G_BEGIN_DECLS
#define E_TYPE_STORAGE (e_storage_get_type ())
#define E_STORAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_STORAGE, EStorage))
-#define E_STORAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_STORAGE, EStorageClass))
+#define E_STORAGE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), E_TYPE_STORAGE, EStorageClass))
#define E_IS_STORAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_STORAGE))
-#define E_IS_STORAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_STORAGE))
+#define E_IS_STORAGE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_STORAGE))
#define E_STORAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_STORAGE, EStorageClass))
typedef struct EStorage EStorage;
diff --git a/server/storage/exchange-account.h b/server/storage/exchange-account.h
index 364d6fa..794aa0d 100644
--- a/server/storage/exchange-account.h
+++ b/server/storage/exchange-account.h
@@ -18,9 +18,9 @@ G_BEGIN_DECLS
#define EXCHANGE_TYPE_ACCOUNT (exchange_account_get_type ())
#define EXCHANGE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_ACCOUNT, ExchangeAccount))
-#define EXCHANGE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_ACCOUNT, ExchangeAccountClass))
+#define EXCHANGE_ACCOUNT_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), EXCHANGE_TYPE_ACCOUNT, ExchangeAccountClass))
#define EXCHANGE_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_ACCOUNT))
-#define EXCHANGE_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_ACCOUNT))
+#define EXCHANGE_IS_ACCOUNT_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_ACCOUNT))
struct _ExchangeAccount {
GObject parent;
diff --git a/server/storage/exchange-folder-size.h b/server/storage/exchange-folder-size.h
index 2d5abd4..1215239 100644
--- a/server/storage/exchange-folder-size.h
+++ b/server/storage/exchange-folder-size.h
@@ -12,9 +12,9 @@ G_BEGIN_DECLS
#define EXCHANGE_TYPE_FOLDER_SIZE (exchange_folder_size_get_type ())
#define EXCHANGE_FOLDER_SIZE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_FOLDER_SIZE, ExchangeFolderSize))
-#define EXCHANGE_FOLDER_SIZE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_FOLDER_SIZE, ExchangeFolderSizeClass))
+#define EXCHANGE_FOLDER_SIZE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), EXCHANGE_TYPE_FOLDER_SIZE, ExchangeFolderSizeClass))
#define EXCHANGE_IS_FOLDER_SIZE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_FOLDER_SIZE))
-#define EXCHANGE_IS_FOLDER_SIZE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_FOLDER_SIZE))
+#define EXCHANGE_IS_FOLDER_SIZE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_FOLDER_SIZE))
typedef struct _ExchangeFolderSize ExchangeFolderSize;
typedef struct _ExchangeFolderSizePrivate ExchangeFolderSizePrivate;
diff --git a/server/storage/exchange-hierarchy-favorites.h b/server/storage/exchange-hierarchy-favorites.h
index 798f287..6a1048b 100644
--- a/server/storage/exchange-hierarchy-favorites.h
+++ b/server/storage/exchange-hierarchy-favorites.h
@@ -10,9 +10,9 @@ G_BEGIN_DECLS
#define EXCHANGE_TYPE_HIERARCHY_FAVORITES (exchange_hierarchy_favorites_get_type ())
#define EXCHANGE_HIERARCHY_FAVORITES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_HIERARCHY_FAVORITES, ExchangeHierarchyFavorites))
-#define EXCHANGE_HIERARCHY_FAVORITES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_HIERARCHY_FAVORITES, ExchangeHierarchyFavoritesClass))
+#define EXCHANGE_HIERARCHY_FAVORITES_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), EXCHANGE_TYPE_HIERARCHY_FAVORITES, ExchangeHierarchyFavoritesClass))
#define EXCHANGE_IS_HIERARCHY_FAVORITES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_FAVORITES))
-#define EXCHANGE_IS_HIERARCHY_FAVORITES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_FAVORITES))
+#define EXCHANGE_IS_HIERARCHY_FAVORITES_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_FAVORITES))
struct _ExchangeHierarchyFavorites {
ExchangeHierarchySomeDAV parent;
diff --git a/server/storage/exchange-hierarchy-foreign.h b/server/storage/exchange-hierarchy-foreign.h
index eee2ee9..dd81d5e 100644
--- a/server/storage/exchange-hierarchy-foreign.h
+++ b/server/storage/exchange-hierarchy-foreign.h
@@ -10,9 +10,9 @@ G_BEGIN_DECLS
#define EXCHANGE_TYPE_HIERARCHY_FOREIGN (exchange_hierarchy_foreign_get_type ())
#define EXCHANGE_HIERARCHY_FOREIGN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_HIERARCHY_FOREIGN, ExchangeHierarchyForeign))
-#define EXCHANGE_HIERARCHY_FOREIGN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_HIERARCHY_FOREIGN, ExchangeHierarchyForeignClass))
+#define EXCHANGE_HIERARCHY_FOREIGN_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), EXCHANGE_TYPE_HIERARCHY_FOREIGN, ExchangeHierarchyForeignClass))
#define EXCHANGE_IS_HIERARCHY_FOREIGN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_FOREIGN))
-#define EXCHANGE_IS_HIERARCHY_FOREIGN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_FOREIGN))
+#define EXCHANGE_IS_HIERARCHY_FOREIGN_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_FOREIGN))
typedef struct _ExchangeHierarchyForeignPrivate ExchangeHierarchyForeignPrivate;
diff --git a/server/storage/exchange-hierarchy-gal.h b/server/storage/exchange-hierarchy-gal.h
index bcc2fe9..e359d57 100644
--- a/server/storage/exchange-hierarchy-gal.h
+++ b/server/storage/exchange-hierarchy-gal.h
@@ -10,9 +10,9 @@ G_BEGIN_DECLS
#define EXCHANGE_TYPE_HIERARCHY_GAL (exchange_hierarchy_gal_get_type ())
#define EXCHANGE_HIERARCHY_GAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_HIERARCHY_GAL, ExchangeHierarchyGAL))
-#define EXCHANGE_HIERARCHY_GAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_HIERARCHY_GAL, ExchangeHierarchyGALClass))
+#define EXCHANGE_HIERARCHY_GAL_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), EXCHANGE_TYPE_HIERARCHY_GAL, ExchangeHierarchyGALClass))
#define EXCHANGE_IS_HIERARCHY_GAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_GAL))
-#define EXCHANGE_IS_HIERARCHY_GAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_GAL))
+#define EXCHANGE_IS_HIERARCHY_GAL_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_GAL))
struct _ExchangeHierarchyGAL {
ExchangeHierarchy parent;
diff --git a/server/storage/exchange-hierarchy-somedav.h b/server/storage/exchange-hierarchy-somedav.h
index d2b292e..8f3a8a7 100644
--- a/server/storage/exchange-hierarchy-somedav.h
+++ b/server/storage/exchange-hierarchy-somedav.h
@@ -10,9 +10,9 @@ G_BEGIN_DECLS
#define EXCHANGE_TYPE_HIERARCHY_SOMEDAV (exchange_hierarchy_somedav_get_type ())
#define EXCHANGE_HIERARCHY_SOMEDAV(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_HIERARCHY_SOMEDAV, ExchangeHierarchySomeDAV))
-#define EXCHANGE_HIERARCHY_SOMEDAV_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_HIERARCHY_SOMEDAV, ExchangeHierarchySomeDAVClass))
+#define EXCHANGE_HIERARCHY_SOMEDAV_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), EXCHANGE_TYPE_HIERARCHY_SOMEDAV, ExchangeHierarchySomeDAVClass))
#define EXCHANGE_IS_HIERARCHY_SOMEDAV(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_SOMEDAV))
-#define EXCHANGE_IS_HIERARCHY_SOMEDAV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_SOMEDAV))
+#define EXCHANGE_IS_HIERARCHY_SOMEDAV_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_SOMEDAV))
#define EXCHANGE_GET_HIERARCHY_SOMEDAV_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EXCHANGE_TYPE_HIERARCHY_SOMEDAV, ExchangeHierarchySomeDAVClass))
struct _ExchangeHierarchySomeDAV {
diff --git a/server/storage/exchange-hierarchy-webdav.h b/server/storage/exchange-hierarchy-webdav.h
index ce629f1..81ec857 100644
--- a/server/storage/exchange-hierarchy-webdav.h
+++ b/server/storage/exchange-hierarchy-webdav.h
@@ -11,9 +11,9 @@ G_BEGIN_DECLS
#define EXCHANGE_TYPE_HIERARCHY_WEBDAV (exchange_hierarchy_webdav_get_type ())
#define EXCHANGE_HIERARCHY_WEBDAV(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_HIERARCHY_WEBDAV, ExchangeHierarchyWebDAV))
-#define EXCHANGE_HIERARCHY_WEBDAV_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_HIERARCHY_WEBDAV, ExchangeHierarchyWebDAVClass))
+#define EXCHANGE_HIERARCHY_WEBDAV_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), EXCHANGE_TYPE_HIERARCHY_WEBDAV, ExchangeHierarchyWebDAVClass))
#define EXCHANGE_IS_HIERARCHY_WEBDAV(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_WEBDAV))
-#define EXCHANGE_IS_HIERARCHY_WEBDAV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_WEBDAV))
+#define EXCHANGE_IS_HIERARCHY_WEBDAV_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY_WEBDAV))
struct _ExchangeHierarchyWebDAV {
ExchangeHierarchy parent;
diff --git a/server/storage/exchange-hierarchy.h b/server/storage/exchange-hierarchy.h
index 2bb9107..18c40db 100644
--- a/server/storage/exchange-hierarchy.h
+++ b/server/storage/exchange-hierarchy.h
@@ -12,9 +12,9 @@ G_BEGIN_DECLS
#define EXCHANGE_TYPE_HIERARCHY (exchange_hierarchy_get_type ())
#define EXCHANGE_HIERARCHY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_HIERARCHY, ExchangeHierarchy))
-#define EXCHANGE_HIERARCHY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_HIERARCHY, ExchangeHierarchyClass))
+#define EXCHANGE_HIERARCHY_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), EXCHANGE_TYPE_HIERARCHY, ExchangeHierarchyClass))
#define EXCHANGE_IS_HIERARCHY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY))
-#define EXCHANGE_IS_HIERARCHY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY))
+#define EXCHANGE_IS_HIERARCHY_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY))
struct _ExchangeHierarchy {
GObject parent;
diff --git a/tools/exchange-share-config-listener.h b/tools/exchange-share-config-listener.h
index 30d4745..00836ad 100644
--- a/tools/exchange-share-config-listener.h
+++ b/tools/exchange-share-config-listener.h
@@ -14,9 +14,9 @@ G_BEGIN_DECLS
#define EXCHANGE_TYPE_SHARE_CONFIG_LISTENER (exchange_share_config_listener_get_type ())
#define EXCHANGE_SHARE_CONFIG_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_SHARE_CONFIG_LISTENER, ExchangeShareConfigListener))
-#define EXCHANGE_SHARE_CONFIG_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_SHARE_CONFIG_LISTENER, ExchangeShareConfigListenerClass))
+#define EXCHANGE_SHARE_CONFIG_LISTENER_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), EXCHANGE_TYPE_SHARE_CONFIG_LISTENER, ExchangeShareConfigListenerClass))
#define EXCHANGE_IS_SHARE_CONFIG_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_SHARE_CONFIG_LISTENER))
-#define EXCHANGE_IS_SHARE_CONFIG_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_SHARE_CONFIG_LISTENER))
+#define EXCHANGE_IS_SHARE_CONFIG_LISTENER_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_SHARE_CONFIG_LISTENER))
typedef struct _ExchangeShareConfigListener ExchangeShareConfigListener;
typedef struct _ExchangeShareConfigListenerPrivate ExchangeShareConfigListenerPrivate;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]