From 2e5b2bbb530b642dda56b332cfd93810ac415098 Mon Sep 17 00:00:00 2001 From: nobody Date: Tue, 1 Apr 2003 17:15:53 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'EVOLUTION_1_2_4'. svn path=/tags/EVOLUTION_1_2_4/; revision=20614 --- camel/ChangeLog | 1292 ++------------------ camel/Makefile.am | 46 +- camel/camel-filter-search.c | 29 +- camel/camel-folder-search.c | 27 +- camel/camel-mime-filter-canon.c | 6 +- camel/camel-mime-filter-tohtml.c | 573 +++++---- camel/camel-mime-filter-tohtml.h | 14 +- camel/camel-mime-part.c | 26 +- camel/camel-mime-utils.c | 177 +-- camel/camel-mime-utils.h | 4 +- camel/camel-multipart-signed.c | 5 +- camel/camel-sasl-gssapi.c | 10 + camel/camel-stream-filter.c | 4 +- camel/camel-tcp-stream-ssl.c | 103 +- camel/providers/imap/camel-imap-store-summary.c | 4 +- camel/providers/imap/camel-imap-store.c | 82 +- .../providers/sendmail/camel-sendmail-transport.c | 2 - camel/providers/smtp/camel-smtp-transport.c | 79 +- 18 files changed, 751 insertions(+), 1732 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index a7022b0cc7..5b1d2fef82 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,56 +1,8 @@ -2003-03-31 Jeffrey Stedfast +2003-03-28 Jeffrey Stedfast - * camel-mime-filter-enriched.c (enriched_to_html): Use strncasecmp - for matching the nofill and /nofill tags. Also fixed to handle - enriched tags that require tags. - -2003-03-28 Not Zed - - * providers/local/camel-spool-store.c (get_folder): remove unused - var. - - * providers/imap/camel-imap-utils.c (imap_parse_list_response): - moved an unused var to the #if 0'd out block. - - * providers/imap/camel-imap-store.c - (parse_list_response_as_folder_info): remove unused vars. - - * camel-index-control.c (main): deifne camel_init() before using - it. - - * camel-vee-store.c (vee_get_folder): removed unused var. - - * camel-stream-mem.c (stream_write): warning -> fixme. - - * camel-stream-filter.c (_CamelStreamFilterPrivate): Add a ; to - the end of the struct definition. - - * camel-store.c (camel_store_delete_folder): remove unused var. - (camel_store_rename_folder): " - (camel_store_unsubscribe_folder): " - - * camel-mime-part.c (write_to_stream): Changed warning into a - TODO. - (construct_from_parser): removed warning, the code was fixed. - - * camel-mime-message.c (construct_from_parser): Remove the - warning, the code was fixed. - - * camel-mime-filter-enriched.c (camel_mime_filter_enriched_new): - Remove unused var. - - * camel-medium.c (camel_medium_get_header): Removed warning, and - changed docs to reflect it. - - * camel-gpg-context.c (gpg_ctx_parse_status): handle MODE_EXPORT - as a noop (warning). - - * camel-folder.c (get_message_user_tag): changed a warning into a - fixme (its not that important). - (camel_folder_get_message_user_tag): " - - * camel-data-cache.c (data_cache_finalise): removed unused vars. - (data_cache_expire): " + * camel-sasl-gssapi.c (gssapi_challenge): If we are using the + heimdal krb5 implementation, don't free outbuf ever. Seems to + segfault if we do. 2003-03-27 Jeffrey Stedfast @@ -59,143 +11,27 @@ release the outbuf gss_buffer_t since it shouldn't be set. Also g_free (str) when we are done with it. - * camel-mime-utils.c (header_encode_phrase_merge_words): When we - remove a node from the list, make sure to g_list_free_1(). - (header_encode_phrase_merge_words): Don't use - CAMEL_FOLD_PREENCODED as the upper-bound for merged-word length if - the merged-word will not be an rfc2047 encoded word. Instead, use - CAMEL_FOLD_SIZE-8 (which is the value we use in other places for - determining upper-bound lengths). Solves bug #38659. - -2003-03-27 Dan Winship - - * camel-url.c (append_url_encoded): Like camel_url_encode, but - works directly on an existing GString. - (camel_url_to_string, output_param): Use it. - (camel_url_encode): Likewise. Remove "escape_unsafe" arg since the - "unsafe" chars are the ones that should *always* be escaped, and - the places we were passing FALSE were wrong. - (camel_url_decode): replace with a new version - - * camel-file-utils.c (camel_file_util_safe_filename): Remove extra - arg to camel_url_encode. - - * tests/misc/url.c (main): Add tests of basic URL parsing and - unparsing - -2003-03-28 Not Zed - - * - camel-mime-part-utils.c (simple_data_wrapper_construct_from_parser): - Do a more thorough check for html marked as text/plain. Check - that the text starts with * camel-sasl-gssapi.c (camel_sasl_gssapi_finalize): Pass in the - addresses of the second args to the delete/release functions. + address of the second args to the delete/release functions. Also + #define gss_nt_service_name when using heimdal. -2003-03-27 Not Zed - - * camel-object.c (camel_object_bag_list): Ignore whether or not - the bag is currently reserved. We'll miss the new potential - object, but only 1. Should address #40103. - -2003-03-25 Jeffrey Stedfast - - * camel-service.c (camel_gethostbyaddr): Don't use setv when we - don't need the stdarg interface. - (camel_gethostbyname): Same. +2003-03-25 Rodney Dawes + * camel-sasl-gssapi.c: #include for heimdal, fixed CFLAGS + 2003-03-24 Jeffrey Stedfast - * camel-folder-search.c (search_user_tag): This expression can - never return an array. We must always return a string value. - -2003-03-24 Timo Sirainen - - * camel-imap-command.c (imap_read_untagged) Integer overflow fix. - If server sent a huge literal length, only a few bytes of memory - was allocated to it, but server could write as much data there as - it wanted. - -2003-03-21 Jeffrey Stedfast - - Camel part of the fix for Lewing's bug #39204. Second half of the - patch should also fix it so that text/plain parts that are - detected as being text/html are rendered as html (not that I agree - with this mind you, but corporate customers want this "feature"). - - * camel-mime-part-utils.c - (simple_data_wrapper_construct_from_parser): If the part is - text/html and doesn't have a charset and we are able to find a - charset in the meta tags of the html content, set the charset - param on the content-type. - (camel_mime_part_construct_content_from_parser): After setting the - content object on the mime part, re-set the content-type of the - content object back to the one from the parser (as it may contain - changes from the original - see changes made to the ct in - simple_data_wrapper_construct_from_parser for details). - -2003-03-21 Jeffrey Stedfast - - * camel-tcp-stream-ssl.c (camel_certdb_nss_cert_get): continue - reading the cert file until we've read it all or get a non-EINTR - errno. - -2003-03-21 Jeffrey Stedfast - - * camel-sasl-gssapi.c: #include instead of - #include + * camel-sasl-gssapi.c: We don't want to #include instead. + #include in the heimdal case. 2003-03-20 Jeffrey Stedfast * camel-sasl.c: Plug in GSSAPI support. - * camel-sasl-gssapi.[c,h]: Various fixes to make it compile (fixed - type-o's mostly). - -2003-03-20 Dan Winship - - Handle raw 8-bit From data "correctly". (The same way we handle - raw 8-bit Subject data.) - - * camel-mime-utils.c (header_decode_mailbox): Take a charset arg - and pass it to header_decode_string. - (header_decode_address): Take a charset arg and pass it to - header_decode_mailbox. - (header_mailbox_decode): Likewise. - (header_address_decode): Take a charset arg and pass it to - header_decode_address. - - * camel-folder-summary.c (summary_format_address): Take a charset - arg and pass to header_address_decode. - (message_info_new, camel_message_info_new_from_header): Pass - charset to summary_format_address - - * camel-internet-address.c (internet_decode): Update for - header_address_decode change. (Unfortunately we don't have a - charset to pass here.) - - * camel-mime-message.c (camel_mime_message_build_mbox_from): Move - this here from camel-mbox-summary since the same functionality is - needed by evolution-mail too (and update for header_address_decode - change) - - * providers/local/camel-mbox-summary.c - (camel_mbox_summary_build_from): Moved to CamelMimeMessage - -2003-03-17 Jeffrey Stedfast - - * camel-mime-part.c (process_header): Removed unused variable left - over from my previous fix. - - * providers/smtp/camel-smtp-transport.c (smtp_send_to): Don't pass - 'has_8bit_parts' to smtp_data() anymore. - (smtp_data): No longer takes 'has_8bit_parts' argument. Ignore - whether or not the message has 8bit parts when deciding what the - required encoding type we need to enforce. Fixes bug #39744. + * camel-sasl-gssapi.[c,h]: New source files implementing GSSAPI. 2003-03-13 Jeffrey Stedfast @@ -210,160 +46,12 @@ mailer uses "@@@%d" as a fake content-id value for parts without content-ids) and don't allow for invalid content-type chars. -2003-03-13 Jeffrey Stedfast - - * camel-folder.c (get_uids): Don't add bogus uids to the uid - array. Might fix bug #38868 (it's the only way I can figure that - camel_folder_get_message_info() could possibly return NULL for the - Outbox folder). - -2003-03-12 Not Zed - - * camel-object.c (remove_bag): removed, it was double-freeing the - key. - (save_object): Just save the object in an array. - (camel_object_bag_destroy): first save the object bag's objects in - a list, then remove them one at a time from the bag since we can't - remove hash table entries while we're in a foreach (PITA glib - shit). For #39486. - (camel_object_bag_*): killed some warnings. - -2003-03-09 Jeffrey Stedfast - - * camel-url-scanner.c (camel_url_addrspec_end): Doh! If inptr == - pos + 1, then return FALSE (before it was checking for inptr == - pos, but it will never be pos). - -2003-03-07 Not Zed - - * camel-vee-folder.c (vee_search_by_expression): handle a null - return from search_by_expression, for bug #33786. - -2003-03-06 Jeffrey Stedfast - - * providers/imap/camel-imap-utils.c (imap_next_word): - s/g_strncasecmp/strncasecmp/g - - * camel-iconv.c: Updated to be an exact copy of e-iconv (except - names changed). We don't use this yet, but we may in the future. - - * camel-url.c (camel_url_new_with_base): Here too. - - * camel-sasl-kerberos4.c (krb4_challenge): Use camel_strdown() - here instead of g_strdown() since the latter has been deprecated. - - * providers/imap/camel-imap-utils.c (imap_parse_body): Use - camel_strdown() since g_ascii_strdown() does not do what we - thought. - - * providers/imap/camel-imap-store.c: - s/strstrcase/camel_strstrcase/g - - * providers/imap/camel-imap-folder.c (do_append): - s/strstrcase/camel_strstrcase/ - (handle_copyuid): Same. - - * string-utils.c (camel_strdown): New function because the - g_ascii_strdown interface sucks. - (camel_strstrcase): Renamed from strstrcase. - -2003-03-06 Jeffrey Stedfast - - * camel-text-index.c (camel_utf8_next): Same as below. - - * camel-search-private.c (camel_utf8_getc): Updated since not all - platforms/compiles support __inline__. - -2003-03-06 Jeffrey Stedfast - - * camel-mime-part.c (camel_mime_part_get_encoding): Get rid of the - const return - it mismatches the prototype and we don't need it - anyway. Fixes bug #39173. - -2003-03-06 Jeffrey Stedfast - - Fixes for bug #39170 - - * camel-store-summary.c (camel_store_info_set_string): Remove - return keyword. - - * camel-session.c (camel_session_thread_msg_free): Remove return - keyword. - (camel_session_thread_wait): Same. - - * camel-index.c (camel_index_cursor_reset): Remove return keyword. - -2003-03-06 Jeffrey Stedfast - - Fixes for bug #39168 - - * providers/local/camel-spool-summary.c: Get rid of the empty - private struct. - - * providers/local/camel-mbox-summary.c: Get rid of the empty - private struct. - - * camel-vee-store.c: Get rid of the empty private struct. - - * camel-mime-filter-from.c: Get rid of the empty private struct. - 2003-03-05 Jeffrey Stedfast * providers/sendmail/camel-sendmail-transport.c (sendmail_send_to): Add a CRLF filter to the output stream to convert any CRLF sequences into plain old line-feeds to work - around a bug in some local transport programs. - -2003-03-04 Jeffrey Stedfast - - * camel-object.h: s/class/klass in one place so that the header is - c++-safe. - -2003-03-03 Jeffrey Stedfast - - * camel-tcp-stream-openssl.c (camel_tcp_stream_ssl_new): Updated - to use the new API from a fe commits ago for the NSS stream. This - is just to make it compile, but does not update the behaviour to - act like the NSS stream. Note that people shouldn't be using - OpenSSL anyway. - (camel_tcp_stream_ssl_new_raw): Same. - - * camel-process.[c,h]: New source file containing convenience - functions for process creation/termination mainly for use with - Pipe filters but should be usable for anything we want. - - * camel-io.[c,h]: New source files implementing read/write system - calls with proper error checking and cancellation - (ie. StreamFs::read/write and CamelTcpStreamRaw::read/write). No - sense duplicating the same code over and over. Now I can use this - same code easily in other i/o code (such as Pipe filters and gpg - code?). - -2003-03-03 Not Zed - - * camel-store.c (camel_store_unsubscribe_folder): Do similar - folder != NULL checking as for delete_folder before passing a NULL - to object_bag_remove. - -2003-02-28 Jeffrey Stedfast - - * camel-http-stream.c (http_connect): Here too. - - * providers/smtp/camel-smtp-transport.c (connect_to_server): Same - as IMAP and POP. - - * providers/imap/camel-imap-store.c (connect_to_server): Same as - the POP3 code. - - * providers/pop3/camel-pop3-store.c (connect_to_server): Pass in - appropriate flags for camel_tcp_stream_ssl_new*() functions. - - * camel-tcp-stream-ssl.c (enable_ssl): Not all ssl/tls streams - will want to allow each of SSLv2, SSLv3 and TLSv1 so use flags to - decide which to enable/disable. - (camel_tcp_stream_ssl_new): Now takes a flags argument to mask out - which SSL/TLS versions the stream should be compatable with. - (camel_tcp_stream_ssl_new_raw): Same. + around a bug in some local transport programs. Fixes bug #39138. 2003-02-27 Jeffrey Stedfast @@ -381,388 +69,28 @@ \n before the boundary really belongs to the boundary anyway) so #if 0 this code out for now. -2003-02-27 Not Zed - - * camel-multipart-signed.c: Undo jeff's changes. - - * providers/local/camel-spool-store.c (scan_dir): Fix a paste-o in - the object_bag_get key. - -2003-02-26 Jeffrey Stedfast - - * camel-multipart-signed.c: Updated to use g_alloca instead of - alloca so that we can skip all the #ifdef checks and skip checking - for alloca in configure.in and all that foo. - - * camel-store.c (camel_store_delete_folder): Make sure the folder - is non-NULL before trying to remove it from the store's - object-bag. - -2003-02-25 Jeffrey Stedfast - - * camel-mime-part-utils.c - (simple_data_wrapper_construct_from_parser): canonicalise the - charset name (if it is an iso charset) so that our strncasecmp to - see if it is an iso-8859-# charset will be guarenteed to work on - all systems. - (canon_charset_name): New function to return the canonical iso - charset name. - (simple_data_wrapper_construct_from_parser): If the charset is - NULL *or* the charset == "us-ascii" then check that it is 7bit - clean to decide if it is rawtext (we did not check the case where - charset was "us-ascii" before). - -2003-02-25 Jeffrey Stedfast - - * camel-mime-message.c: Same as the ones below. - - * camel-mime-part.c: Reverted back to pre-camel-iconv - - * camel-filter-search.c: Same as below. - - * camel-folder-summary.c: Reverted back to pre-camel-iconv - - * camel.c (camel_init): Reverted to pre-camel-iconv - - * camel-charset-map.c (camel_charset_locale_name): Removed (part - of the revert). - (camel_charset_canonical_name): Same. - - * camel-mime-filter-charset.c: Revert back to using e_iconv from GAL. - - * camel-mime-part-utils.c: Revert back to using e_iconv from GAL. - - * camel-mime-utils.c: Revert back to using e_iconv from GAL. - - * camel-sasl-digest-md5.c: Revert back to using e-iconv from GAL. - -2003-02-24 Jeffrey Stedfast - - * camel-charset-map.c (camel_charset_canonical_name): g_alloca - (strlen (charset) + 1) so we don't overflow the buffer. - - * providers/pop3/camel-pop3-stream.c (stream_write): Don't write - the passwd, fixes "bug" #38601. - - * camel-iconv.c: Make bucket->refcount 31 bits and bucket->used 1 - bit instead of having each use their own 32bit int. - (iconv_cache_bucket_expire): Use g_iconv_close() here, missed this - before. - (camel_iconv): Might as well call g_iconv here even though it just - calls iconv directly. - -2003-02-21 Jeffrey Stedfast - - * camel-iconv.c (camel_iconv_charset_name): New function...back - from the depths of hell from whence it came originally. Turns out - that g_iconv_open() is lame and can't handle all the stuff we used - to handle in e_iconv_charset_name(). - (camel_iconv_open): Use camel_iconv_charset_name() on the to/from - charsets rather than camel_charset_canonical_name(). Now maybe - g_iconv_open will work for charsets such as "ks_c_5601-1987". - - * providers/pop3/camel-pop3-store.c (pop3_connect): Reget the - capabilities after a successful authentication. - - * providers/pop3/camel-pop3-engine.c (get_capabilities): If we are - in the TRANSACTION state and CAPA did not list UIDL as a supported - command, try checking for it the hard way. - -2003-02-23 Jeffrey Stedfast - - * providers/smtp/camel-smtp-transport.c (smtp_data): Do it the - same way we just made the sendmail code do it. - - * providers/sendmail/camel-sendmail-transport.c - (sendmail_send_to): My last change but in a better way. - 2003-02-22 Jeffrey Stedfast - * providers/smtp/camel-smtp-transport.c (smtp_data): Remove all - Bcc headers before sending to the smtp server. - * providers/sendmail/camel-sendmail-transport.c (sendmail_send_to): Remove all Bcc headers before sending to - sendmail. - -2003-02-20 Jeffrey Stedfast - - * camel.c (camel_init): Call camel_iconv_init(). - (camel_shutdown): Call camel_iconv_shutdown(). - - * camel-sasl-digest-md5.c (digest_response): Updated to use - camel-iconv and the new camel-charset-map functions. - - * camel-mime-utils.c: Updated to use camel-iconv and the new - camel-charset-map functions. - - * camel-mime-part-utils.c (check_html_charset): Use - camel_charset_canonical_name() instead of e_iconv_charset_name() - which is longer available. - (convert_buffer): Use camel-iconv. - (simple_data_wrapper_construct_from_parser): Since - camel_charset_iso_to_windows() returns the charset in it's - canonical format, no need to re-canonicalise it. - - * camel-mime-part.c (process_header): Use - camel_charset_canonical_name() instead of e_iconv_charset_name() - which is longer available. - - * camel-mime-message.c (process_header): Use - camel_charset_canonical_name() instead of e_iconv_charset_name() - which is longer available. - - * camel-mime-filter-charset.c: Use camel-iconv. - - * camel-folder-summary.c (message_info_new): Use - camel_charset_canonical_name() instead of e_iconv_charset_name() - which is longer available. - (content_info_new): Use camel_charset_locale_name(). - (camel_message_info_new_from_header): Same as message_info_new(). - - * camel-search-private.c: Use g_alloca() instead of alloca(). - - * camel-filter-search.c (check_header): Use - camel_charset_canonical_name() instead of e_iconv_charset_name() - which is longer available. - - * camel-charset-map.c (camel_charset_locale_name): New function, - replaces e_iconv_locale_charset(). - (camel_charset_canonical_name): New function, similar to - e_iconv_charset_name() but instead of returning the iconv-friendly - name, it returns the canonical name. (g_iconv will do the - iconv-friendly name conversions for us). - -2003-02-20 Jeffrey Stedfast - - * camel-filter-search.c (run_command): Redirect program's stdout - and stderr to /dev/null - - * camel-filter-driver.c (pipe_to_system): Redirect the program's - stderr to /dev/null - (pipe_to_system): Write the pipe to a mem stream and use the mem - stream in the parser. Also, when setting an exception get the - errno from the parser so we can give more info about the error to - the user. + sendmail and restore them after it has been sent. 2003-02-19 Jeffrey Stedfast * camel-tcp-stream-ssl.c (stream_connect): Fixed a type-o in the ENABLE_IPv6 ifdef section. -2003-02-19 Jeffrey Stedfast - - * camel-filter-driver.c (pipe_message): New filter action that - pipes the message source to the user-program and reads back the - modified message and replaces driver->priv->message with the new - message object. - (do_copy): Check p->modified to make sure the message hasn't been - modified by the pipe-message action - if it has been modified, - default to the slower camel_folder_append_message() way of - copying. - (do_move): Same. - (pipe_to_system): Set p->modified to TRUE if the user-program gave - us back a message stream and we were able to parse it. - (camel_filter_driver_filter_message): If the message has been - modified, always use camel_folder_append_message() when appending - it to the default folder. - 2003-02-14 Jeffrey Stedfast * camel-folder-search.c: Added a (get-size ) function to fix bug #38073. (search_get_size): Implemented. -2003-02-14 Jeffrey Stedfast - - * camel-url-scanner.c (url_scanner_table_init): Mark chars with - the high-bit set as CTRL chars. - (camel_url_web_end): If the char before the start of the url is an - open-brace, watch out for the matching close-brace. - (camel_url_file_end): Same. - -2003-02-14 Jeffrey Stedfast - - * camel-smime-context.c (smime_get_password): Same as the gpg and - pkcs7 contexts. - - * camel-sasl-popb4smtp.c (popb4smtp_challenge): Updated for - camel_session_get_password(). - - * camel-pkcs7-context.c (get_password): Same as the gpg code. - - * camel-gpg-context.c (gpg_ctx_parse_status): Updated for - camel_session_get_password(). - - * providers/smtp/camel-smtp-transport.c (smtp_connect): No need to - set USER_CANCEL exception here as it is done by - camel_session_get_password(). Also updated for the new - get_password() API change. - - * providers/imap/camel-imap-store.c (imap_auth_loop): Updated for - camel_session_get_password() changes. We don't need to play the - "bad passwd" game here too, do we? Bah, probably should but I - don't feel like it for now. Maybe when we rewrite the IMAP - provider. - - * camel-session.c (camel_session_get_password): Now takes a - 'reprompt' argument that will force user-input to be given even if - we have the passwd cached. - - * providers/pop3/camel-pop3-store.c (pop3_connect): Instead of - uncaching the passwd after we receive a -ERR from the POP server, - set 'reprompt' to TRUE to force user-input for the next password - prompt (ie, make sure the front-end knows not to just return the - cached value). The front-end can then decide to fill-in the - user-input field with the last passwd that the user supplied. - (pop3_try_authenticate): Now takes a reprompt argument which we - pass into camel_session_get_password(). - -2003-02-05 Dan Winship - - * Makefile.am (libcamelincludedir): Define in terms of - privincludedir. - (camellibexecdir): Define in terms of privlibexecdir - (libcamel_la_LDFLAGS): Remove -rpath. (automake will add that) - - * providers/imap/Makefile.am (libcamelimapincludedir): Define in - terms of privincludedir. - (INCLUDES): Remove -I$(includedir) - * providers/local/Makefile.am: Likewise - * providers/nntp/Makefile.am: Likewise - * providers/pop3/Makefile.am: Likewise - * providers/sendmail/Makefile.am: Likewise - * providers/smtp/Makefile.am: Likewise - -2003-02-04 Not Zed - - * camel-object.c (camel_object_bag_new): Init bag->owner to 0. - -2003-01-31 Not Zed - - * camel-object.c (camel_object_bag_*): Changed to use a posix - semaphore instead of a condition variable + flag to reserve the - object bag because e_mutex_cond is broken. - -2003-02-04 Jeffrey Stedfast - - * providers/imap/camel-imap-utils.c (imap_parse_body): Use - g_ascii_strdown() instead of g_strdown, since g_strdown is - deprecated. - (imap_parse_body): Same. - - * providers/imap/camel-imap-folder.c (decode_internaldate): Use - strncasecmp() here too. - (parse_fetch_response): And here. - (camel_imap_folder_selected): Here too. - - * providers/imap/camel-imap-utils.c (imap_namespace_decode): Use - strncasecmp() instead of g_strncasecmp() because the latter is - deprecated. - - * providers/imap/camel-imap-store.c (imap_get_capability): Again here. - (hash_folder_name): Here too. - (compare_folder_name): And here. - (get_folder_online): Again. - (get_folder_offline): And again. - - * providers/imap/camel-imap-folder.c (camel_imap_folder_selected): - Same as below again. - - * providers/imap/camel-imap-command.c (camel_imap_response_free): - Same as below. - - * providers/smtp/camel-smtp-transport.c (smtp_data): Use - strcasecmp() because g_strcasecmp() is deprecated. - - * camel-url.c (camel_url_new_with_base): Use g_ascii_strdown() - instead of g_strdown, since g_strdown is deprecated. - -2003-01-28 Jeffrey Stedfast - - * camel-sasl-gssapi.c (gssapi_challenge): Pass in some default - flags to gss_init_sec_context() (these default flags are defined - as a MUST in rfc1964). - -2003-01-22 Hans Petter Jansson - - * Makefile.am: $(libexec) -> $(libexecdir) - -2003-01-22 Ettore Perazzoli - - * providers/imap/Makefile.am (libcamelimapincludedir): Update to - the new $(BASE_VERSION)-versioned path. - * providers/smtp/Makefile.am (libcamelsmtpincludedir): Likewise. - * providers/sendmail/Makefile.am (libcamelsendmailincludedir): - Likewise. - * providers/pop3/Makefile.am (libcamelpop3includedir): Likewise. - * providers/nntp/Makefile.am (libcamelnntpincludedir): Likewise. - * providers/local/Makefile.am (libcamellocalincludedir): Likewise. - - * camel-lock-client.c (camel_lock_helper_init): Use - CAMEL_LIBEXECDIR instead of CAMEL_SBINDIR to find - camel-lock-helper. - - * Makefile.am: Install camel-lock-helper and camel-index-control - in $(libexec)/evolution/$(BASE_VERSION)/camel. Install - libcamel.la in $privlibdir. - (install-exec-hook): Update for the new location of - camel-lock-helper. - (libcamelincludedir): Version using $(BASE_VERSION). - (INCLUDES): Define CAMEL_LIBEXECDIR. - -2003-01-21 Jeffrey Stedfast +2003-01-06 Jeffrey Stedfast * camel-mime-filter-canon.c (complete): Set the backbuflen to 0 so that calling us again won't re-flush the same data. -2003-01-17 Larry Ewing - - * camel-mime-filter-enriched.c (enriched_to_html): only grow the - buffer when we are out of space. - -2003-01-14 Not Zed - - * camel-mime-parser.c (folder_scan_step): If we have no - content-type header, set it to text/plain explcitly, rather than - NULL, because some code doesn't handle NULL. - -2003-01-14 Jeffrey Stedfast - - * camel-sasl-gssapi.[c,h]: New source files implementing the - GSSAPI SASL mechanism. - -2003-01-13 Not Zed - - * camel-mime-filter-tohtml.c: fix header include order. - - * camel-object.c (camel_object_bag_reserve): Add an assert to - check we're not trying to reserve the bag more than once in a - given thread. - (camel_object_bag_list): If we have reserved the bag, dont try and - cond wait. Fixes a deadlock. - - * camel-mime-filter-tohtml.c (writeln): Read the characters as - utf8, rather than as 8 bit bytes. Remove the PRESERVE_8BIT as it - has no meaning. Also change the default logic slightly so that 8 - bit or greater characters are properly converted to entities. - - * camel-utf8.c (camel_utf8_getc_limit): new function, gets a utf8 - char, bounded by an end pointer. - -2003-01-07 Dan Winship - - * camel-provider.h (CamelProvider): add a "translation_domain" - field. (NULL for all providers in the camel source tree itself). - - * camel-session.c (register_provider): Translate provider strings - in the correct domain - -2003-01-06 Not Zed - - * camel-store.c (store_sync): init local exception before doing - anything. fixes a crash. - 2003-01-04 Jeffrey Stedfast * providers/smtp/camel-smtp-transport.c (smtp_send_to): Instead of @@ -770,51 +98,6 @@ (recipients) != 0 since it is illegal for recipients to be NULL (camel_transport_send_to already checks this). -2002-12-17 Jeffrey Stedfast - - * providers/imap/camel-imap-utils.c: Replace calls to - g_string_sprintfa() with g_string_append_printf() since the former - seems to have been deprecated. - - * providers/imap/camel-imap-search.c: Same. - - * providers/imap/camel-imap-folder.c: Here too. - - * providers/local/camel-mbox-summary.c: And here. - - * providers/local/camel-local-summary.c: Replace - g_string_sprintf() with g_string_printf(). - - * camel-data-cache.c (data_cache_expire): Replace - g_string_sprintf() with g_string_printf(). - - * camel-url.c: Replace calls to g_string_sprintfa() with - g_string_append_printf() since the former seems to have been - deprecated. - - * camel-service.c: Same. - - * camel-mime-utils.c: Here too. - -2002-12-16 Jeffrey Stedfast - - * camel-mime-part-utils.c - (simple_data_wrapper_construct_from_parser): Detect text/html - parts that were marked as text/plain and re-tag them as text/html - parts. Note: currently just checks if the first non-lwsp char is a - '<' - but we might need to be smarter about this? *sigh* Stupid - Windows mailers. - - * camel-mime-filter-tohtml.c (camel_text_to_html): New convenience - function to replace calls to e_text_to_html() in the - mailer/composer etc. - - * camel.h: #include some headers we had forgotten to add - previously, also added camel-mime-filter-enriched.h. - - * camel-mime-filter-enriched.[c,h]: New stream filter to convert - text/enriched and text/richtext into HTML. - 2002-12-15 Jeffrey Stedfast * camel-multipart-signed.c (camel_multipart_signed_verify): Don't @@ -822,119 +105,12 @@ raw data we received (all we want to do is convert o the canonical CRLF format). -2002-12-10 Jeffrey Stedfast - - * camel-mime-filter-tohtml.c (html_convert): Use camel-url-scanner - instead of regex. - -2002-12-09 Jeffrey Stedfast - - * camel-url-scanner.c (camel_url_addrspec_end): Fixed to not be - fooled in the case where the address is followed immediately by a - period. - (camel_url_web_end): Made more robust. - (camel_url_scanner_scan): Oops. We need to set the match->pattern - string pointer to the correct pattern before executing the - start/end methods (as some of them rely on this info). - -2002-12-09 Jeffrey Stedfast - - * camel-url-scanner.c: New code to scan for patterns (used only - for url pattern matching atm, but we may find other uses for this - and thus rename it? I dunno). Uses ETrie. - -2002-12-07 Not Zed - - * camel-data-cache.c (data_cache_init): Use a bag instead of a - hashtable to track the cache streams. - (data_cache_finalise): Same. - (free_busy): No longer needed. - (data_cache_expire): use bag instead of hashtable. - (stream_finalised): No longer required. - (camel_data_cache_add): objectbagise - (camel_data_cache_get): " - (camel_data_cache_remove): " - (data_cache_path): Set the now expired date before running expiry, - so it plays better with multiple threads. Still a couple of - harmless races. - -2002-12-06 Not Zed - - * providers/local/camel-spool-store.c (scan_dir): folders -> - object bag. - (get_folder_info_mbox): folders -> object bag. - - * providers/local/camel-mh-store.c (folder_info_new): folders -> - object bag. - - * providers/local/camel-maildir-store.c (scan_dir): folders -> - object bag. - - * providers/local/camel-local-store.c (rename_folder): folders -> - object bag. - - * camel-private.h (CamelStorePrivate): Remove 'cache' lock, - handled by the objectbag. - - * providers/imap/camel-imap-store.c (copy_folder): Removed. - (imap_store_refresh_folders): folders -> object bag. - (get_folder_counts): folders -> object bag. - - * camel-vee-store.c (vee_get_folder): changes for folders - objectbag. - (vee_get_folder_info): Change to use folders objectbag. Also, - dont refresh the base folder if we're in FAST mode. - (build_info): Removed, no longer needed. - (vee_rename_folder): Fixed for folders objectbag. - - * camel-store.c (camel_store_init): init the folders objectbag. - (camel_store_finalize): Destroy the folders object bag. - (folder_matches): - (folder_finalize): Removed, now handled implicitly by the - objectbag. - (camel_store_get_folder): object bag changes. - (camel_store_delete_folder): " - (get_subfolders): Removed, now handled without a callback. - (camel_store_rename_folder): Changed to use object bag of folders. - (trash_add_folder): Removed. - (init_trash): use folders object bag. - (copy_folder_cache): - (sync_folder): Removed, no longer needed. Weird arsed code anyway. - (store_sync): Use folder object bag instead of hashtable. - (camel_store_unsubscribe_folder): " - (camel_store_init): remove cache_lock init, no longer used. - (camel_store_finalize): Same for cleanup. - -2002-12-05 Not Zed - - * camel-store.h (struct _CamelStore): change folders from a - hashtable into a CamelObjectBag. - - * camel-object.c (camel_object_ref): Use type_lock instead of - class lock for ref counting. - (camel_object_unref): Use type_lock instead of class lock for - unref. - (camel_object_unref): If the object is 'bagged', then also look - hooks, and remove it from any bags. - (camel_object_bag_new): - (camel_object_bag_destroy): - (camel_object_bag_add): - (camel_object_bag_get): - (camel_object_bag_remove_unlocked): - (camel_object_bag_list): - (camel_object_bag_abort): - (camel_object_bag_remove): New functions to implement a utility - object which can manage a 'bag' of weakly ref'd children in an - atomic & threadsafe way. - -2002-12-04 Jeffrey Stedfast +2002-12-03 Jeffrey Stedfast * providers/imap/camel-imap-store-summary.c (camel_imap_store_summary_add_from_full): Properly handle the case where the namespace is "". Fixes bug #34975 -2002-12-03 Jeffrey Stedfast - * broken-date-parser.c (get_tzone): Fixed to not get false positives when the token is shorter than the actual timezone string (but matches the first little bit of it). @@ -942,36 +118,24 @@ token is a special char (such as a '-') that is also used as a token delimiter. -2002-11-21 Jeffrey Stedfast - - * camel-tcp-stream-ssl.c (stream_read): Use the new - camel_operation_cancel_prfd() function to get the cancellation fd - so we can poll on it for cancellation stuff. - (stream_write): Same. - 2002-11-22 Not Zed * camel-operation.c (camel_operation_cancel_prfd): Implement, gets a nspr pr filedesc to poll/wait on (struct _CamelOperation): include a pr filedesc. -2002-11-21 Not Zed +2002-11-21 Jeffrey Stedfast - * providers/imap/camel-imap-store-summary.c - (camel_imap_store_summary_namespace_find_path): If we have a - namespace of "", then always match any path. - (camel_imap_store_summary_namespace_find_full): Same, for full - names. Should address #33309 & friends. + * camel-tcp-stream-ssl.c (stream_read): Use the new + camel_operation_cancel_prfd() function to get the cancellation fd + so we can poll on it for cancellation stuff. + (stream_write): Same. 2002-11-19 Radek Doulik * camel-mime-filter-tohtml.c (html_convert): added CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT flag -2002-11-18 Rodney Dawes - - * tests/*/Makefile.am: Removed $(GNOME_LIBDIR) and $(GNOMEUI_LIBS) - 2002-11-15 Jeffrey Stedfast * providers/imap/camel-imap-store.c (imap_connect_online): If the @@ -980,255 +144,6 @@ not returned in the response or if the folder flags contain \NoSelect, subscribe to INBOX and then try LSUB again. -2002-11-11 Jeffrey Stedfast - - * camel-mime-filter-tohtml.c (html_convert): Rewritten. Much much - much cleaner implementation now, though uses malloc/free more - often than I'd like. - -2002-11-11 Jeffrey Stedfast - - * providers/imap/camel-imap-folder.c (get_message_simple): Use - g_strerror when setting an exception string (we need it to be in - UTF-8). - - * providers/pop3/camel-pop3-store.c (pop3_try_authenticate): Use - g_strerror when setting an exception string (we need it to be in - UTF-8). - - * providers/pop3/camel-pop3-folder.c (pop3_refresh_info): Use - g_strerror when setting an exception string (we need it to be in - UTF-8). - (pop3_get_message): Same. - - * providers/local/camel-spool-summary.c (spool_summary_sync_full): - Use g_strerror when setting an exception string (we need it to be - in UTF-8). - (spool_summary_check): Here too. - - * providers/local/camel-spool-store.c (construct): Use g_strerror - when setting an exception string (we need it to be in UTF-8). - (get_folder): Same. - (scan_dir): Here too. - - * providers/local/camel-spool-folder.c (spool_lock): Use - g_strerror when setting an exception string (we need it to be in - UTF-8). - - * providers/local/camel-mh-summary.c (mh_summary_check): Use - g_strerror when setting an exception string (we need it to be in - UTF-8). - - * providers/local/camel-mh-store.c (delete_folder): Use g_strerror - when setting an exception string (we need it to be in UTF-8). - - * providers/local/camel-mbox-summary.c (summary_update): Use - g_strerror when setting an exception string (we need it to be in - UTF-8). - (mbox_summary_sync_full): Here too. - (mbox_summary_sync_quick): Same. - (mbox_summary_sync): Also here. - (camel_mbox_summary_sync_mbox): Again here. - - * providers/local/camel-mbox-folder.c (mbox_lock): Use g_strerror - when setting an exception string (we need it to be in UTF-8). - (mbox_append_message): Same. - (mbox_get_message): Here too. - - * providers/local/camel-maildir-summary.c (maildir_summary_load): - Use g_strerror when setting an exception string (we need it to be - in UTF-8). - (maildir_summary_check): Same. - - * providers/local/camel-maildir-store.c (get_folder): Use - g_strerror when setting an exception string (we need it to be in - UTF-8). - (delete_folder): Same. - (delete_folder): Here too. - - * providers/local/camel-local-summary.c (local_summary_sync): Use - g_strerror when setting an exception string (we need it to be in - UTF-8). - - * providers/local/camel-local-store.c (get_folder): Use g_strerror - when setting an exception string (we need it to be in UTF-8). - (create_folder): Same. - (xrename): Here too. - (rename_folder): And here. - (delete_folder): Also here. - - * camel-provider.c (camel_provider_init): For debugging printfs, - we want to use normal strerror (we want locale charset, not - UTF-8). - - * camel-movemail.c (camel_movemail): Use g_strerror when setting - an exception string (we need it to be in UTF-8). - (movemail_external): Same. - (camel_movemail_copy_file): Here too. - (camel_movemail_solaris): Also here. - - * camel-mime-utils.c (rfc2047_decode_word): For debugging printfs, - we want to use normal strerror (we want locale charset, not - UTF-8). - (header_encode_param): Same. - - * camel-mime-part-utils.c (convert_buffer): For debugging printfs, - we want to use normal strerror (we want locale charset, not - UTF-8). - - * camel-lock-client.c (camel_lock_helper_init): Use g_strerror - when setting an exception string (we need it to be in UTF-8). - - * camel-data-cache.c (camel_data_cache_remove): Use g_strerror - when setting an exception string (we need it to be in UTF-8). - - * camel-tcp-stream-raw.c (flaky_tcp_write): For debugging printfs, - we want to use normal strerror (we want locale charset, not - UTF-8). - (flaky_tcp_read): Same. - - * camel-gpg-context.c (gpg_ctx_op_step): For debugging printfs, we - want to use normal strerror (we want locale charset, not UTF-8). - - * camel-service.c (camel_gethostbyname): Use g_strerror when - setting an exception string (we need it to be in UTF-8). - - * camel-lock.c (camel_lock_dot): Use g_strerror when setting an - exception string (we need it to be in UTF-8). - (camel_lock_fcntl): Same. - -2002-11-07 Not Zed - - * camel-mime-part.c (camel_mime_part_set_content_type): constify - the content_type. - -2002-11-07 Jeffrey Stedfast - - * camel-i18n.h: Added. - - * camel-object.h: #include camel-i18n.h instead of gnome-i18n.h - - * camel-lock.c: Same. - -2002-11-07 Rodrigo Moya - - * camel-object.h: removed gnome-defs.h, it does not exist. - -2002-11-05 Not Zed - - * Makefile.am (camel_lock_helper_LDADD): Created temporary link - list, we need to link with something for gettext. - - * camel.h: Remove gstring-util.h and hash-table-utils.h. - - * camel-text-index.c: - (text_index_normalise): Changed for g_utf8_strdown api change. - - * camel-search-private.c: - * camel-mime-utils.c: - * camel-mime-part-utils.c: - * camel-html-parser.c: - * camel-charset-map.c: Include glib/gunicode.h from glib instead - of gal. - - * camel-filter-driver.c: Remove include of gtk/gtk.h, should never - have been there. - -2002-11-01 Jeffrey Stedfast - - * camel-mime-utils.c (g_string_append_len): Removed. Glib2 has - this function. - - * providers/local/camel-local-store.c (delete_folder): Use - g_path_get_basename instead of g_strdup (g_basename (filename)). - - * camel-uid-cache.c (camel_uid_cache_new): Use g_path_get_dirname - since g_dirname has been deprecated. - -2002-10-31 Jeffrey Stedfast - - * camel-gpg-context.c (camel_gpg_context_class_init): Set the - virtual method pointers to the import/export methods. - (camel_gpg_context_init): Set the key_protocol string. - (gpg_hash_to_id): Handle 2 more hash types. - (gpg_id_to_hash): Same. - (gpg_ctx_op_step): Slight fixes to support import/export. - (gpg_ctx_parse_status): Fix to hack around the fact that importing - keys doesn't write to stdout. - (gpg_import_keys): Implemented. - (gpg_export_keys): Implemented. - - * camel-cipher-context.c (camel_cipher_context_class_init): Hook - up default virtual methods for import/export. - (camel_cipher_import_keys): Implemented. - (camel_cipher_export_keys): Implemented. - -2002-10-31 Jeffrey Stedfast - - * Makefile.am: Removed hash-table-utils.[c,h] from the build. - - * hash-table-utils.[c,h]: Removed. - - * string-util.c: Imported g_strcase[hash,equal] into here so we - can remove hash-table-utils.[c,h]. - - * camel-medium.c: Removed #include "hash-table-utils.h" - - * camel-mime-message.c: Same here. - - * camel-mime-part.c: And here. - - * camel-session.c: Here too. - - * providers/imap/camel-imap-store-summary.c: #include - string-utils.h instead of hash-table-utils.h - - * camel-charset-map.c: Same. - - * camel-folder-summary.c: Here too. - - * camel-provider.c: Again here. - - * camel-store-summary.c: And again... - -2002-10-31 Jeffrey Stedfast - - Remove a ton of useless snot. - - * Makefile.am: Remove gstring-util.[c,h] from the build. - - * gstring-util.[c,h]: Removed. - - * string-utils.c (string_equal_for_glist): Removed. - (string_split): Removed. - (string_trim): Removed. - (string_prefix): Removed. - (string_unquote): Removed. - (strip): Removed. - - * hash-table-utils.c (g_hash_table_generic_free): Removed. - - g_str[n]casecmp functions are deprecated in glib2. - - * string-utils.c (strstrcase): Use strncasecmp instead of - g_strncasecmp. - - * hash-table-utils.c (g_strcase_equal): Use strcasecmp - instead of g_strcasecmp. - - * camel-smime-utils.c (camel_smime_is_smime_v3_signed): Same. - (camel_smime_is_smime_v3_encrypted): Here too. - - * camel-sasl-digest-md5.c (decode_data_type): And here. - (parse_server_challenge): Again here. - - * camel-pgp-mime.c (camel_pgp_mime_is_rfc2015_signed): Same. - (camel_pgp_mime_is_rfc2015_encrypted): Same - - * camel-mime-part-utils.c (check_html_charset): Here too. - - * camel-folder-summary.c (camel_system_flag): Same. - 2002-10-25 Jeffrey Stedfast * camel-gpg-context.c (gpg_ctx_parse_status): Don't prematurely @@ -1589,7 +504,7 @@ * camel-filter-search.c (camel_filter_search_match): Take new session arg. Update callers. (symbols[]): changed get-source to header-source - (header_source): Changed from get_source. Now a boolean, returns + (header_source): Chagned from get_source. Now a boolean, returns true if source matches one of the arguments. Uses the provider url comparison directly for accurate checking. Makes 'filter on source' work. @@ -1810,7 +725,7 @@ * tests/misc/utf7.c: some utf7/utf8 tests. - * providers/imap/camel-imap-utils.c (imap_mailbox_encode): Changed + * providers/imap/camel-imap-utils.c (imap_mailbox_encode): Chagned to use camel_utf8_utf7 code. (imap_mailbox_decode): As above, using camel_utf8_utf7. 'UTF-7' isn't a widely support iconv() codeset, and besides the new code @@ -1975,7 +890,7 @@ 2002-08-19 Peter Williams Plug some large leaks in the indexing code. - + * camel-mime-filter-index.c (camel_mime_filter_index_set_index): Unref the old index if necessary. @@ -3552,7 +2467,7 @@ to make camel only use literals if it needs to for simple strings. Changed slightly to use imap_is_atom() and more consistent formatting. - * providers/imap/camel-imap-utils.c (imap_is_atom): Changed from + providers/imap/camel-imap-utils.c (imap_is_atom): Chagned from imap_needs_quoting(). ** Merged in camel-object2 branch. Simpler camelobject @@ -5203,7 +4118,7 @@ (get_message_simple): Here too. (add_message_from_data): And here. -2001-11-14 Not Zed +2001-11-14 * camel-vee-folder.c (folder_changed_remove_uid): Use the uid rather than vuid for unmatched. Also add the uid to unmatched if @@ -5328,7 +4243,7 @@ since we'll just waste time in there mallocing left and right only to arrive at the single response line "* BYE" again :-) -2001-11-13 Not Zed +2001-11-13 * camel-filter-search.c (get_source): If we have no source string, then use undefined, which should always evaluate to FALSE. Fix @@ -5345,7 +4260,7 @@ pipe()'s fail, clean up any pipes that may have succeeded. Also close the password fds. -2001-11-09 Not Zed +2001-11-09 * providers/imap/camel-imap-store.c (imap_auth_loop): If we get a user cancel and that causes us to fail to authenticate, abort @@ -5394,13 +4309,13 @@ that we don't get 2 threads trying to read from our stream at the same time. -2001-11-01 Not Zed +2001-11-01 * camel-vee-folder.c (folder_changed_change): Move all searching operations outside of any locks except subfolder lock, same as build_folder. Fix for #14294. -2001-10-31 Not Zed +2001-10-31 * providers/local/camel-spool-folder.c (spool_get_message): Same as below. @@ -5429,7 +4344,7 @@ (folder_scan_init_with_fd): Setup errno depeding on ok/failure. (folder_scan_init_with_stream): Same. -2001-10-30 Not Zed +2001-10-30 * camel-operation.c (camel_operation_new): Dont setup cancel_fd. (camel_operation_cancel_fd): If cancel_fd not created, set it up. @@ -5464,7 +4379,7 @@ * camel-mime-part.c (free_headers): Fix this to match get_headers. -2001-10-30 Not Zed +2001-10-30 * providers/local/camel-local-store.c (rename_folder): Dont try to move ibex if we have none. @@ -5477,7 +4392,7 @@ * camel-mime-utils.c (camel_mime_utils_init): Removed unused variable. -2001-10-30 Not Zed +2001-10-30 * camel-mime-utils.c (header_decode_mailbox): w(x) out some warnings. @@ -5512,7 +4427,7 @@ * camel-stream-buffer.h: Removed CAMEL_STREAM_BUFFER_NEWLINE since it never got used anywhere and it isn't supported anyway. -2001-10-30 Not Zed +2001-10-30 * providers/imap/camel-imap-store.c (parse_list_response_as_folder_info): If we get an empty name, @@ -5524,7 +4439,7 @@ imap_get_message): Set an X-Evolution-Source header on the returned message so replies come from the right identity. -2001-10-29 Not Zed +2001-10-29 * camel-vee-folder.c (folder_changed_change): If we're not going to search on a changed uid, make sure we change out copy still. @@ -5568,7 +4483,7 @@ is being connected and thinks it's online, but the session is offline, then mark the service offline as well. Fixes 13683. -2001-10-29 Not Zed +2001-10-29 * camel-mime-utils.c: Turn off w() -> warnings. @@ -5590,7 +4505,7 @@ * camel-store.c (get_subfolders): Fix the 'is this a matching folder or subfolder' logic. -2001-10-28 Not Zed +2001-10-28 * providers/local/camel-local-store.c (rename_folder): Changed to call ibex_move to rename it internally. @@ -5611,7 +4526,7 @@ 0. Still seems to be a bug in select() if it's telling us the socket is ready for data when it really isn't but oh well. -2001-10-28 Not Zed +2001-10-28 * providers/local/camel-local-folder.c (camel_local_folder_construct): Use path not protocol as the path @@ -5627,7 +4542,7 @@ camelfolders before emitting the folderchanged event (otherwise vstore fails to pick up change. -2001-10-27 Not Zed +2001-10-27 * camel-store.c (camel_store_init): Always use a default dir_sep of '/'. @@ -5644,7 +4559,7 @@ * providers/local/camel-local-folder.c (local_rename): Implement local rename of folder objects. -2001-10-26 Not Zed +2001-10-26 * camel-vee-folder.c (camel_vee_folder_class_init): Hook into rename function. @@ -5695,7 +4610,7 @@ reading from it and get no data from it since it is already at the EOS. This may fix bug #12943. -2001-10-25 Not Zed +2001-10-25 * camel-search-private.c (utf8_get): Remove the stupid warning that should never have been there in the first place. @@ -5712,7 +4627,7 @@ * camel-mime-filter-charset.c (reset, complete, filter): " -2001-10-24 Not Zed +2001-10-24 * camel-mime-filter-basic.c (complete): For qp decoding, if the data isn't really qp encoded, we could possible grow the buffer by @@ -5743,11 +4658,11 @@ * camel-mime-utils.c (mail_list_magic): Remove an extra * in one of the regexps that glibc apparently doesn't mind but bsd does. -2001-10-23 Not Zed +2001-10-23 * providers/local/camel-mbox-summary.c: made d(x) x recompile again. -2001-10-22 Not Zed +2001-10-22 * providers/local/camel-spool-summary.c (summary_rebuild): No, use Storing, as the other code does :p @@ -5765,7 +4680,7 @@ kludging around a inline-pgp signed part, do some charset conversion to protect any 8bit text. -2001-10-22 Not Zed +2001-10-22 * camel-filter-search.c, camel-folder-search.c (check_header): Use search_type_mlist for mailing list searches. @@ -5819,7 +4734,7 @@ * camel-store.c (camel_folder_info_build): Updated comments to make the code a bit more clear. -2001-10-21 Not Zed +2001-10-21 * camel-store.c (CS_CLASS): Dont do the macro stuff - basically so you can actually debug calls. @@ -5829,7 +4744,7 @@ vuid, since its alloca'd now. (folder_changed_change): Kill a compile warning. -2001-10-20 Not Zed +2001-10-20 * camel-folder.c (move_messages_to): If no exception supplied, use a local one. @@ -5841,7 +4756,7 @@ destination folder is the vfolder source folder, then set_message_flags on it. -2001-10-19 Not Zed +2001-10-19 * camel-session.c (register_provider): When registering provider, translate all strings. @@ -5885,7 +4800,7 @@ is x-unknown or some other x- charset, always set the rawtext bit to TRUE. -2001-10-18 Not Zed +2001-10-18 * camel-store.c (camel_store_unsubscribe_folder): If we are unsubscribing from a folder we have loaded, set the folder @@ -5916,7 +4831,7 @@ Cyrus imapd workaround...instead of checking to see if info->flags == FLAGGED, just check to see if it contains any IMAP flags. -2001-10-17 Not Zed +2001-10-17 * providers/local/camel-maildir-folder.c (camel_maildir_folder_new): Use '.' as the inbox name for filter @@ -5947,7 +4862,7 @@ * camel-filter-driver.c (do_copy): Add an optimization for when destination folder is the same as the source folder. -2001-10-17 Not Zed +2001-10-17 * providers/imap/camel-imap-store.c (get_folder_info_online): (parse_list_response_as_folder_info): Patch from Danw, Use unread @@ -5987,7 +4902,7 @@ parent directory exists before trying to open the filename, if it doesn't, create it. -2001-10-16 Not Zed +2001-10-16 * camel-mime-utils.c (header_address_decode): If no content, dont try and decode further and spit meaningless warnings. @@ -6025,7 +4940,7 @@ filter, it was completely broken - instead remove the header and set it again after we send. -2001-10-12 Not Zed +2001-10-12 * camel-vee-folder.c (camel_vee_folder_remove_folder): Unhook from all events before removing folder. @@ -6034,7 +4949,7 @@ (subfolder_deleted): When the folder is deleted, remove it from the vfolder automagically. -2001-10-11 Not Zed +2001-10-11 * camel-vee-folder.c (vee_search_by_uids): convert the uids list to a subset appropriate for each subfolder before trying to search @@ -6057,7 +4972,7 @@ * camel-tcp-stream-ssl.c (ssl_bad_cert): Hack around the fact that adding a cert to nss's certdb seems to not work. -2001-10-10 Not Zed +2001-10-10 * camel-vee-folder.c (vee_sync): Only re-build the folder if we're expunging. Also only clear out the changed folders list if we're @@ -6068,12 +4983,12 @@ * camel-charset-map.c (camel_charset_map_init): Added a hack for Solaris systems. -2001-10-10 Not Zed +2001-10-10 * providers/local/camel-maildir-store.c (scan_dir): oops, we want get_unread_message_count, not get_message_count! -2001-10-09 Not Zed +2001-10-09 * camel-service.c (camel_service_disconnect): Duplicate connect code that unregisters a cancel op if we created one. @@ -6156,7 +5071,7 @@ uu encoder. (uuencode_step): New function to uuencode a block of data. -2001-10-05 Not Zed +2001-10-05 * providers/imap/camel-imap-store.c (subscribe_folder): Use a folder_subscribed event rather than a folder_created one. @@ -6202,7 +5117,7 @@ (subscribe_folder): Here too. (unsubscribe_folder): And here. -2001-10-05 Not Zed +2001-10-05 * camel-mime-utils.c (header_decode_mailbox): Try harder to get broken names out of addresses. Unencoded ,'s in names will still @@ -6211,7 +5126,7 @@ past a '.', even if we can't decode the next part. Fix for some annoying bug #. -2001-10-04 Not Zed +2001-10-04 * camel-store.c (camel_store_delete_folder): Change the order of execution slightly. We delete the folder first, then call the @@ -6224,7 +5139,7 @@ * camel-service.c (camel_service_connect): Unregister the operation before unreffing it. -2001-10-03 Not Zed +2001-10-03 * providers/imap/camel-imap-folder.c (camel_imap_folder_changed): Remove now unused 'recents' array/freeing func. @@ -6287,7 +5202,7 @@ * camel-tcp-stream-ssl.c (ssl_bad_cert): Import the certificate if the user accepts it. -2001-10-02 Not Zed +2001-10-02 * providers/local/camel-local-provider.c (local_url_hash, local_url_equal): for hashing/comparing local url's, we ignore @@ -6325,7 +5240,7 @@ conversion fails, for whatever reason, retry using the user's locale charset. -2001-10-02 Not Zed +2001-10-02 * providers/local/camel-maildir-store.c (get_folder_info): Go back to using the store url's path, not the toplevel_dir thing. @@ -6467,7 +5382,7 @@ * providers/imap/camel-imap-folder.c (get_content): and one that doesn't -2001-09-27 Not Zed +2001-09-27 * camel-service.c (camel_service_connect): Dont re-register the connect_op if we got it by calling 'operation_registered', which @@ -6529,7 +5444,7 @@ * camel-operation.c (camel_operation_registered): Deal with the possibility that there's no registered op. -2001-09-26 Not Zed +2001-09-26 * camel-filter-driver.c (camel_filter_driver_filter_message): If we get a search error, just abort, dont try and fall back and copy @@ -6562,7 +5477,7 @@ * camel-pgp-mime.c (camel_pgp_mime_is_rfc2015_signed): block out some code if ENABLE_PEDANTIC_PGPMIME is not defined. -2001-09-26 Not Zed +2001-09-26 * camel-vee-store.c: Emptied VeeStorePrivate, member wasn't used. @@ -6606,7 +5521,7 @@ * Makefile.am (camel-lock-helper): Add $(EXEEXT) for Automake 1.5 compatibility. -2001-09-25 Not Zed +2001-09-25 * camel-folder.c (get_unread_message_count): Only unref info if we got it. @@ -6640,7 +5555,7 @@ Fixes at least ximian 8593, and probably 6024 and maybe 10366, at least for OpenSSL. There may be a parallel NSS bug? -2001-09-25 Not Zed +2001-09-25 * camel-stream-buffer.c (stream_write_all): A "safe write" function that always writes out all data asked of it, till @@ -6648,7 +5563,7 @@ (stream_write): Rewritten. What was i on when i wrote that originally, how did it ever work with tcp streams ... -2001-09-24 Not Zed +2001-09-24 * camel-folder.c (append_message): Set the exception to FOLDER_INVALID rather than making out it worked. A fix for #7025. @@ -6718,7 +5633,7 @@ (pgp_encrypt): And here. (pgp_decrypt): Here too. -2001-09-21 Not Zed +2001-09-21 * camel-store.c (create_folder): Set the exception if create_folder isn't implemented. @@ -6730,7 +5645,7 @@ break folder creation (returning nodes from the root path when it shouldn't be?). -2001-09-21 Not Zed +2001-09-21 * camel-vee-store.c (vee_get_folder_info): Force a refresh of vfolders before storing their count. This essentially makes @@ -6750,7 +5665,7 @@ (vee_refresh_info): Refresh folder, re-run queries on any changed folders. -2001-09-20 Not Zed +2001-09-20 * camel-folder-summary.c (camel_folder_summary_header_load): New function to just load the summary. Not much use yet, until unread @@ -6844,7 +5759,7 @@ `data' isn't a CamelService...cuz it's not supposed to be! It's a CamelTcpStreamSSL object...doh! -2001-09-19 Not Zed +2001-09-19 * General cleanup of camel debug printfs. @@ -6861,14 +5776,14 @@ * camel-mime-utils.c: Match mailing-list header List-Owner. -2001-09-18 Not Zed +2001-09-18 * camel-vee-store.c (vee_get_folder): Fix the uri genereated for the folderinfo for the folder_created event. * camel-store.h: Added 'total' to CamelFolderInfo. -2000-09-18 Not Zed +2000-09-18 * providers/local/camel-maildir-folder.c (camel_maildir_folder_new): If filter inbox is set on the store, @@ -6955,7 +5870,7 @@ session_thread_queue, session_thread_wait): default implementation of session threads stuff. -2001-09-17 Not Zed +2001-09-17 * camel-folder.c (camel_folder_change_info_recent_uid): New function to add a 'recent' uid to the change info. @@ -7010,7 +5925,7 @@ URI of a folder. (get_uri): Default implementation. -2001-09-14 Not Zed +2001-09-14 * camel-vee-folder.c (camel_vee_folder_set_folders): New function, set the complete list of folders on a vfolder, all at once. @@ -7029,7 +5944,7 @@ * camel-store.h: Add a new flags CAMEL_STORE_VTRASH -> store supports vtrash. -2001-09-13 Not Zed +2001-09-13 * camel-vee-store.c (vee_get_folder_info): Implement. (build_info): Used to build a folder record from the folders @@ -7056,7 +5971,7 @@ name?query syntax to setup vfolder, but set the expression directly. Also fixes a small memleak. -2001-09-12 Not Zed +2001-09-12 * camel-store.c (camel_store_delete_folder): Fixed warnings with a cast. @@ -7125,7 +6040,7 @@ * camel-filter-driver.c (camel_filter_driver_filter_mbox): free the source url in the nonfailure case. -2001-09-12 Not Zed +2001-09-12 * camel-folder-search.h: Change the 'not' virtual method from an immediate e-sexp function to a non-immediate one, which is what it @@ -7142,7 +6057,7 @@ * camel-filter-driver.c (camel_filter_driver_filter_mbox): Unref the message info. -2001-09-10 Not Zed +2001-09-10 * providers/local/camel-maildir-store.c (get_folder_info): Pass in a hashtalbe used for finding visited nodes. @@ -7169,7 +6084,7 @@ * camel-charset-map.c (camel_charset_to_iconv): Get rid of the g_warning, we no longer really need that. -2001-09-10 Not Zed +2001-09-10 * providers/imap/camel-imap-store.c (camel_imap_msg_new): Forgot to return the newly allocated msg. @@ -7216,7 +6131,7 @@ (camel_mime_part_construct_content_from_parser): Reuse the original boundary instead of generating our own. -2001-09-06 Not Zed +2001-09-06 * providers/imap/camel-imap-folder.c (filter_proc): Thread function to perform filtering. @@ -7796,7 +6711,7 @@ 2001-07-31 Not Zed - * camel-folder.c (camel_folder_init): Changed mutexes to + * camel-folder.c (camel_folder_init): Chagned mutexes to e_mutexes, folder lock recursive. This fixes the imap filtering bug, or at least some cases of it. (camel_folder_finalize): Free mutexes. @@ -9972,7 +8887,7 @@ * providers/smtp/camel-smtp-provider.c: Same * providers/smtp/camel-smtp-transport.c: #ifdef HAVE_CONFIG_H, mark strings for translations. - + 2001-03-29 Dan Winship * camel-url.c (camel_url_to_string): change "gboolean show_passwd" @@ -10009,7 +8924,7 @@ * camel-search-private.c: #include * camel-vee-folder.c: Mark string for translation. * providers/local/camel-mbox-summary.c: #include - + 2001-04-03 Dan Winship * providers/imap/camel-imap-folder.c (imap_sync): If we don't @@ -10597,7 +9512,7 @@ 2001-03-16 Kjartan Maraas * providers/pop3/camel-pop3-folder.c: Added #include - + 2001-03-16 Dan Winship * camel-mime-utils.c (header_msgid_generate): Don't use @@ -11863,7 +10778,7 @@ 2001-01-19 Kjartan Maraas * providers/smtp/camel-smtp-provider.c: Mark strings for translation. - + 2001-01-19 Not Zed * camel-filter-driver.c (report_status): Add a percentage complete @@ -11912,7 +10827,7 @@ New smtp error-code to string mapping function. (smtp_connect): Use the new error->string function for reporting useful errors. - (smtp_helo): Same. Also use a case-insensitive strstr for 8BITMIME + (smtp_helo): Same. Also use a case-insensitive strstr for 8BITMIEM as it seems Exchange sends back lowercase for that one single SMTP extension. Everything else is uppercase. I'm seeing a lack of love for that extension by Microsoft dudes... @@ -14619,7 +13534,7 @@ * camel-charset-map.c, camel-charset-map-private.h: synced all charsets with ones found in libunicode. Just include more "iso/*.h" and rebuild ...private.h with this. - + 2000-10-31 Dan Winship * camel-service.c (service_disconnect): Add a new argument, clean, @@ -14733,7 +13648,7 @@ Content-type parameters when the quoting is mandatory, and deal with embedded quotes/backslashes when quoting. -2000-10-27 JPR +2000-10-27 * providers/pop3/Makefile.am: Tidy up build @@ -14747,7 +13662,7 @@ 2000-10-26 Kjartan Maraas * camel-exceptions-list.def: Add newline to kill warnings. - + 2000-10-25 Dan Winship * providers/imap/camel-imap-store.c (get_folder_info): Fix folder @@ -16844,6 +15759,7 @@ * providers/imap/camel-imap-folder.c: (summary_get_internal): Same as above. + 2000-07-27 Jeffrey Stedfast @@ -18781,6 +17697,7 @@ * camel-mime-part.c (camel_mime_part_set_content): Change camel_data_wrapper_new to camel_simple_data_wrapper_new. + 2000-05-17 Darin Adler @@ -18919,12 +17836,12 @@ * camel-mime-message.c (finalize): Free message_uid. (finalize): Free the recipients hashtable. -2000-05-11 NotZed +2000-05-11 * camel-folder-summary.c (camel_folder_summary_finalise): Free summary items and charset filters. -2000-05-10 NotZed +2000-05-10 * camel-folder-summary.c (camel_folder_summary_finalise): Don't free stuff in p, after we've free'd p. @@ -19120,7 +18037,7 @@ * providers/smtp/camel-smtp-provider.c: Note in the description that this provider is not yet tested. -2000-05-08 NotZed +2000-05-08 * camel-mime-part.c (write_to_stream): Free the filter stream when done. @@ -19181,7 +18098,7 @@ returns, and automagically translates 'From ' into '>From' as necessary. -2000-05-07 NotZed +2000-05-07 * camel-mime-filter.c (filter_run): Oops, forgot to add the backlen to the pre-buffer (*poof*). @@ -19208,7 +18125,7 @@ (camel_mbox_summary_load): Removed some fo that checking, it needs more code to work reliably. -2000-05-07 NotZed +2000-05-07 * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_load): Set the size and mtime of the mbox we indexed once done. @@ -19275,7 +18192,7 @@ Commented out some memory profiling stuff. -2000-05-05 NotZed +2000-05-05 * camel-mime-utils.c (header_decode_mailbox): Plug a memory leak. (header_decode_text): Fixed memory leaks with g_string_append(). @@ -19283,7 +18200,7 @@ glib api is so awful ... (header_content_type_decode): More memory leaks. -2000-05-05 NotZed +2000-05-05 * camel-mime-parser.c (folder_scan_init_with_fd): Make sure we init the end of buffer sentinal! @@ -19466,7 +18383,7 @@ (header_append): Also move the header-start tracking stuff here. Could be a static function to save code. -2000-05-02 NotZed +2000-05-02 * camel-mime-part-utils.c (simple_data_wrapper_construct_from_parser): Dont use autofill on @@ -21375,17 +20292,20 @@ * camel-stream-b64.[ch] : b64 encoding/decoding is now implemented as a stream. + 2000-02-21 bertrand * camel-seekable-substream.c (_reemit_parent_signal): emit "data_available" when parent stream emits it. + 2000-02-21 NotZed * providers/mbox/Makefile.am: Uh, fixed LIBADD again. What was there was never ever going to work, wasn't it tested? + 2000-02-21 Dan Winship * camel-session.h: (struct _CamelSession): Add authenticator. diff --git a/camel/Makefile.am b/camel/Makefile.am index 7055630273..c79045cdfe 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -1,22 +1,20 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = . providers tests +SUBDIRS = providers tests -libcamelincludedir = $(privincludedir)/camel +libcamelincludedir = $(includedir)/camel -camellibexecdir = $(privlibexecdir)/camel -camellibexec_PROGRAMS = camel-lock-helper camel-index-control +sbin_PROGRAMS = camel-lock-helper camel-index-control -privlib_LTLIBRARIES = libcamel.la +lib_LTLIBRARIES = libcamel.la noinst_LTLIBRARIES = libcamel-static.la INCLUDES = -I.. -I$(srcdir)/.. \ -I$(top_srcdir)/intl \ -I$(top_srcdir)/e-util \ - -DCAMEL_LIBEXECDIR=\""$(camellibexecdir)"\" \ + -DCAMEL_SBINDIR=\""$(sbindir)"\" \ -DCAMEL_PROVIDERDIR=\""$(camel_providerdir)"\" \ -DG_LOG_DOMAIN=\"camel\" \ - -DG_DISABLE_DEPRECATED \ $(CAMEL_CFLAGS) libcamel_la_SOURCES = \ @@ -55,9 +53,9 @@ libcamel_la_SOURCES = \ camel-mime-filter-bestenc.c \ camel-mime-filter-basic.c \ camel-mime-filter-charset.c \ + camel-mime-filter-chomp.c \ camel-mime-filter-canon.c \ camel-mime-filter-crlf.c \ - camel-mime-filter-enriched.c \ camel-mime-filter-from.c \ camel-mime-filter-html.c \ camel-mime-filter-tohtml.c \ @@ -112,12 +110,13 @@ libcamel_la_SOURCES = \ camel-transport.c \ camel-uid-cache.c \ camel-url.c \ - camel-url-scanner.c \ camel-utf8.c \ camel-vee-folder.c \ camel-vee-store.c \ camel-vtrash-folder.c \ camel.c \ + gstring-util.c \ + hash-table-utils.c \ string-utils.c libcamelinclude_HEADERS = \ @@ -150,16 +149,15 @@ libcamelinclude_HEADERS = \ camel-http-stream.h \ camel-index.h \ camel-internet-address.h \ - camel-i18n.h \ camel-lock.h \ camel-lock-client.h \ camel-medium.h \ camel-mime-filter-bestenc.h \ camel-mime-filter-basic.h \ camel-mime-filter-charset.h \ + camel-mime-filter-chomp.h \ camel-mime-filter-canon.h \ camel-mime-filter-crlf.h \ - camel-mime-filter-enriched.h \ camel-mime-filter-from.h \ camel-mime-filter-html.h \ camel-mime-filter-tohtml.h \ @@ -213,15 +211,16 @@ libcamelinclude_HEADERS = \ camel-types.h \ camel-uid-cache.h \ camel-url.h \ - camel-url-scanner.h \ camel-utf8.h \ camel-vee-folder.h \ camel-vee-store.h \ camel-vtrash-folder.h \ camel.h \ + gstring-util.h \ + hash-table-utils.h \ string-utils.h -libcamel_la_LDFLAGS = -version-info 0:0:0 +libcamel_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir) libcamel_la_LIBADD = \ $(top_builddir)/e-util/libeutil.la \ @@ -237,24 +236,19 @@ camel_lock_helper_SOURCES = \ camel-lock.c \ camel-lock.h -# NOTE: This needs to be cleaned up, it shouldn't link with all this crap, -# because it might be setuid. -camel_lock_helper_LDADD = \ - $(libcamel_la_LIBADD) - camel_index_control_SOURCES = \ camel-index-control.c camel_index_control_LDADD = \ $(libcamel_la_LIBADD) \ - libcamel.la -# $(EVOLUTION_MAIL_LIBS) + libcamel.la \ + $(EVOLUTION_MAIL_LIBS) install-exec-hook: @if test -n "$(CAMEL_LOCK_HELPER_USER)"; then \ if test `whoami` = root ; then \ - chown $(CAMEL_LOCK_HELPER_USER) $(DESTDIR)$(camellibexecdir)/camel-lock-helper ; \ - chmod u+s $(DESTDIR)$(camellibexecdir)/camel-lock-helper ; \ + chown $(CAMEL_LOCK_HELPER_USER) $(DESTDIR)$(sbindir)/camel-lock-helper ; \ + chmod u+s $(DESTDIR)$(sbindir)/camel-lock-helper ; \ else \ echo '*** WARNING ***' ; \ echo "Camel will not be able to open mbox files until you perform the following steps:" ; \ @@ -268,14 +262,14 @@ install-exec-hook: fi @if test -n "$(CAMEL_LOCK_HELPER_GROUP)"; then \ if test `whoami` = root ; then \ - chgrp $(CAMEL_LOCK_HELPER_GROUP) $(DESTDIR)$(camellibexecdir)/camel-lock-helper ; \ - chmod g+s $(DESTDIR)$(camellibexecdir)/camel-lock-helper ; \ + chgrp $(CAMEL_LOCK_HELPER_GROUP) $(DESTDIR)$(sbindir)/camel-lock-helper ; \ + chmod g+s $(DESTDIR)$(sbindir)/camel-lock-helper ; \ else \ echo '*** WARNING ***' ; \ echo "Camel will not be able to open mbox files until you perform the following steps:" ; \ echo " 1. Become root" ; \ - echo " 2. chgrp $(CAMEL_LOCK_HELPER_GROUP) $(DESTDIR)$(camellibexecdir)/camel-lock-helper" ; \ - echo " 3. chmod g+s $(DESTDIR)$(camellibexecdir)/camel-lock-helper" ; \ + echo " 2. chgrp $(CAMEL_LOCK_HELPER_GROUP) $(DESTDIR)$(sbindir)/camel-lock-helper" ; \ + echo " 3. chmod g+s $(DESTDIR)$(sbindir)/camel-lock-helper" ; \ echo '*** WARNING ***' ; \ fi \ else \ diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c index 627b7ad78b..62747dcf17 100644 --- a/camel/camel-filter-search.c +++ b/camel/camel-filter-search.c @@ -42,10 +42,15 @@ #include #include -#include + +#ifdef HAVE_ALLOCA_H +#include +#endif #include +#include "e-util/e-sexp.h" + #include "camel-mime-message.h" #include "camel-provider.h" #include "camel-session.h" @@ -162,10 +167,8 @@ check_header (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMess type = CAMEL_SEARCH_TYPE_ADDRESS_ENCODED; else { ct = camel_mime_part_get_content_type (CAMEL_MIME_PART (message)); - if (ct) { - charset = header_content_type_param (ct, "charset"); - charset = e_iconv_charset_name (charset); - } + if (ct) + charset = e_iconv_charset_name(header_content_type_param(ct, "charset")); } } @@ -516,22 +519,18 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa if (!(pid = fork ())) { /* child process */ GPtrArray *args; - int maxfd, fd, i; - - fd = open ("/dev/null", O_WRONLY); + int maxfd, i; - if (dup2 (in_fds[0], STDIN_FILENO) < 0 || - dup2 (fd, STDOUT_FILENO) < 0 || - dup2 (fd, STDERR_FILENO) < 0) + if (dup2 (in_fds[0], STDIN_FILENO) < 0) _exit (255); setsid (); maxfd = sysconf (_SC_OPEN_MAX); if (maxfd > 0) { - for (fd = 0; fd < maxfd; fd++) { - if (fd != STDIN_FILENO && fd != STDOUT_FILENO && fd != STDERR_FILENO) - close (fd); + for (i = 0; i < maxfd; i++) { + if (i != STDIN_FILENO && i != STDOUT_FILENO && i != STDERR_FILENO) + close (i); } } @@ -548,7 +547,7 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa _exit (255); } else if (pid < 0) { camel_exception_setv (fms->ex, CAMEL_EXCEPTION_SYSTEM, - _("Failed to create create child process '%s': %s"), + _("Failed to create child process '%s': %s"), argv[0]->value.string, g_strerror (errno)); return -1; } diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c index 00315fafdc..ef6dfc8564 100644 --- a/camel/camel-folder-search.c +++ b/camel/camel-folder-search.c @@ -1052,20 +1052,25 @@ search_system_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, Came return r; } -static ESExpResult * -search_user_tag(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search) +static ESExpResult *search_user_tag(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search) { - const char *value = NULL; ESExpResult *r; - + r(printf("executing user-tag\n")); - - if (argc == 1) - value = camel_tag_get (&search->current->user_tags, argv[0]->value.string); - - r = e_sexp_result_new(f, ESEXP_RES_STRING); - r->value.string = g_strdup (value ? value : ""); - + + /* are we inside a match-all? */ + if (search->current) { + const char *value = NULL; + if (argc == 1) { + value = camel_tag_get(&search->current->user_tags, argv[0]->value.string); + } + r = e_sexp_result_new(f, ESEXP_RES_STRING); + r->value.string = g_strdup(value?value:""); + } else { + r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR); + r->value.ptrarray = g_ptr_array_new(); + } + return r; } diff --git a/camel/camel-mime-filter-canon.c b/camel/camel-mime-filter-canon.c index 43337ae856..80b1b4aeb8 100644 --- a/camel/camel-mime-filter-canon.c +++ b/camel/camel-mime-filter-canon.c @@ -197,10 +197,6 @@ complete(CamelMimeFilter *f, char *in, size_t len, size_t prespace, char **out, } #if 0 - /* Note: #if 0'd out because we do not want to add a - * \r\n for PGP/MIME verification if it isn't there in - * the original content stream */ - /* check end of line canonicalisation */ if (o>starto) { if (flags & CAMEL_MIME_FILTER_CANON_CRLF) { @@ -211,7 +207,7 @@ complete(CamelMimeFilter *f, char *in, size_t len, size_t prespace, char **out, o--; } } - + /* and always finish with an eol */ *o++ = '\n'; #endif diff --git a/camel/camel-mime-filter-tohtml.c b/camel/camel-mime-filter-tohtml.c index 60c4686824..b638a315b4 100644 --- a/camel/camel-mime-filter-tohtml.c +++ b/camel/camel-mime-filter-tohtml.c @@ -27,37 +27,15 @@ #include #include +#include -#include "camel-url-scanner.h" #include "camel-mime-filter-tohtml.h" -#include "camel-utf8.h" #define d(x) -#define CONVERT_WEB_URLS CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS -#define CONVERT_ADDRSPEC CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES - -static struct { - unsigned int mask; - urlpattern_t pattern; -} patterns[] = { - { CONVERT_WEB_URLS, { "file://", "", camel_url_file_start, camel_url_file_end } }, - { CONVERT_WEB_URLS, { "ftp://", "", camel_url_web_start, camel_url_web_end } }, - { CONVERT_WEB_URLS, { "http://", "", camel_url_web_start, camel_url_web_end } }, - { CONVERT_WEB_URLS, { "https://", "", camel_url_web_start, camel_url_web_end } }, - { CONVERT_WEB_URLS, { "news://", "", camel_url_web_start, camel_url_web_end } }, - { CONVERT_WEB_URLS, { "nntp://", "", camel_url_web_start, camel_url_web_end } }, - { CONVERT_WEB_URLS, { "telnet://", "", camel_url_web_start, camel_url_web_end } }, - { CONVERT_WEB_URLS, { "www.", "http://", camel_url_web_start, camel_url_web_end } }, - { CONVERT_WEB_URLS, { "ftp.", "ftp://", camel_url_web_start, camel_url_web_end } }, - { CONVERT_ADDRSPEC, { "@", "mailto:", camel_url_addrspec_start, camel_url_addrspec_end } }, -}; - -#define NUM_URL_PATTERNS (sizeof (patterns) / sizeof (patterns[0])) - static void camel_mime_filter_tohtml_class_init (CamelMimeFilterToHTMLClass *klass); -static void camel_mime_filter_tohtml_init (CamelMimeFilterToHTML *filter); -static void camel_mime_filter_tohtml_finalize (CamelObject *obj); +static void camel_mime_filter_tohtml_init (CamelObject *o); +static void camel_mime_filter_tohtml_finalize (CamelObject *o); static CamelMimeFilterClass *camel_mime_filter_tohtml_parent; @@ -82,22 +60,15 @@ camel_mime_filter_tohtml_get_type (void) } static void -camel_mime_filter_tohtml_finalize (CamelObject *obj) +camel_mime_filter_tohtml_finalize (CamelObject *o) { - CamelMimeFilterToHTML *filter = (CamelMimeFilterToHTML *) obj; - - camel_url_scanner_free (filter->scanner); + ; } static void -camel_mime_filter_tohtml_init (CamelMimeFilterToHTML *filter) +camel_mime_filter_tohtml_init (CamelObject *o) { - filter->scanner = camel_url_scanner_new (); - - filter->flags = 0; - filter->colour = 0; - filter->column = 0; - filter->pre_open = FALSE; + ; } @@ -118,97 +89,188 @@ check_size (CamelMimeFilter *filter, char *outptr, char **outend, size_t len) return filter->outbuf + offset; } -static int -citation_depth (const char *in) + +static unsigned short special_chars[128] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7, 4, 3, 0, 0, 0, 0, 7, 3, 7, 0, 0, 7, 12, 12, 1, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 7, 3, 0, 7, 4, + 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, 7, 3, 0, 4, + 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 7, 4, 0, 0, +}; + + +#define IS_NON_ADDR (1 << 0) +#define IS_NON_URL (1 << 1) +#define IS_GARBAGE (1 << 2) +#define IS_DOMAIN (1 << 3) + +#define NON_EMAIL_CHARS "()<>@,;:\\\"/[]`'|\n\t " +#define NON_URL_CHARS "()<>,;\\\"[]`'|\n\t " +#define TRAILING_URL_GARBAGE ",.!?;:>)}\\`'-_|\n\t " + +#define is_addr_char(c) ((unsigned char) (c) < 128 && !(special_chars[(unsigned char) (c)] & IS_NON_ADDR)) +#define is_url_char(c) ((unsigned char) (c) < 128 && !(special_chars[(unsigned char) (c)] & IS_NON_URL)) +#define is_trailing_garbage(c) ((unsigned char) (c) > 127 || (special_chars[(unsigned char) (c)] & IS_GARBAGE)) +#define is_domain_name_char(c) ((unsigned char) (c) < 128 && (special_chars[(unsigned char) (c)] & IS_DOMAIN)) + + +#if 0 +static void +table_init (void) { - register const char *inptr = in; - int depth = 1; + int max, ch, i; + char *c; + + memset (special_chars, 0, sizeof (special_chars)); + for (c = NON_EMAIL_CHARS; *c; c++) + special_chars[(int) *c] |= IS_NON_ADDR; + for (c = NON_URL_CHARS; *c; c++) + special_chars[(int) *c] |= IS_NON_URL; + for (c = TRAILING_URL_GARBAGE; *c; c++) + special_chars[(int) *c] |= IS_GARBAGE; + +#define is_ascii_alpha(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z')) + + for (ch = 0; ch < 128; ch++) { + if (is_ascii_alpha (ch) || isdigit (ch) || ch == '.' || ch == '-') + special_chars[ch] |= IS_DOMAIN; + } - if (*inptr++ != '>') - return 0; + max = sizeof (special_chars) / sizeof (special_chars[0]); + printf ("static unsigned short special_chars[%d] = {", max); + for (i = 0; i < max; i++) { + if (i % 16 == 0) + printf ("\n\t"); + printf ("%3d,", special_chars[i]); + } + printf ("\n};\n"); +} +#endif + +static char * +url_extract (char **in, int inlen, gboolean check, gboolean *backup) +{ + unsigned char *inptr, *inend, *p; + char *url; - /* check that it isn't an escaped From line */ - if (!strncmp (inptr, "From", 4)) - return 0; + inptr = (unsigned char *) *in; + inend = inptr + inlen; - while (*inptr != '\n') { - if (*inptr == ' ') - inptr++; - - if (*inptr++ != '>') - break; - - depth++; + while (inptr < inend && is_url_char (*inptr)) + inptr++; + + if ((char *) inptr == *in) + return NULL; + + /* back up if we probably went too far. */ + while (inptr > (unsigned char *) *in && is_trailing_garbage (*(inptr - 1))) + inptr--; + + if (check) { + /* make sure we weren't fooled. */ + p = memchr (*in, ':', (char *) inptr - *in); + if (!p) + return NULL; } - return depth; + if (inptr == inend && backup) { + *backup = TRUE; + return NULL; + } + + url = g_strndup (*in, (char *) inptr - *in); + *in = inptr; + + return url; } static char * -writeln (CamelMimeFilter *filter, const char *in, const char *inend, char *outptr, char **outend) +email_address_extract (char **in, char *inend, char *start, char **outptr, gboolean *backup) { - CamelMimeFilterToHTML *html = (CamelMimeFilterToHTML *) filter; - const char *inptr = in; - - while (inptr < inend) { - guint32 u; + char *addr, *pre, *end, *dot; + + /* *in points to the '@'. Look backward for a valid local-part */ + pre = *in; + while (pre - 1 >= start && is_addr_char (*(pre - 1))) + pre--; + + if (pre == *in) + return NULL; + + /* Now look forward for a valid domain part */ + for (end = *in + 1, dot = NULL; end < inend && is_domain_name_char (*end); end++) { + if (*end == '.' && !dot) + dot = end; + } + + if (end >= inend && backup) { + *backup = TRUE; + *outptr -= (*in - pre); + *in = pre; + return NULL; + } + + if (!dot) + return NULL; + + /* Remove trailing garbage */ + while (end > *in && is_trailing_garbage (*(end - 1))) + end--; + if (dot > end) + return NULL; + + addr = g_strndup (pre, end - pre); + *outptr -= (*in - pre); + *in = end; + + return addr; +} - outptr = check_size (filter, outptr, outend, 16); +static gboolean +is_citation (char *inptr, char *inend, gboolean saw_citation, gboolean *backup) +{ + if (*inptr != '>') + return FALSE; + + if (inend - inptr >= 6) { + /* make sure this isn't just mbox From-magling... */ + if (strncmp (inptr, ">From ", 6) != 0) + return TRUE; + } else if (backup) { + /* we don't have enough data to tell, so return */ + *backup = TRUE; + return saw_citation; + } + + /* if the previous line was a citation, then say this one is too */ + if (saw_citation) + return TRUE; + + /* otherwise it was just an isolated ">From " line */ + return FALSE; +} - u = camel_utf8_getc_limit ((const unsigned char **) &inptr, inend); - switch (u) { - case 0xffff: - g_warning("Truncated utf8 buffer"); - return outptr; - case '<': - outptr = g_stpcpy (outptr, "<"); - html->column++; - break; - case '>': - outptr = g_stpcpy (outptr, ">"); - html->column++; - break; - case '&': - outptr = g_stpcpy (outptr, "&"); - html->column++; - break; - case '"': - outptr = g_stpcpy (outptr, """); - html->column++; - break; - case '\t': - if (html->flags & (CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES)) { - do { - outptr = check_size (filter, outptr, outend, 7); - outptr = g_stpcpy (outptr, " "); - html->column++; - } while (html->column % 8); - break; - } - /* otherwise, FALL THROUGH */ - case ' ': - if (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES - && ((inptr == (in + 1) || *inptr == ' ' || *inptr == '\t'))) { - outptr = g_stpcpy (outptr, " "); - html->column++; - break; - } - /* otherwise, FALL THROUGH */ - default: - if (u >= 20 && u <0x80) - *outptr++ = u; - else { - if (html->flags & CAMEL_MIME_FILTER_TOHTML_ESCAPE_8BIT) - *outptr++ = '?'; - else - outptr += sprintf(outptr, "&#%u;", u); - } - html->column++; - break; - } +static gboolean +is_protocol (char *inptr, char *inend, gboolean *backup) +{ + if (inend - inptr >= 8) { + if (!strncasecmp (inptr, "http://", 7) || + !strncasecmp (inptr, "https://", 8) || + !strncasecmp (inptr, "ftp://", 6) || + !strncasecmp (inptr, "nntp://", 7) || + !strncasecmp (inptr, "mailto:", 7) || + !strncasecmp (inptr, "news:", 5) || + !strncasecmp (inptr, "file:", 5)) + return TRUE; + } else if (backup) { + *backup = TRUE; + return FALSE; } - return outptr; + return FALSE; } static void @@ -216,128 +278,193 @@ html_convert (CamelMimeFilter *filter, char *in, size_t inlen, size_t prespace, char **out, size_t *outlen, size_t *outprespace, gboolean flush) { CamelMimeFilterToHTML *html = (CamelMimeFilterToHTML *) filter; - register char *inptr, *outptr; - char *start, *outend; - const char *inend; - int depth; + char *inptr, *inend, *outptr, *outend, *start; + gboolean backup = FALSE; camel_mime_filter_set_size (filter, inlen * 2 + 6, FALSE); - inptr = in; + inptr = start = in; inend = in + inlen; outptr = filter->outbuf; outend = filter->outbuf + filter->outsize; if (html->flags & CAMEL_MIME_FILTER_TOHTML_PRE && !html->pre_open) { - outptr = g_stpcpy (outptr, "
");
+		outptr += sprintf (outptr, "%s", "
");
 		html->pre_open = TRUE;
 	}
 	
-	start = inptr;
-	while (inptr < inend && *inptr != '\n')
-		inptr++;
-	
 	while (inptr < inend) {
-		html->column = 0;
-		depth = 0;
+		unsigned char u;
 		
-		if (html->flags & CAMEL_MIME_FILTER_TOHTML_MARK_CITATION) {
-			if ((depth = citation_depth (start)) > 0) {
-				char font[25];
-				
-				/* FIXME: we could easily support multiple colour depths here */
-				
-				g_snprintf (font, 25, "", html->colour);
-				
-				outptr = check_size (filter, outptr, &outend, 25);
-				outptr = g_stpcpy (outptr, font);
-			} else if (*start == '>') {
-				/* >From line */
-				start++;
+		if (html->flags & CAMEL_MIME_FILTER_TOHTML_MARK_CITATION && html->column == 0) {
+			html->saw_citation = is_citation (inptr, inend, html->saw_citation,
+							  flush ? &backup : NULL);
+			if (backup)
+				break;
+			
+			if (html->saw_citation) {
+				if (!html->coloured) {
+					char font[25];
+					
+					g_snprintf (font, 25, "", html->colour);
+					
+					outptr = check_size (filter, outptr, &outend, 25);
+					outptr += sprintf (outptr, "%s", font);
+					html->coloured = TRUE;
+				}
+			} else if (html->coloured) {
+				outptr = check_size (filter, outptr, &outend, 10);
+				outptr += sprintf (outptr, "%s", "");
+				html->coloured = FALSE;
 			}
-		} else if (html->flags & CAMEL_MIME_FILTER_TOHTML_CITE) {
+			
+			/* display mbox-mangled ">From " as "From " */
+			if (*inptr == '>' && !html->saw_citation)
+				inptr++;
+		} else if (html->flags & CAMEL_MIME_FILTER_TOHTML_CITE && html->column == 0) {
 			outptr = check_size (filter, outptr, &outend, 6);
-			outptr = g_stpcpy (outptr, "> ");
-			html->column += 2;
+			outptr += sprintf (outptr, "%s", "> ");
 		}
 		
-#define CONVERT_URLS (CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES)
-		if (html->flags & CONVERT_URLS) {
-			size_t matchlen, buflen, len;
-			urlmatch_t match;
-			
-			len = inptr - start;
+		if (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS && isalpha ((int) *inptr)) {
+			char *refurl = NULL, *dispurl = NULL;
 			
-			do {
-				if (camel_url_scanner_scan (html->scanner, start, len, &match)) {
-					/* write out anything before the first regex match */
-					outptr = writeln (filter, start, start + match.um_so,
-							  outptr, &outend);
-					
-					start += match.um_so;
-					len -= match.um_so;
-					
-					matchlen = match.um_eo - match.um_so;
-					
-					buflen = 20 + strlen (match.prefix) + matchlen + matchlen;
-					outptr = check_size (filter, outptr, &outend, buflen);
-					
-					/* write out the href tag */
-					outptr = g_stpcpy (outptr, "");
-					
-					/* now write the matched string */
-					memcpy (outptr, start, matchlen);
-					html->column += matchlen;
-					outptr += matchlen;
-					start += matchlen;
-					len -= matchlen;
-					
-					/* close the href tag */
-					outptr = g_stpcpy (outptr, "");
-				} else {
-					/* nothing matched so write out the remainder of this line buffer */
-					outptr = writeln (filter, start, start + len, outptr, &outend);
+			if (is_protocol (inptr, inend, flush ? &backup : NULL)) {
+				dispurl = url_extract (&inptr, inend - inptr, TRUE,
+						       flush ? &backup : NULL);
+				if (backup)
 					break;
+				
+				if (dispurl)
+					refurl = g_strdup (dispurl);
+			} else {
+				if (backup)
+					break;
+				
+				if (!strncasecmp (inptr, "www.", 4) && ((unsigned char) inptr[4]) < 0x80
+				    && isalnum ((int) inptr[4])) {
+					dispurl = url_extract (&inptr, inend - inptr, FALSE,
+							      flush ? &backup : NULL);
+					if (backup)
+						break;
+					
+					if (dispurl)
+						refurl = g_strdup_printf ("http://%s", dispurl);
 				}
-			} while (len > 0);
-		} else {
-			outptr = writeln (filter, start, inptr, outptr, &outend);
-		}
-		
-		if ((html->flags & CAMEL_MIME_FILTER_TOHTML_MARK_CITATION) && depth > 0) {
-			outptr = check_size (filter, outptr, &outend, 8);
-			outptr = g_stpcpy (outptr, "");
+			}
+			
+			if (dispurl) {
+				outptr = check_size (filter, outptr, &outend,
+						     strlen (refurl) +
+						     strlen (dispurl) + 15);
+				outptr += sprintf (outptr, "%s",
+						   refurl, dispurl);
+				html->column += strlen (dispurl);
+				g_free (refurl);
+				g_free (dispurl);
+			}
+			
+			if (inptr >= inend)
+				break;
 		}
 		
-		if (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_NL) {
-			outptr = check_size (filter, outptr, &outend, 5);
-			outptr = g_stpcpy (outptr, "
"); + if (*inptr == '@' && (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES)) { + char *addr, *outaddr; + + addr = email_address_extract (&inptr, inend, start, &outptr, + flush ? &backup : NULL); + if (backup) + break; + + if (addr) { + outaddr = g_strdup_printf ("%s", + addr, addr); + outptr = check_size (filter, outptr, &outend, strlen (outaddr)); + outptr += sprintf (outptr, "%s", outaddr); + html->column += strlen (addr); + g_free (addr); + g_free (outaddr); + } } - *outptr++ = '\n'; + outptr = check_size (filter, outptr, &outend, 32); - start = ++inptr; - while (inptr < inend && *inptr != '\n') - inptr++; + switch ((u = (unsigned char) *inptr++)) { + case '<': + outptr += sprintf (outptr, "%s", "<"); + html->column++; + break; + + case '>': + outptr += sprintf (outptr, "%s", ">"); + html->column++; + break; + + case '&': + outptr += sprintf (outptr, "%s", "&"); + html->column++; + break; + + case '"': + outptr += sprintf (outptr, "%s", """); + html->column++; + break; + + case '\n': + if (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_NL) + outptr += sprintf (outptr, "%s", "
"); + + *outptr++ = '\n'; + start = inptr; + html->column = 0; + break; + + case '\t': + if (html->flags & (CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES)) { + do { + outptr = check_size (filter, outptr, &outend, 7); + outptr += sprintf (outptr, "%s", " "); + html->column++; + } while (html->column % 8); + break; + } + /* otherwise, FALL THROUGH */ + + case ' ': + if (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES) { + if (inptr == in || (inptr < inend && (*(inptr + 1) == ' ' || + *(inptr + 1) == '\t' || + *(inptr - 1) == '\n'))) { + outptr += sprintf (outptr, "%s", " "); + html->column++; + break; + } + } + /* otherwise, FALL THROUGH */ + + default: + if ((u >= 0x20 && u < 0x80) || + (u == '\r' || u == '\t') || html->flags & CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT) { + /* Default case, just copy. */ + *outptr++ = (char) u; + } else { + if (html->flags & CAMEL_MIME_FILTER_TOHTML_ESCAPE_8BIT) + *outptr++ = '?'; + else + outptr += g_snprintf (outptr, 9, "&#%d;", (int) u); + } + html->column++; + break; + } } - if (flush) { - /* flush the rest of our input buffer */ - if (start < inend) - outptr = writeln (filter, start, inend, outptr, &outend); - - if (html->pre_open) { - /* close the pre-tag */ - outptr = check_size (filter, outptr, &outend, 10); - outptr = g_stpcpy (outptr, "
"); - } - } else if (start < inend) { - /* backup */ - camel_mime_filter_backup (filter, start, (unsigned) (inend - start)); + if (inptr < inend) + camel_mime_filter_backup (filter, inptr, inend - inptr); + + if (flush && html->pre_open) { + outptr = check_size (filter, outptr, &outend, 10); + outptr += sprintf (outptr, "%s", "
"); + html->pre_open = FALSE; } *out = filter->outbuf; @@ -366,6 +493,8 @@ filter_reset (CamelMimeFilter *filter) html->column = 0; html->pre_open = FALSE; + html->saw_citation = FALSE; + html->coloured = FALSE; } static void @@ -394,39 +523,11 @@ CamelMimeFilter * camel_mime_filter_tohtml_new (guint32 flags, guint32 colour) { CamelMimeFilterToHTML *new; - int i; new = CAMEL_MIME_FILTER_TOHTML (camel_object_new (camel_mime_filter_tohtml_get_type ())); new->flags = flags; new->colour = colour; - for (i = 0; i < NUM_URL_PATTERNS; i++) { - if (patterns[i].mask & flags) - camel_url_scanner_add (new->scanner, &patterns[i].pattern); - } - return CAMEL_MIME_FILTER (new); } - - -char * -camel_text_to_html (const char *in, guint32 flags, guint32 colour) -{ - CamelMimeFilter *filter; - size_t outlen, outpre; - char *outbuf; - - g_return_val_if_fail (in != NULL, NULL); - - filter = camel_mime_filter_tohtml_new (flags, colour); - - camel_mime_filter_complete (filter, (char *) in, strlen (in), 0, - &outbuf, &outlen, &outpre); - - outbuf = g_strndup (outbuf, outlen); - - camel_object_unref (filter); - - return outbuf; -} diff --git a/camel/camel-mime-filter-tohtml.h b/camel/camel-mime-filter-tohtml.h index de8690a1e0..a37c02ae3c 100644 --- a/camel/camel-mime-filter-tohtml.h +++ b/camel/camel-mime-filter-tohtml.h @@ -44,7 +44,6 @@ extern "C" { #define CAMEL_MIME_FILTER_TOHTML_ESCAPE_8BIT (1 << 6) #define CAMEL_MIME_FILTER_TOHTML_CITE (1 << 7) #define CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT (1 << 8) -#define CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED (1 << 9) typedef struct _CamelMimeFilterToHTMLClass CamelMimeFilterToHTMLClass; typedef struct _CamelMimeFilterToHTML CamelMimeFilterToHTML; @@ -52,13 +51,13 @@ typedef struct _CamelMimeFilterToHTML CamelMimeFilterToHTML; struct _CamelMimeFilterToHTML { CamelMimeFilter parent; - struct _CamelUrlScanner *scanner; - guint32 flags; guint32 colour; - guint32 column : 31; - guint32 pre_open : 1; + guint32 column : 29; + guint32 pre_open : 1; + guint32 saw_citation : 1; + guint32 coloured : 1; }; struct _CamelMimeFilterToHTMLClass { @@ -70,11 +69,6 @@ CamelType camel_mime_filter_tohtml_get_type (void); CamelMimeFilter *camel_mime_filter_tohtml_new (guint32 flags, guint32 colour); - -/* utility functions to replace e_text_to_html shit */ - -char *camel_text_to_html (const char *in, guint32 flags, guint32 colour); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index 78cdb9c6b7..e041846551 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -29,10 +29,12 @@ #include #include #include + #include #include +#include "hash-table-utils.h" #include "camel-mime-parser.h" #include "camel-stream-mem.h" #include "camel-stream-filter.h" @@ -211,7 +213,7 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_ { CamelMimePart *mime_part = CAMEL_MIME_PART (medium); CamelHeaderType header_type; - const char *charset; + const char *charset, *p; char *text; /* Try to parse the header pair. If it corresponds to something */ @@ -222,10 +224,9 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_ switch (header_type) { case HEADER_DESCRIPTION: /* raw header->utf8 conversion */ g_free (mime_part->description); - if (mime_part->content_type) { - charset = header_content_type_param (mime_part->content_type, "charset"); - charset = e_iconv_charset_name (charset); - } else + if (mime_part->content_type) + charset = e_iconv_charset_name(header_content_type_param(mime_part->content_type, "charset")); + else charset = NULL; mime_part->description = g_strstrip (header_decode_string (header_value, charset)); break; @@ -488,7 +489,7 @@ camel_mime_part_set_encoding (CamelMimePart *mime_part, "Content-Transfer-Encoding", text); } -CamelMimePartEncodingType +const CamelMimePartEncodingType camel_mime_part_get_encoding (CamelMimePart *mime_part) { return mime_part->encoding; @@ -517,7 +518,7 @@ camel_mime_part_get_content_languages (CamelMimePart *mime_part) /* **** Content-Type: */ void -camel_mime_part_set_content_type (CamelMimePart *mime_part, const gchar *content_type) +camel_mime_part_set_content_type (CamelMimePart *mime_part, gchar *content_type) { camel_medium_set_header (CAMEL_MEDIUM (mime_part), "Content-Type", content_type); @@ -632,8 +633,11 @@ write_to_stream(CamelDataWrapper *data_wrapper, CamelStream *stream) d(printf("mime_part::write_to_stream\n")); /* FIXME: something needs to be done about this ... */ - /* TODO: content-languages header? */ - + /* FIXME: need to count these bytes too */ +#ifndef NO_WARNINGS +#warning content-languages should be stored as a header +#endif + if (mp->headers) { struct _header_raw *h = mp->headers; char *val; @@ -797,6 +801,10 @@ construct_from_parser(CamelMimePart *dw, CamelMimeParser *mp) } d(printf("mime_part::construct_from_parser() leaving\n")); +#ifndef NO_WARNINGS +#warning "Need to work out how to detect a (fatally) bad parse in the parser" +#endif + err = camel_mime_parser_errno(mp); if (err != 0) { errno = err; diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 6ba498ffa9..257c1574fc 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -39,6 +39,8 @@ #define MAXHOSTNAMELEN 1024 #endif +#include + #include #include @@ -46,8 +48,9 @@ #include #include +#include #include -#include +#include "e-time-utils.h" #include "camel-mime-utils.h" #include "camel-charset-map.h" @@ -1011,7 +1014,7 @@ rfc2047_decode_word(const char *in, size_t len) d(printf("found ?, encoding is '%c'\n", inptr[0])); inptr++; tmplen = inend-inptr-2; - decword = g_alloca (tmplen); /* this will always be more-than-enough room */ + decword = alloca(tmplen); /* this will always be more-than-enough room */ switch(toupper(inptr[0])) { case 'Q': inlen = quoted_decode(inptr+2, tmplen, decword); @@ -1032,7 +1035,7 @@ rfc2047_decode_word(const char *in, size_t len) if (inlen > 0) { /* yuck, all this snot is to setup iconv! */ tmplen = inptr - in - 3; - encname = g_alloca (tmplen + 1); + encname = alloca (tmplen + 1); memcpy (encname, in + 2, tmplen); encname[tmplen] = '\0'; @@ -1053,7 +1056,7 @@ rfc2047_decode_word(const char *in, size_t len) inbuf = decword; outlen = inlen * 6 + 16; - outbase = g_alloca (outlen); + outbase = alloca (outlen); outbuf = outbase; retry: @@ -1068,7 +1071,7 @@ rfc2047_decode_word(const char *in, size_t len) e_iconv_close (ic); } else { w(g_warning ("Cannot decode charset, header display may be corrupt: %s: %s", - charset, strerror (errno))); + charset, g_strerror (errno))); if (!retried) { charset = e_iconv_locale_charset (); @@ -1090,6 +1093,18 @@ rfc2047_decode_word(const char *in, size_t len) return decoded; } +/* grrr, glib should have this ! */ +static GString * +g_string_append_len(GString *st, const char *s, size_t l) +{ + char *tmp; + + tmp = alloca(l+1); + tmp[l]=0; + memcpy(tmp, s, l); + return g_string_append(st, tmp); +} + /* ok, a lot of mailers are BROKEN, and send iso-latin1 encoded headers, when they should just be sticking to US-ASCII according to the rfc's. Anyway, since the conversion to utf-8 @@ -1126,17 +1141,17 @@ append_8bit (GString *out, const char *inbuf, size_t inlen, const char *charset) outlen = inlen * 6 + 16; outbuf = outbase = g_malloc(outlen); - if (e_iconv (ic, &inbuf, &inlen, &outbuf, &outlen) == (size_t) -1) { - w(g_warning("Conversion to '%s' failed: %s", charset, strerror (errno))); + if (e_iconv(ic, &inbuf, &inlen, &outbuf, &outlen) == (size_t) -1) { + w(g_warning("Conversion to '%s' failed: %s", charset, strerror(errno))); g_free(outbase); - e_iconv_close (ic); + e_iconv_close(ic); return FALSE; } *outbuf = 0; g_string_append(out, outbase); g_free(outbase); - e_iconv_close (ic); + e_iconv_close(ic); return TRUE; @@ -1149,10 +1164,10 @@ header_decode_text (const char *in, size_t inlen, const char *default_charset) GString *out; const char *inptr, *inend, *start, *chunk, *locale_charset; char *dword = NULL; - - locale_charset = e_iconv_locale_charset (); - - out = g_string_new (""); + + locale_charset = e_iconv_locale_charset(); + + out = g_string_new(""); inptr = in; inend = inptr + inlen; chunk = NULL; @@ -1223,11 +1238,11 @@ rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char * /* convert utf8->encoding */ bufflen = len * 6 + 16; - buffer = g_alloca (bufflen); + buffer = alloca (bufflen); inlen = len; inptr = in; - ascii = g_alloca (bufflen); + ascii = alloca (bufflen); if (strcasecmp (type, "UTF-8") != 0) ic = e_iconv_open (type, "UTF-8"); @@ -1279,12 +1294,12 @@ rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char * convlen = MIN(inlen, CAMEL_FOLD_PREENCODED); p = inptr; if (e_iconv (ic, &inptr, &convlen, &out, &outlen) == (size_t) -1) { - w(g_warning("Conversion problem: conversion truncated: %s", strerror (errno))); + w(g_warning("Conversion problem: conversion truncated: %s", strerror(errno))); /* blah, we include it anyway, better than infinite loop ... */ inptr = p + convlen; } else { /* make sure we flush out any shift state */ - e_iconv (ic, NULL, 0, &out, &outlen); + e_iconv(ic, NULL, 0, &out, &outlen); } inlen -= (inptr - p); } @@ -1309,7 +1324,7 @@ rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char * } if (ic != (iconv_t) -1) - e_iconv_close (ic); + e_iconv_close(ic); } @@ -1561,8 +1576,6 @@ header_encode_phrase_get_words (const unsigned char *in) return words; } -#define MERGED_WORD_LT_FOLDLEN(wordlen, type) ((type) == WORD_2047 ? (wordlen) < CAMEL_FOLD_PREENCODED : (wordlen) < (CAMEL_FOLD_SIZE - 8)) - static gboolean header_encode_phrase_merge_words (GList **wordsp) { @@ -1580,15 +1593,13 @@ header_encode_phrase_merge_words (GList **wordsp) next = nextl->data; /* merge nodes of the same type AND we are not creating too long a string */ if (word_types_compatable (word->type, next->type)) { - if (MERGED_WORD_LT_FOLDLEN (next->end - word->start, MAX (word->type, next->type))) { + if (next->end - word->start < CAMEL_FOLD_PREENCODED) { /* the resulting word type is the MAX of the 2 types */ word->type = MAX(word->type, next->type); word->end = next->end; words = g_list_remove_link (words, nextl); - g_list_free_1 (nextl); g_free (next); - nextl = g_list_next (wordl); merged = TRUE; @@ -2338,7 +2349,7 @@ header_decode_addrspec(const char **in) */ static struct _header_address * -header_decode_mailbox(const char **in, const char *charset) +header_decode_mailbox(const char **in) { const char *inptr = *in; char *pre; @@ -2360,7 +2371,7 @@ header_decode_mailbox(const char **in, const char *charset) char *text, *last; /* perform internationalised decoding, and append */ - text = header_decode_string (pre, charset); + text = header_decode_string (pre, NULL); g_string_append (name, text); last = pre; g_free(text); @@ -2462,7 +2473,7 @@ header_decode_mailbox(const char **in, const char *charset) g_string_append_c(addr, *inptr); /* check for address is encoded word ... */ - text = header_decode_string(addr->str, charset); + text = header_decode_string(addr->str, NULL); if (name == NULL) { name = addr; addr = g_string_new(""); @@ -2518,7 +2529,7 @@ header_decode_mailbox(const char **in, const char *charset) if (comend > comstart) { d(printf(" looking at subset '%.*s'\n", comend-comstart, comstart)); tmp = g_strndup (comstart, comend-comstart); - text = header_decode_string (tmp, charset); + text = header_decode_string (tmp, NULL); name = g_string_new (text); g_free (tmp); g_free (text); @@ -2541,7 +2552,7 @@ header_decode_mailbox(const char **in, const char *charset) } static struct _header_address * -header_decode_address(const char **in, const char *charset) +header_decode_address(const char **in) { const char *inptr = *in; char *pre; @@ -2566,7 +2577,7 @@ header_decode_address(const char **in, const char *charset) if (*inptr != ';') { int go = TRUE; do { - member = header_decode_mailbox(&inptr, charset); + member = header_decode_mailbox(&inptr); if (member) header_address_add_member(addr, member); header_decode_lwsp(&inptr); @@ -2585,7 +2596,7 @@ header_decode_address(const char **in, const char *charset) } *in = inptr; } else { - addr = header_decode_mailbox(in, charset); + addr = header_decode_mailbox(in); } g_string_free(group, TRUE); @@ -2811,16 +2822,16 @@ header_references_dup(const struct _header_references *list) } struct _header_address * -header_mailbox_decode(const char *in, const char *charset) +header_mailbox_decode(const char *in) { if (in == NULL) return NULL; - return header_decode_mailbox(&in, charset); + return header_decode_mailbox(&in); } struct _header_address * -header_address_decode(const char *in, const char *charset) +header_address_decode(const char *in) { const char *inptr = in, *last; struct _header_address *list = NULL, *addr; @@ -2836,7 +2847,7 @@ header_address_decode(const char *in, const char *charset) do { last = inptr; - addr = header_decode_address(&inptr, charset); + addr = header_decode_address(&inptr); if (addr) header_address_list_append(&list, addr); header_decode_lwsp(&inptr); @@ -3055,7 +3066,7 @@ header_encode_param (const unsigned char *in, gboolean *encoded) inbuf = in; if (e_iconv (cd, &inbuf, &inleft, &outptr, &outleft) == (size_t) -1) { - w(g_warning ("Conversion problem: conversion truncated: %s", strerror (errno))); + w(g_warning ("Conversion problem: conversion truncated: %s", g_strerror (errno))); } else { e_iconv (cd, NULL, 0, &outptr, &outleft); } @@ -3068,7 +3079,7 @@ header_encode_param (const unsigned char *in, gboolean *encoded) /* FIXME: set the 'language' as well, assuming we can get that info...? */ out = g_string_new (""); - g_string_append_printf (out, "%s''", charset); + g_string_sprintfa (out, "%s''", charset); while (inptr < inend) { unsigned char c = *inptr++; @@ -3076,9 +3087,9 @@ header_encode_param (const unsigned char *in, gboolean *encoded) /* FIXME: make sure that '\'', '*', and ';' are also encoded */ if (c > 127) { - g_string_append_printf (out, "%%%c%c", tohex[(c >> 4) & 0xf], tohex[c & 0xf]); + g_string_sprintfa (out, "%%%c%c", tohex[(c >> 4) & 0xf], tohex[c & 0xf]); } else if (is_lwsp (c) || !(camel_mime_special_table[c] & IS_ESAFE)) { - g_string_append_printf (out, "%%%c%c", tohex[(c >> 4) & 0xf], tohex[c & 0xf]); + g_string_sprintfa (out, "%%%c%c", tohex[(c >> 4) & 0xf], tohex[c & 0xf]); } else { g_string_append_c (out, c); } @@ -3165,7 +3176,7 @@ header_param_list_format_append (GString *out, struct _header_param *p) used = 0; } - g_string_append_printf (out, "%s*%d%s=", p->name, i++, encoded ? "*" : ""); + g_string_sprintfa (out, "%s*%d%s=", p->name, i++, encoded ? "*" : ""); if (encoded || !quote) g_string_append_len (out, inptr, ptr - inptr); else @@ -3178,7 +3189,7 @@ header_param_list_format_append (GString *out, struct _header_param *p) inptr = ptr; } } else { - g_string_append_printf (out, "%s%s=", p->name, encoded ? "*" : ""); + g_string_sprintfa (out, "%s%s=", p->name, encoded ? "*" : ""); if (encoded || !quote) g_string_append (out, value); @@ -3264,32 +3275,31 @@ header_content_type_dump(struct _header_content_type *ct) } char * -header_content_type_format (struct _header_content_type *ct) +header_content_type_format(struct _header_content_type *ct) { GString *out; char *ret; - - if (ct == NULL) + + if (ct==NULL) return NULL; - - out = g_string_new (""); + + out = g_string_new(""); if (ct->type == NULL) { - g_string_append_printf (out, "text/plain"); - w(g_warning ("Content-Type with no main type")); + g_string_sprintfa(out, "text/plain"); + w(g_warning("Content-Type with no main type")); } else if (ct->subtype == NULL) { - w(g_warning ("Content-Type with no sub type: %s", ct->type)); - if (!strcasecmp (ct->type, "multipart")) - g_string_append_printf (out, "%s/mixed", ct->type); + w(g_warning("Content-Type with no sub type: %s", ct->type)); + if (!strcasecmp(ct->type, "multipart")) + g_string_sprintfa(out, "%s/mixed", ct->type); else - g_string_append_printf (out, "%s", ct->type); + g_string_sprintfa(out, "%s", ct->type); } else { - g_string_append_printf (out, "%s/%s", ct->type, ct->subtype); + g_string_sprintfa(out, "%s/%s", ct->type, ct->subtype); } - header_param_list_format_append (out, ct->params); - + header_param_list_format_append(out, ct->params); + ret = out->str; - g_string_free (out, FALSE); - + g_string_free(out, FALSE); return ret; } @@ -3617,7 +3627,7 @@ header_raw_append_parse(struct _header_raw **list, const char *header, int offse printf("Invalid header line: '%s'\n", header); return; } - name = g_alloca (fieldlen + 1); + name = alloca(fieldlen+1); memcpy(name, header, fieldlen); name[fieldlen] = 0; @@ -4002,10 +4012,10 @@ void header_address_list_clear(struct _header_address **l) /* if encode is true, then the result is suitable for mailing, otherwise the result is suitable for display only (and may not even be re-parsable) */ static void -header_address_list_encode_append (GString *out, int encode, struct _header_address *a) +header_address_list_encode_append(GString *out, int encode, struct _header_address *a) { char *text; - + while (a) { switch (a->type) { case HEADER_ADDRESS_NAME: @@ -4014,65 +4024,64 @@ header_address_list_encode_append (GString *out, int encode, struct _header_addr else text = a->name; if (text && *text) - g_string_append_printf (out, "%s <%s>", text, a->v.addr); + g_string_sprintfa(out, "%s <%s>", text, a->v.addr); else - g_string_append (out, a->v.addr); + g_string_append(out, a->v.addr); if (encode) - g_free (text); + g_free(text); break; case HEADER_ADDRESS_GROUP: if (encode) - text = header_encode_phrase (a->name); + text = header_encode_phrase(a->name); else text = a->name; - g_string_append_printf (out, "%s: ", text); - header_address_list_encode_append (out, encode, a->v.members); - g_string_append_printf (out, ";"); + g_string_sprintfa(out, "%s: ", text); + header_address_list_encode_append(out, encode, a->v.members); + g_string_sprintfa(out, ";"); if (encode) - g_free (text); + g_free(text); break; default: - g_warning ("Invalid address type"); + g_warning("Invalid address type"); break; } a = a->next; if (a) - g_string_append (out, ", "); + g_string_append(out, ", "); } } char * -header_address_list_encode (struct _header_address *a) +header_address_list_encode(struct _header_address *a) { GString *out; char *ret; - + if (a == NULL) return NULL; - - out = g_string_new (""); - header_address_list_encode_append (out, TRUE, a); + + out = g_string_new(""); + + header_address_list_encode_append(out, TRUE, a); ret = out->str; - g_string_free (out, FALSE); - + g_string_free(out, FALSE); return ret; } char * -header_address_list_format (struct _header_address *a) +header_address_list_format(struct _header_address *a) { GString *out; char *ret; - + if (a == NULL) return NULL; - - out = g_string_new (""); - - header_address_list_encode_append (out, FALSE, a); + + out = g_string_new(""); + + header_address_list_encode_append(out, FALSE, a); ret = out->str; - g_string_free (out, FALSE); - + g_string_free(out, FALSE); return ret; } diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h index b949ffcf98..303f29be07 100644 --- a/camel/camel-mime-utils.h +++ b/camel/camel-mime-utils.h @@ -111,8 +111,8 @@ void header_address_list_append_list(struct _header_address **l, struct _header_ void header_address_list_append(struct _header_address **, struct _header_address *); void header_address_list_clear(struct _header_address **); -struct _header_address *header_address_decode(const char *in, const char *charset); -struct _header_address *header_mailbox_decode(const char *in, const char *charset); +struct _header_address *header_address_decode(const char *in); +struct _header_address *header_mailbox_decode(const char *in); /* for mailing */ char *header_address_list_encode(struct _header_address *a); /* for display */ diff --git a/camel/camel-multipart-signed.c b/camel/camel-multipart-signed.c index 79252c85d0..9bf7054b87 100644 --- a/camel/camel-multipart-signed.c +++ b/camel/camel-multipart-signed.c @@ -24,10 +24,6 @@ #include #endif -#ifdef HAVE_ALLOCA_H -#include -#endif - #include #include @@ -47,6 +43,7 @@ #include "camel-stream-filter.h" #include "camel-seekable-substream.h" +#include "camel-mime-filter-chomp.h" #include "camel-mime-filter-crlf.h" #include "camel-mime-filter-canon.h" diff --git a/camel/camel-sasl-gssapi.c b/camel/camel-sasl-gssapi.c index 9faa1d8091..4f15c43821 100644 --- a/camel/camel-sasl-gssapi.c +++ b/camel/camel-sasl-gssapi.c @@ -264,7 +264,9 @@ gssapi_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex) challenge = g_byte_array_new (); g_byte_array_append (challenge, outbuf.value, outbuf.length); +#ifndef HAVE_HEIMDAL_KRB5 gss_release_buffer (&minor, &outbuf); +#endif break; case GSSAPI_STATE_COMPLETE: if (token == NULL) { @@ -285,7 +287,9 @@ gssapi_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex) if (outbuf.length < 4) { camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, _("Bad authentication response from server.")); +#ifndef HAVE_HEIMDAL_KRB5 gss_release_buffer (&minor, &outbuf); +#endif return NULL; } @@ -302,7 +306,10 @@ gssapi_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex) memcpy (inbuf.value, outbuf.value, 4); str[0] = DESIRED_SECURITY_LAYER; memcpy (str + 4, sasl->service->url->user, inbuf.length - 4); + +#ifndef HAVE_HEIMDAL_KRB5 gss_release_buffer (&minor, &outbuf); +#endif major = gss_wrap (&minor, priv->ctx, FALSE, qop, &inbuf, &conf_state, &outbuf); if (major != GSS_S_COMPLETE) { @@ -314,7 +321,10 @@ gssapi_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex) g_free (str); challenge = g_byte_array_new (); g_byte_array_append (challenge, outbuf.value, outbuf.length); + +#ifndef HAVE_HEIMDAL_KRB5 gss_release_buffer (&minor, &outbuf); +#endif priv->state = GSSAPI_STATE_AUTHENTICATED; diff --git a/camel/camel-stream-filter.c b/camel/camel-stream-filter.c index e17fcb8377..5330dfadb7 100644 --- a/camel/camel-stream-filter.c +++ b/camel/camel-stream-filter.c @@ -51,7 +51,7 @@ struct _CamelStreamFilterPrivate { size_t filteredlen; int last_was_read:1; /* was the last op read or write? */ - int flushed:1; /* were the filters flushed? */ + int flushed:1 /* were the filters flushed? */ }; #define READ_PAD (128) /* bytes padded before buffer */ @@ -376,7 +376,7 @@ do_eos (CamelStream *stream) { CamelStreamFilter *filter = (CamelStreamFilter *)stream; struct _CamelStreamFilterPrivate *p = _PRIVATE(filter); - + if (p->filteredlen > 0) return FALSE; diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c index 3a3f234544..f2491d48d4 100644 --- a/camel/camel-tcp-stream-ssl.c +++ b/camel/camel-tcp-stream-ssl.c @@ -89,7 +89,6 @@ struct _CamelTcpStreamSSLPrivate { CamelService *service; char *expected_host; gboolean ssl_mode; - guint32 flags; }; static void @@ -161,7 +160,6 @@ camel_tcp_stream_ssl_get_type (void) * camel_tcp_stream_ssl_new: * @service: camel service * @expected_host: host that the stream is expected to connect with. - * @flags: ENABLE_SSL2, ENABLE_SSL3 and/or ENABLE_TLS * * Since the SSL certificate authenticator may need to prompt the * user, a CamelService is needed. @expected_host is needed as a @@ -170,7 +168,7 @@ camel_tcp_stream_ssl_get_type (void) * Return value: a ssl stream (in ssl mode) **/ CamelStream * -camel_tcp_stream_ssl_new (CamelService *service, const char *expected_host, guint32 flags) +camel_tcp_stream_ssl_new (CamelService *service, const char *expected_host) { CamelTcpStreamSSL *stream; @@ -179,7 +177,6 @@ camel_tcp_stream_ssl_new (CamelService *service, const char *expected_host, guin stream->priv->service = service; stream->priv->expected_host = g_strdup (expected_host); stream->priv->ssl_mode = TRUE; - stream->priv->flags = flags; return CAMEL_STREAM (stream); } @@ -189,7 +186,6 @@ camel_tcp_stream_ssl_new (CamelService *service, const char *expected_host, guin * camel_tcp_stream_ssl_new_raw: * @service: camel service * @expected_host: host that the stream is expected to connect with. - * @flags: ENABLE_SSL2, ENABLE_SSL3 and/or ENABLE_TLS * * Since the SSL certificate authenticator may need to prompt the * user, a CamelService is needed. @expected_host is needed as a @@ -198,7 +194,7 @@ camel_tcp_stream_ssl_new (CamelService *service, const char *expected_host, guin * Return value: a ssl-capable stream (in non ssl mode) **/ CamelStream * -camel_tcp_stream_ssl_new_raw (CamelService *service, const char *expected_host, guint32 flags) +camel_tcp_stream_ssl_new_raw (CamelService *service, const char *expected_host) { CamelTcpStreamSSL *stream; @@ -207,7 +203,6 @@ camel_tcp_stream_ssl_new_raw (CamelService *service, const char *expected_host, stream->priv->service = service; stream->priv->expected_host = g_strdup (expected_host); stream->priv->ssl_mode = FALSE; - stream->priv->flags = flags; return CAMEL_STREAM (stream); } @@ -630,49 +625,37 @@ camel_certdb_nss_cert_get(CamelCertDB *certdb, CERTCertificate *cert) { char *fingerprint, *path; CamelCert *ccert; - struct stat st; - size_t nread; - ssize_t n; int fd; - - fingerprint = cert_fingerprint (cert); - ccert = camel_certdb_get_cert (certdb, fingerprint); + ssize_t len; + struct stat st; + + fingerprint = cert_fingerprint(cert); + ccert = camel_certdb_get_cert(certdb, fingerprint); if (ccert == NULL) { - g_free (fingerprint); + g_free(fingerprint); return ccert; } - + if (ccert->rawcert == NULL) { - path = g_strdup_printf ("%s/.camel_certs/%s", getenv ("HOME"), fingerprint); - if (stat (path, &st) == -1 - || (fd = open (path, O_RDONLY)) == -1) { - g_warning ("could not load cert %s: %s", path, strerror (errno)); - g_free (fingerprint); - g_free (path); - camel_cert_set_trust (certdb, ccert, CAMEL_CERT_TRUST_UNKNOWN); - camel_certdb_touch (certdb); - + path = g_strdup_printf("%s/.camel_certs/%s", getenv("HOME"), fingerprint); + if (stat(path, &st) == -1 + || (fd = open(path, O_RDONLY)) == -1) { + g_warning("could not load cert %s: %s", path, strerror(errno)); + g_free(fingerprint); + g_free(path); + camel_cert_set_trust(certdb, ccert, CAMEL_CERT_TRUST_UNKNOWN); + camel_certdb_touch(certdb); + return ccert; } g_free(path); - ccert->rawcert = g_byte_array_new (); - g_byte_array_set_size (ccert->rawcert, st.st_size); - - nread = 0; - do { - do { - n = read (fd, ccert->rawcert->data + nread, st.st_size - nread); - } while (n == -1 && errno == EINTR); - - if (n > 0) - nread += n; - } while (nread < st.st_size && n != -1); - - close (fd); - - if (nread != st.st_size) { - g_warning ("cert size read truncated %s: %d != %ld", path, nread, st.st_size); + ccert->rawcert = g_byte_array_new(); + g_byte_array_set_size(ccert->rawcert, st.st_size); + len = read(fd, ccert->rawcert->data, st.st_size); + close(fd); + if (len != st.st_size) { + g_warning("cert size read truncated %s: %d != %ld", path, len, st.st_size); g_byte_array_free(ccert->rawcert, TRUE); ccert->rawcert = NULL; g_free(fingerprint); @@ -728,12 +711,11 @@ camel_certdb_nss_cert_set(CamelCertDB *certdb, CamelCert *ccert, CERTCertificate struct stat st; fingerprint = ccert->fingerprint; - + if (ccert->rawcert == NULL) - ccert->rawcert = g_byte_array_new (); - - g_byte_array_set_size (ccert->rawcert, cert->derCert.len); - memcpy (ccert->rawcert->data, cert->derCert.data, cert->derCert.len); + ccert->rawcert = g_byte_array_new(); + g_byte_array_set_size(ccert->rawcert, cert->derCert.len); + memcpy(ccert->rawcert->data, cert->derCert.data, cert->derCert.len); dir = g_strdup_printf ("%s/.camel_certs", getenv ("HOME")); if (stat (dir, &st) == -1 && mkdir (dir, 0700) == -1) { @@ -745,19 +727,19 @@ camel_certdb_nss_cert_set(CamelCertDB *certdb, CamelCert *ccert, CERTCertificate path = g_strdup_printf ("%s/%s", dir, fingerprint); g_free (dir); - stream = camel_stream_fs_new_with_name (path, O_WRONLY | O_CREAT | O_TRUNC, 0600); + stream = camel_stream_fs_new_with_name(path, O_WRONLY|O_CREAT|O_TRUNC, 0600); if (stream != NULL) { - if (camel_stream_write (stream, ccert->rawcert->data, ccert->rawcert->len) == -1) { - g_warning ("Could not save cert: %s: %s", path, strerror (errno)); - unlink (path); + if (camel_stream_write(stream, ccert->rawcert->data, ccert->rawcert->len) != ccert->rawcert->len) { + g_warning("Could not save cert: %s: %s", path, strerror(errno)); + unlink(path); } - camel_stream_close (stream); - camel_object_unref (stream); + camel_stream_close(stream); + camel_object_unref(stream); } else { - g_warning ("Could not save cert: %s: %s", path, strerror (errno)); + g_warning("Could not save cert: %s: %s", path, strerror(errno)); } - g_free (path); + g_free(path); } @@ -996,19 +978,6 @@ enable_ssl (CamelTcpStreamSSL *ssl, PRFileDesc *fd) return NULL; SSL_OptionSet (ssl_fd, SSL_SECURITY, PR_TRUE); - if (ssl->priv->flags & CAMEL_TCP_STREAM_SSL_ENABLE_SSL2) - SSL_OptionSet (ssl_fd, SSL_ENABLE_SSL2, PR_TRUE); - else - SSL_OptionSet (ssl_fd, SSL_ENABLE_SSL2, PR_FALSE); - if (ssl->priv->flags & CAMEL_TCP_STREAM_SSL_ENABLE_SSL3) - SSL_OptionSet (ssl_fd, SSL_ENABLE_SSL3, PR_TRUE); - else - SSL_OptionSet (ssl_fd, SSL_ENABLE_SSL3, PR_FALSE); - if (ssl->priv->flags & CAMEL_TCP_STREAM_SSL_ENABLE_TLS) - SSL_OptionSet (ssl_fd, SSL_ENABLE_TLS, PR_TRUE); - else - SSL_OptionSet (ssl_fd, SSL_ENABLE_TLS, PR_FALSE); - SSL_SetURL (ssl_fd, ssl->priv->expected_host); /*SSL_GetClientAuthDataHook (sslSocket, ssl_get_client_auth, (void *) certNickname);*/ diff --git a/camel/providers/imap/camel-imap-store-summary.c b/camel/providers/imap/camel-imap-store-summary.c index 5ba3f955e2..63444f44c3 100644 --- a/camel/providers/imap/camel-imap-store-summary.c +++ b/camel/providers/imap/camel-imap-store-summary.c @@ -32,7 +32,7 @@ #include "camel-file-utils.h" -#include "string-utils.h" +#include "hash-table-utils.h" #include "e-util/md5-utils.h" #include "e-util/e-memory.h" @@ -366,7 +366,7 @@ CamelImapStoreNamespace *camel_imap_store_summary_namespace_new(CamelImapStoreSu CamelImapStoreNamespace *ns; char *p; int len; - + ns = g_malloc0(sizeof(*ns)); ns->full_name = g_strdup(full_name); len = strlen(ns->full_name)-1; diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 7004b7d6a7..0fba62fe36 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -519,7 +519,7 @@ imap_get_capability (CamelService *service, CamelException *ex) continue; } for (i = 0; capabilities[i].name; i++) { - if (strcasecmp (capa, capabilities[i].name) == 0) { + if (g_strcasecmp (capa, capabilities[i].name) == 0) { store->capabilities |= capabilities[i].flag; break; } @@ -544,9 +544,6 @@ enum { USE_SSL_WHEN_POSSIBLE }; -#define SSL_PORT_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 | CAMEL_TCP_STREAM_SSL_ENABLE_SSL3) -#define STARTTLS_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_TLS) - static gboolean connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelException *ex) { @@ -566,11 +563,11 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE #ifdef HAVE_SSL if (ssl_mode != USE_SSL_NEVER) { - if (try_starttls) { - tcp_stream = camel_tcp_stream_ssl_new_raw (service, service->url->host, STARTTLS_FLAGS); - } else { + if (try_starttls) + tcp_stream = camel_tcp_stream_ssl_new_raw (service, service->url->host); + else { port = service->url->port ? service->url->port : 993; - tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host, SSL_PORT_FLAGS); + tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host); } } else { tcp_stream = camel_tcp_stream_raw_new (); @@ -909,8 +906,8 @@ imap_forget_folder (CamelImapStore *imap_store, const char *folder_name, CamelEx if (cache) camel_imap_message_cache_clear (cache); - camel_object_unref (cache); - camel_object_unref (summary); + camel_object_unref (CAMEL_OBJECT (cache)); + camel_object_unref (CAMEL_OBJECT (summary)); unlink (summary_file); g_free (summary_file); @@ -954,6 +951,13 @@ imap_check_folder_still_extant (CamelImapStore *imap_store, const char *full_nam return TRUE; } +static void +copy_folder(char *key, CamelFolder *folder, GPtrArray *out) +{ + g_ptr_array_add(out, folder); + camel_object_ref((CamelObject *)folder); +} + /* This is a little 'hack' to avoid the deadlock conditions that would otherwise ensue when calling camel_folder_refresh_info from inside a lock */ /* NB: on second thougts this is probably not entirely safe, but it'll do for now */ @@ -968,7 +972,10 @@ imap_store_refresh_folders (CamelImapStore *store, CamelException *ex) GPtrArray *folders; int i; - folders = camel_object_bag_list(CAMEL_STORE (store)->folders); + folders = g_ptr_array_new(); + CAMEL_STORE_LOCK(store, cache_lock); + g_hash_table_foreach (CAMEL_STORE (store)->folders, (GHFunc)copy_folder, folders); + CAMEL_STORE_UNLOCK(store, cache_lock); for (i = 0; i len; i++) { CamelFolder *folder = folders->pdata[i]; @@ -985,12 +992,12 @@ imap_store_refresh_folders (CamelImapStore *store, CamelException *ex) * after being offline */ namedup = g_strdup (folder->full_name); - camel_object_unref(folder); + camel_object_unref((CamelObject *)folder); imap_folder_effectively_unsubscribed (store, namedup, ex); imap_forget_folder (store, namedup, ex); g_free (namedup); } else - camel_object_unref(folder); + camel_object_unref((CamelObject *)folder); } g_ptr_array_free (folders, TRUE); @@ -1097,7 +1104,8 @@ imap_auth_loop (CamelService *service, CamelException *ex) while (!authenticated) { if (errbuf) { /* We need to un-cache the password before prompting again */ - camel_session_forget_password (session, service, "password", ex); + camel_session_forget_password ( + session, service, "password", ex); g_free (service->url->passwd); service->url->passwd = NULL; } @@ -1111,8 +1119,9 @@ imap_auth_loop (CamelService *service, CamelException *ex) service->url->user, service->url->host); service->url->passwd = - camel_session_get_password (session, prompt, FALSE, TRUE, - service, "password", ex); + camel_session_get_password ( + session, prompt, TRUE, + service, "password", ex); g_free (prompt); g_free (errbuf); errbuf = NULL; @@ -1202,7 +1211,7 @@ imap_connect_online (CamelService *service, CamelException *ex) imap_namespaces_destroy (namespaces); /* end new code */ - name = camel_strstrcase (result, "NAMESPACE (("); + name = strstrcase (result, "NAMESPACE (("); if (name) { char *sep; @@ -1471,7 +1480,7 @@ imap_noop (CamelStore *store, CamelException *ex) static guint hash_folder_name (gconstpointer key) { - if (strcasecmp (key, "INBOX") == 0) + if (g_strcasecmp (key, "INBOX") == 0) return g_str_hash ("INBOX"); else return g_str_hash (key); @@ -1482,9 +1491,9 @@ compare_folder_name (gconstpointer a, gconstpointer b) { gconstpointer aname = a, bname = b; - if (strcasecmp (a, "INBOX") == 0) + if (g_strcasecmp (a, "INBOX") == 0) aname = "INBOX"; - if (strcasecmp (b, "INBOX") == 0) + if (g_strcasecmp (b, "INBOX") == 0) bname = "INBOX"; return g_str_equal (aname, bname); } @@ -1528,7 +1537,7 @@ get_folder_status (CamelImapStore *imap_store, const char *folder_name, const ch if (!status) return -1; - p = camel_strstrcase (status, type); + p = strstrcase (status, type); if (p) out = strtoul (p + strlen (type), NULL, 10); else @@ -1550,7 +1559,7 @@ get_folder_online (CamelStore *store, const char *folder_name, if (!camel_imap_store_connected (imap_store, ex)) return NULL; - if (!strcasecmp (folder_name, "INBOX")) + if (!g_strcasecmp (folder_name, "INBOX")) folder_name = "INBOX"; /* Lock around the whole lot to check/create atomically */ @@ -1626,7 +1635,7 @@ get_folder_offline (CamelStore *store, const char *folder_name, !camel_service_connect (CAMEL_SERVICE (store), ex)) return NULL; - if (!strcasecmp (folder_name, "INBOX")) + if (!g_strcasecmp (folder_name, "INBOX")) folder_name = "INBOX"; storage_path = g_strdup_printf("%s/folders", imap_store->storage_path); @@ -1951,8 +1960,8 @@ parse_list_response_as_folder_info (CamelImapStore *imap_store, const char *response) { CamelFolderInfo *fi; - int flags; - char sep, *dir; + int flags, i; + char sep, *dir, *name = NULL, *path; CamelURL *url; CamelImapStoreInfo *si; guint32 newflags; @@ -2189,25 +2198,30 @@ get_folder_counts(CamelImapStore *imap_store, CamelFolderInfo *fi, CamelExceptio } else { fi->unread_message_count = get_folder_status (imap_store, fi->full_name, "UNSEEN"); /* if we have this folder open, and the unread count has changed, update */ - folder = camel_object_bag_get(CAMEL_STORE(imap_store)->folders, fi->full_name); - if (folder && fi->unread_message_count != camel_folder_get_unread_message_count(folder)) { + CAMEL_STORE_LOCK(imap_store, cache_lock); + folder = g_hash_table_lookup(CAMEL_STORE(imap_store)->folders, fi->full_name); + if (folder && fi->unread_message_count != camel_folder_get_unread_message_count(folder)) + camel_object_ref(folder); + else + folder = NULL; + CAMEL_STORE_UNLOCK(imap_store, cache_lock); + if (folder) { CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(folder))->refresh_info(folder, ex); fi->unread_message_count = camel_folder_get_unread_message_count(folder); - } - if (folder) camel_object_unref(folder); - + } } CAMEL_SERVICE_UNLOCK (imap_store, connect_lock); } else { /* since its cheap, get it if they're open */ - folder = camel_object_bag_get(CAMEL_STORE(imap_store)->folders, fi->full_name); - if (folder) { + CAMEL_STORE_LOCK(imap_store, cache_lock); + folder = g_hash_table_lookup(CAMEL_STORE(imap_store)->folders, fi->full_name); + if (folder) fi->unread_message_count = camel_folder_get_unread_message_count(folder); - camel_object_unref(folder); - } else + else fi->unread_message_count = -1; + CAMEL_STORE_UNLOCK(imap_store, cache_lock); } if (fi->child) diff --git a/camel/providers/sendmail/camel-sendmail-transport.c b/camel/providers/sendmail/camel-sendmail-transport.c index 863daf1bca..f7059198b0 100644 --- a/camel/providers/sendmail/camel-sendmail-transport.c +++ b/camel/providers/sendmail/camel-sendmail-transport.c @@ -189,8 +189,6 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message, /* Parent process. Write the message out. */ close (fd[0]); out = camel_stream_fs_new_with_fd (fd[1]); - - /* workaround for lame sendmail implementations that can't handle CRLF eoln sequences */ filter = camel_stream_filter_new_with_stream (out); crlf = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_DECODE, CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY); camel_stream_filter_add (filter, crlf); diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 86caa635dc..bfe9737d40 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -81,7 +81,8 @@ static gboolean smtp_auth (CamelSmtpTransport *transport, const char *mech, Came static gboolean smtp_mail (CamelSmtpTransport *transport, const char *sender, gboolean has_8bit_parts, CamelException *ex); static gboolean smtp_rcpt (CamelSmtpTransport *transport, const char *recipient, CamelException *ex); -static gboolean smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelException *ex); +static gboolean smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, + gboolean has_8bit_parts, CamelException *ex); static gboolean smtp_rset (CamelSmtpTransport *transport, CamelException *ex); static gboolean smtp_quit (CamelSmtpTransport *transport, CamelException *ex); @@ -227,9 +228,6 @@ smtp_error_string (int error) } } -#define SSL_PORT_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 | CAMEL_TCP_STREAM_SSL_ENABLE_SSL3) -#define STARTTLS_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_TLS) - static gboolean connect_to_server (CamelService *service, int try_starttls, CamelException *ex) { @@ -254,11 +252,11 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex) #ifdef HAVE_SSL if (transport->flags & CAMEL_SMTP_TRANSPORT_USE_SSL) { - if (try_starttls) { - tcp_stream = camel_tcp_stream_ssl_new_raw (service, service->url->host, STARTTLS_FLAGS); - } else { + if (try_starttls) + tcp_stream = camel_tcp_stream_ssl_new_raw (service, service->url->host); + else { port = service->url->port ? service->url->port : 465; - tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host, SSL_PORT_FLAGS); + tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host); } } else { tcp_stream = camel_tcp_stream_raw_new (); @@ -501,7 +499,7 @@ smtp_connect (CamelService *service, CamelException *ex) while (!authenticated) { if (errbuf) { /* We need to un-cache the password before prompting again */ - camel_session_forget_password (session, service, "password", NULL); + camel_session_forget_password (session, service, "password", ex); g_free (service->url->passwd); service->url->passwd = NULL; } @@ -513,7 +511,7 @@ smtp_connect (CamelService *service, CamelException *ex) errbuf ? errbuf : "", service->url->user, service->url->host); - service->url->passwd = camel_session_get_password (session, prompt, FALSE, TRUE, + service->url->passwd = camel_session_get_password (session, prompt, TRUE, service, "password", ex); g_free (prompt); @@ -521,6 +519,8 @@ smtp_connect (CamelService *service, CamelException *ex) errbuf = NULL; if (!service->url->passwd) { + camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, + _("You didn't enter a password.")); camel_service_disconnect (service, TRUE, NULL); return FALSE; } @@ -721,7 +721,10 @@ smtp_send_to (CamelTransport *transport, CamelMimeMessage *message, } } - if (!smtp_data (smtp_transport, message, ex)) { + /* passing in has_8bit_parts saves time as we don't have to + recurse through the message all over again if the user is + not sending 8bit mime parts */ + if (!smtp_data (smtp_transport, message, has_8bit_parts, ex)) { camel_operation_end (NULL); return FALSE; } @@ -1218,23 +1221,26 @@ smtp_rcpt (CamelSmtpTransport *transport, const char *recipient, CamelException } static gboolean -smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelException *ex) +smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, gboolean has_8bit_parts, CamelException *ex) { CamelBestencEncoding enctype = CAMEL_BESTENC_8BIT; - struct _header_raw *header, *savedbcc, *n, *tail; char *cmdbuf, *respbuf = NULL; CamelStreamFilter *filtered_stream; CamelMimeFilter *crlffilter; + struct _header_raw *header; + GSList *h, *bcc = NULL; int ret; - /* If the server doesn't support 8BITMIME, set our required encoding to be 7bit */ - if (!(transport->flags & CAMEL_SMTP_TRANSPORT_8BITMIME)) + /* if the message contains 8bit/binary mime parts and the server + doesn't support it, set our required encoding to be 7bit */ + if (has_8bit_parts && !(transport->flags & CAMEL_SMTP_TRANSPORT_8BITMIME)) enctype = CAMEL_BESTENC_7BIT; /* FIXME: should we get the best charset too?? */ - /* Changes the encoding of all mime parts to fit within our required - encoding type and also force any text parts with long lines (longer - than 998 octets) to wrap by QP or base64 encoding them. */ + /* Changes the encoding of any 8bit/binary mime parts to fit + within our required encoding type and also force any text + parts with long lines (longer than 998 octets) to wrap by + QP or base64 encoding them. */ camel_mime_message_set_best_encoding (message, CAMEL_BESTENC_GET_ENCODING, enctype); cmdbuf = g_strdup ("DATA\r\n"); @@ -1278,30 +1284,29 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelExcept camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (crlffilter)); camel_object_unref (CAMEL_OBJECT (crlffilter)); - /* unlink the bcc headers */ - savedbcc = NULL; - tail = (struct _header_raw *) &savedbcc; - - header = (struct _header_raw *) &CAMEL_MIME_PART (message)->headers; - n = header->next; - while (n != NULL) { - if (!strcasecmp (n->name, "Bcc")) { - header->next = n->next; - tail->next = n; - n->next = NULL; - tail = n; - } else { - header = n; - } - - n = header->next; + /* copy and remove the bcc headers */ + header = CAMEL_MIME_PART (message)->headers; + while (header) { + if (!g_strcasecmp (header->name, "Bcc")) + bcc = g_slist_append (bcc, g_strdup (header->value)); + header = header->next; } + camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc"); + /* write the message */ ret = camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (filtered_stream)); - /* restore the bcc headers */ - header->next = savedbcc; + /* add the bcc headers back */ + if (bcc) { + h = bcc; + while (h) { + camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", h->data); + g_free (h->data); + h = h->next; + } + g_slist_free (bcc); + } if (ret == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, -- cgit v1.2.3