Commit d32ba2a7 authored by Bertrand Guiheneuf's avatar Bertrand Guiheneuf

sync

svn path=/trunk/; revision=959
parent 1d01c8da
......@@ -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
......
......@@ -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;
}
......@@ -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);
......
......@@ -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
......
......@@ -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 \
......
/* -*- 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)
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment