diff options
author | Not Zed <NotZed@Ximian.com> | 2005-05-17 19:01:47 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2005-05-17 19:01:47 +0800 |
commit | d8b428ec123291244f1366dc7a2309b845367d45 (patch) | |
tree | 818f7e219258652b25c0a648ada034955da2de06 /plugins | |
parent | 9700e3678e1a683c99291cd244f6370308bd5ff6 (diff) | |
download | gsoc2013-evolution-d8b428ec123291244f1366dc7a2309b845367d45.tar.gz gsoc2013-evolution-d8b428ec123291244f1366dc7a2309b845367d45.tar.zst gsoc2013-evolution-d8b428ec123291244f1366dc7a2309b845367d45.zip |
added initial e_error wrapper.
2005-05-17 Not Zed <NotZed@Ximian.com>
* Evolution.cs: added initial e_error wrapper.
* Camel.cs: added multipart & contenttype wrappers.
svn path=/trunk/; revision=29376
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mono/Camel.cs | 57 | ||||
-rw-r--r-- | plugins/mono/ChangeLog | 7 | ||||
-rw-r--r-- | plugins/mono/Evolution.cs | 62 |
3 files changed, 86 insertions, 40 deletions
diff --git a/plugins/mono/Camel.cs b/plugins/mono/Camel.cs index d14158edfc..97aa2f3fe3 100644 --- a/plugins/mono/Camel.cs +++ b/plugins/mono/Camel.cs @@ -155,7 +155,8 @@ namespace Camel { types.Add("CamelMedium", typeof(Camel.Medium)); types.Add("CamelMimeMessage", typeof(Camel.MimeMessage)); types.Add("CamelMimePart", typeof(Camel.MimePart)); - // camelmultipart? + types.Add("CamelMultipart", typeof(Camel.Multipart)); + types.Add("CamelStore", typeof(Camel.Store)); types.Add("CamelTransport", typeof(Camel.Transport)); types.Add("CamelAddress", typeof(Camel.Address)); @@ -510,6 +511,7 @@ namespace Camel { [DllImport("camel-1.2")] static extern int camel_data_wrapper_write_to_stream(IntPtr o, IntPtr s); [DllImport("camel-1.2")] static extern int camel_data_wrapper_decode_to_stream(IntPtr o, IntPtr s); [DllImport("camel-1.2")] static extern int camel_data_wrapper_construct_from_stream(IntPtr o, IntPtr s); + [DllImport("camel-1.2")] static extern IntPtr camel_data_wrapper_get_mime_type_field(IntPtr o); public void writeToStream(Camel.Stream stream) { int res; @@ -534,6 +536,8 @@ namespace Camel { if (res == -1) throw new Exception(Exception.Type.SYSTEM, "IO Error"); } + + public ContentType mimeType { get { return new ContentType(camel_data_wrapper_get_mime_type_field(cobject)); } } } public class Medium : Camel.DataWrapper { @@ -557,6 +561,40 @@ namespace Camel { } } + public class Multipart : Camel.DataWrapper { + [DllImport("camel-1.2")] static extern IntPtr camel_multipart_new(); + [DllImport("camel-1.2")] static extern void camel_multipart_add_part(IntPtr o, IntPtr p); + [DllImport("camel-1.2")] static extern void camel_multipart_remove_part(IntPtr o, IntPtr p); + [DllImport("camel-1.2")] static extern IntPtr camel_multipart_get_part(IntPtr o, int index); + [DllImport("camel-1.2")] static extern int camel_multipart_get_number(IntPtr o); + + public Multipart(IntPtr raw) : base(raw) { } + + public void addPart(MimePart part) { + camel_multipart_add_part(cobject, part.cobject); + } + + public void removePart(MimePart part) { + camel_multipart_add_part(cobject, part.cobject); + } + + public MimePart getPart(int index) { + IntPtr o; + + o = camel_multipart_get_part(cobject, index); + if (o != (IntPtr)0) + return (MimePart)Object.fromCamel(o); + else + return null; + } + + public int getNumber() { + return camel_multipart_get_number(cobject); + } + + // FIXME: finish + } + public class MimePart : Camel.Medium { [DllImport("camel-1.2")] static extern IntPtr camel_mime_part_new(); [DllImport("camel-1.2")] static extern IntPtr camel_mime_part_get_description(IntPtr o); @@ -884,6 +922,23 @@ namespace Camel { } } + public class ContentType { + public IntPtr cobject; + + public ContentType(IntPtr raw) { + cobject = raw; + } + + [DllImport("camel-1.2")] static extern bool camel_content_type_is(IntPtr raw, string type, string subtype); + + ~ContentType() { + } + + public bool isType(string type, string subtype) { + return camel_content_type_is(cobject, type, subtype); + } + } + public class MessageInfo { public IntPtr cobject; private Tags user_tags; diff --git a/plugins/mono/ChangeLog b/plugins/mono/ChangeLog index e69de29bb2..4a630d355d 100644 --- a/plugins/mono/ChangeLog +++ b/plugins/mono/ChangeLog @@ -0,0 +1,7 @@ +2005-05-17 Not Zed <NotZed@Ximian.com> + + * Evolution.cs: added initial e_error wrapper. + + * Camel.cs: added multipart & contenttype wrappers. + + diff --git a/plugins/mono/Evolution.cs b/plugins/mono/Evolution.cs index 99772d8ca2..0db54405b3 100644 --- a/plugins/mono/Evolution.cs +++ b/plugins/mono/Evolution.cs @@ -4,45 +4,6 @@ using System.Reflection; using Camel; -[StructLayout (LayoutKind.Sequential)] -struct EMPopupTargetSelect { - int type; - int mask; - IntPtr parent; - IntPtr folder; - string folderURI; - IntPtr uids; -}; - -[StructLayout (LayoutKind.Sequential)] -struct EMPopupTargetFolder { - int type; - int mask; - IntPtr parent; - string folderURI; -}; - - -[StructLayout (LayoutKind.Sequential)] -struct aCamelObject { -IntPtr klass; -uint magic; -IntPtr hooks; -uint bitfield1; -// ref_count:24 -uint ref_count { // highly non-portable - get { return (bitfield1 & 0xffffff) >> 0; } - set { bitfield1 = (bitfield1 & 0xff000000) | ((value << 0) & 0xffffff); } -} -// flags:8 -uint flags { // highly non-portable - get { return (bitfield1 & 0xff000000) >> 24; } - set { bitfield1 = (bitfield1 & 0xffffff) | ((value << 24) & 0xff000000); } -} -IntPtr next; -IntPtr prev; -} - namespace Evolution { [StructLayout (LayoutKind.Sequential)] public class PopupTarget { @@ -68,6 +29,29 @@ namespace Evolution { }; }; +namespace Evolution { + public class Error { + // can we marshal varags from c#? + [DllImport("eutil")] static extern int e_error_run(IntPtr parent, string tag, IntPtr end); + [DllImport("eutil")] static extern int e_error_run(IntPtr parent, string tag, string arg0, IntPtr end); + [DllImport("eutil")] static extern int e_error_run(IntPtr parent, string tag, string arg0, string arg1, IntPtr end); + [DllImport("eutil")] static extern int e_error_run(IntPtr parent, string tag, string arg0, string arg1, string arg2, IntPtr end); + + public static int run(IntPtr parent, string tag) { + return e_error_run(parent, tag, (IntPtr)0); + } + public static int run(IntPtr parent, string tag, string arg0) { + return e_error_run(parent, tag, arg0, (IntPtr)0); + } + public static int run(IntPtr parent, string tag, string arg0, string arg1) { + return e_error_run(parent, tag, arg0, arg1, (IntPtr)0); + } + public static int run(IntPtr parent, string tag, string arg0, string arg1, string arg2) { + return e_error_run(parent, tag, arg0, arg1, arg2, (IntPtr)0); + } + } +} + namespace Evolution.Mail { /* ********************************************************************** */ [StructLayout (LayoutKind.Sequential)] |