aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-utils.c
Commit message (Collapse)AuthorAgeFilesLines
* Merged NEW_SUMMARY branch back to trunk, and resolved conflicts.NotZed2000-05-081-6/+10
| | | | | | | | | | | | | 2000-05-08 NotZed <NotZed@HelixCode.com> * Merged NEW_SUMMARY branch back to trunk, and resolved conflicts. * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_update): Return status. * camel-stream-filter.c (do_close): We NEED a stream close. svn path=/trunk/; revision=2906
* And same here ...NotZed2000-05-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | 2000-05-05 NotZed <NotZed@HelixCode.com> * camel-folder-summary.c: And same here ... * camel-mime-utils.c: Defined out some memory profiling stuff I left there by mistake. * camel-mime-parser.c (folder_scan_content): Apply the fix from the header scanner to here too. (folder_scan_header): Only check for end of header if we have space for it (didn't end the read with a newline) (folder_scan_header): inptr is the only real thing we need registerised for performance. Try to help the compiler be smart about it .. (folder_scan_header): Simplified the save header case a tad. Commented out some memory profiling stuff. svn path=/trunk/; revision=2811
* Plug a memory leak. (header_decode_text): Fixed memory leaks with52000-05-051-31/+35
| | | | | | | | | | | | | | | | | | 2000-05-05 <notzed@helixcode.com> * camel-mime-utils.c (header_decode_mailbox): Plug a memory leak. (header_decode_text): Fixed memory leaks with g_string_append(). (header_encode_string): And here too, and a few other places. The glib api is so awful ... (header_content_type_decode): More memory leaks, more left ... 2000-05-05 <notzed@helixcode.com> * camel-mime-parser.c (folder_scan_init_with_fd): Make sure we init the end of buffer sentinal! (folder_scan_init_with_stream): And here too ... svn path=/trunk/; revision=2810
* Maxcount is minimum of the max and the requested count, not the maximum :)NotZed2000-05-051-32/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | 2000-05-04 NotZed <NotZed@HelixCode.com> * providers/mbox/camel-mbox-folder.c (summary_get_message_info): Maxcount is minimum of the max and the requested count, not the maximum :) * camel-mime-parser.c (folder_scan_content): Properly set midline, so we dont falsely catch offset boundary markers (i.e. From inside content). (folder_read): Set a sentinal on the end of the read data (\n) so we dont have to check the buffer boundary in the inner loop. (mempool_*): New experimental memory management routines, speed up simple structure parsing by about 25% ... not compiled in by default. Something similar may be needed for camel-mime-utils to address performance issues with g_malloc and friends. * camel-mime-utils.c: Added a macro w(x) used to wrap all warnings about mime/rfc violations, so they can be turned off. * camel-folder-summary.c (summary_build_content_info): Step after the end of a message ... Turn into a stand-alone program for testing and profiling. svn path=/trunk/; revision=2808
* No, we're not going to have g_strcasecmp for no good reason,NotZed2000-05-041-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | not even if its slipped in with no changelog. 2000-05-04 NotZed <NotZed@HelixCode.com> * providers/mbox/camel-mbox-summary.c: Yes, and anotherone. * camel-mime-utils.c: And another one. * camel-mime-part.c: And another one. * camel-mime-part-utils.c: And another one. * camel-folder-search.c: And another one. * camel-mime-parser.c: Reverted a change wihtout a ChangeLog entry. 2000-05-04 NotZed <NotZed@HelixCode.com> * camel-folder-summary.[hc]: Yes, CamelFolderSummary is back ... ... re-usable class to summarise and index any stream or message and to manage/load/save the created summaries. * camel-folder.c: Include string.h to kill a warning. 2000-05-03 NotZed <NotZed@HelixCode.com> * camel-folder.h: Added pos/bodypos/endpos to the basic message content info object. Size to be removed? Moved the messageconentinfo and messageinfo back to camel-folder-summary.h. * camel-mime-filter-index.c (camel_mime_filter_index_set_ibex): New function to (re)set the index to use on a filter. * camel-mime-parser.c (camel_mime_parser_scan_from): Whole bunch of inline docs. (camel_mime_parser_drop_step): New function to drop a state from the parser. Needs more testing. svn path=/trunk/; revision=2789
* s/strcasecmp/g_strcasecamp/ everywhere except intl/, per michael'sJacob Leach2000-05-031-18/+18
| | | | | | request. svn path=/trunk/; revision=2776
* If the iconv handle is -1, then dont try and convert (crashesNotZed2000-05-031-10/+17
| | | | | | | | | | | | | | 2000-05-03 NotZed <NotZed@HelixCode.com> * camel-mime-utils.c (rfc2047_decode_word): If the iconv handle is -1, then dont try and convert (crashes unicode_iconv?). (rfc2047_decode_word): Use alloca for variables instead of g_malloc - by the rfc they should always be short. (rfc2047_decode_word): If we can't do the charset conversion, undo the quoted-printable/base64 at least? Should probably convert unknown characters to the utf-8 unknown character. svn path=/trunk/; revision=2774
* fix typo when dereferencing saveoffset.Larry Ewing2000-05-031-1/+1
| | | | | | | | | 2000-05-02 Larry Ewing <lewing@helixcode.com> * camel-mime-utils.c (header_decode_date): fix typo when dereferencing saveoffset. svn path=/trunk/; revision=2771
* Dont try and check a NULL header.NotZed2000-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2000-04-27 NotZed <NotZed@HelixCode.com> * camel-mime-utils.c (check_header): Dont try and check a NULL header. * camel-recipient.[ch]: Dead. Its not pining. * camel-mime-message.h: Dont include recipients.h anymore. * camel-mime-message.c (camel_mime_message_add_recipient): Accept name/address separately, and store in an CamelInternetAddress. (add_recipient): Removed. (remove_recipient): Removed. (remove_recipient_address): Renamed from remove_receipient, works via address. (camel_mime_message_remove_recipient_name): New function to remove by name. (get_recipients): Removed. (camel_mime_message_get_recipients): Return a camel-internet-address. (write_to_stream): No longer write receipients directly. (write_recipients_to_stream): Removed. (write_one_recipient_to_stream): Removed. (camel_mime_message_init): Setup recipients hashtable, rather than usign the recipients stuff. (set_recipient_list_from_string): Killed, a violent and lengthy death. (process_header): Simplified recipient handling code a lot. (received_date_str, sent_date_str, reply_to_str, subject_str, from_str): Removed some oddly-defined global statics. (camel_mime_message_class_init): Dont initialise above variables anymore. (init_header_name_table): Removed, use a table to init this, and do it in class init (2 lines of code ...). * camel-news-address.c: Class to represent news addresses - currently empty, and not built. * camel-internet-address.h: Class to represent internet (email) addresses. * camel-address.h: Abstract class to represent (lists of) addresses. svn path=/trunk/; revision=2671
* fix format specifier for time zone. Fix typo in month names array.Dan Winship2000-04-271-3/+2
| | | | | | | * camel-mime-utils.c (header_format_date): fix format specifier for time zone. Fix typo in month names array. svn path=/trunk/; revision=2640
* Big fixes for the last commit which broke the message creation entirely.Michael Zucci2000-04-241-36/+263
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Plus an address decoder/formatter, etc. * camel-mime-message.c (construct_from_parser): Allow MESSAGE_END _or_ EOF as valid termination conditions. * providers/mbox/camel-mbox-summary.c (message_struct_new): Decode and then re-encode the addresses, so they are consistently formatted. * camel-mime-utils.c (header_decode_mailbox): Store the address in a _header_address. And try to get a comment-stored name if there is one. (header_decode_address): Actually return an address. (header_to_decode): Renamed to header_address_decode() (header_mailbox_decode): New function to get a single mailbox. (header_mime_decode): Return the major/minor value, as appropriate. (header_address_new, and friends): Whole bunch of utility functions for working with the address thingies. (header_decode_domain): Free the string header, and dont expand '.' into ' . '. (camel_mime_part_construct_content_from_parser): Oops, this was totally screwed up, try creating the right cotnent on the right object. svn path=/trunk/; revision=2579
* fix some obvious minor bugs noted by -Wall.Dan Winship2000-04-241-2/+2
| | | | | | | * camel-mime-utils.c (header_to_decode, header_mime_decode): fix some obvious minor bugs noted by -Wall. svn path=/trunk/; revision=2563
* Whole swag of changes. Still lots of cleanup remaining ...NotZed2000-04-231-2/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2000-04-23 NotZed <NotZed@HelixCode.com> * camel-data-wrapper.c (set_mime_type_field): Ref the content_field when we get it? * camel-mime-parser.c (camel_mime_parser_unstep): New function. Cause a subsequent call to mime_parser_step() to return the same state over again. * providers/mbox/camel-mbox-folder.c (_get_message_by_uid): Initial test code using the mime parser to construct the message. * camel-mime-part.c (construct_from_parser): part constructor. (camel_mime_part_construct_content): Basically a simpler replacement for the datawrapper repository. (camel_mime_part_init): Set the default type to text/plain. * camel-simple-data-wrapper.c (construct_from_parser): Initial implementation of a content constructor. * camel-multipart.c (construct_from_parser): Multipart construction routine. (camel_multipart_init): Set the default multipart type to multipart/mixed. Duh, no subtype is not allowed anyway. 2000-04-22 NotZed <NotZed@HelixCode.com> * camel-mime-message.h (struct _CamelMimeMessage): Removed send_date, and received_date, and replaced it with a time_t 'date' (this is what the header is called), and date_offset to store the GMT offset of the date. * camel-mime-message.c (camel_mime_message_set_from): Update raw header as we go. (_set_from): Removed. (_get_from): Removed. (camel_mime_message_get_from): Moved implementation here. (camel_mime_message_get_subject): Move implementation here. (_get_subject): Nuked. (camel_mime_message_set_subject): Handle utf-8 input, and also update raw header when changed. (_set_subject): Removed. (_set_received_date): Removed. (camel_mime_message_set_received_date): Removed. (_get_received_date): Removed. (camel_mime_message_get_received_date): Removed. (_get_sent_date): Removed. (camel_mime_message_get_sent_date): Removed. (camel_mime_message_get_date): New function to get the date as a time_t/offset. (camel_mime_message_set_date): Set the date as a time_t/offset. (camel_mime_message_get_date_string): Get the date as a string. (camel_mime_message_init): Initialise the current date as 'CMAEL_MESSAGE_DATE_CURRENT'. (_set_reply_to): Removed. (camel_mime_message_set_reply_to): Moved implementation here. This is still broken, reply-to can have multiple addresses. (_get_reply_to): Removed. (_set_field): Removed, no longer used anywhere. (_get_field): Also removed. (_init_header_name_table): Add the Date header. (process_header): Also handle snooping of Date header here. * camel-stream-filter.c (finalise): Unref the source stream on finalise, and also call the parent class (oops). * camel-mime-parser.c (camel_mime_parser_state): New function to get the current parser state. (camel_mime_parser_stream): Allow you to get the stream back from the mime_parser. (camel_mime_parser_fd): Alternative to allow you to get the fd back from the mime_parser. (folder_scan_init_with_stream): Properly ref/unref the stream. (folder_scan_close): Properly unref the stream/close the fd on exit. (folder_scan_init_with_fd): Close the old fd if there is one. * camel-data-wrapper.c (camel_data_wrapper_construct_from_parser): New method, construct a data wrapper from an initialised parser. (construct_from_parser): Empty implementation. * providers/mbox/camel-mbox-summary.c (message_struct_new): Convert subject line to unicode, before storing in the summary. (strdup_trim): Removed, no longer needed. * providers/mbox/camel-mbox-folder.c (_get_message_by_uid): Ref the folder after setting it in the new message. * camel-mime-part.c (my_set_content_object): Have the headers follow the content-type change here too. (my_write_to_stream): Dont write content-type here, automatically stored in the headers ... (my_write_to_stream): Use header_disposition_format() to format the content-disposition header. (my_write_to_stream): Removed old code, all headers are now stored in the camel-medium level, always. Need to do the same with camel-mime-message i suppose ... (my_write_to_stream): Write the content using the parent class, not some weird function. (camel_mime_part_class_init): Dont override get_output_stream. (camel_mime_part_encoding_from_string): Bleh, make it case-insensitive. * camel-mime-utils.c (header_content_type_is): Handle empty types. (header_encode_string): Start of an implementation of the rfc2047 encoder. It does iso-8859-1, and us-ascii, and utf-8 (others get tricky *sigh*) (rfc2047_encode_word): Convert a single word/string into rfc2047 encoding. (quoted_encode): Different quoted-printable encoding for rfc2047 encoding of headers. * gmime-content-field.c (gmime_content_field_write_to_stream): Use header_content_type_format() to format it. svn path=/trunk/; revision=2560
* Ref the folder after setting it in the new message.NotZed2000-04-221-55/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2000-04-22 NotZed <NotZed@HelixCode.com> * providers/mbox/camel-mbox-folder.c (_get_message_by_uid): Ref the folder after setting it in the new message. * camel-mime-part.c (my_set_content_object): Have the headers follow the content-type change here too. (my_write_to_stream): Dont write content-type here, automatically stored in the headers ... (my_write_to_stream): Use header_disposition_format() to format the content-disposition header. (my_write_to_stream): Removed old code, all headers are now stored in the camel-medium level, always. Need to do the same with camel-mime-message i suppose ... * camel-mime-utils.c (header_content_type_is): Handle empty types. * gmime-content-field.c (gmime_content_field_write_to_stream): Use header_content_type_format() to format it. 2000-04-21 NotZed <NotZed@HelixCode.com> * camel-mime-utils.h: Add prototype for header_param_list_free. * camel-recipient.c: New function to remove all the types of a recipient list. I think this whole object needs a major review. * camel-mime-message.c (camel_mime_message_class_init): Removed parse_header_pair override, override add_header instead. (_parse_header_pair): Renamed to add_header. (remove_header): Add this method, to make sure we keep upto date with removed headers too. (_set_field): If given a NULL value, clear it out. (_set_recipient_list_from_string): Constify. (set_header): Override set_header from camel_medium. (process_header): Local function to handle set/add/remove of each header we know about. * camel-mime-part.c (camel_mime_part_class_init): Removed parse_header_pair setup. (my_parse_header_pair): Moved into add_header(), removed. (my_set_disposition): Allow a NULL disposition to clear it. (my_set_content_id): Allow NULL content id to clear it. (remove_header): Track removed headers. (my_set_description): Allow NULL description to clear it. (my_set_content_MD5): Make sure we copy the md5 value, and allow a NULL value to reset it. (my_set_filename): Copy the filename. (my_set_header_lines): Removed. Nothing uses it, it doesn't actually serve any purpose. (camel_mime_part_set_header_lines): Ditto. (my_get_header_lines): Ditto. (camel_mime_part_get_header_lines): Ditto. (camel_mime_part_class_init): Remove *_header_lines setup. (camel_mime_part_init): Remove header_lines init. (my_finalize): Remove header_lines finalise. (my_write_to_stream): Write the headers here. This is just WRONG, camel_medium should be doing this. (my_get_output_stream): Kill a warning. (camel_mime_part_encoding_to_string): Ditto. (camel_mime_part_set_description): Unvirtualiase, use add_header() to do the processing. (my_set_description): Removed. (set_disposition): Renamed from my_set_disposition. (camel_mime_part_get_description): Get the descriptionf rom the get_header method. (my_get_description): Removed. (my_set_filename): Removed. (camel_mime_part_get_filename): Get the parameter from the disposition. (camel_mime_part_encoding_from_string): Handle NULL string. (camel_mime_part_init): Remove reference to filename. (my_finalize): Dont free filename. * camel-mime-part.h (CamelMimePartClass): Removed parse_header_pair() method, it doesn't add anything that add_header() can't be used for. (CamelMimePartClass): Remove *_header_lines methods. (struct _CamelMimePart): Remove header_lines list. (struct _CamelMimePart): Removed filename attribute. * camel-medium.c (camel_medium_init): Init headers to null, not a hashtable. (add_header): Append the headers as a list. (remove_header): Remove headers as a list. (get_header): Likewise for lookup. (free_header): Removed, no longer needed. (finalize): Free headers using header_raw_clear(). (camel_medium_set_header): New function, to reset and override all values of a header with a new value. * camel-medium.h (struct _CamelMedium): Changed to use a header_raw struct rather than a hash table, to store headers (many headers can occur multiple times). * camel-mime-utils.c (header_raw_find_next): New function, allows you to find multi-valued header fields. (header_disposition_format): New function to format/create content-disposition header string. (header_param_list_format_append): Function to format parameter lists into a GString. (header_content_type_format): Function to format content-type into a usable format. (header_set_param): allow NULL value to remove the parameter. (decode_token): Renamed from header_decode_token. (header_decode_token): New interface for external use. (quoted_decode): Made static to kill annoying warnings. (g_strdup_len): Killed, replaced with calls to g_strndup(). (rfc2047_decode_word): Made static to kill warnings. (decode_coded_string): Terminated. (g_string_append_len): Made static to kill warnings. (header_decode_text): Made static to kill warnings. (header_decode_text): Constify. (rfc2047_decode_word): Constify. (header_param): Constify. (header_content_type_new): Copy the type/subtype strings. (header_param_list_decode): Made static. (header_param_list_format_append): Made static. (quoted_decode): Constify. (g_string_append_len): Constify. (header_token_decode): New function to decode a single token. * providers/mbox/camel-mbox-summary.c (header_write): Append a trailing \n when writing headers. (strdup_trim): Killed a warning. (camel_mbox_summary_set_uid): Make sure the next uid is at least 1 higher than any existing one. (header_evolution_decode): Use header_token_decode to get the token. * camel-mime-parser.c (folder_scan_header): Strip the trailing \n of the end of all header lines. svn path=/trunk/; revision=2551
* use libunicode iconv functions rather than libc ones (since libc might notDan Winship2000-04-211-8/+15
| | | | | | | | | | * camel-mime-utils.c (rfc2047_decode_word): use libunicode iconv functions rather than libc ones (since libc might not have them). (header_decode_date): add autoconfiscation on timezone code * camel.c (camel_init): call unicode_init () svn path=/trunk/; revision=2540
* MERGE NEW_PARSER branch into HEAD, fixed conflicts.NotZed2000-04-211-0/+1870
| | | | | | | | | | | | | | | | | | | | | | | | | 2000-04-20 NotZed <NotZed@HelixCode.com> * MERGE NEW_PARSER branch into HEAD, fixed conflicts. * gmime-content-field.c (_print_parameter): Duh, removed again (@@#$@ cvs merge). * camel-mime-utils.c (header_content_type_is): Constify. (header_content_type_unref): Killed a couple warnings. * camel-folder.c (_init): Removed more log crap. * providers/Makefile.am (SUBDIRS): Removed nntp, pending fixes for summary changes. * providers/mbox/camel-mbox-folder.c (_get_message_by_number): Fixed for new summary interface. Added a warning for using this broken api. (_get_message_by_uid): Fixed for message new with session vanishing. svn path=/trunk/; revision=2531
* mime utils namespace changeBertrand Guiheneuf1999-05-121-36/+0
| | | | svn path=/trunk/; revision=920
* overload wrapper class method. (_write_to_file): start to write some textbertrand1999-05-121-0/+36
1999-05-11 bertrand <Bertrand.Guiheneuf@inria.fr> * camel/camel-mime-part.c (_write_to_file): overload wrapper class method. (_write_to_file): start to write some text in file. svn path=/trunk/; revision=904