Commit Graph

137 Commits

Author SHA1 Message Date
31cab455ff Wrote a new version of header_fold() that takes a 'force' option and uses
2001-03-04  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-mime-utils.c: Wrote a new version of header_fold() that
	takes a 'force' option and uses another new function called
	header_fold_next_space() in place of strchr(inptr, ' ') to get the
	next whitespace char. The idea of header_fold_next_space() is to
	not treat spaces between a set of quotes as a space - this way it
	will be possible to fold (for example) the Content-Type MIME
	header without worrying about breaking up a boundary string.
	Note: This code is #if 0'd out until Zucchi approves of the patch.
	Another Note: We will probably still want to use the "don't fold
	this header" hash lookup for headers like the Message-Id and
	possibly a few others.

svn path=/trunk/; revision=8552
2001-03-05 04:02:38 +00:00
559f8e8245 encoded string segments need to be at least 8 chars (7 doesn't leave room
2001-03-04  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-mime-utils.c (rfc2047_decode_word): encoded string
	segments need to be at least 8 chars (7 doesn't leave room for an
	ecoding value. To be more realistic, even 8 chars isn't enough as
	this assumes there is no charset nor any encoded text. If the
	encoding value is not 'Q' or 'B', then return NULL. This fixes bug
	#1689.

svn path=/trunk/; revision=8550
2001-03-05 00:37:44 +00:00
90dabbdb22 Reconstify variables to match iconv.
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
2001-03-01 17:31:33 +00:00
8d5ca6bb75 A fix for broken mailers that send 2-digit years (ie "Wed, 28 Feb 01
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
2001-02-28 21:40:51 +00:00
65839ea1ee A fix for broken mailers that send 2-digit years (ie "Wed, 28 Feb 01
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
2001-02-28 21:06:44 +00:00
4321d72d9b Added camel-sasl*.[c,h] to the build.
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
2001-02-28 18:16:02 +00:00
a596227e1c Made thread-safe and moved to above the test code.
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
2001-02-26 19:56:58 +00:00
72bc2233d2 Take the ^Header: part out of the expression, since we look that up
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
2001-02-20 00:19:16 +00:00
9bf0f94434 Changed this code to match the glibc iconv signature.
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
2001-02-14 23:43:38 +00:00
7c6a688ab9 Rewrote using unicode_get_utf8(). (camel_ustrcasecmp): Use unicode_char_t
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
2001-02-06 21:50:37 +00:00
f8f9d8aadb Made these pass char ** as the second parameter to iconv.
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
2001-02-06 20:57:17 +00:00
b8af62e803 Removed unwanted header. It was never put in for a reason. Stop fixing
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
2001-02-06 02:38:19 +00:00
fd49db2029 If we are folding, drop the space at the end of the line.
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
2001-02-01 00:29:35 +00:00
18e2b2ebc5 Make the output a little prettier. Okay, so I'm anal...
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
2001-01-22 03:46:57 +00:00
ef48c6d6b0 REmove warning, this isn't really deprecated, sigh.
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
2001-01-03 00:15:54 +00:00
af35d99587 New function to return just foo/bar with no parameters.
* 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
2001-01-02 19:33:34 +00:00
7fbf92b1d6 When checking to see if we need to fold the header, when we come accross a
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
2000-12-15 21:33:21 +00:00
1c95a1e985 Remove use of linewrap filter. Headers are now wrapped. encode_8bit
* 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
2000-12-11 11:40:15 +00:00
ac3f575649 Use iconv instead of unicode_iconv.
* camel-mime-utils.c:
	* camel-mime-filter-charset.c: Use iconv instead of unicode_iconv.

svn path=/trunk/; revision=6721
2000-11-29 20:41:08 +00:00
d38a417de3 Add a missed unref.
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
2000-11-29 10:49:05 +00:00
05aaadc66b little util to scan mailboxes for any and every address they contain.
* 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
2000-11-24 07:06:45 +00:00
99e80d6ecf Add tests.
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
2000-11-24 03:18:20 +00:00
982a078d51 check for return values
2000-11-22  Radek Doulik  <rodo@helixcode.com>

	* camel-mime-utils.c (header_msgid_generate): check for return
	values

svn path=/trunk/; revision=6651
2000-11-22 15:50:10 +00:00
20b14e0bb5 removed #include <libgnomevfs/gnome-vfs.h>
svn path=/trunk/; revision=6581
2000-11-15 18:45:53 +00:00
7384e82aa7 mime_guess_type_from_file_name moved back to composer as it introduced
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
2000-11-15 08:44:57 +00:00
fb76cad79a Removed local again, not quite ready.
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
2000-11-15 06:33:49 +00:00
88bb6dde6d fix ids ending with '.'
2000-11-10  Radek Doulik  <rodo@helixcode.com>

	* camel-mime-utils.c (header_msgid_generate): fix ids ending with '.'

svn path=/trunk/; revision=6536
2000-11-10 20:46:59 +00:00
413284362f new function, moved from composer
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
2000-11-08 13:04:59 +00:00
c70c4c35f3 Implement a complete() function, now we need one. (filter): Upgraded to
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
2000-11-07 12:31:10 +00:00
1ca157384d new function, generates simple message/content id
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
2000-11-04 10:07:37 +00:00
338344b2e4 Set the preface/postface from the parser into the multipart object.
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
2000-11-04 02:34:46 +00:00
f351369e51 Merged in camel-incremental-branch.
2000-11-02  Not Zed  <NotZed@HelixCode.com>

        * Merged in camel-incremental-branch.

svn path=/trunk/; revision=6336
2000-11-02 03:35:04 +00:00
abe39be172 Take an additional argument, "break_lines", saying whether or not to add
* 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
2000-10-30 16:58:53 +00:00
201718d553 Remove previous comment about Outlook brokenness, since it turns out the
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
2000-10-27 22:05:45 +00:00
aa1f585298 Work around Outlook brokenness in iMIP parsing by only quoting
* 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
2000-10-27 20:19:48 +00:00
e81e64f8dd Simple subclass of CamelFolderSummary that also keeps a UIDVALIDITY value
* 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
2000-10-12 20:55:11 +00:00
6c337e9ea0 Removed temp_message_buffer, and content_input_stream fields which seem to
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
2000-10-12 13:38:51 +00:00
8a246228a9 teach camel about "its" vs. "it's"
2000-10-10  Jacob "Ulysses" Berkman  <jacob@helixcode.com>

	* camel-*.c: teach camel about "its" vs. "it's"

svn path=/trunk/; revision=5819
2000-10-10 16:57:29 +00:00
ff1f5fc3dd Fix so that we don't encode every single char in the word. Also, do we
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
2000-10-06 19:05:22 +00:00
734f0a9402 Fix so that we don't encode every single char in the word. Also, do we
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
2000-10-06 17:59:39 +00:00
1d7f431754 Encode the name part of the address and don't quote the name.
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
2000-10-06 00:59:34 +00:00
19d6689653 Modified to not encode space chars in the middle of a line. (isblank): New
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
2000-10-05 21:26:28 +00:00
47a2f8444f Handle the case where ct != NULL, but type and subtype are, and also match
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
2000-10-04 15:56:32 +00:00
7ba4d2bed2 Make sure to add the space char after an encoded word when the encoding is
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
2000-09-28 23:57:54 +00:00
e71de4c021 New function to fold headers.
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
2000-09-28 11:31:29 +00:00
26f1d04d35 (append_latin1): Do an additional mask for account for c's
undefined behaviour for sign extension whilst shifting right.

svn path=/trunk/; revision=5129
2000-08-31 01:49:21 +00:00
dbe98bddd3 New function - even though its broken, we'll assume mailers send latin1
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
2000-08-31 01:46:44 +00:00
a1bf7aa6c4 Use g_free()' instead of free()' in the `header_decode_text()'
helper function.

svn path=/trunk/; revision=5061
2000-08-27 00:59:45 +00:00
81f994a359 More UTF-8 handling
svn path=/trunk/; revision=5032
2000-08-25 04:31:13 +00:00
0131da3b09 put commas between addresses.
* camel-mime-utils.c (header_address_list_format_append): put
	commas between addresses.

svn path=/trunk/; revision=4985
2000-08-23 19:58:51 +00:00