[DllImport("ebook")] static extern unsafe bool e_book_get_contacts(IntPtr raw, IntPtr query, out IntPtr contacts, out IntPtr error); public unsafe Contact[] GetContacts(Evolution.BookQuery query) { if (query == null) throw new ArgumentNullException ("query"); IntPtr contacts_handle; IntPtr error = IntPtr.Zero; bool raw_ret = e_book_get_contacts(Handle, query.Handle, out contacts_handle, out error); if (error != IntPtr.Zero) throw new GLib.GException (error); if (raw_ret == false) return null; GLib.List cl = new GLib.List(contacts_handle, typeof (Contact)); Contact[] result = new Contact [cl.Count]; for (int i = 0; i < cl.Count; i++) result [i] = cl [i] as Contact; return result; } [DllImport("ebook")] static extern unsafe bool e_book_get_book_view(IntPtr raw, IntPtr query, IntPtr requested_fields, int max_results, out IntPtr book_view, out IntPtr error); public unsafe BookView GetBookView (Evolution.BookQuery query, IEnumerable requestedFields, int max_results) { IntPtr error = IntPtr.Zero; IntPtr bookHandle; GLib.List fieldsList = new GLib.List (typeof (string)); if (requestedFields != null) { foreach (string field in requestedFields) { fieldsList.Append (field); } } bool raw_ret = e_book_get_book_view (Handle, query.Handle, fieldsList.Handle, max_results, out bookHandle, out error); if (error != IntPtr.Zero) throw new GLib.GException (error); if (raw_ret == false || bookHandle == (IntPtr)0) return null; return new BookView (bookHandle); } [DllImport("evolutionglue")] static extern bool e_book_glue_ebook_get_changes(IntPtr raw, string changeid, out IntPtr added, out IntPtr modified, out IntPtr deleted, out IntPtr error); public unsafe bool GetChanges(string changeid, out Contact[] newcontacts, out Contact[] updated, out String[] removed ) { IntPtr error = IntPtr.Zero; IntPtr added = IntPtr.Zero; IntPtr modified = IntPtr.Zero; IntPtr deleted = IntPtr.Zero; bool raw_ret = e_book_glue_ebook_get_changes (Handle, changeid, out added, out modified, out deleted, out error); if (error != IntPtr.Zero) throw new GLib.GException (error); if (raw_ret == false) { newcontacts = new Contact [0]; updated = new Contact [0]; removed = new string [0]; return raw_ret; } GLib.SList cl; if (added != IntPtr.Zero) { cl = new GLib.SList(added, typeof (Contact)); newcontacts = new Contact [cl.Count]; for (int i = 0; i < cl.Count; i++) newcontacts [i] = cl [i] as Contact; } else { newcontacts = new Contact [0]; } if (modified != IntPtr.Zero) { cl = new GLib.SList(modified, typeof (Contact)); updated = new Contact [cl.Count]; for (int i = 0; i < cl.Count; i++) updated [i] = cl [i] as Contact; } else { updated = new Contact [0]; } if (deleted != IntPtr.Zero) { GLib.SList sl = new GLib.SList(deleted, typeof (string)); removed = new string [sl.Count]; for (int i = 0; i < sl.Count; i++) removed [i] = sl [i] as String; } else { removed = new string [0]; } return raw_ret; }