aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNotZed <NotZed@HelixCode.com>2000-05-26 05:40:58 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-05-26 05:40:58 +0800
commit1ead1f0174023636e3dc62f554f8c57749a8ec82 (patch)
tree72821cf8f129393d3598575b189e7a7dc42baa44
parent60f52f5eaedd302180188c671ab9298b23119930 (diff)
downloadgsoc2013-evolution-1ead1f0174023636e3dc62f554f8c57749a8ec82.tar
gsoc2013-evolution-1ead1f0174023636e3dc62f554f8c57749a8ec82.tar.gz
gsoc2013-evolution-1ead1f0174023636e3dc62f554f8c57749a8ec82.tar.bz2
gsoc2013-evolution-1ead1f0174023636e3dc62f554f8c57749a8ec82.tar.lz
gsoc2013-evolution-1ead1f0174023636e3dc62f554f8c57749a8ec82.tar.xz
gsoc2013-evolution-1ead1f0174023636e3dc62f554f8c57749a8ec82.tar.zst
gsoc2013-evolution-1ead1f0174023636e3dc62f554f8c57749a8ec82.zip
Removed camel-simple-data-wrapper again. Less code to maintain == better
2000-05-25 NotZed <NotZed@HelixCode.com> * Makefile.am (libcamel_la_SOURCES): Removed camel-simple-data-wrapper again. Less code to maintain == better code. * camel-data-wrapper.c (construct_from_stream): Fixes for bug where text attachments dont work. Made data-wrapper concrete for the second time. svn path=/trunk/; revision=3207
-rw-r--r--camel/ChangeLog15
-rw-r--r--camel/Makefile.am2
-rw-r--r--camel/camel-data-wrapper.c7
-rw-r--r--camel/camel-simple-data-wrapper.c141
-rw-r--r--camel/camel-simple-data-wrapper.h71
-rw-r--r--camel/camel.h1
-rw-r--r--camel/providers/vee/camel-vee-folder.c70
7 files changed, 91 insertions, 216 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index b4acfd3f45..70d0beffeb 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,18 @@
+2000-05-25 NotZed <NotZed@HelixCode.com>
+
+ * Makefile.am (libcamel_la_SOURCES): Removed
+ camel-simple-data-wrapper again. Less code to maintain == better
+ code.
+
+ * camel-data-wrapper.c (construct_from_stream): Fixes for bug
+ where text attachments dont work. Made data-wrapper concrete for
+ the second time.
+
+2000-05-23 NotZed <NotZed@HelixCode.com>
+
+ * providers/vee/camel-vee-folder.c (vee_folder_build_folder):
+ Update the vfolder details for a single folder.
+
2000-05-25 Jeffrey Stedfast <fejj@helixcode.com>
* providers/smtp/camel-smtp-transport.c (_send_to): Took out code
diff --git a/camel/Makefile.am b/camel/Makefile.am
index 80523b7ea4..84f1f0d8b7 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -33,7 +33,6 @@ libcamel_la_SOURCES = \
camel-seekable-substream.c \
camel-service.c \
camel-session.c \
- camel-simple-data-wrapper.c \
camel-store.c \
camel-stream.c \
camel-stream-buffer.c \
@@ -78,7 +77,6 @@ libcamelinclude_HEADERS = \
camel-seekable-substream.h \
camel-service.h \
camel-session.h \
- camel-simple-data-wrapper.h \
camel-store.h \
camel-stream.h \
camel-stream-buffer.h \
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
index fe9f8bf78b..86be8117bf 100644
--- a/camel/camel-data-wrapper.c
+++ b/camel/camel-data-wrapper.c
@@ -156,7 +156,12 @@ camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
static int
construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
{
- return -1;
+ if (data_wrapper->stream)
+ gtk_object_unref((GtkObject *)data_wrapper->stream);
+
+ data_wrapper->stream = stream;
+ gtk_object_ref (GTK_OBJECT (stream));
+ return 0;
}
/**
diff --git a/camel/camel-simple-data-wrapper.c b/camel/camel-simple-data-wrapper.c
deleted file mode 100644
index f091211e3c..0000000000
--- a/camel/camel-simple-data-wrapper.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-simple-data-wrapper.c: a simple stream-backed data wrapper */
-
-/*
- * Author:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel-simple-data-wrapper.h"
-#include "camel-exception.h"
-
-#include <errno.h>
-
-static CamelDataWrapperClass *parent_class = NULL;
-
-/* Returns the class for a CamelDataWrapper */
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT (so)->klass)
-
-
-static int construct_from_stream (CamelDataWrapper *, CamelStream *);
-static int write_to_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-
-static void finalize (GtkObject *object);
-
-static void
-camel_simple_data_wrapper_class_init (CamelSimpleDataWrapperClass *camel_simple_data_wrapper_class)
-{
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_simple_data_wrapper_class);
- CamelDataWrapperClass *camel_data_wrapper_class =
- CAMEL_DATA_WRAPPER_CLASS (camel_simple_data_wrapper_class);
-
- parent_class = gtk_type_class (camel_data_wrapper_get_type ());
-
- /* virtual method overload */
- camel_data_wrapper_class->write_to_stream = write_to_stream;
- camel_data_wrapper_class->construct_from_stream =
- construct_from_stream;
-
- gtk_object_class->finalize = finalize;
-}
-
-GtkType
-camel_simple_data_wrapper_get_type (void)
-{
- static GtkType camel_simple_data_wrapper_type = 0;
-
- if (!camel_simple_data_wrapper_type) {
- GtkTypeInfo camel_simple_data_wrapper_info =
- {
- "CamelSimpleDataWrapper",
- sizeof (CamelSimpleDataWrapper),
- sizeof (CamelSimpleDataWrapperClass),
- (GtkClassInitFunc) camel_simple_data_wrapper_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_simple_data_wrapper_type = gtk_type_unique (camel_data_wrapper_get_type (), &camel_simple_data_wrapper_info);
- }
-
- return camel_simple_data_wrapper_type;
-}
-
-
-static void
-finalize (GtkObject *object)
-{
- CamelSimpleDataWrapper *simple_data_wrapper =
- CAMEL_SIMPLE_DATA_WRAPPER (object);
-
- if (simple_data_wrapper->content)
- gtk_object_unref (GTK_OBJECT (simple_data_wrapper->content));
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/**
- * camel_simple_data_wrapper_new:
- *
- * Create a new camel data wrapper object.
- *
- * Return value:
- **/
-CamelDataWrapper *
-camel_simple_data_wrapper_new (void)
-{
- return gtk_type_new (camel_simple_data_wrapper_get_type ());
-}
-
-
-static int
-construct_from_stream (CamelDataWrapper *wrapper, CamelStream *stream)
-{
- CamelSimpleDataWrapper *simple_data_wrapper =
- CAMEL_SIMPLE_DATA_WRAPPER (wrapper);
-
- if (simple_data_wrapper->content)
- gtk_object_unref((GtkObject *)simple_data_wrapper->content);
-
- simple_data_wrapper->content = stream;
- gtk_object_ref (GTK_OBJECT (stream));
- return 0;
-}
-
-
-static int
-write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelSimpleDataWrapper *simple_data_wrapper =
- CAMEL_SIMPLE_DATA_WRAPPER (data_wrapper);
-
- if (simple_data_wrapper->content == NULL)
- return -1;
-
- if (camel_stream_reset (simple_data_wrapper->content) == -1)
- return -1;
-
- return camel_stream_write_to_stream (simple_data_wrapper->content, stream);
-}
diff --git a/camel/camel-simple-data-wrapper.h b/camel/camel-simple-data-wrapper.h
deleted file mode 100644
index 5346cd969d..0000000000
--- a/camel/camel-simple-data-wrapper.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-simple-data-wrapper.h: a simple stream-backed data wrapper */
-
-/*
- * Author:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_SIMPLE_DATA_WRAPPER_H
-#define CAMEL_SIMPLE_DATA_WRAPPER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-data-wrapper.h>
-
-#define CAMEL_SIMPLE_DATA_WRAPPER_TYPE (camel_data_wrapper_get_type ())
-#define CAMEL_SIMPLE_DATA_WRAPPER(obj) (GTK_CHECK_CAST((obj), CAMEL_SIMPLE_DATA_WRAPPER_TYPE, CamelSimpleDataWrapper))
-#define CAMEL_SIMPLE_DATA_WRAPPER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SIMPLE_DATA_WRAPPER_TYPE, CamelSimpleDataWrapperClass))
-#define CAMEL_IS_SIMPLE_DATA_WRAPPER(o) (GTK_CHECK_TYPE((o), CAMEL_SIMPLE_DATA_WRAPPER_TYPE))
-
-
-struct _CamelSimpleDataWrapper
-{
- CamelDataWrapper parent_object;
-
- CamelStream *content;
-};
-
-
-typedef struct {
- CamelDataWrapperClass parent_class;
-
-} CamelSimpleDataWrapperClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_simple_data_wrapper_get_type (void);
-
-
-/* convenience functions */
-CamelDataWrapper *camel_simple_data_wrapper_new (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SIMPLE_DATA_WRAPPER_H */
diff --git a/camel/camel.h b/camel/camel.h
index ac314ac656..d3a65b1312 100644
--- a/camel/camel.h
+++ b/camel/camel.h
@@ -54,7 +54,6 @@ extern "C" {
#include <camel/camel-seekable-substream.h>
#include <camel/camel-service.h>
#include <camel/camel-session.h>
-#include <camel/camel-simple-data-wrapper.h>
#include <camel/camel-store.h>
#include <camel/camel-stream-buffer.h>
#include <camel/camel-stream-filter.h>
diff --git a/camel/providers/vee/camel-vee-folder.c b/camel/providers/vee/camel-vee-folder.c
index 3d4050cf19..25922ed13f 100644
--- a/camel/providers/vee/camel-vee-folder.c
+++ b/camel/providers/vee/camel-vee-folder.c
@@ -365,6 +365,7 @@ vee_folder_build(CamelVeeFolder *vf, CamelException *ex)
g_free(mi->info.from);
g_free(mi->info.uid);
camel_flag_list_free(&mi->info.user_flags);
+ g_free(mi);
}
}
@@ -416,6 +417,75 @@ vee_folder_build(CamelVeeFolder *vf, CamelException *ex)
}
+/* build query contents for a single folder */
+static void
+vee_folder_build_folder(CamelVeeFolder *vf, CamelFolder *source, CamelException *ex)
+{
+ struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
+ GList *node;
+
+ GList *matches, *match;
+ CamelFolder *f = source;
+ CamelVeeMessageInfo *mi;
+ const CamelMessageInfo *info;
+ CamelFlag *flag;
+
+ GPtrArray *messages;
+ GHashTable *messages_uid;
+
+ {
+ int i;
+
+ for (i=0;i<vf->messages->len;i++) {
+ CamelVeeMessageInfo *mi = g_ptr_array_index(vf->messages, i);
+ if (mi->folder == source) {
+ g_hash_table_remove(vf->messages_uid, mi->info.uid);
+ g_ptr_array_remove_index_fast(vf->messages, i);
+
+ g_free(mi->info.subject);
+ g_free(mi->info.to);
+ g_free(mi->info.from);
+ g_free(mi->info.uid);
+ camel_flag_list_free(&mi->info.user_flags);
+ g_free(mi);
+ i--;
+ }
+ }
+ }
+
+ messages = vf->messages;
+ messages_uid = vf->messages_uid;
+
+ matches = camel_folder_search_by_expression(f, vf->expression, ex);
+ match = matches;
+ while (match) {
+ info = camel_folder_summary_get_by_uid(f, match->data);
+ if (info) {
+ mi = g_malloc0(sizeof(*mi));
+ mi->info.subject = g_strdup(info->subject);
+ mi->info.to = g_strdup(info->to);
+ mi->info.from = g_strdup(info->from);
+ mi->info.uid = g_strdup_printf("%p:%s", f, info->uid);
+ mi->info.flags = info->flags;
+ mi->info.size = info->size;
+ mi->info.date_sent = info->date_sent;
+ mi->info.date_received = info->date_received;
+ flag = info->user_flags;
+ while (flag) {
+ camel_flag_set(&mi->info.user_flags, flag->name, TRUE);
+ flag = flag->next;
+ }
+ mi->info.content = NULL;
+ mi->folder = f;
+ g_ptr_array_add(messages, mi);
+ g_hash_table_insert(messages_uid, mi->info.uid, mi);
+ }
+ match = g_list_next(match);
+ }
+ g_list_free(matches);
+}
+
+
/*
(match-folder "folder1" "folder2")