aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBertrand Guiheneuf <bertrand@src.gnome.org>1999-06-19 04:32:18 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-06-19 04:32:18 +0800
commit19a118096fe6f3d7b79a0fe3cb6e5bfe50ef8767 (patch)
tree04f063fc3c18e43eea5251943be93fa89cfd5549 /tests
parent499ae51b86891889ffb5fd9954b1f60efcadfed2 (diff)
downloadgsoc2013-evolution-19a118096fe6f3d7b79a0fe3cb6e5bfe50ef8767.tar
gsoc2013-evolution-19a118096fe6f3d7b79a0fe3cb6e5bfe50ef8767.tar.gz
gsoc2013-evolution-19a118096fe6f3d7b79a0fe3cb6e5bfe50ef8767.tar.bz2
gsoc2013-evolution-19a118096fe6f3d7b79a0fe3cb6e5bfe50ef8767.tar.lz
gsoc2013-evolution-19a118096fe6f3d7b79a0fe3cb6e5bfe50ef8767.tar.xz
gsoc2013-evolution-19a118096fe6f3d7b79a0fe3cb6e5bfe50ef8767.tar.zst
gsoc2013-evolution-19a118096fe6f3d7b79a0fe3cb6e5bfe50ef8767.zip
Commit of all Netherlands changes.
All mime stuff uses streams now, and it still works. Bertrand svn path=/trunk/; revision=981
Diffstat (limited to 'tests')
-rw-r--r--tests/test1.c23
-rw-r--r--tests/test2.c24
2 files changed, 21 insertions, 26 deletions
diff --git a/tests/test1.c b/tests/test1.c
index 9a483d0ca9..65d3b046c7 100644
--- a/tests/test1.c
+++ b/tests/test1.c
@@ -1,13 +1,16 @@
/* -*- 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>
+#include "camel-stream.h"
+#include "camel-stream-fs.h"
+#include "camel-log.h"
void
main (int argc, char**argv)
{
CamelMimeMessage *message;
- FILE *output_file;
+ /* FILE *output_file; */
+ CamelStream *stream;
gtk_init (&argc, &argv);
message = camel_mime_message_new_with_session( (CamelSession *)NULL);
@@ -28,15 +31,13 @@ main (int argc, char**argv)
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) {
- perror("could not open output file");
+
+ stream = camel_stream_fs_new_with_name (g_string_new ("mail1.test"), CAMEL_STREAM_FS_WRITE );
+ if (!stream) {
+ CAMEL_LOG(WARNING, "could not open output file");
exit(2);
}
- camel_data_wrapper_write_to_file (CAMEL_DATA_WRAPPER (message), output_file);
- fclose (output_file);
-
-
-
-
+
+ camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream);
+ camel_stream_close (stream);
}
diff --git a/tests/test2.c b/tests/test2.c
index e79c5b79d3..8d980868d5 100644
--- a/tests/test2.c
+++ b/tests/test2.c
@@ -30,37 +30,31 @@ void print_header_pair (gpointer key, gpointer value, gpointer user_data)
void
main (int argc, char**argv)
{
- FILE *output_file;
GHashTable *header_table;
CamelMimeMessage *message;
- CamelStream *stream;
+ CamelStream *input_stream, *output_stream;
gtk_init (&argc, &argv);
camel_debug_level = FULL_DEBUG;
message = camel_mime_message_new_with_session( (CamelSession *)NULL);
- /* input_file = fopen ("mail.test", "r"); */
- stream = camel_stream_fs_new_with_name (g_string_new ("mail.test"), CAMEL_STREAM_FS_READ);
- if (!stream) {
+
+ input_stream = camel_stream_fs_new_with_name (g_string_new ("mail1.test"), CAMEL_STREAM_FS_READ);
+ if (!input_stream) {
perror("could not open input file");
exit(2);
}
- //header_table = get_header_table_from_file (input_file);
- header_table = get_header_table_from_stream (stream);
+ header_table = get_header_table_from_stream (input_stream);
if (header_table) g_hash_table_foreach (header_table, print_header_pair, (gpointer)message);
else printf("header is empty, no header line present\n");
- camel_stream_close (stream);
+ camel_stream_close (input_stream);
- output_file = fopen ("mail2.test", "w");
- if (!output_file) {
- perror("could not open output file");
- exit(2);
- }
- camel_data_wrapper_write_to_file (CAMEL_DATA_WRAPPER (message), output_file);
- fclose (output_file);
+ output_stream = camel_stream_fs_new_with_name (g_string_new ("mail2.test"), CAMEL_STREAM_FS_WRITE);
+ camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream);
+ camel_stream_close (output_stream);