From 4b461ef363b736d361054f3e50d44d1b241dd320 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 19 Aug 2011 10:52:38 -0400 Subject: plugin-mono: Remove Camel.cs and Evolution.cs These files are hopelessly out of date, and don't appear to be used for anything anyway. The only sustainable way to provide language bindings for Evolution is to generate them through gobject-introspection. --- modules/plugin-mono/Camel.cs | 1210 -------------------------------------- modules/plugin-mono/Evolution.cs | 158 ----- 2 files changed, 1368 deletions(-) delete mode 100644 modules/plugin-mono/Camel.cs delete mode 100644 modules/plugin-mono/Evolution.cs (limited to 'modules/plugin-mono') diff --git a/modules/plugin-mono/Camel.cs b/modules/plugin-mono/Camel.cs deleted file mode 100644 index 21fbe468f4..0000000000 --- a/modules/plugin-mono/Camel.cs +++ /dev/null @@ -1,1210 +0,0 @@ - -using System; -using System.Collections; -using System.ComponentModel; -using System.Runtime.InteropServices; - -namespace Camel { - [StructLayout (LayoutKind.Sequential)] - public struct CamelException { - public int id; - public string desc; - } - - public class Arg { - public enum Tag : uint { - END = 0, - IGNORE = 1, - FIRST = 1024, - - TYPE = 0xf0000000, /* type field for tags */ - TAG = 0x0fffffff, /* tag field for args */ - - OBJ = 0x00000000, /* object */ - INT = 0x10000000, /* int */ - DBL = 0x20000000, /* double */ - STR = 0x30000000, /* c string */ - PTR = 0x40000000, /* ptr */ - BOO = 0x50000000 /* bool */ - } - } - - public class Exception : System.ApplicationException { - public enum Type { - NONE = 0, - SYSTEM = 1 - } - - public Type id; - public string desc; - - public Exception(CamelException ex) { - id = (Type)ex.id; - desc = ex.desc; - } - - public Exception(Type _id, string _desc) { - id = _id; - desc = _desc; - } - } - - public class Util { - [DllImport("camel-1.2")] static extern int camel_init(string certdir, bool nss); - - public static void Init(string certdir, bool nss) { - if (camel_init(certdir, nss) != 0) - throw new Exception(Exception.Type.SYSTEM, "Init failure"); - } - - public static string [] getUIDArray(IntPtr o) { - GPtrArray pa = (GPtrArray)Marshal.PtrToStructure(o, typeof(GPtrArray)); - string [] uids = new string[pa.len]; - - for (int i=0;i use StringBuilder - [DllImport("camel-1.2")] static extern IntPtr camel_url_decode(ref string url); - - public URL(string uri) { - CamelException ex = new CamelException(); - - cobject = camel_url_new(uri, ref ex); - if (ex.id != 0) - throw new Exception(ex); - } - - public URL(URL bbase, string uri) { - cobject = camel_url_new_with_base(bbase.cobject, uri); - } - - ~URL() { - camel_url_free(cobject); - } - - /* its ugly but it works */ - private string field(string name) { - return Marshal.PtrToStringAuto(Marshal.ReadIntPtr(cobject, (int)Marshal.OffsetOf(typeof(CamelURL), name))); - } - - public string protocol { - set { camel_url_set_protocol(cobject, value); } - get { return field("protocol"); } - } - - public string user { - set { camel_url_set_user(cobject, value); } - get { return field("user"); } - } - - public string authmech { - set { camel_url_set_authmech(cobject, value); } - get { return field("authmech"); } - } - - public string passwd { - set { camel_url_set_passwd(cobject, value); } - get { return field("passwd"); } - } - - public string host { - set { camel_url_set_host(cobject, value); } - get { return field("host"); } - } - - public int port { - set { camel_url_set_port(cobject, value); } - get { return (int)Marshal.ReadIntPtr(cobject, (int)Marshal.OffsetOf(typeof(CamelURL), "port")); } - } - - public string path { - set { camel_url_set_path(cobject, value); } - get { return field("path"); } - } - - public string query { - set { camel_url_set_query(cobject, value); } - get { return field("query"); } - } - - public string fragment { - set { camel_url_set_fragment(cobject, value); } - get { return field("fragment"); } - } - - public Params paramlist { - get { - if (param_list == null) - param_list = new Params(this); - return param_list; - } - } - - public override string ToString() { - return camel_url_to_string(cobject, 0); - } - - public static string encode(string val) { - return camel_url_encode(val, null); - } - - public static string encode(string val, string escape) { - return camel_url_encode(val, escape); - } - } -} - -namespace Camel.Hash { - public class Stream : System.IO.Stream { - protected Camel.Stream substream; - - public Stream(Camel.Stream sub) { - substream = sub; - } - - public override bool CanSeek { get { return false; } } - public override bool CanRead { get { return true; } } - public override bool CanWrite { get { return true; } } - public override long Length { - get { - throw new System.IO.IOException("Cannot get stream length"); - } - } - public override long Position { - get { - throw new System.IO.IOException("Cannot get stream position"); - } - set { - if (value == 0) { - substream.reset(); - } else { - throw new System.IO.IOException("Cannot set stream position"); - } - } - } - - public override int Read(byte[] buffer, int offset, int count) { - // FIXME: how to add the offset to the buffer? - return substream.read(buffer, count); - } - - public override void Write(byte[] buffer, int offset, int count) { - // FIXME: how to add the offset to the buffer? - substream.write(buffer, count); - } - - public override void Flush() { - substream.flush(); - } - - public override long Seek(long offset, System.IO.SeekOrigin seek) { - throw new System.IO.IOException("Seeking not supported"); - } - - public override void SetLength(long len) { - throw new System.IO.IOException("Cannot set stream length"); - } - } -} - -/* -namespace Evolution.Mail { - class Component : GLib.Object { - public Component(IntPtr raw) : base(raw) {} - public Component() : base() {} - - ~Component() { - Dispose(); - } - - [DllImport("libevolution-mail.so")] static extern IntPtr mail_component_peek(); - [DllImport("libevolution-mail.so")] static extern IntPtr mail_component_peek_base_directory(IntPtr component); - [DllImport("libevolution-mail.so")] static extern IntPtr mail_component_peek(); - - public static Component peek() { - return new Component(mail_component_peek()); - } - - public String baseDirectory { - get {} - } -} -*/ diff --git a/modules/plugin-mono/Evolution.cs b/modules/plugin-mono/Evolution.cs deleted file mode 100644 index 0db54405b3..0000000000 --- a/modules/plugin-mono/Evolution.cs +++ /dev/null @@ -1,158 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Reflection; - -using Camel; - -namespace Evolution { - [StructLayout (LayoutKind.Sequential)] - public class PopupTarget { - public IntPtr popup; - public IntPtr widget; - public int type; - public int mask; - }; - - [StructLayout (LayoutKind.Sequential)] - public class MenuTarget { - public IntPtr menu; - public IntPtr widget; - public int type; - public int mask; - }; - - [StructLayout (LayoutKind.Sequential)] - public class EventTarget { - public IntPtr aevent; - public int type; - public int mask; - }; -}; - -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)] - public class PopupTargetSelect : PopupTarget { - public IntPtr _folder; - public string uri; - public IntPtr _uids; - - public static PopupTargetSelect get(IntPtr o) { - return (PopupTargetSelect)Marshal.PtrToStructure(o, typeof(PopupTargetSelect)); - } - - public Camel.Folder folder { - get { return (Camel.Folder)Camel.Object.fromCamel(_folder); } - } - - public string [] uids { - get { return Camel.Util.getUIDArray(_uids); } - } - } - - [StructLayout (LayoutKind.Sequential)] - public class PopupTargetURI : Evolution.PopupTarget { - public string uri; - - public static PopupTargetURI get(IntPtr o) { - return (PopupTargetURI)Marshal.PtrToStructure(o, typeof(PopupTargetURI)); - } - } - - [StructLayout (LayoutKind.Sequential)] - public class PopupTargetPart : PopupTarget { - public string mimeType; - public IntPtr _part; - - public static PopupTargetPart get(IntPtr o) { - return (PopupTargetPart)Marshal.PtrToStructure(o, typeof(PopupTargetPart)); - } - - public Camel.Object part { - get { return (Camel.Object)Camel.Object.fromCamel(_part); } - } - } - - [StructLayout (LayoutKind.Sequential)] - public struct PopupTargetFolder { - public Evolution.PopupTarget target; - public string uri; - - public static PopupTargetFolder get(IntPtr o) { - return (PopupTargetFolder)Marshal.PtrToStructure(o, typeof(PopupTargetFolder)); - } - } - - /* ********************************************************************** */ - [StructLayout (LayoutKind.Sequential)] - public class MenuTargetSelect : MenuTarget { - public IntPtr _folder; - public string uri; - public IntPtr _uids; - - public static MenuTargetSelect get(IntPtr o) { - return (MenuTargetSelect)Marshal.PtrToStructure(o, typeof(MenuTargetSelect)); - } - - public Camel.Folder folder { - get { return (Camel.Folder)Camel.Object.fromCamel(_folder); } - } - - public string [] uids { - get { return Camel.Util.getUIDArray(_uids); } - } - } - - /* ********************************************************************** */ - [StructLayout (LayoutKind.Sequential)] - public class EventTargetFolder : EventTarget { - public string uri; - - public static EventTargetFolder get(IntPtr o) { - return (EventTargetFolder)Marshal.PtrToStructure(o, typeof(EventTargetFolder)); - } - } - - [StructLayout (LayoutKind.Sequential)] - public class EventTargetMessage : EventTarget { - public IntPtr _folder; - public string uid; - public IntPtr _message; - - public static EventTargetMessage get(IntPtr o) { - return (EventTargetMessage)Marshal.PtrToStructure(o, typeof(EventTargetMessage)); - } - - public Camel.Folder folder { - get { return (Camel.Folder)Camel.Object.fromCamel(_folder); } - } - - public Camel.MimeMessage message { - get { return (Camel.MimeMessage)Camel.Object.fromCamel(_message); } - } - - } -}; -- cgit v1.2.3