From 76bbd700763e4b45614df6ad6174fe831ddb932e Mon Sep 17 00:00:00 2001 From: nobody Date: Thu, 24 Jan 2002 19:01:46 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'EVOLUTION_1_0_2'. svn path=/tags/EVOLUTION_1_0_2/; revision=15455 --- camel/ChangeLog | 418 ++-------------------------- camel/Makefile.am | 12 +- camel/camel-charset-map-private.h | 296 +++++++------------- camel/camel-charset-map.c | 63 +---- camel/camel-folder-summary.c | 10 - camel/camel-mime-filter-basic.c | 65 +---- camel/camel-mime-part-utils.c | 72 ++--- camel/camel-mime-utils.c | 177 ++++++------ camel/camel-mime-utils.h | 11 +- camel/camel-pgp-mime.c | 47 +++- camel/camel-service.c | 8 +- camel/camel-tcp-stream-ssl.c | 68 ++--- camel/providers/imap/camel-imap-command.c | 49 ++-- camel/providers/imap/camel-imap-folder.c | 360 ++++++++++-------------- camel/providers/imap/camel-imap-utils.c | 357 +++--------------------- camel/providers/local/camel-local-folder.c | 1 + camel/providers/nntp/Makefile.am | 38 +-- camel/providers/smtp/camel-smtp-transport.c | 74 ++--- 18 files changed, 558 insertions(+), 1568 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index c3265b3675..37d4aba877 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,140 +1,8 @@ -2002-01-22 Jeffrey Stedfast - - * camel-filter-driver.c (camel_filter_driver_remove_rule_by_name): - New function to remove a filter rule by name. - -2002-01-21 Jeffrey Stedfast - - * camel-filter-driver.c (do_beep): As a temporary solution, just - printf ("\a"); to make a beep :-) - - * providers/imap/camel-imap-command.c - (imap_command_strdup_vprintf): Encode the mailbox to UTF-7 here. - - * providers/imap/camel-imap-utils.c (imap_parse_list_response): - Decode the mailbox name as we parse the list response. - (imap_mailbox_decode): It's only an illegal mailbox name if it - didn't switch back to US-ASCII mode. - -2002-01-18 Jeffrey Stedfast - - * providers/imap/camel-imap-utils.c (imap_mailbox_decode): New - function to decode an IMAP mailbox name from modified UTF-7 - encoding to UTF-8. - (imap_mailbox_encode): New function to convert a mailbox name from - UTF-8 to IMAP's modified UTF-7 encoding. - -2002-01-17 Jeffrey Stedfast - - * camel-mime-filter-basic.c (filter): Stop uudecoding once the - CAMEL_UUDECODE_STATE_END state bit gets set. Set the - CAMEL_UUDECODE_STATE_BEGIN state bit once we find the begin line. - (reset): No longer have uu_begin or uulen state variables, these - are now stuffed into a single state variable. - - * camel-mime-utils.c (uudecode_step): No longer needs a uulen - argument and also keeps track of whether or not the end of the - encoded data has been found in 'state'. - (uuencode_step): Now stuffs uulen into state so that the uulen - argument is no longer needed. - (uuencode_close): Same. - -2002-01-16 Jeffrey Stedfast - - * camel-mime-filter-basic.c (filter): If we don't want to corrupt - the uuencoded data by overwriting it with base64 decoded data - afterward, we need to add a break statement! - - * camel-folder-summary.c (summary_build_content_info): Add code to - add a uu filter. - (camel_folder_summary_finalize): Unref the uuencode filter. - -2002-01-16 Jeffrey Stedfast - - * camel-mime-filter-basic.c (filter): Fixed slight logic error to - find the uuencode begin line. Fixes bug #18754. - -2002-01-15 Jeffrey Stedfast - - * providers/smtp/camel-smtp-transport.c (smtp_send_to): Updated to - match the new send_to API. - (smtp_send): Get the from address and pass that along to - smtp_send_to(). - - * providers/sendmail/camel-sendmail-transport.c - (sendmail_send_to): Updated to match the new send_to API. - - * camel-transport.c (camel_transport_send_to): Now takes a from - argument too. - - * providers/imap/camel-imap-folder.c (imap_update_summary): Sort - the needheaders UID array and fixed to respect the - UID_SET_LIMIT. This should now finish the fixification of bug - #2529. There's still the possible issue that a command-line (The - only command-line I can think of that can still be too long is a - SEARCH command, but this can't possibly be fixed until we rewrite - the imap code to use Zucchi's ImapEngine idea). - -2002-01-14 Jeffrey Stedfast - - * providers/imap/camel-imap-folder.c (imap_expunge_uids_online): - Move the command-lock outside the loop. - -2002-01-14 Jeffrey Stedfast - - * providers/imap/camel-imap-folder.c (imap_expunge_uids_online): - Updated to use the new imap_uid_array_to_set() interface. - (imap_expunge_uids_resyncing): Same. - (do_copy): Here too. - (imap_update_summary): Added a FIXME comment to rewrite allowing - for a uid-set limitation. - (get_matching): Copy some of the logic over from - imap_uid_adday_to_set() to limit the length of the uid-set string. - (imap_sync_online): Added a comment to explain what is going on - with get_matching() since the behavior has changed slightly. - - * providers/imap/camel-imap-utils.c (imap_uid_array_to_set): - Modify the interface so that we can limit the size of the uid set - string returned. - -2002-01-14 Not Zed - - * providers/imap/camel-imap-search.c (imap_body_contains): - Rewritten to use a cache for body searches when online. Will need - some heavy testing but so far seems to be beneficial. - - * providers/imap/camel-imap-folder.c (imap_search_by_expression, - search_by_uids): dont initialise search object here. - (camel_imap_folder_new): Setup search object here with pointer to - cache dir. - -2001-12-01 Not Zed - - * camel-store-summary.[ch]: New class to store a store's folder - list in. Not yet completed. - 2002-01-11 Jeffrey Stedfast * providers/imap/camel-imap-folder.c (imap_update_summary): Kludge around a bug in Exchange 5.5 that reports 2 messages with the same - UID. Fixes bug #17694. Replaces the fix from yesterday. - -2002-01-10 Jeffrey Stedfast - - * providers/local/camel-local-folder.c: If PATH_MAX doesn't exist, - use _POSIX_PATH_MAX. - - * providers/imap/camel-imap-folder.c (imap_update_summary): If mi - is NULL, don't bother updating it. Should fix bug #17694. - -2002-01-10 Jeffrey Stedfast - - * camel.h: #include camel-mime-filter-tohtml.h - - * providers/imap/camel-imap-folder.c (imap_update_summary): Kludge - around Microsoft Exchange 5.5 (bug #5348) by forgetting our - currently selected folder and re-SELECTing it so that the Exchange - server has a chance to realise it has new messages. + UID. Fixes bug #17694. 2002-01-09 Jeffrey Stedfast @@ -144,60 +12,10 @@ rewrite the mbox later without worrying about clobbering the symlink. -2002-01-08 Jeffrey Stedfast - - * camel-filter-search.c (TODO): There are a few sexp callbacks - that could be modified to use fms->info rather than using a - message object (like date and possibly mlist stuff) but *only* if - the date exists on the CamelMessageInfo object (since it may be - blank except for message flags). - (camel_filter_search_get_message): New internal convenience - function to make sure that the FilterMessageSearch has loaded the - message (and to load the message if this isn't the case). - (check_header): Call camel_filter_search_get_message(). - (header_exists): Same. - (header_regex): Here too. - (header_full_regex): And here. - (body_contains): Again here. - (body_regex): Here too. - (get_sent_date): Here also. - (get_received_date): Same. - (get_source): Here if we need to. - (camel_filter_search_match): Now takes a callback function/data - pair for on-demand message loading so that we don't necessarily - have to load the message if the defined filter rules don't require - it. - - * camel-filter-driver.c (camel_filter_driver_filter_folder): Don't - bother fetching the message here, let - camel_filter_driver_filter_message() worry about this. - (get_message_cb): New utility callback to fetch a message. - (camel_filter_driver_filter_message): Only fetch the message if we - absolutely need it to get a CamelMessageInfo. Instead of passing a - message object to camel_filter_search_match(), pass get_message_cb - and some user_data so that the matching code can fetch the message - on demand. - -2002-01-07 Jeffrey Stedfast - - * camel-folder.c (filter_filter): Flush the only-once actions. - - * camel-filter-driver.c (camel_filter_driver_filter_message): - Don't increment a filtered_count here any longer. - (camel_filter_driver_reset_filtered_count): Removed. - (camel_filter_driver_get_filtered_count): Removed. - (do_beep): New action. - (play_sound): New action to play a sound - (do_only_once): Another new action. - (camel_filter_driver_finalise): Free the only_once hash if the - driver has not been "flushed". - (camel_filter_driver_flush): Flush all of the only-once actions. - - * camel-charset-map.c: Moved windows-1251 to the end of the list - since it contains the euro and we'd prefer to use iso-8859-15 when - the euro is requested than a windows charset if possible. +2001-12-11 Jeffrey Stedfast - * camel-charset-map-private.h: Regenerated. + * camel-service.c (camel_service_connect): Make sure that the + connect_op is non-NULL before unregistering/unreffing it. 2001-12-12 Jeffrey Stedfast @@ -206,62 +24,6 @@ * camel-mime-utils.c (header_set_param): NULL-protection. -2002-01-02 Jeffrey Stedfast - - * camel-tcp-stream-ssl.c (ssl_bad_cert): Do more like what mutt - does so hopefully this'll fix bug #16363 and #16300. - -2001-12-21 Jeffrey Stedfast - - * broken-date-parser.c (parse_broken_date): Completely - rewritten. It is now a load faster and a heck of a lot more - accurate, also now returns a time_t and sets the saveoffset - variable rather than returning a new char* buffer for the normal - camel date parser to re-parse. This saves a fair number of cpu - cycles :-) - - * camel-mime-utils.c (header_decode_date): Cleanup the broken date - parsing code. - -2001-12-20 Jeffrey Stedfast - - * camel-address.h: Change the prototype for camel_address_get_type - to return a CamelType (since internally this is what it returns - and also in case we decide to write a replacement for the current - CamelObject it'd be easier to drop in). - - * camel-internet-address.h: Same but for - camel_internet_address_get_type() - - * providers/smtp/camel-smtp-transport.c (smtp_send_to): Updated to - use a CamelAddress of recipients. - (smtp_send): Since smtp_send_to now takes a CamelAddress - recipients argument, our lives have been simplified and we can now - just concat To/Cc/Bcc into a recipients addr and send away. - - * providers/sendmail/camel-sendmail-transport.c - (sendmail_send_to): Updated to use a CamelAddress of recipients. - - * camel-transport.c (camel_transport_send_to): Now takes a - CamelAddress argument for the recipient list rather than a GList. - -2001-12-19 Jeffrey Stedfast - - * providers/smtp/Makefile.am: Remove the providerdir variable. - - * providers/sendmail/Makefile.am: Same. - -2001-12-17 Jeffrey Stedfast - - * camel-charset-map.c (camel_charset_iso_to_windows): New function - to map ISO charsets to the Windows charsets. - - * camel-mime-part-utils.c (broken_windows_charset): Detect Windows - charsets. - (simple_data_wrapper_construct_from_parser): Simplify a tad and - also check for iso-8859-* charsets that are really Windows - charsets. Fixes bug #12631. - 2001-12-17 Dan Winship * Makefile.am (INCLUDES): define CAMEL_PROVIDERDIR to be the @@ -271,58 +33,13 @@ * providers/imap/Makefile.am (camel_provider_LTLIBRARIES, camel_provider_DATA): renamed from provider_LTLIBRARIES, - provider_DATA. - - * providers/local/Makefile.am: Likewise - - * providers/nntp/Makefile.am: Likewise - - * providers/pop3/Makefile.am: Likewise - - * providers/sendmail/Makefile.am: Likewise - + provider_DATA. + * 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 -2001-12-16 Jeffrey Stedfast - - * providers/imap/camel-imap-folder.c (get_content): Reverted my - previous changes here since it doesn't actually work afterall. - - * providers/imap/camel-imap-wrapper.c (imap_wrapper_hydrate): - Update to do uudecoding when appropriate. - -2001-12-16 Jeffrey Stedfast - - * providers/imap/camel-imap-folder.c (get_content): Try to use the - original boundary so luis will stop bugging me about "data - corruption". Also preserve other params in the multipart - content-type by dumping it to a string and setting it on the mime - part. - -2001-12-14 Jeffrey Stedfast - - * camel-filter-driver.c - (camel_filter_driver_reset_filtered_count): Reset the - filtered_count to zero. - (camel_filter_driver_get_filtered_count): Return the private - filtered_count value. - (camel_filter_driver_filter_message): Increment the - filtered_count. - (camel_filter_driver_set_shell_exec_func): New function to set the - shell-exec func. - (shell_exec): New ESExp filter action callback. - -2001-12-14 Jeffrey Stedfast - - * camel-pgp-mime.c (camel_pgp_mime_part_verify): Removed - x-inline-pgp-hack kludge because it doesn't work. - (camel_pgp_mime_part_decrypt): Same. - -2001-12-13 Chris Toshok - - * camel-data-cache.c: include stdlib.h (for alloca on freebsd) and - only include alloca.h if HAVE_ALLOCA_H is defined. - 2001-12-11 Zbigniew Chyla Fixes #17085 @@ -341,17 +58,6 @@ * camel-service.c (camel_service_connect): Make sure that the connect_op is non-NULL before unregistering/unreffing it. -2001-12-04 Jeffrey Stedfast - - * camel-mime-utils.c (header_content_type_simple): Protect against - either of the types being NULL. - -2001-12-05 Jeffrey Stedfast - - * camel-mime-filter-basic.c (filter): If complete() allocates - len+2 bytes for the out buffer, so should this. See bug #16371 for - an example case. - 2001-12-05 Jeffrey Stedfast * camel-sasl-digest-md5.c: iconv() returns a size_t, not an int. @@ -391,19 +97,23 @@ (rfc2184_decode): Use size_t's with iconv(). (header_decode_param): Same. -2001-12-09 Jon Trowbridge - - * camel-folder-summary.c: Add "NeedsReply" to the flag_names array - for CAMEL_MESSAGE_NEEDS_REPLY. - - * camel-folder-summary.h: Added CAMEL_MESSAGE_NEEDS_REPLY flag. - 2001-12-07 Dan Winship * camel-mime-message.c (camel_mime_message_set_date): Fix the tm_gmtoff case (its sign is the opposite of "timezone"). Fixes #14678 +2001-12-04 Jeffrey Stedfast + + * camel-mime-utils.c (header_content_type_simple): Protect against + either of the types being NULL. + +2001-12-05 Jeffrey Stedfast + + * camel-mime-filter-basic.c (filter): If complete() allocates + len+2 bytes for the out buffer, so should this. See bug #16371 for + an example case. + 2001-11-29 Jeffrey Stedfast * camel-folder-search.c (search_body_contains): Don't use regex @@ -432,52 +142,12 @@ order, always summary_lock before ref_lock. (camel_folder_summary_array): " (camel_folder_summary_uid): " - (camel_folder_summary_remove_uid): " Fixes a deadlock. - -2001-11-30 Not Zed - - * providers/nntp/camel-nntp-*.c: Completely new implementation of - NNTP. - - Doesn't support subscriptions yet (lists all folders), but should - be more reliable (faster?), and has an integrated cache. - - * camel-exception.c (camel_exception_new): Use e_memchunks for - exception blocks. - (camel_exception_free): Same. - - * camel-data-cache.[ch]: New object for managing on-disk caches of - anything that can be stored in a camel-stream. - - * camel-file-utils.c (camel_file_util_mkdir): New function, just a - nicer place to put this (than camel-store), should be removed from - camel-store. - (camel_file_util_safe_filename): New function to url-encode a - filename. - - * camel-mime-parser.c (drop_states): New func to drop the parser - state to initial state. - (folder_scan_init_with_fd): - (folder_scan_init_with_stream): Call above func to reset state if - the stream is changed on us so we can change streams to reuse a - parser object. - -2001-11-25 Not Zed + (camel_folder_summary_remove_uid): " Fixes a deadlock. - * providers/nntp/camel-nntp-folder.c (nntp_folder_get_message): If - the uid doesn't have a ',' in it, fail to crash. +2001-11-21 Jeffrey Stedfast - * providers/nntp/camel-nntp-newsrc.c - (camel_nntp_newsrc_article_is_read): check group != NULL before - scanning. - (camel_nntp_newsrc_get_highest_article_read): " - (camel_nntp_newsrc_get_num_articles_read): " - (camel_nntp_newsrc_mark_range_read): " - - * providers/nntp/camel-nntp-store.c - (camel_nntp_store_get_overview_fmt): IF we dont have - nntp_list_follows, dont try and get a list response. - (nntp_store_get_folder_info): Set path part of folderinfo. + * Makefile.am: Remove OpenSSL library includes/LDFLAGS from the + build. 2001-11-20 Jeffrey Stedfast @@ -485,48 +155,17 @@ Check to see that errno is non-zero before returning g_strerror. If it's 0, then we have an unknown error. -2001-11-26 Jeffrey Stedfast - - * camel-mime-filter-basic.c: For the uudecoding mode, garble up - the "begin " line before decoding. - - * camel-mime-part-utils.c - (simple_data_wrapper_construct_from_parser): Add a uudecoder if - the transfer encoding is x-uuencode. - - * camel-mime-part.c (write_to_stream): Handle x-uuencoded content - too. - 2001-11-19 Jeffrey Stedfast * camel-tcp-stream-ssl.c (stream_read): Added a check to see if the operation has been cancelled. (stream_write): Same. -2001-11-19 Jeffrey Stedfast - - Updates for compliance with rfc2231 - - * camel-mime-utils.c (header_encode_param): - camel_mime_special_table[c] & IS_ESAFE should have been - !(camel_mime_special_table[c] & IS_ESAFE). Also added a few - comments for how to improve the code at some future date. - (header_decode_param): Now takes an argument rfc2184_part so our - caller can get this information as well. - (header_decode_param_list): Pass an rfc2184_part argument to - header_decode_param and also added a few comments on where to - improve on rfc2184/rfc2231 compliance. - (rfc2047_decode_word): Updated to respect the updated ABNF syntax - of rfc2047 encoded words, yay. - 2001-11-16 Jeffrey Stedfast * providers/imap/camel-imap-utils.c (imap_parse_body): Abort if body == NULL. - * camel-mime-filter-tohtml.c (camel_mime_filter_tohtml_new): New - mime filter to convert plain text to html. - 2001-11-16 Jeffrey Stedfast Since some mail clients like Outlook are broken, we need to set a @@ -536,15 +175,6 @@ parameter. (camel_pgp_mime_part_sign): Same. -2001-11-14 Jeffrey Stedfast - - * providers/imap/camel-imap-command.c - (camel_imap_command_response): If we get a BYE response, call - camel_service_disconnect() and set an exception. Also do the check - for "* BYE" first instead of passing it off imap_read_untagged() - 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 * camel-filter-search.c (get_source): If we have no source string, diff --git a/camel/Makefile.am b/camel/Makefile.am index 055c303534..c1a98a071a 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -17,7 +17,6 @@ INCLUDES = -I.. -I$(srcdir)/.. \ $(KRB4_CFLAGS) \ $(NSPR_CFLAGS) \ $(NSS_CFLAGS) \ - $(OPENSSL_CFLAGS) \ -DCAMEL_SBINDIR=\""$(sbindir)"\" \ -DCAMEL_PROVIDERDIR=\""$(camel_providerdir)"\" \ -DG_LOG_DOMAIN=\"camel\" @@ -27,7 +26,6 @@ libcamel_la_SOURCES = \ camel-address.c \ camel-cipher-context.c \ camel-cms-context.c \ - camel-data-cache.c \ camel-data-wrapper.c \ camel-digest-folder.c \ camel-disco-diary.c \ @@ -52,7 +50,6 @@ libcamel_la_SOURCES = \ camel-mime-filter-crlf.c \ camel-mime-filter-from.c \ camel-mime-filter-html.c \ - camel-mime-filter-tohtml.c \ camel-mime-filter-index.c \ camel-mime-filter-linewrap.c \ camel-mime-filter-save.c \ @@ -86,7 +83,6 @@ libcamel_la_SOURCES = \ camel-service.c \ camel-session.c \ camel-store.c \ - camel-store-summary.c \ camel-stream-buffer.c \ camel-stream-filter.c \ camel-stream-fs.c \ @@ -95,7 +91,6 @@ libcamel_la_SOURCES = \ camel-stream.c \ camel-tcp-stream-raw.c \ camel-tcp-stream-ssl.c \ - camel-tcp-stream-openssl.c \ camel-tcp-stream.c \ camel-transport.c \ camel-uid-cache.c \ @@ -115,7 +110,6 @@ libcamelinclude_HEADERS = \ camel-charset-map.h \ camel-cipher-context.h \ camel-cms-context.h \ - camel-data-cache.h \ camel-data-wrapper.h \ camel-digest-folder.h \ camel-disco-diary.h \ @@ -140,7 +134,6 @@ libcamelinclude_HEADERS = \ camel-mime-filter-crlf.h \ camel-mime-filter-from.h \ camel-mime-filter-html.h \ - camel-mime-filter-tohtml.h \ camel-mime-filter-index.h \ camel-mime-filter-linewrap.h \ camel-mime-filter-save.h \ @@ -173,7 +166,6 @@ libcamelinclude_HEADERS = \ camel-service.h \ camel-session.h \ camel-store.h \ - camel-store-summary.h \ camel-stream-buffer.h \ camel-stream-filter.h \ camel-stream-fs.h \ @@ -182,7 +174,6 @@ libcamelinclude_HEADERS = \ camel-stream.h \ camel-tcp-stream-raw.h \ camel-tcp-stream-ssl.h \ - camel-tcp-stream-openssl.h \ camel-tcp-stream.h \ camel-transport.h \ camel-types.h \ @@ -202,8 +193,7 @@ libcamel_la_LIBADD = $(top_builddir)/e-util/libeutil.la \ $(CAMEL_LIBS) \ $(KRB4_LDFLAGS) \ $(NSPR_LDFLAGS) \ - $(NSS_LDFLAGS) \ - $(OPENSSL_LDFLAGS) + $(NSS_LDFLAGS) libcamel_static_la_SOURCES = $(libcamel_la_SOURCES) libcamel_static_la_LIBADD = $(libcamel_la_LIBADD) diff --git a/camel/camel-charset-map-private.h b/camel/camel-charset-map-private.h index 35556db87e..3348b0def3 100644 --- a/camel/camel-charset-map-private.h +++ b/camel/camel-charset-map-private.h @@ -12,54 +12,54 @@ static unsigned char m000[256] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xbf, 0xbf, 0xbf, 0xbf, - 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, - 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, - 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, - 0xbf, 0xbf, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, - 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, - 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, - 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, - 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, - 0xff, 0x80, 0xc0, 0xe0, 0xc3, 0xc0, 0xe0, 0xf3, - 0xe3, 0xec, 0x80, 0xe0, 0xe0, 0xf3, 0xc0, 0xc2, - 0xef, 0xe0, 0xec, 0xe0, 0xc3, 0xc0, 0xc0, 0xec, - 0xc3, 0xc0, 0x80, 0xe0, 0xc0, 0xe0, 0xc0, 0x80, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xb7, + 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, + 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, + 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, + 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, + 0xff, 0x80, 0x80, 0xc0, 0x8b, 0x80, 0xc8, 0xeb, + 0xc3, 0xdc, 0x80, 0xc8, 0xc8, 0xeb, 0x88, 0x82, + 0xdf, 0xc8, 0xd4, 0xc0, 0x83, 0x88, 0x88, 0xdc, + 0x83, 0x80, 0x80, 0xc8, 0x80, 0xc0, 0x80, 0x80, 0x80, 0x83, 0x83, 0x82, 0x83, 0x82, 0x82, 0x81, 0x80, 0x83, 0x80, 0x83, 0x80, 0x83, 0x83, 0x80, - 0x00, 0x80, 0x80, 0x81, 0x83, 0x82, 0x83, 0xc3, + 0x00, 0x80, 0x80, 0x81, 0x83, 0x82, 0x83, 0x83, 0x82, 0x80, 0x83, 0x82, 0x83, 0x01, 0x00, 0x83, 0x80, 0x83, 0x83, 0x82, 0x83, 0x82, 0x82, 0x81, 0x80, 0x83, 0x80, 0x83, 0x80, 0x83, 0x83, 0x80, - 0x00, 0x80, 0x80, 0x81, 0x83, 0x82, 0x83, 0xcf, + 0x00, 0x80, 0x80, 0x81, 0x83, 0x82, 0x83, 0x97, 0x82, 0x80, 0x83, 0x82, 0x83, 0x01, 0x00, 0x80, }; static unsigned char m001[256] = { - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x07, 0x02, 0x03, 0x03, 0x05, 0x02, 0x05, 0x07, - 0x00, 0x07, 0x02, 0x07, 0x07, 0x07, 0x07, 0x02, - 0x07, 0x07, 0x03, 0x03, 0x00, 0x07, 0x07, 0x07, - 0x00, 0x03, 0x02, 0x07, 0x01, 0x01, 0x01, 0x02, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x02, 0x03, 0x03, 0x01, 0x02, 0x01, 0x03, + 0x00, 0x03, 0x02, 0x03, 0x03, 0x03, 0x03, 0x02, + 0x03, 0x03, 0x03, 0x03, 0x00, 0x03, 0x03, 0x03, + 0x00, 0x03, 0x02, 0x03, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x02, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x03, @@ -192,16 +192,16 @@ static unsigned char m030[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x00, - 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x00, + 0x40, 0x40, 0x40, 0x00, 0x40, 0x00, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -211,86 +211,25 @@ static unsigned char m030[256] = { }; static unsigned char m040[256] = { - 0x00, 0x1c, 0x10, 0x10, 0x18, 0x10, 0x18, 0x18, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, - 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, - 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, - 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, - 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, - 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, - 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, - 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, - 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, - 0x00, 0x1c, 0x10, 0x10, 0x18, 0x10, 0x18, 0x18, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static unsigned char m041[256] = { - 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x04, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static unsigned char m050[256] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3c, 0x28, 0x28, 0x38, 0x28, 0x38, 0x38, + 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x28, 0x28, + 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, + 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, + 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, + 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, + 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, + 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, + 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, + 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, + 0x00, 0x3c, 0x28, 0x28, 0x38, 0x28, 0x38, 0x38, + 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -304,27 +243,17 @@ static unsigned char m050[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, - 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; static unsigned char m200[256] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x40, - 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x08, 0x40, 0x00, 0x00, + 0x48, 0x48, 0x08, 0x00, 0x08, 0x08, 0x08, 0x00, + 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -338,6 +267,7 @@ static unsigned char m200[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -353,44 +283,8 @@ static unsigned char m200[256] = { static unsigned char m201[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x05, 0x04, 0x00, 0x05, 0x05, 0x05, 0x00, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static unsigned char m210[256] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -408,6 +302,7 @@ static unsigned char m210[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -420,12 +315,12 @@ static unsigned char m210[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m211[256] = { +static unsigned char m210[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -459,16 +354,16 @@ static unsigned char m220[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -495,7 +390,7 @@ static unsigned char m230[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -526,27 +421,27 @@ static unsigned char m230[256] = { }; static unsigned char m250[256] = { - 0x0c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x0c, 0x0c, 0x04, 0x0c, 0x04, 0x04, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x04, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x04, 0x0c, 0x04, 0x04, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x04, 0x0c, 0x00, 0x00, 0x00, + 0x14, 0x14, 0x14, 0x04, 0x14, 0x04, 0x04, 0x14, + 0x14, 0x14, 0x14, 0x14, 0x04, 0x14, 0x14, 0x14, + 0x14, 0x14, 0x04, 0x14, 0x04, 0x04, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x04, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x14, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -564,11 +459,11 @@ struct { unsigned char *bits0; unsigned char *bits1; } camel_charmap[256] = { - { m000, m001, }, { m010, m011, }, { m020, 0, }, { m030, 0, }, { m040, m041, }, { m050, 0, }, { 0, 0, }, { 0, 0, }, + { m000, m001, }, { m010, m011, }, { m020, 0, }, { m030, 0, }, { m040, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, - { m200, m201, }, { m210, m211, }, { m220, 0, }, { m230, 0, }, { 0, 0, }, { m250, 0, }, { 0, 0, }, { 0, 0, }, + { m200, m201, }, { m210, 0, }, { m220, 0, }, { m230, 0, }, { 0, 0, }, { m250, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, @@ -605,14 +500,13 @@ struct { { "iso-8859-2", 0x0001 }, { "iso-8859-4", 0x0002 }, { "koi8-r", 0x0004 }, - { "koi8-u", 0x0008 }, - { "iso-8859-5", 0x0010 }, - { "iso-8859-7", 0x0020 }, - { "iso-8859-8", 0x0040 }, + { "windows-1251", 0x0008 }, + { "koi8-u", 0x0010 }, + { "iso-8859-5", 0x0020 }, + { "iso-8859-7", 0x0040 }, { "iso-8859-9", 0x0080 }, { "iso-8859-13", 0x0100 }, { "iso-8859-15", 0x0200 }, - { "windows-1251", 0x0400 }, }; #define charset_mask(x) \ diff --git a/camel/camel-charset-map.c b/camel/camel-charset-map.c index 4368e52018..17962d74be 100644 --- a/camel/camel-charset-map.c +++ b/camel/camel-charset-map.c @@ -61,16 +61,15 @@ static struct { { "iso-8859-2", 0 }, /* Central/Eastern European */ { "iso-8859-4", 0 }, /* Baltic */ { "koi8-r", 0 }, /* Russian */ + { "windows-1251", 0 }, /* Russian */ { "koi8-u", 0 }, /* Ukranian */ { "iso-8859-5", 0 }, /* Least-popular Russian encoding */ { "iso-8859-7", 0 }, /* Greek */ - { "iso-8859-8", 0 }, /* Hebrew; Visual */ { "iso-8859-9", 0 }, /* Turkish */ { "iso-8859-13", 0 }, /* Baltic again */ { "iso-8859-15", 0 }, /* New-and-improved iso-8859-1, but most * programs that support this support UTF8 */ - { "windows-1251", 0 }, /* Russian */ { 0, 0 } }; @@ -82,7 +81,7 @@ unsigned int encoding_map[256 * 256]; #define UCS "UCS-4LE" #endif -int main (void) +void main(void) { int i, j; int max, min; @@ -191,8 +190,7 @@ int main (void) printf("\t\\\n"); } printf("\n\n"); - - return 0; + } #else @@ -294,60 +292,5 @@ camel_charset_best (const char *in, int len) return camel_charset_best_name (&charset); } - -/** - * camel_charset_iso_to_windows: - * @isocharset: an ISO charset - * - * Returns the equivalent Windows charset. - **/ -const char * -camel_charset_iso_to_windows (const char *isocharset) -{ - /* According to http://czyborra.com/charsets/codepages.html, - * the charset mapping is as follows: - * - * iso-8859-1 maps to windows-cp1252 - * iso-8859-2 maps to windows-cp1250 - * iso-8859-3 maps to windows-cp???? - * iso-8859-4 maps to windows-cp???? - * iso-8859-5 maps to windows-cp1251 - * iso-8859-6 maps to windows-cp1256 - * iso-8859-7 maps to windows-cp1253 - * iso-8859-8 maps to windows-cp1255 - * iso-8859-9 maps to windows-cp1254 - * iso-8859-10 maps to windows-cp???? - * iso-8859-11 maps to windows-cp???? - * iso-8859-12 maps to windows-cp???? - * iso-8859-13 maps to windows-cp1257 - * - * Assumptions: - * - I'm going to assume that since iso-8859-4 and - * iso-8859-13 are Baltic that it also maps to - * windows-cp1257. - */ - - if (!strcasecmp (isocharset, "iso-8859-1")) - return "windows-cp1252"; - else if (!strcasecmp (isocharset, "iso-8859-2")) - return "windows-cp1250"; - else if (!strcasecmp (isocharset, "iso-8859-4")) - return "windows-cp1257"; - else if (!strcasecmp (isocharset, "iso-8859-5")) - return "windows-cp1251"; - else if (!strcasecmp (isocharset, "iso-8859-6")) - return "windows-cp1256"; - else if (!strcasecmp (isocharset, "iso-8859-7")) - return "windows-cp1253"; - else if (!strcasecmp (isocharset, "iso-8859-8")) - return "windows-cp1255"; - else if (!strcasecmp (isocharset, "iso-8859-9")) - return "windows-cp1254"; - else if (!strcasecmp (isocharset, "iso-8859-13")) - return "windows-cp1257"; - - return isocharset; -} - #endif /* !BUILD_MAP */ diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index 9c79ad80f3..65fdc76cb2 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -207,8 +207,6 @@ camel_folder_summary_finalize (CamelObject *obj) camel_object_unref((CamelObject *)p->filter_64); if (p->filter_qp) camel_object_unref((CamelObject *)p->filter_qp); - if (p->filter_uu) - camel_object_unref((CamelObject *)p->filter_uu); if (p->filter_save) camel_object_unref((CamelObject *)p->filter_save); if (p->filter_html) @@ -1906,13 +1904,6 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam else camel_mime_filter_reset((CamelMimeFilter *)p->filter_qp); enc_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)p->filter_qp); - } else if (!strcasecmp (encoding, "x-uuencode")) { - d(printf(" decoding x-uuencode\n")); - if (p->filter_uu == NULL) - p->filter_uu = camel_mime_filter_basic_new_type(CAMEL_MIME_FILTER_BASIC_UU_DEC); - else - camel_mime_filter_reset((CamelMimeFilter *)p->filter_uu); - enc_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)p->filter_uu); } else { d(printf(" ignoring encoding %s\n", encoding)); } @@ -2360,7 +2351,6 @@ struct flag_names_t { { "flagged", CAMEL_MESSAGE_FLAGGED }, { "seen", CAMEL_MESSAGE_SEEN }, { "attachments", CAMEL_MESSAGE_ATTACHMENTS }, - { "needsreply", CAMEL_MESSAGE_NEEDS_REPLY }, { NULL, 0 } }; diff --git a/camel/camel-mime-filter-basic.c b/camel/camel-mime-filter-basic.c index efb9b9818e..6db8f30211 100644 --- a/camel/camel-mime-filter-basic.c +++ b/camel/camel-mime-filter-basic.c @@ -2,7 +2,6 @@ * Copyright (C) 2000 Ximian Inc. * * Authors: Michael Zucchi - * Jeffrey Stedfast * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -22,7 +21,6 @@ #include "camel-mime-filter-basic.h" #include "camel-mime-utils.h" -#include static void reset(CamelMimeFilter *mf); static void complete(CamelMimeFilter *mf, char *in, size_t len, @@ -80,7 +78,7 @@ static void reset(CamelMimeFilter *mf) { CamelMimeFilterBasic *f = (CamelMimeFilterBasic *)mf; - + switch(f->type) { case CAMEL_MIME_FILTER_BASIC_QP_ENC: f->state = -1; @@ -113,7 +111,8 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, case CAMEL_MIME_FILTER_BASIC_UU_ENC: /* won't go to more than 2 * (x + 2) + 62 */ camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE); - newlen = uuencode_close (in, len, mf->outbuf, f->uubuf, &f->state, &f->save); + newlen = uuencode_close (in, len, mf->outbuf, f->uubuf, &f->state, + &f->save, &f->uulen); g_assert (newlen <= (len + 2) * 2 + 62); break; case CAMEL_MIME_FILTER_BASIC_BASE64_DEC: @@ -129,13 +128,9 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, g_assert(newlen <= len+2); break; case CAMEL_MIME_FILTER_BASIC_UU_DEC: - if ((f->state & CAMEL_UUDECODE_STATE_BEGIN) && !(f->state & CAMEL_UUDECODE_STATE_END)) { - /* "begin \n" has been found, so we can now start decoding */ - camel_mime_filter_set_size (mf, len + 3, FALSE); - newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save); - } else { - newlen = 0; - } + /* output can't possibly exceed the input size */ + camel_mime_filter_set_size (mf, len, FALSE); + newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save, &f->uulen); break; default: g_warning("unknown type %d in CamelMimeFilterBasic", f->type); @@ -176,9 +171,8 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s case CAMEL_MIME_FILTER_BASIC_UU_ENC: /* won't go to more than 2 * (x + 2) + 62 */ camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE); - newlen = uuencode_step (in, len, mf->outbuf, f->uubuf, &f->state, &f->save); + newlen = uuencode_step (in, len, mf->outbuf, f->uubuf, &f->state, &f->save, &f->uulen); g_assert (newlen <= (len + 2) * 2 + 62); - break; case CAMEL_MIME_FILTER_BASIC_BASE64_DEC: /* output can't possibly exceed the input size */ camel_mime_filter_set_size(mf, len+3, FALSE); @@ -192,48 +186,9 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s g_assert(newlen <= len + 2); break; case CAMEL_MIME_FILTER_BASIC_UU_DEC: - if (!(f->state & CAMEL_UUDECODE_STATE_BEGIN)) { - register char *inptr, *inend; - size_t left; - - inptr = in; - inend = inptr + len; - - while (inptr < inend) { - left = inend - inptr; - if (left < 6) { - if (!strncmp (inptr, "begin ", left)) - camel_mime_filter_backup (mf, inptr, left); - break; - } else if (!strncmp (inptr, "begin ", 6)) { - for (in = inptr; inptr < inend && *inptr != '\n'; inptr++); - if (inptr < inend) { - inptr++; - f->state |= CAMEL_UUDECODE_STATE_BEGIN; - /* we can start uudecoding... */ - in = inptr; - len = inend - in; - } else { - camel_mime_filter_backup (mf, in, left); - } - break; - } - - /* go to the next line */ - for ( ; inptr < inend && *inptr != '\n'; inptr++); - - if (inptr < inend) - inptr++; - } - } - - if ((f->state & CAMEL_UUDECODE_STATE_BEGIN) && !(f->state & CAMEL_UUDECODE_STATE_END)) { - /* "begin \n" has been found, so we can now start decoding */ - camel_mime_filter_set_size (mf, len + 3, FALSE); - newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save); - } else { - newlen = 0; - } + /* output can't possibly exceed the input size */ + camel_mime_filter_set_size (mf, len, FALSE); + newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save, &f->uulen); break; default: g_warning("unknown type %d in CamelMimeFilterBasic", f->type); diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c index 8367cecf37..fa644468b8 100644 --- a/camel/camel-mime-part-utils.c +++ b/camel/camel-mime-part-utils.c @@ -97,8 +97,7 @@ check_html_charset(char *buffer, int length) return charset; } -static GByteArray * -convert_buffer (GByteArray *in, const char *to, const char *from) +static GByteArray *convert_buffer(GByteArray *in, const char *to, const char *from) { iconv_t ic; size_t inlen, outlen; @@ -155,28 +154,6 @@ convert_buffer (GByteArray *in, const char *to, const char *from) return out; } -/* We don't really use the charset argument except for debugging... */ -static gboolean -broken_windows_charset (GByteArray *buffer, const char *charset) -{ - register unsigned char *inptr; - unsigned char *inend; - - inptr = buffer->data; - inend = inptr + buffer->len; - - while (inptr < inend) { - register unsigned char c = *inptr++; - - if (c >= 128 && c <= 159) { - g_warning ("Encountered Windows charset parading as %s", charset); - return TRUE; - } - } - - return FALSE; -} - static gboolean is_7bit (GByteArray *buffer) { @@ -194,31 +171,28 @@ static void simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser *mp) { CamelMimeFilter *fdec = NULL, *fcrlf = NULL; - CamelMimeFilterBasicType enctype = 0; int len, decid = -1, crlfid = -1; struct _header_content_type *ct; - const char *charset = NULL; GByteArray *buffer; char *encoding, *buf; + const char *charset = NULL; + CamelMimeFilterBasicType enctype = 0; CamelStream *mem; - - d(printf ("simple_data_wrapper_construct_from_parser()\n")); + + d(printf("constructing data-wrapper\n")); /* first, work out conversion, if any, required, we dont care about what we dont know about */ - encoding = header_content_encoding_decode (camel_mime_parser_header (mp, "Content-Transfer-Encoding", NULL)); + encoding = header_content_encoding_decode(camel_mime_parser_header(mp, "content-transfer-encoding", NULL)); if (encoding) { - if (!strcasecmp (encoding, "base64")) { + if (!strcasecmp(encoding, "base64")) { d(printf("Adding base64 decoder ...\n")); enctype = CAMEL_MIME_FILTER_BASIC_BASE64_DEC; - } else if (!strcasecmp (encoding, "quoted-printable")) { + } else if (!strcasecmp(encoding, "quoted-printable")) { d(printf("Adding quoted-printable decoder ...\n")); enctype = CAMEL_MIME_FILTER_BASIC_QP_DEC; - } else if (!strcasecmp (encoding, "x-uuencode")) { - d(printf("Adding uudecoder ...\n")); - enctype = CAMEL_MIME_FILTER_BASIC_UU_DEC; } g_free (encoding); - + if (enctype != 0) { fdec = (CamelMimeFilter *)camel_mime_filter_basic_new_type(enctype); decid = camel_mime_parser_filter_add (mp, fdec); @@ -251,32 +225,21 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser charset = check_html_charset(buffer->data, buffer->len); /* if we need to do charset conversion, see if we can/it works/etc */ - if (charset && !(strcasecmp (charset, "us-ascii") == 0 - || strcasecmp (charset, "utf-8") == 0 - || strncasecmp (charset, "x-", 2) == 0)) { + if (charset && !(strcasecmp(charset, "us-ascii") == 0 + || strcasecmp(charset, "utf-8") == 0 + || strncasecmp(charset, "x-", 2) == 0)) { GByteArray *out; - /* You often see Microsoft Windows users announcing their texts - * as being in ISO-8859-1 even when in fact they contain funny - * characters from the Windows-CP1252 superset. - */ - if (!strncasecmp (charset, "iso-8859", 8)) { - /* check for Windows-specific chars... */ - if (broken_windows_charset (buffer, charset)) { - charset = camel_charset_iso_to_windows (charset); - charset = e_iconv_charset_name (charset); - } - } - - out = convert_buffer (buffer, "UTF-8", charset); + out = convert_buffer(buffer, "UTF-8", charset); if (out) { /* converted ok, use this data instead */ g_byte_array_free(buffer, TRUE); buffer = out; } else { - /* else failed to convert, leave as raw? */ g_warning("Storing text as raw, unknown charset '%s' or invalid format", charset); + /* else failed to convert, leave as raw? */ dw->rawtext = TRUE; + /* should we change the content-type header? */ } } else if (header_content_type_is (ct, "text", "*")) { if (charset == NULL) { @@ -291,9 +254,10 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser dw->rawtext = !g_utf8_validate (buffer->data, buffer->len, NULL); } } - + + d(printf("message part kept in memory!\n")); - + mem = camel_stream_mem_new_with_byte_array(buffer); camel_data_wrapper_construct_from_stream(dw, mem); camel_object_unref((CamelObject *)mem); diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index ea60fc8a88..47e26bf78b 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -1,4 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * Copyright (C) 2000 Ximian Inc. * @@ -417,28 +416,28 @@ base64_decode_simple (char *data, size_t len) * @uubuf: temporary buffer of 60 bytes * @state: holds the number of bits that are stored in @save * @save: leftover bits that have not yet been encoded + * @uulen: holds the value of the length-char which is used to calculate + * how many more chars need to be decoded for that 'line' * * Returns the number of bytes encoded. Call this when finished * encoding data with uuencode_step to flush off the last little * bit. **/ size_t -uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save) +uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save, char *uulen) { register unsigned char *outptr, *bufptr; register guint32 saved; - int uulen, i; + int i; outptr = out; if (len > 0) - outptr += uuencode_step (in, len, out, uubuf, state, save); + outptr += uuencode_step (in, len, out, uubuf, state, save, uulen); + bufptr = uubuf + ((*uulen / 3) * 4); saved = *save; - i = *state & 0xff; - uulen = (*state >> 8) & 0xff; - - bufptr = uubuf + ((uulen / 3) * 4); + i = *state; if (i > 0) { while (i < 3) { @@ -458,24 +457,20 @@ uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *bufptr++ = CAMEL_UUENCODE_CHAR (((b0 << 4) | ((b1 >> 4) & 0xf)) & 0x3f); *bufptr++ = CAMEL_UUENCODE_CHAR (((b1 << 2) | ((b2 >> 6) & 0x3)) & 0x3f); *bufptr++ = CAMEL_UUENCODE_CHAR (b2 & 0x3f); - - i = 0; - saved = 0; - uulen += 3; } } - if (uulen > 0) { - int cplen = ((uulen / 3) * 4); + if (*uulen || *state) { + int cplen = (((*uulen + (*state ? 3 : 0)) / 3) * 4); - *outptr++ = CAMEL_UUENCODE_CHAR (uulen & 0xff); + *outptr++ = CAMEL_UUENCODE_CHAR (*uulen + *state); memcpy (outptr, uubuf, cplen); outptr += cplen; *outptr++ = '\n'; - uulen = 0; + *uulen = 0; } - *outptr++ = CAMEL_UUENCODE_CHAR (uulen & 0xff); + *outptr++ = CAMEL_UUENCODE_CHAR (*uulen); *outptr++ = '\n'; *save = 0; @@ -493,6 +488,8 @@ uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char * @uubuf: temporary buffer of 60 bytes * @state: holds the number of bits that are stored in @save * @save: leftover bits that have not yet been encoded + * @uulen: holds the value of the length-char which is used to calculate + * how many more chars need to be decoded for that 'line' * * Returns the number of bytes encoded. Performs an 'encode step', * only encodes blocks of 45 characters to the output at a time, saves @@ -500,26 +497,28 @@ uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char * invocation). **/ size_t -uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save) +uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save, char *uulen) { register unsigned char *inptr, *outptr, *bufptr; unsigned char *inend; register guint32 saved; - int uulen, i; + int i; - saved = *save; - i = *state & 0xff; - uulen = (*state >> 8) & 0xff; + if (*uulen <= 0) + *uulen = 0; inptr = in; inend = in + len; outptr = out; - bufptr = uubuf + ((uulen / 3) * 4); + bufptr = uubuf + ((*uulen / 3) * 4); + + saved = *save; + i = *state; while (inptr < inend) { - while (uulen < 45 && inptr < inend) { + while (*uulen < 45 && inptr < inend) { while (i < 3 && inptr < inend) { saved = (saved << 8) | *inptr++; i++; @@ -540,22 +539,22 @@ uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char i = 0; saved = 0; - uulen += 3; + *uulen += 3; } } - if (uulen >= 45) { - *outptr++ = CAMEL_UUENCODE_CHAR (uulen & 0xff); - memcpy (outptr, uubuf, ((uulen / 3) * 4)); - outptr += ((uulen / 3) * 4); + if (*uulen >= 45) { + *outptr++ = CAMEL_UUENCODE_CHAR (*uulen); + memcpy (outptr, uubuf, ((*uulen / 3) * 4)); + outptr += ((*uulen / 3) * 4); *outptr++ = '\n'; - uulen = 0; + *uulen = 0; bufptr = uubuf; } } *save = saved; - *state = ((uulen & 0xff) << 8) | (i & 0xff); + *state = i; return outptr - out; } @@ -568,92 +567,85 @@ uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char * @out: output stream * @state: holds the number of bits that are stored in @save * @save: leftover bits that have not yet been decoded + * @uulen: holds the value of the length-char which is used to calculate + * how many more chars need to be decoded for that 'line' * * Returns the number of bytes decoded. Performs a 'decode step' on * a chunk of uuencoded data. Assumes the "begin " * line has been stripped off. **/ size_t -uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save) +uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save, char *uulen) { register unsigned char *inptr, *outptr; unsigned char *inend, ch; register guint32 saved; gboolean last_was_eoln; - int uulen, i; - - if (*state & CAMEL_UUDECODE_STATE_END) - return 0; - - saved = *save; - i = *state & 0xff; - uulen = (*state >> 8) & 0xff; - if (uulen == 0) + int i; + + if (*uulen <= 0) last_was_eoln = TRUE; else last_was_eoln = FALSE; inend = in + len; outptr = out; - + saved = *save; + i = *state; inptr = in; - while (inptr < inend) { + while (inptr < inend && *inptr) { if (*inptr == '\n' || last_was_eoln) { - if (last_was_eoln && *inptr != '\n') { - uulen = CAMEL_UUDECODE_CHAR (*inptr); + if (last_was_eoln) { + *uulen = CAMEL_UUDECODE_CHAR (*inptr); last_was_eoln = FALSE; - if (uulen == 0) { - *state |= CAMEL_UUDECODE_STATE_END; - break; - } } else { last_was_eoln = TRUE; } - + inptr++; continue; } - + ch = *inptr++; - if (uulen > 0) { + if (*uulen > 0) { /* save the byte */ saved = (saved << 8) | ch; i++; if (i == 4) { /* convert 4 uuencoded bytes to 3 normal bytes */ unsigned char b0, b1, b2, b3; - + b0 = saved >> 24; b1 = saved >> 16 & 0xff; b2 = saved >> 8 & 0xff; b3 = saved & 0xff; - - if (uulen >= 3) { + + if (*uulen >= 3) { *outptr++ = CAMEL_UUDECODE_CHAR (b0) << 2 | CAMEL_UUDECODE_CHAR (b1) >> 4; *outptr++ = CAMEL_UUDECODE_CHAR (b1) << 4 | CAMEL_UUDECODE_CHAR (b2) >> 2; *outptr++ = CAMEL_UUDECODE_CHAR (b2) << 6 | CAMEL_UUDECODE_CHAR (b3); } else { - if (uulen >= 1) { + if (*uulen >= 1) { *outptr++ = CAMEL_UUDECODE_CHAR (b0) << 2 | CAMEL_UUDECODE_CHAR (b1) >> 4; } - if (uulen >= 2) { + if (*uulen >= 2) { *outptr++ = CAMEL_UUDECODE_CHAR (b1) << 4 | CAMEL_UUDECODE_CHAR (b2) >> 2; } } - + i = 0; saved = 0; - uulen -= 3; + *uulen -= 3; } } else { break; } } - + *save = saved; - *state = (*state & CAMEL_UUDECODE_STATE_MASK) | ((uulen & 0xff) << 8) | (i & 0xff); - + *state = i; + return outptr - out; } @@ -984,7 +976,7 @@ rfc2047_decode_word(const char *in, size_t len) const char *inend = in+len-2; const char *inbuf; const char *charset; - char *encname, *p; + char *encname; int tmplen; size_t ret; char *decword = NULL; @@ -1034,18 +1026,6 @@ rfc2047_decode_word(const char *in, size_t len) memcpy (encname, in + 2, tmplen); encname[tmplen] = '\0'; - /* rfc2231 updates rfc2047 encoded words... - * The ABNF given in RFC 2047 for encoded-words is: - * encoded-word := "=?" charset "?" encoding "?" encoded-text "?=" - * This specification changes this ABNF to: - * encoded-word := "=?" charset ["*" language] "?" encoding "?" encoded-text "?=" - */ - - /* trim off the 'language' part if it's there... */ - p = strchr (encname, '*'); - if (p) - *p = '\0'; - charset = e_iconv_charset_name (encname); inbuf = decword; @@ -1894,7 +1874,7 @@ rfc2184_decode (const char *in, size_t len) inbuf = decword = hex_decode (inptr, inend - inptr); inlen = strlen (inbuf); - ic = e_iconv_open ("UTF-8", charset); + ic = e_iconv_open("UTF-8", charset); if (ic != (iconv_t) -1) { size_t ret; @@ -1909,7 +1889,7 @@ rfc2184_decode (const char *in, size_t len) decoded = outbase; } - e_iconv_close (ic); + e_iconv_close(ic); } else { decoded = decword; } @@ -1933,14 +1913,14 @@ decode_param_token (const char **in) inptr++; if (inptr > start) { *in = inptr; - return g_strndup (start, inptr - start); + return g_strndup (start, inptr-start); } else { return NULL; } } static gboolean -header_decode_rfc2184_param (const char **in, char **paramp, gboolean *value_is_encoded, int *part) +header_decode_rfc2184_param (const char **in, char **paramp, int *part, gboolean *value_is_encoded) { gboolean is_rfc2184 = FALSE; const char *inptr = *in; @@ -1984,17 +1964,18 @@ header_decode_rfc2184_param (const char **in, char **paramp, gboolean *value_is_ } static int -header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2184_param, int *rfc2184_part) +header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2184_param) { gboolean is_rfc2184_encoded = FALSE; gboolean is_rfc2184 = FALSE; const char *inptr = *in; char *param, *value = NULL; + int rfc2184_part = -1; *is_rfc2184_param = FALSE; - *rfc2184_part = -1; - is_rfc2184 = header_decode_rfc2184_param (&inptr, ¶m, &is_rfc2184_encoded, rfc2184_part); + is_rfc2184 = header_decode_rfc2184_param (&inptr, ¶m, &rfc2184_part, + &is_rfc2184_encoded); if (*inptr == '=') { inptr++; @@ -2003,7 +1984,7 @@ header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2 if (is_rfc2184) { /* We have ourselves an rfc2184 parameter */ - if (*rfc2184_part == -1) { + if (rfc2184_part == -1) { /* rfc2184 allows the value to be broken into * multiple parts - this isn't one of them so * it is safe to decode it. @@ -2048,7 +2029,7 @@ header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2 inbuf = value; inlen = strlen (inbuf); - charset = e_iconv_locale_charset (); + charset = e_iconv_locale_charset(); ic = e_iconv_open ("UTF-8", charset ? charset : "ISO-8859-1"); if (ic != (iconv_t) -1) { size_t ret; @@ -2802,7 +2783,7 @@ header_mime_decode(const char *in, int *maj, int *min) } static struct _header_param * -header_decode_param_list (const char **in) +header_decode_param_list(const char **in) { const char *inptr = *in; struct _header_param *head = NULL, *tail = NULL; @@ -2814,11 +2795,10 @@ header_decode_param_list (const char **in) while (*inptr == ';') { struct _header_param *param; char *name, *value; - int rfc2184_part; inptr++; /* invalid format? */ - if (header_decode_param (&inptr, &name, &value, &is_rfc2184, &rfc2184_part) != 0) + if (header_decode_param (&inptr, &name, &value, &is_rfc2184) != 0) break; if (is_rfc2184 && tail && !strcasecmp (name, tail->name)) { @@ -2826,7 +2806,6 @@ header_decode_param_list (const char **in) * and it looks like we've found one. Append this value to the * last value. */ - /* FIXME: we should be ordering these based on rfc2184_part id */ GString *gvalue; gvalue = g_string_new (tail->value); @@ -2894,7 +2873,7 @@ header_param_list_decode(const char *in) return header_decode_param_list(&in); } - +/* FIXME: I wrote this in a quick & dirty fasion - it may not be 100% correct */ static char * header_encode_param (const unsigned char *in, gboolean *encoded) { @@ -2934,15 +2913,13 @@ header_encode_param (const unsigned char *in, gboolean *encoded) continue; } - /* FIXME: make sure that '\'', '*', and ';' are also encoded */ - if (c > 127 && c < 256) { encoding = MAX (encoding, 1); g_string_sprintfa (out, "%%%c%c", tohex[(c >> 4) & 0xf], tohex[c & 0xf]); } else if (c >= 256) { encoding = MAX (encoding, 2); 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)) { + } else if (is_lwsp (c) || camel_mime_special_table[c] & IS_ESAFE) { g_string_sprintfa (out, "%%%c%c", tohex[(c >> 4) & 0xf], tohex[c & 0xf]); } else { g_string_append_c (out, c); @@ -2951,7 +2928,6 @@ header_encode_param (const unsigned char *in, gboolean *encoded) inptr = newinptr; } - /* FIXME: set the 'language' as well, assuming we can get that info...? */ switch (encoding) { default: g_string_prepend (out, "iso-8859-1''"); @@ -3336,12 +3312,21 @@ header_decode_date(const char *in, int *saveoffset) inptr++; } else { #ifndef CLEAN_DATE - return parse_broken_date (in, saveoffset); -#else + char *newdate; + + w(g_warning("day not followed by ',' it's probably a broken mail client, so we'll ignore its date entirely")); + w(printf ("Giving it one last chance...\n")); + newdate = parse_broken_date (in); + if (newdate) { + w(printf ("Got: %s\n", newdate)); + t = header_decode_date (newdate, saveoffset); + g_free (newdate); + return t; + } +#endif if (saveoffset) *saveoffset = 0; return 0; -#endif /* ! CLEAN_DATE */ } } } diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h index 7795741c48..fcd1a06fa5 100644 --- a/camel/camel-mime-utils.h +++ b/camel/camel-mime-utils.h @@ -28,11 +28,6 @@ /* maximum size of a line from header_fold() */ #define CAMEL_FOLD_SIZE (77) -#define CAMEL_UUDECODE_STATE_INIT (0) -#define CAMEL_UUDECODE_STATE_BEGIN (1 << 16) -#define CAMEL_UUDECODE_STATE_END (1 << 17) -#define CAMEL_UUDECODE_STATE_MASK (CAMEL_UUDECODE_STATE_BEGIN | CAMEL_UUDECODE_STATE_END) - /* a list of references for this message */ struct _header_references { struct _header_references *next; @@ -196,12 +191,12 @@ size_t base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int size_t base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save); size_t base64_encode_close(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save); -size_t uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save); +size_t uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save, char *uulen); size_t uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, - guint32 *save); + guint32 *save, char *uulen); size_t uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, - guint32 *save); + guint32 *save, char *uulen); size_t quoted_decode_step(unsigned char *in, size_t len, unsigned char *out, int *savestate, int *saveme); diff --git a/camel/camel-pgp-mime.c b/camel/camel-pgp-mime.c index 4afa137aec..f90e67f8d0 100644 --- a/camel/camel-pgp-mime.c +++ b/camel/camel-pgp-mime.c @@ -376,7 +376,30 @@ camel_pgp_mime_part_verify (CamelPgpContext *context, CamelMimePart *mime_part, camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (from_filter)); camel_object_unref (CAMEL_OBJECT (from_filter)); - wrapper = CAMEL_DATA_WRAPPER (part); + type = camel_mime_part_get_content_type (mime_part); + if (header_content_type_param (type, "x-inline-pgp-hack")) { + /* this is a kludge around inline pgp signatures - basically, + the multipart/signed is faked - the original part (aka part #1) + is the original mime part and the signature is a copy of the + signature in part #1 */ + CamelMimeFilterCharset *charset_filter; + CamelContentType *content_type; + const char *charset; + + content_type = camel_mime_part_get_content_type (part); + charset = header_content_type_param (content_type, "charset"); + if (charset) { + charset_filter = camel_mime_filter_charset_new_convert ("utf-8", charset); + if (charset_filter) { + camel_stream_filter_add (filtered_stream, + CAMEL_MIME_FILTER (charset_filter)); + camel_object_unref (CAMEL_OBJECT (charset_filter)); + } + } + + wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); + } else + wrapper = CAMEL_DATA_WRAPPER (part); camel_data_wrapper_write_to_stream (wrapper, CAMEL_STREAM (filtered_stream)); camel_object_unref (CAMEL_OBJECT (filtered_stream)); camel_stream_reset (stream); @@ -459,6 +482,7 @@ camel_pgp_mime_part_encrypt (CamelPgpContext *context, CamelMimePart **mime_part camel_mime_part_set_content (encrypted_part, CAMEL_STREAM_MEM (ciphertext)->buffer->data, CAMEL_STREAM_MEM (ciphertext)->buffer->len, "application/octet-stream; name=encrypted.asc"); + camel_mime_part_set_description (encrypted_part, _("This is an encrypted message part")); camel_object_unref (CAMEL_OBJECT (ciphertext)); camel_mime_part_set_encoding (encrypted_part, CAMEL_MIME_PART_ENCODING_7BIT); @@ -538,6 +562,27 @@ camel_pgp_mime_part_decrypt (CamelPgpContext *context, CamelMimePart *mime_part, camel_object_unref (CAMEL_OBJECT (ciphertext)); camel_stream_reset (stream); + mime_type = camel_mime_part_get_content_type (mime_part); + if (header_content_type_param (mime_type, "x-inline-pgp-hack")) { + /* this is a kludge around inline pgp encryption - basically, + the multipart/encrypted is fake - the original encrypted + content is not really an encrypted mime part so after + decrypting it, we have to fake some mime content headers */ + CamelStream *hack; + + hack = camel_stream_mem_new (); + +#define CONTENT_TYPE_TEXT_PLAIN "Content-Type: text/plain\r\n\r\n" + camel_stream_write (hack, CONTENT_TYPE_TEXT_PLAIN, + sizeof (CONTENT_TYPE_TEXT_PLAIN) - 1); + + camel_stream_write_to_stream (stream, hack); + camel_stream_reset (hack); + + camel_object_unref (CAMEL_OBJECT (stream)); + stream = hack; + } + /* construct the new decrypted mime part from the stream */ part = camel_mime_part_new (); diff --git a/camel/camel-service.c b/camel/camel-service.c index 9c32256fe0..a166fcc554 100644 --- a/camel/camel-service.c +++ b/camel/camel-service.c @@ -260,12 +260,12 @@ camel_service_connect (CamelService *service, CamelException *ex) service->status = ret ? CAMEL_SERVICE_CONNECTED : CAMEL_SERVICE_DISCONNECTED; CAMEL_SERVICE_LOCK (service, connect_op_lock); - if (service->connect_op) { - if (unreg) - camel_operation_unregister (service->connect_op); - + if (unreg) { + camel_operation_unregister (service->connect_op); camel_operation_unref (service->connect_op); service->connect_op = NULL; + } else { + camel_operation_unref (service->connect_op); } CAMEL_SERVICE_UNLOCK (service, connect_op_lock); diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c index b63586ac9c..46a8dfa6e3 100644 --- a/camel/camel-tcp-stream-ssl.c +++ b/camel/camel-tcp-stream-ssl.c @@ -42,14 +42,9 @@ #include #include -/* this is commented because otherwise we get an error about the - redefinition of MD5Context...yay */ -/*#include */ - #include "camel-tcp-stream-ssl.h" #include "camel-session.h" - static CamelTcpStreamClass *parent_class = NULL; /* Returns the class for a CamelTcpStreamSSL */ @@ -258,8 +253,8 @@ ssl_get_client_auth (void *data, PRFileDesc *sockfd, proto_win = SSL_RevealPinArg (sockfd); - if ((char *) data) { - cert = PK11_FindCertFromNickname ((char *) data, proto_win); + if ((char *)data) { + cert = PK11_FindCertFromNickname ((char *)data, proto_win); if (cert) { privKey = PK11_FindKeyByAnyCert (cert, proto_win); if (privkey) { @@ -279,6 +274,7 @@ ssl_get_client_auth (void *data, PRFileDesc *sockfd, if (names != NULL) { for (i = 0; i < names->numnicknames; i++) { + cert = PK11_FindCertFromNickname (names->nicknames[i], proto_win); if (!cert) @@ -349,7 +345,7 @@ ssl_auth_cert (void *data, PRFileDesc *sockfd, PRBool checksig, PRBool is_server } if (host) - PR_Free (host); + PR_Free (hostName); return secStatus; } @@ -405,13 +401,11 @@ ssl_cert_is_saved (const char *certid) static SECStatus ssl_bad_cert (void *data, PRFileDesc *sockfd) { - unsigned char md5sum[16], fingerprint[40], *f; - gboolean accept, valid_cert; - char *prompt, *cert_str; CamelTcpStreamSSL *ssl; CERTCertificate *cert; CamelService *service; - int i; + char *prompt, *cert_str; + gboolean accept; g_return_val_if_fail (data != NULL, SECFailure); g_return_val_if_fail (CAMEL_IS_TCP_STREAM_SSL (data), SECFailure); @@ -425,26 +419,23 @@ ssl_bad_cert (void *data, PRFileDesc *sockfd) cert = SSL_PeerCertificate (sockfd); - /* calculate the MD5 hash of the raw certificate */ - md5_get_digest (cert->derCert.data, cert->derCert.len, md5sum); - /*HASH_HashBuf (HASH_AlgMD5, md5sum, cert->derCert.data, cert->derCert.len);*/ - for (i = 0, f = fingerprint; i < 16; i++, f += 3) - sprintf (f, "%.2x%c", md5sum[i], i != 15 ? ':' : '\0'); - - valid_cert = CERT_VerifyCertNow (CERT_GetDefaultCertDB (), cert, TRUE, certUsageSSLClient, NULL); - /*issuer = CERT_FindCertByName (CERT_GetDefaultCertDB (), &cert->derIssuer); - valid_cert = issuer && CERT_VerifySignedData (&cert->signatureWrap, issuer, PR_Now (), NULL);*/ - - cert_str = g_strdup_printf (_("Issuer: %s\n" - "Subject: %s\n" - "Fingerprint: %s\n" - "Signature: %s"), - CERT_NameToAscii (&cert->issuer), - CERT_NameToAscii (&cert->subject), - fingerprint, valid_cert ? _("GOOD") : _("BAD")); + cert_str = g_strdup_printf (_("EMail: %s\n" + "Common Name: %s\n" + "Organization Unit: %s\n" + "Organization: %s\n" + "Locality: %s\n" + "State: %s\n" + "Country: %s"), + cert->emailAddr ? cert->emailAddr : "", + CERT_GetCommonName (&cert->issuer) ? CERT_GetCommonName (&cert->issuer) : "", + CERT_GetOrgUnitName (&cert->issuer) ? CERT_GetOrgUnitName (&cert->issuer) : "", + CERT_GetOrgName (&cert->issuer) ? CERT_GetOrgName (&cert->issuer) : "", + CERT_GetLocalityName (&cert->issuer) ? CERT_GetLocalityName (&cert->issuer) : "", + CERT_GetStateName (&cert->issuer) ? CERT_GetStateName (&cert->issuer) : "", + CERT_GetCountryName (&cert->issuer) ? CERT_GetCountryName (&cert->issuer) : ""); /* construct our user prompt */ - prompt = g_strdup_printf (_("SSL Certificate check for %s:\n\n%s\n\nDo you wish to accept?"), + prompt = g_strdup_printf (_("Bad certificate from %s:\n\n%s\n\nDo you wish to accept anyway?"), service->url->host, cert_str); g_free (cert_str); @@ -453,17 +444,6 @@ ssl_bad_cert (void *data, PRFileDesc *sockfd) g_free (prompt); if (accept) { -#if 0 - /* this is how mutt does it but last time I tried to - use CERT_AddTempCertToPerm() I got link errors and - I have also been told by the nss devs that that - function has been deprecated... */ - CERTCertTrust trust; - - CERT_DecodeTrustString (&trust, "P,,"); - - CERT_AddTempCertToPerm (cert, NULL, &trust); -#else SECItem *certs[1]; if (!cert->trust) @@ -477,9 +457,9 @@ ssl_bad_cert (void *data, PRFileDesc *sockfd) NULL, TRUE, FALSE, cert->nickname); /* and since the above code doesn't seem to - work... time for a good ol' fashioned hack */ + work... time for a good ol' fashioned hack */ save_ssl_cert (ssl->priv->expected_host); -#endif + return SECSuccess; } @@ -515,7 +495,7 @@ stream_connect (CamelTcpStream *stream, struct hostent *host, int port) return -1; } - /*SSL_GetClientAuthDataHook (sslSocket, ssl_get_client_auth, (void *) certNickname);*/ + /*SSL_GetClientAuthDataHook (sslSocket, ssl_get_client_auth, (void *)certNickname);*/ /*SSL_AuthCertificateHook (ssl_fd, ssl_auth_cert, (void *) CERT_GetDefaultCertDB ());*/ SSL_BadCertHook (ssl_fd, ssl_bad_cert, ssl); diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c index 6a2382b3c8..f6fb0dde8e 100644 --- a/camel/providers/imap/camel-imap-command.c +++ b/camel/providers/imap/camel-imap-command.c @@ -267,25 +267,18 @@ camel_imap_command_response (CamelImapStore *store, char **response, switch (*respbuf) { case '*': - if (!g_strncasecmp (respbuf, "* BYE", 5)) { + type = CAMEL_IMAP_RESPONSE_UNTAGGED; + + /* Read the rest of the response if it is multi-line. */ + respbuf = imap_read_untagged (store, respbuf, ex); + if (!respbuf) + type = CAMEL_IMAP_RESPONSE_ERROR; + else if (!g_strncasecmp (respbuf, "* BYE", 5)) { /* Connection was lost, no more data to fetch */ - camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL); - camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, - _("Server unexpectedly disconnected: %s"), - _("Unknown error")); /* g_strerror (104)); FIXME after 1.0 is released */ store->connected = FALSE; g_free (respbuf); - respbuf = NULL; type = CAMEL_IMAP_RESPONSE_ERROR; - break; } - - /* Read the rest of the response. */ - type = CAMEL_IMAP_RESPONSE_UNTAGGED; - respbuf = imap_read_untagged (store, respbuf, ex); - if (!respbuf) - type = CAMEL_IMAP_RESPONSE_ERROR; - break; case '+': type = CAMEL_IMAP_RESPONSE_CONTINUATION; @@ -299,7 +292,6 @@ camel_imap_command_response (CamelImapStore *store, char **response, if (type == CAMEL_IMAP_RESPONSE_ERROR || type == CAMEL_IMAP_RESPONSE_TAGGED) CAMEL_IMAP_STORE_UNLOCK (store, command_lock); - return type; } @@ -406,16 +398,17 @@ imap_read_untagged (CamelImapStore *store, char *line, CamelException *ex) str->str + 1, length); if (nread == -1) { if (errno == EINTR) - camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled")); + camel_exception_set(ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled")); else - camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, g_strerror (errno)); + camel_exception_set(ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, strerror(errno)); camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL); goto lose; } if (nread < length) { - camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, - _("Server response ended too soon.")); - camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL); + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, + _("Server response ended too soon.")); + camel_service_disconnect (CAMEL_SERVICE (store), + FALSE, NULL); goto lose; } str->str[length + 1] = '\0'; @@ -588,14 +581,12 @@ camel_imap_response_extract (CamelImapStore *store, int len = strlen (type), i; char *resp; - len = strlen (type); - for (i = 0; i < response->untagged->len; i++) { resp = response->untagged->pdata[i]; /* Skip "* ", and initial sequence number, if present */ strtoul (resp + 2, &resp, 10); if (*resp == ' ') - resp = (char *) imap_next_word (resp); + resp = imap_next_word (resp); if (!g_strncasecmp (resp, type, len)) break; @@ -702,7 +693,7 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt, len += arglen * 2; start = p + 1; break; - + case '%': start = p; break; @@ -743,14 +734,8 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt, case 'S': case 'F': string = args->pdata[i++]; - if (*p == 'F') { - char *mailbox; - - mailbox = imap_namespace_concat (store, string); - string = imap_mailbox_encode (mailbox, strlen (mailbox)); - g_free (mailbox); - } - + if (*p == 'F') + string = imap_namespace_concat (store, string); if (store->capabilities & IMAP_CAPABILITY_LITERALPLUS) { op += sprintf (op, "{%d+}\r\n%s", strlen (string), string); diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index e3888ec06f..45dad9f6b0 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -64,9 +64,6 @@ #include "camel-stream.h" #include "string-utils.h" -#define UID_SET_LIMIT (-1) - - #define CF_CLASS(o) (CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(o))) static CamelDiscoFolderClass *disco_folder_class = NULL; @@ -229,8 +226,6 @@ camel_imap_folder_new (CamelStore *parent, const char *folder_name, !g_strcasecmp (folder_name, "INBOX")) folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT; - imap_folder->search = camel_imap_search_new(folder_dir); - return folder; } @@ -570,14 +565,11 @@ imap_rescan (CamelFolder *folder, int exists, CamelException *ex) g_array_free (removed, TRUE); } -/* the max number of chars that an unsigned 32-bit int can be is 10 chars plus 1 for a possible : */ -#define UID_SET_FULL(setlen, maxlen) (maxlen > 0 ? setlen + 11 >= maxlen : FALSE) - /* Find all messages in @folder with flags matching @flags and @mask. * If no messages match, returns %NULL. Otherwise, returns an array of * CamelMessageInfo and sets *@set to a message set corresponding the - * UIDs of the matched messages (up to @UID_SET_LIMIT bytes). The - * caller must free the infos, the array, and the set string. + * UIDs of the matched messages. The caller must free the infos, the + * array, and the set string. */ static GPtrArray * get_matching (CamelFolder *folder, guint32 flags, guint32 mask, char **set) @@ -586,12 +578,12 @@ get_matching (CamelFolder *folder, guint32 flags, guint32 mask, char **set) CamelMessageInfo *info; int i, max, range; GString *gset; - + matches = g_ptr_array_new (); gset = g_string_new (""); max = camel_folder_summary_count (folder->summary); range = -1; - for (i = 0; i < max && !UID_SET_FULL (gset->len, UID_SET_LIMIT); i++) { + for (i = 0; i < max; i++) { info = camel_folder_summary_index (folder->summary, i); if (!info) continue; @@ -606,7 +598,7 @@ get_matching (CamelFolder *folder, guint32 flags, guint32 mask, char **set) } continue; } - + g_ptr_array_add (matches, info); if (range != -1) continue; @@ -615,12 +607,11 @@ get_matching (CamelFolder *folder, guint32 flags, guint32 mask, char **set) g_string_append_c (gset, ','); g_string_sprintfa (gset, "%s", camel_message_info_uid (info)); } - if (range != -1 && range != max - 1) { info = matches->pdata[matches->len - 1]; g_string_sprintfa (gset, ":%s", camel_message_info_uid (info)); } - + if (matches->len) { *set = gset->str; g_string_free (gset, FALSE); @@ -666,19 +657,14 @@ imap_sync_online (CamelFolder *folder, CamelException *ex) } /* Note: Cyrus is broken and will not accept an - empty-set of flags so... if this is true then we - want to unset the previously set flags.*/ + empty-set of flags so... if this is true then we + want to unset the previously set flags.*/ unset = !(info->flags & CAMEL_IMAP_SERVER_FLAGS); /* FIXME: since we don't know the previously set - flags, if unset is TRUE then just unset all the flags? */ + flags, if unset is TRUE then just unset all the flags? */ flaglist = imap_create_flag_list (unset ? CAMEL_IMAP_SERVER_FLAGS : info->flags); - /* Note: get_matching() uses UID_SET_LIMIT to limit - the size of the uid-set string. We don't have to - loop here to flush all the matching uids because - they will be scooped up later by our parent loop (I - think?). -- Jeff */ matches = get_matching (folder, info->flags & (CAMEL_IMAP_SERVER_FLAGS | CAMEL_MESSAGE_FOLDER_FLAGGED), CAMEL_IMAP_SERVER_FLAGS | CAMEL_MESSAGE_FOLDER_FLAGGED, &set); camel_folder_summary_info_free (folder->summary, info); @@ -743,34 +729,28 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException * { CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store); CamelImapResponse *response; - int uid = 0; char *set; + set = imap_uid_array_to_set (folder->summary, uids); CAMEL_IMAP_STORE_LOCK (store, command_lock); - - while (uid < uids->len) { - set = imap_uid_array_to_set (folder->summary, uids, uid, UID_SET_LIMIT, &uid); - response = camel_imap_command (store, folder, ex, - "UID STORE %s +FLAGS.SILENT \\Deleted", - set); - if (response) - camel_imap_response_free (store, response); - if (camel_exception_is_set (ex)) { - CAMEL_IMAP_STORE_UNLOCK (store, command_lock); - g_free (set); - return; - } - - if (store->capabilities & IMAP_CAPABILITY_UIDPLUS) { - response = camel_imap_command (store, folder, ex, - "UID EXPUNGE %s", set); - } else - response = camel_imap_command (store, folder, ex, "EXPUNGE"); - - if (response) - camel_imap_response_free (store, response); + response = camel_imap_command (store, folder, ex, + "UID STORE %s +FLAGS.SILENT \\Deleted", + set); + if (response) + camel_imap_response_free (store, response); + if (camel_exception_is_set (ex)) { + CAMEL_IMAP_STORE_UNLOCK (store, command_lock); + g_free (set); + return; } + if (store->capabilities & IMAP_CAPABILITY_UIDPLUS) { + response = camel_imap_command (store, folder, ex, + "UID EXPUNGE %s", set); + } else + response = camel_imap_command (store, folder, ex, "EXPUNGE"); + if (response) + camel_imap_response_free (store, response); CAMEL_IMAP_STORE_UNLOCK (store, command_lock); } @@ -794,21 +774,20 @@ static void imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelException *ex) { CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store); - GPtrArray *keep_uids, *mark_uids; CamelImapResponse *response; - char *result; + char *result, *keep_uidset, *mark_uidset; if (store->capabilities & IMAP_CAPABILITY_UIDPLUS) { imap_expunge_uids_online (folder, uids, ex); return; } - + /* If we don't have UID EXPUNGE we need to avoid expunging any * of the wrong messages. So we search for deleted messages, * and any that aren't in our to-expunge list get temporarily * marked un-deleted. */ - + CAMEL_IMAP_STORE_LOCK (store, command_lock); response = camel_imap_command (store, folder, ex, "UID SEARCH DELETED"); if (!response) { @@ -820,125 +799,100 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio CAMEL_IMAP_STORE_UNLOCK (store, command_lock); return; } - + + keep_uidset = mark_uidset = NULL; if (result[8] == ' ') { + GPtrArray *keep_uids, *mark_uids; char *uid, *lasts = NULL; unsigned long euid, kuid; int ei, ki; - + keep_uids = g_ptr_array_new (); mark_uids = g_ptr_array_new (); - + /* Parse SEARCH response */ for (uid = strtok_r (result + 9, " ", &lasts); uid; uid = strtok_r (NULL, " ", &lasts)) g_ptr_array_add (keep_uids, uid); qsort (keep_uids->pdata, keep_uids->len, sizeof (void *), uid_compar); - + /* Fill in "mark_uids", empty out "keep_uids" as needed */ for (ei = ki = 0; ei < uids->len; ei++) { euid = strtoul (uids->pdata[ei], NULL, 10); - + for (kuid = 0; ki < keep_uids->len; ki++) { kuid = strtoul (keep_uids->pdata[ki], NULL, 10); - + if (kuid >= euid) break; } - + if (euid == kuid) g_ptr_array_remove_index (keep_uids, ki); else g_ptr_array_add (mark_uids, uids->pdata[ei]); } + + if (keep_uids->len) + keep_uidset = imap_uid_array_to_set (folder->summary, keep_uids); + g_ptr_array_free (keep_uids, TRUE); + + if (mark_uids->len) + mark_uidset = imap_uid_array_to_set (folder->summary, mark_uids); + g_ptr_array_free (mark_uids, TRUE); } else { /* Empty SEARCH result, meaning nothing is marked deleted * on server. */ - - keep_uids = NULL; - mark_uids = NULL; + mark_uidset = imap_uid_array_to_set (folder->summary, uids); } - g_free (result); - + /* Unmark messages to be kept */ - if (keep_uids) { - char *uidset; - int uid = 0; - - while (uid < keep_uids->len) { - uidset = imap_uid_array_to_set (folder->summary, keep_uids, uid, UID_SET_LIMIT, &uid); - - response = camel_imap_command (store, folder, ex, - "UID STORE %s -FLAGS.SILENT \\Deleted", - uidset); - - g_free (uidset); - - if (!response) { - g_ptr_array_free (keep_uids, TRUE); - g_ptr_array_free (mark_uids, TRUE); - CAMEL_IMAP_STORE_UNLOCK (store, command_lock); - return; - } - camel_imap_response_free (store, response); + if (keep_uidset) { + response = camel_imap_command (store, folder, ex, + "UID STORE %s -FLAGS.SILENT \\Deleted", + keep_uidset); + if (!response) { + g_free (keep_uidset); + g_free (mark_uidset); + CAMEL_IMAP_STORE_UNLOCK (store, command_lock); + return; } + camel_imap_response_free (store, response); } - + /* Mark any messages that still need to be marked */ - if (mark_uids) { - char *uidset; - int uid = 0; - - while (uid < mark_uids->len) { - uidset = imap_uid_array_to_set (folder->summary, mark_uids, uid, UID_SET_LIMIT, &uid); - - response = camel_imap_command (store, folder, ex, - "UID STORE %s +FLAGS.SILENT \\Deleted", - uidset); - - g_free (uidset); - - if (!response) { - g_ptr_array_free (keep_uids, TRUE); - g_ptr_array_free (mark_uids, TRUE); - CAMEL_IMAP_STORE_UNLOCK (store, command_lock); - return; - } - camel_imap_response_free (store, response); + if (mark_uidset) { + response = camel_imap_command (store, folder, ex, + "UID STORE %s +FLAGS.SILENT \\Deleted", + mark_uidset); + g_free (mark_uidset); + if (!response) { + g_free (keep_uidset); + CAMEL_IMAP_STORE_UNLOCK (store, command_lock); + return; } - - g_ptr_array_free (mark_uids, TRUE); + camel_imap_response_free (store, response); } - + /* Do the actual expunging */ response = camel_imap_command (store, folder, ex, "EXPUNGE"); if (response) camel_imap_response_free (store, response); - + /* And fix the remaining messages if we mangled them */ - if (keep_uids) { - char *uidset; - int uid = 0; - - while (uid < keep_uids->len) { - uidset = imap_uid_array_to_set (folder->summary, keep_uids, uid, UID_SET_LIMIT, &uid); - - /* Don't pass ex if it's already been set */ - response = camel_imap_command (store, folder, - camel_exception_is_set (ex) ? NULL : ex, - "UID STORE %s +FLAGS.SILENT \\Deleted", - uidset); - - g_free (uidset); - if (response) - camel_imap_response_free (store, response); - } - - g_ptr_array_free (keep_uids, TRUE); + if (keep_uidset) { + /* Don't pass ex if it's already been set */ + response = camel_imap_command (store, folder, + camel_exception_is_set (ex) ? NULL : ex, + "UID STORE %s +FLAGS.SILENT \\Deleted", + keep_uidset); + g_free (keep_uidset); + if (response) + camel_imap_response_free (store, response); } - + CAMEL_IMAP_STORE_UNLOCK (store, command_lock); } @@ -1232,22 +1186,16 @@ do_copy (CamelFolder *source, GPtrArray *uids, { CamelImapStore *store = CAMEL_IMAP_STORE (source->parent_store); CamelImapResponse *response; - char *uidset; - int uid = 0; - - while (uid < uids->len && !camel_exception_is_set (ex)) { - uidset = imap_uid_array_to_set (source->summary, uids, uid, UID_SET_LIMIT, &uid); - - response = camel_imap_command (store, source, ex, "UID COPY %s %F", - uidset, destination->full_name); - - g_free (uidset); - - if (response && (store->capabilities & IMAP_CAPABILITY_UIDPLUS)) - handle_copyuid (response, source, destination); - - camel_imap_response_free (store, response); - } + char *set; + + set = imap_uid_array_to_set (source->summary, uids); + response = camel_imap_command (store, source, ex, "UID COPY %s %F", + set, destination->full_name); + if (response && (store->capabilities & IMAP_CAPABILITY_UIDPLUS)) + handle_copyuid (response, source, destination); + + camel_imap_response_free (store, response); + g_free (set); } static void @@ -1366,6 +1314,9 @@ imap_search_by_expression (CamelFolder *folder, const char *expression, CamelExc command channel too */ CAMEL_IMAP_FOLDER_LOCK(folder, search_lock); + if (!imap_folder->search) + imap_folder->search = camel_imap_search_new (); + camel_folder_search_set_folder (imap_folder->search, folder); summary = camel_folder_get_summary(folder); camel_folder_search_set_summary(imap_folder->search, summary); @@ -1402,6 +1353,9 @@ imap_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids CAMEL_IMAP_FOLDER_LOCK(folder, search_lock); + if (imap_folder->search == NULL) + imap_folder->search = camel_imap_search_new(); + camel_folder_search_set_folder(imap_folder->search, folder); camel_folder_search_set_summary(imap_folder->search, summary); @@ -1457,7 +1411,6 @@ get_content (CamelImapFolder *imap_folder, const char *uid, body_mp = camel_multipart_new (); camel_data_wrapper_set_mime_type_field ( CAMEL_DATA_WRAPPER (body_mp), ci->type); - camel_multipart_set_boundary (body_mp, NULL); speclen = strlen (part_spec); @@ -1497,7 +1450,7 @@ get_content (CamelImapFolder *imap_folder, const char *uid, camel_object_unref (CAMEL_OBJECT (content)); camel_multipart_add_part (body_mp, part); camel_object_unref (CAMEL_OBJECT (part)); - + ci = ci->next; } g_free (child_spec); @@ -1805,13 +1758,13 @@ imap_update_summary (CamelFolder *folder, int exists, g_free (resp); if (!data) continue; - + seq = GPOINTER_TO_INT (g_datalist_get_data (&data, "SEQUENCE")); if (seq < first) { g_datalist_clear (&data); continue; } - + if (g_datalist_get_data (&data, "FLAGS")) got += IMAP_PRETEND_SIZEOF_FLAGS; if (g_datalist_get_data (&data, "RFC822.SIZE")) @@ -1819,22 +1772,22 @@ imap_update_summary (CamelFolder *folder, int exists, stream = g_datalist_get_data (&data, "BODY_PART_STREAM"); if (stream) { got += IMAP_PRETEND_SIZEOF_HEADERS; - + /* Use the stream now so we don't tie up many * many fds if we're fetching many many messages. */ add_message_from_data (folder, messages, first, data); g_datalist_set_data (&data, "BODY_PART_STREAM", NULL); } - + camel_operation_progress (NULL, got * 100 / size); g_ptr_array_add (fetch_data, data); } camel_operation_end (NULL); - + if (type == CAMEL_IMAP_RESPONSE_ERROR) goto lose; - + /* Figure out which headers we still need to fetch. */ needheaders = g_ptr_array_new (); size = got = 0; @@ -1842,67 +1795,55 @@ imap_update_summary (CamelFolder *folder, int exists, data = fetch_data->pdata[i]; if (g_datalist_get_data (&data, "BODY_PART_LEN")) continue; - + uid = g_datalist_get_data (&data, "UID"); if (uid) { g_ptr_array_add (needheaders, uid); size += IMAP_PRETEND_SIZEOF_HEADERS; } } - + /* And fetch them */ if (needheaders->len) { - char *uidset; - int uid = 0; - - qsort (needheaders->pdata, needheaders->len, - sizeof (void *), uid_compar); - + char *set; + + /* FIXME: sort needheaders */ + set = imap_uid_array_to_set (folder->summary, needheaders); + g_ptr_array_free (needheaders, TRUE); + if (!camel_imap_command_start (store, folder, ex, + "UID FETCH %s BODY.PEEK[%s]", + set, header_spec)) { + g_free (set); + goto lose; + } + g_free (set); + camel_operation_start (NULL, _("Fetching summary information for new messages")); - - while (uid < needheaders->len) { - uidset = imap_uid_array_to_set (folder->summary, needheaders, uid, UID_SET_LIMIT, &uid); - if (!camel_imap_command_start (store, folder, ex, - "UID FETCH %s BODY.PEEK[%s]", - uidset, header_spec)) { - g_ptr_array_free (needheaders, TRUE); - camel_operation_end (NULL); - g_free (uidset); - goto lose; - } - g_free (uidset); - - while ((type = camel_imap_command_response (store, &resp, ex)) - == CAMEL_IMAP_RESPONSE_UNTAGGED) { - data = parse_fetch_response (imap_folder, resp); - g_free (resp); - if (!data) - continue; - - stream = g_datalist_get_data (&data, "BODY_PART_STREAM"); - if (stream) { - add_message_from_data (folder, messages, first, data); - got += IMAP_PRETEND_SIZEOF_HEADERS; - camel_operation_progress (NULL, got * 100 / size); - } - g_datalist_clear (&data); - } - - if (type == CAMEL_IMAP_RESPONSE_ERROR) { - g_ptr_array_free (needheaders, TRUE); - camel_operation_end (NULL); - goto lose; + while ((type = camel_imap_command_response (store, &resp, ex)) + == CAMEL_IMAP_RESPONSE_UNTAGGED) { + data = parse_fetch_response (imap_folder, resp); + g_free (resp); + if (!data) + continue; + + stream = g_datalist_get_data (&data, "BODY_PART_STREAM"); + if (stream) { + add_message_from_data (folder, messages, first, data); + got += IMAP_PRETEND_SIZEOF_HEADERS; + camel_operation_progress (NULL, got * 100 / size); } + g_datalist_clear (&data); } - - g_ptr_array_free (needheaders, TRUE); camel_operation_end (NULL); + + if (type == CAMEL_IMAP_RESPONSE_ERROR) + goto lose; } - + /* Now finish up summary entries (fix UIDs, set flags and size) */ for (i = 0; i < fetch_data->len; i++) { data = fetch_data->pdata[i]; - + seq = GPOINTER_TO_INT (g_datalist_get_data (&data, "SEQUENCE")); if (seq >= first + messages->len) { g_datalist_clear (&data); @@ -1951,11 +1892,11 @@ imap_update_summary (CamelFolder *folder, int exists, size = GPOINTER_TO_INT (g_datalist_get_data (&data, "RFC822.SIZE")); if (size) mi->size = size; - + g_datalist_clear (&data); } g_ptr_array_free (fetch_data, TRUE); - + /* And add the entries to the summary, etc. */ for (i = 0; i < messages->len; i++) { mi = messages->pdata[i]; @@ -1965,30 +1906,13 @@ imap_update_summary (CamelFolder *folder, int exists, } camel_folder_summary_add (folder->summary, mi); camel_folder_change_info_add_uid (changes, camel_message_info_uid (mi)); - + if ((mi->flags & CAMEL_IMAP_MESSAGE_RECENT)) camel_folder_change_info_recent_uid(changes, camel_message_info_uid (mi)); } g_ptr_array_free (messages, TRUE); - - /* Kludge around Microsoft Exchange 5.5 IMAP - See bug #5348 for details */ - if (camel_folder_summary_count (folder->summary) != exists) { - CamelImapStore *imap_store = (CamelImapStore *) folder->parent_store; - CamelImapResponse *response; - - /* forget the currently selected folder */ - if (imap_store->current_folder) { - camel_object_unref (CAMEL_OBJECT (imap_store->current_folder)); - imap_store->current_folder = NULL; - } - - /* now re-select it and process the EXISTS response */ - response = camel_imap_command (imap_store, folder, ex, NULL); - camel_imap_response_free (imap_store, response); - } - return; - + lose: if (fetch_data) { for (i = 0; i < fetch_data->len; i++) { @@ -2097,7 +2021,7 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const char *uid, CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock); CAMEL_IMAP_STORE_UNLOCK (store, command_lock); return stream; - } + } if (camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_OFFLINE) { camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c index 91d2efb702..d5466bf9ac 100644 --- a/camel/providers/imap/camel-imap-utils.c +++ b/camel/providers/imap/camel-imap-utils.c @@ -24,7 +24,6 @@ #include #include #include -#include #include "camel-imap-utils.h" #include "camel-imap-summary.h" @@ -33,13 +32,13 @@ #define d(x) x -const char * +char * imap_next_word (const char *buf) { - const char *word; + char *word; /* skip over current word */ - for (word = buf; *word && *word != ' '; word++); + for (word = (char *)buf; *word && *word != ' '; word++); /* skip over white space */ for ( ; *word && *word == ' '; word++); @@ -63,8 +62,8 @@ imap_next_word (const char *buf) gboolean imap_parse_list_response (CamelImapStore *store, const char *buf, int *flags, char *sep, char **folder) { - const char *word; - size_t len; + char *word; + int len; if (*buf != '*') return FALSE; @@ -117,34 +116,22 @@ imap_parse_list_response (CamelImapStore *store, const char *buf, int *flags, ch return FALSE; if (folder) { - char *astring, *mailbox; - size_t nlen; + char *real_name; + int n_len; /* get the folder name */ word = imap_next_word (word); - astring = imap_parse_astring ((char **) &word, &len); - if (!astring) - return FALSE; - - mailbox = imap_mailbox_decode (astring, strlen (astring)); - g_free (astring); - if (!mailbox) - return FALSE; - - nlen = strlen (store->namespace); - - if (!strncmp (mailbox, store->namespace, nlen)) { - /* strip off the namespace */ - if (nlen > 0) - memmove (mailbox, mailbox + nlen, (len - nlen) + 1); - *folder = mailbox; - } else if (!g_strcasecmp (mailbox, "INBOX")) { - *folder = mailbox; + real_name = imap_parse_astring (&word, &len); + n_len = strlen (store->namespace); + if (!strncmp (real_name, store->namespace, n_len)) + *folder = g_strdup (real_name + n_len); + else if (!g_strcasecmp (real_name, "INBOX")) { + *folder = g_strdup (real_name); } else { - g_warning ("IMAP folder name \"%s\" does not begin with \"%s\"", mailbox, store->namespace); - *folder = mailbox; + g_warning ("IMAP folder name \"%s\" does not begin with \"%s\"", real_name, store->namespace); + *folder = g_strdup (real_name); } - + g_free (real_name); return *folder != NULL; } @@ -286,7 +273,7 @@ static char imap_atom_specials[128] = { /** * imap_parse_string_generic: * @str_p: a pointer to a string - * @len: a pointer to a size_t to return the length in + * @len: a pointer to an int to return the length in * @type: type of string (#IMAP_STRING, #IMAP_ASTRING, or #IMAP_NSTRING) * to parse. * @@ -305,7 +292,7 @@ static char imap_atom_specials[128] = { * latter, it will point to the character after the NIL.) **/ char * -imap_parse_string_generic (char **str_p, size_t *len, int type) +imap_parse_string_generic (char **str_p, int *len, int type) { char *str = *str_p; char *out; @@ -314,7 +301,7 @@ imap_parse_string_generic (char **str_p, size_t *len, int type) return NULL; else if (*str == '"') { char *p; - size_t size; + int size; str++; size = strcspn (str, "\"") + 1; @@ -486,7 +473,7 @@ imap_parse_body (char **body_p, CamelFolder *folder, char *body = *body_p; CamelMessageContentInfo *child; CamelContentType *type; - size_t len; + int len; if (!body || *body++ != '(') { *body_p = NULL; @@ -543,7 +530,7 @@ imap_parse_body (char **body_p, CamelFolder *folder, /* single part */ char *main_type, *subtype; char *id, *description, *encoding; - guint32 size = 0; + guint32 size; main_type = imap_parse_string (&body, &len); skip_char (&body, ' '); @@ -661,54 +648,44 @@ get_summary_uid_numeric (CamelFolderSummary *summary, int index) return uid; } -/* the max number of chars that an unsigned 32-bit int can be is 10 chars plus 1 for a possible : */ -#define UID_SET_FULL(setlen, maxlen) (maxlen > 0 ? setlen + 11 >= maxlen : FALSE) - /** * imap_uid_array_to_set: * @summary: summary for the folder the UIDs come from * @uids: a (sorted) array of UIDs - * @uid: uid index to start at - * @maxlen: max length of the set string (or -1 for infinite) - * @lastuid: index offset of the last uid used * - * Creates an IMAP "set" up to @maxlen bytes long, covering the listed - * UIDs starting at index @uid and not covering any UIDs that are in - * @summary but not in @uids. It doesn't actually require that all (or - * any) of the UIDs be in @summary. - * - * After calling, @lastuid will be set the index of the first uid - * *not* included in the returned set string. + * Creates an IMAP "set" covering the listed UIDs and not covering + * any UIDs that are in @summary but not in @uids. It doesn't + * actually require that all (or any) of the UIDs be in @summary. * * Return value: the set, which the caller must free with g_free() **/ char * -imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids, int uid, ssize_t maxlen, int *lastuid) +imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids) { + int ui, si, scount; unsigned long last_uid, next_summary_uid, this_uid; gboolean range = FALSE; - int si, scount; GString *gset; char *set; - g_return_val_if_fail (uids->len > uid, NULL); + g_return_val_if_fail (uids->len > 0, NULL); - gset = g_string_new (uids->pdata[uid]); - last_uid = strtoul (uids->pdata[uid], NULL, 10); + gset = g_string_new (uids->pdata[0]); + last_uid = strtoul (uids->pdata[0], NULL, 10); next_summary_uid = 0; scount = camel_folder_summary_count (summary); - for (uid++, si = 0; uid < uids->len && !UID_SET_FULL (gset->len, maxlen); uid++) { + for (ui = 1, si = 0; ui < uids->len; ui++) { /* Find the next UID in the summary after the one we * just wrote out. */ - for ( ; last_uid >= next_summary_uid && si < scount; si++) + for (; last_uid >= next_summary_uid && si < scount; si++) next_summary_uid = get_summary_uid_numeric (summary, si); if (last_uid >= next_summary_uid) next_summary_uid = (unsigned long) -1; /* Now get the next UID from @uids */ - this_uid = strtoul (uids->pdata[uid], NULL, 10); + this_uid = strtoul (uids->pdata[ui], NULL, 10); if (this_uid == next_summary_uid || this_uid == last_uid + 1) range = TRUE; else { @@ -725,8 +702,6 @@ imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids, int uid, ss if (range) g_string_sprintfa (gset, ":%lu", last_uid); - *lastuid = uid; - set = gset->str; g_string_free (gset, FALSE); @@ -825,7 +800,7 @@ imap_uid_array_free (GPtrArray *arr) char * imap_concat (CamelImapStore *imap_store, const char *prefix, const char *suffix) { - size_t len; + int len; len = strlen (prefix); if (len == 0 || prefix[len - 1] == imap_store->dir_sep) @@ -843,7 +818,7 @@ imap_namespace_concat (CamelImapStore *store, const char *name) else return g_strdup (""); } - + if (!g_strcasecmp (name, "INBOX")) return g_strdup ("INBOX"); @@ -851,268 +826,6 @@ imap_namespace_concat (CamelImapStore *store, const char *name) g_warning ("Trying to concat NULL namespace to \"%s\"!", name); return g_strdup (name); } - - return imap_concat (store, store->namespace, name); -} - - -#define UTF8_TO_UTF7_LEN(len) ((len * 3) + 8) -#define UTF7_TO_UTF8_LEN(len) (len) - -enum { - MODE_USASCII, - MODE_AMPERSAND, - MODE_MODUTF7 -}; - -#define is_usascii(c) (((c) >= 0x20 && (c) <= 0x25) || ((c) >= 0x27 && (c) <= 0x7e)) -#define encode_mode(c) (is_usascii (c) ? MODE_USASCII : (c) == '&' ? MODE_AMPERSAND : MODE_MODUTF7) - -char * -imap_mailbox_encode (const unsigned char *in, size_t inlen) -{ - const unsigned char *start, *inptr, *inend; - unsigned char *mailbox, *m, *mend; - size_t inleft, outleft, conv; - char *inbuf, *outbuf; - iconv_t cd; - int mode; - - cd = (iconv_t) -1; - m = mailbox = g_malloc (UTF8_TO_UTF7_LEN (inlen) + 1); - mend = mailbox + UTF8_TO_UTF7_LEN (inlen); - - start = inptr = in; - inend = in + inlen; - mode = MODE_USASCII; - - while (inptr < inend) { - int new_mode; - - new_mode = encode_mode (*inptr); - - if (new_mode != mode) { - switch (mode) { - case MODE_USASCII: - memcpy (m, start, inptr - start); - m += (inptr - start); - break; - case MODE_AMPERSAND: - while (start < inptr) { - *m++ = '&'; - *m++ = '-'; - start++; - } - break; - case MODE_MODUTF7: - inbuf = (char *) start; - inleft = inptr - start; - outbuf = (char *) m; - outleft = mend - m; - - if (cd == (iconv_t) -1) - cd = iconv_open ("UTF-7", "UTF-8"); - - conv = iconv (cd, &inbuf, &inleft, &outbuf, &outleft); - if (conv == (size_t) -1) { - g_warning ("error converting mailbox to UTF-7!"); - } - iconv (cd, NULL, NULL, &outbuf, &outleft); - - /* shift into modified UTF-7 mode (overwrite UTF-7's '+' shift)... */ - *m++ = '&'; - - while (m < (unsigned char *) outbuf) { - /* replace '/' with ',' */ - if (*m == '/') - *m = ','; - - m++; - } - - break; - } - - mode = new_mode; - start = inptr; - } - - inptr++; - } - - switch (mode) { - case MODE_USASCII: - memcpy (m, start, inptr - start); - m += (inptr - start); - break; - case MODE_AMPERSAND: - while (start < inptr) { - *m++ = '&'; - *m++ = '-'; - start++; - } - break; - case MODE_MODUTF7: - inbuf = (char *) start; - inleft = inptr - start; - outbuf = (char *) m; - outleft = mend - m; - - if (cd == (iconv_t) -1) - cd = iconv_open ("UTF-7", "UTF-8"); - - conv = iconv (cd, &inbuf, &inleft, &outbuf, &outleft); - if (conv == (size_t) -1) { - g_warning ("error converting mailbox to UTF-7!"); - } - iconv (cd, NULL, NULL, &outbuf, &outleft); - - /* shift into modified UTF-7 mode (overwrite UTF-7's '+' shift)... */ - *m++ = '&'; - - while (m < (unsigned char *) outbuf) { - /* replace '/' with ',' */ - if (*m == '/') - *m = ','; - - m++; - } - - break; - } - - *m = '\0'; - - if (cd != (iconv_t) -1) - iconv_close (cd); - - return mailbox; -} - -char * -imap_mailbox_decode (const unsigned char *in, size_t inlen) -{ - const unsigned char *start, *inptr, *inend; - unsigned char *mailbox, *m, *mend; - unsigned char mode_switch; - iconv_t cd; - - cd = (iconv_t) -1; - m = mailbox = g_malloc (UTF7_TO_UTF8_LEN (inlen) + 1); - mend = mailbox + UTF7_TO_UTF8_LEN (inlen); - - start = inptr = in; - inend = in + inlen; - mode_switch = '&'; - - while (inptr < inend) { - if (*inptr == mode_switch) { - if (mode_switch == '&') { - /* mode switch from US-ASCII to UTF-7 */ - mode_switch = '-'; - memcpy (m, start, inptr - start); - m += (inptr - start); - start = inptr; - } else if (mode_switch == '-') { - /* mode switch from UTF-7 to US-ASCII or an ampersand (&) */ - mode_switch = '&'; - start++; - if (start == inptr) { - /* we had the sequence "&-" which becomes "&" when decoded */ - *m++ = '&'; - } else { - char *buffer, *inbuf, *outbuf; - size_t buflen, outleft, conv; - - buflen = (inptr - start) + 2; - inbuf = buffer = alloca (buflen); - *inbuf++ = '+'; - while (start < inptr) { - *inbuf++ = *start == ',' ? '/' : *start; - start++; - } - *inbuf = '-'; - - inbuf = buffer; - outbuf = (char *) m; - outleft = mend - m; - - if (cd == (iconv_t) -1) - cd = iconv_open ("UTF-8", "UTF-7"); - - conv = iconv (cd, &inbuf, &buflen, &outbuf, &outleft); - if (conv == (size_t) -1) { - g_warning ("error decoding mailbox: %.*s", inlen, in); - } - iconv (cd, NULL, NULL, NULL, NULL); - - m = (unsigned char *) outbuf; - } - - /* point to the char after the '-' */ - start = inptr + 1; - } - } - - inptr++; - } - - if (*inptr == mode_switch) { - if (mode_switch == '&') { - /* the remaining text is US-ASCII */ - memcpy (m, start, inptr - start); - m += (inptr - start); - start = inptr; - } else if (mode_switch == '-') { - /* We've got encoded UTF-7 or else an ampersand */ - start++; - if (start == inptr) { - /* we had the sequence "&-" which becomes "&" when decoded */ - *m++ = '&'; - } else { - char *buffer, *inbuf, *outbuf; - size_t buflen, outleft, conv; - - buflen = (inptr - start) + 2; - inbuf = buffer = alloca (buflen); - *inbuf++ = '+'; - while (start < inptr) { - *inbuf++ = *start == ',' ? '/' : *start; - start++; - } - *inbuf = '-'; - - inbuf = buffer; - outbuf = (char *) m; - outleft = mend - m; - - if (cd == (iconv_t) -1) - cd = iconv_open ("UTF-8", "UTF-7"); - - conv = iconv (cd, &inbuf, &buflen, &outbuf, &outleft); - if (conv == (size_t) -1) { - g_warning ("error decoding mailbox: %.*s", inlen, in); - } - iconv (cd, NULL, NULL, NULL, NULL); - - m = (unsigned char *) outbuf; - } - } - } else { - if (mode_switch == '-') { - /* illegal encoded mailbox... */ - g_warning ("illegal mailbox name encountered: %.*s", inlen, in); - } - - memcpy (m, start, inptr - start); - m += (inptr - start); - } - - *m = '\0'; - - if (cd != (iconv_t) -1) - iconv_close (cd); - - return mailbox; + return imap_concat (store, store->namespace, name); } diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index d84041025c..caf79d90f5 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -214,6 +214,7 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con /* if we have no index file, force it */ forceindex = stat(lf->index_path, &st) == -1; if (flags & CAMEL_STORE_FOLDER_BODY_INDEX) { + lf->index = ibex_open(lf->index_path, O_CREAT | O_RDWR, 0600); if (lf->index == NULL) { /* yes, this isn't fatal at all */ diff --git a/camel/providers/nntp/Makefile.am b/camel/providers/nntp/Makefile.am index 4605be64c8..7761440f5f 100644 --- a/camel/providers/nntp/Makefile.am +++ b/camel/providers/nntp/Makefile.am @@ -16,37 +16,23 @@ INCLUDES = -I../.. \ -DG_LOG_DOMAIN=\"camel-nntp-provider\" libcamelnntp_la_SOURCES = \ + camel-nntp-auth.c \ + camel-nntp-folder.c \ + camel-nntp-grouplist.c \ + camel-nntp-newsrc.c \ camel-nntp-provider.c \ camel-nntp-store.c \ - camel-nntp-folder.c \ - camel-nntp-stream.c \ - camel-nntp-summary.c - -# camel-nntp-auth.c \ -# camel-nntp-folder.c \ -# camel-nntp-grouplist.c \ -# camel-nntp-newsrc.c \ -# camel-nntp-provider.c \ -# camel-nntp-store.c \ -# camel-nntp-utils.c + camel-nntp-utils.c libcamelnntpinclude_HEADERS = \ - camel-nntp-store.h \ + camel-nntp-auth.h \ camel-nntp-folder.h \ - camel-nntp-stream.h \ - camel-nntp-summary.h - -# camel-nntp-auth.h \ -# camel-nntp-folder.h \ -# camel-nntp-grouplist.h \ -# camel-nntp-newsrc.h \ -# camel-nntp-resp-codes.h \ -# camel-nntp-store.h \ -# camel-nntp-types.h \ -# camel-nntp-utils.h - -noinst_HEADERS = \ - camel-nntp-private.h + camel-nntp-grouplist.h \ + camel-nntp-newsrc.h \ + camel-nntp-resp-codes.h \ + camel-nntp-store.h \ + camel-nntp-types.h \ + camel-nntp-utils.h libcamelnntp_la_LDFLAGS = -version-info 0:0:0 diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index c54e0821d8..78509fad28 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -69,8 +69,7 @@ /* camel smtp transport class prototypes */ static gboolean smtp_can_send (CamelTransport *transport, CamelMedium *message); static gboolean smtp_send (CamelTransport *transport, CamelMedium *message, CamelException *ex); -static gboolean smtp_send_to (CamelTransport *transport, CamelMedium *message, - CamelAddress *from, CamelAddress *recipients, CamelException *ex); +static gboolean smtp_send_to (CamelTransport *transport, CamelMedium *message, GList *recipients, CamelException *ex); /* support prototypes */ static void smtp_construct (CamelService *service, CamelSession *session, @@ -567,23 +566,24 @@ smtp_can_send (CamelTransport *transport, CamelMedium *message) static gboolean smtp_send_to (CamelTransport *transport, CamelMedium *message, - CamelAddress *from, CamelAddress *recipients, - CamelException *ex) + GList *recipients, CamelException *ex) { CamelSmtpTransport *smtp_transport = CAMEL_SMTP_TRANSPORT (transport); const CamelInternetAddress *cia; - gboolean has_8bit_parts; + char *recipient; const char *addr; - int i, len; + gboolean has_8bit_parts; + GList *r; - if (!from) { + cia = camel_mime_message_get_from (CAMEL_MIME_MESSAGE (message)); + if (!cia) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot send message: " "sender address not defined.")); return FALSE; } - if (!camel_internet_address_get (CAMEL_INTERNET_ADDRESS (from), 0, NULL, &addr)) { + if (!camel_internet_address_get (cia, 0, NULL, &addr)) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot send message: " "sender address not valid.")); @@ -603,24 +603,18 @@ smtp_send_to (CamelTransport *transport, CamelMedium *message, camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot send message: " "no recipients defined.")); - camel_operation_end (NULL); + camel_operation_end(NULL); return FALSE; } - len = camel_address_length (recipients); - cia = CAMEL_INTERNET_ADDRESS (recipients); - for (i = 0; i < len; i++) { - if (!camel_internet_address_get (cia, i, NULL, &addr)) { - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, - _("Cannot send message: one or more invalid recipients")); - camel_operation_end (NULL); - return FALSE; - } - - if (!smtp_rcpt (smtp_transport, addr, ex)) { + for (r = recipients; r; r = r->next) { + recipient = (char *) r->data; + if (!smtp_rcpt (smtp_transport, recipient, ex)) { + g_free (recipient); camel_operation_end (NULL); return FALSE; } + g_free (recipient); } /* passing in has_8bit_parts saves time as we don't have to @@ -642,26 +636,42 @@ smtp_send_to (CamelTransport *transport, CamelMedium *message, static gboolean smtp_send (CamelTransport *transport, CamelMedium *message, CamelException *ex) { - const CamelInternetAddress *from, *to, *cc, *bcc; - CamelInternetAddress *recipients = NULL; - gboolean status; - - from = camel_mime_message_get_from (CAMEL_MIME_MESSAGE (message)); + const CamelInternetAddress *to, *cc, *bcc; + GList *recipients = NULL; + guint index, len; to = camel_mime_message_get_recipients (CAMEL_MIME_MESSAGE (message), CAMEL_RECIPIENT_TYPE_TO); cc = camel_mime_message_get_recipients (CAMEL_MIME_MESSAGE (message), CAMEL_RECIPIENT_TYPE_CC); bcc = camel_mime_message_get_recipients (CAMEL_MIME_MESSAGE (message), CAMEL_RECIPIENT_TYPE_BCC); - recipients = camel_internet_address_new (); - camel_address_cat (CAMEL_ADDRESS (recipients), CAMEL_ADDRESS (to)); - camel_address_cat (CAMEL_ADDRESS (recipients), CAMEL_ADDRESS (cc)); - camel_address_cat (CAMEL_ADDRESS (recipients), CAMEL_ADDRESS (bcc)); + /* get all of the To addresses into our recipient list */ + len = camel_address_length (CAMEL_ADDRESS (to)); + for (index = 0; index < len; index++) { + const char *addr; + + if (camel_internet_address_get (to, index, NULL, &addr)) + recipients = g_list_append (recipients, g_strdup (addr)); + } - status = smtp_send_to (transport, message, CAMEL_ADDRESS (from), CAMEL_ADDRESS (recipients), ex); + /* get all of the Cc addresses into our recipient list */ + len = camel_address_length (CAMEL_ADDRESS (cc)); + for (index = 0; index < len; index++) { + const char *addr; + + if (camel_internet_address_get (cc, index, NULL, &addr)) + recipients = g_list_append (recipients, g_strdup (addr)); + } - camel_object_unref (CAMEL_OBJECT (recipients)); + /* get all of the Bcc addresses into our recipient list */ + len = camel_address_length (CAMEL_ADDRESS (bcc)); + for (index = 0; index < len; index++) { + const char *addr; + + if (camel_internet_address_get (bcc, index, NULL, &addr)) + recipients = g_list_append (recipients, g_strdup (addr)); + } - return status; + return smtp_send_to (transport, message, recipients, ex); } static gboolean -- cgit v1.2.3