diff options
author | bertrand <Bertrand.Guiheneuf@aful.org> | 1999-08-13 22:30:07 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-08-13 22:30:07 +0800 |
commit | 0472611db8f67bb0c4fc09138e1131802d85b9c3 (patch) | |
tree | 172974a6cace4cfdc16867ad52f0701470e93387 /camel/camel-mime-message.c | |
parent | 18aeb0ec732ed54dcf556d62162fe0392807a675 (diff) | |
download | gsoc2013-evolution-0472611db8f67bb0c4fc09138e1131802d85b9c3.tar gsoc2013-evolution-0472611db8f67bb0c4fc09138e1131802d85b9c3.tar.gz gsoc2013-evolution-0472611db8f67bb0c4fc09138e1131802d85b9c3.tar.bz2 gsoc2013-evolution-0472611db8f67bb0c4fc09138e1131802d85b9c3.tar.lz gsoc2013-evolution-0472611db8f67bb0c4fc09138e1131802d85b9c3.tar.xz gsoc2013-evolution-0472611db8f67bb0c4fc09138e1131802d85b9c3.tar.zst gsoc2013-evolution-0472611db8f67bb0c4fc09138e1131802d85b9c3.zip |
those two func go here now.
1999-08-13 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/hash-table-utils.c (g_strcase_equal):
(g_strcase_hash): those two func go here now.
* camel/hash_table_utils.c (hash_table_generic_free):
free a (gpointer, gpointer) hash table pair.
* camel/camel-mime-message.c (camel_mime_message_init): use
case insensitive hash table functions.
(_set_flag):
(camel_mime_message_set_flag):
(_get_flag):
(camel_mime_message_get_flag):
Use const for flag name, they are now
duplicated.
svn path=/trunk/; revision=1110
Diffstat (limited to 'camel/camel-mime-message.c')
-rw-r--r-- | camel/camel-mime-message.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c index acff82ca71..019903d75a 100644 --- a/camel/camel-mime-message.c +++ b/camel/camel-mime-message.c @@ -28,6 +28,7 @@ #include "string-utils.h" #include "camel-log.h" #include "gmime-utils.h" +#include "hash-table-utils.h" typedef enum { HEADER_UNKNOWN, @@ -65,8 +66,8 @@ static void _add_recipient (CamelMimeMessage *mime_message, gchar *recipient_typ static void _remove_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient); static const GList *_get_recipients (CamelMimeMessage *mime_message, const gchar *recipient_type); -static void _set_flag (CamelMimeMessage *mime_message, gchar *flag, gboolean value); -static gboolean _get_flag (CamelMimeMessage *mime_message, gchar *flag); +static void _set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value); +static gboolean _get_flag (CamelMimeMessage *mime_message, const gchar *flag); static void _set_message_number (CamelMimeMessage *mime_message, guint number); static guint _get_message_number (CamelMimeMessage *mime_message); @@ -143,8 +144,8 @@ camel_mime_message_init (gpointer object, gpointer klass) { CamelMimeMessage *camel_mime_message = CAMEL_MIME_MESSAGE (object); - camel_mime_message->recipients = g_hash_table_new (g_str_hash, g_str_equal); - camel_mime_message->flags = g_hash_table_new (g_str_hash, g_str_equal); + camel_mime_message->recipients = g_hash_table_new (g_strcase_hash, g_strcase_equal); + camel_mime_message->flags = g_hash_table_new (g_strcase_hash, g_strcase_equal); } GtkType @@ -184,10 +185,13 @@ _finalize (GtkObject *object) if (message->reply_to) g_free (message->reply_to); if (message->from) g_free (message->from); -#warning free recipients and flags. +#warning free recipients. if (message->folder) gtk_object_unref (GTK_OBJECT (message->folder)); if (message->session) gtk_object_unref (GTK_OBJECT (message->session)); + if (message->flags) + g_hash_table_foreach (message->flags, g_hash_table_generic_free, NULL); + GTK_OBJECT_CLASS (parent_class)->finalize (object); CAMEL_LOG_FULL_DEBUG ("Leaving CamelMimeMessage::finalize\n"); } @@ -459,7 +463,7 @@ camel_mime_message_get_recipients (CamelMimeMessage *mime_message, const gchar * static void -_set_flag (CamelMimeMessage *mime_message, gchar *flag, gboolean value) +_set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value) { gchar old_flags; gboolean *ptr_value; @@ -469,16 +473,14 @@ _set_flag (CamelMimeMessage *mime_message, gchar *flag, gboolean value) (gpointer)&(ptr_value)) ) { ptr_value = g_new (gboolean, 1); - g_hash_table_insert (mime_message->flags, flag, ptr_value); - } else { - g_free (flag); - } + g_hash_table_insert (mime_message->flags, g_strdup (flag), ptr_value); + } *ptr_value = value; } void -camel_mime_message_set_flag (CamelMimeMessage *mime_message, gchar *flag, gboolean value) +camel_mime_message_set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value) { CMM_CLASS (mime_message)->set_flag (mime_message, flag, value); } @@ -486,7 +488,7 @@ camel_mime_message_set_flag (CamelMimeMessage *mime_message, gchar *flag, gboole static gboolean -_get_flag (CamelMimeMessage *mime_message, gchar *flag) +_get_flag (CamelMimeMessage *mime_message, const gchar *flag) { gboolean *value; value = (gboolean *)g_hash_table_lookup (mime_message->flags, flag); @@ -494,7 +496,7 @@ _get_flag (CamelMimeMessage *mime_message, gchar *flag) } gboolean -camel_mime_message_get_flag (CamelMimeMessage *mime_message, gchar *flag) +camel_mime_message_get_flag (CamelMimeMessage *mime_message, const gchar *flag) { return CMM_CLASS (mime_message)->get_flag (mime_message, flag); } |