2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2001 Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef __PROCMIME_H__
21 #define __PROCMIME_H__
27 typedef struct _MimeType MimeType;
28 typedef struct _MimeInfo MimeInfo;
55 DISPOSITIONTYPE_INLINE,
56 DISPOSITIONTYPE_ATTACHMENT,
57 DISPOSITIONTYPE_UNKNOWN,
63 MIMECONTENT_FILE, /* the file contains all content including sub parts */
82 * An example of MimeInfo structure:
84 * 1: +- message/rfc822 (root)
86 * 2: +- multipart/mixed (children of 1)
88 * 3: +- multipart/alternative (children of 2)
90 * 4: | +- text/plain (children of 3)
92 * 5: | +- text/html (next of 4)
94 * 6: +- message/rfc822 (next of 3)
96 * 7: | ... (children of 6)
98 * 8: +- image/jpeg (next of 6)
114 /* --- NEW MIME STUFF --- */
119 GHashTable *typeparameters;
121 /* Content-Transfer-Encoding */
122 EncodingType encoding_type;
124 /* Content-Description */
133 /* Content-Disposition */
134 DispositionType disposition;
135 GHashTable *dispositionparameters;
138 PrivacyData *privacy;
141 #define IS_BOUNDARY(s, bnd, len) \
142 (bnd && s[0] == '-' && s[1] == '-' && !strncmp(s + 2, bnd, len))
146 #endif /* __cplusplus */
148 /* MimeInfo handling */
150 MimeInfo *procmime_mimeinfo_new (void);
151 void procmime_mimeinfo_free_all (MimeInfo *mimeinfo);
153 MimeInfo *procmime_mimeinfo_insert (MimeInfo *parent,
155 void procmime_mimeinfo_replace (MimeInfo *old_mimeinfo,
156 MimeInfo *new_mimeinfo);
158 MimeInfo *procmime_mimeinfo_parent (MimeInfo *mimeinfo);
159 MimeInfo *procmime_mimeinfo_next (MimeInfo *mimeinfo);
161 MimeInfo *procmime_scan_message (MsgInfo *msginfo);
162 void procmime_scan_multipart_message (MimeInfo *mimeinfo,
164 const gchar *procmime_mimeinfo_get_parameter
170 void procmime_scan_encoding (MimeInfo *mimeinfo,
171 const gchar *encoding);
172 void procmime_scan_content_type (MimeInfo *mimeinfo,
173 const gchar *content_type);
174 void procmime_scan_content_disposition (MimeInfo *mimeinfo,
175 const gchar *content_disposition);
176 void procmime_scan_content_description (MimeInfo *mimeinfo,
177 const gchar *content_description);
178 void procmime_scan_subject (MimeInfo *mimeinfo,
179 const gchar *subject);
180 MimeInfo *procmime_scan_mime_header (FILE *fp);
182 gboolean procmime_decode_content (MimeInfo *mimeinfo);
183 gboolean procmime_encode_content (MimeInfo *mimeinfo, EncodingType encoding);
184 gint procmime_get_part (const gchar *outfile,
186 FILE *procmime_get_text_content (MimeInfo *mimeinfo);
187 FILE *procmime_get_first_text_content (MsgInfo *msginfo);
189 gboolean procmime_find_string_part (MimeInfo *mimeinfo,
190 const gchar *filename,
193 gboolean procmime_find_string (MsgInfo *msginfo,
197 gchar *procmime_get_tmp_file_name (MimeInfo *mimeinfo);
199 gchar *procmime_get_mime_type (const gchar *filename);
201 GList *procmime_get_mime_type_list (void);
203 EncodingType procmime_get_encoding_for_charset (const gchar *charset);
204 EncodingType procmime_get_encoding_for_file (const gchar *file);
205 const gchar *procmime_get_encoding_str (EncodingType encoding);
206 MimeInfo *procmime_scan_file (const gchar *filename);
207 MimeInfo *procmime_scan_queue_file (const gchar *filename);
208 const gchar *procmime_get_media_type_str (MimeMediaType type);
209 MimeMediaType procmime_get_media_type (const gchar *str);
210 gchar *procmime_get_content_type_str (MimeMediaType type,
211 const gchar *subtype);
212 void procmime_force_charset (const gchar *str);
213 void procmime_force_encoding (EncodingType encoding);
215 void renderer_read_config(void);
216 void renderer_write_config(void);
218 gint procmime_write_mimeinfo(MimeInfo *mimeinfo, FILE *fp);
222 #endif /* __cplusplus */
224 #endif /* __PROCMIME_H__ */