Commit Graph

54 Commits

Author SHA1 Message Date
5ea1f1d1cf Partial fix for bug #44457.
2003-06-11  Jeffrey Stedfast  <fejj@ximian.com>

	Partial fix for bug #44457.

	* camel-mime-part-utils.c
	(simple_data_wrapper_construct_from_parser): Make sure to set
	rawtext to FALSE if we successfully convert the text to UTF-8.

	* camel-data-wrapper.c (camel_data_wrapper_init): Default the
	value of rawtext to TRUE instead of FALSE. This way if the mailer
	decides to try displaying a non-textual part as text, it knows
	that it needs to convert the content to UTF-8.

svn path=/trunk/; revision=21420
2003-06-12 04:48:05 +00:00
d2e6a28e22 Initialize our private mutex. (camel_data_wrapper_finalize): Destroy our
2001-11-02  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-data-wrapper.c (camel_data_wrapper_init): Initialize our
	private mutex.
	(camel_data_wrapper_finalize): Destroy our private mutex.
	(write_to_stream): Lock around camel_stream_write_to_stream() so
	that we don't get 2 threads trying to read from our stream at the
	same time.

svn path=/trunk/; revision=14573
2001-11-02 23:53:36 +00:00
08fb7329cb Fixing the license text.
svn path=/trunk/; revision=14212
2001-10-27 16:59:46 +00:00
02dcd0aadf Update the licensing information to require version 2 of the GPL
(instead of version 2 or any later version).

svn path=/trunk/; revision=14190
2001-10-27 00:25:49 +00:00
b4c31f5153 Virtualize this.
* camel-data-wrapper.c (camel_data_wrapper_is_offline): Virtualize
	this.

	* camel-medium.c (is_offline): A medium is offline if its content
	object is offline.

	* camel-multipart.c (is_offline): A multipart is offline if any of
	its subparts are offline.

svn path=/trunk/; revision=12948
2001-09-18 20:03:10 +00:00
6fbbb872fe re-read the iconv man page, and treat the return value properly. It
2001-08-27  Not Zed  <NotZed@Ximian.com>

        * camel-mime-part-utils.c (convert_buffer): re-read the iconv man
        page, and treat the return value properly.  It returns the number
        of non-reversible conversions performed, not the number of output
        characters, sigh.
        (check_html_charset): Changed to just take a buffer of data, and
        not the mime parser.
        (simple_data_wrapper_construct_from_parser): Since we dont need
        the charset till we have all the data, search for the charset
        after we've read the data, if we have html data with no charset in
        the header.
        (simple_data_wrapper_construct_from_parser): Remove the
        seekable_source stuff.

        * Re-apply patches from before.

svn path=/trunk/; revision=12481
2001-08-27 06:33:41 +00:00
7a67b5c2ff Revert Not Zed's previous commits as they apparently can cause serious
2001-08-24  Peter Williams  <peterw@ximian.com>

	* Revert Not Zed's previous commits as they apparently can
	cause serious data loss for POP3 users.

svn path=/trunk/; revision=12461
2001-08-24 22:38:22 +00:00
d7597f0757 Likewise.
2001-08-24  Not Zed  <NotZed@Ximian.com>

        * providers/local/camel-spool-summary.c (summary_rebuild): Likewise.

        * providers/local/camel-mbox-summary.c (summary_rebuild):
        Summarising is spelt with an s.

2001-08-23  Not Zed  <NotZed@Ximian.com>

        * camel-mime-part.c (write_to_stream): If we have rawtext, then
        dont do any charset conversion, only encoding/crlf conversion.

        * camel-data-wrapper.h (struct _CamelDataWrapper): Added 'rawtext'
        member, says the character encoding is raw, not utf8.

        * providers/local/camel-spool-summary.c
        (spool_summary_sync_quick): Synchronising is spelt with an s, not a z.
        (spool_summary_sync_full): "

        * providers/local/camel-mbox-summary.c (mbox_summary_sync_full):
        No, synchronising is spelt with an s.
        (mbox_summary_sync_quick): "

        * camel-mime-part-utils.c
        (camel_mime_part_construct_content_from_parser): Remove the
        warnings which aren't going anywhere fast.
        (convert_buffer): Function to convert a bytearray of textual
        content from one charset to another.  If the charset doesn't exist
        or fails, then do no conversion.
        (simple_data_wrapper_construct_from_parser): First, read in data,
        then try and convert it using the specified charset if supplied.
        If that fails, then dont do any conversion, and leave as raw.
        Also, if we have any x-* charsets, then dont do any processing.

svn path=/trunk/; revision=12429
2001-08-24 01:48:23 +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
fe962a2055 Big header cleanups and nntp compile fix
svn path=/trunk/; revision=9024
2001-03-29 20:31:40 +00:00
8ad855fef6 Delayed loading of IMAP message parts.
* camel-types.h: typedef CamelMessageInfo and
	CamelMessageContentInfo here

	* camel-folder-summary.h: Add a "size" field to
	CamelMessageContentInfo.

	* camel-folder-summary.c (camel_folder_summary_content_info_new,
	camel_folder_summary_content_info_free): Renamed and made
	non-static for providers that construct their own content info.
	(content_info_load, content_info_save): load/save size

	* camel-data-wrapper.c (camel_data_wrapper_is_offline): New
	function to return if a data wrapper's contents are "offline". (So
	that, for example, we don't make thumbnails of images that haven't
	been loaded off the IMAP server yet.) Defaults to FALSE.

	* providers/imap/camel-imap-folder.c (camel_imap_folder_selected):
	Fix a bug in re-selecting a folder when messages have been
	expunged from it by another client in the meantime.
	(imap_get_message): Rewrite. If the message is larger than a
	certain size, just create a skeleton message containing
	CamelImapWrappers that will read parts as needed. This way, large
	attachments only need to be downloaded if the user looks at them,
	and multipart/alternative alternatives that aren't used will never
	be downloaded at all.
	(imap_update_summary): Rewrite this a bunch too to make the
	parsing more robust.

	* providers/imap/camel-imap-summary.c
	(CAMEL_IMAP_SUMMARY_VERSION): bump.
	(camel_imap_summary_new): Set build_content to TRUE.
	(content_info_load, content_info_save): Only save/load the content
	for messages that have it. (The content info gets created as a
	side effect of imap_get_message.)

	* providers/imap/camel-imap-utils.c (imap_parse_body): New routine
	(and helpers) to parse an IMAP 'body' FETCH response and fill in a
	CamelMessageContentInfo from it.

	* providers/imap/Makefile.am (libcamelimap_la_SOURCES,
	libcamelimap_la_HEADERS): add camel-imap-wrapper.

svn path=/trunk/; revision=7557
2001-01-17 00:27:19 +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
156996ac5e Remove this. It was only a thin wrapper around struct _header_content_type
* gmime-content-field.[ch]: Remove this. It was only a thin
	wrapper around struct _header_content_type anyway, and didn't
	match the naming scheme of anything else.

	* Makefile.am: Remove gmime-content-field.[ch]

	* camel.h: Remove gmime-content-field.h

	* camel-types.h: Add CamelContentType as a typedef for struct
	_header_content_type (especially for use outside of camel).

	* camel-multipart.c:
	* camel-mime-part.c:
	* camel-mime-message.c:
	* camel-folder-summary.c:
	* camel-folder-search.c:
	* camel-data-wrapper.[ch]: Use CamelContentType and
	header_content_type_* functions rather than the GMime stuff.

	* camel-mime-part-utils.c:
	* camel-medium.c: Remove unused gmime-content-field.h include.

svn path=/trunk/; revision=7186
2000-12-28 19:28:39 +00:00
8cb514d6dd Merge with camel-async.
svn path=/trunk/; revision=4687
2000-08-10 17:30:50 +00:00
7a5b5c31e4 Fun with purify.
* providers/pop3/camel-pop3-store.c (pop3_connect): free msg on
	success as well as failure.
	(camel_pop3_command_get_additional_data): free buf after reading
	the last line (".").

	* providers/pop3/camel-pop3-folder.c (get_message_by_uid): free
	body data after creating the memstream from it (which will copy
	the data).

	* providers/mbox/camel-mbox-folder.c (mbox_finalize): free summary
	and index paths.

	* camel-data-wrapper.c (finalize): unref the stream, if it exists.

svn path=/trunk/; revision=3381
2000-06-02 06:34:58 +00:00
1ead1f0174 Removed camel-simple-data-wrapper again. Less code to maintain == better
2000-05-25  NotZed  <NotZed@HelixCode.com>

	* Makefile.am (libcamel_la_SOURCES): Removed
	camel-simple-data-wrapper again.  Less code to maintain == better
	code.

	* camel-data-wrapper.c (construct_from_stream): Fixes for bug
	where text attachments dont work.  Made data-wrapper concrete for
	the second time.

svn path=/trunk/; revision=3207
2000-05-25 21:40:58 +00:00
2ce4eb74b6 > searchpart = strchr(namepart, '?');
2000-05-19  NotZed  <NotZed@HelixCode.com>

        * camel-simple-data-wrapper.c (construct_from_stream): If we
        already have been constructed, unref our content.
        (write_to_stream): Check we've been constructued, and change for
        stream api changes.

        * camel-mime-parser.c: Removed exception stuff.

        * md5-utils.c (md5_get_digest_from_stream): repaired.

        * camel-mime-message.c: Remove exception from write_to_stream, and
        fix, and fix formatting.

        * providers/sendmail/camel-sendmail-transport.c (_send_internal):
        Fix for stream changes.

        * providers/pop3/camel-pop3-store.c (camel_pop3_command): Fixes
        for stream changes.

        * providers/mbox/camel-mbox-folder.c, and elsewhere, fix all
        stream api changes.
        (mbox_append_message): Use stream_close() now its back.
        (mbox_append_message): unref the from filter.

        * camel-stream-mem.c: And here.

        * camel-stream-fs.[ch]: Here too.

        * camel-stream-filter.c: Likewise.  This is getting tedious.

        * camel-stream-buffer.c (stream_write): Fix a few little problems.
        (stream_close): Reimplmeent.
        (camel_stream_buffer_read_line): Slightly more efficient version,
        that also only allocates the right amount of memory for strings.

        * camel-seekable-substream.c: Likewise.

        * camel-seekable-stream.[ch]: Remove exceptions, fix formatting,
        changes for stream (re)fixes.  set_bounds returns an error.

        * camel-stream.[ch]: Remove exceptions.  Make flush and reset return
        an error code, repair all the screwed up formatting, and put back
        close.

        * camel-mime-part-utils.c
        (camel_mime_part_construct_content_from_parser): And here.

        * camel-mime-part.c (camel_mime_part_set_content): And this too.
        (write_to_stream): Fixed for stream changes.

        * camel.h: Fixed.

        * providers/vee/camel-vee-folder.c (vee_search_by_expression):
        Implement.  Performs an intersection of the two searches.
        (camel_vee_folder_finalise): Unref search folders.
        (vee_append_message): Implement append.

svn path=/trunk/; revision=3142
2000-05-19 19:58:41 +00:00
0cd1c1934c remove get/set_output_stream operations. They're redundant with
* camel-data-wrapper.c: remove get/set_output_stream operations.
	They're redundant with write_to_stream, and CamelMimePart and
	CamelMimeMessage only implement the latter, meaning that trying to
	get_output_stream on a CamelMimeMessage that was built from pieces
	rather than being parsed from a stream doesn't work. Anything that
	uses get_output_stream can be rewritten to use write_to_stream, so
	we'll standardize on that.
	(camel_data_wrapper_new): remove this: CamelDataWrapper is
	supposed to be an abstract class.
	(write_to_stream): remove default implementation. (Moved to
	CamelSimpleDataWrapper)

	* camel-simple-data-wrapper.c: resurrect, although it's not really
	the same thing it was before. A simple data wrapper, which is
	backed by a CamelStream.

	* camel-mime-part-utils.c
	(simple_data_wrapper_construct_from_parser): Use
	construct_from_stream rather than set_output_stream.
	(camel_mime_part_construct_content_from_parser): Change
	camel_data_wrapper_new to camel_simple_data_wrapper_new.

	* camel-mime-part.c (camel_mime_part_set_content): Change
	camel_data_wrapper_new to camel_simple_data_wrapper_new.

svn path=/trunk/; revision=3112
2000-05-18 01:00:25 +00:00
65ec43cb55 Use CamelException to signal failure. (camel_stream_write_strings):
* camel-stream.c (camel_stream_read, camel_stream_write,
	camel_stream_flush, camel_stream_reset, camel_stream_printf,
	camel_stream_write_to_stream): Use CamelException to signal
	failure.
	(camel_stream_write_strings): Remove. camel_stream_printf is more
	useful in most of the places that used this.
	(camel_stream_write_string): Change from macro to function to
	prevent problems with double-evaluation.

	* camel-seekable-stream.c (camel_seekable_stream_seek,
	camel_seekable_stream_set_bounds): Use CamelException.
	(reset): Update.

	* camel-seekable-substream.c, camel-stream-buffer.c,
	camel-stream-filter.c, camel-stream-fs.c, camel-stream-mem.c:
	Update.

	* camel-stream-fs.c: Remove the virtual init functions and move
	the code into the creator functions. Add CamelExceptions to
	creation functions that could fail.

	* camel-data-wrapper.c (camel_data_wrapper_write_to_stream): Use
	CamelException.
	* camel-mime-message.c, camel-mime-part.c, camel-multipart.c
	(write_to_stream): Update.

	* camel-mime-parser.c: add an exception to the mime parser private
	data and pass that to stream functions as needed.

	* gmime-content-field.c, md5-utils.c: Update (badly) for stream
	changes.

	* camel-exception.h (camel_exception_is_set): convenience macro.

	* providers/Makefile.am: disable SMTP for now

	* providers/mbox/camel-mbox-folder.c (mbox_append_message): Pass
	CamelException to the functions that now need it. Check the
	exception after calling camel_stream_flush, and fail if it fails.
	(mbox_get_message_by_uid): More updates.

	* providers/pop/camel-pop3-folder.c,
	providers/pop/camel-pop3-store.c,
	providers/sendmail/camel-sendmail/transport.c: Update.

svn path=/trunk/; revision=2924
2000-05-08 22:27:59 +00:00
580d885820 Make camel not leak like a sieve.
* camel-object.c: New subclass of GtkObject which is now the base
	of the Camel object hierarchy. Currently the only difference
	between CamelObject and GtkObject is that CamelObjects don't start
	out floating.

	* *.h: Move a bunch of typedefs to camel-types.h. Standardize on
	using <camel/foo.h> in header files rather than <foo.h>, "foo.h",
	or "camel/foo.h". Remove some unneeded includes.

	* camel-address.c, camel-data-wrapper.c, camel-folder-search.c,
	camel-folder-summary.c, camel-folder.c, camel-mime-filter.c,
	camel-mime-parser.c, camel-service.c, camel-session.c,
	camel-stream.c: These are now subclasses of CamelObject.

	* camel-data-wrapper.c (set_output_stream):
	* camel-medium.c (set_content_object):
	* camel-seekable-substream.c
	(init_with_seekable_stream_and_bounds):
	* providers/mbox/camel-mbox-folder.c (mbox_get_message_by_uid):
	remove gtk_object_sink calls.

	* camel-stream-buffer.c (init_vbuf):
	* camel-stream-filter.c (camel_stream_filter_new_with_stream):
	ref the original stream.

	* camel-folder-summary.c (camel_folder_summary_finalise): unref
	the filters when finalizing.

	* camel-mime-part-utils.c
	(simple_data_wrapper_construct_from_parser,
	camel_mime_part_construct_content_from_parser):
	* camel-mime-part.c (camel_mime_part_set_content): Unref objects
	that are created only to be handed off to other objects. If
	they're going to be needed later, they will have been additionally
	ref'ed by the object that needs them.

	* providers/pop3/camel-pop3-folder.c (get_message_by_number):
	unref the message stream after creating the data from it.

	* camel-stream.c, camel-stream-buffer.c, camel-stream-filter.c,
	camel-stream-fs.c, camel-stream-mem.c: Remove camel_stream_close,
	since its semantics are dubious (what happens when you close a
	stream other people still have references on?).

	* providers/nntp/camel-nntp-store.c:
	* providers/smtp/camel-smtp-transport.c:
	* providers/pop3/camel-pop3-store.c:
	replace camel_stream_close calls with gtk_object_unref.

	* providers/mbox/camel-mbox-folder.c:
	* providers/nntp/camel-nntp-folder.c:
	* providers/sendmail/camel-sendmail-transport.c:
	replace camel_stream_close with camel_stream_flush +
	gtk_object_unref

svn path=/trunk/; revision=2882
2000-05-07 21:56:32 +00:00
c93a2e37f5 Big cleanup of camel-stream-*, got rid of 3 classes, improved the interfaces,
and fixed at least one problem (end of stream never happening in certain
cases).  Things that can fail now have a way of saying they failed too.

So much for taking ANZAC day off to get drunk!

2000-04-26  NotZed  <NotZed@HelixCode.com>

	* camel-seekable-substream.c (stream_seek): Changed to have
	absolute seek semantics, not relative to the bounds.

	* camel-seekable-stream.c (reset): When we reset, seek to the
	start of the bound, if there is one.
	(stream_tell): Make tell virtual.

	* camel-stream-filter.c (do_available): Removed.

	* camel-stream-buffer.c: Remove leading _'s from static functions.
	(stream_read): Renamed from read().  Fancy that conflicting!  (my
	boo!)  Others too.

	* providers/pop3/camel-pop3-folder.c (get_message_by_number):
	Changed to stream_mem interface.

	* providers/mbox/camel-mbox-folder.c (_get_message_by_uid): Fixed
	for streamfs interface changes, and implement a failure case.
	(_append_message): Changed for fs stream interface change.

	* camel-multipart.c (print_part): Iterate rahter than callback.  I
	hate glists's interface (hence, move this to write_to_stream).
	(write_to_stream): Return an error (yuck, this is a royal PITA to
	do with the stream write interface).

	* camel-mime-message.c: Removed leading _ from static names.

	* camel-mime-part.h: construct_from_parser() now returns an error
	code.

	* camel-mime-part-utils.c
	(camel_mime_part_construct_content_from_parser): Changed to use a
	camel-data-wrapper instead of a camel-simple-data-wrapper (no
	change needed elsewhere?).
	(simple_data_wrapper_construct_from_parser): Fixes for stream-mem
	interface changes.

	* camel-simple-data-wrapper.[ch],
	camel-simple-data-wrapper-stream.[ch],
	camel-stream-data-wrapper.[ch], removed.  Fixed including of these
	files.

	* camel-mime-part.c (camel_mime_part_set_text): Remove the use of
	the camel-simple-data-wrapper-stream, just use a mem stream.
	(write_to_stream): Renamed from my_*
	(construct_from_stream): Return an error on error.

	* camel-stream-mem.c (camel_stream_mem_new*): Remove mode
	parameter.

	* camel-stream-mem.h (enum CamelStreamMemMode): Removed.  It
	wasn't used at all.

	* camel-data-wrapper.h: Add camel_data_wrapper_new() to create
	these.
	(write_to_stream, construct_from_stream): Return an error
	indicator for success.  Fixed all methods to match (ICK).

	* Makefile.am (libcamel_la_SOURCES): Remove
	camel-simple-data-wrapper.c, camel-simple-data-wrapper-stream.c,
	camel-stream-data-wrapper.c.  Obsoleted by code re-use!

	* camel-data-wrapper.c (construct_from_stream): Change the default
	implementation to just set the output stream == construction
	stream.  Well, this lets me get rid of both simple-data-wrapper
	and stream-data-wrapper (unused anyway), and
	simple-data-wrapper-stream in one hit.  CamelDataWrapper is now
	also a concrete class.
	(write_to_stream): Use camel_stream_write_to_stream() to
	calculate/return values (and save code).
	Include <errno.h> for obvious reasons.

	* camel-stream.c (eos): Provide a default implementation of .eos().
	(camel_stream_write_to_stream): Make it return an error code on
	error.
	(camel_stream_printf): Changed to return the number of bytes
	written/error.
	(camel_stream_available): Removed.

	* camel-stream-fs.h (enum CamelStreamFsMode): Removed.  Changed to
	use unix modes and so forth (wasn't used for anything but new file
	creation and didn't work well either).

	* camel-stream-fs.c: Removed leading _'s for names.  And removed
	some virtual method 'documentation'.
	(destroy): Dont try and close a closed/error fd.  Only report
	error if close returns -1.  Moved all the code to finalise(), and
	killed this function.
	(init_with_fd): Properly setup the seek offset, if it is a
	valid and seekable file descriptor.
	(init_with_fd_and_bounds): Use off_t for bounds, set bounds on the
	seekable stream.
	(init_with_name): Return error codes.
	(init_with_name_and_bounds): Ditto.
	(camel_stream_fs_new_with_name): REturn NULL object if it failed.
	(camel_stream_fs_new_with_name_and_bounds): Return NULL object on
	failure.  Changed with_name* api's to take unix open style args
	and flags.
	(read): The bounded stream bounds checking seemed off, simplified
	code a bit.
	(write): Implement bounds checking for writing, the comment was
	wrong, it could make sense to bound writing.  Cleaned up a little.
	(available): Gone.
	(eos): Removed.  Use CamelStream's implementation now.
	(close): Reset the fd to -1, provide a warning for bad usage.
	(seek): Cleaned up.  Changed the behaviour a little, the returned
	offset is the absolute position in the file, even in bounded
	streams.
	(seek): Seek from end mirrors lseek() behaviour (reverse seeking).

2000-04-25  NotZed  <NotZed@HelixCode.com>

	* camel-stream-fs.h (struct _CamelStreamFs): Moved bounds and eof
	indicator to other parent classes.

	* camel-stream.c (camel_stream_printf): New utility
	function.  Obvious use.

	* camel-stream-mem.c: Removed leading _'s from static func's.
	(camel_stream_mem_new_with_byte_array): Fixed for api changes, set
	the owner for the byte array to us.
	: Removed A bunch of gtk doc stuff for static (implementation) functions.
	(available): Removed.
	(write): Fixed the write implementation so that seek() works on a
	seekable memory stream, as expected.  Seeking past the end of the
	buffer has unix semantics (filling with 0).
	(available): Removed.
	(write): Implement seekable stream bounded stream.
	(read): Implement seekable stream bounded stream.
	(close): Dont free the stream_mem if we're not the owner.
	(seek): Allow to seek beyond the end of memory area,
	implement bounds checking.
	(seek): Set errno on bad policy.

	* camel-stream-mem.h (struct _CamelStreamMem): Changed position to off_t.
	(new_with_buffer): Changed len to be a size_t.
	(set_buffer, set_byte_array): New interface functions.
	(struct _CamelStreamMem): Removed position, it is stored in the
	superclass.

	* camel-stream.h: Removed some of the seemingly random
	whitespace.  Removed the available method (its not
	impelemented/useful enough).

	* camel-seekable-substream.c
	(init_with_seekable_stream_and_bounds): Remove the data_available
	stuff, it hasn't been properly implemented/finished, and may never
	work (unfortunately *sigh).
	(reemit_parent_signal): Removed part of the above change.
	(set_bounds): Removed (moved to seekable-stream).
	: Fixed up some of the generally unreadable indenting (sorry,
	wrapping at 80 characters with
	camels_really_long_function_names()
	just_doesnt_work_very_well_does_it().
	(available): Removed.
	(stream_seek): Fixup for object changes.  Make sure we return -1
	if the parent stream can't seek.

	* camel-seekable-stream.c (ccamel_seekable_stream_set_bounds): New
	function to bound any seekable stream.
	: Removed _'s.
	(camel_seekable_stream_class_init): Implement an init function, to
	setup the stream bounds to unbound.

	* camel-seekable-stream.h (CamelSeekableStreamClass): New virtual
	method set_bounds for seekable streams.
	(CAMEL_STREAM_UNBOUND): New define for no bound.

	* camel-seekable-substream.h (struct _CamelSeekableSubstream):
	Removed sup_bound and inf_bound, moved to CamelSeekableStream (and
	renamed, and changed to off_t's).
	(new_with_seekable_stream_and_bounds): Use off_t as the bounds.
	(CamelSeekableSubstreamClass): Uh, why was the intialiser virtual?
	Removed.

	* camel-seekable-stream.[ch] (CamelSeekableStreamClass): Changed seek
	to accept an off_t as the offset.
	(struct _CamelSeekableStream): Renamed cur_pos to position and
	changed it to an off_t type.
	(enum CamelStreamSeekPolicy): Set to match the SEEK_* constants
	from lseek().
	(get_current_position): Renamed to tell().

	* camel-stream-buffer.h: Commented out set_vbuf - never implemented.

svn path=/trunk/; revision=2624
2000-04-26 10:35:25 +00:00
8c9b0cc3f0 No longer call data_wrapper_repository_init.
2000-04-24  NotZed  <NotZed@HelixCode.com>

	* camel.c (camel_init): No longer call
	data_wrapper_repository_init.

	* camel-medium.c (write_to_stream): Moved (back) to
	camel-mime-part.
	(add_header):
	(set_header):
	(remove_header):
	(get_header): Make all these abstract, and spit warnings if
	called.  I guess it could manage the list, but well, it doesn't.

	* camel-medium.h (struct _CamelMedium): Dont store headers here,
	the implementor is the only one who knows their format.
	(CamelMediumClass): Changed header values to be void *'s.  They
	need not be strings?

	* camel-simple-data-wrapper.c (construct_from_stream): And we're
	back.  Set the output stream.
	(construct_from_parser): Moved to camel-mime-part-utils.

	* camel-mime-part-utils.c
	(camel_mime_part_construct_content_from_parser): Create the
	contents of multipart and simple messages.

	* camel-multipart.c (construct_from_parser): Moved to
	camel-mime-part-utils.
	(separate_part): Removed.

	* camel-mime-part.c (construct_from_stream): Back again!  This now
	switches over to using a mime parser for any mime parts, only.
	(my_write_to_stream): Write our headers and so forth here.
	(add_header): Add header directly, parent class is abstract.
	(remove_header): Ditto.
	(set_header): Ditto.

	* camel-data-wrapper.c (camel_data_wrapper_construct_from_stream):
	Remade abstract.
	(camel_data_wrapper_construct_from_parser): Moved to
	camel_mime_part.

	* camel-data-wrapper.h: Put back construct_from_stream.

	* camel-mime-part.h: Put construct_from_parser in here, the
	data-wrapper shouldn't know about mime.  Ok, so now to undo half
	of the last hours changes ... duh.

2a51,93
	* providers/pop3/camel-pop3-folder.c (get_message_by_number): Use
	construct_from_stream instead of set_input_stream().

	* camel-simple-data-wrapper-stream.c
	(camel_simple_data_wrapper_stream_construct): REmoved the destroy
	callback code.
	(wrapper_destroy_cb): Removed.

	* camel-simple-data-wrapper.h: Add prototype for _construct()
	method.

	* camel.c: Include unicode.h to kill a warning.

	* camel-data-wrapper.h (CameldataWrapperClass): Removed
	construct_from_stream virtual method.
	Removed get/set input stream.

	* data-wrapper-repository.[ch]: Removed&from build.  Obsoleted?
	The justification as is follows: It is mixing storage
	protocol/format with message architecture.  It really just doesn't
	serve any purpose, as each medium implementor will have to have its
	own type->handler mapping, and the only current implementor,
	mimepart has a very simple structure and no need for this.

	* camel-medium.c (write_to_stream): Moved here from most of the
	stuff in camel-mime-part.  Well, the MEDIUM is the one that knows
	what the headers are, and the content is, let it write it out.

	* camel-mime-part-utils.c (camel_mime_part_construct_content):
	Copied from camel-mime-part.c, removed handling of message
	followon state (moved to camel-mime-message).
	(camel_mime_part_construct_content_from_parser): Renamed from
	construct_content.
	(camel_mime_part_construct_headers_from_stream):
	(camel_mime_part_construct_content_from_stream):
	(camel_mime_part_store_stream_in_buffer): Removed.  Replaced by
	the new construct from parser stuff.

	* camel-mime-message.c (construct_from_parser): Do
	construct_from_parser for mime-message.
	(_write_to_stream): Set the mime-version header for medium to
	write out, rather than writing it out ourselves.

4a96,102
	(construct_from_stream): Removed.
	(camel_data_wrapper_construct_from_stream): Changed to a helper
	function, creates a mime_parser, and constructs from that.
	(set_input_stream): Removed.
	(camel_data_wrapper_set_input_stream): Removed.
	(get_input_stream): Removed.
	(camel_data_wrapper_get_input_stream): Removed.
11a110,111
	(_get_message_by_uid): Use construct_from_stream() instead of
	creating our own parser.
16a117,131
	(camel_mime_part_construct_content): Removed to
	camel-mime-part-utils.c
	(my_get_output_stream): Removed.  The streeam is in the
	data-wrapper.
	(my_get_content_object): Removed.  The content object is stored in
	the medium.  If none is there, the object wasn't created properly.
	(my_write_content_to_stream): Removed.  The content object is the
	one that knows how to write itself out!!!!!!!!
	(my_write_to_stream): Remove the base header writing stuff - has
	been moved to camel-medium, where it belongs.  This can just be
	used to check for mandatory headers.
	(my_construct_from_stream): Removed.
	(my_set_input_stream): What the hell, i'll remove this too.
	Nobody seems to understand how it differs from create from stream,
	and they both seem to serve the same purpose ...
19a135,136
	(construct_from_stream): Removed!  Job taken over by
	construct_from_parser.
24a142
	(set_input_stream): REmoved.  Replaced by construct_from_parser.

svn path=/trunk/; revision=2577
2000-04-24 06:05:41 +00:00
5fcb83b5fb Whole swag of changes. Still lots of cleanup remaining ...
2000-04-23  NotZed  <NotZed@HelixCode.com>

	* camel-data-wrapper.c (set_mime_type_field): Ref the
	content_field when we get it?

	* camel-mime-parser.c (camel_mime_parser_unstep): New function.
	Cause a subsequent call to mime_parser_step() to return the same
	state over again.

	* providers/mbox/camel-mbox-folder.c (_get_message_by_uid):
	Initial test code using the mime parser to construct the message.

	* camel-mime-part.c (construct_from_parser): part constructor.
	(camel_mime_part_construct_content): Basically a simpler
	replacement for the datawrapper repository.
	(camel_mime_part_init): Set the default type to text/plain.

	* camel-simple-data-wrapper.c (construct_from_parser): Initial
	implementation of a content constructor.

	* camel-multipart.c (construct_from_parser): Multipart
	construction routine.
	(camel_multipart_init): Set the default multipart type to
	multipart/mixed.  Duh, no subtype is not allowed anyway.

2000-04-22  NotZed  <NotZed@HelixCode.com>

	* camel-mime-message.h (struct _CamelMimeMessage): Removed
	send_date, and received_date, and replaced it with a time_t
	'date' (this is what the header is called), and date_offset to
	store the GMT offset of the date.

	* camel-mime-message.c (camel_mime_message_set_from): Update raw
	header as we go.
	(_set_from): Removed.
	(_get_from): Removed.
	(camel_mime_message_get_from): Moved implementation here.
	(camel_mime_message_get_subject): Move implementation here.
	(_get_subject): Nuked.
	(camel_mime_message_set_subject): Handle utf-8 input, and also
	update raw header when changed.
	(_set_subject): Removed.
	(_set_received_date): Removed.
	(camel_mime_message_set_received_date): Removed.
	(_get_received_date): Removed.
	(camel_mime_message_get_received_date): Removed.
	(_get_sent_date): Removed.
	(camel_mime_message_get_sent_date): Removed.
	(camel_mime_message_get_date): New function to get the date as a
	time_t/offset.
	(camel_mime_message_set_date): Set the date as a time_t/offset.
	(camel_mime_message_get_date_string): Get the date as a string.
	(camel_mime_message_init): Initialise the current date as
	'CMAEL_MESSAGE_DATE_CURRENT'.
	(_set_reply_to): Removed.
	(camel_mime_message_set_reply_to): Moved implementation here.
	This is still broken, reply-to can have multiple addresses.
	(_get_reply_to): Removed.
	(_set_field): Removed, no longer used anywhere.
	(_get_field): Also removed.
	(_init_header_name_table): Add the Date header.
	(process_header): Also handle snooping of Date header here.

	* camel-stream-filter.c (finalise): Unref the source stream on
	finalise, and also call the parent class (oops).

	* camel-mime-parser.c (camel_mime_parser_state): New function to
	get the current parser state.
	(camel_mime_parser_stream): Allow you to get the stream back from
	the mime_parser.
	(camel_mime_parser_fd): Alternative to allow you to get the fd
	back from the mime_parser.
	(folder_scan_init_with_stream): Properly ref/unref the stream.
	(folder_scan_close): Properly unref the stream/close the fd on
	exit.
	(folder_scan_init_with_fd): Close the old fd if there is one.

	* camel-data-wrapper.c (camel_data_wrapper_construct_from_parser):
	New method, construct a data wrapper from an initialised parser.
	(construct_from_parser): Empty implementation.

	* providers/mbox/camel-mbox-summary.c (message_struct_new):
	Convert subject line to unicode, before storing in the summary.
	(strdup_trim): Removed, no longer needed.

	* providers/mbox/camel-mbox-folder.c (_get_message_by_uid): Ref
	the folder after setting it in the new message.

	* camel-mime-part.c (my_set_content_object): Have the headers
	follow the content-type change here too.
	(my_write_to_stream): Dont write content-type here, automatically
	stored in the headers ...
	(my_write_to_stream): Use header_disposition_format() to format
	the content-disposition header.
	(my_write_to_stream): Removed old code, all headers are now stored
	in the camel-medium level, always.  Need to do the same with
	camel-mime-message i suppose ...
	(my_write_to_stream): Write the content using the parent class,
	not some weird function.
	(camel_mime_part_class_init): Dont override get_output_stream.
	(camel_mime_part_encoding_from_string): Bleh, make it
	case-insensitive.

	* camel-mime-utils.c (header_content_type_is): Handle empty types.
	(header_encode_string): Start of an implementation of the rfc2047
	encoder.  It does iso-8859-1, and us-ascii, and utf-8 (others get
	tricky *sigh*)
	(rfc2047_encode_word): Convert a single word/string into rfc2047
	encoding.
	(quoted_encode): Different quoted-printable encoding for rfc2047
	encoding of headers.

	* gmime-content-field.c (gmime_content_field_write_to_stream): Use
	header_content_type_format() to format it.

svn path=/trunk/; revision=2560
2000-04-23 10:10:44 +00:00
80b463a043 do better reference counting of streams so they actually go away when they
* camel-mime-part.c (my_set_input_stream):
	* camel-data-wrapper.c (set_input_stream, set_output_stream): do
	better reference counting of streams so they actually go away
	when they should.

svn path=/trunk/; revision=2490
2000-04-19 03:20:13 +00:00
b0c0886afa added 2nd arg to g_return_val_if_fail so this builds
svn path=/trunk/; revision=2486
2000-04-18 18:22:55 +00:00
bc17057ec5 Clean, polish, document. Most of the gtk-doc comments added to
* camel-data-wrapper.[ch]:
	* camel-simple-data-wrapper.[ch]:
	* camel-medium.[ch]: Clean, polish, document. Most of the gtk-doc
	comments added to camel-data-wrapper.c note serious problems that
	need to be fixed.

svn path=/trunk/; revision=2483
2000-04-18 18:11:24 +00:00
7b379b8f3b fix nastiness with mime dispositions ( at least for now )
svn path=/trunk/; revision=2195
2000-03-27 21:33:34 +00:00
1e7ab47d26 fix the name of "Helix Code, Inc." in all the copyrights
svn path=/trunk/; revision=2091
2000-03-09 19:52:48 +00:00
8eb9e1f40b stream the raw content instead of nothing if the encoding is not
2000-03-04  bertrand  <bertrand@helixcode.com>

	* camel-mime-part.c (my_write_content_to_stream):
	stream the raw content instead of nothing if the encoding
	is not supported.

	* camel-stream-fs.c (_seek): handle eos more
	properly.

svn path=/trunk/; revision=2047
2000-03-04 22:23:06 +00:00
41694524a6 use set_input_stream instead of construct_from_stream to feed the message
2000-03-03  bertrand  <bertrand@helixcode.com>

	* providers/mbox/camel-mbox-folder.c (_get_message_by_uid):
	use set_input_stream instead of construct_from_stream
	to feed the message object.

	* camel-data-wrapper.c (my_write_to_stream): reset output stream.
	(my_set_input_stream): unref the previous input stream.
	use the set_output_stream for default behaviour.
	(my_set_output_stream): unref previous output stream.

	* camel-mime-part.c (my_write_content_to_stream): reset content
	object output stream.

mbox provider now also constructs message bodies. I should have looked
here first. damn.

svn path=/trunk/; revision=2030
2000-03-03 22:26:13 +00:00
2392d67981 don't forget to set the state to 0 after 3. (my_read_encode): don't forget
2000-03-02  bertrand  <bertrand@helixcode.com>

	* camel-stream-b64.c (my_read_encode): don't forget to
	set the state to 0 after 3.
	(my_read_encode): don't forget to encode, even in state 3.

	* camel-simple-data-wrapper.c: static functions are prefixed
	with my_ instead of _
	* camel-multipart.c: static functions are prefixed
	with my_ instead of _
	(my_write_to_stream): commented.
	(my_write_to_stream): warning in case the boudary is set
	but is a zero length string.

	* camel-mime-part.c (camel_mime_part_encoding_from_string):
	remove debug trace.

	* camel-mime-part.c: Replaced all static functions
	with name begining with _ by the same name begining
	with "my_" to prevent the possible conflicts
	with system symbols Dan warned us about.

Mime mail generation works now, at least with b64 encoding.
QP needs to be done now.

svn path=/trunk/; revision=2016
2000-03-03 02:54:25 +00:00
01b2d34d03 fix implementation so that it writes properly to the output stream even.
2000-03-02  bertrand  <bertrand@helixcode.com>

	* camel-data-wrapper.c (my_write_to_stream):
	fix implementation so that it writes properly
	to the output stream even.

	* camel-stream-b64.c (camel_stream_b64_write_to_stream):
	fix implementation.

svn path=/trunk/; revision=2013
2000-03-02 15:09:45 +00:00
39cbe68b8a new utility function.
2000-02-29  bertrand  <bertrand@helixcode.com>

	* camel-stream-b64.c (camel_stream_b64_write_to_stream): new
	utility function.

	* camel-data-wrapper.c (_write_to_stream): default
	implementation.

svn path=/trunk/; revision=1989
2000-02-29 14:12:59 +00:00
b39cda14b7 revamped so that it uses the output stream of the data wrapper
2000-02-17  bertrand  <Bertrand.Guiheneuf@aful.org>

	* camel/camel-formatter.c (handle_text_plain):
	revamped so that it uses the output stream
	of the data wrapper
	(handle_text_html): ditto.


	* camel/camel-simple-data-wrapper.h:
	* camel/camel-simple-data-wrapper.c (camel_simple_data_wrapper_new):
	use (void) instead of ().
	(_get_output_stream): simple implementation.

A lot of small fixes so that the new parser scheme
works properly. Simple implementation of the stream
though.

Changed vette-formatter files so that they work with the
new scheme.

The new parser is now in a usable state. Still needs some work but the
infrastructure is here. /me is happy.

svn path=/trunk/; revision=1822
2000-02-17 15:19:04 +00:00
a020ef5168 include gmime-base64.h various compilation and runtime fixes.
2000-02-15  bertrand  <Bertrand.Guiheneuf@aful.org>

	* camel/camel-mime-part.c: include gmime-base64.h
	various compilation and runtime fixes.
	(_set_input_stream): store the input substream
	for the content object.

	* camel/camel-data-wrapper.h: declare the
	set/get function on input/output stream.

	* camel/camel-mime-part.c (_get_content_object):
	don't use a temporary mem stream.

	* camel/camel-seekable-substream.c (_seek):
	(_eos):
	(_read): the substream can be unlimited in length

	* camel/camel-data-wrapper.c (camel_data_wrapper_class_init):
	set the get/set_input/output_stream methods.

	* camel/camel-multipart.c (_construct_from_stream):
	camel_stream_seek -> camel_seekable_stream_seek

work on the new parser scheme.
temporary sync to laptop.

svn path=/trunk/; revision=1781
2000-02-15 14:17:01 +00:00
2088dd3401 set the mime type to "mime/message". --- THIS IS NOT THE CONTENT TYPE ---
2000-02-09  bertrand  <Bertrand.Guiheneuf@aful.org>

	* camel/camel-mime-message.c (camel_mime_message_init):
	set the mime type to "mime/message".
	--- THIS IS NOT THE CONTENT TYPE ---

	* camel/camel-mime-body-part.c (camel_mime_body_part_init):
	set the mime type to "body-part".
	--- THIS IS NOT THE CONTENT TYPE ---

	* camel/camel-data-wrapper.c (camel_data_wrapper_set_mime_type):
	mime_type is const.
	(_set_input_stream): really set the input stream
	(_set_output_stream): really set the output stream
	various other typo fixes.

	* tests/ui-tests/message-browser.c: various typo
	fixes in the ctree construction.

svn path=/trunk/; revision=1712
2000-02-09 21:09:31 +00:00
0cccd4dc23 The CamelDataWrapper can now be provided with input and output streams, so
2000-01-24  bertrand  <bertrand@helixcode.com>

	* camel/camel-data-wrapper.h:
	* camel/camel-data-wrapper.c
	(_set_input_stream):
	(_get_input_stream):
	(_set_output_stream):
	(_get_output_stream):
	The CamelDataWrapper can now be provided with input and
	output streams, so that nothing has to be kept in memory.

	* camel/camel-stream.c (camel_stream_class_init):
	added the "data_available" signal.

svn path=/trunk/; revision=1624
2000-01-25 04:02:14 +00:00
316a4c47ff Updated my e-mail address to reflect my new employment
svn path=/trunk/; revision=1533
2000-01-03 23:05:55 +00:00
331335d12c Fix copyright informations once again
svn path=/trunk/; revision=1489
1999-12-14 22:40:38 +00:00
ca7044930f Added streaming capability to CamelDataWrapper. This makes it possible, for
example, to build multipart messages out of files that are on disk without
loading them in memory.

svn path=/trunk/; revision=1394
1999-11-17 14:39:25 +00:00
8fe1aa5f41 Copyright change
svn path=/trunk/; revision=1348
1999-10-23 15:19:51 +00:00
6043cbbc55 name parameter is const. This fixes a bug in destroy ()
1999-08-20  bertrand  <Bertrand.Guiheneuf@aful.org>

	* camel/camel-stream-fs.c (camel_stream_fs_new_with_name):
	name parameter is const. This fixes a bug in destroy ()

svn path=/trunk/; revision=1135
1999-08-20 18:37:36 +00:00
9d041c9464 implemented destructors.
1999-08-11  bertrand  <Bertrand.Guiheneuf@aful.org>

	* camel/camel-multipart.c (_finalize):
	* camel/camel-simple-data-wrapper.c (_finalize):
	* camel/camel-mime-part.c (_finalize):
	implemented destructors.

	* camel/gmime-content-field.c (gmime_content_field_ref):
	(gmime_content_field_unref):
	New reference mechanism for GMimeContentField objects.

	* camel/camel-data-wrapper.c (_finalize):
	Started implementing destructors.

	* camel/camel-mime-part.c (_construct_from_stream):
	* camel/gmime-content-field.c (gmime_content_field_write_to_stream):
	* camel/camel-multipart.c (_construct_from_stream):
	removed forgotten anarchic traces.


Go away memory leaks!

svn path=/trunk/; revision=1103
1999-08-10 23:22:44 +00:00
db89b1a62f updated some autogen doc stuff. Still don't understand warnings :(
1999-08-06  bertrand  <Bertrand.Guiheneuf@aful.org>

	* devel-docs/camel/:
	updated some autogen doc stuff.
	Still don't understand warnings :(

	* camel/camel-data-wrapper.c:
	* camel/providers/MH/camel-mh-store.c:
	* camel/url-util.c:
	* camel/gmime-content-field.c:
	* camel/camel-store.c:
	various inline doc corrections.

	* camel/camel-folder.c (get_message_count):
	new method. Returns the number of message
	in the folder.

svn path=/trunk/; revision=1092
1999-08-06 17:28:26 +00:00
cac0ba57e6 merge a lot of work. Rough ChangeLog will follow
svn path=/trunk/; revision=1052
1999-08-01 13:38:28 +00:00
4a765990e5 sync before going home
svn path=/trunk/; revision=1026
1999-07-15 15:54:52 +00:00
fce26238c4 Implemented base64 encoder based on CamelStreams. Should the
1999-07-13  Miguel de Icaza  <miguel@gnu.org>

	* camel/gmime-base64.c (gmime_encode_base64): Implemented base64
	encoder based on CamelStreams.  Should the encoder/decoder be a
	Stream itself?

	* camel/gmime-utils.c: include config.h here.
	* camel/url-util.c: ditto.
	* camel/gstring-util.c: ditto.
	* camel/gmime-content-field.c: ditto.
	* camel/camel-stream.c: ditto.
	* camel/camel-stream-fs.c: ditto.
	* camel/camel-store.c: ditto.
	* camel/camel-simple-data-wrapper.c: ditto.
	* camel/camel-session.c: ditto.
	* camel/camel-service.c: ditto.
	* camel/camel-mime-part.c: ditto.
	* camel/camel-mime-message.c: ditto.
	* camel/camel-log.c: ditto.
	* camel/camel-data-wrapper.c: ditto
	* camel/camel-folder.c: ditto.

	* camel/camel-stream.c (camel_stream_write): Moved api
	documentation to the places that they document.
	(camel_stream_class_init): Virtual classes do not need to have a
	default implementation.  So null them all.
	(camel_stream_write): Return value from write.
	(camel_stream_available): implement.
	(camel_stream_write_strings): documented.

	* devel-docs/query/virtual-folder-in-depth.sgml: Small
	reformatting

1999-06-28  bertrand  <Bertrand.Guiheneuf@inria.fr>

	* tests/test2.c (main): now use
	CamelDataWrapper::contruct_form_stream to test

svn path=/trunk/; revision=1024
1999-07-15 00:11:56 +00:00
1659afa3d3 now use CamelDataWrapper::contruct_form_stream to test message parsing
1999-06-28  bertrand  <Bertrand.Guiheneuf@inria.fr>

	* tests/test2.c (main): now use
	CamelDataWrapper::contruct_form_stream to test
	message parsing

	* camel/camel-data-wrapper.c:
	* camel/camel-data-wrapper.h:
	construct_from_stream no longer has maximimum size arg.

	* camel/camel-mime-part.c (_construct_from_stream): new.
	Construct the mime_part from a stream.

svn path=/trunk/; revision=1003
1999-06-28 16:05:09 +00:00
817f237398 new field (content_type) and associated methods. (camel_mime_part_init):
1999-06-28  bertrand  <Bertrand.Guiheneuf@inria.fr>

	* camel/camel-mime-part.c:
	new field (content_type) and associated methods.
	(camel_mime_part_init): initialize content_type field.
	(_parse_header_pair): now set content_type MimePart field
	instead of using DataWrapper Mime typing facility.

1999-06-28  bertrand  <Bertrand.Guiheneuf@inria.fr>

	* camel/camel-data-wrapper.h:
	s/content_type/mime_type/

1

svn path=/trunk/; revision=1002
1999-06-28 14:36:11 +00:00
7f81757d52 moved all the content-type stuff here. (camel_data_wrapper_init):
1999-06-22  bertrand  <Bertrand.Guiheneuf@inria.fr>

	* camel/camel-data-wrapper.c (_get_content_type):
	moved all the content-type stuff here.
	(camel_data_wrapper_init): initialize the instance
	content-type field.

	* camel/camel-mime-part.c (_parse_header_pair):
	parse Content-Type stuff in header.
	(_write_to_stream): write the content type stuff to
	the stream.

svn path=/trunk/; revision=985
1999-06-22 16:12:27 +00:00