gmime r1312 - in trunk: . docs/reference gmime mono



Author: fejj
Date: Sat May 31 16:02:58 2008
New Revision: 1312
URL: http://svn.gnome.org/viewvc/gmime?rev=1312&view=rev

Log:
2008-05-31  Jeffrey Stedfast  <fejj novell com>

	* gmime/gmime-message-partial.c (message_partial_message_new): Use
	iters to copy the headers.

	* gmime/gmime-header.c (g_mime_header_list_foreach): Removed, this
	API sucked.



Modified:
   trunk/ChangeLog
   trunk/docs/reference/gmime-sections.txt
   trunk/gmime/gmime-header.c
   trunk/gmime/gmime-header.h
   trunk/gmime/gmime-message-partial.c
   trunk/mono/gmime-api.raw

Modified: trunk/docs/reference/gmime-sections.txt
==============================================================================
--- trunk/docs/reference/gmime-sections.txt	(original)
+++ trunk/docs/reference/gmime-sections.txt	Sat May 31 16:02:58 2008
@@ -571,7 +571,6 @@
 <FILE>gmime-header</FILE>
 GMimeHeaderIter
 GMimeHeaderList
-GMimeHeaderForeachFunc
 GMimeHeaderWriter
 g_mime_header_iter_copy
 g_mime_header_iter_free
@@ -594,10 +593,9 @@
 g_mime_header_list_set
 g_mime_header_list_get
 g_mime_header_list_get_iter
+g_mime_header_list_register_writer
 g_mime_header_list_write_to_stream
 g_mime_header_list_to_string
-g_mime_header_list_foreach
-g_mime_header_list_register_writer
 g_mime_header_list_has_raw
 g_mime_header_list_set_raw
 </SECTION>

Modified: trunk/gmime/gmime-header.c
==============================================================================
--- trunk/gmime/gmime-header.c	(original)
+++ trunk/gmime/gmime-header.c	Sat May 31 16:02:58 2008
@@ -836,30 +836,6 @@
 
 
 /**
- * g_mime_header_list_foreach:
- * @headers: a #GMimeHeaderList
- * @func: function to be called for each header.
- * @user_data: User data to be passed to the func.
- *
- * Calls @func for each header name/value pair.
- */
-void
-g_mime_header_list_foreach (const GMimeHeaderList *headers, GMimeHeaderForeachFunc func, gpointer user_data)
-{
-	const GMimeHeader *header;
-	
-	g_return_if_fail (headers != NULL);
-	g_return_if_fail (func != NULL);
-	
-	header = (const GMimeHeader *) headers->list.head;
-	while (header->next) {
-		(*func) (header->name, header->value, user_data);
-		header = header->next;
-	}
-}
-
-
-/**
  * g_mime_header_list_register_writer:
  * @headers: a #GMimeHeaderList
  * @name: header name

Modified: trunk/gmime/gmime-header.h
==============================================================================
--- trunk/gmime/gmime-header.h	(original)
+++ trunk/gmime/gmime-header.h	Sat May 31 16:02:58 2008
@@ -75,16 +75,6 @@
  **/
 typedef ssize_t (* GMimeHeaderWriter) (GMimeStream *stream, const char *name, const char *value);
 
- /**
-  * GMimeHeaderForeachFunc:
-  * @name: The field name.
-  * @value: The field value.
-  * @user_data: The user-supplied callback data.
-  *
-  * Function signature for the callback to g_mime_header_list_foreach().
-  **/
-typedef void (* GMimeHeaderForeachFunc) (const char *name, const char *value, gpointer user_data);
-
 
 GMimeHeaderList *g_mime_header_list_new (void);
 
@@ -102,8 +92,6 @@
 ssize_t g_mime_header_list_write_to_stream (const GMimeHeaderList *headers, GMimeStream *stream);
 char *g_mime_header_list_to_string (const GMimeHeaderList *headers);
 
-void g_mime_header_list_foreach (const GMimeHeaderList *headers, GMimeHeaderForeachFunc func, gpointer user_data);
-
 /* for internal use only */
 void g_mime_header_list_set_raw (GMimeHeaderList *headers, const char *raw);
 gboolean g_mime_header_list_has_raw (const GMimeHeaderList *headers);

Modified: trunk/gmime/gmime-message-partial.c
==============================================================================
--- trunk/gmime/gmime-message-partial.c	(original)
+++ trunk/gmime/gmime-message-partial.c	Sat May 31 16:02:58 2008
@@ -384,22 +384,27 @@
 }
 
 
-static void
-header_copy (const char *name, const char *value, gpointer user_data)
-{
-	GMimeMessage *message = (GMimeMessage *) user_data;
-	
-	if (value)
-		g_mime_object_append_header (GMIME_OBJECT (message), name, value);
-}
-
 static GMimeMessage *
 message_partial_message_new (GMimeMessage *base)
 {
+	const char *name, *value;
 	GMimeMessage *message;
+	GMimeHeaderList *list;
+	GMimeHeaderIter *iter;
 	
 	message = g_mime_message_new (FALSE);
-	g_mime_header_list_foreach (GMIME_OBJECT (base)->headers, header_copy, message);
+	
+	list = ((GMimeObject *) base)->headers;
+	iter = g_mime_header_list_get_iter (list);
+	if (g_mime_header_iter_is_valid (iter)) {
+		do {
+			name = g_mime_header_iter_get_name (iter);
+			value = g_mime_header_iter_get_value (iter);
+			g_mime_object_append_header ((GMimeObject *) message, name, value);
+		} while (g_mime_header_iter_next (iter));
+	}
+	
+	g_mime_header_iter_free (iter);
 	
 	return message;
 }

Modified: trunk/mono/gmime-api.raw
==============================================================================
--- trunk/mono/gmime-api.raw	(original)
+++ trunk/mono/gmime-api.raw	Sat May 31 16:02:58 2008
@@ -93,14 +93,6 @@
       <member cname="INTERNET_ADDRESS_NAME" name="Name" />
       <member cname="INTERNET_ADDRESS_GROUP" name="Group" />
     </enum>
-    <callback name="HeaderForeachFunc" cname="GMimeHeaderForeachFunc">
-      <return-type type="void" />
-      <parameters>
-        <parameter type="const-char*" name="name" />
-        <parameter type="const-char*" name="value" />
-        <parameter type="gpointer" name="user_data" />
-      </parameters>
-    </callback>
     <callback name="HeaderWriter" cname="GMimeHeaderWriter">
       <return-type type="ssize_t" />
       <parameters>
@@ -2183,13 +2175,6 @@
       <method name="Destroy" cname="g_mime_header_list_destroy">
         <return-type type="void" />
       </method>
-      <method name="Foreach" cname="g_mime_header_list_foreach">
-        <return-type type="void" />
-        <parameters>
-          <parameter type="GMimeHeaderForeachFunc" name="func" />
-          <parameter type="gpointer" name="user_data" />
-        </parameters>
-      </method>
       <method name="Get" cname="g_mime_header_list_get">
         <return-type type="const-char*" />
         <parameters>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]