diff options
author | bertrand <Bertrand.Guiheneuf@inria.fr> | 1999-05-10 05:03:54 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-05-10 05:03:54 +0800 |
commit | 62b338094aac49edd76acbc227e18c4f06e726c1 (patch) | |
tree | d482fec8e6a4ccabef92d7dddd267d9eb5e05b4a /camel | |
parent | 65cc58a082a305923a472bcd75c843a47586006c (diff) | |
download | gsoc2013-evolution-62b338094aac49edd76acbc227e18c4f06e726c1.tar gsoc2013-evolution-62b338094aac49edd76acbc227e18c4f06e726c1.tar.gz gsoc2013-evolution-62b338094aac49edd76acbc227e18c4f06e726c1.tar.bz2 gsoc2013-evolution-62b338094aac49edd76acbc227e18c4f06e726c1.tar.lz gsoc2013-evolution-62b338094aac49edd76acbc227e18c4f06e726c1.tar.xz gsoc2013-evolution-62b338094aac49edd76acbc227e18c4f06e726c1.tar.zst gsoc2013-evolution-62b338094aac49edd76acbc227e18c4f06e726c1.zip |
new method
1999-05-09 bertrand <Bertrand.Guiheneuf@inria.fr>
* camel/camel-mime-part.c (__camel_mime_part_add_header):
new method
* camel/camel-mime-part.h (struct CamelMimePart):
added core fields.
svn path=/trunk/; revision=899
Diffstat (limited to 'camel')
-rw-r--r-- | camel/camel-mime-part.c | 18 | ||||
-rw-r--r-- | camel/camel-mime-part.h | 9 | ||||
-rw-r--r-- | camel/gstring-util.c | 30 | ||||
-rw-r--r-- | camel/gstring-util.h | 2 |
4 files changed, 59 insertions, 0 deletions
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index 2d3fdb58fb..eed4e5de0a 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -73,3 +73,21 @@ camel_mime_part_get_type (void) + +static void +__camel_mime_part_add_header (CamelMimePart *mime_part, GString *header_name, GString *header_value) +{ + gboolean header_exists; + GString *old_header_name; + GString *old_header_value; + + header_exists = g_hash_table_lookup_extended (mime_part->headers, header_name, + (gpointer *) &old_header_name, + (gpointer *) &old_header_value); + if (header_exists) { + g_string_free (old_header_name, TRUE); + g_string_free (old_header_value, TRUE); + } + + g_hash_table_insert (mime_part->headers, header_name, header_value); +} diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h index 2342fb0e50..0d5d16b4e4 100644 --- a/camel/camel-mime-part.h +++ b/camel/camel-mime-part.h @@ -42,10 +42,19 @@ extern "C" { #define IS_CAMEL_MIME_PART(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_PART_TYPE)) + typedef struct { CamelDataWrapper parent_object; + GHashTable *headers; + GString *description; + GString *disposition; + GString *content_id; + GString *content_md5; + GString *encoding; + GList *languages; + } CamelMimePart; diff --git a/camel/gstring-util.c b/camel/gstring-util.c index 3c9d24d167..43e482154e 100644 --- a/camel/gstring-util.c +++ b/camel/gstring-util.c @@ -175,3 +175,33 @@ g_string_append_g_string(GString *dest_string, GString *other_string) g_string_append(dest_string, other_string->str); } + + + +/** + * g_string_equal_for_hash: test equality of two GStrings for hash tables + * @v: string 1 + * @v2: string 2 + * + * + * + * Return value: + **/ +g_string_equal_for_hash (gconstpointer v, gconstpointer v2) +{ + return strcmp ( ((const GString*)v)->str, ((const GString*)v2)->str) == 0; +} + + +/** + * g_string_hash: computes a hash value for a Gstring + * @v: Gstring object + * + * + * + * Return value: + **/ +guint g_string_hash (gconstpointer v) +{ + return g_str_hash(((const GString*)v)->str); +} diff --git a/camel/gstring-util.h b/camel/gstring-util.h index decb6ee064..2c118329ed 100644 --- a/camel/gstring-util.h +++ b/camel/gstring-util.h @@ -47,6 +47,8 @@ GString *g_string_clone(GString *string); gchar g_string_right_dichotomy( GString *string, gchar sep, GString **prefix, GString **suffix, DichotomyOption options); void g_string_append_g_string(GString *dest_string, GString *other_string); +gboolean g_string_equal_for_hash (gconstpointer v, gconstpointer v2); +guint g_string_hash (gconstpointer v); #ifdef __cplusplus } |