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 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) 5 * 6 * This library is free software: you can redistribute it and/or modify it 7 * under the terms of the GNU Lesser General Public License as published by 8 * the Free Software Foundation. 9 * 10 * This library is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 13 * for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with this library. If not, see <http://www.gnu.org/licenses/>. 17 * 18 * Authors: Bertrand Guiheneuf <bertrand@helixcode.com> 19 * Michael Zucchi <notzed@ximian.com> 20 */ 21 22 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION) 23 #error "Only <camel/camel.h> can be included directly." 24 #endif 25 26 #ifndef CAMEL_MIME_PART_H 27 #define CAMEL_MIME_PART_H 28 29 #include <camel/camel-medium.h> 30 #include <camel/camel-mime-utils.h> 31 #include <camel/camel-mime-parser.h> 32 #include <camel/camel-name-value-array.h> 33 34 /* Standard GObject macros */ 35 #define CAMEL_TYPE_MIME_PART \ 36 (camel_mime_part_get_type ()) 37 #define CAMEL_MIME_PART(obj) \ 38 (G_TYPE_CHECK_INSTANCE_CAST \ 39 ((obj), CAMEL_TYPE_MIME_PART, CamelMimePart)) 40 #define CAMEL_MIME_PART_CLASS(cls) \ 41 (G_TYPE_CHECK_CLASS_CAST \ 42 ((cls), CAMEL_TYPE_MIME_PART, CamelMimePartClass)) 43 #define CAMEL_IS_MIME_PART(obj) \ 44 (G_TYPE_CHECK_INSTANCE_TYPE \ 45 ((obj), CAMEL_TYPE_MIME_PART)) 46 #define CAMEL_IS_MIME_PART_CLASS(cls) \ 47 (G_TYPE_CHECK_CLASS_TYPE \ 48 ((cls), CAMEL_TYPE_MIME_PART)) 49 #define CAMEL_MIME_PART_GET_CLASS(obj) \ 50 (G_TYPE_INSTANCE_GET_CLASS \ 51 ((obj), CAMEL_TYPE_MIME_PART, CamelMimePartClass)) 52 53 G_BEGIN_DECLS 54 55 typedef struct _CamelMimePart CamelMimePart; 56 typedef struct _CamelMimePartClass CamelMimePartClass; 57 typedef struct _CamelMimePartPrivate CamelMimePartPrivate; 58 59 struct _CamelMimePart { 60 CamelMedium parent; 61 CamelMimePartPrivate *priv; 62 }; 63 64 struct _CamelMimePartClass { 65 CamelMediumClass parent_class; 66 67 /* Synchronous I/O Methods */ 68 gboolean (*construct_from_parser_sync) 69 (CamelMimePart *mime_part, 70 CamelMimeParser *parser, 71 GCancellable *cancellable, 72 GError **error); 73 74 /* Padding for future expansion */ 75 gpointer reserved[20]; 76 }; 77 78 GType camel_mime_part_get_type (void); 79 CamelMimePart * camel_mime_part_new (void); 80 void camel_mime_part_set_description (CamelMimePart *mime_part, 81 const gchar *description); 82 const gchar * camel_mime_part_get_description (CamelMimePart *mime_part); 83 void camel_mime_part_set_disposition (CamelMimePart *mime_part, 84 const gchar *disposition); 85 const gchar * camel_mime_part_get_disposition (CamelMimePart *mime_part); 86 const CamelContentDisposition * 87 camel_mime_part_get_content_disposition 88 (CamelMimePart *mime_part); 89 void camel_mime_part_set_filename (CamelMimePart *mime_part, 90 const gchar *filename); 91 const gchar * camel_mime_part_get_filename (CamelMimePart *mime_part); 92 void camel_mime_part_set_content_id (CamelMimePart *mime_part, 93 const gchar *contentid); 94 const gchar * camel_mime_part_get_content_id (CamelMimePart *mime_part); 95 void camel_mime_part_set_content_md5 (CamelMimePart *mime_part, 96 const gchar *md5sum); 97 const gchar * camel_mime_part_get_content_md5 (CamelMimePart *mime_part); 98 void camel_mime_part_set_content_location 99 (CamelMimePart *mime_part, 100 const gchar *location); 101 const gchar * camel_mime_part_get_content_location 102 (CamelMimePart *mime_part); 103 void camel_mime_part_set_encoding (CamelMimePart *mime_part, 104 CamelTransferEncoding encoding); 105 CamelTransferEncoding 106 camel_mime_part_get_encoding (CamelMimePart *mime_part); 107 void camel_mime_part_set_content_languages 108 (CamelMimePart *mime_part, 109 GList *content_languages); 110 const GList * camel_mime_part_get_content_languages 111 (CamelMimePart *mime_part); 112 void camel_mime_part_set_content_type 113 (CamelMimePart *mime_part, 114 const gchar *content_type); 115 CamelContentType * 116 camel_mime_part_get_content_type 117 (CamelMimePart *mime_part); 118 void camel_mime_part_set_content (CamelMimePart *mime_part, 119 const gchar *data, 120 gint length, 121 const gchar *type); 122 123 gboolean camel_mime_part_construct_from_parser_sync 124 (CamelMimePart *mime_part, 125 CamelMimeParser *parser, 126 GCancellable *cancellable, 127 GError **error); 128 void camel_mime_part_construct_from_parser 129 (CamelMimePart *mime_part, 130 CamelMimeParser *parser, 131 gint io_priority, 132 GCancellable *cancellable, 133 GAsyncReadyCallback callback, 134 gpointer user_data); 135 gboolean camel_mime_part_construct_from_parser_finish 136 (CamelMimePart *mime_part, 137 GAsyncResult *result, 138 GError **error); 139 140 G_END_DECLS 141 142 #endif /* CAMEL_MIME_PART_H */ 143