test2.c 1.27 KB
Newer Older
1 2 3
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* tests mime message file parsing */
#include "stdio.h"
Bertrand Guiheneuf's avatar
Bertrand Guiheneuf committed
4 5
#include "camel-mime-message.h"
#include "camel-mime-part.h"
6
#include "camel-stream.h"
7
#include "camel-stream-fs.h"
8
#include "camel.h"
9

Robert Brady's avatar
Robert Brady committed
10
int
11 12
main (int argc, char**argv)
{
Bertrand Guiheneuf's avatar
Bertrand Guiheneuf committed
13
	CamelMimeMessage *message;
14
	CamelStream *input_stream;
15
	CamelException *ex = camel_exception_new ();
16 17
	
	gtk_init (&argc, &argv);
18
	camel_init ();
19
		
20
	message = camel_mime_message_new ();
Bertrand Guiheneuf's avatar
Bertrand Guiheneuf committed
21

22
	
23
	input_stream = camel_stream_fs_new_with_name ("mail.test", O_RDONLY, 0, ex);
24
	if (!input_stream) {
25 26
		perror ("could not open input file\n");
		printf ("You must create the file mail.test before running this test\n");
27 28
		exit(2);
	}
29

30

NotZed's avatar
NotZed committed
31
	camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (message), input_stream);
32

33
	camel_medium_get_content_object (CAMEL_MEDIUM (message));
34 35

#if 0
36
	camel_stream_close (input_stream);
37
	gtk_object_unref (GTK_OBJECT (input_stream));
38

39
	output_stream = camel_stream_fs_new_with_name ("mail2.test", O_WRONLY|O_TRUNC|O_CREAT, 0600);
40 41
	camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream);
	camel_stream_close (output_stream);
42 43
	gtk_object_unref (GTK_OBJECT (output_stream));
	
44
	//gtk_object_unref (GTK_OBJECT (message));
45
#endif 
Robert Brady's avatar
Robert Brady committed
46
	return 0;
47 48

}