aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-part-utils.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove this. It was only a thin wrapper around struct _header_content_typeDan Winship2000-12-291-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Add tests.Not Zed2000-11-241-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Shite, -1 on error, >=0 on success. So i've just been truncating all theNot Zed2000-11-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Set the preface/postface from the parser into the multipart object.Not Zed2000-11-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* More UTF-8 handlingLauris Kaplinski2000-08-251-4/+4
| | | | svn path=/trunk/; revision=5032
* Fixed some warnings.Christopher James Lahey2000-08-111-6/+9
| | | | | | | | | | | | | | | | 2000-08-10 Christopher James Lahey <clahey@helixcode.com> * camel-folder-search.c, camel-folder-summary.c, camel-medium.c, camel-mime-filter-charset.c, camel-mime-filter.c, camel-mime-filter.h, camel-mime-message.c, camel-mime-parser.c, camel-mime-part-utils.c, camel-mime-part.c, camel-mime-utils.c, camel-movemail.c, camel-multipart.c, camel-object.c, camel-stream-mem.c, providers/mbox/camel-mbox-folder.c, providers/mbox/camel-mbox-summary.c, providers/mh/camel-mh-folder.c, providers/smtp/camel-smtp-transport.c: Fixed some warnings. svn path=/trunk/; revision=4719
* Merge with camel-async.Peter Williams2000-08-111-10/+10
| | | | svn path=/trunk/; revision=4687
* flush the filter stream before unreffing it, so it willDan Winship2000-06-211-3/+19
| | | | | | | | | | | | | | | | | | | | | | * camel-mime-part.c (write_to_stream): flush the filter stream before unreffing it, so it will camel_mime_filter_complete. * camel-stream-filter.c (camel_stream_filter_class_init): Fix a braino so camel_stream_flush works here. * camel-stream-mem.c (stream_seek): Fix a bug that resulted in large attachments being silently dropped. * providers/pop3/camel-pop3-store.c (camel_pop3_command_get_additional_data): Don't use g_strjoinv here, since it is O(n^2) on the length of the output string, and we can do O(n). * camel-mime-part-utils.c (simple_data_wrapper_construct_from_parser): add a CRLF decoder after the QP/B64 decoder if it's text. svn path=/trunk/; revision=3658
* KLUDGE! Since neither ETable nor GtkHTML supports UTF-8 yet, outputDan Winship2000-06-171-4/+4
| | | | | | | | | | | * camel-mime-utils.c (rfc2047_decode_word): * camel-mime-part-utils.c (simple_data_wrapper_construct_from_parser): * camel-folder-summary.c (summary_build_content_info): KLUDGE! Since neither ETable nor GtkHTML supports UTF-8 yet, output ISO-8859-1 instead, so Ettore can read his Italian mail. :) This will be reverted later. svn path=/trunk/; revision=3597
* Fixes Bug 192.Not Zed2000-06-021-1/+0
| | | | | | | | | | | | | | | | | | 2000-06-01 Not Zed <NotZed@HelixCode.com> * camel-mime-part.c (construct_from_parser): For a message part, set the default content-type to message/rfc822. Maybe needs to be done for multiparts too? 2000-05-31 Not Zed <NotZed@HelixCode.com> * camel-mime-message.c (construct_from_parser): Typo in assersion. * camel-mime-parser.c (folder_scan_step): Use a default type of message/rfc822 for multipart/digest. Bug Z192. (folder_scan_drop_step): Remove warning. svn path=/trunk/; revision=3340
* Don't set a default boundary. Require the caller to do that.Dan Winship2000-05-261-1/+2
| | | | | | | | | | | | * camel-multipart.c (camel_multipart_init): Don't set a default boundary. Require the caller to do that. (set_boundary): if boundary is NULL, generate a "random" boundary. * camel-mime-part-utils.c (camel_mime_part_construct_content_from_parser): Add a call to camel_multipart_set_boundary after creating a new multipart. svn path=/trunk/; revision=3217
* Replace simple data wrapper here too, oops.NotZed2000-05-261-1/+1
| | | | | | | | | | 2000-05-25 NotZed <NotZed@HelixCode.com> * camel-mime-part-utils.c (camel_mime_part_construct_content_from_parser): Replace simple data wrapper here too, oops. svn path=/trunk/; revision=3208
* remove get/set_output_stream operations. They're redundant withDan Winship2000-05-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Make camel not leak like a sieve.Dan Winship2000-05-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* And same here ...NotZed2000-05-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | 2000-05-05 NotZed <NotZed@HelixCode.com> * camel-folder-summary.c: And same here ... * camel-mime-utils.c: Defined out some memory profiling stuff I left there by mistake. * camel-mime-parser.c (folder_scan_content): Apply the fix from the header scanner to here too. (folder_scan_header): Only check for end of header if we have space for it (didn't end the read with a newline) (folder_scan_header): inptr is the only real thing we need registerised for performance. Try to help the compiler be smart about it .. (folder_scan_header): Simplified the save header case a tad. Commented out some memory profiling stuff. svn path=/trunk/; revision=2811
* No, we're not going to have g_strcasecmp for no good reason,NotZed2000-05-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | not even if its slipped in with no changelog. 2000-05-04 NotZed <NotZed@HelixCode.com> * providers/mbox/camel-mbox-summary.c: Yes, and anotherone. * camel-mime-utils.c: And another one. * camel-mime-part.c: And another one. * camel-mime-part-utils.c: And another one. * camel-folder-search.c: And another one. * camel-mime-parser.c: Reverted a change wihtout a ChangeLog entry. 2000-05-04 NotZed <NotZed@HelixCode.com> * camel-folder-summary.[hc]: Yes, CamelFolderSummary is back ... ... re-usable class to summarise and index any stream or message and to manage/load/save the created summaries. * camel-folder.c: Include string.h to kill a warning. 2000-05-03 NotZed <NotZed@HelixCode.com> * camel-folder.h: Added pos/bodypos/endpos to the basic message content info object. Size to be removed? Moved the messageconentinfo and messageinfo back to camel-folder-summary.h. * camel-mime-filter-index.c (camel_mime_filter_index_set_ibex): New function to (re)set the index to use on a filter. * camel-mime-parser.c (camel_mime_parser_scan_from): Whole bunch of inline docs. (camel_mime_parser_drop_step): New function to drop a state from the parser. Needs more testing. svn path=/trunk/; revision=2789
* s/strcasecmp/g_strcasecamp/ everywhere except intl/, per michael'sJacob Leach2000-05-031-4/+5
| | | | | | request. svn path=/trunk/; revision=2776
* > * gmime-utils.[ch]: What the hell, remove it. This will break theMichael Zucci2000-05-031-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | > nntp provider (but its broken anyway). The mime parser can be > used instead though. > Removed from all code including it (but none were using it). > > * gmime-utils.c (_store_header_pair_from_string): Removed bizarre > string_dichotomy version of this. This code is somewhat redundant > now, and is headed for death anyway. > > * gstring-util.c (g_string_dichotomy): Same with this one. > (g_string_clone): Removed a memory leak, g_string_new() allocates > its own memory. > (g_string_append_g_string): Allow to append an empty gstring onto > another gstring, dont abort()! > > * string-utils.c (string_dichotomy): Removed this incredibly weird > function. > > * camel-folder.c (_create): Replaced the rather obtuse use of > "string_dichotomy" function with a simple strrchr(). Still not > sure it'll work. > > * camel-folder-summary.c: cvs removed a long-removed file. svn path=/trunk/; revision=2753
* Dont use autofill on these fucking long function anmes!!!!!!22000-05-031-5/+3
| | | | | | | | | | 2000-05-02 <notzed@helixcode.com> * camel-mime-part-utils.c (simple_data_wrapper_construct_from_parser): Dont use autofill on these fucking long function anmes!!!!!! svn path=/trunk/; revision=2750
* camel_mime_parser_tell() returns an offset from where it started parsing,Dan Winship2000-04-291-12/+21
| | | | | | | | | | | | | | | | | | | * camel-mime-part-utils.c (simple_data_wrapper_construct_from_parser): camel_mime_parser_tell() returns an offset from where it started parsing, not necessarily from the start of data. Since we're parsing a bounded seekable_stream, we need to add the stream's starting bound to camel_mime_parser_tell's return value to create the substream in the right place. * camel-seekable-substream.c (camel_seekable_substream_new_with_seekable_stream_and_bounds): say CAMEL_STREAM_UNBOUND rather than -1 in doc. * camel-seekable-stream.c (camel_seekable_stream_seek): Add more info to docs. svn path=/trunk/; revision=2680
* Remove. We weren't using the fields that made this different fromDan Winship2000-04-271-3/+2
| | | | | | | | | | | | | * camel-mime-body-part.[ch]: Remove. We weren't using the fields that made this different from camel-mime-part, so it basically just forced us to do lots of gratuitous typecasting. * camel-multipart.[ch]: Use CamelMimePart. Remove the multipart parent stuff, since we weren't using that either. * etc: update for CamelMimeBodyPart -> CamelMimePart svn path=/trunk/; revision=2645
* Big cleanup of camel-stream-*, got rid of 3 classes, improved the interfaces,NotZed2000-04-261-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* fix a cut-and-pasto.Dan Winship2000-04-251-1/+1
| | | | | | | * camel-mime-part-utils.c (simple_data_wrapper_construct_from_parser): fix a cut-and-pasto. svn path=/trunk/; revision=2587
* Big fixes for the last commit which broke the message creation entirely.Michael Zucci2000-04-241-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Plus an address decoder/formatter, etc. * camel-mime-message.c (construct_from_parser): Allow MESSAGE_END _or_ EOF as valid termination conditions. * providers/mbox/camel-mbox-summary.c (message_struct_new): Decode and then re-encode the addresses, so they are consistently formatted. * camel-mime-utils.c (header_decode_mailbox): Store the address in a _header_address. And try to get a comment-stored name if there is one. (header_decode_address): Actually return an address. (header_to_decode): Renamed to header_address_decode() (header_mailbox_decode): New function to get a single mailbox. (header_mime_decode): Return the major/minor value, as appropriate. (header_address_new, and friends): Whole bunch of utility functions for working with the address thingies. (header_decode_domain): Free the string header, and dont expand '.' into ' . '. (camel_mime_part_construct_content_from_parser): Oops, this was totally screwed up, try creating the right cotnent on the right object. svn path=/trunk/; revision=2579
* No longer call data_wrapper_repository_init.NotZed2000-04-241-117/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* kill camel-logDan Winship2000-04-191-25/+0
| | | | svn path=/trunk/; revision=2487
* fix the name of "Helix Code, Inc." in all the copyrightsDan Winship2000-03-101-1/+1
| | | | svn path=/trunk/; revision=2091
* Make sure we open with create with a creation mask.NotZed2000-03-041-2/+0
| | | | | | | | | | | | | | | 2000-03-03 NotZed <NotZed@HelixCode.com> * providers/mbox/camel-mbox-utils.c (camel_mbox_write_xev): Make sure we open with create with a creation mask. 2000-03-01 NotZed <NotZed@HelixCode.com> * camel-mime-part-utils.c (camel_mime_part_construct_content_from_stream): DO NOT assert on content type, we have fallback code 4 lines below it ... *sigh* svn path=/trunk/; revision=2026
* Free the data in the headers hash table. (_add_header): g_strdup theDan Winship2000-02-241-4/+5
| | | | | | | | | | | | | * camel-medium.c (_finalize): Free the data in the headers hash table. (_add_header): g_strdup the header name and value when adding it. * camel-mime-part-utils.c (camel_mime_part_construct_headers_from_stream): Free the header data after calling camel_medium_add_header, since it will have g_strdup()ed it itself. svn path=/trunk/; revision=1913
* don't seek the begining of the substream. (_eos): fix eos conditionbertrand2000-02-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | 2000-02-16 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-seekable-substream.c (_set_bounds): don't seek the begining of the substream. (_eos): fix eos condition testing. (_finalize): unref parent stream (_init_with_seekable_stream_and_bounds): ref parent stream * camel/gstring-util.c (g_string_equal_for_hash): (g_string_equal_for_glist): return type is int. * camel/camel.h: * camel/camel.c (camel_init): use (void) instead of (). A lot of other small changes to make the set_input_stream scheme work. It actually works. svn path=/trunk/; revision=1798
* this routine replaces the _read_part routine and does not store the partbertrand2000-02-161-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | 2000-02-15 bertrand <bertrand@helixcode.com> * camel/camel-multipart.c (_localize_part): this routine replaces the _read_part routine and does not store the part in a buffer. (_set_input_stream): use the set_input_stream instead of the construct_from_stream. each bodypart is given an input stream. * camel/camel-mime-part-utils.c: include the data-wrapper-repository header. (camel_mime_part_construct_content_from_stream): use the set_input_stream instead of the construct_from_stream method. * camel/camel-seekable-substream.c (_set_bounds): cur position is set to 0 not to inf_bound. Sync svn path=/trunk/; revision=1790
* If we get a -1 read, DONT update the total bytes, and try and truncate theNotZed2000-02-101-8/+11
| | | | | | | | | | | | | | | | 2000-02-09 NotZed <notzed@zedzone.helixcode.com> * camel/camel-mime-part-utils.c (camel_mime_part_store_stream_in_buffer): If we get a -1 read, DONT update the total bytes, and try and truncate the array in reverse. Eek. * camel/camel-mime-part.c (camel_mime_part_encoding_from_string): This was DEFINETLEY not the right way to do it. strncmp!=strcmp (camel_mime_part_encoding_to_string): Handle the default case. : include string.h for strcmp() etc. svn path=/trunk/; revision=1720
* Updated my e-mail address to reflect my new employmentBertrand Guiheneuf2000-01-041-1/+1
| | | | svn path=/trunk/; revision=1533
* Fix copyright informations once againBertrand Guiheneuf1999-12-151-1/+1
| | | | svn path=/trunk/; revision=1489
* Copyright changeBertrand Guiheneuf1999-10-231-1/+4
| | | | svn path=/trunk/; revision=1348
* Address updateBertrand Guiheneuf1999-08-301-1/+1
| | | | svn path=/trunk/; revision=1147
* text parameter declared constbertrand1999-08-291-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1999-08-28 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-mime-part.c (camel_mime_part_set_text): text parameter declared const * camel/camel-mime-part-utils.c (camel_mime_part_store_stream_in_buffer): actually test correctly nb_bytes_read_chunk is >0 * camel/gstring-util.c: * camel/gmime-content-field.c: * camel/providers/MH/camel-mh-folder.c: * camel/camel-stream-fs.c: include string.h * camel/camel-stream-mem.c (_write): return the numver of written bytes. * camel/camel-stream-buffered-fs.c (_eos): return sthg * camel/camel-stream.c (default_camel_seek): return something. * Started to work on new recipient code. * fixed various leaks. svn path=/trunk/; revision=1146
* contruct the content from the buffer before calling CamelMediumbertrand1999-08-261-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1999-08-26 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-mime-part.c (_get_content_object): contruct the content from the buffer before calling CamelMedium implementation. (_construct_from_stream): Do not construct the content by default, just store the content bytes in a temporary buffer. Content will be constructed only at caller request (when calling CamelMedium::get_content_object) Providers with better access to the messages (mbox/MH ...) will have to provider lighter implementation, that is shall not read content at all unless the caller asks for it (again with get_content). * camel/camel-mime-part-utils.c: new file, groups mime-part related utils. Meant to be used by providers subclassing MimeMessage. (camel_mime_part_construct_headers_from_stream): (camel_mime_part_construct_content_from_stream): no more useless temporary hash table. * camel/camel-mime-part.c (_construct_from_stream): calls mime-part-utils functions now. * camel/gmime-utils.c (_store_header_pair_from_string): do not use hash table to store header, use an array instead. svn path=/trunk/; revision=1145
* new file, groups mime-part related utils. Meant to be used by providersbertrand1999-08-261-0/+134
1999-08-26 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-mime-part-utils.c: new file, groups mime-part related utils. Meant to be used by providers subclassing MimeMessage. (camel_mime_part_construct_headers_from_stream): (camel_mime_part_construct_content_from_stream): no more useless temporary hash table. * camel/camel-mime-part.c (_construct_from_stream): calls mime-part-utils functions now. * camel/gmime-utils.c (_store_header_pair_from_string): do not use hash table to store header, use an array instead. * MimePart cleanup. Not complete yet. Content must not be parsed when constructing but only when content object is requested. Default implementation will keep content in a stream. svn path=/trunk/; revision=1144