[gmime] Implemented custom bindings for Signer/Recipient lists
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Implemented custom bindings for Signer/Recipient lists
- Date: Wed, 16 Mar 2011 00:38:32 +0000 (UTC)
commit 3d681f0b6e5cec598d38fb6f10a370f9bf00fc0f
Author: Jeffrey Stedfast <fejj gnome org>
Date: Tue Mar 15 20:37:49 2011 -0400
Implemented custom bindings for Signer/Recipient lists
2011-03-15 Jeffrey Stedfast <fejj novell com>
* mono/SignatureValidity.custom:
* mono/DecryptionResult.custom:
* mono/CryptoRecipient.custom:
* mono/Signer.custom: New custom sources implementing
* enumerators
for Signers and Recipients.
ChangeLog | 8 +++++++
mono/CryptoRecipient.custom | 8 +++++++
mono/DecryptionResult.custom | 44 +++++++++++++++++++++++++++++++++++++++++
mono/GMime.metadata | 5 ++++
mono/HeaderList.custom | 16 +++++++-------
mono/InternetAddress.custom | 8 +++---
mono/SignatureValidity.custom | 44 +++++++++++++++++++++++++++++++++++++++++
mono/Signer.custom | 8 +++++++
8 files changed, 129 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 97bdc5a..bd0d55b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-03-15 Jeffrey Stedfast <fejj novell com>
+
+ * mono/SignatureValidity.custom:
+ * mono/DecryptionResult.custom:
+ * mono/CryptoRecipient.custom:
+ * mono/Signer.custom: New custom sources implementing enumerators
+ for Signers and Recipients.
+
2011-03-14 Jeffrey Stedfast <fejj novell com>
* configure.ac: Check for glib-sharp-2.0 instead of gtk-sharp-2.0
diff --git a/mono/CryptoRecipient.custom b/mono/CryptoRecipient.custom
new file mode 100644
index 0000000..6f70d25
--- /dev/null
+++ b/mono/CryptoRecipient.custom
@@ -0,0 +1,8 @@
+ [DllImport("gmime")]
+ static extern IntPtr g_mime_crypto_recipient_next(IntPtr raw);
+
+ internal GMime.CryptoRecipient Next() {
+ IntPtr raw_ret = g_mime_crypto_recipient_next(Handle);
+ GMime.CryptoRecipient ret = raw_ret == IntPtr.Zero ? null : (GMime.CryptoRecipient) GLib.Opaque.GetOpaque (raw_ret, typeof (GMime.CryptoRecipient), false);
+ return ret;
+ }
diff --git a/mono/DecryptionResult.custom b/mono/DecryptionResult.custom
new file mode 100644
index 0000000..aedf9c7
--- /dev/null
+++ b/mono/DecryptionResult.custom
@@ -0,0 +1,44 @@
+ [DllImport("gmime")]
+ static extern IntPtr g_mime_decryption_result_get_recipients(IntPtr raw);
+
+ public IEnumerator Recipients {
+ get { return new GMimeCryptoRecipientIterator (this); }
+ }
+
+ internal class GMimeCryptoRecipientIterator : IEnumerator {
+ GMime.CryptoRecipient recipient;
+ GMime.DecryptionResult result;
+ int index = -1;
+
+ public GMimeCryptoRecipientIterator (GMime.DecryptionResult result)
+ {
+ this.result = result;
+ }
+
+ public object Current {
+ get { return recipient; }
+ }
+
+ public void Reset ()
+ {
+ recipient = null;
+ index = -1;
+ }
+
+ public bool MoveNext ()
+ {
+ IntPtr rv;
+
+ if (index == -1) {
+ rv = g_mime_decryption_result_get_recipients (result.Handle);
+ if (rv != IntPtr.Zero)
+ recipient = (GMime.CryptoRecipient) GLib.Opaque.GetOpaque (rv, typeof (GMime.CryptoRecipient), false);
+ } else {
+ recipient = recipient.Next ();
+ }
+
+ index++;
+
+ return recipient != null;
+ }
+ }
diff --git a/mono/GMime.metadata b/mono/GMime.metadata
index 7baac0a..a22116e 100644
--- a/mono/GMime.metadata
+++ b/mono/GMime.metadata
@@ -48,14 +48,19 @@
<remove-node path="/api/namespace/object[ cname='GMimeContentType']/field[ cname='type']"/>
<!-- CryptoContext -->
+ <remove-node path="/api/namespace/struct[ cname='GMimeDecryptionResult']/method[ name='GetRecipients']"/>
<remove-node path="/api/namespace/struct[ cname='GMimeDecryptionResult']/field[ cname='recipients']"/>
+ <remove-node path="/api/namespace/struct[ cname='GMimeSignatureValidity']/method[ name='GetSigners']"/>
+ <remove-node path="/api/namespace/struct[ cname='GMimeSignatureValidity']/method[ name='AddSigner']"/>
<remove-node path="/api/namespace/struct[ cname='GMimeSignatureValidity']/field[ cname='signers']"/>
<remove-node path="/api/namespace/struct[ cname='GMimeCryptoRecipient']/field[ cname='keyid']"/>
<remove-node path="/api/namespace/struct[ cname='GMimeCryptoRecipient']/field[ cname='next']"/>
+ <remove-node path="/api/namespace/struct[ cname='GMimeCryptoRecipient']/method[ name='Next']"/>
<remove-node path="/api/namespace/struct[ cname='GMimeSigner']/field[ cname='sig_ver']"/>
<remove-node path="/api/namespace/struct[ cname='GMimeSigner']/field[ cname='unused']"/>
<remove-node path="/api/namespace/struct[ cname='GMimeSigner']/field[ cname='keyid']"/>
<remove-node path="/api/namespace/struct[ cname='GMimeSigner']/field[ cname='next']"/>
+ <remove-node path="/api/namespace/struct[ cname='GMimeSigner']/method[ name='Next']"/>
<!-- DataWrapper -->
<attr path="/api/namespace/object[ cname='GMimeDataWrapper']/method[ name='GetStream']" name="name">GetGMimeStream</attr>
diff --git a/mono/HeaderList.custom b/mono/HeaderList.custom
index 259b6ff..07280d6 100644
--- a/mono/HeaderList.custom
+++ b/mono/HeaderList.custom
@@ -1,8 +1,8 @@
-public StreamWrapper Stream {
- get {
- GMime.StreamMem mem_stream = new GMime.StreamMem ();
- this.WriteToStream (mem_stream);
- mem_stream.Seek (0);
- return new StreamWrapper (mem_stream);
- }
-}
+ public StreamWrapper Stream {
+ get {
+ GMime.StreamMem mem_stream = new GMime.StreamMem ();
+ this.WriteToStream (mem_stream);
+ mem_stream.Seek (0);
+ return new StreamWrapper (mem_stream);
+ }
+ }
diff --git a/mono/InternetAddress.custom b/mono/InternetAddress.custom
index 1871cf2..7edc1c1 100644
--- a/mono/InternetAddress.custom
+++ b/mono/InternetAddress.custom
@@ -1,4 +1,4 @@
-public override string ToString ()
-{
- return ToString (false);
-}
+ public override string ToString ()
+ {
+ return ToString (false);
+ }
diff --git a/mono/SignatureValidity.custom b/mono/SignatureValidity.custom
new file mode 100644
index 0000000..59b02f8
--- /dev/null
+++ b/mono/SignatureValidity.custom
@@ -0,0 +1,44 @@
+ [DllImport("gmime")]
+ static extern IntPtr g_mime_signature_validity_get_signers(IntPtr raw);
+
+ public IEnumerator Signers {
+ get { return new GMimeSignerIterator (this); }
+ }
+
+ internal class GMimeSignerIterator : IEnumerator {
+ GMime.SignatureValidity validity;
+ GMime.Signer signer;
+ int index = -1;
+
+ public GMimeSignerIterator (GMime.SignatureValidity validity)
+ {
+ this.validity = validity;
+ }
+
+ public object Current {
+ get { return signer; }
+ }
+
+ public void Reset ()
+ {
+ signer = null;
+ index = -1;
+ }
+
+ public bool MoveNext ()
+ {
+ IntPtr rv;
+
+ if (index == -1) {
+ rv = g_mime_signature_validity_get_signers (validity.Handle);
+ if (rv != IntPtr.Zero)
+ signer = (GMime.Signer) GLib.Opaque.GetOpaque (rv, typeof (GMime.Signer), false);
+ } else {
+ signer = signer.Next ();
+ }
+
+ index++;
+
+ return signer != null;
+ }
+ }
diff --git a/mono/Signer.custom b/mono/Signer.custom
new file mode 100644
index 0000000..7c98591
--- /dev/null
+++ b/mono/Signer.custom
@@ -0,0 +1,8 @@
+ [DllImport("gmime")]
+ static extern IntPtr g_mime_signer_next(IntPtr raw);
+
+ internal GMime.Signer Next() {
+ IntPtr raw_ret = g_mime_signer_next(Handle);
+ GMime.Signer ret = raw_ret == IntPtr.Zero ? null : (GMime.Signer) GLib.Opaque.GetOpaque (raw_ret, typeof (GMime.Signer), false);
+ return ret;
+ }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]