aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-utils.c
Commit message (Collapse)AuthorAgeFilesLines
* Reconstify variables to match iconv.Not Zed2001-03-021-2/+2
| | | | | | | | | | | | 2001-03-02 Not Zed <NotZed@Ximian.com> * camel-mime-utils.c (rfc2047_encode_word, rfc2047_decode_word): Reconstify variables to match iconv. * camel-search-private.c (camel_ustrstrcase): Change some assertions back into valid returns. svn path=/trunk/; revision=8452
* A fix for broken mailers that send 2-digit years (ie "Wed, 28 Feb 01Jeffrey Stedfast2001-03-011-1/+1
| | | | | | | | | | 2001-02-28 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-utils.c (header_decode_date): A fix for broken mailers that send 2-digit years (ie "Wed, 28 Feb 01 04:59:41"). Fixes bug #1633. svn path=/trunk/; revision=8432
* A fix for broken mailers that send 2-digit years (ie "Wed, 28 Feb 01Jeffrey Stedfast2001-03-011-4/+6
| | | | | | | | | | | | | 2001-02-28 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-utils.c (header_decode_date): A fix for broken mailers that send 2-digit years (ie "Wed, 28 Feb 01 04:59:41"). Fixes bug #1633. * camel-filter-driver.c (camel_filter_driver_filter_folder): Check to make sure message isn't NULL. svn path=/trunk/; revision=8431
* Added camel-sasl*.[c,h] to the build.Jeffrey Stedfast2001-03-011-0/+24
| | | | | | | | | | | | | | | | | | | | | | 2001-02-28 Jeffrey Stedfast <fejj@ximian.com> * Makefile.am: Added camel-sasl*.[c,h] to the build. * camel-sasl.[c,h]: new "abstract" SASL class * camel-sasl-kerberos4.[c,h]: new SASL class for KERBEROS_V4 * camel-sasl-cram-md5.[c,h]: new SASL class for CRAM-MD5 * camel-sasl-plain.[c,h]: new SASL class for PLAIN * providers/imap/camel-imap-auth.c: Removed the base64 functions. * camel-mime-utils.c (base64_encode_simple): Moved here from camel-imap-auth.c (base64_decode_simple): Same. svn path=/trunk/; revision=8428
* Made thread-safe and moved to above the test code.Jeffrey Stedfast2001-02-271-15/+38
| | | | | | | | | | | | | | | | | | 2001-02-26 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-utils.c: Made thread-safe and moved to above the test code. * camel-mime-message.c (camel_mime_message_init): Set the message_id to NULL. (camel_mime_message_finalize): Free the message_id. (camel_mime_message_set_message_id): New function to set the Message-Id. (camel_mime_message_get_message_id): New function to get the Message-Id. (process_header): Decode the message-id. svn path=/trunk/; revision=8393
* Take the ^Header: part out of the expression, since we look that upNot Zed2001-02-201-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | 2001-02-20 Not Zed <NotZed@Ximian.com> * camel-mime-utils.c (mail_list_magic): Take the ^Header: part out of the expression, since we look that up ourselves. (header_raw_check_mailing_list): When getting the match, get match 1, not match 0, we dont want the full string match. * camel-folder-summary.c (CAMEL_FOLDER_SUMMARY_VERSION): Bumped for summary change. (message_info_new): Extract the mlist info from the headers. (message_info_load): Load mlist from summary. (message_info_save): Save mlist to summary. (message_info_free): Save the mlist entry. (camel_message_info_new_from_header): Extract mailing list header. (camel_message_info_dup_to): Copy the mlist entry. (camel_message_info_free): Free mlist. (message_info_dump): Dump the mlist. * camel-folder-summary.h: Add an mlist (mailing list) string to the summary. svn path=/trunk/; revision=8295
* Changed this code to match the glibc iconv signature.Christopher James Lahey2001-02-151-3/+3
| | | | | | | | | | 2001-02-14 Christopher James Lahey <clahey@ximian.com> * camel-mime-filter-charset.c (complete, filter), camel-mime-utils.c (rfc2047_decode_word, rfc2047_encode_word): Changed this code to match the glibc iconv signature. svn path=/trunk/; revision=8238
* Rewrote using unicode_get_utf8(). (camel_ustrcasecmp): Use unicode_char_tJeffrey Stedfast2001-02-071-3/+4
| | | | | | | | | | 2001-02-06 Jeffrey Stedfast <fejj@ximian.com> * camel-search-private.c (utf8_get): Rewrote using unicode_get_utf8(). (camel_ustrcasecmp): Use unicode_char_t (camel_ustrncasecmp): Same. svn path=/trunk/; revision=8026
* Made these pass char ** as the second parameter to iconv.Christopher James Lahey2001-02-071-3/+3
| | | | | | | | | | 2001-02-06 Christopher James Lahey <clahey@ximian.com> * camel-mime-filter-charset.c (complete, filter), camel-mime-utils.c (rfc2047_decode_word, rfc2047_encode_word): Made these pass char ** as the second parameter to iconv. svn path=/trunk/; revision=8022
* Removed unwanted header. It was never put in for a reason. Stop fixingNot Zed2001-02-061-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | 2001-02-06 Not Zed <NotZed@Ximian.com> * camel-search-private.c: Removed unwanted header. It was never put in for a reason. Stop fixing irrelevant warnings. (camel_ustrstrcase): Our own strstrcase impl for utf8 strings. (camel_ustrcasecmp): Ditto for strcasecmp. (camel_ustrncasecmp): And strncasecmp. (utf8_get): Simpler interface to utf8 string processing. (camel_search_header_match): Use the new things. 2001-02-05 Not Zed <NotZed@Ximian.com> * camel-folder.c (get_summary): Removed some old variables/a small memleak. (free_summary): Removed old variables. * camel-mime-utils.c (header_raw_check_mailing_list): New utility function to get the mailing list (if any) that a set of headers came from. svn path=/trunk/; revision=8008
* If we are folding, drop the space at the end of the line.Not Zed2001-02-011-0/+3
| | | | | | | | | 2001-02-01 Not Zed <NotZed@Ximian.com> * camel-mime-utils.c (header_fold): If we are folding, drop the space at the end of the line. svn path=/trunk/; revision=7928
* Make the output a little prettier. Okay, so I'm anal...Jeffrey Stedfast2001-01-221-4/+5
| | | | | | | | | 2001-01-21 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-utils.c (header_param_list_format_append): Make the output a little prettier. Okay, so I'm anal... svn path=/trunk/; revision=7692
* REmove warning, this isn't really deprecated, sigh.Not Zed2001-01-031-2/+2
| | | | | | | | | | | 2000-12-29 Not Zed <NotZed@HelixCode.com> * camel-folder.c (camel_folder_move_message_to): REmove warning, this isn't really deprecated, sigh. * camel-mime-utils.c (header_fold): Comment out some debug. svn path=/trunk/; revision=7222
* New function to return just foo/bar with no parameters.Dan Winship2001-01-031-0/+6
| | | | | | | | | | * camel-mime-utils.c (header_content_type_simple): New function to return just foo/bar with no parameters. * camel-data-wrapper.c (get_mime_type): Use header_content_type_simple rather than header_content_type_format. svn path=/trunk/; revision=7213
* When checking to see if we need to fold the header, when we come accross aJeffrey Stedfast2000-12-161-1/+1
| | | | | | | | | | | 2000-12-15 Jeffrey Stedfast <fejj@helixcode.com> * camel-mime-utils.c (header_fold): When checking to see if we need to fold the header, when we come accross a \n, make sure to start at p + 1 the next time through the loop or else we get into an infinite loop. svn path=/trunk/; revision=7055
* Remove use of linewrap filter. Headers are now wrapped. encode_8bitMichael Zucci2000-12-111-50/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * providers/smtp/camel-smtp-transport.c (smtp_data): Remove use of linewrap filter. Headers are now wrapped. encode_8bit already enforces a 998 octet line limit. (smtp_data): Also fixed a memleak, we always have to unref our own copy of the filters. We also dont need to remove them manually, so dont bother. The type's an int too ... * camel-internet-address.c (internet_unformat): When scanning past quotes, remove them also. (camel_internet_address_format_address): If the name contains "'s, or ','s then strip and quotes and wrap the whole lot in one set of quotes. * Makefile.am (noinst_HEADERS): We dont want to install camel-charset-map-private.h, ever. There are probably other similar files ..? * camel-mime-part.c (write_to_stream): Fold header lines appropriately as we're writing them out. * camel-mime-utils.c (header_fold): Add a new argument, headerlen, tells it how long the associated header token is. (header_fold): Also,k check to see if we need to fold first, using a better algorithm, and also accept already-folded lines, and re-process accordingly. (rfc2047_decode_word): Add a little buffer space to iconv output for shifting overheads? (rfc2047_decode_word): finish the iconv with a null call, to flush shift state, etc. (rfc2047_encode_word): Attempt to break up long words into appropriately sized, independent, chunks. See rfc2047, section 2. (header_decode_mailbox): Dont add in extra spaces into the output if we are decoding adjacent encoded words. We can only guess this case, as some broken mailers put encoded words inside quoted words. (header_encode_phrase): Dont merge words if they are going to end up too long. Also change back ot only merge consecutive words of the same type. e.g. 'foo. blah fum.' -> "foo." blah "fum." or 'iam an. idiot' -> iam "an." idiot svn path=/trunk/; revision=6902
* Use iconv instead of unicode_iconv.Dan Winship2000-11-301-13/+14
| | | | | | | * camel-mime-utils.c: * camel-mime-filter-charset.c: Use iconv instead of unicode_iconv. svn path=/trunk/; revision=6721
* Add a missed unref.Not Zed2000-11-291-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2000-11-29 Not Zed <NotZed@HelixCode.com> * tests/message/test2.c (main): Add a missed unref. * camel-stream-mem.c (camel_stream_mem_set_buffer): We must set ourselves as the owner of the byte-array. Weird, someone has modified this file (its been reindented), but i can't see any changelogs ... * tests/lib/messages.c (content_finalise): Fix memleak in tester, free byte array when our content object is deleted. * camel-folder-search.c (camel_folder_search_finalize): Yeah great, so the sexp is a gtk object, not a camel object. Isn't that going to be fun to fix? * camel-session.c (camel_session_finalise): Free the storage path. * providers/local/camel-local-store.c (camel_local_store_init): If store->folders is setup, free it first, then overwrite. Hmm, this seems a bit crappy to me. * camel-store.c (camel_store_init): Dont setup store->folders if its already setup. * camel-exception.c (camel_exception_setv): Removed a memleak. no need to strdup after a strdup_printf!!! * camel-address.c (camel_address_finalize): Free the address ptrarray, once finished. * providers/local/camel-local-folder.c (local_finalize): Make sure we dont leave the folder locked on close. (local_finalize): Free summary/search. * providers/local/camel-mh-summary.c (mh_summary_next_uid_string): Small memleak, always free name after using it. * camel-mime-part.c (set_content_object): Free txt after setting the header. * providers/local/camel-maildir-summary.c (maildir_summary_check): Fix a memleak, close the dir after scanning new. (message_info_free): Added so we can free the filename cached in the messageinfo. (camel_maildir_summary_finalise): Free the hostname. * tests/folder/test[12].c (main): Clear out camel-test before starting. * providers/local/camel-mbox-summary.c (mbox_summary_sync_quick): Because encode_x_evolution folds the line (sigh, because encode_param does, unlike every other function in camel-mime-utils), unfold the encoded result before comparing. (mbox_summary_sync_quick): Another small memleak, free xevnew once finished with it. * camel-mime-utils.c (header_decode_quoted_string): Removed a redundant check for c=0. (header_unfold): New function to un-fold headers. * providers/local/camel-local-summary.c (local_summary_encode_x_evolution): some problems with encoding tags, using the wrong output strings. (local_summary_encode_x_evolution): We dont need to append a ; either, param_list_format_append() will do it for us. ` svn path=/trunk/; revision=6711
* little util to scan mailboxes for any and every address they contain.Michael Zucci2000-11-241-19/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tests/data/getaddr.pl: little util to scan mailboxes for any and every address they contain. * tests/message/test2.c (main): Added a bunch of stuff to test decoding/reencoding/etc of internationalised addresses. * tests/message/lib/address-data.h: Copy of some unicode/other testing data. **Beware** of editing this file in emacs, it'll probably try and convert all the characters to something unusable. * tests/lib/camel-test.c (camel_test_break): Add a debugger hook point. * camel-mime-utils.c (quoted_encode): Check for space and convert to _ separately. (header_decode_mailbox): Fixed the 'check comments for realname' code, problem was the domain getting code was skipping all whitespace/comments before we could get a look-in. This is approximate but fairly robust. (header_decode_text): Dont use the c-type isspace func here, we want a specific whitespace only. (header_decode_text): If we have decoded words next to each other, do not insert whitespaces between them, which is what rfc2047 requires. (header_decode_text): Make c unsigned too. svn path=/trunk/; revision=6658
* Add tests.Not Zed2000-11-241-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* check for return valuesRadek Doulik2000-11-221-3/+5
| | | | | | | | | 2000-11-22 Radek Doulik <rodo@helixcode.com> * camel-mime-utils.c (header_msgid_generate): check for return values svn path=/trunk/; revision=6651
* removed #include <libgnomevfs/gnome-vfs.h>Radek Doulik2000-11-161-2/+0
| | | | svn path=/trunk/; revision=6581
* mime_guess_type_from_file_name moved back to composer as it introducedRadek Doulik2000-11-151-19/+0
| | | | | | | | | 2000-11-15 Radek Doulik <rodo@helixcode.com> * camel-mime-utils.c: mime_guess_type_from_file_name moved back to composer as it introduced unwanted VFS dependency svn path=/trunk/; revision=6578
* Removed local again, not quite ready.Not Zed2000-11-151-4/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2000-11-15 Not Zed <NotZed@HelixCode.com> * providers/Makefile.am: Removed local again, not quite ready. 2000-11-14 Not Zed <NotZed@HelixCode.com> * camel-folder-summary.c (message_info_new_from_message): Use message_info_new to create the summary from headers, instead of getting directly from the message. (format_recipients): No longer required. * providers/Makefile.am (SUBDIRS): Added local. 2000-11-11 Not Zed <NotZed@HelixCode.com> * camel-mime-parser.c (folder_push_part): Make sure 'atleast' is at least 1, always. This is possibly a temporary fix for a bad failure mode on bad multipart messages. (folder_scan_content): Go until inend, not inend+1. Changed the continuation and retry logic to be simpler and more robust. If we can't find a marker within the atleast we need, just set it to 1, and try again, rather than just going to the next smaller limit (boundary check checks the length anyway). (header_append): streamline the empty line case. And strip trailing \r's if there are any (\n's already stripped). (folder_scan_header): Reordered and cleaned up a lot. Check for continuation only once, and compress lwsp then. Assume the header buffer already has end of line's stripped, and simplify some things: Only check for end of headers once and easier. Dont check to remove end of line character Dont bother testing inptr-start if we get a boundary match - it is always zero. (folder_scan_header): Removed the unused part variable, and a few pointless assignments. (folder_scan_header): Change the end limit to be 1 higher, to make sure we get all content. (folder_scan_content): And here too. (folder_scan_header): Killed a warning. (folder_push_part): Removed a bad comment. Actually boundarylenfinal can be zero for a new message not in a multipart. So we fix that here. 2000-11-09 Not Zed <NotZed@HelixCode.com> * camel-mime-utils.c (header_decode_param_list): Renamed from header_param_list_decode. (header_param_list_decode): New external function to decode a parameter list. (header_param_list_format_append): Made public. (header_param_list_format): Another new public helper function for formatting just a param list. * camel-folder-summary.c (next_uid_string): Default implementation is the same as before. (camel_folder_summary_class_init): And set it up. * camel-folder-summary.h: Make next_uid_string a virtual function. * camel-folder.c (camel_folder_change_info_changed): New function to return true if the changeset contains any changes. svn path=/trunk/; revision=6577
* fix ids ending with '.'Radek Doulik2000-11-111-1/+2
| | | | | | | | 2000-11-10 Radek Doulik <rodo@helixcode.com> * camel-mime-utils.c (header_msgid_generate): fix ids ending with '.' svn path=/trunk/; revision=6536
* new function, moved from composerRadek Doulik2000-11-081-0/+21
| | | | | | | | | 2000-11-08 Radek Doulik <rodo@helixcode.com> * camel-mime-utils.c (mime_guess_type_from_file_name): new function, moved from composer svn path=/trunk/; revision=6506
* Implement a complete() function, now we need one. (filter): Upgraded toNot Zed2000-11-071-15/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* new function, generates simple message/content idRadek Doulik2000-11-041-0/+13
| | | | | | | | | 2000-11-03 Radek Doulik <rodo@helixcode.com> * camel-mime-utils.c (header_msgid_generate): new function, generates simple message/content id svn path=/trunk/; revision=6389
* Set the preface/postface from the parser into the multipart object.Not Zed2000-11-041-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2000-11-04 Not Zed <NotZed@HelixCode.com> * camel-mime-part-utils.c (camel_mime_part_construct_content_from_parser): Set the preface/postface from the parser into the multipart object. * camel-multipart.c (camel_multipart_set_postface): Function to set the postface text on a multipart. (camel_multipart_set_preface): Similarly for preface text. * camel-mime-parser.c (folder_scan_content): If we scan until a boundary, then we do not include the \n that starts the boundary line in the content. (struct _header_scan_stack): Added a ByteArray to store the multipart pre/post-text as we're scanning. (folder_pull_part): Free pre/posttext if they are allocated. (folder_scan_step): Build into the pre/posttext arrays as we encounter data. (camel_mime_parser_preface): REturn the multipart preface text, if there is any scanned. (camel_mime_parser_postface): Likewise for postface text. (byte_array_to_string): helper function for above. * providers/mbox/camel-mbox-folder.c (mbox_append_message): Change the from line to be "\nFrom ..." always, so no need to check/append a \n to messages. (mbox_append_message): Open the output stream with append mode [assuming this is more efficient than seeking to the end] And dont prepend \n on the From line if its the first in the mbox. (mbox_append_message): Pass the offset of the real start of the "From " line when we perform the update (which may != 'seek') * camel-mime-filter-charset.c (complete): Removed the terminating NUL 'fix'. * camel-stream-filter.c (do_read): Added some debug. (do_flush): And here. (do_write): And here too. (do_write): ARGH!!! ARGH! Ok, so the filter stream was writing a different number of bytes than the requester was asking it to write (because of filtering, of course!). So instead of returning the true number of written bytes, we'll return what they asked us to write - unless there is an error in which case we return -1. * camel-mime-utils.c (base64_encode_close): Sigh, forgot to make it unsigned. I think this is actually a gcc bug as (48 >> 2) somehow ended up negative, when it obviously should not, even if the data load was signed. svn path=/trunk/; revision=6388
* Merged in camel-incremental-branch.Not Zed2000-11-021-23/+39
| | | | | | | | 2000-11-02 Not Zed <NotZed@HelixCode.com> * Merged in camel-incremental-branch. svn path=/trunk/; revision=6336
* Take an additional argument, "break_lines", saying whether or not to addDan Winship2000-10-311-5/+6
| | | | | | | | | | | | * camel-mime-utils.c (base64_encode_step, base64_encode_close): Take an additional argument, "break_lines", saying whether or not to add '\n's to the output. * camel-multipart.c (set_boundary): * camel-mime-filter-basic.c (filter, complete): Update for base64 api change. svn path=/trunk/; revision=6271
* Remove previous comment about Outlook brokenness, since it turns out theDan Winship2000-10-281-4/+0
| | | | | | | brokenness was actually somewhere else. (Still in Outlook, just not in the part of Outlook I was told it was.) svn path=/trunk/; revision=6241
* Work around Outlook brokenness in iMIP parsing by only quotingDan Winship2000-10-281-2/+18
| | | | | | | | * camel-mime-utils.c (header_param_list_format_append): Work around Outlook brokenness in iMIP parsing by only quoting Content-type parameters when the quoting is mandatory. svn path=/trunk/; revision=6237
* Simple subclass of CamelFolderSummary that also keeps a UIDVALIDITY valueDan Winship2000-10-131-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * providers/imap/camel-imap-summary.c: Simple subclass of CamelFolderSummary that also keeps a UIDVALIDITY value (and doesn't, for the moment, build content info). * providers/imap/camel-imap-folder.c: (various): Use a CamelImapSummary to store/fetch summary info. (camel_imap_folder_new): Take a path to a file to use for the summary. Set the folder's permanent_flags correctly according to the server response. Read in the summary (checking the UIDVALIDITY) and update it if it's out of date. (imap_refresh_info): Just fetch UIDs and flags. If the UIDs all match, update the flags as needed and be done with it. Otherwise, delete messages that have been expunged from the server and fetch full summary info for any new messages. (imap_sync): Save the summary to disk. (imap_update_summary): Renamed from imap_get_summary_internal. Can now be told to get summary for only a subset of messages. Use camel-mime-utils functions rather than rolling our own header parsing. (imap_get_message_info_internal): Merged into imap_update_summary. (imap_set_message_flags): Don't marked the message FOLDER_FLAGGED if we're not actually changing the value of any of the flags. (camel_imap_folder_changed): Deal with EXISTS rather than RECENT. * providers/imap/camel-imap-store.c (imap_connect): Call camel_session_get_storage_path and save the value. (get_folder): Create a local directory to store summary information and pass a summary file name to camel_imap_folder_new. Don't call camel_folder_refresh_info from here any more since camel_imap_folder_new does it again. * providers/imap/camel-imap-command.c (camel_imap_command): Add a special case to this to make it possible to get the repsonses from a SELECT and still have store->current_folder be updated correctly. (imap_read_response): parse EXISTS rather than RECENT * camel-session.c (camel_session_get_storage_path): Use e_mkdir_hier. * camel-folder-summary.c (camel_folder_summary_remove_index): New function. * camel-mime-utils.c (header_raw_append_parse): fix this. (camel-mime-parser.c doesn't use this code because of the MEMPOOL optimization, so nothing was ever actually calling it before.) svn path=/trunk/; revision=5891
* Removed temp_message_buffer, and content_input_stream fields which seem toNot Zed2000-10-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2000-10-11 Not Zed <NotZed@HelixCode.com> * camel-mime-part.h (struct _CamelMimePart): Removed temp_message_buffer, and content_input_stream fields which seem to have come from nowhere, and are unused. * camel-mime-utils.c: Added a note about touching this file. Nobody is to touch it without asking me first. That goes for you too Jeff. (header_decode_text): In what way is this broken? 2000-10-10 Not Zed <NotZed@HelixCode.com> * providers/imap/camel-imap-folder.c (imap_get_summary_internal): Fix camel_summary_* function rename (imap_get_message_info_internal): Likewise. * camel-mime-parser.c (camel_mime_parser_finalise): Fixed a spelling mistake. * camel-folder-summary.c (camel_summary_format_address): Uh, why do we encode and then decode here ... sigh. This is not the way to fix this. (camel_folder_summary_format_address): Renamed to a proper name, this was only supposed to be a private function. (camel_folder_summary_format_string): Likewise. Oh i see why it was made public, code reuse by cut & paste. Joy. svn path=/trunk/; revision=5881
* teach camel about "its" vs. "it's"Jacob "Ulysses" Berkman2000-10-111-4/+4
| | | | | | | | 2000-10-10 Jacob "Ulysses" Berkman <jacob@helixcode.com> * camel-*.c: teach camel about "its" vs. "it's" svn path=/trunk/; revision=5819
* Fix so that we don't encode every single char in the word. Also, do weJeffrey Stedfast2000-10-071-2/+2
| | | | | | | | | | | 2000-10-06 Jeffrey Stedfast <fejj@helixcode.com> * camel-mime-utils.c (quoted_encode): Fix so that we don't encode every single char in the word. Also, do we need a safemask? I don't see why we would. (header_encode_string): Don't strip off the last char!! svn path=/trunk/; revision=5766
* Fix so that we don't encode every single char in the word. Also, do weJeffrey Stedfast2000-10-071-12/+13
| | | | | | | | | | 2000-10-06 Jeffrey Stedfast <fejj@helixcode.com> * camel-mime-utils.c (quoted_encode): Fix so that we don't encode every single char in the word. Also, do we need a safemask? I don't see why we would. svn path=/trunk/; revision=5765
* Encode the name part of the address and don't quote the name.Jeffrey Stedfast2000-10-061-14/+71
| | | | | | | | | | | 2000-10-05 Jeffrey Stedfast <fejj@helixcode.com> * camel-mime-utils.c (header_address_list_format_append): Encode the name part of the address and don't quote the name. (header_decode_text): Rewrote from scratch, the old code was badly broken. svn path=/trunk/; revision=5758
* Modified to not encode space chars in the middle of a line. (isblank): NewJeffrey Stedfast2000-10-061-30/+38
| | | | | | | | | | | | | | | 2000-10-05 Jeffrey Stedfast <fejj@helixcode.com> * camel-mime-utils.c (quoted_encode_step): Modified to not encode space chars in the middle of a line. (isblank): New macro if we're not on a system with the GNU isblank extension. * camel-mime-message.c (camel_mime_message_set_from): Reversed my changes, don't header_encode_phrase - it generates broken headers. (camel_mime_message_set_reply_to): Same. svn path=/trunk/; revision=5747
* Handle the case where ct != NULL, but type and subtype are, and also matchNot Zed2000-10-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | 2000-10-04 Not Zed <NotZed@HelixCode.com> * camel-mime-utils.c (header_content_type_is): Handle the case where ct != NULL, but type and subtype are, and also match that against text/plain. * camel-folder-summary.c: Bump summary file version. (message_info_save): Save the size from the messageinfo. (message_info_load): Load the size from the summary file. (message_info_load): Fixed up the time_t saving/loading. There was a reason the warning was left there ... obviously nobody could read the comment "/* warnings, leave them here */", why do i even bother. (camel_folder_summary_decode_time_t): Decode a time_t value from the summary file. (camel_folder_summary_encode_time_t): Encode a time_t value to the summary file. svn path=/trunk/; revision=5706
* Make sure to add the space char after an encoded word when the encoding isJeffrey Stedfast2000-09-291-0/+2
| | | | | | | | | 2000-09-28 Jeffrey Stedfast <fejj@helixcode.com> * camel-mime-utils.c (header_encode_string): Make sure to add the space char after an encoded word when the encoding is iso-8859-1. svn path=/trunk/; revision=5626
* New function to fold headers.Not Zed2000-09-281-57/+348
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* (append_latin1): Do an additional mask for account for c'sMichael Zucci2000-08-311-1/+1
| | | | | | undefined behaviour for sign extension whilst shifting right. svn path=/trunk/; revision=5129
* New function - even though its broken, we'll assume mailers send latin1Not Zed2000-08-311-2/+24
| | | | | | | | | | | | 2000-08-31 Not Zed <NotZed@HelixCode.com> * camel-mime-utils.c (append_latin1): New function - even though its broken, we'll assume mailers send latin1 headers instead of us-ascii. We just have to encode high chars into utf-8. (header_decode_text): Call append_latin1 for appending unencoded text segments. svn path=/trunk/; revision=5128
* Use `g_free()' instead of `free()' in the `header_decode_text()'Ettore Perazzoli2000-08-271-1/+1
| | | | | | helper function. svn path=/trunk/; revision=5061
* More UTF-8 handlingLauris Kaplinski2000-08-251-1/+1
| | | | svn path=/trunk/; revision=5032
* put commas between addresses.Dan Winship2000-08-241-0/+2
| | | | | | | * camel-mime-utils.c (header_address_list_format_append): put commas between addresses. svn path=/trunk/; revision=4985
* Fixed some warnings.Christopher James Lahey2000-08-111-2/+6
| | | | | | | | | | | | | | | | 2000-08-10 Christopher James Lahey <clahey@helixcode.com> * camel-folder-search.c, camel-folder-summary.c, camel-medium.c, camel-mime-filter-charset.c, camel-mime-filter.c, camel-mime-filter.h, camel-mime-message.c, camel-mime-parser.c, camel-mime-part-utils.c, camel-mime-part.c, camel-mime-utils.c, camel-movemail.c, camel-multipart.c, camel-object.c, camel-stream-mem.c, providers/mbox/camel-mbox-folder.c, providers/mbox/camel-mbox-summary.c, providers/mh/camel-mh-folder.c, providers/smtp/camel-smtp-transport.c: Fixed some warnings. svn path=/trunk/; revision=4719
* A few string overrun checks for the mime parserPeter Williams2000-08-011-5/+5
| | | | svn path=/trunk/; revision=4427
* Make the mime parser a bit less reckless. More reckful?Matthew Loper2000-07-271-2/+2
| | | | svn path=/trunk/; revision=4365
* Remove some text cruft i was using for testing.Michael Zucci2000-07-131-2/+1
| | | | svn path=/trunk/; revision=4136
* Reset filter on setup. (reset): When resetting qp encoding, set the stateNot Zed2000-07-131-23/+75
| | | | | | | | | | | | | | | | | 2000-07-13 Not Zed <NotZed@HelixCode.com> * camel-mime-filter-basic.c (camel_mime_filter_basic_new_type): Reset filter on setup. (reset): When resetting qp encoding, set the state to -1, instead of 0. * camel-mime-utils.c (quoted_encode_step): Actually count the characters output sofar (it never counted any). Bunch of other fixes. (quoted_encode_close): Also flush out final character, if ther's one. svn path=/trunk/; revision=4135
* New function to copy a header_references structure.Dan Winship2000-07-101-1/+16
| | | | | | | | | | | | | | | | | | | | * camel-mime-utils.c (header_references_dup): New function to copy a header_references structure. * camel-folder-summary.c (camel_message_info_dup_to): New function to (deep) copy the data from one CamelMessageInfo into another. (camel_message_info_free): And free the data. * providers/vee/camel-vee-folder.c (vee_sync): Implement. (empty). (vee_search_by_expression): belatedly update for camel_folder_search change. (vee_folder_build): belatedly update for camel_folder_search change. Use camel_message_info_dup_to and camel_message_info_free (in particular, so that we get message_id and references info so vfolders can be threaded). (vee_folder_build_folder): Ditto. svn path=/trunk/; revision=4024
* Work around In-Reply-To's with unquoted punctuation. So many brokenDan Winship2000-07-081-1/+1
| | | | | | | * camel-mime-utils.c (header_references_decode): Work around In-Reply-To's with unquoted punctuation. So many broken mailers. svn path=/trunk/; revision=3962
* Make this deal with the full RFC822 References/In-Reply-To format ratherDan Winship2000-07-071-12/+18
| | | | | | | | | * camel-mime-utils.c (header_references_decode): Make this deal with the full RFC822 References/In-Reply-To format rather than just the more-nicely-behaved RFC1036 version. (Needed to parse In-Reply-To headers with extra junk in them.) svn path=/trunk/; revision=3926
* Added prototype for uudecode_stepJeffrey Stedfast2000-07-061-3/+1
| | | | | | | | | | | 2000-07-05 Jeffrey Stedfast <fejj@helixcode.com> * camel-mime-utils.h: Added prototype for uudecode_step * camel-mime-utils.c (uudecode_step): Cleaned up some junk that should have been cleaned up when debugging printf's were taken out. svn path=/trunk/; revision=3899
* A rather complex uudecoder written in the spirit of Zucchi-ness, is it upJeffrey Stedfast2000-07-021-0/+105
| | | | | | | | | | 2000-07-02 Jeffrey Stedfast <fejj@helixcode.com> * camel-mime-utils.c (uudecode_step): A rather complex uudecoder written in the spirit of Zucchi-ness, is it up to par? Only the Z-man can tell us :-) svn path=/trunk/; revision=3856
* Utilities for parsing broken date strings.Jeffrey Stedfast2000-07-011-290/+3
| | | | | | | | | | | 2000-06-30 Jeffrey Stedfast <fejj@helixcode.com> * broken-date-parser.[c,h]: Utilities for parsing broken date strings. * providers/imap/camel-imap-folder.c: fixed some mem leaks svn path=/trunk/; revision=3840
* oops, forgot I had blocked that code from running :)Jeffrey Stedfast2000-07-011-2/+2
| | | | svn path=/trunk/; revision=3837
* Wrote some code to try and un-mangle broken date formats and then parseJeffrey Stedfast2000-07-011-12/+314
| | | | | | | | | | 2000-06-30 Jeffrey Stedfast <fejj@helixcode.com> * camel-mime-utils.c (header_decode_date): Wrote some code to try and un-mangle broken date formats and then parse that new string instead. svn path=/trunk/; revision=3836
* KLUDGE! Since neither ETable nor GtkHTML supports UTF-8 yet, outputDan Winship2000-06-171-1/+1
| | | | | | | | | | | * camel-mime-utils.c (rfc2047_decode_word): * camel-mime-part-utils.c (simple_data_wrapper_construct_from_parser): * camel-folder-summary.c (summary_build_content_info): KLUDGE! Since neither ETable nor GtkHTML supports UTF-8 yet, output ISO-8859-1 instead, so Ettore can read his Italian mail. :) This will be reverted later. svn path=/trunk/; revision=3597
* Properly dereference warning/debug messages. (header_references_decode):Not Zed2000-06-081-6/+8
| | | | | | | | | | | 2000-06-07 Not Zed <NotZed@HelixCode.com> * camel-mime-utils.c (header_msgid_decode_internal): Properly dereference warning/debug messages. (header_references_decode): Check we actually have msgid stuff before trying to decode it ... svn path=/trunk/; revision=3467
* Ick, damn signs! Fix a bug with sign extended bytes.Not Zed2000-06-031-3/+3
| | | | | | | | | | | | 2000-06-02 Not Zed <NotZed@HelixCode.com> * camel-mime-utils.c (base64_encode_step): Ick, damn signs! Fix a bug with sign extended bytes. * camel-mime-filter-smtp.c (filter): Changed layout/logic slightly (to match From filter) svn path=/trunk/; revision=3408
* If we get a funny result, just throw it out. Basically a fix for the oneNot Zed2000-06-031-8/+81
| | | | | | | | | | | | | | | | | | | | | | 2000-06-02 Not Zed <NotZed@HelixCode.com> * camel-mime-utils.c (header_decode_date): If we get a funny result, just throw it out. Basically a fix for the one true broken TradeClient. 2000-06-01 Not Zed <NotZed@HelixCode.com> * camel-folder-summary.c (message_info_free): Free references/messsage id. (message_info_save): Save them. (message_info_load): Load them. (message_info_new): And get them from the new message. (CAMEL_FOLDER_SUMMARY_VERSION): Bumped for new changes. * camel-folder-summary.h: Added references and messageid to summary. svn path=/trunk/; revision=3391
* Use `foo@bar' rather than `"" <foo@bar>' for email addresses with no nameDan Winship2000-05-291-2/+2
| | | | | | | | * camel-mime-utils.c (header_address_list_format_append): Use `foo@bar' rather than `"" <foo@bar>' for email addresses with no name component. svn path=/trunk/; revision=3248
* Big bunch o memleaks fixed.NotZed2000-05-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | 2000-05-11 NotZed <NotZed@HelixCode.com> * camel-mime-part.c (write_to_stream): Unref the filter after adding it to the filtering stream. * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_finalise): Free the folder path. * camel-folder-summary.c (camel_folder_summary_finalise): Free the summary path. * camel-internet-address.c (internet_decode): Free multiple entry addresses properly. * camel-mime-utils.c (header_decode_mailbox): Plugged another memleak, free text after converting it. (header_decode_addrspec): More leaks plugged. * camel-mime-message.c (finalize): Free message_uid. (finalize): Free the recipients hashtable. svn path=/trunk/; revision=2989
* 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