diff options
author | Dan Winship <danw@src.gnome.org> | 2000-05-09 06:33:39 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-05-09 06:33:39 +0800 |
commit | 3ab48c957cdade2b751d98fda4c37ae2c0d71aee (patch) | |
tree | 09ce1562b087ab1acd6f4c4765acb2f2b8e6ad61 /tests/test1.c | |
parent | 38165888d297d91e1bdf5f1ac6027b900b23b740 (diff) | |
download | gsoc2013-evolution-3ab48c957cdade2b751d98fda4c37ae2c0d71aee.tar gsoc2013-evolution-3ab48c957cdade2b751d98fda4c37ae2c0d71aee.tar.gz gsoc2013-evolution-3ab48c957cdade2b751d98fda4c37ae2c0d71aee.tar.bz2 gsoc2013-evolution-3ab48c957cdade2b751d98fda4c37ae2c0d71aee.tar.lz gsoc2013-evolution-3ab48c957cdade2b751d98fda4c37ae2c0d71aee.tar.xz gsoc2013-evolution-3ab48c957cdade2b751d98fda4c37ae2c0d71aee.tar.zst gsoc2013-evolution-3ab48c957cdade2b751d98fda4c37ae2c0d71aee.zip |
update for camelstream changes
svn path=/trunk/; revision=2926
Diffstat (limited to 'tests/test1.c')
-rw-r--r-- | tests/test1.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/tests/test1.c b/tests/test1.c index 97c6b3ebed..c21cfd371b 100644 --- a/tests/test1.c +++ b/tests/test1.c @@ -17,9 +17,8 @@ main (int argc, char**argv) CamelMimePart *body_part; CamelMimePart *attachment_part; CamelStream *attachment_stream; - - /* FILE *output_file; */ CamelStream *stream; + CamelException *ex = camel_exception_new (); gtk_init (&argc, &argv); camel_init (); @@ -28,10 +27,11 @@ main (int argc, char**argv) attachment_stream = NULL; } else { if (argc == 2) { - attachment_stream = camel_stream_fs_new_with_name (argv[1], O_RDONLY, 0); + attachment_stream = camel_stream_fs_new_with_name (argv[1], O_RDONLY, 0, ex); if (attachment_stream == NULL) { - fprintf (stderr, "Cannot open `%s'\n", - argv[1]); + fprintf (stderr, "Cannot open `%s': %s\n", + argv[1], + camel_exception_get_description (ex)); return 1; } } else { @@ -106,16 +106,22 @@ main (int argc, char**argv) camel_medium_set_content_object (CAMEL_MEDIUM (message), CAMEL_DATA_WRAPPER (multipart)); - stream = camel_stream_fs_new_with_name ("mail1.test", O_WRONLY|O_TRUNC|O_CREAT, 0600); + stream = camel_stream_fs_new_with_name ("mail1.test", O_WRONLY|O_TRUNC|O_CREAT, 0600, ex); if (!stream) { - printf ("could not open output file"); + printf ("Could not open output file: %s\n", + camel_exception_get_description (ex)); exit(2); } camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), - stream); - camel_stream_close (stream); + stream, ex); + camel_stream_flush (stream, ex); gtk_object_unref (GTK_OBJECT (stream)); + if (camel_exception_is_set (ex)) { + printf ("Oops. Failed. %s\n", + camel_exception_get_description (ex)); + exit (1); + } gtk_object_unref (GTK_OBJECT (message)); gtk_object_unref (GTK_OBJECT (multipart)); |