aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--acconfig.h1
-rw-r--r--camel/gmime-utils.c57
-rw-r--r--camel/gmime-utils.h2
-rw-r--r--configure.in18
-rw-r--r--tests/Makefile.am7
-rw-r--r--tests/test1.c1
-rw-r--r--tests/test2.c3
7 files changed, 85 insertions, 4 deletions
diff --git a/acconfig.h b/acconfig.h
index bc1cadbe45..38d46cf2e4 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -6,6 +6,7 @@
#undef HAVE_LIBSM
#undef PACKAGE
#undef VERSION
+#undef HAVE_BONOBO
/* Define this if you want to build against the development gtk */
#undef HAVE_DEVGTK
diff --git a/camel/gmime-utils.c b/camel/gmime-utils.c
index 92d04d5bf8..b2d95e439e 100644
--- a/camel/gmime-utils.c
+++ b/camel/gmime-utils.c
@@ -171,3 +171,60 @@ get_header_table_from_file (FILE *file)
}
+GHashTable *
+get_header_table_from_stream (GnomeStream *stream)
+{
+ int next_char;
+
+ gboolean crlf = FALSE;
+ gboolean end_of_header_line = FALSE;
+ gboolean end_of_headers = FALSE;
+ gboolean end_of_file = FALSE;
+ GString *header_line=NULL;
+ GHashTable *header_table;
+
+ header_table = g_hash_table_new (g_string_hash, g_string_equal_for_hash);
+ //next_char = fgetc (file);
+ do {
+ header_line = g_string_new("");
+ end_of_header_line = FALSE;
+ crlf = FALSE;
+
+ /* read a whole header line */
+ do {
+ switch (next_char) {
+ case EOF:
+ end_of_file=TRUE;
+ end_of_header_line = TRUE;
+ break;
+ 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;
+
+ default:
+ if (!crlf) header_line = g_string_append_c (header_line, next_char);
+ else 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) next_char = fgetc (file);
+
+ } while ( !end_of_header_line );
+ if ( strlen(header_line->str) )
+ _store_header_pair_from_gstring (header_table, header_line);
+ g_string_free (header_line, FALSE);
+
+ } while ( (!end_of_headers) && (!end_of_file) );
+
+ return header_table;
+}
+
+
diff --git a/camel/gmime-utils.h b/camel/gmime-utils.h
index dafc5ca18a..1c2097434f 100644
--- a/camel/gmime-utils.h
+++ b/camel/gmime-utils.h
@@ -33,12 +33,14 @@ extern "C" {
#include <glib.h>
#include <stdio.h>
+#include <bonobo/gnome-stream.h>
void gmime_write_header_pair_to_file (FILE* file, gchar* name, GString *value);
void write_header_table_to_file (FILE *file, GHashTable *header_table);
void write_header_with_glist_to_file (FILE *file, gchar *header_name, GList *header_values);
GHashTable *get_header_table_from_file (FILE *file);
+GHashTable *get_header_table_from_stream (GnomeStream *stream);
diff --git a/configure.in b/configure.in
index 085eec8203..b05a0df023 100644
--- a/configure.in
+++ b/configure.in
@@ -40,6 +40,24 @@ AM_GNOME_GETTEXT
GNOME_X_CHECKS
+dnl **************************************************
+dnl * ORBit support
+dnl **************************************************
+GNOMEGNORBA_LIBS="$GNOMEGNORBA_LIBS"
+AC_SUBST(GNOMEGNORBA_LIBS)
+
+
+dnl ******************************
+dnl Check for Bonobo
+dnl ******************************
+AM_PATH_BONOBO(0.1.0, [
+ AC_DEFINE(ENABLE_BONOBO)
+ have_bonobo=true
+],[
+ have_bonobo=false
+])
+AM_CONDITIONAL(BONOBO, $have_bonobo)
+
AC_OUTPUT([
Makefile
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d993cfb288..5e2fd8947c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,9 +4,10 @@ INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir)/camel \
-I$(includedir)
LDADD = \
- $(top_builddir)/camel/libcamel.la \
- $(GNOME_LIBDIR) \
- $(GNOMEUI_LIBS) $(INTLLIBS)
+ $(top_builddir)/camel/libcamel.la \
+ $(GNOME_LIBDIR) \
+ $(GNOMEUI_LIBS) $(INTLLIBS) \
+ $(BONOBO_LIBS)
noinst_PROGRAMS = \
test1 \
diff --git a/tests/test1.c b/tests/test1.c
index 28a65ae5c5..9a483d0ca9 100644
--- a/tests/test1.c
+++ b/tests/test1.c
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include "camel-mime-message.h"
#include "stdio.h"
+#include <bonobo/gnome-stream.h>
void
main (int argc, char**argv)
diff --git a/tests/test2.c b/tests/test2.c
index dbb2b29ad0..538ae14345 100644
--- a/tests/test2.c
+++ b/tests/test2.c
@@ -32,7 +32,7 @@ main (int argc, char**argv)
FILE *output_file;
GHashTable *header_table;
CamelMimeMessage *message;
-
+ GnomeStream *stream;
@@ -41,6 +41,7 @@ main (int argc, char**argv)
message = camel_mime_message_new_with_session( (CamelSession *)NULL);
input_file = fopen ("mail.test", "r");
+ stream = gnome_stream_fs_open (NULL, "/tmp/a.png", GNOME_Storage_READ);
if (!input_file) {
perror("could not open input file");
exit(2);