aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-charset-map.c
Commit message (Collapse)AuthorAgeFilesLines
* renamed to camel_charset_to_iconv() to make it just a little moreNot Zed2001-07-201-3/+3
| | | | | | | | | 2001-07-20 Not Zed <NotZed@Ximian.com> * camel-charset-map.c (camel_charset_get_iconv_friendly_name): renamed to camel_charset_to_iconv() to make it just a little more svn path=/trunk/; revision=11254
* Convert to the iconv-friendly charset names.Jeffrey Stedfast2001-07-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2001-07-19 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-filter-charset.c (camel_mime_filter_charset_new_convert): Convert to the iconv-friendly charset names. * providers/imap/camel-imap-store.c (create_folder): Fixed a compiler warning about returning without a value in a non-void function. Blah. * camel-mime-part.c (process_header): Pass the locale charset as the default_charset to header_decode_string(). * camel-folder-summary.c (camel_folder_summary_format_string): Pass the locale charset as the default_charset to header_decode_string(). (content_info_new): Same. * camel-mime-message.c (process_header): Pass the locale charset as the default_charset to header_decode_string(). * camel-mime-utils.c (append_8bit): New helper function who's purpose is similar to append_latin1() but for 8bit text that we are assuming is not latin1. (header_decode_text): Now takes a default_charset parameter and calls append_8bit when appropriate. (header_decode_string): Also takes a default_charset parameter now. (header_decode_mailbox): Pass NULL as the default_charset to header_decode_string(). svn path=/trunk/; revision=11250
* Modified to treat the return value from camel_charset_locale_name() as aJeffrey Stedfast2001-07-201-37/+38
| | | | | | | | | | | | | | | | | | 2001-07-19 Jeffrey Stedfast <fejj@ximian.com> * camel-pgp-context.c (pgp_verify): Modified to treat the return value from camel_charset_locale_name() as a const char*. * camel-sasl-digest-md5.c (digest_response): Modified to treat the return value from camel_charset_locale_name() as a const char*. * camel-charset-map.c (camel_charset_locale_name): Modify to return const char* by returning the static locale_charset which is created inside of camel_charset_map_init(). (camel_charset_map_init): Find the locale charset here and set the static variable. svn path=/trunk/; revision=11245
* Remove my iso8859-1 -> iso-8859-1 hack and useJeffrey Stedfast2001-07-201-3/+104
| | | | | | | | | | | | | | | | | | | | 2001-07-19 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-utils.c (rfc2047_decode_word): Remove my iso8859-1 -> iso-8859-1 hack and use camel_charset_get_iconv_friendly_name() instead. (rfc2184_decode): Use camel_charset_get_iconv_friendly_name() * camel.c (camel_init): Call camel_charset_map_init(). * camel-charset-map.c (camel_charset_map_init): New function to initialize the charset-equivalent lookup table. To be called by camel_init(). (camel_charset_get_iconv_friendly_name): New function to try and convert a charset into something that iconv is more likely to accept. svn path=/trunk/; revision=11235
* Update the copyrights, replacing Helix Code with Ximian andEttore Perazzoli2001-06-231-1/+1
| | | | | | helixcode.com with ximian.com all over the place. svn path=/trunk/; revision=10440
* Redo the BUILD_MAP code to not depend on libunicode. Now it only generatesDan Winship2001-05-311-92/+88
| | | | | | | | | | | | | | | | | | | * camel-charset-map.c: Redo the BUILD_MAP code to not depend on libunicode. Now it only generates a map of "popular" 8bit encodings. (It's not worthwhile to support obscure encodings, because any mailer that supports them will support UTF8 too. And Chinese and Japanese use mostly the same UTF8 characters so you need to decide between those encodings based on the locale or the charset of the message you're replying to or the input method you used. So this is sufficient for camel_charset_best's use.) * camel-charset-map-private.h: Regenerated. * camel.c (camel_shutdown): Move #ifdefs around to prevent a warning. svn path=/trunk/; revision=10055
* Replicate the semantics of the libunicode utf8 functions by returning NULLJon Trowbridge2001-05-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | 2001-05-14 Jon Trowbridge <trow@ximian.com> * camel-search-private.c (utf8_get): Replicate the semantics of the libunicode utf8 functions by returning NULL in the arg on invalid utf8. * camel-pgp-context.c (pgp_verify): Check for valid utf8, terminate loop if something looks wrong. * camel-mime-utils.c (header_encode_phrase_get_words): Properly check for invalid utf8. (header_encode_string): Properly check for invalid utf8. * camel-charset-map.c (camel_charset_step): Properly check for invalid utf8. 2001-05-14 Jon Trowbridge <trow@ximian.com> * e-html-utils.c (is_citation): Check for bad utf8. svn path=/trunk/; revision=9798
* Remove UNICODE_CFLAGS (and some other stuff that's redundant withDan Winship2001-04-271-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile.am (INCLUDES): Remove UNICODE_CFLAGS (and some other stuff that's redundant with EXTRA_GNOME_CFLAGS) (libcamel_la_LIBADD): Replace UNICODE_LIBS with GAL_LIBS. * camel-search-private.c: * camel-pgp-context.c: * camel-mime-utils.c: Use gunicode interfaces rather than libunicode. * camel-charset-map.c: Use gunicode rather than libunicode. (The charmap-regen code still depends on libunicode though.) * camel-mime-filter-charset.h: * tests/message/test2.c (convert): Use iconv rather than unicode_iconv. * providers/smtp/Makefile.am (libcamelsmtp_la_LIBADD): * providers/pop3/Makefile.am (libcamelpop3_la_LIBADD): * providers/local/Makefile.am (libcamellocal_la_LIBADD): Remove UNICODE_LIBS. * camel.c (camel_init): Remove call to unicode_init. * camel-mime-parser.c: Remove unused unicode.h include. svn path=/trunk/; revision=9585
* Added a prototype for stamp().Jeffrey Stedfast2001-04-171-1/+2
| | | | | | | | | | | | | | | 2001-04-16 Jeffrey Stedfast <fejj@ximian.com> * camel-operation.c: Added a prototype for stamp(). * camel-charset-map.c (camel_charset_locale_name): #include string.h so we don't get a warning about strchr being undefined and also init charset to NULL. * camel-pgp-context.c (pgp_verify): Go back to doing the utf8 conversion by hand so that we don't depend on gal. svn path=/trunk/; revision=9388
* Use camel_charset_locale_name() to get the locale charset rather thanJeffrey Stedfast2001-04-111-0/+35
| | | | | | | | | | | | | | | 2001-04-11 Jeffrey Stedfast <fejj@ximian.com> * camel-sasl-digest-md5.c (digest_response): Use camel_charset_locale_name() to get the locale charset rather than checking the CHARSET environment variable. This is a much less ugly hack. Also: If we fail to be able to convert to UTF8, then disavow all knowledge of the charset parameter. * camel-charset-map.c (camel_charset_locale_name): New function to return the locale charset (or NULL if US-ASCII). svn path=/trunk/; revision=9237
* Add tests.Not Zed2000-11-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2000-11-24 Not Zed <NotZed@HelixCode.com> * Makefile.am (SUBDIRS): Add tests. * camel-mime-filter-basic.c (filter): Well, I'll add the extra bytes here too, lathough not strictly needed, might save a re-malloc when we get to complete(). * camel-mime-filter-charset.c (filter): Make sure we have room if we only convert very short data. (complete): and here too. * tests/Makefile.am: Initial test harness & tests. Requires gcc for this. * camel-internet-address.c (d): Turn off debug. * camel-charset-map.c (camel_charset_step): Oops, & masks for set intersection, not | them. Dunno how this got even close to working. 2000-11-23 Not Zed <NotZed@HelixCode.com> * camel-mime-filter-basic.c (filter): For base64 encoding, the output size for 0, 1, or 2 bytes of input can exceed input*2, so make sure we account for that as well. (complete): And here. (complete): Similarly for qp encoding, if we have a trailing space, we need some extra bytes (not needed for 'filter()', as any such bytes are stored in state/save). * camel-mime-utils.c (quoted_decode_step): Removed fixme not required. (quoted_encode_close): Dont append a trailing afterall. Otherwise a pass through the encode/decode will grow the message each time. svn path=/trunk/; revision=6656
* Implement a complete() function, now we need one. (filter): Upgraded toNot Zed2000-11-071-28/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2000-11-07 Not Zed <NotZed@HelixCode.com> * camel-mime-filter-bestenc.c (complete): Implement a complete() function, now we need one. (filter): Upgraded to match rfrc2045 properly. Checks also for length of line and valid CRLF sequences. (camel_mime_filter_bestenc_get_best_encoding): Do the work of working out what is the best encoding given what we found about the stream. * camel-mime-part.c (camel_mime_part_encoding_to_string): Use a lookup table to get the encoding naem, and add the binary type. (camel_mime_part_encoding_from_string): Likewise for the reverse. * camel-mime-part.h: Added the binary encoding type, see rfc2045. * camel-mime-utils.c (header_param_list_format_append): Dont put a space before ;'s in parameter lists, makes them more readable/consistent. * camel-mime-message.c (multipart_has_8bit_parts): Cleaned up the old stuff, well removed it. (camel_mime_message_set_best_encoding): Added another argument that lets you select what you want to set the best of. i.e. for smtp transport we only need 7 bit, and dont need to optimise the charset (although of course, we should always). (find_best_encoding): Implement this feature, if we are not getting the best charset, use the one we have. (best_encoding): Set the charset on the part appropriately. Sigh, the interfaces for this are nonexistant. (find_best_encoding): Tell the bestenc filter that lf should be treated as crlf for the purposes of determining encodings. 2000-11-06 Not Zed <NotZed@HelixCode.com> * camel-charset-map.c (camel_charset_init): Init function for an iterative charset determinator. (camel_charset_step): Iterate another buffer. (camel_charset_mask): Removed, since it couldn't have worked. (camel_charset_best): Use the iterative interface to do the work. (camel_charset_best_name): Get the best name for a charset so far. * camel-mime-filter-bestenc.c: New class, a stream filter that can be used to memory-efficiently determine the best encoding and/or charset to use for a given stream of bytes. * Makefile.am (libcamelinclude_HEADERS): Added stream-null*. (libcamel_la_SOURCES): Added bestenc* * camel-stream-null.c: New class, a null-stream, that always succeeds, and never has any contents. * camel-stream.c: Minor pointless changes. Was going to do something else but changed my mind. Added trivial default implementations for all callbacks. * camel-mime-message.h: Cleaned up some old cruft. * camel-folder-summary.c (camel_folder_summary_format_address): address_list_format() no longer encodes, so we dont need to decode it. * camel-address.c (camel_address_unformat): New function, attempts to reverse the formatting process on display addresses. (camel_address_length): New function to get the number of addresses, without having to peek the structure. * camel-mime-message.c (camel_mime_message_set_from): Fix a typo. (camel_mime_message_finalize): Only unref from/reply_to if we have it. (camel_mime_message_set_recipients): New function - set the recipients as a CamelInternetAddress. This function effectively deprecates the older recipient setting functions. (camel_mime_message_add_recipient): What the hell, i'll bite the bullet. Terminate this function. The old api was ambiguious and inefficient and didn't work right anyway. (camel_mime_message_remove_recipient_address): And this one. (camel_mime_message_remove_recipient_name): And this one too. (camel_mime_message_set_recipients): If we set an empty header, then remove it from the header list. Allow a null receipient object to clear a header. (camel_mime_message_set_from): Likewise, if setting an empty from address. (camel_mime_message_encode_8bit_parts): Eeek!! camel_stream_mem_new_with_byte_array owns the byte_array we give it, so make sure we dont free any of it! (camel_mime_message_encode_8bit_parts): Infact, i'll just rewrite the whole lot, its a bit of a mess. Should really rename it and make it a little more useful too, lets see ... (best_encoding): This has a string interface? Oh boy. (camel_mime_message_foreach_part): New experimental function to iterate over all message parts. Might not remain. (camel_mime_message_has_8bit_parts): New implementation using foreach_part. Fixed a couple of problems. (find_best_encoding): New function, that finds the best encoding for a given part (will probably be moved to camel-mime-part), and also the best charset to use if it is a text part. Since one affects the other it is a two pass process, but uses streams and not memory to achieve this. (camel_mime_message_set_best_encoding): Uses the function above to configure an entire message for the best encoding possible given transport constraints. (camel_mime_message_encode_8bit_parts): Reimplemented to use the function above to perform the work. * camel-internet-address.c (camel_internet_address_format_address): Dont put <> around a lone address with no real name. (camel_internet_address_encode_address): Similarly. (internet_decode): Actually return the count of decoded addresses. (internet_unformat): Implement the unformatting routine. 2000-11-05 Not Zed <NotZed@HelixCode.com> * providers/smtp/camel-smtp-transport.c (_send_to): Changed to get the internetaddress directly, rather than having to parse it itself. * camel-address.c (camel_address_format): Added a new function which will format address, suitable for display. (camel_address_cat): Concatentate 1 camel address onto another. It is upto the caller to ensure the addresses are of compatible types. (camel_address_new_clone): New function to create a new address by copying an existing one of the same type. (camel_address_copy): New helper function to copy an address. * camel-mime-message.h (struct _CamelMimeMessage): Removed cached copy of date string. (struct _CamelMimeMessage): Added date_received info. * camel-mime-message.c (camel_mime_message_get_date_string): Removed. Nothing uses it anyway, and it is redundant. (camel_mime_message_finalize): No more date_str. (camel_mime_message_init): No more date_str, initialise date_received* (write_to_stream): Change the check for a date header. (process_header): No longer track the date_str. (camel_mime_message_get_received_date): Removed. totally invalid anyway. (camel_mime_message_get_sent_date): Removed. Redundant. The only 'date' is the sent date, the received date is just made up. (camel_mime_message_get_date): Args changed to be more consistent with utility functions. (camel_mime_message_get_date): Dont set the date when we're asked for it (if its not set by the time its written, it'll be set then). (camel_mime_message_get_date_received): Actually do 'the right thing' here, if we have a received header, use that to determine the received date. And return the data in the same format as get_date. (camel_mime_message_set_from): Changed the api to better match what we should be doing. Pass a camelinternetaddress, etc. (camel_mime_message_set_reply_to): Cahnged similarly to take an internetaddress. (camel_mime_message_get_reply_to): Likewise. (camel_mime_message_finalize): Unref the from/reply_to objects. (format_address): Removed, no longer needed. (process_header): Changed to store the from/reply_to as internetaddress's. (write_to_stream): Set the from header directly to empty, if we dont have one. Maybe we should just abort, and/or create one based on the current user. * camel-mime-utils.c (header_address_list_format): Renamed to header_address_list_encode, which is what it is actually doing. (header_address_list_format_append): Similarly. (encoding_map[]): Removed, no longer used. (header_address_list_encode_append): Take another arg, do we encode the address (for internet), or not (for display - utf8 only). (header_address_list_format): Re-added this function, but now it generates a display version only. Surprise surprise, that is all anythign needs to generate anyway. Sigh. * camel-internet-address.c (camel_internet_address_get): Return false if we get an invalid index only. (camel_internet_address_encode_address): Helper function to encode a single address for mailing. (internet_encode): Use the above function to format it. (camel_internet_address_format_address): Format a single address for display. (internet_format): Implement the display version. (camel_internet_address_class_init): Init the internet_format virtual function. (internet_cat): Implement virtual function to concatenate addresses. * camel-folder-summary.c (camel_folder_summary_info_new_from_header): new function, only build the summary info, dont add it. (camel_folder_summary_info_new_from_parser): Likewise, for new info from parser. (camel_folder_summary_add_from_parser): Cahnged to call function above to build info. (camel_folder_summary_add_from_header): Changed to call function above, to build info. (camel_folder_summary_info_free): New function to free the summary message info. (camel_folder_summary_clear): Changed to clal above to free info. (camel_folder_summary_remove): Likewise. (camel_folder_summary_add): Cleaned up the clashing uid re-assignment logic a little bit. (camel_folder_summary_decode_uint32): Fixed a typo, 01 != -1. (camel_folder_summary_decode_time_t): Return -1 on error. (camel_folder_summary_encode_off_t): New function to encode an off_t type. (camel_folder_summary_decode_off_t): And likewise for the reverse. (CAMEL_FOLDER_SUMMARY_VERSION): Bumped the summary version, since we're now encoding time/off_t's right. (summary_header_save): Use time_t encoder to save the timestamp. (summary_header_load): Likewise for decoding the timestamp. (content_info_load): Decode off_t types directly, now we can. (content_info_save): And likewise for encoding. (camel_folder_summary_add_from_message): New function, create a summary item from an existing message and add it. (camel_folder_summary_info_new_from_message): New function, create a summary item from an existing message. (summary_build_content_info_message): New function to do the dirty work of building the conent info/indexing, from a message source. (format_recipients): Format an internetaddress suitable for the summary. (message_info_new_from_message): Build a new summary item from a mime message. (content_info_new_from_message): Build a new conent info from a mime part. (camel_folder_summary_class_init): Init the new class functions. (message_info_new_from_message): Fixed for message api change. Added documentation to the functions. svn path=/trunk/; revision=6474
* calendar: made all gui show localizedGediminas Paulauskas2000-11-011-2/+18
| | | | | | | camel: updated charset info from newest libunicode po: updated Lithuanian translation svn path=/trunk/; revision=6308
* Remove md5-utils.h include since it's not part of Camel any more.Dan Winship2000-10-301-7/+4
| | | | | | | | | | | | | | | | | | | | * camel.h: Remove md5-utils.h include since it's not part of Camel any more. * camel-charset-map.c: Kill some warnings. * providers/nntp/camel-nntp-grouplist.c (camel_nntp_get_grouplist_from_file, camel_nntp_grouplist_save): Clean up warnings about time_t casts. * providers/smtp/camel-smtp-transport.c: Remove unused md5-utils.h include. * providers/pop3/camel-pop3-store.c: Undefine the "_" macro defined by krb4's des.h when compiling with krb support. Fix md5-utils.h include. svn path=/trunk/; revision=6253
* New function to fold headers.Not Zed2000-09-281-0/+257
2000-09-28 Not Zed <NotZed@HelixCode.com> * camel-mime-utils.c (header_fold): New function to fold headers. 2000-09-27 Not Zed <NotZed@HelixCode.com> * camel-mime-parser.c (folder_scan_header): If we had an empty header, then it must be end of the headers too. (folder_scan_init): No we dont need to init the outbuf with a nul terminator. * camel-folder-summary.c (camel_folder_summary_set_uid): New function to reset the uid to a higher value. * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_sync): "something failed (yo!)" what sort of crap is this? Fixed all the indenting again, what wanker keeps running stuff through indent? (message_info_new): Check the uid we loaded off the disk, if it existed already, assign a new one. If it didn't then make sure the nextuid is higher. * camel-charset-map.c: New file, used to build a large unicode decoding mapping table, and use it to determine what is the lowest charset a given word can be encoded with. Uses tables from libunicode's source. * camel-internet-address.c (internet_encode): Use header_phrase_encode to properly encode the fullname, as required. refixed indenting. Who keeps doing that? (camel_internet_address_find_address): Changed fatal return/warnings into assertions. * camel-mime-utils.c (header_raw_append_parse): Check : explicitly (removed from is_fieldname() macro). (camel_mime_special_table): Changed to short, so we can represent more bit types. (quoted_encode): Take a mask of the safe chars for this encoding. (header_address_decode): Removed a #warning that makes no sense anymore. (header_decode_date): Fixed the 'broken date' parser code, if it ever decoded it it just threw away the result. (header_encode_string): Use better charset matching for encoding strings as well. 2000-08-31 Not Zed <NotZed@HelixCode.com> * providers/mh/camel-mh-summary.c (camel_mh_summary_sync): Save the index if we do a sync. (camel_mh_summary_check): Save the index here too. Probably. svn path=/trunk/; revision=5615