From 4b03ba004e4a74742c9cbaebad3dc7259920d99d Mon Sep 17 00:00:00 2001 From: Jim Nelson Date: Wed, 6 Jul 2011 15:46:24 -0700 Subject: [PATCH] Use GMime to display the text/plain portion of email messages: #3710 This makes available MIME portions of the message, although more work will need to be done to expose all MIME parts. --- src/client/ui/main-window.vala | 10 +- src/engine/api/geary-email.vala | 20 + .../decoders/imap-fetch-data-decoder.vala | 2 +- src/engine/rfc822/rfc822-error.vala | 11 + src/engine/rfc822/rfc822-message-data.vala | 4 + src/engine/rfc822/rfc822-message.vala | 78 +++ src/engine/sqlite/api/sqlite-folder.vala | 1 + .../sqlite/email/sqlite-message-row.vala | 4 +- src/engine/util/util-memory.vala | 13 +- src/wscript | 2 + vapi/gmime-2.4.vapi | 538 +++++++++++++----- vapi/gmime-2.4/gmime-2.4.metadata | 16 +- 12 files changed, 551 insertions(+), 148 deletions(-) create mode 100644 src/engine/rfc822/rfc822-error.vala create mode 100644 src/engine/rfc822/rfc822-message.vala diff --git a/src/client/ui/main-window.vala b/src/client/ui/main-window.vala index 29183107..fee64804 100644 --- a/src/client/ui/main-window.vala +++ b/src/client/ui/main-window.vala @@ -253,9 +253,13 @@ public class MainWindow : Gtk.Window { return; } - Geary.Email text = yield current_folder.fetch_email_async(email.location.position, - Geary.Email.Field.BODY); - message_buffer.set_text(text.body.buffer.to_ascii_string()); + Geary.Email full = yield current_folder.fetch_email_async(email.location.position, + Geary.Email.Field.HEADER | Geary.Email.Field.BODY); + + Geary.Memory.AbstractBuffer buffer = full.get_message().get_first_mime_part_of_content_type( + "text/plain"); + + message_buffer.set_text(buffer.to_utf8()); } private void on_select_message_completed(Object? source, AsyncResult result) { diff --git a/src/engine/api/geary-email.vala b/src/engine/api/geary-email.vala index 67c3ca7d..1a24e923 100644 --- a/src/engine/api/geary-email.vala +++ b/src/engine/api/geary-email.vala @@ -86,6 +86,8 @@ public class Geary.Email : Object { public Geary.Email.Field fields { get; private set; default = Field.NONE; } + private Geary.RFC822.Message? message = null; + public Email(Geary.EmailLocation location) { this.location = location; } @@ -130,12 +132,18 @@ public class Geary.Email : Object { public void set_message_header(Geary.RFC822.Header header) { this.header = header; + // reset the message object, which is built from this text + message = null; + fields |= Field.HEADER; } public void set_message_body(Geary.RFC822.Text body) { this.body = body; + // reset the message object, which is built from this text + message = null; + fields |= Field.BODY; } @@ -145,6 +153,18 @@ public class Geary.Email : Object { fields |= Field.PROPERTIES; } + public Geary.RFC822.Message get_message() throws EngineError, RFC822.Error { + if (message != null) + return message; + + if (!fields.fulfills(Field.HEADER | Field.BODY)) + throw new EngineError.INCOMPLETE_MESSAGE("Parsed email requires HEADER and BODY"); + + message = new Geary.RFC822.Message.from_parts(header, body); + + return message; + } + public string to_string() { StringBuilder builder = new StringBuilder(); diff --git a/src/engine/imap/decoders/imap-fetch-data-decoder.vala b/src/engine/imap/decoders/imap-fetch-data-decoder.vala index fd931be3..4891f6fd 100644 --- a/src/engine/imap/decoders/imap-fetch-data-decoder.vala +++ b/src/engine/imap/decoders/imap-fetch-data-decoder.vala @@ -123,7 +123,7 @@ public class Geary.Imap.EnvelopeDecoder : Geary.Imap.FetchDataDecoder { message_id = null; return new Envelope(new Geary.RFC822.Date(sent.value), - new Geary.RFC822.Subject(subject.value), + new Geary.RFC822.Subject.from_rfc822(subject.value), parse_addresses(from), parse_addresses(sender), parse_addresses(reply_to), (to != null) ? parse_addresses(to) : null, (cc != null) ? parse_addresses(cc) : null, diff --git a/src/engine/rfc822/rfc822-error.vala b/src/engine/rfc822/rfc822-error.vala new file mode 100644 index 00000000..f886dba0 --- /dev/null +++ b/src/engine/rfc822/rfc822-error.vala @@ -0,0 +1,11 @@ +/* Copyright 2011 Yorba Foundation + * + * This software is licensed under the GNU Lesser General Public License + * (version 2.1 or later). See the COPYING file in this distribution. + */ + +public errordomain Geary.RFC822.Error { + INVALID, + NOT_FOUND +} + diff --git a/src/engine/rfc822/rfc822-message-data.vala b/src/engine/rfc822/rfc822-message-data.vala index 56ffac34..106df644 100644 --- a/src/engine/rfc822/rfc822-message-data.vala +++ b/src/engine/rfc822/rfc822-message-data.vala @@ -48,6 +48,10 @@ public class Geary.RFC822.Subject : Geary.Common.StringMessageData, Geary.RFC822 public Subject(string value) { base (value); } + + public Subject.from_rfc822(string value) { + base (GMime.utils_header_decode_text(value)); + } } public class Geary.RFC822.Header : Geary.Common.BlockMessageData, Geary.RFC822.MessageData { diff --git a/src/engine/rfc822/rfc822-message.vala b/src/engine/rfc822/rfc822-message.vala new file mode 100644 index 00000000..91009f5d --- /dev/null +++ b/src/engine/rfc822/rfc822-message.vala @@ -0,0 +1,78 @@ +/* Copyright 2011 Yorba Foundation + * + * This software is licensed under the GNU Lesser General Public License + * (version 2.1 or later). See the COPYING file in this distribution. + */ + +public class Geary.RFC822.Message : Object { + private GMime.Message? message; + + public Message(Full full) { + GMime.Parser parser = new GMime.Parser.with_stream( + new GMime.StreamMem.with_buffer(full.buffer.get_buffer())); + + message = parser.construct_message(); + } + + public Message.from_parts(Header header, Text body) { + GMime.StreamCat stream_cat = new GMime.StreamCat(); + stream_cat.add_source(new GMime.StreamMem.with_buffer(header.buffer.get_buffer())); + stream_cat.add_source(new GMime.StreamMem.with_buffer(body.buffer.get_buffer())); + + GMime.Parser parser = new GMime.Parser.with_stream(stream_cat); + + message = parser.construct_message(); + } + + public bool is_decoded() { + return message != null; + } + + public Geary.Memory.AbstractBuffer get_first_mime_part_of_content_type(string content_type) + throws RFC822.Error { + if (!is_decoded()) + throw new RFC822.Error.INVALID("Message could not be decoded"); + + // search for content type starting from the root + GMime.Part? part = find_first_mime_part(message.get_mime_part(), content_type); + if (part == null) { + throw new RFC822.Error.NOT_FOUND("Could not find a MIME part with content-type %s", + content_type); + } + + // convert payload to a buffer + GMime.DataWrapper? wrapper = part.get_content_object(); + if (wrapper == null) { + throw new RFC822.Error.INVALID("Could not get the content wrapper for content-type %s", + content_type); + } + + ByteArray byte_array = new ByteArray(); + GMime.StreamMem stream = new GMime.StreamMem.with_byte_array(byte_array); + stream.set_owner(false); + + wrapper.write_to_stream(stream); + + return new Geary.Memory.Buffer(byte_array.data, byte_array.len); + } + + private GMime.Part? find_first_mime_part(GMime.Object current_root, string content_type) { + // descend looking for the content type in a GMime.Part + GMime.Multipart? multipart = current_root as GMime.Multipart; + if (multipart != null) { + int count = multipart.get_count(); + for (int ctr = 0; ctr < count; ctr++) { + GMime.Part? child_part = find_first_mime_part(multipart.get_part(ctr), content_type); + if (child_part != null) + return child_part; + } + } + + GMime.Part? part = current_root as GMime.Part; + if (part != null && part.get_content_type().to_string() == content_type) + return part; + + return null; + } +} + diff --git a/src/engine/sqlite/api/sqlite-folder.vala b/src/engine/sqlite/api/sqlite-folder.vala index a33f585d..797bbdc1 100644 --- a/src/engine/sqlite/api/sqlite-folder.vala +++ b/src/engine/sqlite/api/sqlite-folder.vala @@ -77,6 +77,7 @@ public class Geary.Sqlite.Folder : Geary.AbstractFolder, Geary.LocalFolder { location.uid.to_string(), to_string()); } + // TODO: The following steps should be atomic message_id = yield message_table.create_async( new MessageRow.from_email(message_table, email), cancellable); diff --git a/src/engine/sqlite/email/sqlite-message-row.vala b/src/engine/sqlite/email/sqlite-message-row.vala index e7c687f5..819f2446 100644 --- a/src/engine/sqlite/email/sqlite-message-row.vala +++ b/src/engine/sqlite/email/sqlite-message-row.vala @@ -191,13 +191,13 @@ public class Geary.Sqlite.MessageRow : Geary.Sqlite.Row { } if ((fields & Geary.Email.Field.HEADER) != 0) { - header = (email.header != null) ? email.header.buffer.to_ascii_string() : null; + header = (email.header != null) ? email.header.buffer.to_utf8() : null; this.fields = this.fields.set(Geary.Email.Field.HEADER); } if ((fields & Geary.Email.Field.BODY) != 0) { - body = (email.body != null) ? email.body.buffer.to_ascii_string() : null; + body = (email.body != null) ? email.body.buffer.to_utf8() : null; this.fields = this.fields.set(Geary.Email.Field.BODY); } diff --git a/src/engine/util/util-memory.vala b/src/engine/util/util-memory.vala index 871f9656..9a837a4a 100644 --- a/src/engine/util/util-memory.vala +++ b/src/engine/util/util-memory.vala @@ -20,17 +20,18 @@ public abstract class Geary.Memory.AbstractBuffer { public abstract InputStream get_input_stream(); /** - * Returns the contents of the buffer as though it was an ASCII (or 7-bit) string. Note that + * Returns the contents of the buffer as though it was an UTF-8 string. Note that * this involves reading the entire buffer into memory. + * + * If the conversion fails or decodes as invalid UTF-8, an empty string is returned. */ - public string to_ascii_string() { + public string to_utf8() { uint8[] buffer = get_buffer(); + buffer += (uint8) '\0'; - StringBuilder builder = new StringBuilder(); - foreach (uint8 byte in buffer) - builder.append_c((char) byte); + string str = (string) buffer; - return builder.str; + return str.validate() ? str : ""; } } diff --git a/src/wscript b/src/wscript index 47e76652..ac8d62be 100644 --- a/src/wscript +++ b/src/wscript @@ -81,8 +81,10 @@ def build(bld): '../engine/imap/transport/imap-serializable.vala', '../engine/imap/transport/imap-serializer.vala', + '../engine/rfc822/rfc822-error.vala', '../engine/rfc822/rfc822-mailbox-addresses.vala', '../engine/rfc822/rfc822-mailbox-address.vala', + '../engine/rfc822/rfc822-message.vala', '../engine/rfc822/rfc822-message-data.vala', '../engine/sqlite/abstract/sqlite-database.vala', diff --git a/vapi/gmime-2.4.vapi b/vapi/gmime-2.4.vapi index 12c71a34..1ddceab9 100644 --- a/vapi/gmime-2.4.vapi +++ b/vapi/gmime-2.4.vapi @@ -1,24 +1,37 @@ /* gmime-2.4.vapi generated by vapigen, do not modify. */ -[CCode (cprefix = "GMime", lower_case_cprefix = "g_mime_")] +[CCode (cprefix = "GMime", lower_case_cprefix = "gmime_")] namespace GMime { [Compact] [CCode (cheader_filename = "gmime/gmime.h")] public class Charset { public uint level; public uint mask; + [CCode (cname = "g_mime_charset_best")] public static unowned string best (string inbuf, size_t inlen); + [CCode (cname = "g_mime_charset_best_name")] public unowned string best_name (); + [CCode (cname = "g_mime_charset_can_encode")] public bool can_encode (string charset, string text, size_t len); + [CCode (cname = "g_mime_charset_canon_name")] public static unowned string canon_name (string charset); + [CCode (cname = "g_mime_charset_iconv_name")] public static unowned string iconv_name (string charset); + [CCode (cname = "g_mime_charset_init")] public void init (); + [CCode (cname = "g_mime_charset_iso_to_windows")] public static unowned string iso_to_windows (string isocharset); + [CCode (cname = "g_mime_charset_language")] public static unowned string language (string charset); + [CCode (cname = "g_mime_charset_locale_name")] public static unowned string locale_name (); + [CCode (cname = "g_mime_charset_map_init")] public static void map_init (); + [CCode (cname = "g_mime_charset_map_shutdown")] public static void map_shutdown (); + [CCode (cname = "g_mime_charset_name")] public static unowned string name (string charset); + [CCode (cname = "g_mime_charset_step")] public void step (string inbuf, size_t inlen); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -29,13 +42,21 @@ namespace GMime { public weak string sign_protocol; [CCode (has_construct_function = false)] protected CipherContext (); + [CCode (cname = "g_mime_cipher_context_decrypt")] public virtual unowned GMime.SignatureValidity decrypt (GMime.Stream istream, GMime.Stream ostream) throws GLib.Error; + [CCode (cname = "g_mime_cipher_context_encrypt")] public virtual int encrypt (bool sign, string userid, GLib.GenericArray recipients, GMime.Stream istream, GMime.Stream ostream) throws GLib.Error; + [CCode (cname = "g_mime_cipher_context_export_keys")] public virtual int export_keys (GLib.GenericArray keys, GMime.Stream ostream) throws GLib.Error; + [CCode (cname = "g_mime_cipher_context_hash_id")] public virtual GMime.CipherHash hash_id (string hash); + [CCode (cname = "g_mime_cipher_context_hash_name")] public virtual unowned string hash_name (GMime.CipherHash hash); + [CCode (cname = "g_mime_cipher_context_import_keys")] public virtual int import_keys (GMime.Stream istream) throws GLib.Error; + [CCode (cname = "g_mime_cipher_context_sign")] public virtual int sign (string userid, GMime.CipherHash hash, GMime.Stream istream, GMime.Stream ostream) throws GLib.Error; + [CCode (cname = "g_mime_cipher_context_verify")] public virtual unowned GMime.SignatureValidity verify (GMime.CipherHash hash, GMime.Stream istream, GMime.Stream sigstream) throws GLib.Error; } [CCode (cheader_filename = "gmime/gmime.h")] @@ -43,16 +64,23 @@ namespace GMime { public weak string disposition; public weak GLib.HashTable param_hash; public weak GMime.Param @params; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_content_disposition_new", has_construct_function = false)] public ContentDisposition (); - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_content_disposition_new_from_string", has_construct_function = false)] public ContentDisposition.from_string (string str); + [CCode (cname = "g_mime_content_disposition_get_disposition")] public unowned string get_disposition (); + [CCode (cname = "g_mime_content_disposition_get_parameter")] public unowned string get_parameter (string attribute); + [CCode (cname = "g_mime_content_disposition_get_params")] public unowned GMime.Param get_params (); + [CCode (cname = "g_mime_content_disposition_set_disposition")] public void set_disposition (string value); + [CCode (cname = "g_mime_content_disposition_set_parameter")] public void set_parameter (string attribute, string value); + [CCode (cname = "g_mime_content_disposition_set_params")] public void set_params (GMime.Param @params); + [CCode (cname = "g_mime_content_disposition_to_string")] public unowned string to_string (bool fold); public virtual signal void changed (); } @@ -62,19 +90,29 @@ namespace GMime { public weak GMime.Param @params; public weak string subtype; public weak string type; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_content_type_new", has_construct_function = false)] public ContentType (string type, string subtype); - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_content_type_new_from_string", has_construct_function = false)] public ContentType.from_string (string str); + [CCode (cname = "g_mime_content_type_get_media_subtype")] public unowned string get_media_subtype (); + [CCode (cname = "g_mime_content_type_get_media_type")] public unowned string get_media_type (); + [CCode (cname = "g_mime_content_type_get_parameter")] public unowned string get_parameter (string attribute); + [CCode (cname = "g_mime_content_type_get_params")] public unowned GMime.Param get_params (); + [CCode (cname = "g_mime_content_type_is_type")] public bool is_type (string type, string subtype); + [CCode (cname = "g_mime_content_type_set_media_subtype")] public void set_media_subtype (string subtype); + [CCode (cname = "g_mime_content_type_set_media_type")] public void set_media_type (string type); + [CCode (cname = "g_mime_content_type_set_parameter")] public void set_parameter (string attribute, string value); + [CCode (cname = "g_mime_content_type_set_params")] public void set_params (GMime.Param @params); + [CCode (cname = "g_mime_content_type_to_string")] public unowned string to_string (); public virtual signal void changed (); } @@ -82,14 +120,19 @@ namespace GMime { public class DataWrapper : GLib.Object { public GMime.ContentEncoding encoding; public weak GMime.Stream stream; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_data_wrapper_new", has_construct_function = false)] public DataWrapper (); + [CCode (cname = "g_mime_data_wrapper_get_encoding")] public GMime.ContentEncoding get_encoding (); + [CCode (cname = "g_mime_data_wrapper_get_stream")] public unowned GMime.Stream get_stream (); + [CCode (cname = "g_mime_data_wrapper_set_encoding")] public void set_encoding (GMime.ContentEncoding encoding); + [CCode (cname = "g_mime_data_wrapper_set_stream")] public void set_stream (GMime.Stream stream); - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_data_wrapper_new_with_stream", has_construct_function = false)] public DataWrapper.with_stream (GMime.Stream stream, GMime.ContentEncoding encoding); + [CCode (cname = "g_mime_data_wrapper_write_to_stream")] public virtual ssize_t write_to_stream (GMime.Stream stream); } [Compact] @@ -101,20 +144,35 @@ namespace GMime { public int state; [CCode (array_length = false)] public weak uint[] uubuf; + [CCode (cname = "g_mime_encoding_base64_decode_step")] public static size_t base64_decode_step (uint inbuf, size_t inlen, uint outbuf, int state, uint32 save); + [CCode (cname = "g_mime_encoding_base64_encode_close")] public static size_t base64_encode_close (uint inbuf, size_t inlen, uint outbuf, int state, uint32 save); + [CCode (cname = "g_mime_encoding_base64_encode_step")] public static size_t base64_encode_step (uint inbuf, size_t inlen, uint outbuf, int state, uint32 save); + [CCode (cname = "g_mime_encoding_flush")] public size_t flush (string inbuf, size_t inlen, string outbuf); + [CCode (cname = "g_mime_encoding_init_decode")] public void init_decode (GMime.ContentEncoding encoding); + [CCode (cname = "g_mime_encoding_init_encode")] public void init_encode (GMime.ContentEncoding encoding); + [CCode (cname = "g_mime_encoding_outlen")] public size_t outlen (size_t inlen); + [CCode (cname = "g_mime_encoding_quoted_decode_step")] public static size_t quoted_decode_step (uint inbuf, size_t inlen, uint outbuf, int state, uint32 save); + [CCode (cname = "g_mime_encoding_quoted_encode_close")] public static size_t quoted_encode_close (uint inbuf, size_t inlen, uint outbuf, int state, uint32 save); + [CCode (cname = "g_mime_encoding_quoted_encode_step")] public static size_t quoted_encode_step (uint inbuf, size_t inlen, uint outbuf, int state, uint32 save); + [CCode (cname = "g_mime_encoding_reset")] public void reset (); + [CCode (cname = "g_mime_encoding_step")] public size_t step (string inbuf, size_t inlen, string outbuf); + [CCode (cname = "g_mime_encoding_uudecode_step")] public static size_t uudecode_step (uint inbuf, size_t inlen, uint outbuf, int state, uint32 save); + [CCode (cname = "g_mime_encoding_uuencode_close")] public static size_t uuencode_close (uint inbuf, size_t inlen, uint outbuf, uint uubuf, int state, uint32 save); + [CCode (cname = "g_mime_encoding_uuencode_step")] public static size_t uuencode_step (uint inbuf, size_t inlen, uint outbuf, uint uubuf, int state, uint32 save); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -129,17 +187,23 @@ namespace GMime { public size_t outsize; [CCode (has_construct_function = false)] protected Filter (); + [CCode (cname = "g_mime_filter_backup")] public void backup (string data, size_t length); + [CCode (cname = "g_mime_filter_complete")] public virtual void complete (string inbuf, size_t inlen, size_t prespace, out unowned string outbuf, size_t outlen, size_t outprespace); + [CCode (cname = "g_mime_filter_copy")] public virtual unowned GMime.Filter copy (); + [CCode (cname = "g_mime_filter_filter")] public virtual void filter (string inbuf, size_t inlen, size_t prespace, out unowned string outbuf, size_t outlen, size_t outprespace); + [CCode (cname = "g_mime_filter_reset")] public virtual void reset (); + [CCode (cname = "g_mime_filter_set_size")] public void set_size (size_t size, bool keep); } [CCode (cheader_filename = "gmime/gmime.h")] public class FilterBasic : GMime.Filter { public weak GMime.Encoding encoder; - [CCode (type = "GMimeFilter*", has_construct_function = false)] + [CCode (cname = "g_mime_filter_basic_new", type = "GMimeFilter*", has_construct_function = false)] public FilterBasic (GMime.ContentEncoding encoding, bool encode); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -156,9 +220,11 @@ namespace GMime { public uint midline; public uint startline; public uint total; - [CCode (type = "GMimeFilter*", has_construct_function = false)] + [CCode (cname = "g_mime_filter_best_new", type = "GMimeFilter*", has_construct_function = false)] public FilterBest (GMime.FilterBestFlags flags); + [CCode (cname = "g_mime_filter_best_charset")] public unowned string charset (); + [CCode (cname = "g_mime_filter_best_encoding")] public GMime.ContentEncoding encoding (GMime.BestEncoding required); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -168,7 +234,7 @@ namespace GMime { public bool saw_cr; public bool saw_dot; public bool saw_lf; - [CCode (type = "GMimeFilter*", has_construct_function = false)] + [CCode (cname = "g_mime_filter_crlf_new", type = "GMimeFilter*", has_construct_function = false)] public FilterCRLF (bool encode, bool dots); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -176,28 +242,28 @@ namespace GMime { public void* cd; public weak string from_charset; public weak string to_charset; - [CCode (type = "GMimeFilter*", has_construct_function = false)] + [CCode (cname = "g_mime_filter_charset_new", type = "GMimeFilter*", has_construct_function = false)] public FilterCharset (string from_charset, string to_charset); } [CCode (cheader_filename = "gmime/gmime.h")] public class FilterEnriched : GMime.Filter { public uint32 flags; public int nofill; - [CCode (type = "GMimeFilter*", has_construct_function = false)] + [CCode (cname = "g_mime_filter_enriched_new", type = "GMimeFilter*", has_construct_function = false)] public FilterEnriched (uint32 flags); } [CCode (cheader_filename = "gmime/gmime.h")] public class FilterFrom : GMime.Filter { public bool midline; public GMime.FilterFromMode mode; - [CCode (type = "GMimeFilter*", has_construct_function = false)] + [CCode (cname = "g_mime_filter_from_new", type = "GMimeFilter*", has_construct_function = false)] public FilterFrom (GMime.FilterFromMode mode); } [CCode (cheader_filename = "gmime/gmime.h")] public class FilterGZip : GMime.Filter { public int level; public GMime.FilterGZipMode mode; - [CCode (type = "GMimeFilter*", has_construct_function = false)] + [CCode (cname = "g_mime_filter_gzip_new", type = "GMimeFilter*", has_construct_function = false)] public FilterGZip (GMime.FilterGZipMode mode, int level); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -207,27 +273,30 @@ namespace GMime { public uint32 flags; public uint32 pre_open; public void* scanner; - [CCode (type = "GMimeFilter*", has_construct_function = false)] + [CCode (cname = "g_mime_filter_html_new", type = "GMimeFilter*", has_construct_function = false)] public FilterHTML (uint32 flags, uint32 colour); } [CCode (cheader_filename = "gmime/gmime.h")] public class FilterMd5 : GMime.Filter { - [CCode (type = "GMimeFilter*", has_construct_function = false)] + [CCode (cname = "g_mime_filter_md5_new", type = "GMimeFilter*", has_construct_function = false)] public FilterMd5 (); + [CCode (cname = "g_mime_filter_md5_get_digest")] public void get_digest (uint[] digest); } [CCode (cheader_filename = "gmime/gmime.h")] public class FilterStrip : GMime.Filter { - [CCode (type = "GMimeFilter*", has_construct_function = false)] + [CCode (cname = "g_mime_filter_strip_new", type = "GMimeFilter*", has_construct_function = false)] public FilterStrip (); } [CCode (cheader_filename = "gmime/gmime.h")] public class FilterWindows : GMime.Filter { public weak string claimed_charset; public bool is_windows; - [CCode (type = "GMimeFilter*", has_construct_function = false)] + [CCode (cname = "g_mime_filter_windows_new", type = "GMimeFilter*", has_construct_function = false)] public FilterWindows (string claimed_charset); + [CCode (cname = "g_mime_filter_windows_is_windows_charset")] public bool is_windows_charset (); + [CCode (cname = "g_mime_filter_windows_real_charset")] public unowned string real_charset (); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -237,20 +306,26 @@ namespace GMime { public int part; public uint32 pcrc; public int state; - [CCode (type = "GMimeFilter*", has_construct_function = false)] + [CCode (cname = "g_mime_filter_yenc_new", type = "GMimeFilter*", has_construct_function = false)] public FilterYenc (bool encode); + [CCode (cname = "g_mime_filter_yenc_get_crc")] public uint32 get_crc (); + [CCode (cname = "g_mime_filter_yenc_get_pcrc")] public uint32 get_pcrc (); + [CCode (cname = "g_mime_filter_yenc_set_crc")] public void set_crc (uint32 crc); + [CCode (cname = "g_mime_filter_yenc_set_state")] public void set_state (int state); } [CCode (cheader_filename = "gmime/gmime.h")] public class GpgContext : GMime.CipherContext { public bool always_trust; public weak string path; - [CCode (type = "GMimeCipherContext*", has_construct_function = false)] + [CCode (cname = "g_mime_gpg_context_new", type = "GMimeCipherContext*", has_construct_function = false)] public GpgContext (GMime.Session session, string path); + [CCode (cname = "g_mime_gpg_context_get_always_trust")] public bool get_always_trust (); + [CCode (cname = "g_mime_gpg_context_set_always_trust")] public void set_always_trust (bool always_trust); } [Compact] @@ -258,44 +333,70 @@ namespace GMime { public class Header { } [Compact] - [CCode (copy_function = "g_mime_header_iter_copy", cheader_filename = "gmime/gmime.h")] + [CCode (copy_function = "g_mime_header_iter_copy", free_function = "g_mime_header_iter_free", cheader_filename = "gmime/gmime.h")] public class HeaderIter { public weak GMime.Header cursor; public weak GMime.HeaderList hdrlist; public uint32 version; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_header_iter_new", has_construct_function = false)] public HeaderIter (); + [CCode (cname = "g_mime_header_iter_copy")] public unowned GMime.HeaderIter copy (); + [CCode (cname = "g_mime_header_iter_copy_to")] public void copy_to (GMime.HeaderIter dest); + [CCode (cname = "g_mime_header_iter_equal")] public bool equal (GMime.HeaderIter iter2); + [CCode (cname = "g_mime_header_iter_first")] public bool first (); + [CCode (cname = "g_mime_header_iter_get_name")] public unowned string get_name (); + [CCode (cname = "g_mime_header_iter_get_value")] public unowned string get_value (); + [CCode (cname = "g_mime_header_iter_is_valid")] public bool is_valid (); + [CCode (cname = "g_mime_header_iter_last")] public bool last (); + [CCode (cname = "g_mime_header_iter_next")] public bool next (); + [CCode (cname = "g_mime_header_iter_prev")] public bool prev (); + [CCode (cname = "g_mime_header_iter_remove")] public bool remove (); + [CCode (cname = "g_mime_header_iter_set_value")] public bool set_value (string value); } [Compact] [CCode (free_function = "g_mime_header_list_destroy", cheader_filename = "gmime/gmime.h")] public class HeaderList { - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_header_list_new", has_construct_function = false)] public HeaderList (); + [CCode (cname = "g_mime_header_list_append")] public void append (string name, string value); + [CCode (cname = "g_mime_header_list_foreach")] public void @foreach (GMime.HeaderForeachFunc func); + [CCode (cname = "g_mime_header_list_get")] public unowned string @get (string name); - public bool get_iter (GMime.HeaderIter iter); + [CCode (cname = "g_mime_header_list_get_iter")] + public bool get_iter (out unowned GMime.HeaderIter iter); + [CCode (cname = "g_mime_header_list_get_stream")] public unowned GMime.Stream get_stream (); + [CCode (cname = "g_mime_header_list_has_raw")] public bool has_raw (); + [CCode (cname = "g_mime_header_list_prepend")] public void prepend (string name, string value); + [CCode (cname = "g_mime_header_list_register_writer")] public void register_writer (string name, GMime.HeaderWriter writer); + [CCode (cname = "g_mime_header_list_remove")] public bool remove (string name); + [CCode (cname = "g_mime_header_list_set")] public void @set (string name, string value); + [CCode (cname = "g_mime_header_list_set_raw")] public void set_raw (string raw); + [CCode (cname = "g_mime_header_list_set_stream")] public void set_stream (GMime.Stream stream); + [CCode (cname = "g_mime_header_list_to_string")] public unowned string to_string (); + [CCode (cname = "g_mime_header_list_write_to_stream")] public ssize_t write_to_stream (GMime.Stream stream); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -308,35 +409,55 @@ namespace GMime { public weak string reply_to; public weak string subject; public int tz_offset; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_message_new", has_construct_function = false)] public Message (bool pretty_headers); + [CCode (cname = "g_mime_message_add_recipient")] public void add_recipient (GMime.RecipientType type, string name, string addr); + [CCode (cname = "g_mime_message_foreach")] public void @foreach (GMime.ObjectForeachFunc callback); + [CCode (cname = "g_mime_message_get_all_recipients")] public unowned InternetAddressList get_all_recipients (); + [CCode (cname = "g_mime_message_get_date")] public void get_date (out ulong date, out int tz_offset); + [CCode (cname = "g_mime_message_get_date_as_string")] public unowned string get_date_as_string (); + [CCode (cname = "g_mime_message_get_message_id")] public unowned string get_message_id (); + [CCode (cname = "g_mime_message_get_mime_part")] public unowned GMime.Object get_mime_part (); + [CCode (cname = "g_mime_message_get_recipients")] public unowned InternetAddressList get_recipients (GMime.RecipientType type); + [CCode (cname = "g_mime_message_get_reply_to")] public unowned string get_reply_to (); + [CCode (cname = "g_mime_message_get_sender")] public unowned string get_sender (); + [CCode (cname = "g_mime_message_get_subject")] public unowned string get_subject (); + [CCode (cname = "g_mime_message_set_date")] public void set_date (ulong date, int tz_offset); + [CCode (cname = "g_mime_message_set_date_as_string")] public void set_date_as_string (string str); + [CCode (cname = "g_mime_message_set_message_id")] public void set_message_id (string message_id); + [CCode (cname = "g_mime_message_set_mime_part")] public void set_mime_part (GMime.Object mime_part); + [CCode (cname = "g_mime_message_set_reply_to")] public void set_reply_to (string reply_to); + [CCode (cname = "g_mime_message_set_sender")] public void set_sender (string sender); + [CCode (cname = "g_mime_message_set_subject")] public void set_subject (string subject); } [CCode (cheader_filename = "gmime/gmime.h")] public class MessagePart : GMime.Object { public weak GMime.Message message; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_message_part_new", has_construct_function = false)] public MessagePart (string subtype); + [CCode (cname = "g_mime_message_part_get_message")] public unowned GMime.Message get_message (); + [CCode (cname = "g_mime_message_part_set_message")] public void set_message (GMime.Message message); - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_message_part_new_with_message", has_construct_function = false)] public MessagePart.with_message (string subtype, GMime.Message message); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -344,12 +465,17 @@ namespace GMime { public weak string id; public int number; public int total; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_message_partial_new", has_construct_function = false)] public MessagePartial (string id, int number, int total); + [CCode (cname = "g_mime_message_partial_get_id")] public unowned string get_id (); + [CCode (cname = "g_mime_message_partial_get_number")] public int get_number (); + [CCode (cname = "g_mime_message_partial_get_total")] public int get_total (); + [CCode (cname = "g_mime_message_partial_reconstruct_message")] public unowned GMime.Message reconstruct_message (size_t num); + [CCode (cname = "g_mime_message_partial_split_message")] public static unowned GMime.Message split_message (GMime.Message message, size_t max_size, size_t nparts); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -358,78 +484,124 @@ namespace GMime { public weak GLib.GenericArray children; public weak string postface; public weak string preface; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_multipart_new", has_construct_function = false)] public Multipart (); + [CCode (cname = "g_mime_multipart_add")] public virtual void add (GMime.Object part); + [CCode (cname = "g_mime_multipart_clear")] public virtual void clear (); + [CCode (cname = "g_mime_multipart_contains")] public virtual bool contains (GMime.Object part); + [CCode (cname = "g_mime_multipart_foreach")] public void @foreach (GMime.ObjectForeachFunc callback); + [CCode (cname = "g_mime_multipart_get_boundary")] public virtual unowned string get_boundary (); + [CCode (cname = "g_mime_multipart_get_count")] public virtual int get_count (); + [CCode (cname = "g_mime_multipart_get_part")] public virtual unowned GMime.Object get_part (int index); + [CCode (cname = "g_mime_multipart_get_postface")] public unowned string get_postface (); + [CCode (cname = "g_mime_multipart_get_preface")] public unowned string get_preface (); + [CCode (cname = "g_mime_multipart_get_subpart_from_content_id")] public unowned GMime.Object get_subpart_from_content_id (string content_id); + [CCode (cname = "g_mime_multipart_index_of")] public virtual int index_of (GMime.Object part); + [CCode (cname = "g_mime_multipart_insert")] public virtual void insert (int index, GMime.Object part); + [CCode (cname = "g_mime_multipart_remove")] public virtual bool remove (GMime.Object part); + [CCode (cname = "g_mime_multipart_remove_at")] public virtual unowned GMime.Object remove_at (int index); + [CCode (cname = "g_mime_multipart_set_boundary")] public virtual void set_boundary (string boundary); + [CCode (cname = "g_mime_multipart_set_postface")] public void set_postface (string postface); + [CCode (cname = "g_mime_multipart_set_preface")] public void set_preface (string preface); - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_multipart_new_with_subtype", has_construct_function = false)] public Multipart.with_subtype (string subtype); } [CCode (cheader_filename = "gmime/gmime.h")] public class MultipartEncrypted : GMime.Multipart { public weak GMime.Object decrypted; public weak GMime.SignatureValidity validity; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_multipart_encrypted_new", has_construct_function = false)] public MultipartEncrypted (); + [CCode (cname = "g_mime_multipart_encrypted_decrypt")] public unowned GMime.Object decrypt (GMime.CipherContext ctx) throws GLib.Error; + [CCode (cname = "g_mime_multipart_encrypted_encrypt")] public int encrypt (GMime.Object content, GMime.CipherContext ctx, bool sign, string userid, GLib.GenericArray recipients) throws GLib.Error; + [CCode (cname = "g_mime_multipart_encrypted_get_signature_validity")] public unowned GMime.SignatureValidity get_signature_validity (); } [CCode (cheader_filename = "gmime/gmime.h")] public class MultipartSigned : GMime.Multipart { - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_multipart_signed_new", has_construct_function = false)] public MultipartSigned (); + [CCode (cname = "g_mime_multipart_signed_sign")] public int sign (GMime.Object content, GMime.CipherContext ctx, string userid, GMime.CipherHash hash) throws GLib.Error; + [CCode (cname = "g_mime_multipart_signed_verify")] public unowned GMime.SignatureValidity verify (GMime.CipherContext ctx) throws GLib.Error; } [CCode (cheader_filename = "gmime/gmime.h")] - public class Object : GLib.Object { + public abstract class Object : GLib.Object { public weak string content_id; public weak GMime.ContentType content_type; public weak GMime.ContentDisposition disposition; public weak GMime.HeaderList headers; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_object_new", has_construct_function = false)] public Object (GMime.ContentType content_type); + [CCode (cname = "g_mime_object_append_header")] public virtual void append_header (string header, string value); + [CCode (cname = "g_mime_object_get_content_disposition")] public unowned GMime.ContentDisposition get_content_disposition (); + [CCode (cname = "g_mime_object_get_content_disposition_parameter")] public unowned string get_content_disposition_parameter (string attribute); + [CCode (cname = "g_mime_object_get_content_id")] public unowned string get_content_id (); + [CCode (cname = "g_mime_object_get_content_type")] public unowned GMime.ContentType get_content_type (); + [CCode (cname = "g_mime_object_get_content_type_parameter")] public unowned string get_content_type_parameter (string name); + [CCode (cname = "g_mime_object_get_disposition")] public unowned string get_disposition (); + [CCode (cname = "g_mime_object_get_header")] public virtual unowned string get_header (string header); + [CCode (cname = "g_mime_object_get_header_list")] public unowned GMime.HeaderList get_header_list (); + [CCode (cname = "g_mime_object_get_headers")] public virtual unowned string get_headers (); + [CCode (cname = "g_mime_object_prepend_header")] public virtual void prepend_header (string header, string value); + [CCode (cname = "g_mime_object_register_type")] public static void register_type (string type, string subtype, GLib.Type object_type); + [CCode (cname = "g_mime_object_remove_header")] public virtual bool remove_header (string header); + [CCode (cname = "g_mime_object_set_content_disposition")] public void set_content_disposition (GMime.ContentDisposition disposition); + [CCode (cname = "g_mime_object_set_content_disposition_parameter")] public void set_content_disposition_parameter (string attribute, string value); + [CCode (cname = "g_mime_object_set_content_id")] public void set_content_id (string content_id); + [CCode (cname = "g_mime_object_set_content_type")] public virtual void set_content_type (GMime.ContentType content_type); + [CCode (cname = "g_mime_object_set_content_type_parameter")] public void set_content_type_parameter (string name, string value); + [CCode (cname = "g_mime_object_set_disposition")] public void set_disposition (string disposition); + [CCode (cname = "g_mime_object_set_header")] public virtual void set_header (string header, string value); - public unowned string to_string (); - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_object_to_string")] + public string to_string (); + [CCode (cname = "g_mime_object_new_type", has_construct_function = false)] public Object.type (string type, string subtype); + [CCode (cname = "g_mime_object_type_registry_init")] public static void type_registry_init (); + [CCode (cname = "g_mime_object_type_registry_shutdown")] public static void type_registry_shutdown (); + [CCode (cname = "g_mime_object_write_to_stream")] public virtual ssize_t write_to_stream (GMime.Stream stream); } [Compact] @@ -438,39 +610,60 @@ namespace GMime { public weak string name; public weak GMime.Param next; public weak string value; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_param_new", has_construct_function = false)] public Param (string name, string value); + [CCode (cname = "g_mime_param_append")] public unowned GMime.Param append (string name, string value); + [CCode (cname = "g_mime_param_append_param")] public unowned GMime.Param append_param (GMime.Param param); - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_param_new_from_string", has_construct_function = false)] public Param.from_string (string str); + [CCode (cname = "g_mime_param_get_name")] public unowned string get_name (); [CCode (cname = "g_mime_param_next")] public unowned GMime.Param get_next (); + [CCode (cname = "g_mime_param_get_value")] public unowned string get_value (); + [CCode (cname = "g_mime_param_write_to_string")] public void write_to_string (bool fold, GLib.StringBuilder str); } [CCode (cheader_filename = "gmime/gmime.h")] public class Parser : GLib.Object { - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_parser_new", has_construct_function = false)] public Parser (); - public unowned GMime.Message construct_message (); + [CCode (cname = "g_mime_parser_construct_message")] + public unowned GMime.Message? construct_message (); + [CCode (cname = "g_mime_parser_construct_part")] public unowned GMime.Object construct_part (); + [CCode (cname = "g_mime_parser_eos")] public bool eos (); + [CCode (cname = "g_mime_parser_get_from")] public unowned string get_from (); + [CCode (cname = "g_mime_parser_get_from_offset")] public int64 get_from_offset (); + [CCode (cname = "g_mime_parser_get_headers_begin")] public int64 get_headers_begin (); + [CCode (cname = "g_mime_parser_get_headers_end")] public int64 get_headers_end (); + [CCode (cname = "g_mime_parser_get_persist_stream")] public bool get_persist_stream (); + [CCode (cname = "g_mime_parser_get_respect_content_length")] public bool get_respect_content_length (); + [CCode (cname = "g_mime_parser_get_scan_from")] public bool get_scan_from (); + [CCode (cname = "g_mime_parser_init_with_stream")] public void init_with_stream (GMime.Stream stream); + [CCode (cname = "g_mime_parser_set_header_regex")] public void set_header_regex (string regex, GMime.ParserHeaderRegexFunc header_cb); + [CCode (cname = "g_mime_parser_set_persist_stream")] public void set_persist_stream (bool persist); + [CCode (cname = "g_mime_parser_set_respect_content_length")] public void set_respect_content_length (bool respect_content_length); + [CCode (cname = "g_mime_parser_set_scan_from")] public void set_scan_from (bool scan_from); + [CCode (cname = "g_mime_parser_tell")] public int64 tell (); - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_parser_new_with_stream", has_construct_function = false)] public Parser.with_stream (GMime.Stream stream); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -480,43 +673,66 @@ namespace GMime { public weak string content_location; public weak string content_md5; public GMime.ContentEncoding encoding; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_part_new", has_construct_function = false)] public Part (); + [CCode (cname = "g_mime_part_get_content_description")] public unowned string get_content_description (); + [CCode (cname = "g_mime_part_get_content_encoding")] public GMime.ContentEncoding get_content_encoding (); + [CCode (cname = "g_mime_part_get_content_id")] public unowned string get_content_id (); + [CCode (cname = "g_mime_part_get_content_location")] public unowned string get_content_location (); + [CCode (cname = "g_mime_part_get_content_md5")] public unowned string get_content_md5 (); + [CCode (cname = "g_mime_part_get_content_object")] public unowned GMime.DataWrapper get_content_object (); + [CCode (cname = "g_mime_part_get_filename")] public unowned string get_filename (); + [CCode (cname = "g_mime_part_set_content_description")] public void set_content_description (string description); + [CCode (cname = "g_mime_part_set_content_encoding")] public void set_content_encoding (GMime.ContentEncoding encoding); + [CCode (cname = "g_mime_part_set_content_id")] public void set_content_id (string content_id); + [CCode (cname = "g_mime_part_set_content_location")] public void set_content_location (string content_location); + [CCode (cname = "g_mime_part_set_content_md5")] public void set_content_md5 (string content_md5); + [CCode (cname = "g_mime_part_set_content_object")] public virtual void set_content_object (GMime.DataWrapper content); + [CCode (cname = "g_mime_part_set_filename")] public void set_filename (string filename); + [CCode (cname = "g_mime_part_verify_content_md5")] public bool verify_content_md5 (); - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_part_new_with_type", has_construct_function = false)] public Part.with_type (string type, string subtype); } [Compact] - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (free_function = "g_mime_references_free", cheader_filename = "gmime/gmime.h")] public class References { public weak string msgid; public weak GMime.References next; + [CCode (cname = "g_mime_references_append")] public void append (string msgid); + [CCode (cname = "g_mime_references_clear")] public void clear (); + [CCode (cname = "g_mime_references_decode")] public static unowned GMime.References decode (string text); + [CCode (cname = "g_mime_references_get_message_id")] public unowned string get_message_id (); + [CCode (cname = "g_mime_references_get_next")] public unowned GMime.References get_next (); } [CCode (cheader_filename = "gmime/gmime.h")] public class Session : GLib.Object { [CCode (has_construct_function = false)] protected Session (); + [CCode (cname = "g_mime_session_forget_passwd")] public virtual void forget_passwd (string item) throws GLib.Error; + [CCode (cname = "g_mime_session_is_online")] public virtual bool is_online (); + [CCode (cname = "g_mime_session_request_passwd")] public virtual unowned string request_passwd (string prompt, bool secret, string item) throws GLib.Error; } [CCode (cheader_filename = "gmime/gmime.h")] @@ -526,27 +742,36 @@ namespace GMime { public weak GMime.SimpleRequestPasswdFunc request_passwd; [CCode (has_construct_function = false)] protected SessionSimple (); + [CCode (cname = "g_mime_session_simple_set_forget_passwd")] public void set_forget_passwd (GMime.SimpleForgetPasswdFunc forget_passwd); + [CCode (cname = "g_mime_session_simple_set_is_online")] public void set_is_online (GMime.SimpleIsOnlineFunc is_online); + [CCode (cname = "g_mime_session_simple_set_request_passwd")] public void set_request_passwd (GMime.SimpleRequestPasswdFunc request_passwd); } [Compact] - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (free_function = "g_mime_signature_validity_free", cheader_filename = "gmime/gmime.h")] public class SignatureValidity { public weak string details; public weak GMime.Signer signers; public GMime.SignatureStatus status; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_signature_validity_new", has_construct_function = false)] public SignatureValidity (); + [CCode (cname = "g_mime_signature_validity_add_signer")] public void add_signer (GMime.Signer signer); + [CCode (cname = "g_mime_signature_validity_get_details")] public unowned string get_details (); + [CCode (cname = "g_mime_signature_validity_get_signers")] public unowned GMime.Signer get_signers (); + [CCode (cname = "g_mime_signature_validity_get_status")] public GMime.SignatureStatus get_status (); + [CCode (cname = "g_mime_signature_validity_set_details")] public void set_details (string details); + [CCode (cname = "g_mime_signature_validity_set_status")] public void set_status (GMime.SignatureStatus status); } [Compact] - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (free_function = "g_mime_signer_free", cheader_filename = "gmime/gmime.h")] public class Signer { public ulong created; public uint errors; @@ -558,50 +783,82 @@ namespace GMime { public uint status; public uint trust; public uint unused; - [CCode (has_construct_function = false)] + [CCode (cname = "g_mime_signer_new", has_construct_function = false)] public Signer (); + [CCode (cname = "g_mime_signer_get_created")] public ulong get_created (); + [CCode (cname = "g_mime_signer_get_errors")] public GMime.SignerError get_errors (); + [CCode (cname = "g_mime_signer_get_expires")] public ulong get_expires (); + [CCode (cname = "g_mime_signer_get_fingerprint")] public unowned string get_fingerprint (); + [CCode (cname = "g_mime_signer_get_key_id")] public unowned string get_key_id (); + [CCode (cname = "g_mime_signer_get_name")] public unowned string get_name (); [CCode (cname = "g_mime_signer_next")] public unowned GMime.Signer get_next (); + [CCode (cname = "g_mime_signer_get_status")] public GMime.SignerStatus get_status (); + [CCode (cname = "g_mime_signer_get_trust")] public GMime.SignerTrust get_trust (); + [CCode (cname = "g_mime_signer_set_created")] public void set_created (ulong created); + [CCode (cname = "g_mime_signer_set_errors")] public void set_errors (GMime.SignerError error); + [CCode (cname = "g_mime_signer_set_expires")] public void set_expires (ulong expires); + [CCode (cname = "g_mime_signer_set_fingerprint")] public void set_fingerprint (string fingerprint); + [CCode (cname = "g_mime_signer_set_key_id")] public void set_key_id (string key_id); + [CCode (cname = "g_mime_signer_set_name")] public void set_name (string name); + [CCode (cname = "g_mime_signer_set_status")] public void set_status (GMime.SignerStatus status); + [CCode (cname = "g_mime_signer_set_trust")] public void set_trust (GMime.SignerTrust trust); } [CCode (cheader_filename = "gmime/gmime.h")] - public class Stream : GLib.Object { + public abstract class Stream : GLib.Object { public int64 bound_end; public int64 bound_start; public int64 position; public weak GMime.Stream super_stream; [CCode (has_construct_function = false)] protected Stream (); + [CCode (cname = "g_mime_stream_close")] public virtual int close (); + [CCode (cname = "g_mime_stream_construct")] public void @construct (int64 start, int64 end); + [CCode (cname = "g_mime_stream_eos")] public virtual bool eos (); + [CCode (cname = "g_mime_stream_flush")] public virtual int flush (); + [CCode (cname = "g_mime_stream_length")] public virtual ssize_t length (); + [CCode (cname = "g_mime_stream_printf")] public ssize_t printf (string fmt); + [CCode (cname = "g_mime_stream_read")] public virtual ssize_t read (string buf, size_t len); + [CCode (cname = "g_mime_stream_reset")] public virtual int reset (); + [CCode (cname = "g_mime_stream_seek")] public virtual int64 seek (int64 offset, GMime.SeekWhence whence); + [CCode (cname = "g_mime_stream_set_bounds")] public void set_bounds (int64 start, int64 end); + [CCode (cname = "g_mime_stream_substream")] public virtual unowned GMime.Stream substream (int64 start, int64 end); + [CCode (cname = "g_mime_stream_tell")] public virtual int64 tell (); + [CCode (cname = "g_mime_stream_write")] public virtual ssize_t write (string buf, size_t len); + [CCode (cname = "g_mime_stream_write_string")] public ssize_t write_string (string str); + [CCode (cname = "g_mime_stream_write_to_stream")] public ssize_t write_to_stream (GMime.Stream dest); + [CCode (cname = "g_mime_stream_writev")] public ssize_t writev (GMime.StreamIOVector vector, size_t count); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -612,36 +869,43 @@ namespace GMime { public weak string bufptr; public GMime.StreamBufferMode mode; public weak GMime.Stream source; - [CCode (type = "GMimeStream*", has_construct_function = false)] + [CCode (cname = "g_mime_stream_buffer_new", type = "GMimeStream*", has_construct_function = false)] public StreamBuffer (GMime.Stream source, GMime.StreamBufferMode mode); + [CCode (cname = "g_mime_stream_buffer_gets")] public static ssize_t gets (GMime.Stream stream, string buf, size_t max); + [CCode (cname = "g_mime_stream_buffer_readln")] public static void readln (GMime.Stream stream, GLib.ByteArray buffer); } [CCode (cheader_filename = "gmime/gmime.h")] public class StreamCat : GMime.Stream { public void* current; public void* sources; - [CCode (type = "GMimeStream*", has_construct_function = false)] + [CCode (cname = "g_mime_stream_cat_new", type = "GMimeStream*", has_construct_function = false)] public StreamCat (); + [CCode (cname = "g_mime_stream_cat_add_source")] public int add_source (GMime.Stream source); } [CCode (cheader_filename = "gmime/gmime.h")] public class StreamFile : GMime.Stream { public weak GLib.FileStream fp; public bool owner; - [CCode (type = "GMimeStream*", has_construct_function = false)] + [CCode (cname = "g_mime_stream_file_new", type = "GMimeStream*", has_construct_function = false)] public StreamFile (GLib.FileStream fp); + [CCode (cname = "g_mime_stream_file_get_owner")] public bool get_owner (); + [CCode (cname = "g_mime_stream_file_set_owner")] public void set_owner (bool owner); - [CCode (type = "GMimeStream*", has_construct_function = false)] + [CCode (cname = "g_mime_stream_file_new_with_bounds", type = "GMimeStream*", has_construct_function = false)] public StreamFile.with_bounds (GLib.FileStream fp, int64 start, int64 end); } [CCode (cheader_filename = "gmime/gmime.h")] public class StreamFilter : GMime.Stream { public weak GMime.Stream source; - [CCode (type = "GMimeStream*", has_construct_function = false)] + [CCode (cname = "g_mime_stream_filter_new", type = "GMimeStream*", has_construct_function = false)] public StreamFilter (GMime.Stream stream); + [CCode (cname = "g_mime_stream_filter_add")] public int add (GMime.Filter filter); + [CCode (cname = "g_mime_stream_filter_remove")] public void remove (int id); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -649,11 +913,13 @@ namespace GMime { public bool eos; public int fd; public bool owner; - [CCode (type = "GMimeStream*", has_construct_function = false)] + [CCode (cname = "g_mime_stream_fs_new", type = "GMimeStream*", has_construct_function = false)] public StreamFs (int fd); + [CCode (cname = "g_mime_stream_fs_get_owner")] public bool get_owner (); + [CCode (cname = "g_mime_stream_fs_set_owner")] public void set_owner (bool owner); - [CCode (type = "GMimeStream*", has_construct_function = false)] + [CCode (cname = "g_mime_stream_fs_new_with_bounds", type = "GMimeStream*", has_construct_function = false)] public StreamFs.with_bounds (int fd, int64 start, int64 end); } [Compact] @@ -666,15 +932,19 @@ namespace GMime { public class StreamMem : GMime.Stream { public weak GLib.ByteArray buffer; public bool owner; - [CCode (type = "GMimeStream*", has_construct_function = false)] + [CCode (cname = "g_mime_stream_mem_new", type = "GMimeStream*", has_construct_function = false)] public StreamMem (); + [CCode (cname = "g_mime_stream_mem_get_byte_array")] public unowned GLib.ByteArray get_byte_array (); + [CCode (cname = "g_mime_stream_mem_get_owner")] public bool get_owner (); + [CCode (cname = "g_mime_stream_mem_set_byte_array")] public void set_byte_array (GLib.ByteArray array); + [CCode (cname = "g_mime_stream_mem_set_owner")] public void set_owner (bool owner); - [CCode (type = "GMimeStream*", has_construct_function = false)] - public StreamMem.with_buffer (string buffer, size_t len); - [CCode (type = "GMimeStream*", has_construct_function = false)] + [CCode (cname = "g_mime_stream_mem_new_with_buffer", type = "GMimeStream*", has_construct_function = false)] + public StreamMem.with_buffer ([CCode (array_length_pos = 1)] uint8[] buffer); + [CCode (cname = "g_mime_stream_mem_new_with_byte_array", type = "GMimeStream*", has_construct_function = false)] public StreamMem.with_byte_array (GLib.ByteArray array); } [CCode (cheader_filename = "gmime/gmime.h")] @@ -684,16 +954,16 @@ namespace GMime { public weak string map; public size_t maplen; public bool owner; - [CCode (type = "GMimeStream*", has_construct_function = false)] + [CCode (cname = "g_mime_stream_mmap_new", type = "GMimeStream*", has_construct_function = false)] public StreamMmap (int fd, int prot, int flags); - [CCode (type = "GMimeStream*", has_construct_function = false)] + [CCode (cname = "g_mime_stream_mmap_new_with_bounds", type = "GMimeStream*", has_construct_function = false)] public StreamMmap.with_bounds (int fd, int prot, int flags, int64 start, int64 end); } [CCode (cheader_filename = "gmime/gmime.h")] public class StreamNull : GMime.Stream { public size_t newlines; public size_t written; - [CCode (type = "GMimeStream*", has_construct_function = false)] + [CCode (cname = "g_mime_stream_null_new", type = "GMimeStream*", has_construct_function = false)] public StreamNull (); } [CCode (cprefix = "GMIME_BEST_ENCODING_", has_type_id = false, cheader_filename = "gmime/gmime.h")] @@ -806,140 +1076,140 @@ namespace GMime { [CCode (cheader_filename = "gmime/gmime.h", has_target = false)] public delegate unowned string SimpleRequestPasswdFunc (GMime.Session session, string prompt, bool secret, string item, GLib.Error err); [CCode (cheader_filename = "gmime/gmime.h")] - public const string GMIME_DISPOSITION_ATTACHMENT; + public const string DISPOSITION_ATTACHMENT; [CCode (cheader_filename = "gmime/gmime.h")] - public const string GMIME_DISPOSITION_INLINE; + public const string DISPOSITION_INLINE; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_ENABLE_RFC2047_WORKAROUNDS; + public const int ENABLE_RFC2047_WORKAROUNDS; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_FILTER_ENRICHED_IS_RICHTEXT; + public const int FILTER_ENRICHED_IS_RICHTEXT; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_FILTER_HTML_CITE; + public const int FILTER_HTML_CITE; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_FILTER_HTML_CONVERT_ADDRESSES; + public const int FILTER_HTML_CONVERT_ADDRESSES; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_FILTER_HTML_CONVERT_NL; + public const int FILTER_HTML_CONVERT_NL; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_FILTER_HTML_CONVERT_SPACES; + public const int FILTER_HTML_CONVERT_SPACES; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_FILTER_HTML_CONVERT_URLS; + public const int FILTER_HTML_CONVERT_URLS; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_FILTER_HTML_ESCAPE_8BIT; + public const int FILTER_HTML_ESCAPE_8BIT; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_FILTER_HTML_MARK_CITATION; + public const int FILTER_HTML_MARK_CITATION; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_FILTER_HTML_PRE; + public const int FILTER_HTML_PRE; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_UUDECODE_STATE_BEGIN; + public const int UUDECODE_STATE_BEGIN; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_UUDECODE_STATE_END; + public const int UUDECODE_STATE_END; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_UUDECODE_STATE_INIT; + public const int UUDECODE_STATE_INIT; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_UUDECODE_STATE_MASK; + public const int UUDECODE_STATE_MASK; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_YDECODE_STATE_BEGIN; + public const int YDECODE_STATE_BEGIN; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_YDECODE_STATE_DECODE; + public const int YDECODE_STATE_DECODE; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_YDECODE_STATE_END; + public const int YDECODE_STATE_END; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_YDECODE_STATE_EOLN; + public const int YDECODE_STATE_EOLN; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_YDECODE_STATE_ESCAPE; + public const int YDECODE_STATE_ESCAPE; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_YDECODE_STATE_INIT; + public const int YDECODE_STATE_INIT; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_YDECODE_STATE_PART; + public const int YDECODE_STATE_PART; [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_YENCODE_CRC_INIT; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int GMIME_YENCODE_STATE_INIT; + public const int YENCODE_CRC_INIT; [CCode (cheader_filename = "gmime/gmime.h")] + public const int YENCODE_STATE_INIT; + [CCode (cname = "g_mime_check_version", cheader_filename = "gmime/gmime.h")] public static bool check_version (uint major, uint minor, uint micro); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_content_encoding_from_string", cheader_filename = "gmime/gmime.h")] public static GMime.ContentEncoding content_encoding_from_string (string str); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_content_encoding_to_string", cheader_filename = "gmime/gmime.h")] public static unowned string content_encoding_to_string (GMime.ContentEncoding encoding); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_decode_domain", cheader_filename = "gmime/gmime.h")] public static bool decode_domain (out unowned string @in, GLib.StringBuilder domain); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_decode_lwsp", cheader_filename = "gmime/gmime.h")] public static void decode_lwsp (out unowned string @in); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_decode_word", cheader_filename = "gmime/gmime.h")] public static unowned string decode_word (out unowned string @in); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_iconv_close", cheader_filename = "gmime/gmime.h")] public static int iconv_close (void* cd); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_iconv_init", cheader_filename = "gmime/gmime.h")] public static void iconv_init (); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_iconv_locale_to_utf8", cheader_filename = "gmime/gmime.h")] public static unowned string iconv_locale_to_utf8 (string str); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_iconv_locale_to_utf8_length", cheader_filename = "gmime/gmime.h")] public static unowned string iconv_locale_to_utf8_length (string str, size_t n); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_iconv_open", cheader_filename = "gmime/gmime.h")] public static void* iconv_open (string to, string from); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_iconv_shutdown", cheader_filename = "gmime/gmime.h")] public static void iconv_shutdown (); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_iconv_strdup", cheader_filename = "gmime/gmime.h")] public static unowned string iconv_strdup (void* cd, string str); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_iconv_strndup", cheader_filename = "gmime/gmime.h")] public static unowned string iconv_strndup (void* cd, string str, size_t n); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_iconv_utf8_to_locale", cheader_filename = "gmime/gmime.h")] public static unowned string iconv_utf8_to_locale (string str); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_iconv_utf8_to_locale_length", cheader_filename = "gmime/gmime.h")] public static unowned string iconv_utf8_to_locale_length (string str, size_t n); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_init", cheader_filename = "gmime/gmime.h")] public static void init (uint32 flags); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_locale_charset", cheader_filename = "gmime/gmime.h")] public static unowned string locale_charset (); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_locale_language", cheader_filename = "gmime/gmime.h")] public static unowned string locale_language (); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_parse_content_type", cheader_filename = "gmime/gmime.h")] public static bool parse_content_type (out unowned string @in, out unowned string type, out unowned string subtype); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_set_user_charsets", cheader_filename = "gmime/gmime.h")] public static void set_user_charsets (out unowned string charsets); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_shutdown", cheader_filename = "gmime/gmime.h")] public static void shutdown (); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_user_charsets", cheader_filename = "gmime/gmime.h")] public static unowned string user_charsets (); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_best_encoding", cheader_filename = "gmime/gmime.h")] public static GMime.ContentEncoding utils_best_encoding (uint text, size_t len); - [CCode (cheader_filename = "gmime/gmime.h")] - public static unowned string utils_decode_8bit (string text, size_t len); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_decode_8bit", cheader_filename = "gmime/gmime.h")] + public static string utils_decode_8bit (string text, size_t len); + [CCode (cname = "g_mime_utils_decode_message_id", cheader_filename = "gmime/gmime.h")] public static unowned string utils_decode_message_id (string message_id); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_generate_message_id", cheader_filename = "gmime/gmime.h")] public static unowned string utils_generate_message_id (string fqdn); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_header_decode_date", cheader_filename = "gmime/gmime.h")] public static time_t utils_header_decode_date (string str, out unowned int? tz_offset); - [CCode (cheader_filename = "gmime/gmime.h")] - public static unowned string utils_header_decode_phrase (string phrase); - [CCode (cheader_filename = "gmime/gmime.h")] - public static unowned string utils_header_decode_text (string text); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_header_decode_phrase", cheader_filename = "gmime/gmime.h")] + public static string utils_header_decode_phrase (string phrase); + [CCode (cname = "g_mime_utils_header_decode_text", cheader_filename = "gmime/gmime.h")] + public static string utils_header_decode_text (string text); + [CCode (cname = "g_mime_utils_header_encode_phrase", cheader_filename = "gmime/gmime.h")] public static unowned string utils_header_encode_phrase (string phrase); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_header_encode_text", cheader_filename = "gmime/gmime.h")] public static unowned string utils_header_encode_text (string text); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_header_fold", cheader_filename = "gmime/gmime.h")] public static unowned string utils_header_fold (string str); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_header_format_date", cheader_filename = "gmime/gmime.h")] public static unowned string utils_header_format_date (ulong date, int tz_offset); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_header_printf", cheader_filename = "gmime/gmime.h")] public static unowned string utils_header_printf (string format); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_quote_string", cheader_filename = "gmime/gmime.h")] public static unowned string utils_quote_string (string str); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_structured_header_fold", cheader_filename = "gmime/gmime.h")] public static unowned string utils_structured_header_fold (string str); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_text_is_8bit", cheader_filename = "gmime/gmime.h")] public static bool utils_text_is_8bit (uint text, size_t len); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_unquote_string", cheader_filename = "gmime/gmime.h")] public static void utils_unquote_string (string str); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_utils_unstructured_header_fold", cheader_filename = "gmime/gmime.h")] public static unowned string utils_unstructured_header_fold (string str); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_ydecode_step", cheader_filename = "gmime/gmime.h")] public static size_t ydecode_step (uint inbuf, size_t inlen, uint outbuf, int state, uint32 pcrc, uint32 crc); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_yencode_close", cheader_filename = "gmime/gmime.h")] public static size_t yencode_close (uint inbuf, size_t inlen, uint outbuf, int state, uint32 pcrc, uint32 crc); - [CCode (cheader_filename = "gmime/gmime.h")] + [CCode (cname = "g_mime_yencode_step", cheader_filename = "gmime/gmime.h")] public static size_t yencode_step (uint inbuf, size_t inlen, uint outbuf, int state, uint32 pcrc, uint32 crc); } [CCode (type_check_function = "IS_INTERNET_ADDRESS", type_id = "INTERNET_ADDRESS", cheader_filename = "gmime/gmime.h")] diff --git a/vapi/gmime-2.4/gmime-2.4.metadata b/vapi/gmime-2.4/gmime-2.4.metadata index 2ae264c3..474d6a74 100644 --- a/vapi/gmime-2.4/gmime-2.4.metadata +++ b/vapi/gmime-2.4/gmime-2.4.metadata @@ -1,12 +1,24 @@ -GMime cheader_filename="gmime/gmime.h" lower_case_cprefix="g_mime_" +GMime lower_case_cprefix="gmime_" cheader_filename="gmime/gmime.h" +GMimeObject abstract="1" +GMimeStream abstract="1" + +g_mime_header_list_get_iter.iter is_out="1" g_mime_message_get_date.date is_out="1" g_mime_message_get_date.tz_offset is_out="1" +g_mime_message_get_mime_part is_nullable="1" +g_mime_object_to_string transfer_ownership="1" g_mime_param_next name="get_next" +g_mime_parser_construct_message nullable="1" +g_mime_part_get_content_part nullable="1" g_mime_signer_next name="get_next" - +g_mime_stream_mem_new_with_buffer.buffer is_array="1" array_length_pos="1.0" type_name="uint8[]" +g_mime_stream_mem_new_with_buffer.len hidden="1" +g_mime_utils_decode_8bit transfer_ownership="1" g_mime_utils_header_decode_date type_name="time_t" g_mime_utils_header_decode_date.tz_offset is_out="1" nullable="1" +g_mime_utils_header_decode_phrase transfer_ownership="1" +g_mime_utils_header_decode_text transfer_ownership="1" InternetAddress hidden="1" internet_address_* hidden="1"