aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authornobody <nobody@localhost>2000-02-17 07:51:01 +0800
committernobody <nobody@localhost>2000-02-17 07:51:01 +0800
commit2b80feefead30f2b24a3c51c4b52373c5faacbac (patch)
tree646d019769a1d66081bd13dc9cab96c4417d8843 /camel
parent5a80143a526ddc84b31e8458c525d40580c06810 (diff)
downloadgsoc2013-evolution-2b80feefead30f2b24a3c51c4b52373c5faacbac.tar
gsoc2013-evolution-2b80feefead30f2b24a3c51c4b52373c5faacbac.tar.gz
gsoc2013-evolution-2b80feefead30f2b24a3c51c4b52373c5faacbac.tar.bz2
gsoc2013-evolution-2b80feefead30f2b24a3c51c4b52373c5faacbac.tar.lz
gsoc2013-evolution-2b80feefead30f2b24a3c51c4b52373c5faacbac.tar.xz
gsoc2013-evolution-2b80feefead30f2b24a3c51c4b52373c5faacbac.tar.zst
gsoc2013-evolution-2b80feefead30f2b24a3c51c4b52373c5faacbac.zip
This commit was manufactured by cvs2svn to create tagGNOME_CORE_1_1_4
'GNOME_CORE_1_1_4'. svn path=/tags/GNOME_CORE_1_1_4/; revision=1807
Diffstat (limited to 'camel')
-rw-r--r--camel/.cvsignore7
-rw-r--r--camel/CODING.STYLE19
-rw-r--r--camel/Makefile.am125
-rw-r--r--camel/README57
-rw-r--r--camel/README.COPYRIGHT47
-rw-r--r--camel/README.HACKING14
-rw-r--r--camel/camel-arg-collector.c186
-rw-r--r--camel/camel-data-wrapper.c338
-rw-r--r--camel/camel-data-wrapper.h126
-rw-r--r--camel/camel-exception-list.def19
-rw-r--r--camel/camel-exception.c257
-rw-r--r--camel/camel-exception.h88
-rw-r--r--camel/camel-folder-pt-proxy.c820
-rw-r--r--camel/camel-folder-pt-proxy.h92
-rw-r--r--camel/camel-folder-summary.c162
-rw-r--r--camel/camel-folder-summary.h112
-rw-r--r--camel/camel-folder-utils.c101
-rw-r--r--camel/camel-folder-utils.h44
-rw-r--r--camel/camel-folder.c1845
-rw-r--r--camel/camel-folder.h299
-rw-r--r--camel/camel-formatter.c901
-rw-r--r--camel/camel-formatter.h75
-rw-r--r--camel/camel-log.c45
-rw-r--r--camel/camel-log.h78
-rw-r--r--camel/camel-marshal-utils.c374
-rw-r--r--camel/camel-marshal-utils.h102
-rw-r--r--camel/camel-medium.c257
-rw-r--r--camel/camel-medium.h94
-rw-r--r--camel/camel-mime-body-part.c128
-rw-r--r--camel/camel-mime-body-part.h87
-rw-r--r--camel/camel-mime-message.c717
-rw-r--r--camel/camel-mime-message.h143
-rw-r--r--camel/camel-mime-part-utils.c191
-rw-r--r--camel/camel-mime-part-utils.h54
-rw-r--r--camel/camel-mime-part.c913
-rw-r--r--camel/camel-mime-part.h155
-rw-r--r--camel/camel-multipart.c565
-rw-r--r--camel/camel-multipart.h116
-rw-r--r--camel/camel-op-queue.c187
-rw-r--r--camel/camel-op-queue.h64
-rw-r--r--camel/camel-provider.c187
-rw-r--r--camel/camel-provider.h67
-rw-r--r--camel/camel-recipient.c279
-rw-r--r--camel/camel-recipient.h87
-rw-r--r--camel/camel-seekable-stream.c132
-rw-r--r--camel/camel-seekable-stream.h92
-rw-r--r--camel/camel-seekable-substream.c460
-rw-r--r--camel/camel-seekable-substream.h95
-rw-r--r--camel/camel-service.c297
-rw-r--r--camel/camel-service.h85
-rw-r--r--camel/camel-session.c217
-rw-r--r--camel/camel-session.h87
-rw-r--r--camel/camel-simple-data-wrapper-stream.c298
-rw-r--r--camel/camel-simple-data-wrapper-stream.h76
-rw-r--r--camel/camel-simple-data-wrapper.c230
-rw-r--r--camel/camel-simple-data-wrapper.h82
-rw-r--r--camel/camel-store.c275
-rw-r--r--camel/camel-store.h99
-rw-r--r--camel/camel-stream-buffered-fs.c265
-rw-r--r--camel/camel-stream-buffered-fs.h91
-rw-r--r--camel/camel-stream-data-wrapper.c209
-rw-r--r--camel/camel-stream-data-wrapper.h75
-rw-r--r--camel/camel-stream-fs.c548
-rw-r--r--camel/camel-stream-fs.h113
-rw-r--r--camel/camel-stream-mem.c288
-rw-r--r--camel/camel-stream-mem.h90
-rw-r--r--camel/camel-stream.c224
-rw-r--r--camel/camel-stream.h105
-rw-r--r--camel/camel-thread-proxy.c565
-rw-r--r--camel/camel-thread-proxy.h90
-rw-r--r--camel/camel.c43
-rw-r--r--camel/camel.h71
-rw-r--r--camel/data-wrapper-repository.c135
-rw-r--r--camel/data-wrapper-repository.h55
-rw-r--r--camel/gmime-base64.c101
-rw-r--r--camel/gmime-base64.h16
-rw-r--r--camel/gmime-content-field.c382
-rw-r--r--camel/gmime-content-field.h67
-rw-r--r--camel/gmime-rfc2047.c491
-rw-r--r--camel/gmime-rfc2047.h52
-rw-r--r--camel/gmime-utils.c293
-rw-r--r--camel/gmime-utils.h70
-rw-r--r--camel/gstring-util.c345
-rw-r--r--camel/gstring-util.h77
-rw-r--r--camel/hash-table-utils.c80
-rw-r--r--camel/hash-table-utils.h46
-rw-r--r--camel/md5-utils.c391
-rw-r--r--camel/md5-utils.h54
-rw-r--r--camel/providers/.cvsignore2
-rw-r--r--camel/providers/MH/.cvsignore6
-rw-r--r--camel/providers/MH/Makefile.am33
-rw-r--r--camel/providers/MH/camel-mh-folder.c1022
-rw-r--r--camel/providers/MH/camel-mh-folder.h72
-rw-r--r--camel/providers/MH/camel-mh-provider.c46
-rw-r--r--camel/providers/MH/camel-mh-store.c153
-rw-r--r--camel/providers/MH/camel-mh-store.h72
-rw-r--r--camel/providers/MH/mh-summary.c290
-rw-r--r--camel/providers/MH/mh-summary.h33
-rw-r--r--camel/providers/MH/mh-uid.c220
-rw-r--r--camel/providers/MH/mh-uid.h40
-rw-r--r--camel/providers/MH/mh-utils.c50
-rw-r--r--camel/providers/MH/mh-utils.h30
-rw-r--r--camel/providers/Makefile.am5
-rw-r--r--camel/providers/maildir/.cvsignore6
-rw-r--r--camel/providers/maildir/Makefile.am23
-rw-r--r--camel/providers/maildir/camel-maildir-folder.c803
-rw-r--r--camel/providers/maildir/camel-maildir-folder.h66
-rw-r--r--camel/providers/maildir/camel-maildir-provider.c46
-rw-r--r--camel/providers/maildir/camel-maildir-store.c124
-rw-r--r--camel/providers/maildir/camel-maildir-store.h69
-rw-r--r--camel/providers/mbox/.cvsignore7
-rw-r--r--camel/providers/mbox/Makefile.am38
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c1131
-rw-r--r--camel/providers/mbox/camel-mbox-folder.h83
-rw-r--r--camel/providers/mbox/camel-mbox-parser.c901
-rw-r--r--camel/providers/mbox/camel-mbox-parser.h66
-rw-r--r--camel/providers/mbox/camel-mbox-provider.c49
-rw-r--r--camel/providers/mbox/camel-mbox-search.c857
-rw-r--r--camel/providers/mbox/camel-mbox-search.h10
-rw-r--r--camel/providers/mbox/camel-mbox-store.c153
-rw-r--r--camel/providers/mbox/camel-mbox-store.h72
-rw-r--r--camel/providers/mbox/camel-mbox-summary.c305
-rw-r--r--camel/providers/mbox/camel-mbox-summary.h81
-rw-r--r--camel/providers/mbox/camel-mbox-utils.c385
-rw-r--r--camel/providers/mbox/camel-mbox-utils.h69
-rw-r--r--camel/string-utils.c313
-rw-r--r--camel/string-utils.h78
-rw-r--r--camel/url-util.c146
-rw-r--r--camel/url-util.h61
129 files changed, 0 insertions, 26597 deletions
diff --git a/camel/.cvsignore b/camel/.cvsignore
deleted file mode 100644
index fd6b811c68..0000000000
--- a/camel/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
diff --git a/camel/CODING.STYLE b/camel/CODING.STYLE
deleted file mode 100644
index a236f0060f..0000000000
--- a/camel/CODING.STYLE
+++ /dev/null
@@ -1,19 +0,0 @@
-Note to hackers
----------------
-
-When hacking on camel (and on the gnome mailer in general),
-be sure to follow the same coding style as the intial authors.
-Please read the file HACKING in gnumeric and follow the
-general guidelines explained in it.
-
-Please take a look at camel source files and try to exactly
-imitate the coding style. We are perfectly aware that this
-is not the best and unique style, but it is absolutely
-mandatory that Camel is homogeneous. If you find the current
-coding style to have some weaknesses, please contact the
-authors to discuss this matter.
-
-Thanks.
-
- Bertrand.
-
diff --git a/camel/Makefile.am b/camel/Makefile.am
deleted file mode 100644
index cff67fc736..0000000000
--- a/camel/Makefile.am
+++ /dev/null
@@ -1,125 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS = providers
-
-libcamelincludedir = $(includedir)/camel
-
-
-lib_LTLIBRARIES = libcamel.la
-
-INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \
- -I$(top_srcdir)/intl \
- $(GTK_INCLUDEDIR)
-
-
-if ENABLE_THREADS
-
-pthread_SRC = \
- camel-folder-pt-proxy.c \
- camel-thread-proxy.c
-
-pthread_HDR = \
- camel-folder-pt-proxy.h \
- camel-thread-proxy.h
-
-else
-
-libcamel_pthread_SRC =
-libcamel_pthread_HDR=
-
-endif
-
-
-libcamel_la_SOURCES = \
- camel.c \
- camel-log.c \
- camel-data-wrapper.c \
- camel-exception.c \
- camel-simple-data-wrapper.c \
- camel-simple-data-wrapper-stream.c \
- camel-stream-data-wrapper.c \
- camel-folder.c \
- camel-folder-summary.c \
- camel-folder-utils.c \
- camel-formatter.c \
- camel-medium.c \
- camel-marshal-utils.c \
- camel-mime-body-part.c \
- camel-mime-message.c \
- camel-mime-part.c \
- camel-mime-part-utils.c \
- camel-multipart.c \
- camel-op-queue.c \
- camel-provider.c \
- camel-recipient.c \
- camel-seekable-stream.c \
- camel-seekable-substream.c \
- camel-service.c \
- camel-session.c \
- camel-store.c \
- camel-stream.c \
- camel-stream-buffered-fs.c \
- camel-stream-fs.c \
- camel-stream-mem.c \
- data-wrapper-repository.c \
- gmime-base64.c \
- gmime-content-field.c \
- gmime-utils.c \
- gstring-util.c \
- hash-table-utils.c \
- md5-utils.c \
- string-utils.c \
- url-util.c \
- $(pthread_SRC)
-
-libcamelinclude_HEADERS = \
- camel.h \
- camel-log.h \
- camel-data-wrapper.h \
- camel-exception.h \
- camel-simple-data-wrapper.h \
- camel-simple-data-wrapper-stream.h \
- camel-stream-data-wrapper.h \
- camel-folder.h \
- camel-folder-summary.h \
- camel-folder-utils.h \
- camel-formatter.h \
- camel-mime-body-part.h \
- camel-marshal-utils.h \
- camel-medium.h \
- camel-mime-message.h \
- camel-mime-part.h \
- camel-mime-part-utils.h \
- camel-multipart.h \
- camel-op-queue.h \
- camel-provider.h \
- camel-recipient.h \
- camel-seekable-stream.h \
- camel-seekable-substream.h \
- camel-service.h \
- camel-session.h \
- camel-store.h \
- camel-stream.h \
- camel-stream-buffered-fs.h \
- camel-stream-fs.h \
- camel-stream-mem.h \
- data-wrapper-repository.h \
- gmime-base64.h \
- gmime-content-field.h \
- gmime-utils.h \
- gstring-util.h \
- hash-table-utils.h \
- md5-utils.h \
- string-utils.h \
- url-util.h \
- camel-exception-list.def \
- $(pthread_HDR)
-
-libcamel_extra_sources = \
- camel-arg-collector.c
-
-libcamel_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-EXTRA_DIST = \
- $(libcamel_extra_sources) \
- README
diff --git a/camel/README b/camel/README
deleted file mode 100644
index f020174d5e..0000000000
--- a/camel/README
+++ /dev/null
@@ -1,57 +0,0 @@
-
- CAMEL
-
-
- A generic Messaging Library
-
-
- ----
-
-
-Introduction:
--------------
-
-Camel will be a generic messaging library. It will evntually support
-the standard messaging system for receiving and sending messages.
-It aims at being the backend for the future gnome-mailer system.
-
-The name "camel" stands for ... nothing. Open area of development there.
-You know, that "bazaar" thing. Maybe could we organize a big contest on
-gnome-list to find the best explanation :)
-
-Camel draws heavily from JavaMail and the IMAP4rev1 RFC. People
-wanting to hack on a provider should read the JavaMail API
-specification, but CMC and MAPI are of interest too.
-
-Please, before starting anything, wait for me to finish the abstract
-classes. Some parts are not definitive yet.
-
-
-Organization:
--------------
-
-The library is roughly a set of abstract classes, some kind of generic
-"interfaces" (idl interfaces, not java interfaces ).
-
-Particular implementations are called providers.
-
-Here are the basic objects:
-
-* CamelService : an abstract class representing an access to a server.
-Handles the connection and authentication to any server.
-
-* CamelStore (CamelService): A hierarchy of folders on a server.
-
-* CamelFolder : An object containing messages. A folder is always
-associated with a store.
-
-* CamelMessage : An object contained in folders. Is defined by a set
-of attributes and a content. (Attributes include: the date it was
-received, the sender address, .....)
-
-* CamelTransport (CamelService): A way to send messages.
-
-....
-...
-
-
diff --git a/camel/README.COPYRIGHT b/camel/README.COPYRIGHT
deleted file mode 100644
index 307013bedc..0000000000
--- a/camel/README.COPYRIGHT
+++ /dev/null
@@ -1,47 +0,0 @@
-Important note for Camel hackers:
----------------------------------
-
-Camel has been a lot of work, and has been conceived to be general
-enough to be used outside the gnome-mailer. It is possible in the
-future that it is used in softwares with licenses incompatible with the
-LGPL. For this reason, the copyright has to be owned by a unique
-person. Be sure, however, that Camel will always be available under
-the LGPL. Significant authors will always be consulted before any
-special use of Camel. Moreover, in special situations, they may be
-given the authorization to use Camel with a license different than the
-LGPL.
-
-Thus, when adding code in Camel, always add the following lines at the
-begining of the file:
-
-/*
- *
- * Copyright 199x, 200x HelixCode (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
- */
-
-You may also want to add your name to the author name list after this
-header.
-
-Please contact me (Bertrand.Guiheneuf@aful.org) if you want to discuss
-this copyright issue.
-
-Happy hacking,
-
-Bertrand.
-
-
diff --git a/camel/README.HACKING b/camel/README.HACKING
deleted file mode 100644
index a4742ee7b8..0000000000
--- a/camel/README.HACKING
+++ /dev/null
@@ -1,14 +0,0 @@
-You want to hack on Camel ?
-
-Thanks. Camel aims at being the best messaging
-library for Linux and your help is welcome.
-Please be sure to read the following files before
-commiting any change or sending any patch:
-
-CODING.STYLE
-README.COPYRIGHT
-
-
-Thanks.
-
- Bertrand <Bertrand.Guiheneuf@aful.org> \ No newline at end of file
diff --git a/camel/camel-arg-collector.c b/camel/camel-arg-collector.c
deleted file mode 100644
index 44b9e2d99b..0000000000
--- a/camel/camel-arg-collector.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-/*
- * included in camel because it is not exported
- * by gtk
- *
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- */
-
-/* collect a single argument value from a va_list.
- * this is implemented as a huge macro <shrug>, because we can't
- * pass va_list variables by reference on some systems.
- * the corresponding prototype would be:
- * static inline gchar*
- * gtk_arg_collect_value (GtkArg *arg,
- * va_list var_args);
- */
-#define CAMEL_ARG_COLLECT_VALUE(arg, var_args, _error) \
-G_STMT_START { \
- gchar *error_msg; \
- GtkType fundamental_type; \
- \
- fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type); \
- if (fundamental_type > GTK_TYPE_FUNDAMENTAL_LAST) \
- { \
- fundamental_type = gtk_type_get_varargs_type (fundamental_type); \
- if (!fundamental_type) \
- fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type); \
- } \
- \
- error_msg = NULL; \
- switch (fundamental_type) \
- { \
- case GTK_TYPE_INVALID: \
- error_msg = g_strdup ("invalid untyped argument"); \
- break; \
- \
- case GTK_TYPE_NONE: \
- /* we just ignore this type, since it arithmetically just requires \
- * us to not move the var_args pointer any further. callers need to \
- * check for the validity of GTK_TYPE_NONE themselves. \
- * \
- * error_msg = g_strdup ("invalid argument type `void'"); \
- */ \
- break; \
- \
- /* everything smaller than an int is guarranteed to be \
- * passed as an int \
- */ \
- case GTK_TYPE_CHAR: \
- GTK_VALUE_CHAR (*arg) = va_arg (var_args, gint); \
- break; \
- case GTK_TYPE_UCHAR: \
- GTK_VALUE_UCHAR (*arg) = va_arg (var_args, guint); \
- break; \
- case GTK_TYPE_BOOL: \
- GTK_VALUE_BOOL (*arg) = va_arg (var_args, gint); \
- break; \
- case GTK_TYPE_INT: \
- GTK_VALUE_INT (*arg) = va_arg (var_args, gint); \
- break; \
- case GTK_TYPE_UINT: \
- GTK_VALUE_UINT (*arg) = va_arg (var_args, guint); \
- break; \
- case GTK_TYPE_ENUM: \
- GTK_VALUE_ENUM (*arg) = va_arg (var_args, gint); \
- break; \
- case GTK_TYPE_FLAGS: \
- GTK_VALUE_FLAGS (*arg) = va_arg (var_args, guint); \
- break; \
- \
- /* we collect longs as glongs since they differ in size with \
- * integers on some platforms \
- */ \
- case GTK_TYPE_LONG: \
- GTK_VALUE_LONG (*arg) = va_arg (var_args, glong); \
- break; \
- case GTK_TYPE_ULONG: \
- GTK_VALUE_ULONG (*arg) = va_arg (var_args, gulong); \
- break; \
- \
- /* floats are always passed as doubles \
- */ \
- case GTK_TYPE_FLOAT: \
- /* GTK_VALUE_FLOAT (*arg) = va_arg (var_args, gfloat); */ \
- GTK_VALUE_FLOAT (*arg) = va_arg (var_args, gdouble); \
- break; \
- case GTK_TYPE_DOUBLE: \
- GTK_VALUE_DOUBLE (*arg) = va_arg (var_args, gdouble); \
- break; \
- \
- /* collect pointer values \
- */ \
- case GTK_TYPE_STRING: \
- GTK_VALUE_STRING (*arg) = va_arg (var_args, gchar*); \
- break; \
- case GTK_TYPE_POINTER: \
- GTK_VALUE_POINTER (*arg) = va_arg (var_args, gpointer); \
- break; \
- case GTK_TYPE_BOXED: \
- GTK_VALUE_BOXED (*arg) = va_arg (var_args, gpointer); \
- break; \
- \
- /* structured types \
- */ \
- case GTK_TYPE_SIGNAL: \
- GTK_VALUE_SIGNAL (*arg).f = va_arg (var_args, GtkSignalFunc); \
- GTK_VALUE_SIGNAL (*arg).d = va_arg (var_args, gpointer); \
- break; \
- case GTK_TYPE_ARGS: \
- GTK_VALUE_ARGS (*arg).n_args = va_arg (var_args, gint); \
- GTK_VALUE_ARGS (*arg).args = va_arg (var_args, GtkArg*); \
- break; \
- case GTK_TYPE_FOREIGN: \
- GTK_VALUE_FOREIGN (*arg).data = va_arg (var_args, gpointer); \
- GTK_VALUE_FOREIGN (*arg).notify = va_arg (var_args, GtkDestroyNotify); \
- break; \
- case GTK_TYPE_CALLBACK: \
- GTK_VALUE_CALLBACK (*arg).marshal = va_arg (var_args, GtkCallbackMarshal); \
- GTK_VALUE_CALLBACK (*arg).data = va_arg (var_args, gpointer); \
- GTK_VALUE_CALLBACK (*arg).notify = va_arg (var_args, GtkDestroyNotify); \
- break; \
- case GTK_TYPE_C_CALLBACK: \
- GTK_VALUE_C_CALLBACK (*arg).func = va_arg (var_args, GtkFunction); \
- GTK_VALUE_C_CALLBACK (*arg).func_data = va_arg (var_args, gpointer); \
- break; \
- \
- /* we do some extra sanity checking when collecting objects, \
- * i.e. if the object pointer is not NULL, we check whether we \
- * actually got an object pointer within the desired class branch. \
- */ \
- case GTK_TYPE_OBJECT: \
- GTK_VALUE_OBJECT (*arg) = va_arg (var_args, GtkObject*); \
- if (GTK_VALUE_OBJECT (*arg) != NULL) \
- { \
- register GtkObject *object = GTK_VALUE_OBJECT (*arg); \
- \
- if (object->klass == NULL) \
- error_msg = g_strconcat ("invalid unclassed object pointer for argument type `", \
- gtk_type_name (arg->type), \
- "'", \
- NULL); \
- else if (!gtk_type_is_a (GTK_OBJECT_TYPE (object), arg->type)) \
- error_msg = g_strconcat ("invalid object `", \
- gtk_type_name (GTK_OBJECT_TYPE (object)), \
- "' for argument type `", \
- gtk_type_name (arg->type), \
- "'", \
- NULL); \
- } \
- break; \
- \
- default: \
- error_msg = g_strconcat ("unsupported argument type `", \
- gtk_type_name (arg->type), \
- "'", \
- NULL); \
- break; \
- } \
- \
- _error = error_msg; /* return error_msg; */ \
-} G_STMT_END
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
deleted file mode 100644
index 1ec70c6b37..0000000000
--- a/camel/camel-data-wrapper.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelDataWrapper.c : Abstract class for a data_wrapper */
-
-/** THIS IS MOSTLY AN ABSTRACT CLASS THAT SHOULD HAVE BEEN AN
- INTERFACE. **/
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-data-wrapper.h"
-#include "camel-log.h"
-
-static GtkObjectClass *parent_class=NULL;
-
-/* Returns the class for a CamelDataWrapper */
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void _set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static CamelStream *_get_input_stream (CamelDataWrapper *data_wrapper);
-static void _set_output_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static CamelStream *_get_output_stream (CamelDataWrapper *data_wrapper);
-
-static void _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static void _set_mime_type (CamelDataWrapper *data_wrapper, const gchar *mime_type);
-static gchar *_get_mime_type (CamelDataWrapper *data_wrapper);
-static GMimeContentField *_get_mime_type_field (CamelDataWrapper *data_wrapper);
-static void _set_mime_type_field (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type);
-static CamelStream *_get_stream (CamelDataWrapper *data_wrapper);
-static void _finalize (GtkObject *object);
-
-static void
-camel_data_wrapper_class_init (CamelDataWrapperClass *camel_data_wrapper_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_data_wrapper_class);
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
- camel_data_wrapper_class->write_to_stream = _write_to_stream;
- camel_data_wrapper_class->construct_from_stream = _construct_from_stream;
- camel_data_wrapper_class->set_mime_type = _set_mime_type;
- camel_data_wrapper_class->get_mime_type = _get_mime_type;
- camel_data_wrapper_class->get_mime_type_field = _get_mime_type_field;
- camel_data_wrapper_class->set_mime_type_field = _set_mime_type_field;
- camel_data_wrapper_class->get_stream = _get_stream;
-
- camel_data_wrapper_class->set_input_stream = _set_input_stream;
- camel_data_wrapper_class->get_input_stream = _get_input_stream;
- camel_data_wrapper_class->set_output_stream = _set_output_stream;
- camel_data_wrapper_class->get_output_stream = _get_output_stream;
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-}
-
-
-
-
-
-static void
-camel_data_wrapper_init (gpointer object, gpointer klass)
-{
- CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object);
-
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_init:: Entering\n");
- camel_data_wrapper->mime_type = gmime_content_field_new (NULL, NULL);
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_init:: Leaving\n");
-}
-
-
-
-GtkType
-camel_data_wrapper_get_type (void)
-{
- static GtkType camel_data_wrapper_type = 0;
-
- if (!camel_data_wrapper_type) {
- GtkTypeInfo camel_data_wrapper_info =
- {
- "CamelDataWrapper",
- sizeof (CamelDataWrapper),
- sizeof (CamelDataWrapperClass),
- (GtkClassInitFunc) camel_data_wrapper_class_init,
- (GtkObjectInitFunc) camel_data_wrapper_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_data_wrapper_type = gtk_type_unique (gtk_object_get_type (), &camel_data_wrapper_info);
- }
-
- return camel_data_wrapper_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelDataWrapper::finalize\n");
- CAMEL_LOG_FULL_DEBUG ("CamelDataWrapper::finalize, finalizing object %p\n", object);
- if (camel_data_wrapper->mime_type)
- gmime_content_field_unref (camel_data_wrapper->mime_type);
-
- parent_class->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelDataWrapper::finalize\n");
-}
-
-
-
-
-
-
-static void
-_set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- g_assert (data_wrapper);
- data_wrapper->input_stream = stream;
-}
-
-
-void
-camel_data_wrapper_set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- g_assert (data_wrapper);
- CDW_CLASS(data_wrapper)->set_input_stream (data_wrapper, stream);
-}
-
-
-
-
-
-static CamelStream *
-_get_input_stream (CamelDataWrapper *data_wrapper)
-{
- g_assert (data_wrapper);
- return (data_wrapper->input_stream);
-}
-
-CamelStream *
-camel_data_wrapper_get_input_stream (CamelDataWrapper *data_wrapper)
-{
- g_assert (data_wrapper);
- return CDW_CLASS(data_wrapper)->get_input_stream (data_wrapper);
-}
-
-
-
-
-static void
-_set_output_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- g_assert (data_wrapper);
- data_wrapper->output_stream = stream;
-}
-
-void
-camel_data_wrapper_set_output_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- g_assert (data_wrapper);
- CDW_CLASS(data_wrapper)->set_output_stream (data_wrapper, stream);
-}
-
-
-
-
-static CamelStream *
-_get_output_stream (CamelDataWrapper *data_wrapper)
-{
- g_assert (data_wrapper);
- return (data_wrapper->output_stream);
-}
-
-CamelStream *
-camel_data_wrapper_get_output_stream (CamelDataWrapper *data_wrapper)
-{
- g_assert (data_wrapper);
- return CDW_CLASS(data_wrapper)->get_output_stream (data_wrapper);
-}
-
-
-
-
-
-/**
- * _write_to_stream: write data content in a byte stream
- * @data_wrapper: the data wrapper object
- * @stream byte stream where data will be written
- *
- * This method must be overriden by subclasses
- * Data must be written in the bytes stream
- * in a architecture independant fashion.
- * If data is a standard data (for example an jpg image)
- * it must be serialized in the strea exactly as it
- * would be saved on disk. A simple dump of the stream in
- * a file should be sufficient for the data to be
- * re-read by a foreign application.
- *
- **/
-static void
-_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- /* nothing */
-}
-
-
-/**
- * camel_data_wrapper_write_to_stream: write data in a stream
- * @data_wrapper: the data wrapper object
- * @stream: byte stream where data will be written
- *
- * Write data content in a stream. Data is stored in a machine
- * independant format.
- *
- **/
-void
-camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_write_to_stream:: Entering\n");
- CDW_CLASS(data_wrapper)->write_to_stream (data_wrapper, stream);
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_write_to_stream:: Leaving\n");
-}
-
-
-
-
-
-
-static void
-_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- /* nothing */
-}
-
-void
-camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_construct_from_stream:: Entering\n");
- CDW_CLASS(data_wrapper)->construct_from_stream (data_wrapper, stream);
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_construct_from_stream:: Leaving\n");
-}
-
-
-
-static void
-_set_mime_type (CamelDataWrapper *data_wrapper, const gchar *mime_type)
-{
- CAMEL_LOG_FULL_DEBUG ( "CamelDataWrapper::set_mime_type Entering\n");
- g_assert (mime_type);
- gmime_content_field_construct_from_string (data_wrapper->mime_type, mime_type);
- CAMEL_LOG_FULL_DEBUG ( "CamelDataWrapper::set_mime_type Leaving\n");
-}
-
-void
-camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper, const gchar *mime_type)
-{
- CDW_CLASS(data_wrapper)->set_mime_type (data_wrapper, mime_type);
-}
-
-static gchar *
-_get_mime_type (CamelDataWrapper *data_wrapper)
-{
- gchar *mime_type;
-
- mime_type = gmime_content_field_get_mime_type (data_wrapper->mime_type);
- return mime_type;
-}
-
-gchar *
-camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper)
-{
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_get_mime_type:: Entering before returning\n");
- return CDW_CLASS(data_wrapper)->get_mime_type (data_wrapper);
-}
-
-
-static GMimeContentField *
-_get_mime_type_field (CamelDataWrapper *data_wrapper)
-{
- return data_wrapper->mime_type;
-}
-
-GMimeContentField *
-camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper)
-{
- return CDW_CLASS(data_wrapper)->get_mime_type_field (data_wrapper);
-}
-
-
-static void
-_set_mime_type_field (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type)
-{
- if (data_wrapper->mime_type) gmime_content_field_free (data_wrapper->mime_type);
- data_wrapper->mime_type = mime_type;
-}
-
-void
-camel_data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type)
-{
- CDW_CLASS(data_wrapper)->set_mime_type_field (data_wrapper, mime_type);
-}
-
-static CamelStream *
-_get_stream (CamelDataWrapper *data_wrapper)
-{
- /* This needs to be implemented in subclasses. */
- return NULL;
-}
-
-CamelStream *
-camel_data_wrapper_get_stream (CamelDataWrapper *data_wrapper)
-{
- return CDW_CLASS(data_wrapper)->get_stream (data_wrapper);
-}
diff --git a/camel/camel-data-wrapper.h b/camel/camel-data-wrapper.h
deleted file mode 100644
index 7c16cc65bd..0000000000
--- a/camel/camel-data-wrapper.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelDataWrapper.h : Abstract class for a data wrapper */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_DATA_WRAPPER_H
-#define CAMEL_DATA_WRAPPER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include "gmime-content-field.h"
-#include "camel-stream.h"
-
-
-
-#define CAMEL_DATA_WRAPPER_TYPE (camel_data_wrapper_get_type ())
-#define CAMEL_DATA_WRAPPER(obj) (GTK_CHECK_CAST((obj), CAMEL_DATA_WRAPPER_TYPE, CamelDataWrapper))
-#define CAMEL_DATA_WRAPPER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_DATA_WRAPPER_TYPE, CamelDataWrapperClass))
-#define CAMEL_IS_DATA_WRAPPER(o) (GTK_CHECK_TYPE((o), CAMEL_DATA_WRAPPER_TYPE))
-
-
-typedef struct
-{
- GtkObject parent_object;
-
- CamelStream *input_stream;
- CamelStream *output_stream;
-
- GMimeContentField *mime_type;
-} CamelDataWrapper;
-
-
-
-typedef struct {
-
- GtkObjectClass parent_class;
-
- /* Virtual methods */
- void (*set_input_stream) (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
- CamelStream * (*get_input_stream) (CamelDataWrapper *data_wrapper);
- void (*set_output_stream) (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
- CamelStream * (*get_output_stream) (CamelDataWrapper *data_wrapper);
-
- void (*set_mime_type) (CamelDataWrapper *data_wrapper,
- const gchar * mime_type);
- gchar * (*get_mime_type) (CamelDataWrapper *data_wrapper);
- GMimeContentField * (*get_mime_type_field) (CamelDataWrapper *data_wrapper);
- void (*set_mime_type_field) (CamelDataWrapper *data_wrapper,
- GMimeContentField *mime_type_field);
-
-
- /* deprecated method */
- CamelStream * (*get_stream) (CamelDataWrapper *data_wrapper);
- void (*write_to_stream) (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
- void (*construct_from_stream) (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-
-} CamelDataWrapperClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_data_wrapper_get_type (void);
-
-
-/* public methods */
-
-void camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-void camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper,
- const gchar *mime_type);
-gchar * camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper);
-GMimeContentField * camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper);
-void camel_data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper,
- GMimeContentField *mime_type);
-
-void camel_data_wrapper_set_input_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-CamelStream * camel_data_wrapper_get_input_stream (CamelDataWrapper *data_wrapper);
-void camel_data_wrapper_set_output_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-CamelStream * camel_data_wrapper_get_output_stream (CamelDataWrapper *data_wrapper);
-
-
-
-/* deprecated methods. Left until the new parser scheme is ok */
-CamelStream * camel_data_wrapper_get_stream (CamelDataWrapper *data_wrapper);
-void camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_DATA_WRAPPER_H */
diff --git a/camel/camel-exception-list.def b/camel/camel-exception-list.def
deleted file mode 100644
index 8ad69f378f..0000000000
--- a/camel/camel-exception-list.def
+++ /dev/null
@@ -1,19 +0,0 @@
-CAMEL_EXCEPTION_NONE = 0,
-
-/* Generic exceptions */
-CAMEL_EXCEPTION_INVALID_PARAM,
-CAMEL_EXCEPTION_SYSTEM,
-
-/* CamelFolderException */
-CAMEL_EXCEPTION_FOLDER_NULL,
-CAMEL_EXCEPTION_FOLDER_INVALID,
-CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
-CAMEL_EXCEPTION_FOLDER_NON_EMPTY,
-CAMEL_EXCEPTION_FOLDER_NON_UID,
-CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
-CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
-CAMEL_EXCEPTION_FOLDER_INVALID_UID,
-
-
-/* CamelStoreException */
-CAMEL_EXCEPTION_STORE_NULL, \ No newline at end of file
diff --git a/camel/camel-exception.c b/camel/camel-exception.c
deleted file mode 100644
index a983150612..0000000000
--- a/camel/camel-exception.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-execpetion.c : exception utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-exception.h"
-
-
-
-/**
- * camel_exception_new: allocate a new exception object.
- *
- * Create and returns a new exception object.
- *
- *
- * Return value: The newly allocated exception object.
- **/
-CamelException *
-camel_exception_new ()
-{
- CamelException *ex;
-
- ex = g_new (CamelException, 1);
- ex->desc = NULL;
-
- /* set the Exception Id to NULL */
- ex->id = CAMEL_EXCEPTION_NONE;
-
- return ex;
-}
-
-
-/**
- * camel_exception_clear: Clear an exception
- * @exception: the exception object
- *
- * Clear an exception, that is, set the
- * exception ID to CAMEL_EXCEPTION_NONE and
- * free the description text.
- * If the exception is NULL, this funtion just
- * returns.
- **/
-void
-camel_exception_clear (CamelException *exception)
-{
- if (!exception) return;
-
- /* free the description text */
- if (exception->desc)
- g_free (exception->desc);
- exception->desc = NULL;
-
- /* set the Exception Id to NULL */
- exception->id = CAMEL_EXCEPTION_NONE;
-}
-
-
-
-
-/**
- * camel_exception_free: Free an exception
- * @exception: The exception object to free
- *
- * Free an exception object. If the exception
- * is NULL, nothing is done, the routine simply
- * returns.
- **/
-void
-camel_exception_free (CamelException *exception)
-{
- if (!exception) return;
-
- /* free the description text */
- if (exception->desc)
- g_free (exception->desc);
- /* free the exeption itself */
- g_free (exception);
-}
-
-/**
- * camel_exception_set: set an exception
- * @ex: exception object
- * @id: exception id
- * @desc: textual description of the exception
- *
- * Set the value of an exception. The exception id is
- * a unique number representing the exception. The
- * textual description is a small text explaining
- * what happened and provoked the exception.
- *
- * When @ex is NULL, nothing is done, this routine
- * simply returns.
- *
- **/
-void
-camel_exception_set (CamelException *ex,
- ExceptionId id,
- const char *desc)
-{
- /* if no exception is given, do nothing */
- if (!ex) return;
-
- ex->id = id;
-
- /* remove the previous exception description */
- if (ex->desc)
- g_free (ex->desc);
- ex->desc = g_strdup (desc);
-}
-
-
-/**
- * camel_exception_setv: set an exception
- * @ex: exception object
- * @id: exception id
- * @format: format of the description string. The format string is used as in printf().
- *
- * Set the value of an exception. The exception id is
- * a unique number representing the exception. The
- * textual description is a small text explaining
- * what happened and provoked the exception.
- * In this version, the string is created from the format
- * string and the variable argument list.
- *
- * When @ex is NULL, nothing is done, this routine
- * simply returns.
- *
- **/
-void
-camel_exception_setv (CamelException *ex,
- ExceptionId id,
- const char *format,
- ...)
-{
- va_list args;
- gchar *tmp_desc_string;
-
-
- /* if no exception is given, do nothing */
- if (!ex) return;
-
-
- /* create the temporary exception string */
- va_start(args, format);
- tmp_desc_string = g_strdup_vprintf (format, args);
- va_end (args);
-
-
- /* now set the exception. We don't call
- camel_exception_set because we want to
- avoid a useless strdup () */
- ex->id = id;
-
- /* remove the previous exception description */
- if (ex->desc)
- g_free (ex->desc);
- ex->desc = g_strdup (tmp_desc_string);
-
-}
-
-
-
-
-
-
-
-/**
- * camel_exception_xfer: transfer an exception
- * @ex_dst: Destination exception object
- * @ex_src: Source exception object
- *
- * Transfer the content of an exception from
- * an exception object to another.
- * The destination exception receives the id and
- * the description text of the source exception.
- **/
-void
-camel_exception_xfer (CamelException *ex_dst,
- CamelException *ex_src)
-{
- if (ex_dst->desc)
- g_free (ex_dst->desc);
-
- ex_dst->id = ex_src->id;
- ex_dst->desc = ex_src->desc;
-
- ex_src->desc = NULL;
- ex_src->id = CAMEL_EXCEPTION_NONE;
-}
-
-
-
-
-
-
-
-/**
- * camel_exception_get_id: get the exception id
- * @ex: The exception object
- *
- * Return the id of an exception.
- * If @ex is NULL, return CAMEL_EXCEPTION_NONE;
- *
- * Return value: Exception ID.
- **/
-ExceptionId
-camel_exception_get_id (CamelException *ex)
-{
- if (ex)
- return ex->id;
- else
- return CAMEL_EXCEPTION_NONE;
-}
-
-
-
-
-/**
- * camel_exception_get_description: get the description of an exception.
- * @ex: The exception object
- *
- * Return the exception description text.
- * If @ex is NULL, return NULL;
- *
- *
- * Return value: Exception description text.
- **/
-const gchar *
-camel_exception_get_description (CamelException *ex)
-{
- if (ex)
- return ex->desc;
- else
- return NULL;
-}
diff --git a/camel/camel-exception.h b/camel/camel-exception.h
deleted file mode 100644
index 1284608e91..0000000000
--- a/camel/camel-exception.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-execpetion.h : exception utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_EXCEPTION_H
-#define CAMEL_EXCEPTION_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-
-
-typedef enum {
-#include "camel-exception-list.def"
-
-} ExceptionId;
-
-
-typedef struct {
- /* do not access the fields directly */
- ExceptionId id;
- char *desc;
-
-} CamelException;
-
-
-
-/* creation and destruction functions */
-CamelException *camel_exception_new ();
-void camel_exception_free (CamelException *exception);
-
-
-/* exception content manipulation */
-void camel_exception_clear (CamelException *exception);
-void camel_exception_set (CamelException *ex,
- ExceptionId id,
- const char *desc);
-void camel_exception_setv (CamelException *ex,
- ExceptionId id,
- const char *format,
- ...);
-
-
-/* exception content transfer */
-void camel_exception_xfer (CamelException *ex_dst,
- CamelException *ex_src);
-
-
-/* exception content retrieval */
-ExceptionId camel_exception_get_id (CamelException *ex);
-const gchar *camel_exception_get_description (CamelException *ex);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_EXCEPTION_H */
-
diff --git a/camel/camel-folder-pt-proxy.c b/camel/camel-folder-pt-proxy.c
deleted file mode 100644
index 27e89438c3..0000000000
--- a/camel/camel-folder-pt-proxy.c
+++ /dev/null
@@ -1,820 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-pt-proxy.c : proxy folder using posix threads */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-folder-pt-proxy.h"
-#include "camel-log.h"
-#include "camel-marshal-utils.h"
-#include "camel-exception.h"
-#include <pthread.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-
-static CamelFolderClass *parent_class=NULL;
-
-/* Returns the class for CamelFolderPtProxy and CamelFolder objects */
-#define CFPP_CLASS(so) CAMEL_FOLDER_PT_PROXY_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-
-enum CamelFolderFunc {
- CAMEL_FOLDER_OPEN,
- CAMEL_FOLDER_CLOSE,
- CAMEL_FOLDER__LAST_FUNC
-};
-
-static CamelFuncDef _camel_func_def [CAMEL_FOLDER__LAST_FUNC];
-
-
-static void _init_with_store (CamelFolder *folder,
- CamelStore *parent_store,
- CamelException *ex);
-static void _open_async (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-static void _close_async (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-static void _open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex);
-static void _close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex);
-static void _set_name (CamelFolder *folder,
- const gchar *name,
- CamelException *ex);
-
-static const gchar *_get_name (CamelFolder *folder, CamelException *ex);
-static const gchar *_get_full_name (CamelFolder *folder, CamelException *ex);
-static gboolean _can_hold_folders (CamelFolder *folder, CamelException *ex);
-static gboolean _can_hold_messages(CamelFolder *folder, CamelException *ex);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _is_open (CamelFolder *folder, CamelException *ex);
-static CamelFolder *_get_subfolder (CamelFolder *folder, const gchar *folder_name, CamelException *ex);
-static gboolean _create (CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean _delete_messages (CamelFolder *folder, CamelException *ex);
-static CamelFolder *_get_parent_folder (CamelFolder *folder, CamelException *ex);
-static CamelStore *_get_parent_store (CamelFolder *folder, CamelException *ex);
-static CamelFolderOpenMode _get_mode (CamelFolder *folder, CamelException *ex);
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-static GList *_expunge (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex);
-static gint _get_message_count (CamelFolder *folder, CamelException *ex);
-static void _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static const GList *_list_permanent_flags (CamelFolder *folder, CamelException *ex);
-static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex);
-
-static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-static GList *_get_uid_list (CamelFolder *folder, CamelException *ex);
-
-static void _finalize (GtkObject *object);
-
-
-static void
-camel_folder_pt_proxy_class_init (CamelFolderPtProxyClass *camel_folder_pt_proxy_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_pt_proxy_class);
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_folder_pt_proxy_class);
- CamelFolderPtProxyClass *proxy_class = camel_folder_pt_proxy_class;
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
- camel_folder_class->init_with_store = _init_with_store;
- camel_folder_class->open = _open;
- camel_folder_class->close = _close;
- camel_folder_class->open_async = _open_async;
- camel_folder_class->close_async = _close_async;
- camel_folder_class->set_name = _set_name;
- camel_folder_class->get_name = _get_name;
- camel_folder_class->can_hold_folders = _can_hold_folders;
- camel_folder_class->can_hold_messages = _can_hold_messages;
- camel_folder_class->exists = _exists;
- camel_folder_class->is_open = _is_open;
- camel_folder_class->get_subfolder = _get_subfolder;
- camel_folder_class->create = _create;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->get_parent_folder = _get_parent_folder;
- camel_folder_class->get_parent_store = _get_parent_store;
- camel_folder_class->get_mode = _get_mode;
- camel_folder_class->list_subfolders = _list_subfolders;
- camel_folder_class->expunge = _expunge;
- camel_folder_class->get_message_by_number = _get_message_by_number;
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->append_message = _append_message;
- camel_folder_class->list_permanent_flags = _list_permanent_flags;
- camel_folder_class->copy_message_to = _copy_message_to;
- camel_folder_class->get_message_uid = _get_message_uid;
- camel_folder_class->get_message_by_uid = _get_message_by_uid;
- camel_folder_class->get_uid_list = _get_uid_list;
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-
- /* function definition for proxying */
- proxy_class->open_func_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_INT_POINTER_POINTER,
- 4,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
- proxy_class->open_cb_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_POINTER_POINTER,
- 3,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
-
- proxy_class->close_func_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER,
- 4,
- GTK_TYPE_POINTER,
- GTK_TYPE_BOOL,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
- proxy_class->close_cb_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_POINTER_POINTER,
- 3,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
-
- proxy_class->set_name_func_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER,
- 4,
- GTK_TYPE_POINTER,
- GTK_TYPE_BOOL,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
- proxy_class->set_name_cb_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_POINTER_POINTER,
- 3,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
-
-}
-
-
-
-
-static void
-camel_folder_pt_proxy_init (CamelFolderPtProxy *folder_pt_proxy)
-{
- folder_pt_proxy->thread_ex = camel_exception_new ();
- folder_pt_proxy->pud = g_new (_ProxyCbUserData, 1);
-}
-
-
-
-
-GtkType
-camel_folder_pt_proxy_get_type (void)
-{
- static GtkType camel_folder_pt_proxy_type = 0;
-
- if (!camel_folder_pt_proxy_type) {
- GtkTypeInfo camel_folder_pt_proxy_info =
- {
- "CamelFolderPtProxy",
- sizeof (CamelFolderPtProxy),
- sizeof (CamelFolderPtProxyClass),
- (GtkClassInitFunc) camel_folder_pt_proxy_class_init,
- (GtkObjectInitFunc) camel_folder_pt_proxy_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_folder_pt_proxy_type = gtk_type_unique (gtk_object_get_type (), &camel_folder_pt_proxy_info);
- }
-
- return camel_folder_pt_proxy_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelFolder *camel_folder = CAMEL_FOLDER (object);
- CamelFolderPtProxy *camel_folder_pt_proxy = CAMEL_FOLDER_PT_PROXY (camel_folder);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelFolderPtProxy::finalize\n");
-
- camel_exception_free (camel_folder_pt_proxy->thread_ex);
- g_free (camel_folder_pt_proxy->pud);
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolderPtProxy::finalize\n");
-}
-
-
-
-
-
-
-/*********/
-
-/**** Operations implementation ****/
-
-
-
-static gpointer
-_proxy_cb_user_data (_ProxyCbUserData *pud,
- CamelFolderAsyncCallback real_callback,
- CamelFolderPtProxy *proxy_folder,
- CamelException *ex,
- gpointer real_user_data)
-{
- pud->real_callback = real_callback;
- pud->proxy_folder = proxy_folder;
- pud->ex = ex;
- pud->real_user_data = real_user_data;
- return (gpointer)pud;
-}
-
-
-/* ******** */
-
-/* thread->init_with_store implementation */
-static void
-_init_with_store (CamelFolder *folder,
- CamelStore *parent_store,
- CamelException *ex)
-{
-
- parent_class->init_with_store (folder, parent_store, ex);
- if (ex->id != CAMEL_EXCEPTION_NONE)
- return;
-#warning use proxy store here
- CF_CLASS (folder)->init_with_store (CAMEL_FOLDER_PT_PROXY (folder)->real_folder,
- parent_store,
- ex);
-}
-
-
-
-/* a little bit of explanation for the folder_class->open
- * method implementation :
- *
- * the proxy object "open" method is called by the client
- * program in the main thread. This method creates a
- * CamelOp object containing all the necessary informations
- * to call the corresponding "open" method on the real
- * folder object in the child thread. This CamelOp object
- * is thus pushed in a queue in the main thread (see the
- * CamelThreadProxy structure for more details).
- * The operations in this queue are executed one by one
- * in a child thread.
- * Once the "open" method of the real object is finished,
- * it calls a callback. This callback is not the one supplied
- * by the client object. Instead, the _folder_open_cb()
- * function is called (in the child thread) which pushes
- * the real callback function in another operation queue.
- * The real callback is then called in the main thread.
- */
-
-/* folder->open implementation */
-
-/*
- * proxy callback. Called in the child thread by the
- * real folder "open" method when it is completed
- */
-static void
-_folder_open_cb (CamelFolder *folder,
- gpointer user_data,
- CamelException *ex)
-{
- CamelOp *cb;
- _ProxyCbUserData *pud;
- CamelFuncDef *cb_def;
-
- /* transfer the exception information from "ex" to the
- * client supplied exception (kept in pud->ex) */
- camel_exception_xfer (pud->ex, ex);
-
- /* create an operation which will call the real client
- * supplied callback in the main thread */
- cb_def = CAMEL_FOLDER_PT_PROXY_CLASS(pud->proxy_folder)->open_cb_def;
- cb = camel_marshal_create_op (cb_def,
- pud->real_callback,
- pud->proxy_folder,
- pud->real_user_data,
- pud->ex);
- camel_thread_proxy_push_cb (pud->proxy_folder->proxy_object, cb);
-
-}
-
-static void
-_open_async (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
- CamelOp *op;
- CamelFuncDef *func_def;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
-
- /* create an operation corresponding to the "open"
- * method of the real object. The operation definition
- * is common to all instances of the CamelFolderPtProxy
- * class so it is contained in the CamelFolderPtProxyClass
- * structure. */
- func_def = CAMEL_FOLDER_PT_PROXY_CLASS(proxy_folder)->open_func_def;
- if (callback)
- op = camel_marshal_create_op (func_def,
- CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->open_async,
- proxy_folder->real_folder,
- mode,
- _folder_open_cb,
- _proxy_cb_user_data (proxy_folder->pud, callback, proxy_folder, ex, user_data),
- proxy_folder->thread_ex);
- else
- op = camel_marshal_create_op (func_def,
- CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->open_async,
- proxy_folder->real_folder,
- mode,
- NULL,
- NULL,
- NULL);
- /* push the operation in the operation queue. This operation
- * will be executed in a child thread but only one operation
- * will be executed at a time, so that folder implementations
- * don't have to be MultiThread safe. */
- camel_thread_proxy_push_op (proxy_folder->proxy_object, op);
-}
-
-
-
-static void _open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- open (proxy_folder->real_folder, mode, ex);
-}
-
-
-
-/* folder->close implementation */
-
-static void
-_folder_close_cb (CamelFolder *folder,
- gpointer user_data,
- CamelException *ex)
-{
- CamelOp *cb;
- _ProxyCbUserData *pud;
- CamelFuncDef *cb_def;
-
- camel_exception_xfer (pud->ex, ex);
- cb_def = CAMEL_FOLDER_PT_PROXY_CLASS(pud->proxy_folder)->close_cb_def;
- cb = camel_marshal_create_op (cb_def,
- pud->real_callback,
- pud->proxy_folder,
- pud->real_user_data,
- pud->ex);
- camel_thread_proxy_push_cb (pud->proxy_folder->proxy_object, cb);
-
-}
-
-static void
-_close_async (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
- CamelOp *op;
- CamelFuncDef *func_def;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
-
- func_def = CAMEL_FOLDER_PT_PROXY_CLASS(proxy_folder)->close_func_def;
- if (callback)
- op = camel_marshal_create_op (func_def,
- CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->close_async,
- proxy_folder->real_folder,
- expunge,
- _folder_close_cb,
- _proxy_cb_user_data (proxy_folder->pud, callback, proxy_folder, ex, user_data),
- proxy_folder->thread_ex);
- else
- op = camel_marshal_create_op (func_def,
- CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->close_async,
- proxy_folder->real_folder,
- expunge,
- NULL,
- NULL,
- NULL);
- camel_thread_proxy_push_op (proxy_folder->proxy_object, op);
-
-}
-
-
-static void _close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- close (proxy_folder->real_folder, expunge, ex);
-}
-
-
-
-
-
-/* folder->set_name implementation */
-
-static void
-_set_name (CamelFolder *folder,
- const gchar *name,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- set_name (proxy_folder->real_folder, name, ex);
-
-}
-
-
-/* folder->get_name implementation */
-/* this one is not executed in a thread */
-static const gchar *
-_get_name (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_name (proxy_folder->real_folder, ex);
-}
-
-
-
-/* folder->get_full_name implementation */
-/* this one is not executed in a thread */
-
-static const gchar *
-_get_full_name (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_full_name (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static gboolean
-_can_hold_folders (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- can_hold_folders (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static gboolean
-_can_hold_messages (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- can_hold_messages (proxy_folder->real_folder, ex);
-}
-
-
-
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- exists (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static gboolean
-_is_open (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- is_open (proxy_folder->real_folder, ex);
-}
-
-
-
-
-
-static CamelFolder *
-_get_subfolder (CamelFolder *folder, const gchar *folder_name, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_subfolder (proxy_folder->real_folder, folder_name, ex);
-}
-
-
-
-
-
-
-static gboolean
-_create(CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- create (proxy_folder->real_folder, ex);
-}
-
-
-
-
-
-
-
-
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- delete (proxy_folder->real_folder, recurse, ex);
-}
-
-
-
-
-
-
-
-static gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- delete_messages (proxy_folder->real_folder, ex);
-}
-
-
-
-
-
-
-static CamelFolder *
-_get_parent_folder (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-#warning return proxy parent folder if any
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_parent_folder (proxy_folder->real_folder, ex);
-}
-
-
-
-
-
-static CamelStore *
-_get_parent_store (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_parent_store (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static CamelFolderOpenMode
-_get_mode (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_mode (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- list_subfolders (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static GList *
-_expunge (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- expunge (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static CamelMimeMessage *
-_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_by_number (proxy_folder->real_folder, number, ex);
-}
-
-
-
-
-
-static gint
-_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_count (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static void
-_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- append_message (proxy_folder->real_folder, message, ex);
-}
-
-
-
-static const GList *
-_list_permanent_flags (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- list_permanent_flags (proxy_folder->real_folder, ex);
-}
-
-
-
-static void
-_copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- copy_message_to (proxy_folder->real_folder, message, dest_folder, ex);
-}
-
-
-
-
-
-
-/* UIDs stuff */
-
-
-static const gchar *
-_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_uid (proxy_folder->real_folder, message, ex);
-}
-
-
-/* the next two func are left there temporarily */
-#if 0
-static const gchar *
-_get_message_uid_by_number (CamelFolder *folder, gint message_number, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_uid_by_number (proxy_folder->real_folder, message_number, ex);
-}
-
-#endif
-
-static CamelMimeMessage *
-_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_by_uid (proxy_folder->real_folder, uid, ex);
-}
-
-
-static GList *
-_get_uid_list (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_uid_list (proxy_folder->real_folder, ex);
-}
-
-
-/* **** */
-
-
-
-
-
diff --git a/camel/camel-folder-pt-proxy.h b/camel/camel-folder-pt-proxy.h
deleted file mode 100644
index 189d486a85..0000000000
--- a/camel/camel-folder-pt-proxy.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-pt-proxy.h : proxy folder using posix threads */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_FOLDER_PT_PROXY_H
-#define CAMEL_FOLDER_PT_PROXY_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-folder.h"
-#include "camel-op-queue.h"
-#include "camel-thread-proxy.h"
-
-
-#define CAMEL_FOLDER_PT_PROXY_TYPE (camel_folder_pt_proxy_get_type ())
-#define CAMEL_FOLDER_PT_PROXY(obj) (GTK_CHECK_CAST((obj), CAMEL_FOLDER_PT_PROXY_TYPE, CamelFolderPtProxy))
-#define CAMEL_FOLDER_PT_PROXY_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_FOLDER_PT_PROXY_TYPE, CamelFolderPtProxyClass))
-#define CAMEL_IS_FOLDER_PT_PROXY(o) (GTK_CHECK_TYPE((o), CAMEL_FOLDER_PT_PROXY_TYPE))
-
-typedef struct _CamelFolderPtProxy CamelFolderPtProxy;
-
-typedef struct {
- CamelFolderAsyncCallback real_callback;
- CamelFolderPtProxy *proxy_folder;
- CamelException *ex;
- gpointer real_user_data;
-} _ProxyCbUserData;
-
-struct _CamelFolderPtProxy {
- CamelFolder parent;
-
- /* private fields */
- CamelFolder *real_folder;
- CamelThreadProxy *proxy_object;
- CamelException *thread_ex;
- _ProxyCbUserData *pud;
-
-};
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* functions and callbacks definition (for marshalling) */
- CamelFuncDef *open_func_def;
- CamelFuncDef *open_cb_def;
- CamelFuncDef *close_func_def;
- CamelFuncDef *close_cb_def;
- CamelFuncDef *set_name_func_def;
- CamelFuncDef *set_name_cb_def;
-
-} CamelFolderPtProxyClass;
-
-
-GtkType camel_folder_pt_proxy_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_FOLDER_PT_PROXY_H */
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
deleted file mode 100644
index e1d4543ace..0000000000
--- a/camel/camel-folder-summary.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelFolderSummary.c : Abstract class for a folder_summary */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-folder-summary.h"
-#include "camel-log.h"
-
-static GtkObjectClass *parent_class=NULL;
-
-/* Returns the class for a CamelFolderSummary */
-#define CFS_CLASS(so) CAMEL_FOLDER_SUMMARY_CLASS (GTK_OBJECT(so)->klass)
-
-
-static const GArray *_get_subfolder_info_list (CamelFolderSummary *summary);
-static const GArray *_get_message_info_list (CamelFolderSummary *summary);
-
-static void _finalize (GtkObject *object);
-
-static void
-camel_folder_summary_class_init (CamelFolderSummaryClass *camel_folder_summary_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_summary_class);
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
- camel_folder_summary_class->get_subfolder_info_list = _get_subfolder_info_list;
- camel_folder_summary_class->get_message_info_list = _get_message_info_list;
-
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-}
-
-
-
-
-
-static void
-camel_folder_summary_init (gpointer object, gpointer klass)
-{
- CamelFolderSummary *summary = CAMEL_FOLDER_SUMMARY (object);
-
- CAMEL_LOG_FULL_DEBUG ( "camel_folder_summary_init:: Entering\n");
- summary->subfolder_info_list = g_array_new (FALSE, FALSE, sizeof (CamelFolderInfo));
- summary->message_info_list = g_array_new (FALSE, FALSE, sizeof (CamelMessageInfo));
- CAMEL_LOG_FULL_DEBUG ( "camel_folder_summary_init:: Leaving\n");
-}
-
-
-
-GtkType
-camel_folder_summary_get_type (void)
-{
- static GtkType camel_folder_summary_type = 0;
-
- if (!camel_folder_summary_type) {
- GtkTypeInfo camel_folder_summary_info =
- {
- "CamelFolderSummary",
- sizeof (CamelFolderSummary),
- sizeof (CamelFolderSummaryClass),
- (GtkClassInitFunc) camel_folder_summary_class_init,
- (GtkObjectInitFunc) camel_folder_summary_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_folder_summary_type = gtk_type_unique (gtk_object_get_type (), &camel_folder_summary_info);
- }
-
- return camel_folder_summary_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelFolderSummary *camel_folder_summary = CAMEL_FOLDER_SUMMARY (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelFolderSummary::finalize\n");
- CAMEL_LOG_FULL_DEBUG ("CamelFolderSummary::finalize, finalizing object %p\n", object);
-
- parent_class->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolderSummary::finalize\n");
-}
-
-
-CamelFolderSummary *
-camel_folder_summary_new ()
-{
- CamelFolderSummary *folder_summary;
-
- folder_summary = gtk_type_new (CAMEL_FOLDER_SUMMARY_TYPE);
- folder_summary->message_info_list = g_array_new (FALSE, FALSE, sizeof (CamelMessageInfo));
- folder_summary->subfolder_info_list = g_array_new (FALSE, FALSE, sizeof (CamelFolderInfo));
-
- return folder_summary;
-
-}
-
-static const GArray *
-_get_subfolder_info_list (CamelFolderSummary *summary)
-{
- return summary->subfolder_info_list;
-}
-
-
-const GArray *
-camel_folder_summary_get_subfolder_info_list (CamelFolderSummary *summary)
-{
- return CFS_CLASS (summary)->get_subfolder_info_list (summary);
-}
-
-
-
-
-static const GArray *
-_get_message_info_list (CamelFolderSummary *summary)
-{
- return summary->message_info_list;
-}
-
-const GArray *
-camel_folder_summary_get_message_info_list (CamelFolderSummary *summary)
-{
- return CFS_CLASS (summary)->get_message_info_list (summary);
-}
-
-
-
-
-
-
-
-
-
-
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
deleted file mode 100644
index 414e7a24c9..0000000000
--- a/camel/camel-folder-summary.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelFolderSummary.h : Abstract class for a folder summary */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_FOLDER_SUMMARY_H
-#define CAMEL_FOLDER_SUMMARY_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-
-
-#define CAMEL_FOLDER_SUMMARY_TYPE (camel_folder_summary_get_type ())
-#define CAMEL_FOLDER_SUMMARY(obj) (GTK_CHECK_CAST((obj), CAMEL_FOLDER_SUMMARY_TYPE, CamelFolderSummary))
-#define CAMEL_FOLDER_SUMMARY_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_FOLDER_SUMMARY_TYPE, CamelFolderSummaryClass))
-#define CAMEL_IS_FOLDER_SUMMARY(o) (GTK_CHECK_TYPE((o), CAMEL_FOLDER_SUMMARY_TYPE))
-
-
-
-
-typedef struct {
- gchar *name;
- gint nb_message;
- gint nb_unread_message;
- gint nb_deleted_message;
-
- GHashTable *extended_fields;
-} CamelFolderInfo;
-
-
-
-
-typedef struct {
- gchar *subject;
- gchar *uid;
- gchar *date;
- gchar *sender;
-
- GHashTable *extended_fields;
-} CamelMessageInfo;
-
-
-
-
-typedef struct {
- GtkObject parent_object;
-
- GArray *subfolder_info_list; /* informations on subfolders */
- GArray *message_info_list; /* informations on messages */
-
-} CamelFolderSummary;
-
-
-
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /* Virtual methods */
- const GArray * (*get_subfolder_info_list) (CamelFolderSummary *summary);
- const GArray * (*get_message_info_list) (CamelFolderSummary *summary);
-
-} CamelFolderSummaryClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_folder_summary_get_type (void);
-
-
-/* public methods */
-CamelFolderSummary *camel_folder_summary_new ();
-
-/* get information about the messages and the subfolders in the directory */
-const GArray *camel_folder_summary_get_subfolder_info_list (CamelFolderSummary *summary);
-const GArray *camel_folder_summary_get_message_info_list (CamelFolderSummary *summary);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_FOLDER_SUMMARY_H */
diff --git a/camel/camel-folder-utils.c b/camel/camel-folder-utils.c
deleted file mode 100644
index 76bc040446..0000000000
--- a/camel/camel-folder-utils.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-utils : Utility for camel folders */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-folder-utils.h"
-#include "camel-log.h"
-#include "camel-mime-message.h"
-
-
-
-/* Active Message List utilities */
-
-/* */
-static gint
-camel_mime_message_number_cmp (gconstpointer a, gconstpointer b)
-{
- CamelMimeMessage *m_a = CAMEL_MIME_MESSAGE (a);
- CamelMimeMessage *m_b = CAMEL_MIME_MESSAGE (b);
-
- return (m_a->message_number - (m_b->message_number));
-}
-
-
-/**
- * camel_aml_expunge_messages: Expunge the message marked as deleted in an Active Message List
- * @aml: active message list
- * @folder: folder object
- *
- * Expunge the message flagged as "DELETED" in an active message list.
- * The messages are not freed nor really expunged on the disk, they
- * are just removed from the active message list and marked as
- * "EXPUNGED". The list of the message which have been expunged is
- * return in a GList which must be freed by the caller.
- * To be really expunged the providers must provide or call
- * folder specific methods.
- *
- * Return value: the list of expunged messages.
- **/
-static GList *
-camel_aml_expunge_messages (GList *aml,
- CamelFolder *folder)
-{
- CamelMimeMessage *message = NULL;
- GList *message_node = NULL;
- GList *next_message_node = NULL;
- GList *expunged_messages = NULL;
-
-
- message_node = aml;
- /* look in folder message list which messages
- * need to be expunged */
- while ( message_node) {
- message = CAMEL_MIME_MESSAGE (message_node->data);
-
- /* we may free message_node so get the next node now */
- next_message_node = message_node->next;
-
- if (message) {
- if (camel_mime_message_get_flag (message, "DELETED")) {
-
- /* remove the message from active message list */
- g_list_remove_link (aml, message_node);
- g_list_free_1 (message_node);
- camel_mime_message_set_flag (message, "EXPUNGED", TRUE);
- expunged_messages = g_list_prepend (expunged_messages, message);
-
- }
- }
- else {
- CAMEL_LOG_WARNING ("CamelFolder::expunge warning message_node contains no message\n");
- }
- message_node = next_message_node;
- CAMEL_LOG_FULL_DEBUG ("CamelFolder::expunge, examined message node %p\n", message_node);
- }
-
- return expunged_messages;
-}
diff --git a/camel/camel-folder-utils.h b/camel/camel-folder-utils.h
deleted file mode 100644
index 1d6823e771..0000000000
--- a/camel/camel-folder-utils.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-utils : Utility for camel folders */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_MIME_PART_UTILS_H
-#define CAMEL_MIME_PART_UTILS_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-folder.h"
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MIME_PART_UTILS_H */
-
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
deleted file mode 100644
index d7366d51b4..0000000000
--- a/camel/camel-folder.c
+++ /dev/null
@@ -1,1845 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelFolder.c : Abstract class for an email folder */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-folder.h"
-#include "camel-log.h"
-#include "string-utils.h"
-
-static GtkObjectClass *parent_class=NULL;
-
-/* Returns the class for a CamelFolder */
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-
-
-
-static void _init_with_store (CamelFolder *folder,
- CamelStore *parent_store,
- CamelException *ex);
-static void _finalize (GtkObject *object);
-
-
-static void _open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex);
-static void _close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex);
-
-/* Async operations are not used for the moment */
-static void _open_async (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-static void _close_async (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-
-
-static void _set_name (CamelFolder *folder,
- const gchar *name,
- CamelException *ex);
-static const gchar *_get_name (CamelFolder *folder,
- CamelException *ex);
-static const gchar *_get_full_name (CamelFolder *folder, CamelException *ex);
-/* static void _set_full_name (CamelFolder *folder, const gchar *name); */
-
-
-static gboolean _can_hold_folders (CamelFolder *folder, CamelException *ex);
-static gboolean _can_hold_messages (CamelFolder *folder, CamelException *ex);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _is_open (CamelFolder *folder, CamelException *ex);
-static const GList *_list_permanent_flags (CamelFolder *folder, CamelException *ex);
-static CamelFolderOpenMode _get_mode (CamelFolder *folder, CamelException *ex);
-
-
-static gboolean _create (CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-
-
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-static CamelFolder *_get_subfolder (CamelFolder *folder,
- const gchar *folder_name, CamelException *ex);
-static CamelFolder *_get_parent_folder (CamelFolder *folder, CamelException *ex);
-static CamelStore * _get_parent_store (CamelFolder *folder, CamelException *ex);
-
-
-static gboolean _has_message_number_capability (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message_by_number (CamelFolder *folder,
- gint number,
- CamelException *ex);
-static gint _get_message_count (CamelFolder *folder,
- CamelException *ex);
-
-
-static gboolean _delete_messages (CamelFolder *folder,
- CamelException *ex);
-static GList * _expunge (CamelFolder *folder,
- CamelException *ex);
-static void _append_message (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex);
-static void _copy_message_to (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelFolder *dest_folder,
- CamelException *ex);
-
-
-static GList *_get_uid_list (CamelFolder *folder, CamelException *ex);
-static const gchar *_get_message_uid (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex);
-static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder,
- const gchar *uid,
- CamelException *ex);
-
-
-
-
-static void
-camel_folder_class_init (CamelFolderClass *camel_folder_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_class);
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
- camel_folder_class->init_with_store = _init_with_store;
- camel_folder_class->open = _open;
- camel_folder_class->open_async = _open_async;
- camel_folder_class->close = _close;
- camel_folder_class->close_async = _close_async;
- camel_folder_class->set_name = _set_name;
- camel_folder_class->get_name = _get_name;
- camel_folder_class->get_full_name = _get_full_name;
- camel_folder_class->can_hold_folders = _can_hold_folders;
- camel_folder_class->can_hold_messages = _can_hold_messages;
- camel_folder_class->exists = _exists;
- camel_folder_class->is_open = _is_open;
- camel_folder_class->get_subfolder = _get_subfolder;
- camel_folder_class->create = _create;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->get_parent_folder = _get_parent_folder;
- camel_folder_class->get_parent_store = _get_parent_store;
- camel_folder_class->get_mode = _get_mode;
- camel_folder_class->list_subfolders = _list_subfolders;
- camel_folder_class->expunge = _expunge;
- camel_folder_class->has_message_number_capability = _has_message_number_capability;
- camel_folder_class->get_message_by_number = _get_message_by_number;
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->append_message = _append_message;
- camel_folder_class->list_permanent_flags = _list_permanent_flags;
- camel_folder_class->copy_message_to = _copy_message_to;
- camel_folder_class->get_message_uid = _get_message_uid;
- camel_folder_class->get_message_by_uid = _get_message_by_uid;
- camel_folder_class->get_uid_list = _get_uid_list;
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-}
-
-
-
-
-
-
-
-GtkType
-camel_folder_get_type (void)
-{
- static GtkType camel_folder_type = 0;
-
- if (!camel_folder_type) {
- GtkTypeInfo camel_folder_info =
- {
- "CamelFolder",
- sizeof (CamelFolder),
- sizeof (CamelFolderClass),
- (GtkClassInitFunc) camel_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_folder_type = gtk_type_unique (gtk_object_get_type (), &camel_folder_info);
- }
-
- return camel_folder_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelFolder *camel_folder = CAMEL_FOLDER (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelFolder::finalize\n");
-
- g_free (camel_folder->name);
- g_free (camel_folder->full_name);
- g_free (camel_folder->permanent_flags);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolder::finalize\n");
-}
-
-
-/**
- * _init_with_store: init the folder by setting its parent store.
- * @folder: folder object to initialize
- * @parent_store: parent store object of the folder
- *
- *
- **/
-static void
-_init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex)
-{
-
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- if (!parent_store) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_INVALID_PARAM,
- "parent_store parameter is NULL");
- return;
- }
-
- if (folder->parent_store) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "folder already has a parent store");
- return;
- }
-
- folder->parent_store = parent_store;
- gtk_object_ref (GTK_OBJECT (parent_store));
-
- folder->open_mode = FOLDER_OPEN_UNKNOWN;
- folder->open_state = FOLDER_CLOSE;
- folder->name = NULL;
- folder->full_name = NULL;
-}
-
-
-
-
-
-static void
-_open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- folder->open_state = FOLDER_OPEN;
- folder->open_mode = mode;
-}
-
-
-
-
-/**
- * camel_folder_open: Open a folder
- * @folder: The folder object
- * @mode: open mode (R/W/RW ?)
- * @ex: exception object
- *
- * Open a folder in a given mode.
- *
- **/
-void
-camel_folder_open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- CF_CLASS(folder)->open (folder, mode, ex);
-}
-
-
-
-
-
-
-static void
-_open_async (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- CAMEL_LOG_WARNING ("Calling CamelFolder::open_async directly. "
- "Should be overloaded\n");
-}
-
-
-
-/**
- * camel_folder_open: Open a folder
- * @folder: The folder object
- * @mode: open mode (R/W/RW ?)
- * @callback: function to call when the operation is over
- * @user_data: data to pass to the callback
- * @ex: exception object
- *
- * Open a folder in a given mode. When the operation is over
- * the callback is called and the client program can determine
- * if the operation suceeded by examining the exception.
- *
- **/
-void
-camel_folder_open_async (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- CF_CLASS(folder)->open_async (folder, mode, callback, user_data, ex);
-}
-
-
-
-
-
-
-static void
-_close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- folder->open_state = FOLDER_CLOSE;
-}
-
-/**
- * camel_folder_close: Close a folder.
- * @folder: The folder object
- * @expunge: if TRUE, the flagged message are deleted.
- * @ex: exception object
- *
- * Put a folder in its closed state, and possibly
- * expunge the flagged messages.
- *
- **/
-void
-camel_folder_close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- CF_CLASS(folder)->close (folder, expunge, ex);
-}
-
-
-
-
-
-
-static void
-_close_async (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- CAMEL_LOG_WARNING ("Calling CamelFolder::close_async directly. "
- "Should be overloaded\n");
-}
-
-/**
- * camel_folder_close_async: Close a folder.
- * @folder: The folder object
- * @expunge: if TRUE, the flagged message are deleted.
- * @callback: function to call when the operation is over
- * @user_data: data to pass to the callback
- * @ex: exception object
- *
- * Put a folder in its closed state, and possibly
- * expunge the flagged messages. The callback is called
- * when the operation is over and the client program can determine
- * if the operation suceeded by examining the exception.
- *
- **/
-void
-camel_folder_close_async (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- CF_CLASS(folder)->close_async (folder, expunge, callback, user_data, ex);
-}
-
-
-
-
-
-static void
-_set_name (CamelFolder *folder,
- const gchar *name,
- CamelException *ex)
-{
- gchar separator;
- gchar *full_name;
- const gchar *parent_full_name;
-
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- /* if the folder already has a name, free it */
- g_free (folder->name);
- g_free (folder->full_name);
-
- /* set those fields to NULL now, so that if an
- exception occurs, they will be set anyway */
- folder->name = NULL;
- folder->full_name = NULL;
-
- if (!name) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_INVALID_PARAM,
- "name parameter is NULL");
- return;
- }
-
- CAMEL_LOG_FULL_DEBUG ("CamelFolder::set_name, folder name is %s\n", name);
-
-
- if (!folder->parent_store) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "folder has no parent store");
- return;
- }
-
- /* the set_name method is valid only on
- close folders */
-
- if (camel_folder_is_open (folder, ex)) {
- if (camel_exception_get_id (ex)) return;
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "CamelFolder::set_name is valid only on closed folders");
- return;
- }
-
- separator = camel_store_get_separator (folder->parent_store, ex);
- if (camel_exception_get_id (ex)) return;
-
- camel_exception_clear (ex);
- if (folder->parent_folder) {
- parent_full_name = camel_folder_get_full_name (folder->parent_folder, ex);
- if (camel_exception_get_id (ex)) return;
-
- full_name = g_strdup_printf ("%s%c%s", parent_full_name, separator, name);
- } else {
- full_name = g_strdup_printf ("%c%s", separator, name);
- }
-
- CAMEL_LOG_FULL_DEBUG ("CamelFolder::set_name, folder full name set to %s\n", full_name);
- folder->name = g_strdup (name);
- folder->full_name = full_name;
-
-}
-
-
-/**
- * camel_folder_set_name:set the (short) name of the folder
- * @folder: folder
- * @name: new name of the folder
- * @ex: exception object
- **/
-void
-camel_folder_set_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- }
-
- CF_CLASS(folder)->set_name (folder, name, ex);
-}
-
-
-
-
-
-/* not used for the moment, I don't know if it it is
- a good idea or not to use it */
-#if 0
-static void
-_set_full_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- g_free(folder->full_name);
- folder->full_name = g_strdup (name);
-}
-
-
-/**
- * camel_folder_set_full_name:set the (full) name of the folder
- * @folder: folder
- * @name: new name of the folder
- *
- * set the name of the folder.
- *
- **/
-void
-camel_folder_set_full_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- CF_CLASS(folder)->set_full_name (folder, name, ex);
-}
-#endif
-
-
-
-
-static const gchar *
-_get_name (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
- return folder->name;
-}
-
-
-/**
- * camel_folder_get_name: get the (short) name of the folder
- * @folder:
- *
- * get the name of the folder. The fully qualified name
- * can be obtained with the get_full_ame method (not implemented)
- *
- * Return value: name of the folder
- **/
-const gchar *
-camel_folder_get_name (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS(folder)->get_name (folder, ex);
-}
-
-
-
-static const gchar *
-_get_full_name (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return folder->full_name;
-}
-
-/**
- * camel_folder_get_full_name:get the (full) name of the folder
- * @folder: folder to get the name
- *
- * get the name of the folder.
- *
- * Return value: full name of the folder
- **/
-const gchar *
-camel_folder_get_full_name (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS(folder)->get_full_name (folder, ex);
-}
-
-
-/**
- * _can_hold_folders: tests if the folder can contain other folders
- * @folder: The folder object
- *
- * Tests if a folder can contain other folder
- * (as for example MH folders)
- *
- * Return value:
- **/
-static gboolean
-_can_hold_folders (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return folder->can_hold_folders;
-}
-
-
-
-
-/**
- * _can_hold_messages: tests if the folder can contain messages
- * @folder: The folder object
- *
- * Tests if a folder object can contain messages.
- * In the case it can not, it most surely can only
- * contain folders (rare).
- *
- * Return value: true if it can contain messages false otherwise
- **/
-static gboolean
-_can_hold_messages (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return folder->can_hold_messages;
-}
-
-
-
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return FALSE;
-}
-
-
-/**
- * _exists: tests if the folder object exists in its parent store.
- * @folder: folder object
- *
- * Test if a folder exists on a store. A folder can be
- * created without physically on a store. In that case,
- * use CamelFolder::create to create it
- *
- * Return value: true if the folder exists on the store false otherwise
- **/
-gboolean
-camel_folder_exists (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return (CF_CLASS(folder)->exists (folder, ex));
-}
-
-
-
-/**
- * _is_open: test if the folder is open
- * @folder: The folder object
- *
- * Tests if a folder is open. If not open it can be opened
- * CamelFolder::open
- *
- * Return value: true if the folder exists, false otherwise
- **/
-static gboolean
-_is_open (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return (folder->open_state == FOLDER_OPEN);
-}
-
-
-/**
- * _is_open: test if the folder is open
- * @folder: The folder object
- *
- * Tests if a folder is open. If not open it can be opened
- * CamelFolder::open
- *
- * Return value: true if the folder exists, false otherwise
- **/
-gboolean
-camel_folder_is_open (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return (CF_CLASS(folder)->is_open (folder, ex));
-}
-
-
-
-
-
-static CamelFolder *
-_get_subfolder (CamelFolder *folder,
- const gchar *folder_name,
- CamelException *ex)
-{
- CamelFolder *new_folder;
- gchar *full_name;
- const gchar *current_folder_full_name;
- gchar separator;
-
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
-
- if (!folder_name) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_INVALID_PARAM,
- "folder_name parameter is NULL");
- return NULL;
- }
-
- if (!folder->parent_store) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "folder has no parent store");
- return NULL;
- }
-
- current_folder_full_name = camel_folder_get_full_name (folder, ex);
- if (camel_exception_get_id (ex)) return NULL;
-
-
- separator = camel_store_get_separator (folder->parent_store, ex);
- full_name = g_strdup_printf ("%s%d%s", current_folder_full_name, separator, folder_name);
-
- new_folder = camel_store_get_folder (folder->parent_store, full_name, ex);
- return new_folder;
-}
-
-
-
-/**
- * camel_folder_get_subfolder: return the (sub)folder object that is specified
- * @folder: the folder
- * @folder_name: subfolder path
- *
- * This method returns a folder objects. This folder
- * is necessarily a subfolder of the current folder.
- * It is an error to ask a folder begining with the
- * folder separator character.
- *
- * Return value: Required folder. NULL if the subfolder object could not be obtained
- **/
-CamelFolder *
-camel_folder_get_subfolder (CamelFolder *folder, gchar *folder_name, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return (CF_CLASS(folder)->get_subfolder(folder,folder_name, ex));
-}
-
-
-
-
-/**
- * _create: creates a folder on its store
- * @folder: a CamelFolder object.
- *
- * this routine handles the recursion mechanism.
- * Children classes have to implement the actual
- * creation mechanism. They must call this method
- * before physically creating the folder in order
- * to be sure the parent folder exists.
- * Calling this routine on an existing folder is
- * not an error, and returns %TRUE.
- *
- * Return value: %TRUE if the folder exists, %FALSE otherwise
- **/
-static gboolean
-_create (CamelFolder *folder, CamelException *ex)
-{
- gchar *prefix;
- gchar dich_result;
- CamelFolder *parent;
- gchar sep;
-
- g_assert (folder);
- g_assert (folder->parent_store);
- g_assert (folder->name);
-
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
-
- if (!folder->name) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "folder has no name");
- return FALSE;
- }
-
- if (!folder->parent_store) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "folder has no parent store");
- return FALSE;
- }
-
- /* if the folder already exists on the
- store, do nothing and return true */
- if (CF_CLASS(folder)->exists (folder, ex))
- return TRUE;
-
-
- sep = camel_store_get_separator (folder->parent_store, ex);
- if (folder->parent_folder) {
- camel_folder_create (folder->parent_folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
- }
- else {
- if (folder->full_name) {
- dich_result = string_dichotomy (
- folder->full_name, sep, &prefix, NULL,
- STRING_DICHOTOMY_STRIP_TRAILING | STRING_DICHOTOMY_RIGHT_DIR);
- if (dich_result!='o') {
- g_warning("have to handle the case where the path is not OK\n");
- return FALSE;
- } else {
- parent = camel_store_get_folder (folder->parent_store, prefix, ex);
- camel_folder_create (parent, ex);
- if (camel_exception_get_id (ex)) return FALSE;
- }
- }
- }
- return TRUE;
-}
-
-
-/**
- * camel_folder_create: create the folder object on the physical store
- * @folder: folder object to create
- *
- * This routine physically creates the folder object on
- * the store. Having created the object does not
- * mean the folder physically exists. If it does not
- * exists, this routine will create it.
- * if the folder full name contains more than one level
- * of hierarchy, all folders between the current folder
- * and the last folder name will be created if not existing.
- *
- * Return value:
- **/
-gboolean
-camel_folder_create (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return (CF_CLASS(folder)->create(folder, ex));
-}
-
-
-
-
-
-/**
- * _delete: delete folder
- * @folder: folder to delete
- * @recurse: true is subfolders must also be deleted
- *
- * Delete a folder and its subfolders (if recurse is TRUE).
- * The scheme is the following:
- * 1) delete all messages in the folder
- * 2) if recurse is FALSE, and if there are subfolders
- * return FALSE, else delete current folder and retuen TRUE
- * if recurse is TRUE, delete subfolders, delete
- * current folder and return TRUE
- *
- * subclasses implementing a protocol with a different
- * deletion behaviour must emulate this one or implement
- * empty folders deletion and call this routine which
- * will do all the works for them.
- * Opertions must be done in the folllowing order:
- * - call this routine
- * - delete empty folder
- *
- * Return value: true if the folder has been deleted
- **/
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- GList *subfolders=NULL;
- GList *sf;
- gboolean ok;
-
- g_assert(folder);
-
- /* method valid only on closed folders */
- if (folder->open_state != FOLDER_CLOSE) {
- camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
- "Delete operation invalid on opened folders");
- return FALSE;
- }
-
- /* delete all messages in the folder */
- CF_CLASS(folder)->delete_messages(folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- subfolders = CF_CLASS(folder)->list_subfolders(folder, ex);
- if (camel_exception_get_id (ex)) {
- if (subfolders) g_list_free (subfolders);
- return FALSE;
- }
-
- ok = TRUE;
- if (recurse) { /* delete subfolders */
- if (subfolders) {
- sf = subfolders;
- do {
- CF_CLASS(sf->data)->delete(CAMEL_FOLDER(sf->data), TRUE, ex);
- if (camel_exception_get_id (ex)) ok = FALSE;
- } while (ok && (sf = sf->next));
- }
- } else if (subfolders) {
- camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_NON_EMPTY,
- "folder has subfolders");
- ok = FALSE;
- }
-
- if (subfolders) g_list_free (subfolders);
-
- return ok;
-}
-
-
-
-/**
- * camel_folder_delete: delete a folder
- * @folder: folder to delete
- * @recurse: TRUE if subfolders must be deleted
- *
- * Delete a folder. All messages in the folder
- * are deleted before the folder is deleted.
- * When recurse is true, all subfolders are
- * deleted too. When recurse is FALSE and folder
- * contains subfolders, all messages are deleted,
- * but folder deletion fails.
- *
- * Return value: TRUE if deletion was successful
- **/
-gboolean camel_folder_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return CF_CLASS(folder)->delete(folder, recurse, ex);
-}
-
-
-
-
-
-/**
- * _delete_messages: delete all messages in the folder
- * @folder:
- *
- *
- *
- * Return value:
- **/
-static gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::delete_messages directly. "
- "Should be overloaded\n");
- return FALSE;
-}
-
-
-/**
- * camel_folder_delete_messages: delete all messages in the folder
- * @folder: folder
- *
- * delete all messages stored in a folder
- *
- * Return value: TRUE if the messages could be deleted
- **/
-gboolean
-camel_folder_delete_messages (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return CF_CLASS(folder)->delete_messages(folder, ex);
-}
-
-
-
-
-
-
-/**
- * _get_parent_folder: return parent folder
- * @folder: folder to get the parent
- *
- *
- *
- * Return value:
- **/
-static CamelFolder *
-_get_parent_folder (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return folder->parent_folder;
-}
-
-
-/**
- * camel_folder_get_parent_folder:return parent folder
- * @folder: folder to get the parent
- *
- *
- *
- * Return value:
- **/
-CamelFolder *
-camel_folder_get_parent_folder (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS(folder)->get_parent_folder(folder, ex);
-}
-
-
-/**
- * _get_parent_store: return parent store
- * @folder: folder to get the parent
- *
- *
- *
- * Return value:
- **/
-static CamelStore *
-_get_parent_store (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return folder->parent_store;
-}
-
-
-/**
- * camel_folder_get_parent_store: return parent store
- * @folder: folder to get the parent
- *
- * Return the parent store of a folder
- *
- * Return value: the parent store.
- **/
-CamelStore *
-camel_folder_get_parent_store (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS(folder)->get_parent_store(folder, ex);
-}
-
-
-
-
-static CamelFolderOpenMode
-_get_mode (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FOLDER_OPEN_UNKNOWN;
- }
-
- return folder->open_mode;
-}
-
-
-/**
- * camel_folder_get_mode: return the open mode of a folder
- * @folder:
- *
- *
- *
- * Return value: open mode of the folder
- **/
-CamelFolderOpenMode
-camel_folder_get_mode (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FOLDER_OPEN_UNKNOWN;
- }
-
- return CF_CLASS(folder)->get_mode(folder, ex);
-}
-
-
-
-
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::list_subfolders directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-
-/**
- * camel_folder_list_subfolders: list subfolders in a folder
- * @folder: the folder
- *
- * List subfolders in a folder.
- *
- * Return value: list of subfolders
- **/
-GList *
-camel_folder_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS(folder)->list_subfolders(folder, ex);
-}
-
-
-
-
-static GList *
-_expunge (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::expunge directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-
-/**
- * camel_folder_expunge: physically delete messages marked as "DELETED"
- * @folder: the folder
- *
- * Delete messages which have been marked as "DELETED"
- *
- * Return value: list of expunged messages
- **/
-GList *
-camel_folder_expunge (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS (folder)->expunge (folder, ex);
-}
-
-
-static gboolean
-_has_message_number_capability (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::has_message_number_capability directly. "
- "Should be overloaded\n");
- return FALSE;
-
-}
-
-
-/**
- * camel_folder_has_message_number_capability: tests if the message can be numbered within the folder
- * @folder: folder to test
- *
- * Test if the message in this folder can be
- * obtained via the get_by_number method.
- * Usually, when the folder has the UID
- * capability, messages should be referred to
- * by their UID rather than by their number
- * as the UID is more reliable.
- *
- * Return value: TRUE if the folder supports message numbering, FALSE otherwise.
- **/
-gboolean
-camel_folder_has_message_number_capability (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return CF_CLASS(folder)->has_message_number_capability (folder, ex);
-}
-
-
-
-
-static CamelMimeMessage *
-_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::get_message_by_number directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-
-
-
-/**
- * camel_folder_get_message_by_number: return the message corresponding to that number in the folder
- * @folder: a CamelFolder object
- * @number: the number of the message within the folder.
- *
- * Return the message corresponding to that number within the folder.
- *
- * Return value: A pointer on the corresponding message or NULL if no corresponding message exists
- **/
-CamelMimeMessage *
-camel_folder_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS (folder)->get_message_by_number (folder, number, ex);
-}
-
-
-static gint
-_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- CAMEL_LOG_WARNING ("Calling CamelFolder::get_message_count directly. "
- "Should be overloaded\n");
- return -1;
-}
-
-
-
-/**
- * camel_folder_get_message_count: get the number of messages in the folder
- * @folder: A CamelFolder object
- *
- * Returns the number of messages in the folder.
- *
- * Return value: the number of messages or -1 if unknown.
- **/
-gint
-camel_folder_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return -1;
- }
-
- return CF_CLASS (folder)->get_message_count (folder, ex);
-}
-
-
-static void
-_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::append_message directly. "
- "Should be overloaded\n");
- return;
-
-}
-
-
-/**
- * camel_folder_append_message: add a message to a folder
- * @folder: folder object to add the message to
- * @message: message object
- * @ex: exception object
- *
- * Add a message to a folder.
- *
- **/
-void
-camel_folder_append_message (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- CF_CLASS (folder)->append_message (folder, message, ex);
-}
-
-
-static const GList *
-_list_permanent_flags (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return folder->permanent_flags;
-}
-
-
-const GList *
-camel_folder_list_permanent_flags (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS (folder)->list_permanent_flags (folder, ex);
-}
-
-
-
-
-static void
-_copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- camel_folder_append_message (dest_folder, message, ex);
-}
-
-
-void
-camel_folder_copy_message_to (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelFolder *dest_folder,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- CF_CLASS (folder)->copy_message_to (folder, message, dest_folder, ex);;
-}
-
-
-
-
-
-/* summary stuff */
-
-gboolean
-camel_folder_has_summary_capability (CamelFolder *folder,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return folder->has_summary_capability;
-}
-
-
-/**
- * camel_folder_get_summary: return the summary of a folder
- * @folder: folder object
- * @ex: exception object
- *
- * Return a CamelFolderSummary object from
- * which the main informations about a folder
- * can be retrieved.
- *
- * Return value: the folder summary object.
- **/
-CamelFolderSummary *
-camel_folder_get_summary (CamelFolder *folder,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return folder->summary;
-}
-
-
-
-
-/* UIDs stuff */
-
-/**
- * camel_folder_has_uid_capability: detect if the folder support UIDs
- * @folder: Folder object
- *
- * Detects if a folder supports UID operations, that is
- * reference messages by a Unique IDentifier instead
- * of by message number.
- *
- * Return value: TRUE if the folder supports UIDs
- **/
-gboolean
-camel_folder_has_uid_capability (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return folder->has_uid_capability;
-}
-
-
-
-static const gchar *
-_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CAMEL_LOG_WARNING ("Calling CamelFolder::get_message_uid directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-/**
- * camel_folder_get_message_uid: get the UID of a message in a folder
- * @folder: Folder in which the UID must refer to
- * @message: Message object
- *
- * Return the UID of a message relatively to a folder.
- * A message can have different UID, each one corresponding
- * to a different folder, if the message is referenced in
- * several folders.
- *
- * Return value: The UID of the message in the folder
- **/
-const gchar *
-camel_folder_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- if (!folder->has_uid_capability) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NON_UID,
- "folder is not UID capable");
- return NULL;
- }
-
- return CF_CLASS (folder)->get_message_uid (folder, message, ex);
-}
-
-
-
-/* the next two func are left there temporarily */
-static const gchar *
-_get_message_uid_by_number (CamelFolder *folder, gint message_number, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::get_message_uid_by_number directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-/**
- * camel_folder_get_message_uid_by_number: get the UID corresponding to a message number
- * @folder: Folder object
- * @message_number: Message number
- *
- * get the UID corresponding to a message number.
- * Use of this routine should be avoiding, as on
- * folders supporting UIDs, message numbers should
- * not been used.
- *
- * Return value:
- **/
-const gchar *
-camel_folder_get_message_uid_by_number (CamelFolder *folder, gint message_number, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- /* if (!folder->has_uid_capability) return NULL; */
- /* return CF_CLASS (folder)->get_message_uid_by_number (folder, message_number, ex); */
-}
-
-
-static CamelMimeMessage *
-_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CAMEL_LOG_WARNING ("Calling CamelFolder::get_message_by_uid directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-
-/**
- * camel_folder_get_message_by_uid: Get a message by its UID in a folder
- * @folder: the folder object
- * @uid: the UID
- *
- * Get a message from its UID in the folder. Messages
- * are cached within a folder, that is, asking twice
- * for the same UID returns the same message object.
- *
- * Return value: Message corresponding to the UID
- **/
-CamelMimeMessage *
-camel_folder_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- if (!folder->has_uid_capability) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NON_UID,
- "folder is not UID capable");
- return NULL;
- }
-
- return CF_CLASS (folder)->get_message_by_uid (folder, uid, ex);
-}
-
-static GList *
-_get_uid_list (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- if (!folder->has_uid_capability) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NON_UID,
- "folder is not UID capable");
- return NULL;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::get_uid_list directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-/**
- * camel_folder_get_uid_list: get the list of UID in a folder
- * @folder: folder object
- *
- * get the list of UID available in a folder. This
- * routine is usefull to know what messages are
- * available when the folder does not support
- * summaries. The UIDs in the list must not be freed,
- * the folder object caches them.
- *
- * Return value: Glist of UID correspondind to the messages available in the folder.
- **/
-GList *
-camel_folder_get_uid_list (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- if (!folder->has_uid_capability) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NON_UID,
- "folder is not UID capable");
- return NULL;
- }
-
- return CF_CLASS (folder)->get_uid_list (folder, ex);
-}
-
-/**
- * camel_folder_has_search_capability:
- * @folder: Folder object
- *
- * Checks if a folder supports searching.
- *
- * Return value: TRUE if the folder supports UIDs
- **/
-gboolean
-camel_folder_has_search_capability (CamelFolder *folder, CamelException *ex)
-{
- if (!CAMEL_IS_FOLDER(folder)) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "Invalid folder");
- return FALSE;
- }
-
- return folder->has_search_capability;
-}
-
-GList *camel_folder_search_by_expression (CamelFolder *folder,
- const char *expression,
- CamelException *ex)
-{
- if (!CAMEL_IS_FOLDER(folder)) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "Invalid folder");
- return NULL;
- }
-
- return CF_CLASS (folder)->search_by_expression (folder, expression, ex);
-}
-
-/* **** */
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
deleted file mode 100644
index 2a7b0caced..0000000000
--- a/camel/camel-folder.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelFolder.h : Abstract class for an email folder */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_FOLDER_H
-#define CAMEL_FOLDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-typedef struct _CamelFolder CamelFolder;
-
-#include "camel-store.h"
-#include "camel-mime-message.h"
-#include "camel-folder-summary.h"
-#include "camel-exception.h"
-
-#define CAMEL_FOLDER_TYPE (camel_folder_get_type ())
-#define CAMEL_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_FOLDER_TYPE, CamelFolder))
-#define CAMEL_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_FOLDER_TYPE, CamelFolderClass))
-#define CAMEL_IS_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_FOLDER_TYPE))
-
-typedef enum {
- FOLDER_OPEN,
- FOLDER_CLOSE
-} CamelFolderState;
-
-typedef enum {
- FOLDER_OPEN_UNKNOWN = 0, /* folder open mode is unknown */
- FOLDER_OPEN_READ = 1, /* folder is read only */
- FOLDER_OPEN_WRITE = 2, /* folder is write only */
- FOLDER_OPEN_RW = 3 /* folder is read/write */
-} CamelFolderOpenMode;
-
-typedef void (*CamelFolderAsyncCallback) ();
-
-struct _CamelFolder
-{
- GtkObject parent_object;
-
- gboolean can_hold_folders;
- gboolean can_hold_messages;
- CamelFolderOpenMode open_mode;
- CamelFolderState open_state;
- gchar *name;
- gchar *full_name;
- CamelStore *parent_store;
- CamelFolder *parent_folder;
- GList *permanent_flags;
-
- gboolean has_summary_capability;
- CamelFolderSummary *summary;
-
- gboolean has_uid_capability;
-
- gboolean has_search_capability;
-};
-
-
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /* Virtual methods */
- void (*init_with_store) (CamelFolder *folder,
- CamelStore *parent_store,
- CamelException *ex);
-
- void (*open) (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex);
-
- void (*close) (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex);
-
- void (*open_async) (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-
- void (*close_async) (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-
- void (*set_name) (CamelFolder *folder,
- const gchar *name,
- CamelException *ex);
-
- /* void (*set_full_name) (CamelFolder *folder, const gchar *name); */
-
- const gchar * (*get_name) (CamelFolder *folder,
- CamelException *ex);
-
- const gchar * (*get_full_name) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*can_hold_folders) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*can_hold_messages) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*exists) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*is_open) (CamelFolder *folder,
- CamelException *ex);
-
- CamelFolder * (*get_subfolder) (CamelFolder *folder,
- const gchar *folder_name,
- CamelException *ex);
-
- gboolean (*create) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*delete) (CamelFolder *folder,
- gboolean recurse,
- CamelException *ex);
-
- gboolean (*delete_messages) (CamelFolder *folder,
- CamelException *ex);
-
- CamelFolder * (*get_parent_folder) (CamelFolder *folder,
- CamelException *ex);
-
- CamelStore * (*get_parent_store) (CamelFolder *folder,
- CamelException *ex);
-
- CamelFolderOpenMode (*get_mode) (CamelFolder *folder,
- CamelException *ex);
-
- GList * (*list_subfolders) (CamelFolder *folder,
- CamelException *ex);
-
- GList * (*expunge) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*has_message_number_capability) (CamelFolder *folder, CamelException *ex);
-
- CamelMimeMessage * (*get_message_by_number) (CamelFolder *folder,
- gint number,
- CamelException *ex);
-
- gint (*get_message_count) (CamelFolder *folder,
- CamelException *ex);
-
- void (*append_message) (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex);
-
- const GList * (*list_permanent_flags) (CamelFolder *folder,
- CamelException *ex);
-
- void (*copy_message_to) (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelFolder *dest_folder,
- CamelException *ex);
-
- gboolean (*has_uid_capability) (CamelFolder *folder);
-
- const gchar * (*get_message_uid) (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex);
-
- CamelMimeMessage * (*get_message_by_uid) (CamelFolder *folder,
- const gchar *uid,
- CamelException *ex);
-
- GList * (*get_uid_list) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*has_search_capability) (CamelFolder *folder, CamelException *ex);
- GList *(*search_by_expression) (CamelFolder *folder, const char *expression, CamelException *ex);
-
-} CamelFolderClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_folder_get_type (void);
-
-
-/* public methods */
-
-
-
-CamelFolder *camel_folder_get_subfolder (CamelFolder *folder,
- gchar *folder_name,
- CamelException *ex);
-
-void camel_folder_open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex);
-
-
-void camel_folder_close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex);
-
-gboolean camel_folder_create (CamelFolder *folder, CamelException *ex);
-CamelFolder *camel_folder_get_parent_folder (CamelFolder *folder, CamelException *ex);
-CamelStore *camel_folder_get_parent_store (CamelFolder *folder, CamelException *ex);
-GList *camel_folder_list_subfolders (CamelFolder *folder, CamelException *ex);
-
-
-/* delete operations */
-gboolean camel_folder_delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-gboolean camel_folder_delete_messages (CamelFolder *folder, CamelException *ex);
-GList *camel_folder_expunge (CamelFolder *folder, CamelException *ex);
-
-
-/* folder name manipulation operations */
-void camel_folder_set_name (CamelFolder *folder,
- const gchar *name,
- CamelException *ex);
-const gchar *camel_folder_get_name (CamelFolder *folder, CamelException *ex);
-const gchar *camel_folder_get_full_name (CamelFolder *folder, CamelException *ex);
-
-
-/* various properties accessors */
-gboolean camel_folder_exists (CamelFolder *folder, CamelException *ex);
-const GList *camel_folder_list_permanent_flags (CamelFolder *folder, CamelException *ex);
-CamelFolderOpenMode camel_folder_get_mode (CamelFolder *folder, CamelException *ex);
-gboolean camel_folder_is_open (CamelFolder *folder, CamelException *ex);
-
-
-
-/* message manipulation */
-void camel_folder_append_message (CamelFolder *folder,
- CamelMimeMessage *message, CamelException *ex);
-void camel_folder_copy_message_to (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelFolder *dest_folder,
- CamelException *ex);
-
-
-/* summary related operations */
-gboolean camel_folder_has_summary_capability (CamelFolder *folder, CamelException *ex);
-CamelFolderSummary *camel_folder_get_summary (CamelFolder *folder, CamelException *ex);
-
-
-/* number based access operations */
-gboolean camel_folder_has_message_number_capability (CamelFolder *folder, CamelException *ex);
-CamelMimeMessage *camel_folder_get_message_by_number (CamelFolder *folder,
- gint number, CamelException *ex);
-gint camel_folder_get_message_count (CamelFolder *folder, CamelException *ex);
-
-
-/* uid based access operations */
-gboolean camel_folder_has_uid_capability (CamelFolder *folder, CamelException *ex);
-const gchar * camel_folder_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-CamelMimeMessage *camel_folder_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-GList *camel_folder_get_uid_list (CamelFolder *folder, CamelException *ex);
-
-/* search api */
-gboolean camel_folder_has_search_capability (CamelFolder *folder,
- CamelException *ex);
-GList *camel_folder_search_by_expression (CamelFolder *folder,
- const char *expression,
- CamelException *ex);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_FOLDER_H */
-
diff --git a/camel/camel-formatter.c b/camel/camel-formatter.c
deleted file mode 100644
index 50d1d2da6f..0000000000
--- a/camel/camel-formatter.c
+++ /dev/null
@@ -1,901 +0,0 @@
-
-/*--------------------------------*-C-*---------------------------------*
- *
- * Author :
- * Matt Loper <matt@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 Street #330, Boston, MA 02111-1307, USA.
- *
- *----------------------------------------------------------------------*/
-
-#include <config.h>
-#include "camel-formatter.h"
-
-#include "camel-log.h"
-#include <libgnome/libgnome.h>
-#include <ctype.h> // for isprint
-#include <string.h> // for strstr
-
-/*
- * The CamelFormatter takes a mime message, and produces html from it,
- * through the single function camel_formatter_mime_message_to_html().
- * The flow of execution goes something like this:
- *
- * camel_formatter_mime_message_to_html()
- * |
- * V
- * handle_mime_message()
- * |
- * V
- * call_handler_function()
- *
- * Then, 'call_handler_function' acts as a dispatcher, using a
- * hashtable to match a mime type to one of the following functions;
- * note that the below functions sometimes then use
- * 'call_handler_function()' to continue the process recursively.
- */
-
-static void handle_text_plain (CamelFormatter *formatter,
- CamelDataWrapper *wrapper);
-static void handle_text_html (CamelFormatter *formatter,
- CamelDataWrapper *wrapper);
-static void handle_image (CamelFormatter *formatter,
- CamelDataWrapper *wrapper);
-static void handle_vcard (CamelFormatter *formatter,
- CamelDataWrapper *wrapper);
-static void handle_mime_message (CamelFormatter *formatter,
- CamelDataWrapper *wrapper);
-static void handle_multipart_mixed (CamelFormatter *formatter,
- CamelDataWrapper *wrapper);
-static void handle_multipart_related (CamelFormatter *formatter,
- CamelDataWrapper *wrapper);
-static void handle_multipart_alternative(CamelFormatter *formatter,
- CamelDataWrapper *wrapper);
-static void handle_unknown_type (CamelFormatter *formatter,
- CamelDataWrapper *wrapper);
-
-/* encodes some characters into their 'escaped' version;
- * so '<' turns into '&lt;', and '"' turns into '&quot;' */
-static gchar* text_to_html (const guchar *input,
- guint len,
- guint *encoded_len_return);
-
-/* compares strings case-insensitively */
-static gint strcase_equal (gconstpointer v, gconstpointer v2);
-static void str_tolower (gchar* str);
-
-/* writes the header info for a mime message into a stream */
-static void write_header_info_to_stream (CamelMimeMessage* mime_message,
- CamelStream* stream);
-
-static GtkObjectClass *parent_class = NULL;
-
-struct _CamelFormatterPrivate {
- CamelMimeMessage *current_root;
- CamelStream *stream;
- GHashTable *attachments;
-};
-
-
-static void
-debug (const gchar *format, ...)
-{
- va_list args;
- gchar *string;
-
- g_return_if_fail (format != NULL);
-
- va_start (args, format);
- string = g_strdup_vprintf (format, args);
- va_end (args);
-
- fputs (string, stdout);
- fflush (stdout);
-
- g_free (string);
-}
-
-
-/**
- * camel_formatter_mime_message_to_html:
- * @formatter: the camel formatter object
- * @mime_message: the input mime message
- * @stream: byte stream where data will be written
- *
- * Writes a CamelMimeMessage out, as html, into a stream passed in as
- * a parameter.
- **/
-void
-camel_formatter_mime_message_to_html (CamelFormatter* formatter,
- CamelMimeMessage* mime_message,
- CamelStream* header_stream,
- CamelStream* body_stream)
-{
- CamelFormatterPrivate* fmt = formatter->priv;
-
- g_print ("camel_formatter_mime_message_to_html: entered\n");
- g_assert (mime_message);
-
- /* initialize members of our formatter */
- fmt->current_root = mime_message;
- fmt->stream = body_stream;
- if (fmt->attachments)
- g_hash_table_destroy (fmt->attachments);
- fmt->attachments = g_hash_table_new (g_str_hash, strcase_equal);
-
- /* write the subj:, to:, from: etc. fields out as html to the
- header stream */
- if (header_stream)
- write_header_info_to_stream (mime_message,
- header_stream);
-
- /* write everything to the stream */
- if (body_stream) {
-
- camel_stream_write_string (fmt->stream, "<html><body>\n");
-
- handle_mime_message (
- formatter,
- CAMEL_DATA_WRAPPER (mime_message));
-
- camel_stream_write_string (fmt->stream,
- "\n</body></html>\n");
- }
- else {
- g_print ("camel-formatter.c: ");
- g_print ("camel_formatter_mime_message_to_html: ");
- g_print ("you don't want the body??\n");
- }
-}
-
-/* we're maintaining a hashtable of mimetypes -> functions;
- * those functions have the following signature...*/
-typedef void (*mime_handler_fn) (CamelFormatter *formatter,
- CamelDataWrapper *data_wrapper);
-
-static gchar*
-lookup_unique_id (CamelMimeMessage* root, CamelDataWrapper* child)
-{
- /* TODO: assert our return value != NULL */
-
- return "NYI";
-}
-
-static GHashTable* mime_function_table;
-
-/* This tries to create a tag, given a mimetype and the child of a
- * mime message. It can return NULL if it can't match the mimetype to
- * a bonobo object. */
-static gchar*
-get_bonobo_tag_for_object (CamelFormatter* formatter,
- CamelDataWrapper* wrapper,
- gchar* mimetype)
-{
-
- CamelMimeMessage* root = formatter->priv->current_root;
- char* uid = lookup_unique_id (root, wrapper);
- const char* goad_id = gnome_mime_get_value (
- mimetype, "bonobo-goad_id");
-
- g_assert (root);
-
- if (goad_id) {
- char* tag = g_strdup_printf (
- "<object classid=\"%s\" uid=\"camel://%s\">",
- goad_id, uid);
- return tag;
- }
- else
- return NULL;
-}
-
-
-/*
- * This takes a mimetype, and tries to map that mimetype to a function
- * or a bonobo object.
- *
- * - If it's mapped to a bonobo object, this function prints a tag
- * into the stream, designating the bonobo object and a place that
- * the bonobo object can find data to hydrate from
- *
- * - otherwise, the mimetype is mapped to another function, which can
- * print into the stream
- */
-static void
-call_handler_function (CamelFormatter* formatter,
- CamelDataWrapper* wrapper,
- gchar* mimetype_whole, /* ex. "image/jpeg" */
- gchar* mimetype_main) /* ex. "image" */
-{
- mime_handler_fn handler_function = NULL;
-
- g_assert (formatter);
- g_assert (mimetype_whole || mimetype_main);
- g_assert (wrapper);
-
-/*
- * Try to find a handler function in our own lookup table
- */
- str_tolower (mimetype_whole);
- str_tolower (mimetype_main);
-
- if (mimetype_whole)
- handler_function = g_hash_table_lookup (
- mime_function_table, mimetype_whole);
-
- if (mimetype_main && !handler_function)
- handler_function = g_hash_table_lookup (
- mime_function_table, mimetype_main);
-/*
- * Upon failure, try to find a bonobo object to show the object
- */
- if (!handler_function) {
-
- gchar* bonobo_tag = NULL;
-
- if (mimetype_whole)
- bonobo_tag = get_bonobo_tag_for_object (
- formatter, wrapper, mimetype_whole);
-
- if (mimetype_main && !bonobo_tag)
- bonobo_tag = get_bonobo_tag_for_object (
- formatter, wrapper, mimetype_main);
-
- if (bonobo_tag) {
-
- /* we can print a tag, and return! */
- camel_stream_write_string (
- formatter->priv->stream, bonobo_tag);
- g_free (bonobo_tag);
-
- return;
- }
- }
-/*
- * Use either a handler function we've found, or a default handler
- */
- if (handler_function)
- (*handler_function)(formatter, wrapper);
- else {
- handle_unknown_type (formatter, wrapper);
- debug ("no function or bonobo object found for mimetype \"%s\"\n",
- mimetype_whole?mimetype_whole:mimetype_main);
- }
-}
-
-
-/*----------------------------------------------------------------------*
- * Header (ex. "subj:", "from:") helper functions for mime msgs
- *----------------------------------------------------------------------*/
-
-/* This routine was originally written by Daniel Velliard, (C) 1998
- * World Wide Web Consortium.
- * - It will (for example) turn the input 'ab <c>' into 'ab &lt;c&gt;'
- * - It has also been altered to turn '\n' into <br>. */
-static gchar *
-text_to_html (const guchar *input,
- guint len,
- guint *encoded_len_return)
-{
- const guchar *cur = input;
- guchar *buffer = NULL;
- guchar *out = NULL;
- gint buffer_size = 0;
- guint count;
-
- /* Allocate a translation buffer. */
- buffer_size = 1000;
- buffer = g_malloc (buffer_size);
-
- out = buffer;
- count = 0;
-
- while (count < len) {
- if (out - buffer > buffer_size - 100) {
- gint index = out - buffer;
-
- buffer_size *= 2;
- buffer = g_realloc (buffer, buffer_size);
- out = &buffer[index];
- }
-
- /* By default one has to encode at least '<', '>', '"' and '&'. */
- if (*cur == '<') {
- *out++ = '&';
- *out++ = 'l';
- *out++ = 't';
- *out++ = ';';
- } else if (*cur == '>') {
- *out++ = '&';
- *out++ = 'g';
- *out++ = 't';
- *out++ = ';';
- } else if (*cur == '&') {
- *out++ = '&';
- *out++ = 'a';
- *out++ = 'm';
- *out++ = 'p';
- *out++ = ';';
- } else if (*cur == '"') {
- *out++ = '&';
- *out++ = 'q';
- *out++ = 'u';
- *out++ = 'o';
- *out++ = 't';
- *out++ = ';';
- } else if (((*cur >= 0x20) && (*cur < 0x80))
- || (*cur == '\n') || (*cur == '\r') || (*cur == '\t')) {
- /* Default case, just copy. */
- *out++ = *cur;
- } else {
- char buf[10], *ptr;
-
- g_snprintf(buf, 9, "&#%d;", *cur);
-
- ptr = buf;
- while (*ptr != 0)
- *out++ = *ptr++;
- }
-
- /* turn newlines into <br> */
- if (*cur == '\n') {
- *out++ = '<';
- *out++ = 'b';
- *out++ = 'r';
- *out++ = '>';
- }
-
-
- cur++;
- count++;
- }
-
- *out = 0;
- *encoded_len_return = out - buffer;
-
- return buffer;
-}
-
-
-static void
-write_field_to_stream (const gchar* description, const gchar* value,
- CamelStream *stream)
-{
- gchar *s;
- guint ev_length;
- gchar* encoded_value = value?text_to_html (
- value, strlen(value), &ev_length):"";
- int i;
- for (i = 0; i < strlen (value); i++)
- if (!isprint(encoded_value[i]))
- encoded_value[i] = 'Z';
-
- g_assert (description && value);
-
- s = g_strdup_printf ("<b>%s</b>: %s<br>\n",
- description, encoded_value);
-
- camel_stream_write_string (stream, s);
- g_free (encoded_value);
- g_free (s);
-}
-
-
-static void
-write_recipients_to_stream (const gchar* recipient_type,
- const GList* recipients,
- CamelStream* stream)
-{
- /* list of recipients, like "elvis@graceland; bart@springfield" */
- gchar *recipients_string = NULL;
- g_assert (recipient_type && stream);
-
- /* Write out each recipient of 'recipient_type' to the stream */
- while (recipients) {
- gchar *old_string = recipients_string;
- recipients_string = g_strdup_printf (
- "%s%s%s",
- old_string?old_string:"",
- old_string?"; ":"",
- (gchar*)recipients->data);
-
- g_free (old_string);
-
- recipients = recipients->next;
- }
- write_field_to_stream (recipient_type, recipients_string, stream);
-
- g_free (recipients_string);
- camel_stream_write_string (stream, "<br><br>\n");
-}
-
-
-
-static void
-write_header_info_to_stream (CamelMimeMessage* mime_message,
- CamelStream* stream)
-{
- gchar *s = NULL;
- const GList *recipients = NULL;
-
- g_assert (mime_message && stream);
-
- /* A few fields will probably be available from the mime_message;
- for each one that's available, write it to the output stream
- with a helper function, 'write_field_to_stream'. */
- if ((s = (gchar*)camel_mime_message_get_subject (mime_message))) {
- write_field_to_stream ("Subject: ", s, stream);
- }
-
- if ((s = (gchar*)camel_mime_message_get_from (mime_message))) {
- write_field_to_stream ("From: ", s, stream);
- }
-
- if ((s = (gchar*)camel_mime_message_get_received_date (mime_message))) {
- write_field_to_stream ("Received Date: ", s, stream);
- }
-
- if ((s = (gchar*)camel_mime_message_get_sent_date (mime_message))) {
- write_field_to_stream ("Sent Date: ", s, stream);
- }
-
- /* Fill out the "To:" recipients line */
- recipients = camel_mime_message_get_recipients (
- mime_message, CAMEL_RECIPIENT_TYPE_TO);
-
- if (recipients)
- write_recipients_to_stream ("To:", recipients, stream);
-
- /* Fill out the "CC:" recipients line */
- recipients = camel_mime_message_get_recipients (
- mime_message, CAMEL_RECIPIENT_TYPE_CC);
- if (recipients)
- write_recipients_to_stream ("CC:", recipients, stream);
-
- /* Fill out the "BCC:" recipients line */
- recipients = camel_mime_message_get_recipients (
- mime_message, CAMEL_RECIPIENT_TYPE_BCC);
- if (recipients)
- write_recipients_to_stream ("BCC:", recipients, stream);
-}
-
-/* case-insensitive string comparison */
-static gint
-strcase_equal (gconstpointer v, gconstpointer v2)
-{
- return g_strcasecmp ((const gchar*) v, (const gchar*)v2) == 0;
-}
-
-static void
-str_tolower (gchar* str)
-{
- int i;
- int len = strlen (str);
-
- for (i = 0; i < len; i++) {
- str[i] = tolower (str[i]);
- }
-}
-
-
-#define MIME_TYPE_WHOLE(a) (gmime_content_field_get_mime_type ( \
- camel_mime_part_get_content_type (CAMEL_MIME_PART (a))))
-#define MIME_TYPE_MAIN(a) ((camel_mime_part_get_content_type (CAMEL_MIME_PART (a)))->type)
-#define MIME_TYPE_SUB(a) ((camel_mime_part_get_content_type (CAMEL_MIME_PART (a)))->subtype)
-
-
-/*----------------------------------------------------------------------*
- * Mime handling functions
- *----------------------------------------------------------------------*/
-
-static void
-handle_text_plain (CamelFormatter *formatter, CamelDataWrapper *wrapper)
-{
- CamelSimpleDataWrapper* simple_data_wrapper;
- gchar* text;
-
- debug ("handle_text_plain: entered\n");
-
- /* Plain text is embodied in a CamelSimpleDataWrapper */
- g_assert (CAMEL_IS_SIMPLE_DATA_WRAPPER (wrapper));
- simple_data_wrapper = CAMEL_SIMPLE_DATA_WRAPPER (wrapper);
-
- camel_stream_write_string (formatter->priv->stream,
- "\n<!-- text/plain below -->\n");
-
- /* If there's any text, write it to the stream */
- if (simple_data_wrapper->byte_array->len != 0) {
-
- int returned_strlen;
-
- g_assert (simple_data_wrapper->byte_array->data);
-
- /* replace '<' with '&lt;', etc. */
- text = text_to_html (simple_data_wrapper->byte_array->data,
- simple_data_wrapper->byte_array->len,
- &returned_strlen);
-
- camel_stream_write_string (formatter->priv->stream, text);
- g_free (text);
- }
- else
- debug ("Warning: handle_text_plain: length of byte array is zero!\n");
-
- debug ("handle_text_plain: exiting\n");
-}
-
-static void
-handle_text_html (CamelFormatter *formatter, CamelDataWrapper *wrapper)
-{
- CamelSimpleDataWrapper* simple_data_wrapper;
- gchar* text;
-
- debug ("handle_text_html: entered\n");
-
- /* text is embodied in a CamelSimpleDataWrapper */
- g_assert (CAMEL_IS_SIMPLE_DATA_WRAPPER (wrapper));
- simple_data_wrapper = CAMEL_SIMPLE_DATA_WRAPPER (wrapper);
-
- /* If there's any text, write it to the stream */
- if (simple_data_wrapper->byte_array->len != 0) {
-
- int returned_strlen;
-
- g_assert (simple_data_wrapper->byte_array->data);
-
- /* replace '<' with '&lt;', etc. */
- text = g_strndup (simple_data_wrapper->byte_array->data,
- simple_data_wrapper->byte_array->len);
-
- camel_stream_write_string (formatter->priv->stream,
- "\n<!-- text/html below -->\n");
- camel_stream_write_string (formatter->priv->stream, text);
-
- g_free (text);
- }
- else
- debug ("Warning: handle_text_html: length of byte array is zero!\n");
-
- debug ("handle_text_html: exiting\n");
-}
-
-static void
-handle_image (CamelFormatter *formatter, CamelDataWrapper *wrapper)
-{
- gchar* uuid;
- gchar* tag;
-
- debug ("handle_image: entered\n");
-
- uuid = lookup_unique_id (formatter->priv->current_root, wrapper);
-
- tag = g_strdup_printf ("<img src=\"%s\">\n", uuid);
- camel_stream_write_string (formatter->priv->stream, tag);
-
- g_free (uuid);
- g_free (tag);
-
- debug ("handle_image: exiting\n");
-}
-
-static void
-handle_vcard (CamelFormatter *formatter, CamelDataWrapper *wrapper)
-{
- gchar* vcard;
- debug ("handle_vcard: entered\n");
-
- camel_stream_write_string (formatter->priv->stream,
- "\n<!-- image below -->\n");
-// camel_stream_write_string (formatter->priv->stream, vcard);
-// g_free (vcard);
-
- debug ("handle_vcard: exiting\n");
-}
-
-static void
-handle_mime_message (CamelFormatter *formatter,
- CamelDataWrapper *wrapper)
-{
- CamelMimeMessage* mime_message;
- CamelDataWrapper* message_contents;
-
- g_assert (formatter);
- g_assert (wrapper);
- g_assert (CAMEL_IS_MIME_MESSAGE (wrapper));
-
- mime_message = CAMEL_MIME_MESSAGE (wrapper);
- message_contents =
- camel_medium_get_content_object (CAMEL_MEDIUM (mime_message));
-
- g_assert (message_contents);
-
- debug ("handle_mime_message: entered\n");
- camel_stream_write_string (formatter->priv->stream,
- "\n<!-- mime message below -->\n");
-
-// camel_stream_write_string (formatter->priv->stream,
-// "<table width=95% border=1><tr><td>\n\n");
-
- /* dispatch the correct handler function for the mime type */
- call_handler_function (formatter, message_contents,
- MIME_TYPE_WHOLE (mime_message),
- MIME_TYPE_MAIN (mime_message));
-
- /* close up the table we opened */
-// camel_stream_write_string (formatter->priv->stream,
-// "\n\n</td></tr></table>\n\n");
-
- debug ("handle_mime_message: exiting\n");
-}
-
-
-/*
- * multipart-alternative helper function --
- * returns NULL if no text/html or text/plan msg is found
- */
-static CamelMimePart*
-find_preferred_displayable_body_part_in_multipart_alternative (
- CamelMultipart* multipart)
-{
- int i, max_multiparts;
- CamelMimePart* html_part = NULL;
- CamelMimePart* plain_part = NULL;
-
- /* find out out many parts are in it...*/
- max_multiparts = camel_multipart_get_number (multipart);
-
- /* TODO: DO LEAF-LOOKUP HERE FOR OTHER MIME-TYPES!!! */
-
- for (i = 0; i < max_multiparts; i++) {
- CamelMimeBodyPart* body_part = camel_multipart_get_part (multipart, i);
-
- if (!strcase_equal (MIME_TYPE_MAIN (body_part), "text"))
- continue;
-
- if (strcase_equal (MIME_TYPE_SUB (body_part), "plain")) {
- plain_part = CAMEL_MIME_PART (body_part);
- }
- else if (strcase_equal (MIME_TYPE_SUB (body_part), "html")) {
- html_part = CAMEL_MIME_PART (body_part);
- }
- }
-
- if (html_part)
- return html_part;
- if (plain_part)
- return plain_part;
- return NULL;
-}
-
-
-/* called for each body part in a multipart/mixed */
-static void
-print_camel_body_part (CamelMimeBodyPart* body_part,
- CamelFormatter* formatter,
- gboolean* text_printed_yet)
-{
- CamelDataWrapper* contents =
- camel_medium_get_content_object (CAMEL_MEDIUM (body_part));
- gboolean is_text =
- strcase_equal (MIME_TYPE_MAIN (body_part), "text");
-
- if (is_text && *text_printed_yet)
- return;
-
- call_handler_function (formatter, contents, MIME_TYPE_WHOLE (body_part),
- MIME_TYPE_MAIN (body_part));
- camel_stream_write_string (formatter->priv->stream, "\n<hr>\n");
-}
-
-
-
-/* Our policy here is this:
- (1) print text/(plain|html) parts found
- (2) print vcards and images inline
- (3) treat all other parts as attachments */
-static void
-handle_multipart_mixed (CamelFormatter *formatter,
- CamelDataWrapper *wrapper)
-{
- CamelMultipart* mp;
- gboolean text_printed_yet = FALSE;
-
- g_assert (formatter);
- g_assert (wrapper);
- g_assert (CAMEL_IS_MULTIPART (wrapper));
-
- mp = CAMEL_MULTIPART (wrapper);
- g_assert (mp);
-
-// debug ("handle_multipart_mixed: entered\n");
-
-
- {
- int i, max_multiparts;
-
- max_multiparts = camel_multipart_get_number (mp);
- for (i = 0; i < max_multiparts; i++) {
- CamelMimeBodyPart* body_part =
- camel_multipart_get_part (mp, i);
-
- print_camel_body_part (body_part, formatter, &text_printed_yet);
- }
- }
-
-
-// debug ("handle_multipart_mixed: exiting\n");
-}
-
-static void
-handle_multipart_related (CamelFormatter *formatter,
- CamelDataWrapper *wrapper)
-{
- CamelMultipart* mp = CAMEL_MULTIPART (wrapper);
- debug ("handle_multipart_related: entered\n");
-
- debug ("handle_multipart_related: NYI!!\n");
-
- /* TODO: read RFC, in terms of how a one message
- may refer to another object */
-
- debug ("handle_multipart_related: exiting\n");
-}
-
-/*
- The current policy for multipart/alternative is this:
-
- if (we find a text/html body part)
- we print it
- else if (we find a text/plain body part)
- we print it
- else
- we print nothing
-*/
-static void
-handle_multipart_alternative (CamelFormatter *formatter,
- CamelDataWrapper *wrapper)
-{
- CamelMultipart* multipart = CAMEL_MULTIPART (wrapper);
- CamelMimePart* mime_part;
-
- debug ("handle_multipart_alternative: entered\n");
-
- mime_part = find_preferred_displayable_body_part_in_multipart_alternative(
- multipart);
- if (mime_part) {
-
- CamelDataWrapper* contents =
- camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
-
- call_handler_function (formatter, contents,
- MIME_TYPE_WHOLE (mime_part),
- MIME_TYPE_MAIN (mime_part));
- }
-
- debug ("handle_multipart_alternative: exiting\n");
-}
-
-static void
-handle_unknown_type (CamelFormatter *formatter,
- CamelDataWrapper *wrapper)
-{
- gchar* tag;
- CamelMimeMessage* root = formatter->priv->current_root;
- char* uid = lookup_unique_id (root, wrapper);
-
- debug ("handle_unknown_type: entered\n");
-
- tag = g_strdup_printf ("<a href=\"camel://%s\">click-me-to-save</a>\n",
- uid);
-
- camel_stream_write_string (formatter->priv->stream, tag);
-
- debug ("handle_unknown_type: exiting\n");
-}
-
-/*----------------------------------------------------------------------*
- * Standard Gtk+ class functions
- *----------------------------------------------------------------------*/
-
-CamelFormatter*
-camel_formatter_new ()
-{
- return (gtk_type_new (CAMEL_FORMATTER_TYPE));
-}
-
-
-static void
-_finalize (GtkObject* object)
-{
- CamelFormatter *formatter = CAMEL_FORMATTER (object);
-
- if (formatter->priv->attachments)
- g_hash_table_destroy (formatter->priv->attachments);
-
- g_free (formatter->priv);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-camel_formatter_class_init (CamelFormatterClass *camel_formatter_class)
-{
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_formatter_class);
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- mime_function_table =
- g_hash_table_new (g_str_hash, strcase_equal);
-
-#define ADD_HANDLER(a,b) g_hash_table_insert (mime_function_table, a, b)
-
- /* hook up mime types to functions that handle them */
- ADD_HANDLER ("text/plain", handle_text_plain);
- ADD_HANDLER ("text/html", handle_text_html);
- ADD_HANDLER ("multipart/alternative", handle_multipart_alternative);
- ADD_HANDLER ("multipart/related", handle_multipart_related);
- ADD_HANDLER ("multipart/mixed", handle_multipart_mixed);
- ADD_HANDLER ("message/rfc822", handle_mime_message);
- ADD_HANDLER ("image/", handle_image);
- ADD_HANDLER ("vcard/", handle_vcard);
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-}
-
-
-static void
-camel_formatter_init (gpointer object, gpointer klass)
-{
- CamelFormatter* cmf = CAMEL_FORMATTER (object);
- cmf->priv = g_new (CamelFormatterPrivate, 1);
- cmf->priv->attachments = NULL;
-}
-
-
-GtkType
-camel_formatter_get_type (void)
-{
- static GtkType camel_formatter_type = 0;
-
- if (!camel_formatter_type) {
- GtkTypeInfo camel_formatter_info =
- {
- "CamelFormatter",
- sizeof (CamelFormatter),
- sizeof (CamelFormatterClass),
- (GtkClassInitFunc) camel_formatter_class_init,
- (GtkObjectInitFunc) camel_formatter_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_formatter_type = gtk_type_unique (
- gtk_object_get_type (),
- &camel_formatter_info);
- }
-
- return camel_formatter_type;
-}
-
-
-
-
-
-
diff --git a/camel/camel-formatter.h b/camel/camel-formatter.h
deleted file mode 100644
index 186ce6b1e2..0000000000
--- a/camel/camel-formatter.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*--------------------------------*-C-*---------------------------------*
- *
- * Author :
- * Matt Loper <matt@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 Street #330, Boston, MA 02111-1307, USA.
- *
- *
- *----------------------------------------------------------------------*/
-
-#ifndef CAMEL_FORMATTER_H
-#define CAMEL_FORMATTER_H
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel.h"
-
-#define CAMEL_FORMATTER_TYPE (camel_formatter_get_type ())
-#define CAMEL_FORMATTER(obj) (GTK_CHECK_CAST((obj), CAMEL_FORMATTER_TYPE, CamelFormatter))
-#define CAMEL_FORMATTER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_FORMATTER_TYPE, CamelFormatterClass))
-#define CAMEL_IS_CAMEL_FORMATTER(o) (GTK_CHECK_TYPE((o), CAMEL_FORMATTER_TYPE))
-
-typedef struct _CamelFormatterPrivate CamelFormatterPrivate;
-
-typedef struct _CamelFormatter CamelFormatter;
-
-struct _CamelFormatter
-{
- GtkObject parent_object;
- CamelFormatterPrivate *priv;
-};
-
-typedef struct {
- GtkObjectClass parent_class;
-} CamelFormatterClass;
-
-
-/* Standard Gtk function */
-GtkType camel_formatter_get_type (void);
-
-/* Public functions */
-CamelFormatter* camel_formatter_new (void);
-
-/* The main job of CamelFormatter is to take a mime message, and
- produce html from it. */
-void camel_formatter_mime_message_to_html (CamelFormatter* formatter,
- CamelMimeMessage* mime_message,
- CamelStream* header_stream,
- CamelStream* body_stream);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif // CAMEL_FORMATTER_H
-
diff --git a/camel/camel-log.c b/camel/camel-log.c
deleted file mode 100644
index 970986a5ad..0000000000
--- a/camel/camel-log.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-log.h"
-
-int camel_debug_level = CAMEL_LOG_LEVEL_FULL_DEBUG;
-FILE *camel_log_file_descriptor = NULL;
-
-void
-camel_log(guint level, const gchar *format, ... )
-{
- va_list args;
- if (camel_log_file_descriptor == NULL)
- camel_log_file_descriptor = stdout;
-
- if (level<=camel_debug_level)
- {
- va_start(args, format);
- vfprintf(camel_log_file_descriptor, format, args);
- va_end (args);
- }
-}
diff --git a/camel/camel-log.h b/camel/camel-log.h
deleted file mode 100644
index 5337c79f4d..0000000000
--- a/camel/camel-log.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_LOG_H
-#define CAMEL_LOG_H
-
-
-#include <stdarg.h>
-#include <glib.h>
-#include <stdio.h>
-
-extern int camel_debug_level;
-extern FILE *camel_log_file_descriptor;
-
-#define CAMEL_LOG_LEVEL_NO_LOG 0
-#define CAMEL_LOG_LEVEL_STRANGE 5
-#define CAMEL_LOG_LEVEL_WARNING 6
-#define CAMEL_LOG_LEVEL_TRACE 8
-#define CAMEL_LOG_LEVEL_FULL_DEBUG 10
-
-/* #define CAMEL_HARD_LOG_LEVEL CAMEL_LOG_LEVEL_TRACE */
-
-/* the idea here is to be able to have a hard maximum log
-level, given at compilation time, and a soft one, given at
-runtime (with camel_debug_level) */
-
-#if CAMEL_HARD_LOG_LEVEL>=CAMEL_LOG_LEVEL_STRANGE
-#define CAMEL_LOG_STRANGE(args...) camel_log(CAMEL_LOG_LEVEL_STRANGE, ##args)
-#else /* CAMEL_LOG_LEVEL_STRANGE */
-#define CAMEL_LOG_STRANGE(args...)
-#endif /* CAMEL_LOG_LEVEL_STRANGE */
-
-#if CAMEL_HARD_LOG_LEVEL>=CAMEL_LOG_LEVEL_WARNING
-#define CAMEL_LOG_WARNING(args...) camel_log(CAMEL_LOG_LEVEL_WARNING, ##args)
-#else /* CAMEL_LOG_LEVEL_WARNING */
-#define CAMEL_LOG_WARNING(args...)
-#endif /* CAMEL_LOG_LEVEL_WARNING */
-
-#if CAMEL_HARD_LOG_LEVEL>=CAMEL_LOG_LEVEL_TRACE
-#define CAMEL_LOG_TRACE(args...) camel_log(CAMEL_LOG_LEVEL_TRACE, ##args)
-#else /* CAMEL_LOG_LEVEL_TRACE */
-#define CAMEL_LOG_TRACE(args...)
-#endif /* CAMEL_LOG_LEVEL_TRACE */
-
-#if CAMEL_HARD_LOG_LEVEL>=CAMEL_LOG_LEVEL_FULL_DEBUG
-#define CAMEL_LOG_FULL_DEBUG(args...) camel_log(CAMEL_LOG_LEVEL_FULL_DEBUG, ##args)
-#else /* CAMEL_LOG_LEVEL_FULL_DEBUG */
-#define CAMEL_LOG_FULL_DEBUG(args...)
-#endif /* CAMEL_LOG_LEVEL_FULL_DEBUG */
-
-
-
-
-extern void camel_log(guint level, const gchar *format, ... );
-
-#endif /* CAMEL_LOG_H */
diff --git a/camel/camel-marshal-utils.c b/camel/camel-marshal-utils.c
deleted file mode 100644
index ece61d79fc..0000000000
--- a/camel/camel-marshal-utils.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-marshal-utils.c : marshal utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-log.h"
-#include "camel-marshal-utils.h"
-#include "camel-arg-collector.c"
-
-
-#define NB_OP_CHUNKS 20
-static GMemChunk *op_chunk=NULL;
-static GStaticMutex op_chunk_mutex = G_STATIC_MUTEX_INIT;
-
-CamelFuncDef *
-camel_func_def_new (CamelMarshal marshal, guint n_params, ...)
-{
- CamelFuncDef *func_def;
- va_list args;
- GtkType type;
- int i;
-
- func_def = g_new (CamelFuncDef, 1);
- func_def->marshal = marshal;
- func_def->n_params = n_params;
- func_def->params_type = g_new (GtkType, n_params);
-
- va_start (args, n_params);
- for (i=0; i<n_params; i++) {
- type = va_arg (args, GtkType);
- func_def->params_type [i] = type;
- }
- va_end (args);
-
- return func_def;
-}
-
-
-
-
-static gboolean
-_collect_params (GtkArg *params,
- CamelFuncDef *func_def,
- va_list var_args)
-{
- GtkArg *last_param;
- int i;
- gboolean failed = FALSE;
-
-
- for (i=0;
- i<func_def->n_params;
- i++, params++)
- {
- gchar *error;
-
- params->name = NULL;
- params->type = (func_def->params_type) [i];
- CAMEL_ARG_COLLECT_VALUE (params,
- var_args,
- error);
- if (error)
- {
- failed = TRUE;
- CAMEL_LOG_FULL_DEBUG ("CamelMarshall::_collect_params(): %s", error);
- g_free (error);
- }
- }
- return (failed);
-}
-
-
-
-/**
- * camel_marshal_create_op: create an operation
- * @func_def: function definition object
- * @func: function to call
- *
- * create a function ready to be executed. The
- * vari
- *
- *
- * Return value: operation ready to be executed
- **/
-CamelOp *
-camel_marshal_create_op (CamelFuncDef *func_def, CamelFunc func, ...)
-{
- GtkArg *params;
- gboolean error;
- CamelOp *op;
- va_list args;
-
- g_assert (func_def);
-
- op = camel_op_new (func_def);
- op->func = func;
-
- va_start (args, func);
- error = _collect_params (op->params, func_def, args);
- va_end (args);
-
- if (error) {
- camel_op_free (op);
- return NULL;
- } else
- return (op);
-}
-
-
-
-
-/**
- * camel_op_new: return a new CamelOp object
- *
- * The obtained object must be destroyed with
- * camel_op_free ()
- *
- * Return value: the newly allocated CamelOp object
- **/
-CamelOp *
-camel_op_new (CamelFuncDef *func_def)
-{
- CamelOp *op;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::new\n");
- g_static_mutex_lock (&op_chunk_mutex);
- if (!op_chunk)
- op_chunk = g_mem_chunk_create (CamelOp,
- NB_OP_CHUNKS,
- G_ALLOC_AND_FREE);
- g_static_mutex_unlock (&op_chunk_mutex);
-
- op = g_chunk_new (CamelOp, op_chunk);
- op->func_def = func_def;
- op->params = g_new (GtkArg, func_def->n_params);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::new\n");
- return op;
-}
-
-/**
- * camel_op_free: free a CamelOp object allocated with camel_op_new
- * @op: CamelOp object to free
- *
- * Free a CamelOp object allocated with camel_op_new ()
- * this routine won't work with CamelOp objects allocated
- * with other allocators.
- **/
-void
-camel_op_free (CamelOp *op)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::free\n");
- g_free (op->params);
- g_chunk_free (op, op_chunk);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::free\n");
-}
-
-
-/**
- * camel_op_run: run an operation
- * @op: the operation object
- *
- * run an operation
- *
- **/
-void
-camel_op_run (CamelOp *op)
-{
- GtkArg *params;
- gboolean error;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::run\n");
- g_assert (op);
- g_assert (op->func_def);
- g_assert (op->params);
-
- op->func_def->marshal (op->func, op->params);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::run\n");
-}
-
-
-
-
-/**
- * camel_op_set_user_data: set the private field
- * @op: operation
- * @user_data: private field
- *
- * associate a field to an operation object
- **/
-void
-camel_op_set_user_data (CamelOp *op, gpointer user_data)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::set_user_data\n");
- g_assert (op);
- op->user_data = user_data;
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::set_user_data\n");
-}
-
-
-/**
- * camel_op_get_user_data: return the private field
- * @op: operation object
- *
- * return the private field associated to
- * an operation object.
- *
- * Return value:
- **/
-gpointer
-camel_op_get_user_data (CamelOp *op)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::get_user_data\n");
- g_assert (op);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::get_user_data\n");
- return op->user_data;
-}
-
-
-
-/* misc marshaller */
-
-
-typedef void (*CamelMarshal_NONE__POINTER_INT) (gpointer arg1,
- gint arg2);
-void camel_marshal_NONE__POINTER_INT (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_INT rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_INT\n");
- rfunc = (CamelMarshal_NONE__POINTER_INT) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_INT(args[1]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_INT\n");
-}
-
-
-
-
-
-typedef void (*CamelMarshal_NONE__POINTER_INT_POINTER) (gpointer arg1,
- gint arg2,
- gpointer arg3);
-void camel_marshal_NONE__POINTER_INT_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_INT_POINTER rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_INT_POINTER\n");
- rfunc = (CamelMarshal_NONE__POINTER_INT_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_INT(args[1]),
- GTK_VALUE_POINTER(args[2]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_INT_POINTER\n");
-}
-
-
-typedef void (*CamelMarshal_NONE__POINTER_BOOL_POINTER) (gpointer arg1,
- gboolean arg2,
- gpointer arg3);
-void camel_marshal_NONE__POINTER_BOOL_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_BOOL_POINTER rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_BOOL_POINTER\n");
- rfunc = (CamelMarshal_NONE__POINTER_BOOL_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_BOOL(args[1]),
- GTK_VALUE_POINTER(args[2]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_BOOL_POINTER\n");
-}
-
-
-typedef void (*CamelMarshal_NONE__POINTER_INT_POINTER_POINTER) (gpointer arg1,
- gint arg2,
- gpointer arg3,
- gpointer arg4);
-void camel_marshal_NONE__POINTER_INT_POINTER_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_INT_POINTER_POINTER rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_INT_POINTER_POINTER\n");
- rfunc = (CamelMarshal_NONE__POINTER_INT_POINTER_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_INT(args[1]),
- GTK_VALUE_POINTER(args[2]),
- GTK_VALUE_POINTER(args[3]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_INT_POINTER_POINTER\n");
-}
-
-
-
-typedef void (*CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER) (gpointer arg1,
- gboolean arg2,
- gpointer arg3,
- gpointer arg4);
-void camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER\n");
- rfunc = (CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_BOOL(args[1]),
- GTK_VALUE_POINTER(args[2]),
- GTK_VALUE_POINTER(args[3]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER\n");
-}
-
-
-
-typedef void (*CamelMarshal_NONE__POINTER_POINTER_POINTER) (gpointer arg1,
- gpointer arg2,
- gpointer arg3);
-void camel_marshal_NONE__POINTER_POINTER_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_POINTER_POINTER rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_POINTER_POINTER\n");
- rfunc = (CamelMarshal_NONE__POINTER_POINTER_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_POINTER(args[1]),
- GTK_VALUE_POINTER(args[2]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_POINTER_POINTER\n");
-}
-
-
-typedef void (*CamelMarshal_NONE__INT) (gint arg1);
-void camel_marshal_NONE__INT (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__INT rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__INT\n");
- rfunc = (CamelMarshal_NONE__INT) func;
- (* rfunc) (GTK_VALUE_INT (args[0]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__INT\n");
-}
-
-
-
-
-
-
diff --git a/camel/camel-marshal-utils.h b/camel/camel-marshal-utils.h
deleted file mode 100644
index 8ca9901ba2..0000000000
--- a/camel/camel-marshal-utils.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maeshal-utils.h : marshal utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_MARSHAL_UTILS_H
-#define CAMEL_MARSHAL_UTILS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-
-typedef void (*CamelFunc) ();
-
-typedef void ( *CamelMarshal) (CamelFunc func,
- GtkArg *args);
-
-
-
-
-
-typedef struct {
-
- CamelMarshal marshal;
- guint n_params;
- GtkType *params_type;
-
-} CamelFuncDef;
-
-
-
-typedef struct {
- CamelFuncDef *func_def;
- CamelFunc func;
- GtkArg *params;
- gpointer user_data;
-} CamelOp;
-
-
-CamelFuncDef *
-camel_func_def_new (CamelMarshal marshal,
- guint n_params,
- ...);
-
-
-CamelOp *camel_op_new (CamelFuncDef *func_def);
-void camel_op_free (CamelOp *op);
-void camel_op_run (CamelOp *op);
-void camel_op_run_and_free (CamelOp *op);
-void camel_op_set_user_data (CamelOp *op, gpointer user_data);
-gpointer camel_op_get_user_data (CamelOp *op);
-
-CamelOp *camel_marshal_create_op (CamelFuncDef *func_def, CamelFunc func, ...);
-
-/* marshallers */
-void camel_marshal_NONE__POINTER_INT_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__POINTER_BOOL_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__POINTER_INT_POINTER_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__POINTER_POINTER_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__INT (CamelFunc func,
- GtkArg *args);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MARSHAL_UTILS_H */
-
diff --git a/camel/camel-medium.c b/camel/camel-medium.c
deleted file mode 100644
index 95d00280e1..0000000000
--- a/camel/camel-medium.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelMedium.c : Abstract class for a medium */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-medium.h"
-#include <stdio.h>
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include "gmime-utils.h"
-#include "camel-simple-data-wrapper.h"
-
-
-
-
-
-static CamelDataWrapperClass *parent_class=NULL;
-
-/* Returns the class for a CamelMedium */
-#define CM_CLASS(so) CAMEL_MEDIUM_CLASS (GTK_OBJECT(so)->klass)
-
-static void _add_header (CamelMedium *medium, gchar *header_name, gchar *header_value);
-static void _remove_header (CamelMedium *medium, const gchar *header_name);
-static const gchar *_get_header (CamelMedium *medium, const gchar *header_name);
-
-static CamelDataWrapper *_get_content_object(CamelMedium *medium);
-static void _set_content_object(CamelMedium *medium, CamelDataWrapper *content);
-
-static void _finalize (GtkObject *object);
-
-static void
-camel_medium_class_init (CamelMediumClass *camel_medium_class)
-{
- CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_medium_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_data_wrapper_class);
-
- parent_class = gtk_type_class (camel_data_wrapper_get_type ());
-
- /* virtual method definition */
- camel_medium_class->add_header = _add_header;
- camel_medium_class->remove_header = _remove_header;
- camel_medium_class->get_header = _get_header;
-
- camel_medium_class->set_content_object = _set_content_object;
- camel_medium_class->get_content_object = _get_content_object;
-
- /* 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;
-}
-
-static void
-camel_medium_init (gpointer object, gpointer klass)
-{
- CamelMedium *camel_medium = CAMEL_MEDIUM (object);
-
- camel_medium->headers = g_hash_table_new (g_str_hash, g_str_equal);
- camel_medium->content = NULL;
-}
-
-
-
-
-GtkType
-camel_medium_get_type (void)
-{
- static GtkType camel_medium_type = 0;
-
- if (!camel_medium_type) {
- GtkTypeInfo camel_medium_info =
- {
- "CamelMedium",
- sizeof (CamelMedium),
- sizeof (CamelMediumClass),
- (GtkClassInitFunc) camel_medium_class_init,
- (GtkObjectInitFunc) camel_medium_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_medium_type = gtk_type_unique (camel_data_wrapper_get_type (), &camel_medium_info);
- }
-
- return camel_medium_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelMedium *medium = CAMEL_MEDIUM (object);
-
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMedium::finalize\n");
-
- if (medium->headers) {
-#warning Free hash table elements
- g_hash_table_destroy (medium->headers);
- }
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMedium::finalize\n");
-}
-
-
-
-/* **** */
-
-static void
-_add_header (CamelMedium *medium, gchar *header_name, gchar *header_value)
-{
- gboolean header_exists;
- gchar *old_header_name;
- gchar *old_header_value;
-
-
- header_exists = g_hash_table_lookup_extended (medium->headers, header_name,
- (gpointer *) &old_header_name,
- (gpointer *) &old_header_value);
- if (header_exists) {
- g_free (old_header_name);
- g_free (old_header_value);
- }
-
- g_hash_table_insert (medium->headers, header_name, header_value);
-}
-
-
-void
-camel_medium_add_header (CamelMedium *medium, gchar *header_name, gchar *header_value)
-{
- CM_CLASS(medium)->add_header(medium, header_name, header_value);
-}
-
-
-/* **** */
-
-
-static void
-_remove_header (CamelMedium *medium, const gchar *header_name)
-{
-
- gboolean header_exists;
- gchar *old_header_name;
- gchar *old_header_value;
-
- header_exists = g_hash_table_lookup_extended (medium->headers, header_name,
- (gpointer *) &old_header_name,
- (gpointer *) &old_header_value);
- if (header_exists) {
- g_free (old_header_name);
- g_free (old_header_value);
- }
-
- g_hash_table_remove (medium->headers, header_name);
-
-}
-
-void
-camel_medium_remove_header (CamelMedium *medium, const gchar *header_name)
-{
- CM_CLASS(medium)->remove_header(medium, header_name);
-}
-
-
-/* **** */
-
-
-static const gchar *
-_get_header (CamelMedium *medium, const gchar *header_name)
-{
-
- gchar *old_header_name;
- gchar *old_header_value;
- gchar *header_value;
-
- header_value = (gchar *)g_hash_table_lookup (medium->headers, header_name);
- return header_value;
-}
-
-const gchar *
-camel_medium_get_header (CamelMedium *medium, const gchar *header_name)
-{
- return CM_CLASS(medium)->get_header (medium, header_name);
-}
-
-
-/* **** */
-
-
-static CamelDataWrapper *
-_get_content_object (CamelMedium *medium)
-{
- return medium->content;
-
-}
-
-
-CamelDataWrapper *
-camel_medium_get_content_object (CamelMedium *medium)
-{
- return CM_CLASS(medium)->get_content_object (medium);
-}
-
-
-/* **** */
-
-
-static void
-_set_content_object (CamelMedium *medium, CamelDataWrapper *content)
-{
- GMimeContentField *object_content_field;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMedium::set_content_object\n");
- if (medium->content) {
- CAMEL_LOG_FULL_DEBUG ("CamelMedium::set_content_object unreferencing old content object\n");
- gtk_object_unref (GTK_OBJECT (medium->content));
- }
- gtk_object_ref (GTK_OBJECT (content));
- medium->content = content;
-
-}
-
-void
-camel_medium_set_content_object (CamelMedium *medium, CamelDataWrapper *content)
-{
- CM_CLASS(medium)->set_content_object (medium, content);
-}
-
-
-/* **** */
diff --git a/camel/camel-medium.h b/camel/camel-medium.h
deleted file mode 100644
index 5a228ecbde..0000000000
--- a/camel/camel-medium.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-medium.h : class for a medium object */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_MEDIUM_H
-#define CAMEL_MEDIUM_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-data-wrapper.h"
-#include "camel-stream.h"
-
-
-#define CAMEL_MEDIUM_TYPE (camel_medium_get_type ())
-#define CAMEL_MEDIUM(obj) (GTK_CHECK_CAST((obj), CAMEL_MEDIUM_TYPE, CamelMedium))
-#define CAMEL_MEDIUM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MEDIUM_TYPE, CamelMediumClass))
-#define CAMEL_IS_MEDIUM(o) (GTK_CHECK_TYPE((o), CAMEL_MEDIUM_TYPE))
-
-
-typedef struct
-{
- CamelDataWrapper parent_object;
-
- GHashTable *headers;
-
- CamelDataWrapper *content; /* part real content */
-
-} CamelMedium;
-
-
-
-typedef struct {
- CamelDataWrapperClass parent_class;
-
- /* Virtual methods */
- void (*add_header) (CamelMedium *medium, gchar *header_name, gchar *header_value);
- void (*remove_header) (CamelMedium *medium, const gchar *header_name);
- const gchar * (*get_header) (CamelMedium *medium, const gchar *header_name);
-
- CamelDataWrapper * (*get_content_object) (CamelMedium *medium);
- void (*set_content_object) (CamelMedium *medium, CamelDataWrapper *content);
-
-} CamelMediumClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_medium_get_type (void);
-
-
-/* public methods */
-void camel_medium_add_header (CamelMedium *medium, gchar *header_name, gchar *header_value);
-void camel_medium_remove_header (CamelMedium *medium, const gchar *header_name);
-const gchar *camel_medium_get_header (CamelMedium *medium, const gchar *header_name);
-
-
-CamelDataWrapper *camel_medium_get_content_object (CamelMedium *medium);
-void camel_medium_set_content_object (CamelMedium *medium, CamelDataWrapper *content);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MEDIUM_H */
-
diff --git a/camel/camel-mime-body-part.c b/camel/camel-mime-body-part.c
deleted file mode 100644
index ffc8314d1f..0000000000
--- a/camel/camel-mime-body-part.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mime-body-part.c : Abstract class for a mime body part */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-mime-body-part.h"
-#include "camel-log.h"
-
-
-static void _set_parent (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart);
-static const CamelMultipart *_get_parent (CamelMimeBodyPart *mime_body_part);
-
-
-static CamelMimePartClass *parent_class=NULL;
-
-/* Returns the class for a CamelMimeBodyPart */
-#define CMBP_CLASS(so) CAMEL_MIME_BODY_PART_CLASS (GTK_OBJECT(so)->klass)
-
-
-
-static void
-camel_mime_body_part_class_init (CamelMimeBodyPartClass *camel_mime_body_part_class)
-{
- parent_class = gtk_type_class (camel_mime_part_get_type ());
-
- /* virtual method definition */
- camel_mime_body_part_class->set_parent = _set_parent;
- camel_mime_body_part_class->get_parent = _get_parent;
-}
-
-static void
-camel_mime_body_part_init (gpointer object, gpointer klass)
-{
- camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (object), "mime/body-part");
-}
-
-
-
-
-GtkType
-camel_mime_body_part_get_type (void)
-{
- static GtkType camel_mime_body_part_type = 0;
-
- if (!camel_mime_body_part_type) {
- GtkTypeInfo camel_mime_body_part_info =
- {
- "CamelMimeBodyPart",
- sizeof (CamelMimeBodyPart),
- sizeof (CamelMimeBodyPartClass),
- (GtkClassInitFunc) camel_mime_body_part_class_init,
- (GtkObjectInitFunc) camel_mime_body_part_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mime_body_part_type = gtk_type_unique (camel_mime_part_get_type (), &camel_mime_body_part_info);
- }
-
- return camel_mime_body_part_type;
-}
-
-CamelMimeBodyPart *
-camel_mime_body_part_new (void)
-{
- CamelMimeBodyPart *mime_body_part;
- CAMEL_LOG_FULL_DEBUG ("CamelMimeBodyPart:: Entering new()\n");
-
- mime_body_part = (CamelMimeBodyPart *)gtk_type_new (CAMEL_MIME_BODY_PART_TYPE);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimeBodyPart:: Leaving new()\n");
- return mime_body_part;
-}
-
-
-static void
-_set_parent (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart)
-{
- if (mime_body_part->parent) gtk_object_unref (GTK_OBJECT (mime_body_part->parent));
- mime_body_part->parent = multipart;
- if (multipart) gtk_object_ref (GTK_OBJECT (multipart));
-}
-
-
-void
-camel_mime_body_part_set_parent (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart)
-{
- CMBP_CLASS (mime_body_part)->set_parent (mime_body_part, multipart);
-}
-
-
-static const CamelMultipart *
-_get_parent (CamelMimeBodyPart *mime_body_part)
-{
- return mime_body_part->parent;
-}
-
-
-const CamelMultipart *
-camel_mime_body_part_get_parent (CamelMimeBodyPart *mime_body_part)
-{
- return CMBP_CLASS (mime_body_part)->get_parent (mime_body_part);
-}
-
-
diff --git a/camel/camel-mime-body-part.h b/camel/camel-mime-body-part.h
deleted file mode 100644
index 740ab64520..0000000000
--- a/camel/camel-mime-body-part.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mime-body-part.h : class for a mime body part */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_MIME_BODY_PART_H
-#define CAMEL_MIME_BODY_PART_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-typedef struct _CamelMimeBodyPart CamelMimeBodyPart;
-
-#include <gtk/gtk.h>
-#include "camel-mime-part.h"
-#include "camel-multipart.h"
-
-
-
-#define CAMEL_MIME_BODY_PART_TYPE (camel_mime_body_part_get_type ())
-#define CAMEL_MIME_BODY_PART(obj) (GTK_CHECK_CAST((obj), CAMEL_MIME_BODY_PART_TYPE, CamelMimeBodyPart))
-#define CAMEL_MIME_BODY_PART_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MIME_BODY_PART_TYPE, CamelMimeBodyPartClass))
-#define CAMEL_IS_MIME_BODY_PART(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_BODY_PART_TYPE))
-
-
-struct _CamelMimeBodyPart
-{
- CamelMimePart parent_object;
- CamelMultipart *parent;
-
-};
-
-
-
-typedef struct {
- CamelMimePartClass parent_class;
-
- /* Virtual methods */
- void (*set_parent) (CamelMimeBodyPart *mime_body_part,
- CamelMultipart *multipart);
- const CamelMultipart * (*get_parent) (CamelMimeBodyPart *mime_body_part);
-
-} CamelMimeBodyPartClass;
-
-
-/* Standard Gtk function */
-GtkType camel_mime_body_part_get_type (void);
-
-
-/* public methods */
-CamelMimeBodyPart * camel_mime_body_part_new (void);
-void camel_mime_body_part_set_parent (CamelMimeBodyPart *mime_body_part,
- CamelMultipart *multipart);
-const CamelMultipart *camel_mime_body_part_get_parent (CamelMimeBodyPart *mime_body_part);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MIME_BODY_PART_H */
-
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
deleted file mode 100644
index ea7a983331..0000000000
--- a/camel/camel-mime-message.c
+++ /dev/null
@@ -1,717 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelMimeMessage.c : class for a mime_message */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-mime-message.h"
-#include <stdio.h>
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include "gmime-utils.h"
-#include "hash-table-utils.h"
-
-typedef enum {
- HEADER_UNKNOWN,
- HEADER_FROM,
- HEADER_REPLY_TO,
- HEADER_SUBJECT,
- HEADER_TO,
- HEADER_CC,
- HEADER_BCC
-} CamelHeaderType;
-
-static GHashTable *header_name_table;
-
-
-
-static CamelMimePartClass *parent_class=NULL;
-
-static gchar *received_date_str;
-static gchar *sent_date_str;
-static gchar *reply_to_str;
-static gchar *subject_str;
-static gchar *from_str;
-
-static void _set_received_date (CamelMimeMessage *mime_message, const gchar *received_date);
-static const gchar *_get_received_date (CamelMimeMessage *mime_message);
-static const gchar *_get_sent_date (CamelMimeMessage *mime_message);
-static void _set_reply_to (CamelMimeMessage *mime_message, const gchar *reply_to);
-static const gchar *_get_reply_to (CamelMimeMessage *mime_message);
-static void _set_subject (CamelMimeMessage *mime_message, const gchar *subject);
-static const gchar *_get_subject (CamelMimeMessage *mime_message);
-static void _set_from (CamelMimeMessage *mime_message, const gchar *from);
-static const gchar *_get_from (CamelMimeMessage *mime_message);
-static void _add_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
-static void _remove_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
-static const GList *_get_recipients (CamelMimeMessage *mime_message, const gchar *recipient_type);
-static void _set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value);
-static gboolean _get_flag (CamelMimeMessage *mime_message, const gchar *flag);
-static GList *_get_flag_list (CamelMimeMessage *mime_message);
-static void _set_message_number (CamelMimeMessage *mime_message, guint number);
-static guint _get_message_number (CamelMimeMessage *mime_message);
-static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static gboolean _parse_header_pair (CamelMimePart *mime_part, gchar *header_name, gchar *header_value);
-static void _finalize (GtkObject *object);
-
-/* Returns the class for a CamelMimeMessage */
-#define CMM_CLASS(so) CAMEL_MIME_MESSAGE_CLASS (GTK_OBJECT(so)->klass)
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void
-_init_header_name_table()
-{
- header_name_table = g_hash_table_new (g_str_hash, g_str_equal);
- g_hash_table_insert (header_name_table, "From", (gpointer)HEADER_FROM);
- g_hash_table_insert (header_name_table, "Reply-To", (gpointer)HEADER_REPLY_TO);
- g_hash_table_insert (header_name_table, "Subject", (gpointer)HEADER_SUBJECT);
- g_hash_table_insert (header_name_table, "To", (gpointer)HEADER_TO);
- g_hash_table_insert (header_name_table, "Cc", (gpointer)HEADER_CC);
- g_hash_table_insert (header_name_table, "Bcc", (gpointer)HEADER_BCC);
-
-}
-
-static void
-camel_mime_message_class_init (CamelMimeMessageClass *camel_mime_message_class)
-{
- CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_mime_message_class);
- CamelMimePartClass *camel_mime_part_class = CAMEL_MIME_PART_CLASS (camel_mime_message_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_mime_message_class);
-
- parent_class = gtk_type_class (camel_mime_part_get_type ());
- _init_header_name_table();
-
- received_date_str = "";
- sent_date_str = "";
- reply_to_str = "Reply-To";
- subject_str = "Subject";
- from_str = "From";
-
- /* virtual method definition */
- camel_mime_message_class->set_received_date = _set_received_date;
- camel_mime_message_class->get_received_date = _get_received_date;
- camel_mime_message_class->get_sent_date = _get_sent_date;
- camel_mime_message_class->set_reply_to = _set_reply_to;
- camel_mime_message_class->get_reply_to = _get_reply_to;
- camel_mime_message_class->set_subject = _set_subject;
- camel_mime_message_class->get_subject = _get_subject;
- camel_mime_message_class->set_from = _set_from;
- camel_mime_message_class->get_from = _get_from;
- camel_mime_message_class->add_recipient = _add_recipient;
- camel_mime_message_class->remove_recipient = _remove_recipient;
- camel_mime_message_class->get_recipients = _get_recipients;
- camel_mime_message_class->set_flag = _set_flag;
- camel_mime_message_class->get_flag = _get_flag;
- camel_mime_message_class->get_flag_list = _get_flag_list;
- camel_mime_message_class->set_message_number = _set_message_number;
- camel_mime_message_class->get_message_number = _get_message_number;
-
- /* virtual method overload */
- camel_data_wrapper_class->write_to_stream = _write_to_stream;
- camel_mime_part_class->parse_header_pair = _parse_header_pair;
-
- gtk_object_class->finalize = _finalize;
-}
-
-
-
-
-static void
-camel_mime_message_init (gpointer object, gpointer klass)
-{
- CamelMimeMessage *camel_mime_message = CAMEL_MIME_MESSAGE (object);
-
- camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (object), "mime/message");
-
- camel_mime_message->recipients = camel_recipient_table_new ();
- camel_mime_message->flags = g_hash_table_new (g_strcase_hash, g_strcase_equal);
-
- camel_mime_message->received_date = NULL;
- camel_mime_message->sent_date = NULL;
- camel_mime_message->subject = NULL;
- camel_mime_message->reply_to = NULL;
- camel_mime_message->from = NULL;
- camel_mime_message->folder = NULL;
- camel_mime_message->session = NULL;
-}
-
-GtkType
-camel_mime_message_get_type (void)
-{
- static GtkType camel_mime_message_type = 0;
-
- if (!camel_mime_message_type) {
- GtkTypeInfo camel_mime_message_info =
- {
- "CamelMimeMessage",
- sizeof (CamelMimeMessage),
- sizeof (CamelMimeMessageClass),
- (GtkClassInitFunc) camel_mime_message_class_init,
- (GtkObjectInitFunc) camel_mime_message_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mime_message_type = gtk_type_unique (camel_mime_part_get_type (), &camel_mime_message_info);
- }
-
- return camel_mime_message_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelMimeMessage *message = CAMEL_MIME_MESSAGE (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMimeMessage::finalize\n");
- g_free (message->received_date);
- g_free (message->sent_date);
- g_free (message->subject);
- g_free (message->reply_to);
- g_free (message->from);
-
- if (message->recipients) camel_recipient_table_unref (message->recipients);
- if (message->folder) gtk_object_unref (GTK_OBJECT (message->folder));
- if (message->session) gtk_object_unref (GTK_OBJECT (message->session));
-
- if (message->flags)
- g_hash_table_foreach (message->flags, g_hash_table_generic_free, NULL);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMimeMessage::finalize\n");
-}
-
-
-
-CamelMimeMessage *
-camel_mime_message_new_with_session (CamelSession *session)
-{
- CamelMimeMessage *mime_message;
- mime_message = gtk_type_new (CAMEL_MIME_MESSAGE_TYPE);
- mime_message->session = session;
- if (session) gtk_object_ref (GTK_OBJECT (session));
-
- return mime_message;
-}
-
-
-/* some utils func */
-
-static void
-_set_field (CamelMimeMessage *mime_message, gchar *name, const gchar *value, gchar **variable)
-{
- if (variable) {
- g_free (*variable);
- *variable = g_strdup (value);
- }
-}
-
-/* for future use */
-/* for the moment, only @variable is used */
-static gchar *
-_get_field (CamelMimeMessage *mime_message, gchar *name, gchar *variable)
-{
- return variable;
-}
-
-static gboolean
-_check_not_expunged (CamelMimeMessage *mime_message)
-{
- if (mime_message->expunged) {
- CAMEL_LOG_WARNING ("CamelMimeMessage:: An invalid operation has been tempted on an expunged message\n");
- }
- return (!mime_message->expunged);
-}
-
-/* * */
-
-
-static void
-_set_received_date (CamelMimeMessage *mime_message, const gchar *received_date)
-{
- _set_field (mime_message, received_date_str, received_date, &(mime_message->received_date));
-}
-
-void
-camel_mime_message_set_received_date (CamelMimeMessage *mime_message, const gchar *received_date)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->set_received_date (mime_message, received_date);
-}
-
-
-static const gchar *
-_get_received_date (CamelMimeMessage *mime_message)
-{
- return _get_field (mime_message, received_date_str, mime_message->received_date);
-}
-
-const gchar *
-camel_mime_message_get_received_date (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_received_date (mime_message);
-}
-
-
-static const gchar *
-_get_sent_date (CamelMimeMessage *mime_message)
-{
- return _get_field (mime_message, sent_date_str, mime_message->sent_date);
-}
-
-const gchar *
-camel_mime_message_get_sent_date (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_sent_date (mime_message);
-}
-
-
-static void
-_set_reply_to (CamelMimeMessage *mime_message, const gchar *reply_to)
-{
- _set_field (mime_message, reply_to_str, reply_to, &(mime_message->reply_to));
-}
-
-void
-camel_mime_message_set_reply_to (CamelMimeMessage *mime_message, const gchar *reply_to)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->set_reply_to (mime_message, reply_to);
-}
-
-
-static const gchar *
-_get_reply_to (CamelMimeMessage *mime_message)
-{
- return _get_field (mime_message, reply_to_str, mime_message->reply_to);
-}
-
-const gchar *
-camel_mime_message_get_reply_to (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_reply_to (mime_message);
-}
-
-
-
-
-static void
-_set_subject (CamelMimeMessage *mime_message, const gchar *subject)
-{
- _set_field (mime_message, subject_str, subject, &(mime_message->subject));
-}
-
-void
-camel_mime_message_set_subject (CamelMimeMessage *mime_message,
- const gchar *subject)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->set_subject (mime_message, subject);
-}
-
-
-static const gchar *
-_get_subject (CamelMimeMessage *mime_message)
-{
- return _get_field (mime_message, subject_str, mime_message->subject);
-}
-
-const gchar *
-camel_mime_message_get_subject (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_subject (mime_message);
-}
-
-
-
-
-static void
-_set_from (CamelMimeMessage *mime_message, const gchar *from)
-{
- _set_field (mime_message, from_str, from, &(mime_message->from));
-}
-
-void
-camel_mime_message_set_from (CamelMimeMessage *mime_message, const gchar *from)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->set_from (mime_message, from);
-}
-
-
-static const gchar *
-_get_from (CamelMimeMessage *mime_message)
-{
- return _get_field (mime_message, from_str, mime_message->from);
-}
-
-const gchar *
-camel_mime_message_get_from (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_from (mime_message);
-}
-
-
-
-
-
-
-
-/* **** */
-
-
-
-
-
-static void
-_add_recipient (CamelMimeMessage *mime_message,
- const gchar *recipient_type,
- const gchar *recipient)
-{
- camel_recipient_table_add (mime_message->recipients, recipient_type, recipient);
-}
-
-
-
-void
-camel_mime_message_add_recipient (CamelMimeMessage *mime_message,
- const gchar *recipient_type,
- const gchar *recipient)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->add_recipient (mime_message, recipient_type, recipient);
-}
-
-
-static void
-_remove_recipient (CamelMimeMessage *mime_message,
- const gchar *recipient_type,
- const gchar *recipient)
-{
- camel_recipient_table_remove (mime_message->recipients, recipient_type, recipient);
-}
-
-
-void
-camel_mime_message_remove_recipient (CamelMimeMessage *mime_message,
- const gchar *recipient_type,
- const gchar *recipient)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->remove_recipient (mime_message, recipient_type, recipient);
-}
-
-
-static const GList *
-_get_recipients (CamelMimeMessage *mime_message,
- const gchar *recipient_type)
-{
- return camel_recipient_table_get (mime_message->recipients, recipient_type);
-}
-
-
-const GList *
-camel_mime_message_get_recipients (CamelMimeMessage *mime_message,
- const gchar *recipient_type)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_recipients (mime_message, recipient_type);
-}
-
-
-
-/* **** */
-
-
-
-static void
-_set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value)
-{
- gchar *old_flags;
- gboolean ptr_value;
-
- if (! g_hash_table_lookup_extended (mime_message->flags,
- flag,
- (gpointer)&(old_flags),
- (gpointer)&(ptr_value)) ) {
-
- g_hash_table_insert (mime_message->flags, g_strdup (flag), GINT_TO_POINTER (value));
- } else
- g_hash_table_insert (mime_message->flags, old_flags, GINT_TO_POINTER (value));
-
-}
-
-void
-camel_mime_message_set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->set_flag (mime_message, flag, value);
-}
-
-
-
-static gboolean
-_get_flag (CamelMimeMessage *mime_message, const gchar *flag)
-{
- return GPOINTER_TO_INT (g_hash_table_lookup (mime_message->flags, flag));
-}
-
-gboolean
-camel_mime_message_get_flag (CamelMimeMessage *mime_message, const gchar *flag)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), FALSE);
- return CMM_CLASS (mime_message)->get_flag (mime_message, flag);
-}
-
-
-
-static void
-_add_flag_to_list (gpointer key, gpointer value, gpointer user_data)
-{
- GList **flag_list = (GList **)user_data;
- gchar *flag_name = (gchar *)key;
-
- if ((flag_name) && (flag_name[0] != '\0'))
- *flag_list = g_list_append (*flag_list, flag_name);
-}
-
-static GList *
-_get_flag_list (CamelMimeMessage *mime_message)
-{
- GList *flag_list = NULL;
-
- if (mime_message->flags)
- g_hash_table_foreach (mime_message->flags, _add_flag_to_list, &flag_list);
- return flag_list;
-}
-
-
-GList *
-camel_mime_message_get_flag_list (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_flag_list (mime_message);
-}
-
-
-
-static void
-_set_message_number (CamelMimeMessage *mime_message, guint number)
-{
- mime_message->message_number = number;
-}
-
-static guint
-_get_message_number (CamelMimeMessage *mime_message)
-{
- return mime_message->message_number;
-}
-
-
-
-guint
-camel_mime_message_get_message_number (CamelMimeMessage *mime_message)
-{
- return CMM_CLASS (mime_message)->get_message_number (mime_message);
-}
-
-
-
-
-#ifdef WHPT
-#warning : WHPT is already defined !!!!!!
-#endif
-#define WHPT gmime_write_header_pair_to_stream
-
-static void
-_write_one_recipient_to_stream (gchar *recipient_type,
- GList *recipient_list,
- gpointer user_data)
-{
-
- CamelStream *stream = (CamelStream *)user_data;
- if (recipient_type)
- gmime_write_header_with_glist_to_stream (stream, recipient_type, recipient_list, ", ");
-}
-
-static void
-_write_recipients_to_stream (CamelMimeMessage *mime_message, CamelStream *stream)
-{
- camel_recipient_foreach_recipient_type (mime_message->recipients,
- _write_one_recipient_to_stream,
- (gpointer)stream);
-}
-
-static void
-_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelMimeMessage *mm = CAMEL_MIME_MESSAGE (data_wrapper);
-
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage::write_to_stream\n");
-
-
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage:: Writing \"From\"\n");
- WHPT (stream, "From", mm->from);
-
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage:: Writing \"Reply-To\"\n");
- WHPT (stream, "Reply-To", mm->reply_to);
-
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage:: Writing recipients\n");
- _write_recipients_to_stream (mm, stream);
-
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage:: Writing \"Date\"\n");
- WHPT (stream, "Date", mm->received_date);
-
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage:: Writing \"Subject\"\n");
- WHPT (stream, "Subject", mm->subject);
-
- /* FIXME correct to do it here? */
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage:: Writing \"Mime-Version\"\n");
- WHPT (stream, "Mime-Version", "1.0");
-
- CAMEL_DATA_WRAPPER_CLASS (parent_class)->write_to_stream (data_wrapper, stream);
-
-}
-
-/*******************************/
-/* mime message header parsing */
-
-static void
-_set_recipient_list_from_string (CamelMimeMessage *message, gchar *recipient_type, gchar *recipients_string)
-{
- GList *recipients_list;
- GList *tmp;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimeMessage::_set_recipient_list_from_string parsing ##%s##\n", recipients_string);
- recipients_list = string_split (
- recipients_string, ',', "\t ",
- STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING);
-
- camel_recipient_table_add_list (message->recipients, recipient_type, recipients_list);
-
-}
-
-static gboolean
-_parse_header_pair (CamelMimePart *mime_part, gchar *header_name, gchar *header_value)
-{
- CamelHeaderType header_type;
- CamelMimeMessage *message = CAMEL_MIME_MESSAGE (mime_part);
- gboolean header_handled = FALSE;
-
-
- header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, header_name);
- switch (header_type) {
-
- case HEADER_FROM:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimeMessage::parse_header_pair found HEADER_FROM : %s\n",
- header_value );
-
- camel_mime_message_set_from (message, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_REPLY_TO:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimeMessage::parse_header_pair found HEADER_REPLY_YO : %s\n",
- header_value );
-
- camel_mime_message_set_reply_to (message, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_SUBJECT:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimeMessage::parse_header_pair found HEADER_SUBJECT : %s\n",
- header_value );
-
- camel_mime_message_set_subject (message, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_TO:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimeMessage::parse_header_pair found HEADER_TO : %s\n",
- header_value );
-
- _set_recipient_list_from_string (message, "To", header_value);
- g_free (header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_CC:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimeMessage::parse_header_pair found HEADER_CC : %s\n",
- header_value );
-
- _set_recipient_list_from_string (message, "Cc", header_value);
- g_free (header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_BCC:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimeMessage::parse_header_pair found HEADER_BCC : %s\n",
- header_value );
-
- _set_recipient_list_from_string (message, "Bcc", header_value);
- g_free (header_value);
- header_handled = TRUE;
- break;
-
-
- }
- if (header_handled) {
- g_free (header_name);
- return TRUE;
- } else
- return parent_class->parse_header_pair (mime_part, header_name, header_value);
-
-
-}
-
diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h
deleted file mode 100644
index 69cf840a62..0000000000
--- a/camel/camel-mime-message.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelMimeMessage.h : class for a mime message */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_MIME_MESSAGE_H
-#define CAMEL_MIME_MESSAGE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-typedef struct _CamelMimeMessage CamelMimeMessage;
-
-#include <gtk/gtk.h>
-#include "camel-mime-part.h"
-#include "camel-folder.h"
-#include "camel-session.h"
-#include "camel-recipient.h"
-
-
-#define CAMEL_RECIPIENT_TYPE_TO "To"
-#define CAMEL_RECIPIENT_TYPE_CC "Cc"
-#define CAMEL_RECIPIENT_TYPE_BCC "Bcc"
-
-
-#define CAMEL_MIME_MESSAGE_TYPE (camel_mime_message_get_type ())
-#define CAMEL_MIME_MESSAGE(obj) (GTK_CHECK_CAST((obj), CAMEL_MIME_MESSAGE_TYPE, CamelMimeMessage))
-#define CAMEL_MIME_MESSAGE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MIME_MESSAGE_TYPE, CamelMimeMessageClass))
-#define CAMEL_IS_MIME_MESSAGE(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_MESSAGE_TYPE))
-
-
-
-struct _CamelMimeMessage
-{
- CamelMimePart parent_object;
-
- /* header fields */
- gchar *received_date;
- gchar *sent_date;
-
- gchar *subject;
- gchar *reply_to;
-
- gchar *from;
- CamelRecipientTable *recipients;
-
- /* other fields */
- GHashTable *flags; /* boolean values */
- gboolean expunged;
-
- guint message_number; /* set by folder object when retrieving message */
- gchar *message_uid;
-
- CamelFolder *folder;
- CamelSession *session;
-
-};
-
-
-
-typedef struct {
- CamelMimePartClass parent_class;
-
- /* Virtual methods */
- void (*set_received_date) (CamelMimeMessage *mime_message, gchar *received_date);
- const gchar * (*get_received_date) (CamelMimeMessage *mime_message);
- const gchar * (*get_sent_date) (CamelMimeMessage *mime_message);
- void (*set_reply_to) (CamelMimeMessage *mime_message, const gchar *reply_to);
- const gchar * (*get_reply_to) (CamelMimeMessage *mime_message);
- void (*set_subject) (CamelMimeMessage *mime_message, const gchar *subject);
- const gchar * (*get_subject) (CamelMimeMessage *mime_message);
- void (*set_from) (CamelMimeMessage *mime_message, const gchar *from);
- const gchar * (*get_from) (CamelMimeMessage *mime_message);
- void (*add_recipient) (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
- void (*remove_recipient) (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
- const GList * (*get_recipients) (CamelMimeMessage *mime_message, const gchar *recipient_type);
- void (*set_flag) (CamelMimeMessage *mime_message, const gchar *flag, gboolean value);
- gboolean (*get_flag) (CamelMimeMessage *mime_message, const gchar *flag);
- GList * (*get_flag_list) (CamelMimeMessage *mime_message);
- void (*set_message_number)(CamelMimeMessage *mime_message, guint number);
- guint (*get_message_number)(CamelMimeMessage *mime_message);
-} CamelMimeMessageClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_mime_message_get_type (void);
-
-
-/* public methods */
-CamelMimeMessage *camel_mime_message_new_with_session (CamelSession *session);
-
-
-void camel_mime_message_set_received_date (CamelMimeMessage *mime_message, const gchar *received_date);
-const gchar *camel_mime_message_get_received_date (CamelMimeMessage *mime_message);
-const gchar *camel_mime_message_get_sent_date (CamelMimeMessage *mime_message);
-void camel_mime_message_set_reply_to (CamelMimeMessage *mime_message, const gchar *reply_to);
-const gchar *camel_mime_message_get_reply_to (CamelMimeMessage *mime_message);
-void camel_mime_message_set_subject (CamelMimeMessage *mime_message, const gchar *subject);
-const gchar *camel_mime_message_get_subject (CamelMimeMessage *mime_message);
-void camel_mime_message_set_from (CamelMimeMessage *mime_message, const gchar *from);
-const gchar *camel_mime_message_get_from (CamelMimeMessage *mime_message);
-
-void camel_mime_message_add_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
-void camel_mime_message_remove_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
-const GList *camel_mime_message_get_recipients (CamelMimeMessage *mime_message, const gchar *recipient_type);
-
-void camel_mime_message_set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value);
-gboolean camel_mime_message_get_flag (CamelMimeMessage *mime_message, const gchar *flag);
-GList *camel_mime_message_get_flag_list (CamelMimeMessage *mime_message);
-
-guint camel_mime_message_get_message_number (CamelMimeMessage *mime_message);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MIME_MESSAGE_H */
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
deleted file mode 100644
index 6a06bc3bce..0000000000
--- a/camel/camel-mime-part-utils.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mime-part-utils : Utility for mime parsing and so on */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 "gmime-content-field.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include "gmime-utils.h"
-#include "camel-simple-data-wrapper.h"
-#include "data-wrapper-repository.h"
-
-#include "camel-mime-part-utils.h"
-
-
-
-/* declare this function because it is public
- but it must not be called except here */
-void camel_mime_part_set_content_type (CamelMimePart *mime_part,
- gchar *content_type);
-
-
-void
-camel_mime_part_construct_headers_from_stream (CamelMimePart *mime_part,
- CamelStream *stream)
-{
- GArray *header_array;
- Rfc822Header *cur_header;
- int i;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils:: "
- "Entering _construct_headers_from_stream\n");
- g_assert (stream);
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_headers_from_stream "
- "parsing headers\n");
- /*
- * parse all header lines
- */
- header_array = get_header_array_from_stream (stream);
- if (header_array) {
- for (i=0; i<header_array->len; i++) {
- cur_header = (Rfc822Header *)header_array->data + i;
- camel_medium_add_header ( CAMEL_MEDIUM (mime_part),
- cur_header->name,
- cur_header->value);
- }
-
- g_array_free (header_array, TRUE);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_headers_from_stream "
- "headers parsed. Leaving \n");
- }
-}
-
-
-
-
-
-void
-camel_mime_part_construct_content_from_stream (CamelMimePart *mime_part,
- CamelStream *stream)
-{
- GMimeContentField *content_type = NULL;
- gchar *mime_type = NULL;
- GtkType content_object_type;
- CamelDataWrapper *content_object = NULL;
-
-
- /*
- * find content mime type
- */
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream "
- "parsing content\n");
-
- content_type = camel_mime_part_get_content_type (mime_part);
- /* here we should have a mime type */
- g_assert (content_type);
- if (content_type)
- mime_type = gmime_content_field_get_mime_type (content_type);
-
- /*
- * no mime type found for the content,
- * using text/plain is the default
- */
- if (!mime_type) {
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream "
- "content type field not found "
- "using default \"text/plain\"\n");
- mime_type = g_strdup ("text/plain");
- camel_mime_part_set_content_type (mime_part, mime_type);
- }
-
- /*
- * find in the repository what particular data wrapper is
- * associated to this mime type
- */
- content_object_type =
- data_wrapper_repository_get_data_wrapper_type (mime_type);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream content"
- " type object type used: %s\n",
- gtk_type_name (content_object_type));
-
- g_free (mime_type);
-
- /*
- * create the content object data wrapper with the type
- * returned by the data wrapper repository
- */
- content_object = CAMEL_DATA_WRAPPER (gtk_type_new (content_object_type));
- camel_data_wrapper_set_mime_type_field (content_object,
- camel_mime_part_get_content_type (mime_part));
- camel_medium_set_content_object ( CAMEL_MEDIUM (mime_part), content_object);
-
- /* set the input stream for the content object */
- camel_data_wrapper_set_input_stream (content_object, stream);
-
- /*
- * the object is referenced in the set_content_object method,
- * so unref it here
- */
- gtk_object_unref (GTK_OBJECT (content_object));
-
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream "
- "content parsed\n");
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils:: Leaving _construct_content_from_stream\n");
-}
-
-
-
-void
-camel_mime_part_store_stream_in_buffer (CamelMimePart *mime_part,
- CamelStream *stream)
-{
- gint nb_bytes_read_total = 0;
- gint nb_bytes_read_chunk;
- GByteArray *buffer;
-#define STREAM_READ_CHUNK_SZ 100
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::store_stream_in_buffer entering\n");
-
- if (mime_part->temp_message_buffer == NULL)
- mime_part->temp_message_buffer = g_byte_array_new ();
-
- buffer = mime_part->temp_message_buffer;
-
- g_byte_array_set_size (buffer, nb_bytes_read_total + STREAM_READ_CHUNK_SZ);
- nb_bytes_read_chunk = camel_stream_read (stream,
- buffer->data + nb_bytes_read_total,
- STREAM_READ_CHUNK_SZ);
-
- if (nb_bytes_read_chunk>0) {
- nb_bytes_read_total += nb_bytes_read_chunk;
-
- while (nb_bytes_read_chunk >0) {
- g_byte_array_set_size (buffer, nb_bytes_read_total + STREAM_READ_CHUNK_SZ);
- nb_bytes_read_chunk = camel_stream_read (stream,
- buffer->data + nb_bytes_read_total,
- STREAM_READ_CHUNK_SZ);
- nb_bytes_read_total += nb_bytes_read_chunk;
- }
- }
-
- g_byte_array_set_size (buffer, nb_bytes_read_total);
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::store_stream_in_buffer entering\n");
-
-}
diff --git a/camel/camel-mime-part-utils.h b/camel/camel-mime-part-utils.h
deleted file mode 100644
index 7edbf5d603..0000000000
--- a/camel/camel-mime-part-utils.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mime-part-utils : Utility for mime parsing and so on */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_MIME_PART_UTILS_H
-#define CAMEL_MIME_PART_UTILS_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-mime-part.h"
-
-
-void camel_mime_part_construct_headers_from_stream (CamelMimePart *mime_part,
- CamelStream *stream);
-
-void camel_mime_part_construct_content_from_stream (CamelMimePart *mime_part,
- CamelStream *stream);
-
-void camel_mime_part_store_stream_in_buffer (CamelMimePart *mime_part,
- CamelStream *stream);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MIME_PART_UTILS_H */
-
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
deleted file mode 100644
index 2e52f8312f..0000000000
--- a/camel/camel-mime-part.c
+++ /dev/null
@@ -1,913 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelMimePart.c : Abstract class for a mime_part */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 <string.h>
-#include "camel-mime-part.h"
-#include <stdio.h>
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include "gmime-utils.h"
-#include "camel-simple-data-wrapper.h"
-#include "hash-table-utils.h"
-#include "camel-stream-mem.h"
-#include "camel-mime-part-utils.h"
-#include "gmime-base64.h"
-#include "camel-seekable-substream.h"
-
-
-typedef enum {
- HEADER_UNKNOWN,
- HEADER_DESCRIPTION,
- HEADER_DISPOSITION,
- HEADER_CONTENT_ID,
- HEADER_ENCODING,
- HEADER_CONTENT_MD5,
- HEADER_CONTENT_LANGUAGES,
- HEADER_CONTENT_TYPE
-} CamelHeaderType;
-
-
-static GHashTable *header_name_table;
-
-
-static CamelMediumClass *parent_class=NULL;
-
-/* Returns the class for a CamelMimePart */
-#define CMP_CLASS(so) CAMEL_MIME_PART_CLASS (GTK_OBJECT(so)->klass)
-
-/* from GtkObject */
-static void _finalize (GtkObject *object);
-
-/* from CamelDataWrapper */
-static void _write_to_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-static void _construct_from_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-static void _set_input_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-
-
-/* from CamelMedia */
-static void _add_header (CamelMedium *medium,
- gchar *header_name,
- gchar *header_value);
-
-static void _set_content_object (CamelMedium *medium,
- CamelDataWrapper *content);
-static CamelDataWrapper *_get_content_object (CamelMedium *medium);
-
-
-
-/* from CamelMimePart */
-static void _set_description (CamelMimePart *mime_part,
- const gchar *description);
-static const gchar * _get_description (CamelMimePart *mime_part);
-static void _set_disposition (CamelMimePart *mime_part,
- const gchar *disposition);
-static const gchar * _get_disposition (CamelMimePart *mime_part);
-static void _set_filename (CamelMimePart *mime_part,
- gchar *filename);
-static const gchar * _get_filename (CamelMimePart *mime_part);
-static void _set_content_id (CamelMimePart *mime_part,
- gchar *content_id);
-static const gchar * _get_content_id (CamelMimePart *mime_part);
-static void _set_content_MD5 (CamelMimePart *mime_part,
- gchar *content_MD5);
-static const gchar * _get_content_MD5 (CamelMimePart *mime_part);
-static void _set_encoding (CamelMimePart *mime_part,
- CamelMimePartEncodingType encoding);
-static CamelMimePartEncodingType _get_encoding (CamelMimePart *mime_part);
-static void _set_content_languages (CamelMimePart *mime_part,
- GList *content_languages);
-static const GList * _get_content_languages (CamelMimePart *mime_part);
-static void _set_header_lines (CamelMimePart *mime_part,
- GList *header_lines);
-static const GList * _get_header_lines (CamelMimePart *mime_part);
-static void _set_content_type (CamelMimePart *mime_part,
- const gchar *content_type);
-static GMimeContentField *_get_content_type (CamelMimePart *mime_part);
-
-static gboolean _parse_header_pair (CamelMimePart *mime_part,
- gchar *header_name,
- gchar *header_value);
-
-
-
-/* loads in a hash table the set of header names we */
-/* recognize and associate them with a unique enum */
-/* identifier (see CamelHeaderType above) */
-static void
-_init_header_name_table()
-{
- header_name_table = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- g_hash_table_insert (header_name_table, "Content-Description", (gpointer)HEADER_DESCRIPTION);
- g_hash_table_insert (header_name_table, "Content-Disposition", (gpointer)HEADER_DISPOSITION);
- g_hash_table_insert (header_name_table, "Content-id", (gpointer)HEADER_CONTENT_ID);
- g_hash_table_insert (header_name_table, "Content-Transfer-Encoding", (gpointer)HEADER_ENCODING);
- g_hash_table_insert (header_name_table, "Content-MD5", (gpointer)HEADER_CONTENT_MD5);
- g_hash_table_insert (header_name_table, "Content-Type", (gpointer)HEADER_CONTENT_TYPE);
-
-}
-
-static void
-camel_mime_part_class_init (CamelMimePartClass *camel_mime_part_class)
-{
- CamelMediumClass *camel_medium_class = CAMEL_MEDIUM_CLASS (camel_mime_part_class);
- CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_mime_part_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_data_wrapper_class);
-
- parent_class = gtk_type_class (camel_medium_get_type ());
- _init_header_name_table();
-
- /* virtual method definition */
- camel_mime_part_class->set_description = _set_description;
- camel_mime_part_class->get_description = _get_description;
- camel_mime_part_class->set_disposition = _set_disposition;
- camel_mime_part_class->get_disposition = _get_disposition;
- camel_mime_part_class->set_filename = _set_filename;
- camel_mime_part_class->get_filename = _get_filename;
- camel_mime_part_class->set_content_id = _set_content_id;
- camel_mime_part_class->get_content_id = _get_content_id;
- camel_mime_part_class->set_content_MD5 = _set_content_MD5;
- camel_mime_part_class->get_content_MD5 = _get_content_MD5;
- camel_mime_part_class->set_encoding = _set_encoding;
- camel_mime_part_class->get_encoding = _get_encoding;
- camel_mime_part_class->set_content_languages = _set_content_languages;
- camel_mime_part_class->get_content_languages = _get_content_languages;
- camel_mime_part_class->set_header_lines = _set_header_lines;
- camel_mime_part_class->get_header_lines = _get_header_lines;
- camel_mime_part_class->set_content_type = _set_content_type;
- camel_mime_part_class->get_content_type = _get_content_type;
-
- camel_mime_part_class->parse_header_pair = _parse_header_pair;
-
- /* virtual method overload */
- camel_medium_class->add_header = _add_header;
- camel_medium_class->set_content_object = _set_content_object;
- camel_medium_class->get_content_object = _get_content_object;
-
- camel_data_wrapper_class->write_to_stream = _write_to_stream;
- camel_data_wrapper_class->construct_from_stream = _construct_from_stream;
- camel_data_wrapper_class->set_input_stream = _set_input_stream;
-
- gtk_object_class->finalize = _finalize;
-}
-
-static void
-camel_mime_part_init (gpointer object, gpointer klass)
-{
- CamelMimePart *camel_mime_part = CAMEL_MIME_PART (object);
-
- camel_mime_part->content_type = gmime_content_field_new (NULL, NULL);
- camel_mime_part->description = NULL;
- camel_mime_part->disposition = NULL;
- camel_mime_part->content_id = NULL;
- camel_mime_part->content_MD5 = NULL;
- camel_mime_part->content_languages = NULL;
- camel_mime_part->encoding = CAMEL_MIME_PART_ENCODING_DEFAULT;
- camel_mime_part->filename = NULL;
- camel_mime_part->header_lines = NULL;
-
- camel_mime_part->temp_message_buffer = NULL;
-
-}
-
-
-
-
-GtkType
-camel_mime_part_get_type (void)
-{
- static GtkType camel_mime_part_type = 0;
-
- if (!camel_mime_part_type) {
- GtkTypeInfo camel_mime_part_info =
- {
- "CamelMimePart",
- sizeof (CamelMimePart),
- sizeof (CamelMimePartClass),
- (GtkClassInitFunc) camel_mime_part_class_init,
- (GtkObjectInitFunc) camel_mime_part_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mime_part_type = gtk_type_unique (camel_medium_get_type (), &camel_mime_part_info);
- }
-
- return camel_mime_part_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelMimePart *mime_part = CAMEL_MIME_PART (object);
-
-#warning do something for (mime_part->disposition) which should not be a GMimeContentField
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMimePart::finalize\n");
-
- g_free (mime_part->description);
- gmime_content_field_unref (mime_part->disposition);
- g_free (mime_part->content_id);
- g_free (mime_part->content_MD5);
- string_list_free (mime_part->content_languages);
- g_free (mime_part->filename);
- if (mime_part->header_lines) string_list_free (mime_part->header_lines);
-
- if (mime_part->content_type) gmime_content_field_unref (mime_part->content_type);
- if (mime_part->temp_message_buffer) g_byte_array_free (mime_part->temp_message_buffer, TRUE);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMimePart::finalize\n");
-}
-
-
-/* **** */
-
-static void
-_add_header (CamelMedium *medium, gchar *header_name, gchar *header_value)
-{
- CamelMimePart *mime_part = CAMEL_MIME_PART (medium);
-
- /* Try to parse the header pair. If it corresponds to something */
- /* known, the job is done in the parsing routine. If not, */
- /* we simply add the header in a raw fashion */
- if (! CMP_CLASS(mime_part)->parse_header_pair (mime_part, header_name, header_value) )
- parent_class->add_header (medium, header_name, header_value);
-}
-
-
-
-
-
-
-static void
-_set_description (CamelMimePart *mime_part, const gchar *description)
-{
- g_free (mime_part->description);
- mime_part->description = g_strdup (description);
-}
-
-void
-camel_mime_part_set_description (CamelMimePart *mime_part, const gchar *description)
-{
- CMP_CLASS(mime_part)->set_description (mime_part, description);
-}
-
-
-
-/* **** */
-
-
-
-static const gchar *
-_get_description (CamelMimePart *mime_part)
-{
- return mime_part->description;
-}
-
-const gchar *
-camel_mime_part_get_description (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_description (mime_part);
-}
-
-
-
-/* **** */
-
-
-static void
-_set_disposition (CamelMimePart *mime_part, const gchar *disposition)
-{
-#warning Do not use MimeContentfield here !!!
-
- if (mime_part->disposition) g_free ((mime_part->disposition)->type);
- g_free (mime_part->disposition);
-
- mime_part->disposition = g_new0 (GMimeContentField,1);
- (mime_part->disposition)->type = g_strdup (disposition);
-}
-
-
-void
-camel_mime_part_set_disposition (CamelMimePart *mime_part, const gchar *disposition)
-{
- CMP_CLASS(mime_part)->set_disposition (mime_part, disposition);
-}
-
-
-/* **** */
-
-
-
-static const gchar *
-_get_disposition (CamelMimePart *mime_part)
-{
- if (!mime_part->disposition) return NULL;
- return (mime_part->disposition)->type;
-}
-
-
-const gchar *
-camel_mime_part_get_disposition (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_disposition (mime_part);
-}
-
-
-
-static void
-_set_filename (CamelMimePart *mime_part, gchar *filename)
-{
- g_free(mime_part->filename);
- mime_part->filename = filename;
-}
-
-
-void
-camel_mime_part_set_filename (CamelMimePart *mime_part, gchar *filename)
-{
- CMP_CLASS(mime_part)->set_filename (mime_part, filename);
-}
-
-
-
-/* **** */
-
-
-static const gchar *
-_get_filename (CamelMimePart *mime_part)
-{
- return mime_part->filename;
-}
-
-
-const gchar *
-camel_mime_part_get_filename (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_filename (mime_part);
-}
-
-
-/* **** */
-
-
-/* this routine must not be public */
-static void
-_set_content_id (CamelMimePart *mime_part, gchar *content_id)
-{
- g_free(mime_part->content_id);
- mime_part->content_id = content_id;
-}
-
-
-static const gchar *
-_get_content_id (CamelMimePart *mime_part)
-{
- return mime_part->content_id;
-}
-
-
-/* **** */
-
-
-const gchar *
-camel_mime_part_get_content_id (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_content_id (mime_part);
-}
-
-
-/* this routine must not be public */
-static void
-_set_content_MD5 (CamelMimePart *mime_part, gchar *content_MD5)
-{
- g_free(mime_part->content_MD5);
- mime_part->content_MD5 = content_MD5;
-}
-
-
-/* **** */
-
-
-static const gchar *
-_get_content_MD5 (CamelMimePart *mime_part)
-{
- return mime_part->content_MD5;
-}
-
-const gchar *
-camel_mime_part_get_content_MD5 (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_content_MD5 (mime_part);
-}
-
-
-/* **** */
-
-
-
-static void
-_set_encoding (CamelMimePart *mime_part, CamelMimePartEncodingType encoding)
-{
- mime_part->encoding = encoding;
-}
-
-void
-camel_mime_part_set_encoding (CamelMimePart *mime_part,
- CamelMimePartEncodingType encoding)
-{
- CMP_CLASS(mime_part)->set_encoding (mime_part, encoding);
-}
-
-
-/* **** */
-
-
-
-static CamelMimePartEncodingType
-_get_encoding (CamelMimePart *mime_part)
-{
- return mime_part->encoding;
-}
-
-const CamelMimePartEncodingType
-camel_mime_part_get_encoding (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_encoding (mime_part);
-}
-
-
-
-/* **** */
-
-
-
-static void
-_set_content_languages (CamelMimePart *mime_part, GList *content_languages)
-{
- if (mime_part->content_languages) string_list_free (mime_part->content_languages);
- mime_part->content_languages = content_languages;
-}
-
-void
-camel_mime_part_set_content_languages (CamelMimePart *mime_part, GList *content_languages)
-{
- CMP_CLASS(mime_part)->set_content_languages (mime_part, content_languages);
-}
-
-
-/* **** */
-
-
-
-static const GList *
-_get_content_languages (CamelMimePart *mime_part)
-{
- return mime_part->content_languages;
-}
-
-
-const GList *
-camel_mime_part_get_content_languages (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_content_languages (mime_part);
-}
-
-
-/* **** */
-
-
-
-static void
-_set_header_lines (CamelMimePart *mime_part, GList *header_lines)
-{
- if (mime_part->header_lines) string_list_free (mime_part->header_lines);
- mime_part->header_lines = header_lines;
-}
-
-void
-camel_mime_part_set_header_lines (CamelMimePart *mime_part, GList *header_lines)
-{
- CMP_CLASS(mime_part)->set_header_lines (mime_part, header_lines);
-}
-
-
-/* **** */
-
-
-
-static const GList *
-_get_header_lines (CamelMimePart *mime_part)
-{
- return mime_part->header_lines;
-}
-
-
-
-const GList *
-camel_mime_part_get_header_lines (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_header_lines (mime_part);
-}
-
-
-/* **** */
-
-
-
-static void
-_set_content_type (CamelMimePart *mime_part, const gchar *content_type)
-{
- g_assert (content_type);
- gmime_content_field_construct_from_string (mime_part->content_type, content_type);
-}
-
-void
-camel_mime_part_set_content_type (CamelMimePart *mime_part, gchar *content_type)
-{
- CMP_CLASS(mime_part)->set_content_type (mime_part, content_type);
-}
-
-/* **** */
-
-
-static GMimeContentField *
-_get_content_type (CamelMimePart *mime_part)
-{
- return mime_part->content_type;
-}
-
-GMimeContentField *
-camel_mime_part_get_content_type (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_content_type (mime_part);
-}
-
-/*********/
-
-
-
-static void
-_set_content_object (CamelMedium *medium, CamelDataWrapper *content)
-{
- CamelMimePart *mime_part = CAMEL_MIME_PART (medium);
- GMimeContentField *object_content_field;
-
- parent_class->set_content_object (medium, content);
-
- object_content_field = camel_data_wrapper_get_mime_type_field (content);
- if (mime_part->content_type && (mime_part->content_type != object_content_field))
- gmime_content_field_unref (mime_part->content_type);
- mime_part->content_type = object_content_field;
- gmime_content_field_ref (object_content_field);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMimePart::set_content_object\n");
-
-}
-
-static CamelDataWrapper *
-_get_content_object (CamelMedium *medium)
-{
- CamelMimePart *mime_part = CAMEL_MIME_PART (medium);
- CamelStream *stream;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object entering\n");
-
- if (!medium->content ) {
- stream = mime_part->content_input_stream;
-
- camel_mime_part_construct_content_from_stream (mime_part, stream);
-
- } else {
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object part has a pointer "
- "to a content object\n");
- }
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object leaving\n");
-
- return parent_class->get_content_object (medium);
-
-}
-
-
-/* **** */
-
-
-
-
-/**********************************************************************/
-#ifdef WHPT
-#warning : WHPT is already defined !!!!!!
-#endif
-#define WHPT gmime_write_header_pair_to_stream
-
-
-static void
-_write_content_to_stream (CamelMimePart *mime_part, CamelStream *stream)
-{
- CamelMedium *medium = CAMEL_MEDIUM (mime_part);
- CamelStream *wrapper_stream;
-
- CamelDataWrapper *content = medium->content;
- CAMEL_LOG_FULL_DEBUG ( "Entering CamelMimePart::_write_content_to_stream\n");
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::_write_content_to_stream, content=%p\n", content);
- if (!content) return;
-
- switch (mime_part->encoding) {
- case CAMEL_MIME_PART_ENCODING_DEFAULT:
- case CAMEL_MIME_PART_ENCODING_7BIT:
- case CAMEL_MIME_PART_ENCODING_8BIT:
- camel_data_wrapper_write_to_stream (content, stream);
- break;
- case CAMEL_MIME_PART_ENCODING_BASE64:
- wrapper_stream = camel_data_wrapper_get_stream (content);
- if (wrapper_stream == NULL) {
- /* FIXME in this case, we should probably copy stuff
- in-memory and make sure things work anyway. */
- g_warning ("Class `%s' does not implement `get_stream'",
- gtk_type_name (GTK_OBJECT (content)->klass->type));
- }
- gmime_encode_base64 (wrapper_stream, stream);
- break;
- default:
- g_warning ("Encoding type `%s' not supported.",
- camel_mime_part_encoding_to_string
- (mime_part->encoding));
- }
-
- CAMEL_LOG_FULL_DEBUG ( "Leaving CamelMimePart::_write_content_to_stream\n");
-}
-
-
-
-
-
-static void
-_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelMimePart *mp = CAMEL_MIME_PART (data_wrapper);
- CamelMedium *medium = CAMEL_MEDIUM (data_wrapper);
-
- CAMEL_LOG_FULL_DEBUG ( "Entering CamelMimePart::write_to_stream\n");
-
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-disposition\n");
- gmime_content_field_write_to_stream(mp->disposition, stream);
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-transfer-encoding\n");
- WHPT (stream, "Content-Transfer-Encoding",
- camel_mime_part_encoding_to_string (mp->encoding));
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-description\n");
- WHPT (stream, "Content-Description", mp->description);
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-MD5\n");
- WHPT (stream, "Content-MD5", mp->content_MD5);
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-id\n");
- WHPT (stream, "Content-id", mp->content_id);
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-languages\n");
- gmime_write_header_with_glist_to_stream (stream, "Content-Language", mp->content_languages,", ");
-
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing other headers\n");
- gmime_write_header_table_to_stream (stream, medium->headers);
-
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-type\n");
- gmime_content_field_write_to_stream (mp->content_type, stream);
-
- camel_stream_write_string(stream,"\n");
- _write_content_to_stream (mp, stream);
-
-}
-
-
-
-/*******************************/
-/* mime part parsing */
-
-static gboolean
-_parse_header_pair (CamelMimePart *mime_part, gchar *header_name, gchar *header_value)
-{
- CamelHeaderType header_type;
- gboolean header_handled = FALSE;
-
-
- header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, header_name);
- switch (header_type) {
-
- case HEADER_DESCRIPTION:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimePart::parse_header_pair found HEADER_DESCRIPTION: %s\n",
- header_value );
-
- camel_mime_part_set_description (mime_part, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_DISPOSITION:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimePart::parse_header_pair found HEADER_DISPOSITION: %s\n",
- header_value);
-
- camel_mime_part_set_disposition (mime_part, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_CONTENT_ID:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimePart::parse_header_pair found HEADER_CONTENT_ID: %s\n",
- header_value);
-
- CMP_CLASS(mime_part)->set_content_id (mime_part, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_ENCODING:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimePart::parse_header_pair found HEADER_ENCODING: %s\n",
- header_value);
-
- camel_mime_part_set_encoding
- (mime_part,
- camel_mime_part_encoding_from_string (header_value));
- header_handled = TRUE;
- break;
-
- case HEADER_CONTENT_MD5:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimePart::parse_header_pair found HEADER_CONTENT_MD5: %s\n",
- header_value );
-
- CMP_CLASS(mime_part)->set_content_MD5 (mime_part, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_CONTENT_TYPE:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimePart::parse_header_pair found HEADER_CONTENT_TYPE: %s\n",
- header_value );
-
- gmime_content_field_construct_from_string (mime_part->content_type, header_value);
- header_handled = TRUE;
- break;
-
-
- }
-
-
- if (header_handled) {
- g_free (header_name);
- return TRUE;
- } else return FALSE;
-
-}
-
-
-
-
-static void
-_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
-
- CamelMimePart *mime_part = CAMEL_MIME_PART (data_wrapper);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_from_stream entering\n");
- camel_mime_part_construct_headers_from_stream (mime_part, stream);
-
- camel_mime_part_store_stream_in_buffer (mime_part, stream);
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_from_stream leaving\n");
-
-}
-
-
-
-
-static void
-_set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelMimePart *mime_part = CAMEL_MIME_PART (data_wrapper);
- CamelSeekableStream *seekable_stream;
- guint32 content_stream_inf_bound;
-
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::set_input_stream entering\n");
-
- g_assert (CAMEL_IS_SEEKABLE_STREAM (stream));
- seekable_stream = CAMEL_SEEKABLE_STREAM (stream);
-
- camel_mime_part_construct_headers_from_stream (mime_part, stream);
-
- /* set the input stream for the content object */
- content_stream_inf_bound = camel_seekable_stream_get_current_position (seekable_stream);
- mime_part->content_input_stream =
- camel_seekable_substream_new_with_seekable_stream_and_bounds (seekable_stream,
- content_stream_inf_bound,
- -1);
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::set_input_stream leaving\n");
-
-}
-
-
-const gchar *
-camel_mime_part_encoding_to_string (CamelMimePartEncodingType encoding)
-{
- switch (encoding) {
- case CAMEL_MIME_PART_ENCODING_DEFAULT:
- case CAMEL_MIME_PART_ENCODING_7BIT:
- return "7bit";
- case CAMEL_MIME_PART_ENCODING_8BIT:
- return "8bit";
- case CAMEL_MIME_PART_ENCODING_BASE64:
- return "base64";
- case CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE:
- return "quoted-printable";
- }
- return "";
-}
-
-
-/* FIXME I am not sure this is the correct way to do this. */
-CamelMimePartEncodingType
-camel_mime_part_encoding_from_string (const gchar *string)
-{
- if (strcmp (string, "7bit") == 0)
- return CAMEL_MIME_PART_ENCODING_7BIT;
- else if (strcmp (string, "8bit") == 0)
- return CAMEL_MIME_PART_ENCODING_8BIT;
- else if (strcmp (string, "base64") == 0)
- return CAMEL_MIME_PART_ENCODING_BASE64;
- else if (strcmp (string, "quoted-printable") == 0)
- return CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE;
- else
- /* FIXME? Spit a warning? */
- return CAMEL_MIME_PART_ENCODING_DEFAULT;
-}
-
-
-/******************************/
-/** Misc utility functions **/
-
-
-/**
- * camel_mime_part_set_text: set the content to be some text
- * @camel_mime_part: Mime part
- * @text: the text
- *
- * Utility function used to set the content of a mime part object to
- * be a text string. When @text is NULL, this routine can be used as
- * a way to remove old text content.
- *
- **/
-void
-camel_mime_part_set_text (CamelMimePart *camel_mime_part, const gchar *text)
-{
- CamelSimpleDataWrapper *simple_data_wrapper;
- CamelMedium *medium = CAMEL_MEDIUM (camel_mime_part);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart:: Entering set_text\n");
- CAMEL_LOG_TRACE ("CamelMimePart::set_text, setting text as a mime part content\n");
- if (medium->content) {
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::set_text unreferencing old content object\n");
- gtk_object_unref (GTK_OBJECT (medium->content));
- }
- if (text) {
- simple_data_wrapper = camel_simple_data_wrapper_new ();
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::set_text calling CamelSimpleDataWrapper:set_text with %d chars\n", strlen (text));
- camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (simple_data_wrapper), "text/plain");
- camel_simple_data_wrapper_set_text ( simple_data_wrapper, text);
- camel_medium_set_content_object ( CAMEL_MEDIUM (camel_mime_part), CAMEL_DATA_WRAPPER (simple_data_wrapper));
- gtk_object_unref (GTK_OBJECT (simple_data_wrapper));
- } else medium->content = NULL;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart:: Leaving camel_mime_part_set_text\n");
-}
-
-
diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h
deleted file mode 100644
index 4b48ce1c0c..0000000000
--- a/camel/camel-mime-part.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mime-part.h : class for a mime part */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_MIME_PART_H
-#define CAMEL_MIME_PART_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-medium.h"
-#include "camel-stream.h"
-
-
-#define CAMEL_MIME_PART_TYPE (camel_mime_part_get_type ())
-#define CAMEL_MIME_PART(obj) (GTK_CHECK_CAST((obj), CAMEL_MIME_PART_TYPE, CamelMimePart))
-#define CAMEL_MIME_PART_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MIME_PART_TYPE, CamelMimePartClass))
-#define CAMEL_IS_MIME_PART(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_PART_TYPE))
-
-
-enum _CamelMimePartEncodingType {
- CAMEL_MIME_PART_ENCODING_DEFAULT,
- CAMEL_MIME_PART_ENCODING_7BIT,
- CAMEL_MIME_PART_ENCODING_8BIT,
- CAMEL_MIME_PART_ENCODING_BASE64,
- CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE,
- CAMEL_MIME_PART_NUM_ENCODINGS
-};
-typedef enum _CamelMimePartEncodingType CamelMimePartEncodingType;
-
-
-/* Do not change these values directly, you
- would regret it one day */
-typedef struct
-{
- CamelMedium parent_object;
-
- /* All fields here are -** PRIVATE **- */
- gchar *description;
- GMimeContentField *disposition;
- gchar *content_id;
- gchar *content_MD5;
- GList *content_languages;
- CamelMimePartEncodingType encoding;
- gchar *filename;
- GList *header_lines;
-
- GByteArray *temp_message_buffer;
- GMimeContentField *content_type;
- CamelStream *content_input_stream;
-
-} CamelMimePart;
-
-
-
-typedef struct {
- CamelMediumClass parent_class;
-
- /* Virtual methods */
- void (*set_description) (CamelMimePart *mime_part, const gchar *description);
- const gchar * (*get_description) (CamelMimePart *mime_part);
- void (*set_disposition) (CamelMimePart *mime_part, const gchar *disposition);
- const gchar * (*get_disposition) (CamelMimePart *mime_part);
- void (*set_filename) (CamelMimePart *mime_part, gchar *filename);
- const gchar * (*get_filename) (CamelMimePart *mime_part);
- void (*set_content_id) (CamelMimePart *mime_part, gchar *content_id);
- const gchar * (*get_content_id) (CamelMimePart *mime_part);
- void (*set_content_MD5) (CamelMimePart *mime_part, gchar *content_MD5);
- const gchar * (*get_content_MD5) (CamelMimePart *mime_part);
- void (*set_encoding) (CamelMimePart *mime_part, CamelMimePartEncodingType type);
- const CamelMimePartEncodingType (*get_encoding) (CamelMimePart *mime_part);
- void (*set_content_languages) (CamelMimePart *mime_part, GList *content_languages);
- const GList * (*get_content_languages) (CamelMimePart *mime_part);
- void (*set_header_lines) (CamelMimePart *mime_part, GList *header_lines);
- const GList * (*get_header_lines) (CamelMimePart *mime_part);
-
- void (*set_content_type) (CamelMimePart *mime_part, const gchar *content_type);
- GMimeContentField * (*get_content_type) (CamelMimePart *mime_part);
-
- gboolean (*parse_header_pair) (CamelMimePart *mime_part, gchar *header_name, gchar *header_value);
-
-
-} CamelMimePartClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_mime_part_get_type (void);
-
-
-/* public methods */
-void camel_mime_part_set_description (CamelMimePart *mime_part,
- const gchar *description);
-const gchar *camel_mime_part_get_description (CamelMimePart *mime_part);
-void camel_mime_part_set_disposition (CamelMimePart *mime_part,
- const gchar *disposition);
-const gchar *camel_mime_part_get_disposition (CamelMimePart *mime_part);
-void camel_mime_part_set_filename (CamelMimePart *mime_part,
- gchar *filename);
-const gchar *camel_mime_part_get_filename (CamelMimePart *mime_part);
-const gchar *camel_mime_part_get_content_id (CamelMimePart *mime_part);
-const gchar *camel_mime_part_get_content_MD5 (CamelMimePart *mime_part);
-void camel_mime_part_set_encoding (CamelMimePart *mime_part,
- CamelMimePartEncodingType type);
-CamelMimePartEncodingType camel_mime_part_get_encoding (CamelMimePart *mime_part);
-void camel_mime_part_set_content_languages (CamelMimePart *mime_part,
- GList *content_languages);
-const GList *camel_mime_part_get_content_languages (CamelMimePart *mime_part);
-void camel_mime_part_set_header_lines (CamelMimePart *mime_part,
- GList *header_lines);
-const GList *camel_mime_part_get_header_lines (CamelMimePart *mime_part);
-
-GMimeContentField *camel_mime_part_get_content_type (CamelMimePart *mime_part);
-
-const gchar *camel_mime_part_encoding_to_string (CamelMimePartEncodingType encoding);
-CamelMimePartEncodingType camel_mime_part_encoding_from_string (const gchar *string);
-
-/* utility functions */
-void camel_mime_part_set_text (CamelMimePart *camel_mime_part,
- const gchar *text);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MIME_PART_H */
-
diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c
deleted file mode 100644
index 0a2f488f31..0000000000
--- a/camel/camel-multipart.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-multipart.c : Abstract class for a multipart */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-log.h"
-#include "gmime-content-field.h"
-#include "gmime-utils.h"
-#include "camel-stream-mem.h"
-#include "camel-seekable-substream.h"
-
-#include "camel-multipart.h"
-
-
-static void _add_part (CamelMultipart *multipart,
- CamelMimeBodyPart *part);
-static void _add_part_at (CamelMultipart *multipart,
- CamelMimeBodyPart *part,
- guint index);
-static void _remove_part (CamelMultipart *multipart,
- CamelMimeBodyPart *part);
-static CamelMimeBodyPart * _remove_part_at (CamelMultipart *multipart,
- guint index);
-static CamelMimeBodyPart * _get_part (CamelMultipart *multipart,
- guint index);
-static guint _get_number (CamelMultipart *multipart);
-static void _set_parent (CamelMultipart *multipart,
- CamelMimePart *parent);
-static CamelMimePart * _get_parent (CamelMultipart *multipart);
-static void _set_boundary (CamelMultipart *multipart,
- gchar *boundary);
-static const gchar * _get_boundary (CamelMultipart *multipart);
-static void _write_to_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-static void _set_input_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-
-static void _finalize (GtkObject *object);
-
-static CamelDataWrapperClass *parent_class=NULL;
-
-
-
-/* Returns the class for a CamelMultipart */
-#define CMP_CLASS(so) CAMEL_MULTIPART_CLASS (GTK_OBJECT(so)->klass)
-
-/* Returns the class for a CamelDataWrapper */
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void
-camel_multipart_class_init (CamelMultipartClass *camel_multipart_class)
-{
- CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_multipart_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_multipart_class);
-
- parent_class = gtk_type_class (camel_data_wrapper_get_type ());
-
- /* virtual method definition */
- camel_multipart_class->add_part = _add_part;
- camel_multipart_class->add_part_at = _add_part_at;
- camel_multipart_class->remove_part = _remove_part;
- camel_multipart_class->remove_part_at = _remove_part_at;
- camel_multipart_class->get_part = _get_part;
- camel_multipart_class->get_number = _get_number;
- camel_multipart_class->set_parent = _set_parent;
- camel_multipart_class->get_parent = _get_parent;
- camel_multipart_class->set_boundary = _set_boundary;
- camel_multipart_class->get_boundary = _get_boundary;
-
- /* virtual method overload */
- camel_data_wrapper_class->write_to_stream = _write_to_stream;
- camel_data_wrapper_class->set_input_stream = _set_input_stream;
-
- gtk_object_class->finalize = _finalize;
-}
-
-static void
-camel_multipart_init (gpointer object, gpointer klass)
-{
- CamelMultipart *multipart = CAMEL_MULTIPART (object);
- camel_data_wrapper_set_mime_type ( CAMEL_DATA_WRAPPER (multipart), "multipart");
- camel_multipart_set_boundary (multipart, "__camel_boundary__");
- multipart->preface = NULL;
- multipart->postface = NULL;
-
-}
-
-
-
-
-GtkType
-camel_multipart_get_type (void)
-{
- static GtkType camel_multipart_type = 0;
-
- if (!camel_multipart_type) {
- GtkTypeInfo camel_multipart_info =
- {
- "CamelMultipart",
- sizeof (CamelMultipart),
- sizeof (CamelMultipartClass),
- (GtkClassInitFunc) camel_multipart_class_init,
- (GtkObjectInitFunc) camel_multipart_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_multipart_type = gtk_type_unique (camel_data_wrapper_get_type (), &camel_multipart_info);
- }
-
- return camel_multipart_type;
-}
-
-static void
-_unref_part (gpointer data, gpointer user_data)
-{
- GtkObject *body_part = GTK_OBJECT (data);
-
- gtk_object_unref (body_part);
-}
-
-static void
-_finalize (GtkObject *object)
-{
- CamelMultipart *multipart = CAMEL_MULTIPART (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::finalize\n");
-
- if (multipart->parent) gtk_object_unref (GTK_OBJECT (multipart->parent));
-
- g_list_foreach (multipart->parts, _unref_part, NULL);
-
- if (multipart->boundary) g_free (multipart->boundary);
- if (multipart->preface) g_free (multipart->preface);
- if (multipart->postface) g_free (multipart->postface);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::finalize\n");
-}
-
-
-
-CamelMultipart *
-camel_multipart_new (void)
-{
- CamelMultipart *multipart;
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Entering new()\n");
-
- multipart = (CamelMultipart *)gtk_type_new (CAMEL_MULTIPART_TYPE);
- multipart->preface = NULL;
- multipart->postface = NULL;
-
-
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Leaving new()\n");
- return multipart;
-}
-
-
-static void
-_add_part (CamelMultipart *multipart, CamelMimeBodyPart *part)
-{
- multipart->parts = g_list_append (multipart->parts, part);
- if (part) gtk_object_ref (GTK_OBJECT (part));
-}
-
-void
-camel_multipart_add_part (CamelMultipart *multipart, CamelMimeBodyPart *part)
-{
- CMP_CLASS (multipart)->add_part (multipart, part);
-}
-
-
-static void
-_add_part_at (CamelMultipart *multipart, CamelMimeBodyPart *part, guint index)
-{
- multipart->parts = g_list_insert (multipart->parts, part, index);
- if (part) gtk_object_ref (GTK_OBJECT (part));
-}
-
-void
-camel_multipart_add_part_at (CamelMultipart *multipart, CamelMimeBodyPart *part, guint index)
-{
- CMP_CLASS (multipart)->add_part_at (multipart, part, index);
-}
-
-static void
-_remove_part (CamelMultipart *multipart, CamelMimeBodyPart *part)
-{
- if (!multipart->parts) {
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart::remove_part part list id void\n");
- return;
- }
- multipart->parts = g_list_remove (multipart->parts, part);
- if (part) gtk_object_unref (GTK_OBJECT (part));
-}
-
-void
-camel_multipart_remove_part (CamelMultipart *multipart, CamelMimeBodyPart *part)
-{
- CMP_CLASS (multipart)->remove_part (multipart, part);
-}
-
-
-static CamelMimeBodyPart *
-_remove_part_at (CamelMultipart *multipart, guint index)
-{
- GList *parts_list;
- GList *part_to_remove;
- CamelMimeBodyPart *removed_body_part;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Entering remove_part_at\n");
- CAMEL_LOG_TRACE ("CamelMultipart::remove_part_at : Removing part number %d\n", index);
-
- if (!(multipart->parts)) {
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart::remove_part_at part list is void \n");
- return NULL;
- }
-
- parts_list = multipart->parts;
- part_to_remove = g_list_nth (parts_list, index);
- if (!part_to_remove) {
- CAMEL_LOG_WARNING ("CamelMultipart::remove_part_at : part to remove is NULL\n");
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart::remove_part_at : index = %d, number of parts=%d\n",
- index, g_list_length (parts_list));
- return NULL;
- }
- removed_body_part = CAMEL_MIME_BODY_PART (part_to_remove->data);
-
- multipart->parts = g_list_remove_link (parts_list, part_to_remove);
- if (part_to_remove->data) gtk_object_unref (GTK_OBJECT (part_to_remove->data));
- g_list_free_1 (part_to_remove);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Leaving remove_part_at\n");
- return removed_body_part;
-
-}
-
-CamelMimeBodyPart *
-camel_multipart_remove_part_at (CamelMultipart *multipart, guint index)
-{
- return CMP_CLASS (multipart)->remove_part_at (multipart, index);
-}
-
-
-static CamelMimeBodyPart *
-_get_part (CamelMultipart *multipart, guint index)
-{
- GList *part;
- if (!(multipart->parts)) {
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart::get_part part list is void \n");
- return NULL;
- }
-
- part = g_list_nth (multipart->parts, index);
- if (part) return CAMEL_MIME_BODY_PART (part->data);
- else {
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart::get_part part number %d not found\n", index);
- return NULL;
- }
-}
-
-CamelMimeBodyPart *
-camel_multipart_get_part (CamelMultipart *multipart, guint index)
-{
- return CMP_CLASS (multipart)->get_part (multipart, index);
-}
-
-
-static guint
-_get_number (CamelMultipart *multipart)
-{
- return g_list_length (multipart->parts);
-}
-
-guint
-camel_multipart_get_number (CamelMultipart *multipart)
-{
- return CMP_CLASS (multipart)->get_number (multipart);
-}
-
-
-static void
-_set_parent (CamelMultipart *multipart, CamelMimePart *parent)
-{
- multipart->parent = parent;
- if (parent) gtk_object_ref (GTK_OBJECT (parent));
-}
-
-void
-camel_multipart_set_parent (CamelMultipart *multipart, CamelMimePart *parent)
-{
- CMP_CLASS (multipart)->set_parent (multipart, parent);
-}
-
-
-static CamelMimePart *
-_get_parent (CamelMultipart *multipart)
-{
- return multipart->parent;
-}
-
-
-CamelMimePart *
-camel_multipart_get_parent (CamelMultipart *multipart)
-{
- return CMP_CLASS (multipart)->get_parent (multipart);
-}
-
-
-
-
-
-static void
-_set_boundary (CamelMultipart *multipart, gchar *boundary)
-{
- gmime_content_field_set_parameter (CAMEL_DATA_WRAPPER (multipart)->mime_type, "boundary", boundary);
-}
-
-void
-camel_multipart_set_boundary (CamelMultipart *multipart, gchar *boundary)
-{
- CMP_CLASS (multipart)->set_boundary (multipart, boundary);
-}
-
-
-static const gchar *
-_get_boundary (CamelMultipart *multipart)
-{
- const gchar *boundary;
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::_get_boundary\n");
- if (!CAMEL_DATA_WRAPPER (multipart)->mime_type) {
- CAMEL_LOG_WARNING ("CamelMultipart::_get_boundary CAMEL_DATA_WRAPPER (multipart)->mime_type is NULL\n");
- return NULL;
- }
- boundary = gmime_content_field_get_parameter (CAMEL_DATA_WRAPPER (multipart)->mime_type, "boundary");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::boundary found : \"%s\"\n", boundary);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::_get_boundary\n");
- return boundary;
-}
-
-
-const gchar *
-camel_multipart_get_boundary (CamelMultipart *multipart)
-{
- return CMP_CLASS (multipart)->get_boundary (multipart);
-}
-
-
-struct _print_part_user_data {
- CamelStream *stream;
- const gchar *boundary;
-};
-
-
-
-static void
-_print_part (gpointer data, gpointer user_data)
-{
- CamelMimeBodyPart *body_part = CAMEL_MIME_BODY_PART (data);
- struct _print_part_user_data *ud = (struct _print_part_user_data *)user_data;
-
- if (ud->boundary) camel_stream_write_strings (ud->stream, "\n--", ud->boundary, "\n", NULL);
- else camel_stream_write_strings (ud->stream, "\n--\n", NULL);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (body_part), ud->stream);
-
-
-}
-
-
-
-static void
-_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelMultipart *multipart = CAMEL_MULTIPART (data_wrapper);
- struct _print_part_user_data ud;
- const gchar *boundary;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::_write_to_stream entering\n");
- boundary = camel_multipart_get_boundary (multipart);
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::_write_to_stream, boundary = %s\n", boundary);
- g_return_if_fail (boundary);
- ud.boundary = boundary;
- ud.stream = stream;
- if (multipart->preface) camel_stream_write_strings (stream, multipart->preface, NULL);
- g_list_foreach (multipart->parts, _print_part, (gpointer)&ud);
- camel_stream_write_strings (stream, "\n--", boundary, "--\n", NULL);
- if (multipart->postface) camel_stream_write_strings (stream, multipart->postface, NULL);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::_write_to_stream leaving \n");
-}
-
-
-
-
-
-
-
-/**********************/
-/* new implementation */
-
-
-/**
- * _localize_part: localize one part in a multipart environement.
- * @stream: the stream to read the lines from.
- * @normal_boundary: end of part bundary.
- * @end_boundary: end of multipart boundary.
- * @end_position : end position of the mime part
- *
- * This routine is a bit special: RFC 2046 says that, in a multipart
- * environment, the last crlf before a boundary belongs to the boundary.
- * Thus, if there is no blank line before the boundary, the last crlf
- * of the last line of the part is removed.
- *
- * Return value: true if the last boundary element has been found or if no more data was available from the stream, flase otherwise
- **/
-
-static gboolean
-_localize_part (CamelStream *stream,
- gchar *normal_boundary,
- gchar *end_boundary,
- guint32 *end_position)
-{
- gchar *new_line = NULL;
- gboolean end_of_part = FALSE;
- gboolean last_part = FALSE;
- guint32 last_position;
-
- /* Note for future enhancements */
- /* RFC 2046 precises that when parsing the content of a multipart
- * element, the program should not think it will find the last boundary,
- * and in particular, the message could have been damaged during
- * transport, the parsing should still be OK */
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Entering _localize_part\n");
-
- g_assert (CAMEL_IS_SEEKABLE_STREAM (stream));
-
- last_position = camel_seekable_stream_get_current_position (CAMEL_SEEKABLE_STREAM (stream));
- new_line = gmime_read_line_from_stream (stream);
-
- while (new_line && !end_of_part && !last_part) {
- end_of_part = (strcmp (new_line, normal_boundary) == 0);
- last_part = (strcmp (new_line, end_boundary) == 0);
- if (!end_of_part && !last_part) {
-
- g_free (new_line);
-
- last_position =
- camel_seekable_stream_get_current_position (CAMEL_SEEKABLE_STREAM (stream));
-
- new_line = gmime_read_line_from_stream (stream);
- }
- }
-
- if (new_line) g_free (new_line);
- else last_part = TRUE;
-
- *end_position = last_position;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Leaving _localize_part\n");
- return (last_part);
-}
-
-
-
-
-static void
-_set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelMultipart *multipart = CAMEL_MULTIPART (data_wrapper);
- CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream);
- const gchar *boundary;
- gchar *real_boundary_line;
- gchar *end_boundary_line;
- gboolean end_of_multipart;
- CamelMimeBodyPart *body_part;
- guint32 part_begining, part_end;
- CamelSeekableSubstream *body_part_input_stream;
- guint32 saved_stream_pos;
-
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::_set_input_stream\n");
- boundary = camel_multipart_get_boundary (multipart);
- g_return_if_fail (boundary);
-
- real_boundary_line = g_strdup_printf ("--%s", boundary);
- end_boundary_line = g_strdup_printf ("--%s--", boundary);
-
-
- /* read the prefix if any */
- end_of_multipart = _localize_part (stream,
- real_boundary_line,
- end_boundary_line,
- &part_end);
- if (multipart->preface) g_free (multipart->preface);
-
- /* if ( (new_part->str)[0] != '\0') multipart->preface = g_strdup (new_part->str); */
-
- /* read all the real parts */
- while (!end_of_multipart) {
- /* determine the position of the begining of the part */
- part_begining = camel_seekable_stream_get_current_position (seekable_stream);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart::set_input_stream, detected a new part\n");
- body_part = camel_mime_body_part_new ();
-
- end_of_multipart = _localize_part (stream,
- real_boundary_line,
- end_boundary_line,
- &part_end);
- body_part_input_stream =
- camel_seekable_substream_new_with_seekable_stream_and_bounds (seekable_stream,
- part_begining,
- part_end);
-
- /* the seekable substream may change the position of the stream
- so we must save it before calling set_input_stream */
- saved_stream_pos = camel_seekable_stream_get_current_position (seekable_stream);
-
- camel_data_wrapper_set_input_stream (CAMEL_DATA_WRAPPER (body_part),
- CAMEL_STREAM (body_part_input_stream));
-
- /* restore the stream position */
- camel_seekable_stream_seek (seekable_stream, saved_stream_pos, CAMEL_STREAM_SET);
-
- /* add the body part to the multipart object */
- camel_multipart_add_part (multipart, body_part);
-
- }
-
- /* g_string_assign (new_part, ""); */
- /* _localize_part (new_part, stream, real_boundary_line, end_boundary_line); */
-
- if (multipart->postface) g_free (multipart->postface);
- /* if ( (new_part->str)[0] != '\0') multipart->postface = g_strdup (new_part->str); */
-
- /* g_string_free (new_part, TRUE); */
-
- g_free (real_boundary_line);
- g_free (end_boundary_line);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::_set_input_stream\n");
-}
diff --git a/camel/camel-multipart.h b/camel/camel-multipart.h
deleted file mode 100644
index 50b64b3ae0..0000000000
--- a/camel/camel-multipart.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-multipart.h : class for a multipart */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_MULTIPART_H
-#define CAMEL_MULTIPART_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-typedef struct _CamelMultipart CamelMultipart;
-
-#include <gtk/gtk.h>
-#include "camel-mime-part.h"
-#include "camel-mime-body-part.h"
-
-
-#define CAMEL_MULTIPART_TYPE (camel_multipart_get_type ())
-#define CAMEL_MULTIPART(obj) (GTK_CHECK_CAST((obj), CAMEL_MULTIPART_TYPE, CamelMultipart))
-#define CAMEL_MULTIPART_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MULTIPART_TYPE, CamelMultipartClass))
-#define CAMEL_IS_MULTIPART(o) (GTK_CHECK_TYPE((o), CAMEL_MULTIPART_TYPE))
-
-
-struct _CamelMultipart
-{
- CamelDataWrapper parent_object;
-
- CamelMimePart *parent;
- GList *parts;
- gchar *boundary;
- gchar *preface;
- gchar *postface;
-
-};
-
-
-
-typedef struct {
- CamelDataWrapperClass parent_class;
-
- /* Virtual methods */
- void (*add_part) (CamelMultipart *multipart, CamelMimeBodyPart *part);
- void (*add_part_at) (CamelMultipart *multipart, CamelMimeBodyPart *part, guint index);
- void (*remove_part) (CamelMultipart *multipart, CamelMimeBodyPart *part);
- CamelMimeBodyPart * (*remove_part_at) (CamelMultipart *multipart, guint index);
- CamelMimeBodyPart * (*get_part) (CamelMultipart *multipart, guint index);
- guint (*get_number) (CamelMultipart *multipart);
- void (*set_parent) (CamelMultipart *multipart, CamelMimePart *parent);
- CamelMimePart * (*get_parent) (CamelMultipart *multipart);
- void (*set_boundary) (CamelMultipart *multipart, gchar *boundary);
- const gchar * (*get_boundary) (CamelMultipart *multipart);
-
-} CamelMultipartClass;
-
-
-/* Standard Gtk function */
-GtkType camel_multipart_get_type (void);
-
-
-/* public methods */
-CamelMultipart * camel_multipart_new (void);
-void camel_multipart_add_part (CamelMultipart *multipart,
- CamelMimeBodyPart *part);
-void camel_multipart_add_part_at (CamelMultipart *multipart,
- CamelMimeBodyPart *part,
- guint index);
-void camel_multipart_remove_part (CamelMultipart *multipart,
- CamelMimeBodyPart *part);
-CamelMimeBodyPart * camel_multipart_remove_part_at (CamelMultipart *multipart,
- guint index);
-CamelMimeBodyPart * camel_multipart_get_part (CamelMultipart *multipart,
- guint index);
-guint camel_multipart_get_number (CamelMultipart *multipart);
-void camel_multipart_set_parent (CamelMultipart *multipart,
- CamelMimePart *parent);
-CamelMimePart * camel_multipart_get_parent (CamelMultipart *multipart);
-void camel_multipart_set_boundary (CamelMultipart *multipart,
- gchar *boundary);
-const gchar * camel_multipart_get_boundary (CamelMultipart *multipart);
-
-
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MULTIPART_H */
-
diff --git a/camel/camel-op-queue.c b/camel/camel-op-queue.c
deleted file mode 100644
index dc9996ef38..0000000000
--- a/camel/camel-op-queue.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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
- */
-
-
-/* MT safe */
-
-
-#include <config.h>
-#include "camel-log.h"
-#include "camel-op-queue.h"
-
-static GStaticMutex op_queue_mutex = G_STATIC_MUTEX_INIT;
-
-
-
-/**
- * camel_op_queue_new: create a new operation queue
- *
- * Create a new operation queue.
- *
- * Return value: the newly allcated object
- **/
-CamelOpQueue *
-camel_op_queue_new ()
-{
- CamelOpQueue *op_queue;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::new\n");
-
- op_queue = g_new (CamelOpQueue, 1);
- op_queue->ops_tail = NULL;
- op_queue->ops_head = NULL;
- op_queue->service_available = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::new\n");
- return op_queue;
-}
-
-
-void
-camel_op_queue_free (CamelOpQueue *op_queue)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::free\n");
- g_list_free (op_queue->ops_head);
- g_free (op_queue);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::free\n");
-}
-
-/**
- * camel_op_queue_push_op: Add an operation to the queue
- * @queue: queue object
- * @op: operation to add
- *
- * Add an operation to an operation queue.
- * The queue is a FIFO queue.
- **/
-void
-camel_op_queue_push_op (CamelOpQueue *queue, CamelOp *op)
-{
- GList *new_op;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::push_op\n");
- g_assert (queue);
- g_static_mutex_lock (&op_queue_mutex);
- if (!queue->ops_tail) {
- CAMEL_LOG_FULL_DEBUG ("CamelOpQueue::push_op queue does not exists yet. "
- "Creating it\n");
- queue->ops_head = g_list_prepend (NULL, op);
- queue->ops_tail = queue->ops_head;
- } else
- queue->ops_head = g_list_prepend (queue->ops_head, op);
- g_static_mutex_unlock (&op_queue_mutex);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::push_op\n");
-}
-
-
-/**
- * camel_op_queue_pop_op: Pop the next operation pending in the queue
- * @queue: queue object
- *
- * Pop the next operation pending in the queue.
- *
- * Return value:
- **/
-CamelOp *
-camel_op_queue_pop_op (CamelOpQueue *queue)
-{
- GList *op_list;
- CamelOp *op;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::pop_op\n");
- g_assert (queue);
-
- g_static_mutex_lock (&op_queue_mutex);
- op_list = queue->ops_tail;
- if (!op_list) return NULL;
-
- queue->ops_tail = queue->ops_tail->prev;
- op = (CamelOp *)op_list->data;
- g_static_mutex_unlock (&op_queue_mutex);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::pop_op\n");
- return op;
-}
-
-
-/**
- * camel_op_queue_run_next_op: run the next pending operation
- * @queue: queue object
- *
- * Run the next pending operation in the queue.
- *
- * Return value: TRUE if an operation was launched FALSE if there was no operation pending in the queue.
- **/
-gboolean
-camel_op_queue_run_next_op (CamelOpQueue *queue)
-{
- CamelOp *op;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::run_next_op\n");
- op = camel_op_queue_pop_op (queue);
- if (!op) return FALSE;
-
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::run_next_op\n");
- return FALSE;
-}
-
-/**
- * camel_op_queue_set_service_availability: set the service availability for an operation queue
- * @queue: queue object
- * @available: availability flag
- *
- * set the service availability
- **/
-void
-camel_op_queue_set_service_availability (CamelOpQueue *queue, gboolean available)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::set_service_availability\n");
- g_static_mutex_lock (&op_queue_mutex);
- queue->service_available = available;
- g_static_mutex_unlock (&op_queue_mutex);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::set_service_availability\n");
-}
-
-/**
- * camel_op_queue_get_service_availability: determine if an operation queue service is available
- * @queue: queue object
- *
- * Determine if the service associated to an operation queue is available.
- *
- * Return value: service availability.
- **/
-gboolean
-camel_op_queue_get_service_availability (CamelOpQueue *queue)
-{
- gboolean available;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::get_service_availability\n");
- g_static_mutex_lock (&op_queue_mutex);
- available = queue->service_available;
- g_static_mutex_unlock (&op_queue_mutex);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::get_service_availability\n");
- return available;
-}
-
diff --git a/camel/camel-op-queue.h b/camel/camel-op-queue.h
deleted file mode 100644
index 2bceceb4c8..0000000000
--- a/camel/camel-op-queue.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_OP_QUEUE_H
-#define CAMEL_OP_QUEUE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include "camel-marshal-utils.h"
-
-
-
-typedef struct
-{
- GList *ops_head;
- GList *ops_tail;
- gboolean service_available;
-
-} CamelOpQueue;
-
-
-/* public methods */
-CamelOpQueue *camel_op_queue_new ();
-void camel_op_queue_free (CamelOpQueue *op_queue);
-void camel_op_queue_push_op (CamelOpQueue *queue, CamelOp *op);
-CamelOp *camel_op_queue_pop_op (CamelOpQueue *queue);
-gboolean camel_op_queue_run_next_op (CamelOpQueue *queue);
-gboolean camel_op_queue_get_service_availability (CamelOpQueue *queue);
-void camel_op_queue_set_service_availability (CamelOpQueue *queue, gboolean available);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_OP_QUEUE_H */
-
diff --git a/camel/camel-provider.c b/camel/camel-provider.c
deleted file mode 100644
index 0cff8564a1..0000000000
--- a/camel/camel-provider.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-provider.c : provider framework */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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
- */
-
-
-/*
- A provider can be added "by hand" or by loading a module.
-
-
- Adding providers with modules.
- ------------------------------
-
- The modules are shared libraries which must contain the
- function
-
- CamelProvider *camel_provider_module_init ();
-
- returning the provider object defined in the module
-
-
-*/
-
-/* FIXME: Shouldn't we add a version number to providers ? */
-
-#include "config.h"
-#include "camel-provider.h"
-#include "camel-log.h"
-
-
-static GList *_provider_list = NULL;
-static gchar *_last_error;
-
-static gint
-_provider_name_cmp (gconstpointer a, gconstpointer b)
-{
- CamelProvider *provider_a = CAMEL_PROVIDER (a);
- CamelProvider *provider_b = CAMEL_PROVIDER (b);
-
- return strcmp ( provider_a->name, provider_b->name);
-}
-
-void
-camel_provider_register (CamelProvider *provider)
-{
- GList *old_provider_node = NULL;
-
- g_assert (provider);
-
- if (_provider_list)
- old_provider_node = g_list_find_custom (_provider_list, provider, _provider_name_cmp);
-
- if (old_provider_node != NULL) {
- /* camel_provider_unref (CAMEL_PROVIDER (old_provider_node->data)); */
- old_provider_node->data = provider;
- } else {
- /* be careful, we use prepend here, so that last registered
- providers come first */
- _provider_list = g_list_prepend (_provider_list, provider);
- }
- /* camel_provider_ref (provider); */
-}
-
-
-const CamelProvider *
-camel_provider_register_as_module (const gchar *module_path)
-{
-
- CamelProvider *new_provider = NULL;
- GModule *new_module = NULL;
- CamelProvider * (*camel_provider_module_init) ();
- gboolean has_module_init;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelProvider::register_as_module\n");
-
- g_return_val_if_fail (module_path, NULL);
-
- if (!g_module_supported ()) {
- CAMEL_LOG_WARNING ("CamelProvider::register_as_module module loading not supported on this system\n");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelProvider::register_as_module\n");
- return NULL;
- }
-
-
- new_module = g_module_open (module_path, 0);
- if (!new_module) {
- printf ("g_module_open reports: %s\n", g_module_error ());
- CAMEL_LOG_WARNING ("CamelProvider::register_as_module Unable to load module %s\n", module_path);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelProvider::register_as_module\n");
- return NULL;
- }
-
- has_module_init = g_module_symbol (new_module, "camel_provider_module_init", (gpointer *)&camel_provider_module_init);
- if (!has_module_init){
- CAMEL_LOG_WARNING ("CamelProvider::register_as_module loading of module %s failed,\n"
- "\t Symbol camel_provider_module_init not defined in it\n", module_path);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelProvider::register_as_module\n");
- return NULL;
- }
-
- new_provider = camel_provider_module_init();
- new_provider->gmodule = new_module;
- camel_provider_register (new_provider);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelProvider::register_as_module\n");
- return new_provider;
-
-
-}
-
-
-
-
-/*
- be careful to this function, @a is expected to be
- a provider, @b a protocol name (const gchar *)
-*/
-static gint
-_provider_protocol_find (gconstpointer a, gconstpointer b)
-{
- CamelProvider *provider_a = CAMEL_PROVIDER (a);
- const gchar *name_b = (const gchar *)b;
-
- return g_strcasecmp ( provider_a->name, name_b);
-}
-
-/**
- * camel_provider_get_for_protocol: get a registered provider for a protocol
- * @protocol: protocol name (case insensitive)
- * @type: provider type (transport, store, ...)
- *
- * Look into the list of registered provider if
- * one correspond both to the protocol name
- * and to the protocol type. When several providers
- * exist for a same protocol, the last registered
- * is returned.
- *
- * Return value: Matching provider or NULL if none exists.
- **/
-const CamelProvider *
-camel_provider_get_for_protocol (const gchar *protocol, ProviderType type)
-{
- CamelProvider *current_provider = NULL;
- GList *current_provider_node;
- gboolean protocol_is_found;
- gboolean provider_is_found;
-
- g_assert (protocol);
- g_return_val_if_fail (_provider_list, NULL);
-
- current_provider_node = _provider_list;
- provider_is_found = FALSE;
-
- while ((!provider_is_found) && current_provider_node) {
- current_provider = (CamelProvider *)current_provider_node->data;
-
- protocol_is_found = (g_strcasecmp (protocol, current_provider->protocol) == 0);
- if (protocol_is_found)
- provider_is_found = (current_provider->provider_type == type);
-
- current_provider_node = current_provider_node->next;
- }
-
- if (provider_is_found) return current_provider;
- else return NULL;
-}
diff --git a/camel/camel-provider.h b/camel/camel-provider.h
deleted file mode 100644
index 95df289c3b..0000000000
--- a/camel/camel-provider.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-provider.h : provider definition */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_PROVIDER_H
-#define CAMEL_PROVIDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <gmodule.h>
-
-#define CAMEL_PROVIDER(obj) (CamelProvider *)(obj)
-
-typedef enum {
- PROVIDER_STORE,
- PROVIDER_TRANSPORT
-} ProviderType;
-
-
-typedef struct {
- GtkType object_type; /* used to create instance of the provider */
- ProviderType provider_type; /* is a store or a transport */
- gchar *protocol; /* name of the protocol ("imap"/"smtp"/"mh" ...) */
- gchar *name; /* name of the provider ("Raymond the imap provider") */
- gchar *description; /* Useful when multiple providers are available for a same protocol */
-
- GModule *gmodule;
-} CamelProvider;
-
-void camel_provider_register (CamelProvider *provider);
-const CamelProvider *camel_provider_register_as_module (const gchar *module_path);
-const CamelProvider *camel_provider_get_for_protocol (const gchar *protocol, ProviderType type);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_PROVIDER_H */
diff --git a/camel/camel-recipient.c b/camel/camel-recipient.c
deleted file mode 100644
index 7b42cdc9a0..0000000000
--- a/camel/camel-recipient.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-recipient.h : handle recipients (addresses) and recipiemt lists */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 "glib.h"
-#include "hash-table-utils.h"
-#include "camel-recipient.h"
-
-
-/**
- * camel_recipient_table_new: Create a new recipient table object
- *
- *
- * creates a new recipient table object. A recipient table
- * objects merely associates a recipient list (GList) to
- * recipient types (as for example "To", "Cc" for mime
- * maile messages
- *
- * Return value: the newly created recipient table object
- **/
-CamelRecipientTable *
-camel_recipient_table_new ()
-{
- CamelRecipientTable *recipient_table;
-
- recipient_table = g_new0 (CamelRecipientTable, 1);
- recipient_table->recipient_hash_table = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- recipient_table->ref_count = 1;
- return recipient_table;
-}
-
-
-/**
- * camel_recipient_table_ref: add a reference to a recipient table object
- * @recipient_table: the recipient table object
- *
- * Add a reference to a recipient table object.
- **/
-void
-camel_recipient_table_ref (CamelRecipientTable *recipient_table)
-{
- g_return_if_fail (recipient_table);
- recipient_table->ref_count += 1;
-}
-
-
-
-static void
-_free_recipient_list (gpointer key, gpointer value, gpointer user_data)
-{
- GList *recipient_list = (GList *)value;
- gchar *recipient_name = (gchar *)key;
-
- while (recipient_list) {
- g_free (recipient_list->data);
- recipient_list = recipient_list->next;
- }
-
- g_free (recipient_name);
-
-}
-
-/**
- * camel_recipient_table_free: Free a recipient table object
- * @recipient_table: the recipient table object to free
- *
- * Free a recipient table object. All recipients and recipient
- * are freed.
- **/
-void
-camel_recipient_table_free (CamelRecipientTable *recipient_table)
-{
- if (!recipient_table) return;
-
- /* free each recipient list */
- g_hash_table_foreach (recipient_table->recipient_hash_table, _free_recipient_list, NULL);
- g_hash_table_destroy (recipient_table->recipient_hash_table);
-}
-
-
-
-
-/**
- * camel_recipient_table_unref: Removes a reference to a recipient table object
- * @recipient_table: the recipient table object
- *
- * Removes a reference to the reference count of a recipient
- * table object. If the reference count falls to zero, the
- * recipient table object is freed.
- *
- **/
-void
-camel_recipient_table_unref (CamelRecipientTable *recipient_table)
-{
- if (!recipient_table) return;
-
- recipient_table->ref_count -= 1;
- if (recipient_table->ref_count <1)
- camel_recipient_table_free (recipient_table);
-
-}
-
-
-
-
-/**
- * camel_recipient_table_add: Add a recipient to a recipient table object.
- * @recipient_table: The recipient table object
- * @recipient_type: Recipient type string
- * @recipient: The recipient to add
- *
- * Add a recipient to a recipient table object.
- * The recipient is appended to the list of recipients
- * of type @recipient_type. @recipient and @recipient_type
- * are duplicated if necessary and freed when
- * camel_recipient_table_free is called.
- **/
-void
-camel_recipient_table_add (CamelRecipientTable *recipient_table,
- const gchar *recipient_type,
- const gchar *recipient)
-{
- GList *recipients_list;
- GList *existent_list;
-
- /* see if there is already a list for this recipient type */
- existent_list = (GList *)g_hash_table_lookup (recipient_table->recipient_hash_table, recipient_type);
-
- /* append the new recipient to the recipient list
- if the existent_list is NULL, then a new GList is
- automagically created */
- recipients_list = g_list_append (existent_list, (gpointer)g_strdup (recipient));
-
- if (!existent_list) /* if there was no recipient of this type create the section */
- g_hash_table_insert (recipient_table->recipient_hash_table, g_strdup (recipient_type), recipients_list);
-
-
-}
-
-
-/**
- * camel_recipient_table_add_list: Add a full list of recipients to a recipient table.
- * @recipient_table: The recipient table object
- * @recipient_type: Recipient type string.
- * @recipient_list: Recipient list to add.
- *
- * Add a full list of recipients to a recipient table.
- * The new recipients are appended at the end of the
- * existing recipient list corresponding to @recipient_type.
- * Be careful, the list is used as is, and its element
- * will be freed by camel_recipient_table_unref
- **/
-void
-camel_recipient_table_add_list (CamelRecipientTable *recipient_table,
- const gchar *recipient_type,
- GList *recipient_list)
-{
- GList *existent_list;
-
- /* see if there is already a list for this recipient type */
- existent_list = (GList *)g_hash_table_lookup (recipient_table->recipient_hash_table, recipient_type);
-
- if (existent_list)
- g_list_concat (existent_list, recipient_list);
- else
- g_hash_table_insert (recipient_table->recipient_hash_table, g_strdup (recipient_type), recipient_list);
-
-}
-
-
-
-
-/**
- * camel_recipient_table_remove: Remove a recipient from a recipient table.
- * @recipient_table: The recipient table object
- * @recipient_type: Recipient type string.
- * @recipient: Recipient to remove from the table
- *
- * Remove a recipient from a recipient table. The recipient is
- * only removed from the recipient list corresponding to
- * @recipient_type. The removed recipient is freed.
- *
- **/
-void
-camel_recipient_table_remove (CamelRecipientTable *recipient_table,
- const gchar *recipient_type,
- const gchar *recipient)
-{
- GList *recipients_list;
- GList *new_recipients_list;
- GList *old_element;
- gchar *old_recipient_type;
-
- /* if the recipient type section does not exist, do nothing */
- if (! g_hash_table_lookup_extended (recipient_table->recipient_hash_table,
- recipient_type,
- (gpointer)&(old_recipient_type),
- (gpointer)&(recipients_list))
- ) return;
-
- /* look for the recipient to remove */
- /* g_list_find_custom , use gpointer instead of gconstpointer */
- old_element = g_list_find_custom (recipients_list, (gpointer)recipient, g_strcase_equal);
- if (old_element) {
- /* if recipient exists, remove it */
- new_recipients_list = g_list_remove_link (recipients_list, old_element);
-
- /* if glist head has changed, fix up hash table */
- if (new_recipients_list != recipients_list)
- g_hash_table_insert (recipient_table->recipient_hash_table, old_recipient_type, new_recipients_list);
-
- g_free( (gchar *)(old_element->data));
- g_list_free_1 (old_element);
- }
-}
-
-
-
-/**
- * camel_recipient_table_get: Get the recipients corresponding to a recipient type.
- * @recipient_table: The recipient table object
- * @recipient_type: Recipient type string.
- *
- * Return the list of recipients corresponding to
- * @recipient_type. The returned list is not a copy
- * of the internal list used by the recipient table object
- * but the list itself. It thus must not be freed.
- * The recipients it contains can be modified.
- *
- * Return value: The list of recipients.
- **/
-const GList *
-camel_recipient_table_get (CamelRecipientTable *recipient_table,
- const gchar *recipient_type)
-{
- return (const GList *)g_hash_table_lookup (recipient_table->recipient_hash_table, recipient_type);
-}
-
-
-
-
-/**
- * camel_recipient_foreach_recipient_type: Runs a function over over all recipients type lists.
- * @recipient_table: The recipient table object.
- * @func: The function to run.
- * @user_data: User data to pass to the function.
- *
- * Runs a function over over all recipients type lists.
- **/
-void
-camel_recipient_foreach_recipient_type (CamelRecipientTable *recipient_table,
- CRLFunc func,
- gpointer user_data)
-{
- g_hash_table_foreach (recipient_table->recipient_hash_table, (GHFunc)func, user_data);
-}
diff --git a/camel/camel-recipient.h b/camel/camel-recipient.h
deleted file mode 100644
index e59171add8..0000000000
--- a/camel/camel-recipient.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-recipient.h : handle recipients (addresses) and recipiemt lists */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_RECIPIENT_H
-#define CAMEL_RECIPIENT_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-
-
-
-typedef struct {
- GHashTable *recipient_hash_table;
- gint ref_count;
-
-} CamelRecipientTable;
-
-
-typedef void (*CRLFunc) (gchar *recipient_type,
- GList *recipient_list,
- gpointer user_data);
-
-
-
-
-CamelRecipientTable *camel_recipient_table_new ();
-
-void camel_recipient_table_ref (CamelRecipientTable *recipient_table);
-
-void camel_recipient_table_unref (CamelRecipientTable *recipient_table);
-
-void camel_recipient_table_add (CamelRecipientTable *recipient_table,
- const gchar *recipient_type,
- const gchar *recipient);
-
-void camel_recipient_table_add_list (CamelRecipientTable *recipient_table,
- const gchar *recipient_type,
- GList *recipient_list);
-
-void camel_recipient_table_remove (CamelRecipientTable *recipient_table,
- const gchar *recipient_type,
- const gchar *recipient);
-
-const GList *camel_recipient_table_get (CamelRecipientTable *recipient_table,
- const gchar *recipient_type);
-
-void camel_recipient_foreach_recipient_type (CamelRecipientTable *recipient_table,
- CRLFunc func,
- gpointer user_data);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_RECIPIENT_H */
-
diff --git a/camel/camel-seekable-stream.c b/camel/camel-seekable-stream.c
deleted file mode 100644
index 55bbbd611a..0000000000
--- a/camel/camel-seekable-stream.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-seekable-stream.h"
-#include "camel-log.h"
-
-static CamelStreamClass *parent_class=NULL;
-
-
-/* Returns the class for a CamelSeekableStream */
-#define CSS_CLASS(so) CAMEL_SEEKABLE_STREAM_CLASS (GTK_OBJECT(so)->klass)
-
-static gint _seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy);
-
-
-static void
-camel_seekable_stream_class_init (CamelSeekableStreamClass *camel_seekable_stream_class)
-{
- CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_seekable_stream_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_seekable_stream_class);
-
- parent_class = gtk_type_class (camel_stream_get_type ());
-
- camel_seekable_stream_class->seek = _seek;
-
-}
-
-GtkType
-camel_seekable_stream_get_type (void)
-{
- static GtkType camel_seekable_stream_type = 0;
-
- if (!camel_seekable_stream_type) {
- GtkTypeInfo camel_seekable_stream_info =
- {
- "CamelSeekableStream",
- sizeof (CamelSeekableStream),
- sizeof (CamelSeekableStreamClass),
- (GtkClassInitFunc) camel_seekable_stream_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_seekable_stream_type = gtk_type_unique (camel_stream_get_type (), &camel_seekable_stream_info);
- }
-
- return camel_seekable_stream_type;
-}
-
-
-
-
-static gint
-_seek (CamelSeekableStream *stream,
- gint offset,
- CamelStreamSeekPolicy policy)
-{
- return -1;
-}
-
-
-
-/**
- * camel_stream_seek:
- * @stream: a CamelStream object.
- * @offset: offset value
- * @policy: what to do with the offset
- *
- *
- *
- * Return value: new position, -1 if operation failed.
- **/
-gint
-camel_seekable_stream_seek (CamelSeekableStream *stream,
- gint offset,
- CamelStreamSeekPolicy policy)
-{
- return CSS_CLASS (stream)->seek (stream, offset, policy);
-}
-
-
-
-
-/**
- * camel_seekable_stream_get_current_position: get the position of a stream
- * @stream: seekable stream object
- *
- * Get the current position of a seekable stream.
- *
- * Return value: the position.
- **/
-guint32
-camel_seekable_stream_get_current_position (CamelSeekableStream *stream)
-{
- return stream->cur_pos;
-}
-
-
-
-
-
-
-
-
-
diff --git a/camel/camel-seekable-stream.h b/camel/camel-seekable-stream.h
deleted file mode 100644
index e7ab941caa..0000000000
--- a/camel/camel-seekable-stream.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-fs.h :stream based on unix filesystem */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_SEEKABLE_STREAM_H
-#define CAMEL_SEEKABLE_STREAM_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include "camel-stream.h"
-
-#define CAMEL_SEEKABLE_STREAM_TYPE (camel_seekable_stream_get_type ())
-#define CAMEL_SEEKABLE_STREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_SEEKABLE_STREAM_TYPE, CamelSeekableStream))
-#define CAMEL_SEEKABLE_STREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SEEKABLE_STREAM_TYPE, CamelSeekableStreamClass))
-#define CAMEL_IS_SEEKABLE_STREAM(o) (GTK_CHECK_TYPE((o), CAMEL_SEEKABLE_STREAM_TYPE))
-
-
-typedef enum
-{
- CAMEL_STREAM_SET,
- CAMEL_STREAM_CUR,
- CAMEL_STREAM_END
-
-} CamelStreamSeekPolicy;
-
-
-typedef struct
-{
- CamelStream parent_object;
-
- guint32 cur_pos; /* current postion in the stream */
-
-} CamelSeekableStream;
-
-
-
-typedef struct {
- CamelStreamClass parent_class;
-
- /* Virtual methods */
- gint (*seek) (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy);
-
-
-} CamelSeekableStreamClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_seekable_stream_get_type (void);
-
-
-/* public methods */
-gint camel_seekable_stream_seek (CamelSeekableStream *stream,
- gint offset,
- CamelStreamSeekPolicy policy);
-guint32 camel_seekable_stream_get_current_position (CamelSeekableStream *stream);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SEEKABLE_STREAM_H */
diff --git a/camel/camel-seekable-substream.c b/camel/camel-seekable-substream.c
deleted file mode 100644
index 6d59d8994c..0000000000
--- a/camel/camel-seekable-substream.c
+++ /dev/null
@@ -1,460 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-fs.c : file system based stream */
-
-/* inspired by gnome-stream-fs.c in bonobo by Miguel de Icaza */
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-seekable-substream.h"
-#include "camel-log.h"
-
-static CamelSeekableStreamClass *parent_class=NULL;
-
-
-/* Returns the class for a CamelSeekableSubStream */
-#define CSS_CLASS(so) CAMEL_SEEKABLE_SUBSTREAM_CLASS (GTK_OBJECT(so)->klass)
-
-
-
-
-static gint _read (CamelStream *stream,
- gchar *buffer, gint n);
-static gint _write (CamelStream *stream,
- const gchar *buffer,
- gint n);
-static void _flush (CamelStream *stream);
-static gint _available (CamelStream *stream);
-static gboolean _eos (CamelStream *stream);
-static void _close (CamelStream *stream);
-static gint _seek (CamelSeekableStream *stream,
- gint offset,
- CamelStreamSeekPolicy policy);
-
-static void _finalize (GtkObject *object);
-static void _destroy (GtkObject *object);
-
-static void _init_with_seekable_stream_and_bounds (CamelSeekableSubstream *seekable_substream,
- CamelSeekableStream *parent_stream,
- guint32 inf_bound,
- gint64 sup_bound);
-
-
-
-
-static void
-camel_seekable_substream_class_init (CamelSeekableSubstreamClass *camel_seekable_substream_class)
-{
- CamelSeekableStreamClass *camel_seekable_stream_class = CAMEL_SEEKABLE_STREAM_CLASS (camel_seekable_substream_class);
- CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_seekable_substream_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_seekable_substream_class);
-
- parent_class = gtk_type_class (camel_seekable_stream_get_type ());
-
- /* virtual method definition */
- camel_seekable_substream_class->init_with_seekable_stream_and_bounds = _init_with_seekable_stream_and_bounds;
-
- /* virtual method overload */
- camel_stream_class->read = _read;
- camel_stream_class->write = _write;
- camel_stream_class->flush = _flush;
- camel_stream_class->available = _available;
- camel_stream_class->eos = _eos;
- camel_stream_class->close = _close;
-
- camel_seekable_stream_class->seek = _seek;
-
- gtk_object_class->finalize = _finalize;
- gtk_object_class->destroy = _destroy;
-
-}
-
-static void
-camel_seekable_substream_init (gpointer object, gpointer klass)
-{
- /* does nothing */
-}
-
-
-
-
-GtkType
-camel_seekable_substream_get_type (void)
-{
- static GtkType camel_seekable_substream_type = 0;
-
- if (!camel_seekable_substream_type) {
- GtkTypeInfo camel_seekable_substream_info =
- {
- "CamelSeekableSubstream",
- sizeof (CamelSeekableSubstream),
- sizeof (CamelSeekableSubstreamClass),
- (GtkClassInitFunc) camel_seekable_substream_class_init,
- (GtkObjectInitFunc) camel_seekable_substream_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_seekable_substream_type = gtk_type_unique (camel_seekable_stream_get_type (), &camel_seekable_substream_info);
- }
-
- return camel_seekable_substream_type;
-}
-
-
-
-
-
-
-static void
-_destroy (GtkObject *object)
-{
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelSeekableSubstream::destroy\n");
-
- /* does nothing for the moment */
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelSeekableSubstream::destroy\n");
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelSeekableStream *seekable_stream;
- CAMEL_LOG_FULL_DEBUG ("Entering CamelSeekableSubstream::finalize\n");
-
- seekable_stream = CAMEL_SEEKABLE_STREAM (object);
-
- if (seekable_stream->parent_stream)
- gtk_object_unref (seekable_stream->parent_stream);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelSeekableSubstream::finalize\n");
-}
-
-
-
-static void
-_set_bounds (CamelSeekableSubstream *seekable_substream, guint32 inf_bound, gint64 sup_bound)
-{
- CAMEL_LOG_FULL_DEBUG ("CamelSeekableSubstream::_set_bounds entering\n");
-
- g_assert (seekable_substream);
- g_assert (seekable_substream->parent_stream);
-
- /* store the bounds */
- seekable_substream->inf_bound = inf_bound;
- seekable_substream->sup_bound = sup_bound;
-
-
- seekable_substream->cur_pos = 0;
-
- CAMEL_LOG_FULL_DEBUG ("In CamelSeekableSubstream::_set_bounds, "
- "setting inf bound to %lu, "
- "sup bound to %lld, current position to %lu from %lu\n",
- seekable_substream->inf_bound, seekable_substream->sup_bound,
- seekable_substream->cur_pos, inf_bound);
-
- CAMEL_LOG_FULL_DEBUG ("CamelSeekableSubstream::_set_bounds Leaving\n");
-}
-
-
-
-static void
-_init_with_seekable_stream_and_bounds (CamelSeekableSubstream *seekable_substream,
- CamelSeekableStream *parent_stream,
- guint32 inf_bound,
- gint64 sup_bound)
-{
- /* sanity checks */
- g_assert (seekable_substream);
- g_assert (!seekable_substream->parent_stream);
- g_assert (parent_stream);
-
- /* store the parent stream */
- seekable_substream->parent_stream = parent_stream;
- gtk_object_ref (parent_stream);
-
- /* set the bound of the substream */
- _set_bounds (seekable_substream, inf_bound, sup_bound);
-}
-
-
-
-CamelSeekableSubstream *
-camel_seekable_substream_new_with_seekable_stream_and_bounds (CamelSeekableStream *parent_stream,
- guint32 inf_bound,
- gint64 sup_bound)
-{
- CamelSeekableSubstream *seekable_substream;
-
- /* create the seekable substream */
- seekable_substream = gtk_type_new (camel_seekable_substream_get_type ());
-
- /* initialize it */
- CSS_CLASS (seekable_substream)->init_with_seekable_stream_and_bounds (seekable_substream,
- parent_stream,
- inf_bound,
- sup_bound);
- return seekable_substream;
-}
-
-
-
-
-
-/**
- * _read: read bytes from a stream
- * @stream: stream
- * @buffer: buffer where bytes are stored
- * @n: max number of bytes to read
- *
- *
- *
- * Return value: number of bytes actually read.
- **/
-static gint
-_read (CamelStream *stream, gchar *buffer, gint n)
-{
- CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream);
- CamelSeekableSubstream *seekable_substream = CAMEL_SEEKABLE_SUBSTREAM (stream);
- gint v;
- gint nb_to_read;
- guint32 parent_stream_current_position;
- guint32 position_in_parent;
-
- g_assert (stream);
- g_assert (seekable_substream->parent_stream);
-
-
-
- /*
- we are doing something quite infefficient :
-
- each time we want to read a block, we store
- the parent stream position so that we can
- change it, and restore it before returning
-
- This may change. I don't know yet.
- It may be useless to reseek every time
- and is incompatible with buffering.
- */
-
- parent_stream_current_position =
- camel_seekable_stream_get_current_position (seekable_substream->parent_stream);
-
- /* compute the position in the parent stream */
- position_in_parent =
- seekable_stream->cur_pos + seekable_substream->inf_bound;
-
- /* go to our position in the parent stream */
- if (parent_stream_current_position != position_in_parent)
- camel_seekable_stream_seek (seekable_substream->parent_stream,
- position_in_parent,
- CAMEL_STREAM_SET);
-
-
-
- /* compute how much byte should be read */
- if (seekable_substream->sup_bound != -1)
- nb_to_read =
- MIN (seekable_substream->sup_bound - position_in_parent, n);
- else
- nb_to_read = n;
-
-
- /* Read the data */
- if (nb_to_read >0 )
- v = camel_stream_read ( CAMEL_STREAM (seekable_substream->parent_stream),
- buffer,
- nb_to_read);
- else
- v = 0;
-
- /* if the return value is negative, an error occured,
- we must do something FIXME : handle exception */
- if (v<0)
- CAMEL_LOG_FULL_DEBUG ("CamelSeekableSubstream::read v=%d\n", v);
- else
- seekable_stream->cur_pos += v;
-
-
-
- /* return the number of bytes read */
- return v;
-}
-
-
-/**
- * _write: write bytes to a stream
- * @stream: the stream
- * @buffer: byte buffer
- * @n: number of bytes to write
- *
- *
- *
- * Return value: the number of bytes actually written
- * in the stream.
- **/
-static gint
-_write (CamelStream *stream, const gchar *buffer, gint n)
-{
- /* NOT VALID ON SEEKABLE SUBSTREAM */
- g_warning ("CamelSeekableSubstream:: seekable substream don't have a write method\n");
- CAMEL_LOG_WARNING ( "CamelSeekableSubstream:: seekable substream don't have a write method\n");
- return -1;
-}
-
-
-
-/**
- * _flush: flush pending changes
- * @stream: the stream
- *
- *
- **/
-static void
-_flush (CamelStream *stream)
-{
- /* NOT VALID ON SEEKABLE SUBSTREAM */
- g_warning ("CamelSeekableSubstream:: seekable substream don't have a flush method\n");
- CAMEL_LOG_WARNING ( "CamelSeekableSubstream:: seekable substream don't have a flush method\n");
-}
-
-
-
-/**
- * _available: return the number of bytes available for reading
- * @stream: the stream
- *
- * Return the number of bytes available without blocking.
- *
- * Return value: the number of bytes available
- **/
-static gint
-_available (CamelStream *stream)
-{
- g_warning ("not implemented\n");
- return -1;
-}
-
-
-/**
- * _eos: test if there are bytes left to read
- * @stream: the stream
- *
- *
- *
- * Return value: true if all stream has been read
- **/
-static gboolean
-_eos (CamelStream *stream)
-{
- CamelSeekableSubstream *seekable_substream = CAMEL_SEEKABLE_SUBSTREAM (stream);
- CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream);
- guint32 substream_len;
- gboolean eos;
-
- g_assert (stream);
-
- if (seekable_substream->sup_bound != -1) {
- substream_len = seekable_substream->sup_bound - seekable_substream->inf_bound;
- eos = ( seekable_stream->cur_pos >= substream_len);
- } else {
- eos = camel_stream_eos (CAMEL_STREAM (seekable_substream->parent_stream));
- }
-
- return eos;
-}
-
-
-/**
- * _close: close a stream
- * @stream: the stream
- *
- *
- **/
-static void
-_close (CamelStream *stream)
-{
- CamelSeekableSubstream *seekable_substream = CAMEL_SEEKABLE_SUBSTREAM (stream);
-
- g_assert (stream);
- seekable_substream->open = FALSE;
-}
-
-
-static gint
-_seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy)
-{
- CamelSeekableSubstream *seekable_substream = CAMEL_SEEKABLE_SUBSTREAM (stream);
- CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream);
- gint64 real_offset = 0;
- guint32 substream_len;
- guint32 parent_pos;
- gboolean seek_done = FALSE;
-
- substream_len = seekable_substream->sup_bound - seekable_substream->inf_bound;
-
- switch (policy) {
-
- case CAMEL_STREAM_SET:
- real_offset = offset;
-
- break;
-
- case CAMEL_STREAM_CUR:
- real_offset = seekable_stream->cur_pos + offset;
-
- break;
-
- case CAMEL_STREAM_END:
- if (seekable_substream->sup_bound != -1)
- real_offset = substream_len - offset;
- else {
- parent_pos = camel_seekable_stream_seek (seekable_substream->parent_stream,
- offset,
- CAMEL_STREAM_END);
- seekable_stream->cur_pos = parent_pos - seekable_substream->inf_bound;
- seek_done = TRUE;
- }
-
- break;
-
- default:
- return -1;
- }
- if (!seek_done) {
- if (real_offset > 0) {
- seekable_stream->cur_pos = MIN (real_offset, substream_len);
- } else
- seekable_stream->cur_pos = 0;
- }
-
-
- return seekable_stream->cur_pos;
-}
-
-
diff --git a/camel/camel-seekable-substream.h b/camel/camel-seekable-substream.h
deleted file mode 100644
index 93c4bf7d97..0000000000
--- a/camel/camel-seekable-substream.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-seekable-substream.h : stream */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_SEEKABLE_SUBSTREAM_H
-#define CAMEL_SEEKABLE_SUBSTREAM_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include "camel-seekable-stream.h"
-
-
-
-#define CAMEL_SEEKABLE_SUBSTREAM_TYPE (camel_seekable_substream_get_type ())
-#define CAMEL_SEEKABLE_SUBSTREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_SEEKABLE_SUBSTREAM_TYPE, CamelSeekableSubstream))
-#define CAMEL_SEEKABLE_SUBSTREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SEEKABLE_SUBSTREAM_TYPE, CamelSeekableSubstreamClass))
-#define CAMEL_IS_SEEKABLE_SUBSTREAM(o) (GTK_CHECK_TYPE((o), CAMEL_SEEKABLE_SUBSTREAM_TYPE))
-
-
-
-
-typedef struct
-{
- CamelSeekableStream parent_object;
-
- /* --**-- Private fields --**-- */
- CamelSeekableStream *parent_stream; /* the stream this substream uses */
- guint32 cur_pos; /* current postion in the stream */
- guint32 inf_bound; /* first valid position */
- gint64 sup_bound; /* first invalid position */
- gboolean open;
-
-} CamelSeekableSubstream;
-
-
-
-typedef struct {
- CamelSeekableStreamClass parent_class;
-
- /* Virtual methods */
- void (*init_with_seekable_stream_and_bounds) (CamelSeekableSubstream *seekable_substream,
- CamelSeekableStream *parent_stream,
- guint32 inf_bound,
- gint64 sup_bound);
-
-} CamelSeekableSubstreamClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_seekable_substream_get_type (void);
-
-
-/* public methods */
-
-/* obtain a new seekable substream */
-CamelSeekableSubstream *
-camel_seekable_substream_new_with_seekable_stream_and_bounds (CamelSeekableStream *parent_stream,
- guint32 inf_bound,
- gint64 sup_bound);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SEEKABLE_SUBSTREAM_H */
diff --git a/camel/camel-service.c b/camel/camel-service.c
deleted file mode 100644
index bf7af23ed2..0000000000
--- a/camel/camel-service.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelService.c : Abstract class for an email service */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-service.h"
-#include "camel-log.h"
-
-static GtkObjectClass *parent_class=NULL;
-
-/* Returns the class for a CamelService */
-#define CSERV_CLASS(so) CAMEL_SERVICE_CLASS (GTK_OBJECT(so)->klass)
-
-static void _connect(CamelService *service);
-static void _connect_to_with_login_passwd (CamelService *service, gchar *host, gchar *login, gchar *passwd);
-static void _connect_to_with_login_passwd_port (CamelService *service, gchar *host, gchar *login, gchar *passwd, guint port);
-static gboolean _is_connected (CamelService *service);
-static void _set_connected (CamelService *service, gboolean state);
-static const gchar *_get_url (CamelService *service);
-static void _finalize (GtkObject *object);
-
-static void
-camel_service_class_init (CamelServiceClass *camel_service_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_service_class);
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
- camel_service_class->connect = _connect;
- camel_service_class->connect_to_with_login_passwd = _connect_to_with_login_passwd;
- camel_service_class->connect_to_with_login_passwd_port = _connect_to_with_login_passwd_port;
- camel_service_class->is_connected = _is_connected;
- camel_service_class->set_connected = _set_connected;
- camel_service_class->get_url = _get_url;
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-}
-
-
-
-
-
-
-
-GtkType
-camel_service_get_type (void)
-{
- static GtkType camel_service_type = 0;
-
- if (!camel_service_type) {
- GtkTypeInfo camel_service_info =
- {
- "CamelService",
- sizeof (CamelService),
- sizeof (CamelServiceClass),
- (GtkClassInitFunc) camel_service_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_service_type = gtk_type_unique (gtk_object_get_type (), &camel_service_info);
- }
-
- return camel_service_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelService *camel_service = CAMEL_SERVICE (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelService::finalize\n");
-
- g_free (camel_service->url);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelService::finalize\n");
-}
-
-
-
-/**
- * _connect : connect to a service
- *
- * connect to the service using the parameters
- * stored in the session it is initialized with
- * WARNING: session not implemented for the moment
- *
- * @service: object to connect
- **/
-static void
-_connect (CamelService *service)
-{
- CSERV_CLASS(service)->set_connected(service, TRUE);
-}
-
-
-
-/**
- * camel_service_connect:connect to a service
- * @service: CamelService object
- *
- * connect to the service using the parameters
- * stored in the session it is initialized with
- * WARNING: session not implemented for the moment
- *
- **/
-void
-camel_service_connect (CamelService *service)
-{
- CSERV_CLASS(service)->connect(service);
-}
-
-
-
-/**
- * _connect_to: connect to the specified address
- *
- * Connect to the service, but do not use the session
- * default parameters to retrieve server's address
- *
- * @service: object to connect
- * @host: host to connect to
- * @login: user name used to log in
- * @passwd: password used to log in
- **/
-static void
-_connect_to_with_login_passwd (CamelService *service, gchar *host, gchar *login, gchar *passwd)
-{
- CSERV_CLASS(service)->set_connected(service, TRUE);
-}
-
-/**
- * camel_service_connect_to_with_login_passwd: connect a service
- * @service: the service to connect
- * @host: host to connect to
- * @login: login to connect with
- * @passwd: password to connect with
- *
- * Connect to a service, but do not use the session
- * default parameters to retrieve server's address
- *
- **/
-void
-camel_service_connect_to_with_login_passwd (CamelService *service, gchar *host, gchar *login, gchar *passwd)
-{
- CSERV_CLASS(service)->connect_to_with_login_passwd (service, host, login, passwd);
-}
-
-
-
-
-/**
- * _connect_to_with_login_passwd_port: connect to the specified address
- * @service: service to connect
- * @host: host to connect to
- * @login: user name used to log in
- * @passwd: password used to log in
- * @port: port to connect to
- *
- *
- **/
-static void
-_connect_to_with_login_passwd_port (CamelService *service, gchar *host, gchar *login, gchar *passwd, guint port)
-{
- CSERV_CLASS(service)->set_connected(service, TRUE);
-}
-
-
-/**
- * camel_service_connect_to_with_login_passwd_port: connect a service
- * @service: service to connect
- * @host: host to connect to
- * @login: user name used to log in
- * @passwd: password used to log in
- * @port: port to connect to
- *
- * Connect to a service, but do not use the session
- * default parameters to retrieve server's address
- *
- **/
-void
-camel_service_connect_to_with_login_passwd_port (CamelService *service, gchar *host, gchar *login, gchar *passwd, guint port)
-{
- CSERV_CLASS(service)->connect_to_with_login_passwd_port (service, host, login, passwd, port);
-}
-
-
-
-
-/**
- * _is_connected: test if the service object is connected
- * @service: object to test
- *
- *
- *
- * Return value:
- **/
-static gboolean
-_is_connected (CamelService *service)
-{
- return service->connected;
-}
-
-
-/**
- * camel_service_is_connected: test if the service object is connected
- * @service: object to test
- *
- *
- *
- * Return value:
- **/
-gboolean
-camel_service_is_connected (CamelService *service)
-{
- return CSERV_CLASS(service)->is_connected(service);
-}
-
-
-
-/**
- * _set_connected:set the connected state
- * @service: object to set the state of
- * @state: connected/disconnected
- *
- * This routine has to be called by providers to set the
- * connection state, mainly when the service is disconnected
- * wheras the close() method has not been called.
- *
- **/
-static void
-_set_connected (CamelService *service, gboolean state)
-{
- service->connected = state;
-}
-
-
-
-/**
- * _get_url: get url representing a service
- * @service: the service
- *
- * This method merely returns the "url" field. Subclasses
- * may provide more active implementations.
- *
- *
- * Return value:
- **/
-static const gchar *
-_get_url (CamelService *service)
-{
- return service->url;
-}
-
-/**
- * camel_service_get_url: get the url representing a service
- * @service: the service
- *
- * returns the URL representing a service. For security reasons
- * This routine may not always return the password.
- *
- * Return value: the url name
- **/
-const gchar *
-camel_service_get_url (CamelService *service)
-{
- return CSERV_CLASS(service)->get_url(service);
-}
-
-
diff --git a/camel/camel-service.h b/camel/camel-service.h
deleted file mode 100644
index ae960e22b8..0000000000
--- a/camel/camel-service.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-service.h : Abstract class for an email service */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_SERVICE_H
-#define CAMEL_SERVICE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-#define CAMEL_SERVICE_TYPE (camel_service_get_type ())
-#define CAMEL_SERVICE(obj) (GTK_CHECK_CAST((obj), CAMEL_SERVICE_TYPE, CamelService))
-#define CAMEL_SERVICE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SERVICE_TYPE, CamelServiceClass))
-#define CAMEL_IS_SERVICE(o) (GTK_CHECK_TYPE((o), CAMEL_SERVICE_TYPE))
-
-
-
-typedef struct {
- GtkObject parent_object;
-
- gboolean connected;
- gchar *url; /* This may be a full object ? */
-
-} CamelService;
-
-
-
-typedef struct {
- GtkObjectClass parent_class;
-
- void (*connect) (CamelService *service);
- void (*connect_to_with_login_passwd) (CamelService *service, gchar *host, gchar *login, gchar *passwd);
- void (*connect_to_with_login_passwd_port) (CamelService *service, gchar *host, gchar *login, gchar *passwd, guint port);
- gboolean (*is_connected) (CamelService *service);
- void (*set_connected) (CamelService *service, gboolean state);
- const gchar * (*get_url) (CamelService *service);
-
-} CamelServiceClass;
-
-
-
-
-/* public methods */
-void camel_service_connect (CamelService *service);
-gboolean camel_service_is_connected (CamelService *service);
-void camel_service_connect_to_with_login_passwd (CamelService *service, gchar *host, gchar *login, gchar *passwd);
-void camel_service_connect_to_with_login_passwd_port (CamelService *service, gchar *host, gchar *login, gchar *passwd, guint port);
-const gchar *camel_service_get_url (CamelService *service);
-/* Standard Gtk function */
-GtkType camel_service_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SERVICE_H */
-
diff --git a/camel/camel-session.c b/camel/camel-session.c
deleted file mode 100644
index 923d60c629..0000000000
--- a/camel/camel-session.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-session.c : Abstract class for an email session */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-session.h"
-#include "string-utils.h"
-#include "url-util.h"
-#include "camel-provider.h"
-#include "hash-table-utils.h"
-
-static GtkObjectClass *parent_class=NULL;
-
-/* Returns the class for a CamelSession */
-#define CSS_CLASS(so) CAMEL_SESSION_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void
-camel_session_class_init (CamelSessionClass *camel_session_class)
-{
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
-}
-
-
-
-
-
-static void
-camel_session_init (CamelSession *session)
-{
- session->store_provider_list = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- session->transport_provider_list = g_hash_table_new (g_strcase_hash, g_strcase_equal);
-}
-
-
-
-GtkType
-camel_session_get_type (void)
-{
- static GtkType camel_session_type = 0;
-
- if (!camel_session_type) {
- GtkTypeInfo camel_session_info =
- {
- "CamelSession",
- sizeof (CamelSession),
- sizeof (CamelSessionClass),
- (GtkClassInitFunc) camel_session_class_init,
- (GtkObjectInitFunc) camel_session_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_session_type = gtk_type_unique (gtk_object_get_type (), &camel_session_info);
- }
-
- return camel_session_type;
-}
-
-
-CamelSession *
-camel_session_new ()
-{
- return gtk_type_new (CAMEL_SESSION_TYPE);
-}
-
-/**
- * camel_session_set_provider: set the default provider for a protocol
- * @session: session object for wich the provider will the default
- * @provider: provider object
- *
- * Set the default implementation for a protocol. The protocol
- * is determined by provider->protocol field (See CamelProtocol).
- * It overrides the default provider for this protocol.
- *
- **/
-void
-camel_session_set_provider (CamelSession *session, CamelProvider *provider)
-{
- GHashTable *table;
-
- g_assert(session);
- g_assert(provider);
-
- if (provider->provider_type == PROVIDER_STORE)
- table = session->store_provider_list;
- else
- table = session->transport_provider_list;
-
- g_hash_table_insert (table, (gpointer)(provider->protocol), (gpointer)(provider));
-
-}
-
-
-
-
-
-/**
- * camel_session_get_store_from_provider: create a folder instance for a given provider
- * @session: session object the folder will be initialized with
- * @provider: provider folder to instantiate
- *
- *
- *
- * Return value: the newly instantiated store
- **/
-CamelStore *
-camel_session_get_store_from_provider (CamelSession *session, CamelProvider *provider)
-{
- CamelStore *store;
-
- g_assert(session);
- g_assert(provider);
-
- store = CAMEL_STORE (gtk_object_new (provider->object_type, NULL));
-#warning set the url to a useful value.
- camel_store_init(store, session, NULL, NULL);
- return store;
-}
-
-
-
-
-/**
- * camel_session_get_store_for_protocol: get the store associated to a protocol
- * @session: CamelSession object
- * @protocol: protocol name
- *
- * Return a CamelStore object associated to a given
- * store protocol. If a provider has been set for this
- * protocol in the session @session using
- * camel_session_set_provider (), then a store
- * obtained from this provider is return.
- * Otherwise, if one or more provider corresponding
- * to this protocol has been registered (See
- * camel_provider_register_as_module), the last registered
- * one is used.
- *
- * Return value: store associated to this protocol or NULL if no provider was found.
- **/
-CamelStore *
-camel_session_get_store_for_protocol (CamelSession *session, const gchar *protocol)
-{
- const CamelProvider *provider = NULL;
- CamelStore *new_store;
-
- /* look if there is a provider assiciated to this
- protocol in this session */
- provider = CAMEL_PROVIDER (g_hash_table_lookup (session->store_provider_list, protocol));
- if (!provider)
- /* no provider was found in this session, look
- if there is a registered provider for this
- protocol */
- provider = camel_provider_get_for_protocol (protocol, PROVIDER_STORE);
-
- if (!provider) return NULL;
-
- new_store = (CamelStore *)gtk_type_new (provider->object_type);
- return new_store;
-}
-
-
-
-
-/**
- * camel_session_get_store: get a store object for an URL
- * @session: session object
- * @url_string: url
- *
- * return a store corresponding to an URL.
- *
- * Return value: the store, or NULL if no provider correponds to the protocol
- **/
-CamelStore *
-camel_session_get_store (CamelSession *session, const gchar *url_string)
-{
- Gurl *url = NULL;
- CamelStore *new_store = NULL;
-
- url = g_url_new (url_string);
- g_return_val_if_fail (url, NULL);
-
- if (url->protocol) {
- new_store = camel_session_get_store_for_protocol (session, url->protocol);
- if (new_store)
- camel_store_init (new_store, session, url_string, NULL);
- }
- g_url_free (url);
-
- return new_store;
-
-}
diff --git a/camel/camel-session.h b/camel/camel-session.h
deleted file mode 100644
index bd7af5dc38..0000000000
--- a/camel/camel-session.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-session.h : Abstract class for an email session */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_SESSION_H
-#define CAMEL_SESSION_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-typedef struct _CamelSession CamelSession;
-
-#include "camel-provider.h"
-#include "camel-store.h"
-
-#define CAMEL_SESSION_TYPE (camel_session_get_type ())
-#define CAMEL_SESSION(obj) (GTK_CHECK_CAST((obj), CAMEL_SESSION_TYPE, CamelSession))
-#define CAMEL_SESSION_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SESSION_TYPE, CamelSessionClass))
-#define CAMEL_IS_SESSION(o) (GTK_CHECK_TYPE((o), CAMEL_SESSION_TYPE))
-
-
-
-
-struct _CamelSession
-{
- GtkObject parent_object;
- GHashTable *store_provider_list; /* providers are identified by their protocol */
- GHashTable *transport_provider_list;
-
-
-};
-
-
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /* Virtual methods */
-
-} CamelSessionClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_session_get_type (void);
-
-
-CamelSession *camel_session_new ();
-void camel_session_set_provider (CamelSession *session, CamelProvider *provider);
-CamelStore *camel_session_get_store_for_protocol (CamelSession *session, const gchar *protocol);
-CamelStore *camel_session_get_store (CamelSession *session, const gchar *url_string);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SESSION_H */
diff --git a/camel/camel-simple-data-wrapper-stream.c b/camel/camel-simple-data-wrapper-stream.c
deleted file mode 100644
index 5e89734729..0000000000
--- a/camel/camel-simple-data-wrapper-stream.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* camel-simple-data-wrapper-stream.c
- *
- * Copyright 1999, 2000 HelixCode (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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "camel-simple-data-wrapper-stream.h"
-
-
-static CamelStreamClass *parent_class = NULL;
-
-
-/* CamelStream methods. */
-
-static gint
-read (CamelStream *stream,
- gchar *buffer,
- gint n)
-{
- CamelSimpleDataWrapperStream *wrapper_stream;
- CamelSimpleDataWrapper *wrapper;
- GByteArray *array;
- gint len;
-
- wrapper_stream = CAMEL_SIMPLE_DATA_WRAPPER_STREAM (stream);
- wrapper = wrapper_stream->wrapper;
- g_return_val_if_fail (wrapper != NULL, -1);
- array = wrapper->byte_array;
-
- len = MIN (n, array->len - wrapper_stream->current_position);
- if (len > 0) {
- memcpy (buffer, wrapper_stream->current_position + array->data, len);
- wrapper_stream->current_position += len;
- return len;
- } else {
- return 0;
- }
-}
-
-static gint
-write (CamelStream *stream,
- const gchar *buffer,
- gint n)
-{
- CamelSimpleDataWrapperStream *wrapper_stream;
- CamelSimpleDataWrapper *wrapper;
- GByteArray *array;
- gint len;
- const gchar *buffer_next;
- gint left;
-
- wrapper_stream = CAMEL_SIMPLE_DATA_WRAPPER_STREAM (stream);
- wrapper = wrapper_stream->wrapper;
- g_return_val_if_fail (wrapper != NULL, -1);
- array = wrapper->byte_array;
-
- len = MIN (n, array->len - wrapper_stream->current_position);
- if (len > 0) {
- memcpy (array->data, buffer, len);
- buffer_next = buffer + len;
- left = n - len;
- } else {
- /* If we are past the end of the array, fill with zeros. */
- if (wrapper_stream->current_position > array->len) {
- gint saved_length;
-
- saved_length = array->len;
- g_byte_array_set_size
- (array, wrapper_stream->current_position);
- memset (array->data + saved_length,
- 0,
- (wrapper_stream->current_position
- - saved_length));
- }
-
- buffer_next = buffer;
- left = n;
- }
-
- if (n > 0)
- g_byte_array_append (array, buffer_next, left);
-
- wrapper_stream->current_position += n;
- return n;
-}
-
-static void
-flush (CamelStream *stream)
-{
- /* No op, as we don't do any buffering. */
-}
-
-static gint
-available (CamelStream *stream)
-{
- CamelSimpleDataWrapperStream *wrapper_stream;
- CamelSimpleDataWrapper *wrapper;
- GByteArray *array;
- gint available;
-
- wrapper_stream = CAMEL_SIMPLE_DATA_WRAPPER_STREAM (stream);
- wrapper = wrapper_stream->wrapper;
- g_return_val_if_fail (wrapper != NULL, -1);
- array = wrapper->byte_array;
-
- available = array->len - wrapper_stream->current_position;
- return MAX (available, 0);
-}
-
-static gboolean
-eos (CamelStream *stream)
-{
- if (available (stream) > 0)
- return TRUE;
- else
- return FALSE;
-}
-
-static void
-close (CamelStream *stream)
-{
- /* Nothing to do, we have no associated file descriptor. */
-}
-
-static gint
-seek (CamelSeekableStream *stream,
- gint offset,
- CamelStreamSeekPolicy policy)
-{
- CamelSimpleDataWrapperStream *wrapper_stream;
- gint new_position;
-
- wrapper_stream = CAMEL_SIMPLE_DATA_WRAPPER_STREAM (stream);
-
- switch (policy) {
- case CAMEL_STREAM_SET:
- new_position = offset;
- break;
- case CAMEL_STREAM_CUR:
- new_position = wrapper_stream->current_position + offset;
- break;
- case CAMEL_STREAM_END:
- new_position = wrapper_stream->wrapper->byte_array->len - offset;
- break;
- default:
- g_warning ("Unknown CamelStreamSeekPolicy %d.", policy);
- return -1;
- }
-
- if (new_position<0)
- new_position = 0;
- else if (new_position>=wrapper_stream->wrapper->byte_array->len)
- new_position = wrapper_stream->wrapper->byte_array->len-1;
-
- wrapper_stream->current_position = new_position;
- return new_position;
-}
-
-
-/* This handles destruction of the associated CamelDataWrapper. */
-/* Hm, this should never happen though, because we gtk_object_ref() the
- wrapper. */
-static void
-wrapper_destroy_cb (GtkObject *object,
- gpointer data)
-{
- CamelSimpleDataWrapperStream *stream;
-
- g_warning ("CamelSimpleDataWrapperStream: associated CamelSimpleDataWrapper was destroyed.");
- stream = CAMEL_SIMPLE_DATA_WRAPPER_STREAM (object);
- stream->wrapper = NULL;
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- CamelSimpleDataWrapperStream *stream;
-
- stream = CAMEL_SIMPLE_DATA_WRAPPER_STREAM (object);
-
- gtk_object_unref (GTK_OBJECT (stream->wrapper));
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-static void
-class_init (CamelSimpleDataWrapperStreamClass *klass)
-{
- GtkObjectClass *object_class;
- CamelStreamClass *stream_class;
- CamelSeekableStreamClass *seek_class;
-
- object_class = (GtkObjectClass*) klass;
- stream_class = (CamelStreamClass *)klass;
- seek_class = (CamelSeekableStreamClass *)klass;
-
- stream_class->read = read;
- stream_class->write = write;
- stream_class->flush = flush;
- stream_class->available = available;
- stream_class->eos = eos;
- stream_class->close = close;
-
- seek_class->seek = seek;
-
- object_class->destroy = destroy;
-
- parent_class = gtk_type_class (camel_stream_get_type ());
-}
-
-static void
-init (CamelSimpleDataWrapperStream *simple_data_wrapper_stream)
-{
- simple_data_wrapper_stream->current_position = 0;
-}
-
-
-GtkType
-camel_simple_data_wrapper_stream_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "CamelSimpleDataWrapperStream",
- sizeof (CamelSimpleDataWrapperStream),
- sizeof (CamelSimpleDataWrapperStreamClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (camel_stream_get_type (), &info);
- }
-
- return type;
-}
-
-void
-camel_simple_data_wrapper_stream_construct (CamelSimpleDataWrapperStream *stream,
- CamelSimpleDataWrapper *wrapper)
-{
- g_return_if_fail (stream != NULL);
- g_return_if_fail (CAMEL_IS_SIMPLE_DATA_WRAPPER_STREAM (stream));
- g_return_if_fail (wrapper != NULL);
- g_return_if_fail (CAMEL_IS_SIMPLE_DATA_WRAPPER (wrapper));
-
- gtk_object_ref (GTK_OBJECT (wrapper));
- stream->wrapper = wrapper;
-#if 0
- gtk_signal_connect (GTK_OBJECT (wrapper), "destroy",
- wrapper_destroy_cb, stream);
-#endif
-}
-
-CamelStream *
-camel_simple_data_wrapper_stream_new (CamelSimpleDataWrapper *wrapper)
-{
- CamelStream *stream;
-
- g_return_val_if_fail (wrapper != NULL, NULL);
- g_return_val_if_fail (CAMEL_IS_SIMPLE_DATA_WRAPPER (wrapper), NULL);
-
- stream = gtk_type_new (camel_simple_data_wrapper_stream_get_type ());
-
- camel_simple_data_wrapper_stream_construct
- (CAMEL_SIMPLE_DATA_WRAPPER_STREAM (stream), wrapper);
-
- return stream;
-}
diff --git a/camel/camel-simple-data-wrapper-stream.h b/camel/camel-simple-data-wrapper-stream.h
deleted file mode 100644
index e756d3e591..0000000000
--- a/camel/camel-simple-data-wrapper-stream.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* camel-simple-data-wrapper-stream.h
- *
- * Copyright 1999, 2000 HelixCode (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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef __CAMEL_SIMPLE_DATA_WRAPPER_STREAM_H__
-#define __CAMEL_SIMPLE_DATA_WRAPPER_STREAM_H__
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-
-#include "camel-simple-data-wrapper.h"
-#include "camel-seekable-stream.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define CAMEL_TYPE_SIMPLE_DATA_WRAPPER_STREAM \
- (camel_simple_data_wrapper_stream_get_type ())
-#define CAMEL_SIMPLE_DATA_WRAPPER_STREAM(obj) \
- (GTK_CHECK_CAST ((obj), CAMEL_TYPE_SIMPLE_DATA_WRAPPER_STREAM, CamelSimpleDataWrapperStream))
-#define CAMEL_SIMPLE_DATA_WRAPPER_STREAM_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), CAMEL_TYPE_SIMPLE_DATA_WRAPPER_STREAM, CamelSimpleDataWrapperStreamClass))
-#define CAMEL_IS_SIMPLE_DATA_WRAPPER_STREAM(obj) \
- (GTK_CHECK_TYPE ((obj), CAMEL_TYPE_SIMPLE_DATA_WRAPPER_STREAM))
-#define CAMEL_IS_SIMPLE_DATA_WRAPPER_STREAM_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((obj), CAMEL_TYPE_SIMPLE_DATA_WRAPPER_STREAM))
-
-
-typedef struct _CamelSimpleDataWrapperStream CamelSimpleDataWrapperStream;
-typedef struct _CamelSimpleDataWrapperStreamClass CamelSimpleDataWrapperStreamClass;
-
-struct _CamelSimpleDataWrapperStream {
- CamelSeekableStream parent;
-
- CamelSimpleDataWrapper *wrapper;
- gint current_position;
-};
-
-struct _CamelSimpleDataWrapperStreamClass {
- CamelSeekableStreamClass parent_class;
-};
-
-
-GtkType camel_simple_data_wrapper_stream_get_type (void);
-CamelStream *camel_simple_data_wrapper_stream_new (CamelSimpleDataWrapper *wrapper);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __CAMEL_SIMPLE_DATA_WRAPPER_STREAM_H__ */
diff --git a/camel/camel-simple-data-wrapper.c b/camel/camel-simple-data-wrapper.c
deleted file mode 100644
index 943d8e902d..0000000000
--- a/camel/camel-simple-data-wrapper.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-simple-data-wrapper.c : simple implementation of a data wrapper */
-/* store the data in a glib byte array */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-simple-data-wrapper-stream.h"
-#include "camel-log.h"
-
-static CamelDataWrapperClass *parent_class=NULL;
-
-/* Returns the class for a CamelDataWrapper */
-#define CSDW_CLASS(so) CAMEL_SIMPLE_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass)
-
-static void _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static void _finalize (GtkObject *object);
-static CamelStream *_get_stream (CamelDataWrapper *data_wrapper);
-
-static void
-camel_simple_data_wrapper_class_init (CamelSimpleDataWrapperClass *camel_simple_data_wrapper_class)
-{
- CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_simple_data_wrapper_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_data_wrapper_class);
-
- parent_class = gtk_type_class (camel_data_wrapper_get_type ());
- /* virtual method definition */
-
- /* virtual method overload */
- camel_data_wrapper_class->write_to_stream = _write_to_stream;
- camel_data_wrapper_class->construct_from_stream = _construct_from_stream;
-
- camel_data_wrapper_class->get_stream = _get_stream;
-
- gtk_object_class->finalize = _finalize;
-}
-
-
-static void
-camel_simple_data_wrapper_init (CamelSimpleDataWrapper *wrapper)
-{
- wrapper->stream = NULL;
-}
-
-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) camel_simple_data_wrapper_init,
- /* 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);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMimePart::finalize\n");
- if (simple_data_wrapper->byte_array) g_byte_array_free (simple_data_wrapper->byte_array, TRUE);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMimePart::finalize\n");
-}
-
-
-/**
- * camel_simple_data_wrapper_new: create a new CamelSimpleDataWrapper object
- *
- *
- *
- * Return value:
- **/
-CamelSimpleDataWrapper *
-camel_simple_data_wrapper_new ()
-{
- CamelSimpleDataWrapper *simple_data_wrapper;
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Entering new()\n");
-
- simple_data_wrapper = (CamelSimpleDataWrapper *)gtk_type_new (CAMEL_SIMPLE_DATA_WRAPPER_TYPE);
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Leaving new()\n");
- return simple_data_wrapper;
-}
-
-
-
-static void
-_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelSimpleDataWrapper *simple_data_wrapper = CAMEL_SIMPLE_DATA_WRAPPER (data_wrapper);
- GByteArray *array;
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Entering _write_to_stream\n");
-
- g_assert (data_wrapper);
- g_assert (stream);
- g_assert (simple_data_wrapper->byte_array);
- array = simple_data_wrapper->byte_array;
- if (array->len)
- camel_stream_write (stream, (gchar *)array->data, array->len);
-
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Leaving _write_to_stream\n");
-}
-
-
-#define _CMSDW_TMP_BUF_SIZE 100
-static void
-_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelSimpleDataWrapper *simple_data_wrapper = CAMEL_SIMPLE_DATA_WRAPPER (data_wrapper);
- gint nb_bytes_read;
- static gchar *tmp_buf;
- GByteArray *array;
-
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Entering _construct_from_stream\n");
-
- g_assert (data_wrapper);
- g_assert (stream);
-
- if (!tmp_buf) {
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::construct_from_stream allocating new temp buffer "
- "with %d bytes\n", _CMSDW_TMP_BUF_SIZE);
- tmp_buf = g_new (gchar, _CMSDW_TMP_BUF_SIZE);
- }
-
- array = simple_data_wrapper->byte_array;
- if (array) {
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::construct_from_stream freeing old byte array\n");
- g_byte_array_free (array, FALSE);
- }
-
- array = g_byte_array_new ();
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::construct_from_stream new byte array address:%p\n", array);
- simple_data_wrapper->byte_array = array;
- nb_bytes_read = camel_stream_read (stream, tmp_buf, _CMSDW_TMP_BUF_SIZE);
- while (nb_bytes_read>0) {
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::construct_from_stream read %d bytes from stream\n", nb_bytes_read);
- if (nb_bytes_read>0) g_byte_array_append (array, tmp_buf, nb_bytes_read);
- nb_bytes_read = camel_stream_read (stream, tmp_buf, _CMSDW_TMP_BUF_SIZE);
- };
-
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Leaving _construct_from_stream\n");
-}
-
-
-
-
-/**
- * camel_simple_data_wrapper_set_text: set some text as data wrapper content
- * @simple_data_wrapper: SimpleDataWrapper object
- * @text: the text to use
- *
- * Utility routine used to set up the content of a SimpleDataWrapper object
- * to be a character string.
- **/
-void
-camel_simple_data_wrapper_set_text (CamelSimpleDataWrapper *simple_data_wrapper, const gchar *text)
-{
- GByteArray *array;
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Entering set_text\n");
-
- array = simple_data_wrapper->byte_array;
- if (array) {
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::set_text freeing old byte array\n");
- g_byte_array_free (array, FALSE);
- }
-
- array = g_byte_array_new ();
- simple_data_wrapper->byte_array = array;
-
- g_byte_array_append (array, text, strlen (text));
-
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Entering set_text\n");
-}
-
-
-
-static CamelStream *
-_get_stream (CamelDataWrapper *data_wrapper)
-{
- CamelSimpleDataWrapper *simple_data_wrapper;
-
- simple_data_wrapper = CAMEL_SIMPLE_DATA_WRAPPER (data_wrapper);
- if (simple_data_wrapper->stream == NULL) {
- CamelStream *s;
-
- s = camel_simple_data_wrapper_stream_new (simple_data_wrapper);
- simple_data_wrapper->stream = s;
- }
-
- return simple_data_wrapper->stream;
-}
diff --git a/camel/camel-simple-data-wrapper.h b/camel/camel-simple-data-wrapper.h
deleted file mode 100644
index 1a511b96c4..0000000000
--- a/camel/camel-simple-data-wrapper.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-simple-data-wrapper.c : simple implementation of a data wrapper */
-/* store the data in a glib byte array */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 <gtk/gtk.h>
-#include <stdio.h>
-#include "camel-stream.h"
-#include "camel-data-wrapper.h"
-
-
-
-#define CAMEL_SIMPLE_DATA_WRAPPER_TYPE (camel_simple_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))
-
-
-typedef struct
-{
- CamelDataWrapper parent_object;
-
- GByteArray *byte_array;
- CamelStream *stream;
-} CamelSimpleDataWrapper;
-
-
-
-typedef struct {
- CamelDataWrapperClass parent_class;
-
-
-} CamelSimpleDataWrapperClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_simple_data_wrapper_get_type (void);
-
-
-/* public methods */
-
-CamelSimpleDataWrapper *camel_simple_data_wrapper_new ();
-void camel_simple_data_wrapper_set_text (CamelSimpleDataWrapper *simple_data_wrapper, const gchar *text);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SIMPLE_DATA_WRAPPER_H */
diff --git a/camel/camel-store.c b/camel/camel-store.c
deleted file mode 100644
index 4e8e873ab3..0000000000
--- a/camel/camel-store.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelStore.c : Abstract class for an email store */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-store.h"
-#include "camel-log.h"
-
-static CamelServiceClass *parent_class = NULL;
-
-/* Returns the class for a CamelStore */
-#define CS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-
-static void _set_separator(CamelStore *store, gchar sep, CamelException *ex);
-static CamelFolder *_get_root_folder(CamelStore *store, CamelException *ex);
-static CamelFolder *_get_default_folder(CamelStore *store, CamelException *ex);
-static void _init(CamelStore *store, CamelSession *session, const gchar *url_name, CamelException *ex);
-static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex);
-static gchar _get_separator (CamelStore *store, CamelException *ex);
-
-static void _finalize (GtkObject *object);
-
-static void
-camel_store_class_init (CamelStoreClass *camel_store_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_store_class);
-
- parent_class = gtk_type_class (camel_service_get_type ());
-
- /* virtual method definition */
- camel_store_class->init = _init;
- camel_store_class->set_separator = _set_separator;
- camel_store_class->get_separator = _get_separator;
- camel_store_class->get_folder = _get_folder;
- camel_store_class->get_root_folder = _get_root_folder;
- camel_store_class->get_default_folder = _get_default_folder;
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-}
-
-
-
-
-
-
-
-GtkType
-camel_store_get_type (void)
-{
- static GtkType camel_store_type = 0;
-
- if (!camel_store_type) {
- GtkTypeInfo camel_store_info =
- {
- "CamelStore",
- sizeof (CamelStore),
- sizeof (CamelStoreClass),
- (GtkClassInitFunc) camel_store_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_store_type = gtk_type_unique (CAMEL_SERVICE_TYPE, &camel_store_info);
- }
-
- return camel_store_type;
-}
-
-
-
-
-
-/**
- * camel_store_init: call store's init method
- * @store: the store to initialize
- * @session: session which instantiates the store
- * @url_name: URL defining the store
- *
- * This routine is called by the session object from which this
- * store is created. It must not be called directly.
- *
- **/
-void
-camel_store_init (CamelStore *store, CamelSession *session, const gchar *url_name, CamelException *ex)
-{
- g_assert(store);
- CS_CLASS(store)->init (store, session, url_name, ex);
-}
-
-
-/**
- * init: method called by a session object to initialize a store object
- * @store: the store to initialize
- * @session: session which instantiates the store
- * @url_name: URL defining the store
- *
- * This routine is called by the session object from which this
- * store is created. Be careful, @url_name is used as a private field
- * of the store object.
- *
- **/
-static void
-_init (CamelStore *store, CamelSession *session, const gchar *url_name, CamelException *ex)
-{
-
-#warning re-enable assertion here.
- g_assert(session);
- g_assert(url_name);
-
- store->session = session;
- gtk_object_ref (GTK_OBJECT (session));
- /*store->url_name = url_name;*/
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelStore *camel_store = CAMEL_STORE (object);
- CAMEL_LOG_FULL_DEBUG ("Entering CamelStore::finalize\n");
-
- /* if (camel_store->url_name) g_free (camel_store->url_name); */
- if (camel_store->session) gtk_object_unref (GTK_OBJECT (camel_store->session));
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelStore::finalize\n");
-}
-
-
-
-/**
- * camel_store_set_separator: set the character which separates this folder path from the folders names in a lower level of hierarchy.
- *
- * @store:
- * @sep:
- *
- **/
-static void
-_set_separator (CamelStore *store, gchar sep, CamelException *ex)
-{
- store->separator = sep;
-}
-
-
-
-
-
-static gchar
-_get_separator (CamelStore *store, CamelException *ex)
-{
- g_assert(store);
- return store->separator;
-}
-
-
-
-/**
- * camel_store_get_separator: return the character which separates this folder path from the folders names in a lower level of hierarchy.
- * @store: store
- *
- *
- *
- * Return value: the separator
- **/
-gchar
-camel_store_get_separator (CamelStore *store, CamelException *ex)
-{
- return CS_CLASS(store)->get_separator (store, ex);
-}
-
-
-
-
-
-
-
-static CamelFolder *
-_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex)
-{
- return NULL;
-}
-
-
-/**
- * camel_store_get_folder: return the folder corresponding to a path.
- * @store: store
- * @folder_name: name of the folder to get
- *
- * Returns the folder corresponding to the path "name".
- * If the path begins with the separator caracter, it
- * is relative to the root folder. Otherwise, it is
- * relative to the default folder.
- * The folder does not necessarily exist on the store.
- * To make sure it already exists, use its "exists" method.
- * If it does not exist, you can create it with its
- * "create" method.
- *
- *
- * Return value: the folder
- **/
-CamelFolder *
-camel_store_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex)
-{
- return CS_CLASS(store)->get_folder (store, folder_name, ex);
-}
-
-
-/**
- * camel_store_get_root_folder : return the toplevel folder
- *
- * Returns the folder which is at the top of the folder
- * hierarchy. This folder is generally different from
- * the default folder.
- *
- * @Return value: the toplevel folder.
- **/
-static CamelFolder *
-_get_root_folder (CamelStore *store, CamelException *ex)
-{
- return NULL;
-}
-
-/**
- * camel_store_get_default_folder : return the store default folder
- *
- * The default folder is the folder which is presented
- * to the user in the default configuration. The default
- * is often the root folder.
- *
- * @Return value: the default folder.
- **/
-static CamelFolder *
-_get_default_folder (CamelStore *store, CamelException *ex)
-{
- return NULL;
-}
-
-
-CamelSession *
-camel_store_get_session (CamelStore *store, CamelException *ex)
-{
- if (!store) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_STORE_NULL,
- "Store is NULL");
- return NULL;
- }
-
- return store->session;
-}
-
diff --git a/camel/camel-store.h b/camel/camel-store.h
deleted file mode 100644
index 60254b3a27..0000000000
--- a/camel/camel-store.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-store.h : Abstract class for an email store */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_STORE_H
-#define CAMEL_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-typedef struct _CamelStore CamelStore;
-
-#include "camel-folder.h"
-#include "camel-service.h"
-#include "camel-session.h"
-#include "camel-exception.h"
-
-#define CAMEL_STORE_TYPE (camel_store_get_type ())
-#define CAMEL_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_STORE_TYPE, CamelStore))
-#define CAMEL_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STORE_TYPE, CamelStoreClass))
-#define CAMEL_IS_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_STORE_TYPE))
-
-
-struct _CamelStore
-{
- CamelService parent_object;
-
- CamelSession *session;
- /* gchar *url_name; */
- gchar separator;
-};
-
-
-
-typedef struct {
- CamelServiceClass parent_class;
-
- void (*init) (CamelStore *store,
- CamelSession *session,
- const gchar *url_name,
- CamelException *ex);
- void (*set_separator) (CamelStore *store, gchar sep,
- CamelException *ex);
- gchar (*get_separator) (CamelStore *store,
- CamelException *ex);
- CamelFolder * (*get_folder) (CamelStore *store,
- const gchar *folder_name,
- CamelException *ex);
- CamelFolder * (*get_root_folder) (CamelStore *store,
- CamelException *ex);
- CamelFolder * (*get_default_folder) (CamelStore *store,
- CamelException *ex);
-
-} CamelStoreClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_store_get_type (void);
-
-void camel_store_init (CamelStore *store, CamelSession *session, const gchar *url_name, CamelException *ex);
-CamelFolder * camel_store_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex);
-gchar camel_store_get_separator (CamelStore *store, CamelException *ex);
-CamelSession * camel_store_get_session (CamelStore *store, CamelException *ex);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STORE_H */
diff --git a/camel/camel-stream-buffered-fs.c b/camel/camel-stream-buffered-fs.c
deleted file mode 100644
index 0aba2e2538..0000000000
--- a/camel/camel-stream-buffered-fs.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-buffered-fs.c : file system based stream with buffer*/
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-stream-buffered-fs.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include "camel-log.h"
-
-static CamelStreamFsClass *parent_class=NULL;
-
-
-/* Returns the class for a CamelStreamBufferedFs */
-#define CSBFS_CLASS(so) CAMEL_STREAM_BUFFERED_FS_CLASS (GTK_OBJECT(so)->klass)
-#define CSFS_CLASS(so) CAMEL_STREAM_FS_CLASS (GTK_OBJECT(so)->klass)
-#define CS_CLASS(so) CAMEL_STREAM_CLASS (GTK_OBJECT(so)->klass)
-
-static gint _read (CamelStream *stream, gchar *buffer, gint n);
-static gint _write (CamelStream *stream, const gchar *buffer, gint n);
-static void _flush (CamelStream *stream);
-static gint _available (CamelStream *stream);
-static gboolean _eos (CamelStream *stream);
-static void _close (CamelStream *stream);
-static gint _seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy);
-
-static void _finalize (GtkObject *object);
-static void _destroy (GtkObject *object);
-
-static void
-camel_stream_buffered_fs_class_init (CamelStreamBufferedFsClass *camel_stream_buffered_fs_class)
-{
- CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_buffered_fs_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_buffered_fs_class);
-
- parent_class = gtk_type_class (camel_stream_fs_get_type ());
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_stream_class->read = _read;
-
- gtk_object_class->finalize = _finalize;
- gtk_object_class->destroy = _destroy;
-
-}
-
-static void
-camel_stream_buffered_fs_init (gpointer object, gpointer klass)
-{
- CamelStreamBufferedFs *stream = CAMEL_STREAM_BUFFERED_FS (object);
-
- stream->buffer_size = 200;
- stream->read_buffer = g_new (gchar, stream->buffer_size);
- stream->write_buffer = g_new (gchar, stream->buffer_size);
- stream->read_pos = 0;
- stream->read_pos_max = 0;
- stream->write_pos = 0;
- stream->write_pos_max = stream->buffer_size;
-}
-
-GtkType
-camel_stream_buffered_fs_get_type (void)
-{
- static GtkType camel_stream_buffered_fs_type = 0;
-
- gdk_threads_enter ();
- if (!camel_stream_buffered_fs_type) {
- GtkTypeInfo camel_stream_buffered_fs_info =
- {
- "CamelStreamBufferedFs",
- sizeof (CamelStreamBufferedFs),
- sizeof (CamelStreamBufferedFsClass),
- (GtkClassInitFunc) camel_stream_buffered_fs_class_init,
- (GtkObjectInitFunc) camel_stream_buffered_fs_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_stream_buffered_fs_type = gtk_type_unique (camel_stream_fs_get_type (), &camel_stream_buffered_fs_info);
- }
- gdk_threads_leave ();
- return camel_stream_buffered_fs_type;
-}
-
-
-static void
-_destroy (GtkObject *object)
-{
- CamelStreamBufferedFs *stream_buffered_fs = CAMEL_STREAM_BUFFERED_FS (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamBufferedFs::destroy\n");
-
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamBufferedFs::destroy\n");
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelStreamBufferedFs *stream_buffered_fs = CAMEL_STREAM_BUFFERED_FS (object);
-
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamBufferedFs::finalize\n");
-
- g_free (stream_buffered_fs->read_buffer);
- g_free (stream_buffered_fs->write_buffer);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamBufferedFs::finalize\n");
-}
-
-
-
-CamelStream *
-camel_stream_buffered_fs_new_with_name (const gchar *name, CamelStreamFsMode mode)
-{
- CamelStreamFs *stream_buffered_fs;
- stream_buffered_fs = gtk_type_new (camel_stream_buffered_fs_get_type ());
- CSFS_CLASS (stream_buffered_fs)->init_with_name (stream_buffered_fs, name, mode);
-
- return CAMEL_STREAM (stream_buffered_fs);
-
-}
-
-CamelStream *
-camel_stream_buffered_fs_new_with_fd (int fd)
-{
- CamelStreamFs *stream_buffered_fs;
-
- CAMEL_LOG_FULL_DEBUG ( "Entering CamelStream::new_with_fd fd=%d\n",fd);
- stream_buffered_fs = gtk_type_new (camel_stream_buffered_fs_get_type ());
- CSFS_CLASS (stream_buffered_fs)->init_with_fd (stream_buffered_fs, fd);
-
-
- return CAMEL_STREAM (stream_buffered_fs);
-}
-
-/**
- * _read: read bytes from a stream
- * @stream: stream
- * @buffer: buffer where bytes are stored
- * @n: max number of bytes to read
- *
- *
- *
- * Return value: number of bytes actually read.
- **/
-static gint
-_read (CamelStream *stream, gchar *buffer, gint n)
-{
- CamelStreamBufferedFs *sbf = CAMEL_STREAM_BUFFERED_FS (stream);
- gint v;
- gint nb_bytes_buffered;
- gint nb_bytes_to_read = n;
- gint nb_bytes_read = 0;
- gint bytes_chunk;
- gboolean eof = FALSE;
-
- g_return_val_if_fail (n>0, n);
-
- nb_bytes_buffered = sbf->read_pos_max - sbf->read_pos;
- while ( (!eof) && (nb_bytes_to_read>0)) {
- if (nb_bytes_buffered <= 0) {
- /* have to read some data on disk */
- v = CAMEL_STREAM_CLASS (parent_class)->read (stream, sbf->read_buffer, sbf->buffer_size);
- nb_bytes_buffered = v;
- sbf->read_pos_max = v;
- sbf->read_pos = 0;
- }
-
- /* nb of bytes to put inside buffer */
- bytes_chunk = MIN (nb_bytes_buffered, nb_bytes_to_read);
-
- if (bytes_chunk > 0) {
- /* copy some bytes from the cache */
- memcpy (buffer, sbf->read_buffer + sbf->read_pos, bytes_chunk);
- nb_bytes_buffered -= bytes_chunk;
- nb_bytes_to_read -= bytes_chunk;
- nb_bytes_read += bytes_chunk;
- sbf->read_pos += bytes_chunk;
-
- } else /* nb_bytes_to_read is >0 so if bytes_chunk is <0
- * there was no data available */
- eof = TRUE;
- }
-
-
-
- return nb_bytes_read;
-}
-
-
-static gint
-_write (CamelStream *stream, const gchar *buffer, gint n)
-{
- return 0;
-}
-
-
-
-static void
-_flush (CamelStream *stream)
-{
-
-}
-
-
-
-static gint
-_available (CamelStream *stream)
-{
- return 0;
-}
-
-
-static gboolean
-_eos (CamelStream *stream)
-{
- return FALSE;
-}
-
-
-
-static void
-_close (CamelStream *stream)
-{
-
-}
-
-
-static gint
-_seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy)
-{
- return 0;
-}
diff --git a/camel/camel-stream-buffered-fs.h b/camel/camel-stream-buffered-fs.h
deleted file mode 100644
index 778c7e88df..0000000000
--- a/camel/camel-stream-buffered-fs.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-bufered-fs.h :stream based on unix filesystem */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_STREAM_BUFFERED_FS_H
-#define CAMEL_STREAM_BUFFERED_FS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include "camel-stream-fs.h"
-
-#define CAMEL_STREAM_BUFFERED_FS_TYPE (camel_stream_buffered_fs_get_type ())
-#define CAMEL_STREAM_BUFFERED_FS(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_BUFFERED_FS_TYPE, CamelStreamBufferedFs))
-#define CAMEL_STREAM_BUFFERED_FS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STREAM_BUFFERED_FS_TYPE, CamelStreamBufferedFsClass))
-#define CAMEL_IS_STREAM_BUFFERED_FS(o) (GTK_CHECK_TYPE((o), CAMEL_STREAM_BUFFERED_FS_TYPE))
-
-typedef enum
-{
- CAMEL_STREAM_BUFFERED_FS_READ = 1,
- CAMEL_STREAM_BUFFERED_FS_WRITE = 2
-} CamelStreamBufferedFsMode;
-
-
-typedef struct
-{
- CamelStreamFs parent_object;
-
- gint buffer_size;
- gchar *read_buffer;
- gint read_pos;
- gint read_pos_max;
-
- gchar *write_buffer;
- gint write_pos;
- gint write_pos_max;
-
-} CamelStreamBufferedFs;
-
-
-
-typedef struct {
- CamelStreamFsClass parent_class;
-
- /* Virtual methods */
-
-} CamelStreamBufferedFsClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_stream_buffered_fs_get_type (void);
-
-
-/* public methods */
-CamelStream *camel_stream_buffered_fs_new_with_name (const gchar *name, CamelStreamBufferedFsMode mode);
-CamelStream *camel_stream_buffered_fs_new_with_fd (int fd);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_BUFFERED_FS_H */
diff --git a/camel/camel-stream-data-wrapper.c b/camel/camel-stream-data-wrapper.c
deleted file mode 100644
index f4dfbb29e9..0000000000
--- a/camel/camel-stream-data-wrapper.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* camel-stream-data-wrapper.c
- *
- * Copyright 1999, 2000 HelixCode (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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-
-#include "camel-stream-data-wrapper.h"
-
-
-static CamelDataWrapperClass *parent_class = NULL;
-
-
-/* CamelDataWrapper methods. */
-
-static void
-write_to_stream (CamelDataWrapper *data_wrapper,
- CamelStream *output_stream)
-{
-#define BUFFER_SIZE 4096
- gchar buffer[BUFFER_SIZE];
- CamelStreamDataWrapper *stream_data_wrapper;
- CamelStream *input_stream;
-
- stream_data_wrapper = CAMEL_STREAM_DATA_WRAPPER (data_wrapper);
- input_stream = stream_data_wrapper->stream;
-
- while (TRUE) {
- gchar *p;
- gint read, written;
-
- read = camel_stream_read (input_stream, buffer, BUFFER_SIZE);
- if (read == 0)
- break;
-
- p = buffer;
- while (read > 0) {
- written = camel_stream_write (output_stream, p, read);
-
- /* FIXME no way to report an error?! */
- if (written == -1)
- break;
-
- p += written;
- read -= written;
- }
- }
-#undef BUFFER_SIZE
-}
-
-static CamelStream *
-get_stream (CamelDataWrapper *data_wrapper)
-{
- CamelStreamDataWrapper *stream_data_wrapper;
-
- stream_data_wrapper = CAMEL_STREAM_DATA_WRAPPER (data_wrapper);
- return stream_data_wrapper->stream;
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- CamelStreamDataWrapper *stream_data_wrapper;
- GtkObject *stream_object;
-
- stream_data_wrapper = CAMEL_STREAM_DATA_WRAPPER (object);
-
- stream_object = GTK_OBJECT (object);
- stream_data_wrapper->stream = NULL;
-
- gtk_object_unref (stream_object);
-}
-
-
-/* This handles destruction of the associated CamelDataWrapper outside
- CamelStreamDataWrapper, for debuggin purposes (this should never happen). */
-static void
-stream_destroy_cb (GtkObject *object,
- gpointer data)
-{
- CamelStreamDataWrapper *wrapper;
-
- wrapper = CAMEL_STREAM_DATA_WRAPPER (data);
-
- /* Hack: when we destroy the stream ourselves, we set the `stream'
- member to NULL first, so that we can recognize when this is done out
- of our control. */
- if (wrapper->stream != NULL) {
- g_warning ("CamelSimpleDataWrapperStream: associated CamelSimpleDataWrapper was destroyed.");
- wrapper->stream = NULL;
- }
-}
-
-
-static void
-class_init (CamelStreamDataWrapperClass *class)
-{
- GtkObjectClass *object_class;
- CamelDataWrapperClass *data_wrapper_class;
-
- object_class = GTK_OBJECT_CLASS (class);
- object_class->destroy = destroy;
-
- data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (class);
- data_wrapper_class->write_to_stream = write_to_stream;
- data_wrapper_class->get_stream = get_stream;
-
- parent_class = gtk_type_class (camel_data_wrapper_get_type ());
-}
-
-static void
-init (CamelStreamDataWrapper *wrapper)
-{
- wrapper->stream = NULL;
-}
-
-
-GtkType
-camel_stream_data_wrapper_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "CamelStreamDataWrapper",
- sizeof (CamelStreamDataWrapper),
- sizeof (CamelStreamDataWrapperClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (camel_data_wrapper_get_type (), &info);
- }
-
- return type;
-}
-
-/**
- * camel_stream_data_wrapper_construct:
- * @wrapper: A CamelStreamDataWrapper object
- * @stream: A Camel stream object
- *
- * Construct @wrapper associating @stream to it. Notice that, after this call,
- * @stream is conceptually owned by @wrapper and will be destroyed when
- * @wrapper is destroyed.
- **/
-void
-camel_stream_data_wrapper_construct (CamelStreamDataWrapper *wrapper,
- CamelStream *stream)
-{
- g_return_if_fail (wrapper != NULL);
- g_return_if_fail (CAMEL_IS_STREAM_DATA_WRAPPER (wrapper));
- g_return_if_fail (stream != NULL);
- g_return_if_fail (CAMEL_IS_STREAM (stream));
-
- wrapper->stream = stream;
- gtk_signal_connect (GTK_OBJECT (stream), "destroy",
- GTK_SIGNAL_FUNC (stream_destroy_cb), wrapper);
-}
-
-/**
- * camel_stream_data_wrapper_new:
- * @stream: A Camel stream object
- *
- * Create a new stream data wrapper object for @stream. Notice that, after
- * this call, @stream is conceptually owned by the new wrapper and will be
- * destroyed when the wrapper is destroyed.
- *
- * Return value: A pointer to the new CamelStreamDataWrapper object.
- **/
-CamelDataWrapper *
-camel_stream_data_wrapper_new (CamelStream *stream)
-{
- CamelDataWrapper *wrapper;
-
- wrapper = gtk_type_new (camel_stream_data_wrapper_get_type ());
- camel_stream_data_wrapper_construct
- (CAMEL_STREAM_DATA_WRAPPER (wrapper), stream);
-
- return wrapper;
-}
diff --git a/camel/camel-stream-data-wrapper.h b/camel/camel-stream-data-wrapper.h
deleted file mode 100644
index d0b95e63a6..0000000000
--- a/camel/camel-stream-data-wrapper.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* camel-stream-data-wrapper.h
- *
- * Copyright 1999, 2000 HelixCode (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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef __CAMEL_STREAM_DATA_WRAPPER_H__
-#define __CAMEL_STREAM_DATA_WRAPPER_H__
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-#include "camel-data-wrapper.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-
-#define CAMEL_TYPE_STREAM_DATA_WRAPPER \
- (camel_stream_data_wrapper_get_type ())
-#define CAMEL_STREAM_DATA_WRAPPER(obj) \
- (GTK_CHECK_CAST ((obj), CAMEL_TYPE_STREAM_DATA_WRAPPER, CamelStreamDataWrapper))
-#define CAMEL_STREAM_DATA_WRAPPER_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), CAMEL_TYPE_STREAM_DATA_WRAPPER, CamelStreamDataWrapperClass))
-#define CAMEL_IS_STREAM_DATA_WRAPPER(obj) \
- (GTK_CHECK_TYPE ((obj), CAMEL_TYPE_STREAM_DATA_WRAPPER))
-#define CAMEL_IS_STREAM_DATA_WRAPPER_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((obj), CAMEL_TYPE_STREAM_DATA_WRAPPER))
-
-
-typedef struct _CamelStreamDataWrapper CamelStreamDataWrapper;
-typedef struct _CamelStreamDataWrapperClass CamelStreamDataWrapperClass;
-
-struct _CamelStreamDataWrapper {
- CamelDataWrapper parent;
-
- CamelStream *stream;
-};
-
-struct _CamelStreamDataWrapperClass {
- CamelDataWrapperClass parent_class;
-};
-
-
-GtkType camel_stream_data_wrapper_get_type (void);
-CamelDataWrapper *camel_stream_data_wrapper_new (CamelStream *stream);
-void camel_stream_data_wrapper_construct (CamelStreamDataWrapper *wrapper,
- CamelStream *stream);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __CAMEL_STREAM_DATA_WRAPPER_H__ */
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c
deleted file mode 100644
index d6ba5fba13..0000000000
--- a/camel/camel-stream-fs.c
+++ /dev/null
@@ -1,548 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-fs.c : file system based stream */
-
-/* inspired by gnome-stream-fs.c in bonobo by Miguel de Icaza */
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-stream-fs.h"
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include "camel-log.h"
-
-static CamelSeekableStreamClass *parent_class=NULL;
-
-
-/* Returns the class for a CamelStreamFS */
-#define CSFS_CLASS(so) CAMEL_STREAM_FS_CLASS (GTK_OBJECT(so)->klass)
-
-static gint _read (CamelStream *stream, gchar *buffer, gint n);
-static gint _write (CamelStream *stream, const gchar *buffer, gint n);
-static void _flush (CamelStream *stream);
-static gboolean _available (CamelStream *stream);
-static gboolean _eos (CamelStream *stream);
-static void _close (CamelStream *stream);
-static gint _seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy);
-
-static void _finalize (GtkObject *object);
-static void _destroy (GtkObject *object);
-
-static void _init_with_fd (CamelStreamFs *stream_fs, int fd);
-static void _init_with_fd_and_bounds (CamelStreamFs *stream_fs, int fd, guint32 inf_bound, gint32 sup_bound);
-static void _init_with_name (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode);
-static void _init_with_name_and_bounds (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode,
- guint32 inf_bound, gint32 sup_bound);
-
-static void
-camel_stream_fs_class_init (CamelStreamFsClass *camel_stream_fs_class)
-{
- CamelSeekableStreamClass *camel_seekable_stream_class = CAMEL_SEEKABLE_STREAM_CLASS (camel_stream_fs_class);
- CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_fs_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_fs_class);
-
- parent_class = gtk_type_class (camel_seekable_stream_get_type ());
-
- /* virtual method definition */
- camel_stream_fs_class->init_with_fd = _init_with_fd;
- camel_stream_fs_class->init_with_fd_and_bounds = _init_with_fd_and_bounds;
- camel_stream_fs_class->init_with_name = _init_with_name;
- camel_stream_fs_class->init_with_name_and_bounds = _init_with_name_and_bounds;
-
- /* virtual method overload */
- camel_stream_class->read = _read;
- camel_stream_class->write = _write;
- camel_stream_class->flush = _flush;
- camel_stream_class->available = _available;
- camel_stream_class->eos = _eos;
- camel_stream_class->close = _close;
-
- camel_seekable_stream_class->seek = _seek;
-
- gtk_object_class->finalize = _finalize;
- gtk_object_class->destroy = _destroy;
-
-}
-
-static void
-camel_stream_fs_init (gpointer object, gpointer klass)
-{
- CamelStreamFs *stream = CAMEL_STREAM_FS (object);
-
- stream->name = NULL;
- stream->eof = FALSE;
-}
-
-
-GtkType
-camel_stream_fs_get_type (void)
-{
- static GtkType camel_stream_fs_type = 0;
-
- if (!camel_stream_fs_type) {
- GtkTypeInfo camel_stream_fs_info =
- {
- "CamelStreamFs",
- sizeof (CamelStreamFs),
- sizeof (CamelStreamFsClass),
- (GtkClassInitFunc) camel_stream_fs_class_init,
- (GtkObjectInitFunc) camel_stream_fs_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_stream_fs_type = gtk_type_unique (camel_seekable_stream_get_type (), &camel_stream_fs_info);
- }
-
- return camel_stream_fs_type;
-}
-
-
-static void
-_destroy (GtkObject *object)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (object);
- gint close_error;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamFs::destroy\n");
-
- close_error = close (stream_fs->fd);
- if (close_error) {
- CAMEL_LOG_FULL_DEBUG ("CamelStreamFs::destroy Error while closing file descriptor\n");
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
- }
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamFs::destroy\n");
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (object);
-
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamFs::finalize\n");
-
- g_free (stream_fs->name);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamFs::finalize\n");
-}
-
-
-
-static void
-_set_bounds (CamelStreamFs *stream_fs, guint32 inf_bound, guint32 sup_bound)
-{
-
- printf ("sup_bounds = %u\n", sup_bound);
- /* store the bounds */
- stream_fs->inf_bound = inf_bound;
- stream_fs->sup_bound = sup_bound;
-
- /* go to the first position */
- lseek (stream_fs->fd, inf_bound, SEEK_SET);
-
- CAMEL_SEEKABLE_STREAM (stream_fs)->cur_pos = inf_bound;
-
- CAMEL_LOG_FULL_DEBUG ("In CamelStreamFs::_set_bounds, "
- "setting inf bound to %u, "
- "sup bound to %ld, current postion to %u from %u\n",
- stream_fs->inf_bound, stream_fs->sup_bound,
- CAMEL_SEEKABLE_STREAM (stream_fs)->cur_pos, inf_bound);
-
-}
-
-
-
-
-static void
-_init_with_fd (CamelStreamFs *stream_fs, int fd)
-{
- stream_fs->fd = fd;
- stream_fs->inf_bound = 0;
- stream_fs->sup_bound = -1;
- CAMEL_SEEKABLE_STREAM (stream_fs)->cur_pos = 0;
-}
-
-
-
-
-static void
-_init_with_fd_and_bounds (CamelStreamFs *stream_fs, int fd, guint32 inf_bound, gint32 sup_bound)
-{
-
- CSFS_CLASS (stream_fs)->init_with_fd (stream_fs, fd);
- _set_bounds (stream_fs, inf_bound, sup_bound);
-
-}
-
-
-
-static void
-_init_with_name (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode)
-{
- struct stat s;
- int v, fd;
- int flags;
-
- g_assert (name);
- CAMEL_LOG_FULL_DEBUG ( "Entering CamelStream::new_with_name, name=\"%s\", mode=%d\n", name, mode);
-
-
- v = stat (name, &s);
-
- if (mode & CAMEL_STREAM_FS_READ){
- if (mode & CAMEL_STREAM_FS_WRITE)
- flags = O_RDWR | O_CREAT | O_NONBLOCK;
- else
- flags = O_RDONLY | O_NONBLOCK;
- } else {
- if (mode & CAMEL_STREAM_FS_WRITE)
- flags = O_WRONLY | O_CREAT | O_NONBLOCK;
- else
- return;
- }
-
- if ( (mode & CAMEL_STREAM_FS_READ) && !(mode & CAMEL_STREAM_FS_WRITE) )
- if (v == -1) {
- stream_fs->fd = -1;
- return;
- }
-
-
- fd = open (name, flags, 0600);
- if (fd==-1) {
- CAMEL_LOG_WARNING ( "CamelStreamFs::new_with_name can not obtain fd for file \"%s\"\n", name);
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
- return;
- }
-
- stream_fs->name = g_strdup (name);
- CSFS_CLASS (stream_fs)->init_with_fd (stream_fs, fd);
-
-}
-
-
-
-static void
-_init_with_name_and_bounds (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode,
- guint32 inf_bound, gint32 sup_bound)
-{
- CSFS_CLASS (stream_fs)->init_with_name (stream_fs, name, mode);
- _set_bounds (stream_fs, inf_bound, (gint32)sup_bound);
- CAMEL_LOG_FULL_DEBUG ("In CamelStreamFs::init_with_name_and_bounds, "
- "setting inf bound to %u, "
- "sup bound to %ld, current postion to %u\n",
- stream_fs->inf_bound, stream_fs->sup_bound,
- CAMEL_SEEKABLE_STREAM (stream_fs)->cur_pos);
-}
-
-
-
-
-CamelStream *
-camel_stream_fs_new_with_name (const gchar *name, CamelStreamFsMode mode)
-{
- CamelStreamFs *stream_fs;
- stream_fs = gtk_type_new (camel_stream_fs_get_type ());
- CSFS_CLASS (stream_fs)->init_with_name (stream_fs, name, mode);
- if (stream_fs->fd == -1) {
- gtk_object_destroy (GTK_OBJECT (stream_fs));
- return NULL;
- }
-
- return CAMEL_STREAM (stream_fs);
-}
-
-
-CamelStream *
-camel_stream_fs_new_with_name_and_bounds (const gchar *name, CamelStreamFsMode mode,
- guint32 inf_bound, gint32 sup_bound)
-{
- CamelStreamFs *stream_fs;
- stream_fs = gtk_type_new (camel_stream_fs_get_type ());
- CSFS_CLASS (stream_fs)->init_with_name_and_bounds (stream_fs, name, mode, inf_bound, sup_bound);
-
- return CAMEL_STREAM (stream_fs);
-
-}
-
-
-
-
-
-
-CamelStream *
-camel_stream_fs_new_with_fd (int fd)
-{
- CamelStreamFs *stream_fs;
-
- CAMEL_LOG_FULL_DEBUG ( "Entering CamelStream::new_with_fd fd=%d\n",fd);
- stream_fs = gtk_type_new (camel_stream_fs_get_type ());
- CSFS_CLASS (stream_fs)->init_with_fd (stream_fs, fd);
-
-
- return CAMEL_STREAM (stream_fs);
-}
-
-
-
-CamelStream *
-camel_stream_fs_new_with_fd_and_bounds (int fd, guint32 inf_bound, gint32 sup_bound)
-{
- CamelStreamFs *stream_fs;
-
- CAMEL_LOG_FULL_DEBUG ( "Entering CamelStream::new_with_fd fd=%d\n",fd);
- stream_fs = gtk_type_new (camel_stream_fs_get_type ());
- CSFS_CLASS (stream_fs)->init_with_fd_and_bounds (stream_fs, fd, inf_bound, sup_bound);
-
- return CAMEL_STREAM (stream_fs);
-}
-
-
-
-/**
- * _read: read bytes from a stream
- * @stream: stream
- * @buffer: buffer where bytes are stored
- * @n: max number of bytes to read
- *
- *
- *
- * Return value: number of bytes actually read.
- **/
-static gint
-_read (CamelStream *stream, gchar *buffer, gint n)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream);
- gint v;
- gint nb_to_read;
-
- if (stream_fs->sup_bound != -1)
- nb_to_read = MIN (stream_fs->sup_bound - CAMEL_SEEKABLE_STREAM (stream)->cur_pos, n);
- else
- nb_to_read = n;
-
- do {
- v = read ( (CAMEL_STREAM_FS (stream))->fd, buffer, nb_to_read);
- } while (v == -1 && errno == EINTR);
- if (v<0)
- CAMEL_LOG_FULL_DEBUG ("CamelStreamFs::read v=%d\n", v);
- else
- CAMEL_SEEKABLE_STREAM (stream)->cur_pos += v;
-
- if (v == 0)
- stream_fs->eof = TRUE;
-
- return v;
-}
-
-
-/**
- * _write: write bytes to a stream
- * @stream: the stream
- * @buffer: byte buffer
- * @n: number of bytes to write
- *
- *
- *
- * Return value: the number of bytes actually written
- * in the stream.
- **/
-static gint
-_write (CamelStream *stream, const gchar *buffer, gint n)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream);
- int v;
- gint nb_to_write;
-
- g_assert (stream);
- g_assert (stream_fs->fd);
- CAMEL_LOG_FULL_DEBUG ( "CamelStreamFs:: entering write. n=%d\n", n);
-
- if (stream_fs->sup_bound != -1)
- nb_to_write = MIN (stream_fs->sup_bound - CAMEL_SEEKABLE_STREAM (stream)->cur_pos, n);
- else
- nb_to_write = n;
-
- do {
- v = write ( stream_fs->fd, buffer, nb_to_write);
- } while (v == -1 && errno == EINTR);
-
-#if HARD_LOG_LEVEL >= FULL_DEBUG
- if (v==-1) {
- perror("");
- CAMEL_LOG_FULL_DEBUG ( "CamelStreamFs::write could not write bytes in stream\n");
- }
-#endif
-
- if (v>0)
- CAMEL_SEEKABLE_STREAM (stream)->cur_pos += v;
-
- return v;
-
-}
-
-
-
-/**
- * _flush: flush pending changes
- * @stream: the stream
- *
- *
- **/
-static void
-_flush (CamelStream *stream)
-{
- fsync ((CAMEL_STREAM_FS (stream))->fd);
-}
-
-
-
-/**
- * _available: return the number of bytes available for reading
- * @stream: the stream
- *
- * Return the number of bytes available without blocking.
- *
- * Return value: the number of bytes available
- **/
-static gboolean
-_available (CamelStream *stream)
-{
- g_warning ("Not implemented yet");
- return FALSE;
-}
-
-
-/**
- * _eos: test if there are bytes left to read
- * @stream: the stream
- *
- *
- *
- * Return value: true if all stream has been read
- **/
-static gboolean
-_eos (CamelStream *stream)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream);
-
- g_assert (stream_fs);
- return stream_fs->eof;
-}
-
-
-/**
- * _close: close a stream
- * @stream: the stream
- *
- *
- **/
-static void
-_close (CamelStream *stream)
-{
- close ((CAMEL_STREAM_FS (stream))->fd);
-}
-
-
-static gint
-_seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy)
-{
- int whence;
- gint return_position;
- gint real_offset;
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream);
-
-#if 0
- /* because we don't know what is going to happen, we
- set the eof stream to false so that a reread can
- occur */
- stream_fs->eof = FALSE;
-#endif
- switch (policy) {
- case CAMEL_STREAM_SET:
- real_offset = MAX (stream_fs->inf_bound + offset, stream_fs->inf_bound);
- if (stream_fs->sup_bound > 0)
- real_offset = MIN (real_offset, stream_fs->sup_bound);
- whence = SEEK_SET;
- break;
-
- case CAMEL_STREAM_CUR:
- if ((stream_fs->sup_bound != -1) && ((CAMEL_SEEKABLE_STREAM (stream)->cur_pos + offset) > stream_fs->sup_bound)) {
- real_offset = stream_fs->sup_bound;
- whence = SEEK_SET;
- } else if ((CAMEL_SEEKABLE_STREAM (stream)->cur_pos + offset) < stream_fs->inf_bound) {
- real_offset = stream_fs->inf_bound;
- whence = SEEK_SET;
- } else
- {
- real_offset = offset;
- whence = SEEK_CUR;
- }
- break;
-
- case CAMEL_STREAM_END:
- if (stream_fs->sup_bound != -1) {
- real_offset = stream_fs->sup_bound - offset;
- whence = SEEK_SET;
- } else {
- real_offset = offset;
- whence = SEEK_END;
- }
-
-
- break;
- default:
- return -1;
- }
-
-
-
- printf ("***** Seeking : real_offset=%d, whence=%d\n", real_offset, whence);
- return_position = lseek (stream_fs->fd, real_offset, whence) - stream_fs->inf_bound;
- printf ("*** *** *** *** ***\n");
-
- CAMEL_SEEKABLE_STREAM (stream)->cur_pos = return_position;
-
-
- return return_position;
-}
-
-
-
-
-
-
-
-
-
-
-
diff --git a/camel/camel-stream-fs.h b/camel/camel-stream-fs.h
deleted file mode 100644
index 79c7874c74..0000000000
--- a/camel/camel-stream-fs.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-fs.h :stream based on unix filesystem */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_STREAM_FS_H
-#define CAMEL_STREAM_FS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include "camel-seekable-stream.h"
-
-#define CAMEL_STREAM_FS_TYPE (camel_stream_fs_get_type ())
-#define CAMEL_STREAM_FS(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_FS_TYPE, CamelStreamFs))
-#define CAMEL_STREAM_FS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STREAM_FS_TYPE, CamelStreamFsClass))
-#define CAMEL_IS_STREAM_FS(o) (GTK_CHECK_TYPE((o), CAMEL_STREAM_FS_TYPE))
-
-typedef enum
-{
- CAMEL_STREAM_FS_READ = 1,
- CAMEL_STREAM_FS_WRITE = 2
-
-} CamelStreamFsMode;
-
-
-typedef struct
-{
-
- CamelSeekableStream parent_object;
-
- gchar *name; /* name of the underlying file */
- gboolean eof; /* are we at the end of the file ? */
- gint fd; /* file descriptor on the underlying file */
- guint32 inf_bound; /* first valid position */
- gint32 sup_bound; /* last valid position, -1 means, no sup bound */
-
-} CamelStreamFs;
-
-
-
-typedef struct {
- CamelSeekableStreamClass parent_class;
-
- /* Virtual methods */
- void (*init_with_fd) (CamelStreamFs *stream_fs,
- int fd);
- void (*init_with_fd_and_bounds) (CamelStreamFs *stream_fs,
- int fd, guint32 inf_bound,
- gint32 sup_bound);
-
- void (*init_with_name) (CamelStreamFs *stream_fs,
- const gchar *name,
- CamelStreamFsMode mode);
- void (*init_with_name_and_bounds) (CamelStreamFs *stream_fs,
- const gchar *name,
- CamelStreamFsMode mode,
- guint32 inf_bound,
- gint32 sup_bound);
-
-} CamelStreamFsClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_stream_fs_get_type (void);
-
-
-/* public methods */
-CamelStream * camel_stream_fs_new_with_name (const gchar *name,
- CamelStreamFsMode mode);
-CamelStream * camel_stream_fs_new_with_name_and_bounds (const gchar *name,
- CamelStreamFsMode mode,
- guint32 inf_bound,
- gint32 sup_bound);
-
-CamelStream * camel_stream_fs_new_with_fd (int fd);
-CamelStream * camel_stream_fs_new_with_fd_and_bounds (int fd,
- guint32 inf_bound,
- gint32 sup_bound);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_FS_H */
diff --git a/camel/camel-stream-mem.c b/camel/camel-stream-mem.c
deleted file mode 100644
index 6dd1b804cf..0000000000
--- a/camel/camel-stream-mem.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-mem.c : memory buffer based stream */
-
-/* inspired by gnome-stream-mem.c in bonobo by Miguel de Icaza */
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-stream-mem.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include "camel-log.h"
-
-static CamelStreamClass *parent_class=NULL;
-
-
-/* Returns the class for a CamelStreamMEM */
-#define CSM_CLASS(so) CAMEL_STREAM_MEM_CLASS (GTK_OBJECT(so)->klass)
-
-static gint _read (CamelStream *stream, gchar *buffer, gint n);
-static gint _write (CamelStream *stream, const gchar *buffer, gint n);
-static void _flush (CamelStream *stream);
-static gint _available (CamelStream *stream);
-static gboolean _eos (CamelStream *stream);
-static void _close (CamelStream *stream);
-static gint _seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy);
-
-static void _finalize (GtkObject *object);
-
-static void
-camel_stream_mem_class_init (CamelStreamMemClass *camel_stream_mem_class)
-{
- CamelSeekableStreamClass *camel_seekable_stream_class = CAMEL_SEEKABLE_STREAM_CLASS (camel_stream_mem_class);
- CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_mem_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_mem_class);
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_stream_class->read = _read;
- camel_stream_class->write = _write;
- camel_stream_class->flush = _flush;
- camel_stream_class->available = _available;
- camel_stream_class->eos = _eos;
- camel_stream_class->close = _close;
-
- camel_seekable_stream_class->seek = _seek;
-
- gtk_object_class->finalize = _finalize;
-
-}
-
-static void
-camel_stream_mem_init (gpointer object, gpointer klass)
-{
- CamelStreamMem *camel_stream_mem = CAMEL_STREAM_MEM (object);
- camel_stream_mem->position = 0;
-}
-
-GtkType
-camel_stream_mem_get_type (void)
-{
- static GtkType camel_stream_mem_type = 0;
-
- if (!camel_stream_mem_type) {
- GtkTypeInfo camel_stream_mem_info =
- {
- "CamelStreamMem",
- sizeof (CamelStreamMem),
- sizeof (CamelStreamMemClass),
- (GtkClassInitFunc) camel_stream_mem_class_init,
- (GtkObjectInitFunc) camel_stream_mem_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_stream_mem_type = gtk_type_unique (camel_seekable_stream_get_type (), &camel_stream_mem_info);
- }
-
- return camel_stream_mem_type;
-}
-
-
-CamelStream *
-camel_stream_mem_new (CamelStreamMemMode mode)
-{
- CamelStreamMem *stream_mem;
- GByteArray *buffer;
-
- buffer = g_byte_array_new ();
- stream_mem = (CamelStreamMem *)camel_stream_mem_new_with_buffer (buffer, mode);
- return CAMEL_STREAM (stream_mem);
-}
-
-
-CamelStream *
-camel_stream_mem_new_with_buffer (GByteArray *buffer, CamelStreamMemMode mode)
-{
- CamelStreamMem *stream_mem;
-
- stream_mem = gtk_type_new (camel_stream_mem_get_type ());
- stream_mem->mode = mode;
- stream_mem->buffer = buffer;
-
- return CAMEL_STREAM (stream_mem);
-}
-
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (object);
-
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamMem::finalize\n");
- g_byte_array_free (stream_mem->buffer, TRUE);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamMem::finalize\n");
-}
-
-
-
-/**
- * _read: read bytes from a stream
- * @stream: stream
- * @buffer: buffer where bytes are stored
- * @n: max number of bytes to read
- *
- *
- *
- * Return value: number of bytes actually read.
- **/
-static gint
-_read (CamelStream *stream, gchar *buffer, gint n)
-{
- CamelStreamMem *camel_stream_mem = CAMEL_STREAM_MEM (stream);
- gint nb_bytes_to_read;
-
- g_assert (stream);
- nb_bytes_to_read = MIN (n, (camel_stream_mem->buffer)->len - camel_stream_mem->position);
- if (nb_bytes_to_read>0) {
- memcpy (buffer, (camel_stream_mem->buffer)->data + camel_stream_mem->position, nb_bytes_to_read);
- camel_stream_mem->position += nb_bytes_to_read;
- } else nb_bytes_to_read = -1;
-
- return nb_bytes_to_read;
-}
-
-
-/**
- * _write: read bytes to a stream
- * @stream: the stream
- * @buffer: byte buffer
- * @n: number of bytes to write
- *
- *
- *
- * Return value: the number of bytes actually written
- * in the stream.
- **/
-static gint
-_write (CamelStream *stream, const gchar *buffer, gint n)
-{
- CamelStreamMem *camel_stream_mem = CAMEL_STREAM_MEM (stream);
-
- g_assert (stream);
- g_return_val_if_fail (camel_stream_mem->position>=0, -1);
- camel_stream_mem->buffer = g_byte_array_append (camel_stream_mem->buffer, (const guint8 *)buffer, n);
- camel_stream_mem->position += n;
-
- return n;
-}
-
-
-
-/**
- * _flush: flush pending changes
- * @stream: the stream
- *
- *
- **/
-static void
-_flush (CamelStream *stream)
-{
- g_warning ("Not implemented yet");
-}
-
-
-
-/**
- * _available: return the number of bytes available for reading
- * @stream: the stream
- *
- * Return the number of bytes available without blocking.
- *
- * Return value: the number of bytes available
- **/
-static gint
-_available (CamelStream *stream)
-{
- g_warning ("Not implemented yet");
- return -1;
-}
-
-
-/**
- * _eos: test if there are bytes left to read
- * @stream: the stream
- *
- *
- *
- * Return value: true if all stream has been read
- **/
-static gboolean
-_eos (CamelStream *stream)
-{
- g_warning ("Not implemented yet");
- return FALSE;
-}
-
-
-/**
- * _close: close a stream
- * @stream: the stream
- *
- *
- **/
-static void
-_close (CamelStream *stream)
-{
- g_warning ("Not implemented yet");
-}
-
-
-
-static gint
-_seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy)
-{
- gint position;
- CamelStreamMem *camel_stream_mem = CAMEL_STREAM_MEM (stream);
-
- switch (policy) {
- case CAMEL_STREAM_SET:
- position = offset;
- break;
- case CAMEL_STREAM_CUR:
- position = camel_stream_mem->position + offset;
- break;
- case CAMEL_STREAM_END:
- position = (camel_stream_mem->buffer)->len + offset;
- break;
- default:
- return -1;
- }
-
- position = MIN (position, (camel_stream_mem->buffer)->len);
- position = MAX (position, 0);
-
- camel_stream_mem->position = position;
-
- return position;
-}
diff --git a/camel/camel-stream-mem.h b/camel/camel-stream-mem.h
deleted file mode 100644
index fa8c0514eb..0000000000
--- a/camel/camel-stream-mem.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-mem.h :stream based on memory buffer */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_STREAM_MEM_H
-#define CAMEL_STREAM_MEM_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include "camel-seekable-stream.h"
-
-#define CAMEL_STREAM_MEM_TYPE (camel_stream_mem_get_type ())
-#define CAMEL_STREAM_MEM(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_MEM_TYPE, CamelStreamMem))
-#define CAMEL_STREAM_MEM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STREAM_MEM_TYPE, CamelStreamMemClass))
-#define CAMEL_IS_STREAM_MEM(o) (GTK_CHECK_TYPE((o), CAMEL_STREAM_MEM_TYPE))
-
-typedef enum
-{
- CAMEL_STREAM_MEM_READ = 1,
- CAMEL_STREAM_MEM_WRITE = 2,
- CAMEL_STREAM_MEM_RW = 3
-} CamelStreamMemMode;
-
-
-typedef struct
-{
- CamelSeekableStream parent_object;
-
- GByteArray *buffer;
- gint position;
- CamelStreamMemMode mode;
-
-} CamelStreamMem;
-
-
-
-typedef struct {
- CamelSeekableStreamClass parent_class;
-
- /* Virtual methods */
-
-} CamelStreamMemClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_stream_mem_get_type (void);
-
-
-/* public methods */
-CamelStream *camel_stream_mem_new (CamelStreamMemMode mode);
-CamelStream * camel_stream_mem_new_with_buffer (GByteArray *buffer,
- CamelStreamMemMode mode);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_MEM_H */
diff --git a/camel/camel-stream.c b/camel/camel-stream.c
deleted file mode 100644
index bad7f6811c..0000000000
--- a/camel/camel-stream.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream.c : abstract class for a stream */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-stream.h"
-
-
-enum {
- DATA_AVAILABLE,
- LAST_SIGNAL
-};
-
-static guint camel_stream_signals[LAST_SIGNAL] = { 0 };
-
-static GtkObjectClass *parent_class = NULL;
-
-
-/* Returns the class for a CamelMimeMessage */
-#define CS_CLASS(so) CAMEL_STREAM_CLASS (GTK_OBJECT(so)->klass)
-
-static void
-default_camel_flush (CamelStream *stream)
-{
- /* nothing */
-}
-
-static void
-default_camel_close (CamelStream *stream)
-{
- /* nothing */
-}
-
-
-static void
-camel_stream_class_init (CamelStreamClass *camel_stream_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_class);
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
- camel_stream_class->read = NULL;
- camel_stream_class->write = NULL;
- camel_stream_class->flush = default_camel_flush;
- camel_stream_class->available = NULL;
- camel_stream_class->eos = NULL;
- camel_stream_class->close = default_camel_close;
-
- /* virtual method overload */
-
- /* signal definition */
- camel_stream_signals[DATA_AVAILABLE] =
- gtk_signal_new ("data_available",
- GTK_RUN_LAST,
- gtk_object_class->type,
- GTK_SIGNAL_OFFSET (CamelStreamClass, data_available),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (gtk_object_class, camel_stream_signals, LAST_SIGNAL);
-
-}
-
-GtkType
-camel_stream_get_type (void)
-{
- static GtkType camel_stream_type = 0;
-
- if (!camel_stream_type) {
- GtkTypeInfo camel_stream_info =
- {
- "CamelStream",
- sizeof (CamelStream),
- sizeof (CamelStreamClass),
- (GtkClassInitFunc) camel_stream_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_stream_type = gtk_type_unique (gtk_object_get_type (), &camel_stream_info);
- }
-
- return camel_stream_type;
-}
-
-/**
- * camel_stream_read:
- * @stream: a CamelStream.
- * @buffer: buffer where bytes pulled from the stream are stored.
- * @n: max number of bytes to read.
- *
- * Read at most @n bytes from the @stream object and stores them
- * in the buffer pointed at by @buffer.
- *
- * Return value: number of bytes actually read.
- **/
-gint
-camel_stream_read (CamelStream *stream, gchar *buffer, gint n)
-{
- return CS_CLASS (stream)->read (stream, buffer, n);
-}
-
-/**
- * camel_stream_write:
- * @stream: a CamelStream object.
- * @buffer: buffer to write.
- * @n: number of bytes to write
- *
- * Write @n bytes from the buffer pointed at by @buffer into @stream.
- *
- * Return value: the number of bytes actually written
- * in the stream.
- **/
-gint
-camel_stream_write (CamelStream *stream, const gchar *buffer, gint n)
-{
- return CS_CLASS (stream)->write (stream, buffer, n);
-}
-
-/**
- * camel_stream_flush:
- * @stream: a CamelStream object
- *
- * Flushes the contents of the stream to its backing store.
- **/
-void
-camel_stream_flush (CamelStream *stream)
-{
- CS_CLASS (stream)->flush (stream);
-}
-
-/**
- * camel_stream_available:
- * @stream: a CamelStream object
- *
- * Return value: the number of bytes available.
- **/
-gboolean
-camel_stream_available (CamelStream *stream)
-{
- return CS_CLASS (stream)->available (stream);
-}
-
-/**
- * camel_stream_eos:
- * @stream: a CamelStream object
- *
- * Test if there are bytes left to read on the @stream object.
- *
- * Return value: %TRUE if all the contents on the stream has been read, or
- * %FALSE if information is still available.
- **/
-gboolean
-camel_stream_eos (CamelStream *stream)
-{
- return CS_CLASS (stream)->eos (stream);
-}
-
-
-/**
- * camel_stram_close:
- * @stream: a CamelStream object.
- *
- * Close the @stream object.
- **/
-void
-camel_stream_close (CamelStream *stream)
-{
- CS_CLASS (stream)->close (stream);
-}
-
-
-
-
-/***************** Utility functions ********************/
-
-/**
- * came_stream_write_strings:
- * @stream: a CamelStream object.
- * @...: A %NULL terminated list of strings.
- *
- * This is a utility function that writes the list of
- * strings into the @stream object.
- */
-void
-camel_stream_write_strings (CamelStream *stream, ... )
-{
- va_list args;
- const char *string;
-
- va_start(args, stream);
- string = va_arg (args, const char *);
-
- while (string) {
- camel_stream_write_string (stream, string);
- string = va_arg (args, char *);
- }
- va_end (args);
-}
diff --git a/camel/camel-stream.h b/camel/camel-stream.h
deleted file mode 100644
index 0496e13d7f..0000000000
--- a/camel/camel-stream.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream.h : class for an abstract stream */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_STREAM_H
-#define CAMEL_STREAM_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-#define CAMEL_STREAM_TYPE (camel_stream_get_type ())
-#define CAMEL_STREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_TYPE, CamelStream))
-#define CAMEL_STREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STREAM_TYPE, CamelStreamClass))
-#define CAMEL_IS_STREAM(o) (GTK_CHECK_TYPE((o), CAMEL_STREAM_TYPE))
-
-
-typedef struct
-{
- GtkObject parent_object;
-
-} CamelStream;
-
-
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /* Virtual methods */
-
- void (*data_available) (CamelStream *stream); /* default "data_available" signal handler */
-
- gint (*read) (CamelStream *stream, gchar *buffer, gint n);
- gint (*write) (CamelStream *stream, const gchar *buffer, gint n);
- void (*flush) (CamelStream *stream);
- gint (*available) (CamelStream *stream);
- gboolean (*eos) (CamelStream *stream);
- void (*close) (CamelStream *stream);
-} CamelStreamClass;
-
-
-
-
-
-
-/* Standard Gtk function */
-GtkType camel_stream_get_type (void);
-
-
-
-
-/* public methods */
-gint camel_stream_read (CamelStream *stream, gchar *buffer, gint n);
-gint camel_stream_write (CamelStream *stream, const gchar *buffer, gint n);
-void camel_stream_flush (CamelStream *stream);
-gboolean camel_stream_available (CamelStream *stream);
-gboolean camel_stream_eos (CamelStream *stream);
-void camel_stream_close (CamelStream *stream);
-
-
-
-
-/* utility macros and funcs */
-#define camel_stream_write_string(stream, string) camel_stream_write ((stream), (string), strlen (string))
-
-void camel_stream_write_strings (CamelStream *stream, ... );
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_H */
-
-
-
-
-
-
diff --git a/camel/camel-thread-proxy.c b/camel/camel-thread-proxy.c
deleted file mode 100644
index 53fda08bab..0000000000
--- a/camel/camel-thread-proxy.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-pt-proxy.c : proxy folder using posix threads */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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-log.h"
-#include "camel-marshal-utils.h"
-#include "camel-thread-proxy.h"
-#include <pthread.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-
-
-/* vocabulary:
- * operation: commanded by the main thread, executed by the child thread
- * callback: commanded by the child thread, generally when an operation is
- * completed. Executed in the main thread,
- */
-
-/* needed for proper casts of async funcs when
- * calling pthreads_create
- */
-typedef void * (*thread_call_func) (void *);
-
-/* forward declarations */
-static gboolean
-_thread_notification_catch (GIOChannel *source,
- GIOCondition condition,
- gpointer data);
-
-static void
-_notify_availability (CamelThreadProxy *proxy, gchar op_name);
-
-static int
-_init_notify_system (CamelThreadProxy *proxy);
-
-
-
-/**
- * camel_thread_proxy_new: create a new proxy object
- *
- * Create a new proxy object. This proxy object can be used
- * to run async operations and this operations can trigger
- * callbacks. It can also be used to proxy signals.
- *
- * Return value: The newly created proxy object
- **/
-CamelThreadProxy *
-camel_thread_proxy_new (void)
-{
- CamelThreadProxy *proxy;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::new\n");
-
- proxy = g_new (CamelThreadProxy, 1);
- if (!proxy)
- return NULL;
-
- proxy->server_op_queue = camel_op_queue_new ();
- proxy->client_op_queue = camel_op_queue_new ();
- proxy->signal_data_cond = g_cond_new();
- proxy->signal_data_mutex = g_mutex_new();
- if (_init_notify_system (proxy) < 0) {
- g_free (proxy);
- return NULL;
- }
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::new\n");
- return proxy;
-}
-
-
-/**
- * camel_thread_proxy_free: free a proxy object
- * @proxy: proxy object to free
- *
- * free a proxy object
- **/
-void
-camel_thread_proxy_free (CamelThreadProxy *proxy)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::free\n");
-
- g_cond_free (proxy->signal_data_cond);
- g_mutex_free (proxy->signal_data_mutex);
- camel_op_queue_free (proxy->server_op_queue);
- camel_op_queue_free (proxy->client_op_queue);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::free\n");
-}
-
-
-
-
-
-/* Operations handling */
-
-
-/**
- * _op_run_free_notify:
- * @folder: folder to notify when the operation is completed.
- * @op: operation to run.
- *
- * run an operation, free the operation field
- * and then notify the main thread of the op
- * completion.
- *
- * this routine is intended to be called
- * in a new thread (in _run_next_op_in_thread)
- *
- **/
-void
-_op_run_free_and_notify (CamelOp *op)
-{
- CamelThreadProxy *th_proxy;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_op_run_free_and_notify\n");
-
- camel_op_run (op);
- camel_op_free (op);
- th_proxy = camel_op_get_user_data (op);
- _notify_availability (th_proxy, 'a');
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_op_run_free_and_notify\n");
-}
-
-
-/**
- * _run_next_op_in_thread:
- * @proxy_object:
- *
- * run the next operation pending in the proxy
- * operation queue
- **/
-static void
-_run_next_op_in_thread (CamelThreadProxy *proxy)
-{
- CamelOp *op;
- CamelOpQueue *server_op_queue;
- pthread_t thread;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_run_next_op_in_thread\n");
-
- server_op_queue = proxy->server_op_queue;
- /* get the next pending operation */
- op = camel_op_queue_pop_op (server_op_queue);
- if (!op) {
- camel_op_queue_set_service_availability (server_op_queue, TRUE);
- return;
- }
-
- /* run the operation in a child thread */
- pthread_create (&thread, NULL, (thread_call_func) _op_run_free_and_notify, op);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_run_next_op_in_thread\n");
-}
-
-
-
-/**
- * camel_thread_proxy_push_op: push an operation in the proxy operation queue
- * @proxy: proxy object
- * @op: operation to push in the execution queue
- *
- * if no thread is currently running, executes the
- * operation directly, otherwise push the operation
- * in the proxy operation queue.
- **/
-void
-camel_thread_proxy_push_op (CamelThreadProxy *proxy, CamelOp *op)
-{
- CamelOpQueue *server_op_queue;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::camel_thread_proxy_push_op\n");
-
- g_assert (proxy);
- server_op_queue = proxy->server_op_queue;
-
- /* put the proxy object in the user data
- so that it can be notified when the
- operation is completed */
- camel_op_set_user_data (op, (gpointer)proxy);
-
- /* get next operation */
- camel_op_queue_push_op (server_op_queue, op);
-
- if (camel_op_queue_get_service_availability (server_op_queue)) {
- /* no thread is currently running, run
- * the next operation. */
- camel_op_queue_set_service_availability (server_op_queue, FALSE);
- /* when the operation is completed in the
- child thread the main thread gets
- notified and executes next operation
- (see _thread_notification_catch, case 'a')
- so there is no need to set the service
- availability to FALSE except here
- */
- _run_next_op_in_thread (proxy);
- }
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::camel_thread_proxy_push_op\n");
-}
-/**
- * _op_run_and_free: Run an operation and free it
- * @op: Operation object
- *
- * Run an operation object in the current thread
- * and free it.
- **/
-static void
-_op_run_and_free (CamelOp *op)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_op_run_and_free\n");
- camel_op_run (op);
- camel_op_free (op);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_op_run_and_free\n");
-}
-
-
-
-
-
-
-/* Callbacks handling */
-
-/**
- * _run_next_cb: Run next callback pending in a proxy object
- * @proxy: Proxy object
- *
- * Run next callback in the callback queue of a proxy object
- **/
-static void
-_run_next_cb (CamelThreadProxy *proxy)
-{
- CamelOp *op;
- CamelOpQueue *client_op_queue;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_run_next_cb\n");
- client_op_queue = proxy->client_op_queue;
-
- /* get the next pending operation */
- op = camel_op_queue_pop_op (client_op_queue);
- if (!op) return;
-
- /* run the operation in the main thread */
- _op_run_and_free (op);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_run_next_cb\n");
-}
-
-
-/**
- * camel_thread_proxy_push_cb: push a callback in the client queue
- * @proxy: proxy object concerned by the callback
- * @cb: callback to push
- *
- * Push an operation in the client queue, ie the queue
- * containing the operations (callbacks) intended to be
- * executed in the main thread.
- **/
-void
-camel_thread_proxy_push_cb (CamelThreadProxy *proxy, CamelOp *cb)
-{
- CamelOpQueue *client_op_queue;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::camel_thread_proxy_push_cb\n");
- client_op_queue = proxy->client_op_queue;
-
- /* put the proxy object in the user data
- so that it can be notified when the
- operation is completed */
- camel_op_set_user_data (cb, (gpointer)proxy);
-
- /* push the callback in the client queue */
- camel_op_queue_push_op (client_op_queue, cb);
-
- /* tell the main thread a new callback is there */
- _notify_availability (proxy, 'c');
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::camel_thread_proxy_push_cb\n");
-}
-
-
-
-/**
- * _init_notify_system: set the notify channel up
- * @proxy: proxy object
- *
- * called once to set the notification channel up
- **/
-static int
-_init_notify_system (CamelThreadProxy *proxy)
-{
- int filedes[2];
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_init_notify_system\n");
-
- /* set up the notification channel */
- if (pipe (filedes) < 0) {
- CAMEL_LOG_WARNING ("could not create pipe in CamelThreadProxy::_init_notify_system\n");
- CAMEL_LOG_FULL_DEBUG ("Full error message : %s\n", strerror(errno));
- return -1;
- }
-
-
- proxy->pipe_client_fd = filedes [0];
- proxy->pipe_server_fd = filedes [1];
- proxy->notify_source = g_io_channel_unix_new (filedes [0]);
- proxy->notify_channel = g_io_channel_unix_new (filedes [1]);
-
- /* the _thread_notification_catch function
- * will be called in the main thread when the
- * child thread writes some data in the channel */
- g_io_add_watch (proxy->notify_source, G_IO_IN,
- _thread_notification_catch,
- proxy);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_init_notify_system\n");
- return 1;
-}
-
-/**
- * _notify_availability: notify the main thread from an event
- * @proxy: proxy object
- * @op_name: operation name
- *
- * called by child thread to notify the main
- * thread something is available for him.
- * What this thing is depends on @op_name:
- *
- * 'a' : thread available. That means the thread is ready
- * to process an operation.
- * 's' : a signal is available. Used by the signal proxy.
- *
- */
-static void
-_notify_availability (CamelThreadProxy *proxy, gchar op_name)
-{
- GIOChannel *notification_channel;
- guint bytes_written;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_notify_availability\n");
-
- notification_channel = proxy->notify_channel;
-
- do {
- /* the write operation will trigger the
- * watch on the main thread side */
- g_io_channel_write (notification_channel,
- &op_name,
- 1,
- &bytes_written);
- } while (bytes_written < 1);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_notify_availability\n");
-}
-
-
-
-/* signal proxying */
-
-
-
-/**
- * _signal_marshaller_server_side: called in the child thread to proxy a signal
- * @object:
- * @data:
- * @n_args:
- * @args:
- *
- *
- **/
-static void
-_signal_marshaller_server_side (GtkObject *object,
- gpointer data,
- guint n_args,
- GtkArg *args)
-{
- CamelThreadProxy *proxy;
- guint signal_id;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_signal_marshaller_server_side\n");
- proxy = CAMEL_THREAD_PROXY (gtk_object_get_data (object, "__proxy__"));
- signal_id = (guint)data;
- g_assert (proxy);
-
- g_mutex_lock (proxy->signal_data_mutex);
-
- /* we are going to wait for the main client thread
- * to have emitted the last signal we asked him
- * to proxy.
- */
- while (proxy->signal_data.args)
- g_cond_wait (proxy->signal_data_cond,
- proxy->signal_data_mutex);
-
- proxy->signal_data.signal_id = signal_id;
- proxy->signal_data.args = args;
-
-
- g_mutex_unlock (proxy->signal_data_mutex);
-
- /* tell the main thread there is a signal pending */
- _notify_availability (proxy, 's');
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_signal_marshaller_server_side\n");
-}
-
-
-static void
-_signal_marshaller_client_side (CamelThreadProxy *proxy)
-{
- g_mutex_lock (proxy->signal_data_mutex);
- g_assert (proxy->signal_data.args);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_signal_marshaller_client_side\n");
- /* emit the pending signal */
- gtk_signal_emitv (GTK_OBJECT (proxy),
- proxy->signal_data.signal_id,
- proxy->signal_data.args);
-
- proxy->signal_data.args = NULL;
-
- /* if waiting for the signal to be treated,
- * awake the client thread up
- */
- g_cond_signal (proxy->signal_data_cond);
- g_mutex_unlock (proxy->signal_data_mutex);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_signal_marshaller_client_side\n");
-}
-
-
-/**
- * camel_thread_proxy_add_signals: init the signal proxy
- * @proxy: proxy
- * @proxy_object: Proxy Gtk Object
- * @real_object: Real Gtk Object
- * @signal_to_proxy: NULL terminated array of signal name
- *
- * Add some signals to the list of signals to be
- * proxied by the proxy object.
- * The signals emitted by the real object in the child
- * thread are reemited by the proxy object in the
- * main thread.
- **/
-void
-camel_thread_proxy_add_signals (CamelThreadProxy *proxy,
- GtkObject *proxy_object,
- GtkObject *real_object,
- char *signal_to_proxy[])
-{
- guint i;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::camel_thread_proxy_init_signals\n");
-
- for (i=0; signal_to_proxy[i]; i++) {
- /* connect the signal to the signal marshaller
- * user_data is the signal id */
- gtk_signal_connect_full (GTK_OBJECT (real_object),
- signal_to_proxy[i],
- NULL,
- _signal_marshaller_server_side,
- (gpointer)gtk_signal_lookup (signal_to_proxy[i],
- GTK_OBJECT_CLASS (real_object)->type),
- NULL,
- TRUE,
- FALSE);
- }
-
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::camel_thread_proxy_init_signals\n");
-
-
-}
-
-/**** catch notification from child thread ****/
-/**
- * _thread_notification_catch: call by glib loop when data is available on the thread io channel
- * @source:
- * @condition:
- * @data:
- *
- * called by watch set on the IO channel
- *
- * Return value: TRUE because we don't want the watch to be removed
- **/
-static gboolean
-_thread_notification_catch (GIOChannel *source,
- GIOCondition condition,
- gpointer data)
-{
- CamelThreadProxy *proxy = CAMEL_THREAD_PROXY (data);
- gchar op_name;
- guint bytes_read;
- GIOError error;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_thread_notification_catch\n");
-
-
- error = g_io_channel_read (source,
- &op_name,
- 1,
- &bytes_read);
-
- while ((!error) && (bytes_read == 1)) {
-
- switch (op_name) {
- case 'a': /* the thread is OK for a new operation */
- _run_next_op_in_thread (proxy);
- break;
- case 's': /* there is a pending signal to proxy */
- _signal_marshaller_client_side (proxy);
- break;
- case 'c': /* there is a cb pending in the main thread */
- _run_next_cb (proxy);
- break;
- }
-
- error = g_io_channel_read (source,
- &op_name,
- 1,
- &bytes_read);
-
- }
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_thread_notification_catch\n");
-
- /* do not remove the io watch */
- return TRUE;
-}
-
-
-
-
-
-
-
-
-
-
-
diff --git a/camel/camel-thread-proxy.h b/camel/camel-thread-proxy.h
deleted file mode 100644
index a82a19c87f..0000000000
--- a/camel/camel-thread-proxy.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-pt-proxy.h : proxy folder using posix threads */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_THREAD_PROXY_H
-#define CAMEL_THREAD_PROXY_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-op-queue.h"
-
-#define CAMEL_THREAD_PROXY(o) (CamelThreadProxy *)(o)
-
-
-typedef struct {
- guint signal_id;
- GtkArg *args;
-} CamelThreadProxySignalData;
-
-
-typedef struct {
-
- GtkObject *real_object;
- GtkObject *proxy_object;
-
- CamelOpQueue *server_op_queue;
- CamelOpQueue *client_op_queue;
-
-
- gint pipe_client_fd;
- gint pipe_server_fd;
- GIOChannel *notify_source;
- GIOChannel *notify_channel;
-
- /* signal proxy */
- GMutex *signal_data_mutex;
- GCond *signal_data_cond;
- CamelThreadProxySignalData signal_data;
-
-} CamelThreadProxy;
-
-
-CamelThreadProxy *camel_thread_proxy_new (void);
-void camel_thread_proxy_free (CamelThreadProxy *proxy);
-
-void camel_thread_proxy_push_op (CamelThreadProxy *proxy, CamelOp *op);
-void camel_thread_proxy_push_cb (CamelThreadProxy *proxy, CamelOp *cb);
-
-void camel_thread_proxy_add_signals (CamelThreadProxy *proxy,
- GtkObject *proxy_object,
- GtkObject *real_object,
- char *signal_to_proxy[]);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_THREAD_PROXY_H */
-
-
diff --git a/camel/camel.c b/camel/camel.c
deleted file mode 100644
index 63a5698801..0000000000
--- a/camel/camel.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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.h"
-
-gint
-camel_init(void)
-{
-
-
-#ifdef ENABLE_THREADS
-#ifdef G_THREADS_ENABLED
- g_thread_init (NULL);
-#else /* G_THREADS_ENABLED */
- printf ("Threads are not supported by your version of glib\n");
-#endif /* G_THREADS_ENABLED */
-#endif /* ENABLE_THREADS */
-
- return data_wrapper_repository_init ();
-}
diff --git a/camel/camel.h b/camel/camel.h
deleted file mode 100644
index 92099cd0f8..0000000000
--- a/camel/camel.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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_H
-#define CAMEL_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <camel/data-wrapper-repository.h>
-#include <camel/data-wrapper-repository.h>
-#include <camel/camel-log.h>
-#include <camel/camel-data-wrapper.h>
-#include <camel/camel-simple-data-wrapper.h>
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-pt-proxy.h>
-#include <camel/camel-marshal-utils.h>
-#include <camel/camel-mime-body-part.h>
-#include <camel/camel-mime-message.h>
-#include <camel/camel-mime-part.h>
-#include <camel/camel-multipart.h>
-#include <camel/camel-op-queue.h>
-#include <camel/camel-provider.h>
-#include <camel/camel-service.h>
-#include <camel/camel-session.h>
-#include <camel/camel-store.h>
-#include <camel/camel-stream.h>
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-#include <camel/camel-thread-proxy.h>
-#include <camel/data-wrapper-repository.h>
-#include <camel/gmime-content-field.h>
-#include <camel/gmime-utils.h>
-#include <camel/gstring-util.h>
-#include <camel/string-utils.h>
-#include <camel/url-util.h>
-
-gint camel_init (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_H */
diff --git a/camel/data-wrapper-repository.c b/camel/data-wrapper-repository.c
deleted file mode 100644
index 0b83fdf7d6..0000000000
--- a/camel/data-wrapper-repository.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 "data-wrapper-repository.h"
-#include "camel-multipart.h"
-#include <string.h>
-#include "hash-table-utils.h"
-
-static DataWrapperRepository _repository;
-static _initialized = -1;
-GMimeContentField *_content_field;
-
-
-/**
- * data_wrapper_repository_init: initialize data wrapper repository
- *
- * initialize the data wrapper repository. When the repository has
- * already been initialized, returns -1.
- *
- * Return value: 1 if correctly initialized returns -1.
- **/
-gint
-data_wrapper_repository_init ()
-{
- if (_initialized != -1) return -1;
- _repository.mime_links = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- data_wrapper_repository_set_data_wrapper_type ("multipart", camel_multipart_get_type());
-
- /* this is a temporary default so that Michael can use get_stream on text messages */
- data_wrapper_repository_set_data_wrapper_type ("text", camel_simple_data_wrapper_get_type());
-
- /* this is for matt the great lopper */
- data_wrapper_repository_set_data_wrapper_type ("message/rfc822", camel_mime_message_get_type());
- _content_field = gmime_content_field_new (NULL, NULL);
- _initialized = 1;
- return 1;
-}
-
-/**
- * data_wrapper_repository_set_data_wrapper_type: associate a data wrapper object type to a mime type
- * @mime_type: mime type
- * @object_type: object type
- *
- * Associate an object type to a mime type.
- **/
-void
-data_wrapper_repository_set_data_wrapper_type (const gchar *mime_type, GtkType object_type)
-{
- gboolean already_exists;
- gchar *old_mime_type;
- GtkType old_gtk_type;
-
- already_exists = g_hash_table_lookup_extended (_repository.mime_links, (gpointer)mime_type,
- (gpointer)&old_mime_type, (gpointer)&old_gtk_type);
- if (already_exists)
- g_hash_table_insert (_repository.mime_links, (gpointer)old_mime_type, (gpointer)object_type);
- else
- g_hash_table_insert (_repository.mime_links, (gpointer)g_strdup (mime_type), (gpointer)object_type);
-}
-
-
-
-/**
- * data_wrapper_repository_get_data_wrapper_type: get the gtk type object associated to a mime type
- * @mime_type: mime type
- *
- * returns the GtkType of the data wrapper object associated to
- * a particular mime type. The mime type must be a character string
- * of the form "type/subtype" or simply "type". When the complete
- * mime type ("type/subtype") is not associated to any particular
- * data wrapper object, this routine looks for a default data wrapper
- * for the main mime type ("type"). When no particular association is
- * found for this mime type, the type of the SimpleDataWrapper is
- * returned.
- *
- *
- * Return value: the associated data wrapper object type.
- **/
-GtkType
-data_wrapper_repository_get_data_wrapper_type (const gchar *mime_type)
-{
- gboolean exists;
- gchar *old_mime_type;
- GtkType gtk_type;
-
- printf("looking up type '%s'\n", mime_type);
-
- /* find if the complete mime type exists */
- exists = g_hash_table_lookup_extended (_repository.mime_links, (gpointer)mime_type,
- (gpointer)&old_mime_type, (gpointer)&gtk_type);
- if (exists) { /* the complete mime type exists, return it */
- printf( "exists!\n");
- return gtk_type;
- } else {
- /* the complete mime type association does not exists */
- /* is there an association for the main mime type ? */
- gmime_content_field_construct_from_string (_content_field, mime_type);
- exists = g_hash_table_lookup_extended (_repository.mime_links, (gpointer)(_content_field->type),
- (gpointer)&old_mime_type, (gpointer)&gtk_type);
-
- if (exists) /* the main mime type association exists */
- return gtk_type;
- else return camel_simple_data_wrapper_get_type();
- }
-
-
-
-
-}
-
diff --git a/camel/data-wrapper-repository.h b/camel/data-wrapper-repository.h
deleted file mode 100644
index ec73025764..0000000000
--- a/camel/data-wrapper-repository.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 DATA_WRAPPER_REPOSITORY_H
-#define DATA_WRAPPER_REPOSITORY_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include "camel-data-wrapper.h"
-
-
-
-typedef struct {
- GHashTable *mime_links;
-} DataWrapperRepository;
-
-
-gint data_wrapper_repository_init ();
-void data_wrapper_repository_set_data_wrapper_type (const gchar *mime_type, GtkType object_type);
-GtkType data_wrapper_repository_get_data_wrapper_type (const gchar *mime_type);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* DATA_WRAPPER_REPOSITORY_H */
diff --git a/camel/gmime-base64.c b/camel/gmime-base64.c
deleted file mode 100644
index a75e5c0f17..0000000000
--- a/camel/gmime-base64.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Base64 handlers
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- */
-#include <config.h>
-#include "gmime-base64.h"
-
-#define BSIZE 512
-
-/*
- * 64-based alphabet used by the the Base64 enconding
- */
-static char *base64_alphabet =
-"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-/**
- * gmime_encode_base64:
- * @input: The data source to be encoded in base64 format
- * @output: Where to put the encoded information in.
- *
- * This routine encodes the information pulled from @input using
- * base64 encoding and stores it on the @output CamelStream object
- */
-void
-gmime_encode_base64 (CamelStream *input, CamelStream *output)
-{
- char buffer [BSIZE];
- char obuf [80]; /* Output is limited to 76 characters, rfc2045 */
- int n, i, j, state;
- int keep = 0;
-
- state = 0;
- j = 0;
- while ((n = camel_stream_read (input, buffer, sizeof (buffer))) > 0){
- for (i = 0; i < n; i++, state++){
- char c = buffer [i];
-
- switch (state % 3){
- case 0:
- obuf [j++] = base64_alphabet [c >> 2];
- keep = (c & 3) << 4;
- break;
- case 1:
- obuf [j++] = base64_alphabet [keep | (c >> 4)];
- keep = (c & 0xf) << 2;
- break;
- case 2:
- obuf [j++] = base64_alphabet [keep | (c >> 6)];
- obuf [j++] = base64_alphabet [c & 0x3f];
- break;
- }
-
- if (j == 72){
- obuf [j++] = '\r';
- obuf [j++] = '\n';
- camel_stream_write (output, obuf, j);
- j = 0;
- }
- }
- }
-
- switch (state % 3){
- case 0:
- /* full output, nothing left to do */
- break;
-
- case 1:
- obuf [j++] = base64_alphabet [keep];
- obuf [j++] = '=';
- obuf [j++] = '=';
- break;
-
- case 2:
- obuf [j++] = base64_alphabet [keep];
- obuf [j++] = '=';
- break;
- }
- camel_stream_write (output, obuf, j);
- camel_stream_flush (output);
-}
-
-
-/**
- * gmime_decode_base64:
- * @input: A buffer in base64 format.
- * @output: Destination where the decoded information is stored.
- *
- * This routine decodes the base64 information pulled from @input
- * and stores it on the @output CamelStream object.
- */
-void
-gmime_decode_base64 (CamelStream *input, CamelStream *output)
-{
-}
-
-
-
-
diff --git a/camel/gmime-base64.h b/camel/gmime-base64.h
deleted file mode 100644
index 58ddd58722..0000000000
--- a/camel/gmime-base64.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Base64 handlers
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- */
-
-#ifndef _GMIME_BASE64_H
-#define _GMIME_BASE64_H
-
-#include "camel-stream.h"
-
-void gmime_encode_base64 (CamelStream *input, CamelStream *output);
-
-#endif
diff --git a/camel/gmime-content-field.c b/camel/gmime-content-field.c
deleted file mode 100644
index bec9721e0a..0000000000
--- a/camel/gmime-content-field.c
+++ /dev/null
@@ -1,382 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mime-content_field.c : mime content type field utilities */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 "gmime-content-field.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include <string.h>
-#include "hash-table-utils.h"
-
-/**
- * gmime_content_field_new: Creates a new GMimeContentField object
- * @type: mime type
- * @subtype: mime subtype
- *
- * Creates a GMimeContentField object and initialize it with
- * a mime type and a mime subtype. For example,
- * gmime_content_field_new ("application", "postcript");
- * will create a content field with complete mime type
- * "application/postscript"
- *
- * Return value: The newly created GMimeContentField object
- **/
-GMimeContentField *
-gmime_content_field_new (const gchar *type, const gchar *subtype)
-{
- GMimeContentField *ctf;
-
- ctf = g_new (GMimeContentField, 1);
- ctf->type = g_strdup (type);
- ctf->subtype = g_strdup (subtype);
- ctf->parameters = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- ctf->ref = 1;
-
- return ctf;
-}
-
-
-static void
-_free_parameter (gpointer name, gpointer value, gpointer user_data)
-{
- g_free (name);
- g_free (value);
-}
-
-/**
- * gmime_content_field_free: free a GMimeContentField object
- * @content_field: GMimeContentField object
- *
- * This method destroys the object and should be used very carefully.
- * Use gmime_content_field_unref instead.
- *
- **/
-void
-gmime_content_field_free (GMimeContentField *content_field)
-{
- if (!content_field) return;
-
- g_hash_table_foreach (content_field->parameters, _free_parameter, NULL);
- g_free (content_field->type);
- g_free (content_field->subtype);
- g_hash_table_destroy (content_field->parameters);
- g_free (content_field);
-}
-
-/**
- * gmime_content_field_ref: add a reference to a GMimeContentField object
- * @content_field: GMimeContentField object
- *
- * Tell a GMimeContentField object that something holds a reference
- * on him. This, coupled with the corresponding
- * gmime_content_field_unref() method allow several
- * objects to use the same GMimeContentField object.
- **/
-void
-gmime_content_field_ref (GMimeContentField *content_field)
-{
- content_field->ref += 1;
-}
-
-/**
- * gmime_content_field_unref: remove a reference to a GMimeContentField object
- * @content_field: GMimeContentField object
- *
- * Tell a GMimeContentField object that something which
- * was holding a reference to him does not need it anymore.
- * When no more reference exist, the GMimeContentField object
- * is freed using gmime_content_field_free().
- *
- **/
-void
-gmime_content_field_unref (GMimeContentField *content_field)
-{
- if (!content_field) return;
-
- content_field->ref -= 1;
- if (content_field->ref <= 0)
- gmime_content_field_free (content_field);
-}
-
-
-
-/**
- * gmime_content_field_set_parameter: set a parameter for a GMimeContentField object
- * @content_field: content field
- * @attribute: parameter name
- * @value: paramteter value
- *
- * set a parameter (called attribute in RFC 2045) of a content field. Meaningfull
- * or valid parameters name depend on the content type object. For example,
- * gmime_content_field_set_parameter (cf, "charset", "us-ascii");
- * will make sense for a "text/plain" content field but not for a
- * "image/gif". This routine does not check parameter validity.
- **/
-void
-gmime_content_field_set_parameter (GMimeContentField *content_field, const gchar *attribute, const gchar *value)
-{
- gboolean attribute_exists;
- gchar *old_attribute;
- gchar *old_value;
- CAMEL_LOG_FULL_DEBUG ("GMimeContentField:: Entering set_parameter\n");
- CAMEL_LOG_FULL_DEBUG ("GMimeContentField:: set_parameter content_field=%p name=%s, value=%s\n", content_field, attribute, value);
- attribute_exists = g_hash_table_lookup_extended (content_field->parameters,
- attribute,
- (gpointer *) &old_attribute,
- (gpointer *) &old_value);
- /** CHECK THAT : is normal to free pointers before insertion ? **/
- if (attribute_exists) {
- g_free (old_value);
- g_free (old_attribute);
- }
-
- g_hash_table_insert (content_field->parameters, g_strdup (attribute), g_strdup (value));
- CAMEL_LOG_FULL_DEBUG ("GMimeContentField:: Leaving set_parameter\n");
-}
-
-
-/**
- * _print_parameter: print a parameter/value pair to a stream as described in RFC 2045
- * @name: name of the parameter
- * @value: value of the parameter
- * @user_data: CamelStream object to write the text to.
- *
- *
- **/
-static void
-_print_parameter (gpointer name, gpointer value, gpointer user_data)
-{
- CamelStream *stream = (CamelStream *)user_data;
-
- camel_stream_write_strings (stream,
- "; \n ",
- (gchar *)name,
- "=",
- (gchar *)value,
- NULL);
-
-}
-
-/**
- * gmime_content_field_write_to_stream: write a mime content type to a stream
- * @content_field: content type object
- * @stream: the stream
- *
- *
- **/
-void
-gmime_content_field_write_to_stream (GMimeContentField *content_field, CamelStream *stream)
-{
- if (!content_field) return;
-
- g_assert (stream);
- if (content_field->type) {
- camel_stream_write_strings (stream, "Content-Type: ", content_field->type, NULL);
- if (content_field->subtype) {
- camel_stream_write_strings (stream, "/", content_field->subtype, NULL);
- }
- /* print all parameters */
- g_hash_table_foreach (content_field->parameters, _print_parameter, stream);
- camel_stream_write_string (stream, "\n");
- } else CAMEL_LOG_FULL_DEBUG ("GMimeContentField::write_to_stream no mime type found\n");
-}
-
-/**
- * gmime_content_field_get_mime_type: return the mime type of the content field object
- * @content_field: content field object
- *
- * A RFC 2045 content type field contains the mime type in the
- * form "type/subtype" (example : "application/postscript") and some
- * parameters (attribute/value pairs). This routine returns the mime type
- * in a gchar object.
- *
- * Return value: the mime type in the form "type/subtype" or NULL if not defined.
- **/
-gchar *
-gmime_content_field_get_mime_type (GMimeContentField *content_field)
-{
- gchar *mime_type;
-
- if (!content_field->type) return NULL;
-
- if (content_field->subtype)
- mime_type = g_strdup_printf ("%s/%s", content_field->type, content_field->subtype);
- else
- mime_type = g_strdup (content_field->type);
- return mime_type;
-}
-
-static void
-___debug_print_parameter (gpointer name, gpointer value, gpointer user_data)
-{
-
- printf ("****** parameter \"%s\"=\"%s\"\n", (gchar *)name, (gchar *)value);
-
-}
-
-/**
- * gmime_content_field_get_parameter: return the value of a mime type parameter
- * @content_field: content field object
- * @name: name of the parameter
- *
- * Returns the value of a parameter contained in the content field
- * object. The content type is formed of a mime type, a mime subtype,
- * and a parameter list. Each parameter is a name/value pair. This
- * routine returns the value assiciated to a given name.
- * When the parameter does not exist, NULL is returned.
- *
- * Return value: parameter value, or NULL if not found.
- **/
-const gchar *
-gmime_content_field_get_parameter (GMimeContentField *content_field, const gchar *name)
-{
- const gchar *parameter;
- const gchar *old_name;
- gboolean parameter_exists;
-
- CAMEL_LOG_FULL_DEBUG ("Entering GMimeContentField::get_parameter content_field =%p\n", content_field);
- g_assert (content_field->parameters);
- g_assert (name);
- CAMEL_LOG_FULL_DEBUG ("GMimeContentField::get_parameter looking for parameter \"%s\"\n", name);
- /* parameter = (const gchar *)g_hash_table_lookup (content_field->parameters, name); */
- parameter_exists = g_hash_table_lookup_extended (content_field->parameters,
- name,
- (gpointer *) &old_name,
- (gpointer *) &parameter);
- if (!parameter_exists) {
- CAMEL_LOG_FULL_DEBUG ("GMimeContentField::get_parameter, parameter not found\n");
- g_hash_table_foreach (content_field->parameters, ___debug_print_parameter, NULL);
- return NULL;
- }
- CAMEL_LOG_FULL_DEBUG ("Leaving GMimeContentField::get_parameter\n");
- return parameter;
-}
-
-
-
-
-/**
- * gmime_content_field_construct_from_string: construct a ContentType object by parsing a string.
- *
- * @content_field: content type object to construct
- * @string: string containing the content type field
- *
- * Parse a string containing a content type field as defined in
- * RFC 2045, and construct the corresponding ContentType object.
- * The string is not modified and not used in the ContentType
- * object. It can and must be freed by the calling part.
- **/
-void
-gmime_content_field_construct_from_string (GMimeContentField *content_field, const gchar *string)
-{
- gint first, len;
- gchar *str;
- gint i=0;
- gchar *type, *subtype;
- gchar *param_name, *param_value;
- gboolean param_end;
-
- CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, entering\n");
- g_assert (string);
- g_assert (content_field);
-
- g_free (content_field->type);
- g_free (content_field->subtype);
-
-
- first = 0;
- len = strlen (string);
- if (!len) {
- CAMEL_LOG_FULL_DEBUG ( "GMimeContentField::construct_from_string, leaving\n");
- return;
- }
- CAMEL_LOG_FULL_DEBUG ("GMimeContentField::construct_from_string, All checks done\n");
- CAMEL_LOG_FULL_DEBUG ("GMimeContentField::construct_from_string the complete header is\n"
- "-------------------\n%s\n-------------------\n", string);
- /* find the type */
- while ( (i<len) && (!strchr ("/;", string[i])) ) i++;
-
- if (i == 0) {
- CAMEL_LOG_FULL_DEBUG ( "GMimeContentField::construct_from_string, leaving\n");
- return;
- }
-
- type = g_strndup (string, i);
- string_trim (type, " \t\"", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING);
- content_field->type = type;
- CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, Found mime type : \"%s\"\n", type);
- if (i >= len-1) {
- content_field->subtype = NULL;
-
- CAMEL_LOG_FULL_DEBUG ( "GMimeContentField::construct_from_string only found the type leaving\n");
- return;
- }
-
- first = i+1;
- /* find the subtype, if any */
- if (string[i++] == '/') {
- while ( (i<len) && (string[i] != ';') ) i++;
- if (i != first) {
- subtype = g_strndup (string+first, i-first);
- string_trim (subtype, " \t\"", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING);
- content_field->subtype = subtype;
- CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, Found mime subtype: \"%s\"\n", subtype);
- if (i >= len-1) {
- CAMEL_LOG_FULL_DEBUG ( "GMimeContentField::construct_from_string found the subtype but no parameter, leaving\n");
- return;
- }
- }
- }
- first = i+1;
-
- /* parse parameters list */
- param_end = FALSE;
- do {
- while ( (i<len) && (string[i] != '=') ) i++;
- if ((i == len) || (i==first)) param_end = TRUE;
- else {
- /* we have found parameter name */
- param_name = g_strndup (string+first, i-first);
- string_trim (param_name, " \"", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING);
- i++;
- first = i;
- /* Let's find parameter value */
- while ( (i<len) && (string[i] != ';') ) i++;
- if (i != first) param_value = g_strndup (string+first, i-first);
- else param_value = g_strdup ("");
- CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, Found mime parameter \"%s\"=\"%s\"\n", param_name, param_value);
- string_trim (param_value, " \t\"", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING);
- gmime_content_field_set_parameter (content_field, param_name, param_value);
- g_free (param_name);
- g_free (param_value);
- i++;
- first = i;
- }
- } while ((!param_end) && (first < len));
-
-
-}
-
diff --git a/camel/gmime-content-field.h b/camel/gmime-content-field.h
deleted file mode 100644
index 7558e4b735..0000000000
--- a/camel/gmime-content-field.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mime-content_field.h : mime content type field utilities */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 GMIME_CONTENT_FIELD_H
-#define GMIME_CONTENT_FIELD_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include <stdio.h>
-#include "camel-stream.h"
-
-typedef struct {
-
- gchar *type;
- gchar *subtype;
- GHashTable *parameters;
-
- gint ref;
-
-} GMimeContentField;
-
-GMimeContentField *gmime_content_field_new (const gchar *type, const gchar *subtype);
-void gmime_content_field_ref (GMimeContentField *content_field);
-void gmime_content_field_unref (GMimeContentField *content_field);
-
-void gmime_content_field_set_parameter (GMimeContentField *content_field, const gchar *attribute, const gchar *value);
-void gmime_content_field_write_to_stream (GMimeContentField *content_field, CamelStream *stream);
-void gmime_content_field_construct_from_string (GMimeContentField *content_field, const gchar *string);
-void gmime_content_field_free (GMimeContentField *content_field);
-gchar * gmime_content_field_get_mime_type (GMimeContentField *content_field);
-const gchar *gmime_content_field_get_parameter (GMimeContentField *content_field, const gchar *name);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* GMIME_CONTENT_FIELD_H */
diff --git a/camel/gmime-rfc2047.c b/camel/gmime-rfc2047.c
deleted file mode 100644
index 8dad887849..0000000000
--- a/camel/gmime-rfc2047.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* gmime-rfc2047.c: implemention of RFC2047 */
-
-/*
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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
- *
- */
-
-/*
- * Authors: Robert Brady <rwb197@ecs.soton.ac.uk>
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <unicode.h>
-#include <string.h>
-
-#include "gmime-rfc2047.h"
-
-#define NOT_RANKED -1
-
-/* This should be changed ASAP to use the base64 code Miguel comitted */
-
-const char *base64_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-static unsigned char base64_rank[256];
-static int base64_rank_table_built;
-static void build_base64_rank_table (void);
-
-static int
-hexval (gchar c) {
- if (isdigit (c)) return c-'0';
- c = tolower (c);
- return c - 'a' + 10;
-}
-
-static gchar *
-decode_quoted (const gchar *text, const gchar *end)
-{
- gchar *to = malloc(end - text + 1), *to_2 = to;
-
- if (!to) return NULL;
- while (*text && text < end) {
- if (*text == '=') {
- gchar a = hexval (text[1]);
- gchar b = hexval (text[2]);
- int c = (a << 4) + b;
- *to = c;
- to++;
- text+=3;
- } else if (*text == '_') {
- *to = ' ';
- to++;
- text++;
- } else {
- *to = *text;
- to++;
- text++;
- }
- }
- return to_2;
-}
-
-static gchar *
-decode_base64 (const gchar *data, const gchar *end)
-{
- unsigned short pattern = 0;
- int bits = 0;
- int delimiter = '=';
- gchar x;
- gchar *buffer = g_malloc((end - data) * 3);
- gchar *t = buffer;
- int Q = 0;
-
- if (!buffer) return NULL;
-
- while (*data != delimiter) {
- x = base64_rank[(unsigned char)(*data++)];
- if (x == NOT_RANKED)
- continue;
- pattern <<= 6;
- pattern |= x;
- bits += 6;
- if (bits >= 8) {
- x = (pattern >> (bits - 8)) & 0xff;
- *t++ = x;
- Q++;
- bits -= 8;
- }
- }
- *t = 0;
- return buffer;
-}
-
-static void
-build_base64_rank_table (void)
-{
- int i;
-
- if (!base64_rank_table_built) {
- for (i = 0; i < 256; i++)
- base64_rank[i] = NOT_RANKED;
- for (i = 0; i < 64; i++)
- base64_rank[(int) base64_alphabet[i]] = i;
- base64_rank_table_built = 1;
- }
-}
-
-
-static gchar *
-rfc2047_decode_word (const gchar *data, const gchar *into_what)
-{
- const char *charset = strstr (data, "=?"), *encoding, *text, *end;
-
- char *buffer, *b, *cooked_data;
-
- buffer = g_malloc (strlen(data) * 2);
- b = buffer;
-
- if (!charset) return strdup (data);
- charset+=2;
-
- encoding = strchr (charset, '?');
- if (!encoding) return strdup (data);
- encoding++;
-
- text = strchr(encoding, '?');
- if (!text) return strdup (data);
- text++;
-
- end = strstr(text, "?=");
- if (!end) return strdup (data);
-
- b[0] = 0;
-
- if (toupper(*encoding)=='Q')
- cooked_data = decode_quoted (text, end);
- else if (toupper (*encoding)=='B')
- cooked_data = decode_base64 (text, end);
- else
- return g_strdup(data);
-
- {
- char *c = strchr (charset, '?');
- char *q = g_malloc (c - charset + 1);
- char *cook_2 = cooked_data;
- int cook_len = strlen (cook_2);
- int b_len = 4096;
- unicode_iconv_t i;
- strncpy (q, charset, c - charset);
- q[c - charset] = 0;
- i = unicode_iconv_open (into_what, q);
- if (!i) {
- g_free (q);
- return g_strdup (buffer);
- }
- if (unicode_iconv (i, &cook_2, &cook_len, &b, &b_len)==-1)
- /* FIXME : use approximation code if we can't convert it properly. */
- ;
- unicode_iconv_close (i);
- *b = 0;
- }
-
- return g_strdup (buffer);
-}
-
-static const gchar *
-find_end_of_encoded_word (const gchar *data)
-{
- /* We can't just search for ?=,
- because of the case :
- "=?charset?q?=ff?=" :( */
- if (!data) return NULL;
- data = strstr (data, "=?");
- if (!data) return NULL;
- data = strchr(data+2, '?');
- if (!data) return NULL;
- data = strchr (data+1, '?');
- if (!data) return NULL;
- data = strstr (data+1, "?=");
- if (!data) return NULL;
- return data + 2;
-}
-
-gchar *
-gmime_rfc2047_decode (const gchar *data, const gchar *into_what)
-{
- char *buffer = malloc (strlen(data) * 4), *b = buffer;
-
- int was_encoded_word = 0;
-
- build_base64_rank_table ();
-
- while (data && *data) {
- char *word_start = strstr (data, "=?"), *decoded;
- if (!word_start) {
- strcpy (b, data);
- b[strlen (data)] = 0;
- return buffer;
- }
- if (word_start != data) {
-
- if (strspn (data, " \t\n\r") != (word_start - data)) {
- strncpy (b, data, word_start - data);
- b += word_start - data;
- *b = 0;
- }
- }
- decoded = rfc2047_decode_word (word_start, into_what);
- strcpy (b, decoded);
- b += strlen (decoded);
- *b = 0;
- g_free (decoded);
-
- data = find_end_of_encoded_word (data);
- }
-
- *b = 0;
- return buffer;
-}
-
-#define isnt_ascii(a) ((a) <= 0x1f || (a) >= 0x7f)
-
-static int
-rfc2047_clean (const gchar *string, const gchar *max)
-{
- /* if (strstr (string, "?=")) return 1; */
- while (string < max) {
- if (isnt_ascii ((unsigned char)*string))
- return 0;
- string++;
- }
- return 1;
-}
-
-static gchar *
-encode_word (const gchar *string, int length, const gchar *said_charset)
-{
- const gchar *max = string + length;
- if (rfc2047_clean(string, max)) {
- /* don't bother encoding it if it has no odd characters in it */
- return g_strndup (string, length);
- }
- {
- char *temp = malloc (length * 4 + 1), *t = temp;
- t += sprintf (t, "=?%s?q?", said_charset);
- while (string < max) {
- if (*string == ' ')
- *(t++) = '_';
- else if ((*string <= 0x1f) || (*string >= 0x7f) || (*string == '=') || (*string == '?'))
- t += sprintf (t, "=%2x", (unsigned char)*string);
- else
- *(t++) = *string;
-
- string++;
- }
- t += sprintf (t, "?=");
- *t = 0;
- return temp;
- }
-}
-
-static int
-words_in(char *a)
-{
- int words = 1;
- while (*a) {
- if (*(a++)==' ')
- words++;
- }
- return words;
-}
-
-struct word_data {
- const char *word;
- int word_length;
- const char *to_encode_in;
- char *encoded;
- enum {
- wt_None,
- wt_Address,
- } type;
-};
-
-static int string_can_fit_in(const char *a, int length, const char *charset)
-{
- while (length--) {
- if (*a < 0x1f || *a >= 0x7f) return 0;
- a++;
- }
- return 1;
-}
-
-static void
-show_entry(struct word_data *a)
-{
- a->type = wt_None;
-
- if (string_can_fit_in(a->word, a->word_length, "US-ASCII"))
- a->to_encode_in = "US-ASCII";
-
- if (a->word[0]=='<' && a->word[a->word_length-1]=='>') {
- a->type = wt_Address;
- }
-}
-
-static void
-break_into_words(const char *string, struct word_data *a, int words)
-{
- int i;
- for (i=0;i<words;i++) {
-
- char *next_space = strchr(string, ' ');
-
- if (!next_space) {
- a[i].word = string;
- a[i].word_length = strlen(string);
- a[i].to_encode_in = NULL; /* i.e. the default */
-
- show_entry(a+i);
-
- return;
- }
-
- a[i].word = string;
- a[i].word_length = next_space - string;
- a[i].to_encode_in = NULL;
-
- show_entry(a+i);
-
- string = next_space + 1;
-
- }
-}
-
-static void
-join_words(struct word_data *a, int words)
-{
- int i;
- for (i=(words-1);i>0;i--) {
- if (a[i].to_encode_in == a[i-1].to_encode_in) {
- a[i-1].word_length += 1 + a[i].word_length;
- a[i].word = 0;
- a[i].word_length = 0;
- }
-
- }
-}
-
-static void show_words(struct word_data *words, int count)
-{
- int i;
- for (i=0;i<count;i++)
- if (words[i].word)
- show_entry(words+i);
-}
-
-gchar *
-gmime_rfc2047_encode (const gchar *string, const gchar *charset)
-{
- int temp_len = strlen (string)*4 + 1, word_count;
- char *temp = g_malloc (temp_len), *temp_2 = temp;
- int string_length = strlen (string);
- char *encoded = NULL, *p;
- struct word_data *words;
-
- /* first, let us convert to UTF-8 */
- unicode_iconv_t i = unicode_iconv_open ("UTF-8", charset);
- unicode_iconv (i, &string, &string_length, &temp_2, &temp_len);
- unicode_iconv_close (i);
-
- /* null terminate it */
- *temp_2 = 0;
-
- /* now encode it as if it were a single word */
-
- word_count = words_in ( temp );
-
- words = g_malloc(sizeof (struct word_data) * word_count);
- break_into_words(temp, words, word_count);
-
- join_words(words, word_count);
-
- show_words(words, word_count);
-
- {
- size_t len = 0;
- int c = 0;
- for (c = 0;c<word_count;c++) {
- if (words[c].word)
- {
- words[c].encoded = encode_word(words[c].word, words[c].word_length,
- words[c].to_encode_in ? words[c].to_encode_in :
- "UTF-8");
- len += strlen(words[c].encoded) + 1;
- }
- }
-
- {
- encoded = g_malloc(len+1);
- p = encoded;
- for (c = 0; c < word_count;c++) if (words[c].word) {
- strcpy(p, words[c].encoded);
- p += strlen(p);
- strcpy(p, " ");
- p++;
- }
- *p = 0;
- }
- }
-
-
- /*
-
- real algorithm :
-
- we need to
-
- split it into words
-
- identify portions that have NOT to be encoded (i.e. <> and the comment starter/ender )
-
- identify the best character set for each word
-
- merge words which share a character set, allow jumping and merging with words which
- would be ok to encode in non-US-ASCII.
-
- if we have to use 2 character sets, try and collapse them into one.
-
- (e.g. if one word contains letters in latin-1, and another letters in latin-2, use
- latin-2 for the first word as well if possible).
-
- finally :
-
- if utf-8 will still be used, use it for everything.
-
- and then, at last, generate the encoded text, using base64/quoted-printable for
- each word depending upon which is more efficient.
-
- TODO :
- create a priority list of encodings
-
- i.e.
-
- US-ASCII, ISO-8859-1, ISO-8859-2, ISO-8859-3, KOI8,
-
- Should survey for most popular charsets :
- what do people usually use for the following scripts?
-
- * Chinese/Japanese/Korean
- * Greek
- * Cyrillic
-
- (any other scripts commonly used in mail/news?)
-
- This algorithm is probably far from optimal, but should be
- reasonably efficient for simple cases. (and almost free if
- the text is just in US-ASCII : like 99% of the text that will
- pass through it)
-
-
-
- current status :
-
- Algorithm now partially implemented.
-
- */
-
- g_free(words);
- g_free(temp);
-
- return encoded;
-}
diff --git a/camel/gmime-rfc2047.h b/camel/gmime-rfc2047.h
deleted file mode 100644
index 6efd8cc243..0000000000
--- a/camel/gmime-rfc2047.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* gmime-rfc2047.c: implemention of RFC2047 */
-
-/*
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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
- *
- */
-
-/*
- * Authors: Robert Brady <rwb197@ecs.soton.ac.uk>
- */
-
-#ifndef GMIME_RFC2047_H
-#define GMIME_RFC2047_H 1
-#include <glib.h>
-
-gchar *gmime_rfc2047_decode (const gchar *text, const gchar* charset);
-gchar *gmime_rfc2047_encode (const gchar *text, const gchar* charset);
-
-/*
- * pass text and charset, (e.g. "UTF-8", or "ISO-8859-1"), and
- * it will encode or decode text according to RFC2047
- *
- * You will need to link with libunicode for these.
- *
- * TODO : Make it so that if charset==NULL, the charset specified (either
- * implicitly or explicity) in the locale is used.
- *
- * TODO : Run torture tests and fix the buffer overruns in these functions.
- *
- * The caller will need to free the memory for the string.
- */
-
-#endif /* GMIME_RFC2047_H */
diff --git a/camel/gmime-utils.c b/camel/gmime-utils.c
deleted file mode 100644
index 7ceb0219ec..0000000000
--- a/camel/gmime-utils.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mime-utils.c : misc utilities for mime */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 "gmime-utils.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include "camel-stream.h"
-
-void
-gmime_write_header_pair_to_stream (CamelStream *stream, const gchar* name, const gchar *value)
-{
-
- gchar *strtmp;
-
- CAMEL_LOG_FULL_DEBUG ( "gmime_write_header_pair_to_stream:: Entering\n");
- g_assert(name);
-
- if (!value) return;
- strtmp = g_strdup_printf ("%s: %s\n", name, value);
-
- camel_stream_write_string (stream, strtmp);
- CAMEL_LOG_FULL_DEBUG ( "gmime_write_header_pair_to_stream:\n writing %s\n", strtmp);
-
- g_free (strtmp);
- CAMEL_LOG_FULL_DEBUG ( "gmime_write_header_pair_to_stream:: Leaving\n");
-
-}
-
-
-static void
-_write_one_header_to_stream (gpointer key, gpointer value, gpointer user_data)
-{
- gchar *header_name = (gchar *)key;
- gchar *header_value = (gchar *)value;
- CamelStream *stream = (CamelStream *)user_data;
-
- CAMEL_LOG_FULL_DEBUG ( "_write_one_header_to_stream:: Entering\n");
- if ((header_name) && (header_value))
- gmime_write_header_pair_to_stream (stream, header_name, header_value);
- CAMEL_LOG_FULL_DEBUG ( "_write_one_header_to_stream:: Leaving\n");
-}
-
-void
-gmime_write_header_table_to_stream (CamelStream *stream, GHashTable *header_table)
-{
- CAMEL_LOG_FULL_DEBUG ( "write_header_table_to_stream:: Entering\n");
- g_hash_table_foreach (header_table,
- _write_one_header_to_stream,
- (gpointer)stream);
- CAMEL_LOG_FULL_DEBUG ( "write_header_table_to_stream:: Leaving\n");
-}
-
-
-void
-gmime_write_header_with_glist_to_stream (CamelStream *stream,
- const gchar *header_name,
- GList *header_values,
- const gchar *separator)
-{
-
- gchar *current;
-
- CAMEL_LOG_FULL_DEBUG ( "write_header_with_glist_to_stream:: entering\n");
- CAMEL_LOG_FULL_DEBUG ( "\theader name : %s\n", header_name);
- if ( (header_name) && (header_values) )
- {
- gboolean first;
-
- camel_stream_write (stream, header_name, strlen (header_name) );
- camel_stream_write (stream, ": ", 2);
- first = TRUE;
- while (header_values) {
- current = (gchar *)header_values->data;
- CAMEL_LOG_FULL_DEBUG ( "write_header_with_glist_to_stream:: writing value : %s\n", current);
- if (current) {
- if (!first) camel_stream_write_string (stream, separator);
- else first = FALSE;
- camel_stream_write (stream, current, strlen (current));
- }
- header_values = g_list_next (header_values);
- }
- camel_stream_write (stream, "\n", 1);
- }
- CAMEL_LOG_FULL_DEBUG ("write_header_with_glist_to_stream:: leaving\n");
-
-}
-
-
-
-
-
-/* * * * * * * * * * * */
-/* scanning functions */
-
-static void
-_store_header_pair_from_string (GArray *header_array, gchar *header_line)
-{
- gchar dich_result;
- gchar *header_name, *header_value;
- Rfc822Header header;
-
- CAMEL_LOG_FULL_DEBUG ( "_store_header_pair_from_string:: Entering\n");
-
- g_assert (header_array);
- g_return_if_fail (header_line);
-
-
- if (header_line) {
- dich_result = string_dichotomy ( header_line, ':',
- &header_name, &header_value,
- STRING_DICHOTOMY_NONE);
- if (dich_result != 'o') {
- CAMEL_LOG_WARNING (
- "** WARNING **\n"
- "store_header_pair_from_string : dichotomy result is '%c'\n"
- "header line is :\n--\n%s\n--\n"
- "** \n", dich_result, header_line);
- if (header_name)
- g_free (header_name);
- if (header_value)
- g_free (header_value);
-
- } else {
- string_trim (header_value, " \t",
- STRING_TRIM_STRIP_LEADING | STRING_TRIM_STRIP_TRAILING);
-
- header.name = header_name;
- header.value = header_value;
- g_array_append_val (header_array, header);
- }
- }
-
- CAMEL_LOG_FULL_DEBUG ( "_store_header_pair_from_string:: Leaving\n");
-
-}
-
-
-
-/*
- this is a blocking version of the
- header parsing. Need to change when
- fs streams are non blocking
-*/
-GArray *
-get_header_array_from_stream (CamelStream *stream)
-{
-#warning Correct Lazy Implementation
- /* should not use GString. */
- /* should read the header line by line */
- /* and not char by char */
- gchar next_char;
- gint nb_char_read;
-
- gboolean crlf = FALSE;
- gboolean end_of_header_line = FALSE;
- gboolean end_of_headers = FALSE;
- gboolean end_of_file = FALSE;
-
- GString *header_line=NULL;
- GArray *header_array;
-
-
- CAMEL_LOG_FULL_DEBUG ( "gmime-utils:: Entering get_header_table_from_stream\n");
- header_array = g_array_new (FALSE, FALSE, sizeof (Rfc822Header));
-
- nb_char_read = camel_stream_read (stream, &next_char, 1);
- do {
- header_line = g_string_new ("");
- end_of_header_line = FALSE;
- crlf = FALSE;
-
- /* read a whole header line */
- do {
- if (nb_char_read>0) {
- switch (next_char) {
-
- case '\r': CAMEL_LOG_FULL_DEBUG ( "gmime-utils::get_header_table_from_stream "
- "****** FOUND A \\r******* \n");
- case '\n': /* a blank line means end of headers */
- if (crlf) {
- end_of_headers=TRUE;
- end_of_header_line = TRUE;
- }
- else crlf = TRUE;
- break;
- case ' ':
- case '\t':
- if (crlf) {
- crlf = FALSE;
- next_char = ' ';
- }
-
- default:
- if (!crlf) header_line = g_string_append_c (header_line, next_char);
- else end_of_header_line = TRUE;
-
- }
- } else {
-
- if (camel_stream_eos (stream)) {
-
- end_of_file=TRUE;
- end_of_header_line = TRUE;
-
- }
- }
-
- /* if we have read a whole header line, we have also read
- the first character of the next line to be sure the
- crlf was not followed by a space or a tab char */
- if (!end_of_header_line) nb_char_read = camel_stream_read (stream, &next_char, 1);
-
- } while ( !end_of_header_line );
- if ( strlen(header_line->str) ) {
- /* str_header_line = g_strdup (header_line->str); */
- _store_header_pair_from_string (header_array, header_line->str);
- }
- g_string_free (header_line, FALSE);
-
- } while ( (!end_of_headers) && (!end_of_file) );
-
- CAMEL_LOG_FULL_DEBUG ( "gmime-utils:: Leaving get_header_table_from_stream\n");
- return header_array;
-}
-
-
-
-gchar *
-gmime_read_line_from_stream (CamelStream *stream)
-{
- GString *new_line;
- gchar *result;
- gchar next_char;
- gboolean end_of_line = FALSE;
- gboolean end_of_stream = FALSE;
- gint nb_char_read;
-
- new_line = g_string_new ("");
- do {
- nb_char_read = camel_stream_read (stream, &next_char, 1);
-
- if (nb_char_read>0) {
-
- switch (next_char) {
- case '\n':
- end_of_line = TRUE;
- /* g_string_append_c (new_line, next_char); */
- break;
- default:
- g_string_append_c (new_line, next_char);
-
- }
- } else {
-
- if (camel_stream_eos (stream))
- end_of_stream = TRUE;
-
- }
- } while (!end_of_line && !end_of_stream);
-
-
- if (!end_of_stream)
- result = g_strdup (new_line->str);
- else result=NULL;
-
- g_string_free (new_line, TRUE);
-
- return result;
-}
diff --git a/camel/gmime-utils.h b/camel/gmime-utils.h
deleted file mode 100644
index cf352cb798..0000000000
--- a/camel/gmime-utils.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mime-utils.h : misc utilities for mime */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 GMIME_UTILS_H
-#define GMIME_UTILS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include <stdio.h>
-#include <camel/camel-stream.h>
-
-typedef struct
-{
- gchar *name;
- gchar *value;
-
-} Rfc822Header;
-
-
-void gmime_write_header_pair_to_stream (CamelStream *stream,
- const gchar* name,
- const gchar *value);
-
-void gmime_write_header_table_to_stream (CamelStream *stream,
- GHashTable *header_table);
-
-void gmime_write_header_with_glist_to_stream (CamelStream *stream,
- const gchar *header_name,
- GList *header_values,
- const gchar *separator);
-
-GArray *get_header_array_from_stream (CamelStream *stream);
-gchar *gmime_read_line_from_stream (CamelStream *stream);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* GMIME_UTILS_H */
diff --git a/camel/gstring-util.c b/camel/gstring-util.c
deleted file mode 100644
index eb89c2aa28..0000000000
--- a/camel/gstring-util.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* gstring-util : utilities for gstring object */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 "gstring-util.h"
-#include "camel-log.h"
-#include <string.h>
-
-/**
- * g_string_equals : test if two string are equal
- *
- * @string1 : first string
- * @string2 : second string
- *
- * @Return Value : true if the strings equal, false otherwise
- **/
-gboolean
-g_string_equals (GString *string1, GString *string2)
-{
- g_assert (string1);
- g_assert (string2);
- return !strcmp (string1->str, string2->str);
-}
-
-
-
-
-/**
- * g_string_clone : clone a GString
- *
- * @string : the string to clone
- *
- * @Return Value : the clone ...
- **/
-GString *
-g_string_clone (GString *string)
-{
- return g_string_new (g_strdup (string->str) );
-}
-
-
-
-
-/**
- * g_string_dichotomy:
- * @sep : separator
- * @prefix: pointer to be field by the prefix object
- * the prefix is not returned when the given pointer is NULL
- * @suffix: pointer to be field by the suffix object
- * the suffix is not returned when the given pointer is NULL
- *
- * Return the strings before and/or after
- * the last occurence of the specified separator
- *
- * This routine returns the string before and/or after
- * a character given as an argument.
- * if the separator is the last character, prefix and/or
- * suffix is set to NULL and result is set to 'l'
- * if the separator is not in the list, prefix and/or
- * suffix is set to NULL and result is set to 'n'
- * When the operation succedeed, the return value is 'o'
- *
- * @Return Value : result of the operation ('o', 'l' or 'n')
- *
- **/
-gchar
-g_string_dichotomy (GString *string, gchar sep, GString **prefix, GString **suffix,
- GStringDichotomyOption options)
-{
- gchar *str, *tmp;
- gint pos, len, first;
-
- CAMEL_LOG_FULL_DEBUG (\
- "Entering string_dichotomy: \n\tseparator=%c \n\tprefix=%p \n\tsuffix=%p \n\toptions=%ld\n",\
- sep, prefix, suffix, options);
- g_assert (tmp=string->str);
- len = strlen (tmp);
- if (!len) {
- if (prefix)
- *prefix=NULL;
- if (suffix)
- *suffix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: string is empty\n");
- return 'n';
- }
- first = 0;
-
- if ((options & GSTRING_DICHOTOMY_STRIP_LEADING ) && (tmp[first] == sep) )
- do {first++;} while ( (first<len) && (tmp[first] == sep) );
-
- if (options & GSTRING_DICHOTOMY_STRIP_TRAILING )
- while (tmp[len-1] == sep)
- len--;
-
- if (first==len) {
- if (prefix) *prefix=NULL;
- if (suffix) *suffix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: after stripping, string is empty\n");
- return 'n';
- }
-
- if (options & GSTRING_DICHOTOMY_RIGHT_DIR) {
- pos = len;
-
- do {
- pos--;
- } while ((pos>=first) && (tmp[pos]!=sep));
- } else {
- pos = first;
- do {
- pos++;
- } while ((pos<len) && (tmp[pos]!=sep));
-
- }
-
- if ( (pos<first) || (pos>=len) )
- {
- if (suffix) *suffix=NULL;
- if (prefix) *prefix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator not found\n");
- return 'n';
- }
-
- /* if we have stripped trailing separators, we should */
- /* never enter here */
- if (pos==len-1)
- {
- if (suffix) *suffix=NULL;
- if (prefix) *prefix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator is last character\n");
- return 'l';
- }
- /* if we have stripped leading separators, we should */
- /* never enter here */
- if (pos==first)
- {
- if (suffix) *suffix=NULL;
- if (prefix) *prefix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator is first character\n");
- return 'l';
- }
-
- if (prefix) /* return the prefix */
- {
- str = g_strndup(tmp,pos);
- *prefix = g_string_new(str);
- g_free(str);
- }
- if (suffix) /* return the suffix */
- {
- str = g_strdup(tmp+pos+1);
- *suffix = g_string_new(str);
- g_free(str);
- }
-
- return 'o';
-}
-
-
-/**
- * g_string_append_g_string : append a GString to another GString
- *
- * @dest_string : string which will be appended
- * @other_string : string to append
- *
- **/
-void
-g_string_append_g_string(GString *dest_string, GString *other_string)
-{
- g_assert(other_string);
- g_assert(dest_string);
- g_assert(other_string->str);
-
- g_string_append(dest_string, other_string->str);
-}
-
-
-
-/**
- * g_string_equal_for_hash: test equality of two GStrings for hash tables
- * @v: string 1
- * @v2: string 2
- *
- *
- *
- * Return value:
- **/
-gint
-g_string_equal_for_hash (gconstpointer v, gconstpointer v2)
-{
- return strcmp ( ((const GString*)v)->str, ((const GString*)v2)->str) == 0;
-}
-
-gint
-g_string_equal_for_glist (gconstpointer v, gconstpointer v2)
-{
- return !strcmp ( ((const GString*)v)->str, ((const GString*)v2)->str) == 0;
-}
-
-
-/**
- * g_string_hash: computes a hash value for a Gstring
- * @v: Gstring object
- *
- *
- *
- * Return value:
- **/
-guint
-g_string_hash (gconstpointer v)
-{
- return g_str_hash(((const GString*)v)->str);
-}
-
-
-
-
-/* utility func : frees a GString element in a GList */
-static void
-__g_string_list_free_string (gpointer data, gpointer user_data)
-{
- GString *string = (GString *)data;
- g_string_free(string, TRUE);
-}
-
-
-void
-g_string_list_free (GList *string_list)
-{
- g_list_foreach(string_list, __g_string_list_free_string, NULL);
- g_list_free(string_list);
-}
-
-
-
-
-
-
-GList *
-g_string_split (GString *string, char sep, gchar *trim_chars, GStringTrimOption trim_options)
-{
- GList *result = NULL;
- gint first, last, pos;
- gchar *str;
- gchar *new_str;
- GString *new_gstring;
-
- g_assert (string);
- str = string->str;
- if (!str) return NULL;
-
- first = 0;
- last = strlen(str) - 1;
-
- /* strip leading and trailing separators */
- while ( (first<=last) && (str[first]==sep) )
- first++;
- while ( (first<=last) && (str[last]==sep) )
- last--;
-
-
- CAMEL_LOG_FULL_DEBUG ("g_string_split:: trim options: %d\n", trim_options);
-
- while (first<=last) {
- pos = first;
- /* find next separator */
- while ((pos<=last) && (str[pos]!=sep)) pos++;
- if (first != pos) {
- new_str = g_strndup (str+first, pos-first);
- new_gstring = g_string_new (new_str);
- g_free (new_str);
- /* could do trimming in line to speed up this code */
- if (trim_chars) g_string_trim (new_gstring, trim_chars, trim_options);
- result = g_list_append (result, new_gstring);
- }
- first = pos + 1;
- }
-
- return result;
-}
-
-
-void
-g_string_trim (GString *string, gchar *chars, GStringTrimOption options)
-{
- gint first_ok;
- gint last_ok;
- guint length;
- gchar *str;
-
- CAMEL_LOG_FULL_DEBUG ("**\nentering g_string_trim::\n");
-
- if ((!string) || (!string->str))
- return;
- str = string->str;
- length = strlen (str);
- if (!length)
- return;
-
- first_ok = 0;
- last_ok = length - 1;
-
- CAMEL_LOG_FULL_DEBUG ("g_string_trim:: trim_options:%d\n", options);
- if (options & GSTRING_TRIM_STRIP_LEADING)
- while ( (first_ok <= last_ok) && (strchr (chars, str[first_ok])) )
- first_ok++;
-
- if (options & GSTRING_TRIM_STRIP_TRAILING)
- while ( (first_ok <= last_ok) && (strchr (chars, str[last_ok])) )
- last_ok++;
- CAMEL_LOG_FULL_DEBUG ("g_string_trim::\n\t\"%s\":first ok:%d last_ok:%d\n",
- string->str, first_ok, last_ok);
-
- if (first_ok > 0)
- g_string_erase (string, 0, first_ok);
-
- if (last_ok < length-1)
- g_string_truncate (string, last_ok - first_ok +1);
-
-}
diff --git a/camel/gstring-util.h b/camel/gstring-util.h
deleted file mode 100644
index 10bbac3a56..0000000000
--- a/camel/gstring-util.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* gstring-util : utilities for gstring object */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 GSTRING_UTIL_H
-#define GSTRING_UTIL_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-
-typedef enum {
- GSTRING_DICHOTOMY_NONE = 0,
- GSTRING_DICHOTOMY_RIGHT_DIR = 1,
- GSTRING_DICHOTOMY_STRIP_TRAILING = 2,
- GSTRING_DICHOTOMY_STRIP_LEADING = 4
-
-} GStringDichotomyOption;
-
-typedef enum {
- GSTRING_TRIM_NONE = 0,
- GSTRING_TRIM_STRIP_TRAILING = 1,
- GSTRING_TRIM_STRIP_LEADING = 2
-} GStringTrimOption;
-
-
-gboolean g_string_equals (GString *string1, GString *string2);
-GString *g_string_clone (GString *string);
-gchar g_string_dichotomy (GString *string, gchar sep,
- GString **prefix, GString **suffix,
- GStringDichotomyOption options);
-void g_string_append_g_string (GString *dest_string,
- GString *other_string);
-
-gboolean g_string_equal_for_hash (gconstpointer v, gconstpointer v2);
-gboolean g_string_equal_for_glist (gconstpointer v, gconstpointer v2);
-guint g_string_hash (gconstpointer v);
-void g_string_list_free (GList *string_list);
-
-GList *g_string_split (GString *string, char sep,
- gchar *trim_chars, GStringTrimOption trim_options);
-void g_string_trim (GString *string, gchar *chars,
- GStringTrimOption options);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* GSTRING_UTIL_H */
diff --git a/camel/hash-table-utils.c b/camel/hash-table-utils.c
deleted file mode 100644
index cbd75296dd..0000000000
--- a/camel/hash-table-utils.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* generic utilities for hash tables */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 "glib.h"
-#include "hash-table-utils.h"
-
-
-/*
- * free a (key/value) hash table pair.
- * to be called in a g_hash_table_foreach()
- * before g_hash_table_destroy().
- */
-void
-g_hash_table_generic_free (gpointer key, gpointer value, gpointer user_data)
-{
- g_free (key);
- g_free (value);
-}
-
-
-
-/***/
-/* use these two funcs for case insensitive hash table */
-
-gint
-g_strcase_equal (gconstpointer a, gconstpointer b)
-{
- return (g_strcasecmp ((gchar *)a, (gchar *)b) == 0);
-}
-
-
-/* modified g_str_hash from glib/gstring.c
- because it would have been too slow to
- us g_strdown() on the string */
-/* a char* hash function from ASU */
-guint
-g_strcase_hash (gconstpointer v)
-{
- const char *s = (char*)v;
- const char *p;
- guint h=0, g;
-
- for(p = s; *p != '\0'; p += 1) {
- h = ( h << 4 ) + toupper(*p);
- if ( ( g = h & 0xf0000000 ) ) {
- h = h ^ (g >> 24);
- h = h ^ g;
- }
- }
-
- return h /* % M */;
-}
-
-
-
-/***/
diff --git a/camel/hash-table-utils.h b/camel/hash-table-utils.h
deleted file mode 100644
index 99d33f59a0..0000000000
--- a/camel/hash-table-utils.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* generic utilities for hash tables */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 HASH_TABLE_UTILS_H
-#define HASH_TABLE_UTILS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-void g_hash_table_generic_free (gpointer key, gpointer value, gpointer user_data);
-
-gint g_strcase_equal (gconstpointer a, gconstpointer b);
-guint g_strcase_hash (gconstpointer v);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* HASH_TABLE_UTILS_H */
diff --git a/camel/md5-utils.c b/camel/md5-utils.c
deleted file mode 100644
index 7363eaec40..0000000000
--- a/camel/md5-utils.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to md5_init, call md5_update as
- * needed on buffers full of bytes, and then call md5_Final, which
- * will fill a supplied 16-byte array with the digest.
- */
-
-/* parts of this file are :
- * Written March 1993 by Branko Lankester
- * Modified June 1993 by Colin Plumb for altered md5.c.
- * Modified October 1995 by Erik Troan for RPM
- */
-
-
-#include "md5-utils.h"
-#include <stdio.h>
-
-static void md5_transform (guint32 buf[4], const guint32 in[16]);
-
-static gint _ie = 0x44332211;
-static union _endian { gint i; gchar b[4]; } *_endian = (union _endian *)&_ie;
-#define IS_BIG_ENDIAN() (_endian->b[0] == '\x44')
-#define IS_LITTLE_ENDIAN() (_endian->b[0] == '\x11')
-
-
-/*
- * Note: this code is harmless on little-endian machines.
- */
-static void
-_byte_reverse (guchar *buf, guint32 longs)
-{
- guint32 t;
- do {
- t = (guint32) ((guint32) buf[3] << 8 | buf[2]) << 16 |
- ((guint32) buf[1] << 8 | buf[0]);
- *(guint32 *) buf = t;
- buf += 4;
- } while (--longs);
-}
-
-/**
- * md5_init: Initialise an md5 context object
- * @ctx: md5 context
- *
- * Initialise an md5 buffer.
- *
- **/
-void
-md5_init (MD5Context *ctx)
-{
- ctx->buf[0] = 0x67452301;
- ctx->buf[1] = 0xefcdab89;
- ctx->buf[2] = 0x98badcfe;
- ctx->buf[3] = 0x10325476;
-
- ctx->bits[0] = 0;
- ctx->bits[1] = 0;
-
- if (IS_BIG_ENDIAN())
- ctx->doByteReverse = 1;
- else
- ctx->doByteReverse = 0;
-}
-
-
-
-/**
- * md5_update: add a buffer to md5 hash computation
- * @ctx: conetxt object used for md5 computaion
- * @buf: buffer to add
- * @len: buffer length
- *
- * Update context to reflect the concatenation of another buffer full
- * of bytes. Use this to progressively construct an md5 hash.
- **/
-void
-md5_update (MD5Context *ctx, const guchar *buf, guint32 len)
-{
- guint32 t;
-
- /* Update bitcount */
-
- t = ctx->bits[0];
- if ((ctx->bits[0] = t + ((guint32) len << 3)) < t)
- ctx->bits[1]++; /* Carry from low to high */
- ctx->bits[1] += len >> 29;
-
- t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
-
- /* Handle any leading odd-sized chunks */
-
- if (t) {
- guchar *p = (guchar *) ctx->in + t;
-
- t = 64 - t;
- if (len < t) {
- memcpy (p, buf, len);
- return;
- }
- memcpy (p, buf, t);
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 16);
- md5_transform (ctx->buf, (guint32 *) ctx->in);
- buf += t;
- len -= t;
- }
- /* Process data in 64-byte chunks */
-
- while (len >= 64) {
- memcpy (ctx->in, buf, 64);
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 16);
- md5_transform (ctx->buf, (guint32 *) ctx->in);
- buf += 64;
- len -= 64;
- }
-
- /* Handle any remaining bytes of data. */
-
- memcpy (ctx->in, buf, len);
-}
-
-
-
-
-
-/*
- * Final wrapup - pad to 64-byte boundary with the bit pattern
- * 1 0* (64-bit count of bits processed, MSB-first)
- */
-/**
- * md5_final: copy the final md5 hash to a bufer
- * @digest: 16 bytes buffer
- * @ctx: context containing the calculated md5
- *
- * copy the final md5 hash to a bufer
- **/
-void
-md5_final (MD5Context *ctx, guchar digest[16])
-{
- guint32 count;
- guchar *p;
-
- /* Compute number of bytes mod 64 */
- count = (ctx->bits[0] >> 3) & 0x3F;
-
- /* Set the first char of padding to 0x80. This is safe since there is
- always at least one byte free */
- p = ctx->in + count;
- *p++ = 0x80;
-
- /* Bytes of padding needed to make 64 bytes */
- count = 64 - 1 - count;
-
- /* Pad out to 56 mod 64 */
- if (count < 8) {
- /* Two lots of padding: Pad the first block to 64 bytes */
- memset (p, 0, count);
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 16);
- md5_transform (ctx->buf, (guint32 *) ctx->in);
-
- /* Now fill the next block with 56 bytes */
- memset (ctx->in, 0, 56);
- } else {
- /* Pad block to 56 bytes */
- memset (p, 0, count - 8);
- }
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 14);
-
- /* Append length in bits and transform */
- ((guint32 *) ctx->in)[14] = ctx->bits[0];
- ((guint32 *) ctx->in)[15] = ctx->bits[1];
-
- md5_transform (ctx->buf, (guint32 *) ctx->in);
- if (ctx->doByteReverse)
- _byte_reverse ((guchar *) ctx->buf, 4);
- memcpy (digest, ctx->buf, 16);
-}
-
-
-
-
-/* The four core functions - F1 is optimized somewhat */
-
-/* #define F1(x, y, z) (x & y | ~x & z) */
-#define F1(x, y, z) (z ^ (x & (y ^ z)))
-#define F2(x, y, z) F1(z, x, y)
-#define F3(x, y, z) (x ^ y ^ z)
-#define F4(x, y, z) (y ^ (x | ~z))
-
-/* This is the central step in the MD5 algorithm. */
-#define MD5STEP(f, w, x, y, z, data, s) \
- ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
-
-/*
- * The core of the MD5 algorithm, this alters an existing MD5 hash to
- * reflect the addition of 16 longwords of new data. md5_Update blocks
- * the data and converts bytes into longwords for this routine.
- */
-static void
-md5_transform (guint32 buf[4], const guint32 in[16])
-{
- register guint32 a, b, c, d;
-
- a = buf[0];
- b = buf[1];
- c = buf[2];
- d = buf[3];
-
- MD5STEP (F1, a, b, c, d, in[0] + 0xd76aa478, 7);
- MD5STEP (F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
- MD5STEP (F1, c, d, a, b, in[2] + 0x242070db, 17);
- MD5STEP (F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
- MD5STEP (F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
- MD5STEP (F1, d, a, b, c, in[5] + 0x4787c62a, 12);
- MD5STEP (F1, c, d, a, b, in[6] + 0xa8304613, 17);
- MD5STEP (F1, b, c, d, a, in[7] + 0xfd469501, 22);
- MD5STEP (F1, a, b, c, d, in[8] + 0x698098d8, 7);
- MD5STEP (F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
- MD5STEP (F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
- MD5STEP (F1, b, c, d, a, in[11] + 0x895cd7be, 22);
- MD5STEP (F1, a, b, c, d, in[12] + 0x6b901122, 7);
- MD5STEP (F1, d, a, b, c, in[13] + 0xfd987193, 12);
- MD5STEP (F1, c, d, a, b, in[14] + 0xa679438e, 17);
- MD5STEP (F1, b, c, d, a, in[15] + 0x49b40821, 22);
-
- MD5STEP (F2, a, b, c, d, in[1] + 0xf61e2562, 5);
- MD5STEP (F2, d, a, b, c, in[6] + 0xc040b340, 9);
- MD5STEP (F2, c, d, a, b, in[11] + 0x265e5a51, 14);
- MD5STEP (F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
- MD5STEP (F2, a, b, c, d, in[5] + 0xd62f105d, 5);
- MD5STEP (F2, d, a, b, c, in[10] + 0x02441453, 9);
- MD5STEP (F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
- MD5STEP (F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
- MD5STEP (F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
- MD5STEP (F2, d, a, b, c, in[14] + 0xc33707d6, 9);
- MD5STEP (F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
- MD5STEP (F2, b, c, d, a, in[8] + 0x455a14ed, 20);
- MD5STEP (F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
- MD5STEP (F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
- MD5STEP (F2, c, d, a, b, in[7] + 0x676f02d9, 14);
- MD5STEP (F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-
- MD5STEP (F3, a, b, c, d, in[5] + 0xfffa3942, 4);
- MD5STEP (F3, d, a, b, c, in[8] + 0x8771f681, 11);
- MD5STEP (F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
- MD5STEP (F3, b, c, d, a, in[14] + 0xfde5380c, 23);
- MD5STEP (F3, a, b, c, d, in[1] + 0xa4beea44, 4);
- MD5STEP (F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
- MD5STEP (F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
- MD5STEP (F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
- MD5STEP (F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
- MD5STEP (F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
- MD5STEP (F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
- MD5STEP (F3, b, c, d, a, in[6] + 0x04881d05, 23);
- MD5STEP (F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
- MD5STEP (F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
- MD5STEP (F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
- MD5STEP (F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-
- MD5STEP (F4, a, b, c, d, in[0] + 0xf4292244, 6);
- MD5STEP (F4, d, a, b, c, in[7] + 0x432aff97, 10);
- MD5STEP (F4, c, d, a, b, in[14] + 0xab9423a7, 15);
- MD5STEP (F4, b, c, d, a, in[5] + 0xfc93a039, 21);
- MD5STEP (F4, a, b, c, d, in[12] + 0x655b59c3, 6);
- MD5STEP (F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
- MD5STEP (F4, c, d, a, b, in[10] + 0xffeff47d, 15);
- MD5STEP (F4, b, c, d, a, in[1] + 0x85845dd1, 21);
- MD5STEP (F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
- MD5STEP (F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
- MD5STEP (F4, c, d, a, b, in[6] + 0xa3014314, 15);
- MD5STEP (F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
- MD5STEP (F4, a, b, c, d, in[4] + 0xf7537e82, 6);
- MD5STEP (F4, d, a, b, c, in[11] + 0xbd3af235, 10);
- MD5STEP (F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
- MD5STEP (F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-
- buf[0] += a;
- buf[1] += b;
- buf[2] += c;
- buf[3] += d;
-}
-
-
-
-
-/**
- * md5_get_digest: get the md5 hash of a buffer
- * @buffer: byte buffer
- * @buffer_size: buffer size (in bytes)
- * @digest: 16 bytes buffer receiving the hash code.
- *
- * Get the md5 hash of a buffer. The result is put in
- * the 16 bytes buffer @digest .
- **/
-void
-md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16])
-{
- MD5Context ctx;
-
- md5_init (&ctx);
- md5_update (&ctx, buffer, buffer_size);
- md5_final (&ctx, digest);
-
-}
-
-
-/**
- * md5_get_digest_from_stream: get the md5 hash of a stream
- * @stream: stream
- * @digest: 16 bytes buffer receiving the hash code.
- *
- * Get the md5 hash of a stream. The result is put in
- * the 16 bytes buffer @digest .
- **/
-void
-md5_get_digest_from_stream (CamelStream *stream, guchar digest[16])
-{
- MD5Context ctx;
- guchar tmp_buf[1024];
- gint nb_bytes_read;
-
- md5_init (&ctx);
-
- nb_bytes_read = camel_stream_read (stream, tmp_buf, 1024);
- while (nb_bytes_read) {
- md5_update (&ctx, tmp_buf, nb_bytes_read);
- nb_bytes_read = camel_stream_read (stream, tmp_buf, 1024);
- }
-
- md5_final (&ctx, digest);
-
-}
-
-
-
-
-/**
- * md5_get_digest_from_file: get the md5 hash of a file
- * @filename: file name
- * @digest: 16 bytes buffer receiving the hash code.
- *
- * Get the md5 hash of a file. The result is put in
- * the 16 bytes buffer @digest .
- **/
-void
-md5_get_digest_from_file (const gchar *filename, guchar digest[16])
-{
- MD5Context ctx;
- guchar tmp_buf[1024];
- gint nb_bytes_read;
- FILE *fp;
-
- printf("generating checksum\n");
-
- md5_init (&ctx);
- fp = fopen(filename, "r");
- if (!fp) {
- return;
- }
-
- while ((nb_bytes_read = fread (tmp_buf, sizeof (guchar), 1024, fp)) > 0)
- md5_update (&ctx, tmp_buf, nb_bytes_read);
-
- if (ferror(fp)) {
- fclose(fp);
- return;
- }
-
-
- md5_final (&ctx, digest);
-
- printf("checksum done\n");
-}
-
-
-
-
diff --git a/camel/md5-utils.h b/camel/md5-utils.h
deleted file mode 100644
index e4569dd54a..0000000000
--- a/camel/md5-utils.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to rpmMD5Init, call rpmMD5Update as
- * needed on buffers full of bytes, and then call rpmMD5Final, which
- * will fill a supplied 16-byte array with the digest.
- */
-
-/* parts of this file are :
- * Written March 1993 by Branko Lankester
- * Modified June 1993 by Colin Plumb for altered md5.c.
- * Modified October 1995 by Erik Troan for RPM
- */
-
-
-#ifndef MD5_UTILS_H
-#define MD5_UTILS_H
-
-#include <glib.h>
-#include "camel-stream.h"
-
-typedef struct {
- guint32 buf[4];
- guint32 bits[2];
- guchar in[64];
- gint doByteReverse;
-
-} MD5Context ;
-
-
-void md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16]);
-void md5_get_digest_from_stream (CamelStream *stream, guchar digest[16]);
-
-/* use this one when speed is needed */
-/* for use in provider code only */
-void md5_get_digest_from_file (const gchar *filename, guchar digest[16]);
-
-/* raw routines */
-void md5_init (MD5Context *ctx);
-void md5_update (MD5Context *ctx, const guchar *buf, guint32 len);
-void md5_final (MD5Context *ctx, guchar digest[16]);
-
-
-#endif /* MD5_UTILS_H */
diff --git a/camel/providers/.cvsignore b/camel/providers/.cvsignore
deleted file mode 100644
index b840c21800..0000000000
--- a/camel/providers/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile.in
-Makefile \ No newline at end of file
diff --git a/camel/providers/MH/.cvsignore b/camel/providers/MH/.cvsignore
deleted file mode 100644
index 2e7b174532..0000000000
--- a/camel/providers/MH/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile.in
-Makefile
-.deps
-*.lo
-*.la
-.libs
diff --git a/camel/providers/MH/Makefile.am b/camel/providers/MH/Makefile.am
deleted file mode 100644
index dab6bec199..0000000000
--- a/camel/providers/MH/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelmhincludedir = $(includedir)/camel
-
-
-lib_LTLIBRARIES = libcamelmh.la
-
-INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \
- -I$(top_srcdir)/intl \
- $(GTK_INCLUDEDIR) -I$(top_srcdir)/camel
-
-libcamelmh_la_SOURCES = \
- camel-mh-folder.c \
- camel-mh-provider.c \
- camel-mh-store.c \
- mh-summary.c \
- mh-uid.c \
- mh-utils.c
-
-libcamelmhinclude_HEADERS = \
- camel-mh-folder.h \
- camel-mh-store.h \
- mh-summary.c \
- mh-uid.h \
- mh-utils.h
-
-
-libcamelmh_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-
-EXTRA_DIST =
diff --git a/camel/providers/MH/camel-mh-folder.c b/camel/providers/MH/camel-mh-folder.c
deleted file mode 100644
index 86bbab46ba..0000000000
--- a/camel/providers/MH/camel-mh-folder.c
+++ /dev/null
@@ -1,1022 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-folder.c : Abstract class for an email folder */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 <sys/stat.h>
-#include <sys/param.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include "camel-mh-folder.h"
-#include "camel-mh-store.h"
-#include "gstring-util.h"
-#include "camel-log.h"
-#include "camel-stream-fs.h"
-#include "camel-stream-buffered-fs.h"
-#include "camel-folder-summary.h"
-#include "gmime-utils.h"
-#include "mh-utils.h"
-#include "mh-uid.h"
-#include "mh-summary.h"
-
-
-static CamelFolderClass *parent_class=NULL;
-
-/* Returns the class for a CamelMhFolder */
-#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMHS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void _set_name(CamelFolder *folder, const gchar *name, CamelException *ex);
-static void _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _create(CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean _delete_messages (CamelFolder *folder, CamelException *ex);
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message (CamelFolder *folder, gint number, CamelException *ex);
-static gint _get_message_count (CamelFolder *folder, CamelException *ex);
-static gint _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static void _expunge (CamelFolder *folder, CamelException *ex);
-static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex);
-static void _open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex);
-static void _close (CamelFolder *folder, gboolean expunge, CamelException *ex);
-
-static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-static GList *_get_uid_list (CamelFolder *folder, CamelException *ex);
-
-/* some utility functions */
-static int copy_reg (const char *src_path, const char *dst_path, CamelException *ex);
-
-static void
-camel_mh_folder_class_init (CamelMhFolderClass *camel_mh_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_mh_folder_class);
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_folder_class->init_with_store = _init_with_store;
- camel_folder_class->set_name = _set_name;
- camel_folder_class->exists = _exists;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->list_subfolders = _list_subfolders;
- camel_folder_class->get_message = _get_message;
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->append_message = _append_message;
- camel_folder_class->expunge = _expunge;
- camel_folder_class->copy_message_to = _copy_message_to;
- camel_folder_class->open = _open;
- camel_folder_class->close = _close;
- camel_folder_class->get_message_uid = _get_message_uid;
- camel_folder_class->get_message_by_uid = _get_message_by_uid;
- camel_folder_class->get_uid_list = _get_uid_list;
-
-}
-
-
-
-
-
-
-
-GtkType
-camel_mh_folder_get_type (void)
-{
- static GtkType camel_mh_folder_type = 0;
-
- if (!camel_mh_folder_type) {
- GtkTypeInfo camel_mh_folder_info =
- {
- "CamelMhFolder",
- sizeof (CamelMhFolder),
- sizeof (CamelMhFolderClass),
- (GtkClassInitFunc) camel_mh_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mh_folder_type = gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_mh_folder_info);
- }
-
- return camel_mh_folder_type;
-}
-
-
-
-static gint
-_message_name_compare (gconstpointer a, gconstpointer b)
-{
- gchar *m1 = (gchar *)a;
- gchar *m2 = (gchar *)b;
- gint len_diff;
-
- return (atoi (m1) - atoi (m2));
-}
-
-
-static void
-_init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex)
-{
- /* call parent method */
- parent_class->init_with_store (folder, parent_store, ex);
-
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- folder->has_summary_capability = TRUE;
- folder->has_uid_capability = TRUE;
-
- folder->summary = NULL;
-
-}
-
-
-
-static void
-_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- struct dirent *dir_entry;
- DIR *dir_handle;
-
-
- if (folder->open_state == FOLDER_OPEN) return;
-
-
- /* create message list */
- /* read the whole folder and sort message names */
- dir_handle = opendir (mh_folder->directory_path);
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while (dir_entry != NULL) {
- /* tests if the entry correspond to a message file */
- if (mh_is_a_message_file (dir_entry->d_name, mh_folder->directory_path))
- /* add the file name to the list */
- mh_folder->file_name_list = g_list_insert_sorted (mh_folder->file_name_list,
- g_strdup (dir_entry->d_name),
- _message_name_compare);
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- /* get (or create) uid list */
- if (!(mh_load_uid_list (mh_folder) > 0))
- mh_generate_uid_list (mh_folder);
-
- /* get or create summary */
- /* it is important that it comes after uid list reading/generation */
- if (!(mh_load_summary (mh_folder) > 0))
- mh_generate_summary (folder);
- printf ("**** summary = %p\n", folder->summary);
-
-}
-
-
-
-static void
-_close (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
-
- /* save uid list, if any */
- if (mh_folder->uid_array)
- mh_save_uid_list (mh_folder);
-
- /* save summary, if any */
- if (folder->summary)
- mh_save_summary (mh_folder);
-
- /* call parent implementation */
- parent_class->close (folder, expunge, ex);
-}
-
-
-
-
-
-/**
- * camel_mh_folder_set_name: set the name of an MH folder
- * @folder: the folder to set the name
- * @name: a string representing the (short) name
- *
- *
- *
- **/
-static void
-_set_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- const gchar *root_dir_path;
- gchar *full_name;
- const gchar *parent_full_name;
- gchar separator;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMhFolder::set_name\n");
- g_assert (folder);
- g_assert (name);
- g_assert (folder->parent_store);
-
- /* call default implementation */
- parent_class->set_name (folder, name, ex);
-
- if (mh_folder->directory_path) g_free (mh_folder->directory_path);
-
- separator = camel_store_get_separator (folder->parent_store);
- root_dir_path = camel_mh_store_get_toplevel_dir (CAMEL_MH_STORE(folder->parent_store));
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::set_name full_name is %s\n", folder->full_name);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::set_name root_dir_path is %s\n", root_dir_path);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::separator is %c\n", separator);
-
- mh_folder->directory_path = g_strdup_printf ("%s%c%s", root_dir_path, separator, folder->full_name);
-
- if (!camel_folder_exists (folder, ex)) return;
-
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::set_name mh_folder->directory_path is %s\n",
- mh_folder->directory_path);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMhFolder::set_name\n");
-}
-
-
-
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- struct stat stat_buf;
- gint stat_error;
- gboolean exists;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMhFolder::exists\n");
- g_assert (folder);
-
- if (!mh_folder->directory_path) return FALSE;
-
- stat_error = stat (mh_folder->directory_path, &stat_buf);
- if (stat_error == -1) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::exists when executing stat on %s, stat_error = %d\n",
- mh_folder->directory_path, stat_error);
- CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
- return FALSE;
- }
- exists = S_ISDIR (stat_buf.st_mode);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMhFolder::exists\n");
- return exists;
-}
-
-
-static gboolean
-_create (CamelFolder *folder, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- mode_t dir_mode = S_IRWXU;
- gint mkdir_error;
-
- g_assert(folder);
-
- /* call default implementation */
- parent_class->create (folder, ex);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return FALSE;
-
- if (camel_folder_exists (folder, ex)) return TRUE;
-
- mkdir_error = mkdir (directory_path, dir_mode);
- return (mkdir_error == -1);
-}
-
-
-
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
-
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- gint rmdir_error = 0;
-
- g_assert(folder);
-
- /* call default implementation */
- parent_class->delete (folder, recurse, ex);
- /* the default implementation will care about deleting
- messages first and recursing the operation if
- necessary */
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return FALSE;
-
- if (!camel_folder_exists (folder, ex)) return TRUE;
-
- /* physically delete the directory */
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::delete removing directory %s\n", directory_path);
- rmdir_error = rmdir (directory_path);
- if (rmdir_error == -1) {
- CAMEL_LOG_WARNING ("CamelMhFolder::delete Error when removing directory %s\n", directory_path);
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
- }
-
- return (rmdir_error != -1);
-}
-
-
-static gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
-
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- struct stat stat_buf;
- gint stat_error = 0;
- gchar *entry_name;
- struct dirent *dir_entry;
- gint unlink_error = 0;
- DIR *dir_handle;
-
- g_assert(folder);
-
- /* call default implementation */
- parent_class->delete_messages (folder, ex);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return FALSE;
-
- if (!camel_folder_exists (folder, ex)) return TRUE;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while ((stat_error != -1) && (unlink_error != -1) && (dir_entry != NULL)) {
-
- /* get the name of the next entry in the dir */
- entry_name = dir_entry->d_name;
- stat_error = stat (mh_folder->directory_path, &stat_buf);
-
- /* is it a regular file ? */
- if ((stat_error != -1) && S_ISREG(stat_buf.st_mode)) {
- /* yes, delete it */
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::delete_messages removing file %s\n", entry_name);
- unlink_error = unlink(entry_name);
-
- if (unlink_error == -1) {
- CAMEL_LOG_WARNING ("CamelMhFolder::delete_messages Error when deleting file %s\n",
- entry_name);
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
- }
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- return ((stat_error != -1) && (unlink_error != -1));
-
-}
-
-
-
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- GList *subfolder_name_list = NULL;
-
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- struct stat stat_buf;
- gint stat_error = 0;
- GList *file_list;
- gchar *entry_name;
- gchar *full_entry_name;
- struct dirent *dir_entry;
- DIR *dir_handle;
-
- g_assert(folder);
-
- /* call default implementation */
- parent_class->delete_messages (folder, ex);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return NULL;
-
- if (!camel_folder_exists (folder, ex)) return NULL;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while ((stat_error != -1) && (dir_entry != NULL)) {
-
- /* get the name of the next entry in the dir */
- entry_name = dir_entry->d_name;
- full_entry_name = g_strdup_printf ("%s/%s", mh_folder->directory_path, entry_name);
- stat_error = stat (full_entry_name, &stat_buf);
- g_free (full_entry_name);
-
- /* is it a directory ? */
- if ((stat_error != -1) && S_ISDIR (stat_buf.st_mode)) {
- /* yes, add it to the list */
- if (entry_name[0] != '.') {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::list_subfolders adding %s\n", entry_name);
- subfolder_name_list = g_list_append (subfolder_name_list, g_strdup (entry_name));
- }
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- return subfolder_name_list;
-}
-
-
-
-
-
-static void
-_filename_free (gpointer data)
-{
- g_free ((gchar *)data);
-}
-
-
-/* slow routine, may be optimixed, or we should use
- caches if users complain */
-static CamelMimeMessage *
-_get_message (CamelFolder *folder, gint number, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- gchar *message_name;
- gchar *message_file_name;
- CamelStream *input_stream = NULL;
- CamelMimeMessage *message = NULL;
- GList *message_list = NULL;
-
- g_assert(folder);
-
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return NULL;
-
-
-
- message_name = g_list_nth_data (mh_folder->file_name_list, number);
-
- if (message_name != NULL) {
- CAMEL_LOG_FULL_DEBUG ("CanelMhFolder::get_message message number = %d, name = %s\n",
- number, message_name);
- message_file_name = g_strdup_printf ("%s/%s", directory_path, message_name);
- input_stream = camel_stream_buffered_fs_new_with_name (message_file_name, CAMEL_STREAM_BUFFERED_FS_READ);
-
- if (input_stream != NULL) {
-#warning use session field here
- message = camel_mime_message_new_with_session ( (CamelSession *)NULL);
- camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (message), input_stream);
- gtk_object_unref (GTK_OBJECT (input_stream));
- message->message_number = number;
- gtk_object_set_data_full (GTK_OBJECT (message), "filename",
- g_strdup (message_name), _filename_free);
-
-#warning Set flags and all this stuff here
- }
- g_free (message_file_name);
- } else
- CAMEL_LOG_FULL_DEBUG ("CanelMhFolder::get_message message number = %d, not found\n", number);
-
-
- return message;
-}
-
-
-
-static gint
-_get_message_count (CamelFolder *folder, CamelException *ex)
-{
-
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- struct dirent *dir_entry;
- DIR *dir_handle;
- guint message_count = 0;
-
- g_assert(folder);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return -1;
-
- if (!camel_folder_exists (folder, ex)) return 0;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while (dir_entry != NULL) {
- /* tests if the entry correspond to a message file */
- if (mh_is_a_message_file (dir_entry->d_name, directory_path))
- message_count++;
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::get_message_count found %d messages\n", message_count);
- return message_count;
-}
-
-
-
-static gboolean
-_find_next_free_message_file (CamelFolder *folder, gint *new_msg_number, gchar **new_msg_filename, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- struct dirent *dir_entry;
- DIR *dir_handle;
- gint last_max_message_number = 0;
- gint current_message_number;
-
- g_assert(folder);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return FALSE;
-
- if (!camel_folder_exists (folder, ex)) return FALSE;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while (dir_entry != NULL) {
- /* tests if the entry correspond to a message file */
- if (mh_is_a_message_file (dir_entry->d_name, directory_path)) {
- /* see if the message number is the biggest found */
- current_message_number = atoi (dir_entry->d_name);
- if (current_message_number > last_max_message_number)
- last_max_message_number = current_message_number;
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
- closedir (dir_handle);
-
- *new_msg_number = last_max_message_number + 1;
- *new_msg_filename = g_strdup_printf ("%s/%d", directory_path, *new_msg_number);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::find_next_free_message_file new message path is %s\n",
- *new_msg_filename);
- return TRUE;
-
-
-}
-static gint
-_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- guint new_msg_number;
- gchar *new_msg_filename;
- CamelStream *output_stream;
- gboolean error;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMhFolder::append_message\n");
- if (!_find_next_free_message_file (folder, &new_msg_number, &new_msg_filename, ex))
- return -1;
-
- output_stream = camel_stream_fs_new_with_name (new_msg_filename, CAMEL_STREAM_FS_WRITE);
- if (output_stream != NULL) {
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream);
- camel_stream_close (output_stream);
- } else {
- CAMEL_LOG_WARNING ("CamelMhFolder::append_message could not open %s for writing\n",
- new_msg_filename);
- CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
- error = TRUE;
- }
-
- g_free (new_msg_filename);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMhFolder::append_message\n");
- if (error) return -1;
- else return new_msg_number;
-}
-
-
-
-
-
-static void
-_expunge (CamelFolder *folder, CamelException *ex)
-{
- /* For the moment, we look in the folder active message
- * list. I did not make my mind for the moment, should
- * the gtk_object->destroy signal be used to expunge
- * freed messages objects marked DELETED ?
- */
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- CamelMimeMessage *message;
- GList *message_node;
- gchar *fullpath;
- gchar *filename;
- gint unlink_error;
- const gchar *directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelFolder::expunge\n");
-
- message_node = folder->message_list;
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return;
-
- /* look in folder message list which messages
- * need to be expunged */
- while ( message_node) {
- message = CAMEL_MIME_MESSAGE (message_node->data);
-
- if (message && camel_mime_message_get_flag (message, "DELETED")) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::expunge, expunging message %d\n", message->message_number);
- /* expunge the message */
- filename = gtk_object_get_data (GTK_OBJECT (message), "filename");
- fullpath = g_strdup_printf ("%s/%s", directory_path, filename);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::expunge, message fullpath is %s\n",
- fullpath);
- unlink_error = unlink(fullpath);
- if (unlink_error != -1) {
- message->expunged = TRUE;
- } else {
- CAMEL_LOG_WARNING ("CamelMhFolder:: could not unlink %s (message %d)\n",
- fullpath, message->message_number);
- CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
- }
- }
- message_node = message_node->next;
- CAMEL_LOG_FULL_DEBUG ("CamelFolder::expunge, examined message node %p\n", message_node);
- }
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolder::expunge\n");
-}
-
-
-static void
-_copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex)
-{
- gchar *src_msg_filename;
- guint dest_msg_number;
- gchar *dest_msg_filename;
-
- if (IS_CAMEL_MH_FOLDER (dest_folder)) {
- /*g_return_if_fail (message->parent_folder == folder);*/
-
- if (!_find_next_free_message_file (dest_folder, &dest_msg_number, &dest_msg_filename, ex))
- return;
- src_msg_filename = gtk_object_get_data (GTK_OBJECT (message), "fullpath");
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::copy_to copy file %s to %s\n", src_msg_filename, dest_msg_filename);
- copy_reg (src_msg_filename, dest_msg_filename, ex);
-
- } else
- parent_class->copy_message_to (folder, message, dest_folder, ex);
-}
-
-
-
-/** UID **/
-
-static const gchar *
-_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- GArray *uid_array;
- gboolean found = FALSE;
- MhUidCouple *uid_couple;
- gchar *filename;
- guint file_number;
- gint i;
-
- /* if the message already has its uid stored,
- return it */
- if (message->message_uid)
- return (message->message_uid);
-
- /* else, it has a filename associated to it */
- filename = gtk_object_get_data (GTK_OBJECT (message), "filename");
- file_number = atoi (file_number);
-
- uid_array = mh_folder->uid_array;
- uid_couple = (MhUidCouple *)uid_array->data;
-
- /* look in the uid array for the file number */
- found = (uid_couple->file_number == file_number);
- for (i=0; (i<uid_array->len) && (!found); i++) {
- uid_couple++;
- found = (uid_couple->file_number == file_number);
- }
-
- if (found) return uid_couple->uid;
- else return NULL;
-
-}
-
-
-static CamelMimeMessage *
-_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- GArray *uid_array;
- gboolean found = FALSE;
- MhUidCouple *uid_couple;
- gint file_number;
- gchar *filename;
- CamelMimeMessage *message = NULL;
- CamelStream *input_stream;
- int i;
-
- /*
- * because they are constructed with md5
- * signatures, all MH uids are 16 bytes long
- */
- if (strlen (uid) != 16) return NULL;
-
- uid_array = mh_folder->uid_array;
- uid_couple = (MhUidCouple *)uid_array->data;
-
- found = !strncmp (uid, uid_couple->uid, 16 * sizeof (guchar));
- for (i=0; (i<uid_array->len) && (!found); i++) {
- uid_couple++;
- found = !strncmp (uid, uid_couple->uid, 16 * sizeof (guchar));
- }
- if (found) {
- /* physically retrieve the message */
- file_number = uid_couple->file_number;
- filename = g_strdup_printf ("%d", file_number);
- input_stream = camel_stream_buffered_fs_new_with_name (filename, CAMEL_STREAM_BUFFERED_FS_READ);
-
- if (input_stream != NULL) {
-#warning use session field here
- message = camel_mime_message_new_with_session ( (CamelSession *)NULL);
- camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (message), input_stream);
- gtk_object_unref (GTK_OBJECT (input_stream));
-
- /* set message UID in CamelMimeMessage */
- message->message_uid = g_strdup (uid);
-
- }
- g_free (filename);
- }
-
- return message;
-
-}
-
-static GList *
-_get_uid_list (CamelFolder *folder, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- GList *uid_list;
- GArray *uid_array;
- MhUidCouple *uid_couple;
- int i;
-
- uid_array = mh_folder->uid_array;
- uid_couple = (MhUidCouple *)uid_array->data;
-
- for (i=0; i<uid_array->len; i++) {
- uid_list = g_list_prepend (uid_list, uid_couple->uid);
- uid_couple++;
- }
-
- return uid_list;
-}
-
-
-
-
-
-
-
-
-/************************************************************************/
-
-/*** Took directly from GNU fileutils-4.0 ***/
-/* Copyright (C) 89, 90, 91, 95, 96, 97, 1998 Free Software Foundation. */
-/* This may be rwritten soon. -Bertrand */
-
-
-/* Write LEN bytes at PTR to descriptor DESC, retrying if interrupted.
- Return LEN upon success, write's (negative) error code otherwise. */
-int
-full_write (int desc, const char *ptr, size_t len)
-{
- int total_written;
-
- total_written = 0;
- while (len > 0)
- {
- int written = write (desc, ptr, len);
- if (written < 0)
- {
- if (errno == EINTR)
- continue;
- return written;
- }
- total_written += written;
- ptr += written;
- len -= written;
- }
- return total_written;
-}
-
-
-
-
-static int
-copy_reg (const char *src_path, const char *dst_path, CamelException *ex)
-{
- char *buf;
- int buf_size;
- int dest_desc;
- int source_desc;
- int n_read;
- struct stat sb;
- char *cp;
- int *ip;
- int return_val = 0;
- off_t n_read_total = 0;
- int last_write_made_hole = 0;
- int make_holes = TRUE;
-
- source_desc = open (src_path, O_RDONLY);
- if (source_desc < 0)
- {
- /* If SRC_PATH doesn't exist, then chances are good that the
- user did something like this `cp --backup foo foo': and foo
- existed to start with, but copy_internal renamed DST_PATH
- with the backup suffix, thus also renaming SRC_PATH. */
- if (errno == ENOENT)
- error (0, 0, "`%s' and `%s' are the same file",
- src_path, dst_path);
- else
- error (0, errno, "%s", src_path);
-
- return -1;
- }
-
- /* Create the new regular file with small permissions initially,
- to not create a security hole. */
-
- dest_desc = open (dst_path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
- if (dest_desc < 0)
- {
- error (0, errno, "cannot create regular file `%s'", dst_path);
- return_val = -1;
- goto ret2;
- }
-
- /* Find out the optimal buffer size. */
-
- if (fstat (dest_desc, &sb))
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- goto ret;
- }
-
- buf_size = 8192;
-
-
-
- /* Make a buffer with space for a sentinel at the end. */
-
- buf = (char *) alloca (buf_size + sizeof (int));
-
- for (;;)
- {
- n_read = read (source_desc, buf, buf_size);
- if (n_read < 0)
- {
- if (errno == EINTR)
- continue;
- error (0, errno, "%s", src_path);
- return_val = -1;
- goto ret;
- }
- if (n_read == 0)
- break;
-
- n_read_total += n_read;
-
- ip = 0;
- if (make_holes)
- {
- buf[n_read] = 1; /* Sentinel to stop loop. */
-
- /* Find first nonzero *word*, or the word with the sentinel. */
-
- ip = (int *) buf;
- while (*ip++ == 0)
- ;
-
- /* Find the first nonzero *byte*, or the sentinel. */
-
- cp = (char *) (ip - 1);
- while (*cp++ == 0)
- ;
-
- /* If we found the sentinel, the whole input block was zero,
- and we can make a hole. */
-
- if (cp > buf + n_read)
- {
- /* Make a hole. */
- if (lseek (dest_desc, (off_t) n_read, SEEK_CUR) < 0L)
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- goto ret;
- }
- last_write_made_hole = 1;
- }
- else
- /* Clear to indicate that a normal write is needed. */
- ip = 0;
- }
- if (ip == 0)
- {
- if (full_write (dest_desc, buf, n_read) < 0)
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- goto ret;
- }
- last_write_made_hole = 0;
- }
- }
-
- /* If the file ends with a `hole', something needs to be written at
- the end. Otherwise the kernel would truncate the file at the end
- of the last write operation. */
-
- if (last_write_made_hole)
- {
-#if HAVE_FTRUNCATE
- /* Write a null character and truncate it again. */
- if (full_write (dest_desc, "", 1) < 0
- || ftruncate (dest_desc, n_read_total) < 0)
-#else
- /* Seek backwards one character and write a null. */
- if (lseek (dest_desc, (off_t) -1, SEEK_CUR) < 0L
- || full_write (dest_desc, "", 1) < 0)
-#endif
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- }
- }
-
-ret:
- if (close (dest_desc) < 0)
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- }
-ret2:
- if (close (source_desc) < 0)
- {
- error (0, errno, "%s", src_path);
- return_val = -1;
- }
-
- return return_val;
-}
diff --git a/camel/providers/MH/camel-mh-folder.h b/camel/providers/MH/camel-mh-folder.h
deleted file mode 100644
index 40800375eb..0000000000
--- a/camel/providers/MH/camel-mh-folder.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-folder.h : Abstract class for an email folder */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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_MH_FOLDER_H
-#define CAMEL_MH_FOLDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-folder.h"
-/* #include "camel-store.h" */
-
-#define CAMEL_MH_FOLDER_TYPE (camel_mh_folder_get_type ())
-#define CAMEL_MH_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_MH_FOLDER_TYPE, CamelMhFolder))
-#define CAMEL_MH_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MH_FOLDER_TYPE, CamelMhFolderClass))
-#define IS_CAMEL_MH_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_MH_FOLDER_TYPE))
-
-
-typedef struct {
- CamelFolder parent_object;
-
- gchar *directory_path;
- GList *file_name_list;
- GArray *uid_array;
-
-} CamelMhFolder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMhFolderClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mh_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MH_FOLDER_H */
diff --git a/camel/providers/MH/camel-mh-provider.c b/camel/providers/MH/camel-mh-provider.c
deleted file mode 100644
index 316b8a0797..0000000000
--- a/camel/providers/MH/camel-mh-provider.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-provider.c: mh provider registration code */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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-mh-store.h"
-#include "camel-provider.h"
-#include "camel-log.h"
-
-
-static CamelProvider _mh_provider = {
- (GtkType) 0,
- PROVIDER_STORE,
- "mh",
- "Camel default mh provider",
- "This is a very simple provider, mh is a bad protocol anyway",
- (GModule *) NULL
-};
-
-
-
-CamelProvider *
-camel_provider_module_init ()
-{
- _mh_provider.object_type = camel_mh_store_get_type();
- return &_mh_provider;
-}
diff --git a/camel/providers/MH/camel-mh-store.c b/camel/providers/MH/camel-mh-store.c
deleted file mode 100644
index 60ba07f47b..0000000000
--- a/camel/providers/MH/camel-mh-store.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-store.c : class for an mh store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 "camel-mh-store.h"
-#include "camel-mh-folder.h"
-#include "url-util.h"
-
-static CamelStoreClass *parent_class=NULL;
-
-/* Returns the class for a CamelMhStore */
-#define CMHS_CLASS(so) CAMEL_MH_STORE_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-static void _init (CamelStore *store, CamelSession *session, const gchar *url_name);
-static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name);
-
-
-static void
-camel_mh_store_class_init (CamelMhStoreClass *camel_mh_store_class)
-{
- CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_mh_store_class);
-
- parent_class = gtk_type_class (camel_store_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_store_class->init = _init;
- camel_store_class->get_folder = _get_folder;
-}
-
-
-
-static void
-camel_mh_store_init (gpointer object, gpointer klass)
-{
- CamelMhStore *mh_store = CAMEL_MH_STORE (object);
- CamelStore *store = CAMEL_STORE (object);
-
- store->separator = '/';
-}
-
-
-
-
-GtkType
-camel_mh_store_get_type (void)
-{
- static GtkType camel_mh_store_type = 0;
-
- if (!camel_mh_store_type) {
- GtkTypeInfo camel_mh_store_info =
- {
- "CamelMhStore",
- sizeof (CamelMhStore),
- sizeof (CamelMhStoreClass),
- (GtkClassInitFunc) camel_mh_store_class_init,
- (GtkObjectInitFunc) camel_mh_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mh_store_type = gtk_type_unique (CAMEL_STORE_TYPE, &camel_mh_store_info);
- }
-
- return camel_mh_store_type;
-}
-
-
-
-
-/* These evil public functions are here for test only */
-void
-camel_mh_store_set_toplevel_dir (CamelMhStore *store, const gchar *toplevel)
-{
- store->toplevel_dir = g_strdup (toplevel);
- CAMEL_STORE(store)->separator = '/';
-}
-
-
-const gchar *
-camel_mh_store_get_toplevel_dir (CamelMhStore *store)
-{
- return store->toplevel_dir;
-}
-
-
-
-static void
-_init (CamelStore *store, CamelSession *session, const gchar *url_name)
-{
- CamelMhStore *mh_store = CAMEL_MH_STORE (store);
- Gurl *store_url;
-
- g_assert (url_name);
- /* call parent implementation */
- parent_class->init (store, session, url_name);
-
-
- /* find the path in the URL*/
- store_url = g_url_new (url_name);
-
- g_return_if_fail (store_url);
- g_return_if_fail (store_url->path);
-
- mh_store->toplevel_dir = g_strdup (store_url->path);
- g_url_free (store_url);
-
-
-
-}
-
-
-static CamelFolder *
-_get_folder (CamelStore *store, const gchar *folder_name)
-{
- CamelMhFolder *new_mh_folder;
- CamelFolder *new_folder;
-
- /* check if folder has already been created */
- /* call the standard routine for that when */
- /* it is done ... */
-
- new_mh_folder = gtk_type_new (CAMEL_MH_FOLDER_TYPE);
- new_folder = CAMEL_FOLDER (new_mh_folder);
-
- CF_CLASS (new_folder)->init_with_store (new_folder, store, NULL);
- CF_CLASS (new_folder)->set_name (new_folder, folder_name, NULL);
-
-
- return new_folder;
-}
diff --git a/camel/providers/MH/camel-mh-store.h b/camel/providers/MH/camel-mh-store.h
deleted file mode 100644
index 924a5a6fc5..0000000000
--- a/camel/providers/MH/camel-mh-store.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mhstore.h : class for an mh store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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_MH_STORE_H
-#define CAMEL_MH_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-store.h"
-
-#define CAMEL_MH_STORE_TYPE (camel_mh_store_get_type ())
-#define CAMEL_MH_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_MH_STORE_TYPE, CamelMhStore))
-#define CAMEL_MH_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MH_STORE_TYPE, CamelMhStoreClass))
-#define IS_CAMEL_MH_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_MH_STORE_TYPE))
-
-
-typedef struct {
- CamelStore parent_object;
-
- gchar *toplevel_dir;
-} CamelMhStore;
-
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-
-} CamelMhStoreClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mh_store_get_type (void);
-
-void camel_mh_store_set_toplevel_dir (CamelMhStore *store, const gchar *toplevel);
-const gchar *camel_mh_store_get_toplevel_dir (CamelMhStore *store);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MH_STORE_H */
-
-
diff --git a/camel/providers/MH/mh-summary.c b/camel/providers/MH/mh-summary.c
deleted file mode 100644
index 5a964696e0..0000000000
--- a/camel/providers/MH/mh-summary.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 "mh-uid.h"
-#include "camel-log.h"
-#include "camel-stream.h"
-#include "camel-stream-fs.h"
-#include "camel-stream-buffered-fs.h"
-#include "gmime-utils.h"
-#include "mh-utils.h"
-
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-void
-mh_generate_summary (CamelFolder *folder)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- CamelFolderSummary *summary;
- CamelMessageInfo *message_info;
- CamelFolderInfo *subfolder_info;
- CamelStream *message_stream;
- guint file_number;
- gchar *message_fullpath;
- gchar *directory_path;
- GArray *header_array;
- MhUidCouple *uid_couple;
- Rfc822Header *cur_header;
- int i;
- int n_file;
- GArray *uid_array;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary entering \n");
-
- g_assert (folder);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary folder has no directory path\n");
- return;
- }
-
- summary = camel_folder_summary_new ();
- folder->summary = summary;
-
- uid_array = mh_folder->uid_array;
-
- if (!uid_array) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary "
- "no uid list, that probably means there is "
- "no message in this folder, exiting \n");
- return;
- }
- uid_couple = (MhUidCouple *)uid_array->data;
-
- for (n_file=0; n_file<uid_array->len; n_file++) {
-
- file_number = uid_couple->file_number;
-
- message_info = g_new0 (CamelMessageInfo, 1);
- message_info->uid = g_new0 (guchar, 17);
- strncpy (message_info->uid, uid_couple->uid, 16);
-
-
- message_fullpath = g_strdup_printf ("%s/%d", directory_path, file_number);
- message_stream = camel_stream_buffered_fs_new_with_name (message_fullpath,
- CAMEL_STREAM_BUFFERED_FS_READ);
- if (!message_stream) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary "
- "could not open %d for reading\n", message_fullpath);
- g_free (message_fullpath);
- return;
- }
- g_free (message_fullpath);
-
- header_array = get_header_array_from_stream (message_stream);
- gtk_object_unref (GTK_OBJECT (message_stream));
-
- for (i=0; i<header_array->len; i++) {
- cur_header = (Rfc822Header *)header_array->data + i;
- if (!g_strcasecmp (cur_header->name, "subject")) {
- message_info->subject = cur_header->value;
- g_free (cur_header->name);
- } else if (!g_strcasecmp (cur_header->name, "sender")) {
- message_info->date = cur_header->value;
- g_free (cur_header->name);
- } else if (!g_strcasecmp (cur_header->name, "date")) {
- message_info->date = cur_header->value;
- g_free (cur_header->name);
- } else {
- g_free (cur_header->name);
- g_free (cur_header->value);
- }
- }
- g_array_free (header_array, TRUE);
-
- summary->message_info_list = g_list_append (summary->message_info_list, message_info);
-
- /* next message in the uid list */
- uid_couple++;
- }
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary leaving \n");
-
-}
-
-
-void
-mh_save_summary (CamelMhFolder *mh_folder)
-{
- GArray *uid_array;
- MhUidCouple *first_uid_couple;
- CamelFolderSummary *summary;
- GList *msg_info_list;
- CamelMessageInfo *msg_info;
- gchar *directory_path = mh_folder->directory_path;
- gchar *summary_file_path;
- gint fd;
- gint i;
- gint field_lgth;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::save_summary entering \n");
-
- summary = CAMEL_FOLDER (mh_folder)->summary;
- if (!summary) return;
-
- summary_file_path = g_strdup_printf ("%s/%s", directory_path, ".camel-summary");
- CAMEL_LOG_FULL_DEBUG ("In the process of writing %s\n", summary_file_path);
- fd = open (summary_file_path, O_WRONLY | O_CREAT );
-
- if (!fd) {
- CAMEL_LOG_FULL_DEBUG ("could not open file %s for writing. Exiting.\n", summary_file_path);
- g_free (summary_file_path);
- return;
- }
- g_free (summary_file_path);
-
- msg_info_list = summary->message_info_list;
- while (msg_info_list) {
- msg_info = msg_info_list->data;
- /* write subject */
- field_lgth = msg_info->subject ? strlen (msg_info->subject) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->subject, field_lgth);
-
- /* write uid */
- field_lgth = msg_info->uid ? strlen (msg_info->uid) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->uid, field_lgth);
-
- /* write date */
- field_lgth = msg_info->date ? strlen (msg_info->date) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->date, field_lgth);
-
- /* write sender */
- field_lgth = msg_info->sender ? strlen (msg_info->sender) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->sender, field_lgth);
-
- msg_info_list = msg_info_list->next;
-
- }
-
- close (fd);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::save_summary leaving \n");
-
-}
-
-
-
-
-
-gint
-mh_load_summary (CamelMhFolder *mh_folder)
-{
- GArray *uid_array;
- MhUidCouple *first_uid_couple;
- CamelFolderSummary *summary;
- CamelMessageInfo *msg_info;
- gchar *directory_path = mh_folder->directory_path;
- gchar *summary_file_path;
- gint fd;
- gint i;
- gint field_lgth;
- gboolean file_eof;
- gint stat_error;
- struct stat stat_buf;
-
- summary = CAMEL_FOLDER (mh_folder)->summary;
- if (summary) return 1; /* should we regenerate it ? */
-
- summary_file_path = g_strdup_printf ("%s/%s", directory_path, ".camel-summary");
- CAMEL_LOG_FULL_DEBUG ("In the process of reading %s\n", summary_file_path);
- fd = open (summary_file_path, O_RDONLY);
- /* tests if file exists */
- stat_error = stat (summary_file_path, &stat_buf);
-
- if (!((stat_error != -1) && S_ISREG (stat_buf.st_mode))) {
- CAMEL_LOG_FULL_DEBUG ("could not open file %s for reading. Exiting.\n", summary_file_path);
- g_free (summary_file_path);
- return -1;
- }
- g_free (summary_file_path);
-
- for (;;) {
- /* read subject */
- file_eof = (read (fd, &field_lgth, sizeof (gint)) <= 0);
- if (file_eof) break;
-
-
- /* allcate a summary if needed */
- if (!summary)
- summary = camel_folder_summary_new ();
- /* allocate a message info struct */
- msg_info = g_new0 (CamelMessageInfo, 1);
-
- if (!file_eof && (field_lgth > 0)) {
- msg_info->subject = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->subject, field_lgth);
- } else
- msg_info->subject = NULL;
-
- /* read uid */
- if (!file_eof) file_eof = (read (fd, &field_lgth, sizeof (gint)) <= 0);
- if (!file_eof && (field_lgth > 0)) {
- msg_info->uid = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->uid, field_lgth);
- } else
- msg_info->uid = NULL;
-
- /* read date */
- if (!file_eof) file_eof = (read (fd, &field_lgth, sizeof (gint)) <= 0);
- if (!file_eof && (field_lgth > 0)) {
- msg_info->date = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->date, field_lgth);
- } else
- msg_info->date = NULL;
-
- /* read sender */
- if (!file_eof) file_eof = (read (fd, &field_lgth, sizeof (gint)) <= 0);
- if (!file_eof && (field_lgth > 0)) {
- msg_info->sender = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->sender, field_lgth);
- } else
- msg_info->sender = NULL;
-
- summary->message_info_list = g_list_prepend (summary->message_info_list,
- msg_info);
- }
-
- CAMEL_FOLDER (mh_folder)->summary = summary;
-
- close (fd);
- return 1;
-}
-
-
diff --git a/camel/providers/MH/mh-summary.h b/camel/providers/MH/mh-summary.h
deleted file mode 100644
index 27c9a21f60..0000000000
--- a/camel/providers/MH/mh-summary.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 MH_SUMMARY_H
-#define MH_SUMMARY_H 1
-
-#include <glib.h>
-#include "camel-mh-folder.h"
-
-void mh_generate_summary (CamelFolder *folder);
-void mh_save_summary (CamelMhFolder *mh_folder);
-gint mh_load_summary (CamelMhFolder *mh_folder);
-
-#endif /* MH_SUMMARY_H */
diff --git a/camel/providers/MH/mh-uid.c b/camel/providers/MH/mh-uid.c
deleted file mode 100644
index ebcccacd23..0000000000
--- a/camel/providers/MH/mh-uid.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 "mh-uid.h"
-#include "camel-log.h"
-#include "camel-stream.h"
-#include "camel-stream-fs.h"
-#include "camel-stream-buffered-fs.h"
-#include "gmime-utils.h"
-#include "md5-utils.h"
-#include "mh-utils.h"
-
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-void
-mh_uid_get_for_file (gchar *filename, guchar uid[16])
-{
- CamelStream *message_stream;
- GArray *header_array;
- Rfc822Header *cur_header;
- int i;
- MD5Context ctx;
-
-
- message_stream = camel_stream_buffered_fs_new_with_name (filename,
- CAMEL_STREAM_BUFFERED_FS_READ);
- header_array = get_header_array_from_stream (message_stream);
- gtk_object_unref (GTK_OBJECT (message_stream));
-
- md5_init (&ctx);
- for (i=0; i<header_array->len; i++) {
- cur_header = (Rfc822Header *)header_array->data + i;
- if (!g_strcasecmp (cur_header->name, "subject")) {
- md5_update (&ctx, cur_header->value, strlen (cur_header->value));
- } else if (!g_strcasecmp (cur_header->name, "sender")) {
- md5_update (&ctx, cur_header->value, strlen (cur_header->value));
- } else if (!g_strcasecmp (cur_header->name, "date")) {
- md5_update (&ctx, cur_header->value, strlen (cur_header->value));
- }
-
- g_free (cur_header->name);
- g_free (cur_header->value);
-
- }
-
- g_array_free (header_array, TRUE);
-
- md5_final (&ctx, uid);
-}
-
-
-
-
-void
-mh_save_uid_list (CamelMhFolder *mh_folder)
-{
- GArray *uid_array;
- MhUidCouple *first_uid_couple;
- gchar *directory_path = mh_folder->directory_path;
- gchar *uidfile_path;
- int fd;
- int i;
-
-
- uidfile_path = g_strdup_printf ("%s/%s", directory_path, ".camel-uid-list");
- CAMEL_LOG_FULL_DEBUG ("In the process of writing %s\n", uidfile_path);
- fd = open (uidfile_path, O_WRONLY | O_CREAT );
-
- if (!fd) {
- CAMEL_LOG_FULL_DEBUG ("could not open file %s for writing. Exiting.\n", uidfile_path);
- g_free (uidfile_path);
- return;
- }
- g_free (uidfile_path);
-
- uid_array = mh_folder->uid_array;
- first_uid_couple = (MhUidCouple *)uid_array->data;
-
- /* write the number of uid contained in the file */
- write (fd, &(uid_array->len), sizeof (guint));
- CAMEL_LOG_FULL_DEBUG ("%d entrie present in the list\n", uid_array->len);
- /* now write the array of uid self */
- write (fd, first_uid_couple, sizeof (MhUidCouple) * uid_array->len);
-
- close (fd);
-}
-
-
-gint
-mh_load_uid_list (CamelMhFolder *mh_folder)
-{
- GArray *new_uid_array;
- MhUidCouple *first_uid_couple;
- gchar *directory_path = mh_folder->directory_path;
- gchar *uidfile_path;
- int fd;
- guint uid_nb;
- struct stat stat_buf;
- gint stat_error = 0;
-
- uidfile_path = g_strdup_printf ("%s/%s", directory_path, ".camel-uid-list");
-
- /* tests if file exists */
- stat_error = stat (uidfile_path, &stat_buf);
-
-
- if (!((stat_error != -1) && S_ISREG (stat_buf.st_mode))) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::load_uid_list "
- "file %s does not exist. Exiting.\n", uidfile_path);
- g_free (uidfile_path);
- return -1;
- }
-
- fd = open (uidfile_path, O_RDONLY);
- g_free (uidfile_path);
- if (!fd) return -1;
-
- if (mh_folder->uid_array) g_array_free (mh_folder->uid_array, FALSE);
-
- /* read the number of uids in the file */
- read (fd, &uid_nb, sizeof (guint));
- CAMEL_LOG_FULL_DEBUG ("reading %d uid_entries\n", uid_nb);
- new_uid_array = g_array_new (FALSE, FALSE, sizeof (MhUidCouple));
- new_uid_array = g_array_set_size (new_uid_array, uid_nb);
- first_uid_couple = (MhUidCouple *)new_uid_array->data;
-
-
- read (fd, first_uid_couple, sizeof (MhUidCouple) * uid_nb);
-
- mh_folder->uid_array = new_uid_array;
-
- return 1;
-}
-
-
-gint
-mh_generate_uid_list (CamelMhFolder *mh_folder)
-{
- GArray *new_uid_array;
- const gchar *directory_path;
- struct dirent *dir_entry;
- DIR *dir_handle;
- gchar *msg_path;
- guint msg_count;
- MhUidCouple *uid_couple;
- guint file_number;
-
- g_assert (mh_folder);
- CAMEL_LOG_FULL_DEBUG ("in the process of creating uid list \n");
- directory_path = mh_folder->directory_path;
- if (!directory_path) {
- CAMEL_LOG_FULL_DEBUG ("folder has no directory path. Exiting\n");
- return -1;
- }
-
- msg_count = camel_folder_get_message_count (CAMEL_FOLDER (mh_folder), NULL);
- if (!msg_count) {
- CAMEL_LOG_FULL_DEBUG ("no message in %s. Exiting\n", directory_path);
- return -1;
- }
-
- new_uid_array = g_array_new (FALSE, FALSE, sizeof (MhUidCouple));
- new_uid_array = g_array_set_size (new_uid_array, msg_count);
- uid_couple = (MhUidCouple *)new_uid_array->data;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while (dir_entry != NULL) {
-
- /* tests if the entry correspond to a message file */
- if (mh_is_a_message_file (dir_entry->d_name, directory_path)) {
-
- /* get the uid for this message */
- msg_path = g_strdup_printf ("%s/%s", directory_path, dir_entry->d_name);
- mh_uid_get_for_file (msg_path, uid_couple->uid);
- g_free (msg_path);
-
- /* convert filename into file number */
- uid_couple->file_number = atoi (dir_entry->d_name);
- uid_couple++;
- }
-
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
- mh_folder->uid_array = new_uid_array;
-}
diff --git a/camel/providers/MH/mh-uid.h b/camel/providers/MH/mh-uid.h
deleted file mode 100644
index 63dfe5b159..0000000000
--- a/camel/providers/MH/mh-uid.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 MH_UID_H
-#define MH_UID_H 1
-
-#include <glib.h>
-#include "camel-mh-folder.h"
-
-
-typedef struct {
- gchar uid[16];
- guint file_number;
-} MhUidCouple;
-
-void mh_uid_get_for_file (gchar *filename, guchar uid[16]);
-void mh_save_uid_list (CamelMhFolder *mh_folder);
-gint mh_load_uid_list (CamelMhFolder *mh_folder);
-gint mh_generate_uid_list (CamelMhFolder *mh_folder);
-
-#endif /* MH_UID_H */
diff --git a/camel/providers/MH/mh-utils.c b/camel/providers/MH/mh-utils.c
deleted file mode 100644
index 51bb84bc65..0000000000
--- a/camel/providers/MH/mh-utils.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 "mh-utils.h"
-
-#include <sys/stat.h>
-
-gboolean
-mh_is_a_message_file (const gchar *file_name, const gchar *file_path)
-{
- struct stat stat_buf;
- gint stat_error = 0;
- gboolean ok;
- gchar *full_file_name;
- int i;
-
- /* test if the name is a number */
- i=0;
- while ((file_name[i] != '\0') && (file_name[i] >= '0') && (file_name[i] <= '9'))
- i++;
- if ((i==0) || (file_name[i] != '\0')) return FALSE;
-
- /* is it a regular file ? */
- full_file_name = g_strdup_printf ("%s/%s", file_path, file_name);
- stat_error = stat (full_file_name, &stat_buf);
- g_free (full_file_name);
-
- return ((stat_error != -1) && S_ISREG (stat_buf.st_mode));
-}
-
diff --git a/camel/providers/MH/mh-utils.h b/camel/providers/MH/mh-utils.h
deleted file mode 100644
index 968228b0a3..0000000000
--- a/camel/providers/MH/mh-utils.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 MH_UTILS_H
-#define MH_UTILS_H 1
-
-#include <glib.h>
-
-gboolean mh_is_a_message_file (const gchar *file_name, const gchar *file_path);
-
-#endif /* MH_UTILS_H */
diff --git a/camel/providers/Makefile.am b/camel/providers/Makefile.am
deleted file mode 100644
index cf43b07714..0000000000
--- a/camel/providers/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS = mbox
-# this ones are disabled for the moment.
-# MH maildir
diff --git a/camel/providers/maildir/.cvsignore b/camel/providers/maildir/.cvsignore
deleted file mode 100644
index 2e7b174532..0000000000
--- a/camel/providers/maildir/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile.in
-Makefile
-.deps
-*.lo
-*.la
-.libs
diff --git a/camel/providers/maildir/Makefile.am b/camel/providers/maildir/Makefile.am
deleted file mode 100644
index 51a0d7327b..0000000000
--- a/camel/providers/maildir/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelmaildirincludedir = $(includedir)/camel
-
-lib_LTLIBRARIES = libcamelmaildir.la
-
-INCLUDES = -I.. -I$(srcdir)/.. -I$(top_srcdir)/intl -I$(top_srcdir)/camel \
- $(GTK_INCLUDEDIR) -I$(includedir)
-
-libcamelmaildir_la_SOURCES = \
- camel-maildir-folder.c \
- camel-maildir-provider.c \
- camel-maildir-store.c
-
-libcamelmaildirinclude_HEADERS = \
- camel-maildir-folder.h \
- camel-maildir-store.h
-
-libcamelmaildir_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-EXTRA_DIST =
diff --git a/camel/providers/maildir/camel-maildir-folder.c b/camel/providers/maildir/camel-maildir-folder.c
deleted file mode 100644
index 4ad5409658..0000000000
--- a/camel/providers/maildir/camel-maildir-folder.c
+++ /dev/null
@@ -1,803 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildir-folder.c : camel-folder subclass for maildir folders */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * 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
- */
-
-/*
- * AUTHORS : Jukka Zitting
- *
- */
-
-
-#include <config.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <errno.h>
-#include <time.h>
-#include <string.h>
-#include "camel-maildir-folder.h"
-#include "camel-maildir-store.h"
-#include "camel-stream-fs.h"
-#include "camel-log.h"
-
-static CamelFolderClass *parent_class=NULL;
-
-/* Returns the class for a CamelMaildirFolder */
-#define CMAILDIRF_CLASS(so) CAMEL_MAILDIR_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMAILDIRS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-
-static void _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex);
-static void _set_name (CamelFolder *folder, const gchar *name, CamelException *ex);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _create (CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean _delete_messages (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message (CamelFolder *folder, gint number, CamelException *ex);
-static gint _get_message_count (CamelFolder *folder, CamelException *ex);
-static void _expunge (CamelFolder *folder, CamelException *ex);
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-
-/* fs utility functions */
-static DIR * _xopendir (const gchar *path);
-static gboolean _xstat (const gchar *path, struct stat *buf);
-static gboolean _xmkdir (const gchar *path);
-static gboolean _xrename (const gchar *from, const gchar *to);
-static gboolean _xunlink (const gchar *path);
-static gboolean _xrmdir (const gchar *path);
-/* ** */
-
-static void
-camel_maildir_folder_class_init (CamelMaildirFolderClass *camel_maildir_folder_class)
-{
- CamelFolderClass *camel_folder_class =
- CAMEL_FOLDER_CLASS (camel_maildir_folder_class);
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_folder_class->init_with_store = _init_with_store;
- camel_folder_class->set_name = _set_name;
- camel_folder_class->exists = _exists;
- camel_folder_class->create = _create;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->expunge = _expunge;
- camel_folder_class->get_message = _get_message;
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->list_subfolders = _list_subfolders;
-}
-
-GtkType
-camel_maildir_folder_get_type (void)
-{
- static GtkType camel_maildir_folder_type = 0;
-
- if (!camel_maildir_folder_type) {
- GtkTypeInfo camel_maildir_folder_info =
- {
- "CamelMaildirFolder",
- sizeof (CamelMaildirFolder),
- sizeof (CamelMaildirFolderClass),
- (GtkClassInitFunc) camel_maildir_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_maildir_folder_type =
- gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_maildir_folder_info);
- }
-
- return camel_maildir_folder_type;
-}
-
-
-
-
-
-
-/**
- * CamelMaildirFolder::init_with_store: initializes the folder object
- * @folder: folder object to initialize
- * @parent_store: parent store object of the folder
- *
- * Simply tells that the folder can contain messages but not subfolders.
- * Perhaps we'll later implement subfolders too...
- */
-static void
-_init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::init_with_store\n");
- g_assert (folder);
- g_assert (parent_store);
-
- /* call parent method */
- parent_class->init_with_store (folder, parent_store, ex);
-
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- folder->has_summary_capability = FALSE;
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::init_with_store\n");
-}
-
-/**
- * CamelMaildirFolder::set_name: sets the name of the folder
- * @folder: folder object
- * @name: name of the folder
- *
- * Sets the name of the folder object. The existence of a folder with
- * the given name is not checked in this function.
- */
-static void
-_set_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder;
- CamelMaildirStore *maildir_store;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::set_name\n");
- g_assert (folder);
- g_assert (name);
- g_assert (folder->parent_store);
-
- maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- maildir_store = CAMEL_MAILDIR_STORE (folder->parent_store);
-
- /* call default implementation */
- parent_class->set_name (folder, name, ex);
-
- if (maildir_folder->directory_path)
- g_free (maildir_folder->directory_path);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::set_name full_name is %s\n", folder->full_name);
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::set_name toplevel_dir is %s\n", maildir_store->toplevel_dir);
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::set_name separator is %c\n", camel_store_get_separator (folder->parent_store));
-
- if (folder->full_name && folder->full_name[0])
- maildir_folder->directory_path =
- g_strconcat (maildir_store->toplevel_dir, G_DIR_SEPARATOR_S,
- folder->full_name, NULL);
- else
- maildir_folder->directory_path = g_strdup (maildir_store->toplevel_dir);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::set_name: name set to %s\n", name);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::set_name\n");
-}
-
-/**
- * CamelMaildirFolder::exists: tests whether the named maildir exists
- * @folder: folder object
- *
- * A created maildir folder object doesn't necessarily exist yet in the
- * filesystem. This function checks whether the maildir exists.
- * The structure of the maildir is stated in the maildir.5 manpage.
- *
- * maildir.5:
- * A directory in maildir format has three subdirectories,
- * all on the same filesystem: tmp, new, and cur.
- *
- * Return value: TRUE if the maildir exists, FALSE otherwise
- */
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- static const gchar *dir[3] = { "new", "cur", "tmp" };
- gint i;
- struct stat statbuf;
- const gchar *maildir;
- gchar *path;
- gboolean rv = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::exists\n");
- g_assert (folder);
- g_return_val_if_fail (maildir_folder->directory_path, FALSE);
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMailFolder::exists: checking maildir %s\n",
- maildir);
-
- /* check whether the toplevel directory exists */
- rv = _xstat (maildir, &statbuf) && S_ISDIR (statbuf.st_mode);
-
- /* check whether the maildir subdirectories exist */
- for (i = 0; rv && i < 3; i++) {
- path = g_strconcat (maildir, G_DIR_SEPARATOR_S, dir[i], NULL);
-
- rv = _xstat (path, &statbuf) && S_ISDIR (statbuf.st_mode);
-
- g_free (path);
- }
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::exists: %s\n",
- (rv) ? "maildir found" : "maildir not found");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::exists\n");
- return rv;
-}
-
-/**
- * CamelMaildirFolder::create: creates the named maildir
- * @folder: folder object
- *
- * A created maildir folder object doesn't necessarily exist yet in the
- * filesystem. This function creates the maildir if it doesn't yet exist.
- * The structure of the maildir is stated in the maildir.5 manpage.
- *
- * maildir.5:
- * A directory in maildir format has three subdirectories,
- * all on the same filesystem: tmp, new, and cur.
- *
- * Return value: TRUE if the maildir existed already or was created,
- * FALSE otherwise
- */
-static gboolean
-_create (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- static const gchar *dir[3] = { "new", "cur", "tmp" };
- gint i;
- const gchar *maildir;
- gchar *path;
- gboolean rv = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::create\n");
- g_assert (folder);
-
- /* check whether the maildir already exists */
- if (camel_folder_exists (folder, ex)) return TRUE;
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMailFolder::create: creating maildir %s\n",
- maildir);
-
- /* create the toplevel directory */
- rv = _xmkdir (maildir);
-
- /* create the maildir subdirectories */
- for (i = 0; rv && i < 3; i++) {
- path = g_strconcat (maildir, G_DIR_SEPARATOR_S, dir[i], NULL);
-
- rv = _xmkdir (path);
-
- g_free (path);
- }
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::create: %s\n",
- rv ? "maildir created" : "an error occurred");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::create\n");
- return rv;
-}
-
-/**
- * CamelMaildirFolder::delete: delete the maildir folder
- * @folder: the folder object
- * @recurse:
- *
- * This function empties and deletes the maildir folder. The subdirectories
- * "tmp", "cur", and "new" are removed first and then the toplevel maildir
- * directory is deleted. All files from the directories are deleted as well,
- * so you should be careful when using this function. If a subdirectory cannot
- * be deleted, then the operation it is stopped. Thus if an error occurs, the
- * maildir directory won't be removed, but it might no longer be a valid maildir.
- */
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- static const gchar *dir[3] = { "new", "cur", "tmp" };
- gint i;
- const gchar *maildir;
- gchar *path;
- gboolean rv = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::create\n");
- g_assert (folder);
-
- /* check whether the maildir already exists */
- if (!camel_folder_exists (folder, ex)) return TRUE;
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMailFolder::delete: deleting maildir %s\n",
- maildir);
-
- /* delete the maildir subdirectories */
- for (i = 0; rv && i < 3; i++) {
- path = g_strconcat (maildir, G_DIR_SEPARATOR_S, dir[i], NULL);
-
- rv = _xrmdir (path);
-
- g_free (path);
- }
-
- /* create the toplevel directory */
- if (rv)
- rv = _xrmdir (maildir);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::delete: %s\n",
- rv ? "maildir deleted" : "an error occurred");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::delete\n");
- return rv;
-}
-
-/**
- * CamelMaildirFolder::delete_messages: empty the maildir folder
- * @folder: the folder object
- *
- * This function empties the maildir folder. All messages from the
- * "cur" subdirectory are deleted. If a message cannot be deleted, then
- * it is just skipped and the rest of the messages are still deleted.
- * Files with names starting with a dot are skipped as described in the
- * maildir.5 manpage.
- *
- * maildir.5:
- * It is a good idea for readers to skip all filenames in new
- * and cur starting with a dot. Other than this, readers
- * should not attempt to parse filenames.
- *
- * Return value: FALSE on error and if some messages could not be deleted.
- * TRUE otherwise.
- */
-static gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- const gchar *maildir;
- gchar *curdir, *file;
- DIR *dir_handle;
- struct dirent *dir_entry;
- gboolean rv = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::delete_messages\n");
- g_assert (folder);
-
- /* call default implementation */
- parent_class->delete_messages (folder, ex);
-
- /* Check if the folder didn't exist */
- if (!camel_folder_exists (folder, ex)) return TRUE;
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::delete_messages: "
- "deleting messages from %s\n", maildir);
-
- /* delete messages from the maildir subdirectory "cur" */
- curdir = g_strconcat (maildir, G_DIR_SEPARATOR_S, "cur", NULL);
-
- dir_handle = _xopendir (curdir);
- if (dir_handle) {
- while ((dir_entry = readdir (dir_handle))) {
- if (dir_entry->d_name[0] == '.') continue;
- file = g_strconcat (curdir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, NULL);
-
- if (!_xunlink (file)) rv = FALSE;
-
- g_free (file);
- }
- closedir (dir_handle);
- } else
- rv = FALSE;
-
- g_free (curdir);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::delete_messages: %s\n",
- rv ? "messages deleted" : "an error occurred");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::delete_messages\n");
- return rv;
-}
-
-/**
- * CamelMaildirFolder::get_message: get a message from maildir
- * @folder: the folder object
- * @number: number of the message within the folder
- *
- * Return value: the message, NULL on error
- */
-static CamelMimeMessage *
-_get_message (CamelFolder *folder, gint number, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER(folder);
- DIR *dir_handle;
- struct dirent *dir_entry;
- CamelStream *stream;
- CamelMimeMessage *message = NULL;
- const gchar *maildir;
- gchar *curdir, *file = NULL;
- gint count = -1;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::get_message\n");
- g_assert(folder);
-
- /* Check if the folder exists */
- if (!camel_folder_exists (folder, ex)) return NULL;
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message: "
- "getting message #%d from %s\n", number, maildir);
-
- /* Count until the desired message is reached */
- curdir = g_strconcat (maildir, G_DIR_SEPARATOR_S, "cur", NULL);
- if ((dir_handle = _xopendir (curdir))) {
- while ((count < number) && (dir_entry = readdir (dir_handle)))
- if (dir_entry->d_name[0] != '.') count++;
-
- if (count == number)
- file = g_strconcat (curdir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, NULL);
-
- closedir (dir_handle);
- }
- g_free (curdir);
- if (!file) return NULL;
-
- /* Create the message object */
-#warning use session field here
- message = camel_mime_message_new_with_session ((CamelSession *) NULL);
- stream = camel_stream_fs_new_with_name (file, CAMEL_STREAM_FS_READ);
-
- if (!message || !stream) {
- g_free (file);
- if (stream) gtk_object_unref (GTK_OBJECT (stream));
- if (message) gtk_object_unref (GTK_OBJECT (message));
- return NULL;
- }
-
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (message),
- stream);
- gtk_object_unref (GTK_OBJECT (stream));
- gtk_object_set_data_full (GTK_OBJECT (message),
- "fullpath", file, g_free);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message: "
- "message %p created from %s\n", message, file);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::get_message\n");
- return message;
-}
-
-/**
- * CamelMaildirFolder::get_message_count: count messages in maildir
- * @folder: the folder object
- *
- * Returns the number of messages in the maildir folder. New messages
- * are included in this count.
- *
- * Return value: number of messages in the maildir, -1 on error
- */
-static gint
-_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER(folder);
- const gchar *maildir;
- gchar *newdir, *curdir, *newfile, *curfile;
- DIR *dir_handle;
- struct dirent *dir_entry;
- guint count = 0;
-
- CAMEL_LOG_FULL_DEBUG ("Entering "
- "CamelMaildirFolder::get_message_count\n");
- g_assert(folder);
-
- /* check if the maildir exists */
- if (!camel_folder_exists (folder, ex)) return -1;
-
- maildir = maildir_folder->directory_path;
-
- newdir = g_strconcat (maildir, G_DIR_SEPARATOR_S, "new", NULL);
- curdir = g_strconcat (maildir, G_DIR_SEPARATOR_S, "cur", NULL);
-
- /* Check new messages */
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message_count: "
- "getting new messages from %s\n", newdir);
- if ((dir_handle = _xopendir (newdir))) {
- while ((dir_entry = readdir (dir_handle))) {
- if (dir_entry->d_name[0] == '.') continue;
- newfile = g_strconcat (newdir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, NULL);
- curfile = g_strconcat (curdir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, ":2,", NULL);
-
- _xrename (newfile, curfile);
-
- g_free (curfile);
- g_free (newfile);
- }
- closedir (dir_handle);
- }
-
- /* Count messages */
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message_count: "
- "counting messages in %s\n", curdir);
- if ((dir_handle = _xopendir (curdir))) {
- while ((dir_entry = readdir (dir_handle)))
- if (dir_entry->d_name[0] != '.') count++;
- closedir (dir_handle);
- }
-
- g_free (curdir);
- g_free (newdir);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message_count: "
- " found %d messages\n", count);
- CAMEL_LOG_FULL_DEBUG ("Leaving "
- "CamelMaildirFolder::get_message_count\n");
- return count;
-}
-
-
-
-
-/**
- * CamelMaildirFolder::expunge: expunge messages marked as deleted
- * @folder: the folder object
- *
- * Physically deletes the messages marked as deleted in the folder.
- */
-static void
-_expunge (CamelFolder *folder, CamelException *ex)
-{
- CamelMimeMessage *message;
- GList *node;
- gchar *fullpath;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::expunge\n");
- g_assert(folder);
-
- /* expunge messages marked for deletion */
- for (node = folder->message_list; node; node = g_list_next(node)) {
- message = CAMEL_MIME_MESSAGE (node->data);
- if (!message) {
- CAMEL_LOG_WARNING ("CamelMaildirFolder::expunge: "
- "null message in node %p\n", node);
- continue;
- }
-
- if (camel_mime_message_get_flag (message, "DELETED")) {
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::expunge: "
- "expunging message #%d\n",
- message->message_number);
-
- /* expunge the message */
- fullpath = gtk_object_get_data (GTK_OBJECT (message),
- "fullpath");
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::expunge: "
- "message fullpath is %s\n",
- fullpath);
-
- if (_xunlink (fullpath))
- message->expunged = TRUE;
- } else {
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::expunge: "
- "skipping message #%d\n",
- message->message_number);
- }
- }
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::expunge\n");
-}
-
-
-
-
-/**
- * CamelMaildirFolder::list_subfolders: return a list of subfolders
- * @folder: the folder object
- *
- * Returns the names of the maildir subfolders in a list.
- *
- * Return value: list of subfolder names
- */
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- const gchar *maildir;
- gchar *subdir;
- struct stat statbuf;
- struct dirent *dir_entry;
- DIR *dir_handle;
- GList *subfolders = NULL;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::list_subfolders\n");
- g_assert (folder);
-
- /* check if the maildir exists */
- if (!camel_folder_exists (folder, ex)) return NULL;
-
- /* scan through the maildir toplevel directory */
- maildir = maildir_folder->directory_path;
- if ((dir_handle = _xopendir (maildir))) {
- while ((dir_entry = readdir (dir_handle))) {
- if (dir_entry->d_name[0] == '.') continue;
- if (strcmp (dir_entry->d_name, "new") == 0) continue;
- if (strcmp (dir_entry->d_name, "cur") == 0) continue;
- if (strcmp (dir_entry->d_name, "tmp") == 0) continue;
-
- subdir = g_strconcat (maildir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, NULL);
-
- if (_xstat (subdir, &statbuf)
- && S_ISDIR (statbuf.st_mode))
- subfolders =
- g_list_append (
- subfolders,
- g_strdup (dir_entry->d_name));
-
- g_free (subdir);
- }
- closedir (dir_handle);
- }
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::list_subfolders\n");
- return subfolders;
-}
-
-
-
-
-
-
-
-/*
- * fs utility function
- *
- */
-
-static DIR *
-_xopendir (const gchar *path)
-{
- DIR *handle;
- g_assert (path);
-
- handle = opendir (path);
- if (!handle) {
- CAMEL_LOG_WARNING ("ERROR: opendir (%s);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- }
-
- return handle;
-}
-
-static gboolean
-_xstat (const gchar *path, struct stat *buf)
-{
- gint stat_error;
- g_assert (path);
- g_assert (buf);
-
- stat_error = stat (path, buf);
- if (stat_error == 0) {
- return TRUE;
- } else if (errno == ENOENT) {
- buf->st_mode = 0;
- return TRUE;
- } else {
- CAMEL_LOG_WARNING ("ERROR: stat (%s, %p);\n", path, buf);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-}
-
-static gboolean
-_xmkdir (const gchar *path)
-{
- g_assert (path);
-
- if (mkdir (path, S_IRWXU) == -1) {
- CAMEL_LOG_WARNING ("ERROR: mkdir (%s, S_IRWXU);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-_xrename (const gchar *from, const gchar *to)
-{
- g_assert (from);
- g_assert (to);
-
- if (rename (from, to) == 0) {
- return TRUE;
- } else {
- CAMEL_LOG_WARNING ("ERROR: rename (%s, %s);\n", from, to);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-}
-
-static gboolean
-_xunlink (const gchar *path)
-{
- g_assert (path);
-
- if (unlink (path) == 0) {
- return TRUE;
- } else if (errno == ENOENT) {
- return TRUE;
- } else {
- CAMEL_LOG_WARNING ("ERROR: unlink (%s);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-}
-
-static gboolean
-_xrmdir (const gchar *path)
-{
- DIR *dir_handle;
- struct dirent *dir_entry;
- gchar *file;
- struct stat statbuf;
- g_assert (path);
-
- dir_handle = opendir (path);
- if (!dir_handle && errno == ENOENT) {
- return TRUE;
- } else if (!dir_handle) {
- CAMEL_LOG_WARNING ("ERROR: opendir (%s);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-
- while ((dir_entry = readdir (dir_handle))) {
- file = g_strconcat (path, G_DIR_SEPARATOR_S, dir_entry->d_name,
- NULL);
- if (_xstat (file, &statbuf) && S_ISREG (statbuf.st_mode))
- _xunlink (file);
- g_free (file);
- }
-
- closedir (dir_handle);
-
- if (rmdir (path) == 0) {
- return TRUE;
- } else if (errno == ENOENT) {
- return TRUE;
- } else {
- CAMEL_LOG_WARNING ("ERROR: rmdir (%s);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-}
-
-/** *** **/
-
diff --git a/camel/providers/maildir/camel-maildir-folder.h b/camel/providers/maildir/camel-maildir-folder.h
deleted file mode 100644
index 5997da2011..0000000000
--- a/camel/providers/maildir/camel-maildir-folder.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildir-folder.h : Abstract class for an email folder */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * 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_MAILDIR_FOLDER_H
-#define CAMEL_MAILDIR_FOLDER_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-folder.h"
-/* #include "camel-store.h" */
-
-#define CAMEL_MAILDIR_FOLDER_TYPE (camel_maildir_folder_get_type ())
-#define CAMEL_MAILDIR_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_MAILDIR_FOLDER_TYPE, CamelMaildirFolder))
-#define CAMEL_MAILDIR_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MAILDIR_FOLDER_TYPE, CamelMaildirFolderClass))
-#define IS_CAMEL_MAILDIR_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_MAILDIR_FOLDER_TYPE))
-
-
-typedef struct {
- CamelFolder parent_object;
-
- gchar *directory_path;
-} CamelMaildirFolder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMaildirFolderClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_maildir_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MAILDIR_FOLDER_H */
diff --git a/camel/providers/maildir/camel-maildir-provider.c b/camel/providers/maildir/camel-maildir-provider.c
deleted file mode 100644
index cd5521adc0..0000000000
--- a/camel/providers/maildir/camel-maildir-provider.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildir-provider.c: maildir provider registration code */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * 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-maildir-store.h"
-#include "camel-provider.h"
-#include "camel-log.h"
-
-
-static CamelProvider _maildir_provider = {
- (GtkType) 0,
- PROVIDER_STORE,
- "maildir",
- "Maildir provider for Camel",
- "This maildir provider is based on the default MH provider of Camel",
- (GModule *) NULL
-};
-
-
-
-CamelProvider *
-camel_provider_module_init ()
-{
- _maildir_provider.object_type = camel_maildir_store_get_type();
- return &_maildir_provider;
-}
diff --git a/camel/providers/maildir/camel-maildir-store.c b/camel/providers/maildir/camel-maildir-store.c
deleted file mode 100644
index 8f37494003..0000000000
--- a/camel/providers/maildir/camel-maildir-store.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildir-store.c : class for an maildir store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * 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 "camel-maildir-store.h"
-#include "camel-maildir-folder.h"
-#include "url-util.h"
-
-static CamelStoreClass *parent_class=NULL;
-
-/* Returns the class for a CamelMaildirStore */
-#define CMAILDIRS_CLASS(so) CAMEL_MAILDIR_STORE_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMAILDIRF_CLASS(so) CAMEL_MAILDIR_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-static void _init (CamelStore *store, CamelSession *session,
- const gchar *url_name);
-static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name);
-
-static void
-camel_maildir_store_class_init (
- CamelMaildirStoreClass *camel_maildir_store_class)
-{
- CamelStoreClass *camel_store_class =
- CAMEL_STORE_CLASS (camel_maildir_store_class);
-
- parent_class = gtk_type_class (camel_store_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_store_class->init = _init;
- camel_store_class->get_folder = _get_folder;
-}
-
-static void
-camel_maildir_store_init (gpointer object, gpointer klass)
-{
- CamelMaildirStore *maildir_store = CAMEL_MAILDIR_STORE (object);
- CamelStore *store = CAMEL_STORE (object);
-
- store->separator = G_DIR_SEPARATOR;
-}
-
-GtkType
-camel_maildir_store_get_type (void)
-{
- static GtkType camel_maildir_store_type = 0;
-
- if (!camel_maildir_store_type) {
- GtkTypeInfo camel_maildir_store_info =
- {
- "CamelMaildirStore",
- sizeof (CamelMaildirStore),
- sizeof (CamelMaildirStoreClass),
- (GtkClassInitFunc) camel_maildir_store_class_init,
- (GtkObjectInitFunc) camel_maildir_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_maildir_store_type =
- gtk_type_unique (CAMEL_STORE_TYPE,
- &camel_maildir_store_info);
- }
-
- return camel_maildir_store_type;
-}
-
-static void
-_init (CamelStore *store, CamelSession *session, const gchar *url_name)
-{
- CamelMaildirStore *maildir_store = CAMEL_MAILDIR_STORE (store);
- Gurl *store_url;
- g_assert (url_name);
-
- /* call parent implementation */
- parent_class->init (store, session, url_name);
-
- /* find the path in the URL*/
- store_url = g_url_new (url_name);
-
- g_return_if_fail (store_url);
- g_return_if_fail (store_url->path);
-
- maildir_store->toplevel_dir = g_strdup (store_url->path);
-
- g_url_free (store_url);
-}
-
-static CamelFolder *
-_get_folder (CamelStore *store, const gchar *folder_name)
-{
- CamelMaildirStore *maildir_store = CAMEL_MAILDIR_STORE (store);
- CamelMaildirFolder *new_maildir_folder;
- CamelFolder *new_folder;
-
- new_maildir_folder = gtk_type_new (CAMEL_MAILDIR_FOLDER_TYPE);
- new_folder = CAMEL_FOLDER (new_maildir_folder);
-
- CF_CLASS (new_folder)->init_with_store (new_folder, store, NULL);
- CF_CLASS (new_folder)->set_name (new_folder, folder_name, NULL);
-
- return new_folder;
-}
diff --git a/camel/providers/maildir/camel-maildir-store.h b/camel/providers/maildir/camel-maildir-store.h
deleted file mode 100644
index 1a95ed1436..0000000000
--- a/camel/providers/maildir/camel-maildir-store.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildirstore.h : class for an maildir store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * 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_MAILDIR_STORE_H
-#define CAMEL_MAILDIR_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-store.h"
-
-#define CAMEL_MAILDIR_STORE_TYPE (camel_maildir_store_get_type ())
-#define CAMEL_MAILDIR_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_MAILDIR_STORE_TYPE, CamelMaildirStore))
-#define CAMEL_MAILDIR_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MAILDIR_STORE_TYPE, CamelMaildirStoreClass))
-#define IS_CAMEL_MAILDIR_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_MAILDIR_STORE_TYPE))
-
-
-typedef struct {
- CamelStore parent_object;
-
- gchar *toplevel_dir;
-} CamelMaildirStore;
-
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-
-} CamelMaildirStoreClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_maildir_store_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MAILDIR_STORE_H */
-
-
diff --git a/camel/providers/mbox/.cvsignore b/camel/providers/mbox/.cvsignore
deleted file mode 100644
index fd6b811c68..0000000000
--- a/camel/providers/mbox/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
diff --git a/camel/providers/mbox/Makefile.am b/camel/providers/mbox/Makefile.am
deleted file mode 100644
index c258f3d747..0000000000
--- a/camel/providers/mbox/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelmboxincludedir = $(includedir)/camel
-
-
-provider_LTLIBRARIES = libcamelmbox.la
-
-INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \
- -I$(top_srcdir)/intl \
- $(GTK_INCLUDEDIR) -I$(top_srcdir)/camel \
- -I$(top_srcdir)/libibex
-
-libcamelmbox_la_SOURCES = \
- camel-mbox-folder.c \
- camel-mbox-parser.c \
- camel-mbox-provider.c \
- camel-mbox-store.c \
- camel-mbox-summary.c \
- camel-mbox-search.c \
- camel-mbox-utils.c
-
-libcamelmboxinclude_HEADERS = \
- camel-mbox-folder.h \
- camel-mbox-parser.h \
- camel-mbox-store.h \
- camel-mbox-summary.h \
- camel-mbox-search.h \
- camel-mbox-utils.h
-
-
-libcamelmbox_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-#libcamelmbox_la_LIBADD = -L$(top_srcdir)/libibex -libex
-libcamelmbox_la_LIBADD = $(top_srcdir)/libibex/libibex.la $(UNICODE_LIBS)
-
-EXTRA_DIST =
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
deleted file mode 100644
index 64d559c00a..0000000000
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ /dev/null
@@ -1,1131 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-folder.c : Abstract class for an email folder */
-
-/*
- * Author : Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code .
- *
- * 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 <stdlib.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-
-#include "camel-mbox-folder.h"
-#include "camel-mbox-store.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include "camel-stream-buffered-fs.h"
-#include "camel-folder-summary.h"
-#include "camel-mbox-summary.h"
-#include "camel-mbox-parser.h"
-#include "camel-mbox-utils.h"
-#include "md5-utils.h"
-#include "gmime-utils.h"
-#include "camel-mbox-search.h"
-
-#include "camel-exception.h"
-
-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)
-
-
-static void _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex);
-static void _set_name(CamelFolder *folder, const gchar *name, CamelException *ex);
-
-
-static void _open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex);
-static void _close (CamelFolder *folder, gboolean expunge, CamelException *ex);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _create(CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean _delete_messages (CamelFolder *folder, CamelException *ex);
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-/* static CamelMimeMessage *_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex);*/
-static gint _get_message_count (CamelFolder *folder, CamelException *ex);
-static gint _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static GList *_get_uid_list (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-#if 0
-static void _expunge (CamelFolder *folder, CamelException *ex);
-static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex);
-static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-#endif
-
-static CamelFolderSummary *search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
-
-static void _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);
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_folder_class->init_with_store = _init_with_store;
- camel_folder_class->set_name = _set_name;
- camel_folder_class->open = _open;
- camel_folder_class->close = _close;
- camel_folder_class->exists = _exists;
- camel_folder_class->create = _create;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->list_subfolders = _list_subfolders;
- /* camel_folder_class->get_message_by_number = _get_message_by_number; */
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->append_message = _append_message;
- camel_folder_class->get_uid_list = _get_uid_list;
-#if 0
- camel_folder_class->expunge = _expunge;
- camel_folder_class->copy_message_to = _copy_message_to;
- camel_folder_class->get_message_uid = _get_message_uid;
-#endif
- camel_folder_class->get_message_by_uid = _get_message_by_uid;
-
- camel_folder_class->search_by_expression = search_by_expression;
-
- gtk_object_class->finalize = _finalize;
-
-}
-
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelFolder::finalize\n");
-
-
- g_free (mbox_folder->folder_file_path);
- g_free (mbox_folder->folder_dir_path);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolder::finalize\n");
-}
-
-
-
-
-
-GtkType
-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);
- }
-
- return camel_mbox_folder_type;
-}
-
-
-
-
-
-
-static void
-_init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
-
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::init_with_store\n");
-
- /* call parent method */
- parent_class->init_with_store (folder, parent_store, ex);
- if (camel_exception_get_id (ex)) return;
-
- /* we assume that the parent init_with_store
- method checks for the existance of @folder */
-
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- folder->has_summary_capability = TRUE;
- folder->has_uid_capability = TRUE;
- folder->summary = camel_folder_summary_new ();
-
- mbox_folder->folder_file_path = NULL;
- mbox_folder->summary_file_path = NULL;
- mbox_folder->folder_dir_path = NULL;
- mbox_folder->index_file_path = NULL;
- mbox_folder->internal_summary = NULL;
- mbox_folder->uid_array = NULL;
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMhFolder::init_with_store\n");
-}
-
-
-
-/* internal method used to :
- - test for the existence of a summary file
- - test the sync between the summary and the mbox file
- - load the summary or create it if necessary
-*/
-static void
-_check_get_or_maybe_generate_summary_file (CamelMboxFolder *mbox_folder, CamelException *ex)
-{
- CamelFolder *folder = CAMEL_FOLDER (mbox_folder);
- GArray *message_info_array;
- gboolean summary_file_exists;
- gboolean summary_file_is_sync;
- GArray *mbox_summary_info;
- gint mbox_file_fd;
- guint32 next_uid;
- guint32 file_size;
-
- /* test for the existence of the summary file */
- summary_file_exists = (access (mbox_folder->summary_file_path, F_OK) == 0);
-
- /* if the summary file exists, test if the
- md5 of the mbox file is still in sync
- with the one we had computed the last time
- we saved the summary file */
- if (summary_file_exists) {
-
- summary_file_is_sync =
- camel_mbox_check_summary_sync (mbox_folder->summary_file_path,
- mbox_folder->folder_file_path,
- ex);
- if (camel_exception_get_id (ex)) return;
- }
-
-
- /* in the case where the summary does not exist
- or is not in sync with the mbox file
- regenerate it */
- if ( !(summary_file_exists && summary_file_is_sync)) {
-
- /* parse the mbox folder and get some
- information about the messages */
-
- mbox_file_fd = open (mbox_folder->folder_file_path, O_RDONLY);
- message_info_array = camel_mbox_parse_file (mbox_file_fd,
- "From ",
- 0,
- &file_size,
- &next_uid,
- TRUE,
- NULL,
- 0,
- ex);
-
- close (mbox_file_fd);
- if (camel_exception_get_id (ex)) {
- return;
- }
-
-
- next_uid = camel_mbox_write_xev (mbox_folder->folder_file_path,
- message_info_array, &file_size, next_uid, ex);
-
- if (camel_exception_get_id (ex)) {
- /* ** FIXME : free the preparsed information */
- return;
- }
-
- mbox_summary_info =
- parsed_information_to_mbox_summary (message_info_array);
-
- /* **FIXME : Free the parsed information structure */
-
- /* allocate an internal summary object */
- mbox_folder->internal_summary = g_new (CamelMboxSummary, 1);
-
- /* generate the folder md5 signature */
- md5_get_digest_from_file (mbox_folder->folder_file_path, mbox_folder->internal_summary->md5_digest);
-
- /* store the number of messages as well as the summary array */
- mbox_folder->internal_summary->nb_message = mbox_summary_info->len;
- mbox_folder->internal_summary->next_uid = next_uid;
- mbox_folder->internal_summary->mbox_file_size = file_size;
- mbox_folder->internal_summary->message_info = mbox_summary_info;
-
- } else {
- /* every thing seems ok, just read the summary file from disk */
- mbox_folder->internal_summary = camel_mbox_load_summary (mbox_folder->summary_file_path, ex);
- }
-
- /* copy the internal summary information to the external
- folder summary used by the display engines */
- camel_mbox_summary_append_internal_to_external (mbox_folder->internal_summary, folder->summary, 0);
-}
-
-
-
-static void
-_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- //struct dirent *dir_entry;
- //struct stat stat_buf;
-
-
- if (folder->open_state == FOLDER_OPEN) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
- "folder is already open");
- return;
- }
-
-
-
- /* get (or create) uid list */
- //if (!(mbox_load_uid_list (mbox_folder) > 0))
- // mbox_generate_uid_list (mbox_folder);
-
- _check_get_or_maybe_generate_summary_file (mbox_folder, ex);
-}
-
-
-static void
-_close (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
-
-
- /* call parent implementation */
- parent_class->close (folder, expunge, ex);
-
- /* save the folder summary on disc */
- camel_mbox_save_summary (mbox_folder->internal_summary, mbox_folder->summary_file_path, ex);
-}
-
-
-
-
-static void
-_set_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- const gchar *root_dir_path;
- //gchar *full_name;
- //const gchar *parent_full_name;
- gchar separator;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::set_name\n");
-
- /* call default implementation */
- parent_class->set_name (folder, name, ex);
- if (camel_exception_get_id (ex)) return;
-
- g_free (mbox_folder->folder_file_path);
- g_free (mbox_folder->folder_dir_path);
- g_free (mbox_folder->index_file_path);
-
- separator = camel_store_get_separator (folder->parent_store, ex);
- root_dir_path = camel_mbox_store_get_toplevel_dir (CAMEL_MBOX_STORE(folder->parent_store), ex);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::set_name full_name is %s\n", folder->full_name);
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::set_name root_dir_path is %s\n", root_dir_path);
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::separator is %c\n", separator);
-
- mbox_folder->folder_file_path = g_strdup_printf ("%s%c%s", root_dir_path, separator, folder->full_name);
- mbox_folder->summary_file_path = g_strdup_printf ("%s%c%s-ev-summary", root_dir_path, separator, folder->full_name);
- mbox_folder->folder_dir_path = g_strdup_printf ("%s%c%s.sdb", root_dir_path, separator, folder->full_name);
- mbox_folder->index_file_path = g_strdup_printf ("%s%c%s.ibex", root_dir_path, separator, folder->full_name);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::set_name mbox_folder->folder_file_path is %s\n",
- mbox_folder->folder_file_path);
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::set_name mbox_folder->folder_dir_path is %s\n",
- mbox_folder->folder_dir_path);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::set_name\n");
-}
-
-
-
-
-
-
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- struct stat stat_buf;
- gint stat_error;
- gboolean exists;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::exists\n");
-
- /* check if the folder object exists */
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- /* check if the mbox file path is determined */
- if (!mbox_folder->folder_file_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "undetermined folder file path. Maybe use set_name ?");
- return FALSE;
- }
-
- /* check if the mbox dir path is determined */
- if (!mbox_folder->folder_dir_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "undetermined folder directory path. Maybe use set_name ?");
- return FALSE;
- }
-
-
- /* we should not check for that here */
-#if 0
- /* check if the mbox directory exists */
- access_result = access (mbox_folder->folder_dir_path, F_OK);
- if (access_result < 0) {
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::exists errot when executing access on %s\n",
- mbox_folder->folder_dir_path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- strerror(errno));
- return FALSE;
- }
- stat_error = stat (mbox_folder->folder_dir_path, &stat_buf);
- if (stat_error == -1) {
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::exists when executing stat on %s, stat_error = %d\n",
- mbox_folder->folder_dir_path, stat_error);
- CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- strerror(errno));
- return FALSE;
- }
- exists = S_ISDIR (stat_buf.st_mode);
- if (!exists) return FALSE;
-#endif
-
-
- /* check if the mbox file exists */
- stat_error = stat (mbox_folder->folder_file_path, &stat_buf);
- if (stat_error == -1)
- return FALSE;
-
- exists = S_ISREG (stat_buf.st_mode);
- /* we should check the rights here */
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::exists\n");
- return exists;
-}
-
-
-
-
-
-
-
-
-static gboolean
-_create (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- const gchar *folder_file_path, *folder_dir_path;
- mode_t dir_mode = S_IRWXU;
- gint mkdir_error;
- gboolean folder_already_exists;
- int creat_fd;
- mode_t old_umask;
-
- /* check if the folder object exists */
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
-
- /* call default implementation */
- parent_class->create (folder, ex);
-
- /* get the paths of what we need to create */
- folder_file_path = mbox_folder->folder_file_path;
- folder_dir_path = mbox_folder->folder_file_path;
-
- if (!(folder_file_path || folder_dir_path)) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- /* if the folder already exists, simply return */
- folder_already_exists = camel_folder_exists (folder,ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- if (folder_already_exists) return TRUE;
-
-
- /* create the directory for the subfolders */
- mkdir_error = mkdir (folder_dir_path, dir_mode);
- if (mkdir_error == -1) goto io_error;
-
-
- /* create the mbox file */
- /* it must be rw for the user and none for the others */
- old_umask = umask (0700);
- creat_fd = open (folder_file_path,
- O_WRONLY | O_CREAT | O_APPEND,
- S_IRUSR | S_IWUSR);
- umask (old_umask);
- if (creat_fd == -1) goto io_error;
- close (creat_fd);
-
- /* create the summary object */
- mbox_folder->internal_summary = g_new (CamelMboxSummary, 1);
- mbox_folder->internal_summary->nb_message = 0;
- mbox_folder->internal_summary->next_uid = 1;
- mbox_folder->internal_summary->mbox_file_size = 0;
- mbox_folder->internal_summary->message_info = g_array_new (FALSE, FALSE, sizeof (CamelMboxSummaryInformation));
-
- return TRUE;
-
- /* exception handling for io errors */
- io_error :
-
- CAMEL_LOG_WARNING ("CamelMboxFolder::create, error when creating %s and %s\n",
- folder_dir_path, folder_file_path);
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
-
- if (errno == EACCES) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "You don't have the permission to create the mbox file.");
- return FALSE;
- } else {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to create the mbox file.");
- return FALSE;
- }
-}
-
-
-
-
-
-
-
-
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- const gchar *folder_file_path, *folder_dir_path;
- gint rmdir_error = 0;
- gint unlink_error = 0;
- gboolean folder_already_exists;
-
- /* check if the folder object exists */
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
-
- /* in the case where the folder does not exist,
- return immediatly */
- folder_already_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- if (!folder_already_exists) return TRUE;
-
-
- /* call default implementation.
- It should delete the messages in the folder
- and recurse the operation to subfolders */
- parent_class->delete (folder, recurse, ex);
-
-
- /* get the paths of what we need to be deleted */
- folder_file_path = mbox_folder->folder_file_path;
- folder_dir_path = mbox_folder->folder_file_path;
-
- if (!(folder_file_path || folder_dir_path)) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- /* physically delete the directory */
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::delete removing directory %s\n", folder_dir_path);
- rmdir_error = rmdir (folder_dir_path);
- if (rmdir_error == -1)
- switch errno {
- case EACCES :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "Not enough permission to delete the mbox folder");
- return FALSE;
- break;
-
- case ENOTEMPTY :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NON_EMPTY,
- "mbox folder not empty. Cannot delete it. Maybe use recurse flag ?");
- return FALSE;
- break;
- default :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to delete the mbox folder.");
- return FALSE;
- }
-
- /* physically delete the file */
- unlink_error = unlink (folder_dir_path);
- if (unlink_error == -1)
- switch errno {
- case EACCES :
- case EPERM :
- case EROFS :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "Not enough permission to delete the mbox file");
- return FALSE;
- break;
-
- case EFAULT :
- case ENOENT :
- case ENOTDIR :
- case EISDIR :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
- "Invalid mbox file");
- return FALSE;
- break;
-
- default :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to delete the mbox folder.");
- return FALSE;
- }
-
-
- return TRUE;
-}
-
-
-
-
-gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
-
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- const gchar *folder_file_path;
- gboolean folder_already_exists;
- int creat_fd;
- mode_t old_umask;
-
-
- /* check if the folder object exists */
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- /* in the case where the folder does not exist,
- return immediatly */
- folder_already_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- if (!folder_already_exists) return TRUE;
-
-
-
- /* get the paths of the mbox file we need to delete */
- folder_file_path = mbox_folder->folder_file_path;
-
- if (!folder_file_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- /* create the mbox file */
- /* it must be rw for the user and none for the others */
- old_umask = umask (0700);
- creat_fd = open (folder_file_path,
- O_WRONLY | O_TRUNC,
- S_IRUSR | S_IWUSR);
- umask (old_umask);
- if (creat_fd == -1) goto io_error;
- close (creat_fd);
-
- return TRUE;
-
- /* exception handling for io errors */
- io_error :
-
- CAMEL_LOG_WARNING ("CamelMboxFolder::create, error when deleting files %s\n",
- folder_file_path);
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
-
- if (errno == EACCES) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "You don't have the permission to write in the mbox file.");
- return FALSE;
- } else {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to write in the mbox file.");
- return FALSE;
- }
-
-
-}
-
-
-
-
-
-
-
-
-
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- GList *subfolder_name_list = NULL;
-
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- const gchar *folder_dir_path;
- gboolean folder_exists;
-
- struct stat stat_buf;
- gint stat_error = 0;
- //GList *file_list;
- gchar *entry_name;
- gchar *full_entry_name;
- gchar *real_folder_name;
- struct dirent *dir_entry;
- DIR *dir_handle;
- gboolean folder_suffix_found;
-
- //gchar *io_error_text;
-
-
-
- /* check if the folder object exists */
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
-
- /* in the case the folder does not exist,
- raise an exception */
- folder_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- if (!folder_exists) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "Inexistant folder.");
- return FALSE;
- }
-
-
- /* get the mbox subfolders directories */
- folder_dir_path = mbox_folder->folder_file_path;
- if (!folder_dir_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "Invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- dir_handle = opendir (folder_dir_path);
-
- /* read the first entry in the directory */
- dir_entry = readdir (dir_handle);
- while ((stat_error != -1) && (dir_entry != NULL)) {
-
- /* get the name of the next entry in the dir */
- entry_name = dir_entry->d_name;
- full_entry_name = g_strdup_printf ("%s/%s", folder_dir_path, entry_name);
- stat_error = stat (full_entry_name, &stat_buf);
- g_free (full_entry_name);
-
- /* is it a directory ? */
- if ((stat_error != -1) && S_ISDIR (stat_buf.st_mode)) {
- /* yes, add it to the list */
- if (entry_name[0] != '.') {
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::list_subfolders adding "
- "%s\n", entry_name);
-
- /* if the folder is a netscape folder, remove the
- ".sdb" from the name */
- real_folder_name = string_prefix (entry_name, ".sdb", &folder_suffix_found);
- /* stick here the tests for other folder suffixes if any */
-
- if (!folder_suffix_found) real_folder_name = g_strdup (entry_name);
-
- /* add the folder name to the list */
- subfolder_name_list = g_list_append (subfolder_name_list,
- real_folder_name);
- }
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- return subfolder_name_list;
-
-
-
- /* io exception handling */
- io_error :
-
- switch errno {
- case EACCES :
-
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "Unable to list the directory. Full Error text is : %s ",
- strerror (errno));
- break;
-
- case ENOENT :
- case ENOTDIR :
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
- "Invalid mbox folder path. Full Error text is : %s ",
- strerror (errno));
- break;
-
- default :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to delete the mbox folder.");
-
- }
-
- g_list_free (subfolder_name_list);
- return NULL;
-}
-
-
-
-
-static gint
-_get_message_count (CamelFolder *folder, CamelException *ex)
-{
-
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- gint message_count;
-
- g_assert (folder);
- g_assert (mbox_folder->internal_summary);
-
- message_count = mbox_folder->internal_summary->nb_message;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::get_message_count found %d messages\n", message_count);
- return message_count;
-}
-
-
-static gint
-_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- //guint new_msg_number;
- CamelStream *output_stream;
- guint32 tmp_file_size;
- guint32 next_uid;
- gint tmp_file_fd;
- GArray *message_info_array;
- GArray *mbox_summary_info;
- gchar *tmp_message_filename;
- gint fd1, fd2;
-
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::append_message\n");
-
- tmp_message_filename = g_strdup_printf ("%s.tmp", mbox_folder->folder_file_path);
- /* write the message itself */
- output_stream = camel_stream_fs_new_with_name (tmp_message_filename, CAMEL_STREAM_FS_WRITE);
- if (output_stream != NULL) {
- camel_stream_write_string (output_stream, "From - \n");
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream);
- }
- camel_stream_close (output_stream);
-
- /* at this point we have saved the message to a
- temporary file, now, we have to add the x-evolution
- field and also update the main summary summary */
-
- /*
- First : parse the mbox file, but only from the
- position where the message has been added,
- wich happens to be the last postion in the
- mbox file before we added the message.
- This position is still stored in the summary
- for the moment
- */
- next_uid = mbox_folder->internal_summary->next_uid;
- tmp_file_fd = open (tmp_message_filename, O_RDONLY);
- message_info_array = camel_mbox_parse_file (tmp_file_fd,
- "From - ",
- 0,
- &tmp_file_size,
- &next_uid,
- TRUE,
- NULL,
- 0,
- ex);
-
- close (tmp_file_fd);
-
- /* get the value of the last available UID
- as saved in the summary file */
- next_uid = mbox_folder->internal_summary->next_uid;
-
- /*
- OK, this is not very efficient, we should not use the same
- method as for parsing an entire mail file,
- but I have no time to write a simpler parser
- */
- next_uid = camel_mbox_write_xev (tmp_message_filename,
- message_info_array, &tmp_file_size, next_uid, ex);
-
- if (camel_exception_get_id (ex)) {
- /* ** FIXME : free the preparsed information */
- return -1;
- }
-
- mbox_summary_info =
- parsed_information_to_mbox_summary (message_info_array);
-
-
-
-
- /* store the number of messages as well as the summary array */
- mbox_folder->internal_summary->nb_message += 1;
- mbox_folder->internal_summary->next_uid = next_uid;
-
- ((CamelMboxSummaryInformation *)(mbox_summary_info->data))->position += mbox_folder->internal_summary->mbox_file_size;
- mbox_folder->internal_summary->mbox_file_size += tmp_file_size;
-
- camel_mbox_summary_append_entries (mbox_folder->internal_summary, mbox_summary_info);
-
- /* append the new entry of the internal summary to
- the external summary */
- camel_mbox_summary_append_internal_to_external (mbox_folder->internal_summary,
- folder->summary,
- mbox_folder->internal_summary->nb_message-1);
-
- g_array_free (mbox_summary_info, TRUE);
-
-
- /* append the temporary file message to the mbox file */
- fd1 = open (tmp_message_filename, O_RDONLY);
- fd2 = open (mbox_folder->folder_file_path,
- O_WRONLY | O_CREAT | O_APPEND,
- S_IRUSR | S_IWUSR);
-
- if (fd2 == -1) {
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "could not open the mbox folder file for appending the message\n"
- "\t%s\n"
- "Full error is : %s\n",
- mbox_folder->folder_file_path,
- strerror (errno));
- return -1;
- }
-
- camel_mbox_copy_file_chunk (fd1,
- fd2,
- tmp_file_size,
- ex);
- close (fd1);
- close (fd2);
-
- /* remove the temporary file */
- unlink (tmp_message_filename);
-
- /* generate the folder md5 signature */
- md5_get_digest_from_file (mbox_folder->folder_file_path, mbox_folder->internal_summary->md5_digest);
-
-
- g_free (tmp_message_filename);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::append_message\n");
-
- return -1;
-}
-
-
-
-
-static GList *
-_get_uid_list (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- GArray *message_info_array;
- CamelMboxSummaryInformation *message_info;
- GList *uid_list = NULL;
- int i;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::get_uid_list\n");
-
- message_info_array = mbox_folder->internal_summary->message_info;
-
- for (i=0; i<message_info_array->len; i++) {
-
- message_info = (CamelMboxSummaryInformation *)(message_info_array->data) + i;
- uid_list = g_list_prepend (uid_list, g_strdup_printf ("%u", message_info->uid));
- }
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::get_uid_list\n");
-
- return uid_list;
-}
-
-
-
-
-
-
-
-
-static CamelMimeMessage *
-_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
-
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- GArray *message_info_array;
- CamelMboxSummaryInformation *message_info;
- guint32 searched_uid;
- int i;
- gboolean uid_found;
- CamelStreamFs *message_stream;
- CamelMimeMessage *message = NULL;
- CamelStore *parent_store;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::get_uid_list\n");
-
- searched_uid = strtoul(uid, (char **)NULL, 10);
-
- message_info_array = mbox_folder->internal_summary->message_info;
- i=0;
- uid_found = FALSE;
-
- /* first, look for the message that has the searched uid */
- while ((i<message_info_array->len) && (!uid_found)) {
- message_info = (CamelMboxSummaryInformation *)(message_info_array->data) + i;
- uid_found = (message_info->uid == searched_uid);
- i++;
- }
-
- /* if the uid was not found, raise an exception and return */
- if (!uid_found) {
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- "uid %s not found in the folder",
- uid);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::get_uid_list\n");
- return NULL;
- }
-
- /* at this point, the message_info structure
- contains the informations concerning the
- message that was searched for */
-
- /* create a stream bound to the message */
- message_stream = camel_stream_fs_new_with_name_and_bounds (mbox_folder->folder_file_path,
- CAMEL_STREAM_FS_READ,
- message_info->position,
- message_info->position + message_info->size);
-
-
- /* get the parent store */
- parent_store = camel_folder_get_parent_store (folder, ex);
- if (camel_exception_get_id (ex)) {
- gtk_object_unref (GTK_OBJECT (message_stream));
- return NULL;
- }
-
-
- message = camel_mime_message_new_with_session (camel_store_get_session (parent_store, ex));
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (message_stream));
-
-
-
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::get_uid_list\n");
- return message;
-}
-
-static CamelFolderSummary *
-search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex)
-{
- return camel_mbox_folder_search_by_expression(folder, expression);
-}
diff --git a/camel/providers/mbox/camel-mbox-folder.h b/camel/providers/mbox/camel-mbox-folder.h
deleted file mode 100644
index 76288d5c3c..0000000000
--- a/camel/providers/mbox/camel-mbox-folder.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-folder.h : Abstract class for an email folder */
-
-/*
- *
- * Author : Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code .
- *
- * 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_MBOX_FOLDER_H
-#define CAMEL_MBOX_FOLDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-folder.h"
-#include "camel-mbox-summary.h"
-
-/* #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))
-
-
-typedef struct {
- CamelFolder parent_object;
-
- CamelFolderSummary *external_summary;
- /* the external summary is intended to be read by callers */
-
- gchar *folder_file_path; /* contains the messages */
- gchar *summary_file_path; /* contains the messages summary */
- gchar *folder_dir_path; /* contains the subfolders */
- gchar *index_file_path; /* index of body contents */
-
- CamelMboxSummary *internal_summary; /* internal summary object */
- GList *uid_array;
-
-} CamelMboxFolder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMboxFolderClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mbox_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MBOX_FOLDER_H */
diff --git a/camel/providers/mbox/camel-mbox-parser.c b/camel/providers/mbox/camel-mbox-parser.c
deleted file mode 100644
index d730c07aa6..0000000000
--- a/camel/providers/mbox/camel-mbox-parser.c
+++ /dev/null
@@ -1,901 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-parser.c : mbox folder parser */
-
-/*
- *
- * Author : Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code .
- *
- * 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-mbox-parser.h"
-#include "camel-mbox-utils.h"
-#include "camel-log.h"
-#include "camel-exception.h"
-#include <sys/types.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-
-
-#define MBOX_PARSER_BUF_SIZE 10000
-
-#define MBOX_PARSER_FROM_KW "from:"
-#define MBOX_PARSER_FROM_KW_SZ 5
-
-#define MBOX_PARSER_DATE_KW "date:"
-#define MBOX_PARSER_DATE_KW_SZ 5
-
-#define MBOX_PARSER_SUBJECT_KW "subject:"
-#define MBOX_PARSER_SUBJECT_KW_SZ 8
-
-#define MBOX_PARSER_TO_KW "to:"
-#define MBOX_PARSER_TO_KW_SZ 3
-
-#define MBOX_PARSER_X_EVOLUTION_KW "x-evolution:"
-#define MBOX_PARSER_X_EVOLUTION_KW_SZ 12
-
-/* the maximum lentgh of all the previous keywords */
-#define MBOX_PARSER_MAX_KW_SIZE 12
-
-
-#define MBOX_PARSER_SUMMARY_SIZE 150
-
-
-
-
-
-
-typedef struct {
-
- int fd; /* file descriptor of the mbox file */
- glong real_position; /* real position in the file */
-
-
- gchar *message_delimiter; /* message delimiter string */
- guint message_delimiter_length;
-
- guint message_summary_size; /* how many characters from the begining of the
- mail to put into the message summary */
-
- GArray *preparsed_messages; /* array of MessagePreParsingInfo */
- CamelMboxParserMessageInfo current_message_info; /* used to store curent info */
- gboolean is_pending_message; /* is there some message information pending ? */
-
- /* buffer info */
- gchar *buffer; /* temporary buffer */
- guint left_chunk_size; /* size of the left chunk in the temp buffer */
- guint last_position; /* last position that can be compared to a keyword */
- guint current_position; /* current position in the temp buffer */
-
- /* other */
- GString *tmp_string; /* temporary string to fill the headers in */
-
-
-
-} CamelMboxPreParser;
-
-
-/* clear a preparsing info structure */
-static void
-clear_message_info (CamelMboxParserMessageInfo *preparsing_info)
-{
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::clear_message_info\n");
-
- preparsing_info->message_position = 0;
- preparsing_info->size = 0;
- preparsing_info->from = NULL;
- preparsing_info->date = NULL;
- preparsing_info->subject = NULL;
- preparsing_info->priority = NULL;
- preparsing_info->references = NULL;
- preparsing_info->body_summary = NULL;
- preparsing_info->end_of_headers_offset = 0;
-
- preparsing_info->x_evolution_offset = 0;
- preparsing_info->status = 0;
- preparsing_info->uid = 0;
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::clear_message_info\n");
-}
-
-
-
-/**
- * new_parser: create a new parser object
- * @fd: file descriptor opened on the mbox file
- * @message_delimiter: the string that announce the start of a new message.
- *
- * Create a new parser object. This object is the place where are
- * stored all the information concerning the parsing process.
- *
- * Return value: The newly created parser object.
- **/
-static CamelMboxPreParser *
-new_parser (int fd,
- const gchar *message_delimiter)
-{
- CamelMboxPreParser *parser;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::ew_parser\n");
-
- parser = g_new0 (CamelMboxPreParser, 1);
-
- parser->fd = fd;
- parser->buffer = g_new (gchar, MBOX_PARSER_BUF_SIZE);
- parser->current_position = 0;
- parser->message_delimiter = g_strdup (message_delimiter);
- parser->message_delimiter_length = strlen (message_delimiter);
- parser->real_position = 0;
- parser->preparsed_messages = g_array_new (FALSE, FALSE, sizeof (CamelMboxParserMessageInfo));
- parser->message_summary_size = MBOX_PARSER_SUMMARY_SIZE;
-
- parser->left_chunk_size = MAX (parser->message_delimiter_length, MBOX_PARSER_MAX_KW_SIZE);
-
- parser->tmp_string = g_string_sized_new (1000);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::ew_parser\n");
-
- return parser;
-}
-
-
-
-/**
- * parser_free: free the parser object
- * @parser: the parser objet to free.
- *
- * it is important to notice that all structures allocated
- * in new_parser () are freed ** EXCEPT ** the message
- * information array, i.e. the preparsed_messages
- * field.
- **/
-static void
-parser_free (CamelMboxPreParser *parser)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::parser_free\n");
-
- g_free (parser->buffer);
- g_free (parser->message_delimiter);
- g_string_free (parser->tmp_string, TRUE);
- g_free (parser);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::parser_free\n");
-}
-
-
-
-
-/* ** handle exceptions here */
-/**
- * initialize_buffer: read the first chunk of data in the buffer
- * @parser: parser object to fill
- * @first_position: position to start the read at
- *
- * read the first chunk of data from the mbox file.
- *
- **/
-static void
-initialize_buffer (CamelMboxPreParser *parser,
- glong first_position)
-{
- gint seek_res;
- gint buf_nb_read;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::intialize_buffer\n");
-
- g_assert (parser);
-
- /* set the search start position */
- seek_res = lseek (parser->fd, first_position, SEEK_SET);
- //if (seek_res == (off_t)-1) goto io_error;
-
-
- /* the first part of the buffer is filled with newlines,
- but the next time a chunk of buffer is read, it will
- be filled with the last bytes of the previous chunk.
- This allows simple g_strcasecmp to test for the presence of
- the keyword */
- memset (parser->buffer, '\n', parser->left_chunk_size);
- do {
- buf_nb_read = read (parser->fd, parser->buffer + parser->left_chunk_size,
- MBOX_PARSER_BUF_SIZE - parser->left_chunk_size);
- } while ((buf_nb_read == -1) && (errno == EINTR));
- /* ** check for an error here */
-
- if (buf_nb_read < MBOX_PARSER_BUF_SIZE - parser->left_chunk_size) {
- /* fill the end of the buffer with 0\ */
- memset (parser->buffer + buf_nb_read + parser->left_chunk_size, '\0',
- MIN (parser->left_chunk_size, MBOX_PARSER_BUF_SIZE - buf_nb_read - parser->left_chunk_size));
- };
-
- parser->last_position = MIN (buf_nb_read + parser->left_chunk_size + 1,
- MBOX_PARSER_BUF_SIZE - parser->left_chunk_size);
- parser->current_position = parser->left_chunk_size;
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::intialize_buffer\n");
-
-}
-
-
-
-
-/**
- * read_next_buffer_chunk: read the next chunk of data in the mbox file
- * @parser: parser object
- *
- * read the next chunk of data in the mbox file.
- * Routine copies the last part of the buffer at
- * the begining are concatenate the read data to
- * it. This allows strcmp of keywords in the buffer,
- * until the last postion. That means you can
- * do a strcmp (buffer, keyword) for any of the
- * keyword defined at the begining of this file.
- *
- **/
-static void
-read_next_buffer_chunk (CamelMboxPreParser *parser)
-{
- gint buf_nb_read;
-
- g_assert (parser);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::intialize_buffer\n");
-
- /* read the next chunk of data in the folder file : */
- /* - first, copy the last bytes from the previous
- chunk at the begining of the new one. */
- memcpy (parser->buffer,
- parser->buffer + MBOX_PARSER_BUF_SIZE - parser->left_chunk_size,
- parser->left_chunk_size);
-
- /* - then read the next chunk on disk */
- do {
- buf_nb_read = read (parser->fd,
- parser->buffer + parser->left_chunk_size,
- MBOX_PARSER_BUF_SIZE - parser->left_chunk_size);
- } while ((buf_nb_read == -1) && (errno == EINTR));
- /* ** check for an error here */
-
- if (buf_nb_read < MBOX_PARSER_BUF_SIZE - parser->left_chunk_size) {
- /* fill the end of the buffer with 0\ */
- memset (parser->buffer + buf_nb_read + parser->left_chunk_size, '\0',
- MIN (parser->left_chunk_size, MBOX_PARSER_BUF_SIZE - buf_nb_read - parser->left_chunk_size));
- };
-
- parser->last_position = MIN (buf_nb_read + parser->left_chunk_size + 1,
- MBOX_PARSER_BUF_SIZE - parser->left_chunk_size);
-
- parser->current_position = 0;
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::intialize_buffer\n");
-
-}
-
-
-
-/**
- * goto_next_char: go one postion forward in the buffer
- * @parser: parser object
- *
- * goto one position forward in the buffer. If necessary,
- * read the next chunk of data in the file.
- *
- **/
-static void
-goto_next_char (CamelMboxPreParser *parser)
-{
-
- if (parser->current_position < parser->last_position - 1)
- parser->current_position++;
- else
- read_next_buffer_chunk (parser);
-
- parser->real_position++;
-
-}
-
-
-
-
-
-
-
-/**
- * advance_n_chars: go n positions forward in the buffer.
- * @parser: parser object
- * @n: number of characters to advance.
- *
- **/
-static void
-advance_n_chars (CamelMboxPreParser *parser, guint n)
-{
-
- gint position_to_the_end;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::advnce_n_chars\n");
-
- position_to_the_end = parser->last_position - parser->current_position;
-
- if (n < position_to_the_end)
- parser->current_position += n;
- else {
- read_next_buffer_chunk (parser);
- parser->current_position = n - position_to_the_end;
- }
-
- parser->real_position += n;
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::advance_n_chars\n");
-}
-
-
-
-
-
-
-/* called when the buffer has detected the begining of
- a new message. This routine is supposed to simply
- store the previous message information and
- clean the temporary structure used to store
- the informations */
-
-
-/**
- * new_message_detected: routine to call when a new message has been detected
- * @parser: parser object.
- *
- * this routine must be called when the keyword determining the
- * begining of a new message has been detected. It pushes the
- * information fetched for the last message into the message information
- * array. Also, it gets the parser to the end of the line.
- **/
-static void
-new_message_detected (CamelMboxPreParser *parser)
-{
-
- gchar c;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::new_message_detected\n");
-
- /* if we were filling a message information
- save it in the message information array */
-
- if (parser->is_pending_message) {
- parser->current_message_info.size =
- parser->real_position - parser->current_message_info.message_position;
- g_array_append_vals (parser->preparsed_messages, (gchar *)parser +
- G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info), 1);
- }
-
- clear_message_info ( &(parser->current_message_info));
-
- /* go to the end of the line */
- do {
-
- c = parser->buffer[parser->current_position];
- goto_next_char (parser);
-
- } while (c != '\n');
-
- /* save message position in the message information structure */
- (parser->current_message_info).message_position = parser->real_position;
-
- parser->is_pending_message = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::new_message_detected\n");
-}
-
-
-
-
-
-
-
-/**
- * read_header: read the header content contained after the current position.
- * @parser: the parser object.
- * @header_content: a pointer on a (char *) variable to feed with the obtained header string.
- *
- * This routine must be called when the parser has detected a header
- * and it wants the header content to be stored. The parser current position
- * must EXACTLY be located at the begining of the header content line.
- * For example, if the file contains the line :
- * from:Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * When this routine is called, the parser must be located
- * on the "B" of "Bertrand".
- *
- * When this routine returns, the parser is located just
- * after the "\n" at the end of the header content.
- *
- **/
-static void
-read_header (CamelMboxPreParser *parser, gchar **header_content)
-{
- gboolean space = FALSE;
- gboolean newline = FALSE;
- gboolean header_end = FALSE;
- gchar *buffer;
- gchar c;
-
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::read_header\n");
-
- g_assert (parser);
-
- /* reset the header buffer string */
- parser->tmp_string = g_string_truncate (parser->tmp_string, 0);
-
- buffer = parser->buffer;
-
- /* read the current character */
- c = buffer[parser->current_position];
-
- while (! ((c == '\0') || header_end )) {
-
- if (space) {
- if (c == ' ' && c == '\t')
- goto next_char;
- else
- space = FALSE;
- }
-
- if (newline) {
- if (c == ' ' && c == '\t') {
-
- space = TRUE;
- newline = FALSE;
- goto next_char;
- } else {
-
- header_end = TRUE;
- continue;
- }
- }
-
- if (c == '\n') {
- newline = TRUE;
- goto next_char;
- }
-
- /* feed the header content */
- parser->tmp_string = g_string_append_c (parser->tmp_string, c);
-
- next_char: /* read next char in the buffer */
- goto_next_char (parser);
- /* read the current character */
- c = buffer[parser->current_position];
- }
-
-
- /* copy the buffer in the preparsing information structure */
- *header_content = g_strndup (parser->tmp_string->str, parser->tmp_string->len);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::read_header\n");
-
-}
-
-
-
-
-
-
-
-/**
- * read_message_begining: read the first characters of a message body
- * @parser: parser object
- * @message_summary: a pointer on a (gchar *) variable where the obtained string will be stored.
- *
- * Read the first lines of a message. When calling this routine, the
- * parser must be located at the begining of the message body.
- *
- * Return value: if the parsing inside this routine last read a newline, then %TRUE is returned, otherwise %FALSE is returned
- **/
-static gboolean
-read_message_begining (CamelMboxPreParser *parser, gchar **message_summary)
-{
- guint nb_read = 0;
- gchar *buffer;
- gboolean new_message = FALSE;
- guint nb_line = 0;
- g_assert (parser);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::read_message_begining\n");
-
- /* reset the header buffer string */
- parser->tmp_string = g_string_truncate (parser->tmp_string, 0);
-
- buffer = parser->buffer;
- /* the message should not be filled character by
- character but there is no g_string_n_append
- function, so for the moment, this is a lazy
- implementation */
- while (! (buffer[parser->current_position] != '\0') &&
- (nb_line <2) && (nb_read<parser->message_summary_size) &&
- (!new_message)) {
-
-
- /* test if we are not at the end of the message */
- if (buffer[parser->current_position] == '\n') {
-
- nb_line++;
- goto_next_char (parser);
- if ((buffer[parser->current_position] == '\0') ||
- (g_strncasecmp (parser->buffer + parser->current_position,
- parser->message_delimiter,
- parser->message_delimiter_length) == 0)) {
- new_message = TRUE;
- continue;
- } else {
- /* we're not at the end, so let's just add the cr to the summary */
- parser->tmp_string = g_string_append_c (parser->tmp_string,
- '\n');
- nb_read++;
- continue;
- }
-
-
- }
-
- parser->tmp_string = g_string_append_c (parser->tmp_string,
- buffer[parser->current_position]);
- nb_read++;
- goto_next_char (parser);
- }
-
- *message_summary = g_strndup (parser->tmp_string->str, parser->tmp_string->len);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::read_message_begining\n");
-
- return new_message;
-}
-
-
-
-
-
-
-
-
-
-
-/**
- * camel_mbox_parse_file: read an mbox file and parse it.
- * @fd: file descriptor opened on the mbox file.
- * @message_delimiter: character string delimiting the beginig of a new message
- * @start_position: poition in the file where to start the parsing.
- * @get_message_summary: should the parser retrieve the begining of the messages
- * @status_callback: function to call peridically to indicate the progress of the parser
- * @status_interval: floating value between 0 and 1 indicate how often to call @status_callback.
- * @user_data: user data that will be passed to the callback function
- *
- * This routine parses an mbox file and retreives both the message starting positions and
- * some of the informations contained in the message. Those informations are mainly
- * some RFC822 headers values but also (optionally) the first characters of the mail
- * body. The @get_message_summary parameter allows to enable or disable this option.
- *
- *
- * Return value: An array of CamelMboxParserMessageInfo containing the informations on each message parsed in the file
- **/
-GArray *
-camel_mbox_parse_file (int fd,
- const gchar *message_delimiter,
- glong start_position,
- guint32 *file_size,
- guint32 *next_uid,
- gboolean get_message_summary,
- camel_mbox_preparser_status_callback *status_callback,
- double status_interval,
- gpointer user_data)
-{
- CamelMboxPreParser *parser;
- gboolean is_parsing_a_message = FALSE;
- gchar c;
- struct stat stat_buf;
- gint fstat_result;
- glong total_file_size;
- int last_status = 0;
- int real_interval;
- gboolean newline;
- GArray *return_value;
- gchar *x_ev_header_content;
- guint32 next_available_uid = 1;
-
-
- g_assert (next_uid);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::parse_file\n");
-
- /* get file size */
- fstat_result = fstat (fd, &stat_buf);
- if (fstat_result == -1) {
- g_warning ("Manage exception here \n");
- }
-
- total_file_size = stat_buf.st_size;
- real_interval = status_interval * total_file_size;
-
-
- /* create the parser */
- parser = new_parser (fd, message_delimiter);
-
- /* initialize the temporary char buffer */
- initialize_buffer (parser, start_position);
-
- /* the first line is indeed at the begining of a new line ... */
- newline = TRUE;
-
- while (parser->buffer[parser->current_position] != '\0') {
-
-
-
-
- /* read the current character */
- if (!newline) {
- c = parser->buffer[parser->current_position];
- newline = (c == '\n');
- goto_next_char (parser);
- }
-
- if (newline) {
-
- /* check if we reached a status milestone */
- if ( status_callback && ((parser->real_position - last_status) > real_interval)) {
- last_status += real_interval;
- status_callback ((double)last_status / (double)total_file_size,
- user_data);
- }
-
- /* is the next part a message delimiter ? */
- if (strncmp (parser->buffer + parser->current_position,
- parser->message_delimiter,
- parser->message_delimiter_length) == 0) {
-
- is_parsing_a_message = TRUE;
- new_message_detected (parser);
- newline = TRUE;
- continue;
- }
-
-
- if (is_parsing_a_message) {
- /* we could find the headers in a clever way, like
- storing them in a list of pair
- [keyword, offset_in_CamelMboxParserMessageInfo]
- I am too busy for now. Contribution welcome */
-
- /* is the next part a "from" header ? */
- if (g_strncasecmp (parser->buffer + parser->current_position,
- MBOX_PARSER_FROM_KW,
- MBOX_PARSER_FROM_KW_SZ) == 0) {
-
- advance_n_chars (parser, MBOX_PARSER_FROM_KW_SZ);
- read_header (parser, (gchar **) ((gchar *)parser +
- G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) +
- G_STRUCT_OFFSET (CamelMboxParserMessageInfo, from)));
-
- newline = TRUE;
- continue;
- }
-
- /* is the next part a "Date" header ? */
- if (g_strncasecmp (parser->buffer + parser->current_position,
- MBOX_PARSER_DATE_KW,
- MBOX_PARSER_DATE_KW_SZ) == 0) {
-
- advance_n_chars (parser, MBOX_PARSER_DATE_KW_SZ);
- read_header (parser, (gchar **) ((gchar *)parser +
- G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) +
- G_STRUCT_OFFSET (CamelMboxParserMessageInfo, date)));
-
- newline = TRUE;
- continue;
- }
-
-
- /* is the next part a "Subject" header ? */
- if (g_strncasecmp (parser->buffer + parser->current_position,
- MBOX_PARSER_SUBJECT_KW,
- MBOX_PARSER_SUBJECT_KW_SZ) == 0) {
-
- advance_n_chars (parser, MBOX_PARSER_SUBJECT_KW_SZ);
- read_header (parser, (gchar **) ((gchar *)parser +
- G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) +
- G_STRUCT_OFFSET (CamelMboxParserMessageInfo, subject)));
-
- newline = TRUE;
- continue;
- }
-
-
- /* is the next part a "To" header ? */
- if (g_strncasecmp (parser->buffer + parser->current_position,
- MBOX_PARSER_TO_KW,
- MBOX_PARSER_TO_KW_SZ) == 0) {
-
- advance_n_chars (parser, MBOX_PARSER_TO_KW_SZ);
- read_header (parser, (gchar **) ((gchar *)parser +
- G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) +
- G_STRUCT_OFFSET (CamelMboxParserMessageInfo, to)));
-
- newline = TRUE;
- continue;
- }
-
-
- /* is the next part a "X-evolution" header ? */
- if (g_strncasecmp (parser->buffer + parser->current_position,
- MBOX_PARSER_X_EVOLUTION_KW,
- MBOX_PARSER_X_EVOLUTION_KW_SZ) == 0) {
-
- /* in the case of the evolution private field, we store
- the field position as well as its length because
- we will have to change them */
- parser->current_message_info.x_evolution_offset = parser->real_position
- - parser->current_message_info.message_position;
- advance_n_chars (parser, MBOX_PARSER_X_EVOLUTION_KW_SZ);
-
- /* read the header */
- read_header (parser, &x_ev_header_content);
-
- /* parse it and put the result in the uid and status fields */
- camel_mbox_xev_parse_header_content (x_ev_header_content,
- (guint32 *) ((gchar *)parser +
- G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) +
- G_STRUCT_OFFSET (CamelMboxParserMessageInfo, uid)),
- (guchar *) ((gchar *)parser +
- G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) +
- G_STRUCT_OFFSET (CamelMboxParserMessageInfo, status)));
- g_free (x_ev_header_content);
- next_available_uid = MAX (next_available_uid, parser->current_message_info.uid);
-
- newline = TRUE;
- continue;
- }
-
-
-
-
- /* is it an empty line ? */
- if (parser->buffer[parser->current_position] == '\n') {
-
- parser->current_message_info.end_of_headers_offset =
- parser->real_position - parser->current_message_info.message_position;
-
- goto_next_char (parser);
- if (get_message_summary)
- newline = read_message_begining (parser, (gchar **) ((gchar *)parser +
- G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) +
- G_STRUCT_OFFSET (CamelMboxParserMessageInfo, body_summary)));
-
- is_parsing_a_message = FALSE;
- continue;
- }
- }
- newline = FALSE;
- }
-
- }
-
- /* if there is a pending message information put it in the array */
- if (parser->is_pending_message) {
- parser->current_message_info.size =
- parser->real_position - parser->current_message_info.message_position;
- g_array_append_vals (parser->preparsed_messages, (gchar *)parser +
- G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info), 1);
- }
-
- return_value = parser->preparsed_messages;
- *file_size = parser->real_position;
- *next_uid = next_available_uid;
- /* free the parser */
- parser_free (parser);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::parse_file\n");
-
- return return_value;
-}
-
-
-
-
-
-
-
-
-
-
-#ifdef MBOX_PARSER_TEST
-/* to build the test :
-
- gcc -O3 -I/opt/gnome/lib/glib/include `glib-config --cflags` -o test_parser -DMBOX_PARSER_TEST -I ../.. -I ../../.. -I /usr/lib/glib/include camel-mbox-parser.c `glib-config --libs` -lm
-
-
- */
-
-
-#include <math.h>
-
-static void
-status (double done, gpointer user_data)
-{
- printf ("%d %% done\n", (int)floor (done * 100));
-}
-int
-main (int argc, char **argv)
-{
- int test_file_fd;
- int i;
- int file_size;
- int next_uid;
- GArray *message_positions;
- CamelMboxParserMessageInfo *message_info;
- gchar tmp_buffer[50];
-
- tmp_buffer[49] = '\0';
-
- if (argc<2) {
- printf("usage: %s mbox\n", argv[0]);
- return 1;
- }
-
- test_file_fd = open (argv[1], O_RDONLY);
- message_positions = camel_mbox_parse_file (test_file_fd,
- "From ",
- 0,
- &file_size,
- &next_uid,
- TRUE,
- status,
- 0.05,
- NULL);
-
- printf ("Found %d messages \n", message_positions->len);
-
-
- for (i=0; i<message_positions->len; i++) {
-
- message_info = ((CamelMboxParserMessageInfo *)(message_positions->data)) + i;
- printf ("\n\n** Message %d : \n", i);
- printf ("Size : %d\n", message_info->size);
- printf ("From: %s\n", message_info->from);
- printf ("Date: %s\n", message_info->date);
- printf ("Subject: %s\n", message_info->subject);
- printf ("Summary: %s\n", message_info->body_summary) ;
-
-
- lseek (test_file_fd, message_info->message_position, SEEK_SET);
- read (test_file_fd, tmp_buffer, 49);
- printf ("File content at position %d : \n===\n%s\n===\n", message_info->message_position, tmp_buffer);
-
- }
-
-
-
- return 0;
-}
-
-
-
-
-#endif /* MBOX_PARSER_TEST */
diff --git a/camel/providers/mbox/camel-mbox-parser.h b/camel/providers/mbox/camel-mbox-parser.h
deleted file mode 100644
index 1c49ea55c6..0000000000
--- a/camel/providers/mbox/camel-mbox-parser.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-parser.c : mbox folder parser */
-
-/*
- *
- * Author : Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code .
- *
- * 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 <glib.h>
-#include "camel-log.h"
-#include "camel-exception.h"
-
-
-typedef struct {
-
- glong message_position;
- glong size;
-
- gchar *from;
- gchar *to;
- gchar *date;
- gchar *subject;
- gchar *priority;
- gchar *references;
- gchar *body_summary;
- gshort end_of_headers_offset;
-
- gchar *x_evolution;
- gshort x_evolution_offset;
- guint32 uid;
- guchar status;
-
-} CamelMboxParserMessageInfo;
-
-
-typedef void camel_mbox_preparser_status_callback (double percentage_done, gpointer user_data);
-
-
-GArray *
-camel_mbox_parse_file (int fd,
- const gchar *message_delimiter,
- glong start_position,
- guint32 *file_size,
- guint32 *next_uid,
- gboolean get_message_summary,
- camel_mbox_preparser_status_callback *status_callback,
- double status_interval,
- gpointer user_data);
-
diff --git a/camel/providers/mbox/camel-mbox-provider.c b/camel/providers/mbox/camel-mbox-provider.c
deleted file mode 100644
index 873dca0954..0000000000
--- a/camel/providers/mbox/camel-mbox-provider.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-provider.c: mbox provider registration code */
-
-/*
- * Authors :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright (C) 2000 HelixCode (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-mbox-store.h"
-#include "camel-provider.h"
-#include "camel-log.h"
-
-
-static CamelProvider _mbox_provider = {
- (GtkType) 0,
- PROVIDER_STORE,
- "mbox",
- "Camel default mbox provider",
- "This the first full fledged local mail provider",
- (GModule *) NULL
-};
-
-CamelProvider *
-camel_provider_module_init ()
-{
- _mbox_provider.object_type = camel_mbox_store_get_type();
- return &_mbox_provider;
-}
-
-
-
diff --git a/camel/providers/mbox/camel-mbox-search.c b/camel/providers/mbox/camel-mbox-search.c
deleted file mode 100644
index b46c046b6d..0000000000
--- a/camel/providers/mbox/camel-mbox-search.c
+++ /dev/null
@@ -1,857 +0,0 @@
-/*
- * Copyright 2000 HelixCode (http://www.helixcode.com).
- *
- * Author :
- * Michael Zucchi <notzed@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 <glib.h>
-#include <stdio.h>
-#include <time.h>
-#include <string.h>
-
-#include <camel/gmime-utils.h>
-#include <camel/camel-log.h>
-#include "camel/camel-mime-message.h"
-#include "camel/camel-mime-part.h"
-#include "camel/camel-stream.h"
-#include "camel/camel-stream-fs.h"
-#include "camel/camel.h"
-#include "camel-mbox-folder.h"
-
-#define HAVE_IBEX
-#ifdef HAVE_IBEX
-#include "ibex.h"
-#endif
-
-#define p(x) /* parse debug */
-#define r(x) /* run debug */
-#define d(x) /* general debug */
-
-
-/*
-
- This is not yet complete.
-
- The following s-exp's are supported:
-
- list = (and list*)
- perform an intersection of a number of lists, and return that.
-
- bool = (and bool*)
- perform a boolean AND of boolean values.
-
- list = (or list*)
- perform a union of a number of lists, returning the new list.
-
- bool = (or bool*)
- perform a boolean OR of boolean values.
-
- Comparison operators:
-
- bool = (lt int int)
- bool = (gt int int)
- bool = (eq int int)
-
- bool = (lt string string)
- bool = (gt string string)
- bool = (eq string string)
- Perform a comparision of 2 integers, or 2 string values.
-
- Matching operators:
-
- list = (contains string)
- Returns a list of all messages containing the string in their body.
-
- list = (match-all bool-expr)
- Returns a list of all messages for which the bool expression is true.
- The bool-expr is evaluated for each message in turn.
- It is more efficient not to perform body-content comparisons inside a
- match-all operator.
-
- int = (date-sent)
- Returns a time_t of the date-sent of the message.
-
- bool = (header-contains string1 string2)
- Returns true if the current message (inside a match-all operator)
- has a header 'string1', which contains 'string2'
-*/
-
-static GScannerConfig scanner_config =
-{
- (
- " \t\r\n"
- ) /* cset_skip_characters */,
- (
- G_CSET_a_2_z
- "_"
- G_CSET_A_2_Z
- ) /* cset_identifier_first */,
- (
- G_CSET_a_2_z
- "_0123456789-"
- G_CSET_A_2_Z
- G_CSET_LATINS
- G_CSET_LATINC
- ) /* cset_identifier_nth */,
- ( "#\n" ) /* cpair_comment_single */,
-
- FALSE /* case_sensitive */,
-
- TRUE /* skip_comment_multi */,
- TRUE /* skip_comment_single */,
- TRUE /* scan_comment_multi */,
- TRUE /* scan_identifier */,
- FALSE /* scan_identifier_1char */,
- FALSE /* scan_identifier_NULL */,
- TRUE /* scan_symbols */,
- FALSE /* scan_binary */,
- TRUE /* scan_octal */,
- TRUE /* scan_float */,
- TRUE /* scan_hex */,
- FALSE /* scan_hex_dollar */,
- TRUE /* scan_string_sq */,
- TRUE /* scan_string_dq */,
- TRUE /* numbers_2_int */,
- FALSE /* int_2_float */,
- FALSE /* identifier_2_string */,
- TRUE /* char_2_token */,
- FALSE /* symbol_2_token */,
- FALSE /* scope_0_fallback */,
-};
-
-
-enum _searchtermtype_t {
- SEARCH_AND,
- SEARCH_OR,
- SEARCH_LT,
- SEARCH_GT,
- SEARCH_EQ,
- SEARCH_CONTAINS,
- SEARCH_DATESENT,
- SEARCH_STRING,
- SEARCH_INT,
- SEARCH_FUNC,
-};
-
-struct _searchterm {
- enum _searchtermtype_t type;
- union {
- char *string;
- int number;
- struct {
- struct _searchterm_symbol *sym;
- struct _searchterm **terms;
- int termcount;
- } func;
- } value;
-};
-
-struct _searchcontext {
- int whatever;
-
- CamelFolder *folder;
-
-#ifdef HAVE_IBEX
- ibex *index; /* index of content for this folder */
-#endif
-
- CamelFolderSummary *summary;
- const GArray *message_info;
-
- CamelMessageInfo *message_current; /* when performing a (match operation */
-};
-
-enum _searchresulttype_t {
- RESULT_ARRAY_PTR=0,
- RESULT_INT,
- RESULT_STRING,
- RESULT_BOOL,
- RESULT_UNDEFINED
-};
-
-struct _searchresult {
- enum _searchresulttype_t type;
- union {
- GPtrArray *ptrarray;
- int number;
- char *string;
- int bool;
- } value;
-};
-
-/* function callbacks */
-static struct _searchresult *search_contains(struct _searchcontext *ctx, struct _searchterm *t);
-static struct _searchresult *search_matches(struct _searchcontext *ctx, struct _searchterm *t);
-static struct _searchresult *search_date_sent(struct _searchcontext *ctx, struct _searchterm *t);
-static struct _searchresult *header_contains(struct _searchcontext *ctx, struct _searchterm *t);
-
-struct _searchterm_symbol {
- char *name;
- int type;
- int argtype;
- struct _searchresult * (*func)(struct _searchcontext *ctx, struct _searchterm *t);
-} symbols[] = {
- { "and", SEARCH_AND, 0, NULL },
- { "or", SEARCH_OR, 0, NULL },
- { "lt", SEARCH_LT, 1, NULL },
- { "gt", SEARCH_GT, 1, NULL },
- { "eq", SEARCH_EQ, 1, NULL },
- { "contains", SEARCH_FUNC, 1, search_contains },
- { "match-all", SEARCH_FUNC, 1, search_matches },
- { "date-sent", SEARCH_FUNC, 1, search_date_sent },
- { "header-contains", SEARCH_FUNC, 1, header_contains },
-};
-
-static struct _searchterm * parse_list(GScanner *gs, int gotbrace);
-static struct _searchterm * parse_value(GScanner *gs);
-
-static struct _searchresult *term_eval(struct _searchcontext *ctx, struct _searchterm *t);
-static void parse_dump_term(struct _searchterm *t, int depth);
-
-/* can you tell, i dont like glib? */
-struct _glib_sux_donkeys {
- int count;
- GPtrArray *uids;
-};
-
-
-/* ok, store any values that are in all sets */
-static void
-g_lib_sux_htand(char *key, int value, struct _glib_sux_donkeys *fuckup)
-{
- if (value == fuckup->count) {
- g_ptr_array_add(fuckup->uids, key);
- }
-}
-
-/* or, store all unique values */
-static void
-g_lib_sux_htor(char *key, int value, struct _glib_sux_donkeys *fuckup)
-{
- g_ptr_array_add(fuckup->uids, key);
-}
-
-static struct _searchresult *
-result_new(int type)
-{
- struct _searchresult *r = g_malloc0(sizeof(*r));
- r->type = type;
- return r;
-}
-
-static void
-result_free(struct _searchresult *t)
-{
- switch(t->type) {
- case RESULT_ARRAY_PTR:
- g_ptr_array_free(t->value.ptrarray, TRUE);
- break;
- case RESULT_BOOL:
- case RESULT_INT:
- break;
- case RESULT_STRING:
- g_free(t->value.string);
- break;
- case RESULT_UNDEFINED:
- break;
- }
- g_free(t);
-}
-
-static struct _searchresult *search_contains(struct _searchcontext *ctx, struct _searchterm *t)
-{
- struct _searchresult *r, *r1;
-
- r = result_new(RESULT_UNDEFINED);
-
- if (t->value.func.termcount>0) {
- if (t->value.func.termcount!=1) {
- printf("warning, only looking for first string in contains clause\n");
- }
- r1 = term_eval(ctx, t->value.func.terms[0]);
- if (r1->type == RESULT_STRING) {
- if (ctx->message_current) {
- int truth = FALSE;
-#ifdef HAVE_IBEX
- int i;
- GPtrArray *array;
-
- if (ctx->index) {
- array = ibex_find(ctx->index, r1->value.string);
-
- for (i=0;i<array->len;i++) {
- if (!strcmp(g_ptr_array_index(array, i), ctx->message_current->uid)) {
- truth = TRUE;
- break;
- }
- }
- g_ptr_array_free(array, TRUE);
- }
-#endif
- r->type = RESULT_BOOL;
- r->value.bool = truth;
- } else {
- r->type = RESULT_ARRAY_PTR;
-#ifdef HAVE_IBEX
- if (ctx->index) {
- /* blah, this should probably copy the index strings? */
- r->value.ptrarray = ibex_find(ctx->index, r1->value.string);
- } else {
- r->value.ptrarray = g_ptr_array_new();
- }
-#endif
- }
- } else {
- printf("you can't search for a contents of a non-string, fool\n");
- }
- result_free(r1);
- }
- return r;
-}
-
-/* run a sub-tree of commands which match on header fields etc */
-static struct _searchresult *search_matches(struct _searchcontext *ctx, struct _searchterm *t)
-{
- int i;
- struct _searchresult *r, *r1;
-
- if (t->value.func.termcount == 1) {
- r = result_new(RESULT_ARRAY_PTR);
- r->value.ptrarray = g_ptr_array_new();
-
- for (i=0;i<ctx->message_info->len;i++) {
- ctx->message_current = &g_array_index(ctx->message_info, CamelMessageInfo, i);
- r1 = term_eval(ctx, t->value.func.terms[0]);
- if (r1->type == RESULT_BOOL) {
- if (r1->value.bool) {
- r(printf("adding message %s\n", ctx->message_current->uid));
- g_ptr_array_add(r->value.ptrarray, ctx->message_current->uid);
- }
- } else {
- printf("invalid syntax, matches require a single bool result\n");
- }
- result_free(r1);
- }
- ctx->message_current = NULL;
- } else {
- r = result_new(RESULT_UNDEFINED);
- printf("invalid syntax, matches only allows a single bool arg\n");
- }
- return r;
-}
-
-/* these variable-getting things could be put into 1 function */
-static struct _searchresult *search_date_sent(struct _searchcontext *ctx, struct _searchterm *t)
-{
- struct _searchresult *r;
-
- if (ctx->message_current) {
- r = result_new(RESULT_INT);
- r->value.number = time(0);
- /* r->value.number = ctx->current_message->date_sent;*/
- } else {
- r = result_new(RESULT_UNDEFINED);
- }
- return r;
-}
-
-/* header contains - can only be used inside a match-all construct */
-/* all headers should be inside a lookup table, so this can search
- all header types */
-static struct _searchresult *header_contains(struct _searchcontext *ctx, struct _searchterm *t)
-{
- struct _searchresult *r;
-
- r(printf("executing header-contains\n"));
-
- /* are we inside a match-all? */
- if (ctx->message_current
- && t->value.func.termcount == 2) {
- char *header, *substring;
- int truth = FALSE;
- struct _searchresult *r1, *r2;
-
- r1 = term_eval(ctx, t->value.func.terms[0]);
- r2 = term_eval(ctx, t->value.func.terms[1]);
-
- if (r1->type == RESULT_STRING
- && r2->type == RESULT_STRING) {
-
- header = r1->value.string;
- substring = r2->value.string;
- if (!strcasecmp(header, "subject")) {
- r(printf("comparing subject: %s\n", ctx->message_current->subject));
- if (ctx->message_current->subject)
- truth = (strstr(ctx->message_current->subject, substring)) != NULL;
- else
- printf("Warning: no subject line in message?\n");
- }
- r(printf("header-contains %s %s = %s\n", header, substring, truth?"TRUE":"FALSE"));
- }
-
- result_free(r1);
- result_free(r2);
-
- r = result_new(RESULT_BOOL);
- r->value.number = truth;
- } else {
- r = result_new(RESULT_UNDEFINED);
- }
- return r;
-}
-
-
-static struct _searchresult *
-term_eval(struct _searchcontext *ctx, struct _searchterm *t)
-{
- struct _searchresult *r, *r1, *r2;
- int i;
-
- r(printf("eval term :\n"));
- r(parse_dump_term(t, 0));
-
- r = g_malloc0(sizeof(*r));
- r->type = RESULT_UNDEFINED;
-
- switch (t->type) {
- case SEARCH_AND: {
- GHashTable *ht = g_hash_table_new(g_str_hash, g_str_equal);
- struct _glib_sux_donkeys lambdafoo;
- int type=-1;
- int bool = TRUE;
-
- r(printf("( and\n"));
-
- for (i=0;bool && i<t->value.func.termcount;i++) {
- r1 = term_eval(ctx, t->value.func.terms[i]);
- if (type == -1)
- type = r1->type;
- if (type != r1->type) {
- printf("invalid types in and operation, all types must be the same\n");
- } else if ( r1->type == RESULT_ARRAY_PTR ) {
- char **a1;
- int l1, j;
-
- a1 = (char **)r1->value.ptrarray->pdata;
- l1 = r1->value.ptrarray->len;
- for (j=0;i<l1;j++) {
- int n;
- n = (int)g_hash_table_lookup(ht, a1[i]);
- g_hash_table_insert(ht, a1[i], (void *)n+1);
- }
- } else if ( r1->type == RESULT_BOOL ) {
- bool &= r1->value.bool;
- }
- result_free(r1);
- }
-
- if (type == RESULT_ARRAY_PTR) {
- lambdafoo.count = t->value.func.termcount;
- lambdafoo.uids = g_ptr_array_new();
- g_hash_table_foreach(ht, (GHFunc)g_lib_sux_htand, &lambdafoo);
- r->type = RESULT_ARRAY_PTR;
- r->value.ptrarray = lambdafoo.uids;
- } else if (type == RESULT_BOOL) {
- r->type = RESULT_BOOL;
- r->value.bool = bool;
- }
-
- g_hash_table_destroy(ht);
-
- break; }
- case SEARCH_OR: {
- GHashTable *ht = g_hash_table_new(g_str_hash, g_str_equal);
- struct _glib_sux_donkeys lambdafoo;
- int type = -1;
- int bool = FALSE;
-
- r(printf("(or \n"));
-
- for (i=0;!bool && i<t->value.func.termcount;i++) {
- r1 = term_eval(ctx, t->value.func.terms[i]);
- if (type == -1)
- type = r1->type;
- if (r1->type != type) {
- printf("wrong types in or operation\n");
- } else if (r1->type == RESULT_ARRAY_PTR) {
- char **a1;
- int l1, j;
-
- a1 = (char **)r1->value.ptrarray->pdata;
- l1 = r1->value.ptrarray->len;
- for (j=0;i<l1;j++) {
- g_hash_table_insert(ht, a1[j], (void *)1);
- }
- } else if (r1->type == RESULT_BOOL) {
- bool |= r1->value.bool;
- }
- result_free(r1);
- }
-
- if (type == RESULT_ARRAY_PTR) {
- lambdafoo.count = t->value.func.termcount;
- lambdafoo.uids = g_ptr_array_new();
- g_hash_table_foreach(ht, (GHFunc)g_lib_sux_htor, &lambdafoo);
- r->type = RESULT_ARRAY_PTR;
- r->value.ptrarray = lambdafoo.uids;
- } else if (type == RESULT_BOOL) {
- r->type = RESULT_BOOL;
- r->value.bool = bool;
- }
- g_hash_table_destroy(ht);
-
- break; }
- case SEARCH_LT:
- r(printf("(lt \n"));
- if (t->value.func.termcount == 2) {
- r1 = term_eval(ctx, t->value.func.terms[0]);
- r2 = term_eval(ctx, t->value.func.terms[1]);
- if (r1->type != r2->type) {
- printf("error, invalid types in compare\n");
- } else if (r1->type == RESULT_INT) {
- r->type = RESULT_BOOL;
- r->value.bool = r1->value.number < r2->value.number;
- } else if (r1->type == RESULT_STRING) {
- r->type = RESULT_BOOL;
- r->value.bool = strcmp(r1->value.string, r2->value.string) < 0;
- }
- }
- break;
- case SEARCH_GT:
- r(printf("(gt \n"));
- if (t->value.func.termcount == 2) {
- r1 = term_eval(ctx, t->value.func.terms[0]);
- r2 = term_eval(ctx, t->value.func.terms[1]);
- if (r1->type != r2->type) {
- printf("error, invalid types in compare\n");
- } else if (r1->type == RESULT_INT) {
- r->type = RESULT_BOOL;
- r->value.bool = r1->value.number > r2->value.number;
- } else if (r1->type == RESULT_STRING) {
- r->type = RESULT_BOOL;
- r->value.bool = strcmp(r1->value.string, r2->value.string) > 0;
- }
- }
- break;
- case SEARCH_STRING:
- r(printf(" (string \"%s\")\n", t->value.string));
- r->type = RESULT_STRING;
- /* erk, this shoul;dn't need to strdup this ... */
- r->value.string = g_strdup(t->value.string);
- break;
- case SEARCH_INT:
- r(printf(" (int %d)\n", t->value.number));
- r->type = RESULT_INT;
- r->value.number = t->value.number;
- break;
- case SEARCH_FUNC:
- g_free(r); /* <---- FIXME: ICK !! */
- r(printf("function '%s'\n", t->value.func.sym->name));
- return t->value.func.sym->func(ctx, t);
- default:
- printf("Warning: Unknown type encountered in parse tree: %d\n", t->type);
- r->type = RESULT_UNDEFINED;
- }
-
- return r;
-}
-
-
-static void
-parse_dump_term(struct _searchterm *t, int depth)
-{
- int dumpvals = FALSE;
- int i;
-
- if (t==NULL) {
- printf("null term??\n");
- return;
- }
-
- for (i=0;i<depth;i++)
- printf(" ");
-
- switch (t->type) {
- case SEARCH_AND:
- printf("(and \n");
- dumpvals = 1;
- break;
- case SEARCH_OR:
- printf("(or \n");
- dumpvals = 1;
- break;
- case SEARCH_LT:
- printf("(lt \n");
- dumpvals = 1;
- break;
- case SEARCH_GT:
- printf("(gt \n");
- dumpvals = 1;
- break;
- case SEARCH_STRING:
- printf(" \"%s\"", t->value.string);
- break;
- case SEARCH_INT:
- printf(" %d", t->value.number);
- break;
- case SEARCH_FUNC:
- printf(" (function %s", t->value.func.sym->name);
- dumpvals = 1;
- break;
- default:
- printf("unknown type: %d\n", t->type);
- }
-
- if (dumpvals) {
- /*printf(" [%d] ", t->value.func.termcount);*/
- for (i=0;i<t->value.func.termcount;i++) {
- parse_dump_term(t->value.func.terms[i], depth+1);
- }
- for (i=0;i<depth;i++)
- printf(" ");
- printf(")\n");
- }
- printf("\n");
-}
-
-/*
- PARSER
-*/
-
-static struct _searchterm *
-parse_new_term(int type)
-{
- struct _searchterm *s = g_malloc0(sizeof(*s));
- s->type = type;
- return s;
-}
-
-static void
-parse_term_free(struct _searchterm *t)
-{
- int i;
-
- if (t==NULL) {
- return;
- }
-
- switch (t->type) {
- case SEARCH_AND:
- case SEARCH_OR:
- case SEARCH_LT:
- case SEARCH_GT:
- case SEARCH_FUNC:
- for (i=0;i<t->value.func.termcount;i++) {
- parse_term_free(t->value.func.terms[i]);
- }
- g_free(t->value.func.terms);
- break;
- case SEARCH_STRING:
- g_free(t->value.string);
- break;
- case SEARCH_INT:
- break;
- default:
- printf("parse_term_free: unknown type: %d\n", t->type);
- }
- g_free(t);
-}
-
-static struct _searchterm **
-parse_lists(GScanner *gs, int *len)
-{
- int token;
- struct _searchterm **terms;
- int i=0;
-
- p(printf("parsing lists\n"));
-
- terms = g_malloc0(20*sizeof(*terms));
-
- while ( (token = g_scanner_peek_next_token(gs)) != G_TOKEN_EOF
- && token != ')') {
- terms[i]=parse_list(gs, FALSE);
- i++;
- }
-
- if (len)
- *len = i;
-
- p(printf("found %d subterms\n", i));
-
- p(printf("done parsing lists, token= %d %c\n", token, token));
- return terms;
-}
-
-static struct _searchterm **
-parse_values(GScanner *gs, int *len)
-{
- int token;
- struct _searchterm **terms;
- int i=0;
-
- p(printf("parsing values\n"));
-
- terms = g_malloc0(20*sizeof(*terms));
-
- while ( (token = g_scanner_peek_next_token(gs)) != G_TOKEN_EOF
- && token != ')') {
- terms[i]=parse_value(gs);
- i++;
- }
-
- p(printf("found %d subterms\n", i));
- *len = i;
-
- p(printf("dont parsing values\n"));
- return terms;
-}
-
-static struct _searchterm *
-parse_value(GScanner *gs)
-{
- int token;
- struct _searchterm *t = NULL;
-
- p(printf("parsing value\n"));
-
- token = g_scanner_get_next_token(gs);
- switch(token) {
- case G_TOKEN_LEFT_PAREN:
- p(printf("got brace, its a list!\n"));
- return parse_list(gs, TRUE);
- case G_TOKEN_STRING:
- p(printf("got string\n"));
- t = parse_new_term(SEARCH_STRING);
- t->value.string = g_strdup(g_scanner_cur_value(gs).v_string);
- break;
- case G_TOKEN_INT:
- t = parse_new_term(SEARCH_INT);
- t->value.number = g_scanner_cur_value(gs).v_int;
- p(printf("got int\n"));
- break;
- default:
- printf("Innvalid token trying to parse a list of values\n");
- }
- p(printf("done parsing value\n"));
- return t;
-}
-
-/* FIXME: this needs some robustification */
-static struct _searchterm *
-parse_list(GScanner *gs, int gotbrace)
-{
- int token;
- struct _searchterm *t = NULL;
-
- p(printf("parsing list\n"));
- if (gotbrace)
- token = '(';
- else
- token = g_scanner_get_next_token(gs);
- if (token =='(') {
- token = g_scanner_get_next_token(gs);
- if (token == G_TOKEN_SYMBOL) {
- struct _searchterm_symbol *s;
-
- s = g_scanner_cur_value(gs).v_symbol;
- p(printf("got funciton: %s\n", s->name));
- t = parse_new_term(s->type);
- t->value.func.sym = s;
- p(printf("created new list %p\n", t));
- switch(s->argtype) {
- case 0: /* it MUST be a list of lists */
- t->value.func.terms = parse_lists(gs, &t->value.func.termcount);
- break;
- case 1:
- t->value.func.terms = parse_values(gs, &t->value.func.termcount);
- break;
- default:
- printf("Error, internal error parsing symbols\n");
- }
- } else {
- printf("unknown sequence encountered, type = %d\n", token);
- }
- token = g_scanner_get_next_token(gs);
- if (token != ')') {
- printf("Error, expected ')' not found\n");
- }
- } else {
- printf("Error, list term without opening (\n");
- }
-
- p(printf("returning list %p\n", t));
- return t;
-}
-
-GList *
-camel_mbox_folder_search_by_expression(CamelFolder *folder, char *expression, CamelException *ex)
-{
- GScanner *gs;
- int i;
- struct _searchterm *t;
- struct _searchcontext *ctx;
- struct _searchresult *r;
- GList *matches = NULL;
-
- gs = g_scanner_new(&scanner_config);
- for(i=0;i<sizeof(symbols)/sizeof(symbols[0]);i++)
- g_scanner_scope_add_symbol(gs, 0, symbols[i].name, &symbols[i]);
-
- g_scanner_input_text(gs, expression, strlen(expression));
- t = parse_list(gs, 0);
-
- if (t) {
- ctx = g_malloc0(sizeof(*ctx));
- ctx->folder = folder;
- ctx->summary = camel_folder_get_summary(folder, ex);
- ctx->message_info = camel_folder_summary_get_message_info_list(ctx->summary);
-#ifdef HAVE_IBEX
- ctx->index = ibex_open(CAMEL_MBOX_FOLDER(folder)->index_file_path, FALSE);
- if (!ctx->index) {
- perror("Cannot open index file, body searches will be ignored\n");
- }
-#endif
- r = term_eval(ctx, t);
-
- /* now create a folder summary to return?? */
- if (r
- && r->type == RESULT_ARRAY_PTR) {
- d(printf("got result ...\n"));
- for (i=0;i<r->value.ptrarray->len;i++) {
- d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i)));
- matches = g_list_prepend(matches, g_strdup(g_ptr_array_index(r->value.ptrarray, i)));
- }
- result_free(r);
- }
-
- if (ctx->index)
- ibex_close(ctx->index);
-
- gtk_object_unref((GtkObject *)ctx->summary);
- g_free(ctx);
- parse_term_free(t);
- } else {
- printf("Warning, Could not parse expression!\n %s\n", expression);
- }
-
- g_scanner_destroy(gs);
-
- return matches;
-}
diff --git a/camel/providers/mbox/camel-mbox-search.h b/camel/providers/mbox/camel-mbox-search.h
deleted file mode 100644
index 16efd4a023..0000000000
--- a/camel/providers/mbox/camel-mbox-search.h
+++ /dev/null
@@ -1,10 +0,0 @@
-
-#ifndef _CAMEL_MBOX_SEARCH_H
-#define _CAMEL_MBOX_SEARCH_H
-
-#include "camel-mbox-folder.h"
-
-GList *camel_mbox_folder_search_by_expression(CamelFolder *folder, const char *expression);
-
-#endif /* ! _CAMEL_MBOX_SEARCH_H */
-
diff --git a/camel/providers/mbox/camel-mbox-store.c b/camel/providers/mbox/camel-mbox-store.c
deleted file mode 100644
index f8b3b62718..0000000000
--- a/camel/providers/mbox/camel-mbox-store.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-store.c : class for an mbox store */
-
-/*
- *
- * Copyright (C) 2000 HelixCode <bertrand@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 "camel-mbox-store.h"
-#include "camel-mbox-folder.h"
-#include "url-util.h"
-
-static CamelStoreClass *parent_class=NULL;
-
-/* 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)
-
-static void _init (CamelStore *store, CamelSession *session, const gchar *url_name, CamelException *ex);
-static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex);
-
-
-static void
-camel_mbox_store_class_init (CamelMboxStoreClass *camel_mbox_store_class)
-{
- CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_mbox_store_class);
-
- parent_class = gtk_type_class (camel_store_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_store_class->init = _init;
- camel_store_class->get_folder = _get_folder;
-}
-
-
-
-static void
-camel_mbox_store_init (gpointer object, gpointer klass)
-{
- CamelMboxStore *mbox_store = CAMEL_MBOX_STORE (object);
- CamelStore *store = CAMEL_STORE (object);
-
- store->separator = '/';
-}
-
-
-
-
-GtkType
-camel_mbox_store_get_type (void)
-{
- static GtkType camel_mbox_store_type = 0;
-
- 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);
- }
-
- return camel_mbox_store_type;
-}
-
-
-
-
-/* These evil public functions are here for test only */
-void
-camel_mbox_store_set_toplevel_dir (CamelMboxStore *store, const gchar *toplevel, CamelException *ex)
-{
- store->toplevel_dir = g_strdup (toplevel);
- CAMEL_STORE(store)->separator = '/';
-}
-
-
-const gchar *
-camel_mbox_store_get_toplevel_dir (CamelMboxStore *store, CamelException *ex)
-{
- return store->toplevel_dir;
-}
-
-
-
-static void
-_init (CamelStore *store, CamelSession *session, const gchar *url_name, CamelException *ex)
-{
- CamelMboxStore *mbox_store = CAMEL_MBOX_STORE (store);
- Gurl *store_url;
-
- g_assert (url_name);
- /* call parent implementation */
- parent_class->init (store, session, url_name, ex);
-
-
- /* find the path in the URL*/
- store_url = g_url_new (url_name);
-
- g_return_if_fail (store_url);
- g_return_if_fail (store_url->path);
-
- mbox_store->toplevel_dir = g_strdup (store_url->path);
- g_url_free (store_url);
-
-
-
-}
-
-
-static CamelFolder *
-_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex)
-{
- CamelMboxFolder *new_mbox_folder;
- CamelFolder *new_folder;
-
- /* check if folder has already been created */
- /* call the standard routine for that when */
- /* it is done ... */
-
- new_mbox_folder = gtk_type_new (CAMEL_MBOX_FOLDER_TYPE);
- new_folder = CAMEL_FOLDER (new_mbox_folder);
-
- CF_CLASS (new_folder)->init_with_store (new_folder, store, ex);
- CF_CLASS (new_folder)->set_name (new_folder, folder_name, ex);
-
-
- return new_folder;
-}
diff --git a/camel/providers/mbox/camel-mbox-store.h b/camel/providers/mbox/camel-mbox-store.h
deleted file mode 100644
index a5aea965e2..0000000000
--- a/camel/providers/mbox/camel-mbox-store.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-store.h : class for an mbox store */
-
-/*
- *
- * Copyright (C) 2000 HelixCode <bertrand@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_MBOX_STORE_H
-#define CAMEL_MBOX_STORE_H 1
-
-
-#ifdef __cplusplus
-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))
-
-
-typedef struct {
- CamelStore parent_object;
-
- gchar *toplevel_dir;
-} CamelMboxStore;
-
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-
-} CamelMboxStoreClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mbox_store_get_type (void);
-
-void camel_mbox_store_set_toplevel_dir (CamelMboxStore *store, const gchar *toplevel, CamelException *ex);
-const gchar *camel_mbox_store_get_toplevel_dir (CamelMboxStore *store, CamelException *ex);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MBOX_STORE_H */
-
-
diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c
deleted file mode 100644
index 244fe34073..0000000000
--- a/camel/providers/mbox/camel-mbox-summary.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author : Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code .
-
- * 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-log.h"
-#include "camel-mbox-folder.h"
-#include "camel-mbox-summary.h"
-#include "md5-utils.h"
-
-
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-
-void
-camel_mbox_save_summary (CamelMboxSummary *summary, const gchar *filename, CamelException *ex)
-{
- CamelMboxSummaryInformation *msg_info;
- guint cur_msg;
- guint field_lgth;
- gint fd;
- gint write_result;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::save_summary entering \n");
-
- fd = open (filename,
- O_WRONLY | O_CREAT | O_TRUNC,
- S_IRUSR | S_IWUSR);
- if (fd == -1) {
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "could not create the mbox summary file\n"
- "\t%s\n"
- "Full error is : %s\n",
- filename,
- strerror (errno));
- return;
- }
-
- /* compute and write the mbox file md5 signature */
- //md5_get_digest_from_file (filename, summary->md5_digest);
-
- /* write the number of messages + the md5 signatures
- + next UID + mbox file size */
- write_result = write (fd, summary, G_STRUCT_OFFSET (CamelMboxSummary, message_info));
-
-
- for (cur_msg=0; cur_msg < summary->nb_message; cur_msg++) {
-
- msg_info = (CamelMboxSummaryInformation *)(summary->message_info->data) + cur_msg;
-
- /* write message position + message size
- + x-evolution offset + uid + status */
- write (fd, (gchar *)msg_info,
- sizeof (guint32) + 2 * sizeof (guint) +
- sizeof (guint32) + sizeof (guchar));
-
- /* write subject */
- field_lgth = msg_info->subject ? strlen (msg_info->subject) : 0;
- write (fd, &field_lgth, sizeof (guint));
- if (field_lgth)
- write (fd, msg_info->subject, field_lgth);
- /* write sender */
- field_lgth = msg_info->sender ? strlen (msg_info->sender) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->sender, field_lgth);
-
- /* write to */
- field_lgth = msg_info->to ? strlen (msg_info->to) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->to, field_lgth);
-
- /* write date */
- field_lgth = msg_info->date ? strlen (msg_info->date) : 0;
- write (fd, &field_lgth, sizeof (guint));
- if (field_lgth)
- write (fd, msg_info->date, field_lgth);
-
-
- }
-
- close (fd);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::save_summary leaving \n");
-}
-
-
-
-
-
-CamelMboxSummary *
-camel_mbox_load_summary (const gchar *filename, CamelException *ex)
-{
- CamelMboxSummaryInformation *msg_info;
- guint cur_msg;
- guint field_lgth;
- gint fd;
- CamelMboxSummary *summary;
- gint read_result;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::save_summary entering \n");
-
- fd = open (filename, O_RDONLY);
- if (fd == -1) {
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "could not open the mbox summary file\n"
- "\t%s\n"
- "Full error is : %s\n",
- filename,
- strerror (errno));
- return NULL;
- }
- summary = g_new0 (CamelMboxSummary, 1);
-
- /* read the message number, the md5 signature
- and the next available UID + mbox file size */
- read_result = read (fd, summary, G_STRUCT_OFFSET (CamelMboxSummary, message_info));
-
-
- summary->message_info = g_array_new (FALSE, FALSE, sizeof (CamelMboxSummaryInformation));
- summary->message_info = g_array_set_size (summary->message_info, summary->nb_message);
-
-
- for (cur_msg=0; cur_msg < summary->nb_message; cur_msg++) {
-
- msg_info = (CamelMboxSummaryInformation *)(summary->message_info->data) + cur_msg;
-
- /* read message position + message size
- + x-evolution offset + uid + status */
- read (fd, (gchar *)msg_info,
- sizeof (guint32) + 2 * sizeof (guint) +
- sizeof (guint32) + sizeof (guchar));
-
-
- /* read the subject */
- read (fd, &field_lgth, sizeof (gint));
- if (field_lgth > 0) {
- msg_info->subject = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->subject, field_lgth);
- } else
- msg_info->subject = NULL;
-
- /* read the sender */
- read (fd, &field_lgth, sizeof (gint));
- if (field_lgth > 0) {
- msg_info->sender = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->sender, field_lgth);
- } else
- msg_info->sender = NULL;
-
- /* read the "to" field */
- read (fd, &field_lgth, sizeof (gint));
- if (field_lgth > 0) {
- msg_info->to = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->to, field_lgth);
- } else
- msg_info->to = NULL;
-
- /* read the "date" field */
- read (fd, &field_lgth, sizeof (gint));
- if (field_lgth > 0) {
- msg_info->date = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->date, field_lgth);
- } else
- msg_info->date = NULL;
-
-
-
-
- }
-
- close (fd);
- return summary;
-}
-
-
-
-
-
-
-
-
-
-gboolean
-camel_mbox_check_summary_sync (gchar *summary_filename,
- gchar *mbox_filename,
- CamelException *ex)
-
-{
- gint fd;
- guchar summary_md5[16];
- guchar real_md5[16];
-
-
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::save_summary entering \n");
-
- fd = open (summary_filename, O_RDONLY);
- if (fd == -1) {
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "could not open the mbox summary file\n"
- "\t%s\n"
- "Full error is : %s\n",
- summary_filename,
- strerror (errno));
- return FALSE;
- }
-
- /* skip the message number field */
- lseek (fd, sizeof (guint), SEEK_SET);
-
- /* read the md5 signature stored in the summary file */
- read (fd, summary_md5, sizeof (guchar) * 16);
- close (fd);
- /* ** FIXME : check for exception in all these operations */
-
- /* compute the actual md5 signature on the
- mbox file */
- md5_get_digest_from_file (mbox_filename, real_md5);
-
- return (strncmp (real_md5, summary_md5, 16) == 0);
-}
-
-
-
-
-
-void
-camel_mbox_summary_append_entries (CamelMboxSummary *summary, GArray *entries)
-{
-
- summary->message_info = g_array_append_vals (summary->message_info, entries->data, entries->len);
-
-}
-
-
-
-
-
-void
-camel_mbox_summary_append_internal_to_external (CamelMboxSummary *internal,
- CamelFolderSummary *external,
- guint first_entry)
-{
- GArray *internal_array;
- GArray *external_array;
-
- CamelMessageInfo external_entry;
- CamelMboxSummaryInformation *internal_entry;
-
- int i;
-
-
- internal_array = internal->message_info;
- external_array = external->message_info_list;
-
- /* we don't set any extra fields */
- external_entry.extended_fields = NULL;
-
-
- for (i=first_entry; i<internal_array->len; i++) {
- internal_entry = (CamelMboxSummaryInformation *)(internal_array->data) + i;
-
- external_entry.subject = internal_entry->subject ? strdup (internal_entry->subject) : NULL;
- external_entry.uid = g_strdup_printf ("%u", internal_entry->uid);
- external_entry.date = internal_entry->date ? strdup (internal_entry->date) : NULL;
- external_entry.sender = internal_entry->sender ? strdup (internal_entry->sender) : NULL;
-
- g_array_append_vals (external_array, &external_entry, 1);
-
- }
-
-
-}
diff --git a/camel/providers/mbox/camel-mbox-summary.h b/camel/providers/mbox/camel-mbox-summary.h
deleted file mode 100644
index af64ff7cf5..0000000000
--- a/camel/providers/mbox/camel-mbox-summary.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author : Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code (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 MBOX_SUMMARY_H
-#define MBOX_SUMMARY_H 1
-
-#include <glib.h>
-
-
-
-typedef struct {
-
- guint32 position;
- guint size;
- guint x_evolution_offset;
- guint32 uid;
- guchar status;
- gchar *subject;
- gchar *sender;
- gchar *to;
- gchar *date;
-
-} CamelMboxSummaryInformation;
-
-
-typedef struct {
-
- guint nb_message; /* number of messages in the summary */
- guchar md5_digest[16]; /* md5 signature of the mbox file */
- guint32 next_uid;
- guint32 mbox_file_size;
-
- GArray *message_info; /* array of CamelMboxSummaryInformation */
-
-} CamelMboxSummary;
-
-
-void
-camel_mbox_save_summary (CamelMboxSummary *summary, const gchar *filename, CamelException *ex);
-
-CamelMboxSummary *
-camel_mbox_load_summary (const gchar *filename, CamelException *ex);
-
-gboolean
-camel_mbox_check_summary_sync (gchar *summary_filename,
- gchar *mbox_filename,
- CamelException *ex);
-
-void
-camel_mbox_summary_append_entries (CamelMboxSummary *summary, GArray *entries);
-
-
-
-void
-camel_mbox_summary_append_internal_to_external (CamelMboxSummary *internal,
- CamelFolderSummary *external,
- guint first_entry);
-
-
-#endif /* MH_SUMMARY_H */
diff --git a/camel/providers/mbox/camel-mbox-utils.c b/camel/providers/mbox/camel-mbox-utils.c
deleted file mode 100644
index 64fb4cb283..0000000000
--- a/camel/providers/mbox/camel-mbox-utils.c
+++ /dev/null
@@ -1,385 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Various utilities for the mbox provider */
-
-/*
- * Authors :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code.
- *
- * 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
- */
-
-
-/* "xev" stands for x-evolution, which is the name of the
- * evolution specific header where are stored informations
- * like :
- * - mail status
- * - mail uid
- * ...
- *
- *
- * The evolution line has the following format :
- *
- * X-Evolution:XXXXX-X
- * \___/ \/
- * UID ---' `- Status
- *
- * the UID is internally used as a 32 bits long integer, but only the first 24 bits are
- * used. The UID is coded as a string on 4 characters. Each character is a 6 bits
- * integer coded using the b64 alphabet.
- *
- */
-
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-
-
-#include <glib.h>
-#include "camel-mbox-utils.h"
-#include "camel-mbox-parser.h"
-#include "camel-folder-summary.h"
-#include "camel-mbox-summary.h"
-
-
-
-static gchar b64_alphabet[64] =
-"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-
-
-static void
-uid_to_string (guint32 uid, gchar string[4])
-{
-
- string [0] = b64_alphabet [(uid >> 18) & 0x3f];
- string [1] = b64_alphabet [(uid >> 12) & 0x3f];
- string [2] = b64_alphabet [(uid >> 6) & 0x3f];
- string [3] = b64_alphabet [(uid ) & 0x3f];
-}
-
-
-static guint32
-string_to_uid (gchar *string)
-{
- guint32 i;
-
- i =
- (((string [0] >= 97) ? ( string [0] - 71 ) :
- ((string [0] >= 65) ? ( string [0] - 65 ) :
- ((string [0] >= 48) ? ( string [0] + 4 ) :
- ((string [0] == 43) ? 62 : 63 )))) << 18)
-
- + (((string [1] >= 97) ? ( string [1] - 71 ) :
- ((string [1] >= 65) ? ( string [1] - 65 ) :
- ((string [1] >= 48) ? ( string [1] + 4 ) :
- ((string [1] == 43) ? 62 : 63 )))) << 12)
-
-
- + ((((string [2] >= 97) ? ( string [2] - 71 ) :
- ((string [2] >= 65) ? ( string [2] - 65 ) :
- ((string [2] >= 48) ? ( string [2] + 4 ) :
- ((string [2] == 43) ? 62 : 63 ))))) << 6)
-
-
- + (((string [3] >= 97) ? ( string [3] - 71 ) :
- ((string [3] >= 65) ? ( string [3] - 65 ) :
- ((string [3] >= 48) ? ( string [3] + 4 ) :
- ((string [3] == 43) ? 62 : 63 )))));
-
- return i;
-
-}
-
-
-static gchar
-flag_to_string (guchar status)
-{
- return b64_alphabet [status & 0x3f];
-}
-
-
-static guchar
-string_to_flag (gchar string)
-{
- return (string >= 97) ? ( string - 71 ) :
- ((string >= 65) ? ( string - 65 ) :
- ((string >= 48) ? ( string + 4 ) :
- ((string == 43) ? 62 : 63 )));
-}
-
-
-
-
-
-void
-camel_mbox_xev_parse_header_content (gchar header_content[6],
- guint32 *uid,
- guchar *status)
-{
-
- /* we assume that the first 4 characters of the header content
- are actually the uid stuff. If somebody messed with it ...
- toooo bad.
- */
- *uid = string_to_uid (header_content);
- *status = string_to_flag (header_content[5]);
-}
-
-void
-camel_mbox_xev_write_header_content (gchar header_content[6],
- guint32 uid,
- guchar status)
-{
- uid_to_string (uid, header_content);
- header_content[5] = flag_to_string (status);
- header_content[4] = '-';
-}
-
-
-
-
-
-
-void
-camel_mbox_copy_file_chunk (gint fd_src,
- gint fd_dest,
- glong nb_bytes,
- CamelException *ex)
-{
- gchar buffer [1000];
- glong nb_to_read;
- glong nb_read, v;
-
- nb_to_read = nb_bytes;
- while (nb_to_read > 0) {
-
- do {
- nb_read = read (fd_src, buffer, MIN (1000, nb_to_read));
- } while (nb_read == -1 && errno == EINTR);
-
- if (nb_read == -1) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "could read from the mbox file");
- return;
- }
-
-
- nb_to_read -= nb_read;
-
- do {
- v = write (fd_dest, buffer, nb_read);
- } while (v == -1 && errno == EINTR);
-
- if (v == -1) {
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "could not write to the mbox copy file\n"
- "Full error is : %s\n",
- strerror (errno));
- return;
- }
-
-
- }
-
-
-
-}
-
-
-guint32
-camel_mbox_write_xev (gchar *mbox_file_name,
- GArray *summary_information,
- guint32 *file_size,
- guint32 next_uid,
- CamelException *ex)
-{
- gint cur_msg;
- CamelMboxParserMessageInfo *cur_msg_info;
- gint fd1, fd2;
- guint bytes_to_copy = 0;
- glong cur_pos = 0;
- glong cur_offset = 0;
- glong end_of_last_message;
- glong next_free_uid;
- gchar xev_header[20] = "X-Evolution:XXXX-X\n";
- gchar *tmp_file_name;
- gchar *tmp_file_name_secure;
- gint rename_result;
- gint unlink_result;
-
- tmp_file_name = g_strdup_printf ("%s__.ev_tmp", mbox_file_name);
- tmp_file_name_secure = g_strdup_printf ("%s__.ev_tmp_secure", mbox_file_name);
-
- fd1 = open (mbox_file_name, O_RDONLY);
- fd2 = open (tmp_file_name,
- O_WRONLY | O_CREAT | O_TRUNC ,
- S_IRUSR | S_IWUSR);
-
- if (fd2 == -1) {
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "could not create the temporary mbox copy file\n"
- "\t%s\n"
- "Full error is : %s\n",
- tmp_file_name,
- strerror (errno));
- return next_uid;
- }
-
- next_free_uid = next_uid;
- for (cur_msg = 0; cur_msg < summary_information->len; cur_msg++) {
-
- cur_msg_info = (CamelMboxParserMessageInfo *)(summary_information->data) + cur_msg;
- end_of_last_message = cur_msg_info->message_position + cur_msg_info->size;
-
- if (cur_msg_info->uid == 0) {
-
- bytes_to_copy = cur_msg_info->message_position
- + cur_msg_info->end_of_headers_offset
- - cur_pos;
-
- cur_pos = cur_msg_info->message_position
- + cur_msg_info->end_of_headers_offset;
-
- camel_mbox_copy_file_chunk (fd1, fd2, bytes_to_copy, ex);
- if (camel_exception_get_id (ex)) {
- close (fd1);
- close (fd2);
- goto end;
- }
-
- cur_msg_info->uid = next_free_uid;
- cur_msg_info->status = 0;
- camel_mbox_xev_write_header_content (xev_header + 12, next_free_uid, 0);
- next_free_uid++;
- write (fd2, xev_header, 19);
- cur_offset += 19;
- cur_msg_info->size += 19;
- cur_msg_info->x_evolution_offset = cur_msg_info->end_of_headers_offset;
- cur_msg_info->x_evolution = g_strdup_printf ("%.6s", xev_header + 12);
- cur_msg_info->end_of_headers_offset += 19;
- *file_size += 19;
- }
- cur_msg_info->message_position += cur_offset;
- }
-
-
- bytes_to_copy = end_of_last_message - cur_pos;
- camel_mbox_copy_file_chunk (fd1, fd2, bytes_to_copy, ex);
-
-
- /* close the original file as well as the
- newly created one */
- close (fd1);
- close (fd2);
-
-
-
- /* replace the mbox file with the temporary
- file we just created */
-
- /* first rename the old mbox file to a temporary file */
- rename_result = rename (mbox_file_name, tmp_file_name_secure);
- if (rename_result == -1) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "could not rename the mbox file to a temporary file");
- goto end;
- }
-
- /* then rename the newly created mbox file to the name
- of the original one */
- rename_result = rename (tmp_file_name, mbox_file_name);
- if (rename_result == -1) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "could not rename the X-Evolution fed file to the mbox file");
- goto end;
- }
-
- /* finally, remove the old renamed mbox file */
- unlink_result = unlink (tmp_file_name_secure);
- if (unlink_result == -1) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "could not remove the saved original mbox file");
- goto end;
- }
-
-
- end: /* free everything and return */
-
- g_free (tmp_file_name);
- g_free (tmp_file_name_secure);
- return next_free_uid;
-}
-
-
-
-
-
-
-GArray *
-parsed_information_to_mbox_summary (GArray *parsed_information)
-{
- guint cur_msg;
- CamelMboxParserMessageInfo *cur_msg_info;
- GArray *mbox_summary;
- CamelMboxSummaryInformation *cur_sum_info;
-
- mbox_summary = g_array_new (FALSE, FALSE, sizeof (CamelMboxSummaryInformation));
- mbox_summary = g_array_set_size (mbox_summary, parsed_information->len);
-
- for (cur_msg = 0; cur_msg < parsed_information->len; cur_msg++) {
-
- cur_msg_info = (CamelMboxParserMessageInfo *)(parsed_information->data) + cur_msg;
- cur_sum_info = (CamelMboxSummaryInformation *)(mbox_summary->data) + cur_msg;
-
- cur_sum_info->position = cur_msg_info->message_position;
-
- cur_sum_info->size = cur_msg_info->size;
-
- cur_sum_info->x_evolution_offset = cur_msg_info->x_evolution_offset;
-
- cur_sum_info->uid = cur_msg_info->uid;
-
- cur_sum_info->status = cur_msg_info->status;
-
- cur_sum_info->subject = cur_msg_info->subject;
- cur_msg_info->subject = NULL;
-
- cur_sum_info->sender = cur_msg_info->from;
- cur_msg_info->from = NULL;
-
- cur_sum_info->to = cur_msg_info->to;
- cur_msg_info->to = NULL;
-
- cur_sum_info->date = cur_msg_info->date;
- cur_msg_info->date = NULL;
-
- }
-
- return mbox_summary;
-}
diff --git a/camel/providers/mbox/camel-mbox-utils.h b/camel/providers/mbox/camel-mbox-utils.h
deleted file mode 100644
index 062a284b03..0000000000
--- a/camel/providers/mbox/camel-mbox-utils.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Various utilities for the mbox provider */
-
-/*
- * Authors :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code.
- *
- * 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_MBOX_UTILS_H
-#define CAMEL_MBOX_UTILS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-
-#include "camel-exception.h"
-
-void
-camel_mbox_xev_parse_header_content (gchar header_content[6],
- guint32 *uid,
- guchar *status);
-
-void
-camel_mbox_xev_write_header_content (gchar header_content[6],
- guint32 uid,
- guchar status);
-
-guint32
-camel_mbox_write_xev (gchar *mbox_file_name,
- GArray *summary_information,
- guint32 *file_size,
- guint32 last_uid,
- CamelException *ex);
-
-GArray *
-parsed_information_to_mbox_summary (GArray *parsed_information);
-
-void
-camel_mbox_copy_file_chunk (gint fd_src,
- gint fd_dest,
- glong nb_bytes,
- CamelException *ex);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MBOX_UTILS_H */
diff --git a/camel/string-utils.c b/camel/string-utils.c
deleted file mode 100644
index 757a907190..0000000000
--- a/camel/string-utils.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* string-util : utilities for gchar* strings */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 "string-utils.h"
-#include "camel-log.h"
-#include "string.h"
-
-
-
-gboolean
-string_equal_for_glist (gconstpointer v, gconstpointer v2)
-{
- return (!strcmp ( ((const gchar *)v), ((const gchar*)v2))) == 0;
-}
-
-/**
- * string_dichotomy:
- * @sep : separator
- * @prefix: pointer to be field by the prefix object
- * the prefix is not returned when the given pointer is NULL
- * @suffix: pointer to be field by the suffix object
- * the suffix is not returned when the given pointer is NULL
- *
- * Return the strings before and/or after
- * the last occurence of the specified separator
- *
- * This routine returns the string before and/or after
- * a character given as an argument.
- * if the separator is the last character, prefix and/or
- * suffix is set to NULL and result is set to 'l'
- * if the separator is not in the list, prefix and/or
- * suffix is set to NULL and result is set to 'n'
- * When the operation succedeed, the return value is 'o'
- *
- * @Return Value : result of the operation ('o', 'l' or 'n')
- *
- **/
-gchar
-string_dichotomy (const gchar *string, gchar sep, gchar **prefix, gchar **suffix,
- StringDichotomyOption options)
-{
- gint sep_pos, first, last, len;
-
- g_assert (string);
- CAMEL_LOG_FULL_DEBUG (\
- "string_dichotomy:: string=\"%s\"\n\tseparator=\"%c\" \n\tprefix=%p \n\tsuffix=%p \n\toptions=%ld\n",\
- string, sep, prefix, suffix, options);
- len = strlen (string);
- if (!len) {
- if (prefix)
- *prefix=NULL;
- if (suffix)
- *suffix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy:: input string is empty\n");
- return 'n';
- }
- first = 0;
- last = len-1;
-
- if ( (options & STRING_DICHOTOMY_STRIP_LEADING ) && (string[first] == sep) )
- do {first++;} while ( (first<len) && (string[first] == sep) );
-
- if (options & STRING_DICHOTOMY_STRIP_TRAILING )
- while ((string[last] == sep) && (last>first))
- last--;
-
- if (first==last) {
- if (prefix) *prefix=NULL;
- if (suffix) *suffix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: after stripping, string is empty\n");
- return 'n';
- }
-
- if (options & STRING_DICHOTOMY_RIGHT_DIR) {
- sep_pos = last;
- while ((sep_pos>=first) && (string[sep_pos]!=sep)) {
- sep_pos--;
- }
- } else {
- sep_pos = first;
- while ((sep_pos<=last) && (string[sep_pos]!=sep)) {
- sep_pos++;
- }
-
- }
-
- if ( (sep_pos<first) || (sep_pos>last) )
- {
- if (suffix) *suffix=NULL;
- if (prefix) *prefix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator not found\n");
- return 'n';
- }
-
- /* if we have stripped trailing separators, we should */
- /* never enter here */
- if (sep_pos==last)
- {
- if (suffix) *suffix=NULL;
- if (prefix) *prefix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator is last character\n");
- return 'l';
- }
- /* if we have stripped leading separators, we should */
- /* never enter here */
- if (sep_pos==first)
- {
- if (suffix) *suffix=NULL;
- if (prefix) *prefix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator is first character\n");
- return 'l';
- }
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator found at :%d\n", sep_pos);
- if (prefix) { /* return the prefix */
- *prefix = g_strndup (string+first,sep_pos-first);
- CAMEL_LOG_FULL_DEBUG ( "string_dichotomy:: prefix:\"%s\"\n", *prefix);
- }
- if (suffix) { /* return the suffix */
- *suffix = g_strndup (string+sep_pos+1, last-sep_pos);
- CAMEL_LOG_FULL_DEBUG ( "string_dichotomy:: suffix:\"%s\"\n", *suffix);
- }
-
- return 'o';
-}
-
-
-
-
-
-
-/* utility func : frees a gchar element in a GList */
-static void
-__string_list_free_string (gpointer data, gpointer user_data)
-{
- gchar *string = (gchar *)data;
- g_free (string);
-}
-
-
-void
-string_list_free (GList *string_list)
-{
- if (string_list == NULL) return;
-
- g_list_foreach (string_list, __string_list_free_string, NULL);
- g_list_free (string_list);
-}
-
-
-
-
-
-
-GList *
-string_split (const gchar *string, char sep, const gchar *trim_chars, StringTrimOption trim_options)
-{
- GList *result = NULL;
- gint first, last, pos;
- gchar *new_string;
-
- g_assert (string);
-
- first = 0;
- last = strlen(string) - 1;
-
- /* strip leading and trailing separators */
- while ( (first<=last) && (string[first]==sep) )
- first++;
- while ( (first<=last) && (string[last]==sep) )
- last--;
-
-
- CAMEL_LOG_FULL_DEBUG ("string_split:: trim options: %d\n", trim_options);
-
- while (first<=last) {
- pos = first;
- /* find next separator */
- while ((pos<=last) && (string[pos]!=sep)) pos++;
- if (first != pos) {
- new_string = g_strndup (string+first, pos-first);
- /* could do trimming in line to speed up this code */
- if (trim_chars) string_trim (new_string, trim_chars, trim_options);
- result = g_list_append (result, new_string);
- }
- first = pos + 1;
- }
-
- return result;
-}
-
-
-void
-string_trim (gchar *string, const gchar *trim_chars, StringTrimOption options)
-{
- gint first_ok;
- gint last_ok;
- guint length;
-
- CAMEL_LOG_FULL_DEBUG ("string-utils:: Entering string_trim::\n");
- CAMEL_LOG_FULL_DEBUG ("string_trim:: trim_chars:\"%s\"", trim_chars);
- CAMEL_LOG_FULL_DEBUG ("string_trim:: trim_options:%d\n", options);
-
- g_return_if_fail (string);
- length = strlen (string);
- g_return_if_fail (length > 0);
-
- first_ok = 0;
- last_ok = length - 1;
-
- if (options & STRING_TRIM_STRIP_LEADING)
- while ( (first_ok <= last_ok) && (strchr (trim_chars, string[first_ok])!=NULL) )
- first_ok++;
-
- if (options & STRING_TRIM_STRIP_TRAILING)
- while ( (first_ok <= last_ok) && (strchr (trim_chars, string[last_ok])!=NULL) )
- last_ok--;
- CAMEL_LOG_FULL_DEBUG ("string_trim::\n\t\"%s\":first ok:%d last_ok:%d\n",
- string, first_ok, last_ok);
-
- if (first_ok > 0)
- memmove (string, string+first_ok, last_ok - first_ok + 1);
- string[last_ok - first_ok +1] = '\0';
-
-}
-
-
-
-
-
-/**
- * remove_suffix: remove a suffix from a string
- * @s: the string to remove the suffix from.
- * @suffix: the suffix to remove
- * @suffix_found : suffix found flag
- *
- * Remove a suffix from a string. If the
- * string ends with the full suffix, a copy
- * of the string without the suffix is returned and
- * @suffix_found is set to %TRUE.
- * Otherwise, NULL is returned and
- * @suffix_found is set to %FALSE.
- *
- * Return value: an allocated copy of the string without the suffix or NULL if the suffix was not found.
- **/
-gchar *
-string_prefix (const gchar *s, const gchar *suffix, gboolean *suffix_found)
-{
- guint s_len, suf_len;
- guint suffix_pos;
- char *result_string;
-
- g_assert (s);
- g_assert (suffix);
- g_assert (suffix_found);
-
- s_len = strlen (s);
- suf_len = strlen (suffix);
-
- /* if the string is shorter than the suffix, do nothing */
- if (s_len < suf_len) {
- *suffix_found = FALSE;
- return NULL;
- }
-
- /* theoretical position of the prefix */
- suffix_pos = s_len - suf_len;
-
- /* compare the right hand side of the string with the suffix */
- if (!strncmp (s+suffix_pos, suffix, suf_len)) {
-
- /* if the suffix matches, check that there are
- characters before */
- if (suffix_pos == 0) {
- result_string = NULL;
- *suffix_found = TRUE;
- } else {
- result_string = g_strndup (s, suffix_pos);
- *suffix_found = TRUE;
- }
-
- } else {
- result_string = NULL;
- *suffix_found = FALSE;
- }
-
- return result_string;
-}
diff --git a/camel/string-utils.h b/camel/string-utils.h
deleted file mode 100644
index f37abbd08b..0000000000
--- a/camel/string-utils.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* string-util : utilities for normal gchar * strings */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 STRING_UTIL_H
-#define STRING_UTIL_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-
-
-
-typedef enum {
- STRING_DICHOTOMY_NONE = 0,
- STRING_DICHOTOMY_RIGHT_DIR = 1,
- STRING_DICHOTOMY_STRIP_TRAILING = 2,
- STRING_DICHOTOMY_STRIP_LEADING = 4
-
-} StringDichotomyOption;
-
-
-typedef enum {
- STRING_TRIM_NONE = 0,
- STRING_TRIM_STRIP_TRAILING = 1,
- STRING_TRIM_STRIP_LEADING = 2
-} StringTrimOption;
-
-
-
-gboolean string_equal_for_glist (gconstpointer v, gconstpointer v2);
-
-gchar string_dichotomy (const gchar *string, gchar sep,
- gchar **prefix, gchar **suffix,
- StringDichotomyOption options);
-void string_list_free (GList *string_list);
-
-GList *string_split (const gchar *string, char sep,
- const gchar *trim_chars, StringTrimOption trim_options);
-void string_trim (gchar *string, const gchar *chars,
- StringTrimOption options);
-
-gchar *string_prefix (const gchar *s, const gchar *suffix, gboolean *suffix_found);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* STRING_UTIL_H */
diff --git a/camel/url-util.c b/camel/url-util.c
deleted file mode 100644
index 91779873cb..0000000000
--- a/camel/url-util.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* url-util.c : utility functions to parse URLs */
-
-
-/*
- * Authors :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 1999, 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
- */
-
-
-
-/*
- * Here we deal with URLs following the general scheme:
- * protocol://user;AUTH=mech:password@host:port/name
- * where name is a path-like string (ie dir1/dir2/....) See RFC 1738
- * for the complete description of Uniform Resource Locators. The
- * ";AUTH=mech" addition comes from RFC 2384, "POP URL Scheme".
- */
-
-/* XXX TODO: recover the words between #'s or ?'s after the path */
-
-#include <string.h>
-#include <config.h>
-#include "url-util.h"
-
-/**
- * g_url_new: create a Gurl object from a string
- *
- * @url_string: The string containing the URL to scan
- *
- * This routine takes a gchar and parses it as a
- * URL of the form:
- * protocol://user;AUTH=mech:password@host:port/path
- * There is no test on the values. For example,
- * "port" can be a string, not only a number!
- * The Gurl structure fields are filled with
- * the scan results. When a member of the
- * general URL can not be found, the corresponding
- * Gurl member is NULL.
- * Fields filled in the Gurl structure are allocated
- * and url_string is not modified.
- *
- * Return value: a Gurl structure containing the URL items.
- **/
-Gurl *g_url_new (const gchar* url_string)
-{
- Gurl *g_url;
- char *semi, *colon, *at, *slash;
-
- g_url = g_new (Gurl,1);
-
- /* Find protocol: initial substring until "://" */
- colon = strchr (url_string, ':');
- if (colon && !strncmp (colon, "://", 3)) {
- g_url->protocol = g_strndup (url_string, colon - url_string);
- url_string = colon + 3;
- } else
- g_url->protocol = NULL;
-
- /* If there is an @ sign, look for user, authmech, and
- * password before it.
- */
- at = strchr (url_string, '@');
- if (at) {
- colon = strchr (url_string, ':');
- if (colon && colon < at)
- g_url->passwd = g_strndup (colon + 1, at - colon - 1);
- else {
- g_url->passwd = NULL;
- colon = at;
- }
-
- semi = strchr(url_string, ';');
- if (semi && semi < colon && !strncasecmp (semi, ";auth=", 6))
- g_url->authmech = g_strndup (semi + 6, colon - semi - 6);
- else {
- g_url->authmech = NULL;
- semi = colon;
- }
-
- g_url->user = g_strndup (url_string, semi - url_string);
- url_string = at + 1;
- } else
- g_url->user = g_url->passwd = g_url->authmech = NULL;
-
- /* Find host (required) and port. */
- slash = strchr (url_string, '/');
- colon = strchr (url_string, ':');
- if (slash && colon > slash)
- colon == 0;
-
- if (colon) {
- g_url->host = g_strndup (url_string, colon - url_string);
- if (slash)
- g_url->port = g_strndup (colon + 1, slash - colon - 1);
- else
- g_url->port = g_strdup (colon + 1);
- } else if (slash) {
- g_url->host = g_strndup (url_string, slash - url_string);
- g_url->port = NULL;
- } else {
- g_url->host = g_strdup (url_string);
- g_url->port = NULL;
- }
-
- if (slash && *(slash + 1))
- g_url->path = g_strdup (slash + 1);
- else
- g_url->path = NULL;
-
- return g_url;
-}
-
-void
-g_url_free (Gurl *url)
-{
- g_assert (url);
-
- g_free (url->protocol);
- g_free (url->user);
- g_free (url->authmech);
- g_free (url->passwd);
- g_free (url->host);
- g_free (url->port);
- g_free (url->path);
-
- g_free (url);
-}
diff --git a/camel/url-util.h b/camel/url-util.h
deleted file mode 100644
index 67cc420eb2..0000000000
--- a/camel/url-util.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* url-util.h : utility functions to parse URLs */
-
-/*
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (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 URL_UTIL_H
-#define URL_UTIL_H 1
-
-#include <glib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-typedef struct {
- gchar *protocol;
- gchar *user;
- gchar *authmech;
- gchar *passwd;
- gchar *host;
- gchar *port;
- gchar *path;
-
-} Gurl;
-
-/* the cache system has been disabled because it would
- need the user to use accessors instead of modifying the
- structure field. As the speed is not so important here,
- I chose not to use it */
-
-Gurl *g_url_new (const gchar *url_string);
-void g_url_free (Gurl *url);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* URL_UTIL_H */