aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/mbox
diff options
context:
space:
mode:
authorPeter Williams <peterw@src.gnome.org>2000-08-11 01:30:50 +0800
committerPeter Williams <peterw@src.gnome.org>2000-08-11 01:30:50 +0800
commit8cb514d6dd9497893a35a089d07a132d51263ee7 (patch)
tree9f4e5d1f929da7e0be900919753d419fe4c9c61a /camel/providers/mbox
parentbcbb63c59f80eb4e684036c5ef58ab141fb01b03 (diff)
downloadgsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.tar
gsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.tar.gz
gsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.tar.bz2
gsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.tar.lz
gsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.tar.xz
gsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.tar.zst
gsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.zip
Merge with camel-async.
svn path=/trunk/; revision=4687
Diffstat (limited to 'camel/providers/mbox')
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c485
-rw-r--r--camel/providers/mbox/camel-mbox-folder.h11
-rw-r--r--camel/providers/mbox/camel-mbox-store.c34
-rw-r--r--camel/providers/mbox/camel-mbox-store.h11
-rw-r--r--camel/providers/mbox/camel-mbox-summary.c494
-rw-r--r--camel/providers/mbox/camel-mbox-summary.h7
6 files changed, 533 insertions, 509 deletions
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index 68e0f5fd28..28defb7b87 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -48,47 +48,50 @@
#define d(x)
-static CamelFolderClass *parent_class = NULL;
+static CamelFolderClass *parent_class=NULL;
/* Returns the class for a CamelMboxFolder */
-#define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMBOXS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
+#define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
+#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
+#define CMBOXS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-static void mbox_init(CamelFolder * folder, CamelStore * parent_store,
- CamelFolder * parent_folder, const gchar * name,
- gchar * separator, gboolean path_begins_with_sep, CamelException * ex);
-static void mbox_sync(CamelFolder * folder, gboolean expunge, CamelException * ex);
-static gint mbox_get_message_count(CamelFolder * folder);
-static gint mbox_get_unread_message_count(CamelFolder * folder);
-static void mbox_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, CamelException * ex);
-static GPtrArray *mbox_get_uids(CamelFolder * folder);
-static GPtrArray *mbox_get_subfolder_names(CamelFolder * folder);
-static GPtrArray *mbox_get_summary(CamelFolder * folder);
-static CamelMimeMessage *mbox_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex);
+static void mbox_init (CamelFolder *folder, CamelStore *parent_store,
+ CamelFolder *parent_folder, const gchar *name,
+ gchar *separator, gboolean path_begins_with_sep,
+ CamelException *ex);
-static void mbox_expunge(CamelFolder * folder, CamelException * ex);
+static void mbox_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
+static gint mbox_get_message_count (CamelFolder *folder);
+static gint mbox_get_unread_message_count (CamelFolder *folder);
+static void mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, CamelException *ex);
+static GPtrArray *mbox_get_uids (CamelFolder *folder);
+static GPtrArray *mbox_get_subfolder_names (CamelFolder *folder);
+static GPtrArray *mbox_get_summary (CamelFolder *folder);
+static CamelMimeMessage *mbox_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex);
-static const CamelMessageInfo *mbox_get_message_info(CamelFolder * folder, const char *uid);
+static void mbox_expunge (CamelFolder *folder, CamelException *ex);
-static GPtrArray *mbox_search_by_expression(CamelFolder * folder, const char *expression, CamelException * ex);
+static const CamelMessageInfo *mbox_get_message_info (CamelFolder *folder, const char *uid);
+
+static GPtrArray *mbox_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
static void mbox_search_free(CamelFolder * folder, GPtrArray * result);
-static guint32 mbox_get_message_flags(CamelFolder * folder, const char *uid);
-static void mbox_set_message_flags(CamelFolder * folder, const char *uid, guint32 flags, guint32 set);
-static gboolean mbox_get_message_user_flag(CamelFolder * folder, const char *uid, const char *name);
-static void mbox_set_message_user_flag(CamelFolder * folder, const char *uid, const char *name, gboolean value);
+static guint32 mbox_get_message_flags (CamelFolder *folder, const char *uid);
+static void mbox_set_message_flags (CamelFolder *folder, const char *uid, guint32 flags, guint32 set);
+static gboolean mbox_get_message_user_flag (CamelFolder *folder, const char *uid, const char *name);
+static void mbox_set_message_user_flag (CamelFolder *folder, const char *uid, const char *name, gboolean value);
-static void mbox_finalize(GtkObject * object);
-static void camel_mbox_folder_class_init(CamelMboxFolderClass * camel_mbox_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS(camel_mbox_folder_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS(camel_folder_class);
+static void mbox_finalize (CamelObject *object);
- parent_class = gtk_type_class(camel_folder_get_type());
+static void
+camel_mbox_folder_class_init (CamelMboxFolderClass *camel_mbox_folder_class)
+{
+ CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_mbox_folder_class);
+ parent_class = CAMEL_FOLDER_CLASS(camel_type_get_global_classfuncs (camel_folder_get_type ()));
+
/* virtual method definition */
/* virtual method overload */
@@ -116,59 +119,53 @@ static void camel_mbox_folder_class_init(CamelMboxFolderClass * camel_mbox_folde
camel_folder_class->set_message_flags = mbox_set_message_flags;
camel_folder_class->get_message_user_flag = mbox_get_message_user_flag;
camel_folder_class->set_message_user_flag = mbox_set_message_user_flag;
-
- gtk_object_class->finalize = mbox_finalize;
-
}
-static void mbox_finalize(GtkObject * object)
+static void
+mbox_finalize (CamelObject *object)
{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(object);
+ CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (object);
- g_free(mbox_folder->folder_file_path);
- g_free(mbox_folder->summary_file_path);
- g_free(mbox_folder->folder_dir_path);
- g_free(mbox_folder->index_file_path);
+ g_free (mbox_folder->folder_file_path);
+ g_free (mbox_folder->summary_file_path);
+ g_free (mbox_folder->folder_dir_path);
+ g_free (mbox_folder->index_file_path);
- GTK_OBJECT_CLASS(parent_class)->finalize(object);
}
-GtkType camel_mbox_folder_get_type(void)
+CamelType
+camel_mbox_folder_get_type (void)
{
- static GtkType camel_mbox_folder_type = 0;
-
- if (!camel_mbox_folder_type) {
- GtkTypeInfo camel_mbox_folder_info = {
- "CamelMboxFolder",
- sizeof(CamelMboxFolder),
- sizeof(CamelMboxFolderClass),
- (GtkClassInitFunc) camel_mbox_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mbox_folder_type = gtk_type_unique(CAMEL_FOLDER_TYPE, &camel_mbox_folder_info);
+ static CamelType camel_mbox_folder_type = CAMEL_INVALID_TYPE;
+
+ if (camel_mbox_folder_type == CAMEL_INVALID_TYPE) {
+ camel_mbox_folder_type = camel_type_register (CAMEL_FOLDER_TYPE, "CamelMboxFolder",
+ sizeof (CamelMboxFolder),
+ sizeof (CamelMboxFolderClass),
+ (CamelObjectClassInitFunc) camel_mbox_folder_class_init,
+ NULL,
+ (CamelObjectInitFunc) NULL,
+ (CamelObjectFinalizeFunc) mbox_finalize);
}
-
+
return camel_mbox_folder_type;
}
-static void
-mbox_init(CamelFolder * folder, CamelStore * parent_store,
- CamelFolder * parent_folder, const gchar * name, gchar * separator,
- gboolean path_begins_with_sep, CamelException * ex)
+static void
+mbox_init (CamelFolder *folder, CamelStore *parent_store,
+ CamelFolder *parent_folder, const gchar *name, gchar *separator,
+ gboolean path_begins_with_sep, CamelException *ex)
{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *) folder;
+ CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
const gchar *root_dir_path;
gchar *real_name;
int forceindex;
struct stat st;
/* call parent method */
- parent_class->init(folder, parent_store, parent_folder, name, separator, path_begins_with_sep, ex);
- if (camel_exception_get_id(ex))
+ parent_class->init (folder, parent_store, parent_folder,
+ name, separator, path_begins_with_sep, ex);
+ if (camel_exception_get_id (ex))
return;
/* we assume that the parent init
@@ -179,108 +176,120 @@ mbox_init(CamelFolder * folder, CamelStore * parent_store,
folder->has_search_capability = TRUE;
folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
- CAMEL_MESSAGE_DELETED |
- CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_USER;
+ CAMEL_MESSAGE_DELETED |
+ CAMEL_MESSAGE_DRAFT |
+ CAMEL_MESSAGE_FLAGGED |
+ CAMEL_MESSAGE_SEEN |
+ CAMEL_MESSAGE_USER;
/* FIXME: we don't actually preserve user flags right now. */
- mbox_folder->summary = NULL;
- mbox_folder->search = NULL;
+ mbox_folder->summary = NULL;
+ mbox_folder->search = NULL;
/* now set the name info */
- g_free(mbox_folder->folder_file_path);
- g_free(mbox_folder->folder_dir_path);
- g_free(mbox_folder->index_file_path);
+ g_free (mbox_folder->folder_file_path);
+ g_free (mbox_folder->folder_dir_path);
+ g_free (mbox_folder->index_file_path);
- root_dir_path = camel_mbox_store_get_toplevel_dir(CAMEL_MBOX_STORE(folder->parent_store));
+ root_dir_path = camel_mbox_store_get_toplevel_dir (CAMEL_MBOX_STORE(folder->parent_store));
- real_name = g_basename(folder->full_name);
- mbox_folder->folder_file_path = g_strdup_printf("%s/%s", root_dir_path, real_name);
- mbox_folder->summary_file_path = g_strdup_printf("%s/%s-ev-summary", root_dir_path, real_name);
- mbox_folder->folder_dir_path = g_strdup_printf("%s/%s.sdb", root_dir_path, real_name);
- mbox_folder->index_file_path = g_strdup_printf("%s/%s.ibex", root_dir_path, real_name);
+ real_name = g_basename (folder->full_name);
+ mbox_folder->folder_file_path = g_strdup_printf ("%s/%s", root_dir_path, real_name);
+ mbox_folder->summary_file_path = g_strdup_printf ("%s/%s-ev-summary", root_dir_path, real_name);
+ mbox_folder->folder_dir_path = g_strdup_printf ("%s/%s.sdb", root_dir_path, real_name);
+ mbox_folder->index_file_path = g_strdup_printf ("%s/%s.ibex", root_dir_path, real_name);
/* if we have no index file, force it */
forceindex = stat(mbox_folder->index_file_path, &st) == -1;
- mbox_folder->index = ibex_open(mbox_folder->index_file_path, O_CREAT | O_RDWR, 0600);
+ mbox_folder->index = ibex_open(mbox_folder->index_file_path, O_CREAT|O_RDWR, 0600);
if (mbox_folder->index == NULL) {
/* yes, this isn't fatal at all */
- g_warning("Could not open/create index file: %s: indexing not performed", strerror(errno));
+ g_warning("Could not open/create index file: %s: indexing not performed",
+ strerror(errno));
}
/* no summary (disk or memory), and we're proverbially screwed */
- mbox_folder->summary = camel_mbox_summary_new(mbox_folder->summary_file_path,
- mbox_folder->folder_file_path, mbox_folder->index);
- if (mbox_folder->summary == NULL || camel_mbox_summary_load(mbox_folder->summary, forceindex) == -1) {
- camel_exception_set(ex, CAMEL_EXCEPTION_FOLDER_INVALID, /* FIXME: right error code */
- "Could not create summary");
+ mbox_folder->summary = camel_mbox_summary_new (mbox_folder->summary_file_path,
+ mbox_folder->folder_file_path, mbox_folder->index);
+ if (mbox_folder->summary == NULL
+ || camel_mbox_summary_load(mbox_folder->summary, forceindex) == -1) {
+ camel_exception_set (ex,
+ CAMEL_EXCEPTION_FOLDER_INVALID, /* FIXME: right error code */
+ "Could not create summary");
return;
}
}
-static void mbox_sync(CamelFolder * folder, gboolean expunge, CamelException * ex)
+static void
+mbox_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
+ CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
if (expunge)
- mbox_expunge(folder, ex);
+ mbox_expunge (folder, ex);
else
- camel_mbox_summary_sync(mbox_folder->summary, FALSE, ex);
+ camel_mbox_summary_sync (mbox_folder->summary, FALSE, ex);
/* save index */
if (mbox_folder->index)
ibex_save(mbox_folder->index);
if (mbox_folder->summary)
- camel_folder_summary_save(CAMEL_FOLDER_SUMMARY(mbox_folder->summary));
+ camel_folder_summary_save (CAMEL_FOLDER_SUMMARY (mbox_folder->summary));
}
-static void mbox_expunge(CamelFolder * folder, CamelException * ex)
+static void
+mbox_expunge (CamelFolder *folder, CamelException *ex)
{
- CamelMboxFolder *mbox = CAMEL_MBOX_FOLDER(folder);
+ CamelMboxFolder *mbox = CAMEL_MBOX_FOLDER (folder);
- camel_mbox_summary_sync(mbox->summary, TRUE, ex);
+ camel_mbox_summary_sync (mbox->summary, TRUE, ex);
/* TODO: check it actually changed */
- gtk_signal_emit_by_name(GTK_OBJECT(folder), "folder_changed", 0);
+ camel_object_trigger_event (CAMEL_OBJECT (folder), "folder_changed", GINT_TO_POINTER(0));
}
-static gint mbox_get_message_count(CamelFolder * folder)
+static gint
+mbox_get_message_count (CamelFolder *folder)
{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
-
- g_return_val_if_fail(mbox_folder->summary != NULL, -1);
+ CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- return camel_folder_summary_count(CAMEL_FOLDER_SUMMARY(mbox_folder->summary));
+ g_return_val_if_fail (mbox_folder->summary != NULL, -1);
+
+ return camel_folder_summary_count (CAMEL_FOLDER_SUMMARY (mbox_folder->summary));
}
-static gint mbox_get_unread_message_count(CamelFolder * folder)
+static gint
+mbox_get_unread_message_count (CamelFolder *folder)
{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
+ CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
CamelMessageInfo *info;
GPtrArray *infolist;
gint i, max, count = 0;
- g_return_val_if_fail(mbox_folder->summary != NULL, -1);
+ g_return_val_if_fail (mbox_folder->summary != NULL, -1);
- max = camel_folder_summary_count(CAMEL_FOLDER_SUMMARY(mbox_folder->summary));
+ max = camel_folder_summary_count (CAMEL_FOLDER_SUMMARY (mbox_folder->summary));
if (max == -1)
return -1;
- infolist = mbox_get_summary(folder);
-
+ infolist = mbox_get_summary (folder);
+
for (i = 0; i < infolist->len; i++) {
- info = (CamelMessageInfo *) g_ptr_array_index(infolist, i);
+ info = (CamelMessageInfo *) g_ptr_array_index (infolist, i);
if (!(info->flags & CAMEL_MESSAGE_SEEN))
count++;
}
-
+
return count;
}
/* FIXME: this may need some tweaking for performance? */
-static void mbox_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, CamelException * ex)
+static void
+mbox_append_message (CamelFolder *folder, CamelMimeMessage *message,
+ const CamelMessageInfo *info, CamelException *ex)
{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
+ CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
CamelStream *output_stream = NULL, *filter_stream = NULL;
CamelMimeFilter *filter_from = NULL;
CamelMessageInfo *newinfo;
@@ -290,135 +299,147 @@ static void mbox_append_message(CamelFolder * folder, CamelMimeMessage * message
guint32 uid;
char *fromline = NULL;
- if (stat(mbox_folder->folder_file_path, &st) != 0)
+ if (stat (mbox_folder->folder_file_path, &st) != 0)
goto fail;
- output_stream = camel_stream_fs_new_with_name(mbox_folder->folder_file_path, O_RDWR, 0600);
+ output_stream = camel_stream_fs_new_with_name (mbox_folder->folder_file_path, O_RDWR, 0600);
if (output_stream == NULL)
goto fail;
if (st.st_size) {
- seek = camel_seekable_stream_seek((CamelSeekableStream *) output_stream, st.st_size - 1, SEEK_SET);
+ seek = camel_seekable_stream_seek ((CamelSeekableStream *)output_stream, st.st_size - 1, SEEK_SET);
if (++seek != st.st_size)
goto fail;
/* If the mbox doesn't end with a newline, fix that. */
- if (camel_stream_read(output_stream, &last, 1) != 1)
+ if (camel_stream_read (output_stream, &last, 1) != 1)
goto fail;
if (last != '\n')
- camel_stream_write(output_stream, "\n", 1);
+ camel_stream_write (output_stream, "\n", 1);
} else
seek = 0;
/* assign a new x-evolution header/uid */
- camel_medium_remove_header(CAMEL_MEDIUM(message), "X-Evolution");
- uid = camel_folder_summary_next_uid(CAMEL_FOLDER_SUMMARY(mbox_folder->summary));
+ camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution");
+ uid = camel_folder_summary_next_uid (CAMEL_FOLDER_SUMMARY (mbox_folder->summary));
/* important that the header matches exactly 00000000-0000 */
- xev = g_strdup_printf("%08x-%04x", uid, info?info->flags&0xffff:0);
- camel_medium_add_header(CAMEL_MEDIUM(message), "X-Evolution", xev);
- g_free(xev);
+ if (info)
+ xev = g_strdup_printf ("%08x-%04x", uid, info->flags & 0xFFFF);
+ else
+ xev = g_strdup_printf ("%08x-%04x", uid, 0);
+ camel_medium_add_header (CAMEL_MEDIUM (message), "X-Evolution", xev);
+ g_free (xev);
/* we must write this to the non-filtered stream ... */
- fromline = camel_mbox_summary_build_from(CAMEL_MIME_PART(message)->headers);
- if (camel_stream_write_string(output_stream, fromline) == -1)
+ fromline = camel_mbox_summary_build_from (CAMEL_MIME_PART (message)->headers);
+ if (camel_stream_write_string (output_stream, fromline) == -1)
goto fail;
/* and write the content to the filtering stream, that translated '\nFrom' into '\n>From' */
- filter_stream = (CamelStream *) camel_stream_filter_new_with_stream(output_stream);
- filter_from = (CamelMimeFilter *) camel_mime_filter_from_new();
- camel_stream_filter_add((CamelStreamFilter *) filter_stream, filter_from);
- if (camel_data_wrapper_write_to_stream(CAMEL_DATA_WRAPPER(message), filter_stream) == -1)
+ filter_stream = (CamelStream *)camel_stream_filter_new_with_stream (output_stream);
+ filter_from = (CamelMimeFilter *)camel_mime_filter_from_new ();
+ camel_stream_filter_add ((CamelStreamFilter *)filter_stream, filter_from);
+ if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), filter_stream) == -1)
goto fail;
- if (camel_stream_close(filter_stream) == -1)
+ if (camel_stream_close (filter_stream) == -1)
goto fail;
/* filter stream ref's the output stream itself, so we need to unref it too */
- gtk_object_unref(GTK_OBJECT(filter_from));
- gtk_object_unref(GTK_OBJECT(filter_stream));
- gtk_object_unref(GTK_OBJECT(output_stream));
- g_free(fromline);
+ camel_object_unref (CAMEL_OBJECT (filter_from));
+ camel_object_unref (CAMEL_OBJECT (filter_stream));
+ camel_object_unref (CAMEL_OBJECT (output_stream));
+ g_free (fromline);
/* force a summary update - will only update from the new position, if it can */
- if (camel_mbox_summary_update(mbox_folder->summary, seek) == 0) {
+ if (camel_mbox_summary_update (mbox_folder->summary, seek) == 0) {
char uidstr[16];
- sprintf(uidstr, "%u", uid);
- if (info
- && (newinfo = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mbox_folder->summary), uidstr))) {
+
+ sprintf (uidstr, "%u", uid);
+ newinfo = camel_folder_summary_uid (CAMEL_FOLDER_SUMMARY (mbox_folder->summary), uidstr);
+
+ if (info && newinfo) {
CamelFlag *flag = info->user_flags;
CamelTag *tag = info->user_tags;
+
while (flag) {
- camel_flag_set(&newinfo->user_flags, flag->name, TRUE);
+ camel_flag_set (&(newinfo->user_flags), flag->name, TRUE);
flag = flag->next;
}
+
while (tag) {
- camel_tag_set(&newinfo->user_tags, tag->name, tag->value);
+ camel_tag_set (&(newinfo->user_tags), tag->name, tag->value);
tag = tag->next;
}
}
- gtk_signal_emit_by_name(GTK_OBJECT(folder), "folder_changed", 0);
+ camel_object_trigger_event (CAMEL_OBJECT (folder), "folder_changed", GINT_TO_POINTER(0));
}
+
return;
- fail:
- if (camel_exception_is_set(ex)) {
- camel_exception_setv(ex, camel_exception_get_id(ex),
- "Cannot append message to mbox file: %s", camel_exception_get_description(ex));
+fail:
+ if (camel_exception_is_set (ex)) {
+ camel_exception_setv (ex, camel_exception_get_id (ex),
+ "Cannot append message to mbox file: %s",
+ camel_exception_get_description (ex));
} else {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- "Cannot append message to mbox file: %s", g_strerror(errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ "Cannot append message to mbox file: %s",
+ g_strerror (errno));
}
if (filter_stream) {
- /*camel_stream_close (filter_stream); */
- gtk_object_unref(GTK_OBJECT(filter_stream));
+ /*camel_stream_close (filter_stream);*/
+ camel_object_unref (CAMEL_OBJECT (filter_stream));
}
if (output_stream)
- gtk_object_unref(GTK_OBJECT(output_stream));
+ camel_object_unref (CAMEL_OBJECT (output_stream));
if (filter_from)
- gtk_object_unref(GTK_OBJECT(filter_from));
-
- g_free(fromline);
+ camel_object_unref (CAMEL_OBJECT (filter_from));
+
+ g_free (fromline);
/* make sure the file isn't munged by us */
if (seek != -1) {
- int fd = open(mbox_folder->folder_file_path, O_WRONLY, 0600);
-
+ int fd = open (mbox_folder->folder_file_path, O_WRONLY, 0600);
+
if (fd != -1) {
- ftruncate(fd, st.st_size);
+ ftruncate (fd, st.st_size);
close(fd);
}
}
}
-static GPtrArray *mbox_get_uids(CamelFolder * folder)
+static GPtrArray *
+mbox_get_uids (CamelFolder *folder)
{
GPtrArray *array;
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
+ CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
int i, count;
- count = camel_folder_summary_count(CAMEL_FOLDER_SUMMARY(mbox_folder->summary));
- array = g_ptr_array_new();
- g_ptr_array_set_size(array, count);
+ count = camel_folder_summary_count (CAMEL_FOLDER_SUMMARY (mbox_folder->summary));
+ array = g_ptr_array_new ();
+ g_ptr_array_set_size (array, count);
for (i = 0; i < count; i++) {
- CamelMboxMessageInfo *info =
- (CamelMboxMessageInfo *) camel_folder_summary_index(CAMEL_FOLDER_SUMMARY(mbox_folder->summary), i);
-
- array->pdata[i] = g_strdup(info->info.uid);
+ CamelMboxMessageInfo *info = (CamelMboxMessageInfo *) camel_folder_summary_index (
+ CAMEL_FOLDER_SUMMARY (mbox_folder->summary), i);
+ array->pdata[i] = g_strdup (info->info.uid);
}
-
+
return array;
}
-static GPtrArray *mbox_get_subfolder_names(CamelFolder * folder)
+static GPtrArray *
+mbox_get_subfolder_names (CamelFolder *folder)
{
/* No subfolders. */
- return g_ptr_array_new();
+ return g_ptr_array_new ();
}
-static CamelMimeMessage *mbox_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex)
+static CamelMimeMessage *
+mbox_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
+ CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
CamelStream *message_stream = NULL;
CamelMimeMessage *message = NULL;
CamelMboxMessageInfo *info;
@@ -435,142 +456,156 @@ static CamelMimeMessage *mbox_get_message(CamelFolder * folder, const gchar * ui
}
/* if this has no content, its an error in the library */
- g_assert(info->info.content);
- g_assert(info->frompos != -1);
+ g_assert (info->info.content);
+ g_assert (info->frompos != -1);
/* where we read from */
- message_stream = camel_stream_fs_new_with_name(mbox_folder->folder_file_path, O_RDONLY, 0);
+ message_stream = camel_stream_fs_new_with_name (mbox_folder->folder_file_path, O_RDONLY, 0);
if (message_stream == NULL)
goto fail;
/* we use a parser to verify the message is correct, and in the correct position */
- parser = camel_mime_parser_new();
- camel_mime_parser_init_with_stream(parser, message_stream);
- gtk_object_unref(GTK_OBJECT(message_stream));
- camel_mime_parser_scan_from(parser, TRUE);
-
- camel_mime_parser_seek(parser, info->frompos, SEEK_SET);
- if (camel_mime_parser_step(parser, &buffer, &len) != HSCAN_FROM) {
- g_warning("File appears truncated");
+ parser = camel_mime_parser_new ();
+ camel_mime_parser_init_with_stream (parser, message_stream);
+ camel_object_unref (CAMEL_OBJECT (message_stream));
+ camel_mime_parser_scan_from (parser, TRUE);
+
+ camel_mime_parser_seek (parser, info->frompos, SEEK_SET);
+ if (camel_mime_parser_step (parser, &buffer, &len) != HSCAN_FROM) {
+ g_warning ("File appears truncated");
goto fail;
}
- if (camel_mime_parser_tell_start_from(parser) != info->frompos) {
- g_warning("Summary doesn't match the folder contents! eek!\n"
- " expecting offset %ld got %ld", (long int)info->frompos,
- (long int)camel_mime_parser_tell_start_from(parser));
+ if (camel_mime_parser_tell_start_from (parser) != info->frompos) {
+ g_warning ("Summary doesn't match the folder contents! eek!\n"
+ " expecting offset %ld got %ld", (long int)info->frompos,
+ (long int)camel_mime_parser_tell_start_from (parser));
errno = EINVAL;
goto fail;
}
- message = camel_mime_message_new();
- if (camel_mime_part_construct_from_parser(CAMEL_MIME_PART(message), parser) == -1) {
- g_warning("Construction failed");
+ message = camel_mime_message_new ();
+ if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (message), parser) == -1) {
+ g_warning ("Construction failed");
goto fail;
}
- gtk_object_unref(GTK_OBJECT(parser));
+ camel_object_unref (CAMEL_OBJECT (parser));
return message;
- fail:
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, "Cannot get message: %s", g_strerror(errno));
+fail:
+ camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
+ "Cannot get message: %s",
+ g_strerror(errno));
if (parser)
- gtk_object_unref(GTK_OBJECT(parser));
+ camel_object_unref (CAMEL_OBJECT (parser));
if (message)
- gtk_object_unref(GTK_OBJECT(message));
+ camel_object_unref (CAMEL_OBJECT (message));
return NULL;
}
-GPtrArray *mbox_get_summary(CamelFolder * folder)
+GPtrArray *
+mbox_get_summary (CamelFolder *folder)
{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
+ CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- return CAMEL_FOLDER_SUMMARY(mbox_folder->summary)->messages;
+ return CAMEL_FOLDER_SUMMARY (mbox_folder->summary)->messages;
}
/* get a single message info, by uid */
-static const CamelMessageInfo *mbox_get_message_info(CamelFolder * folder, const char *uid)
+static const CamelMessageInfo *
+mbox_get_message_info (CamelFolder *folder, const char *uid)
{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
+ CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- return camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mbox_folder->summary), uid);
+ return camel_folder_summary_uid (CAMEL_FOLDER_SUMMARY (mbox_folder->summary), uid);
}
-static GPtrArray *mbox_search_by_expression(CamelFolder * folder, const char *expression, CamelException * ex)
+static GPtrArray *
+mbox_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex)
{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
+ CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
if (mbox_folder->search == NULL) {
- mbox_folder->search = camel_folder_search_new();
+ mbox_folder->search = camel_folder_search_new ();
}
- camel_folder_search_set_folder(mbox_folder->search, folder);
+ camel_folder_search_set_folder (mbox_folder->search, folder);
if (mbox_folder->summary) {
/* FIXME: dont access summary array directly? */
- camel_folder_search_set_summary(mbox_folder->search,
- CAMEL_FOLDER_SUMMARY(mbox_folder->summary)->messages);
+ camel_folder_search_set_summary (mbox_folder->search,
+ CAMEL_FOLDER_SUMMARY (mbox_folder->summary)->messages);
}
+
+ camel_folder_search_set_body_index (mbox_folder->search, mbox_folder->index);
- camel_folder_search_set_body_index(mbox_folder->search, mbox_folder->index);
-
- return camel_folder_search_execute_expression(mbox_folder->search, expression, ex);
+ return camel_folder_search_execute_expression (mbox_folder->search, expression, ex);
}
-static void mbox_search_free(CamelFolder * folder, GPtrArray * result)
+static void
+mbox_search_free(CamelFolder * folder, GPtrArray * result)
{
CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
camel_folder_search_free_result(mbox_folder->search, result);
}
-static guint32 mbox_get_message_flags(CamelFolder * folder, const char *uid)
+static guint32
+mbox_get_message_flags (CamelFolder *folder, const char *uid)
{
CamelMessageInfo *info;
- CamelMboxFolder *mf = CAMEL_MBOX_FOLDER(folder);
+ CamelMboxFolder *mf = CAMEL_MBOX_FOLDER (folder);
- info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid);
- g_return_val_if_fail(info != NULL, 0);
+ info = camel_folder_summary_uid (CAMEL_FOLDER_SUMMARY (mf->summary), uid);
+ g_return_val_if_fail (info != NULL, 0);
return info->flags;
}
-static void mbox_set_message_flags(CamelFolder * folder, const char *uid, guint32 flags, guint32 set)
+static void
+mbox_set_message_flags (CamelFolder *folder, const char *uid, guint32 flags,
+ guint32 set)
{
CamelMessageInfo *info;
- CamelMboxFolder *mf = CAMEL_MBOX_FOLDER(folder);
+ CamelMboxFolder *mf = CAMEL_MBOX_FOLDER (folder);
- info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid);
- g_return_if_fail(info != NULL);
+ info = camel_folder_summary_uid (CAMEL_FOLDER_SUMMARY (mf->summary), uid);
+ g_return_if_fail (info != NULL);
- info->flags = (info->flags & ~flags) | (set & flags) | CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary));
+ info->flags = (info->flags & ~flags) | (set & flags) |
+ CAMEL_MESSAGE_FOLDER_FLAGGED;
+ camel_folder_summary_touch (CAMEL_FOLDER_SUMMARY (mf->summary));
- gtk_signal_emit_by_name(GTK_OBJECT(folder), "message_changed", uid);
+ camel_object_trigger_event (CAMEL_OBJECT (folder), "message_changed", uid);
}
-static gboolean mbox_get_message_user_flag(CamelFolder * folder, const char *uid, const char *name)
+static gboolean
+mbox_get_message_user_flag (CamelFolder *folder, const char *uid,
+ const char *name)
{
CamelMessageInfo *info;
- CamelMboxFolder *mf = CAMEL_MBOX_FOLDER(folder);
+ CamelMboxFolder *mf = CAMEL_MBOX_FOLDER (folder);
- info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid);
- g_return_val_if_fail(info != NULL, FALSE);
+ info = camel_folder_summary_uid (CAMEL_FOLDER_SUMMARY (mf->summary), uid);
+ g_return_val_if_fail (info != NULL, FALSE);
- return camel_flag_get(&info->user_flags, name);
+ return camel_flag_get (&info->user_flags, name);
}
-static void mbox_set_message_user_flag(CamelFolder * folder, const char *uid, const char *name, gboolean value)
+static void
+mbox_set_message_user_flag (CamelFolder *folder, const char *uid,
+ const char *name, gboolean value)
{
CamelMessageInfo *info;
- CamelMboxFolder *mf = CAMEL_MBOX_FOLDER(folder);
+ CamelMboxFolder *mf = CAMEL_MBOX_FOLDER (folder);
- info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid);
- g_return_if_fail(info != NULL);
+ info = camel_folder_summary_uid (CAMEL_FOLDER_SUMMARY (mf->summary), uid);
+ g_return_if_fail (info != NULL);
- camel_flag_set(&info->user_flags, name, value);
+ camel_flag_set (&info->user_flags, name, value);
info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary));
- gtk_signal_emit_by_name(GTK_OBJECT(folder), "message_changed", uid);
+ camel_folder_summary_touch (CAMEL_FOLDER_SUMMARY (mf->summary));
+ camel_object_trigger_event (CAMEL_OBJECT (folder), "message_changed", uid);
}
diff --git a/camel/providers/mbox/camel-mbox-folder.h b/camel/providers/mbox/camel-mbox-folder.h
index d7dc361f14..7c5558f362 100644
--- a/camel/providers/mbox/camel-mbox-folder.h
+++ b/camel/providers/mbox/camel-mbox-folder.h
@@ -33,7 +33,6 @@ extern "C" {
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
#include <camel/camel-folder.h>
#include <camel/camel-folder-search.h>
#include <libibex/ibex.h>
@@ -42,9 +41,9 @@ extern "C" {
/* #include "camel-store.h" */
#define CAMEL_MBOX_FOLDER_TYPE (camel_mbox_folder_get_type ())
-#define CAMEL_MBOX_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_MBOX_FOLDER_TYPE, CamelMboxFolder))
-#define CAMEL_MBOX_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MBOX_FOLDER_TYPE, CamelMboxFolderClass))
-#define IS_CAMEL_MBOX_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_MBOX_FOLDER_TYPE))
+#define CAMEL_MBOX_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_MBOX_FOLDER_TYPE, CamelMboxFolder))
+#define CAMEL_MBOX_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MBOX_FOLDER_TYPE, CamelMboxFolderClass))
+#define IS_CAMEL_MBOX_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_MBOX_FOLDER_TYPE))
typedef struct {
CamelFolder parent_object;
@@ -71,8 +70,8 @@ typedef struct {
/* public methods */
-/* Standard Gtk function */
-GtkType camel_mbox_folder_get_type (void);
+/* Standard Camel function */
+CamelType camel_mbox_folder_get_type (void);
#ifdef __cplusplus
}
diff --git a/camel/providers/mbox/camel-mbox-store.c b/camel/providers/mbox/camel-mbox-store.c
index 475fbd1352..e90c90275e 100644
--- a/camel/providers/mbox/camel-mbox-store.c
+++ b/camel/providers/mbox/camel-mbox-store.c
@@ -35,9 +35,9 @@
#include "camel-url.h"
/* Returns the class for a CamelMboxStore */
-#define CMBOXS_CLASS(so) CAMEL_MBOX_STORE_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (GTK_OBJECT(so)->klass)
+#define CMBOXS_CLASS(so) CAMEL_MBOX_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
+#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
+#define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
static char *get_name (CamelService *service, gboolean brief);
static CamelFolder *get_folder (CamelStore *store, const char *folder_name,
@@ -75,25 +75,19 @@ camel_mbox_store_init (gpointer object, gpointer klass)
store->folders = g_hash_table_new (g_str_hash, g_str_equal);
}
-GtkType
+CamelType
camel_mbox_store_get_type (void)
{
- static GtkType camel_mbox_store_type = 0;
+ static CamelType camel_mbox_store_type = CAMEL_INVALID_TYPE;
- if (!camel_mbox_store_type) {
- GtkTypeInfo camel_mbox_store_info =
- {
- "CamelMboxStore",
- sizeof (CamelMboxStore),
- sizeof (CamelMboxStoreClass),
- (GtkClassInitFunc) camel_mbox_store_class_init,
- (GtkObjectInitFunc) camel_mbox_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mbox_store_type = gtk_type_unique (CAMEL_STORE_TYPE, &camel_mbox_store_info);
+ if (camel_mbox_store_type == CAMEL_INVALID_TYPE) {
+ camel_mbox_store_type = camel_type_register (CAMEL_STORE_TYPE, "CamelMboxStore",
+ sizeof (CamelMboxStore),
+ sizeof (CamelMboxStoreClass),
+ (CamelObjectClassInitFunc) camel_mbox_store_class_init,
+ NULL,
+ (CamelObjectInitFunc) camel_mbox_store_init,
+ NULL);
}
return camel_mbox_store_type;
@@ -156,7 +150,7 @@ get_folder (CamelStore *store, const char *folder_name, gboolean create,
return NULL;
}
- new_folder = gtk_type_new (CAMEL_MBOX_FOLDER_TYPE);
+ new_folder = CAMEL_FOLDER (camel_object_new (CAMEL_MBOX_FOLDER_TYPE));
CF_CLASS (new_folder)->init (new_folder, store, NULL,
folder_name, "/", TRUE, ex);
diff --git a/camel/providers/mbox/camel-mbox-store.h b/camel/providers/mbox/camel-mbox-store.h
index 06a971ada4..7b298b67f6 100644
--- a/camel/providers/mbox/camel-mbox-store.h
+++ b/camel/providers/mbox/camel-mbox-store.h
@@ -31,13 +31,12 @@ extern "C" {
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
#include "camel-store.h"
#define CAMEL_MBOX_STORE_TYPE (camel_mbox_store_get_type ())
-#define CAMEL_MBOX_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_MBOX_STORE_TYPE, CamelMboxStore))
-#define CAMEL_MBOX_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MBOX_STORE_TYPE, CamelMboxStoreClass))
-#define IS_CAMEL_MBOX_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_MBOX_STORE_TYPE))
+#define CAMEL_MBOX_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_MBOX_STORE_TYPE, CamelMboxStore))
+#define CAMEL_MBOX_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MBOX_STORE_TYPE, CamelMboxStoreClass))
+#define IS_CAMEL_MBOX_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_MBOX_STORE_TYPE))
typedef struct {
@@ -55,8 +54,8 @@ typedef struct {
/* public methods */
-/* Standard Gtk function */
-GtkType camel_mbox_store_get_type (void);
+/* Standard Camel function */
+CamelType camel_mbox_store_get_type (void);
const gchar *camel_mbox_store_get_toplevel_dir (CamelMboxStore *store);
diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c
index fc1eacafe7..b656205b1a 100644
--- a/camel/providers/mbox/camel-mbox-summary.c
+++ b/camel/providers/mbox/camel-mbox-summary.c
@@ -40,73 +40,58 @@ struct _CamelMboxSummaryPrivate {
#define _PRIVATE(o) (((CamelMboxSummary *)(o))->priv)
-static int summary_header_load(CamelFolderSummary *, FILE *);
-static int summary_header_save(CamelFolderSummary *, FILE *);
-
-static CamelMessageInfo *message_info_new(CamelFolderSummary *, struct _header_raw *);
-static CamelMessageInfo *message_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
-static CamelMessageInfo *message_info_load(CamelFolderSummary *, FILE *);
-static int message_info_save(CamelFolderSummary *, FILE *, CamelMessageInfo *);
+static int summary_header_load (CamelFolderSummary *, FILE *);
+static int summary_header_save (CamelFolderSummary *, FILE *);
+static CamelMessageInfo * message_info_new (CamelFolderSummary *, struct _header_raw *);
+static CamelMessageInfo * message_info_new_from_parser (CamelFolderSummary *, CamelMimeParser *);
+static CamelMessageInfo * message_info_load (CamelFolderSummary *, FILE *);
+static int message_info_save (CamelFolderSummary *, FILE *, CamelMessageInfo *);
/*static void message_info_free (CamelFolderSummary *, CamelMessageInfo *);*/
-static void camel_mbox_summary_class_init(CamelMboxSummaryClass * klass);
-static void camel_mbox_summary_init(CamelMboxSummary *obj);
-static void camel_mbox_summary_finalise(GtkObject * obj);
+static void camel_mbox_summary_class_init (CamelMboxSummaryClass *klass);
+static void camel_mbox_summary_init (CamelMboxSummary *obj);
+static void camel_mbox_summary_finalise (CamelObject *obj);
static CamelFolderSummaryClass *camel_mbox_summary_parent;
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint camel_mbox_summary_get_type(void)
+CamelType
+camel_mbox_summary_get_type (void)
{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelMboxSummary",
- sizeof(CamelMboxSummary),
- sizeof(CamelMboxSummaryClass),
- (GtkClassInitFunc) camel_mbox_summary_class_init,
- (GtkObjectInitFunc) camel_mbox_summary_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique(camel_folder_summary_get_type(), &type_info);
+ static CamelType type = CAMEL_INVALID_TYPE;
+
+ if (type == CAMEL_INVALID_TYPE) {
+ type = camel_type_register (camel_folder_summary_get_type (), "CamelMboxSummary",
+ sizeof (CamelMboxSummary),
+ sizeof (CamelMboxSummaryClass),
+ (CamelObjectClassInitFunc) camel_mbox_summary_class_init,
+ NULL,
+ (CamelObjectInitFunc) camel_mbox_summary_init,
+ (CamelObjectFinalizeFunc) camel_mbox_summary_finalise);
}
-
+
return type;
}
static void
-camel_mbox_summary_class_init(CamelMboxSummaryClass * klass)
+camel_mbox_summary_class_init (CamelMboxSummaryClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
CamelFolderSummaryClass *sklass = (CamelFolderSummaryClass *) klass;
-
- camel_mbox_summary_parent = gtk_type_class(camel_folder_summary_get_type());
-
- object_class->finalize = camel_mbox_summary_finalise;
+
+ camel_mbox_summary_parent = CAMEL_FOLDER_SUMMARY_CLASS(camel_type_get_global_classfuncs (camel_folder_summary_get_type ()));
sklass->summary_header_load = summary_header_load;
sklass->summary_header_save = summary_header_save;
- sklass->message_info_new = message_info_new;
+ sklass->message_info_new = message_info_new;
sklass->message_info_new_from_parser = message_info_new_from_parser;
sklass->message_info_load = message_info_load;
sklass->message_info_save = message_info_save;
- /*sklass->message_info_free = message_info_free; */
-
- gtk_object_class_add_signals(object_class, signals, LAST_SIGNAL);
+ /*sklass->message_info_free = message_info_free;*/
}
static void
-camel_mbox_summary_init(CamelMboxSummary *obj)
+camel_mbox_summary_init (CamelMboxSummary *obj)
{
struct _CamelMboxSummaryPrivate *p;
struct _CamelFolderSummary *s = (CamelFolderSummary *)obj;
@@ -122,13 +107,11 @@ camel_mbox_summary_init(CamelMboxSummary *obj)
}
static void
-camel_mbox_summary_finalise(GtkObject * obj)
+camel_mbox_summary_finalise (CamelObject *obj)
{
- CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY(obj);
+ CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY (obj);
- g_free(mbs->folder_path);
-
- ((GtkObjectClass *) (camel_mbox_summary_parent))->finalize(GTK_OBJECT(obj));
+ g_free (mbs->folder_path);
}
/**
@@ -139,203 +122,204 @@ camel_mbox_summary_finalise(GtkObject * obj)
* Return value: A new CamelMboxSummary widget.
**/
CamelMboxSummary *
-camel_mbox_summary_new(const char *filename, const char *mbox_name, ibex * index)
+camel_mbox_summary_new (const char *filename, const char *mbox_name, ibex *index)
{
- CamelMboxSummary *new = CAMEL_MBOX_SUMMARY(gtk_type_new(camel_mbox_summary_get_type()));
-
+ CamelMboxSummary *new = CAMEL_MBOX_SUMMARY (camel_object_new (camel_mbox_summary_get_type ()));
+
if (new) {
/* ?? */
- camel_folder_summary_set_build_content(CAMEL_FOLDER_SUMMARY(new), TRUE);
- camel_folder_summary_set_filename(CAMEL_FOLDER_SUMMARY(new), filename);
- new->folder_path = g_strdup(mbox_name);
+ camel_folder_summary_set_build_content (CAMEL_FOLDER_SUMMARY (new), TRUE);
+ camel_folder_summary_set_filename (CAMEL_FOLDER_SUMMARY (new), filename);
+ new->folder_path = g_strdup (mbox_name);
new->index = index;
}
return new;
}
static int
-summary_header_load(CamelFolderSummary *s, FILE * in)
+summary_header_load (CamelFolderSummary *s, FILE *in)
{
- CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY(s);
+ CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY (s);
- if (((CamelFolderSummaryClass *) camel_mbox_summary_parent)->summary_header_load(s, in) == -1)
+ if (((CamelFolderSummaryClass *)camel_mbox_summary_parent)->summary_header_load (s, in) == -1)
return -1;
- return camel_folder_summary_decode_uint32(in, &mbs->folder_size);
+ return camel_folder_summary_decode_uint32 (in, &mbs->folder_size);
}
static int
-summary_header_save(CamelFolderSummary *s, FILE * out)
+summary_header_save (CamelFolderSummary *s, FILE *out)
{
- CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY(s);
+ CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY (s);
- if (((CamelFolderSummaryClass *) camel_mbox_summary_parent)->summary_header_save(s, out) == -1)
+ if (((CamelFolderSummaryClass *)camel_mbox_summary_parent)->summary_header_save (s, out) == -1)
return -1;
- return camel_folder_summary_encode_uint32(out, mbs->folder_size);
+ return camel_folder_summary_encode_uint32 (out, mbs->folder_size);
}
static int
-header_evolution_decode(const char *in, guint32 * uid, guint32 * flags)
+header_evolution_decode (const char *in, guint32 *uid, guint32 *flags)
{
- char *header;
-
- if (in && (header = header_token_decode(in))) {
- if (strlen(header) == strlen("00000000-0000")
- && sscanf(header, "%08x-%04x", uid, flags) == 2) {
- g_free(header);
- return *uid;
- }
- g_free(header);
- }
-
- return -1;
+ char *header;
+
+ if (in && (header = header_token_decode(in))) {
+ if (strlen (header) == strlen ("00000000-0000")
+ && sscanf (header, "%08x-%04x", uid, flags) == 2) {
+ g_free (header);
+ return *uid;
+ }
+ g_free (header);
+ }
+
+ return -1;
}
static char *
-header_evolution_encode(guint32 uid, guint32 flags)
+header_evolution_encode (guint32 uid, guint32 flags)
{
- return g_strdup_printf("%08x-%04x", uid, flags & 0xffff);
+ return g_strdup_printf ("%08x-%04x", uid, flags & 0xffff);
}
static CamelMessageInfo *
-message_info_new(CamelFolderSummary *s, struct _header_raw *h)
+message_info_new (CamelFolderSummary *s, struct _header_raw *h)
{
CamelMessageInfo *mi;
- mi = ((CamelFolderSummaryClass *) camel_mbox_summary_parent)->message_info_new(s, h);
+ mi = ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_new (s, h);
if (mi) {
const char *xev;
guint32 uid, flags;
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *) mi;
+ CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
- xev = header_raw_find(&h, "X-Evolution", NULL);
+ xev = header_raw_find (&h, "X-Evolution", NULL);
if (xev && header_evolution_decode(xev, &uid, &flags) != -1) {
- g_free(mi->uid);
- mi->uid = g_strdup_printf("%u", uid);
+ g_free (mi->uid);
+ mi->uid = g_strdup_printf ("%u", uid);
mi->flags = flags;
} else {
/* to indicate it has no xev header? */
mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV;
- mi->uid = g_strdup_printf("%u", camel_folder_summary_next_uid(s));
+ mi->uid = g_strdup_printf ("%u", camel_folder_summary_next_uid (s));
}
mbi->frompos = -1;
}
-
+
return mi;
}
static CamelMessageInfo *
-message_info_new_from_parser(CamelFolderSummary *s, CamelMimeParser * mp)
+message_info_new_from_parser (CamelFolderSummary *s, CamelMimeParser *mp)
{
CamelMessageInfo *mi;
- CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY(s);
+ CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY (s);
- mi = ((CamelFolderSummaryClass *) camel_mbox_summary_parent)->message_info_new_from_parser(s, mp);
+ mi = ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_new_from_parser (s, mp);
if (mi) {
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *) mi;
+ CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
- mbi->frompos = camel_mime_parser_tell_start_from(mp);
+ mbi->frompos = camel_mime_parser_tell_start_from (mp);
/* do we want to index this message as we add it, as well? */
- if (mbs->index_force || (mi->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0
+ if (mbs->index_force
+ || (mi->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0
|| !ibex_contains_name(mbs->index, mi->uid)) {
- camel_folder_summary_set_index(s, mbs->index);
+
+ camel_folder_summary_set_index (s, mbs->index);
} else {
- camel_folder_summary_set_index(s, NULL);
+ camel_folder_summary_set_index (s, NULL);
}
}
-
+
return mi;
}
static CamelMessageInfo *
-message_info_load(CamelFolderSummary *s, FILE * in)
+message_info_load (CamelFolderSummary *s, FILE *in)
{
CamelMessageInfo *mi;
- io(printf("loading mbox message info\n"));
+ io (printf ("loading mbox message info\n"));
- mi = ((CamelFolderSummaryClass *) camel_mbox_summary_parent)->message_info_load(s, in);
+ mi = ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_load (s, in);
if (mi) {
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *) mi;
+ CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
- camel_folder_summary_decode_uint32(in, &mbi->frompos);
+ camel_folder_summary_decode_uint32 (in, &mbi->frompos);
}
-
+
return mi;
}
static int
-message_info_save(CamelFolderSummary *s, FILE * out, CamelMessageInfo * mi)
+message_info_save (CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
{
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *) mi;
+ CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
- io(printf("saving mbox message info\n"));
+ io (printf ("saving mbox message info\n"));
- ((CamelFolderSummaryClass *) camel_mbox_summary_parent)->message_info_save(s, out, mi);
+ ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_save (s, out, mi);
- return camel_folder_summary_encode_uint32(out, mbi->frompos);
+ return camel_folder_summary_encode_uint32 (out, mbi->frompos);
}
static int
-summary_rebuild(CamelMboxSummary *mbs, off_t offset)
+summary_rebuild (CamelMboxSummary *mbs, off_t offset)
{
- CamelFolderSummary *s = CAMEL_FOLDER_SUMMARY(mbs);
+ CamelFolderSummary *s = CAMEL_FOLDER_SUMMARY (mbs);
CamelMimeParser *mp;
int fd;
int ok = 0;
- fd = open(mbs->folder_path, O_RDONLY);
+ fd = open (mbs->folder_path, O_RDONLY);
if (fd == -1) {
- printf("%s failed to open: %s", mbs->folder_path, strerror(errno));
+ printf ("%s failed to open: %s", mbs->folder_path, strerror (errno));
return -1;
}
-
- mp = camel_mime_parser_new();
- camel_mime_parser_init_with_fd(mp, fd);
- camel_mime_parser_scan_from(mp, TRUE);
- camel_mime_parser_seek(mp, offset, SEEK_SET);
+
+ mp = camel_mime_parser_new ();
+ camel_mime_parser_init_with_fd (mp, fd);
+ camel_mime_parser_scan_from (mp, TRUE);
+ camel_mime_parser_seek (mp, offset, SEEK_SET);
if (offset > 0) {
- if (camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM) {
- if (camel_mime_parser_tell_start_from(mp) != offset) {
- g_warning
- ("The next message didn't start where I expected\nbuilding summary from start");
- camel_mime_parser_drop_step(mp);
+ if (camel_mime_parser_step (mp, NULL, NULL) == HSCAN_FROM) {
+ if (camel_mime_parser_tell_start_from (mp) != offset) {
+ g_warning ("The next message didn't start where I expected\nbuilding summary from start");
+ camel_mime_parser_drop_step (mp);
offset = 0;
- camel_mime_parser_seek(mp, offset, SEEK_SET);
- camel_folder_summary_clear(CAMEL_FOLDER_SUMMARY(mbs));
+ camel_mime_parser_seek (mp, offset, SEEK_SET);
+ camel_folder_summary_clear (CAMEL_FOLDER_SUMMARY (mbs));
} else {
- camel_mime_parser_unstep(mp);
+ camel_mime_parser_unstep (mp);
}
} else {
- gtk_object_unref(GTK_OBJECT(mp));
+ camel_object_unref (CAMEL_OBJECT (mp));
/* end of file - no content? */
return -1;
}
}
- while (camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM) {
+ while (camel_mime_parser_step (mp, NULL, NULL) == HSCAN_FROM) {
CamelMessageInfo *info;
- info = camel_folder_summary_add_from_parser(CAMEL_FOLDER_SUMMARY(mbs), mp);
+ info = camel_folder_summary_add_from_parser (CAMEL_FOLDER_SUMMARY (mbs), mp);
if (info == NULL) {
- printf("Could not build info from file?\n");
+ printf ("Could not build info from file?\n");
ok = -1;
break;
}
- g_assert(camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM_END);
+ g_assert (camel_mime_parser_step (mp, NULL, NULL) == HSCAN_FROM_END);
}
- gtk_object_unref(GTK_OBJECT(mp));
-
+ camel_object_unref (CAMEL_OBJECT (mp));
+
/* update the file size/mtime in the summary */
if (ok != -1) {
struct stat st;
- if (stat(mbs->folder_path, &st) == 0) {
+ if (stat (mbs->folder_path, &st) == 0) {
mbs->folder_size = st.st_size;
s->time = st.st_mtime;
}
@@ -627,246 +611,260 @@ camel_mbox_summary_sync(CamelMboxSummary *mbs, gboolean expunge, CamelException
char *fromline;
/* make sure we're in sync */
- count = camel_folder_summary_count(s);
+ count = camel_folder_summary_count (s);
if (count > 0) {
- CamelMessageInfo *mi = camel_folder_summary_index(s, count - 1);
-
- camel_mbox_summary_update(mbs, mi->content->endpos);
+ CamelMessageInfo *mi = camel_folder_summary_index (s, count - 1);
+ camel_mbox_summary_update (mbs, mi->content->endpos);
} else {
- camel_mbox_summary_update(mbs, 0);
+ camel_mbox_summary_update (mbs, 0);
}
/* check if we have any work to do */
- d(printf("Performing sync, %d messages in inbox\n", count));
+ d(printf ("Performing sync, %d messages in inbox\n", count));
for (i = 0; quick && i < count; i++) {
- info = (CamelMboxMessageInfo *) camel_folder_summary_index(s, i);
- if ((expunge && (info->info.flags & CAMEL_MESSAGE_DELETED))
- || (info->info.flags & CAMEL_MESSAGE_FOLDER_NOXEV))
+ info = (CamelMboxMessageInfo *)camel_folder_summary_index (s, i);
+ if ((expunge && (info->info.flags & CAMEL_MESSAGE_DELETED)) ||
+ (info->info.flags & CAMEL_MESSAGE_FOLDER_NOXEV))
quick = FALSE;
else
work |= (info->info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0;
}
- d(printf("Options: %s %s %s\n", expunge ? "expunge" : "", quick ? "quick" : "", work ? "Work" : ""));
+ d(printf ("Options: %s %s %s\n", expunge ? "expunge" : "", quick ? "quick" : "", work ? "Work" : ""));
if (quick && !work)
return 0;
- fd = open(mbs->folder_path, O_RDWR);
+ fd = open (mbs->folder_path, O_RDWR);
if (fd == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "Could not open summary %s", mbs->folder_path);
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ "Could not open summary %s", mbs->folder_path);
return -1;
}
- mp = camel_mime_parser_new();
- camel_mime_parser_scan_from(mp, TRUE);
- camel_mime_parser_init_with_fd(mp, fd);
+ mp = camel_mime_parser_new ();
+ camel_mime_parser_scan_from (mp, TRUE);
+ camel_mime_parser_init_with_fd (mp, fd);
if (!quick) {
- tmpname = alloca(strlen(mbs->folder_path) + 5);
- sprintf(tmpname, "%s.tmp", mbs->folder_path);
- d(printf("Writing tmp file to %s\n", tmpname));
- retry_out:
- fdout = open(tmpname, O_WRONLY | O_CREAT | O_EXCL, 0600);
+ tmpname = alloca (strlen (mbs->folder_path) + 5);
+ sprintf (tmpname, "%s.tmp", mbs->folder_path);
+ d(printf ("Writing tmp file to %s\n", tmpname));
+ retry_out:
+ fdout = open (tmpname, O_WRONLY | O_CREAT | O_EXCL, 0600);
if (fdout == -1) {
if (errno == EEXIST)
if (unlink(tmpname) != -1)
goto retry_out;
-
- free(tmpname);
+
+ free (tmpname);
tmpname = NULL;
- g_warning("Something failed (yo!)");
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "Cannot open temporary mailbox: %s",
- strerror(errno));
+ g_warning ("Something failed (yo!)");
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ "Cannot open temporary mailbox: %s", strerror (errno));
goto error;
}
}
for (i = 0; i < count; i++) {
off_t frompos, bodypos, lastpos;
-
/* This has to be an int, not an off_t, because that's
* what camel_mime_parser_header returns... FIXME.
*/
int xevoffset;
- info = (CamelMboxMessageInfo *) camel_folder_summary_index(s, i);
+ info = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
- g_assert(info);
+ g_assert (info);
- d(printf("Looking at message %s\n", info->info.uid));
+ d(printf ("Looking at message %s\n", info->info.uid));
if (expunge && info->info.flags & CAMEL_MESSAGE_DELETED) {
- d(printf("Deleting %s\n", info->info.uid));
+ d(printf ("Deleting %s\n", info->info.uid));
- g_assert(!quick);
+ g_assert (!quick);
offset -= (info->info.content->endpos - info->frompos);
if (mbs->index)
- ibex_unindex(mbs->index, info->info.uid);
- camel_folder_summary_remove(s, (CamelMessageInfo *) info);
+ ibex_unindex (mbs->index, info->info.uid);
+ camel_folder_summary_remove (s, (CamelMessageInfo *)info);
count--;
i--;
info = NULL;
} else if (info->info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV | CAMEL_MESSAGE_FOLDER_FLAGGED)) {
int xevok = FALSE;
- d(printf("Updating header for %s flags = %08x\n", info->info.uid, info->info.flags));
+ d(printf ("Updating header for %s flags = %08x\n", info->info.uid, info->info.flags));
/* find the next message, header parts */
- camel_mime_parser_seek(mp, info->frompos, SEEK_SET);
- if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_FROM) {
- g_warning("camel_mime_parser_step failed (1)");
+ camel_mime_parser_seek (mp, info->frompos, SEEK_SET);
+ if (camel_mime_parser_step (mp, &buffer, &len) != HSCAN_FROM) {
+ g_warning ("camel_mime_parser_step failed (1)");
goto error;
}
- if (camel_mime_parser_tell_start_from(mp) != info->frompos) {
- g_warning("Summary/mbox mismatch, aborting sync");
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "Summary mismatch, aborting sync");
+ if (camel_mime_parser_tell_start_from (mp) != info->frompos) {
+ g_warning ("Summary/mbox mismatch, aborting sync");
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ "Summary mismatch, aborting sync");
goto error;
}
-
- if (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_FROM_END) {
- g_warning("camel_mime_parser_step failed (2)");
+
+ if (camel_mime_parser_step (mp, &buffer, &len) == HSCAN_FROM_END) {
+ g_warning ("camel_mime_parser_step failed (2)");
goto error;
}
/* Check if the X-Evolution header is valid. */
- xev = camel_mime_parser_header(mp, "X-Evolution", &xevoffset);
- if (xev && header_evolution_decode(xev, &uid, &flags) != -1)
+ xev = camel_mime_parser_header (mp, "X-Evolution", &xevoffset);
+ if (xev && header_evolution_decode (xev, &uid, &flags) != -1)
xevok = TRUE;
- xevnew = header_evolution_encode(strtoul(info->info.uid, NULL, 10), info->info.flags & 0xffff);
+ xevnew = header_evolution_encode (strtoul (info->info.uid, NULL, 10), info->info.flags & 0xffff);
if (quick) {
if (!xevok) {
- g_warning("The summary told me I had an X-Evolution header, but i dont!");
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- "Summary mismatch, X-Evolution header missing");
+ g_warning ("The summary told me I had an X-Evolution header, but i dont!");
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ "Summary mismatch, X-Evolution header missing");
goto error;
}
- buffer = g_strdup_printf("X-Evolution: %s", xevnew);
- lastpos = lseek(fd, 0, SEEK_CUR);
- lseek(fd, xevoffset, SEEK_SET);
+ buffer = g_strdup_printf ("X-Evolution: %s", xevnew);
+ lastpos = lseek (fd, 0, SEEK_CUR);
+ lseek (fd, xevoffset, SEEK_SET);
do {
- len = write(fd, buffer, strlen(buffer));
+ len = write (fd, buffer, strlen (buffer));
} while (len == -1 && errno == EINTR);
- lseek(fd, lastpos, SEEK_SET);
- g_free(buffer);
+ lseek (fd, lastpos, SEEK_SET);
+ g_free (buffer);
if (len == -1) {
- g_warning("Yahoo! len == -1");
+ g_warning ("Yahoo! len == -1");
goto error;
}
} else {
- frompos = lseek(fdout, 0, SEEK_CUR);
- fromline = camel_mbox_summary_build_from(camel_mime_parser_headers_raw(mp));
- write(fdout, fromline, strlen(fromline));
- g_free(fromline);
- if (header_write(fdout, camel_mime_parser_headers_raw(mp), xevnew) == -1) {
- d(printf("Error writing to tmp mailbox\n"));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- "Error writing to temp mailbox: %s", strerror(errno));
+ frompos = lseek (fdout, 0, SEEK_CUR);
+ fromline = camel_mbox_summary_build_from (camel_mime_parser_headers_raw (mp));
+ write (fdout, fromline, strlen(fromline));
+ g_free (fromline);
+ if (header_write (fdout, camel_mime_parser_headers_raw (mp), xevnew) == -1) {
+ d(printf ("Error writing to tmp mailbox\n"));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ "Error writing to temp mailbox: %s",
+ strerror (errno));
goto error;
}
- bodypos = lseek(fdout, 0, SEEK_CUR);
- d(printf("pos = %d, endpos = %d, bodypos = %d\n",
- (int)info->info.content->pos,
- (int)info->info.content->endpos,
- (int)info->info.content->bodypos));
- if (copy_block(fd, fdout, info->info.content->bodypos,
- info->info.content->endpos - info->info.content->bodypos) == -1) {
- g_warning("Cannot copy data to output fd");
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- "Cannot copy data to output fd: %s", strerror(errno));
+ bodypos = lseek (fdout, 0, SEEK_CUR);
+ d(printf ("pos = %d, endpos = %d, bodypos = %d\n",
+ (int) info->info.content->pos,
+ (int) info->info.content->endpos,
+ (int) info->info.content->bodypos));
+ if (copy_block (fd, fdout, info->info.content->bodypos,
+ info->info.content->endpos - info->info.content->bodypos) == -1) {
+ g_warning ("Cannot copy data to output fd");
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ "Cannot copy data to output fd: %s",
+ strerror (errno));
goto error;
}
info->frompos = frompos;
offset = bodypos - info->info.content->bodypos;
}
info->info.flags &= 0xffff;
- g_free(xevnew);
+ g_free (xevnew);
xevnew = NULL;
- camel_mime_parser_drop_step(mp);
- camel_mime_parser_drop_step(mp);
+ camel_mime_parser_drop_step (mp);
+ camel_mime_parser_drop_step (mp);
} else {
if (!quick) {
- if (copy_block(fd, fdout, info->frompos, info->info.content->endpos - info->frompos) == -1) {
- g_warning("Cannot copy data to output fd");
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- "Cannot copy data to output fd: %s", strerror(errno));
+ if (copy_block (fd, fdout, info->frompos,
+ info->info.content->endpos - info->frompos) == -1) {
+ g_warning ("Cannot copy data to output fd");
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ "Cannot copy data to output fd: %s",
+ strerror (errno));
goto error;
}
/* update from pos here? */
info->frompos += offset;
} else {
- d(printf("Nothing to do for this message\n"));
+ d(printf ("Nothing to do for this message\n"));
}
}
if (!quick && info != NULL && offset != 0) {
- d(printf("offsetting content: %d\n", (int)offset));
- camel_folder_summary_offset_content(info->info.content, offset);
- d(printf("pos = %d, endpos = %d, bodypos = %d\n",
- (int)info->info.content->pos,
- (int)info->info.content->endpos,
- (int)info->info.content->bodypos));
+ d(printf ("offsetting content: %d\n", (int) offset));
+ camel_folder_summary_offset_content (info->info.content, offset);
+ d(printf ("pos = %d, endpos = %d, bodypos = %d\n",
+ (int) info->info.content->pos,
+ (int) info->info.content->endpos,
+ (int) info->info.content->bodypos));
}
}
- d(printf("Closing folders\n"));
+ d(printf ("Closing folders\n"));
- if (close(fd) == -1) {
- g_warning("Cannot close source folder: %s", strerror(errno));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "Could not close source folder %s: %s",
- mbs->folder_path, strerror(errno));
+ if (close (fd) == -1) {
+ g_warning ("Cannot close source folder: %s", strerror (errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ "Could not close source folder %s: %s",
+ mbs->folder_path, strerror (errno));
goto error;
}
if (!quick) {
- if (close(fdout) == -1) {
- g_warning("Cannot close tmp folder: %s", strerror(errno));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "Could not close temp folder: %s",
- strerror(errno));
+ if (close (fdout) == -1) {
+ g_warning ("Cannot close tmp folder: %s", strerror (errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ "Could not close temp folder: %s",
+ strerror (errno));
goto error;
}
- if (rename(tmpname, mbs->folder_path) == -1) {
- g_warning("Cannot rename folder: %s", strerror(errno));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "Could not rename folder: %s",
- strerror(errno));
+ if (rename (tmpname, mbs->folder_path) == -1) {
+ g_warning ("Cannot rename folder: %s", strerror (errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ "Could not rename folder: %s",
+ strerror (errno));
goto error;
}
tmpname = NULL;
if (mbs->index)
- ibex_save(mbs->index);
+ ibex_save (mbs->index);
}
- if (stat(mbs->folder_path, &st) == -1) {
- g_warning("Hmm... stat(mbs->folder_path, &st) == -1");
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "Unknown error: %s", strerror(errno));
+ if (stat (mbs->folder_path, &st) == -1) {
+ g_warning ("Hmm... stat(mbs->folder_path, &st) == -1");
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ "Unknown error: %s",
+ strerror (errno));
goto error;
}
- camel_folder_summary_touch(s);
+ camel_folder_summary_touch (s);
s->time = st.st_mtime;
mbs->folder_size = st.st_size;
- camel_folder_summary_save(s);
-
- gtk_object_unref(GTK_OBJECT(mp));
+ camel_folder_summary_save (s);
+ camel_object_unref (CAMEL_OBJECT (mp));
+
return 0;
- error:
+ error:
if (fd != -1)
- close(fd);
-
+ close (fd);
+
if (fdout != -1)
- close(fdout);
-
- g_free(xevnew);
-
+ close (fdout);
+
+ g_free (xevnew);
+
if (tmpname)
- unlink(tmpname);
+ unlink (tmpname);
if (mp)
- gtk_object_unref(GTK_OBJECT(mp));
+ camel_object_unref (CAMEL_OBJECT (mp));
return -1;
}
+
+
+
+
+
diff --git a/camel/providers/mbox/camel-mbox-summary.h b/camel/providers/mbox/camel-mbox-summary.h
index b4e59fa343..2462b72078 100644
--- a/camel/providers/mbox/camel-mbox-summary.h
+++ b/camel/providers/mbox/camel-mbox-summary.h
@@ -22,14 +22,13 @@
#ifndef _CAMEL_MBOX_SUMMARY_H
#define _CAMEL_MBOX_SUMMARY_H
-#include <gtk/gtk.h>
#include <camel/camel-folder-summary.h>
#include <camel/camel-exception.h>
#include <libibex/ibex.h>
-#define CAMEL_MBOX_SUMMARY(obj) GTK_CHECK_CAST (obj, camel_mbox_summary_get_type (), CamelMboxSummary)
-#define CAMEL_MBOX_SUMMARY_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mbox_summary_get_type (), CamelMboxSummaryClass)
-#define IS_CAMEL_MBOX_SUMMARY(obj) GTK_CHECK_TYPE (obj, camel_mbox_summary_get_type ())
+#define CAMEL_MBOX_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_mbox_summary_get_type (), CamelMboxSummary)
+#define CAMEL_MBOX_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mbox_summary_get_type (), CamelMboxSummaryClass)
+#define IS_CAMEL_MBOX_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_mbox_summary_get_type ())
typedef struct _CamelMboxSummary CamelMboxSummary;
typedef struct _CamelMboxSummaryClass CamelMboxSummaryClass;