camel-mime-part.h 4.79 KB
Newer Older
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 7
 * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
 *	    Michael Zucchi <notzed@helixcode.com>
Bertrand Guiheneuf's avatar
Bertrand Guiheneuf committed
8
 *
9
 * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
 *
 * This program is free software; you can redistribute it and/or 
 * modify it under the terms of the GNU General Public License as 
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 */


#ifndef CAMEL_MIME_PART_H
#define CAMEL_MIME_PART_H 1


#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus }*/

37
#include <camel/camel-medium.h>
38
#include <camel/camel-mime-utils.h>
39
#include <camel/camel-mime-parser.h>
40 41

#define CAMEL_MIME_PART_TYPE     (camel_mime_part_get_type ())
Peter Williams's avatar
Peter Williams committed
42 43 44
#define CAMEL_MIME_PART(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_MIME_PART_TYPE, CamelMimePart))
#define CAMEL_MIME_PART_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MIME_PART_TYPE, CamelMimePartClass))
#define CAMEL_IS_MIME_PART(o)    (CAMEL_CHECK_TYPE((o), CAMEL_MIME_PART_TYPE))
45

46
/* note, if you change this, make sure you change the 'encodings' array in camel-mime-part.c */
47 48 49 50 51 52
enum _CamelMimePartEncodingType {
        CAMEL_MIME_PART_ENCODING_DEFAULT,
        CAMEL_MIME_PART_ENCODING_7BIT,
        CAMEL_MIME_PART_ENCODING_8BIT,
        CAMEL_MIME_PART_ENCODING_BASE64,
        CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE,
53
        CAMEL_MIME_PART_ENCODING_BINARY,
54 55 56 57 58
        CAMEL_MIME_PART_NUM_ENCODINGS
};
typedef enum _CamelMimePartEncodingType CamelMimePartEncodingType;


59
/* Do not change these values directly, you would regret it one day */
60
struct _CamelMimePart
61
{
bertrand's avatar
bertrand committed
62
	CamelMedium parent_object;
63
	
Jeffrey Stedfast's avatar
Jeffrey Stedfast committed
64
	/* All fields here are -** PRIVATE **- */
65
	gchar *description;
66
	CamelMimeDisposition *disposition;
67 68
	gchar *content_id;
	gchar *content_MD5;
69
	GList *content_languages;
70
	CamelMimePartEncodingType encoding;
71
	
72
	CamelContentType *content_type;
73 74

	struct _header_raw *headers; /* mime headers */
75
};
76

77
typedef struct _CamelMimePartClass {
bertrand's avatar
bertrand committed
78
	CamelMediumClass parent_class;
79
	
80 81
	/* Virtual methods */
	int (*construct_from_parser) (CamelMimePart *, CamelMimeParser *);
82 83
} CamelMimePartClass;

Peter Williams's avatar
Peter Williams committed
84 85
/* Standard Camel function */
CamelType camel_mime_part_get_type (void);
86 87

/* public methods */
88 89
CamelMimePart *  camel_mime_part_new                    (void);

90
void	         camel_mime_part_set_description	(CamelMimePart *mime_part, const gchar *description);
91
const     gchar *camel_mime_part_get_description	(CamelMimePart *mime_part);
92 93

void	         camel_mime_part_set_disposition	(CamelMimePart *mime_part, const gchar *disposition);
94
const     gchar *camel_mime_part_get_disposition	(CamelMimePart *mime_part);
95

96
void	         camel_mime_part_set_filename		(CamelMimePart *mime_part, const gchar *filename);
97
const	  gchar *camel_mime_part_get_filename		(CamelMimePart *mime_part);
98 99

void             camel_mime_part_set_content_id		(CamelMimePart *mime_part, const char *contentid);
100
const	  gchar *camel_mime_part_get_content_id		(CamelMimePart *mime_part);
101 102

void		 camel_mime_part_set_content_MD5	(CamelMimePart *mime_part, const char *);
103
const	  gchar *camel_mime_part_get_content_MD5	(CamelMimePart *mime_part);
104 105

void	         camel_mime_part_set_encoding		(CamelMimePart *mime_part, CamelMimePartEncodingType type);
106
CamelMimePartEncodingType camel_mime_part_get_encoding	(CamelMimePart *mime_part);
107 108

void	 	 camel_mime_part_set_content_languages	(CamelMimePart *mime_part, GList *content_languages);
109 110
const	  GList *camel_mime_part_get_content_languages	(CamelMimePart *mime_part);

111 112
/* FIXME: what about content-type parameters?   what about major/minor parts? */
void               camel_mime_part_set_content_type 	(CamelMimePart *mime_part, gchar *content_type);
113
CamelContentType  *camel_mime_part_get_content_type	(CamelMimePart *mime_part);
114

115
const     gchar *         camel_mime_part_encoding_to_string   (CamelMimePartEncodingType encoding);
116 117
CamelMimePartEncodingType camel_mime_part_encoding_from_string (const gchar *string);

118
/* construction */
119
int		camel_mime_part_construct_from_parser  (CamelMimePart *, CamelMimeParser *);
120

121
/* utility functions */
122 123
void      	camel_mime_part_set_content 	       (CamelMimePart *camel_mime_part,
							const char *content, int length, const char *type);
124

125 126 127 128 129
#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* CAMEL_MIME_PART_H */
130