1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2000-2012 Jeffrey Stedfast
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 2.1
8 * of the License, or (at your option) any later version.
10 * This library 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 GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
22 #ifndef __GMIME_UTILS_H__
23 #define __GMIME_UTILS_H__
29 #include <gmime/gmime-encodings.h>
33 typedef struct _GMimeReferences GMimeReferences;
37 * @next: Pointer to the next reference.
38 * @msgid: Reference message-id.
40 * A List of references, as per the References or In-Reply-To header
43 struct _GMimeReferences {
44 GMimeReferences *next;
49 time_t g_mime_utils_header_decode_date (const char *str, int *tz_offset);
50 char *g_mime_utils_header_format_date (time_t date, int tz_offset);
52 char *g_mime_utils_generate_message_id (const char *fqdn);
54 /* decode a message-id */
55 char *g_mime_utils_decode_message_id (const char *message_id);
57 /* decode a References or In-Reply-To header */
58 GMimeReferences *g_mime_references_decode (const char *text);
59 void g_mime_references_append (GMimeReferences **refs, const char *msgid);
60 void g_mime_references_clear (GMimeReferences **refs);
61 void g_mime_references_free (GMimeReferences *refs);
62 const GMimeReferences *g_mime_references_get_next (const GMimeReferences *ref);
63 const char *g_mime_references_get_message_id (const GMimeReferences *ref);
65 char *g_mime_utils_structured_header_fold (const char *str);
66 char *g_mime_utils_unstructured_header_fold (const char *str);
67 char *g_mime_utils_header_fold (const char *str);
68 char *g_mime_utils_header_printf (const char *format, ...);
70 char *g_mime_utils_quote_string (const char *str);
71 void g_mime_utils_unquote_string (char *str);
73 /* encoding decision making utilities ;-) */
74 gboolean g_mime_utils_text_is_8bit (const unsigned char *text, size_t len);
75 GMimeContentEncoding g_mime_utils_best_encoding (const unsigned char *text, size_t len);
77 /* utility function to convert text in an unknown 8bit/multibyte charset to UTF-8 */
78 char *g_mime_utils_decode_8bit (const char *text, size_t len);
80 /* utilities to (de/en)code headers */
81 char *g_mime_utils_header_decode_text (const char *text);
82 char *g_mime_utils_header_encode_text (const char *text);
84 char *g_mime_utils_header_decode_phrase (const char *phrase);
85 char *g_mime_utils_header_encode_phrase (const char *phrase);
89 #endif /* __GMIME_UTILS_H__ */