Commit Graph

157 Commits

Author SHA1 Message Date
016826bc8a Use the new header_address_fold.
2001-06-27  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-internet-address.c
	(camel_internet_address_encode_address): Use the new
	header_address_fold.

	* camel-mime-utils.c: Removed some old #if 0'd code of mine.
	(rfc2047_encode_word): If enclen is 0, don't write an encoded word
	token (=?iso-8859-7?Q??= would be an invalid token).
	(header_address_fold): New function to wrap address headers -
	header_fold() was force-wrapping rfc2047 encoded words which was
	making the test suite fail. The *real* solution, however, is to
	not create rfc2047 encoded words longer than 72 chars.

svn path=/trunk/; revision=10545
2001-06-27 22:14:20 +00:00
91cc026904 Update the copyrights, replacing Helix Code with Ximian and
helixcode.com with ximian.com all over the place.

svn path=/trunk/; revision=10440
2001-06-23 08:52:02 +00:00
34bc515362 New function that decides if 2 word types are mergeable. An atom and a
2001-06-21  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-mime-utils.c (word_types_compatable): New function that
	decides if 2 word types are mergeable. An atom and a qstring are
	mergeable; 2 qstrings are mergeable; and 2 encoded words are
	mergeable.
	(header_encode_phrase_merge_words): If 2 words are merged, the new
	word type is the MAX of the combined types. This means that if we
	merge a qstring and an atom, the resulting word type is a
	qstring.

	* camel-internet-address.c (internet_format):
	s/g_string_sprintfa/g_string_append since this makes more sense in
	this particular case.
	(internet_encode): Same here.

svn path=/trunk/; revision=10377
2001-06-21 19:53:47 +00:00
fcc4195845 If the first char of the mailing-list name is '<', chop it off to make
2001-06-20  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-mime-utils.c (header_raw_check_mailing_list): If the first
	char of the mailing-list name is '<', chop it off to make Ettore
	happy. Fixes bug #2153.

svn path=/trunk/; revision=10347
2001-06-20 19:46:58 +00:00
9a52bdf0d1 Added Mailing-List header regex so that we can do mlist magic on that
2001-06-14  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-mime-utils.c: Added Mailing-List header regex so that we
	can do mlist magic on that header.

svn path=/trunk/; revision=10242
2001-06-14 22:32:35 +00:00
e86a28e484 Numerous fixes to get it to compile.
2001-05-31  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-smime-context.c: Numerous fixes to get it to compile.

svn path=/trunk/; revision=10073
2001-05-31 22:30:06 +00:00
e085e7e666 Use g_strcasecmp() because some systems don't have strcasecmp(). Also,
2001-05-28  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-mime-utils.c (header_set_param): Use g_strcasecmp()
	because some systems don't have strcasecmp(). Also, when removing
	a param, make sure to free the param->name too.

svn path=/trunk/; revision=10030
2001-05-28 18:47:24 +00:00
618ce2988e Fix an fd leak
* tests/lib/messages.c (test_message_read_file): Fix an fd leak

	* tests/lib/session.c, tests/lib/session.h: a CamelSession
	subclass for the test programs.

	* tests/lib/Makefile.am: include session.[ch]

	* tests/folder/test*.c: Use a CamelTestSession from libcameltest
	instead of cut+pasting everywhere.

	* tests/misc/url.c (main): Update for a camel_url_new change at
	some point.

	* tests/*/.cvsignore: Add stuff.

	* camel-mime-utils.c (rfc2047_encode_word): Fix a silly ==/!=
	mixup.

svn path=/trunk/; revision=10023
2001-05-27 19:52:07 +00:00
05817ac122 Replicate the semantics of the libunicode utf8 functions by returning NULL
2001-05-14  Jon Trowbridge  <trow@ximian.com>

        * camel-search-private.c (utf8_get): Replicate the semantics of
        the libunicode utf8 functions by returning NULL in the arg
        on invalid utf8.

        * camel-pgp-context.c (pgp_verify): Check for valid utf8,
        terminate loop if something looks wrong.

        * camel-mime-utils.c (header_encode_phrase_get_words): Properly
        check for invalid utf8.
        (header_encode_string): Properly check for invalid utf8.

        * camel-charset-map.c (camel_charset_step): Properly check for
        invalid utf8.

2001-05-14  Jon Trowbridge  <trow@ximian.com>

        * e-html-utils.c (is_citation): Check for bad utf8.

svn path=/trunk/; revision=9798
2001-05-14 21:04:35 +00:00
ba099582f3 Decode Content-Location, either correctly or Netscape-generated-brokenly.
* camel-mime-utils.c (header_location_decode): Decode
	Content-Location, either correctly or Netscape-generated-brokenly.

	* camel-mime-part.c (camel_mime_part_set_content_location,
	camel_mime_part_get_content_location, etc): Deal with
	Content-Location header.

svn path=/trunk/; revision=9772
2001-05-11 20:57:26 +00:00
18af050c05 Remove UNICODE_CFLAGS (and some other stuff that's redundant with
* Makefile.am (INCLUDES): Remove UNICODE_CFLAGS (and some other
	stuff that's redundant with EXTRA_GNOME_CFLAGS)
	(libcamel_la_LIBADD): Replace UNICODE_LIBS with GAL_LIBS.

	* camel-search-private.c:
	* camel-pgp-context.c:
	* camel-mime-utils.c: Use gunicode interfaces rather than
	libunicode.

	* camel-charset-map.c: Use gunicode rather than libunicode. (The
	charmap-regen code still depends on libunicode though.)

	* camel-mime-filter-charset.h:
	* tests/message/test2.c (convert): Use iconv rather than
	unicode_iconv.

	* providers/smtp/Makefile.am (libcamelsmtp_la_LIBADD):
	* providers/pop3/Makefile.am (libcamelpop3_la_LIBADD):
	* providers/local/Makefile.am (libcamellocal_la_LIBADD): Remove
	UNICODE_LIBS.

	* camel.c (camel_init): Remove call to unicode_init.

	* camel-mime-parser.c: Remove unused unicode.h include.

svn path=/trunk/; revision=9585
2001-04-26 18:21:32 +00:00
cd05d11ca0 oops, &pattern
svn path=/trunk/; revision=9334
2001-04-15 21:54:12 +00:00
adc000f756 regex doesn't set errno and regcomp returns 0 on success and any other
2001-04-15  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-mime-utils.c (header_raw_check_mailing_list): regex
	doesn't set errno and regcomp returns 0 on success and any other
	value for an error (so don't *just* check for -1).

svn path=/trunk/; revision=9333
2001-04-15 21:39:37 +00:00
2723c5fba6 Added tests/ back in
2001-04-03  Jeffrey Stedfast  <fejj@ximian.com>

	* Makefile.am: Added tests/ back in

	* camel-mime-utils.c (header_decode_text): Ignore whitespace
	between encoded words (there were a few cases where it didn't
	before).
	(header_encode_string): Preserve whitespace between words that are
	to be encoded by encoding them too.
	(header_encode_phrase): Same here but with phrases.

svn path=/trunk/; revision=9158
2001-04-04 02:00:25 +00:00
fe962a2055 Big header cleanups and nntp compile fix
svn path=/trunk/; revision=9024
2001-03-29 20:31:40 +00:00
4b93e802d9 When writing the last token (if not rfc2047 encoded), don't use
2001-03-26  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-mime-utils.c (header_decode_text): When writing the last
	token (if not rfc2047 encoded), don't use g_string_append_len, use
	append_latin1.

svn path=/trunk/; revision=8954
2001-03-26 20:11:27 +00:00
5e96f5b639 Quote the param value if it contains whitespace as well.
2001-03-18  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-mime-utils.c (header_param_list_format_append): Quote the
	param value if it contains whitespace as well.

svn path=/trunk/; revision=8804
2001-03-19 00:22:29 +00:00
2eda2f02ef Don't use getdomainname: it's NIS crap, not DNS.
* camel-mime-utils.c (header_msgid_generate): Don't use
	getdomainname: it's NIS crap, not DNS.

svn path=/trunk/; revision=8761
2001-03-16 17:17:30 +00:00
83b4aa2b1d Check for a new type of mailing list header.
2001-03-14  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-mime-utils.c: Check for a new type of mailing list header.

svn path=/trunk/; revision=8702
2001-03-14 06:16:28 +00:00
b3bb38e036 Fix a bug that could make this walk off the end of a string. (The bug has
* camel-mime-utils.c (header_fold): Fix a bug that could make this
	walk off the end of a string. (The bug has been there since
	December... maybe this will fix some unreproduceable crashes?)

svn path=/trunk/; revision=8619
2001-03-09 20:36:12 +00:00
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