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
34 #ifdef ENABLE_CRYPTOGRAPHY
35 #include "gmime-pkcs7-context.h"
36 #include "gmime-gpg-context.h"
43 * @short_description: Initialization, shutdown and version-check routines
46 * Initialization, shutdown, and version-check functions.
49 extern gboolean _g_mime_enable_rfc2047_workarounds (void);
51 GQuark gmime_gpgme_error_quark;
52 GQuark gmime_error_quark;
54 const guint gmime_major_version = GMIME_MAJOR_VERSION;
55 const guint gmime_minor_version = GMIME_MINOR_VERSION;
56 const guint gmime_micro_version = GMIME_MICRO_VERSION;
57 const guint gmime_interface_age = GMIME_INTERFACE_AGE;
58 const guint gmime_binary_age = GMIME_BINARY_AGE;
60 static unsigned int initialized = 0;
61 static guint32 enable = 0;
65 * g_mime_check_version:
66 * @major: Minimum major version
67 * @minor: Minimum minor version
68 * @micro: Minimum micro version
70 * Checks that the GMime library version meets the requirements of the
73 * Returns: %TRUE if the requirement is met or %FALSE otherwise.
76 g_mime_check_version (guint major, guint minor, guint micro)
78 if (GMIME_MAJOR_VERSION > major)
81 if (GMIME_MAJOR_VERSION == major && GMIME_MINOR_VERSION > minor)
84 if (GMIME_MAJOR_VERSION == major && GMIME_MINOR_VERSION == minor && GMIME_MICRO_VERSION >= micro)
93 * @flags: initialization flags
97 * Note: Calls g_mime_charset_map_init() and g_mime_iconv_init() as
101 g_mime_init (guint32 flags)
106 #if defined (HAVE_TIMEZONE) || defined (HAVE__TIMEZONE)
107 /* initialize timezone */
115 g_mime_charset_map_init ();
117 g_mime_iconv_init ();
120 /* gpgme_check_version() initializes GpgMe */
121 gpgme_check_version (NULL);
122 #endif /* ENABLE_SMIME */
124 gmime_gpgme_error_quark = g_quark_from_static_string ("gmime-gpgme");
125 gmime_error_quark = g_quark_from_static_string ("gmime");
127 /* register our GObject types with the GType system */
128 g_mime_crypto_context_get_type ();
129 g_mime_decrypt_result_get_type ();
130 g_mime_certificate_list_get_type ();
131 g_mime_signature_list_get_type ();
132 g_mime_certificate_get_type ();
133 g_mime_signature_get_type ();
134 #ifdef ENABLE_CRYPTOGRAPHY
135 g_mime_gpg_context_get_type ();
136 g_mime_pkcs7_context_get_type ();
139 g_mime_filter_get_type ();
140 g_mime_filter_basic_get_type ();
141 g_mime_filter_best_get_type ();
142 g_mime_filter_charset_get_type ();
143 g_mime_filter_crlf_get_type ();
144 g_mime_filter_enriched_get_type ();
145 g_mime_filter_from_get_type ();
146 g_mime_filter_gzip_get_type ();
147 g_mime_filter_html_get_type ();
148 g_mime_filter_md5_get_type ();
149 g_mime_filter_strip_get_type ();
150 g_mime_filter_windows_get_type ();
151 g_mime_filter_yenc_get_type ();
153 g_mime_stream_get_type ();
154 g_mime_stream_buffer_get_type ();
155 g_mime_stream_cat_get_type ();
156 g_mime_stream_file_get_type ();
157 g_mime_stream_filter_get_type ();
158 g_mime_stream_fs_get_type ();
159 g_mime_stream_gio_get_type ();
160 g_mime_stream_mem_get_type ();
161 g_mime_stream_mmap_get_type ();
162 g_mime_stream_null_get_type ();
163 g_mime_stream_pipe_get_type ();
165 g_mime_parser_get_type ();
166 g_mime_message_get_type ();
167 g_mime_data_wrapper_get_type ();
168 g_mime_content_type_get_type ();
169 g_mime_content_disposition_get_type ();
171 internet_address_get_type ();
172 internet_address_list_get_type ();
173 internet_address_group_get_type ();
174 internet_address_mailbox_get_type ();
176 /* register our default mime object types */
177 g_mime_object_type_registry_init ();
178 g_mime_object_register_type ("*", "*", g_mime_part_get_type ());
179 g_mime_object_register_type ("multipart", "*", g_mime_multipart_get_type ());
180 g_mime_object_register_type ("multipart", "encrypted", g_mime_multipart_encrypted_get_type ());
181 g_mime_object_register_type ("multipart", "signed", g_mime_multipart_signed_get_type ());
182 g_mime_object_register_type ("message", "rfc822", g_mime_message_part_get_type ());
183 g_mime_object_register_type ("message", "rfc2822", g_mime_message_part_get_type ());
184 g_mime_object_register_type ("message", "news", g_mime_message_part_get_type ());
185 g_mime_object_register_type ("message", "partial", g_mime_message_partial_get_type ());
192 * Frees internally allocated tables created in g_mime_init(). Also
193 * calls g_mime_charset_map_shutdown() and g_mime_iconv_shutdown().
196 g_mime_shutdown (void)
201 g_mime_object_type_registry_shutdown ();
202 g_mime_charset_map_shutdown ();
203 g_mime_iconv_shutdown ();
208 _g_mime_enable_rfc2047_workarounds (void)
210 return (enable & GMIME_ENABLE_RFC2047_WORKAROUNDS);