[gmime] Added g_mime_multipart_replace()
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Added g_mime_multipart_replace()
- Date: Sat, 13 Aug 2011 20:22:30 +0000 (UTC)
commit 60884a8743774b2b0b858ea7b80ce5255f8217ab
Author: Jeffrey Stedfast <fejj gnome org>
Date: Sat Aug 13 16:20:53 2011 -0400
Added g_mime_multipart_replace()
2011-08-13 Jeffrey Stedfast <fejj gnome org>
* gmime/gmime-multipart.c (g_mime_multipart_replace): New
convenience function to replace a mime part at a specified
position.
ChangeLog | 6 ++++++
docs/reference/gmime-sections.txt | 7 ++++---
gmime/gmime-multipart.c | 32 ++++++++++++++++++++++++++++++++
gmime/gmime-multipart.h | 1 +
mono/GMime.metadata | 1 +
mono/gmime-api.raw | 19 ++++++++++++++++++-
6 files changed, 62 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 42b4878..0c0ca11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-13 Jeffrey Stedfast <fejj gnome org>
+
+ * gmime/gmime-multipart.c (g_mime_multipart_replace): New
+ convenience function to replace a mime part at a specified
+ position.
+
2011-08-08 Jeffrey Stedfast <fejj gnome org>
* README: Bumped version
diff --git a/docs/reference/gmime-sections.txt b/docs/reference/gmime-sections.txt
index e8b7995..3b3240f 100644
--- a/docs/reference/gmime-sections.txt
+++ b/docs/reference/gmime-sections.txt
@@ -757,14 +757,15 @@ g_mime_multipart_set_postface
g_mime_multipart_get_postface
g_mime_multipart_set_boundary
g_mime_multipart_get_boundary
+g_mime_multipart_get_count
+g_mime_multipart_contains
+g_mime_multipart_index_of
g_mime_multipart_add
g_mime_multipart_clear
g_mime_multipart_insert
g_mime_multipart_remove
g_mime_multipart_remove_at
-g_mime_multipart_get_count
-g_mime_multipart_contains
-g_mime_multipart_index_of
+g_mime_multipart_replace
g_mime_multipart_get_part
g_mime_multipart_foreach
g_mime_multipart_get_subpart_from_content_id
diff --git a/gmime/gmime-multipart.c b/gmime/gmime-multipart.c
index 4b95c6c..a1da42a 100644
--- a/gmime/gmime-multipart.c
+++ b/gmime/gmime-multipart.c
@@ -606,6 +606,38 @@ g_mime_multipart_remove_at (GMimeMultipart *multipart, int index)
}
+/**
+ * g_mime_multipart_replace:
+ * @multipart: a #GMimeMultipart object
+ * @index: position of the mime part to replace
+ * @replacement: a #GMimeObject to use as the replacement
+ *
+ * Replaces the mime part at position @index within @multipart with
+ * @replacement.
+ *
+ * Returns: the mime part that was replaced or %NULL if the part was
+ * not contained within the multipart.
+ **/
+GMimeObject *
+g_mime_multipart_replace (GMimeMultipart *multipart, int index, GMimeObject *replacement)
+{
+ GMimeObject *replaced;
+
+ g_return_val_if_fail (GMIME_IS_MULTIPART (multipart), NULL);
+ g_return_val_if_fail (GMIME_IS_OBJECT (replacement), NULL);
+ g_return_val_if_fail (index >= 0, NULL);
+
+ if ((guint) index >= multipart->children->len)
+ return NULL;
+
+ replaced = multipart->children->pdata[index];
+ multipart->children->pdata[index] = replacement;
+ g_object_ref (replacement);
+
+ return replaced;
+}
+
+
static GMimeObject *
multipart_get_part (GMimeMultipart *multipart, int index)
{
diff --git a/gmime/gmime-multipart.h b/gmime/gmime-multipart.h
index 6797110..76c6f4a 100644
--- a/gmime/gmime-multipart.h
+++ b/gmime/gmime-multipart.h
@@ -96,6 +96,7 @@ void g_mime_multipart_add (GMimeMultipart *multipart, GMimeObject *part);
void g_mime_multipart_insert (GMimeMultipart *multipart, int index, GMimeObject *part);
gboolean g_mime_multipart_remove (GMimeMultipart *multipart, GMimeObject *part);
GMimeObject *g_mime_multipart_remove_at (GMimeMultipart *multipart, int index);
+GMimeObject *g_mime_multipart_replace (GMimeMultipart *multipart, int index, GMimeObject *replacement);
GMimeObject *g_mime_multipart_get_part (GMimeMultipart *multipart, int index);
gboolean g_mime_multipart_contains (GMimeMultipart *multipart, GMimeObject *part);
diff --git a/mono/GMime.metadata b/mono/GMime.metadata
index d42a4fd..2543fa4 100644
--- a/mono/GMime.metadata
+++ b/mono/GMime.metadata
@@ -271,6 +271,7 @@
<remove-node path="/api/namespace/object[ cname='GMimeMultipart']/method[ name='Insert']"/>
<remove-node path="/api/namespace/object[ cname='GMimeMultipart']/method[ name='Remove']"/>
<remove-node path="/api/namespace/object[ cname='GMimeMultipart']/method[ name='RemoveAt']"/>
+ <remove-node path="/api/namespace/object[ cname='GMimeMultipart']/method[ name='Replace']"/>
<remove-node path="/api/namespace/object[ cname='GMimeMultipart']/method[ name='GetPart']"/>
<!-- MultipartEncrypted -->
diff --git a/mono/gmime-api.raw b/mono/gmime-api.raw
index b39b770..e4a3865 100644
--- a/mono/gmime-api.raw
+++ b/mono/gmime-api.raw
@@ -26,7 +26,7 @@
<member cname="GMIME_CIPHER_ALGO_AES256" name="Aes256" value="9" />
<member cname="GMIME_CIPHER_ALGO_TWOFISH" name="Twofish" value="10" />
<member cname="GMIME_CIPHER_ALGO_CAMELLIA128" name="Camellia128" value="11" />
- <member cname="GMIME_CIPHER_ALGO_CAMELLIA196" name="Camellia196" value="12" />
+ <member cname="GMIME_CIPHER_ALGO_CAMELLIA192" name="Camellia192" value="12" />
<member cname="GMIME_CIPHER_ALGO_CAMELLIA256" name="Camellia256" value="13" />
</enum>
<enum name="ContentEncoding" cname="GMimeContentEncoding" type="enum">
@@ -876,6 +876,7 @@
<object name="GpgContext" cname="GMimeGpgContext" parent="GMimeCryptoContext">
<field name="AutoKeyRetrieve" cname="auto_key_retrieve" type="gboolean" />
<field name="AlwaysTrust" cname="always_trust" type="gboolean" />
+ <field name="UseAgent" cname="use_agent" type="gboolean" />
<field name="Path" cname="path" type="char*" />
<method name="GetAlwaysTrust" cname="g_mime_gpg_context_get_always_trust">
<return-type type="gboolean" />
@@ -886,6 +887,9 @@
<method name="GetType" cname="g_mime_gpg_context_get_type" shared="true">
<return-type type="GType" />
</method>
+ <method name="GetUseAgent" cname="g_mime_gpg_context_get_use_agent">
+ <return-type type="gboolean" />
+ </method>
<constructor cname="g_mime_gpg_context_new">
<parameters>
<parameter type="GMimePasswordRequestFunc" name="request_passwd" />
@@ -904,6 +908,12 @@
<parameter type="gboolean" name="auto_key_retrieve" />
</parameters>
</method>
+ <method name="SetUseAgent" cname="g_mime_gpg_context_set_use_agent">
+ <return-type type="void" />
+ <parameters>
+ <parameter type="gboolean" name="use_agent" />
+ </parameters>
+ </method>
</object>
<object name="Message" cname="GMimeMessage" parent="GMimeObject">
<field name="Recipients" cname="recipients" type="InternetAddressList**" />
@@ -1236,6 +1246,13 @@
<parameter type="int" name="index" />
</parameters>
</method>
+ <method name="Replace" cname="g_mime_multipart_replace">
+ <return-type type="GMimeObject*" />
+ <parameters>
+ <parameter type="int" name="index" />
+ <parameter type="GMimeObject*" name="replacement" />
+ </parameters>
+ </method>
<method name="SetBoundary" cname="g_mime_multipart_set_boundary">
<return-type type="void" />
<parameters>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]