Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / camel-mime-part.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
2 /* camel-mime-part.h : class for a mime part */
3
4 /* 
5  *
6  * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
7  *          Michael Zucchi <notzed@ximian.com>
8  *
9  * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com)
10  *
11  * This program is free software; you can redistribute it and/or 
12  * modify it under the terms of version 2 of the GNU Lesser General Public 
13  * License as published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
23  * USA
24  */
25
26
27 #ifndef CAMEL_MIME_PART_H
28 #define CAMEL_MIME_PART_H 1
29
30 #include <camel/camel-medium.h>
31 #include <camel/camel-mime-utils.h>
32 #include <camel/camel-mime-parser.h>
33
34 #define CAMEL_MIME_PART_TYPE     (camel_mime_part_get_type ())
35 #define CAMEL_MIME_PART(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_MIME_PART_TYPE, CamelMimePart))
36 #define CAMEL_MIME_PART_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MIME_PART_TYPE, CamelMimePartClass))
37 #define CAMEL_IS_MIME_PART(o)    (CAMEL_CHECK_TYPE((o), CAMEL_MIME_PART_TYPE))
38
39 G_BEGIN_DECLS
40
41 /* Do not change these values directly, you would regret it one day */
42 struct _CamelMimePart {
43         CamelMedium parent_object;
44         
45         struct _camel_header_raw *headers; /* mime headers */
46         
47         /* All fields here are -** PRIVATE **- */
48         /* TODO: these should be in a camelcontentinfo */
49         char *description;
50         CamelContentDisposition *disposition;
51         char *content_id;
52         char *content_MD5;
53         char *content_location;
54         GList *content_languages;
55         CamelTransferEncoding encoding;
56 };
57
58 typedef struct _CamelMimePartClass {
59         CamelMediumClass parent_class;
60         
61         /* Virtual methods */
62         int (*construct_from_parser) (CamelMimePart *, CamelMimeParser *);
63 } CamelMimePartClass;
64
65 /* Standard Camel function */
66 CamelType camel_mime_part_get_type (void);
67
68 /* public methods */
69 CamelMimePart *  camel_mime_part_new                    (void);
70
71 void             camel_mime_part_set_description        (CamelMimePart *mime_part, const char *description);
72 const     char  *camel_mime_part_get_description        (CamelMimePart *mime_part);
73
74 void             camel_mime_part_set_disposition        (CamelMimePart *mime_part, const char *disposition);
75 const     char  *camel_mime_part_get_disposition        (CamelMimePart *mime_part);
76
77 void             camel_mime_part_set_filename           (CamelMimePart *mime_part, const char *filename);
78 const     char  *camel_mime_part_get_filename           (CamelMimePart *mime_part);
79
80 void             camel_mime_part_set_content_id         (CamelMimePart *mime_part, const char *contentid);
81 const     char  *camel_mime_part_get_content_id         (CamelMimePart *mime_part);
82
83 void             camel_mime_part_set_content_MD5        (CamelMimePart *mime_part, const char *md5sum);
84 const     char  *camel_mime_part_get_content_MD5        (CamelMimePart *mime_part);
85
86 void             camel_mime_part_set_content_location   (CamelMimePart *mime_part, const char *location);
87 const     char  *camel_mime_part_get_content_location   (CamelMimePart *mime_part);
88
89 void             camel_mime_part_set_encoding           (CamelMimePart *mime_part, CamelTransferEncoding encoding);
90 CamelTransferEncoding camel_mime_part_get_encoding      (CamelMimePart *mime_part);
91
92 void             camel_mime_part_set_content_languages  (CamelMimePart *mime_part, GList *content_languages);
93 const     GList *camel_mime_part_get_content_languages  (CamelMimePart *mime_part);
94
95 /* FIXME: what about content-type parameters?   what about major/minor parts? */
96 void               camel_mime_part_set_content_type     (CamelMimePart *mime_part, const char *content_type);
97 CamelContentType  *camel_mime_part_get_content_type     (CamelMimePart *mime_part);
98
99 /* construction */
100 int             camel_mime_part_construct_from_parser  (CamelMimePart *mime_part, CamelMimeParser *parser);
101
102 /* utility functions */
103 void            camel_mime_part_set_content            (CamelMimePart *mime_part,
104                                                         const char *content, int length, const char *type);
105
106 G_END_DECLS
107
108 #endif /* CAMEL_MIME_PART_H */