diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eeb513cf..d15f671c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,7 +27,7 @@ variables: # Fedora packages FEDORA_DEPS: meson vala desktop-file-utils enchant2-devel folks-devel gcr-devel - glib2-devel gmime-devel gnome-online-accounts-devel gspell-devel + glib2-devel gmime30-devel gnome-online-accounts-devel gspell-devel gtk3-devel iso-codes-devel json-glib-devel itstool libappstream-glib-devel libgee-devel libhandy-devel libpeas-devel libsecret-devel libunwind-devel libxml2-devel libytnef-devel @@ -38,7 +38,7 @@ variables: UBUNTU_DEPS: meson build-essential valac desktop-file-utils gettext iso-codes itstool libappstream-glib-dev libenchant-dev libfolks-dev - libgcr-3-dev libgee-0.8-dev libglib2.0-dev libgmime-2.6-dev + libgcr-3-dev libgee-0.8-dev libglib2.0-dev libgmime-3.0-dev libgoa-1.0-dev libgspell-1-dev libgtk-3-dev libhandy-0.0-dev libjson-glib-dev libmessaging-menu-dev libpeas-dev libsecret-1-dev libsqlite3-dev libunwind-dev libwebkit2gtk-4.0-dev libxml2-dev diff --git a/INSTALL b/INSTALL index 1ca42891..3bb721fb 100644 --- a/INSTALL +++ b/INSTALL @@ -40,7 +40,7 @@ Installing dependencies on Fedora Install them by running this command: sudo dnf install meson vala desktop-file-utils enchant2-devel \ - folks-devel gcr-devel glib2-devel gmime-devel \ + folks-devel gcr-devel glib2-devel gmime30-devel \ gnome-online-accounts-devel gspell-devel gtk3-devel \ iso-codes-devel json-glib-devel libappstream-glib-devel \ libgee-devel libhandy-devel libpeas-devel libsecret-devel \ @@ -55,7 +55,7 @@ Install them by running this command: sudo apt-get install meson build-essential valac \ desktop-file-utils iso-codes gettext itstool \ libappstream-glib-dev libenchant-dev libfolks-dev libgcr-3-dev \ - libgee-0.8-dev libglib2.0-dev libgmime-2.6-dev libgoa-1.0-dev \ + libgee-0.8-dev libglib2.0-dev libgmime3.0-dev libgoa-1.0-dev \ libgspell-1-dev libgtk-3-dev libjson-glib-dev libhandy-0.0-dev \ libpeas-dev libsecret-1-dev libsqlite3-dev libunwind-dev \ libwebkit2gtk-4.0-dev libxml2-dev libytnef0-dev diff --git a/bindings/vapi/Makefile b/bindings/vapi/Makefile deleted file mode 100644 index c7b6687e..00000000 --- a/bindings/vapi/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# NOTE: The dependencies in this file require vapigen and vala-gen-introspect to be installed, -# which are not default in a standard Vala installation. - -GMIME_FILES := \ - gmime-2.6/gmime-2.6.defines \ - gmime-2.6/gmime-2.6.files \ - gmime-2.6/gmime-2.6.metadata \ - gmime-2.6/gmime-2.6.namespace \ - gmime-2.6/gmime-2.6-custom.vala - -all: gmime-2.6.vapi - -.PHONY: clean -clean: - rm gmime-2.6.vapi gmime-2.6/gmime-2.6.gi - -gmime-2.6/gmime-2.6.gi: $(GMIME_FILES) - vala-gen-introspect gmime-2.6 gmime-2.6 - -gmime-2.6.vapi: gmime-2.6/gmime-2.6.gi - vapigen --pkg=glib-2.0 --pkg=gio-2.0 --library gmime-2.6 gmime-2.6/gmime-2.6.gi gmime-2.6/gmime-2.6-custom.vala - diff --git a/bindings/vapi/gmime-2.6.vapi b/bindings/vapi/gmime-2.6.vapi deleted file mode 100644 index 7665a784..00000000 --- a/bindings/vapi/gmime-2.6.vapi +++ /dev/null @@ -1,1452 +0,0 @@ -/* gmime-2.6.vapi generated by vapigen, do not modify. */ - -[CCode (lower_case_cprefix = "gmime_")] -namespace GMime { - [CCode (cheader_filename = "gmime/gmime.h")] - public class Certificate : GLib.Object { - public ulong created; - public GMime.DigestAlgo digest_algo; - public weak string email; - public ulong expires; - public weak string fingerprint; - public weak string issuer_name; - public weak string issuer_serial; - public weak string keyid; - public weak string name; - public GMime.PubKeyAlgo pubkey_algo; - public GMime.CertificateTrust trust; - [CCode (cname = "g_mime_certificate_new", has_construct_function = false)] - public Certificate (); - [CCode (cname = "g_mime_certificate_get_created")] - public ulong get_created (); - [CCode (cname = "g_mime_certificate_get_digest_algo")] - public GMime.DigestAlgo get_digest_algo (); - [CCode (cname = "g_mime_certificate_get_email")] - public unowned string get_email (); - [CCode (cname = "g_mime_certificate_get_expires")] - public ulong get_expires (); - [CCode (cname = "g_mime_certificate_get_fingerprint")] - public unowned string get_fingerprint (); - [CCode (cname = "g_mime_certificate_get_issuer_name")] - public unowned string get_issuer_name (); - [CCode (cname = "g_mime_certificate_get_issuer_serial")] - public unowned string get_issuer_serial (); - [CCode (cname = "g_mime_certificate_get_key_id")] - public unowned string get_key_id (); - [CCode (cname = "g_mime_certificate_get_name")] - public unowned string get_name (); - [CCode (cname = "g_mime_certificate_get_pubkey_algo")] - public GMime.PubKeyAlgo get_pubkey_algo (); - [CCode (cname = "g_mime_certificate_get_trust")] - public GMime.CertificateTrust get_trust (); - [CCode (cname = "g_mime_certificate_set_created")] - public void set_created (ulong created); - [CCode (cname = "g_mime_certificate_set_digest_algo")] - public void set_digest_algo (GMime.DigestAlgo algo); - [CCode (cname = "g_mime_certificate_set_email")] - public void set_email (string email); - [CCode (cname = "g_mime_certificate_set_expires")] - public void set_expires (ulong expires); - [CCode (cname = "g_mime_certificate_set_fingerprint")] - public void set_fingerprint (string fingerprint); - [CCode (cname = "g_mime_certificate_set_issuer_name")] - public void set_issuer_name (string issuer_name); - [CCode (cname = "g_mime_certificate_set_issuer_serial")] - public void set_issuer_serial (string issuer_serial); - [CCode (cname = "g_mime_certificate_set_key_id")] - public void set_key_id (string key_id); - [CCode (cname = "g_mime_certificate_set_name")] - public void set_name (string name); - [CCode (cname = "g_mime_certificate_set_pubkey_algo")] - public void set_pubkey_algo (GMime.PubKeyAlgo algo); - [CCode (cname = "g_mime_certificate_set_trust")] - public void set_trust (GMime.CertificateTrust trust); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class CertificateList : GLib.Object { - public weak GLib.PtrArray array; - [CCode (cname = "g_mime_certificate_list_new", has_construct_function = false)] - public CertificateList (); - [CCode (cname = "g_mime_certificate_list_add")] - public int add (GMime.Certificate cert); - [CCode (cname = "g_mime_certificate_list_clear")] - public void clear (); - [CCode (cname = "g_mime_certificate_list_contains")] - public bool contains (GMime.Certificate cert); - [CCode (cname = "g_mime_certificate_list_get_certificate")] - public unowned GMime.Certificate get_certificate (int index); - [CCode (cname = "g_mime_certificate_list_index_of")] - public int index_of (GMime.Certificate cert); - [CCode (cname = "g_mime_certificate_list_insert")] - public void insert (int index, GMime.Certificate cert); - [CCode (cname = "g_mime_certificate_list_length")] - public int length (); - [CCode (cname = "g_mime_certificate_list_remove")] - public bool remove (GMime.Certificate cert); - [CCode (cname = "g_mime_certificate_list_remove_at")] - public bool remove_at (int index); - [CCode (cname = "g_mime_certificate_list_set_certificate")] - public void set_certificate (int index, GMime.Certificate cert); - } - [CCode (cheader_filename = "gmime/gmime.h")] - [Compact] - 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")] - public class ContentDisposition : GLib.Object { - public weak string disposition; - public weak GLib.HashTable param_hash; - public weak GMime.Param @params; - [CCode (cname = "g_mime_content_disposition_new", has_construct_function = false)] - public ContentDisposition (); - [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); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class ContentType : GLib.Object { - public weak GLib.HashTable param_hash; - public weak GMime.Param @params; - public weak string subtype; - public weak string type; - [CCode (cname = "g_mime_content_type_new", has_construct_function = false)] - public ContentType (string type, string subtype); - [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 string to_string (); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class CryptoContext : GLib.Object { - public weak GMime.PasswordRequestFunc request_passwd; - [CCode (has_construct_function = false)] - protected CryptoContext (); - [CCode (cname = "g_mime_crypto_context_decrypt")] - public virtual unowned GMime.DecryptResult decrypt (GMime.Stream istream, GMime.Stream ostream) throws GLib.Error; - [CCode (cname = "g_mime_crypto_context_digest_id")] - public virtual GMime.DigestAlgo digest_id (string name); - [CCode (cname = "g_mime_crypto_context_digest_name")] - public virtual unowned string digest_name (GMime.DigestAlgo digest); - [CCode (cname = "g_mime_crypto_context_encrypt")] - public virtual int encrypt (bool sign, string userid, GMime.DigestAlgo digest, GLib.PtrArray recipients, GMime.Stream istream, GMime.Stream ostream) throws GLib.Error; - [CCode (cname = "g_mime_crypto_context_export_keys")] - public virtual int export_keys (GLib.PtrArray keys, GMime.Stream ostream) throws GLib.Error; - [CCode (cname = "g_mime_crypto_context_get_encryption_protocol")] - public virtual unowned string get_encryption_protocol (); - [CCode (cname = "g_mime_crypto_context_get_key_exchange_protocol")] - public virtual unowned string get_key_exchange_protocol (); - [CCode (cname = "g_mime_crypto_context_get_signature_protocol")] - public virtual unowned string get_signature_protocol (); - [CCode (cname = "g_mime_crypto_context_import_keys")] - public virtual int import_keys (GMime.Stream istream) throws GLib.Error; - [CCode (cname = "g_mime_crypto_context_set_request_password")] - public void set_request_password (GMime.PasswordRequestFunc request_passwd); - [CCode (cname = "g_mime_crypto_context_sign")] - public virtual int sign (string userid, GMime.DigestAlgo digest, GMime.Stream istream, GMime.Stream ostream) throws GLib.Error; - [CCode (cname = "g_mime_crypto_context_verify")] - public virtual unowned GMime.SignatureList verify (GMime.DigestAlgo digest, GMime.Stream istream, GMime.Stream sigstream) throws GLib.Error; - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class DataWrapper : GLib.Object { - public GMime.ContentEncoding encoding; - public weak GMime.Stream stream; - [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 (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); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class DecryptResult : GLib.Object { - public GMime.CipherAlgo cipher; - public GMime.DigestAlgo mdc; - public weak GMime.CertificateList recipients; - public weak GMime.SignatureList signatures; - [CCode (cname = "g_mime_decrypt_result_new", has_construct_function = false)] - public DecryptResult (); - [CCode (cname = "g_mime_decrypt_result_get_cipher")] - public GMime.CipherAlgo get_cipher (); - [CCode (cname = "g_mime_decrypt_result_get_mdc")] - public GMime.DigestAlgo get_mdc (); - [CCode (cname = "g_mime_decrypt_result_get_recipients")] - public unowned GMime.CertificateList get_recipients (); - [CCode (cname = "g_mime_decrypt_result_get_signatures")] - public unowned GMime.SignatureList get_signatures (); - [CCode (cname = "g_mime_decrypt_result_set_cipher")] - public void set_cipher (GMime.CipherAlgo cipher); - [CCode (cname = "g_mime_decrypt_result_set_mdc")] - public void set_mdc (GMime.DigestAlgo mdc); - [CCode (cname = "g_mime_decrypt_result_set_recipients")] - public void set_recipients (GMime.CertificateList recipients); - [CCode (cname = "g_mime_decrypt_result_set_signatures")] - public void set_signatures (GMime.SignatureList signatures); - } - [CCode (cheader_filename = "gmime/gmime.h")] - [Compact] - public class Encoding { - public bool encode; - public GMime.ContentEncoding encoding; - public uint32 save; - 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")] - public class Filter : GLib.Object { - public char* backbuf; - public size_t backlen; - public size_t backsize; - [CCode (array_length_cname = "outsize", array_length_type = "size_t")] - public char[] outbuf; - public size_t outpre; - public char* outptr; - public char* outreal; - [CCode (has_construct_function = false)] - protected Filter (); - [CCode (cname = "g_mime_filter_backup")] - public void backup ([CCode (array_length_pos = 1.1, array_length_type = "size_t")] char[] data); - [CCode (cname = "g_mime_filter_complete")] - public virtual void complete ([CCode (array_length_pos = 1.1, array_length_type = "size_t")] char[] inbuf, size_t prespace, [CCode (array_length_pos = 3.1, array_length_type = "size_t")] out unowned char[] outbuf, out size_t outprespace); - [CCode (cname = "g_mime_filter_copy")] - public virtual GMime.Filter copy (); - [CCode (cname = "g_mime_filter_filter")] - public virtual void filter ([CCode (array_length_pos = 1.1, array_length_type = "size_t")] char[] inbuf, size_t prespace, [CCode (array_length_pos = 3.1, array_length_type = "size_t")] out unowned char[] outbuf, out 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 (cname = "g_mime_filter_basic_new", has_construct_function = false, type = "GMimeFilter*")] - public FilterBasic (GMime.ContentEncoding encoding, bool encode); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class FilterBest : GMime.Filter { - public uint count0; - public uint count8; - public GMime.FilterBestFlags flags; - [CCode (array_length = false)] - public weak uint[] frombuf; - public uint fromlen; - public uint hadfrom; - public uint linelen; - public uint maxline; - public uint midline; - public uint startline; - public uint total; - [CCode (cname = "g_mime_filter_best_new", has_construct_function = false, type = "GMimeFilter*")] - 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.EncodingConstraint constraint); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class FilterCRLF : GMime.Filter { - public bool dots; - public bool encode; - public bool saw_cr; - public bool saw_dot; - public bool saw_lf; - [CCode (cname = "g_mime_filter_crlf_new", has_construct_function = false, type = "GMimeFilter*")] - public FilterCRLF (bool encode, bool dots); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class FilterCharset : GMime.Filter { - public void* cd; - public weak string from_charset; - public weak string to_charset; - [CCode (cname = "g_mime_filter_charset_new", has_construct_function = false, type = "GMimeFilter*")] - 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 (cname = "g_mime_filter_enriched_new", has_construct_function = false, type = "GMimeFilter*")] - public FilterEnriched (uint32 flags); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class FilterFrom : GMime.Filter { - public bool midline; - public GMime.FilterFromMode mode; - [CCode (cname = "g_mime_filter_from_new", has_construct_function = false, type = "GMimeFilter*")] - public FilterFrom (GMime.FilterFromMode mode); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class FilterGZip : GMime.Filter { - public int level; - public GMime.FilterGZipMode mode; - [CCode (cname = "g_mime_filter_gzip_new", has_construct_function = false, type = "GMimeFilter*")] - public FilterGZip (GMime.FilterGZipMode mode, int level); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class FilterHTML : GMime.Filter { - public uint32 colour; - public uint32 column; - public uint32 flags; - public uint32 pre_open; - public void* scanner; - [CCode (cname = "g_mime_filter_html_new", has_construct_function = false, type = "GMimeFilter*")] - public FilterHTML (uint32 flags, uint32 colour); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class FilterMd5 : GMime.Filter { - [CCode (cname = "g_mime_filter_md5_new", has_construct_function = false, type = "GMimeFilter*")] - 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 (cname = "g_mime_filter_strip_new", has_construct_function = false, type = "GMimeFilter*")] - public FilterStrip (); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class FilterWindows : GMime.Filter { - public weak string claimed_charset; - public bool is_windows; - [CCode (cname = "g_mime_filter_windows_new", has_construct_function = false, type = "GMimeFilter*")] - 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")] - public class FilterYenc : GMime.Filter { - public uint32 crc; - public bool encode; - public int part; - public uint32 pcrc; - public int state; - [CCode (cname = "g_mime_filter_yenc_new", has_construct_function = false, type = "GMimeFilter*")] - 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.CryptoContext { - public bool always_trust; - public bool auto_key_retrieve; - public weak string path; - public bool use_agent; - [CCode (cname = "g_mime_gpg_context_new", has_construct_function = false, type = "GMimeCryptoContext*")] - public GpgContext (GMime.PasswordRequestFunc request_passwd, string path); - [CCode (cname = "g_mime_gpg_context_get_always_trust")] - public bool get_always_trust (); - [CCode (cname = "g_mime_gpg_context_get_auto_key_retrieve")] - public bool get_auto_key_retrieve (); - [CCode (cname = "g_mime_gpg_context_get_use_agent")] - public bool get_use_agent (); - [CCode (cname = "g_mime_gpg_context_set_always_trust")] - public void set_always_trust (bool always_trust); - [CCode (cname = "g_mime_gpg_context_set_auto_key_retrieve")] - public void set_auto_key_retrieve (bool auto_key_retrieve); - [CCode (cname = "g_mime_gpg_context_set_use_agent")] - public void set_use_agent (bool use_agent); - } - [CCode (cheader_filename = "gmime/gmime.h")] - [Compact] - public class Header { - } - [CCode (cheader_filename = "gmime/gmime.h", copy_function = "g_mime_header_iter_copy", free_function = "g_mime_header_iter_free")] - [Compact] - public class HeaderIter { - public weak GMime.Header cursor; - public weak GMime.HeaderList hdrlist; - public uint32 version; - [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); - } - [CCode (cheader_filename = "gmime/gmime.h", free_function = "g_mime_header_list_destroy")] - [Compact] - public class HeaderList { - [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_clear")] - public void clear (); - [CCode (cname = "g_mime_header_list_contains")] - public bool contains (string name); - [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); - [CCode (cname = "g_mime_header_list_get_iter")] - public bool get_iter (GMime.HeaderIter iter); - [CCode (cname = "g_mime_header_list_get_stream")] - public unowned GMime.Stream get_stream (); - [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_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")] - public class Message : GMime.Object { - public ulong date; - public weak string from; - public weak string message_id; - public weak GMime.Object mime_part; - public weak InternetAddressList recipients; - public weak string reply_to; - public weak string subject; - public int tz_offset; - [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_body")] - public unowned GMime.Object get_body (); - [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 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 (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 (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")] - public class MessagePartial : GMime.Part { - public weak string id; - public int number; - public int total; - [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")] - public class Multipart : GMime.Object { - public weak string boundary; - public weak GLib.PtrArray children; - public weak string postface; - public weak string preface; - [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 GMime.Object remove_at (int index); - [CCode (cname = "g_mime_multipart_replace")] - public GMime.Object replace (int index, GMime.Object replacement); - [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 (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 { - [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.CryptoContext ctx, out unowned GMime.DecryptResult _result) throws GLib.Error; - [CCode (cname = "g_mime_multipart_encrypted_encrypt")] - public int encrypt (GMime.Object content, GMime.CryptoContext ctx, bool sign, string userid, GMime.DigestAlgo digest, GLib.PtrArray recipients) throws GLib.Error; - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class MultipartSigned : GMime.Multipart { - [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.CryptoContext ctx, string userid, GMime.DigestAlgo digest) throws GLib.Error; - [CCode (cname = "g_mime_multipart_signed_verify")] - public unowned GMime.SignatureList verify (GMime.CryptoContext ctx) throws GLib.Error; - } - [CCode (cheader_filename = "gmime/gmime.h")] - 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 (cname = "g_mime_object_new", has_construct_function = false)] - protected 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_encode")] - public virtual void encode (GMime.EncodingConstraint constraint); - [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 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); - [CCode (cname = "g_mime_object_to_string")] - public string to_string (); - [CCode (cname = "g_mime_object_new_type", has_construct_function = false)] - protected 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); - } - [CCode (cheader_filename = "gmime/gmime.h", free_function = "g_mime_param_destroy")] - [Compact] - public class Param { - public weak string name; - public weak GMime.Param next; - public weak string value; - [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 (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 (cname = "g_mime_parser_new", has_construct_function = false)] - public Parser (); - [CCode (cname = "g_mime_parser_construct_message")] - public GMime.Message? construct_message (); - [CCode (cname = "g_mime_parser_construct_part")] - public 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 (cname = "g_mime_parser_new_with_stream", has_construct_function = false)] - public Parser.with_stream (GMime.Stream stream); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class Part : GMime.Object { - public weak GMime.DataWrapper content; - public weak string content_description; - public weak string content_location; - public weak string content_md5; - public GMime.ContentEncoding encoding; - [CCode (cname = "g_mime_part_new", has_construct_function = false)] - public Part (); - [CCode (cname = "g_mime_part_get_best_content_encoding")] - public GMime.ContentEncoding get_best_content_encoding (GMime.EncodingConstraint constraint); - [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 (cname = "g_mime_part_new_with_type", has_construct_function = false)] - public Part.with_type (string type, string subtype); - } - [CCode (cheader_filename = "gmime/gmime.h", free_function = "g_mime_part_iter_free")] - [Compact] - public class PartIter { - [CCode (cname = "g_mime_part_iter_new", has_construct_function = false)] - public PartIter (GMime.Object toplevel); - [CCode (cname = "g_mime_part_iter_get_current")] - public unowned GMime.Object get_current (); - [CCode (cname = "g_mime_part_iter_get_parent")] - public unowned GMime.Object get_parent (); - [CCode (cname = "g_mime_part_iter_get_path")] - public unowned string get_path (); - [CCode (cname = "g_mime_part_iter_get_toplevel")] - public unowned GMime.Object get_toplevel (); - [CCode (cname = "g_mime_part_iter_is_valid")] - public bool is_valid (); - [CCode (cname = "g_mime_part_iter_jump_to")] - public bool jump_to (string path); - [CCode (cname = "g_mime_part_iter_next")] - public bool next (); - [CCode (cname = "g_mime_part_iter_prev")] - public bool prev (); - [CCode (cname = "g_mime_part_iter_remove")] - public bool remove (); - [CCode (cname = "g_mime_part_iter_replace")] - public bool replace (GMime.Object replacement); - [CCode (cname = "g_mime_part_iter_reset")] - public void reset (); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class Pkcs7Context : GMime.CryptoContext { - [CCode (cname = "g_mime_pkcs7_context_new", has_construct_function = false, type = "GMimeCryptoContext*")] - public Pkcs7Context (GMime.PasswordRequestFunc request_passwd); - [CCode (cname = "g_mime_pkcs7_context_get_always_trust")] - public bool get_always_trust (); - [CCode (cname = "g_mime_pkcs7_context_set_always_trust")] - public void set_always_trust (bool always_trust); - } - [CCode (cheader_filename = "gmime/gmime.h", free_function = "g_mime_references_free")] - [Compact] - 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 Signature : GLib.Object { - public weak GMime.Certificate cert; - public ulong created; - public GMime.SignatureError errors; - public ulong expires; - public GMime.SignatureStatus status; - [CCode (cname = "g_mime_signature_new", has_construct_function = false)] - public Signature (); - [CCode (cname = "g_mime_signature_get_certificate")] - public unowned GMime.Certificate get_certificate (); - [CCode (cname = "g_mime_signature_get_created")] - public ulong get_created (); - [CCode (cname = "g_mime_signature_get_errors")] - public GMime.SignatureError get_errors (); - [CCode (cname = "g_mime_signature_get_expires")] - public ulong get_expires (); - [CCode (cname = "g_mime_signature_get_status")] - public GMime.SignatureStatus get_status (); - [CCode (cname = "g_mime_signature_set_certificate")] - public void set_certificate (GMime.Certificate cert); - [CCode (cname = "g_mime_signature_set_created")] - public void set_created (ulong created); - [CCode (cname = "g_mime_signature_set_errors")] - public void set_errors (GMime.SignatureError errors); - [CCode (cname = "g_mime_signature_set_expires")] - public void set_expires (ulong expires); - [CCode (cname = "g_mime_signature_set_status")] - public void set_status (GMime.SignatureStatus status); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class SignatureList : GLib.Object { - public weak GLib.PtrArray array; - [CCode (cname = "g_mime_signature_list_new", has_construct_function = false)] - public SignatureList (); - [CCode (cname = "g_mime_signature_list_add")] - public int add (GMime.Signature sig); - [CCode (cname = "g_mime_signature_list_clear")] - public void clear (); - [CCode (cname = "g_mime_signature_list_contains")] - public bool contains (GMime.Signature sig); - [CCode (cname = "g_mime_signature_list_get_signature")] - public unowned GMime.Signature get_signature (int index); - [CCode (cname = "g_mime_signature_list_index_of")] - public int index_of (GMime.Signature sig); - [CCode (cname = "g_mime_signature_list_insert")] - public void insert (int index, GMime.Signature sig); - [CCode (cname = "g_mime_signature_list_length")] - public int length (); - [CCode (cname = "g_mime_signature_list_remove")] - public bool remove (GMime.Signature sig); - [CCode (cname = "g_mime_signature_list_remove_at")] - public bool remove_at (int index); - [CCode (cname = "g_mime_signature_list_set_signature")] - public void set_signature (int index, GMime.Signature sig); - } - [CCode (cheader_filename = "gmime/gmime.h")] - 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 int64 length (); - [CCode (cname = "g_mime_stream_printf")] - public ssize_t printf (string fmt); - [CCode (cname = "g_mime_stream_read")] - public virtual ssize_t read (uint8[] buf); - [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")] - public class StreamBuffer : GMime.Stream { - public weak string bufend; - public weak string buffer; - public size_t buflen; - public weak string bufptr; - public GMime.StreamBufferMode mode; - public weak GMime.Stream source; - [CCode (cname = "g_mime_stream_buffer_new", has_construct_function = false, type = "GMimeStream*")] - 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 (cname = "g_mime_stream_cat_new", has_construct_function = false, type = "GMimeStream*")] - 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 (cname = "g_mime_stream_file_new", has_construct_function = false, type = "GMimeStream*")] - public StreamFile (GLib.FileStream fp); - [CCode (cname = "g_mime_stream_file_new_for_path", has_construct_function = false, type = "GMimeStream*")] - public StreamFile.for_path (string path, string mode); - [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 (cname = "g_mime_stream_file_new_with_bounds", has_construct_function = false, type = "GMimeStream*")] - 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 (cname = "g_mime_stream_filter_new", has_construct_function = false, type = "GMimeStream*")] - 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")] - public class StreamFs : GMime.Stream { - public bool eos; - public int fd; - public bool owner; - [CCode (cname = "g_mime_stream_fs_new", has_construct_function = false, type = "GMimeStream*")] - public StreamFs (int fd); - [CCode (cname = "g_mime_stream_fs_new_for_path", has_construct_function = false, type = "GMimeStream*")] - public StreamFs.for_path (string path, int flags, int mode); - [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 (cname = "g_mime_stream_fs_new_with_bounds", has_construct_function = false, type = "GMimeStream*")] - public StreamFs.with_bounds (int fd, int64 start, int64 end); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class StreamGIO : GMime.Stream { - public bool eos; - public weak GLib.File file; - public weak GLib.InputStream istream; - public weak GLib.OutputStream ostream; - public bool owner; - [CCode (cname = "g_mime_stream_gio_new", has_construct_function = false, type = "GMimeStream*")] - public StreamGIO (GLib.File file); - [CCode (cname = "g_mime_stream_gio_get_owner")] - public bool get_owner (); - [CCode (cname = "g_mime_stream_gio_set_owner")] - public void set_owner (bool owner); - [CCode (cname = "g_mime_stream_gio_new_with_bounds", has_construct_function = false, type = "GMimeStream*")] - public StreamGIO.with_bounds (GLib.File file, int64 start, int64 end); - } - [CCode (cheader_filename = "gmime/gmime.h")] - [Compact] - public class StreamIOVector { - public void* data; - public size_t len; - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class StreamMem : GMime.Stream { - public weak GLib.ByteArray buffer; - public bool owner; - [CCode (cname = "g_mime_stream_mem_new", has_construct_function = false, type = "GMimeStream*")] - 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 (cname = "g_mime_stream_mem_new_with_buffer", has_construct_function = false, type = "GMimeStream*")] - public StreamMem.with_buffer ([CCode (array_length_pos = 1)] uint8[] buffer); - [CCode (cname = "g_mime_stream_mem_new_with_byte_array", has_construct_function = false, type = "GMimeStream*")] - public StreamMem.with_byte_array (GLib.ByteArray array); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class StreamMmap : GMime.Stream { - public bool eos; - public int fd; - public weak string map; - public size_t maplen; - public bool owner; - [CCode (cname = "g_mime_stream_mmap_new", has_construct_function = false, type = "GMimeStream*")] - public StreamMmap (int fd, int prot, int flags); - [CCode (cname = "g_mime_stream_mmap_new_with_bounds", has_construct_function = false, type = "GMimeStream*")] - 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 (cname = "g_mime_stream_null_new", has_construct_function = false, type = "GMimeStream*")] - public StreamNull (); - } - [CCode (cheader_filename = "gmime/gmime.h")] - public class StreamPipe : GMime.Stream { - public bool eos; - public int fd; - public bool owner; - [CCode (cname = "g_mime_stream_pipe_new", has_construct_function = false, type = "GMimeStream*")] - public StreamPipe (int fd); - [CCode (cname = "g_mime_stream_pipe_get_owner")] - public bool get_owner (); - [CCode (cname = "g_mime_stream_pipe_set_owner")] - public void set_owner (bool owner); - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_CERTIFICATE_TRUST_", has_type_id = false)] - public enum CertificateTrust { - NONE, - NEVER, - UNDEFINED, - MARGINAL, - FULLY, - ULTIMATE - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_CIPHER_ALGO_", has_type_id = false)] - public enum CipherAlgo { - DEFAULT, - IDEA, - @3DES, - CAST5, - BLOWFISH, - AES, - AES192, - AES256, - TWOFISH, - CAMELLIA128, - CAMELLIA192, - CAMELLIA256 - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_CONTENT_ENCODING_", has_type_id = false)] - public enum ContentEncoding { - DEFAULT, - @7BIT, - @8BIT, - BINARY, - BASE64, - QUOTEDPRINTABLE, - UUENCODE - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_DIGEST_ALGO_", has_type_id = false)] - public enum DigestAlgo { - DEFAULT, - MD5, - SHA1, - RIPEMD160, - MD2, - TIGER192, - HAVAL5160, - SHA256, - SHA384, - SHA512, - SHA224, - MD4 - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_ENCODING_CONSTRAINT_", has_type_id = false)] - public enum EncodingConstraint { - @7BIT, - @8BIT, - BINARY - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_FILTER_BEST_", has_type_id = false)] - public enum FilterBestFlags { - CHARSET, - ENCODING - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_FILTER_FROM_MODE_", has_type_id = false)] - public enum FilterFromMode { - DEFAULT, - ESCAPE, - ARMOR - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_FILTER_GZIP_MODE_", has_type_id = false)] - public enum FilterGZipMode { - ZIP, - UNZIP - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_PUBKEY_ALGO_", has_type_id = false)] - public enum PubKeyAlgo { - DEFAULT, - RSA, - RSA_E, - RSA_S, - ELG_E, - DSA, - ELG - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_RECIPIENT_TYPE_", has_type_id = false)] - public enum RecipientType { - TO, - CC, - BCC - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_STREAM_SEEK_", has_type_id = false)] - public enum SeekWhence { - SET, - CUR, - END - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_SIGNATURE_ERROR_", has_type_id = false)] - public enum SignatureError { - NONE, - EXPSIG, - NO_PUBKEY, - EXPKEYSIG, - REVKEYSIG, - UNSUPP_ALGO - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_SIGNATURE_STATUS_", has_type_id = false)] - public enum SignatureStatus { - GOOD, - ERROR, - BAD - } - [CCode (cheader_filename = "gmime/gmime.h", cprefix = "GMIME_STREAM_BUFFER_", has_type_id = false)] - public enum StreamBufferMode { - CACHE_READ, - BLOCK_READ, - BLOCK_WRITE - } - [CCode (cheader_filename = "gmime/gmime.h")] - public delegate void HeaderForeachFunc (string name, string value); - [CCode (cheader_filename = "gmime/gmime.h", has_target = false)] - public delegate ssize_t HeaderWriter (GMime.Stream stream, string name, string value); - [CCode (cheader_filename = "gmime/gmime.h")] - public delegate void ObjectForeachFunc (GMime.Object parent, GMime.Object part); - [CCode (cheader_filename = "gmime/gmime.h")] - public delegate void ParserHeaderRegexFunc (GMime.Parser parser, string header, string value, int64 offset); - [CCode (cheader_filename = "gmime/gmime.h", has_target = false)] - public delegate bool PasswordRequestFunc (GMime.CryptoContext ctx, string user_id, string prompt_ctx, bool reprompt, GMime.Stream response) throws GLib.Error; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int BINARY_AGE; - [CCode (cheader_filename = "gmime/gmime.h")] - public const string DISPOSITION_ATTACHMENT; - [CCode (cheader_filename = "gmime/gmime.h")] - public const string DISPOSITION_INLINE; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int ENABLE_RFC2047_WORKAROUNDS; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int ENABLE_USE_ONLY_USER_CHARSETS; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int FILTER_ENRICHED_IS_RICHTEXT; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int FILTER_HTML_CITE; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int FILTER_HTML_CONVERT_ADDRESSES; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int FILTER_HTML_CONVERT_NL; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int FILTER_HTML_CONVERT_SPACES; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int FILTER_HTML_CONVERT_URLS; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int FILTER_HTML_ESCAPE_8BIT; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int FILTER_HTML_MARK_CITATION; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int FILTER_HTML_PRE; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int INTERFACE_AGE; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int MAJOR_VERSION; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int MICRO_VERSION; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int MINOR_VERSION; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int UUDECODE_STATE_BEGIN; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int UUDECODE_STATE_END; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int UUDECODE_STATE_INIT; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int UUDECODE_STATE_MASK; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int YDECODE_STATE_BEGIN; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int YDECODE_STATE_DECODE; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int YDECODE_STATE_END; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int YDECODE_STATE_EOLN; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int YDECODE_STATE_ESCAPE; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int YDECODE_STATE_INIT; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int YDECODE_STATE_PART; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int YENCODE_CRC_INIT; - [CCode (cheader_filename = "gmime/gmime.h")] - public const int YENCODE_STATE_INIT; - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_check_version")] - public static bool check_version (uint major, uint minor, uint micro); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_content_encoding_from_string")] - public static GMime.ContentEncoding content_encoding_from_string (string str); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_content_encoding_to_string")] - public static unowned string content_encoding_to_string (GMime.ContentEncoding encoding); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_iconv_close")] - public static int iconv_close (void* cd); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_iconv_init")] - public static void iconv_init (); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_iconv_locale_to_utf8")] - public static unowned string iconv_locale_to_utf8 (string str); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_iconv_locale_to_utf8_length")] - public static unowned string iconv_locale_to_utf8_length (string str, size_t n); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_iconv_open")] - public static void* iconv_open (string to, string from); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_iconv_shutdown")] - public static void iconv_shutdown (); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_iconv_strdup")] - public static unowned string iconv_strdup (void* cd, string str); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_iconv_strndup")] - public static unowned string iconv_strndup (void* cd, string str, size_t n); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_iconv_utf8_to_locale")] - public static unowned string iconv_utf8_to_locale (string str); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_iconv_utf8_to_locale_length")] - public static unowned string iconv_utf8_to_locale_length (string str, size_t n); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_init")] - public static void init (uint32 flags); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_locale_charset")] - public static unowned string locale_charset (); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_locale_language")] - public static unowned string locale_language (); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_set_user_charsets")] - public static void set_user_charsets ([CCode (array_length = false)] string[] charsets); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_shutdown")] - public static void shutdown (); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_user_charsets")] - public static unowned string user_charsets (); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_best_encoding")] - public static GMime.ContentEncoding utils_best_encoding (uint text, size_t len); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_decode_8bit")] - public static string utils_decode_8bit (string text, size_t len); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_decode_message_id")] - public static string utils_decode_message_id (string message_id); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_generate_message_id")] - public static string utils_generate_message_id (string fqdn); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_header_decode_date")] - public static time_t utils_header_decode_date (string str, out int tz_offset); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_header_decode_phrase")] - public static string utils_header_decode_phrase (string phrase); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_header_decode_text")] - public static string utils_header_decode_text (string text); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_header_encode_phrase")] - public static string utils_header_encode_phrase (string phrase); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_header_encode_text")] - public static string utils_header_encode_text (string text); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_header_fold")] - public static string utils_header_fold (string header); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_header_format_date")] - public static string utils_header_format_date (ulong date, int tz_offset); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_header_printf")] - public static string utils_header_printf (string format); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_quote_string")] - public static string utils_quote_string (string str); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_structured_header_fold")] - public static string utils_structured_header_fold (string header); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_text_is_8bit")] - public static bool utils_text_is_8bit (string text, size_t len); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_unquote_string")] - public static void utils_unquote_string (string str); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_utils_unstructured_header_fold")] - public static string utils_unstructured_header_fold (string header); - [CCode (cheader_filename = "gmime/gmime.h", cname = "g_mime_ydecode_step")] - 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", cname = "g_mime_yencode_close")] - 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", cname = "g_mime_yencode_step")] - public static size_t yencode_step (uint inbuf, size_t inlen, uint outbuf, int state, uint32 pcrc, uint32 crc); -} -[CCode (cheader_filename = "gmime/gmime.h", cname = "InternetAddress", type_check_function = "IS_INTERNET_ADDRESS", type_id = "INTERNET_ADDRESS_TYPE")] -public class InternetAddress : GLib.Object { - [CCode (cname = "internet_address_get_name")] - public unowned string? get_name (); - [CCode (cname = "internet_address_set_name")] - public void set_name (string? name); - [CCode (cname = "internet_address_to_string")] - public virtual string to_string (bool encoded); -} -[CCode (cheader_filename = "gmime/gmime.h", cname = "InternetAddressGroup", type_check_function = "INTERNET_ADDRESS_IS_GROUP", type_id = "INTERNET_ADDRESS_TYPE_GROUP")] -public class InternetAddressGroup : InternetAddress { - [CCode (cname = "internet_address_group_new")] - public InternetAddressGroup (string name); - [CCode (cname = "internet_address_group_add_member")] - public int add_member (InternetAddress member); - [CCode (cname = "internet_address_group_get_members")] - public unowned InternetAddressList get_members (); - [CCode (cname = "internet_address_group_set_members")] - public void set_members (InternetAddressList members); -} -[CCode (cheader_filename = "gmime/gmime.h", cname = "InternetAddressMailbox", type_check_function = "INTERNET_ADDRESS_IS_MAILBOX", type_id = "INTERNET_ADDRESS_TYPE_MAILBOX")] -public class InternetAddressMailbox : InternetAddress { - [CCode (cname = "internet_address_mailbox_new")] - public InternetAddressMailbox (string? name, string addr); - [CCode (cname = "internet_address_mailbox_get_addr")] - public unowned string get_addr (); - [CCode (cname = "internet_address_mailbox_set_addr")] - public void set_addr (string addr); -} -[CCode (cheader_filename = "gmime/gmime.h", cname = "InternetAddressList", type_check_function = "IS_INTERNET_ADDRESS_LIST", type_id = "INTERNET_ADDRESS_LIST_TYPE")] -public class InternetAddressList : GLib.Object { - [CCode (cname = "internet_address_list_new")] - public InternetAddressList (); - [CCode (cname = "internet_address_list_add")] - public int add (InternetAddress addr); - [CCode (cname = "internet_address_list_append")] - public void append (InternetAddressList append); - [CCode (cname = "internet_address_list_clear")] - public void clear (); - [CCode (cname = "internet_address_list_contains")] - public bool contains (InternetAddress addr); - [CCode (cname = "internet_address_list_get_address")] - public unowned InternetAddress get_address (int index); - [CCode (cname = "internet_address_list_index_of")] - public int index_of (InternetAddress addr); - [CCode (cname = "internet_address_list_insert")] - public void insert (int index, InternetAddress addr); - [CCode (cname = "internet_address_list_length")] - public int length (); - [CCode (cname = "internet_address_list_parse_string")] - public static InternetAddressList? parse_string (string str); - [CCode (cname = "internet_address_list_prepend")] - public void prepend (InternetAddressList prepend); - [CCode (cname = "internet_address_list_remove")] - public bool remove (InternetAddress addr); - [CCode (cname = "internet_address_list_remove_at")] - public bool remove_at (int index); - [CCode (cname = "internet_address_list_set_address")] - public void set_address (int index, InternetAddress addr); - [CCode (cname = "internet_address_list_to_string")] - public string? to_string (bool encode); -} diff --git a/bindings/vapi/gmime-2.6/gmime-2.6-custom.vala b/bindings/vapi/gmime-2.6/gmime-2.6-custom.vala deleted file mode 100644 index 63aebaa9..00000000 --- a/bindings/vapi/gmime-2.6/gmime-2.6-custom.vala +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2016 Software Freedom Conservancy Inc. - * - * This software is licensed under the GNU Lesser General Public License - * (version 2.1 or later). See the COPYING file in this distribution. - */ - -[CCode (cname="InternetAddress", cheader_filename="gmime/gmime.h", type_id="INTERNET_ADDRESS_TYPE", type_check_function="IS_INTERNET_ADDRESS")] -public class InternetAddress : GLib.Object { - [CCode (cname="internet_address_get_name")] - public unowned string? get_name(); - [CCode (cname="internet_address_set_name")] - public void set_name(string? name); - [CCode (cname="internet_address_to_string")] - public virtual string to_string(bool encoded); -} - -[CCode (cname="InternetAddressGroup", cheader_filename="gmime/gmime.h", type_id="INTERNET_ADDRESS_TYPE_GROUP", type_check_function="INTERNET_ADDRESS_IS_GROUP")] -public class InternetAddressGroup : InternetAddress { - [CCode (cname="internet_address_group_new")] - public InternetAddressGroup(string name); - [CCode (cname="internet_address_group_get_members")] - public unowned InternetAddressList get_members(); - [CCode (cname="internet_address_group_set_members")] - public void set_members(InternetAddressList members); - [CCode (cname="internet_address_group_add_member")] - public int add_member(InternetAddress member); -} - -[CCode (cname="InternetAddressMailbox", cheader_filename="gmime/gmime.h", type_id="INTERNET_ADDRESS_TYPE_MAILBOX", type_check_function="INTERNET_ADDRESS_IS_MAILBOX")] -public class InternetAddressMailbox : InternetAddress { - [CCode (cname="internet_address_mailbox_new")] - public InternetAddressMailbox(string? name, string addr); - [CCode (cname="internet_address_mailbox_get_addr")] - public unowned string get_addr(); - [CCode (cname="internet_address_mailbox_set_addr")] - public void set_addr(string addr); -} - -[CCode (cname="InternetAddressList", cheader_filename="gmime/gmime.h", type_id="INTERNET_ADDRESS_LIST_TYPE", type_check_function="IS_INTERNET_ADDRESS_LIST")] -public class InternetAddressList : GLib.Object { - [CCode (cname="internet_address_list_new")] - public InternetAddressList(); - [CCode (cname="internet_address_list_length")] - public int length(); - [CCode (cname="internet_address_list_clear")] - public void clear(); - [CCode (cname="internet_address_list_add")] - public int add(InternetAddress addr); - [CCode (cname="internet_address_list_insert")] - public void insert(int index, InternetAddress addr); - [CCode (cname="internet_address_list_remove")] - public bool remove(InternetAddress addr); - [CCode (cname="internet_address_list_remove_at")] - public bool remove_at(int index); - [CCode (cname="internet_address_list_contains")] - public bool contains(InternetAddress addr); - [CCode (cname="internet_address_list_index_of")] - public int index_of(InternetAddress addr); - [CCode (cname="internet_address_list_get_address")] - public unowned InternetAddress get_address(int index); - [CCode (cname="internet_address_list_set_address")] - public void set_address(int index, InternetAddress addr); - [CCode (cname="internet_address_list_prepend")] - public void prepend(InternetAddressList prepend); - [CCode (cname="internet_address_list_append")] - public void append(InternetAddressList append); - [CCode (cname="internet_address_list_to_string")] - public string? to_string(bool encode); - [CCode (cname="internet_address_list_parse_string")] - public static InternetAddressList? parse_string(string str); -} - diff --git a/bindings/vapi/gmime-2.6/gmime-2.6.defines b/bindings/vapi/gmime-2.6/gmime-2.6.defines deleted file mode 100644 index e69de29b..00000000 diff --git a/bindings/vapi/gmime-2.6/gmime-2.6.files b/bindings/vapi/gmime-2.6/gmime-2.6.files deleted file mode 100644 index 425d3d34..00000000 --- a/bindings/vapi/gmime-2.6/gmime-2.6.files +++ /dev/null @@ -1,2 +0,0 @@ -include/gmime-2.6/ -lib/x86_64-linux-gnu/libgmime-2.6.so diff --git a/bindings/vapi/gmime-2.6/gmime-2.6.metadata b/bindings/vapi/gmime-2.6/gmime-2.6.metadata deleted file mode 100644 index f080d906..00000000 --- a/bindings/vapi/gmime-2.6/gmime-2.6.metadata +++ /dev/null @@ -1,90 +0,0 @@ -GMime lower_case_cprefix="gmime_" cheader_filename="gmime/gmime.h" - -GMimeObject abstract="1" -GMimeStream abstract="1" - -g_mime_content_type_to_string transfer_ownership="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_date_as_string transfer_ownership="1" -g_mime_message_get_mime_part is_nullable="1" -g_mime_multipart_remove_at is_nullable="1" transfer_ownership="1" -g_mime_multipart_replace is_nullable="1" transfer_ownership="1" -g_mime_object_get_content_disposition nullable="1" -g_mime_object_get_content_type nullable="1" -g_mime_object_get_content_type_parameter nullable="1" -g_mime_object_get_headers transfer_ownership="1" -g_mime_object_to_string transfer_ownership="1" -g_mime_param_next name="get_next" -g_mime_parser_construct_message nullable="1" transfer_ownership="1" -g_mime_parser_construct_part nullable="1" transfer_ownership="1" -g_mime_part_get_content_description nullable="1" -g_mime_part_get_content_location nullable="1" -g_mime_part_get_content_id nullable="1" -g_mime_part_get_content_md5 nullable="1" -g_mime_part_get_content_object nullable="1" -g_mime_part_get_content_part nullable="1" -g_mime_part_get_filename 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_stream_read.buf is_array="1" type_name="uint8[]" -g_mime_stream_read.len hidden="1" -g_mime_utils_decode_8bit transfer_ownership="1" -g_mime_utils_decode_message_id transfer_ownership="1" -g_mime_utils_generate_message_id transfer_ownership="1" -g_mime_utils_header_decode_date type_name="time_t" -g_mime_utils_header_decode_date.tz_offset is_out="1" -g_mime_utils_header_decode_phrase transfer_ownership="1" -g_mime_utils_header_decode_text transfer_ownership="1" -g_mime_utils_header_encode_phrase transfer_ownership="1" -g_mime_utils_header_encode_text transfer_ownership="1" -g_mime_utils_header_fold transfer_ownership="1" -g_mime_utils_header_format_date transfer_ownership="1" -g_mime_utils_header_printf transfer_ownership="1" -g_mime_utils_quote_string transfer_ownership="1" -g_mime_utils_structured_header_fold transfer_ownership="1" -g_mime_utils_unstructured_header_fold transfer_ownership="1" - -# FIXME: there is no keyword "is_protected" -GMimeFilter.backbuf type_name="char*" is_protected="1" -GMimeFilter.backlen is_protected="1" -GMimeFilter.backsize is_protected="1" -GMimeFilter.outbuf is_array="1" type_name="char[]" array_length_cname="outsize" array_length_type="size_t" is_protected="1" -GMimeFilter.outpre is_protected="1" -GMimeFilter.outptr type_name="char*" is_protected="1" -GMimeFilter.outreal type_name="char*" is_protected="1" -GMimeFilter.outsize hidden="1" is_protected="1" -GMimeFilterBest.charset hidden="1" - -g_mime_filter_backup.data is_array="1" array_length_pos="1.1" array_length_type="size_t" type_name="char[]" -g_mime_filter_backup.length hidden="1" -g_mime_filter_complete.inbuf is_array="1" array_length_pos="1.1" array_length_type="size_t" type_name="char[]" -g_mime_filter_complete.inlen hidden="1" -g_mime_filter_complete.outbuf is_array="1" array_length_pos="3.1" array_length_type="size_t" type_name="char[]" is_out="1" transfer_ownership="0" -g_mime_filter_complete.outlen hidden="1" -g_mime_filter_complete.outprespace is_out="1" -g_mime_filter_filter.inbuf is_array="1" array_length_pos="1.1" array_length_type="size_t" type_name="char[]" -g_mime_filter_filter.inlen hidden="1" -g_mime_filter_filter.outbuf is_array="1" array_length_pos="3.1" array_length_type="size_t" type_name="char[]" is_out="1" transfer_ownership="0" -g_mime_filter_filter.outlen hidden="1" -g_mime_filter_filter.outprespace is_out="1" -g_mime_filter_copy transfer_ownership="1" - -InternetAddress hidden="1" -internet_address_* hidden="1" -InternetAddress.name hidden="1" - -InternetAddressGroup hidden="1" -internet_address_group_* hidden="1" -InternetAddressGroup.members hidden="1" - -InternetAddressList hidden="1" -internet_address_list_* hidden="1" -InternetAddressList.array hidden="1" - -InternetAddressMailbox hidden="1" -internet_address_mailbox_* hidden="1" -InternetAddressMailbox.addr hidden="1" - diff --git a/bindings/vapi/gmime-2.6/gmime-2.6.namespace b/bindings/vapi/gmime-2.6/gmime-2.6.namespace deleted file mode 100644 index 9b87733d..00000000 --- a/bindings/vapi/gmime-2.6/gmime-2.6.namespace +++ /dev/null @@ -1 +0,0 @@ -GMime diff --git a/meson.build b/meson.build index 62f092a6..c8e0c277 100644 --- a/meson.build +++ b/meson.build @@ -57,7 +57,7 @@ target_webkit = '2.24' # Primary deps glib = dependency('glib-2.0', version: '>=' + target_glib) -gmime = dependency('gmime-2.6', version: '>= 2.6.17') +gmime = dependency('gmime-3.0', version: '>= 3.2.4') gtk = dependency('gtk+-3.0', version: '>=' + target_gtk) sqlite = dependency('sqlite3', version: '>= 3.24') webkit2gtk = dependency('webkit2gtk-4.0', version: '>=' + target_webkit) diff --git a/org.gnome.Geary.json b/org.gnome.Geary.json index 9c604fff..be08b087 100644 --- a/org.gnome.Geary.json +++ b/org.gnome.Geary.json @@ -167,8 +167,7 @@ "sources": [ { "type": "git", - "url": "https://github.com/jstedfast/gmime.git", - "branch": "gmime-2-6" + "url": "https://github.com/jstedfast/gmime.git" } ] }, diff --git a/org.gnome.Geary.yml b/org.gnome.Geary.yml index ce1c74d7..b8bb7336 100644 --- a/org.gnome.Geary.yml +++ b/org.gnome.Geary.yml @@ -175,7 +175,6 @@ modules: sources: - type: git url: https://github.com/jstedfast/gmime.git - branch: gmime-2-6 # Geary dependency - name: libhandy diff --git a/src/engine/imap-db/imap-db-attachment.vala b/src/engine/imap-db/imap-db-attachment.vala index f2aacc25..4db81717 100644 --- a/src/engine/imap-db/imap-db-attachment.vala +++ b/src/engine/imap-db/imap-db-attachment.vala @@ -180,7 +180,7 @@ private class Geary.ImapDB.Attachment : Geary.Attachment { target_stream ); stream = new GMime.StreamBuffer( - stream, GMime.StreamBufferMode.BLOCK_WRITE + stream, GMime.StreamBufferMode.WRITE ); part.write_to_stream(stream, RFC822.Part.EncodingConversion.NONE); diff --git a/src/engine/mime/mime-content-disposition.vala b/src/engine/mime/mime-content-disposition.vala index 9b34849f..675aac75 100644 --- a/src/engine/mime/mime-content-disposition.vala +++ b/src/engine/mime/mime-content-disposition.vala @@ -102,7 +102,7 @@ public class Geary.Mime.ContentDisposition : Geary.BaseObject { out is_unknown); is_unknown_disposition_type = is_unknown; original_disposition_type_string = content_disposition.get_disposition(); - params = new ContentParameters.from_gmime(content_disposition.get_params()); + params = new ContentParameters.from_gmime(content_disposition.get_parameters()); } } diff --git a/src/engine/mime/mime-content-parameters.vala b/src/engine/mime/mime-content-parameters.vala index 0267a9d5..6d2f5ef4 100644 --- a/src/engine/mime/mime-content-parameters.vala +++ b/src/engine/mime/mime-content-parameters.vala @@ -51,11 +51,13 @@ public class Geary.Mime.ContentParameters : BaseObject { } } - internal ContentParameters.from_gmime(GMime.Param? gmime_param) { + internal ContentParameters.from_gmime(GMime.ParamList? gmime_params) { Gee.Map params = new Gee.HashMap(); - while (gmime_param != null) { - params.set(gmime_param.get_name(), gmime_param.get_value()); - gmime_param = gmime_param.get_next(); + if (gmime_params != null) { + for (int i = 0; i < gmime_params.length(); i++) { + GMime.Param gmime_param = gmime_params.get_parameter_at(i); + params.set(gmime_param.get_name(), gmime_param.get_value()); + } } this(params); } diff --git a/src/engine/mime/mime-content-type.vala b/src/engine/mime/mime-content-type.vala index ed59a491..9fe333d8 100644 --- a/src/engine/mime/mime-content-type.vala +++ b/src/engine/mime/mime-content-type.vala @@ -74,7 +74,10 @@ public class Geary.Mime.ContentType : Geary.BaseObject { if (!str.contains("/")) throw new MimeError.PARSE("Invalid MIME Content-Type: %s", str); - return new ContentType.from_gmime(new GMime.ContentType.from_string(str)); + return new ContentType.from_gmime(GMime.ContentType.parse( + Geary.RFC822.get_parser_options(), + str + )); } /** @@ -158,7 +161,7 @@ public class Geary.Mime.ContentType : Geary.BaseObject { internal ContentType.from_gmime(GMime.ContentType content_type) { media_type = content_type.get_media_type().strip(); media_subtype = content_type.get_media_subtype().strip(); - params = new ContentParameters.from_gmime(content_type.get_params()); + params = new ContentParameters.from_gmime(content_type.get_parameters()); } /** diff --git a/src/engine/rfc822/rfc822-gmime-filter-blockquotes.vala b/src/engine/rfc822/rfc822-gmime-filter-blockquotes.vala index 7d18342d..6f8c118f 100644 --- a/src/engine/rfc822/rfc822-gmime-filter-blockquotes.vala +++ b/src/engine/rfc822/rfc822-gmime-filter-blockquotes.vala @@ -49,7 +49,7 @@ private class Geary.RFC822.FilterBlockquotes : GMime.Filter { return new_filter; } - private void do_filter(char[] inbuf, size_t prespace, out unowned char[] processed_buffer, + private void do_filter(uint8[] inbuf, size_t prespace, out unowned uint8[] processed_buffer, out size_t outprespace, bool flush) { // This may not be strictly necessary. @@ -64,7 +64,7 @@ private class Geary.RFC822.FilterBlockquotes : GMime.Filter { } for (uint i = 0; i < inbuf.length; i++) { - char c = inbuf[i]; + uint8 c = inbuf[i]; if (in_prefix && !in_tag) { if (c == Geary.RFC822.Utils.QUOTE_MARKER) { @@ -122,12 +122,12 @@ private class Geary.RFC822.FilterBlockquotes : GMime.Filter { outprespace = this.outpre; } - public override void filter(char[] inbuf, size_t prespace, out unowned char[] processed_buffer, + public override void filter(uint8[] inbuf, size_t prespace, out unowned uint8[] processed_buffer, out size_t outprespace) { do_filter(inbuf, prespace, out processed_buffer, out outprespace, false); } - public override void complete(char[] inbuf, size_t prespace, out unowned char[] processed_buffer, + public override void complete(uint8[] inbuf, size_t prespace, out unowned uint8[] processed_buffer, out size_t outprespace) { do_filter(inbuf, prespace, out processed_buffer, out outprespace, true); } diff --git a/src/engine/rfc822/rfc822-gmime-filter-flowed.vala b/src/engine/rfc822/rfc822-gmime-filter-flowed.vala index 3f5a28a9..d018c537 100644 --- a/src/engine/rfc822/rfc822-gmime-filter-flowed.vala +++ b/src/engine/rfc822/rfc822-gmime-filter-flowed.vala @@ -57,7 +57,7 @@ private class Geary.RFC822.FilterFlowed : GMime.Filter { return new_filter; } - public override void filter(char[] inbuf, size_t prespace, out unowned char[] processed_buffer, + public override void filter(uint8[] inbuf, size_t prespace, out unowned uint8[] processed_buffer, out size_t outprespace) { // Worst-case scenario: We are about to leave the prefix, @@ -67,7 +67,7 @@ private class Geary.RFC822.FilterFlowed : GMime.Filter { uint out_index = 0; for (uint i = 0; i < inbuf.length; i++) { - char c = inbuf[i]; + uint8 c = inbuf[i]; if (this.in_prefix) { if (c == '>') { @@ -147,7 +147,7 @@ private class Geary.RFC822.FilterFlowed : GMime.Filter { outprespace = this.outpre; } - public override void complete(char[] inbuf, size_t prespace, out unowned char[] processed_buffer, + public override void complete(uint8[] inbuf, size_t prespace, out unowned uint8[] processed_buffer, out size_t outprespace) { filter(inbuf, prespace, out processed_buffer, out outprespace); } diff --git a/src/engine/rfc822/rfc822-gmime-filter-plain.vala b/src/engine/rfc822/rfc822-gmime-filter-plain.vala index d66e3284..b38baac0 100644 --- a/src/engine/rfc822/rfc822-gmime-filter-plain.vala +++ b/src/engine/rfc822/rfc822-gmime-filter-plain.vala @@ -26,7 +26,7 @@ private class Geary.RFC822.FilterPlain : GMime.Filter { return new_filter; } - public override void filter(char[] inbuf, size_t prespace, out unowned char[] processed_buffer, + public override void filter(uint8[] inbuf, size_t prespace, out unowned uint8[] processed_buffer, out size_t outprespace) { // This may not be strictly necessary. @@ -34,7 +34,7 @@ private class Geary.RFC822.FilterPlain : GMime.Filter { uint out_index = 0; for (uint i = 0; i < inbuf.length; i++) { - char c = inbuf[i]; + uint8 c = inbuf[i]; if (in_prefix) { if (c == '>') { @@ -56,7 +56,7 @@ private class Geary.RFC822.FilterPlain : GMime.Filter { outprespace = this.outpre; } - public override void complete(char[] inbuf, size_t prespace, out unowned char[] processed_buffer, + public override void complete(uint8[] inbuf, size_t prespace, out unowned uint8[] processed_buffer, out size_t outprespace) { filter(inbuf, prespace, out processed_buffer, out outprespace); } diff --git a/src/engine/rfc822/rfc822-mailbox-address.vala b/src/engine/rfc822/rfc822-mailbox-address.vala index 73803f19..6d994136 100644 --- a/src/engine/rfc822/rfc822-mailbox-address.vala +++ b/src/engine/rfc822/rfc822-mailbox-address.vala @@ -42,11 +42,17 @@ public class Geary.RFC822.MailboxAddress : } private static string decode_name(string name) { - return GMime.utils_header_decode_phrase(prepare_header_text_part(name)); + return GMime.utils_header_decode_phrase( + Geary.RFC822.get_parser_options(), + prepare_header_text_part(name) + ); } private static string decode_address_part(string mailbox) { - return GMime.utils_header_decode_text(prepare_header_text_part(mailbox)); + return GMime.utils_header_decode_text( + Geary.RFC822.get_parser_options(), + prepare_header_text_part(mailbox) + ); } private static bool display_name_needs_quoting(string name) { @@ -118,8 +124,9 @@ public class Geary.RFC822.MailboxAddress : // _internet_address_decode_name() function. // see if a broken mailer has sent raw 8-bit information - string text = GMime.utils_text_is_8bit(part, part.length) - ? part : GMime.utils_decode_8bit(part, part.length); + string text = GMime.utils_text_is_8bit(part.data) + ? part : GMime.utils_decode_8bit(Geary.RFC822.get_parser_options(), + part.data); // unquote the string then decode the text GMime.utils_unquote_string(text); @@ -222,16 +229,19 @@ public class Geary.RFC822.MailboxAddress : } public MailboxAddress.from_rfc822_string(string rfc822) throws RFC822Error { - InternetAddressList addrlist = InternetAddressList.parse_string(rfc822); + GMime.InternetAddressList addrlist = GMime.InternetAddressList.parse( + Geary.RFC822.get_parser_options(), + rfc822 + ); if (addrlist == null) return; int length = addrlist.length(); for (int ctr = 0; ctr < length; ctr++) { - InternetAddress? addr = addrlist.get_address(ctr); + GMime.InternetAddress? addr = addrlist.get_address(ctr); // TODO: Handle group lists - InternetAddressMailbox? mbox_addr = addr as InternetAddressMailbox; + GMime.InternetAddressMailbox? mbox_addr = addr as GMime.InternetAddressMailbox; if (mbox_addr != null) { this.gmime(mbox_addr); return; @@ -240,11 +250,11 @@ public class Geary.RFC822.MailboxAddress : throw new RFC822Error.INVALID("Could not parse RFC822 address: %s", rfc822); } - public MailboxAddress.gmime(InternetAddressMailbox mailbox) { + public MailboxAddress.gmime(GMime.InternetAddressMailbox mailbox) { // GMime strips source route for us, so the address part // should only ever contain a single '@' string? name = mailbox.get_name(); - if (name != null) { + if (name != "") { this.name = decode_name(name); } @@ -456,7 +466,11 @@ public class Geary.RFC822.MailboxAddress : public string to_rfc822_string() { return has_distinct_name() ? "%s <%s>".printf( - GMime.utils_header_encode_phrase(this.name), + GMime.utils_header_encode_phrase( + Geary.RFC822.get_format_options(), + this.name, + "iso-8859-1" + ), to_rfc822_address() ) : to_rfc822_address(); diff --git a/src/engine/rfc822/rfc822-mailbox-addresses.vala b/src/engine/rfc822/rfc822-mailbox-addresses.vala index 8ebf79de..5d647fa7 100644 --- a/src/engine/rfc822/rfc822-mailbox-addresses.vala +++ b/src/engine/rfc822/rfc822-mailbox-addresses.vala @@ -74,27 +74,30 @@ public class Geary.RFC822.MailboxAddresses : } public MailboxAddresses.from_rfc822_string(string rfc822) { - InternetAddressList addrlist = InternetAddressList.parse_string(rfc822); + GMime.InternetAddressList addrlist = GMime.InternetAddressList.parse( + Geary.RFC822.get_parser_options(), + rfc822 + ); if (addrlist == null) return; int length = addrlist.length(); for (int ctr = 0; ctr < length; ctr++) { - InternetAddress? addr = addrlist.get_address(ctr); + GMime.InternetAddress? addr = addrlist.get_address(ctr); - InternetAddressMailbox? mbox_addr = addr as InternetAddressMailbox; + GMime.InternetAddressMailbox? mbox_addr = addr as GMime.InternetAddressMailbox; if (mbox_addr != null) { this.addrs.add(new MailboxAddress.gmime(mbox_addr)); } else { // XXX this is pretty bad - we just flatten the // group's addresses into this list, merging lists and // losing the group names. - InternetAddressGroup? mbox_group = addr as InternetAddressGroup; + GMime.InternetAddressGroup? mbox_group = addr as GMime.InternetAddressGroup; if (mbox_group != null) { - InternetAddressList group_list = mbox_group.get_members(); + GMime.InternetAddressList group_list = mbox_group.get_members(); for (int i = 0; i < group_list.length(); i++) { - InternetAddressMailbox? group_addr = - addrlist.get_address(i) as InternetAddressMailbox; + GMime.InternetAddressMailbox? group_addr = + addrlist.get_address(i) as GMime.InternetAddressMailbox; if (group_addr != null) { this.addrs.add(new MailboxAddress.gmime(group_addr)); } diff --git a/src/engine/rfc822/rfc822-message-data.vala b/src/engine/rfc822/rfc822-message-data.vala index 2d399986..d4a3aa0a 100644 --- a/src/engine/rfc822/rfc822-message-data.vala +++ b/src/engine/rfc822/rfc822-message-data.vala @@ -173,27 +173,13 @@ public class Geary.RFC822.Date : Geary.RFC822.MessageData, Geary.MessageData.Abs public DateTime value { get; private set; } public Date(string rfc822) throws ImapError { - int offset = 0; - int64 time_t_utc = GMime.utils_header_decode_date(rfc822, out offset); - if (time_t_utc == 0) - throw new ImapError.PARSE_ERROR( - "Unable to parse \"%s\": Not ISO-8601 date", rfc822 - ); - - DateTime? value = new DateTime.from_unix_utc(time_t_utc); + DateTime? value = GMime.utils_header_decode_date(rfc822); if (value == null) { throw new ImapError.PARSE_ERROR( "Unable to parse \"%s\": Outside supported range", rfc822 ); } this.value = value; - - if (offset != 0) { - this.value = value.to_timezone( - new GLib.TimeZone("%+05d".printf(offset)) - ); - } - this.original = rfc822; } @@ -206,18 +192,7 @@ public class Geary.RFC822.Date : Geary.RFC822.MessageData, Geary.MessageData.Abs * Returns the {@link Date} in RFC 822 format. */ public string to_rfc822_string() { - // Although GMime documents its conversion methods as - // requiring the tz offset in hours, it appears the number is - // handed directly to the string (i.e. an offset of -7:30 becomes - // "-0007", whereas we want "-0730"). - int hours = (int) GLib.Math.floor(value.get_utc_offset() / TimeSpan.HOUR); - int minutes = (int) ( - (value.get_utc_offset() % TimeSpan.HOUR) / (double) TimeSpan.HOUR * 60 - ); - return GMime.utils_header_format_date( - (time_t) this.value.to_utc().to_unix(), - (hours * 100) + minutes - ); + return GMime.utils_header_format_date(this.value); } /** @@ -261,7 +236,7 @@ public class Geary.RFC822.Subject : Geary.MessageData.StringMessageData, } public Subject.decode(string value) { - base (GMime.utils_header_decode_text(value)); + base (GMime.utils_header_decode_text(Geary.RFC822.get_parser_options(), value)); original = value; } @@ -337,9 +312,8 @@ public class Geary.RFC822.Header : Geary.MessageData.BlockMessageData, Geary.RFC GMime.Parser parser = new GMime.Parser.with_stream(Utils.create_stream_mem(buffer)); parser.set_respect_content_length(false); - parser.set_scan_from(false); - message = parser.construct_message(); + message = parser.construct_message(Geary.RFC822.get_parser_options()); if (message == null) throw new RFC822Error.INVALID("Unable to parse RFC 822 headers"); @@ -347,17 +321,22 @@ public class Geary.RFC822.Header : Geary.MessageData.BlockMessageData, Geary.RFC } public string? get_header(string name) throws RFC822Error { - return get_headers().get(name); + GMime.Header header = get_headers().get_header(name); + if (header != null) + // We should not parse the raw-value here, but use GMime's parsing + // functionality instead. + // See: https://gitlab.gnome.org/GNOME/geary/merge_requests/382#note_669699 + return GMime.utils_header_unfold(header.get_raw_value()); + else + return null; } public string[] get_header_names() throws RFC822Error { if (this.names == null) { this.names = new string[0]; - GMime.HeaderIter iter = new GMime.HeaderIter(); - if (get_headers().get_iter(iter) && iter.first()) { - do { - names += iter.get_name(); - } while (iter.next()); + GMime.HeaderList headers = get_headers(); + for (int i = 0; i < headers.get_count(); i++) { + names += headers.get_header_at(i).get_name(); } } return this.names; @@ -388,7 +367,7 @@ public class Geary.RFC822.PreviewText : Geary.RFC822.Text { // Parse the header. GMime.Stream header_stream = Utils.create_stream_mem(preview_header); GMime.Parser parser = new GMime.Parser.with_stream(header_stream); - GMime.Part? gpart = parser.construct_part() as GMime.Part; + GMime.Part? gpart = parser.construct_part(Geary.RFC822.get_parser_options()) as GMime.Part; if (gpart != null) { Part part = new Part(gpart); @@ -402,7 +381,7 @@ public class Geary.RFC822.PreviewText : Geary.RFC822.Text { new GMime.StreamMem.with_buffer(preview.get_uint8_array()), gpart.get_content_encoding() ); - gpart.set_content_object(body); + gpart.set_content(body); try { Memory.Buffer preview_buffer = part.write_to_buffer( diff --git a/src/engine/rfc822/rfc822-message.vala b/src/engine/rfc822/rfc822-message.vala index 02d4b397..e14093e3 100644 --- a/src/engine/rfc822/rfc822-message.vala +++ b/src/engine/rfc822/rfc822-message.vala @@ -29,7 +29,6 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { */ public delegate string? InlinePartReplacer(Part part); - private const string HEADER_SENDER = "Sender"; private const string HEADER_IN_REPLY_TO = "In-Reply-To"; private const string HEADER_REFERENCES = "References"; private const string HEADER_MAILER = "X-Mailer"; @@ -89,7 +88,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { public Message(Full full) throws RFC822Error { GMime.Parser parser = new GMime.Parser.with_stream(Utils.create_stream_mem(full.buffer)); - message = parser.construct_message(); + message = parser.construct_message(Geary.RFC822.get_parser_options()); if (message == null) throw new RFC822Error.INVALID("Unable to parse RFC 822 message"); @@ -115,7 +114,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { stream_cat.add_source(new GMime.StreamMem.with_buffer(body.buffer.get_bytes().get_data())); GMime.Parser parser = new GMime.Parser.with_stream(stream_cat); - message = parser.construct_message(); + message = parser.construct_message(Geary.RFC822.get_parser_options()); if (message == null) throw new RFC822Error.INVALID("Unable to parse RFC 822 message"); @@ -136,67 +135,71 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { this.from = email.from; this.date = email.date; - // GMimeMessage.set_sender actually sets the From header - and - // although the API docs make it sound otherwise, it also - // supports a list of addresses - message.set_sender(this.from.to_rfc822_string()); - message.set_date_as_string(this.date.serialize()); - if (message_id != null) { - this.message_id = new MessageID(message_id); - message.set_message_id(message_id); + this.message.set_date(this.date.value); + + if (email.from != null) { + foreach (RFC822.MailboxAddress mailbox in email.from) + this.message.add_mailbox(FROM, mailbox.name, mailbox.address); } // Optional headers if (email.to != null) { this.to = email.to; foreach (RFC822.MailboxAddress mailbox in email.to) - this.message.add_recipient(GMime.RecipientType.TO, mailbox.name, mailbox.address); + this.message.add_mailbox(TO, mailbox.name, mailbox.address); } if (email.cc != null) { this.cc = email.cc; foreach (RFC822.MailboxAddress mailbox in email.cc) - this.message.add_recipient(GMime.RecipientType.CC, mailbox.name, mailbox.address); + this.message.add_mailbox(CC, mailbox.name, mailbox.address); } if (email.bcc != null) { this.bcc = email.bcc; foreach (RFC822.MailboxAddress mailbox in email.bcc) - this.message.add_recipient(GMime.RecipientType.BCC, mailbox.name, mailbox.address); + this.message.add_mailbox(BCC, mailbox.name, mailbox.address); } if (email.sender != null) { - this.sender = email.sender; - this.message.set_header(HEADER_SENDER, - email.sender.to_rfc822_string()); + this.message.add_mailbox(SENDER, this.sender.name, this.sender.address); } if (email.reply_to != null) { this.reply_to = email.reply_to; - this.message.set_reply_to(email.reply_to.to_rfc822_string()); + foreach (RFC822.MailboxAddress mailbox in email.reply_to) + this.message.add_mailbox(REPLY_TO, mailbox.name, mailbox.address); } if (email.in_reply_to != null) { this.in_reply_to = email.in_reply_to; + // We could use `this.message.add_mailbox()` in a similar way like + // we did for the other headers, but this would require to change + // the type of `email.in_reply_to` and `this.in_reply_to` from + // `RFC822.MessageIDList` to `RFC822.MailboxAddresses`. this.message.set_header(HEADER_IN_REPLY_TO, - email.in_reply_to.to_rfc822_string()); + email.in_reply_to.to_rfc822_string(), + Geary.RFC822.get_charset()); } if (email.references != null) { this.references = email.references; this.message.set_header(HEADER_REFERENCES, - email.references.to_rfc822_string()); + email.references.to_rfc822_string(), + Geary.RFC822.get_charset()); } if (email.subject != null) { this.subject = email.subject; - this.message.set_subject(email.subject.value); + this.message.set_subject(email.subject.value, + Geary.RFC822.get_charset()); } // User-Agent if (!Geary.String.is_empty(email.mailer)) { this.mailer = email.mailer; - this.message.set_header(HEADER_MAILER, email.mailer); + this.message.set_header(HEADER_MAILER, email.mailer, + Geary.RFC822.get_charset()); } // Build the message's body mime parts @@ -406,7 +409,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { string type) { GMime.Object? part = coalesce_parts(parts, "related"); if (parts.size > 1) { - part.set_header("Type", type); + part.set_header("Type", type, Geary.RFC822.get_charset()); } return part; } @@ -433,11 +436,12 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { FileQueryInfoFlags.NONE ); - GMime.Part part = new GMime.Part(); + GMime.Part part = new GMime.Part.with_type("text", "plain"); part.set_disposition(disposition.serialize()); part.set_filename(file.get_basename()); - GMime.ContentType content_type = new GMime.ContentType.from_string( + GMime.ContentType content_type = GMime.ContentType.parse( + Geary.RFC822.get_parser_options(), file_info.get_content_type() ); part.set_content_type(content_type); @@ -468,7 +472,10 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { ); } - GMime.ContentType? content_type = new GMime.ContentType.from_string(mime_type.get_mime_type()); + GMime.ContentType? content_type = GMime.ContentType.parse( + Geary.RFC822.get_parser_options(), + mime_type.get_mime_type() + ); if (content_type == null) { throw new RFC822Error.INVALID( @@ -476,7 +483,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { ); } - GMime.Part part = new GMime.Part(); + GMime.Part part = new GMime.Part.with_type("text", "plain"); part.set_disposition(disposition.serialize()); part.set_filename(basename); part.set_content_type(content_type); @@ -515,7 +522,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { } part.set_content_encoding(encoding); - part.set_content_object( + part.set_content( new GMime.DataWrapper.with_stream( stream, GMime.ContentEncoding.BINARY ) @@ -536,7 +543,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { Geary.Email email = new Geary.Email(id); email.set_message_header(new Geary.RFC822.Header(new Geary.Memory.StringBuffer( - message.get_headers()))); + message.get_headers(Geary.RFC822.get_format_options())))); email.set_send_date(date); email.set_originators(from, sender, reply_to); email.set_receivers(to, cc, bcc); @@ -884,68 +891,76 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { } private void stock_from_gmime() { - this.message.get_header_list().foreach((name, value) => { - switch (name.down()) { - case "from": - this.from = append_address(this.from, value); - break; + GMime.HeaderList headers = this.message.get_header_list(); + for (int i = 0; i < headers.get_count(); i++) { + GMime.Header header = headers.get_header_at(i); + string name = header.get_name(); + // We should not parse the raw-value here, but use GMime's parsing + // functionality instead. + // See: https://gitlab.gnome.org/GNOME/geary/merge_requests/382#note_669699 + string value = GMime.utils_header_unfold(header.get_raw_value()); + switch (name.down()) { + case "from": + this.from = append_address(this.from, value); + break; - case "sender": - try { - this.sender = new RFC822.MailboxAddress.from_rfc822_string(value); - } catch (Error err) { - debug("Could parse subject: %s", err.message); - } - break; + case "sender": + try { + this.sender = new RFC822.MailboxAddress.from_rfc822_string(value); + } catch (Error err) { + debug("Could parse subject: %s", err.message); + } + break; - case "reply-to": - this.reply_to = append_address(this.reply_to, value); - break; + case "reply-to": + this.reply_to = append_address(this.reply_to, value); + break; - case "to": - this.to = append_address(this.to, value); - break; + case "to": + this.to = append_address(this.to, value); + break; - case "cc": - this.cc = append_address(this.cc, value); - break; + case "cc": + this.cc = append_address(this.cc, value); + break; - case "bcc": - this.bcc = append_address(this.bcc, value); - break; + case "bcc": + this.bcc = append_address(this.bcc, value); + break; - case "subject": - this.subject = new RFC822.Subject.decode(value); - break; + case "subject": + this.subject = new RFC822.Subject.decode(value); + break; - case "date": - try { - this.date = new Geary.RFC822.Date(value); - } catch (Error err) { - debug("Could not parse date: %s", err.message); - } - break; + case "date": + try { + this.date = new Geary.RFC822.Date(value); + } catch (Error err) { + debug("Could not parse date: %s", err.message); + } + break; - case "message-id": - this.message_id = new MessageID(value); - break; + case "message-id": + this.message_id = new MessageID(value); + break; - case "in-reply-to": - this.in_reply_to = append_message_id(this.in_reply_to, value); - break; + case "in-reply-to": + this.in_reply_to = append_message_id(this.in_reply_to, value); + break; - case "references": - this.references = append_message_id(this.references, value); - break; + case "references": + this.references = append_message_id(this.references, value); + break; - case "x-mailer": - this.mailer = GMime.utils_header_decode_text(value); - break; + case "x-mailer": + this.mailer = GMime.utils_header_decode_text(Geary.RFC822.get_parser_options(), value); + break; - default: - break; - } - }); + default: + // do nothing + break; + } + }; } private MailboxAddresses append_address(MailboxAddresses? existing, @@ -990,11 +1005,11 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { if (requested_disposition == Mime.DispositionType.UNSPECIFIED || disposition == requested_disposition) { GMime.Stream stream = new GMime.StreamMem(); - message.write_to_stream(stream); + message.write_to_stream(Geary.RFC822.get_format_options(), stream); GMime.DataWrapper data = new GMime.DataWrapper.with_stream(stream, GMime.ContentEncoding.BINARY); // Equivalent to no encoding GMime.Part part = new GMime.Part.with_type("message", "rfc822"); - part.set_content_object(data); + part.set_content(data); part.set_filename((message.get_subject() ?? _("(no subject)")) + ".eml"); attachments.add(new Part(part)); } @@ -1017,7 +1032,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { #if WITH_TNEF_SUPPORT if (content_type.is_type("application", "vnd.ms-tnef")) { GMime.StreamMem stream = new GMime.StreamMem(); - ((GMime.Part) root).get_content_object().write_to_stream(stream); + ((GMime.Part) root).get_content().write_to_stream(stream); ByteArray tnef_data = stream.get_byte_array(); Ytnef.TNEFStruct tn; if (Ytnef.ParseMemory(tnef_data.data, out tn) == 0) { @@ -1050,10 +1065,10 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { string filename = (string) filenameProp.data; uint8[] data = Bytes.unref_to_data(new Bytes(a.FileData.data)); - GMime.Part part = new GMime.Part(); + GMime.Part part = new GMime.Part.with_type("text", "plain"); part.set_filename(filename); - part.set_content_type(new GMime.ContentType.from_string(GLib.ContentType.guess(filename, data, null))); - part.set_content_object(new GMime.DataWrapper.with_stream(new GMime.StreamMem.with_buffer(data), GMime.ContentEncoding.BINARY)); + part.set_content_type(GMime.ContentType.parse(Geary.RFC822.get_parser_options(), GLib.ContentType.guess(filename, data, null))); + part.set_content(new GMime.DataWrapper.with_stream(new GMime.StreamMem.with_buffer(data), GMime.ContentEncoding.BINARY)); return part; } #endif @@ -1092,19 +1107,29 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { stream.set_owner(false); GMime.StreamFilter stream_filter = new GMime.StreamFilter(stream); - stream_filter.add(new GMime.FilterCRLF(encoded, dotstuffed)); + if (encoded) { + stream_filter.add(new GMime.FilterUnix2Dos(false)); + } else { + stream_filter.add(new GMime.FilterDos2Unix(false)); + } + if (dotstuffed) { + stream_filter.add(new GMime.FilterSmtpData()); + } - if (message.write_to_stream(stream_filter) < 0) - throw new RFC822Error.FAILED("Unable to write RFC822 message to memory buffer"); + if (message.write_to_stream(Geary.RFC822.get_format_options(), stream_filter) < 0) + throw new RFC822Error.FAILED("Unable to write RFC822 message to filter stream"); if (stream_filter.flush() != 0) + throw new RFC822Error.FAILED("Unable to flush RFC822 message to memory stream"); + + if (stream.flush() != 0) throw new RFC822Error.FAILED("Unable to flush RFC822 message to memory buffer"); return new Memory.ByteBuffer.from_byte_array(byte_array); } public string to_string() { - return message.to_string(); + return message.to_string(Geary.RFC822.get_format_options()); } /** @@ -1152,11 +1177,13 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { // Base64-encoded text needs to have CR's added after LF's // before encoding, otherwise it breaks format=flowed. See // Bug 753528. - filter_stream.add(new GMime.FilterCRLF(true, false)); + filter_stream.add(new GMime.FilterUnix2Dos(false)); } - GMime.ContentType complete_type = - new GMime.ContentType.from_string(content_type); + GMime.ContentType complete_type = GMime.ContentType.parse( + Geary.RFC822.get_parser_options(), + content_type + ); complete_type.set_parameter("charset", charset); if (is_flowed) { complete_type.set_parameter("format", "flowed"); @@ -1166,9 +1193,9 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet { filter_stream, GMime.ContentEncoding.DEFAULT ); - GMime.Part body_part = new GMime.Part(); + GMime.Part body_part = new GMime.Part.with_type("text", "plain"); body_part.set_content_type(complete_type); - body_part.set_content_object(body); + body_part.set_content(body); body_part.set_content_encoding(encoding); return body_part; } diff --git a/src/engine/rfc822/rfc822-part.vala b/src/engine/rfc822/rfc822-part.vala index b8a3b2a8..58c58ff0 100644 --- a/src/engine/rfc822/rfc822-part.vala +++ b/src/engine/rfc822/rfc822-part.vala @@ -160,7 +160,7 @@ public class Geary.RFC822.Part : Object { BodyFormatting format = BodyFormatting.NONE) throws RFC822Error { GMime.DataWrapper? wrapper = (this.source_part != null) - ? this.source_part.get_content_object() : null; + ? this.source_part.get_content() : null; if (wrapper == null) { throw new RFC822Error.INVALID( "Could not get the content wrapper for content-type %s", @@ -201,7 +201,7 @@ public class Geary.RFC822.Part : Object { if ((this.source_part == null || this.source_part.encoding != BASE64) && !(content_type.media_subtype in CR_PRESERVING_TEXT_TYPES)) { - filter.add(new GMime.FilterCRLF(false, false)); + filter.add(new GMime.FilterDos2Unix(false)); } if (flowed) { @@ -226,12 +226,18 @@ public class Geary.RFC822.Part : Object { filter.add(new Geary.RFC822.FilterBlockquotes()); } - wrapper.write_to_stream(filter); - filter.flush(); + if (wrapper.write_to_stream(filter) < 0) + throw new RFC822Error.FAILED("Unable to write textual RFC822 part to filter stream"); + if (filter.flush() != 0) + throw new RFC822Error.FAILED("Unable to flush textual RFC822 part to destination stream"); + if (destination.flush() != 0) + throw new RFC822Error.FAILED("Unable to flush textual RFC822 part to destination"); } else { // Keep as binary - wrapper.write_to_stream(destination); - destination.flush(); + if (wrapper.write_to_stream(destination) < 0) + throw new RFC822Error.FAILED("Unable to write binary RFC822 part to destination stream"); + if (destination.flush() != 0) + throw new RFC822Error.FAILED("Unable to flush binary RFC822 part to destination"); } } diff --git a/src/engine/rfc822/rfc822-utils.vala b/src/engine/rfc822/rfc822-utils.vala index 37a967fb..d9278f64 100644 --- a/src/engine/rfc822/rfc822-utils.vala +++ b/src/engine/rfc822/rfc822-utils.vala @@ -186,7 +186,7 @@ public string email_addresses_for_reply(Geary.RFC822.MailboxAddresses? addresses } -public bool comp_char_arr_slice(char[] array, uint start, string comp) { +public bool comp_char_arr_slice(uint8[] array, uint start, string comp) { for (int i = 0; i < comp.length; i++) { if (array[start + i] != comp[i]) return false; @@ -277,7 +277,7 @@ public async string get_best_charset(GMime.Stream in_stream, }, cancellable ); - return filter.charset(); + return filter.get_charset(); } /** diff --git a/src/engine/rfc822/rfc822.vala b/src/engine/rfc822/rfc822.vala index 9195eac1..cef728a2 100644 --- a/src/engine/rfc822/rfc822.vala +++ b/src/engine/rfc822/rfc822.vala @@ -19,11 +19,6 @@ public enum TextFormat { */ public const string UTF8_CHARSET = "UTF-8"; -/** - * Official IANA charset encoding name for the ASCII character set. - */ -public const string ASCII_CHARSET = "US-ASCII"; - private int init_count = 0; internal Regex? invalid_filename_character_re = null; @@ -32,18 +27,8 @@ public void init() { if (init_count++ != 0) return; - GMime.init(GMime.ENABLE_RFC2047_WORKAROUNDS); - - // This has the effect of ensuring all non US-ASCII and non-ISO-8859-1 - // headers are always encoded as UTF-8. This should be fine because - // message bodies are also always sent as UTF-8. - const string?[] USER_CHARSETS = { - UTF8_CHARSET, - // GMime.set_user_charsets calls g_strdupv under the hood, so - // the array needs to be null-terminated - null - }; - GMime.set_user_charsets(USER_CHARSETS); + GMime.init(); + GMime.ParserOptions.get_default().set_allow_addresses_without_domain(true); try { invalid_filename_character_re = new Regex("[/\\0]"); @@ -52,6 +37,17 @@ public void init() { } } +public GMime.FormatOptions get_format_options() { + return GMime.FormatOptions.get_default().clone(); +} + +public GMime.ParserOptions get_parser_options() { + return GMime.ParserOptions.get_default().clone(); +} + +public string? get_charset() { + return UTF8_CHARSET; +} internal bool is_utf_8(string charset) { string up = charset.up(); diff --git a/src/meson.build b/src/meson.build index 90b628d3..244c3699 100644 --- a/src/meson.build +++ b/src/meson.build @@ -132,7 +132,7 @@ if enable_valadoc '--pkg', 'gio-2.0', '--pkg', 'gee-0.8', '--pkg', 'sqlite3', - '--pkg', 'gmime-2.6', + '--pkg', 'gmime-3.0', '--pkg', 'javascriptcoregtk-4.0', '--pkg', 'libxml-2.0', '--pkg', 'libunwind', diff --git a/test/engine/imap-db/imap-db-attachment-test.vala b/test/engine/imap-db/imap-db-attachment-test.vala index d24f2b8d..bf201b70 100644 --- a/test/engine/imap-db/imap-db-attachment-test.vala +++ b/test/engine/imap-db/imap-db-attachment-test.vala @@ -21,7 +21,7 @@ class Geary.ImapDB.AttachmentTest : TestCase { public void new_from_minimal_mime_part() throws Error { GMime.Part part = new_part(null, ATTACHMENT_BODY.data); - part.set_header("Content-Type", ""); + part.set_header("Content-Type", "", Geary.RFC822.get_charset()); Attachment test = new Attachment.from_part( 1, new Geary.RFC822.Part(part) @@ -51,7 +51,8 @@ class Geary.ImapDB.AttachmentTest : TestCase { part.set_content_id(ID); part.set_content_description(DESC); part.set_content_disposition( - new GMime.ContentDisposition.from_string( + GMime.ContentDisposition.parse( + Geary.RFC822.get_parser_options(), "attachment; filename=%s".printf(NAME) ) ); @@ -74,7 +75,10 @@ class Geary.ImapDB.AttachmentTest : TestCase { public void new_from_inline_mime_part() throws Error { GMime.Part part = new_part(null, ATTACHMENT_BODY.data); part.set_content_disposition( - new GMime.ContentDisposition.from_string("inline") + GMime.ContentDisposition.parse( + Geary.RFC822.get_parser_options(), + "inline" + ) ); Attachment test = new Attachment.from_part( @@ -205,7 +209,8 @@ CREATE TABLE MessageAttachmentTable ( part.set_content_id(ID); part.set_content_description(DESCRIPTION); part.set_content_disposition( - new GMime.ContentDisposition.from_string( + GMime.ContentDisposition.parse( + Geary.RFC822.get_parser_options(), "inline; filename=%s;".printf(FILENAME) )); @@ -350,14 +355,17 @@ VALUES (2, 'text/plain'); private GMime.Part new_part(string? mime_type, uint8[] body, GMime.ContentEncoding encoding = GMime.ContentEncoding.DEFAULT) { - GMime.Part part = new GMime.Part(); + GMime.Part part = new GMime.Part.with_type("text", "plain"); if (mime_type != null) { - part.set_content_type(new GMime.ContentType.from_string(mime_type)); + part.set_content_type(GMime.ContentType.parse( + Geary.RFC822.get_parser_options(), + mime_type + )); } GMime.DataWrapper body_wrapper = new GMime.DataWrapper.with_stream( new GMime.StreamMem.with_buffer(body), encoding ); - part.set_content_object(body_wrapper); + part.set_content(body_wrapper); return part; } diff --git a/test/engine/rfc822-mailbox-address-test.vala b/test/engine/rfc822-mailbox-address-test.vala index c04d47e0..714da286 100644 --- a/test/engine/rfc822-mailbox-address-test.vala +++ b/test/engine/rfc822-mailbox-address-test.vala @@ -12,6 +12,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase { add_test("is_valid_address", is_valid_address); add_test("unescaped_constructor", unescaped_constructor); add_test("from_rfc822_string_encoded", from_rfc822_string_encoded); + add_test("prepare_header_text_part", prepare_header_text_part); // latter depends on the former, so test that first add_test("has_distinct_name", has_distinct_name); add_test("is_spoofed", is_spoofed); @@ -140,18 +141,36 @@ class Geary.RFC822.MailboxAddressTest : TestCase { // Courtesy Mailsploit https://www.mailsploit.com addr = new MailboxAddress.from_rfc822_string("\"=?utf-8?b?dGVzdCIgPHBvdHVzQHdoaXRlaG91c2UuZ292Pg==?==?utf-8?Q?=00=0A?=\" "); - assert(addr.name == "test ?\n"); + assert(addr.name == "test ?"); assert(addr.address == "demo@mailsploit.com"); // Courtesy Mailsploit https://www.mailsploit.com addr = new MailboxAddress.from_rfc822_string("\"=?utf-8?Q?=42=45=47=49=4E=20=2F=20=28=7C=29=7C=3C=7C=3E=7C=40=7C=2C=7C=3B=7C=3A=7C=5C=7C=22=7C=2F=7C=5B=7C=5D=7C=3F=7C=2E=7C=3D=20=2F=20=00=20=50=41=53=53=45=44=20=4E=55=4C=4C=20=42=59=54=45=20=2F=20=0D=0A=20=50=41=53=53=45=44=20=43=52=4C=46=20=2F=20?==?utf-8?b?RU5E=?=\""); assert(addr.name == null); assert(addr.address == "BEGIN / (|)|<|>|@|,|;|:|\\|\"|/|[|]|?|.|= / ? PASSED NULL BYTE / \r\n PASSED CRLF / END"); + } catch (Error err) { + assert_not_reached(); + } + } - addr = new MailboxAddress.from_rfc822_string("=?UTF-8?Q?=22Firstname_=22=C2=AF\\=5F=28=E3=83=84=29=5F/=C2=AF=22_Lastname_via?==?UTF-8?Q?_Vendor=22_?="); + public void prepare_header_text_part() throws Error { + try { + // Test if prepare_header_text_part() can handle crappy input without grilling the CPU + MailboxAddress addr = new MailboxAddress.imap( + "=?UTF-8?Q?=22Firstname_=22=C2=AF\\=5F=28=E3=83=84=29=5F/=C2=AF=22_Lastname_via?==?UTF-8?Q?_Vendor=22_?=", + null, + "=?UTF-8?Q?=22Firstname_=22=C2=AF\\=5F=28=E3=83=84=29=5F/=C2=AF=22_Lastname_via?==?UTF-8?Q?_Vendor=22_?=", + "vendor.com"); + assert(addr.name == "\"Firstname \"¯_(ツ)_/¯\" Lastname via Vendor\" "); + assert(addr.mailbox == "\"Firstname \"¯_(ツ)_/¯\" Lastname via Vendor\" "); + + // A second test with the input that have been passed to prepare_header_text_part() by the pre-GMime3 tests + addr = new MailboxAddress.imap( + "\"Firstname \"¯_(ツ)_/¯\" Lastname via=?UTF-8?Q?_Vendor=22_", + null, + "system", + "vendor.com"); assert(addr.name == "Firstname ¯_(ツ)_/¯ Lastname via=?UTF-8?Q?_Vendor=22_"); - assert(addr.mailbox == "system"); - assert(addr.domain == "vendor.com"); } catch (Error err) { assert_not_reached(); } diff --git a/test/engine/rfc822-part-test.vala b/test/engine/rfc822-part-test.vala index b6e82e60..9ec2cabf 100644 --- a/test/engine/rfc822-part-test.vala +++ b/test/engine/rfc822-part-test.vala @@ -40,7 +40,10 @@ class Geary.RFC822.PartTest : TestCase { part.set_content_id(ID); part.set_content_description(DESC); part.set_content_disposition( - new GMime.ContentDisposition.from_string("inline") + GMime.ContentDisposition.parse( + Geary.RFC822.get_parser_options(), + "inline" + ) ); Part test = new Part(part); @@ -91,15 +94,18 @@ class Geary.RFC822.PartTest : TestCase { private GMime.Part new_part(string? mime_type, uint8[] body) { - GMime.Part part = new GMime.Part(); + GMime.Part part = new GMime.Part.with_type("text", "plain"); if (mime_type != null) { - part.set_content_type(new GMime.ContentType.from_string(mime_type)); + part.set_content_type(GMime.ContentType.parse( + Geary.RFC822.get_parser_options(), + mime_type + )); } GMime.DataWrapper body_wrapper = new GMime.DataWrapper.with_stream( new GMime.StreamMem.with_buffer(body), GMime.ContentEncoding.BINARY ); - part.set_content_object(body_wrapper); + part.set_content(body_wrapper); part.encode(GMime.EncodingConstraint.7BIT); return part; }