/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
+ * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
*
* 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
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
*/
#ifndef __PROCMIME_H__
#define __PROCMIME_H__
#ifdef HAVE_CONFIG_H
-# include "config.h"
+#include "claws-features.h"
#endif
-typedef struct _MimeType MimeType;
-typedef struct _MimeInfo MimeInfo;
+#include <gio/gio.h>
-#include "procmsg.h"
#include "utils.h"
-
+#include "proctypes.h"
typedef enum
{
ENC_7BIT,
MIMETYPE_APPLICATION,
MIMETYPE_MESSAGE,
MIMETYPE_MULTIPART,
+ MIMETYPE_MODEL,
MIMETYPE_UNKNOWN
} MimeMediaType;
#include <glib.h>
#include <stdio.h>
-#include "procmsg.h"
-#include "privacy.h"
+struct _PrivacyData;
struct _MimeType
{
gchar *extension;
};
+struct _MimeParser
+{
+ MimeMediaType type;
+ const gchar *sub_type;
+
+ gboolean (*parse)(MimeParser *parser, MimeInfo *mimeinfo);
+};
+
/*
* An example of MimeInfo structure:
*
/* Content-ID */
gchar *id;
+ /* Content-Location */
+ gchar *location;
+
guint offset;
guint length;
GHashTable *dispositionparameters;
/* Privacy */
- PrivacyData *privacy;
+ struct _PrivacyData *privacy;
+
+ gboolean broken;
};
#define IS_BOUNDARY(s, bnd, len) \
/* MimeInfo handling */
MimeInfo *procmime_mimeinfo_new (void);
-void procmime_mimeinfo_free_all (MimeInfo *mimeinfo);
+void procmime_mimeinfo_free_all (MimeInfo **mimeinfo_ptr);
MimeInfo *procmime_mimeinfo_insert (MimeInfo *parent,
MimeInfo *mimeinfo);
MimeInfo *procmime_mimeinfo_next (MimeInfo *mimeinfo);
MimeInfo *procmime_scan_message (MsgInfo *msginfo);
+MimeInfo *procmime_scan_message_short (MsgInfo *msginfo);
void procmime_scan_multipart_message (MimeInfo *mimeinfo,
FILE *fp);
const gchar *procmime_mimeinfo_get_parameter
gboolean procmime_encode_content (MimeInfo *mimeinfo, EncodingType encoding);
gint procmime_get_part (const gchar *outfile,
MimeInfo *mimeinfo);
-FILE *procmime_get_text_content (MimeInfo *mimeinfo);
FILE *procmime_get_first_text_content (MsgInfo *msginfo);
FILE *procmime_get_first_encrypted_text_content
(MsgInfo *msginfo);
-gboolean procmime_find_string_part (MimeInfo *mimeinfo,
- const gchar *filename,
- const gchar *str,
- StrFindFunc find_func);
-gboolean procmime_find_string (MsgInfo *msginfo,
- const gchar *str,
- StrFindFunc find_func);
-
gchar *procmime_get_tmp_file_name (MimeInfo *mimeinfo);
gchar *procmime_get_part_file_name (MimeInfo *mimeinfo);
void procmime_force_charset (const gchar *str);
void procmime_force_encoding (EncodingType encoding);
gboolean procmime_msginfo_is_encrypted (MsgInfo *msginfo);
-
+int procmime_write_mime_header (MimeInfo *mimeinfo,
+ FILE *fp);
void renderer_read_config(void);
-void renderer_write_config(void);
gint procmime_write_mimeinfo(MimeInfo *mimeinfo, FILE *fp);
+void procmime_mimeparser_register(MimeParser *mimeparser);
+void procmime_mimeparser_unregister(MimeParser *mimeparser);
+FILE *procmime_get_text_content(MimeInfo *mimeinfo);
+FILE *procmime_get_binary_content(MimeInfo *mimeinfo);
+
+/* scans mimeinfo contents, calling scan_callback() once per line.
+ * return TRUE and scan is aborted if scan_callback returns TRUE.
+ * return TRUE on error.
+ * return FALSE if scan completed and scan_callback never returned TRUE.
+ */
+gboolean procmime_scan_text_content(MimeInfo *mimeinfo,
+ gboolean (*scan_callback)(const gchar *str, gpointer cb_data),
+ gpointer cb_data);
+void *procmime_get_part_as_string(MimeInfo *mimeinfo,
+ gboolean null_terminate);
+GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo,
+ GError **error);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */