Commit Graph

603 Commits

Author SHA1 Message Date
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
189cb50426 Added at least some explanation of all this stuff.
2000-11-24  Not Zed  <NotZed@HelixCode.com>

	* tests/README: Added at least some explanation of all this stuff.

	* tests/lib/camel-test.h (check_msg): Added a non-gcc version of
	the fail command, we dont get the expression that failed, but no
	matter.  Should be (more) portable now.
	(check, check_msg): Put the file/lineno in the default message.

svn path=/trunk/; revision=6657
2000-11-24 03:54:55 +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
fb92b831ae add #ifdef HAVE_ALLOCA_H
* camel-lock.c:
	* camel-movemail.c: add #ifdef HAVE_ALLOCA_H

svn path=/trunk/; revision=6638
2000-11-21 22:04:40 +00:00
a34a4b15b8 Shite, -1 on error, >=0 on success. So i've just been truncating all the
2000-11-21  Not Zed  <NotZed@HelixCode.com>

	* providers/local/camel-mh-summary.c (mh_summary_sync_message):
	Shite, -1 on error, >=0 on success.  So i've just been truncating
	all the messages I touched, good one zed.
	(mh_summary_sync_message): Sigh, and write to the right damn fd as
	well.
	(mh_summary_sync_message): Argh, and we need to compare the length
	of the old xev -1 to the new xev, to check if we can optimise it.

	* camel-folder.c (camel_folder_change_info_new): Init the pool.
	(camel_folder_change_info_add_source): Allocate string in the
	pool.
	(camel_folder_change_info_add_source_list):
	(camel_folder_change_info_add_update): No longer free the key, as
	it cannot be yet.
	(change_info_add_uid): Add a new arg, copy, telling it whether to
	copy the uid argument or not, and copy using mempool_strdup.
	(change_info_cat): Tell add_uid to copy the string.
	(camel_folder_change_info_add_update): Call add_uid directly.
	(change_info_remove): Call add_uid directly, with no copy, and
	dont free the key.
	(change_info_free_update): No longer required since we dont malloc
	the keys.
	(camel_folder_change_info_add_uid): Fix for add_uid change.
	(camel_folder_change_info_remove_uid):
	(camel_folder_change_info_change_uid):
	(change_info_clear): No longer needed, just set the size to 0 on
	the array directly.
	(camel_folder_change_info_clear): Empty the arrays directly, and
	flush the mempool too, and also clear uid_source, incase anyone
	was silly enough to call us in the wrong order.
	(camel_folder_change_info_free): Dont bother clearing the array's
	contents, just free the pool and throw away all the indexes.

	* camel-folder.h: Added a mempool to CamelFolderChangeInfo to
	store the uid's we get.

	* camel-folder-search.c (search_match_all): If we are only
	matching a single info, just use that/do the search.
	(camel_folder_search_match_expression): New function.  Matches a
	single message info against an expression.
	(camel_folder_search_init): Init a hash table used to map the
	returned gptrarrays' to mempools.
	(camel_folder_search_execute_expression): Store all of the string
	data in a mempool, slightly faster, less wasted space (usually),.
	(camel_folder_search_free_result): Check for the mempool that
	stores the data for the list, and free that if we have it,
	otherwise assume we need to use g_free() (which should only happen
	if the list is empty at the moment).
	: commented out the debugging prints.  Got sick of 'executing
	header search' crap.

	* providers/vee/camel-vee-folder.c (camel_vee_folder_init): Init
	changes.
	(camel_vee_folder_finalise): Free changes.
	(vfolder_add_match): Simple helper to add a new matching info
	record.
	(camel_vee_folder_add_folder): Only trigger a changed event if we
	have changes.
	(vfolder_change_match): New function, changes our local vfolder
	info to match the source.
	(vfolder_add_match): Add a new info to the vfolder list.
	(vfolder_remove_match): Remove a no-longer matching info from the
	vfolder summary.
	(message_changed): check if the message still matches, and
	remove/etc as required.
	(camel_vee_folder_finalise, init): init/free search object.
	(vee_folder_build_folder): Build the changes to the folder into
	the changes data, as we go.
	(folder_changed): If the folder gave us an explicit list of
	changes, then process each one separately (unless there's a lot
	added/changed).

	* providers/vee/camel-vee-folder.h: Added a changes field to the
	folder.

svn path=/trunk/; revision=6628
2000-11-21 13:38:53 +00:00
7ea24b0cb1 Added camel-folder-thread.[ch].
2000-11-21  Not Zed  <NotZed@HelixCode.com>

        * Makefile.am (libcamel_la_SOURCES): Added
        camel-folder-thread.[ch].

        * camel-folder-thread.c: message-threading algorithm, taken from
        evolutions' mail component, as it is generally more useful than
        just for evolution itself.  Changed to use e-memchunks as well to
        speed it up a little and use less mem.

svn path=/trunk/; revision=6623
2000-11-21 03:51:33 +00:00
0f442b0884 fix changelog merge conflicts
svn path=/trunk/; revision=6622
2000-11-21 02:21:40 +00:00
2cf986c43b Fixed to return the correct bytecount in all cases which is the real fix
2000-11-20  Jeffrey Stedfast  <fejj@helixcode.com>

	* camel-remote-store.c (remote_recv_line): Fixed to return the
	correct bytecount in all cases which is the real fix to
	imap_parse_nstring.

	* providers/imap/camel-imap-command.c (imap_read_untagged): Again,
	don't use strlen for the post-data, use 'n'.

	* providers/imap/camel-imap-utils.c (imap_parse_nstring): Undo my
	previous temp-fix.

svn path=/trunk/; revision=6621
2000-11-21 02:21:03 +00:00
854f94bc20 Fixes for the summary messageid changes. Hash the messageid and store it.
2000-11-20  Not Zed  <NotZed@HelixCode.com>

	* providers/nntp/camel-nntp-utils.c (get_XOVER_headers): Fixes for
	the summary messageid changes.  Hash the messageid and store it.
	(get_XOVER_headers): Use camel_folder_summary_info_new() to create
	the summary item before adding it.

	* camel-folder-summary.h (CamelMessageInfo): Changed the
	messgae-id to be an 8 byte md5 hash, and the references list to be
	an array of these.

	* providers/local/camel-mh-summary.c (mh_summary_sync_message):
	New function, sync out the message info stuff.  Only updates the
	X-Ev header if it can get away with it, otherwise writes out a
	whole new message.
	(mh_summary_sync): Added more functionality.  All summary info is
	now written to the X-Ev header, etc, and new messages re-written
	if required during the sync process.

	* providers/local/camel-local-folder.c
	(local_set_message_user_flag): Set the XEVCHANGE flag.
	(local_set_message_user_tag): And here too.

	* providers/local/camel-local-summary.h: New flag
	CAMEL_MESSAGE_FOLDER_XEVCHANGE to indicate the XEV header has
	probably changed size and needs to be rewritten in whole.

	* camel-folder-summary.c (next_uid_string): Want this static, not
	const.
	(message_info_new): Store the references and message-id values as
	64 bit, binary hashes.
	(message_info_load): fix for message-id/references changes.
	(message_info_save): Likewise.
	(camel_message_info_dup_to): And here.
	(camel_message_info_free): And here too.  No longer free
	message_id, and simple free for references array.
	(CAMEL_FOLDER_SUMMARY_VERSION): Bumped file revision.
	(camel_folder_summary_init): Init memchunk allocators to empty.
	(camel_folder_summary_finalize): Free memchunk allocators if
	there.
	(message_info_new): Use the chunk allocator to allocate message
	info's.
	(camel_folder_summary_info_new): New helper to allocate the
	message info, and setup the memchunk if required.
	(content_info_alloc): Likewise for content info's.
	(message_info_load): Use summary_info_new_empty.
	(content_info_new): Use content_info_alloc.
	(content_info_load): "
	(content_info_free): Free the content info as a memchunk.
	(message_info_free): Free everything directly and the base as a
	memchunk, rather than calling camel_message_info_free(), which
	assumes a malloc'd array.

	* providers/local/camel-local-summary.c: Include ctype.h, kill a
	warning.
	(local_summary_decode_x_evolution): If we get a NULL message info,
	then dont try and set anything, just check for validity.
	(camel_local_summary_write_headers): New function to write a set
	of headers to an fd.
	(camel_local_summary_check): Added some statistic generation
	stuff for memory profiling.

	* providers/local/camel-mbox-summary.c (header_write): Changed to
	use stdoi functions to write out the header to a buffered stream,
	instead of using writev, which is apparently slow (and writing
	each line separately is slow anyway).
	(mbox_summary_sync_full): New implementation.  Does things
	differently, doesn't use or require the content info stuff.
	(summary_rebuild): Dont return an error if we start scanning at
	the end of file.
	(mbox_summary_sync_full): If we are not writing out new headers,
	make sure we copy the From line as we go, and update frompos
	appropriately.
	(mbox_summary_sync_full): Always copy the From line from the
	existing one, rather than trying to make one up ourselves.
	(mbox_summary_sync): If we can get by with a quick-sync, then try
	it, if that fails, then try a full sync anyway.
	(mbox_summary_sync_quick): Quick sync.  Only update system flags,
	etc.
	(mbox_summary_sync_full): Use the proper local summary encode_xev
	function.
	(header_evolution_decode): Removed, no longer needed.
	(header_evolution_encode): Same.
	(copy_block): No longer needed, removed.
	(header_write): Removed, replaced with
	camel_local_summary_write_headers.
	(mbox_summary_sync_full): Fixed for header_write change.

	* camel-mime-parser.c (folder_scan_step): Implement the new
	optional parser state HSCAN_PRE_FROM, that returns the (currently
	unfiltered) input data.
	(folder_scan_drop_step): Do the right thing for the PRE_FROM
	state.
	(camel_mime_parser_scan_from): Update the doco.
	(camel_mime_parser_scan_pre_from): Ok, make this behaviour
	optional, it simplifies a lot of loops that dont otherwise need to
	know about it.
	(folder_scan_step): Made the PRE_FROM state optional.
	(struct _header_scan_state): Made the bool vars 1 bit.
	(folder_pull_part): Free the from_line buffer if it is there.
	(folder_scan_skip_line): Added a new arg, can save the skpped data
	to a byte_array, as we go.
	(folder_scan_step): Fixed calls to skip_line approrpiately.  Now
	we save the from line as we parse it.
	(camel_mime_parser_read): New function to read from the mime
	parser buffer directly.  Useful if you use the parser to read the
	first/some headers, then need to scan the rest of the data,
	without needing to use a seek(), or allocate your own buffers.

	* camel-mime-parser.h (struct _header_state): Added a new parser state,
	pre-from which returns any data found before a from line during
	parsing (all other data can be retrieved by the caller except
	this).

svn path=/trunk/; revision=6618
2000-11-20 23:54:48 +00:00
aaaa3be69c When extracting a literal string, capture up until the end of the last
2000-11-17  Jeffrey Stedfast  <fejj@helixcode.com>

	* providers/imap/camel-imap-utils.c (imap_parse_nstring): When
	extracting a literal string, capture up until the end of the last
	line - this we we don't lose any data if the byte count is off.

	* providers/imap/camel-imap-command.c (imap_read_untagged): Use
	the byte-read count to decrement the number of bytes left to read
	rather than using strlen. Not only does this protect against a DoS
	(embedded NUL chars in the literal string would make strlen
	inaccurate) but it also improves performace a little.

	* camel-remote-store.c (remote_recv_line): *Sigh* Return the
	number of bytes read on success rather than 0. Also don't use
	camel_stream_buffer_read_line since we can't get an accurate octet
	count.

svn path=/trunk/; revision=6600
2000-11-17 08:11:29 +00:00
e14164702f Use the byte-read count to decrement the number of bytes left to read
2000-11-17  Jeffrey Stedfast  <fejj@helixcode.com>

	* providers/imap/camel-imap-command.c (imap_read_untagged): Use
	the byte-read count to decrement the number of bytes left to read
	rather than using strlen. Not only does this protect against a DoS
	(embedded NUL chars in the literal string would make strlen
	inaccurate) but it also improves performace a little.

	* camel-remote-store.c (remote_recv_line): *Sigh* Return the
	number of bytes read on success rather than 0. Also don't use
	camel_stream_buffer_read_line since we can't get an accurate octet
	count.

svn path=/trunk/; revision=6599
2000-11-17 07:18:56 +00:00
a1ccc43fbe We should always terminate the string. No need to check outptr is in
2000-11-17  Not Zed  <NotZed@HelixCode.com>

        * camel-stream-buffer.c (camel_stream_buffer_gets): We should
        always terminate the string.  No need to check outptr is in range,
        its already been checked.

        * providers/local/camel-mbox-summary.c (mbox_summary_sync): When
        we update the summary, do it from mbox_summary->folder_size, not
        the content info endpos (which isn't any good anymore anyway).

        * providers/local/camel-mbox-folder.c (mbox_append_message): Set
        the frompos from the current folder size, since summary_add wont
        have initialised it to anything useful.

svn path=/trunk/; revision=6597
2000-11-17 06:04:23 +00:00
d424adcf63 Check the uid string is all digits before trying to write a 'standard'
2000-11-16  Not Zed  <NotZed@HelixCode.com>

        * providers/local/camel-local-summary.c
        (local_summary_encode_x_evolution): Check the uid string is all
        digits before trying to write a 'standard' x-ev header.

        * providers/local/camel-maildir-summary.c
        (camel_maildir_summary_info_to_name): Convert an info into a
        maildir name:info filename.
        (camel_maildir_summary_name_to_info): Convert a name:info filename
        into an info, and tell us if it didn't match it.
        (message_info_new): When creating a new filename, gets its info
        from the flags field.  Likewise if creating from an existing file,
        extract the flags.
        (maildir_summary_sync): Remove a small memleak.  Also, if our
        flags and that requires a filename change, perform that here.
        (message_info_new): Get the received date from the filename.
        Also, dont overwirte the uid if we have one.
        (maildir_summary_check): Sort the summary in received order before
        completion.
        (maildir_summary_next_uid_string): Test the name for collusions
        before we give it out.  Retry, and if that fails, well, I guess we
        collide :(

        * providers/local/camel-mbox-folder.c (mbox_lock): Implement mbox
        locking.
        (mbox_unlock): And unlocking.
        (mbox_append_message): Lock the folder for write before doing
        anything.
        (mbox_get_message): Lock the folder for read before doing
        anything.

        * providers/local/camel-local-folder.c (camel_local_folder_lock):
        Implement something here.  We handle the recursive ability but
        pass the locking to the folder itself.
        (camel_local_folder_unlock): Likewise for unlocking.
        (local_lock): Default - do nothing, return success.
        (local_unlock): Same.
        (local_sync): Changed slightly for locking api changes, and also,
        only lock around the sync process itself.

        * camel-lock.c: New file - utility functions for locking using
        different strategies and/or for locking folders safely.

        * Makefile.am (libcamel_la_SOURCES): Adde camel-lock.[ch]

svn path=/trunk/; revision=6592
2000-11-16 13:27:21 +00:00
d39149c579 New file - utility functions for locking using different strategies and/or
2000-11-16  Not Zed  <NotZed@HelixCode.com>

        * camel-lock.c: New file - utility functions for locking using
        different strategies and/or for locking folders safely.

        * Makefile.am (libcamel_la_SOURCES): Adde camel-lock.[ch]

svn path=/trunk/; revision=6590
2000-11-16 08:36:39 +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
d266df61cc Don't cast an int to a ssize_t.
2000-11-14  Jeffrey Stedfast  <fejj@helixcode.com>

	* camel-stream.c (camel_stream_printf): Don't cast an int to a
	ssize_t.

svn path=/trunk/; revision=6574
2000-11-14 21:29:21 +00:00
977338752b put a space before a single-digit day of the month since it seems some
* providers/mbox/camel-mbox-summary.c
	(camel_mbox_summary_build_from): put a space before a single-digit
	day of the month since it seems some mailers are fantastically
	picky about this. (bugs.gnome.org #27232)

svn path=/trunk/; revision=6538
2000-11-10 21:32:24 +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
9a3020083a Fix error handling. (Only send a "*" to bail out of authentication if the
* providers/imap/camel-imap-auth.c (imap_try_kerberos_v4_auth):
	Fix error handling. (Only send a "*" to bail out of authentication
	if the server hasn't already bailed on us.)

svn path=/trunk/; revision=6520
2000-11-09 18:52:06 +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
2b97bd935b Keep track of the caller bestenc flags that make sense.
2000-11-08  Not Zed  <NotZed@HelixCode.com>

	* camel-mime-message.c (find_best_encoding): Keep track of the
	caller bestenc flags that make sense.

	* camel-mime-filter-bestenc.c (filter): Added code to detect when
	we have "^From " lines in the sequence of text.
	(camel_mime_filter_bestenc_get_best_encoding): Added a new flag
	CAMEL_BESTENC_NO_FROM: if set, it will not allow any lines
	matching "^From " to appear in the output - currently forcing
	base64 encoding to achieve this.

	* camel-mime-parser.c (folder_scan_step): Call
	camel_mime-filter_complete() once we're done, rather than
	filter_filter().
	(folder_scan_content): Some fixes for state changing; so that when
	we do find another boundary it is properly flagged.  Since we
	strip the last \n off all data, we must take that into account
	too.  Sigh.  Fixes a rather nasty set of bugs where multipart
	messages could start including following messages as parts, etc.
	(struct _header_scan_stack): Added new parameter,
	boundarylenfinal, which holds the length of the final boundary, if
	it is different (e.g. for From lines, whihc aren't)
	(folder_scan_step): Setup teh boundarylenfinal value when creating
	a new boundary.
	(folder_scan_content): Hmm, if we hit the end-of-buffer sentinal,
	reset the scanner back to leave 'atleast' chars in the buffer
	still, dump that content, and retry again.  Stops us losing a
	check for a boundary on some data we haven't really looked at yet!
	(folder_scan_content): Use boundarylenfinal to calculate
	'atleast'.
	(folder_scan_header): And here too.
	(folder_boundary_check): Use the atleast value directly, dont
	truncate it.  Use the boundarylen/boundarylenfinal values directly
	too.
	(struct _header_scan_stack): Add an atleast parameter to cache the
	atleast info.
	(folder_push_part): Determine/set 'atleast', every time we add a
	new part.
	(folder_scan_header): Get the cached atleast info from the current
	part.
	(folder_scan_content): And here too.
	(folder_scan_header): Fix a problem where a part starting with
	" text" would be interpreted as a followon header wrongly.

	* camel-mime-filter-charset.c (complete): Add some assertions to
	find a bug.

svn path=/trunk/; revision=6500
2000-11-08 09:13:52 +00:00
be043c8ce6 Fix the default implementation for CamelService::get_name() so that it
returns a malloced string instead of a static one.  (A static one
breaks the semantics of the method.)

svn path=/trunk/; revision=6483
2000-11-07 18:37:30 +00:00
3045084721 Kill debugging, as it causes lots of evolution-mail spewage.
* camel-stream-filter.c (d): Kill debugging, as it causes lots of
	evolution-mail spewage.

svn path=/trunk/; revision=6482
2000-11-07 18:29:45 +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
66b85f364e Two segfault fixes
svn path=/trunk/; revision=6472
2000-11-07 01:19:27 +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
e47b962e0d Undo my incorrect fix - I misunderstood danw - sorry!
2000-11-03  Jeffrey Stedfast  <fejj@helixcode.com>

	* camel-url.c: Undo my incorrect fix - I misunderstood danw -
	sorry!

svn path=/trunk/; revision=6386
2000-11-03 23:07:47 +00:00
065fe4ad08 Unbreak this.
* providers/pop3/camel-pop3-store.c (camel_pop3_store_expunge):
	Unbreak this.

svn path=/trunk/; revision=6381
2000-11-03 22:33:23 +00:00
4e0d5fd52a If show_pass, then base64 the password before writing it to the output
2000-11-03  Jeffrey Stedfast  <fejj@helixcode.com>

	* camel-url.c (camel_url_to_string): If show_pass, then base64 the
	password before writing it to the output string.
	(camel_url_new): Assume password has been base64 encoded and
	decode accordingly.

svn path=/trunk/; revision=6374
2000-11-03 20:55:02 +00:00
5a4fa8505d Add an "url_flags" field to CamelProvider. Move the CAMEL_SERVICE_URL_*
* camel-provider.h: Add an "url_flags" field to CamelProvider.
	Move the CAMEL_SERVICE_URL_* defines here and remove the SERVICE_
	part of the name.

	* camel-service.h: Remove CAMEL_SERVICE_URL_* flags and
	service->url_flags field.

	* camel-service.c (check_url, get_path): Get URL flags from
	service->provider, update for changed flag names.

	* providers/*/camel-*-provider.c: Add URL flags to provider
	structures.

	* providers/*/camel-*-{store,transport}.c, camel-remote-store.c:
	Remove service->url_flags initialization.

svn path=/trunk/; revision=6370
2000-11-03 18:22:34 +00:00
91eae33bdc Quote foldernames when sending to the IMAP server because the folder name
2000-11-02  Jeffrey Stedfast  <fejj@helixcode.com>

	* providers/imap/camel-imap-store.c (get_folder_info): Quote
	foldernames when sending to the IMAP server because the folder
	name might contain spaces.

svn path=/trunk/; revision=6344
2000-11-02 05:00:28 +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
24e7b7d5fc Remove old subbed folders from hash table after freeing them.
* providers/imap/camel-imap-store.c (get_folder_info): Remove old
        subbed folders from hash table after freeing them.

svn path=/trunk/; revision=6335
2000-11-02 02:52:21 +00:00
1e41fefdba Deal correctly with namespace == ""
* providers/imap/camel-imap-folder.c (imap_get_full_name): Deal
	correctly with namespace == ""

svn path=/trunk/; revision=6322
2000-11-01 21:34:06 +00:00
a4985006cd calendar: made all gui show localized
camel: updated charset info from newest libunicode
po: updated Lithuanian translation

svn path=/trunk/; revision=6308
2000-11-01 04:11:29 +00:00
517db3b21f Add a new argument, clean, that says whether or not to try to disconnect
* camel-service.c (service_disconnect): Add a new argument, clean,
	that says whether or not to try to disconnect cleanly.

	* camel-remote-store.c (remote_send_string, remote_send_stream,
	remote_recv_line): disconnect uncleanly on failure to prevent
	infinite loops when providers would normally send commands from
	disconnect(). Remove some unneeded CamelException goo.

	* providers/smtp/camel-smtp-transport.c (smtp_disconnect):
	* providers/pop3/camel-pop3-store.c (pop3_disconnect):
	* providers/nntp/camel-nntp-store.c (nntp_store_disconnect):
	* providers/imap/camel-imap-store.c (imap_disconnect): Don't send
	QUIT/LOGOUT if !clean.

svn path=/trunk/; revision=6303
2000-10-31 23:44:46 +00:00
dd50048ab4 New file with code for IMAP authentication mechanisms. (Currently just
* providers/imap/camel-imap-auth.c: New file with code for IMAP
	authentication mechanisms. (Currently just krb4, and without
	integrity/privacy protection).

	* providers/imap/Makefile.am: Add camel-imap-auth.[ch] and krb4
	CFLAGS/LDFLAGS

	* providers/imap/camel-imap-store.c (connect_to_server): Split out
	from imap_connect. Just does the basic connect and CAPABILITY
	check. Redo the CAPABILITY code more robustly.
	(query_auth_types_connected): Do this right rather than punting to
	query_auth_types_generic. Check for KERBEROS_V4 if compiled with
	krb4 support.
	(query_auth_types_generic): Mention KERBEROS_V4 if compiled with
	krb4 support.
	(imap_connect): Use connect_to_server().

svn path=/trunk/; revision=6272
2000-10-30 17:00:06 +00:00
d4656431e9 Improved IMAP namespace handling: leave the namespace in the
folder names rather than constantly prepending it and stripping it
	off. Also some subscription fixes.

	* camel-store.c (camel_folder_info_build): Fix for the case where
	@top isn't in @folders.

	* providers/imap/camel-imap-folder.c (camel_imap_folder_new): Add
	a "short_name" argument rather than figuring it out ourselves.
	(imap_get_full_name): Implementation of CamelFolder::get_full_name
	that strips off namespace so the user doesn't have to see it.
	(imap_append_message, imap_copy_message_to, imap_move_message_to):
	Use folder->full_name rather than calling
	camel_imap_store_get_folder_path.

	* providers/imap/camel-imap-utils.c (imap_parse_list_response):
	Update this: make @flags a bitmask and @sep a char rather than a
	string. Make all of the out arguments optional. Handle literals in
	the server response.

	* providers/imap/camel-imap-store.c (imap_connect): Do a better
	job of getting the correct dir_sep for the namespace we're using.
	Construct a base_url here that will be used by get_folder_info.
	(camel_imap_store_folder_path): Removed
	(imap_folder_exists): Add an argument to return the short name of
	the folder (parsed out of the LIST response). Update for
	imap_parse_list_response change.
	(get_folder): Update for the various other changes.
	(get_folder_info): Update for the various other changes. Be more
	consistent about the returned layout: put everything underneath
	the "namespace" directory, including INBOX, even if it doesn't
	belong there. Don't destroy the list of subscribed folders until
	we've actually gotten the new list.
	(folder_subscribed, subscribe_folder, unsubscribe_folder): Use
	folder_name directly rather than camel_imap_store_folder_Path.

	* providers/imap/camel-imap-command.c (camel_imap_command): Update
	for folder name changes.

svn path=/trunk/; revision=6256
2000-10-30 03:24:15 +00:00
65f9e9cd94 Remove md5-utils.h include since it's not part of Camel any more.
* camel.h: Remove md5-utils.h include since it's not part of Camel
	any more.

	* camel-charset-map.c: Kill some warnings.

	* providers/nntp/camel-nntp-grouplist.c
	(camel_nntp_get_grouplist_from_file, camel_nntp_grouplist_save):
	Clean up warnings about time_t casts.

	* providers/smtp/camel-smtp-transport.c: Remove unused md5-utils.h
	include.

	* providers/pop3/camel-pop3-store.c: Undefine the "_" macro
	defined by krb4's des.h when compiling with krb support.
	Fix md5-utils.h include.

svn path=/trunk/; revision=6253
2000-10-29 20:06:29 +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
7
4edb2c4651 build md5-utils
2000-10-27    <jpr@helixcode.com>

	* Makefile.am: build md5-utils

	* md5-utils.c: Make part of util, get rid of camel stream util
	function include string.h

	* md5-utils.h: ditto

2000-10-27    <jpr@helixcode.com>

	* providers/pop3/Makefile.am: Tidy up build

	* providers/smtp/Makefile.am: ditto

	* Makefile.am:  Move md5-utils.[hc] to e-util because the
	addressbook is going to use md5 hashes for pilot syncing.
	Maybe the calendar conduits as well because this is a good idea
	Chris had.

svn path=/trunk/; revision=6234
2000-10-27 18:28:20 +00:00
34639f458f Add newline to kill warnings.
2000-10-26  Kjartan Maraas  <kmaraas@gnome.org>

	* camel-exceptions-list.def: Add newline to kill warnings.

svn path=/trunk/; revision=6183
2000-10-25 22:38:15 +00:00
76d0cad905 Fix folder listing code infinite loop.
* providers/imap/camel-imap-store.c (get_folder_info): Fix folder
	listing code infinite loop.

svn path=/trunk/; revision=6178
2000-10-25 21:36:09 +00:00
82185d7faa Add a "parent" field to CamelFolderInfo.
* camel-store.h: Add a "parent" field to CamelFolderInfo.

	* camel-store.c (camel_folder_info_build): Deal with "parent"
	(camel_store_folder_subscribed, camel_store_subscribe_folder,
	camel_store_unsubscribe_folder): Add g_return_if_fails checking
	that the folder supports subscriptions.

	* providers/imap/camel-imap-store.c (folder_subscribed,
	subscribe_folder, unsubscribe_folder): Remove "+ 1"s since the
	mail subscribe UI won't prepend / to the folder names now.
	(get_folder_info): Clear the "parent" field of the folderinfos
	when removing an empty top level.

	* providers/nntp/camel-nntp-store.c (nntp_store_folder_subscribed,
	nntp_store_subscribe_folder, nntp_store_unsubscribe_folder):
	Remove "+ 1"s since the mail subscribe UI won't prepend / to the
	folder names now.

svn path=/trunk/; revision=6167
2000-10-25 15:27:17 +00:00
b227836e30 add subscribed_folders.
2000-10-24  Chris Toshok  <toshok@helixcode.com>

	* providers/imap/camel-imap-store.h: add subscribed_folders.

	* providers/imap/camel-imap-store.c (camel_imap_store_class_init):
	fill in vtable entries for subscription functions.
	(camel_imap_store_finalize): new function, so we can free up our
	subscribed_folders hashtable.
	(camel_imap_store_init): set CAMEL_STORE_SUBSCRIPTIONS in the
	CamelStore flags, and create our subscribed_folders hashtable.
	(camel_imap_store_get_type): camel_imap_store_finalize is our
	finalize function.
	(get_folder_info): if we're looking at subscribed_only, clear out
	the subscribed_folders hashtable, use LSUB instead of LIST, and
	insert folder paths (prepended by their namespace if there is one)
	into subscribed_folders.  INBOX subscription support needs work,
	since we always show it, regardless of it's subscribed state.
	(folder_subscribed): new function.  just look up the folder_path
	in the hashtable.
	(subscribe_folder): new function.  use the imap SUBSCRIBE command,
	and if successful add it to the hashtable.
	(unsubscribe_folder): new function.  use the imap UNSUBSCRIBE
	command, and if successful remove it from the hashtable.

svn path=/trunk/; revision=6157
2000-10-25 02:13:17 +00:00