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
This commit is contained in:
bertrand
1999-05-09 21:03:54 +00:00
committed by Bertrand Guiheneuf
parent 65cc58a082
commit 62b338094a
5 changed files with 67 additions and 0 deletions

View File

@ -1,3 +1,11 @@
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.
1999-05-08 bertrand <Bertrand.Guiheneuf@inria.fr> 1999-05-08 bertrand <Bertrand.Guiheneuf@inria.fr>
* camel/camel-mime-part.[ch]: * camel/camel-mime-part.[ch]:

View File

@ -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);
}

View File

@ -42,10 +42,19 @@ extern "C" {
#define IS_CAMEL_MIME_PART(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_PART_TYPE)) #define IS_CAMEL_MIME_PART(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_PART_TYPE))
typedef struct typedef struct
{ {
CamelDataWrapper parent_object; CamelDataWrapper parent_object;
GHashTable *headers;
GString *description;
GString *disposition;
GString *content_id;
GString *content_md5;
GString *encoding;
GList *languages;
} CamelMimePart; } CamelMimePart;

View File

@ -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_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);
}

View File

@ -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); 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); 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 #ifdef __cplusplus
} }