aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am5
-rw-r--r--tests/test1.c7
-rw-r--r--tests/test2.c36
3 files changed, 43 insertions, 5 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 646190475c..d993cfb288 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,6 +8,7 @@ LDADD = \
$(GNOME_LIBDIR) \
$(GNOMEUI_LIBS) $(INTLLIBS)
-noinst_PROGRAMS = \
- test1
+noinst_PROGRAMS = \
+ test1 \
+ test2
diff --git a/tests/test1.c b/tests/test1.c
index f75d9046ca..013f9e72bf 100644
--- a/tests/test1.c
+++ b/tests/test1.c
@@ -11,6 +11,10 @@ main (int argc, char**argv)
gtk_init (&argc, &argv);
message = camel_mime_message_new_with_session( (CamelSession *)NULL);
camel_mime_part_set_description (CAMEL_MIME_PART (message), g_string_new ("a test"));
+ camel_mime_part_add_header (CAMEL_MIME_PART (message), g_string_new ("X-test1"), g_string_new ("the value of a test"));
+ camel_mime_part_add_header (CAMEL_MIME_PART (message), g_string_new ("X-test2"), g_string_new ("the value of another test"));
+ /*camel_mime_part_add_content_language (CAMEL_MIME_PART (message), g_string_new ("es-ca"));*/
+
camel_mime_message_set_received_date (message, g_string_new ("Thu, 20 May 1999, 10:39:14 +0200"));
camel_mime_message_set_subject (message, g_string_new ("A test message"));
camel_mime_message_set_reply_to (message, g_string_new ("toto@toto.com"));
@@ -19,12 +23,9 @@ main (int argc, char**argv)
camel_mime_message_add_recipient (message, g_string_new (RECIPIENT_TYPE_TO), g_string_new ("franck.dechamps@alseve.fr"));
camel_mime_message_add_recipient (message, g_string_new (RECIPIENT_TYPE_TO), g_string_new ("mc@alseve.fr"));
camel_mime_message_add_recipient (message, g_string_new (RECIPIENT_TYPE_TO), g_string_new ("richard.lengagne@inria.fr"));
-
camel_mime_message_add_recipient (message, g_string_new (RECIPIENT_TYPE_CC), g_string_new ("Francois.fleuret@inria.fr"));
camel_mime_message_add_recipient (message, g_string_new (RECIPIENT_TYPE_CC), g_string_new ("maury@justmagic.com"));
-
camel_mime_message_add_recipient (message, g_string_new (RECIPIENT_TYPE_BCC), g_string_new ("guiheneu@aful.org"));
-
output_file = fopen ("mail.test", "w");
if (!output_file) {
diff --git a/tests/test2.c b/tests/test2.c
new file mode 100644
index 0000000000..be72e8f8a6
--- /dev/null
+++ b/tests/test2.c
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* tests mime message file parsing */
+#include "gmime-utils.h"
+#include "stdio.h"
+
+void print_header_line (gpointer data, gpointer user_data)
+{
+ GString *header_line = (GString *)data;
+ printf("\n--------- New Header ----------\n");
+ if ((header_line) && (header_line->str))
+ printf("%s\n", header_line->str);
+ printf("--------- End -----------------\n");
+}
+
+void
+main (int argc, char**argv)
+{
+ FILE *input_file;
+ GList *header_lines;
+
+
+ gtk_init (&argc, &argv);
+
+ input_file = fopen ("mail.test", "r");
+ if (!input_file) {
+ perror("could not open input file");
+ exit(2);
+ }
+
+ header_lines = get_header_lines_from_file (input_file);
+ if (header_lines) g_list_foreach (header_lines, print_header_line, NULL);
+ else printf("header is empty, no header line present\n");
+ fclose (input_file);
+
+
+}