1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
2 /* camelMimeMessage.h : class for a mime message
4 * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
5 * Michael Zucchi <notzed@ximian.com>
7 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of version 2 of the GNU Lesser General Public
11 * License as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
24 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
25 #error "Only <camel/camel.h> can be included directly."
28 #ifndef CAMEL_MIME_MESSAGE_H
29 #define CAMEL_MIME_MESSAGE_H
31 #include <camel/camel-mime-part.h>
32 #include <camel/camel-mime-utils.h>
33 #include <camel/camel-internet-address.h>
34 #include <camel/camel-mime-filter-bestenc.h>
36 /* Standard GObject macros */
37 #define CAMEL_TYPE_MIME_MESSAGE \
38 (camel_mime_message_get_type ())
39 #define CAMEL_MIME_MESSAGE(obj) \
40 (G_TYPE_CHECK_INSTANCE_CAST \
41 ((obj), CAMEL_TYPE_MIME_MESSAGE, CamelMimeMessage))
42 #define CAMEL_MIME_MESSAGE_CLASS(cls) \
43 (G_TYPE_CHECK_CLASS_CAST \
44 ((cls), CAMEL_TYPE_MIME_MESSAGE, CamelMimeMessageClass))
45 #define CAMEL_IS_MIME_MESSAGE(obj) \
46 (G_TYPE_CHECK_INSTANCE_TYPE \
47 ((obj), CAMEL_TYPE_MIME_MESSAGE))
48 #define CAMEL_IS_MIME_MESSAGE_CLASS(cls) \
49 (G_TYPE_CHECK_CLASS_TYPE \
50 ((cls), CAMEL_TYPE_MIME_MESSAGE))
51 #define CAMEL_MIME_MESSAGE_GET_CLASS(obj) \
52 (G_TYPE_INSTANCE_GET_CLASS \
53 ((obj), CAMEL_TYPE_MIME_MESSAGE, CamelMimeMessageClass))
55 #define CAMEL_RECIPIENT_TYPE_TO "To"
56 #define CAMEL_RECIPIENT_TYPE_CC "Cc"
57 #define CAMEL_RECIPIENT_TYPE_BCC "Bcc"
59 #define CAMEL_RECIPIENT_TYPE_RESENT_TO "Resent-To"
60 #define CAMEL_RECIPIENT_TYPE_RESENT_CC "Resent-Cc"
61 #define CAMEL_RECIPIENT_TYPE_RESENT_BCC "Resent-Bcc"
63 /* specify local time */
64 #define CAMEL_MESSAGE_DATE_CURRENT (~0)
68 typedef struct _CamelMimeMessage CamelMimeMessage;
69 typedef struct _CamelMimeMessageClass CamelMimeMessageClass;
71 struct _CamelMimeMessage {
76 gint date_offset; /* GMT offset */
78 /* cached internal copy */
80 gint date_received_offset; /* GMT offset */
86 CamelInternetAddress *reply_to;
87 CamelInternetAddress *from;
89 GHashTable *recipients; /* hash table of CamelInternetAddress's */
92 struct _CamelMimeMessageClass {
93 CamelMimePartClass parent_class;
96 GType camel_mime_message_get_type (void);
98 camel_mime_message_new (void);
99 void camel_mime_message_set_date (CamelMimeMessage *message,
102 time_t camel_mime_message_get_date (CamelMimeMessage *message,
104 time_t camel_mime_message_get_date_received
105 (CamelMimeMessage *message,
107 void camel_mime_message_set_message_id
108 (CamelMimeMessage *message,
109 const gchar *message_id);
110 const gchar * camel_mime_message_get_message_id
111 (CamelMimeMessage *message);
112 void camel_mime_message_set_reply_to (CamelMimeMessage *message,
113 CamelInternetAddress *reply_to);
114 CamelInternetAddress *
115 camel_mime_message_get_reply_to (CamelMimeMessage *message);
116 void camel_mime_message_set_subject (CamelMimeMessage *message,
117 const gchar *subject);
118 const gchar * camel_mime_message_get_subject (CamelMimeMessage *message);
119 void camel_mime_message_set_from (CamelMimeMessage *message,
120 CamelInternetAddress *from);
121 CamelInternetAddress *
122 camel_mime_message_get_from (CamelMimeMessage *message);
123 CamelInternetAddress *
124 camel_mime_message_get_recipients
125 (CamelMimeMessage *message,
127 void camel_mime_message_set_recipients
128 (CamelMimeMessage *message,
130 CamelInternetAddress *recipients);
131 void camel_mime_message_set_source (CamelMimeMessage *message,
132 const gchar *source_uid);
133 const gchar * camel_mime_message_get_source (CamelMimeMessage *message);
135 /* utility functions */
136 gboolean camel_mime_message_has_8bit_parts
137 (CamelMimeMessage *message);
138 void camel_mime_message_set_best_encoding
139 (CamelMimeMessage *message,
140 CamelBestencRequired required,
141 CamelBestencEncoding enctype);
142 void camel_mime_message_encode_8bit_parts
143 (CamelMimeMessage *message);
144 CamelMimePart * camel_mime_message_get_part_by_content_id
145 (CamelMimeMessage *message,
146 const gchar *content_id);
147 gchar * camel_mime_message_build_mbox_from
148 (CamelMimeMessage *message);
149 gboolean camel_mime_message_has_attachment
150 (CamelMimeMessage *message);
151 void camel_mime_message_dump (CamelMimeMessage *message,
156 #endif /* CAMEL_MIME_MESSAGE_H */