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 */
6 * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
7 * Michael Zucchi <notzed@ximian.com>
9 * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com)
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.
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.
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
27 #ifndef CAMEL_MIME_PART_H
28 #define CAMEL_MIME_PART_H 1
30 #include <camel/camel-medium.h>
31 #include <camel/camel-mime-utils.h>
32 #include <camel/camel-mime-parser.h>
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))
41 /* Do not change these values directly, you would regret it one day */
42 struct _CamelMimePart {
43 CamelMedium parent_object;
45 struct _camel_header_raw *headers; /* mime headers */
47 /* All fields here are -** PRIVATE **- */
48 /* TODO: these should be in a camelcontentinfo */
50 CamelContentDisposition *disposition;
53 char *content_location;
54 GList *content_languages;
55 CamelTransferEncoding encoding;
58 typedef struct _CamelMimePartClass {
59 CamelMediumClass parent_class;
62 int (*construct_from_parser) (CamelMimePart *, CamelMimeParser *);
65 /* Standard Camel function */
66 CamelType camel_mime_part_get_type (void);
69 CamelMimePart * camel_mime_part_new (void);
71 void camel_mime_part_set_description (CamelMimePart *mime_part, const char *description);
72 const char *camel_mime_part_get_description (CamelMimePart *mime_part);
74 void camel_mime_part_set_disposition (CamelMimePart *mime_part, const char *disposition);
75 const char *camel_mime_part_get_disposition (CamelMimePart *mime_part);
77 void camel_mime_part_set_filename (CamelMimePart *mime_part, const char *filename);
78 const char *camel_mime_part_get_filename (CamelMimePart *mime_part);
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);
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);
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);
89 void camel_mime_part_set_encoding (CamelMimePart *mime_part, CamelTransferEncoding encoding);
90 CamelTransferEncoding camel_mime_part_get_encoding (CamelMimePart *mime_part);
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);
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);
100 int camel_mime_part_construct_from_parser (CamelMimePart *mime_part, CamelMimeParser *parser);
102 /* utility functions */
103 void camel_mime_part_set_content (CamelMimePart *mime_part,
104 const char *content, int length, const char *type);
108 #endif /* CAMEL_MIME_PART_H */