aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/.cvsignore7
-rw-r--r--camel/CODING.STYLE19
-rw-r--r--camel/ChangeLog3004
-rw-r--r--camel/Makefile.am131
-rw-r--r--camel/README57
-rw-r--r--camel/README.COPYRIGHT47
-rw-r--r--camel/README.HACKING14
-rw-r--r--camel/camel-address.c151
-rw-r--r--camel/camel-address.h57
-rw-r--r--camel/camel-arg-collector.c186
-rw-r--r--camel/camel-data-wrapper.c280
-rw-r--r--camel/camel-data-wrapper.h96
-rw-r--r--camel/camel-exception-list.def35
-rw-r--r--camel/camel-exception.c279
-rw-r--r--camel/camel-exception.h89
-rw-r--r--camel/camel-folder-pt-proxy.c809
-rw-r--r--camel/camel-folder-pt-proxy.h92
-rw-r--r--camel/camel-folder-search.c496
-rw-r--r--camel/camel-folder-search.h85
-rw-r--r--camel/camel-folder-summary.c1410
-rw-r--r--camel/camel-folder-summary.h191
-rw-r--r--camel/camel-folder.c1166
-rw-r--r--camel/camel-folder.h289
-rw-r--r--camel/camel-internet-address.c287
-rw-r--r--camel/camel-internet-address.h51
-rw-r--r--camel/camel-marshal-utils.c343
-rw-r--r--camel/camel-marshal-utils.h102
-rw-r--r--camel/camel-medium.c275
-rw-r--r--camel/camel-medium.h92
-rw-r--r--camel/camel-mime-filter-basic.c219
-rw-r--r--camel/camel-mime-filter-basic.h58
-rw-r--r--camel/camel-mime-filter-charset.c243
-rw-r--r--camel/camel-mime-filter-charset.h52
-rw-r--r--camel/camel-mime-filter-from.c242
-rw-r--r--camel/camel-mime-filter-from.h50
-rw-r--r--camel/camel-mime-filter-index.c178
-rw-r--r--camel/camel-mime-filter-index.h55
-rw-r--r--camel/camel-mime-filter-save.c160
-rw-r--r--camel/camel-mime-filter-save.h50
-rw-r--r--camel/camel-mime-filter.c228
-rw-r--r--camel/camel-mime-filter.h83
-rw-r--r--camel/camel-mime-message.c704
-rw-r--r--camel/camel-mime-message.h169
-rw-r--r--camel/camel-mime-parser.c1774
-rw-r--r--camel/camel-mime-parser.h119
-rw-r--r--camel/camel-mime-part-utils.c218
-rw-r--r--camel/camel-mime-part-utils.h45
-rw-r--r--camel/camel-mime-part.c705
-rw-r--r--camel/camel-mime-part.h131
-rw-r--r--camel/camel-mime-utils.c2371
-rw-r--r--camel/camel-mime-utils.h154
-rw-r--r--camel/camel-movemail.c500
-rw-r--r--camel/camel-movemail.h45
-rw-r--r--camel/camel-multipart.c467
-rw-r--r--camel/camel-multipart.h103
-rw-r--r--camel/camel-news-address.c84
-rw-r--r--camel/camel-news-address.h45
-rw-r--r--camel/camel-object.c57
-rw-r--r--camel/camel-object.h65
-rw-r--r--camel/camel-op-queue.c166
-rw-r--r--camel/camel-op-queue.h64
-rw-r--r--camel/camel-provider.c153
-rw-r--r--camel/camel-provider.h83
-rw-r--r--camel/camel-seekable-stream.c206
-rw-r--r--camel/camel-seekable-stream.h88
-rw-r--r--camel/camel-seekable-substream.c284
-rw-r--r--camel/camel-seekable-substream.h70
-rw-r--r--camel/camel-service.c466
-rw-r--r--camel/camel-service.h130
-rw-r--r--camel/camel-session.c234
-rw-r--r--camel/camel-session.h100
-rw-r--r--camel/camel-simple-data-wrapper.c141
-rw-r--r--camel/camel-simple-data-wrapper.h71
-rw-r--r--camel/camel-store.c274
-rw-r--r--camel/camel-store.h97
-rw-r--r--camel/camel-stream-buffer.c475
-rw-r--r--camel/camel-stream-buffer.h109
-rw-r--r--camel/camel-stream-filter.c355
-rw-r--r--camel/camel-stream-filter.h52
-rw-r--r--camel/camel-stream-fs.c310
-rw-r--r--camel/camel-stream-fs.h75
-rw-r--r--camel/camel-stream-mem.c248
-rw-r--r--camel/camel-stream-mem.h74
-rw-r--r--camel/camel-stream.c294
-rw-r--r--camel/camel-stream.h90
-rw-r--r--camel/camel-thread-proxy.c514
-rw-r--r--camel/camel-thread-proxy.h90
-rw-r--r--camel/camel-transport.c110
-rw-r--r--camel/camel-transport.h85
-rw-r--r--camel/camel-types.h67
-rw-r--r--camel/camel-url.c294
-rw-r--r--camel/camel-url.h65
-rw-r--r--camel/camel.c46
-rw-r--r--camel/camel.h77
-rw-r--r--camel/devel-docs/camel_stream.diabin2669 -> 0 bytes
-rw-r--r--camel/gmime-content-field.c237
-rw-r--r--camel/gmime-content-field.h71
-rw-r--r--camel/gstring-util.c216
-rw-r--r--camel/gstring-util.h66
-rw-r--r--camel/hash-table-utils.c80
-rw-r--r--camel/hash-table-utils.h46
-rw-r--r--camel/md5-utils.c391
-rw-r--r--camel/md5-utils.h54
-rw-r--r--camel/providers/.cvsignore2
-rw-r--r--camel/providers/MH/.cvsignore6
-rw-r--r--camel/providers/MH/Makefile.am34
-rw-r--r--camel/providers/MH/camel-mh-folder.c1022
-rw-r--r--camel/providers/MH/camel-mh-folder.h72
-rw-r--r--camel/providers/MH/camel-mh-provider.c46
-rw-r--r--camel/providers/MH/camel-mh-store.c153
-rw-r--r--camel/providers/MH/camel-mh-store.h72
-rw-r--r--camel/providers/MH/mh-summary.c290
-rw-r--r--camel/providers/MH/mh-summary.h33
-rw-r--r--camel/providers/MH/mh-uid.c220
-rw-r--r--camel/providers/MH/mh-uid.h40
-rw-r--r--camel/providers/MH/mh-utils.c50
-rw-r--r--camel/providers/MH/mh-utils.h30
-rw-r--r--camel/providers/Makefile.am6
-rw-r--r--camel/providers/maildir/.cvsignore6
-rw-r--r--camel/providers/maildir/Makefile.am24
-rw-r--r--camel/providers/maildir/camel-maildir-folder.c802
-rw-r--r--camel/providers/maildir/camel-maildir-folder.h66
-rw-r--r--camel/providers/maildir/camel-maildir-provider.c46
-rw-r--r--camel/providers/maildir/camel-maildir-store.c124
-rw-r--r--camel/providers/maildir/camel-maildir-store.h69
-rw-r--r--camel/providers/mbox/.cvsignore7
-rw-r--r--camel/providers/mbox/Makefile.am41
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c855
-rw-r--r--camel/providers/mbox/camel-mbox-folder.h81
-rw-r--r--camel/providers/mbox/camel-mbox-provider.c50
-rw-r--r--camel/providers/mbox/camel-mbox-store.c129
-rw-r--r--camel/providers/mbox/camel-mbox-store.h69
-rw-r--r--camel/providers/mbox/camel-mbox-summary.c740
-rw-r--r--camel/providers/mbox/camel-mbox-summary.h78
-rw-r--r--camel/providers/mbox/libcamelmbox.urls1
-rw-r--r--camel/providers/nntp/.cvsignore7
-rw-r--r--camel/providers/nntp/Makefile.am31
-rw-r--r--camel/providers/nntp/camel-nntp-folder.c617
-rw-r--r--camel/providers/nntp/camel-nntp-folder.h73
-rw-r--r--camel/providers/nntp/camel-nntp-provider.c69
-rw-r--r--camel/providers/nntp/camel-nntp-store.c486
-rw-r--r--camel/providers/nntp/camel-nntp-store.h85
-rw-r--r--camel/providers/nntp/camel-nntp-utils.c211
-rw-r--r--camel/providers/nntp/camel-nntp-utils.h42
-rw-r--r--camel/providers/nntp/libcamelnntp.urls2
-rw-r--r--camel/providers/pop3/.cvsignore6
-rw-r--r--camel/providers/pop3/Makefile.am35
-rw-r--r--camel/providers/pop3/camel-pop3-folder.c271
-rw-r--r--camel/providers/pop3/camel-pop3-folder.h73
-rw-r--r--camel/providers/pop3/camel-pop3-provider.c51
-rw-r--r--camel/providers/pop3/camel-pop3-store.c612
-rw-r--r--camel/providers/pop3/camel-pop3-store.h81
-rw-r--r--camel/providers/pop3/libcamelpop3.urls1
-rw-r--r--camel/providers/sendmail/.cvsignore7
-rw-r--r--camel/providers/sendmail/Makefile.am31
-rw-r--r--camel/providers/sendmail/camel-sendmail-provider.c53
-rw-r--r--camel/providers/sendmail/camel-sendmail-transport.c212
-rw-r--r--camel/providers/sendmail/camel-sendmail-transport.h64
-rw-r--r--camel/providers/sendmail/libcamelsendmail.urls1
-rw-r--r--camel/providers/smtp/.cvsignore6
-rw-r--r--camel/providers/smtp/Makefile.am32
-rw-r--r--camel/providers/smtp/camel-smtp-provider.c53
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c735
-rw-r--r--camel/providers/smtp/camel-smtp-transport.h68
-rw-r--r--camel/providers/smtp/libcamelsmtp.urls1
-rw-r--r--camel/providers/vee/Makefile.am39
-rw-r--r--camel/providers/vee/camel-vee-folder.c423
-rw-r--r--camel/providers/vee/camel-vee-folder.h58
-rw-r--r--camel/providers/vee/camel-vee-provider.c45
-rw-r--r--camel/providers/vee/camel-vee-store.c132
-rw-r--r--camel/providers/vee/camel-vee-store.h48
-rw-r--r--camel/providers/vee/libcamelvee.urls1
-rw-r--r--camel/string-utils.c185
-rw-r--r--camel/string-utils.h64
174 files changed, 0 insertions, 37007 deletions
diff --git a/camel/.cvsignore b/camel/.cvsignore
deleted file mode 100644
index fd6b811c68..0000000000
--- a/camel/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
diff --git a/camel/CODING.STYLE b/camel/CODING.STYLE
deleted file mode 100644
index a236f0060f..0000000000
--- a/camel/CODING.STYLE
+++ /dev/null
@@ -1,19 +0,0 @@
-Note to hackers
----------------
-
-When hacking on camel (and on the gnome mailer in general),
-be sure to follow the same coding style as the intial authors.
-Please read the file HACKING in gnumeric and follow the
-general guidelines explained in it.
-
-Please take a look at camel source files and try to exactly
-imitate the coding style. We are perfectly aware that this
-is not the best and unique style, but it is absolutely
-mandatory that Camel is homogeneous. If you find the current
-coding style to have some weaknesses, please contact the
-authors to discuss this matter.
-
-Thanks.
-
- Bertrand.
-
diff --git a/camel/ChangeLog b/camel/ChangeLog
deleted file mode 100644
index 504b95bf7a..0000000000
--- a/camel/ChangeLog
+++ /dev/null
@@ -1,3004 +0,0 @@
-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.
-
-2000-05-18 Dan Winship <danw@helixcode.com>
-
- * camel-folder.c: remove message_number_capability and require uid
- capatibility.
- (camel_folder_list_subfolders, camel_folder_get_uid_list,
- camel_folder_get_subfolder_info, camel_folder_get_message_info):
- removed
- (camel_folder_get_subfolder_names,
- camel_folder_free_subfolder_names): new subfolder interfaces.
- (camel_folder_get_uids, camel_folder_free_uids): new uid
- interfaces
- (camel_folder_get_summary, camel_folder_free_summary): new summary
- interfaces
-
- * providers/mbox/camel-mbox-folder.c,
- * providers/nntp/camel-nntp-folder.c:
- * providers/vee/camel-vee-folder.c: Update for changes
-
- * providers/pop3/camel-pop3-folder.c: Implement get_uids, update
- for other changes.
-
-2000-05-18 NotZed <NotZed@HelixCode.com>
-
- * providers/vee/camel-vee-folder.c: Guess!
-
- * camel-folder-search.c (search_user_flag): Implement user_flag
- search term.
-
- * camel-folder-search.h: Added user_flag search capability
- (user-flag "blah")
-
- * providers/mbox/camel-mbox-folder.c (mbox_init): Set USER flag in
- permanent flags for the folder.
-
-2000-05-17 Dan Winship <danw@helixcode.com>
-
- * camel-folder.c: Remove unused async open/close and
- copy_message_to functions.
- Rename functions without initial _. Fix glib preconditions and
- gtk-doc comments.
-
-2000-05-17 Dan Winship <danw@helixcode.com>
-
- * 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.
-
-
-2000-05-17 Darin Adler <darin@eazel.com>
-
- * camel-folder-summary.c: (message_info_load):
- Quick fix to get it to compile. I hope I don't get into trouble.
-
-2000-05-17 Dan Winship <danw@helixcode.com>
-
- * camel.h: Don't include the no-longer-distributed
- possibly-to-be-removed headers.
-
- * providers/smtp/camel-smtp-transport.c
- (smtp_get_email_addr_from_text): fix an off-by-one error in
- address parsing
- (smtp_data): use camel_data_wrapper_get_output_stream rather than
- data_wrapper->output_stream
-
-2000-05-17 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-folder.c (message_changed): Snoop
- changes to user flags on the message into the summary as well.
-
- * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_init):
- Changed version init to include the parent class version info
- (i.e. add it not overwrite it).
-
- * camel-folder-summary.c (message_info_new): Initialise user_flags
- to empty.
- (message_info_load): And load user flags.
- (message_info_save): And save user flags.
- (message_info_free): And free them.
- (CAMEL_FOLDER_SUMMARY_VERSION): Bumped file revision.
-
- * camel-folder-summary.h: Added user-flags to summary.
-
- * camel-mime-message.c (camel_mime_message_set_user_flag): Dont
- use a hashtable for user flags.
- (camel_mime_message_get_user_flag): And changed here too.
- (camel_flag_get): New interface to get a flag from a flag
- list. Flag lists are easier to work with than hash tables, and
- save memory too.
- (camel_flag_set): And set.
- (camel_flag_list_free): And free.
- (free_key_only): Discard.
- (finalize): Remove the flag list.
-
-2000-05-17 Jeffrey Stedfast <fejj@stampede.org>
-
- * providers/smtp/camel-smtp-transport.c: (smtp_helo): Error
- checking on gethostbyaddr() eliminating a possible segfault.
-
-2000-05-16 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-folder.c (mbox_delete_message_by_uid):
- Implement.
-
-2000-05-12 NotZed <NotZed@HelixCode.com>
-
- * camel-movemail.c (camel_movemail): Open the destination with
- O_APPEND, so we dont blow away a partially transferred mbox.
- (camel_movemail): Loop if we get errno=INTR, and not fail.
-
-2000-05-11 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-summary.c (summary_rebuild): Update
- the summarised file size, if everything went ok.
- (camel_mbox_summary_expunge): Clear header flags after updating.
-
-2000-05-16 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-folder.c:
- * providers/nntp/camel-nntp-folder.h:
- * providers/nntp/camel-nntp-provider.c:
- * providers/nntp/camel-nntp-store.c:
- * providers/nntp/camel-nntp-utils.c:
- * providers/nntp/camel-nntp-utils.h:
- get things working with new camel summary stuff.
-
- * providers/nntp/camel-nntp-summary.c:
- * providers/nntp/camel-nntp-summary.h:
- removed files since camel-folder-summary does all we need.
-
-2000-05-15 Jeffrey Stedfast <fejj@stampede.org>
-
- * providers/smtp/camel-smtp-transport.c: Added some preliminary
- AUTH support.
-
-2000-05-15 Dan Winship <danw@helixcode.com>
-
- * camel-folder.h: Remove camel_folder_get_summary, which no longer
- exists.
-
-2000-05-11 Dan Winship <danw@helixcode.com>
-
- * Makefile.am: remove some cruft that we're not currently using.
-
- * camel-stream-mem.c (camel_stream_mem_new_with_buffer): Change
- to match prototype (size_t vs unsigned int) so it works on 64-bit
- machines. Noted by msw.
-
-2000-05-11 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-folder.c (message_changed): Indicate
- the summary changed also.
-
-2000-05-11 Jeffrey Stedfast <fejj@stampede.org>
-
- * providers/smtp/camel-smtp-transport.c: (smtp_helo):
- Updated to more closely comply with RFC 821 standards
-
-2000-05-11 NotZed <NotZed@HelixCode.com>
-
- * camel-mime-part.c (write_to_stream): Unref the filter after
- adding it to the filtering stream.
-
- * providers/mbox/camel-mbox-summary.c
- (camel_mbox_summary_finalise): Free the folder path.
- (camel_mbox_summary_update): Also save summary when done.
- (camel_mbox_summary_expunge): Unindex items when deleting them.
- (camel_mbox_summary_expunge): Save the index as well as the
- summary.
-
- * camel-folder-summary.c (camel_folder_summary_finalise): Free the
- summary path.
- (camel_folder_summary_touch): New function, indicate the summary
- info changed.
- (camel_folder_summary_remove): Dirty here.
-
- * camel-internet-address.c (internet_decode): Free multiple entry
- addresses properly.
-
- * camel-mime-utils.c (header_decode_mailbox): Plugged another
- memleak, free text after converting it.
- (header_decode_addrspec): More leaks plugged.
-
- * camel-mime-message.c (finalize): Free message_uid.
- (finalize): Free the recipients hashtable.
-
-2000-05-11 <notzed@helixcode.com>
-
- * camel-folder-summary.c (camel_folder_summary_finalise): Free
- summary items and charset filters.
-
-2000-05-10 <notzed@helixcode.com>
-
- * camel-folder-summary.c (camel_folder_summary_finalise): Don't
- free stuff in p, after we've free'd p.
-
- * providers/mbox/camel-mbox-folder.c (mbox_append_message): Unref
- the stream we created for appending.
-
-2000-05-10 Jeffrey Stedfast <fejj@stampede.org>
-
- * providers/smtp/camel-smtp-transport.c: (camel_smtp_transport_class_init):
- Added initialization for service_class
-
-2000-05-10 Dan Winship <danw@helixcode.com>
-
- * camel-multipart.c (write_to_stream): fix a stupid typo. Thank
- you, C.
-
- * camel-mime-part.c (write_to_stream): don't ref the stream before
- wrapper a filter around it, since nothing will ever unref it.
-
-2000-05-10 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Added camel-types.h, camel-folder-pt-proxy.h, and
- camel-thread-proxy.h.
-
-2000-05-09 Dan Winship <danw@helixcode.com>
-
- * providers/sendmail/camel-sendmail-transport.c (_send_internal):
- Bleah. Can't fsync a pipe. As a quick kludge, just don't
- stream_flush it. The right fix will require bringing back
- stream_close though.
-
-2000-05-09 Jeffrey Stedfast <fejj@stampede.org>
- * camel-internet-address.[c,h]: Undid my changes (moved
- struct _address back into came-internet-address.c)
- * providers/smtp/camel-smtp-transport.c: (_send): changed
- from using it's own address manipulation (using struct _address)
- to using camel_internet_address_get(). Also some format changes
- to keep consistant with the rest of Camel
-
-2000-05-09 Jeffrey Stedfast <fejj@stampede.org>
-
- * camel-internet-address.[c,h]: Moved struct _address from
- camel-internet-address.c to camel-internet-address.h
- (hopefully this doesn't break anything...)
- * providers/smtp/camel-smtp-transport.c: (_send): now
- populates the recipient list with To, Cc, and Bcc addresses.
- Should now be able to use this module.
-
-2000-05-09 Dan Winship <danw@helixcode.com>
-
- * providers/mbox/camel-mbox-folder.c (mbox_get_message_by_uid):
- one more refcounting fix I missed before.
-
-2000-05-08 Jeffrey Stedfast <fejj@stampede.org>
-
- * providers/smtp/camel-smtp-transport.c: no longer frees memory it
- shouldn't, updated to reflect camel-stream changes involving
- CamelException (perhaps it should use a different CamelException
- variable than is passed to the camel smtp module?)
-
-2000-05-08 Dan Winship <danw@helixcode.com>
-
- * 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.
-
-
-2000-05-08 NotZed <NotZed@HelixCode.com>
-
- * camel-mime-message.c (process_header): Format From and Reply-To
- to at least a decoded string. Should probably store them as an
- camelinternetaddress.
-
- * Merged NEW_SUMMARY branch back to trunk, and resolved conflicts.
-
- * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_update):
- Return status.
- (camel_mbox_summary_expunge): Force an update of the summary
- before we do anything.
- (camel_mbox_summary_expunge): Build new xev line in xevnew, and
- free that, and consify xev.
- (camel_mbox_summary_load): If we are rebuilding from scratch, make
- sure we clear the summary content.
-
- * camel-stream-filter.c (do_close): We NEED a stream close.
-
-2000-05-07 Dan Winship <danw@helixcode.com>
-
- 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
-
-2000-05-06 Dan Winship <danw@helixcode.com>
-
- * providers/pop3/camel-pop3-store.c (query_auth_types): A machine
- which serves neither POP nor KPOP is not a POP server.
-
- * providers/smtp/camel-smtp-provider.c: Note in the description
- that this provider is not yet tested.
-
-2000-05-08 <notzed@helixcode.com>
-
- * camel-mime-part.c (write_to_stream): Free the filter stream when
- done.
-
- * camel-mime-parser.c (folder_seek): Make sure we add the \n
- terminal when we seek as well (frob!).
-
- * camel-mime-utils.c (header_decode_addrspec): Plug minor memleak.
-
- * camel-mime-part.c (finalize): Free header tables once finished.
-
- * camel-folder-summary.c (camel_folder_summary_remove): Dont try
- to access info after its free'd.
-
-2000-05-07 NotZed <NotZed@HelixCode.com>
-
- * camel-mime-part.c (write_to_stream): Apply encoding to content
- part, when writing to a stream *sigh*.
-
- * camel-stream-filter.c (do_write): implement write for the
- filtering stream. Writes shouldn't be mixed with reads.
- (do_flush): Implemented flush. Again write/flush shouldn't be
- mixed with reads. Only flushes if the last op was write.
- (do_close): Force flush on close.
-
- * camel-mime-filter.c (filter_run): Oops, make sure we include the
- backlen in the total length before passing onto the filter.
-
- * camel-mime-filter-from.c: New filter, munges 'From ' lines into
- '>From ', for mbox.
-
- * camel-mime-parser.c (camel_mime_parser_header_remove): New
- function to remove the parser's raw header, rather than
- manipulating the header directly (wich doesn't work with
- mempools).
-
- * camel-mime-utils.c (header_address_list_clear): Fixed some
- broken(tm) logic, which would leak entries on multivalued lists.
-
- * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_load):
- Use ibex_save() to save the ibex. Makes a big difference to
- startup times for very large mailboxes.
- (camel_mbox_summary_expunge): Dum de dum, reimplemented. Designed
- to be much more robust, and to stop immediately if anything awry
- happens.
- (copy_block): Utility function to copy n bytes from one fd to
- another.
- (header_write): Utility function to write out raw headers to an
- fd.
- (camel_mbox_summary_update): Incremental summary updater.
-
- * providers/mbox/camel-mbox-folder.c (mbox_get_message_by_uid):
- Dont unref the stream, because of the broken(tm) ref model of gtk
- widget that for some odd reason is being perpetuated in camel.
- (mbox_expunge): Reenable expunge again.
- (mbox_append_message): Removed the optimised mbox append. If its
- an issue, it can go back later. Cleaned up a lot, checks error
- returns, and automagically translates 'From ' into '>From' as
- necessary.
-
-2000-05-07 <notzed@helixcode.com>
-
- * camel-mime-filter.c (filter_run): Oops, forgot to add the
- backlen to the pre-buffer (*poof*).
-
-2000-05-07 NotZed <NotZed@HelixCode.com>
-
- * camel-mime-message.c (construct_from_parser): Allow
- HSCAN_FROM_END to terminate the processing of a message.
-
- * camel-folder-summary.c (perform_content_info_load): Ick, dont
- try and append a node onto its own list.
- (camel_folder_summary_clear): Actually clear the indexes after
- we've removed the messages.
- (camel_folder_summary_clear): Set dirty if it changes.
- (camel_folder_summary_load): Clear dirty.
- (camel_folder_summary_save): Only save if dirty.
-
- * providers/mbox/camel-mbox-summary.c (summary_header_load): Oops,
- remember to call that parent class first ...
- (summary_header_save): Here too.
- (camel_mbox_summary_load): Do more checking to verify the index
- contents as well as teh summary contents, against the mbox
- contents.
- (camel_mbox_summary_load): Removed some fo that checking, it needs
- more code to work reliably.
-
-2000-05-07 <notzed@helixcode.com>
-
- * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_load):
- Set the size and mtime of the mbox we indexed once done.
-
- * camel-folder-summary.c (camel_folder_summary_set_index): Dont
- write the index if it changes - let the claler fix it (uh, kind of
- impacts performance).
- (camel_folder_summary_load): close in.
-
- * camel-folder-summary.c (summary_format_string): Check header
- exists before trying to strip its leading spaces.
-
-2000-05-06 NotZed <NotZed@HelixCode.com>
-
- * camel-folder.h: Removed summary info from here, and include
- camel-folder-summary.h as well.
-
- * camel-mime-parser.c (camel_mime_parser_step): Allow it to accept
- a NULL databuffer.
-
- * providers/mbox/camel-mbox-summary.c: Totally new file, now
- subclasses camel-folder-summary.
-
- * camel-folder-summary.c (message_info_load): Load the uid as a
- string.
- (message_info_save): And save too.
- (camel_folder_summary_clear): New function, clears the contents of
- the summary.
-
- * providers/mbox/camel-mbox-folder.c: Fixes for summary changes.
- (mbox_get_message_by_uid): Completely redone. Now cross-checks
- the summary information to make sure we get a real message.
- (mbox_append_message): Disabled the copy version of append for
- now.
- (mbox_expunge): Temporarily disabled the expunge function, until
- it is put back in camel-mbox-summary.c
-
-2000-05-05 NotZed <NotZed@HelixCode.com>
-
- * camel-folder-summary.c: And same here ...
- (camel_folder_summary_encode_fixed_int32): Ugh, fwrite doesn't
- return -1 on error ..
- (camel_folder_summary_decode_fixed_int32): Neither deos fread.
- (camel_folder_summary_encode_token): Fix here too.
- (summary_build_content_info): Use start-headers to get the pos of
- the message, not parser_tell(), which might not be what we
- expected because of parser_unstep().
- (camel_folder_summary_encode_token): Use bserch() to tokenise the
- values, rather than a linear search.
-
- * camel-mime-utils.c: Defined out some memory profiling stuff I
- left there by mistake.
- (header_decode_mailbox): Dont try to append the word part of a
- local address if we ran out of words.
-
- * 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.
-
-2000-05-05 <notzed@helixcode.com>
-
- * camel-mime-utils.c (header_decode_mailbox): Plug a memory leak.
- (header_decode_text): Fixed memory leaks with g_string_append().
- (header_encode_string): And here too, and a few other places. The
- glib api is so awful ...
- (header_content_type_decode): More memory leaks.
-
-2000-05-05 <notzed@helixcode.com>
-
- * camel-mime-parser.c (folder_scan_init_with_fd): Make sure we
- init the end of buffer sentinal!
- (folder_scan_init_with_stream): And here too ...
-
-2000-05-04 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-folder.c (summary_get_message_info):
- Maxcount is minimum of the max and the requested count, not the
- maximum :)
-
- * camel-mime-parser.c (folder_scan_content): Properly set midline,
- so we dont falsely catch offset boundary markers (i.e. From inside
- content).
- (folder_read): Set a sentinal on the end of the read data (\n) so
- we dont have to check the buffer boundary in the inner loop.
- (mempool_*): New experimental memory management routines, speed
- up simple structure parsing by about 25% ... not compiled in by
- default. Something similar may be needed for camel-mime-utils to
- address performance issues with g_malloc and friends.
-
- * camel-mime-utils.c: Added a macro w(x) used to wrap all warnings
- about mime/rfc violations, so they can be turned off.
-
- * camel-folder-summary.c (summary_build_content_info): Step after
- the end of a message ...
- Turn into a stand-alone program for testing and profiling.
-
-2000-05-04 Dan Winship <danw@helixcode.com>
-
- * providers/pop3/camel-pop3-store.c (pop3_connect): Don't fall
- back to plaintext passwords if APOP fails, since it should also
- fail.
-
-2000-05-04 Dan Winship <danw@helixcode.com>
-
- * camel-session.c (camel_session_list_providers): New function to
- replace camel_provider_scan. Returns a list of either (a) all
- currently-loaded providers, or (b) all available providers.
-
- * camel-url.[ch]: Add an "empty" flag to CamelURL (indicating that
- it contains only a protocol).
-
- * camel-service.c (camel_service_query_auth_types): Make this take
- a CamelException (since it may have to try to connect to the
- server, and it might not able to.)
-
- * providers/pop3/camel-pop3-store.c: add KPOP (Kerberized POP)
- support. This is mostly so I have two kinds of authmech to play
- with instead of just one. (But it does actually work.)
-
- * providers/smtp/camel-smtp-transport.c (query_auth_types): update
- for prototype change, but disable the functionality, since it
- doesn't really support any auth types yet.
- (camel_smtp_transport_get_type): add an object init function to
- set the service url_flags.
-
-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 Jason Leach <leach@wam.umd.edu>
-
- * Makefile.am (INCLUDES): add $(UNICODE_CFLAGS) to the INCLUDES,
- people who installed libunicde in non-standard include paths need
- this.
-
-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.
-
- * camel-mime-utils.c (rfc2047_decode_word): If the iconv handle is
- -1, then dont try and convert (crashes unicode_iconv?).
- (rfc2047_decode_word): Use alloca for variables instead of
- g_malloc - by the rfc they should always be short.
- (rfc2047_decode_word): If we can't do the charset conversion, undo
- the quoted-printable/base64 at least? Should probably convert
- unknown characters to the utf-8 unknown character.
-
-2000-05-02 Larry Ewing <lewing@helixcode.com>
-
- * camel-mime-utils.c (header_decode_date): fix typo when
- dereferencing saveoffset.
-
-2000-05-02 NotZed <NotZed@HelixCode.com>
-
- * camel-folder-search.c: Added some header doco.
-
- * camel.h: REmove gmime-utils.h from here.
-
- * providers/mbox/camel-mbox-search.[ch]: Removed. Functionally
- redundant.
-
- * providers/mbox/camel-mbox-folder.c (mbox_search_by_expression):
- Use the new CamelFolderSearch class to do the actual searching,
- just setup the search here.
-
- * camel-folder-search.[ch]: A helper class that providers may
- subclass to provide their own search functionality, or they can
- simply use as is, it supports body searches if an ibex is
- supplied, and header searches if a summary is supplied.
-
-2000-05-02 Matt Loper <matt@helixcode.com>
-
- * Makefile.am: set G_LOG_DOMAIN.
- * providers/MH/Makefile.am: same.
- * providers/maildir/Makefile.am: same.
- * providers/mbox/Makefile.am: same.
- * providers/nntp/Makefile.am: same.
- * providers/pop3/Makefile.am: same.
- * providers/sendmail/Makefile.am: same.
- * providers/smtp/Makefile.am: same.
-
-2000-05-02 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-search.c
- (camel_mbox_folder_search_by_expression): Dont store/remove
- current search from the search list.
-
- * providers/mbox/camel-mbox-folder.h: Removed searches list,
- searches are all sync now.
-
- * gmime-utils.[ch]: What the hell, remove it. This will break the
- nntp provider. 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.
-
- * camel-mime-parser.c (folder_scan_header): Fix the previous
- overflow problem properly (can happen in 2 places).
- (header_append): A new macro to include the code changed above, so
- it only appears in one place.
- (folder_scan_step): Change the content type to text/plain if the
- multipart is broken. Doesn't actually change the header though.
- (header_append): Also move the header-start tracking stuff here.
- Could be a static function to save code.
-
-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!!!!!!
-
-2000-05-02 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-summary.c
- (camel_mbox_summary_expunge): Fix the offset for the summary when
- an item is expunged to take account of the From line.
-
-2000-05-01 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-folder.h (CamelMboxFolder): Removed
- search_id.
-
- * providers/mbox/camel-mbox-search.c
- (camel_mbox_folder_search_cancel): Remove.d
- (camel_mbox_folder_search_complete): Removed.
- (camel_mbox_folder_search_by_expression): Changed back to sync
- api.
- (struct _searchcontext): Removed cancelled flag.
- (find_context): Removed.
- (func_header_contains): Debug out some search stuff.
-
- * providers/mbox/camel-mbox-search.h
- (camel_mbox_folder_search_by_expression): Moved back to sync api.
-
- * providers/mbox/camel-mbox-summary.c
- (camel_mbox_summary_set_flags_by_uid): New function to update the
- flags in the summary.
- (camel_mbox_summary_expunge): Expunge messages from a folder.
- (offset_content): Re-align offsets of summary when messages
- added/removed to an existing summary.
- (camel_mbox_summary_remove_uid): Remove a message summary entry by
- uid.
- (index_folder): Restore flags from X-Evolution header, if they are set.
- (index_folder): Make sure we index using a decimal uid, since
- thats what everything else indexes off (oops).
- Upped SUMMARY_VERSION as a result.
- (camel_mbox_summary_expunge): Oops, my wrong, use the string uid
- to unindex on.
-
- * providers/mbox/camel-mbox-folder.c (_get_message_by_uid):
- Connect to the message_changed signal.
- (_init): Set permanent flags to something reasonable. No user
- flags yet ...
- (message_changed): If the flags of the message change, update the
- flags in the summary.
- (mbox_expunge): Implement the expunge.
- (camel_mbox_folder_class_init): Renamed all leading _'s to mbox_'s
- (mbox_expunge): Emit a folder_changed signal on expunge (uh, even
- if it didn't ...)
-
- * camel-folder.c (_finalize): Uh, dont free permanent_flags
- anymore (this wouldn't failed anyway, it was a GList !!!)
- (camel_folder_search_complete): Removed.
- (camel_folder_search_cancel): Removed.
- (camel_folder_expunge): Changed to only allow expunge on an open
- folder. It doesn't make sense for mbox, otherwise (?)
- (camel_folder_class_init): Added a folder_changed signal.
-
- * camel-folder.h (struct _CamelFolder): Change permanent_flags to
- a bitfield.
- (list_permanent_flags): Renamed to get_permanent_flags, and
- returns a bitfield.
- (camel_folder_expunge): Changed expunge to a void type. The
- messages would no longer be useful after they have been removed
- ...
- (CamelFolderClass): New function summary_get_by_uid() to get a single
- summary.
- (*search*): Moved back to synchronous search api ... *sigh*
-
- * camel-folder.h: Removed CamelSearchFunc.
-
- * camel-mime-message.c (set_flag): Removed.
- (camel_mime_message_set_flag): Removed.
- (get_flag): Removed.
- (camel_mime_message_get_flag): Removed.
- (add_flag_to_list): Removed.
- (get_flag_list): Removed.
- (camel_mime_message_get_flag_list): Removed.
- (camel_mime_message_get_flags): New interface to get system flags.
- (camel_mime_message_set_flags): " to set ".
- (camel_mime_message_get_user_flag): To get a user flag.
- (camel_mime_message_set_user_flag): To set a user flag.
- (finalize): Hmm, the old one free'd the key and data, not good
- when the data is a boolean ...
-
-2000-04-30 Dan Winship <danw@helixcode.com>
-
- * camel-provider.h: Tweak the definition of CamelProvider. Among
- other things, a provider may now be both a store and a transport.
-
- * camel-provider.c: Remove a lot of code we had no intention of
- using. This now only contains two functions: camel_provider_init
- to read the installed .urls files, and camel_provider_load to
- load and register a new provider.
-
- * camel-session.c: Remove more unused code and simplify some of
- the remaining code. The list of available provider modules is now
- stored in the session, and it handles calling camel_provider_load
- to load them as needed. Provider registration is now done by
- calling back from the module init routine, which allows a single
- module to register providers for multiple URL types.
-
- * providers/*: Update provider structures and init routines for
- the new stuff. Add a .urls file to each provider specifying what
- urls it handles, and install that with the library.
-
- * providers/nntp/camel-nntp-provider.c: Add hints towards
- supporting both news: and nntp: URLs, and using nntp as both a
- store and a transport.
-
-2000-04-29 Dan Winship <danw@helixcode.com>
-
- * camel-internet-address.c (camel_internet_address_get): const
- poison
-
- * 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.
-
-2000-04-28 Dan Winship <danw@helixcode.com>
-
- * camel-mime-parser.c (folder_scan_header): fix a bug that would
- cause corruption with very long headers.
-
-2000-04-27 Ettore Perazzoli <ettore@helixcode.com>
-
- * providers/pop3/Makefile.am (INCLUDES): Add `-I$(srcdir)/../../..'
- to pick the Camel includes.
- * providers/sendmail/Makefile.am (INCLUDES): Likewise.
-
- * camel.h: Don't #include <camel/data-wrapper-repository.h> anymore.
-
-2000-04-27 NotZed <NotZed@HelixCode.com>
-
- * camel-mime-utils.c (check_header): Dont try and check a NULL
- header.
-
- * camel-recipient.[ch]: Dead. Its not pining.
-
- * camel-mime-message.h: Dont include recipients.h anymore.
-
- * camel-mime-message.c (camel_mime_message_add_recipient): Accept
- name/address separately, and store in an CamelInternetAddress.
- (add_recipient): Removed.
- (remove_recipient): Removed.
- (remove_recipient_address): Renamed from remove_receipient, works
- via address.
- (camel_mime_message_remove_recipient_name): New function to remove
- by name.
- (get_recipients): Removed.
- (camel_mime_message_get_recipients): Return a camel-internet-address.
- (write_to_stream): No longer write receipients directly.
- (write_recipients_to_stream): Removed.
- (write_one_recipient_to_stream): Removed.
- (camel_mime_message_init): Setup recipients hashtable, rather than
- usign the recipients stuff.
- (set_recipient_list_from_string): Killed, a violent and lengthy
- death.
- (process_header): Simplified recipient handling code a lot.
- (received_date_str, sent_date_str, reply_to_str, subject_str,
- from_str): Removed some oddly-defined global statics.
- (camel_mime_message_class_init): Dont initialise above variables
- anymore.
- (init_header_name_table): Removed, use a table to init this, and
- do it in class init (2 lines of code ...).
-
- * camel-news-address.c: Class to represent news addresses -
- currently empty, and not built.
-
- * camel-internet-address.h: Class to represent internet (email)
- addresses.
-
- * camel-address.h: Abstract class to represent (lists of)
- addresses.
-
-2000-04-27 Dan Winship <danw@helixcode.com>
-
- * camel-mime-part.c (write_to_stream): Revert previous change. I
- was confused.
-
- * camel-url.[ch] (camel_url_encode, camel_url_decode): expose
- these routines.
-
-2000-04-26 Dan Winship <danw@helixcode.com>
-
- * camel-mime-part.c (write_to_stream): Only write a newline
- between the headers and the content object if the content object
- is not a CamelMedium. (If the content is a medium, it may have its
- own headers, which then need to go before the blank line.)
-
- * 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
-
-2000-04-26 Dan Winship <danw@helixcode.com>
-
- * camel-medium.c (set_content_object): sink the content object
- after referencing it.
-
- * camel-mime-part.c: fix various little things in the handling
- of CamelMedium methods. Change camel_mime_part_set_text to the
- more generic camel_mime_part_set_content.
-
- * camel.h: sync to current reality
-
- * camel-folder-utils.[ch]: removed
-
- * camel-mime-utils.c (header_format_date): fix format specifier
- for time zone. Fix typo in month names array.
-
-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.
-
-2000-04-25 Dan Winship <danw@helixcode.com>
-
- * camel-stream-buffer.c (_eos): only return TRUE if the parent is
- at eos AND the buffer has been exhausted
-
- * camel-mime-message.c: fix some incorrect macro usage that
- resulted in bogus casts
-
-2000-04-24 Dan Winship <danw@helixcode.com>
-
- * camel-mime-part-utils.c
- (simple_data_wrapper_construct_from_parser): fix a cut-and-pasto.
-
- * providers/mbox/camel-mbox-folder.c (_get_message_by_uid): ref
- (and sink) the message stream if we're going to unref it later.
- Otherwise it could get destroyed while there are still substreams
- attached to it. This needs a cleaner solution.
-
- * camel.h: remove data-wrapper-repository.h include(s)
-
-2000-04-24 NotZed <NotZed@HelixCode.com>
-
- * 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.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_mime_part_construct_content_from_parser): Oops, this was
- totally screwed up, try creating the right cotnent on the right
- object.
-
- * 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.
-
-2000-04-23 Dan Winship <danw@helixcode.com>
-
- * camel-mime-utils.c (header_to_decode, header_mime_decode): fix
- some obvious minor bugs noted by -Wall.
-
-2000-04-23 NotZed <NotZed@HelixCode.com>
-
- * 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.
-
- * camel-data-wrapper.c (set_mime_type_field): Ref the
- content_field when we get it?
- (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.
-
- * 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.
- (_get_message_by_uid): Use construct_from_stream() instead of
- creating our own parser.
-
- * 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_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 ...
-
- * camel-simple-data-wrapper.c (construct_from_parser): Initial
- implementation of a content constructor.
- (construct_from_stream): Removed! Job taken over by
- construct_from_parser.
-
- * 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.
- (set_input_stream): REmoved. Replaced by construct_from_parser.
-
-2000-04-22 Dan Winship <danw@helixcode.com>
-
- * camel-multipart.[ch]: clean, document, etc.
- (camel_multipart_init): pick a prettier default boundary. Still
- need to deal with the larger problem
-
-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.
-
-2000-04-21 NotZed <NotZed@HelixCode.com>
-
- * camel-mime-utils.h: Add prototype for header_param_list_free.
-
- * camel-recipient.c: New function to remove all the types of a
- recipient list. I think this whole object needs a major review.
-
- * camel-mime-message.c (camel_mime_message_class_init): Removed
- parse_header_pair override, override add_header instead.
- (_parse_header_pair): Renamed to add_header.
- (remove_header): Add this method, to make sure we keep upto date
- with removed headers too.
- (_set_field): If given a NULL value, clear it out.
- (_set_recipient_list_from_string): Constify.
- (set_header): Override set_header from camel_medium.
- (process_header): Local function to handle set/add/remove of each
- header we know about.
-
- * camel-mime-part.c (camel_mime_part_class_init): Removed
- parse_header_pair setup.
- (my_parse_header_pair): Moved into add_header(), removed.
- (my_set_disposition): Allow a NULL disposition to clear it.
- (my_set_content_id): Allow NULL content id to clear it.
- (remove_header): Track removed headers.
- (my_set_description): Allow NULL description to clear it.
- (my_set_content_MD5): Make sure we copy the md5 value, and allow a
- NULL value to reset it.
- (my_set_filename): Copy the filename.
- (my_set_header_lines): Removed. Nothing uses it, it doesn't
- actually serve any purpose.
- (camel_mime_part_set_header_lines): Ditto.
- (my_get_header_lines): Ditto.
- (camel_mime_part_get_header_lines): Ditto.
- (camel_mime_part_class_init): Remove *_header_lines setup.
- (camel_mime_part_init): Remove header_lines init.
- (my_finalize): Remove header_lines finalise.
- (my_write_to_stream): Write the headers here. This is just WRONG,
- camel_medium should be doing this.
- (my_get_output_stream): Kill a warning.
- (camel_mime_part_encoding_to_string): Ditto.
- (camel_mime_part_set_description): Unvirtualiase, use add_header()
- to do the processing.
- (my_set_description): Removed.
- (set_disposition): Renamed from my_set_disposition.
- (camel_mime_part_get_description): Get the descriptionf rom the
- get_header method.
- (my_get_description): Removed.
- (my_set_filename): Removed.
- (camel_mime_part_get_filename): Get the parameter from the
- disposition.
- (camel_mime_part_encoding_from_string): Handle NULL string.
- (camel_mime_part_init): Remove reference to filename.
- (my_finalize): Dont free filename.
-
- * camel-mime-part.h (CamelMimePartClass): Removed
- parse_header_pair() method, it doesn't add anything that
- add_header() can't be used for.
- (CamelMimePartClass): Remove *_header_lines methods.
- (struct _CamelMimePart): Remove header_lines list.
- (struct _CamelMimePart): Removed filename attribute.
-
- * camel-medium.c (camel_medium_init): Init headers to null, not a
- hashtable.
- (add_header): Append the headers as a list.
- (remove_header): Remove headers as a list.
- (get_header): Likewise for lookup.
- (free_header): Removed, no longer needed.
- (finalize): Free headers using header_raw_clear().
- (camel_medium_set_header): New function, to reset and override all
- values of a header with a new value.
-
- * camel-medium.h (struct _CamelMedium): Changed to use a
- header_raw struct rather than a hash table, to store headers
- (many headers can occur multiple times).
-
- * camel-mime-utils.c (header_raw_find_next): New function, allows
- you to find multi-valued header fields.
- (header_disposition_format): New function to format/create
- content-disposition header string.
- (header_param_list_format_append): Function to format parameter
- lists into a GString.
- (header_content_type_format): Function to format content-type into
- a usable format.
- (header_set_param): allow NULL value to remove the parameter.
- (decode_token): Renamed from header_decode_token.
- (header_decode_token): New interface for external use.
- (quoted_decode): Made static to kill annoying warnings.
- (g_strdup_len): Killed, replaced with calls to g_strndup().
- (rfc2047_decode_word): Made static to kill warnings.
- (decode_coded_string): Terminated.
- (g_string_append_len): Made static to kill warnings.
- (header_decode_text): Made static to kill warnings.
- (header_decode_text): Constify.
- (rfc2047_decode_word): Constify.
- (header_param): Constify.
- (header_content_type_new): Copy the type/subtype strings.
- (header_param_list_decode): Made static.
- (header_param_list_format_append): Made static.
- (quoted_decode): Constify.
- (g_string_append_len): Constify.
- (header_token_decode): New function to decode a single token.
-
- * providers/mbox/camel-mbox-summary.c (header_write): Append a
- trailing \n when writing headers.
- (strdup_trim): Killed a warning.
- (camel_mbox_summary_set_uid): Make sure the next uid is at least 1
- higher than any existing one.
- (header_evolution_decode): Use header_token_decode to get the
- token.
-
- * camel-mime-parser.c (folder_scan_header): Strip the trailing \n
- of the end of all header lines.
-
-2000-04-20 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-utils.[ch]: Removed.
-
- * providers/mbox/camel-mbox-parser.[ch]: Removed. Removed
- references to it.
-
-2000-04-20 Dan Winship <danw@helixcode.com>
-
- * camel-mime-utils.c (rfc2047_decode_word): use libunicode iconv
- functions rather than libc ones (since libc might not have them).
- (header_decode_date): add autoconfiscation on timezone code
-
- * camel.c (camel_init): call unicode_init ()
-
-2000-04-20 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-summary.c (message_struct_new): Trim
- leading/trailing spaces off the raw headers.
-
- * MERGE NEW_PARSER branch into HEAD, fixed conflicts.
-
- * gmime-content-field.c (_print_parameter): Duh, removed again
- (@@#$@ cvs merge).
-
- * camel-mime-utils.c (header_content_type_is): Constify.
- (header_content_type_unref): Killed a couple warnings.
-
- * camel-folder.c (_init): Removed more log crap.
-
- * providers/Makefile.am (SUBDIRS): Removed nntp, pending fixes for
- summary changes.
-
- * providers/mbox/camel-mbox-folder.c (_get_message_by_number):
- Fixed for new summary interface. Added a warning for using this
- broken api.
- (_get_message_by_uid): Fixed for message new with session
- vanishing.
-
-2000-04-19 Dan Winship <danw@helixcode.com>
-
- * camel-simple-data-wrapper-stream.c
- (camel_simple_data_wrapper_stream_get_type): This is a subtype of
- CamelSeekableStream, not CamelStream.
-
- * camel-seekable-substream.c: clean up a lot.
- (eos): When testing for end-of-stream, reset the parent position
- before testing if it is at end-of-stream, since either (a) it may
- have been seek'ed to eos by someone else, or (b) we may have been
- seek'ed away from eos and it hasn't been synced yet.
-
- * camel-medium.[ch] (camel_medium_add_header): const poison.
- (Belatedly goes with my change of 2000-02-23.)
- (camel_medium_init): Use g_strcase_{hash,equal} on the header
- array.
-
-2000-04-18 Dan Winship <danw@helixcode.com>
-
- * 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.
-
- * camel-log.[ch], *: Nuke camel log stuff. Replace calls to
- CAMEL_LOG_WARNING with calls to g_warning.
-
- * 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.
-
-2000-04-17 Dan Winship <danw@helixcode.com>
-
- * camel-mime-message.[ch]: Remove the "session" field from
- CamelMimeMessage. Nothing uses it, about half of the existing
- calls to camel_mime_message_new_with_session pass NULL, and
- there's no obvious reason for it to be there.
-
- * providers/MH/camel-mh-folder.c:
- * providers/maildir/camel-maildir-folder.c:
- * providers/mbox/camel-mbox-folder.c:
- * providers/mbox/camel-mbox-utils.c:
- * providers/nntp/camel-nntp-folder.c:
- * providers/pop3/camel-pop3-folder.c: Use camel_mime_message_new
- instead of camel_mime_message_new_with_session.
-
- * camel-session.c (get_store_for_protocol_with_url): Set the
- exception if no provider is found.
-
- * camel-url.c: Add code to encode and decode %-escapes in URLs,
- and do some additional correctness-checking on URL syntax. From
- Tiago Antào with modifications by me.
-
-2000-04-14 Chris Toshok <toshok@helixcode.com>
-
- * providers/Makefile.am (SUBDIRS): add nntp
-
-2000-04-14 Christopher James Lahey <clahey@helixcode.com>
-
- * providers/mbox/camel-mbox-folder.c: Fix switch statement.
-
-2000-04-14 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-folder.c (_exists): always return TRUE
- for now. we need to check the server response to make sure the
- group exists.
- (_get_message_by_uid): make sure to account for the \n we add to
- the string after every line.
-
- * providers/nntp/camel-nntp-utils.c (get_XOVER_headers): function
- to get the headers using the XOVER command.
- (get_HEAD_headers): function to get the headers using the HEAD
- command on each message. slooooooow.
- (camel_nntp_get_headers): make this function use either XOVER or HEAD
- versions depending on whether or not the server extension is present.
-
-2000-04-14 Dan Winship <danw@helixcode.com>
-
- * camel-formatter.[ch]: This didn't belong in Camel. Move to mail/
-
- * Makefile.am, camel-types.h: remove references to
- camel-formatter.
-
-2000-04-12 Matt Loper <matt@helixcode.com>
-
- * camel-folder-pt-proxy.c (_folder_open_cb): Print warning message
- for broken function.
- (_folder_close_cb): Same.
-
-2000-04-12 Miguel de Icaza <miguel@gnu.org>
-
- * Makefile.am (pthread_SRC): Use correct names for the pthread
- source variables.
-
-2000-04-10 Dan Winship <danw@helixcode.com>
-
- * providers/pop3/camel-pop3-store.c (pop3_connect): fix various
- bugs in APOP code (still untested) and some of the error cases.
-
- * camel-provider.h: Clarify what provider.protocol, provider.name,
- and provider.description should be.
-
- * providers/mbox/camel-mbox-provider.c:
- * providers/pop3/camel-pop3-provider.c:
- * providers/sendmail/camel-sendmail-provider.c:
- * providers/smtp/camel-smtp-provider.c: update protocols, names,
- and descriptions
-
- * providers/mbox/camel-mbox-folder.c (_get_message_by_number):
- implement get_message_by_number for the mail fetch code.
-
-2000-04-09 Jeffrey Stedfast <fejj@stampede.org>
-
- * providers/smtp/camel-smtp-transport.c: reformatted to fit
- the standard indent format used by helix code
-
-2000-04-09 Dan Winship <danw@helixcode.com>
-
- * camel-movemail.c: New file with new function to dot-lock an mbox
- file and copy it to a safe private directory.
-
-2000-04-08 Christopher James Lahey <clahey@helixcode.com>
-
- * providers/smtp/.cvsignore: Added a .cvsignore file.
-
-2000-04-08 Dan Winship <danw@helixcode.com>
-
- * providers/sendmail/camel-sendmail-transport.c (_send_internal):
- actually record the pid returned by fork(). Noticed by clahey.
-
- * providers/smtp/camel-smtp-transport.c: #include <sys/param.h>
- for MAXHOSTNAMELEN. (This is a stopgap: some of the uses of
- MAXHOSTNAMELEN are wrong anyway...)
-
-2000-04-07 Jeffrey Stedfast <fejj@stampede.org>
-
- * providers/smtp/camel-smtp-transport.c: fixes to numerous bugs;
- should now build fine.
- * providers/Makefile.am: Readded smtp now that smtp builds without
- error.
-
-2000-04-20 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-summary.c
- (camel_mbox_summary_next_uid): Public function to get the next
- uid, makes sure its saved to disk too.
-
- * camel-mime-part.c (my_finalize): Fix disposition crap with a
- real disposition.
- (my_set_disposition): Likewise.
- (my_get_disposition): And here.
- (my_write_to_stream): And here, needs more cleanup.
-
- * providers/mbox/camel-mbox-folder.c (_append_message): Assign a
- new uid at this point.
-
- * gmime-content-field.c (gmime_content_field_write_to_stream):
- Make something up if we have an invalid/missing content type
- (i.e. text/plain).
-
-2000-04-19 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-folder.c (_delete): Fixed completely
- broken switch() syntax, only compiled because errno is a macro on
- some systems.
- (_list_subfolders): Likewise.
-
-2000-04-18 NotZed <NotZed@HelixCode.com>
-
- * camel-mime-parser.c (folder_scan_init): init stream to null.
-
- * providers/mbox/camel-mbox-summary.c
- (CAMEL_MBOX_SUMMARY_VERSION): Moved to .c file, incremented.
- (index_folder): Changed to have index passed via the summary.
- (decode_string): Do a sanity check on the string size, so we dont
- visit g_malloc()'s friendly abort().
-
- * camel-folder-pt-proxy.c (camel_folder_pt_proxy_class_init):
- Removed reference to set_name.
- (_set_name): Removed.
-
- * providers/mbox/camel-mbox-utils.c
- (parsed_information_to_mbox_summary): Removed. Most of this file
- is about to be binned.
-
- * providers/mbox/camel-mbox-search.c (func_header_contains): Fixes
- for changes to summary interface.
- (struct _searchcontext): Remove pointer to message info, get it
- straight from the mboxsummary.
- (camel_mbox_folder_search_by_expression): New summary interface.
- (camel_mbox_folder_search_by_expression): Uh, the summary is not
- an object anymore (well not yet).
-
- * providers/mbox/camel-mbox-folder.c
- (camel_mbox_folder_class_init): Removed set_name init.
- (_set_name): Removed.
- (_open): Call new summary interface.
- (_close): Use new summary interface.
- (_create): Removed a summary object leak.
- (_get_message_count): New summary interface.
- (_get_uid_list): Use new summary interface. FIXME: this is leaky.
- (_get_message_by_uid): Use the new summary interface, some
- cleanup.
- (_append_message): Totally changed, basically just appends the
- message directly, ignores the summary (for now), the summary will
- fix itself up if it needs to.
- (_check_get_or_maybe_generate_summary_file): Bye bye old code.
- (summary_get_message_info): Implement get_message_info again, for
- folder.
-
- * camel-folder.c (camel_folder_class_init): Removed set_name
- setup.
- (_set_name): Moved contents into _init.
- (_init): Perform the old functions of set_name here.
-
- * camel-folder.h: Removed the set_name internal interface.
-
-2000-04-14 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-summary.[ch]: Completely replaced with
- new code.
-
- * Makefile.am (libcamel_la_SOURCES): Removed
- camel-folder-summary.[ch].
-
- * camel-folder.h (struct _CamelFolder): Removed summary.
- (struct _CamelFolder): Changed flags to be 1 bit bitfields.
-
- * camel-folder-summary.[ch]: Class removed entirely.
-
- * camel-folder.c (camel_folder_get_summary): Removed.
- (camel_folder_summary_get_message_info): Moved from
- camel-folder-summary.c
- (camel_folder_summary_get_subfolder_info): Moved from
- camel-folder-summary.c
-
- * camel-mime-parser.c (folder_scan_step): Store the start of
- headers and start of from in the scan state.
- (camel_mime_parser_tell_start_headers): Query the start of the
- headers.
- (camel_mime_parser_tell_start_from): Query the cached start of
- from marker.
-
-2000-04-13 NotZed <NotZed@HelixCode.com>
-
- * gmime-content-field.c (gmime_content_field_free): Removed this
- function. If its too dangerous to use, it shouldn't be here.
- (gmime_content_field_ref): Also ref the embedded content-type.
- (gmime_content_field_unref): Ditto to unref it.
-
- * camel-mime-utils.h: Add a refcount for content-type header.
-
- * camel-mime-utils.c (header_content_type_unref): Implement unref
- for content-type.
- (header_content_type_ref): Implement ref for header content type.
-
-2000-04-12 NotZed <NotZed@HelixCode.com>
-
- * gmime-content-field.h: Changed to use a _header_content_type.
- Added type/subtype back for compatability with clients.
-
- * gmime-content-field.c: Basically a total rewrite, and now just a
- thin wrapper ontop of header_content_type.
- (_free_parameter): Got rid of it.
- (gmime_content_field_new): Use header_content_type_* functions.
- (gmime_content_field_set_parameter): Likewise.
- (_print_parameter): Blow away.
- (gmime_content_field_write_to_stream): Get details from the
- content_type field. Should check if it needs to escape chars in
- the paramter value.
- (gmime_content_field_get_mime_type): Likewise.
- (___debug_print_parameter): Get rid of this rather annoyingly
- named function.
- (gmime_content_field_get_parameter): Simplified function.
- (gmime_content_field_construct_from_string): Fixed this to use a
- real parser.
- (gmime_content_field_is_type): New function to test if a type matches.
- (gmime_content_field_construct_from_string): Track type/subtype
- from subordinate content_type header struct.
-
- * gmime-rfc2047.[ch]: Removed. Unused.
-
- * camel-stream-b64.[ch]: Blown away more duplicated code.
-
- * Makefile.am: Removed camel-stream-b64.[ch], and
- gmime-base64.[ch].
-
- * camel-mime-part.c (my_get_content_object): Replaced
- camel-stream-b64 with camel-stream-filter/camel-mime-filter-basic.
- (my_write_content_to_stream): Replaced camel-stream-b64 with the
- camel-stream-filter with an encoder.
- (my_get_content_object): Also implement quoted-printable decoding.
- (my_write_content_to_stream): Also implement quoted-printable
- encoding.
- (my_get_output_stream): Took out stream-b64 code (nothing's being
- executed yet anyway).
-
- * gmime-base64.[ch]: Blown away. Not used, dont need it.
-
- * camel-mime-utils.h: Added offset for this header. Records where
- it is in the source.
-
- * camel-mime-utils.c (header_raw_append_parse): Add offset
- parameter, to store where the header is stored in the stream.
- (header_raw_append): Added offset param.
- (header_raw_find): Return offset, if a pointer supplied for it.
- (header_raw_replace): Add offset param.
- (header_content_type_new): New function, to create an empty
- content type.
- (header_content_type_set_param): Set a parameter in the
- content-type.
- (header_set_param): Generic header parameter setting function.
- (header_decode_string): Handle NULL input.
-
- * camel-mime-parser.c (camel_mime_parser_headers_raw): New
- function to get access to all the raw headers.
- (folder_scan_header): Keep track of the header start position, and
- store it when saving the header.
-
-2000-04-11 NotZed <NotZed@HelixCode.com>
-
- * camel-mime-utils.c: Moved a bunch of printf's to debug.
-
- * camel-mime-parser.c: Moved a bunch of printf's to debug.
- (folder_scan_header): Detect end of each header line using the
- last scanned char, and not the last scanned position.
-
- * camel-mime-filter-index.[ch]: Indexing filter. Indexes unicode
- sequences into ibex files.
-
-2000-04-09 NotZed <NotZed@HelixCode.com>
-
- * camel-mime-part.c: Dont include gmime-base64.h
-
- * camel-mime-filter-charset.c (complete): Implement the completion
- function.
-
- * camel-mime-parser.c (folder_scan_step): If we get to the end of
- the body data, check any filters for outstanding completion data.
- (camel_mime_parser_scan_from): Set whether we scan for "From "
- headers or not.
-
- * camel-stream-filter.c (do_read): If we get to end of stream on
- the source, then call the filtering completion function to see if
- we have any more data to return.
-
- * camel-mime-filter-basic.c (filter): Implement quoted printable
- encoding and decoding filters.
- (complete): And the complete function as well.
-
- * camel-mime-utils.c (base64_encode_close): Also take an input
- buffer, allow closing of filters.
- (quoted_encode_step): First cut, simple quoted-printable encoder.
- Doesn't handle trailing spaces/tabs on end of line properly yet.
- (quoted_encode_close): Complete a quoted-encoding.
- (is_qpsafe): New type check, for quoted-printable safe characters
- (that do not need encoding). Thats all bits used in the type
- table! Rebuilt the types table.
- (header_content_type_is): Checks a content type against at
- type/subtype match.
- (header_content_type_param): Handle NULL content type pointer.
-
-2000-04-08 NotZed <NotZed@HelixCode.com>
-
- * camel-mime-filter-basic.c (filter): Implement the base64
- encoder. Problem is, there is no way to know when to close it.
- Close/Reset will have to provide the same args as filter, so it can
- flush remaining data *sigh*
-
- * camel-mime-utils.c (base64_encode_step): A rather complex base64
- encoder, fast?
- (base64_step_close): Companion function to finish off the base64
- sequence.
-
- * camel-mime-part.c (my_write_content_to_stream): Changed to use
- camel_stream_write_to_stream().
-
- * camel-stream.[ch] (camel_stream_write_to_stream): From
- camel_stream_b64_write_to_stream(). Fixed some infinite loop
- bugs with error conditions.
-
- * camel-stream-b64.[ch] (camel_stream_b64_write_to_stream): Removed.
- This has nothing to do with stream-b64, so i've moved it to
- CamelStream.
-
- * camel-mime-utils.h: Add a comment about refcounting
- header_content_type struct.
-
- * Makefile.am: Added camel-stream-filter*.[ch].
-
- * camel-stream-filter.[ch]: Class to implement a generic
- (multipass) filter ontop of a stream. Only implements a read-only
- stream.
-
- * camel-mime-parser.c (camel_mime_parser_filter_add): Ref the
- filter we just added.
-
- * Makefile.am: Added camel-mime-filter*.[ch].
-
- * camel-mime-filter-charset.[ch]: A filter to preform character set
- conversion (uses unicode_iconv).
-
- * camel-mime-filter-save.[ch]: A simple filter which will save all
- data directly to a file or file descriptor.
-
- * camel-mime-filter-basic.[ch]: Implements the basic mime filters,
- base64 and quoted-printable decoding (encoding not implemented yet).
-
- * camel-mime-filter.[ch]: A filtering class, which can filter streams
- of data without having to copy them. Simpler than stream classes,
- and can be plugged into a single stream class (when i write it).
-
-2000-04-07 Dan Winship <danw@helixcode.com>
-
- * providers/pop3/camel-pop3-store.c (pop3_connect): Clarify error
- messages.
- (finalize): fix a bug in camel_exception usage
- (pop3_connect): Remember the password after asking for it the
- first time.
-
-2000-04-07 NotZed <NotZed@HelixCode.com>
-
- * Makefile.am: Added camel-mime-parser/camel-mime-utils.
-
- * camel-mime-parser.c: Fast mime parser.
-
- * camel-mime-utils.c: Mime utility functions, and email header
- parsers.
-
-2000-04-07 NotZed <NotZed@HelixCode.com>
-
- * providers/Makefile.am: Removed smtp for now, its a long way from
- building.
- * providers/smtp/Makefile.in: Removed file that shouldn't have been
- checked in.
-
-2000-04-06 Matt Loper <matt@helixcode.com>
-
- * camel-folder-pt-proxy.c (_get_full_name): Remove exception param
- from get_full_name() called, since get_full_name() was changed to
- not have an exception in the last param (see dan's notes below).
- (_get_name): same.
-
-2000-04-06 Dan Winship <danw@helixcode.com>
-
- * camel-store.[ch]: Reorganize the folder-fetching methods and
- implement a folder cache so that multiple requests for the same
- folder will yield the same CamelFolder object (as long as it
- remains active). Includes some code to remove no-longer-active
- folders from the cache, but it doesn't get used since nothing is
- ever unref'ed in Camel right now...
-
- * providers/mbox/camel-mbox-store.c:
- * providers/pop3/camel-pop3-store.c: update for CamelStore
- changes.
-
- * camel-folder.[ch]: Remove the (unused) CamelException argument
- from camel_folder_get_name and camel_folder_get_full_name.
- (camel_folder_set_name): make this go away since changing a
- folder's name after it has been created could result in it
- conflicting with a separately-issued folder.
-
-2000-04-05 Dan Winship <danw@helixcode.com>
-
- * g_url_new really wanted to take a CamelException. So, rename
- Gurl to CamelURL, g_url_* to camel_url_* (with camel_url_new
- taking an exception), and url-util.[ch] to camel-url.[ch]. Also
- force url->port to be numeric and remove camel_service_getport. (I
- was confused before: the URL RFC says the port must be numeric, so
- we don't want to do getportbyname.)
-
-2000-04-01 Dan Winship <danw@helixcode.com>
-
- * providers/mbox/camel-mbox-folder.c
- (_check_get_or_maybe_generate_summary_file): Compare
- mbox_file_size and mbox_modtime to the results of stat()ing the
- mbox file, not the summary file. Duh.
- (_close): Update the summary's mbox_file_size and mbox_modtime
- before writing it to disk.
-
- * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_save,
- camel_mbox_summary_load): Wow. I must have been tired when I wrote
- this code. First, the comparison bug above. Second, it was using
- ntohs and htons instead of ntohl and htonl. Third, I was reading
- the status flag byte in two different places and thus getting out
- of sync. Fourth, it was writing out field_length bytes of each
- header field after having converted field_length to network byte
- order, resulting in lots of random crap being appended, and the
- summary files being huge. (Fortunately, since the size/modtime
- comparison was biffed, the garbage summary read from disk was
- always immediately discarded.)
-
- * providers/mbox/camel-mbox-parser.c (camel_mbox_parse_file): fix
- an off-by-one error that caused the last-used UID to be reused if
- the summary file was regenerated. (That one wasn't my fault. :-)
-
-2000-03-31 Dan Winship <danw@helixcode.com>
-
- * camel-stream-mem.c: implement unimplemented methods
-
- * gmime-content-field.c
- (gmime_content_field_construct_from_string):
- * data-wrapper-repository.c
- (data_wrapper_repository_get_data_wrapper_type):
- * camel-simple-data-wrapper.c (my_write_to_stream):
- * camel-mime-part.c (my_set_input_stream):
- remove debugging printf()s that no longer seem useful.
-
-2000-03-31 Matt Loper <matt@helixcode.com>
-
- * camel-formatter.c (text_to_html): Added "convert_newlines_to_br"
- boolean param, to give the option of not converting '\n's to <br>
- tags. This way, when we stick stuff in a <pre> tag, newlines stay
- newlines.
-
-2000-03-30 Matt Loper <matt@helixcode.com>
-
- * camel-formatter.c (handle_text_plain): Use <pre> tag to force
- the use of monospaced fonts.
-
-2000-03-30 Dan Winship <danw@helixcode.com>
-
- * camel-service.c (camel_service_getport): Add a htons in the
- default_number case, and document the fact that the function
- returns the port in network byte order.
-
- * providers/pop3/camel-pop3-store.c (pop3_connect): Revert
- Miguel's change. The port number bug was actually somewhere
- else, and the IP address copying code was fine already.
-
-2000-03-29 Miguel de Icaza <miguel@gnu.org>
-
- * providers/pop3/camel-pop3-store.c (pop3_connect): Add htons
- (port), and only copy 4 bytes for the IP address to prevent a DNS
- attack.
-
-2000-03-28 Dan Winship <danw@helixcode.com>
-
- * camel-seekable-substream.c
- (camel_seekable_substream_new_with_seekable_stream_and_bounds):
- make this return a CamelStream rather than a
- CamelSeekableSubstream, because that's the way Gtk objects tend to
- work.
-
- * camel-service.c (camel_service_gethost,
- camel_service_getport): convenience functions to canonicalize
- the host and port values of a service's URL.
- * providers/pop3/camel-pop3-store.c: use them
-
- * providers/mbox/camel-mbox-folder.c
- (_check_get_or_maybe_generate_summary_file): Make this work when
- the inbox file doesn't yet exist.
-
-2000-03-27 Dan Winship <danw@helixcode.com>
-
- * providers/mbox/camel-mbox-folder.c (_append_message): uncomment
- the call to unlink the temp file: there's no way to tell
- camel_stream_fs to truncate a file, so reusing the same file was
- resulting in junk at the ends of messages.
-
- * camel-folder.[ch]: add delete_message_by_{number,uid}.
-
- * providers/pop3/camel-pop3-folder.[ch]: implement
- delete_message_by_uid. Add a close method to do expunging
- of deleted messages if requested.
-
- * providers/pop3/camel-pop3-store.[ch]: support for
- CamelPop3Folder::close. (You have to close the connection
- in order to expunge the folder, thus the store may be
- connected in the CamelService::is_connected sense when it
- is not actually connected to the server.) Also some bugfixes.
-
-2000-03-27 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-folder.c (_append_message): Unref the
- output_stream when done, close doesn't do it.
- (_append_message): Clear all uid's from the appending messages, so
- they are reassigned proper unique id's.
-
- * gmime-utils.c (get_header_array_from_stream): Actually free the
- header, it is copied elsewhere.
-
-2000-03-26 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-utils.c (camel_mbox_write_xev): Added
- folder parameter to function. Fixed callers.
- (index_message): Index a message as it is assigned a unique id.
-
- * camel-mime-part.c (my_set_content_id): Make sure we malloc and
- copy the content_id, otherwise *poof*
-
-2000-03-25 NotZed <NotZed@HelixCode.com>
-
- * camel-medium.c (_finalize): Another leak, unref the content if
- finished with it.
-
- * camel-recipient.c (camel_recipient_table_free): Plug another
- memory leak - actually free the recipient table.
-
- * camel-mime-message.c (_finalize): Plugged a memory leak with the
- flags table.
-
- * gmime-utils.c (_store_header_pair_from_string): A simpler, more
- debuggable and functionally identical header extraction function.
-
-2000-03-24 NotZed <NotZed@HelixCode.com>
-
- * gmime-content-field.c (gmime_content_field_set_parameter):
- Remove the hash table entry before freeing its key and data.
-
-2000-03-27 Dan Winship <danw@helixcode.com>
-
- * providers/Makefile.am (SUBDIRS): Add pop3.
-
- * providers/pop3/camel-pop3-store.c: keep separate input and
- output streams so the output doesn't end up being buffered.
-
- * providers/pop3/camel-pop3-folder.c (get_message_by_number):
- finish implementing this.
-
-2000-03-27 Michael Meeks <michael@helixcode.com>
-
- * camel-mime-part.c (my_set_disposition): fix so less broken.
- (my_finalize): remove dodgy disposition free.
-
- * camel-data-wrapper.c (my_set_mime_type_field): unref instead of
- free on mime_type.
-
-2000-03-27 Dan Winship <danw@helixcode.com>
-
- * camel-service.c (camel_service_free_auth_types): new routine to
- free the data allocated by camel_service_query_auth_types.
-
- * providers/pop3/camel-pop3-store.c (free_auth_types): implement
-
- * camel-stream-mem.c (camel_stream_mem_new_with_buffer): rename
- camel_stream_mem_new_with_buffer to ..._with_byte_array and add a
- new ..._with_buffer that takes a char * rather than a GByteArray.
-
- * Remove CamelStreamBufferedFs, since CamelStreamBuffer makes it
- redundant.
-
-2000-03-25 Dan Winship <danw@helixcode.com>
-
- * camel-folder-summary.[ch]: change the CamelFolderSummary
- interfaces to allow partial summary queries (for dealing
- with very large folders). Remove the "extended_fields" from
- CamelFolderInfo and CamelMessageInfo: this is better dealt
- with by subtyping.
-
- * providers/mbox/camel-mbox-summary.[ch]: Make CamelMboxSummary a
- subclass of CamelFolderSummary. Update interfaces for that. Remove
- the internal/external summary distinction. Remove the (unused) md5
- checksum in the folder summary. Change the summary file format
- (primarily to make it no longer byte-order dependent) and add a
- version number to it so it will be easier to change in the future.
-
- * providers/mbox/camel-mbox-folder.[ch]
- * providers/mbox/camel-mbox-search.c
- * providers/mbox/camel-mbox-utils.c: update for summary changes
-
- * camel-exception-list.def: add
- CAMEL_EXCEPTION_FOLDER_SUMMARY_INVALID
-
-2000-03-23 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-provider.c: Added flag to provider
- initialisation, to match changed structure.
-
-2000-03-22 NotZed <NotZed@HelixCode.com>
-
- * camel-folder.[ch]: Added async search api.
-
- * providers/mbox/camel-mbox-search.c
- (camel_mbox_folder_search_by_expression): Changed to use an
- asynchronous interface.
- (camel_mbox_folder_search_cancel): Cancel function for async
- interface.
-
-2000-03-23 Dan Winship <danw@helixcode.com>
-
- * camel-stream-buffer.c (camel_stream_buffer_read_line): Function
- to read one line of any size from a stream and return it in
- allocated memory.
-
-2000-03-22 Dan Winship <danw@helixcode.com>
-
- * camel-service.c (camel_service_query_auth_types): New function
- to query a service for the authentication protocols it supports.
- * providers/pop3/camel-pop3-store.c (query_auth_types): implement
-
- * camel-provider.c (camel_provider_scan): New function to
- scan the provider dir and return a list of all providers.
-
- * providers/pop3/camel-pop3-folder.c: fill this in partially
- * providers/pop3/camel-pop3-store.c: make camel_pop3_command
- return the text after "+OK"/"-ERR" and add a separate
- camel_pop3_get_additional_data to get the message body or
- whatever. Also make them take a CamelPop3Store rather than
- a CamelStreamBuffer.
-
-2000-03-22 Matt Loper <matt@helixcode.com>
-
- * camel-formatter.c (debug): Disabled some useless debug
- messaging.
-
-2000-03-21 Dan Winship <danw@helixcode.com>
-
- * providers/pop3: some initial bits of the POP3 provider, to
- make Matt happy. Incomplete, untested, etc.
-
-2000-03-21 bertrand <bertrand@helixcode.com>
-
- * providers/mbox/camel-mbox-summary.c
- (camel_mbox_summary_append_internal_to_external): copy the size field
-
- * providers/mbox/camel-mbox-folder.c (_get_message_by_uid): initialize
- message_info to NULL
-
- * camel-folder-summary.h: added the size field.
-
- * providers/mbox/camel-mbox-summary.h:
- added the received_date field.
-
- * providers/mbox/camel-mbox-summary.c:
- documented all functions.
-
- * camel-folder-summary.h: name change and
- new fields.
-
- * providers/mbox/camel-mbox-search.c: update to
- conform to name change in the summary fields.
-
-2000-03-10 bertrand <bertrand@helixcode.com>
-
- * camel-service.h: cosmetic changes.
-
-2000-03-09 Dan Winship <danw@helixcode.com>
-
- * s/HelixCode/Helix Code, Inc./ in the copyrights
-
-2000-03-07 bertrand <bertrand@helixcode.com>
-
- * camel-formatter.c (handle_mime_part):
- plug mem leaks due to bad documentation
- of camel_content_field_get_mime_type
- (print_camel_body_part): idem
- (handle_multipart_alternative): idem
-
- * gmime-content-field.c (gmime_content_field_get_mime_type):
- documentation fix.
-
-
- * camel-mime-part.c (my_finalize): unref the
- content_input_stream if any.
-
-2000-03-06 bertrand <bertrand@helixcode.com>
-
- * camel-stream-fs.c (_seek): fix a bogus calculation
- in the return position.
-
-2000-03-05 bertrand <bertrand@helixcode.com>
-
- * camel-session.h: cosmetic fixes.
-
- * camel-stream-fs.c (_read):
- (_seek): fixed the current position so that it refers
- to the current position in the stream, not in its parent.
-
-2000-03-04 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-search.c
- (camel_mbox_folder_search_by_expression): Ref the summary
- after we have got it.
-
-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.
-
- * camel-formatter.c (get_bonobo_tag_for_object):
- bonobo-goad-id is the good key to look for.
- (get_bonobo_tag_for_object): close the <object> tag.
- (get_bonobo_tag_for_object): the correct syntax for the
- to set a parameter inside an <object> tag is :
- <object classid="..."> <param name="uid" value="..."> <param ...>
- </object>
-
-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.
-
-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*
-
-2000-02-29 NotZed <NotZed@HelixCode.com>
-
- * Makefile.am (libcamelinclude_HEADERS): Added camel-stream-buffer
- to build.
-
- * camel-stream-buffer.[ch]: Generic buffer which can be applied to
- any stream.
-
-2000-03-03 bertrand <bertrand@helixcode.com>
-
- * camel-formatter.c (handle_image): in the case
- of images, put the content object output stream
- in the url. This allows the message browser
- to show inline images.
-
- * camel-stream-b64.c (my_read_encode): fixed state
- 0 keep value.
-
-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.
-
- * camel-stream-b64.c (camel_stream_b64_write_to_stream):
- use CamelStreamB64 type for the input stream.
-
- * camel-mime-part.c (_get_content_object): remove
- debugging trace
- (_write_content_to_stream): implement the b64
- encoding the new way (that is using camel_stream_b64)
-
- * 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.
-
-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.
-
- * gmime-utils.c (_store_header_pair_from_string):
- revert strange changes.
-
- * camel-stream-b64.c (my_read_decode): set eos to true when we
- have read the whole input stream.
- (my_reset): set eos to FALSE.
-
-2000-02-28 NotZed <NotZed@HelixCode.com>
-
- * camel-mime-part.c (_parse_header_pair): Dont free this either.
-
- * camel-medium.c (_remove_header): Ugh, dont free the header
- before we actually remove it.
- (_add_header): Ugh, dont free hashtable entries which may be
- duplicated (hash_insert _will_ reference that memory).
-
- * string-utils.c (string_trim): Trimming a 0-length string is not
- an error.
-
- * camel-mime-message.c (_parse_header_pair): Fixed very broken
- memory handling of header_name/value.
-
- * providers/mbox/camel-mbox-utils.c (camel_mbox_write_xev):
- Initialise end_of_last_message always.
- (camel_mbox_copy_file_chunk): Stop trying to read if we run out of
- data, rather than looping forever.
- (camel_mbox_write_xev): Use an open flag when opening with create.
-
- * camel-folder.c (camel_folder_search_by_expression): No, its not
- a fatal error to search on a non-searchable folder, you just dont
- get any matches.
- (_open): Dont open an opened folder (i dont see why this is really
- a bug, but what the hell ...)
-
- * providers/mbox/camel-mbox-folder.c (_init): Set search cap on.
- (_open): Call parent class to perform open. Remove folder-open
- check to parent instead.
- (_create): open takes a creation mask, dont use umask to try and
- set the open mode.
- (_delete): Dont bother checking folder==NULL, its already been
- checked on the external interface (changed to an assertion, this
- would have to be a camel bug).
- (_delete_messages): Likewise.
- (_create): Ditto.
- (_init): Dont go and clear all the paths and shit that the parent
- open just setup for us.
- (_delete_messages): Get rid of more umask stuff.
- (_append_message): Make sure we pass file mode to open with create.
- (_append_message): Cleaned up some indenting to make it readable.
-
- * camel-stream-b64.c (my_read_encode): Fixed a typo.
-
- * providers/mbox/camel-mbox-search.c: Changed to use e-sexp,
- rather than filter-sexp.
-
-2000-02-28 bertrand <bertrand@helixcode.com>
-
- * camel-stream-b64.c (my_read_encode): encoding
- filter.
-
-2000-02-23 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel-stream-b64.c: changed the __static
- suffix into a my_ prefix.
- (camel_stream_b64_set_mode): reset the persistent
- status.
- (my_read_decode): remove superfluous %
-
- * providers/mbox/camel-mbox-utils.c (camel_mbox_copy_file_chunk):
- fix exception description message.
-
-2000-02-24 Dan Winship <danw@helixcode.com>
-
- * camel-session.c: Add camel_session_get_transport_for_protocol.
-
- * camel-transport.h:
- * camel-transport.c: Add an abstract CamelTransport class.
-
- * providers/sendmail/*: A CamelTransport that uses sendmail
- to deliver mail.
-
-2000-02-24 Dan Winship <danw@helixcode.com>
-
- * camel-folder.c: use CamelExceptions for run-time errors, not
- incorrect code. Don't bother validating that an object exists from
- inside one of its methods, since you couldn't have gotten there if
- it didn't. Fix some code style bugs.
-
- (_init): Rename init_with_store to init and add parent_folder,
- separator, and name arguments.
- (_set_name): Get separator from self, not parent_store now.
-
- * camel-store.h:
- * camel-store.c: Remove get/set_separator.
-
- * providers/mbox/: Update for above.
-
-2000-02-23 Dan Winship <danw@helixcode.com>
-
- * 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.
-
-2000-02-22 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-search.c: Dont compile by default.
-
- * providers/mbox/Makefile.am: Fuck off the filter code.
-
-2000-02-22 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel-stream-b64.c (read_decode__static):
- don't read the char if we reached the length
- of the output buffer. Hours lost on this
- %$!@# bug : 3.5
-
- * camel-folder.c (camel_folder_get_subfolder):
- (camel_folder_create):
- (camel_folder_delete):
- (camel_folder_delete_messages):
- (camel_folder_list_subfolders):
- (camel_folder_expunge):
- (camel_folder_get_message_by_number):
- (camel_folder_get_message_count):
- (camel_folder_append_message):
- (camel_folder_copy_message_to):
- (camel_folder_get_summary):
- (camel_folder_get_message_uid):
- (camel_folder_get_message_by_uid):
- (camel_folder_get_uid_list):
- Check folder state (open/close) and raise an
- exception if it is not ok.
-
- * providers/mbox/camel-mbox-folder.c (_create):
- create the file and the path with two different
- names.
-
- * camel-folder.c (_create): handle the case
- when the folder name starts with '/'
-
- * camel-exception.c (camel_exception_new): use
- (void) instead of () in decl.
-
- * camel-exception.h: cosmetic fixes.
-
- * camel-exception.c (camel_exception_init): new routine.
- Fix a bug in mail/message-list.c
-
-
- * camel-folder.h: cosmetic changes.
-
- * camel-stream-b64.c (reset__static): added a
- reset method. Thanks message-browser to find
- so much bugs :)
-
- * providers/mbox/Makefile.am (libcamelmbox_la_LIBADD): readd
- Unicode libs.
-
-2000-02-21 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel-formatter.c (lookup_unique_id):
- awful hack to test get_output_stream.
- * camel-stream-b64.[ch] :
- b64 encoding/decoding is now implemented as
- a stream.
-
-
-2000-02-21 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel-seekable-substream.c (_reemit_parent_signal):
- emit "data_available" when parent stream emits it.
-
-
-2000-02-21 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/Makefile.am: Uh, fixed LIBADD again. What was
- there was never ever going to work, wasn't it tested?
-
-
-2000-02-21 Dan Winship <danw@helixcode.com>
-
- * camel-session.h: (struct _CamelSession): Add authenticator.
-
- * camel-session.c (camel_session_new): Add authenticator.
- (camel_session_query_authenticator): New function to query the
- session authenticator for password, etc, information.
-
-2000-02-21 Dan Winship <danw@helixcode.com>
-
- * camel-session.c: add CamelExceptions to several functions. Use
- camel_session_new to initialize the session and URL fields of
- created CamelStores as appropriate.
-
- * camel-store.h:
- * camel-store.c
- * camel-service.h:
- * camel-service.c: Move the session and url (and associated
- functions) from CamelStore to CamelService. Add url_flags to
- CamelService so subclasses can specify which URL components
- are mandatory for them. Add camel_session_new for
- camel_session_get_store* to use.
-
- * providers/mbox/camel-mbox-folder.c:
- * providers/mbox/camel-mbox-store.c:
- * providers/mbox/camel-mbox-store.h: Update for above changes.
-
- * camel-exception-list.def: Once camel is being used for real,
- exceptions won't be renumberable. So renumber them now to make
- more room to add exceptions to the various categories later, and
- add a big warning message.
-
-2000-02-20 Dan Winship <danw@helixcode.com>
-
- * providers/mbox/Makefile.am: add libibex back to
- libcamelmbox_la_LIBADD
-
-2000-02-18 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-search.h
- (camel_mbox_folder_search_by_expression): Added exception to call,
- and fixed caller.
-
- * providers/mbox/camel-mbox-search.c
- (camel_mbox_folder_search_by_expression): Major changes, to use
- the sexp evaluator from filter/filter-sexp.c to implement the
- searching.
- (func_body_contains): Changed to support multiple strings in 1
- command (results or'd together)
-
- * url-util.c (g_url_new): Fixed a typo (colon == 0 isn't right),
- and made it so full url's are absolute pathed (Dan, this is how it
- has to work!). Also, always include a path part, even if it is an
- empty string.
-
-2000-02-18 Dan Winship <danw@helixcode.com>
-
- * camel/camel-types.h: New header with the typedefs for all camel
- classes. Now the class headers can just include this and the
- header for the parent type. This makes it possible for
- CamelService to include a CamelSession without creating an
- #include loop.
-
- * camel/*:
- * composer/e-msg-composer-attachment-bar.h:
- * mail/folder-browser.c:
- * mail/message-list.c: frob #includes to match the new reality
-
-2000-02-17 Dan Winship <danw@helixcode.com>
-
- * camel/camel-service.h:
- * camel/camel-service.c: Make camel-service us a Gurl internally.
- Remove the login/password interfaces and instead provide
- camel_service_connect_with_url. Add CamelExceptions
-
-2000-02-17 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-formatter.c (handle_text_plain):
- (handle_text_html): use camel_stream_reset instead
- of seek. The formatter should be able to work
- with all streams, not only seekable streams.
- In the case where some provider implementation
- would not be able to provide a reset method
- to their stream, implementors would have
- to find a workaround.
-
- * camel/camel-session.c (camel_session_new): use
- (void) instean of () in function decl.
-
- * camel/camel-folder.c: ifdef async operation
- related code.
-
- * camel/camel-seekable-stream.c (_seek): added a warning.
- (_reset): default implementation of reset for seekable
- stream.
-
- * camel/camel-mime-message.h: set_received_date declaration fix.
- cosmetic changes.
-
- * camel/providers/mbox/camel-mbox-provider.c (camel_provider_module_init):
- use (void) instead of ().
-
- * camel/camel-stream.c (camel_stream_reset):
- new method for CamelStream.
-
-2000-02-17 Dan Winship <danw@helixcode.com>
-
- * camel/url-util.c (g_url_to_string): New function to convert
- a Gurl back into a char *.
-
-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.
-
-2000-02-16 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-data-wrapper.c (_set_input_stream): ref input stream
- (_set_output_stream): ref output stream
- (_finalize): unref input and output streams
-
- * 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 ().
-
-2000-02-16 NotZed <NotZed@HelixCode.com>
-
- * providers/mbox/Makefile.am (libcamelmbox_la_LIBADD): Added
- libfilter to link line (temporarily?). Required for
- filter-sexp.
-
-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.
-
-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
-
-2000-02-14 Miguel de Icaza <miguel@gnu.org>
-
- * camel/providers/mbox/Makefile.am (libcamelmbox_la_LIBADD): Add
- the unicode libraries as well.
-
- * camel/camel-provider.c (camel_provider_register_as_module): Add
- error reporting here. Desire to use Solaris increases. Hair loss
- in the last two hours: 5,400.
-
- * camel/providers/mbox/camel-mbox-provider.c
- (camel_mbox_get_provider): Renamed function.
-
- * camel/camel.h: All include files use camel/ now here.
-
- * camel/providers/mbox/Makefile.am: Drop all the dynamism from
- Camel, and make this a standard library.
-
-2000-02-14 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/gmime-utils.c (get_header_array_from_stream): use the
- eos stream method.
- (gmime_read_line_from_stream): ditto.
-
- * camel/camel-stream-fs.h (struct ): add the eof field
- cosmetics changes.
-
- * camel/camel-stream-fs.c (camel_stream_fs_init): set eof.
- (_read): set eof on end of file.
- (_eos): implemented.
-
- * camel/gmime-utils.c (get_header_array_from_stream):
- make a blocking version of the header parser.
- When the fs stream uses gnome-vfs, this should
- be changed.
- (gmime_read_line_from_stream): ditto.
-
-2000-02-11 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-stream-fs.c:
- everywhere, when using the cur_pos field, do it
- on the CamelSeekableStream object.
- (_seek): small fix.
-
- * camel/camel-seekable-stream.c (camel_seekable_stream_seek):
- s/camel_stream_seek/camel_seekable_stream_seek/g
-
- * camel/camel-seekable-stream.h:
- (struct ): added a field to store the
- current position.
-
- * camel/camel-seekable-stream.c (camel_seekable_stream_get_current_position):
- New function. Allows to get the current position
- of a seekable stream.
-
-
-2000-02-13 NotZed <notzed@zedzone.helixcode.com>
-
- * providers/mbox/camel-mbox-search.c: New file, implements the
- search api for mbox folders.
-
- * providers/mbox/Makefile.am: Link with ibex.
-
- * camel-folder.c (camel_folder_has_search_capability): Api
- additions.
- (camel_folder_search_by_expression): Ditto.
-
-2000-02-12 NotZed <notzed@zedzone.helixcode.com>
-
- * providers/mbox/camel-mbox-folder.c (_set_name): Setup index
- filename as well.
- (_init_with_store): Init index filename. Hmm, none of these
- names ever seem to get free'd (FIXME?)
-
- * providers/mbox/camel-mbox-folder.h: Add index file name.
-
-2000-02-12 NotZed <notzed@helixcode.com>
-
- * camel-folder.h: Add folder search functions.
-
- ** Created ChangeLog just for camel **
- - refer to ../ChangeLog for changes prior to this date.
diff --git a/camel/Makefile.am b/camel/Makefile.am
deleted file mode 100644
index a1b672ab13..0000000000
--- a/camel/Makefile.am
+++ /dev/null
@@ -1,131 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS = providers
-
-libcamelincludedir = $(includedir)/camel
-providerdir = $(libdir)/evolution/camel-providers/$(VERSION)
-
-lib_LTLIBRARIES = libcamel.la
-
-INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \
- -I$(top_srcdir)/intl \
- $(GTK_INCLUDEDIR) \
- $(UNICODE_CFLAGS) \
- -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" \
- -DG_LOG_DOMAIN=\"camel\"
-
-libcamel_la_SOURCES = \
- camel.c \
- camel-data-wrapper.c \
- camel-exception.c \
- camel-folder.c \
- camel-folder-search.c \
- camel-folder-summary.c \
- camel-medium.c \
- camel-mime-message.c \
- camel-mime-part.c \
- camel-mime-part-utils.c \
- camel-movemail.c \
- camel-multipart.c \
- camel-object.c \
- camel-provider.c \
- camel-seekable-stream.c \
- camel-seekable-substream.c \
- camel-service.c \
- camel-session.c \
- camel-simple-data-wrapper.c \
- camel-store.c \
- camel-stream.c \
- camel-stream-buffer.c \
- camel-stream-fs.c \
- camel-stream-mem.c \
- camel-transport.c \
- camel-url.c \
- gmime-content-field.c \
- gstring-util.c \
- hash-table-utils.c \
- md5-utils.c \
- string-utils.c \
- camel-mime-parser.c \
- camel-mime-utils.c \
- camel-mime-filter.c \
- camel-mime-filter-basic.c \
- camel-mime-filter-save.c \
- camel-mime-filter-charset.c \
- camel-mime-filter-index.c \
- camel-mime-filter-from.c \
- camel-stream-filter.c \
- camel-address.c \
- camel-internet-address.c
-
-libcamelinclude_HEADERS = \
- camel.h \
- camel-data-wrapper.h \
- camel-exception.h \
- camel-folder.h \
- camel-folder-search.h \
- camel-folder-summary.h \
- camel-medium.h \
- camel-mime-message.h \
- camel-mime-part.h \
- camel-mime-part-utils.h \
- camel-movemail.h \
- camel-multipart.h \
- camel-object.h \
- camel-provider.h \
- camel-seekable-stream.h \
- camel-seekable-substream.h \
- camel-service.h \
- camel-session.h \
- camel-simple-data-wrapper.h \
- camel-store.h \
- camel-stream.h \
- camel-stream-buffer.h \
- camel-stream-fs.h \
- camel-stream-mem.h \
- camel-transport.h \
- camel-types.h \
- camel-url.h \
- gmime-content-field.h \
- gstring-util.h \
- hash-table-utils.h \
- md5-utils.h \
- string-utils.h \
- camel-exception-list.def \
- camel-mime-parser.h \
- camel-mime-utils.h \
- camel-mime-filter.h \
- camel-mime-filter-basic.h \
- camel-mime-filter-save.h \
- camel-mime-filter-charset.h \
- camel-mime-filter-index.h \
- camel-mime-filter-from.h \
- camel-stream-filter.h \
- camel-address.h \
- camel-internet-address.h
-
-libcamel_extra_sources = \
- camel-arg-collector.c
-
-libcamel_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-EXTRA_DIST = \
- $(libcamel_extra_sources) \
- README
-
-#noinst_PROGRAMS = \
-# camel-mime-filter-from
-#
-#camel_mime_filter_from_SOURCES = \
-# camel-mime-filter-from.c
-#
-#camel_mime_filter_from_LDADD = \
-# ../camel/libcamel.la \
-# ../e-util/libeutil.la \
-# ../libibex/libibex.la \
-# $(GNOME_LIBDIR) \
-# $(GNOMEUI_LIBS) \
-# $(INTLLIBS) \
-# $(PTHREAD_LIB) \
-# $(EXTRA_GNOME_LIBS)
-
diff --git a/camel/README b/camel/README
deleted file mode 100644
index f020174d5e..0000000000
--- a/camel/README
+++ /dev/null
@@ -1,57 +0,0 @@
-
- CAMEL
-
-
- A generic Messaging Library
-
-
- ----
-
-
-Introduction:
--------------
-
-Camel will be a generic messaging library. It will evntually support
-the standard messaging system for receiving and sending messages.
-It aims at being the backend for the future gnome-mailer system.
-
-The name "camel" stands for ... nothing. Open area of development there.
-You know, that "bazaar" thing. Maybe could we organize a big contest on
-gnome-list to find the best explanation :)
-
-Camel draws heavily from JavaMail and the IMAP4rev1 RFC. People
-wanting to hack on a provider should read the JavaMail API
-specification, but CMC and MAPI are of interest too.
-
-Please, before starting anything, wait for me to finish the abstract
-classes. Some parts are not definitive yet.
-
-
-Organization:
--------------
-
-The library is roughly a set of abstract classes, some kind of generic
-"interfaces" (idl interfaces, not java interfaces ).
-
-Particular implementations are called providers.
-
-Here are the basic objects:
-
-* CamelService : an abstract class representing an access to a server.
-Handles the connection and authentication to any server.
-
-* CamelStore (CamelService): A hierarchy of folders on a server.
-
-* CamelFolder : An object containing messages. A folder is always
-associated with a store.
-
-* CamelMessage : An object contained in folders. Is defined by a set
-of attributes and a content. (Attributes include: the date it was
-received, the sender address, .....)
-
-* CamelTransport (CamelService): A way to send messages.
-
-....
-...
-
-
diff --git a/camel/README.COPYRIGHT b/camel/README.COPYRIGHT
deleted file mode 100644
index 91774e7339..0000000000
--- a/camel/README.COPYRIGHT
+++ /dev/null
@@ -1,47 +0,0 @@
-Important note for Camel hackers:
----------------------------------
-
-Camel has been a lot of work, and has been conceived to be general
-enough to be used outside the gnome-mailer. It is possible in the
-future that it is used in softwares with licenses incompatible with the
-LGPL. For this reason, the copyright has to be owned by a unique
-person. Be sure, however, that Camel will always be available under
-the LGPL. Significant authors will always be consulted before any
-special use of Camel. Moreover, in special situations, they may be
-given the authorization to use Camel with a license different than the
-LGPL.
-
-Thus, when adding code in Camel, always add the following lines at the
-begining of the file:
-
-/*
- *
- * Copyright 199x, 200x Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-You may also want to add your name to the author name list after this
-header.
-
-Please contact me (Bertrand.Guiheneuf@aful.org) if you want to discuss
-this copyright issue.
-
-Happy hacking,
-
-Bertrand.
-
-
diff --git a/camel/README.HACKING b/camel/README.HACKING
deleted file mode 100644
index a4742ee7b8..0000000000
--- a/camel/README.HACKING
+++ /dev/null
@@ -1,14 +0,0 @@
-You want to hack on Camel ?
-
-Thanks. Camel aims at being the best messaging
-library for Linux and your help is welcome.
-Please be sure to read the following files before
-commiting any change or sending any patch:
-
-CODING.STYLE
-README.COPYRIGHT
-
-
-Thanks.
-
- Bertrand <Bertrand.Guiheneuf@aful.org> \ No newline at end of file
diff --git a/camel/camel-address.c b/camel/camel-address.c
deleted file mode 100644
index 8056c121c8..0000000000
--- a/camel/camel-address.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "camel-address.h"
-
-
-static void camel_address_class_init (CamelAddressClass *klass);
-static void camel_address_init (CamelAddress *obj);
-static void camel_address_finalise (GtkObject *obj);
-
-static CamelObjectClass *camel_address_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_address_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelAddress",
- sizeof (CamelAddress),
- sizeof (CamelAddressClass),
- (GtkClassInitFunc) camel_address_class_init,
- (GtkObjectInitFunc) camel_address_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_object_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-camel_address_class_init (CamelAddressClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- camel_address_parent = gtk_type_class (camel_object_get_type ());
-
- object_class->finalize = camel_address_finalise;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_address_init (CamelAddress *obj)
-{
- obj->addresses = g_ptr_array_new();
-}
-
-static void
-camel_address_finalise (GtkObject *obj)
-{
- camel_address_remove((CamelAddress *)obj, -1);
-
- ((GtkObjectClass *)(camel_address_parent))->finalize((GtkObject *)obj);
-}
-
-/**
- * camel_address_new:
- *
- * Create a new CamelAddress object.
- *
- * Return value: A new CamelAddress widget.
- **/
-CamelAddress *
-camel_address_new (void)
-{
- CamelAddress *new = CAMEL_ADDRESS ( gtk_type_new (camel_address_get_type ()));
- return new;
-}
-
-
-/**
- * camel_address_decode:
- * @a: An address.
- * @raw: Raw address description.
- *
- * Construct a new address from a raw address field.
- *
- * Return value: Returns the number of addresses found,
- * or -1 if the addresses could not be parsed fully.
- **/
-int
-camel_address_decode (CamelAddress *a, const char *raw)
-{
- g_return_val_if_fail(IS_CAMEL_ADDRESS(a), -1);
-
- return ((CamelAddressClass *)((GtkObject *)a)->klass)->decode(a, raw);
-}
-
-/**
- * camel_address_encode:
- * @a:
- *
- * Encode an address in a format suitable for a raw header.
- *
- * Return value: The encoded address.
- **/
-char *
-camel_address_encode (CamelAddress *a)
-{
- g_return_val_if_fail(IS_CAMEL_ADDRESS(a), NULL);
-
- return ((CamelAddressClass *)((GtkObject *)a)->klass)->encode(a);
-}
-
-/**
- * camel_address_remove:
- * @a:
- * @index: The address to remove, use -1 to remove all address.
- *
- * Remove an address by index, or all addresses.
- **/
-void
-camel_address_remove (CamelAddress *a, int index)
-{
- g_return_if_fail(IS_CAMEL_ADDRESS(a));
-
- if (index == -1) {
- for (index=a->addresses->len; index>-1; index--)
- ((CamelAddressClass *)((GtkObject *)a)->klass)->remove(a, index);
- } else {
- ((CamelAddressClass *)((GtkObject *)a)->klass)->remove(a, index);
- }
-}
diff --git a/camel/camel-address.h b/camel/camel-address.h
deleted file mode 100644
index d035f20e00..0000000000
--- a/camel/camel-address.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _CAMEL_ADDRESS_H
-#define _CAMEL_ADDRESS_H
-
-#include <camel/camel-object.h>
-
-#define CAMEL_ADDRESS(obj) GTK_CHECK_CAST (obj, camel_address_get_type (), CamelAddress)
-#define CAMEL_ADDRESS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_address_get_type (), CamelAddressClass)
-#define IS_CAMEL_ADDRESS(obj) GTK_CHECK_TYPE (obj, camel_address_get_type ())
-
-typedef struct _CamelAddressClass CamelAddressClass;
-
-struct _CamelAddress {
- CamelObject parent;
-
- GPtrArray *addresses;
-
- struct _CamelAddressPrivate *priv;
-};
-
-struct _CamelAddressClass {
- CamelObjectClass parent_class;
-
- int (*decode) (CamelAddress *, const char *raw);
- char *(*encode) (CamelAddress *);
-
- void (*remove) (CamelAddress *, int index);
-};
-
-guint camel_address_get_type (void);
-CamelAddress *camel_address_new (void);
-
-int camel_address_decode (CamelAddress *, const char *);
-char *camel_address_encode (CamelAddress *);
-
-void camel_address_remove (CamelAddress *, int index);
-
-#endif /* ! _CAMEL_ADDRESS_H */
diff --git a/camel/camel-arg-collector.c b/camel/camel-arg-collector.c
deleted file mode 100644
index 44b9e2d99b..0000000000
--- a/camel/camel-arg-collector.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-/*
- * included in camel because it is not exported
- * by gtk
- *
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- */
-
-/* collect a single argument value from a va_list.
- * this is implemented as a huge macro <shrug>, because we can't
- * pass va_list variables by reference on some systems.
- * the corresponding prototype would be:
- * static inline gchar*
- * gtk_arg_collect_value (GtkArg *arg,
- * va_list var_args);
- */
-#define CAMEL_ARG_COLLECT_VALUE(arg, var_args, _error) \
-G_STMT_START { \
- gchar *error_msg; \
- GtkType fundamental_type; \
- \
- fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type); \
- if (fundamental_type > GTK_TYPE_FUNDAMENTAL_LAST) \
- { \
- fundamental_type = gtk_type_get_varargs_type (fundamental_type); \
- if (!fundamental_type) \
- fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type); \
- } \
- \
- error_msg = NULL; \
- switch (fundamental_type) \
- { \
- case GTK_TYPE_INVALID: \
- error_msg = g_strdup ("invalid untyped argument"); \
- break; \
- \
- case GTK_TYPE_NONE: \
- /* we just ignore this type, since it arithmetically just requires \
- * us to not move the var_args pointer any further. callers need to \
- * check for the validity of GTK_TYPE_NONE themselves. \
- * \
- * error_msg = g_strdup ("invalid argument type `void'"); \
- */ \
- break; \
- \
- /* everything smaller than an int is guarranteed to be \
- * passed as an int \
- */ \
- case GTK_TYPE_CHAR: \
- GTK_VALUE_CHAR (*arg) = va_arg (var_args, gint); \
- break; \
- case GTK_TYPE_UCHAR: \
- GTK_VALUE_UCHAR (*arg) = va_arg (var_args, guint); \
- break; \
- case GTK_TYPE_BOOL: \
- GTK_VALUE_BOOL (*arg) = va_arg (var_args, gint); \
- break; \
- case GTK_TYPE_INT: \
- GTK_VALUE_INT (*arg) = va_arg (var_args, gint); \
- break; \
- case GTK_TYPE_UINT: \
- GTK_VALUE_UINT (*arg) = va_arg (var_args, guint); \
- break; \
- case GTK_TYPE_ENUM: \
- GTK_VALUE_ENUM (*arg) = va_arg (var_args, gint); \
- break; \
- case GTK_TYPE_FLAGS: \
- GTK_VALUE_FLAGS (*arg) = va_arg (var_args, guint); \
- break; \
- \
- /* we collect longs as glongs since they differ in size with \
- * integers on some platforms \
- */ \
- case GTK_TYPE_LONG: \
- GTK_VALUE_LONG (*arg) = va_arg (var_args, glong); \
- break; \
- case GTK_TYPE_ULONG: \
- GTK_VALUE_ULONG (*arg) = va_arg (var_args, gulong); \
- break; \
- \
- /* floats are always passed as doubles \
- */ \
- case GTK_TYPE_FLOAT: \
- /* GTK_VALUE_FLOAT (*arg) = va_arg (var_args, gfloat); */ \
- GTK_VALUE_FLOAT (*arg) = va_arg (var_args, gdouble); \
- break; \
- case GTK_TYPE_DOUBLE: \
- GTK_VALUE_DOUBLE (*arg) = va_arg (var_args, gdouble); \
- break; \
- \
- /* collect pointer values \
- */ \
- case GTK_TYPE_STRING: \
- GTK_VALUE_STRING (*arg) = va_arg (var_args, gchar*); \
- break; \
- case GTK_TYPE_POINTER: \
- GTK_VALUE_POINTER (*arg) = va_arg (var_args, gpointer); \
- break; \
- case GTK_TYPE_BOXED: \
- GTK_VALUE_BOXED (*arg) = va_arg (var_args, gpointer); \
- break; \
- \
- /* structured types \
- */ \
- case GTK_TYPE_SIGNAL: \
- GTK_VALUE_SIGNAL (*arg).f = va_arg (var_args, GtkSignalFunc); \
- GTK_VALUE_SIGNAL (*arg).d = va_arg (var_args, gpointer); \
- break; \
- case GTK_TYPE_ARGS: \
- GTK_VALUE_ARGS (*arg).n_args = va_arg (var_args, gint); \
- GTK_VALUE_ARGS (*arg).args = va_arg (var_args, GtkArg*); \
- break; \
- case GTK_TYPE_FOREIGN: \
- GTK_VALUE_FOREIGN (*arg).data = va_arg (var_args, gpointer); \
- GTK_VALUE_FOREIGN (*arg).notify = va_arg (var_args, GtkDestroyNotify); \
- break; \
- case GTK_TYPE_CALLBACK: \
- GTK_VALUE_CALLBACK (*arg).marshal = va_arg (var_args, GtkCallbackMarshal); \
- GTK_VALUE_CALLBACK (*arg).data = va_arg (var_args, gpointer); \
- GTK_VALUE_CALLBACK (*arg).notify = va_arg (var_args, GtkDestroyNotify); \
- break; \
- case GTK_TYPE_C_CALLBACK: \
- GTK_VALUE_C_CALLBACK (*arg).func = va_arg (var_args, GtkFunction); \
- GTK_VALUE_C_CALLBACK (*arg).func_data = va_arg (var_args, gpointer); \
- break; \
- \
- /* we do some extra sanity checking when collecting objects, \
- * i.e. if the object pointer is not NULL, we check whether we \
- * actually got an object pointer within the desired class branch. \
- */ \
- case GTK_TYPE_OBJECT: \
- GTK_VALUE_OBJECT (*arg) = va_arg (var_args, GtkObject*); \
- if (GTK_VALUE_OBJECT (*arg) != NULL) \
- { \
- register GtkObject *object = GTK_VALUE_OBJECT (*arg); \
- \
- if (object->klass == NULL) \
- error_msg = g_strconcat ("invalid unclassed object pointer for argument type `", \
- gtk_type_name (arg->type), \
- "'", \
- NULL); \
- else if (!gtk_type_is_a (GTK_OBJECT_TYPE (object), arg->type)) \
- error_msg = g_strconcat ("invalid object `", \
- gtk_type_name (GTK_OBJECT_TYPE (object)), \
- "' for argument type `", \
- gtk_type_name (arg->type), \
- "'", \
- NULL); \
- } \
- break; \
- \
- default: \
- error_msg = g_strconcat ("unsupported argument type `", \
- gtk_type_name (arg->type), \
- "'", \
- NULL); \
- break; \
- } \
- \
- _error = error_msg; /* return error_msg; */ \
-} G_STMT_END
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
deleted file mode 100644
index fe9f8bf78b..0000000000
--- a/camel/camel-data-wrapper.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camel-data-wrapper.c : Abstract class for a data_wrapper */
-
-/*
- *
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-data-wrapper.h"
-#include "camel-exception.h"
-
-#include <errno.h>
-
-#define d(x)
-
-static CamelObjectClass *parent_class = NULL;
-
-/* Returns the class for a CamelDataWrapper */
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT (so)->klass)
-
-
-static int construct_from_stream(CamelDataWrapper *, CamelStream *);
-static int write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static void set_mime_type (CamelDataWrapper *data_wrapper, const gchar *mime_type);
-static gchar *get_mime_type (CamelDataWrapper *data_wrapper);
-static GMimeContentField *get_mime_type_field (CamelDataWrapper *data_wrapper);
-static void set_mime_type_field (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type);
-static void finalize (GtkObject *object);
-
-static void
-camel_data_wrapper_class_init (CamelDataWrapperClass *camel_data_wrapper_class)
-{
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_data_wrapper_class);
-
- parent_class = gtk_type_class (camel_object_get_type ());
-
- /* virtual method definition */
- camel_data_wrapper_class->write_to_stream = write_to_stream;
- camel_data_wrapper_class->set_mime_type = set_mime_type;
- camel_data_wrapper_class->get_mime_type = get_mime_type;
- camel_data_wrapper_class->get_mime_type_field = get_mime_type_field;
- camel_data_wrapper_class->set_mime_type_field = set_mime_type_field;
-
- camel_data_wrapper_class->construct_from_stream = construct_from_stream;
-
- /* virtual method overload */
- gtk_object_class->finalize = finalize;
-}
-
-static void
-camel_data_wrapper_init (gpointer object, gpointer klass)
-{
- CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object);
-
- camel_data_wrapper->mime_type = gmime_content_field_new (NULL, NULL);
-}
-
-
-
-GtkType
-camel_data_wrapper_get_type (void)
-{
- static GtkType camel_data_wrapper_type = 0;
-
- if (!camel_data_wrapper_type) {
- GtkTypeInfo camel_data_wrapper_info =
- {
- "CamelDataWrapper",
- sizeof (CamelDataWrapper),
- sizeof (CamelDataWrapperClass),
- (GtkClassInitFunc) camel_data_wrapper_class_init,
- (GtkObjectInitFunc) camel_data_wrapper_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_data_wrapper_type = gtk_type_unique (camel_object_get_type (), &camel_data_wrapper_info);
- }
-
- return camel_data_wrapper_type;
-}
-
-
-static void
-finalize (GtkObject *object)
-{
- CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object);
-
- if (camel_data_wrapper->mime_type)
- gmime_content_field_unref (camel_data_wrapper->mime_type);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static int
-write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- if (data_wrapper->stream == NULL) {
- return -1;
- }
-
- if (camel_stream_reset (data_wrapper->stream) == -1)
- return -1;
-
- return camel_stream_write_to_stream (data_wrapper->stream, stream);
-}
-
-CamelDataWrapper *
-camel_data_wrapper_new(void)
-{
- return (CamelDataWrapper *)gtk_type_new(camel_data_wrapper_get_type());
-}
-
-/**
- * camel_data_wrapper_write_to_stream:
- * @data_wrapper: a data wrapper
- * @stream: stream for data to be written to
- * @ex: a CamelException
- *
- * Writes the data content to @stream in a machine-independent format
- * appropriate for the data. It should be possible to construct an
- * equivalent data wrapper object later by passing this stream to
- * camel_data_construct_from_stream().
- *
- * Return value: the number of bytes written, or -1 if an error occurs.
- **/
-int
-camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream)
-{
- g_return_val_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper), -1);
- g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
-
- return CDW_CLASS (data_wrapper)->write_to_stream (data_wrapper, stream);
-}
-
-static int
-construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- return -1;
-}
-
-/**
- * camel_data_wrapper_construct_from_stream:
- * @data_wrapper: a data wrapper
- * @stream: A stream that can be read from.
- *
- * Constructs the content of the data wrapper from the
- * supplied @stream.
- *
- * Return value: -1 on error.
- **/
-int
-camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream)
-{
- g_return_val_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper), -1);
- g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
-
- return CDW_CLASS (data_wrapper)->construct_from_stream (data_wrapper, stream);
-}
-
-
-static void
-set_mime_type (CamelDataWrapper *data_wrapper, const gchar *mime_type)
-{
- gmime_content_field_construct_from_string (data_wrapper->mime_type,
- mime_type);
-}
-
-/**
- * camel_data_wrapper_set_mime_type:
- * @data_wrapper: a data wrapper
- * @mime_type: the text representation of a MIME type
- *
- * This sets the data wrapper's MIME type.
- * It might fail, but you won't know. It will allow you to set
- * Content-Type parameters on the data wrapper, which are meaningless.
- * You should not be allowed to change the MIME type of a data wrapper
- * that contains data, or at least, if you do, it should invalidate the
- * data.
- **/
-void
-camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper,
- const gchar *mime_type)
-{
- g_return_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper));
- g_return_if_fail (mime_type != NULL);
-
- CDW_CLASS (data_wrapper)->set_mime_type (data_wrapper, mime_type);
-}
-
-static gchar *
-get_mime_type (CamelDataWrapper *data_wrapper)
-{
- return gmime_content_field_get_mime_type (data_wrapper->mime_type);
-}
-
-/**
- * camel_data_wrapper_get_mime_type:
- * @data_wrapper: a data wrapper
- *
- * Return value: the text form of the data wrapper's MIME type
- **/
-gchar *
-camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper)
-{
- g_return_val_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper), NULL);
-
- return CDW_CLASS (data_wrapper)->get_mime_type (data_wrapper);
-}
-
-
-static GMimeContentField *
-get_mime_type_field (CamelDataWrapper *data_wrapper)
-{
- return data_wrapper->mime_type;
-}
-
-/**
- * camel_data_wrapper_get_mime_type_field:
- * @data_wrapper: a data wrapper
- *
- * Return value: the parsed form of the data wrapper's MIME type
- **/
-GMimeContentField *
-camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper)
-{
- g_return_val_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper), NULL);
-
- return CDW_CLASS (data_wrapper)->get_mime_type_field (data_wrapper);
-}
-
-/**
- * camel_data_wrapper_set_mime_type_field:
- * @data_wrapper: a data wrapper
- * @mime_type: the parsed representation of a MIME type
- *
- * This sets the data wrapper's MIME type. It suffers from the same
- * flaws as camel_data_wrapper_set_mime_type.
- **/
-static void
-set_mime_type_field (CamelDataWrapper *data_wrapper,
- GMimeContentField *mime_type)
-{
- g_return_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper));
- g_return_if_fail (mime_type != NULL);
-
- if (data_wrapper->mime_type)
- gmime_content_field_unref (data_wrapper->mime_type);
- data_wrapper->mime_type = mime_type;
- if (mime_type)
- gmime_content_field_ref (data_wrapper->mime_type);
-}
-
-void
-camel_data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper,
- GMimeContentField *mime_type)
-{
- CDW_CLASS (data_wrapper)->set_mime_type_field (data_wrapper, mime_type);
-}
diff --git a/camel/camel-data-wrapper.h b/camel/camel-data-wrapper.h
deleted file mode 100644
index 8df09fa848..0000000000
--- a/camel/camel-data-wrapper.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-data-wrapper.h : Abstract class for a data wrapper */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_DATA_WRAPPER_H
-#define CAMEL_DATA_WRAPPER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-object.h>
-#include <camel/gmime-content-field.h>
-
-#define CAMEL_DATA_WRAPPER_TYPE (camel_data_wrapper_get_type ())
-#define CAMEL_DATA_WRAPPER(obj) (GTK_CHECK_CAST((obj), CAMEL_DATA_WRAPPER_TYPE, CamelDataWrapper))
-#define CAMEL_DATA_WRAPPER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_DATA_WRAPPER_TYPE, CamelDataWrapperClass))
-#define CAMEL_IS_DATA_WRAPPER(o) (GTK_CHECK_TYPE((o), CAMEL_DATA_WRAPPER_TYPE))
-
-struct _CamelDataWrapper
-{
- CamelObject parent_object;
-
- GMimeContentField *mime_type;
- CamelStream *stream;
-};
-
-typedef struct {
- CamelObjectClass parent_class;
-
- /* Virtual methods */
- void (*set_output_stream) (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
- CamelStream * (*get_output_stream) (CamelDataWrapper *data_wrapper);
-
- void (*set_mime_type) (CamelDataWrapper *data_wrapper,
- const gchar * mime_type);
- gchar * (*get_mime_type) (CamelDataWrapper *data_wrapper);
- GMimeContentField * (*get_mime_type_field) (CamelDataWrapper *data_wrapper);
- void (*set_mime_type_field) (CamelDataWrapper *data_wrapper,
- GMimeContentField *mime_type_field);
-
- int (*write_to_stream) (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-
- int (*construct_from_stream) (CamelDataWrapper *data_wrapper,
- CamelStream *);
-} CamelDataWrapperClass;
-
-/* Standard Gtk function */
-GtkType camel_data_wrapper_get_type (void);
-
-/* public methods */
-CamelDataWrapper * camel_data_wrapper_new(void);
-int camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-void camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper,
- const gchar *mime_type);
-gchar * camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper);
-GMimeContentField * camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper);
-void camel_data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper,
- GMimeContentField *mime_type);
-
-int camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_DATA_WRAPPER_H */
diff --git a/camel/camel-exception-list.def b/camel/camel-exception-list.def
deleted file mode 100644
index fcb99e5a52..0000000000
--- a/camel/camel-exception-list.def
+++ /dev/null
@@ -1,35 +0,0 @@
-/* WARNING: Exceptions MUST NOT be renumbered: they need to be
- * consistent across libraries compiled at different times.
- * Categories should be widely separated, old unused exceptions can
- * never be deleted, and new exceptions can be added only to the
- * ends of categories.
- */
-
-CAMEL_EXCEPTION_NONE = 0,
-
-/* Generic exceptions */
-CAMEL_EXCEPTION_INVALID_PARAM,
-CAMEL_EXCEPTION_SYSTEM,
-CAMEL_EXCEPTION_USER_CANCEL,
-
-/* CamelFolderException */
-CAMEL_EXCEPTION_FOLDER_NULL = 100,
-CAMEL_EXCEPTION_FOLDER_INVALID,
-CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
-CAMEL_EXCEPTION_FOLDER_NON_EMPTY,
-CAMEL_EXCEPTION_FOLDER_NON_UID,
-CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
-CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
-CAMEL_EXCEPTION_FOLDER_INVALID_UID,
-CAMEL_EXCEPTION_FOLDER_SUMMARY_INVALID,
-
-/* CamelStoreException */
-CAMEL_EXCEPTION_STORE_NULL = 200,
-CAMEL_EXCEPTION_STORE_INVALID,
-
-/* CamelServiceException */
-CAMEL_EXCEPTION_SERVICE_NULL = 300,
-CAMEL_EXCEPTION_SERVICE_INVALID,
-CAMEL_EXCEPTION_SERVICE_URL_INVALID,
-CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE
diff --git a/camel/camel-exception.c b/camel/camel-exception.c
deleted file mode 100644
index cf5daff9d3..0000000000
--- a/camel/camel-exception.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-execpetion.c : exception utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel-exception.h"
-
-
-
-/**
- * camel_exception_new: allocate a new exception object.
- *
- * Create and returns a new exception object.
- *
- *
- * Return value: The newly allocated exception object.
- **/
-CamelException *
-camel_exception_new (void)
-{
- CamelException *ex;
-
- ex = g_new (CamelException, 1);
- ex->desc = NULL;
-
- /* set the Exception Id to NULL */
- ex->id = CAMEL_EXCEPTION_NONE;
-
- return ex;
-}
-
-/**
- * camel_exception_init: init a (statically allocated) exception.
- *
- * Init an exception. This routine is mainly
- * useful when using a statically allocated
- * exception.
- *
- *
- **/
-void
-camel_exception_init (CamelException *ex)
-{
- ex->desc = NULL;
-
- /* set the Exception Id to NULL */
- ex->id = CAMEL_EXCEPTION_NONE;
-}
-
-
-/**
- * camel_exception_clear: Clear an exception
- * @exception: the exception object
- *
- * Clear an exception, that is, set the
- * exception ID to CAMEL_EXCEPTION_NONE and
- * free the description text.
- * If the exception is NULL, this funtion just
- * returns.
- **/
-void
-camel_exception_clear (CamelException *exception)
-{
- if (!exception) return;
-
- /* free the description text */
- if (exception->desc)
- g_free (exception->desc);
- exception->desc = NULL;
-
- /* set the Exception Id to NULL */
- exception->id = CAMEL_EXCEPTION_NONE;
-}
-
-
-
-
-/**
- * camel_exception_free: Free an exception
- * @exception: The exception object to free
- *
- * Free an exception object. If the exception
- * is NULL, nothing is done, the routine simply
- * returns.
- **/
-void
-camel_exception_free (CamelException *exception)
-{
- if (!exception) return;
-
- /* free the description text */
- if (exception->desc)
- g_free (exception->desc);
- /* free the exeption itself */
- g_free (exception);
-}
-
-/**
- * camel_exception_set: set an exception
- * @ex: exception object
- * @id: exception id
- * @desc: textual description of the exception
- *
- * Set the value of an exception. The exception id is
- * a unique number representing the exception. The
- * textual description is a small text explaining
- * what happened and provoked the exception.
- *
- * When @ex is NULL, nothing is done, this routine
- * simply returns.
- *
- **/
-void
-camel_exception_set (CamelException *ex,
- ExceptionId id,
- const char *desc)
-{
- /* if no exception is given, do nothing */
- if (!ex) return;
-
- ex->id = id;
-
- /* remove the previous exception description */
- if (ex->desc)
- g_free (ex->desc);
- ex->desc = g_strdup (desc);
-}
-
-
-/**
- * camel_exception_setv: set an exception
- * @ex: exception object
- * @id: exception id
- * @format: format of the description string. The format string is
- * used as in printf().
- *
- * Set the value of an exception. The exception id is
- * a unique number representing the exception. The
- * textual description is a small text explaining
- * what happened and provoked the exception.
- * In this version, the string is created from the format
- * string and the variable argument list.
- *
- * It is safe to say:
- * camel_exception_setv (ex, ..., camel_exception_get_description (ex), ...);
- *
- * When @ex is NULL, nothing is done, this routine
- * simply returns.
- *
- **/
-void
-camel_exception_setv (CamelException *ex,
- ExceptionId id,
- const char *format,
- ...)
-{
- va_list args;
- gchar *tmp_desc_string;
-
-
- /* if no exception is given, do nothing */
- if (!ex) return;
-
-
- /* create the temporary exception string */
- va_start(args, format);
- tmp_desc_string = g_strdup_vprintf (format, args);
- va_end (args);
-
-
- /* now set the exception. We don't call
- camel_exception_set because we want to
- avoid a useless strdup () */
- ex->id = id;
-
- /* remove the previous exception description */
- if (ex->desc)
- g_free (ex->desc);
- ex->desc = g_strdup (tmp_desc_string);
-
-}
-
-
-
-
-
-
-
-/**
- * camel_exception_xfer: transfer an exception
- * @ex_dst: Destination exception object
- * @ex_src: Source exception object
- *
- * Transfer the content of an exception from
- * an exception object to another.
- * The destination exception receives the id and
- * the description text of the source exception.
- **/
-void
-camel_exception_xfer (CamelException *ex_dst,
- CamelException *ex_src)
-{
- if (ex_dst->desc)
- g_free (ex_dst->desc);
-
- ex_dst->id = ex_src->id;
- ex_dst->desc = ex_src->desc;
-
- ex_src->desc = NULL;
- ex_src->id = CAMEL_EXCEPTION_NONE;
-}
-
-
-
-
-
-
-
-/**
- * camel_exception_get_id: get the exception id
- * @ex: The exception object
- *
- * Return the id of an exception.
- * If @ex is NULL, return CAMEL_EXCEPTION_NONE;
- *
- * Return value: Exception ID.
- **/
-ExceptionId
-camel_exception_get_id (CamelException *ex)
-{
- if (ex)
- return ex->id;
- else
- return CAMEL_EXCEPTION_NONE;
-}
-
-
-
-
-/**
- * camel_exception_get_description: get the description of an exception.
- * @ex: The exception object
- *
- * Return the exception description text.
- * If @ex is NULL, return NULL;
- *
- *
- * Return value: Exception description text.
- **/
-const gchar *
-camel_exception_get_description (CamelException *ex)
-{
- if (ex)
- return ex->desc;
- else
- return NULL;
-}
diff --git a/camel/camel-exception.h b/camel/camel-exception.h
deleted file mode 100644
index d5c93e5941..0000000000
--- a/camel/camel-exception.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-execpetion.h : exception utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#ifndef CAMEL_EXCEPTION_H
-#define CAMEL_EXCEPTION_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include <camel/camel-types.h>
-
-typedef enum {
-#include "camel-exception-list.def"
-
-} ExceptionId;
-
-
-struct _CamelException {
- /* do not access the fields directly */
- ExceptionId id;
- char *desc;
-
-};
-
-
-
-/* creation and destruction functions */
-CamelException * camel_exception_new (void);
-void camel_exception_free (CamelException *exception);
-void camel_exception_init (CamelException *ex);
-
-
-/* exception content manipulation */
-void camel_exception_clear (CamelException *exception);
-void camel_exception_set (CamelException *ex,
- ExceptionId id,
- const char *desc);
-void camel_exception_setv (CamelException *ex,
- ExceptionId id,
- const char *format,
- ...);
-
-
-/* exception content transfer */
-void camel_exception_xfer (CamelException *ex_dst,
- CamelException *ex_src);
-
-
-/* exception content retrieval */
-ExceptionId camel_exception_get_id (CamelException *ex);
-const gchar * camel_exception_get_description (CamelException *ex);
-
-#define camel_exception_is_set(ex) (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE)
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_EXCEPTION_H */
-
diff --git a/camel/camel-folder-pt-proxy.c b/camel/camel-folder-pt-proxy.c
deleted file mode 100644
index 65f74ecc4d..0000000000
--- a/camel/camel-folder-pt-proxy.c
+++ /dev/null
@@ -1,809 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-pt-proxy.c : proxy folder using posix threads */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#include <config.h>
-#include "camel-folder-pt-proxy.h"
-#include "camel-marshal-utils.h"
-#include "camel-exception.h"
-#include <pthread.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-
-static CamelFolderClass *parent_class = NULL;
-
-/* Returns the class for CamelFolderPtProxy and CamelFolder objects */
-#define CFPP_CLASS(so) CAMEL_FOLDER_PT_PROXY_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-
-enum CamelFolderFunc {
- CAMEL_FOLDER_OPEN,
- CAMEL_FOLDER_CLOSE,
- CAMEL_FOLDER__LAST_FUNC
-};
-
-static CamelFuncDef _camel_func_def [CAMEL_FOLDER__LAST_FUNC];
-
-
-static void _init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar separator, CamelException *ex);
-static void _open_async (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-static void _close_async (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-static void _open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex);
-static void _close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex);
-static void _set_name (CamelFolder *folder,
- const gchar *name,
- CamelException *ex);
-
-static const gchar *_get_name (CamelFolder *folder, CamelException *ex);
-static const gchar *_get_full_name (CamelFolder *folder, CamelException *ex);
-static gboolean _can_hold_folders (CamelFolder *folder);
-static gboolean _can_hold_messages(CamelFolder *folder);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _is_open (CamelFolder *folder);
-static CamelFolder *_get_subfolder (CamelFolder *folder, const gchar *folder_name, CamelException *ex);
-static gboolean _create (CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean _delete_messages (CamelFolder *folder, CamelException *ex);
-static CamelFolder *_get_parent_folder (CamelFolder *folder, CamelException *ex);
-static CamelStore *_get_parent_store (CamelFolder *folder, CamelException *ex);
-static CamelFolderOpenMode _get_mode (CamelFolder *folder, CamelException *ex);
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-static GList *_expunge (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex);
-static gint _get_message_count (CamelFolder *folder, CamelException *ex);
-static void _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static const GList *_list_permanent_flags (CamelFolder *folder, CamelException *ex);
-static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex);
-
-static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-static GList *_get_uid_list (CamelFolder *folder, CamelException *ex);
-
-static void _finalize (GtkObject *object);
-
-
-static void
-camel_folder_pt_proxy_class_init (CamelFolderPtProxyClass *camel_folder_pt_proxy_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_pt_proxy_class);
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_folder_pt_proxy_class);
- CamelFolderPtProxyClass *proxy_class = camel_folder_pt_proxy_class;
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
- camel_folder_class->init = _init;
- camel_folder_class->open = _open;
- camel_folder_class->close = _close;
-#ifdef FOLDER_ASYNC_TEST
- camel_folder_class->open_async = _open_async;
- camel_folder_class->close_async = _close_async;
-#endif
- camel_folder_class->get_name = _get_name;
- camel_folder_class->can_hold_folders = _can_hold_folders;
- camel_folder_class->can_hold_messages = _can_hold_messages;
- camel_folder_class->exists = _exists;
- camel_folder_class->is_open = _is_open;
- camel_folder_class->get_subfolder = _get_subfolder;
- camel_folder_class->create = _create;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->get_parent_folder = _get_parent_folder;
- camel_folder_class->get_parent_store = _get_parent_store;
- camel_folder_class->get_mode = _get_mode;
- camel_folder_class->list_subfolders = _list_subfolders;
- camel_folder_class->expunge = _expunge;
- camel_folder_class->get_message_by_number = _get_message_by_number;
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->append_message = _append_message;
- camel_folder_class->list_permanent_flags = _list_permanent_flags;
- camel_folder_class->copy_message_to = _copy_message_to;
- camel_folder_class->get_message_uid = _get_message_uid;
- camel_folder_class->get_message_by_uid = _get_message_by_uid;
- camel_folder_class->get_uid_list = _get_uid_list;
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-
- /* function definition for proxying */
- proxy_class->open_func_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_INT_POINTER_POINTER,
- 4,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
- proxy_class->open_cb_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_POINTER_POINTER,
- 3,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
-
- proxy_class->close_func_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER,
- 4,
- GTK_TYPE_POINTER,
- GTK_TYPE_BOOL,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
- proxy_class->close_cb_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_POINTER_POINTER,
- 3,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
-
- proxy_class->set_name_func_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER,
- 4,
- GTK_TYPE_POINTER,
- GTK_TYPE_BOOL,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
- proxy_class->set_name_cb_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_POINTER_POINTER,
- 3,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
-
-}
-
-
-
-
-static void
-camel_folder_pt_proxy_init (CamelFolderPtProxy *folder_pt_proxy)
-{
- folder_pt_proxy->thread_ex = camel_exception_new ();
- folder_pt_proxy->pud = g_new (_ProxyCbUserData, 1);
-}
-
-
-
-
-GtkType
-camel_folder_pt_proxy_get_type (void)
-{
- static GtkType camel_folder_pt_proxy_type = 0;
-
- if (!camel_folder_pt_proxy_type) {
- GtkTypeInfo camel_folder_pt_proxy_info =
- {
- "CamelFolderPtProxy",
- sizeof (CamelFolderPtProxy),
- sizeof (CamelFolderPtProxyClass),
- (GtkClassInitFunc) camel_folder_pt_proxy_class_init,
- (GtkObjectInitFunc) camel_folder_pt_proxy_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_folder_pt_proxy_type = gtk_type_unique (camel_folder_get_type (), &camel_folder_pt_proxy_info);
- }
-
- return camel_folder_pt_proxy_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelFolder *camel_folder = CAMEL_FOLDER (object);
- CamelFolderPtProxy *camel_folder_pt_proxy = CAMEL_FOLDER_PT_PROXY (camel_folder);
-
- camel_exception_free (camel_folder_pt_proxy->thread_ex);
- g_free (camel_folder_pt_proxy->pud);
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-
-
-
-
-/*********/
-
-/**** Operations implementation ****/
-
-
-
-static gpointer
-_proxy_cb_user_data (_ProxyCbUserData *pud,
- CamelFolderAsyncCallback real_callback,
- CamelFolderPtProxy *proxy_folder,
- CamelException *ex,
- gpointer real_user_data)
-{
- pud->real_callback = real_callback;
- pud->proxy_folder = proxy_folder;
- pud->ex = ex;
- pud->real_user_data = real_user_data;
- return (gpointer)pud;
-}
-
-
-/* ******** */
-
-/* thread->init implementation */
-static void
-_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar separator, CamelException *ex)
-{
-
- parent_class->init (folder, parent_store, parent_folder,
- name, separator, ex);
- if (ex->id != CAMEL_EXCEPTION_NONE)
- return;
-#warning use proxy store here
- CF_CLASS (folder)->init (CAMEL_FOLDER_PT_PROXY (folder)->real_folder,
- parent_store, parent_folder, name,
- separator, ex);
-}
-
-
-
-/* a little bit of explanation for the folder_class->open
- * method implementation :
- *
- * the proxy object "open" method is called by the client
- * program in the main thread. This method creates a
- * CamelOp object containing all the necessary informations
- * to call the corresponding "open" method on the real
- * folder object in the child thread. This CamelOp object
- * is thus pushed in a queue in the main thread (see the
- * CamelThreadProxy structure for more details).
- * The operations in this queue are executed one by one
- * in a child thread.
- * Once the "open" method of the real object is finished,
- * it calls a callback. This callback is not the one supplied
- * by the client object. Instead, the _folder_open_cb()
- * function is called (in the child thread) which pushes
- * the real callback function in another operation queue.
- * The real callback is then called in the main thread.
- */
-
-/* folder->open implementation */
-
-/*
- * proxy callback. Called in the child thread by the
- * real folder "open" method when it is completed
- */
-static void
-_folder_open_cb (CamelFolder *folder,
- gpointer user_data,
- CamelException *ex)
-{
- CamelOp *cb;
- _ProxyCbUserData *pud;
- CamelFuncDef *cb_def;
-
- g_print ("%s: %s(): Bailing. This function is incredibly"
- " broken; the \"*pud\" pointer isn't allocated"
- " memory anywhere.\n");
- return;
-
- /* transfer the exception information from "ex" to the
- * client supplied exception (kept in pud->ex) */
- camel_exception_xfer (pud->ex, ex);
-
- /* create an operation which will call the real client
- * supplied callback in the main thread */
- cb_def = CAMEL_FOLDER_PT_PROXY_CLASS(pud->proxy_folder)->open_cb_def;
- cb = camel_marshal_create_op (cb_def,
- pud->real_callback,
- pud->proxy_folder,
- pud->real_user_data,
- pud->ex);
- camel_thread_proxy_push_cb (pud->proxy_folder->proxy_object, cb);
-
-}
-
-static void
-_open_async (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
- CamelOp *op;
- CamelFuncDef *func_def;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
-
- /* create an operation corresponding to the "open"
- * method of the real object. The operation definition
- * is common to all instances of the CamelFolderPtProxy
- * class so it is contained in the CamelFolderPtProxyClass
- * structure. */
- func_def = CAMEL_FOLDER_PT_PROXY_CLASS(proxy_folder)->open_func_def;
- if (callback)
- op = camel_marshal_create_op (func_def,
- CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->open_async,
- proxy_folder->real_folder,
- mode,
- _folder_open_cb,
- _proxy_cb_user_data (proxy_folder->pud, callback, proxy_folder, ex, user_data),
- proxy_folder->thread_ex);
- else
- op = camel_marshal_create_op (func_def,
- CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->open_async,
- proxy_folder->real_folder,
- mode,
- NULL,
- NULL,
- NULL);
- /* push the operation in the operation queue. This operation
- * will be executed in a child thread but only one operation
- * will be executed at a time, so that folder implementations
- * don't have to be MultiThread safe. */
- camel_thread_proxy_push_op (proxy_folder->proxy_object, op);
-}
-
-
-
-static void _open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- open (proxy_folder->real_folder, mode, ex);
-}
-
-
-
-/* folder->close implementation */
-
-static void
-_folder_close_cb (CamelFolder *folder,
- gpointer user_data,
- CamelException *ex)
-{
- CamelOp *cb;
- _ProxyCbUserData *pud;
- CamelFuncDef *cb_def;
-
- g_print ("%s: %s(): Bailing. This function is incredibly"
- " broken; the \"*pud\" pointer isn't allocated"
- " memory anywhere.\n");
- return;
-
- camel_exception_xfer (pud->ex, ex);
- cb_def = CAMEL_FOLDER_PT_PROXY_CLASS(pud->proxy_folder)->close_cb_def;
- cb = camel_marshal_create_op (cb_def,
- pud->real_callback,
- pud->proxy_folder,
- pud->real_user_data,
- pud->ex);
- camel_thread_proxy_push_cb (pud->proxy_folder->proxy_object, cb);
-
-}
-
-static void
-_close_async (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
- CamelOp *op;
- CamelFuncDef *func_def;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
-
- func_def = CAMEL_FOLDER_PT_PROXY_CLASS(proxy_folder)->close_func_def;
- if (callback)
- op = camel_marshal_create_op (func_def,
- CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->close_async,
- proxy_folder->real_folder,
- expunge,
- _folder_close_cb,
- _proxy_cb_user_data (proxy_folder->pud, callback, proxy_folder, ex, user_data),
- proxy_folder->thread_ex);
- else
- op = camel_marshal_create_op (func_def,
- CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->close_async,
- proxy_folder->real_folder,
- expunge,
- NULL,
- NULL,
- NULL);
- camel_thread_proxy_push_op (proxy_folder->proxy_object, op);
-
-}
-
-
-static void _close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- close (proxy_folder->real_folder, expunge, ex);
-}
-
-
-/* folder->get_name implementation */
-/* this one is not executed in a thread */
-static const gchar *
-_get_name (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_name (proxy_folder->real_folder);
-}
-
-
-
-/* folder->get_full_name implementation */
-/* this one is not executed in a thread */
-
-static const gchar *
-_get_full_name (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_full_name (proxy_folder->real_folder);
-}
-
-
-
-
-static gboolean
-_can_hold_folders (CamelFolder *folder)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- can_hold_folders (proxy_folder->real_folder);
-}
-
-
-
-
-static gboolean
-_can_hold_messages (CamelFolder *folder)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- can_hold_messages (proxy_folder->real_folder);
-}
-
-
-
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- exists (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static gboolean
-_is_open (CamelFolder *folder)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- is_open (proxy_folder->real_folder);
-}
-
-
-
-
-
-static CamelFolder *
-_get_subfolder (CamelFolder *folder, const gchar *folder_name, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_subfolder (proxy_folder->real_folder, folder_name, ex);
-}
-
-
-
-
-
-
-static gboolean
-_create(CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- create (proxy_folder->real_folder, ex);
-}
-
-
-
-
-
-
-
-
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- delete (proxy_folder->real_folder, recurse, ex);
-}
-
-
-
-
-
-
-
-static gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- delete_messages (proxy_folder->real_folder, ex);
-}
-
-
-
-
-
-
-static CamelFolder *
-_get_parent_folder (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-#warning return proxy parent folder if any
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_parent_folder (proxy_folder->real_folder, ex);
-}
-
-
-
-
-
-static CamelStore *
-_get_parent_store (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_parent_store (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static CamelFolderOpenMode
-_get_mode (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_mode (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- list_subfolders (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static GList *
-_expunge (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- expunge (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static CamelMimeMessage *
-_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_by_number (proxy_folder->real_folder, number, ex);
-}
-
-
-
-
-
-static gint
-_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_count (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static void
-_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- append_message (proxy_folder->real_folder, message, ex);
-}
-
-
-
-static const GList *
-_list_permanent_flags (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- list_permanent_flags (proxy_folder->real_folder, ex);
-}
-
-
-
-static void
-_copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- copy_message_to (proxy_folder->real_folder, message, dest_folder, ex);
-}
-
-
-
-
-
-
-/* UIDs stuff */
-
-
-static const gchar *
-_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_uid (proxy_folder->real_folder, message, ex);
-}
-
-
-/* the next two func are left there temporarily */
-#if 0
-static const gchar *
-_get_message_uid_by_number (CamelFolder *folder, gint message_number, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_uid_by_number (proxy_folder->real_folder, message_number, ex);
-}
-
-#endif
-
-static CamelMimeMessage *
-_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_by_uid (proxy_folder->real_folder, uid, ex);
-}
-
-
-static GList *
-_get_uid_list (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_uid_list (proxy_folder->real_folder, ex);
-}
-
-
-/* **** */
-
-
-
-
-
diff --git a/camel/camel-folder-pt-proxy.h b/camel/camel-folder-pt-proxy.h
deleted file mode 100644
index 7422786170..0000000000
--- a/camel/camel-folder-pt-proxy.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-pt-proxy.h : proxy folder using posix threads */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-
-
-#ifndef CAMEL_FOLDER_PT_PROXY_H
-#define CAMEL_FOLDER_PT_PROXY_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-folder.h>
-#include <camel/camel-op-queue.h>
-#include <camel/camel-thread-proxy.h>
-
-
-#define CAMEL_FOLDER_PT_PROXY_TYPE (camel_folder_pt_proxy_get_type ())
-#define CAMEL_FOLDER_PT_PROXY(obj) (GTK_CHECK_CAST((obj), CAMEL_FOLDER_PT_PROXY_TYPE, CamelFolderPtProxy))
-#define CAMEL_FOLDER_PT_PROXY_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_FOLDER_PT_PROXY_TYPE, CamelFolderPtProxyClass))
-#define CAMEL_IS_FOLDER_PT_PROXY(o) (GTK_CHECK_TYPE((o), CAMEL_FOLDER_PT_PROXY_TYPE))
-
-typedef struct _CamelFolderPtProxy CamelFolderPtProxy;
-
-typedef struct {
- CamelFolderAsyncCallback real_callback;
- CamelFolderPtProxy *proxy_folder;
- CamelException *ex;
- gpointer real_user_data;
-} _ProxyCbUserData;
-
-struct _CamelFolderPtProxy {
- CamelFolder parent;
-
- /* private fields */
- CamelFolder *real_folder;
- CamelThreadProxy *proxy_object;
- CamelException *thread_ex;
- _ProxyCbUserData *pud;
-
-};
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* functions and callbacks definition (for marshalling) */
- CamelFuncDef *open_func_def;
- CamelFuncDef *open_cb_def;
- CamelFuncDef *close_func_def;
- CamelFuncDef *close_cb_def;
- CamelFuncDef *set_name_func_def;
- CamelFuncDef *set_name_cb_def;
-
-} CamelFolderPtProxyClass;
-
-
-GtkType camel_folder_pt_proxy_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_FOLDER_PT_PROXY_H */
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
deleted file mode 100644
index fa07fc819f..0000000000
--- a/camel/camel-folder-search.c
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/* This is a helper class for folders to implement the search function.
- It implements enough to do basic searches on folders that can provide
- an in-memory summary and a body index. */
-
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-
-#include "camel-folder-search.h"
-
-#define d(x)
-#define r(x)
-
-struct _CamelFolderSearchPrivate {
-};
-
-#define _PRIVATE(o) (((CamelFolderSearch *)(o))->priv)
-
-static ESExpResult *search_header_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search);
-static ESExpResult *search_match_all(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFolderSearch *search);
-static ESExpResult *search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search);
-static ESExpResult *search_user_flag(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-
-static ESExpResult *search_dummy(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search);
-
-static void camel_folder_search_class_init (CamelFolderSearchClass *klass);
-static void camel_folder_search_init (CamelFolderSearch *obj);
-static void camel_folder_search_finalise (GtkObject *obj);
-
-static CamelObjectClass *camel_folder_search_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_folder_search_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelFolderSearch",
- sizeof (CamelFolderSearch),
- sizeof (CamelFolderSearchClass),
- (GtkClassInitFunc) camel_folder_search_class_init,
- (GtkObjectInitFunc) camel_folder_search_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_object_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-camel_folder_search_class_init (CamelFolderSearchClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- camel_folder_search_parent = gtk_type_class (camel_object_get_type ());
-
- object_class->finalize = camel_folder_search_finalise;
-
- klass->match_all = search_match_all;
- klass->body_contains = search_body_contains;
- klass->header_contains = search_header_contains;
- klass->user_flag = search_user_flag;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_folder_search_init (CamelFolderSearch *obj)
-{
- struct _CamelFolderSearchPrivate *p;
-
- p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
-
- obj->sexp = e_sexp_new();
-}
-
-static void
-camel_folder_search_finalise (GtkObject *obj)
-{
- CamelFolderSearch *search = (CamelFolderSearch *)obj;
- if (search->sexp)
- gtk_object_unref((GtkObject *)search->sexp);
-
- g_free(search->last_search);
-
- ((GtkObjectClass *)(camel_folder_search_parent))->finalize((GtkObject *)obj);
-}
-
-struct {
- char *name;
- int offset;
- int flags; /* 0x02 = immediate, 0x01 = always enter */
-} builtins[] = {
- /* these have default implementations in e-sexp */
- { "and", GTK_STRUCT_OFFSET(CamelFolderSearchClass, and), 2 },
- { "or", GTK_STRUCT_OFFSET(CamelFolderSearchClass, or), 2 },
- { "not", GTK_STRUCT_OFFSET(CamelFolderSearchClass, not), 2 },
- { "<", GTK_STRUCT_OFFSET(CamelFolderSearchClass, lt), 2 },
- { ">", GTK_STRUCT_OFFSET(CamelFolderSearchClass, gt), 2 },
- { "=", GTK_STRUCT_OFFSET(CamelFolderSearchClass, eq), 2 },
-
- /* these we have to use our own default if there is none */
- /* they should all be defined in the language? so it poarses, or should they not?? */
- { "match-all", GTK_STRUCT_OFFSET(CamelFolderSearchClass, match_all), 3 },
- { "body-contains", GTK_STRUCT_OFFSET(CamelFolderSearchClass, body_contains), 1 },
- { "header-contains", GTK_STRUCT_OFFSET(CamelFolderSearchClass, header_contains), 1 },
- { "user-flag", GTK_STRUCT_OFFSET(CamelFolderSearchClass, user_flag), 1 },
-};
-
-void
-camel_folder_search_construct (CamelFolderSearch *search)
-{
- int i;
- CamelFolderSearchClass *klass = (CamelFolderSearchClass *)GTK_OBJECT(search)->klass;
-
- for (i=0;i<sizeof(builtins)/sizeof(builtins[0]);i++) {
- void *func;
- /* c is sure messy sometimes */
- func = *((void **)(((char *)klass)+builtins[i].offset));
- if (func == NULL && builtins[i].flags&1) {
- g_warning("Search class doesn't implement '%s' method: %s", builtins[i].name, gtk_type_name(GTK_OBJECT(search)->klass->type));
- func = (void *)search_dummy;
- }
- if (func != NULL) {
- if (builtins[i].flags&2) {
- e_sexp_add_ifunction(search->sexp, 0, builtins[i].name, (ESExpIFunc *)func, search);
- } else {
- e_sexp_add_function(search->sexp, 0, builtins[i].name, (ESExpFunc *)func, search);
- }
- }
- }
-}
-
-/**
- * camel_folder_search_new:
- *
- * Create a new CamelFolderSearch object.
- *
- * A CamelFolderSearch is a subclassable, extensible s-exp
- * evaluator which enforces a particular set of s-expressions.
- * Particular methods may be overriden by an implementation to
- * implement a search for any sort of backend.
- *
- * Return value: A new CamelFolderSearch widget.
- **/
-CamelFolderSearch *
-camel_folder_search_new (void)
-{
- CamelFolderSearch *new = CAMEL_FOLDER_SEARCH ( gtk_type_new (camel_folder_search_get_type ()));
-
- camel_folder_search_construct(new);
- return new;
-}
-
-/**
- * camel_folder_search_set_folder:
- * @search:
- * @folder: A folder.
- *
- * Set the folder attribute of the search. This is currently unused, but
- * could be used to perform a slow-search when indexes and so forth are not
- * available. Or for use by subclasses.
- **/
-void
-camel_folder_search_set_folder(CamelFolderSearch *search, CamelFolder *folder)
-{
- search->folder = folder;
-}
-
-/**
- * camel_folder_search_set_summary:
- * @search:
- * @summary: An array of CamelMessageInfo pointers.
- *
- * Set the array of summary objects representing the span of the search.
- *
- * If this is not set, then a subclass must provide the functions
- * for searching headers and for the match-all operator.
- **/
-void
-camel_folder_search_set_summary(CamelFolderSearch *search, GPtrArray *summary)
-{
- search->summary = summary;
-}
-
-/**
- * camel_folder_search_set_body_index:
- * @search:
- * @index:
- *
- * Set the index (ibex) representing the contents of all messages
- * in this folder. If this is not set, then the folder implementation
- * should sub-class the CamelFolderSearch and provide its own
- * body-contains function.
- **/
-void
-camel_folder_search_set_body_index(CamelFolderSearch *search, ibex *index)
-{
- search->body_index = index;
-}
-
-/**
- * camel_folder_search_execute_expression:
- * @search:
- * @expr:
- * @ex:
- *
- * Execute the search expression @expr, returning a list of
- * all matches as a GList of uid's of matching messages.
- *
- * Note that any settings such as set_body_index(), set_folder(),
- * and so on are reset to #NULL once the search has completed.
- *
- * TODO: The interface should probably return a GPtrArray
- * of summary items instead (since they are much more useful
- * to any client).
- *
- * Return value: A GList of strings of all matching messages. Once
- * finished with this, the array AND CONTENTS should be free'd
- * by the caller.
- **/
-GList *
-camel_folder_search_execute_expression(CamelFolderSearch *search, const char *expr, CamelException *ex)
-{
- ESExpResult *r;
- GList *matches = NULL;
- int i;
-
- /* only re-parse if the search has changed */
- if (search->last_search == NULL
- || strcmp(search->last_search, expr)) {
- e_sexp_input_text(search->sexp, expr, strlen(expr));
- e_sexp_parse(search->sexp);
- g_free(search->last_search);
- search->last_search = g_strdup(expr);
- }
- r = e_sexp_eval(search->sexp);
-
- /* now create a folder summary to return?? */
- if (r
- && r->type == ESEXP_RES_ARRAY_PTR) {
- d(printf("got result ...\n"));
- for (i=0;i<r->value.ptrarray->len;i++) {
- d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i)));
- matches = g_list_prepend(matches, g_strdup(g_ptr_array_index(r->value.ptrarray, i)));
- }
- e_sexp_result_free(r);
- } else {
- printf("no result!\n");
- }
-
- search->folder = NULL;
- search->summary = NULL;
- search->current = NULL;
- search->body_index = NULL;
-
- return matches;
-}
-
-/* dummy function, returns false always, or an empty match array */
-static ESExpResult *
-search_dummy(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
-{
- ESExpResult *r;
-
- if (search->current == NULL) {
- r = e_sexp_result_new(ESEXP_RES_BOOL);
- r->value.bool = FALSE;
- } else {
- r = e_sexp_result_new(ESEXP_RES_ARRAY_PTR);
- r->value.ptrarray = g_ptr_array_new();
- }
-
- return r;
-}
-
-static ESExpResult *
-search_match_all(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFolderSearch *search)
-{
- int i;
- ESExpResult *r, *r1;
-
- if (argc>1) {
- g_warning("match-all only takes a single argument, other arguments ignored");
- }
- r = e_sexp_result_new(ESEXP_RES_ARRAY_PTR);
- r->value.ptrarray = g_ptr_array_new();
-
- if (search->summary == NULL) {
- /* TODO: make it work - e.g. use the folder and so forth for a slower search */
- g_warning("No summary supplied, match-all doesn't work with no summary");
- return r;
- }
-
- /* TODO: Could make this a bit faster in the uncommon case (of match-everything) */
- for (i=0;i<search->summary->len;i++) {
- search->current = g_ptr_array_index(search->summary, i);
- if (argc>0) {
- r1 = e_sexp_term_eval(f, argv[0]);
- if (r1->type == ESEXP_RES_BOOL) {
- if (r1->value.bool)
- g_ptr_array_add(r->value.ptrarray, search->current->uid);
- } else {
- g_warning("invalid syntax, matches require a single bool result");
- }
- e_sexp_result_free(r1);
- } else {
- g_ptr_array_add(r->value.ptrarray, search->current->uid);
- }
- }
- search->current = NULL;
-
- return r;
-}
-
-static ESExpResult *
-search_header_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
-{
- ESExpResult *r;
- int truth = FALSE;
-
- r(printf("executing header-contains\n"));
-
- /* are we inside a match-all? */
- if (search->current && argc>1
- && argv[0]->type == ESEXP_RES_STRING) {
- char *headername, *header = NULL;
- char strbuf[32];
- int i;
-
- /* only a subset of headers are supported .. */
- headername = argv[0]->value.string;
- if (!strcasecmp(headername, "subject")) {
- header = search->current->subject;
- } else if (!strcasecmp(headername, "date")) {
- /* FIXME: not a very useful form of the date */
- sprintf(strbuf, "%d", (int)search->current->date_sent);
- header = strbuf;
- } else if (!strcasecmp(headername, "from")) {
- header = search->current->from;
- } else if (!strcasecmp(headername, "to")) {
- header = search->current->from;
- } else {
- g_warning("Performing query on unknown header: %s", headername);
- }
-
- if (header) {
- /* performs an OR of all words */
- for (i=1;i<argc && !truth;i++) {
- if (argv[i]->type == ESEXP_RES_STRING
- && strstr(header, argv[i]->value.string)) {
- r(printf("%s got a match with %s of %s\n", search->current->uid, header, argv[i]->value.string));
- truth = TRUE;
- break;
- }
- }
- }
- }
- /* TODO: else, find all matches */
-
- r = e_sexp_result_new(ESEXP_RES_BOOL);
- r->value.bool = truth;
-
- return r;
-}
-
-/* this is just to OR results together */
-struct _glib_sux_donkeys {
- int count;
- GPtrArray *uids;
-};
-
-/* or, store all unique values */
-static void
-g_lib_sux_htor(char *key, int value, struct _glib_sux_donkeys *fuckup)
-{
- g_ptr_array_add(fuckup->uids, key);
-}
-
-static ESExpResult *
-search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
-{
- ESExpResult *r;
- int i, j;
-
- if (search->current) {
- int truth = FALSE;
-
- r = e_sexp_result_new(ESEXP_RES_BOOL);
- if (search->body_index) {
- for (i=0;i<argc && !truth;i++) {
- if (argv[i]->type == ESEXP_RES_STRING) {
- truth = ibex_find_name(search->body_index, search->current->uid, argv[i]->value.string);
- } else {
- g_warning("Invalid type passed to body-contains match function");
- }
- }
- } else {
- g_warning("Cannot perform indexed body query with no index");
- }
- r->value.bool = truth;
- } else {
- r = e_sexp_result_new(ESEXP_RES_ARRAY_PTR);
-
- if (search->body_index) {
- if (argc==1) {
- /* common case */
- r->value.ptrarray = ibex_find(search->body_index, argv[0]->value.string);
- } else {
- GHashTable *ht = g_hash_table_new(g_str_hash, g_str_equal);
- GPtrArray *pa;
- struct _glib_sux_donkeys lambdafoo;
-
- /* this sux, perform an or operation on the result(s) of each word */
- for (i=0;i<argc;i++) {
- if (argv[i]->type == ESEXP_RES_STRING) {
- pa = ibex_find(search->body_index, argv[i]->value.string);
- for (j=0;j<pa->len;j++) {
- g_hash_table_insert(ht, g_ptr_array_index(pa, j), (void *)1);
- }
- g_ptr_array_free(pa, FALSE);
- } else {
- g_warning("invalid type passed to body-contains");
- }
- }
- lambdafoo.uids = g_ptr_array_new();
- g_hash_table_foreach(ht, (GHFunc)g_lib_sux_htor, &lambdafoo);
- r->value.ptrarray = lambdafoo.uids;
- g_hash_table_destroy(ht);
- }
- } else {
- r->value.ptrarray = g_ptr_array_new();
- }
- }
-
- return r;
-}
-
-static ESExpResult *search_user_flag(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
-{
- ESExpResult *r;
- int i;
-
- r(printf("executing user-flag\n"));
-
- /* are we inside a match-all? */
- if (search->current) {
- int truth = FALSE;
- /* performs an OR of all words */
- for (i=0;i<argc && !truth;i++) {
- if (argv[i]->type == ESEXP_RES_STRING
- && camel_flag_get(&search->current->user_flags, argv[i]->value.string)) {
- truth = TRUE;
- break;
- }
- }
- r = e_sexp_result_new(ESEXP_RES_BOOL);
- r->value.bool = truth;
- } else {
- r = e_sexp_result_new(ESEXP_RES_ARRAY_PTR);
- r->value.ptrarray = g_ptr_array_new();
- }
-
- return r;
-}
diff --git a/camel/camel-folder-search.h b/camel/camel-folder-search.h
deleted file mode 100644
index 87493912f8..0000000000
--- a/camel/camel-folder-search.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef _CAMEL_FOLDER_SEARCH_H
-#define _CAMEL_FOLDER_SEARCH_H
-
-#include <camel/camel-object.h>
-#include <e-util/e-sexp.h>
-#include <libibex/ibex.h>
-#include <camel/camel-folder.h>
-
-#define CAMEL_FOLDER_SEARCH(obj) GTK_CHECK_CAST (obj, camel_folder_search_get_type (), CamelFolderSearch)
-#define CAMEL_FOLDER_SEARCH_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_folder_search_get_type (), CamelFolderSearchClass)
-#define IS_CAMEL_FOLDER_SEARCH(obj) GTK_CHECK_TYPE (obj, camel_folder_search_get_type ())
-
-typedef struct _CamelFolderSearchClass CamelFolderSearchClass;
-
-struct _CamelFolderSearch {
- CamelObject parent;
-
- struct _CamelFolderSearchPrivate *priv;
-
- ESExp *sexp; /* s-exp evaluator */
- char *last_search; /* last searched expression */
-
- /* these are only valid during the search, and are reset afterwards */
- CamelFolder *folder; /* folder for current search */
- GPtrArray *summary; /* summary array for current search */
- CamelMessageInfo *current; /* current message info, when searching one by one */
- ibex *body_index;
-};
-
-struct _CamelFolderSearchClass {
- CamelObjectClass parent_class;
-
- /* general bool/comparison options, usually these wont need to be set, unless it is compiling into another language */
- ESExpResult * (*and)(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFolderSearch *s);
- ESExpResult * (*or)(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFolderSearch *s);
- ESExpResult * (*not)(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFolderSearch *s);
- ESExpResult * (*lt)(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFolderSearch *s);
- ESExpResult * (*gt)(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFolderSearch *s);
- ESExpResult * (*eq)(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFolderSearch *s);
-
- /* search options */
- /* (match-all [boolean expression]) Apply match to all messages */
- ESExpResult * (*match_all)(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFolderSearch *s);
-
- /* (body-contains "string1" "string2" ...) Returns a list of matches, or true if in single-message mode */
- ESExpResult * (*body_contains)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-
- /* (header-contains "headername" "string1" ...) List of matches, or true if in single-message mode */
- ESExpResult * (*header_contains)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-
- /* (user-flag "flagname" "flagname" ...) If one of user-flag set */
- ESExpResult * (*user_flag)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-};
-
-guint camel_folder_search_get_type (void);
-CamelFolderSearch *camel_folder_search_new (void);
-void camel_folder_search_construct (CamelFolderSearch *search);
-
-void camel_folder_search_set_folder(CamelFolderSearch *search, CamelFolder *folder);
-void camel_folder_search_set_summary(CamelFolderSearch *search, GPtrArray *summary);
-void camel_folder_search_set_body_index(CamelFolderSearch *search, ibex *index);
-GList *camel_folder_search_execute_expression(CamelFolderSearch *search, const char *expr, CamelException *ex);
-
-#endif /* ! _CAMEL_FOLDER_SEARCH_H */
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
deleted file mode 100644
index 9e3b478236..0000000000
--- a/camel/camel-folder-summary.c
+++ /dev/null
@@ -1,1410 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <unistd.h>
-#include <netinet/in.h>
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#include "camel-folder-summary.h"
-
-#include <camel/camel-mime-message.h>
-
-#include <camel/camel-mime-filter.h>
-#include <camel/camel-mime-filter-index.h>
-#include <camel/camel-mime-filter-charset.h>
-#include <camel/camel-mime-filter-save.h>
-#include <camel/camel-mime-filter-basic.h>
-#include <camel/camel-mime-message.h>
-#include "hash-table-utils.h"
-
-/* this should probably be conditional on it existing */
-#define USE_BSEARCH
-
-#define d(x)
-#define io(x) /* io debug */
-
-#if 0
-extern int strdup_count, malloc_count, free_count;
-#endif
-
-#define CAMEL_FOLDER_SUMMARY_VERSION (4)
-
-struct _CamelFolderSummaryPrivate {
- GHashTable *filter_charset; /* CamelMimeFilterCharset's indexed by source charset */
-
- CamelMimeFilterIndex *filter_index;
- CamelMimeFilterBasic *filter_64;
- CamelMimeFilterBasic *filter_qp;
- CamelMimeFilterSave *filter_save;
-
- ibex *index;
-};
-
-#define _PRIVATE(o) (((CamelFolderSummary *)(o))->priv)
-
-/* trivial lists, just because ... */
-struct _node {
- struct _node *next;
-};
-
-static struct _node *my_list_append(struct _node **list, struct _node *n);
-static int my_list_size(struct _node **list);
-
-static int summary_header_load(CamelFolderSummary *, FILE *);
-static int summary_header_save(CamelFolderSummary *, FILE *);
-
-static CamelMessageInfo * message_info_new(CamelFolderSummary *, struct _header_raw *);
-static CamelMessageInfo * message_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
-static CamelMessageInfo * message_info_load(CamelFolderSummary *, FILE *);
-static int message_info_save(CamelFolderSummary *, FILE *, CamelMessageInfo *);
-static void message_info_free(CamelFolderSummary *, CamelMessageInfo *);
-
-static CamelMessageContentInfo * content_info_new(CamelFolderSummary *, struct _header_raw *);
-static CamelMessageContentInfo * content_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
-static CamelMessageContentInfo * content_info_load(CamelFolderSummary *, FILE *);
-static int content_info_save(CamelFolderSummary *, FILE *, CamelMessageContentInfo *);
-static void content_info_free(CamelFolderSummary *, CamelMessageContentInfo *);
-
-static CamelMessageContentInfo * summary_build_content_info(CamelFolderSummary *s, CamelMimeParser *mp);
-
-static void camel_folder_summary_class_init (CamelFolderSummaryClass *klass);
-static void camel_folder_summary_init (CamelFolderSummary *obj);
-static void camel_folder_summary_finalise (GtkObject *obj);
-
-static CamelObjectClass *camel_folder_summary_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_folder_summary_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelFolderSummary",
- sizeof (CamelFolderSummary),
- sizeof (CamelFolderSummaryClass),
- (GtkClassInitFunc) camel_folder_summary_class_init,
- (GtkObjectInitFunc) camel_folder_summary_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_object_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-camel_folder_summary_class_init (CamelFolderSummaryClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- camel_folder_summary_parent = gtk_type_class (camel_object_get_type ());
-
- object_class->finalize = camel_folder_summary_finalise;
-
- klass->summary_header_load = summary_header_load;
- klass->summary_header_save = summary_header_save;
-
- klass->message_info_new = message_info_new;
- klass->message_info_new_from_parser = message_info_new_from_parser;
- klass->message_info_load = message_info_load;
- klass->message_info_save = message_info_save;
- klass->message_info_free = message_info_free;
-
- klass->content_info_new = content_info_new;
- klass->content_info_new_from_parser = content_info_new_from_parser;
- klass->content_info_load = content_info_load;
- klass->content_info_save = content_info_save;
- klass->content_info_free = content_info_free;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_folder_summary_init (CamelFolderSummary *s)
-{
- struct _CamelFolderSummaryPrivate *p;
-
- p = _PRIVATE(s) = g_malloc0(sizeof(*p));
-
- p->filter_charset = g_hash_table_new(g_strcase_hash, g_strcase_equal);
-
- s->message_info_size = sizeof(CamelMessageInfo);
- s->content_info_size = sizeof(CamelMessageContentInfo);
-
- s->version = CAMEL_FOLDER_SUMMARY_VERSION;
- s->flags = 0;
- s->time = 0;
- s->nextuid = 1;
-
- s->messages = g_ptr_array_new();
- s->messages_uid = g_hash_table_new(g_str_hash, g_str_equal);
-}
-
-static void free_o_name(void *key, void *value, void *data)
-{
- gtk_object_unref((GtkObject *)value);
- g_free(key);
-}
-
-static void
-camel_folder_summary_finalise (GtkObject *obj)
-{
- struct _CamelFolderSummaryPrivate *p;
- CamelFolderSummary *s = (CamelFolderSummary *)obj;
-
- p = _PRIVATE(obj);
-
- camel_folder_summary_clear(s);
- g_ptr_array_free(s->messages, TRUE);
- g_hash_table_destroy(s->messages_uid);
-
- g_hash_table_foreach(p->filter_charset, free_o_name, 0);
- g_hash_table_destroy(p->filter_charset);
-
- g_free(s->summary_path);
-
- if (p->filter_index)
- gtk_object_unref ((GtkObject *)p->filter_index);
- if (p->filter_64)
- gtk_object_unref ((GtkObject *)p->filter_64);
- if (p->filter_qp)
- gtk_object_unref ((GtkObject *)p->filter_qp);
- if (p->filter_save)
- gtk_object_unref ((GtkObject *)p->filter_save);
-
- g_free(p);
-
- ((GtkObjectClass *)(camel_folder_summary_parent))->finalize((GtkObject *)obj);
-}
-
-/**
- * camel_folder_summary_new:
- *
- * Create a new CamelFolderSummary object.
- *
- * Return value: A new CamelFolderSummary widget.
- **/
-CamelFolderSummary *
-camel_folder_summary_new (void)
-{
- CamelFolderSummary *new = CAMEL_FOLDER_SUMMARY ( gtk_type_new (camel_folder_summary_get_type ()));
- return new;
-}
-
-
-void camel_folder_summary_set_filename(CamelFolderSummary *s, const char *name)
-{
- g_free(s->summary_path);
- s->summary_path = g_strdup(name);
-}
-
-void camel_folder_summary_set_index(CamelFolderSummary *s, ibex *index)
-{
- struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
-
- p->index = index;
-}
-
-void camel_folder_summary_set_build_content(CamelFolderSummary *s, gboolean state)
-{
- s->build_content = state;
-}
-
-int
-camel_folder_summary_count(CamelFolderSummary *s)
-{
- return s->messages->len;
-}
-
-CamelMessageInfo *
-camel_folder_summary_index(CamelFolderSummary *s, int i)
-{
- if (i<s->messages->len)
- return g_ptr_array_index(s->messages, i);
- return NULL;
-}
-
-CamelMessageInfo *
-camel_folder_summary_uid(CamelFolderSummary *s, const char *uid)
-{
- return g_hash_table_lookup(s->messages_uid, uid);
-}
-
-void
-camel_folder_summary_set_uid(CamelFolderSummary *s, guint32 base)
-{
- if (s->nextuid <= base)
- s->nextuid = base+1;
-}
-
-guint32 camel_folder_summary_next_uid(CamelFolderSummary *s)
-{
- guint32 uid = s->nextuid++;
-
- /* FIXME: sync this to disk */
-/* summary_header_save(s);*/
- return uid;
-}
-
-/* loads the content descriptions, recursively */
-static CamelMessageContentInfo *
-perform_content_info_load(CamelFolderSummary *s, FILE *in)
-{
- int i;
- guint32 count;
- CamelMessageContentInfo *ci, *part;
-
- ci = ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->content_info_load(s, in);
- camel_folder_summary_decode_uint32(in, &count);
- for (i=0;i<count;i++) {
- part = perform_content_info_load(s, in);
- if (part) {
- my_list_append((struct _node **)&ci->childs, (struct _node *)part);
- part->parent = ci;
- } else {
- g_warning("Summary file format messed up?");
- }
- }
- return ci;
-}
-
-int
-camel_folder_summary_load(CamelFolderSummary *s)
-{
- FILE *in;
- int i;
- CamelMessageInfo *mi;
-
- g_assert(s->summary_path);
-
- printf("loading summary\n");
-
- in = fopen(s->summary_path, "r");
- if ( in == NULL ) {
- return -1;
- }
-
- printf("loading header\n");
-
- if ( ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->summary_header_load(s, in) == -1) {
- fclose(in);
- return -1;
- }
-
- printf("loading content\n");
-
- /* now read in each message ... */
- /* FIXME: check returns */
- for (i=0;i<s->saved_count;i++) {
- mi = ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->message_info_load(s, in);
-
- if (s->build_content) {
- mi->content = perform_content_info_load(s, in);
- }
-
- camel_folder_summary_add(s, mi);
- }
-
- if (fclose(in) == -1)
- return -1;
-
- s->flags &= ~CAMEL_SUMMARY_DIRTY;
-
- return 0;
-}
-
-/* saves the content descriptions, recursively */
-static int
-perform_content_info_save(CamelFolderSummary *s, FILE *out, CamelMessageContentInfo *ci)
-{
- CamelMessageContentInfo *part;
-
- ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->content_info_save(s, out, ci);
- camel_folder_summary_encode_uint32(out, my_list_size((struct _node **)&ci->childs));
- part = ci->childs;
- while (part) {
- perform_content_info_save(s, out, part);
- part = part->next;
- }
- return 0;
-}
-
-int
-camel_folder_summary_save(CamelFolderSummary *s)
-{
- FILE *out;
- int fd;
- int i;
- guint32 count;
- CamelMessageInfo *mi;
-
- g_assert(s->summary_path);
-
- printf("saving summary? '%s'\n", s->summary_path);
-
- if ((s->flags & CAMEL_SUMMARY_DIRTY) == 0) {
- printf("nup\n");
- return 0;
- }
-
- printf("yep\n");
-
- fd = open(s->summary_path, O_RDWR|O_CREAT, 0600);
- if (fd == -1)
- return -1;
- out = fdopen(fd, "w");
- if ( out == NULL ) {
- close(fd);
- return -1;
- }
-
- io(printf("saving header\n"));
-
- if ( ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->summary_header_save(s, out) == -1) {
- fclose(out);
- return -1;
- }
-
- /* now write out each message ... */
- /* FIXME: check returns */
- count = camel_folder_summary_count(s);
- for (i=0;i<count;i++) {
- mi = camel_folder_summary_index(s, i);
- ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->message_info_save(s, out, mi);
-
- if (s->build_content) {
- perform_content_info_save(s, out, mi->content);
- }
- }
- if (fclose(out) == -1)
- return -1;
-
- s->flags &= ~CAMEL_SUMMARY_DIRTY;
- return 0;
-}
-
-void camel_folder_summary_add(CamelFolderSummary *s, CamelMessageInfo *info)
-{
- if (info == NULL)
- return;
-retry:
- if (info->uid == NULL) {
- info->uid = g_strdup_printf("%u", s->nextuid++);
- }
- if (g_hash_table_lookup(s->messages_uid, info->uid)) {
- g_warning("Trying to insert message with clashing uid. new uid re-assigned");
- g_free(info->uid);
- info->uid = NULL;
- goto retry;
- }
-
- g_ptr_array_add(s->messages, info);
- g_hash_table_insert(s->messages_uid, info->uid, info);
- s->flags |= CAMEL_SUMMARY_DIRTY;
-}
-
-CamelMessageInfo *camel_folder_summary_add_from_header(CamelFolderSummary *s, struct _header_raw *h)
-{
- CamelMessageInfo *info = NULL;
-
- info = ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->message_info_new(s, h);
- camel_folder_summary_add(s, info);
-
- return info;
-}
-
-CamelMessageInfo *camel_folder_summary_add_from_parser(CamelFolderSummary *s, CamelMimeParser *mp)
-{
- CamelMessageInfo *info = NULL;
- char *buffer;
- int len;
- struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
-
- /* should this check the parser is in the right state, or assume it is?? */
-
- if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_EOF) {
- info = ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->message_info_new_from_parser(s, mp);
-
- camel_mime_parser_unstep(mp);
-
- /* FIXME: better uid assignment method? */
- if (info->uid == NULL) {
- info->uid = g_strdup_printf("%u", s->nextuid++);
- }
-
- if (p->index) {
- if (p->filter_index == NULL)
- p->filter_index = camel_mime_filter_index_new_ibex(p->index);
- camel_mime_filter_index_set_name(p->filter_index, info->uid);
- ibex_unindex(p->index, info->uid);
- }
-
- /* build the content info, if we're supposed to */
- if (s->build_content) {
- info->content = summary_build_content_info(s, mp);
- if (info->content->pos != -1)
- info->size = info->content->endpos - info->content->pos;
- } else {
- camel_mime_parser_drop_step(mp);
- }
-
- camel_folder_summary_add(s, info);
- }
- return info;
-}
-
-static void
-perform_content_info_free(CamelFolderSummary *s, CamelMessageContentInfo *ci)
-{
- CamelMessageContentInfo *pw, *pn;
-
- pw = ci->childs;
- ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->content_info_free(s, ci);
- while (pw) {
- pn = pw->next;
- perform_content_info_free(s, pw);
- pw = pn;
- }
-}
-
-void
-camel_folder_summary_touch(CamelFolderSummary *s)
-{
- s->flags |= CAMEL_SUMMARY_DIRTY;
-}
-
-void
-camel_folder_summary_clear(CamelFolderSummary *s)
-{
- int i;
-
- if (camel_folder_summary_count(s) == 0)
- return;
-
- for (i=0;i<camel_folder_summary_count(s);i++) {
- CamelMessageInfo *mi = camel_folder_summary_index(s, i);
- CamelMessageContentInfo *ci = mi->content;
-
- ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->message_info_free(s, mi);
- if (s->build_content && ci) {
- perform_content_info_free(s, ci);
- }
- }
-
- g_ptr_array_set_size(s->messages, 0);
- g_hash_table_destroy(s->messages_uid);
- s->messages_uid = g_hash_table_new(g_str_hash, g_str_equal);
- s->flags |= CAMEL_SUMMARY_DIRTY;
-}
-
-void camel_folder_summary_remove(CamelFolderSummary *s, CamelMessageInfo *info)
-{
- CamelMessageContentInfo *ci = info->content;
-
- g_hash_table_remove(s->messages_uid, info->uid);
- g_ptr_array_remove(s->messages, info);
- ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->message_info_free(s, info);
- if (s->build_content && ci) {
- perform_content_info_free(s, ci);
- }
- s->flags |= CAMEL_SUMMARY_DIRTY;
-}
-
-void camel_folder_summary_remove_uid(CamelFolderSummary *s, const char *uid)
-{
- CamelMessageInfo *oldinfo;
- char *olduid;
-
- if (g_hash_table_lookup_extended(s->messages_uid, uid, (void *)&olduid, (void *)&oldinfo)) {
- camel_folder_summary_remove(s, oldinfo);
- g_free(olduid);
- }
-}
-
-int
-camel_folder_summary_encode_uint32(FILE *out, guint32 value)
-{
- int i;
-
- io(printf("Encoding int %u\n", value));
-
- for (i=28;i>0;i-=7) {
- if (value >= (1<<i)) {
- unsigned int c = (value>>i) & 0x7f;
- if (fputc(c, out) == -1)
- return -1;
- }
- }
- return fputc(value | 0x80, out);
-}
-
-int
-camel_folder_summary_decode_uint32(FILE *in, guint32 *dest)
-{
- gint32 value=0, v;
-
- /* until we get the last byte, keep decoding 7 bits at a time */
- while ( ((v = fgetc(in)) & 0x80) == 0 && v!=EOF) {
- value |= v;
- value <<= 7;
- }
- if (v == EOF) {
- *dest = value>>7;
- return 01;
- }
- *dest = value | (v&0x7f);
-
- io(printf("Decoding int %u\n", *dest));
-
- return 0;
-}
-
-int
-camel_folder_summary_encode_fixed_int32(FILE *out, gint32 value)
-{
- guint32 save;
-
- save = htonl(value);
- if (fwrite(&save, sizeof(save), 1, out) != 1)
- return -1;
- return 0;
-}
-
-int
-camel_folder_summary_decode_fixed_int32(FILE *in, gint32 *dest)
-{
- guint32 save;
-
- if (fread(&save, sizeof(save), 1, in) == 1) {
- *dest = ntohl(save);
- return 0;
- } else {
- return -1;
- }
-}
-
-/* should be sorted, for binary search */
-/* This is a tokenisation mechanism for strings written to the
- summary - to save space.
- This list can have at most 31 words. */
-static char * tokens[] = {
- "7bit",
- "8bit",
- "alternative",
- "application",
- "base64",
- "boundary",
- "charset",
- "filename",
- "html",
- "image",
- "iso-8859-1",
- "iso-8859-8",
- "message",
- "mixed",
- "multipart",
- "name",
- "octet-stream",
- "parallel",
- "plain",
- "postscript",
- "quoted-printable",
- "related",
- "rfc822",
- "text",
- "us-ascii", /* 25 words */
-};
-
-#define tokens_len (sizeof(tokens)/sizeof(tokens[0]))
-
-/* baiscally ...
- 0 = null
- 1-tokens_len == tokens[id-1]
- >=32 string, length = n-32
-*/
-
-#ifdef USE_BSEARCH
-static int
-token_search_cmp(char *key, char **index)
-{
- d(printf("comparing '%s' to '%s'\n", key, *index));
- return strcmp(key, *index);
-}
-#endif
-
-int
-camel_folder_summary_encode_token(FILE *out, char *str)
-{
- io(printf("Encoding token: '%s'\n", str));
-
- if (str == NULL) {
- return camel_folder_summary_encode_uint32(out, 0);
- } else {
- int len = strlen(str);
- int i, token=-1;
-
- if (len <= 16) {
- char lower[32];
- char **match;
-
- for (i=0;i<len;i++)
- lower[i] = tolower(str[i]);
- lower[i] = 0;
-#ifdef USE_BSEARCH
- match = bsearch(lower, tokens, tokens_len, sizeof(char *), (int (*)(void *, void *))token_search_cmp);
- if (match)
- token = match-tokens;
-#else
- for (i=0;i<tokens_len;i++) {
- if (!strcmp(tokens[i], lower)) {
- token = i;
- break;
- }
- }
-#endif
- }
- if (token != -1) {
- return camel_folder_summary_encode_uint32(out, token+1);
- } else {
- if (camel_folder_summary_encode_uint32(out, len+32) == -1)
- return -1;
- if (fwrite(str, len, 1, out) != 1)
- return -1;
- }
- }
- return 0;
-}
-
-int
-camel_folder_summary_decode_token(FILE *in, char **str)
-{
- char *ret;
- int len;
-
- io(printf("Decode token ...\n"));
-
- if (camel_folder_summary_decode_uint32(in, &len) == -1) {
- g_warning("Could not decode token from file");
- *str = NULL;
- return -1;
- }
-
- if (len<32) {
- if (len <= 0) {
- ret = NULL;
- } else if (len<= tokens_len) {
- ret = g_strdup(tokens[len-1]);
- } else {
- g_warning("Invalid token encountered: %d", len);
- *str = NULL;
- return -1;
- }
- } else if (len > 10240) {
- g_warning("Got broken string header length: %d bytes", len);
- *str = NULL;
- return -1;
- } else {
- len -= 32;
- ret = g_malloc(len+1);
- if (fread(ret, len, 1, in) != 1) {
- g_free(ret);
- *str = NULL;
- return -1;
- }
- ret[len]=0;
- }
-
- io(printf("Token = '%s'\n", ret));
-
- *str = ret;
- return 0;
-}
-
-int
-camel_folder_summary_encode_string(FILE *out, char *str)
-{
- register int len;
-
- io(printf("Encoding string: '%s'\n", str));
-
- if (str == NULL)
- return camel_folder_summary_encode_uint32(out, 0);
-
- len = strlen(str);
- if (camel_folder_summary_encode_uint32(out, len+1) == -1)
- return -1;
- if (fwrite(str, len, 1, out) == 1)
- return 0;
- return -1;
-}
-
-
-int
-camel_folder_summary_decode_string(FILE *in, char **str)
-{
- int len;
- register char *ret;
-
- io(printf("Decode string ...\n", str));
-
- if (camel_folder_summary_decode_uint32(in, &len) == -1) {
- *str = NULL;
- return -1;
- }
-
- len--;
- if (len < 0) {
- *str = NULL;
- io(printf("String = '%s'\n", *str));
- return -1;
- }
-
- ret = g_malloc(len+1);
- if (fread(ret, len, 1, in) != 1) {
- g_free(ret);
- *str = NULL;
- return -1;
- }
-
- io(printf("String = '%s'\n", ret));
-
- ret[len] = 0;
- *str = ret;
- return 0;
-}
-
-void
-camel_folder_summary_offset_content(CamelMessageContentInfo *content, off_t offset)
-{
- content->pos += offset;
- content->bodypos += offset;
- content->endpos += offset;
- content = content->childs;
- while (content) {
- camel_folder_summary_offset_content(content, offset);
- content = content->next;
- }
-}
-
-static struct _node *
-my_list_append(struct _node **list, struct _node *n)
-{
- struct _node *ln = (struct _node *)list;
- while (ln->next)
- ln = ln->next;
- n->next = 0;
- ln->next = n;
- return n;
-}
-
-static int
-my_list_size(struct _node **list)
-{
- int len = 0;
- struct _node *ln = (struct _node *)list;
- while (ln->next) {
- ln = ln->next;
- len++;
- }
- return len;
-}
-
-static int
-summary_header_load(CamelFolderSummary *s, FILE *in)
-{
- guint32 version, flags, nextuid, count;
- time_t time;
-
- fseek(in, 0, SEEK_SET);
-
- io(printf("Loading header\n"));
-
- if (camel_folder_summary_decode_fixed_int32(in, &version) == -1
- || camel_folder_summary_decode_fixed_int32(in, &flags) == -1
- || camel_folder_summary_decode_fixed_int32(in, &nextuid) == -1
- || camel_folder_summary_decode_fixed_int32(in, &time) == -1 /* TODO: yes i know this warns, to be fixed later */
- || camel_folder_summary_decode_fixed_int32(in, &count) == -1) {
- return -1;
- }
-
- s->nextuid = nextuid;
- s->flags = flags;
- s->time = time;
- s->saved_count = count;
- if (s->version != version) {
- g_warning("Summary header version mismatch");
- return -1;
- }
- return 0;
-}
-
-static int
-summary_header_save(CamelFolderSummary *s, FILE *out)
-{
- fseek(out, 0, SEEK_SET);
-
- io(printf("Savining header\n"));
-
- camel_folder_summary_encode_fixed_int32(out, s->version);
- camel_folder_summary_encode_fixed_int32(out, s->flags);
- camel_folder_summary_encode_fixed_int32(out, s->nextuid);
- camel_folder_summary_encode_fixed_int32(out, s->time);
- return camel_folder_summary_encode_fixed_int32(out, camel_folder_summary_count(s));
-}
-
-/* are these even useful for anything??? */
-static CamelMessageInfo * message_info_new_from_parser(CamelFolderSummary *s, CamelMimeParser *mp)
-{
- CamelMessageInfo *mi = NULL;
- int state;
-
- state = camel_mime_parser_state(mp);
- switch (state) {
- case HSCAN_HEADER:
- case HSCAN_MESSAGE:
- case HSCAN_MULTIPART:
- mi = ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->message_info_new(s, camel_mime_parser_headers_raw(mp));
- break;
- default:
- g_error("Invalid parser state");
- }
-
- return mi;
-}
-
-static CamelMessageContentInfo * content_info_new_from_parser(CamelFolderSummary *s, CamelMimeParser *mp)
-{
- CamelMessageContentInfo *ci = NULL;
-
- switch (camel_mime_parser_state(mp)) {
- case HSCAN_HEADER:
- case HSCAN_MESSAGE:
- case HSCAN_MULTIPART:
- ci = ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->content_info_new(s, camel_mime_parser_headers_raw(mp));
- if (ci) {
- ci->type = camel_mime_parser_content_type(mp);
- header_content_type_ref(ci->type);
- }
- break;
- default:
- g_error("Invalid parser state");
- }
-
- return ci;
-}
-
-static char *
-summary_format_address(struct _header_raw *h, const char *name)
-{
- struct _header_address *addr;
- const char *text;
- char *ret;
-
- text = header_raw_find(&h, name, NULL);
- addr = header_address_decode(text);
- if (addr) {
- ret = header_address_list_format(addr);
- header_address_list_clear(&addr);
- } else {
- ret = g_strdup(text);
- }
- return ret;
-}
-
-static char *
-summary_format_string(struct _header_raw *h, const char *name)
-{
- const char *text;
-
- text = header_raw_find(&h, name, NULL);
- if (text) {
- while (isspace(*text))
- text++;
- return header_decode_string(text);
- } else {
- return NULL;
- }
-}
-
-static CamelMessageInfo *
-message_info_new(CamelFolderSummary *s, struct _header_raw *h)
-{
- CamelMessageInfo *mi;
-
- mi = g_malloc0(s->message_info_size);
-
- mi->subject = summary_format_string(h, "subject");
- mi->from = summary_format_address(h, "from");
- mi->to = summary_format_address(h, "to");
- mi->user_flags = NULL;
- mi->date_sent = header_decode_date(header_raw_find(&h, "date", NULL), NULL);
- mi->date_received = 0;
-
- return mi;
-}
-
-
-static CamelMessageInfo *
-message_info_load(CamelFolderSummary *s, FILE *in)
-{
- CamelMessageInfo *mi;
- guint count;
- int i;
-
- mi = g_malloc0(s->message_info_size);
-
- io(printf("Loading message info\n"));
-
- camel_folder_summary_decode_string(in, &mi->uid);
- camel_folder_summary_decode_uint32(in, &mi->flags);
- camel_folder_summary_decode_uint32(in, &mi->date_sent); /* warnings, leave them here */
- camel_folder_summary_decode_uint32(in, &mi->date_received);
-/* ms->xev_offset = camel_folder_summary_decode_uint32(in);*/
- camel_folder_summary_decode_string(in, &mi->subject);
- camel_folder_summary_decode_string(in, &mi->from);
- camel_folder_summary_decode_string(in, &mi->to);
- mi->content = NULL;
-
- camel_folder_summary_decode_uint32(in, &count);
- for (i=0;i<count;i++) {
- char *name;
- camel_folder_summary_decode_string(in, &name);
- camel_flag_set(&mi->user_flags, name, TRUE);
- g_free(name);
- }
-
- return mi;
-}
-
-static int
-message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
-{
- guint32 count;
- CamelFlag *flag;
-
- io(printf("Saving message info\n"));
-
- camel_folder_summary_encode_string(out, mi->uid);
- camel_folder_summary_encode_uint32(out, mi->flags);
- camel_folder_summary_encode_uint32(out, mi->date_sent);
- camel_folder_summary_encode_uint32(out, mi->date_received);
-/* camel_folder_summary_encode_uint32(out, ms->xev_offset);*/
- camel_folder_summary_encode_string(out, mi->subject);
- camel_folder_summary_encode_string(out, mi->from);
- camel_folder_summary_encode_string(out, mi->to);
-
- count = camel_flag_list_size(&mi->user_flags);
- camel_folder_summary_encode_uint32(out, count);
- flag = mi->user_flags;
- while (flag) {
- camel_folder_summary_encode_string(out, flag->name);
- flag = flag->next;
- }
- return ferror(out);
-}
-
-static void
-message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
-{
- g_free(mi->uid);
- g_free(mi->subject);
- g_free(mi->from);
- g_free(mi->to);
- camel_flag_list_free(&mi->user_flags);
- g_free(mi);
-}
-
-static CamelMessageContentInfo *
-content_info_new(CamelFolderSummary *s, struct _header_raw *h)
-{
- CamelMessageContentInfo *ci;
-
- ci = g_malloc0(s->content_info_size);
-
- ci->id = header_msgid_decode(header_raw_find(&h, "content-id", NULL));
- ci->description = header_decode_string(header_raw_find(&h, "content-description", NULL));
- ci->encoding = header_content_encoding_decode(header_raw_find(&h, "content-transfer-encoding", NULL));
-
- ci->pos = -1;
- ci->bodypos = -1;
- ci->endpos = -1;
- return ci;
-}
-
-static CamelMessageContentInfo *
-content_info_load(CamelFolderSummary *s, FILE *in)
-{
- CamelMessageContentInfo *ci;
- char *type, *subtype;
- guint32 count, i;
- struct _header_content_type *ct;
-
- io(printf("Loading content info\n"));
-
- ci = g_malloc0(s->content_info_size);
-
- camel_folder_summary_decode_uint32(in, &ci->pos);
- camel_folder_summary_decode_uint32(in, &ci->bodypos);
- camel_folder_summary_decode_uint32(in, &ci->endpos);
-
- camel_folder_summary_decode_token(in, &type);
- camel_folder_summary_decode_token(in, &subtype);
- ct = header_content_type_new(type, subtype);
- g_free(type); /* can this be removed? */
- g_free(subtype);
- camel_folder_summary_decode_uint32(in, &count);
- for (i=0;i<count;i++) {
- char *name, *value;
- camel_folder_summary_decode_token(in, &name);
- camel_folder_summary_decode_token(in, &value);
- header_content_type_set_param(ct, name, value);
- /* TODO: do this so we dont have to double alloc/free */
- g_free(name);
- g_free(value);
- }
- ci->type = ct;
-
- camel_folder_summary_decode_token(in, &ci->id);
- camel_folder_summary_decode_token(in, &ci->description);
- camel_folder_summary_decode_token(in, &ci->encoding);
-
- ci->childs = NULL;
- return ci;
-}
-
-static int
-content_info_save(CamelFolderSummary *s, FILE *out, CamelMessageContentInfo *ci)
-{
- struct _header_content_type *ct;
- struct _header_param *hp;
-
- io(printf("Saving content info\n"));
-
- camel_folder_summary_encode_uint32(out, ci->pos);
- camel_folder_summary_encode_uint32(out, ci->bodypos);
- camel_folder_summary_encode_uint32(out, ci->endpos);
-
- ct = ci->type;
- if (ct) {
- camel_folder_summary_encode_token(out, ct->type);
- camel_folder_summary_encode_token(out, ct->subtype);
- camel_folder_summary_encode_uint32(out, my_list_size((struct _node **)&ct->params));
- hp = ct->params;
- while (hp) {
- camel_folder_summary_encode_token(out, hp->name);
- camel_folder_summary_encode_token(out, hp->value);
- hp = hp->next;
- }
- } else {
- camel_folder_summary_encode_token(out, NULL);
- camel_folder_summary_encode_token(out, NULL);
- camel_folder_summary_encode_uint32(out, 0);
- }
- camel_folder_summary_encode_token(out, ci->id);
- camel_folder_summary_encode_token(out, ci->description);
- return camel_folder_summary_encode_token(out, ci->encoding);
-}
-
-static void
-content_info_free(CamelFolderSummary *s, CamelMessageContentInfo *ci)
-{
- header_content_type_unref(ci->type);
- g_free(ci->id);
- g_free(ci->description);
- g_free(ci->encoding);
- g_free(ci);
-}
-
-/*
- OK
- Now this is where all the "smarts" happen, where the content info is built,
- and any indexing and what not is performed
-*/
-
-static CamelMessageContentInfo *
-summary_build_content_info(CamelFolderSummary *s, CamelMimeParser *mp)
-{
- int state, len;
- char *buffer;
- CamelMessageContentInfo *info = NULL;
- struct _header_content_type *ct;
- int body;
- int enc_id = -1, chr_id = -1, idx_id = -1;
- struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
- CamelMimeFilterCharset *mfc;
- CamelMessageContentInfo *part;
-
- d(printf("building content info\n"));
-
- /* start of this part */
- state = camel_mime_parser_step(mp, &buffer, &len);
- body = camel_mime_parser_tell(mp);
-
- info = ((CamelFolderSummaryClass *)((GtkObject *)s)->klass)->content_info_new_from_parser(s, mp);
-
- info->pos = camel_mime_parser_tell_start_headers(mp);
- info->bodypos = body;
-
- switch(state) {
- case HSCAN_HEADER:
- /* check content type for indexing, then read body */
- ct = camel_mime_parser_content_type(mp);
- if (p->index && header_content_type_is(ct, "text", "*")) {
- char *encoding;
- const char *charset;
-
- d(printf("generating index:\n"));
-
- encoding = header_content_encoding_decode(camel_mime_parser_header(mp, "content-transfer-encoding", NULL));
- if (encoding) {
- if (!strcasecmp(encoding, "base64")) {
- d(printf(" decoding base64\n"));
- if (p->filter_64 == NULL)
- p->filter_64 = camel_mime_filter_basic_new_type(CAMEL_MIME_FILTER_BASIC_BASE64_DEC);
- enc_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)p->filter_64);
- } else if (!strcasecmp(encoding, "quoted-printable")) {
- d(printf(" decoding quoted-printable\n"));
- if (p->filter_qp == NULL)
- p->filter_qp = camel_mime_filter_basic_new_type(CAMEL_MIME_FILTER_BASIC_QP_DEC);
- enc_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)p->filter_qp);
- } else {
- d(printf(" ignoring encoding %s\n", encoding));
- }
- g_free(encoding);
- }
-
- charset = header_content_type_param(ct, "charset");
- if (charset!=NULL
- && !(strcasecmp(charset, "us-ascii")==0
- || strcasecmp(charset, "utf-8")==0)) {
- d(printf(" Adding conversion filter from %s to utf-8\n", charset));
- mfc = g_hash_table_lookup(p->filter_charset, charset);
- if (mfc == NULL) {
- mfc = camel_mime_filter_charset_new_convert(charset, "utf-8");
- if (mfc)
- g_hash_table_insert(p->filter_charset, g_strdup(charset), mfc);
- }
- if (mfc) {
- chr_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)mfc);
- } else {
- g_warning("Cannot convert '%s' to 'utf-8', message index may be corrupt", charset);
- }
- }
-
- /* and this filter actually does the indexing */
- idx_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)p->filter_index);
- }
- /* and scan/index everything */
- while (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_BODY_END)
- ;
- /* and remove the filters */
- camel_mime_parser_filter_remove(mp, enc_id);
- camel_mime_parser_filter_remove(mp, chr_id);
- camel_mime_parser_filter_remove(mp, idx_id);
- break;
- case HSCAN_MULTIPART:
- d(printf("Summarising multipart\n"));
- while (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_MULTIPART_END) {
- camel_mime_parser_unstep(mp);
- part = summary_build_content_info(s, mp);
- if (part) {
- part->parent = info;
- my_list_append((struct _node **)&info->childs, (struct _node *)part);
- } else {
- g_error("Parsing failed: could not build part of a multipart");
- }
- }
- break;
- case HSCAN_MESSAGE:
- d(printf("Summarising message\n"));
- part = summary_build_content_info(s, mp);
- if (part) {
- part->parent = info;
- my_list_append((struct _node **)&info->childs, (struct _node *)part);
- } else {
- g_error("Parsing failed: no content of a message?");
- }
- state = camel_mime_parser_step(mp, &buffer, &len);
- if (state != HSCAN_MESSAGE_END) {
- g_error("Bad parser state: Expecing MESSAGE_END or MESSAGE_EOF, got: %d", state);
- camel_mime_parser_unstep(mp);
- }
- break;
- }
-
- info->endpos = camel_mime_parser_tell(mp);
-
- d(printf("finished building content info\n"));
-
- return info;
-}
-
-static void
-content_info_dump(CamelMessageContentInfo *ci, int depth)
-{
- char *p;
-
- p = alloca(depth*4+1);
- memset(p, ' ', depth*4);
- p[depth*4] = 0;
-
- if (ci == NULL) {
- printf("%s<empty>\n", p);
- return;
- }
-
- printf("%sconent-type: %s/%s\n", p, ci->type->type, ci->type->subtype);
- printf("%sontent-transfer-encoding: %s\n", p, ci->encoding);
- printf("%scontent-description: %s\n", p, ci->description);
- printf("%sbytes: %d %d %d\n", p, (int)ci->pos, (int)ci->bodypos, (int)ci->endpos);
- ci = ci->childs;
- while (ci) {
- content_info_dump(ci, depth+1);
- ci = ci->next;
- }
-}
-
-static void
-message_info_dump(CamelMessageInfo *mi)
-{
- if (mi == NULL) {
- printf("No message?\n");
- return;
- }
-
- printf("Subject: %s\n", mi->subject);
- printf("To: %s\n", mi->to);
- printf("From: %s\n", mi->from);
- printf("UID: %s\n", mi->uid);
- printf("Flags: %04x\n", mi->flags & 0xffff);
- content_info_dump(mi->content, 0);
-}
-
-
-#if 0
-int main(int argc, char **argv)
-{
- CamelMimeParser *mp;
- int fd;
- CamelFolderSummary *s;
- char *buffer;
- int len;
- int i;
- ibex *index;
-
- gtk_init(&argc, &argv);
-
-#if 0
- {
- int i;
- char *s;
- char buf[1024];
-
- for (i=0;i<434712;i++) {
- memcpy(buf, " ", 50);
- buf[50] = 0;
-#if 0
- s = g_strdup(buf);
- g_free(s);
-#endif
- }
- return 0;
- }
-#endif
-
- if (argc < 2 ) {
- printf("usage: %s mbox\n", argv[0]);
- return 1;
- }
-
- fd = open(argv[1], O_RDONLY);
-
- index = ibex_open("index.ibex", O_CREAT|O_RDWR, 0600);
-
- mp = camel_mime_parser_new();
- camel_mime_parser_scan_from(mp, TRUE);
-/* camel_mime_parser_set_header_regex(mp, "^(content-[^:]*|subject|from|to|date):");*/
- camel_mime_parser_init_with_fd(mp, fd);
-
- s = camel_folder_summary_new();
- camel_folder_summary_set_build_content(s, TRUE);
-/* camel_folder_summary_set_index(s, index);*/
-
- while (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_FROM) {
- /*printf("Parsing message ...\n");*/
- camel_folder_summary_add_from_parser(s, mp);
- if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_FROM_END) {
- g_warning("Uknown state encountered, excpecting %d, got %d\n", HSCAN_FROM_END, camel_mime_parser_state(mp));
- break;
- }
- }
-
- printf("Printing summary\n");
- for (i=0;i<camel_folder_summary_count(s);i++) {
- message_info_dump(camel_folder_summary_index(s, i));
- }
-
- printf("Saivng summary\n");
- camel_folder_summary_set_filename(s, "index.summary");
- camel_folder_summary_save(s);
-
- {
- CamelFolderSummary *n;
-
- printf("\nLoading summary\n");
- n = camel_folder_summary_new();
- camel_folder_summary_set_build_content(n, TRUE);
- camel_folder_summary_set_filename(n, "index.summary");
- camel_folder_summary_load(n);
-
- printf("Printing summary\n");
- for (i=0;i<camel_folder_summary_count(n);i++) {
- message_info_dump(camel_folder_summary_index(n, i));
- }
- gtk_object_unref(n);
- }
-
-
- gtk_object_unref(mp);
- gtk_object_unref(s);
-
- printf("summarised %d messages\n", camel_folder_summary_count(s));
-#if 0
- printf("g_strdup count = %d\n", strdup_count);
- printf("g_malloc count = %d\n", malloc_count);
- printf("g_free count = %d\n", free_count);
-#endif
- return 0;
-}
-
-#endif
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
deleted file mode 100644
index a22172c41b..0000000000
--- a/camel/camel-folder-summary.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef _CAMEL_FOLDER_SUMMARY_H
-#define _CAMEL_FOLDER_SUMMARY_H
-
-#include <camel/camel-object.h>
-#include <stdio.h>
-#include <time.h>
-#include <camel/camel-mime-parser.h>
-#include <libibex/ibex.h>
-
-#define CAMEL_FOLDER_SUMMARY(obj) GTK_CHECK_CAST (obj, camel_folder_summary_get_type (), CamelFolderSummary)
-#define CAMEL_FOLDER_SUMMARY_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_folder_summary_get_type (), CamelFolderSummaryClass)
-#define IS_CAMEL_FOLDER_SUMMARY(obj) GTK_CHECK_TYPE (obj, camel_folder_summary_get_type ())
-
-/*typedef struct _CamelFolderSummary CamelFolderSummary;*/
-typedef struct _CamelFolderSummaryClass CamelFolderSummaryClass;
-
-/* these structs from camel-folder-summary.h ... (remove comment after cleanup soon) */
-/* TODO: perhaps they should be full-block objects? */
-/* FIXME: rename this to something more suitable */
-typedef struct {
- gchar *name;
- gint nb_message; /* ick, these should be renamed to something better */
- gint nb_unread_message;
- gint nb_deleted_message;
-} CamelFolderInfo;
-
-/* A tree of message content info structures
- describe the content structure of the message (if it has any) */
-typedef struct _CamelMessageContentInfo {
- struct _CamelMessageContentInfo *next;
-
- struct _CamelMessageContentInfo *childs;
- struct _CamelMessageContentInfo *parent;
-
- struct _header_content_type *type;
- char *id;
- char *description;
- char *encoding;
-
- /* information about where this object lives in the stream.
- if pos is -1 these are all invalid */
- off_t pos;
- off_t bodypos;
- off_t endpos;
-} CamelMessageContentInfo;
-
-/* information about a given object */
-typedef struct {
- /* public fields */
- gchar *subject;
- gchar *to;
- gchar *from;
-
- gchar *uid;
- guint32 flags;
- guint32 size;
-
- time_t date_sent;
- time_t date_received;
-
- struct _CamelFlag *user_flags;
-
- /* tree of content description - NULL if it is not available */
- CamelMessageContentInfo *content;
-} CamelMessageInfo;
-
-enum _CamelFolderSummaryFlags {
- CAMEL_SUMMARY_DIRTY = 1<<0,
-};
-
-struct _CamelFolderSummary {
- CamelObject parent;
-
- struct _CamelFolderSummaryPrivate *priv;
-
- /* header info */
- guint32 version; /* version of file required, should be set by implementors */
- guint32 flags; /* flags */
- guint32 nextuid; /* next uid? */
- guint32 saved_count; /* how many were saved/loaded */
- time_t time; /* timestamp for this summary (for implementors to use) */
-
- /* sizes of memory objects */
- guint32 message_info_size;
- guint32 content_info_size;
-
- char *summary_path;
- gboolean build_content; /* do we try and parse/index the content, or not? */
-
- GPtrArray *messages; /* CamelMessageInfo's */
- GHashTable *messages_uid; /* CamelMessageInfo's by uid */
-};
-
-struct _CamelFolderSummaryClass {
- CamelObjectClass parent_class;
-
- /* load/save the global info */
- int (*summary_header_load)(CamelFolderSummary *, FILE *);
- int (*summary_header_save)(CamelFolderSummary *, FILE *);
-
- /* create/save/load an individual message info */
- CamelMessageInfo * (*message_info_new)(CamelFolderSummary *, struct _header_raw *);
- CamelMessageInfo * (*message_info_new_from_parser)(CamelFolderSummary *, CamelMimeParser *);
- CamelMessageInfo * (*message_info_load)(CamelFolderSummary *, FILE *);
- int (*message_info_save)(CamelFolderSummary *, FILE *, CamelMessageInfo *);
- void (*message_info_free)(CamelFolderSummary *, CamelMessageInfo *);
-
- /* save/load individual content info's */
- CamelMessageContentInfo * (*content_info_new)(CamelFolderSummary *, struct _header_raw *);
- CamelMessageContentInfo * (*content_info_new_from_parser)(CamelFolderSummary *, CamelMimeParser *);
- CamelMessageContentInfo * (*content_info_load)(CamelFolderSummary *, FILE *);
- int (*content_info_save)(CamelFolderSummary *, FILE *, CamelMessageContentInfo *);
- void (*content_info_free)(CamelFolderSummary *, CamelMessageContentInfo *);
-};
-
-guint camel_folder_summary_get_type (void);
-CamelFolderSummary *camel_folder_summary_new (void);
-
-void camel_folder_summary_set_filename(CamelFolderSummary *, const char *);
-void camel_folder_summary_set_index(CamelFolderSummary *, ibex *);
-void camel_folder_summary_set_uid(CamelFolderSummary *, guint32);
-void camel_folder_summary_set_build_content(CamelFolderSummary *, gboolean state);
-
-guint32 camel_folder_summary_next_uid(CamelFolderSummary *s);
-
-/* load/save the summary in its entirety */
-int camel_folder_summary_load(CamelFolderSummary *);
-int camel_folder_summary_save(CamelFolderSummary *);
-
-/* set the dirty bit on the summary */
-void camel_folder_summary_touch(CamelFolderSummary *s);
-
-/* add a new raw summary item */
-void camel_folder_summary_add(CamelFolderSummary *, CamelMessageInfo *info);
-
-/* build/add raw summary items */
-CamelMessageInfo *camel_folder_summary_add_from_header(CamelFolderSummary *, struct _header_raw *);
-CamelMessageInfo *camel_folder_summary_add_from_parser(CamelFolderSummary *, CamelMimeParser *);
-
-/* removes a summary item, doesn't fix content offsets */
-void camel_folder_summary_remove(CamelFolderSummary *s, CamelMessageInfo *info);
-void camel_folder_summary_remove_uid(CamelFolderSummary *s, const char *uid);
-/* remove all items */
-void camel_folder_summary_clear(CamelFolderSummary *s);
-
-/* lookup functions */
-int camel_folder_summary_count(CamelFolderSummary *);
-CamelMessageInfo *camel_folder_summary_index(CamelFolderSummary *, int);
-CamelMessageInfo *camel_folder_summary_uid(CamelFolderSummary *, const char *uid);
-
-/* utility functions */
-void camel_folder_summary_set_flags_by_uid(CamelFolderSummary *s, const char *uid, guint32 flags);
-/* shift content ... */
-void camel_folder_summary_offset_content(CamelMessageContentInfo *content, off_t offset);
-
-/* summary file loading/saving helper functions */
-int camel_folder_summary_encode_fixed_int32(FILE *, gint32);
-int camel_folder_summary_decode_fixed_int32(FILE *, gint32 *);
-
-int camel_folder_summary_encode_uint32(FILE *, guint32);
-int camel_folder_summary_decode_uint32(FILE *, guint32 *);
-
-int camel_folder_summary_encode_string(FILE *, char *);
-int camel_folder_summary_decode_string(FILE *, char **);
-
-/* basically like strings, but certain keywords can be compressed and de-cased */
-int camel_folder_summary_encode_token(FILE *, char *);
-int camel_folder_summary_decode_token(FILE *, char **);
-
-#endif /* ! _CAMEL_FOLDER_SUMMARY_H */
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
deleted file mode 100644
index 34b830f564..0000000000
--- a/camel/camel-folder.c
+++ /dev/null
@@ -1,1166 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camel-folder.c: Abstract class for an email folder */
-
-/*
- * Author:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include <string.h>
-#include "camel-folder.h"
-#include "camel-exception.h"
-#include "camel-store.h"
-#include "camel-mime-message.h"
-#include "string-utils.h"
-
-static CamelObjectClass *parent_class = NULL;
-
-/* Returns the class for a CamelFolder */
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT (so)->klass)
-
-
-enum SIGNALS {
- FOLDER_CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-
-static void init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar separator, CamelException *ex);
-static void finalize (GtkObject *object);
-
-
-static void folder_open (CamelFolder *folder, CamelFolderOpenMode mode,
- CamelException *ex);
-static void folder_close (CamelFolder *folder, gboolean expunge,
- CamelException *ex);
-
-static const gchar *get_name (CamelFolder *folder);
-static const gchar *get_full_name (CamelFolder *folder);
-
-
-static gboolean can_hold_folders (CamelFolder *folder);
-static gboolean can_hold_messages (CamelFolder *folder);
-static gboolean exists (CamelFolder *folder, CamelException *ex);
-static gboolean is_open (CamelFolder *folder);
-static guint32 get_permanent_flags (CamelFolder *folder, CamelException *ex);
-static CamelFolderOpenMode get_mode (CamelFolder *folder, CamelException *ex);
-
-
-static gboolean create (CamelFolder *folder, CamelException *ex);
-static gboolean delete (CamelFolder *folder, gboolean recurse,
- CamelException *ex);
-
-
-static GPtrArray *get_subfolder_names (CamelFolder *folder,
- CamelException *ex);
-static CamelFolder *get_subfolder (CamelFolder *folder,
- const gchar *folder_name,
- CamelException *ex);
-static CamelFolder *get_parent_folder (CamelFolder *folder,
- CamelException *ex);
-static CamelStore *get_parent_store (CamelFolder *folder,
- CamelException *ex);
-
-
-static gint get_message_count (CamelFolder *folder, CamelException *ex);
-
-
-static gboolean delete_messages (CamelFolder *folder,
- CamelException *ex);
-static void expunge (CamelFolder *folder,
- CamelException *ex);
-
-
-static void append_message (CamelFolder *folder, CamelMimeMessage *message,
- CamelException *ex);
-
-
-static GPtrArray *get_uids (CamelFolder *folder,
- CamelException *ex);
-static void free_uids (CamelFolder *folder,
- GPtrArray *array);
-static GPtrArray *get_summary (CamelFolder *folder,
- CamelException *ex);
-static void free_summary (CamelFolder *folder,
- GPtrArray *array);
-static const gchar *get_message_uid (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex);
-static CamelMimeMessage *get_message_by_uid (CamelFolder *folder,
- const gchar *uid,
- CamelException *ex);
-static void delete_message_by_uid (CamelFolder *folder,
- const gchar *uid,
- CamelException *ex);
-
-static const CamelMessageInfo *summary_get_by_uid (CamelFolder *folder,
- const char *uid);
-
-static GList *search_by_expression (CamelFolder *folder, const char *exp,
- CamelException *ex);
-
-static void
-camel_folder_class_init (CamelFolderClass *camel_folder_class)
-{
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_folder_class);
-
- parent_class = gtk_type_class (camel_object_get_type ());
-
- /* virtual method definition */
- camel_folder_class->init = init;
- camel_folder_class->open = folder_open;
- camel_folder_class->close = folder_close;
- camel_folder_class->get_name = get_name;
- camel_folder_class->get_full_name = get_full_name;
- camel_folder_class->can_hold_folders = can_hold_folders;
- camel_folder_class->can_hold_messages = can_hold_messages;
- camel_folder_class->exists = exists;
- camel_folder_class->is_open = is_open;
- camel_folder_class->get_subfolder = get_subfolder;
- camel_folder_class->create = create;
- camel_folder_class->delete = delete;
- camel_folder_class->delete_messages = delete_messages;
- camel_folder_class->get_parent_folder = get_parent_folder;
- camel_folder_class->get_parent_store = get_parent_store;
- camel_folder_class->get_mode = get_mode;
- camel_folder_class->get_subfolder_names = get_subfolder_names;
- camel_folder_class->free_subfolder_names = free_uids;
- camel_folder_class->expunge = expunge;
- camel_folder_class->get_message_count = get_message_count;
- camel_folder_class->append_message = append_message;
- camel_folder_class->get_permanent_flags = get_permanent_flags;
- camel_folder_class->get_message_uid = get_message_uid;
- camel_folder_class->get_message_by_uid = get_message_by_uid;
- camel_folder_class->delete_message_by_uid = delete_message_by_uid;
- camel_folder_class->get_uids = get_uids;
- camel_folder_class->free_uids = free_uids;
- camel_folder_class->get_summary = get_summary;
- camel_folder_class->free_summary = free_summary;
- camel_folder_class->search_by_expression = search_by_expression;
- camel_folder_class->summary_get_by_uid = summary_get_by_uid;
-
- /* virtual method overload */
- gtk_object_class->finalize = finalize;
-
- signals[FOLDER_CHANGED] =
- gtk_signal_new ("folder_changed",
- GTK_RUN_LAST,
- gtk_object_class->type,
- GTK_SIGNAL_OFFSET (CamelFolderClass,
- folder_changed),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- gtk_object_class_add_signals (gtk_object_class, signals, LAST_SIGNAL);
-
-}
-
-
-GtkType
-camel_folder_get_type (void)
-{
- static GtkType camel_folder_type = 0;
-
- if (!camel_folder_type) {
- GtkTypeInfo camel_folder_info =
- {
- "CamelFolder",
- sizeof (CamelFolder),
- sizeof (CamelFolderClass),
- (GtkClassInitFunc) camel_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_folder_type = gtk_type_unique (camel_object_get_type (),
- &camel_folder_info);
- }
-
- return camel_folder_type;
-}
-
-
-static void
-finalize (GtkObject *object)
-{
- CamelFolder *camel_folder = CAMEL_FOLDER (object);
-
- g_free (camel_folder->name);
- g_free (camel_folder->full_name);
-
- if (camel_folder->parent_store)
- gtk_object_unref (GTK_OBJECT (camel_folder->parent_store));
- if (camel_folder->parent_folder)
- gtk_object_unref (GTK_OBJECT (camel_folder->parent_folder));
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-/**
- * init: init the folder
- * @folder: folder object to initialize
- * @parent_store: parent store object of the folder
- * @parent_folder: parent folder of the folder (may be NULL)
- * @name: (short) name of the folder
- * @separator: separator between the parent folder name and this name
- * @ex: a CamelException
- *
- * Initalizes the folder by setting the parent store, parent folder,
- * and name.
- **/
-static void
-init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar separator, CamelException *ex)
-{
- gchar *full_name;
- const gchar *parent_full_name;
-
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (CAMEL_IS_STORE (parent_store));
- g_return_if_fail (parent_folder == NULL || CAMEL_IS_FOLDER (parent_folder));
- g_return_if_fail (folder->parent_store == NULL);
-
- folder->parent_store = parent_store;
- gtk_object_ref (GTK_OBJECT (parent_store));
-
- folder->parent_folder = parent_folder;
- if (parent_folder)
- gtk_object_ref (GTK_OBJECT (parent_folder));
-
- folder->open_mode = FOLDER_OPEN_UNKNOWN;
- folder->open_state = FOLDER_CLOSE;
- folder->separator = separator;
-
- /* if the folder already has a name, free it */
- g_free (folder->name);
- g_free (folder->full_name);
-
- /* set those fields to NULL now, so that if an
- exception occurs, they will be set anyway */
- folder->name = NULL;
- folder->full_name = NULL;
-
- if (folder->parent_folder) {
- parent_full_name =
- camel_folder_get_full_name (folder->parent_folder);
-
- full_name = g_strdup_printf ("%s%c%s", parent_full_name,
- folder->separator, name);
- } else {
- full_name = g_strdup_printf ("%c%s", folder->separator, name);
- }
-
- folder->name = g_strdup (name);
- folder->full_name = full_name;
-}
-
-
-static void
-folder_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex)
-{
- if (folder->open_state == FOLDER_OPEN) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
- "folder is already open");
- return;
- }
-
- folder->open_state = FOLDER_OPEN;
- folder->open_mode = mode;
-}
-
-/**
- * camel_folder_open:
- * @folder: The folder object
- * @mode: open mode (R/W/RW ?)
- * @ex: exception object
- *
- * Open a folder in a given mode.
- **/
-void
-camel_folder_open (CamelFolder *folder, CamelFolderOpenMode mode,
- CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (!camel_folder_is_open (folder));
-
- CF_CLASS (folder)->open (folder, mode, ex);
-}
-
-
-static void
-folder_close (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- folder->open_state = FOLDER_CLOSE;
-}
-
-/**
- * camel_folder_close:
- * @folder: The folder object
- * @expunge: whether or not to expunge deleted messages
- * @ex: exception object
- *
- * Put a folder in its closed state, and possibly expunge the messages
- * flagged for deletion.
- **/
-void
-camel_folder_close (CamelFolder *folder, gboolean expunge,
- CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (camel_folder_is_open (folder));
-
- CF_CLASS (folder)->close (folder, expunge, ex);
-}
-
-
-static const gchar *
-get_name (CamelFolder *folder)
-{
- return folder->name;
-}
-
-/**
- * camel_folder_get_name:
- * @folder: a folder
- *
- * Get the (short) name of the folder. The fully qualified name
- * can be obtained with the get_full_name method.
- *
- * Return value: name of the folder
- **/
-const gchar *
-camel_folder_get_name (CamelFolder *folder)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
-
- return CF_CLASS (folder)->get_name (folder);
-}
-
-
-static const gchar *
-get_full_name (CamelFolder *folder)
-{
- return folder->full_name;
-}
-
-/**
- * camel_folder_get_full_name:
- * @folder: a folder
- *
- * Get the (full) name of the folder.
- *
- * Return value: full name of the folder
- **/
-const gchar *
-camel_folder_get_full_name (CamelFolder *folder)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
-
- return CF_CLASS (folder)->get_full_name (folder);
-}
-
-
-static gboolean
-can_hold_folders (CamelFolder *folder)
-{
- return folder->can_hold_folders;
-}
-
-static gboolean
-can_hold_messages (CamelFolder *folder)
-{
- return folder->can_hold_messages;
-}
-
-
-static gboolean
-exists (CamelFolder *folder, CamelException *ex)
-{
- return FALSE;
-}
-
-/**
- * camel_folder_exists:
- * @folder: folder object
- * @ex: a CamelException
- *
- * Test if a folder exists in a store. A CamelFolder can be created
- * without physically existing in a store. In that case, use
- * CamelFolder::create to create it.
- *
- * Return value: whether or not the folder exists
- **/
-gboolean
-camel_folder_exists (CamelFolder *folder, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
-
- return CF_CLASS (folder)->exists (folder, ex);
-}
-
-
-static gboolean
-is_open (CamelFolder *folder)
-{
- return folder->open_state == FOLDER_OPEN;
-}
-
-/**
- * camel_folder_is_open:
- * @folder: a folder object
- *
- * Tests if a folder is open. If not open it can be opened with
- * CamelFolder::open
- *
- * Return value: whether or not the folder is open
- **/
-gboolean
-camel_folder_is_open (CamelFolder *folder)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
-
- return CF_CLASS (folder)->is_open (folder);
-}
-
-
-static CamelFolder *
-get_subfolder (CamelFolder *folder, const gchar *folder_name,
- CamelException *ex)
-{
- CamelFolder *new_folder;
- gchar *full_name;
- const gchar *current_folder_full_name;
-
- g_return_val_if_fail (CAMEL_IS_STORE (folder->parent_store), NULL);
-
- current_folder_full_name = camel_folder_get_full_name (folder);
-
- full_name = g_strdup_printf ("%s%c%s", current_folder_full_name,
- folder->separator, folder_name);
- new_folder = camel_store_get_folder (folder->parent_store,
- full_name, ex);
- g_free (full_name);
-
- return new_folder;
-}
-
-/**
- * camel_folder_get_subfolder:
- * @folder: a folder
- * @folder_name: subfolder path
- * @ex: a CamelException
- *
- * This method returns a folder object. This folder is a subfolder of
- * the given folder. It is an error to ask for a folder whose name begins
- * with the folder separator character.
- *
- * Return value: the requested folder, or %NULL if the subfolder object
- * could not be obtained
- **/
-CamelFolder *
-camel_folder_get_subfolder (CamelFolder *folder, const gchar *folder_name,
- CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_return_val_if_fail (camel_folder_is_open (folder), NULL);
- g_return_val_if_fail (folder_name != NULL, NULL);
-
- return CF_CLASS (folder)->get_subfolder (folder, folder_name, ex);
-}
-
-
-/**
- * create: creates a folder on its store
- * @folder: a CamelFolder object.
- *
- * this routine handles the recursion mechanism.
- * Children classes have to implement the actual
- * creation mechanism. They must call this method
- * before physically creating the folder in order
- * to be sure the parent folder exists.
- * Calling this routine on an existing folder is
- * not an error, and returns %TRUE.
- *
- * Return value: %TRUE if the folder exists, %FALSE otherwise
- **/
-static gboolean
-create (CamelFolder *folder, CamelException *ex)
-{
- CamelFolder *parent;
-
- g_return_val_if_fail (folder->parent_store != NULL, FALSE);
- g_return_val_if_fail (folder->name != NULL, FALSE);
-
- /* if the folder already exists on the store, do nothing and return true */
- if (CF_CLASS (folder)->exists (folder, ex))
- return TRUE;
-
- if (folder->parent_folder) {
- camel_folder_create (folder->parent_folder, ex);
- if (camel_exception_get_id (ex))
- return FALSE;
- } else if (folder->full_name) {
- char *slash, *prefix;
-
- slash = strrchr(folder->full_name, folder->separator);
- if (slash && slash != folder->full_name) {
- prefix = g_strndup(folder->full_name, slash-folder->full_name);
- parent = camel_store_get_folder (folder->parent_store, prefix, ex);
- camel_folder_create (parent, ex);
- if (camel_exception_get_id (ex))
- return FALSE;
- }
- }
- return TRUE;
-}
-
-
-/**
- * camel_folder_create: create the folder object on the physical store
- * @folder: folder object to create
- * @ex: a CamelException
- *
- * This routine physically creates the folder on the store. Having
- * created the object does not mean the folder physically exists. If
- * it does not exist, this routine will create it. If the folder full
- * name contains more than one level of hierarchy, all folders between
- * the current folder and the last folder name will be created if not
- * existing.
- *
- * Return value: whether or not the operation succeeded
- **/
-gboolean
-camel_folder_create (CamelFolder *folder, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
- g_return_val_if_fail (!camel_folder_is_open (folder), FALSE);
-
- return CF_CLASS (folder)->create (folder, ex);
-}
-
-
-/**
- * delete: delete folder
- * @folder: folder to delete
- * @recurse: true is subfolders must also be deleted
- *
- * Delete a folder and its subfolders (if recurse is TRUE).
- * The scheme is the following:
- * 1) delete all messages in the folder
- * 2) if recurse is FALSE, and if there are subfolders
- * return FALSE, else delete current folder and retuen TRUE
- * if recurse is TRUE, delete subfolders, delete
- * current folder and return TRUE
- *
- * subclasses implementing a protocol with a different
- * deletion behaviour must emulate this one or implement
- * empty folders deletion and call this routine which
- * will do all the works for them.
- * Opertions must be done in the folllowing order:
- * - call this routine
- * - delete empty folder
- *
- * Return value: true if the folder has been deleted
- **/
-static gboolean
-delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- GPtrArray *subfolders;
- int i;
- gboolean ok;
-
- /* delete all messages in the folder */
- CF_CLASS (folder)->delete_messages (folder, ex);
- if (camel_exception_get_id (ex))
- return FALSE;
-
- subfolders = camel_folder_get_subfolder_names (folder, ex);
- if (camel_exception_get_id (ex))
- return FALSE;
-
- ok = TRUE;
- if (recurse) { /* delete subfolders */
- if (subfolders) {
- for (i = 0; ok && i < subfolders->len; i++) {
- CamelFolder *sf;
-
- sf = camel_folder_get_subfolder (folder, subfolders->pdata[i], ex);
- camel_folder_delete (sf, TRUE, ex);
- if (camel_exception_get_id (ex))
- ok = FALSE;
- }
- }
- } else if (subfolders) {
- camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_NON_EMPTY,
- "folder has subfolders");
- ok = FALSE;
- }
-
- if (subfolders)
- camel_folder_free_subfolder_names (folder, subfolders);
-
- return ok;
-}
-
-/**
- * camel_folder_delete: delete a folder
- * @folder: folder to delete
- * @recurse: %TRUE if subfolders must be deleted
- * @ex: a CamelException
- *
- * Delete a folder. All messages in the folder are deleted before the
- * folder is deleted. When @recurse is %TRUE, all subfolders are
- * deleted too. When @recurse is %FALSE and folder contains
- * subfolders, all messages are deleted, but folder deletion fails.
- *
- * Return value: whether or not deletion was successful
- **/
-gboolean
-camel_folder_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
- g_return_val_if_fail (!camel_folder_is_open (folder), FALSE);
-
- return CF_CLASS (folder)->delete (folder, recurse, ex);
-}
-
-
-static gboolean
-delete_messages (CamelFolder *folder, CamelException *ex)
-{
- g_warning ("CamelFolder::delete_messages not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return FALSE;
-}
-
-/**
- * camel_folder_delete_messages: delete all messages in the folder
- * @folder: folder
- * @ex: a CamelException
- *
- * Delete all messages stored in a folder.
- *
- * Return value: whether or not the messages could be deleted
- **/
-gboolean
-camel_folder_delete_messages (CamelFolder *folder, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
- g_return_val_if_fail (!camel_folder_is_open (folder), FALSE);
-
- return CF_CLASS (folder)->delete_messages (folder, ex);
-}
-
-
-static CamelFolder *
-get_parent_folder (CamelFolder *folder, CamelException *ex)
-{
- return folder->parent_folder;
-}
-
-/**
- * camel_folder_get_parent_folder:
- * @folder: folder to get the parent of
- * @ex: a CamelException
- *
- * Return value: the folder's parent
- **/
-CamelFolder *
-camel_folder_get_parent_folder (CamelFolder *folder, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
-
- return CF_CLASS (folder)->get_parent_folder (folder, ex);
-}
-
-
-static CamelStore *
-get_parent_store (CamelFolder *folder, CamelException *ex)
-{
- return folder->parent_store;
-}
-
-/**
- * camel_folder_get_parent_store:
- * @folder: folder to get the parent of
- * @ex: a CamelException
- *
- * Return value: the parent store of the folder.
- **/
-CamelStore *
-camel_folder_get_parent_store (CamelFolder *folder, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
-
- return CF_CLASS (folder)->get_parent_store (folder, ex);
-}
-
-
-static CamelFolderOpenMode
-get_mode (CamelFolder *folder, CamelException *ex)
-{
- return folder->open_mode;
-}
-
-/**
- * camel_folder_get_mode:
- * @folder: a folder
- * @ex: a CamelException
- *
- * Return value: the open mode of the folder
- **/
-CamelFolderOpenMode
-camel_folder_get_mode (CamelFolder *folder, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), -1);
-
- return CF_CLASS (folder)->get_mode (folder, ex);
-}
-
-
-static GPtrArray *
-get_subfolder_names (CamelFolder *folder, CamelException *ex)
-{
- g_warning ("CamelFolder::get_subfolder_names not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return NULL;
-}
-
-/**
- * camel_folder_get_subfolder_names:
- * @folder: the folder
- * @ex: a CamelException
- *
- * Return value: an array containing the names of the folder's
- * subfolders. The array should not be modified and must be freed with
- * camel_folder_free_subfolder_names().
- **/
-GPtrArray *
-camel_folder_get_subfolder_names (CamelFolder *folder, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_return_val_if_fail (camel_folder_is_open (folder), NULL);
-
- return CF_CLASS (folder)->get_subfolder_names (folder, ex);
-}
-
-
-/**
- * camel_folder_free_subfolder_names:
- * @folder: folder object
- * @array: the array of subfolder names to free
- *
- * Frees the array of names returned by camel_folder_get_subfolder_names().
- **/
-void
-camel_folder_free_subfolder_names (CamelFolder *folder, GPtrArray *array)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (camel_folder_is_open (folder));
-
- CF_CLASS (folder)->free_subfolder_names (folder, array);
-}
-
-
-static void
-expunge (CamelFolder *folder, CamelException *ex)
-{
- g_warning ("CamelFolder::expunge not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (folder)));
-}
-
-
-/**
- * camel_folder_expunge:
- * @folder: the folder
- * @ex: a CamelException
- *
- * Delete messages which have been marked as "DELETED"
- **/
-void
-camel_folder_expunge (CamelFolder *folder, CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (camel_folder_is_open (folder));
-
- return CF_CLASS (folder)->expunge (folder, ex);
-}
-
-
-static gint
-get_message_count (CamelFolder *folder, CamelException *ex)
-{
- g_warning ("CamelFolder::get_message_count not implemented "
- "for `%s'", gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return -1;
-}
-
-/**
- * camel_folder_get_message_count:
- * @folder: A CamelFolder object
- * @ex: a CamelException
- *
- * Return value: the number of messages in the folder, or -1 if unknown.
- **/
-gint
-camel_folder_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), -1);
- g_return_val_if_fail (camel_folder_is_open (folder), -1);
-
- return CF_CLASS (folder)->get_message_count (folder, ex);
-}
-
-
-static void
-append_message (CamelFolder *folder, CamelMimeMessage *message,
- CamelException *ex)
-{
- g_warning ("CamelFolder::append_message not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return;
-
-}
-
-/**
- * camel_folder_append_message: add a message to a folder
- * @folder: folder object to add the message to
- * @message: message object
- * @ex: exception object
- *
- * Add a message to a folder.
- **/
-void
-camel_folder_append_message (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (camel_folder_is_open (folder));
-
- CF_CLASS (folder)->append_message (folder, message, ex);
-}
-
-
-static guint32
-get_permanent_flags (CamelFolder *folder, CamelException *ex)
-{
- return folder->permanent_flags;
-}
-
-guint32
-camel_folder_get_permanent_flags (CamelFolder *folder, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), 0);
-
- return CF_CLASS (folder)->get_permanent_flags (folder, ex);
-}
-
-
-static const CamelMessageInfo *
-summary_get_by_uid (CamelFolder *folder, const char *uid)
-{
- g_warning ("CamelFolder::summary_get_by_uid not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return NULL;
-}
-
-/**
- * camel_folder_summary_get_by_uid:
- * @folder: a CamelFolder
- * @uid: the uid of a message
- *
- * Return value: the summary information for the indicated message
- **/
-const CamelMessageInfo *
-camel_folder_summary_get_by_uid (CamelFolder *folder, const char *uid)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_return_val_if_fail (uid != NULL, NULL);
-
- return CF_CLASS (folder)->summary_get_by_uid (folder, uid);
-}
-
-
-/* TODO: is this function required anyway? */
-gboolean
-camel_folder_has_summary_capability (CamelFolder *folder)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
-
- return folder->has_summary_capability;
-}
-
-
-/* UIDs stuff */
-
-static const gchar *
-get_message_uid (CamelFolder *folder, CamelMimeMessage *message,
- CamelException *ex)
-{
- g_warning ("CamelFolder::get_message_uid not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return NULL;
-}
-
-/**
- * camel_folder_get_message_uid:
- * @folder: Folder in which the UID must refer to
- * @message: Message object
- * @ex: a CamelException
- *
- * Return the UID of a message relatively to a folder.
- * A message can have different UID, each one corresponding
- * to a different folder, if the message is referenced in
- * several folders.
- *
- * Return value: The UID of the message in the folder
- **/
-const gchar *
-camel_folder_get_message_uid (CamelFolder *folder, CamelMimeMessage *message,
- CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
- g_return_val_if_fail (camel_folder_is_open (folder), NULL);
-
- return CF_CLASS (folder)->get_message_uid (folder, message, ex);
-}
-
-
-static CamelMimeMessage *
-get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- g_warning ("CamelFolder::get_message_by_uid not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return NULL;
-}
-
-/**
- * camel_folder_get_message_by_uid:
- * @folder: the folder object
- * @uid: the UID
- * @ex: a CamelException
- *
- * Get a message from its UID in the folder. Messages are cached
- * within a folder, that is, asking twice for the same UID returns the
- * same message object. (FIXME: is this true?)
- *
- * Return value: Message corresponding to the UID
- **/
-CamelMimeMessage *
-camel_folder_get_message_by_uid (CamelFolder *folder, const gchar *uid,
- CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_return_val_if_fail (camel_folder_is_open (folder), NULL);
-
- return CF_CLASS (folder)->get_message_by_uid (folder, uid, ex);
-}
-
-
-static void
-delete_message_by_uid (CamelFolder *folder, const gchar *uid,
- CamelException *ex)
-{
- g_warning ("CamelFolder::delete_message_by_uid not implemented "
- "for `%s'", gtk_type_name (GTK_OBJECT_TYPE (folder)));
-}
-
-/**
- * camel_folder_delete_message_by_uid:
- * @folder: the folder object
- * @uid: the UID
- * @ex: a CamelException
- *
- * Delete a message from a folder given its UID.
- **/
-void
-camel_folder_delete_message_by_uid (CamelFolder *folder, const gchar *uid,
- CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (camel_folder_is_open (folder));
-
- return CF_CLASS (folder)->delete_message_by_uid (folder, uid, ex);
-}
-
-
-static GPtrArray *
-get_uids (CamelFolder *folder, CamelException *ex)
-{
- g_warning ("CamelFolder::get_uids not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return NULL;
-}
-
-/**
- * camel_folder_get_uids:
- * @folder: folder object
- * @ex: a CamelException
- *
- * Get the list of UIDs available in a folder. This routine is useful
- * for finding what messages are available when the folder does not
- * support summaries. The returned array shoudl not be modified, and
- * must be freed by passing it to camel_folder_free_uids().
- *
- * Return value: GPtrArray of UIDs corresponding to the messages
- * available in the folder.
- **/
-GPtrArray *
-camel_folder_get_uids (CamelFolder *folder, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_return_val_if_fail (camel_folder_is_open (folder), NULL);
-
- return CF_CLASS (folder)->get_uids (folder, ex);
-}
-
-
-/* This is also the default implementation of free_subfolder_names. */
-static void
-free_uids (CamelFolder *folder, GPtrArray *array)
-{
- int i;
-
- /* Default implementation: free all of the strings and
- * the array itself.
- */
- for (i = 0; i < array->len; i++)
- g_free (array->pdata[i]);
- g_ptr_array_free (array, TRUE);
-}
-
-/**
- * camel_folder_free_uids:
- * @folder: folder object
- * @array: the array of uids to free
- *
- * Frees the array of UIDs returned by camel_folder_get_uids().
- **/
-void
-camel_folder_free_uids (CamelFolder *folder, GPtrArray *array)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (camel_folder_is_open (folder));
-
- CF_CLASS (folder)->free_uids (folder, array);
-}
-
-
-static GPtrArray *
-get_summary (CamelFolder *folder, CamelException *ex)
-{
- g_warning ("CamelFolder::get_summary not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return NULL;
-}
-
-/**
- * camel_folder_get_summary:
- * @folder: a folder object
- * @ex: a CamelException
- *
- * This returns the summary information for the folder. This array
- * should not be modified, and must be freed with
- * camel_folder_free_summary().
- *
- * Return value: an array of CamelMessageInfo
- **/
-GPtrArray *
-camel_folder_get_summary (CamelFolder *folder, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_return_val_if_fail (camel_folder_is_open (folder), NULL);
-
- return CF_CLASS (folder)->get_summary (folder, ex);
-}
-
-
-static void
-free_summary (CamelFolder *folder, GPtrArray *array)
-{
- g_warning ("CamelFolder::free_summary not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (folder)));
-}
-
-/**
- * camel_folder_free_summary:
- * @folder: folder object
- * @array: the summary array to free
- *
- * Frees the summary array returned by camel_folder_get_summary().
- **/
-void
-camel_folder_free_summary (CamelFolder *folder, GPtrArray *array)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (camel_folder_is_open (folder));
-
- CF_CLASS (folder)->free_summary (folder, array);
-}
-
-
-/**
- * camel_folder_has_search_capability:
- * @folder: Folder object
- *
- * Checks if a folder supports searching.
- *
- * Return value: %TRUE if the folder supports searching
- **/
-gboolean
-camel_folder_has_search_capability (CamelFolder *folder)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
-
- return folder->has_search_capability;
-}
-
-static GList *
-search_by_expression (CamelFolder *folder, const char *expression,
- CamelException *ex)
-{
- g_warning ("CamelFolder::search_by_expression not implemented for "
- "`%s'", gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return NULL;
-}
-
-GList *camel_folder_search_by_expression (CamelFolder *folder,
- const char *expression,
- CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_return_val_if_fail (folder->has_search_capability, NULL);
-
- return CF_CLASS (folder)->search_by_expression (folder, expression,
- ex);
-}
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
deleted file mode 100644
index c90802c6c2..0000000000
--- a/camel/camel-folder.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder.h: Abstract class for an email folder */
-
-/*
- * Author:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_FOLDER_H
-#define CAMEL_FOLDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-object.h>
-#include <camel/camel-folder-summary.h>
-
-#define CAMEL_FOLDER_TYPE (camel_folder_get_type ())
-#define CAMEL_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_FOLDER_TYPE, CamelFolder))
-#define CAMEL_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_FOLDER_TYPE, CamelFolderClass))
-#define CAMEL_IS_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_FOLDER_TYPE))
-
-typedef enum {
- FOLDER_OPEN,
- FOLDER_CLOSE
-} CamelFolderState;
-
-typedef enum {
- FOLDER_OPEN_UNKNOWN = 0, /* folder open mode is unknown */
- FOLDER_OPEN_READ = 1, /* folder is read only */
- FOLDER_OPEN_WRITE = 2, /* folder is write only */
- FOLDER_OPEN_RW = 3 /* folder is read/write */
-} CamelFolderOpenMode;
-
-struct _CamelFolder
-{
- CamelObject parent_object;
-
- CamelFolderOpenMode open_mode;
- CamelFolderState open_state;
- gchar *name;
- gchar *full_name;
- gchar separator;
- CamelStore *parent_store;
- CamelFolder *parent_folder;
- guint32 permanent_flags;
-
- gboolean can_hold_folders:1;
- gboolean can_hold_messages:1;
- gboolean has_summary_capability:1;
- gboolean has_search_capability:1;
-};
-
-typedef struct {
- CamelObjectClass parent_class;
-
- /* signals */
- void (*folder_changed) (CamelFolder *, int type);
-
- /* Virtual methods */
- void (*init) (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar separator, CamelException *ex);
-
- void (*open) (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex);
-
- void (*close) (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex);
-
- const gchar * (*get_name) (CamelFolder *folder);
-
- const gchar * (*get_full_name) (CamelFolder *folder);
-
- gboolean (*can_hold_folders) (CamelFolder *folder);
-
- gboolean (*can_hold_messages) (CamelFolder *folder);
-
- gboolean (*exists) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*is_open) (CamelFolder *folder);
-
- CamelFolder * (*get_subfolder) (CamelFolder *folder,
- const gchar *folder_name,
- CamelException *ex);
-
- gboolean (*create) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*delete) (CamelFolder *folder,
- gboolean recurse,
- CamelException *ex);
-
- gboolean (*delete_messages) (CamelFolder *folder,
- CamelException *ex);
-
- CamelFolder * (*get_parent_folder) (CamelFolder *folder,
- CamelException *ex);
-
- CamelStore * (*get_parent_store) (CamelFolder *folder,
- CamelException *ex);
-
- CamelFolderOpenMode (*get_mode) (CamelFolder *folder,
- CamelException *ex);
-
- void (*expunge) (CamelFolder *folder,
- CamelException *ex);
-
- gint (*get_message_count) (CamelFolder *folder,
- CamelException *ex);
-
- void (*append_message) (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex);
-
- guint32 (*get_permanent_flags) (CamelFolder *folder,
- CamelException *ex);
-
- const gchar * (*get_message_uid) (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex);
-
- CamelMimeMessage * (*get_message_by_uid) (CamelFolder *folder,
- const gchar *uid,
- CamelException *ex);
-
- void (*delete_message_by_uid) (CamelFolder *folder,
- const gchar *uid,
- CamelException *ex);
-
- GPtrArray * (*get_uids) (CamelFolder *folder,
- CamelException *ex);
- void (*free_uids) (CamelFolder *folder,
- GPtrArray *array);
-
- GPtrArray * (*get_summary) (CamelFolder *folder,
- CamelException *ex);
- void (*free_summary) (CamelFolder *folder,
- GPtrArray *summary);
-
- GPtrArray * (*get_subfolder_names) (CamelFolder *folder,
- CamelException *ex);
- void (*free_subfolder_names) (CamelFolder *folder,
- GPtrArray *subfolders);
-
- gboolean (*has_search_capability) (CamelFolder *folder);
-
- GList * (*search_by_expression) (CamelFolder *folder, const char *expression, CamelException *ex);
-
- const CamelMessageInfo * (*summary_get_by_uid) (CamelFolder *, const char *uid);
-} CamelFolderClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_folder_get_type (void);
-
-
-/* public methods */
-
-
-
-CamelFolder * camel_folder_get_subfolder (CamelFolder *folder,
- const gchar *folder_name,
- CamelException *ex);
-
-void camel_folder_open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex);
-
-
-void camel_folder_close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex);
-
-gboolean camel_folder_create (CamelFolder *folder,
- CamelException *ex);
-CamelFolder * camel_folder_get_parent_folder (CamelFolder *folder,
- CamelException *ex);
-CamelStore * camel_folder_get_parent_store (CamelFolder *folder,
- CamelException *ex);
-GList * camel_folder_list_subfolders (CamelFolder *folder,
- CamelException *ex);
-
-
-/* delete operations */
-gboolean camel_folder_delete (CamelFolder *folder,
- gboolean recurse,
- CamelException *ex);
-gboolean camel_folder_delete_messages (CamelFolder *folder,
- CamelException *ex);
-void camel_folder_expunge (CamelFolder *folder,
- CamelException *ex);
-
-
-/* folder name operations */
-const gchar * camel_folder_get_name (CamelFolder *folder);
-const gchar * camel_folder_get_full_name (CamelFolder *folder);
-
-
-/* various properties accessors */
-gboolean camel_folder_exists (CamelFolder *folder,
- CamelException *ex);
-guint32 camel_folder_get_permanent_flags (CamelFolder *folder,
- CamelException *ex);
-
-CamelFolderOpenMode camel_folder_get_mode (CamelFolder *folder,
- CamelException *ex);
-gboolean camel_folder_is_open (CamelFolder *folder);
-
-
-
-/* message manipulation */
-void camel_folder_append_message (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex);
-
-
-/* summary related operations */
-gboolean camel_folder_has_summary_capability (CamelFolder *folder);
-
-
-gint camel_folder_get_message_count (CamelFolder *folder,
- CamelException *ex);
-
-GPtrArray * camel_folder_get_summary (CamelFolder *folder,
- CamelException *ex);
-void camel_folder_free_summary (CamelFolder *folder,
- GPtrArray *array);
-
-GPtrArray * camel_folder_get_subfolder_names (CamelFolder *folder,
- CamelException *ex);
-void camel_folder_free_subfolder_names (CamelFolder *folder,
- GPtrArray *array);
-
-
-/* uid based access operations */
-const gchar * camel_folder_get_message_uid (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex);
-CamelMimeMessage * camel_folder_get_message_by_uid (CamelFolder *folder,
- const gchar *uid,
- CamelException *ex);
-void camel_folder_delete_message_by_uid (CamelFolder *folder,
- const gchar *uid,
- CamelException *ex);
-GPtrArray * camel_folder_get_uids (CamelFolder *folder,
- CamelException *ex);
-void camel_folder_free_uids (CamelFolder *folder,
- GPtrArray *array);
-
-/* search api */
-gboolean camel_folder_has_search_capability (CamelFolder *folder);
-GList * camel_folder_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
-
-/* summary info. FIXME: rename this slightly? */
-const CamelMessageInfo *camel_folder_summary_get_by_uid (CamelFolder *summary,
- const char *uid);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_FOLDER_H */
-
diff --git a/camel/camel-internet-address.c b/camel/camel-internet-address.c
deleted file mode 100644
index 003cae5b48..0000000000
--- a/camel/camel-internet-address.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "camel-mime-utils.h"
-#include "camel-internet-address.h"
-
-static int internet_decode (CamelAddress *, const char *raw);
-static char * internet_encode (CamelAddress *);
-static void internet_remove (CamelAddress *, int index);
-
-static void camel_internet_address_class_init (CamelInternetAddressClass *klass);
-static void camel_internet_address_init (CamelInternetAddress *obj);
-
-static CamelAddressClass *camel_internet_address_parent;
-
-struct _address {
- char *name;
- char *address;
-};
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_internet_address_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelInternetAddress",
- sizeof (CamelInternetAddress),
- sizeof (CamelInternetAddressClass),
- (GtkClassInitFunc) camel_internet_address_class_init,
- (GtkObjectInitFunc) camel_internet_address_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_address_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-camel_internet_address_class_init (CamelInternetAddressClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- CamelAddressClass *address = (CamelAddressClass *) klass;
-
- camel_internet_address_parent = gtk_type_class (camel_address_get_type ());
-
- address->decode = internet_decode;
- address->encode = internet_encode;
- address->remove = internet_remove;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_internet_address_init (CamelInternetAddress *obj)
-{
-}
-
-static int
-internet_decode (CamelAddress *a, const char *raw)
-{
- struct _header_address *ha, *n;
-
- /* Should probably use its own decoder or something */
- ha = header_address_decode(raw);
- if (ha) {
- n = ha;
- while (n) {
- if (n->type == HEADER_ADDRESS_NAME) {
- camel_internet_address_add((CamelInternetAddress *)a, n->name, n->v.addr);
- } else if (n->type == HEADER_ADDRESS_GROUP) {
- struct _header_address *g = n->v.members;
- while (g) {
- if (g->type == HEADER_ADDRESS_NAME)
- camel_internet_address_add((CamelInternetAddress *)a, g->name, g->v.addr);
- /* otherwise, its an error, infact */
- g = g->next;
- }
- }
- n = n->next;
- }
- header_address_list_clear(&ha);
- }
- return 0;
-}
-
-static char * internet_encode (CamelAddress *a)
-{
- int i;
- GString *out;
- char *ret;
-
- if (a->addresses->len == 0)
- return NULL;
-
- out = g_string_new("");
-
- for (i=0;i<a->addresses->len;i++) {
- struct _address *addr = g_ptr_array_index( a->addresses, i );
- char *name = header_encode_string(addr->name);
-
- if (i!=0)
- g_string_append(out, ", ");
-
- if (name) {
- g_string_sprintfa(out, "%s ", name);
- g_free(name);
- }
- g_string_sprintfa(out, "<%s>", addr->address);
- }
- ret = out->str;
- g_string_free(out, FALSE);
- return ret;
-}
-
-static void internet_remove (CamelAddress *a, int index)
-{
- struct _address *addr;
-
- if (index <0 || index >= a->addresses->len)
- return;
-
- addr = g_ptr_array_index( a->addresses, index);
- g_free(addr->name);
- g_free(addr->address);
- g_free(addr);
- g_ptr_array_remove_index( a->addresses, index);
-}
-
-/**
- * camel_internet_address_new:
- *
- * Create a new CamelInternetAddress object.
- *
- * Return value: A new CamelInternetAddress object.
- **/
-CamelInternetAddress *
-camel_internet_address_new (void)
-{
- CamelInternetAddress *new = CAMEL_INTERNET_ADDRESS ( gtk_type_new (camel_internet_address_get_type ()));
- return new;
-}
-
-/**
- * camel_internet_address_add:
- * @a:
- * @name:
- * @address:
- *
- * Add a new internet address to the address object.
- *
- * Return value: Index of added entry.
- **/
-int
-camel_internet_address_add (CamelInternetAddress *a, const char *name, const char *address)
-{
- struct _address *new;
- int index;
-
- g_return_val_if_fail(IS_CAMEL_INTERNET_ADDRESS(a), -1);
-
- new = g_malloc(sizeof(*new));
- new->name = g_strdup(name);
- new->address = g_strdup(address);
- index = ((CamelAddress *)a)->addresses->len;
- g_ptr_array_add(((CamelAddress *)a)->addresses, new);
-
- return index;
-}
-
-/**
- * camel_internet_address_get:
- * @a:
- * @index:
- * @namep: Holder for the returned name, or NULL, if not required.
- * @addressp: Holder for the returned address, or NULL, if not required.
- *
- * Get the address at @index.
- *
- * Return value: TRUE if such an address exists, or FALSE otherwise.
- **/
-gboolean
-camel_internet_address_get (const CamelInternetAddress *a, int index, const char **namep, const char **addressp)
-{
- struct _address *addr;
-
- g_return_val_if_fail(IS_CAMEL_INTERNET_ADDRESS(a), -1);
- g_return_val_if_fail(index >= 0, -1);
-
- if (index >= ((CamelAddress *)a)->addresses->len)
- return FALSE;
-
- addr = g_ptr_array_index( ((CamelAddress *)a)->addresses, index);
- if (namep)
- *namep = addr->name;
- if (addressp)
- *addressp = addr->address;
- return TRUE;
-}
-
-/**
- * camel_internet_address_find_name:
- * @a:
- * @name:
- * @addressp: Holder for address part, or NULL, if not required.
- *
- * Find address by real name.
- *
- * Return value: The index of the address matching the name, or -1
- * if no match was found.
- **/
-int
-camel_internet_address_find_name(CamelInternetAddress *a, const char *name, const char **addressp)
-{
- struct _address *addr;
- int i, len;
-
- g_return_val_if_fail(IS_CAMEL_INTERNET_ADDRESS(a), -1);
-
- len = ((CamelAddress *)a)->addresses->len;
- for (i=0;i<len;i++) {
- addr = g_ptr_array_index( ((CamelAddress *)a)->addresses, i );
- if (!strcmp(addr->name, name)) {
- if (addressp)
- *addressp = addr->address;
- return i;
- }
- }
- return -1;
-}
-
-/**
- * camel_internet_address_find_address:
- * @a:
- * @address:
- * @namep: Return for the matching name, or NULL, if not required.
- *
- * Find an address by address.
- *
- * Return value: The index of the address, or -1 if not found.
- **/
-int
-camel_internet_address_find_address(CamelInternetAddress *a, const char *address, const char **namep)
-{
- struct _address *addr;
- int i, len;
-
- g_return_val_if_fail(IS_CAMEL_INTERNET_ADDRESS(a), -1);
-
- len = ((CamelAddress *)a)->addresses->len;
- for (i=0;i<len;i++) {
- addr = g_ptr_array_index( ((CamelAddress *)a)->addresses, i );
- if (!strcmp(addr->address, address)) {
- if (namep)
- *namep = addr->name;
- return i;
- }
- }
- return -1;
-}
diff --git a/camel/camel-internet-address.h b/camel/camel-internet-address.h
deleted file mode 100644
index 14fbd5436a..0000000000
--- a/camel/camel-internet-address.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _CAMEL_INTERNET_ADDRESS_H
-#define _CAMEL_INTERNET_ADDRESS_H
-
-#include <camel/camel-address.h>
-
-#define CAMEL_INTERNET_ADDRESS(obj) GTK_CHECK_CAST (obj, camel_internet_address_get_type (), CamelInternetAddress)
-#define CAMEL_INTERNET_ADDRESS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_internet_address_get_type (), CamelInternetAddressClass)
-#define IS_CAMEL_INTERNET_ADDRESS(obj) GTK_CHECK_TYPE (obj, camel_internet_address_get_type ())
-
-typedef struct _CamelInternetAddressClass CamelInternetAddressClass;
-
-struct _CamelInternetAddress {
- CamelAddress parent;
-
- struct _CamelInternetAddressPrivate *priv;
-};
-
-struct _CamelInternetAddressClass {
- CamelAddressClass parent_class;
-};
-
-guint camel_internet_address_get_type (void);
-CamelInternetAddress *camel_internet_address_new (void);
-
-int camel_internet_address_add (CamelInternetAddress *, const char *, const char *);
-gboolean camel_internet_address_get (const CamelInternetAddress *, int, const char **, const char **);
-
-int camel_internet_address_find_name(CamelInternetAddress *, const char *, const char **);
-int camel_internet_address_find_address(CamelInternetAddress *, const char *, const char **);
-
-#endif /* ! _CAMEL_INTERNET_ADDRESS_H */
diff --git a/camel/camel-marshal-utils.c b/camel/camel-marshal-utils.c
deleted file mode 100644
index a743f155d5..0000000000
--- a/camel/camel-marshal-utils.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-marshal-utils.c : marshal utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-
-#include "config.h"
-#include "camel-marshal-utils.h"
-#include "camel-arg-collector.c"
-
-
-#define NB_OP_CHUNKS 20
-static GMemChunk *op_chunk=NULL;
-static GStaticMutex op_chunk_mutex = G_STATIC_MUTEX_INIT;
-
-CamelFuncDef *
-camel_func_def_new (CamelMarshal marshal, guint n_params, ...)
-{
- CamelFuncDef *func_def;
- va_list args;
- GtkType type;
- int i;
-
- func_def = g_new (CamelFuncDef, 1);
- func_def->marshal = marshal;
- func_def->n_params = n_params;
- func_def->params_type = g_new (GtkType, n_params);
-
- va_start (args, n_params);
- for (i=0; i<n_params; i++) {
- type = va_arg (args, GtkType);
- func_def->params_type [i] = type;
- }
- va_end (args);
-
- return func_def;
-}
-
-
-
-
-static gboolean
-_collect_params (GtkArg *params,
- CamelFuncDef *func_def,
- va_list var_args)
-{
- int i;
- gboolean failed = FALSE;
-
-
- for (i=0;
- i<func_def->n_params;
- i++, params++)
- {
- gchar *error;
-
- params->name = NULL;
- params->type = (func_def->params_type) [i];
- CAMEL_ARG_COLLECT_VALUE (params,
- var_args,
- error);
- if (error)
- {
- failed = TRUE;
- g_free (error);
- }
- }
- return (failed);
-}
-
-
-
-/**
- * camel_marshal_create_op: create an operation
- * @func_def: function definition object
- * @func: function to call
- *
- * create a function ready to be executed. The
- * vari
- *
- *
- * Return value: operation ready to be executed
- **/
-CamelOp *
-camel_marshal_create_op (CamelFuncDef *func_def, CamelFunc func, ...)
-{
- gboolean error;
- CamelOp *op;
- va_list args;
-
- g_assert (func_def);
-
- op = camel_op_new (func_def);
- op->func = func;
-
- va_start (args, func);
- error = _collect_params (op->params, func_def, args);
- va_end (args);
-
- if (error) {
- camel_op_free (op);
- return NULL;
- } else
- return (op);
-}
-
-
-
-
-/**
- * camel_op_new: return a new CamelOp object
- *
- * The obtained object must be destroyed with
- * camel_op_free ()
- *
- * Return value: the newly allocated CamelOp object
- **/
-CamelOp *
-camel_op_new (CamelFuncDef *func_def)
-{
- CamelOp *op;
-
- g_static_mutex_lock (&op_chunk_mutex);
- if (!op_chunk)
- op_chunk = g_mem_chunk_create (CamelOp,
- NB_OP_CHUNKS,
- G_ALLOC_AND_FREE);
- g_static_mutex_unlock (&op_chunk_mutex);
-
- op = g_chunk_new (CamelOp, op_chunk);
- op->func_def = func_def;
- op->params = g_new (GtkArg, func_def->n_params);
-
- return op;
-}
-
-/**
- * camel_op_free: free a CamelOp object allocated with camel_op_new
- * @op: CamelOp object to free
- *
- * Free a CamelOp object allocated with camel_op_new ()
- * this routine won't work with CamelOp objects allocated
- * with other allocators.
- **/
-void
-camel_op_free (CamelOp *op)
-{
- g_free (op->params);
- g_chunk_free (op, op_chunk);
-}
-
-
-/**
- * camel_op_run: run an operation
- * @op: the operation object
- *
- * run an operation
- *
- **/
-void
-camel_op_run (CamelOp *op)
-{
- g_assert (op);
- g_assert (op->func_def);
- g_assert (op->params);
-
- op->func_def->marshal (op->func, op->params);
-}
-
-
-
-
-/**
- * camel_op_set_user_data: set the private field
- * @op: operation
- * @user_data: private field
- *
- * associate a field to an operation object
- **/
-void
-camel_op_set_user_data (CamelOp *op, gpointer user_data)
-{
- g_assert (op);
- op->user_data = user_data;
-}
-
-
-/**
- * camel_op_get_user_data: return the private field
- * @op: operation object
- *
- * return the private field associated to
- * an operation object.
- *
- * Return value:
- **/
-gpointer
-camel_op_get_user_data (CamelOp *op)
-{
- g_assert (op);
- return op->user_data;
-}
-
-
-
-/* misc marshaller */
-
-
-typedef void (*CamelMarshal_NONE__POINTER_INT) (gpointer arg1,
- gint arg2);
-void camel_marshal_NONE__POINTER_INT (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_INT rfunc;
-
- rfunc = (CamelMarshal_NONE__POINTER_INT) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_INT(args[1]));
-}
-
-
-
-
-
-typedef void (*CamelMarshal_NONE__POINTER_INT_POINTER) (gpointer arg1,
- gint arg2,
- gpointer arg3);
-void camel_marshal_NONE__POINTER_INT_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_INT_POINTER rfunc;
-
- rfunc = (CamelMarshal_NONE__POINTER_INT_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_INT(args[1]),
- GTK_VALUE_POINTER(args[2]));
-}
-
-
-typedef void (*CamelMarshal_NONE__POINTER_BOOL_POINTER) (gpointer arg1,
- gboolean arg2,
- gpointer arg3);
-void camel_marshal_NONE__POINTER_BOOL_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_BOOL_POINTER rfunc;
-
- rfunc = (CamelMarshal_NONE__POINTER_BOOL_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_BOOL(args[1]),
- GTK_VALUE_POINTER(args[2]));
-}
-
-
-typedef void (*CamelMarshal_NONE__POINTER_INT_POINTER_POINTER) (gpointer arg1,
- gint arg2,
- gpointer arg3,
- gpointer arg4);
-void camel_marshal_NONE__POINTER_INT_POINTER_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_INT_POINTER_POINTER rfunc;
-
- rfunc = (CamelMarshal_NONE__POINTER_INT_POINTER_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_INT(args[1]),
- GTK_VALUE_POINTER(args[2]),
- GTK_VALUE_POINTER(args[3]));
-}
-
-
-
-typedef void (*CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER) (gpointer arg1,
- gboolean arg2,
- gpointer arg3,
- gpointer arg4);
-void camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER rfunc;
-
- rfunc = (CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_BOOL(args[1]),
- GTK_VALUE_POINTER(args[2]),
- GTK_VALUE_POINTER(args[3]));
-}
-
-
-
-typedef void (*CamelMarshal_NONE__POINTER_POINTER_POINTER) (gpointer arg1,
- gpointer arg2,
- gpointer arg3);
-void camel_marshal_NONE__POINTER_POINTER_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_POINTER_POINTER rfunc;
-
- rfunc = (CamelMarshal_NONE__POINTER_POINTER_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_POINTER(args[1]),
- GTK_VALUE_POINTER(args[2]));
-}
-
-
-typedef void (*CamelMarshal_NONE__INT) (gint arg1);
-void camel_marshal_NONE__INT (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__INT rfunc;
-
- rfunc = (CamelMarshal_NONE__INT) func;
- (* rfunc) (GTK_VALUE_INT (args[0]));
-}
-
-
-
-
-
-
diff --git a/camel/camel-marshal-utils.h b/camel/camel-marshal-utils.h
deleted file mode 100644
index d33489d2a1..0000000000
--- a/camel/camel-marshal-utils.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maeshal-utils.h : marshal utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#ifndef CAMEL_MARSHAL_UTILS_H
-#define CAMEL_MARSHAL_UTILS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-
-typedef void (*CamelFunc) ();
-
-typedef void ( *CamelMarshal) (CamelFunc func,
- GtkArg *args);
-
-
-
-
-
-typedef struct {
-
- CamelMarshal marshal;
- guint n_params;
- GtkType *params_type;
-
-} CamelFuncDef;
-
-
-
-typedef struct {
- CamelFuncDef *func_def;
- CamelFunc func;
- GtkArg *params;
- gpointer user_data;
-} CamelOp;
-
-
-CamelFuncDef *
-camel_func_def_new (CamelMarshal marshal,
- guint n_params,
- ...);
-
-
-CamelOp *camel_op_new (CamelFuncDef *func_def);
-void camel_op_free (CamelOp *op);
-void camel_op_run (CamelOp *op);
-void camel_op_run_and_free (CamelOp *op);
-void camel_op_set_user_data (CamelOp *op, gpointer user_data);
-gpointer camel_op_get_user_data (CamelOp *op);
-
-CamelOp *camel_marshal_create_op (CamelFuncDef *func_def, CamelFunc func, ...);
-
-/* marshallers */
-void camel_marshal_NONE__POINTER_INT_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__POINTER_BOOL_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__POINTER_INT_POINTER_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__POINTER_POINTER_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__INT (CamelFunc func,
- GtkArg *args);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MARSHAL_UTILS_H */
-
diff --git a/camel/camel-medium.c b/camel/camel-medium.c
deleted file mode 100644
index dcc5d31d67..0000000000
--- a/camel/camel-medium.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* camelMedium.c : Abstract class for a medium
- *
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include <stdio.h>
-#include <ctype.h>
-#include "camel-medium.h"
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include "hash-table-utils.h"
-
-#define d(x)
-
-static CamelDataWrapperClass *parent_class = NULL;
-
-/* Returns the class for a CamelMedium */
-#define CM_CLASS(so) CAMEL_MEDIUM_CLASS (GTK_OBJECT (so)->klass)
-
-static void add_header (CamelMedium *medium, const gchar *header_name,
- const void *header_value);
-static void set_header (CamelMedium *medium, const gchar *header_name, const void *header_value);
-static void remove_header (CamelMedium *medium, const gchar *header_name);
-static const void *get_header (CamelMedium *medium, const gchar *header_name);
-
-static CamelDataWrapper *get_content_object (CamelMedium *medium);
-static void set_content_object (CamelMedium *medium,
- CamelDataWrapper *content);
-static void finalize (GtkObject *object);
-
-static void
-camel_medium_class_init (CamelMediumClass *camel_medium_class)
-{
- CamelDataWrapperClass *camel_data_wrapper_class =
- CAMEL_DATA_WRAPPER_CLASS (camel_medium_class);
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_data_wrapper_class);
-
- parent_class = gtk_type_class (camel_data_wrapper_get_type ());
-
- /* virtual method definition */
- camel_medium_class->add_header = add_header;
- camel_medium_class->set_header = set_header;
- camel_medium_class->remove_header = remove_header;
- camel_medium_class->get_header = get_header;
-
- camel_medium_class->set_content_object = set_content_object;
- camel_medium_class->get_content_object = get_content_object;
-
- gtk_object_class->finalize = finalize;
-}
-
-static void
-camel_medium_init (gpointer object, gpointer klass)
-{
- CamelMedium *camel_medium = CAMEL_MEDIUM (object);
-
- camel_medium->content = NULL;
-}
-
-
-GtkType
-camel_medium_get_type (void)
-{
- static GtkType camel_medium_type = 0;
-
- if (!camel_medium_type) {
- GtkTypeInfo camel_medium_info =
- {
- "CamelMedium",
- sizeof (CamelMedium),
- sizeof (CamelMediumClass),
- (GtkClassInitFunc) camel_medium_class_init,
- (GtkObjectInitFunc) camel_medium_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_medium_type = gtk_type_unique (camel_data_wrapper_get_type (), &camel_medium_info);
- }
-
- return camel_medium_type;
-}
-
-static void
-finalize (GtkObject *object)
-{
- CamelMedium *medium = CAMEL_MEDIUM (object);
-
- if (medium->content)
- gtk_object_unref (GTK_OBJECT (medium->content));
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-add_header (CamelMedium *medium, const gchar *header_name,
- const void *header_value)
-{
- g_warning("No %s::add_header implemented, adding %s", gtk_type_name(((GtkObject *)medium)->klass->type), header_name);
-}
-
-/**
- * camel_medium_add_header:
- * @medium: a CamelMedium
- * @header_name: name of the header
- * @header_value: value of the header
- *
- * Adds a header to a medium.
- *
- * FIXME: Where does it add it? We need to be able to prepend and
- * append headers, and also be able to insert them relative to other
- * headers. No we dont, order isn't important! Z
- **/
-void
-camel_medium_add_header (CamelMedium *medium, const gchar *header_name,
- const void *header_value)
-{
- g_return_if_fail (CAMEL_IS_MEDIUM (medium));
- g_return_if_fail (header_name != NULL);
- g_return_if_fail (header_value != NULL);
-
- CM_CLASS (medium)->add_header (medium, header_name, header_value);
-}
-
-static void
-set_header (CamelMedium *medium, const gchar *header_name, const void *header_value)
-{
- g_warning("No %s::set_header implemented, setting %s", gtk_type_name(((GtkObject *)medium)->klass->type), header_name);
-}
-
-/**
- * camel_medium_set_header:
- * @medium: a CamelMedium
- * @header_name: name of the header
- * @header_value: value of the header
- *
- * Sets the value of a header. Any other occurances of the header
- * will be removed.
- **/
-void
-camel_medium_set_header (CamelMedium *medium, const gchar *header_name, const void *header_value)
-{
- g_return_if_fail (CAMEL_IS_MEDIUM (medium));
- g_return_if_fail (header_name != NULL);
- g_return_if_fail (header_value != NULL);
-
- CM_CLASS (medium)->add_header (medium, header_name, header_value);
-}
-
-static void
-remove_header (CamelMedium *medium, const gchar *header_name)
-{
- g_warning("No %s::remove_header implemented, removing %s", gtk_type_name(((GtkObject *)medium)->klass->type), header_name);
-}
-
-/**
- * camel_medium_remove_header:
- * @medium: a medium
- * @header_name: the name of the header
- *
- * Removes the named header from the medium. All occurances of the
- * header are removed.
- **/
-void
-camel_medium_remove_header (CamelMedium *medium, const gchar *header_name)
-{
- g_return_if_fail (CAMEL_IS_MEDIUM (medium));
- g_return_if_fail (header_name != NULL);
-
- CM_CLASS (medium)->remove_header (medium, header_name);
-}
-
-
-static const void *
-get_header (CamelMedium *medium, const gchar *header_name)
-{
- g_warning("No %s::get_header implemented, getting %s", gtk_type_name(((GtkObject *)medium)->klass->type), header_name);
- return NULL;
-}
-
-/**
- * camel_medium_get_header:
- * @medium: a medium
- * @header_name: the name of the header
- *
- * Returns the value of the named header in the medium, or %NULL if
- * it is unset. The caller should not modify or free the data.
- *
- * FIXME: What if the header occurs more than once?
- *
- * Return value: the value of the named header, or %NULL
- **/
-const void *
-camel_medium_get_header (CamelMedium *medium, const gchar *header_name)
-{
- g_return_val_if_fail (CAMEL_IS_MEDIUM (medium), NULL);
- g_return_val_if_fail (header_name != NULL, NULL);
-
-#warning No way to get multi-valued headers?
-
- return CM_CLASS (medium)->get_header (medium, header_name);
-}
-
-
-static CamelDataWrapper *
-get_content_object (CamelMedium *medium)
-{
- return medium->content;
-}
-
-/**
- * camel_medium_get_content_object:
- * @medium: a medium
- *
- * Returns a data wrapper that represents the content of the medium,
- * without its headers.
- *
- * Return value: the medium's content object.
- **/
-CamelDataWrapper *
-camel_medium_get_content_object (CamelMedium *medium)
-{
- g_return_val_if_fail (CAMEL_IS_MEDIUM (medium), NULL);
-
- return CM_CLASS (medium)->get_content_object (medium);
-}
-
-
-static void
-set_content_object (CamelMedium *medium, CamelDataWrapper *content)
-{
- if (medium->content)
- gtk_object_unref (GTK_OBJECT (medium->content));
- gtk_object_ref (GTK_OBJECT (content));
- medium->content = content;
-}
-
-/**
- * camel_medium_set_content_object:
- * @medium: a medium
- * @content: a data wrapper representing the medium's content
- *
- * Sets the content of @medium to be @content.
- **/
-void
-camel_medium_set_content_object (CamelMedium *medium,
- CamelDataWrapper *content)
-{
- g_return_if_fail (CAMEL_IS_MEDIUM (medium));
- g_return_if_fail (CAMEL_IS_DATA_WRAPPER (content));
-
- CM_CLASS (medium)->set_content_object (medium, content);
-}
diff --git a/camel/camel-medium.h b/camel/camel-medium.h
deleted file mode 100644
index 2b6f77f825..0000000000
--- a/camel/camel-medium.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-medium.h : class for a medium object */
-
-/*
- *
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MEDIUM_H
-#define CAMEL_MEDIUM_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-data-wrapper.h>
-
-#define CAMEL_MEDIUM_TYPE (camel_medium_get_type ())
-#define CAMEL_MEDIUM(obj) (GTK_CHECK_CAST((obj), CAMEL_MEDIUM_TYPE, CamelMedium))
-#define CAMEL_MEDIUM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MEDIUM_TYPE, CamelMediumClass))
-#define CAMEL_IS_MEDIUM(o) (GTK_CHECK_TYPE((o), CAMEL_MEDIUM_TYPE))
-
-
-struct _CamelMedium
-{
- CamelDataWrapper parent_object;
-
- /* The content of the medium, as opposed to our parent
- * CamelDataWrapper, which wraps both the headers and the
- * content.
- */
- CamelDataWrapper *content;
-
-};
-
-
-
-typedef struct {
- CamelDataWrapperClass parent_class;
-
- /* Virtual methods */
- void (*add_header) (CamelMedium *medium, const gchar *header_name, const void *header_value);
- void (*set_header) (CamelMedium *medium, const gchar *header_name, const void *header_value);
- void (*remove_header) (CamelMedium *medium, const gchar *header_name);
- const void * (*get_header) (CamelMedium *medium, const gchar *header_name);
-
- CamelDataWrapper * (*get_content_object) (CamelMedium *medium);
- void (*set_content_object) (CamelMedium *medium, CamelDataWrapper *content);
-
-} CamelMediumClass;
-
-/* Standard Gtk function */
-GtkType camel_medium_get_type (void);
-
-/* Header get/set interface */
-void camel_medium_add_header (CamelMedium *medium, const gchar *header_name, const void *header_value);
-void camel_medium_set_header (CamelMedium *medium, const gchar *header_name, const void *header_value);
-void camel_medium_remove_header (CamelMedium *medium, const gchar *header_name);
-const void *camel_medium_get_header (CamelMedium *medium, const gchar *header_name);
-
-/* accessor methods */
-CamelDataWrapper *camel_medium_get_content_object (CamelMedium *medium);
-void camel_medium_set_content_object (CamelMedium *medium,
- CamelDataWrapper *content);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MEDIUM_H */
-
diff --git a/camel/camel-mime-filter-basic.c b/camel/camel-mime-filter-basic.c
deleted file mode 100644
index 60566abf4e..0000000000
--- a/camel/camel-mime-filter-basic.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "camel-mime-filter-basic.h"
-
-#include "camel-mime-utils.h"
-
-static void camel_mime_filter_basic_class_init (CamelMimeFilterBasicClass *klass);
-static void camel_mime_filter_basic_init (CamelMimeFilterBasic *obj);
-
-static CamelMimeFilterClass *camel_mime_filter_basic_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_mime_filter_basic_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelMimeFilterBasic",
- sizeof (CamelMimeFilterBasic),
- sizeof (CamelMimeFilterBasicClass),
- (GtkClassInitFunc) camel_mime_filter_basic_class_init,
- (GtkObjectInitFunc) camel_mime_filter_basic_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_mime_filter_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-finalise(GtkObject *o)
-{
- ((GtkObjectClass *)camel_mime_filter_basic_parent)->finalize (o);
-}
-
-/* should this 'flush' outstanding state/data bytes? */
-static void
-reset(CamelMimeFilter *mf)
-{
- CamelMimeFilterBasic *f = (CamelMimeFilterBasic *)mf;
-
- f->state = 0;
- f->save = 0;
-}
-
-static void
-complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlen, size_t *outprespace)
-{
- CamelMimeFilterBasic *f = (CamelMimeFilterBasic *)mf;
- int newlen;
-
- switch(f->type) {
- case CAMEL_MIME_FILTER_BASIC_BASE64_ENC:
- /* wont go to more than 2x size (overly conservative) */
- camel_mime_filter_set_size(mf, len*2, FALSE);
- newlen = base64_encode_close(in, len, mf->outbuf, &f->state, &f->save);
- break;
- case CAMEL_MIME_FILTER_BASIC_QP_ENC:
- /* FIXME: *3 is probably not quite enough ... */
- camel_mime_filter_set_size(mf, len*3, FALSE);
- newlen = quoted_encode_close(in, len, mf->outbuf, &f->state, &f->save);
- break;
- case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
- /* output can't possibly exceed the input size */
- camel_mime_filter_set_size(mf, len, FALSE);
- newlen = base64_decode_step(in, len, mf->outbuf, &f->state, &f->save);
- break;
- case CAMEL_MIME_FILTER_BASIC_QP_DEC:
- /* output can't possibly exceed the input size */
- camel_mime_filter_set_size(mf, len, FALSE);
- newlen = quoted_decode_step(in, len, mf->outbuf, &f->state, &f->save);
- break;
- default:
- g_warning("unknown type %d in CamelMimeFilterBasic", f->type);
- goto donothing;
- }
-
- *out = mf->outbuf;
- *outlen = newlen;
- *outprespace = mf->outpre;
-
- return;
-donothing:
- *out = in;
- *outlen = len;
- *outprespace = prespace;
-}
-
-/* here we do all of the basic mime filtering */
-static void
-filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlen, size_t *outprespace)
-{
- CamelMimeFilterBasic *f = (CamelMimeFilterBasic *)mf;
- int newlen;
-
- switch(f->type) {
- case CAMEL_MIME_FILTER_BASIC_BASE64_ENC:
- /* wont go to more than 2x size (overly conservative) */
- camel_mime_filter_set_size(mf, len*2, FALSE);
- newlen = base64_encode_step(in, len, mf->outbuf, &f->state, &f->save);
- break;
- case CAMEL_MIME_FILTER_BASIC_QP_ENC:
- /* FIXME: *3 is probably not quite enough ... */
- camel_mime_filter_set_size(mf, len*3, FALSE);
- newlen = quoted_encode_step(in, len, mf->outbuf, &f->state, &f->save);
- break;
- case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
- /* output can't possibly exceed the input size */
- camel_mime_filter_set_size(mf, len, FALSE);
- newlen = base64_decode_step(in, len, mf->outbuf, &f->state, &f->save);
- break;
- case CAMEL_MIME_FILTER_BASIC_QP_DEC:
- /* output can't possibly exceed the input size */
- camel_mime_filter_set_size(mf, len, FALSE);
- newlen = quoted_decode_step(in, len, mf->outbuf, &f->state, &f->save);
- break;
- default:
- g_warning("unknown type %d in CamelMimeFilterBasic", f->type);
- goto donothing;
- }
-
- *out = mf->outbuf;
- *outlen = newlen;
- *outprespace = mf->outpre;
-
- return;
-donothing:
- *out = in;
- *outlen = len;
- *outprespace = prespace;
-}
-
-static void
-camel_mime_filter_basic_class_init (CamelMimeFilterBasicClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass;
-
- camel_mime_filter_basic_parent = gtk_type_class (camel_mime_filter_get_type ());
-
- object_class->finalize = finalise;
-
- filter_class->reset = reset;
- filter_class->filter = filter;
- filter_class->complete = complete;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_mime_filter_basic_init (CamelMimeFilterBasic *obj)
-{
- obj->state = 0;
- obj->save = 0;
-}
-
-/**
- * camel_mime_filter_basic_new:
- *
- * Create a new CamelMimeFilterBasic object.
- *
- * Return value: A new CamelMimeFilterBasic widget.
- **/
-CamelMimeFilterBasic *
-camel_mime_filter_basic_new (void)
-{
- CamelMimeFilterBasic *new = CAMEL_MIME_FILTER_BASIC ( gtk_type_new (camel_mime_filter_basic_get_type ()));
- return new;
-}
-
-CamelMimeFilterBasic *
-camel_mime_filter_basic_new_type(CamelMimeFilterBasicType type)
-{
- CamelMimeFilterBasic *new;
-
- switch (type) {
- case CAMEL_MIME_FILTER_BASIC_BASE64_ENC:
- case CAMEL_MIME_FILTER_BASIC_QP_ENC:
- case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
- case CAMEL_MIME_FILTER_BASIC_QP_DEC:
- new = camel_mime_filter_basic_new();
- new->type = type;
- break;
- default:
- g_warning("Invalid type of CamelMimeFilterBasic requested: %d", type);
- new = NULL;
- break;
- }
- return new;
-}
-
diff --git a/camel/camel-mime-filter-basic.h b/camel/camel-mime-filter-basic.h
deleted file mode 100644
index f700997fd2..0000000000
--- a/camel/camel-mime-filter-basic.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _CAMEL_MIME_FILTER_BASIC_H
-#define _CAMEL_MIME_FILTER_BASIC_H
-
-#include <camel/camel-mime-filter.h>
-
-#define CAMEL_MIME_FILTER_BASIC(obj) GTK_CHECK_CAST (obj, camel_mime_filter_basic_get_type (), CamelMimeFilterBasic)
-#define CAMEL_MIME_FILTER_BASIC_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_basic_get_type (), CamelMimeFilterBasicClass)
-#define IS_CAMEL_MIME_FILTER_BASIC(obj) GTK_CHECK_TYPE (obj, camel_mime_filter_basic_get_type ())
-
-typedef struct _CamelMimeFilterBasicClass CamelMimeFilterBasicClass;
-
-typedef enum {
- CAMEL_MIME_FILTER_BASIC_BASE64_ENC = 1,
- CAMEL_MIME_FILTER_BASIC_BASE64_DEC,
- CAMEL_MIME_FILTER_BASIC_QP_ENC,
- CAMEL_MIME_FILTER_BASIC_QP_DEC,
-} CamelMimeFilterBasicType;
-
-struct _CamelMimeFilterBasic {
- CamelMimeFilter parent;
-
- struct _CamelMimeFilterBasicPrivate *priv;
-
- CamelMimeFilterBasicType type;
-
- int state;
- int save;
-};
-
-struct _CamelMimeFilterBasicClass {
- CamelMimeFilterClass parent_class;
-};
-
-guint camel_mime_filter_basic_get_type (void);
-CamelMimeFilterBasic *camel_mime_filter_basic_new (void);
-CamelMimeFilterBasic *camel_mime_filter_basic_new_type (CamelMimeFilterBasicType type);
-
-#endif /* ! _CAMEL_MIME_FILTER_BASIC_H */
diff --git a/camel/camel-mime-filter-charset.c b/camel/camel-mime-filter-charset.c
deleted file mode 100644
index eb9db60802..0000000000
--- a/camel/camel-mime-filter-charset.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#include <unicode.h>
-
-#include <string.h>
-#include <errno.h>
-
-#include "camel-mime-filter-charset.h"
-
-
-static void camel_mime_filter_charset_class_init (CamelMimeFilterCharsetClass *klass);
-static void camel_mime_filter_charset_init (CamelMimeFilterCharset *obj);
-
-static CamelMimeFilterClass *camel_mime_filter_charset_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_mime_filter_charset_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelMimeFilterCharset",
- sizeof (CamelMimeFilterCharset),
- sizeof (CamelMimeFilterCharsetClass),
- (GtkClassInitFunc) camel_mime_filter_charset_class_init,
- (GtkObjectInitFunc) camel_mime_filter_charset_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_mime_filter_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-finalise(GtkObject *o)
-{
- CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)o;
-
- g_free(f->from);
- g_free(f->to);
- if (f->ic != (unicode_iconv_t)-1) {
- unicode_iconv_close(f->ic);
- f->ic = (unicode_iconv_t) -1;
- }
-
- ((GtkObjectClass *)camel_mime_filter_charset_parent)->finalize (o);
-}
-
-static void
-reset(CamelMimeFilter *mf)
-{
- CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)mf;
- char buf[16];
- char *buffer;
- int outlen = 16;
-
- /* what happens with the output bytes if this resets the state? */
- if (f->ic != (unicode_iconv_t) -1) {
- buffer = buf;
- unicode_iconv(f->ic, NULL, 0, &buffer, &outlen);
- }
-}
-
-static void
-complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlenptr, size_t *outprespace)
-{
- CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)mf;
- int converted;
- char *inbuf, *outbuf;
- int inlen, outlen;
-
- if (f->ic == (unicode_iconv_t) -1) {
- goto donothing;
- }
-
- /* FIXME: there's probably a safer way to size this ...? */
- /* We could always resize if we run out of room in outbuf (but it'd be nice not
- to have to) */
- camel_mime_filter_set_size(mf, len*5, FALSE);
- inbuf = in;
- inlen = len;
- outbuf = mf->outbuf;
- outlen = mf->outsize;
- if (inlen>0) {
- converted = unicode_iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen);
- if (converted == -1) {
- if (errno != EINVAL) {
- g_warning("error occured converting: %s", strerror(errno));
- goto donothing;
- }
- }
-
- if (inlen>0) {
- g_warning("Output lost in character conversion, invalid sequence encountered?");
- }
- }
-
- /* this 'resets' the output stream, returning back to the initial
- shift state for multishift charactersets */
- converted = unicode_iconv(f->ic, NULL, 0, &outbuf, &outlen);
- if (converted == -1) {
- g_warning("Conversion failed to complete: %s", strerror(errno));
- }
-
- *out = mf->outbuf;
- *outlenptr = mf->outsize - outlen;
- *outprespace = mf->outpre;
- return;
-
-donothing:
- *out = in;
- *outlenptr = len;
- *outprespace = prespace;
-}
-
-static void
-filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlenptr, size_t *outprespace)
-{
- CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)mf;
- int converted;
- char *inbuf, *outbuf;
- int inlen, outlen;
-
- if (f->ic == (unicode_iconv_t) -1) {
- goto donothing;
- }
-
- /* FIXME: there's probably a safer way to size this ...? */
- camel_mime_filter_set_size(mf, len*5, FALSE);
- inbuf = in;
- inlen = len;
- outbuf = mf->outbuf;
- outlen = mf->outsize;
- converted = unicode_iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen);
- if (converted == -1) {
- if (errno != EINVAL) {
- g_warning("error occured converting: %s", strerror(errno));
- goto donothing;
- }
- }
-
- /*
- NOTE: This assumes EINVAL only occurs because we ran out of
- bytes for a multibyte sequence, if not, we're in trouble.
- */
-
- if (inlen>0) {
- camel_mime_filter_backup(mf, inbuf, inlen);
- }
-
- *out = mf->outbuf;
- *outlenptr = mf->outsize - outlen;
- *outprespace = mf->outpre;
- return;
-
-donothing:
- *out = in;
- *outlenptr = len;
- *outprespace = prespace;
-}
-
-static void
-camel_mime_filter_charset_class_init (CamelMimeFilterCharsetClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass;
-
- camel_mime_filter_charset_parent = gtk_type_class (camel_mime_filter_get_type ());
-
- object_class->finalize = finalise;
-
- filter_class->reset = reset;
- filter_class->filter = filter;
- filter_class->complete = complete;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_mime_filter_charset_init (CamelMimeFilterCharset *obj)
-{
- obj->ic = (unicode_iconv_t)-1;
-}
-
-/**
- * camel_mime_filter_charset_new:
- *
- * Create a new CamelMimeFilterCharset object.
- *
- * Return value: A new CamelMimeFilterCharset widget.
- **/
-CamelMimeFilterCharset *
-camel_mime_filter_charset_new (void)
-{
- CamelMimeFilterCharset *new = CAMEL_MIME_FILTER_CHARSET ( gtk_type_new (camel_mime_filter_charset_get_type ()));
- return new;
-}
-
-CamelMimeFilterCharset *
-camel_mime_filter_charset_new_convert(const char *from_charset, const char *to_charset)
-{
- CamelMimeFilterCharset *new = CAMEL_MIME_FILTER_CHARSET ( gtk_type_new (camel_mime_filter_charset_get_type ()));
-
- new->ic = unicode_iconv_open(to_charset, from_charset);
- if (new->ic == (unicode_iconv_t) -1) {
- g_warning("Cannot create charset conversion from %s to %s: %s", from_charset, to_charset, strerror(errno));
- gtk_object_unref((GtkObject *)new);
- new = NULL;
- } else {
- new->from = g_strdup(from_charset);
- new->to = g_strdup(to_charset);
- }
- return new;
-}
diff --git a/camel/camel-mime-filter-charset.h b/camel/camel-mime-filter-charset.h
deleted file mode 100644
index 866a9fd6bf..0000000000
--- a/camel/camel-mime-filter-charset.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _CAMEL_MIME_FILTER_CHARSET_H
-#define _CAMEL_MIME_FILTER_CHARSET_H
-
-#include <camel/camel-mime-filter.h>
-#include <unicode.h>
-
-#define CAMEL_MIME_FILTER_CHARSET(obj) GTK_CHECK_CAST (obj, camel_mime_filter_charset_get_type (), CamelMimeFilterCharset)
-#define CAMEL_MIME_FILTER_CHARSET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_charset_get_type (), CamelMimeFilterCharsetClass)
-#define IS_CAMEL_MIME_FILTER_CHARSET(obj) GTK_CHECK_TYPE (obj, camel_mime_filter_charset_get_type ())
-
-typedef struct _CamelMimeFilterCharsetClass CamelMimeFilterCharsetClass;
-
-struct _CamelMimeFilterCharset {
- CamelMimeFilter parent;
-
- struct _CamelMimeFilterCharsetPrivate *priv;
-
- unicode_iconv_t ic;
- char *from;
- char *to;
-};
-
-struct _CamelMimeFilterCharsetClass {
- CamelMimeFilterClass parent_class;
-};
-
-guint camel_mime_filter_charset_get_type (void);
-CamelMimeFilterCharset *camel_mime_filter_charset_new (void);
-
-CamelMimeFilterCharset *camel_mime_filter_charset_new_convert (const char *from_charset, const char *to_charset);
-
-#endif /* ! _CAMEL_MIME_FILTER_CHARSET_H */
diff --git a/camel/camel-mime-filter-from.c b/camel/camel-mime-filter-from.c
deleted file mode 100644
index 065b15e656..0000000000
--- a/camel/camel-mime-filter-from.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "camel-mime-filter-from.h"
-#include <string.h>
-
-#define d(x)
-
-struct _CamelMimeFilterFromPrivate {
-};
-
-#define _PRIVATE(o) (((CamelMimeFilterFrom *)(o))->priv)
-
-static void camel_mime_filter_from_class_init (CamelMimeFilterFromClass *klass);
-static void camel_mime_filter_from_init (CamelMimeFilterFrom *obj);
-static void camel_mime_filter_from_finalise (GtkObject *obj);
-
-static CamelMimeFilterClass *camel_mime_filter_from_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_mime_filter_from_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelMimeFilterFrom",
- sizeof (CamelMimeFilterFrom),
- sizeof (CamelMimeFilterFromClass),
- (GtkClassInitFunc) camel_mime_filter_from_class_init,
- (GtkObjectInitFunc) camel_mime_filter_from_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_mime_filter_get_type (), &type_info);
- }
-
- return type;
-}
-
-struct fromnode {
- struct fromnode *next;
- char *pointer;
-};
-
-static void
-complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlen, size_t *outprespace)
-{
- *out = in;
- *outlen = len;
- *outprespace = prespace;
-}
-
-/* Yes, it is complicated ... */
-static void
-filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlen, size_t *outprespace)
-{
- CamelMimeFilterFrom *f = (CamelMimeFilterFrom *)mf;
- register char *inptr, *inend;
- int left;
- int midline = f->midline;
- int fromcount = 0;
- struct fromnode *head= NULL, *tail = (struct fromnode *)&head, *node;
- char *outptr;
-
- inptr = in;
- inend = inptr+len;
-
- d(printf("Filtering '%.*s'\n", len, in));
-
- /* first, see if we need to escape any from's */
- while (inptr<inend) {
- register int c=-1;
-
- if (midline)
- while (inptr<inend && (c=*inptr++) != '\n')
- ;
-
- if (c=='\n' || !midline) {
- left = inend-inptr;
- if (left > 0) {
- midline = TRUE;
- if (left<5) {
- if (inptr[0]=='F') {
- camel_mime_filter_backup(mf, inptr, left);
- midline = FALSE;
- inend = inptr;
- break;
- }
- } else {
- if (!strncmp(inptr, "From ", 5)) {
- fromcount++;
- /* yes, we do alloc them on the stack ... at most we're going to get
- len / 7 of them anyway */
- node = alloca(sizeof(*node));
- node->pointer = inptr;
- node->next = NULL;
- tail->next = node;
- tail = node;
- inptr+=5;
- }
- }
- } else {
- /* \n is at end of line, check next buffer */
- midline = FALSE;
- }
- }
- }
-
- f->midline = midline;
-
- if (fromcount > 0) {
- camel_mime_filter_set_size(mf, len + fromcount, FALSE);
- node = head;
- inptr = in;
- outptr = mf->outbuf;
- while (node) {
- memcpy(outptr, inptr, node->pointer-inptr);
- outptr+=node->pointer-inptr;
- *outptr++='>';
- inptr = node->pointer;
- node = node->next;
- }
- memcpy(outptr, inptr, inend-inptr);
- outptr += inend-inptr;
- *out = mf->outbuf;
- *outlen = outptr-mf->outbuf;
- *outprespace = mf->outbuf-mf->outreal;
-
- d(printf("Filtered '%.*s'\n", *outlen, *out));
- } else {
- *out = in;
- *outlen = inend - in;
- *outprespace = prespace;
-
- d(printf("Filtered '%.*s'\n", *outlen, *out));
- }
-}
-
-static void
-camel_mime_filter_from_class_init (CamelMimeFilterFromClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass;
-
- camel_mime_filter_from_parent = gtk_type_class (camel_mime_filter_get_type ());
-
- object_class->finalize = camel_mime_filter_from_finalise;
-
- filter_class->filter = filter;
- filter_class->complete = complete;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_mime_filter_from_init (CamelMimeFilterFrom *obj)
-{
- struct _CamelMimeFilterFromPrivate *p;
-
- p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
- obj->midline = FALSE;
-}
-
-static void
-camel_mime_filter_from_finalise (GtkObject *obj)
-{
- ((GtkObjectClass *)(camel_mime_filter_from_parent))->finalize((GtkObject *)obj);
-}
-
-/**
- * camel_mime_filter_from_new:
- *
- * Create a new CamelMimeFilterFrom object.
- *
- * Return value: A new CamelMimeFilterFrom widget.
- **/
-CamelMimeFilterFrom *
-camel_mime_filter_from_new (void)
-{
- CamelMimeFilterFrom *new = CAMEL_MIME_FILTER_FROM ( gtk_type_new (camel_mime_filter_from_get_type ()));
- return new;
-}
-
-#if 0
-
-#include <stdio.h>
-
-int main(int argc, char **argv)
-{
- CamelMimeFilterFrom *f;
- char *buffer;
- int len, prespace;
-
- gtk_init(&argc, &argv);
-
-
- f = camel_mime_filter_from_new();
-
- buffer = "This is a test\nFrom Someone\nTo someone. From Someone else, From\n From blah\nFromblah\nBye! \nFrom ";
- len = strlen(buffer);
- prespace = 0;
-
- printf("input = '%.*s'\n", len, buffer);
- camel_mime_filter_filter(f, buffer, len, prespace, &buffer, &len, &prespace);
- printf("output = '%.*s'\n", len, buffer);
- buffer = "";
- len = 0;
- prespace =0;
- camel_mime_filter_complete(f, buffer, len, prespace, &buffer, &len, &prespace);
- printf("complete = '%.*s'\n", len, buffer);
-
-
- return 0;
-}
-
-#endif
diff --git a/camel/camel-mime-filter-from.h b/camel/camel-mime-filter-from.h
deleted file mode 100644
index 2a97bcc0f0..0000000000
--- a/camel/camel-mime-filter-from.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef _CAMEL_MIME_FILTER_FROM_H
-#define _CAMEL_MIME_FILTER_FROM_H
-
-#include <gtk/gtk.h>
-#include <camel/camel-mime-filter.h>
-
-#define CAMEL_MIME_FILTER_FROM(obj) GTK_CHECK_CAST (obj, camel_mime_filter_from_get_type (), CamelMimeFilterFrom)
-#define CAMEL_MIME_FILTER_FROM_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_from_get_type (), CamelMimeFilterFromClass)
-#define IS_CAMEL_MIME_FILTER_FROM(obj) GTK_CHECK_TYPE (obj, camel_mime_filter_from_get_type ())
-
-typedef struct _CamelMimeFilterFrom CamelMimeFilterFrom;
-typedef struct _CamelMimeFilterFromClass CamelMimeFilterFromClass;
-
-struct _CamelMimeFilterFrom {
- CamelMimeFilter parent;
-
- struct _CamelMimeFilterFromPrivate *priv;
-
- int midline; /* are we between lines? */
-};
-
-struct _CamelMimeFilterFromClass {
- CamelMimeFilterClass parent_class;
-};
-
-guint camel_mime_filter_from_get_type (void);
-CamelMimeFilterFrom *camel_mime_filter_from_new (void);
-
-#endif /* ! _CAMEL_MIME_FILTER_FROM_H */
diff --git a/camel/camel-mime-filter-index.c b/camel/camel-mime-filter-index.c
deleted file mode 100644
index 53a9f72920..0000000000
--- a/camel/camel-mime-filter-index.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "camel-mime-filter-index.h"
-
-
-static void camel_mime_filter_index_class_init (CamelMimeFilterIndexClass *klass);
-static void camel_mime_filter_index_init (CamelMimeFilterIndex *obj);
-
-static CamelMimeFilterClass *camel_mime_filter_index_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_mime_filter_index_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelMimeFilterIndex",
- sizeof (CamelMimeFilterIndex),
- sizeof (CamelMimeFilterIndexClass),
- (GtkClassInitFunc) camel_mime_filter_index_class_init,
- (GtkObjectInitFunc) camel_mime_filter_index_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_mime_filter_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-finalise(GtkObject *o)
-{
- CamelMimeFilterIndex *f = (CamelMimeFilterIndex *)o;
-
- g_free(f->name);
- f->index = NULL; /* ibex's need refcounting? */
-
- ((GtkObjectClass *)camel_mime_filter_index_parent)->finalize (o);
-}
-
-static void
-complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlenptr, size_t *outprespace)
-{
- CamelMimeFilterIndex *f = (CamelMimeFilterIndex *)mf;
-
- if (f->index == NULL || f->name==NULL) {
- goto donothing;
- }
-
- ibex_index_buffer(f->index, f->name, in, len, NULL);
-
-donothing:
- *out = in;
- *outlenptr = len;
- *outprespace = prespace;
-}
-
-static void
-filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlenptr, size_t *outprespace)
-{
- CamelMimeFilterIndex *f = (CamelMimeFilterIndex *)mf;
- int inleft = 0;
-
- if (f->index == NULL || f->name==NULL) {
- goto donothing;
- }
-
- ibex_index_buffer(f->index, f->name, in, len, &inleft);
-
- if (inleft>0) {
- camel_mime_filter_backup(mf, in+(len-inleft), inleft);
- }
-
- *out = in;
- *outlenptr = len-inleft;
- *outprespace = prespace;
- return;
-
-donothing:
- *out = in;
- *outlenptr = len;
- *outprespace = prespace;
-}
-
-static void
-camel_mime_filter_index_class_init (CamelMimeFilterIndexClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass;
-
- camel_mime_filter_index_parent = gtk_type_class (camel_mime_filter_get_type ());
-
- object_class->finalize = finalise;
-
- /*filter_class->reset = reset;*/
- filter_class->filter = filter;
- filter_class->complete = complete;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_mime_filter_index_init (CamelMimeFilterIndex *obj)
-{
-}
-
-/**
- * camel_mime_filter_index_new:
- *
- * Create a new CamelMimeFilterIndex object.
- *
- * Return value: A new CamelMimeFilterIndex widget.
- **/
-CamelMimeFilterIndex *
-camel_mime_filter_index_new (void)
-{
- CamelMimeFilterIndex *new = CAMEL_MIME_FILTER_INDEX ( gtk_type_new (camel_mime_filter_index_get_type ()));
- return new;
-}
-
-CamelMimeFilterIndex *camel_mime_filter_index_new_ibex (ibex *index)
-{
- CamelMimeFilterIndex *new = camel_mime_filter_index_new();
-
- if (new) {
- new->index = index;
- new->name = g_strdup("");
- }
- return new;
-}
-
-/* Set the match name for any indexed words */
-void camel_mime_filter_index_set_name (CamelMimeFilterIndex *mf, char *name)
-{
- g_free(mf->name);
- mf->name = g_strdup(name);
-}
-
-void camel_mime_filter_index_set_ibex (CamelMimeFilterIndex *mf, ibex *index)
-{
- if (mf->index) {
- char *out;
- size_t outlen, outspace;
-
- camel_mime_filter_complete((CamelMimeFilter *)mf, "", 0, 0, &out, &outlen, &outspace);
- }
- mf->index = index;
-}
-
-
-
diff --git a/camel/camel-mime-filter-index.h b/camel/camel-mime-filter-index.h
deleted file mode 100644
index 7dcc76b8ea..0000000000
--- a/camel/camel-mime-filter-index.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _CAMEL_MIME_FILTER_INDEX_H
-#define _CAMEL_MIME_FILTER_INDEX_H
-
-#include <camel/camel-mime-filter.h>
-#include <libibex/ibex.h>
-
-#define CAMEL_MIME_FILTER_INDEX(obj) GTK_CHECK_CAST (obj, camel_mime_filter_index_get_type (), CamelMimeFilterIndex)
-#define CAMEL_MIME_FILTER_INDEX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_index_get_type (), CamelMimeFilterIndexClass)
-#define IS_CAMEL_MIME_FILTER_INDEX(obj) GTK_CHECK_TYPE (obj, camel_mime_filter_index_get_type ())
-
-typedef struct _CamelMimeFilterIndexClass CamelMimeFilterIndexClass;
-
-struct _CamelMimeFilterIndex {
- CamelMimeFilter parent;
-
- struct _CamelMimeFilterIndexPrivate *priv;
-
- ibex *index;
- char *name;
-};
-
-struct _CamelMimeFilterIndexClass {
- CamelMimeFilterClass parent_class;
-};
-
-guint camel_mime_filter_index_get_type (void);
-CamelMimeFilterIndex *camel_mime_filter_index_new (void);
-
-CamelMimeFilterIndex *camel_mime_filter_index_new_ibex (ibex *);
-
-/* Set the match name for any indexed words */
-void camel_mime_filter_index_set_name (CamelMimeFilterIndex *, char *);
-void camel_mime_filter_index_set_ibex (CamelMimeFilterIndex *mf, ibex *index);
-
-#endif /* ! _CAMEL_MIME_FILTER_INDEX_H */
diff --git a/camel/camel-mime-filter-save.c b/camel/camel-mime-filter-save.c
deleted file mode 100644
index b5b54a2ee6..0000000000
--- a/camel/camel-mime-filter-save.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <string.h>
-#include <errno.h>
-
-#include "camel-mime-filter-save.h"
-
-static void camel_mime_filter_save_class_init (CamelMimeFilterSaveClass *klass);
-static void camel_mime_filter_save_init (CamelMimeFilterSave *obj);
-
-static CamelMimeFilterClass *camel_mime_filter_save_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_mime_filter_save_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelMimeFilterSave",
- sizeof (CamelMimeFilterSave),
- sizeof (CamelMimeFilterSaveClass),
- (GtkClassInitFunc) camel_mime_filter_save_class_init,
- (GtkObjectInitFunc) camel_mime_filter_save_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_mime_filter_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-finalise(GtkObject *o)
-{
- CamelMimeFilterSave *f = (CamelMimeFilterSave *)o;
-
- g_free(f->filename);
- if (f->fd != -1) {
- /* FIXME: what do we do with failed writes???? */
- close(f->fd);
- }
-
- ((GtkObjectClass *)camel_mime_filter_save_parent)->finalize (o);
-}
-
-static void
-reset(CamelMimeFilter *mf)
-{
- CamelMimeFilterSave *f = (CamelMimeFilterSave *)mf;
-
- /* i dunno, how do you 'reset' a file? reopen it? do i care? */
- if (f->fd != -1){
- lseek(f->fd, 0, SEEK_SET);
- }
-}
-
-/* all this code just to support this little trivial filter! */
-static void
-filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlen, size_t *outprespace)
-{
- CamelMimeFilterSave *f = (CamelMimeFilterSave *)mf;
-
- if (f->fd != -1) {
- /* FIXME: check return */
- int outlen = write(f->fd, in, len);
- if (outlen != len) {
- g_warning("could not write to '%s': %s", f->filename?f->filename:"<descriptor>", strerror(errno));
- }
- }
- *out = in;
- *outlen = len;
- *outprespace = prespace;
-}
-
-static void
-camel_mime_filter_save_class_init (CamelMimeFilterSaveClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass;
-
- camel_mime_filter_save_parent = gtk_type_class (camel_mime_filter_get_type ());
-
- object_class->finalize = finalise;
-
- filter_class->reset = reset;
- filter_class->filter = filter;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_mime_filter_save_init (CamelMimeFilterSave *f)
-{
- f->fd = -1;
-}
-
-/**
- * camel_mime_filter_save_new:
- *
- * Create a new CamelMimeFilterSave object.
- *
- * Return value: A new CamelMimeFilterSave widget.
- **/
-CamelMimeFilterSave *
-camel_mime_filter_save_new (void)
-{
- CamelMimeFilterSave *new = CAMEL_MIME_FILTER_SAVE ( gtk_type_new (camel_mime_filter_save_get_type ()));
- return new;
-}
-
-CamelMimeFilterSave *
-camel_mime_filter_save_new_name (const char *name, int flags, int mode)
-{
- CamelMimeFilterSave *new = NULL;
-
- new = camel_mime_filter_save_new();
- if (new) {
- new->fd = open(name, flags, mode);
- if (new->fd != -1) {
- new->filename = g_strdup(name);
- } else {
- gtk_object_unref((GtkObject *)new);
- new = NULL;
- }
- }
- return new;
-}
-
diff --git a/camel/camel-mime-filter-save.h b/camel/camel-mime-filter-save.h
deleted file mode 100644
index eb6e448560..0000000000
--- a/camel/camel-mime-filter-save.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _CAMEL_MIME_FILTER_SAVE_H
-#define _CAMEL_MIME_FILTER_SAVE_H
-
-#include <camel/camel-mime-filter.h>
-
-#define CAMEL_MIME_FILTER_SAVE(obj) GTK_CHECK_CAST (obj, camel_mime_filter_save_get_type (), CamelMimeFilterSave)
-#define CAMEL_MIME_FILTER_SAVE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_save_get_type (), CamelMimeFilterSaveClass)
-#define IS_CAMEL_MIME_FILTER_SAVE(obj) GTK_CHECK_TYPE (obj, camel_mime_filter_save_get_type ())
-
-typedef struct _CamelMimeFilterSaveClass CamelMimeFilterSaveClass;
-
-struct _CamelMimeFilterSave {
- CamelMimeFilter parent;
-
- struct _CamelMimeFilterSavePrivate *priv;
-
- char *filename;
- int fd;
-};
-
-struct _CamelMimeFilterSaveClass {
- CamelMimeFilterClass parent_class;
-};
-
-guint camel_mime_filter_save_get_type (void);
-CamelMimeFilterSave *camel_mime_filter_save_new (void);
-
-CamelMimeFilterSave *camel_mime_filter_save_new_name (const char *name, int flags, int mode);
-
-#endif /* ! _CAMEL_MIME_FILTER_SAVE_H */
diff --git a/camel/camel-mime-filter.c b/camel/camel-mime-filter.c
deleted file mode 100644
index 27cee890fe..0000000000
--- a/camel/camel-mime-filter.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "camel-mime-filter.h"
-
-struct _CamelMimeFilterPrivate {
- char *inbuf;
- size_t inlen;
-};
-
-#define PRE_HEAD (64)
-#define BACK_HEAD (64)
-#define _PRIVATE(o) (((CamelMimeFilter *)(o))->priv)
-#define FCLASS(o) ((CamelMimeFilterClass *)((GtkObject *)(o))->klass)
-
-static void camel_mime_filter_class_init (CamelMimeFilterClass *klass);
-static void camel_mime_filter_init (CamelMimeFilter *obj);
-
-static CamelObjectClass *camel_mime_filter_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_mime_filter_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelMimeFilter",
- sizeof (CamelMimeFilter),
- sizeof (CamelMimeFilterClass),
- (GtkClassInitFunc) camel_mime_filter_class_init,
- (GtkObjectInitFunc) camel_mime_filter_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_object_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-finalise(GtkObject *o)
-{
- CamelMimeFilter *f = (CamelMimeFilter *)o;
- struct _CamelMimeFilterPrivate *p = _PRIVATE(f);
-
- g_free(f->outreal);
- g_free(f->backbuf);
- g_free(p->inbuf);
- g_free(p);
-
- ((GtkObjectClass *)camel_mime_filter_parent)->finalize (o);
-}
-
-static void
-complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlen, size_t *outprespace)
-{
- /* default - do nothing */
-}
-
-static void
-camel_mime_filter_class_init (CamelMimeFilterClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- camel_mime_filter_parent = gtk_type_class (camel_object_get_type ());
-
- object_class->finalize = finalise;
-
- klass->complete = complete;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_mime_filter_init (CamelMimeFilter *obj)
-{
- obj->outreal = NULL;
- obj->outbuf = NULL;
- obj->outsize = 0;
-
- obj->backbuf = NULL;
- obj->backsize = 0;
- obj->backlen = 0;
-
- _PRIVATE(obj) = g_malloc0(sizeof(*obj->priv));
-}
-
-/**
- * camel_mime_filter_new:
- *
- * Create a new CamelMimeFilter object.
- *
- * Return value: A new CamelMimeFilter widget.
- **/
-CamelMimeFilter *
-camel_mime_filter_new (void)
-{
- CamelMimeFilter *new = CAMEL_MIME_FILTER ( gtk_type_new (camel_mime_filter_get_type ()));
- return new;
-}
-
-static void filter_run(CamelMimeFilter *f,
- char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace,
- void (*filterfunc)(CamelMimeFilter *f,
- char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace))
-{
- struct _CamelMimeFilterPrivate *p;
-
- /*
- here we take a performance hit, if the input buffer doesn't
- have the pre-space required. We make a buffer that does ...
- */
- if (prespace < f->backlen) {
- int newlen = len+prespace+f->backlen;
- p = _PRIVATE(f);
- if (p->inlen < newlen) {
- /* NOTE: g_realloc copies data, we dont need that (slower) */
- g_free(p->inbuf);
- p->inbuf = g_malloc(newlen+PRE_HEAD);
- p->inlen = newlen+PRE_HEAD;
- }
- /* copy to end of structure */
- memcpy(p->inbuf+p->inlen - len, in, len);
- in = p->inbuf+p->inlen - len;
- prespace = p->inlen - len;
- }
-
- /* preload any backed up data */
- if (f->backlen > 0) {
- memcpy(in-f->backlen, f->backbuf, f->backlen);
- in -= f->backlen;
- len += f->backlen;
- prespace -= f->backlen;
- f->backlen = 0;
- }
-
- filterfunc(f, in, len, prespace, out, outlen, outprespace);
-}
-
-void camel_mime_filter_filter(CamelMimeFilter *f,
- char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace)
-{
- if (FCLASS(f)->filter)
- filter_run(f, in, len, prespace, out, outlen, outprespace, FCLASS(f)->filter);
- else
- g_error("Filter function unplmenented in class");
-}
-
-void camel_mime_filter_complete(CamelMimeFilter *f,
- char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace)
-{
- if (FCLASS(f)->complete)
- filter_run(f, in, len, prespace, out, outlen, outprespace, FCLASS(f)->complete);
-}
-
-void camel_mime_filter_reset(CamelMimeFilter *f)
-{
- if (FCLASS(f)->reset) {
- FCLASS(f)->reset(f);
- }
-
- /* could free some buffers, if they are really big? */
- f->backlen = 0;
-}
-
-/* sets number of bytes backed up on the input, new calls replace previous ones */
-void camel_mime_filter_backup(CamelMimeFilter *f, char *data, size_t length)
-{
- if (f->backsize < length) {
- /* g_realloc copies data, unnecessary overhead */
- g_free(f->backbuf);
- f->backbuf = g_malloc(length+BACK_HEAD);
- f->backsize = length+BACK_HEAD;
- }
- f->backlen = length;
- memcpy(f->backbuf, data, length);
-}
-
-/* ensure this much size available for filter output (if required) */
-void camel_mime_filter_set_size(CamelMimeFilter *f, size_t size, int keep)
-{
- if (f->outsize < size) {
- int offset = f->outptr - f->outreal;
- if (keep) {
- f->outreal = g_realloc(f->outreal, size + PRE_HEAD*4);
- } else {
- g_free(f->outreal);
- f->outreal = g_malloc(size + PRE_HEAD*4);
- }
- f->outptr = f->outreal + offset;
- f->outbuf = f->outreal + PRE_HEAD*4;
- f->outsize = size;
- /* this could be offset from the end of the structure, but
- this should be good enough */
- f->outpre = PRE_HEAD*4;
- }
-}
-
diff --git a/camel/camel-mime-filter.h b/camel/camel-mime-filter.h
deleted file mode 100644
index 4576596bab..0000000000
--- a/camel/camel-mime-filter.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* Abstract class for non-copying filters */
-
-#ifndef _CAMEL_MIME_FILTER_H
-#define _CAMEL_MIME_FILTER_H
-
-#include <camel/camel-object.h>
-#include <sys/types.h>
-
-#define CAMEL_MIME_FILTER(obj) GTK_CHECK_CAST (obj, camel_mime_filter_get_type (), CamelMimeFilter)
-#define CAMEL_MIME_FILTER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_get_type (), CamelMimeFilterClass)
-#define IS_CAMEL_MIME_FILTER(obj) GTK_CHECK_TYPE (obj, camel_mime_filter_get_type ())
-
-typedef struct _CamelMimeFilterClass CamelMimeFilterClass;
-
-struct _CamelMimeFilter {
- CamelObject parent;
-
- struct _CamelMimeFilterPrivate *priv;
-
- char *outreal; /* real malloc'd buffer */
- char *outbuf; /* first 'writable' position allowed (outreal + outpre) */
- char *outptr;
- int outsize;
- int outpre; /* prespace of this buffer */
-
- char *backbuf;
- int backsize;
- int backlen; /* significant data there */
-};
-
-struct _CamelMimeFilterClass {
- CamelObjectClass parent_class;
-
- /* virtual functions */
- void (*filter)(CamelMimeFilter *f,
- char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace);
- void (*complete)(CamelMimeFilter *f,
- char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace);
- void (*reset)(CamelMimeFilter *f);
-};
-
-guint camel_mime_filter_get_type (void);
-CamelMimeFilter *camel_mime_filter_new (void);
-
-void camel_mime_filter_filter(CamelMimeFilter *f,
- char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace);
-
-void camel_mime_filter_complete(CamelMimeFilter *f,
- char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace);
-
-void camel_mime_filter_reset(CamelMimeFilter *f);
-
-/* sets/returns number of bytes backed up on the input */
-void camel_mime_filter_backup(CamelMimeFilter *f, char *data, size_t length);
-
-/* ensure this much size available for filter output */
-void camel_mime_filter_set_size(CamelMimeFilter *f, size_t size, int keep);
-
-#endif /* ! _CAMEL_MIME_FILTER_H */
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
deleted file mode 100644
index 8fca516fd0..0000000000
--- a/camel/camel-mime-message.c
+++ /dev/null
@@ -1,704 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camelMimeMessage.c : class for a mime_message */
-
-/*
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel-mime-message.h"
-#include <stdio.h>
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include "hash-table-utils.h"
-
-#define d(x)
-
-/* these 2 below should be kept in sync */
-typedef enum {
- HEADER_UNKNOWN,
- HEADER_FROM,
- HEADER_REPLY_TO,
- HEADER_SUBJECT,
- HEADER_TO,
- HEADER_CC,
- HEADER_BCC,
- HEADER_DATE
-} CamelHeaderType;
-
-static char *header_names[] = {
- /* dont include HEADER_UNKNOWN string */
- "From", "Reply-To", "Subject", "To", "Cc", "Bcc", "Date", NULL
-};
-
-static GHashTable *header_name_table;
-
-static CamelMimePartClass *parent_class=NULL;
-
-static char *recipient_names[] = {
- "To", "Cc", "Bcc", NULL
-};
-
-enum SIGNALS {
- MESSAGE_CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-static void set_message_number (CamelMimeMessage *mime_message, guint number);
-static guint get_message_number (CamelMimeMessage *mime_message);
-static int write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static void finalize (GtkObject *object);
-static void add_header (CamelMedium *medium, const char *header_name, const void *header_value);
-static void set_header (CamelMedium *medium, const char *header_name, const void *header_value);
-static void remove_header (CamelMedium *medium, const char *header_name);
-static int construct_from_parser (CamelMimePart *, CamelMimeParser *);
-
-/* Returns the class for a CamelMimeMessage */
-#define CMM_CLASS(so) CAMEL_MIME_MESSAGE_CLASS (GTK_OBJECT(so)->klass)
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass)
-#define CMD_CLASS(so) CAMEL_MEDIUM_CLASS (GTK_OBJECT(so)->klass)
-
-static void
-camel_mime_message_class_init (CamelMimeMessageClass *camel_mime_message_class)
-{
- CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_mime_message_class);
- CamelMimePartClass *camel_mime_part_class = CAMEL_MIME_PART_CLASS (camel_mime_message_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_mime_message_class);
- CamelMediumClass *camel_medium_class = CAMEL_MEDIUM_CLASS (camel_mime_message_class);
- int i;
-
- parent_class = gtk_type_class (camel_mime_part_get_type ());
-
- header_name_table = g_hash_table_new (g_str_hash, g_str_equal);
- for (i=0;header_names[i];i++)
- g_hash_table_insert (header_name_table, header_names[i], (gpointer)i+1);
-
- /* virtual method definition */
- camel_mime_message_class->set_message_number = set_message_number;
- camel_mime_message_class->get_message_number = get_message_number;
-
- /* virtual method overload */
- camel_data_wrapper_class->write_to_stream = write_to_stream;
-
- camel_medium_class->add_header = add_header;
- camel_medium_class->set_header = set_header;
- camel_medium_class->remove_header = remove_header;
-
- camel_mime_part_class->construct_from_parser = construct_from_parser;
-
- signals[MESSAGE_CHANGED] =
- gtk_signal_new ("message_changed",
- GTK_RUN_LAST,
- gtk_object_class->type,
- GTK_SIGNAL_OFFSET (CamelMimeMessageClass, message_changed),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- gtk_object_class_add_signals (gtk_object_class, signals, LAST_SIGNAL);
-
- gtk_object_class->finalize = finalize;
-}
-
-
-
-
-static void
-camel_mime_message_init (gpointer object, gpointer klass)
-{
- CamelMimeMessage *mime_message = (CamelMimeMessage *)object;
- int i;
-
- camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (object), "message/rfc822");
-
- mime_message->recipients = g_hash_table_new(g_strcase_hash, g_strcase_equal);
- for (i=0;recipient_names[i];i++) {
- g_hash_table_insert(mime_message->recipients, recipient_names[i], camel_internet_address_new());
- }
-
- mime_message->user_flags = NULL;
- mime_message->flags = 0;
-
- mime_message->subject = NULL;
- mime_message->reply_to = NULL;
- mime_message->from = NULL;
- mime_message->folder = NULL;
- mime_message->date = CAMEL_MESSAGE_DATE_CURRENT;
- mime_message->date_offset = 0;
- mime_message->date_str = NULL;
-}
-
-GtkType
-camel_mime_message_get_type (void)
-{
- static GtkType camel_mime_message_type = 0;
-
- if (!camel_mime_message_type) {
- GtkTypeInfo camel_mime_message_info =
- {
- "CamelMimeMessage",
- sizeof (CamelMimeMessage),
- sizeof (CamelMimeMessageClass),
- (GtkClassInitFunc) camel_mime_message_class_init,
- (GtkObjectInitFunc) camel_mime_message_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mime_message_type = gtk_type_unique (camel_mime_part_get_type (), &camel_mime_message_info);
- }
-
- return camel_mime_message_type;
-}
-
-/* annoying way to free objects in a hashtable, i mean, its not like anyone
- would want to store them in a hashtable, really */
-static void g_lib_is_uber_crappy_shit(gpointer whocares, gpointer getlost, gpointer blah)
-{
- gtk_object_unref((GtkObject *)getlost);
-}
-
-static void
-finalize (GtkObject *object)
-{
- CamelMimeMessage *message = CAMEL_MIME_MESSAGE (object);
-
- g_free (message->date_str);
- g_free (message->subject);
- g_free (message->reply_to);
- g_free (message->from);
-
- g_free (message->message_uid);
-
- g_hash_table_foreach (message->recipients, g_lib_is_uber_crappy_shit, NULL);
- g_hash_table_destroy(message->recipients);
-
- camel_flag_list_free(&message->user_flags);
-
- if (message->folder)
- gtk_object_unref (GTK_OBJECT (message->folder));
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-
-CamelMimeMessage *
-camel_mime_message_new (void)
-{
- CamelMimeMessage *mime_message;
- mime_message = gtk_type_new (CAMEL_MIME_MESSAGE_TYPE);
-
- return mime_message;
-}
-
-
-/* **** Date: */
-
-void
-camel_mime_message_set_date(CamelMimeMessage *message, time_t date, int offset)
-{
- g_assert(message);
- if (date == CAMEL_MESSAGE_DATE_CURRENT) {
- struct tm *local;
- int tz;
-
- date = time(0);
- local = localtime(&date);
- offset = 0;
-#if defined(HAVE_TIMEZONE)
- tz = timezone;
-#elif defined(HAVE_TM_GMTOFF)
- tz = local->tm_gmtoff;
-#endif
- offset = ((tz/60/60) * 100) + (tz/60 % 60);
- }
- message->date = date;
- message->date_offset = offset;
- g_free(message->date_str);
- message->date_str = header_format_date(date, offset);
-
- CAMEL_MEDIUM_CLASS(parent_class)->set_header((CamelMedium *)message, "Date", message->date_str);
-}
-
-void
-camel_mime_message_get_date(CamelMimeMessage *message, time_t *date, int *offset)
-{
- if (message->date == CAMEL_MESSAGE_DATE_CURRENT)
- camel_mime_message_set_date(message, CAMEL_MESSAGE_DATE_CURRENT, 0);
- if (date)
- *date = message->date;
- if (offset)
- *offset = message->date_offset;
-}
-
-char *
-camel_mime_message_get_date_string(CamelMimeMessage *message)
-{
- if (message->date == CAMEL_MESSAGE_DATE_CURRENT)
- camel_mime_message_set_date(message, CAMEL_MESSAGE_DATE_CURRENT, 0);
- return message->date_str;
-}
-
-/* **** Reply-To: */
-
-void
-camel_mime_message_set_reply_to (CamelMimeMessage *mime_message, const gchar *reply_to)
-{
- g_assert (mime_message);
-
- /* FIXME: check format of string, handle it nicer ... */
-
- g_free(mime_message->reply_to);
- mime_message->reply_to = g_strdup(reply_to);
- CAMEL_MEDIUM_CLASS(parent_class)->set_header((CamelMedium *)mime_message, "Reply-To", reply_to);
-}
-
-const gchar *
-camel_mime_message_get_reply_to (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
-
- return mime_message->reply_to;
-}
-
-void
-camel_mime_message_set_subject (CamelMimeMessage *mime_message,
- const gchar *subject)
-{
- char *text;
- g_assert (mime_message);
-
- g_free(mime_message->subject);
- mime_message->subject = g_strdup(subject);
- text = header_encode_string(subject);
- CAMEL_MEDIUM_CLASS(parent_class)->set_header((CamelMedium *)mime_message, "Subject", text);
- g_free(text);
-}
-
-const gchar *
-camel_mime_message_get_subject (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
-
- return mime_message->subject;
-}
-
-/* *** From: */
-void
-camel_mime_message_set_from (CamelMimeMessage *mime_message, const gchar *from)
-{
- g_assert (mime_message);
-
- g_free(mime_message->from);
- mime_message->from = g_strdup(from);
- CAMEL_MEDIUM_CLASS(parent_class)->set_header((CamelMedium *)mime_message, "From", from);
-}
-
-const gchar *
-camel_mime_message_get_from (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
-
- return mime_message->from;
-}
-
-/* **** */
-
-void
-camel_mime_message_add_recipient (CamelMimeMessage *mime_message,
- const gchar *type,
- const gchar *name, const char *address)
-{
- CamelInternetAddress *addr;
- char *text;
-
- g_assert (mime_message);
-
- addr = g_hash_table_lookup(mime_message->recipients, type);
- if (addr == NULL) {
- g_warning("trying to add a non-valid receipient type: %s = %s %s", type, name, address);
- return;
- }
-
- camel_internet_address_add(addr, name, address);
-
- /* FIXME: maybe this should be delayed till we're ready to write out? */
- text = camel_address_encode((CamelAddress*)addr);
- CAMEL_MEDIUM_CLASS(parent_class)->set_header((CamelMedium *)mime_message, type, text);
- g_free(text);
-}
-
-void
-camel_mime_message_remove_recipient_address (CamelMimeMessage *mime_message,
- const gchar *type,
- const gchar *address)
-{
- CamelInternetAddress *addr;
- int index;
- char *text;
-
-
- g_assert (mime_message);
-
- addr = g_hash_table_lookup(mime_message->recipients, type);
- if (addr == NULL) {
- g_warning("trying to remove a non-valid receipient type: %s = %s", type, address);
- return;
- }
- index = camel_internet_address_find_address(addr, address, NULL);
- if (index == -1) {
- g_warning("trying to remove address for nonexistand address: %s", address);
- return;
- }
-
- camel_address_remove((CamelAddress *)addr, index);
-
- /* FIXME: maybe this should be delayed till we're ready to write out? */
- text = camel_address_encode((CamelAddress *)addr);
- CAMEL_MEDIUM_CLASS(parent_class)->set_header((CamelMedium *)mime_message, type, text);
- g_free(text);
-}
-
-void
-camel_mime_message_remove_recipient_name (CamelMimeMessage *mime_message,
- const gchar *type,
- const gchar *name)
-{
- CamelInternetAddress *addr;
- int index;
- char *text;
-
- g_assert (mime_message);
-
- addr = g_hash_table_lookup(mime_message->recipients, type);
- if (addr == NULL) {
- g_warning("trying to remove a non-valid receipient type: %s = %s", type, name);
- return;
- }
- index = camel_internet_address_find_name(addr, name, NULL);
- if (index == -1) {
- g_warning("trying to remove address for nonexistand name: %s", name);
- return;
- }
-
- camel_address_remove((CamelAddress *)addr, index);
-
- /* FIXME: maybe this should be delayed till we're ready to write out? */
- text = camel_address_encode((CamelAddress *)addr);
- CAMEL_MEDIUM_CLASS(parent_class)->set_header((CamelMedium *)mime_message, type, text);
- g_free(text);
-}
-
-const CamelInternetAddress *
-camel_mime_message_get_recipients (CamelMimeMessage *mime_message,
- const gchar *type)
-{
- g_assert (mime_message);
-
- return g_hash_table_lookup(mime_message->recipients, type);
-}
-
-
-
-/* **** */
-
-
-guint32
-camel_mime_message_get_flags (CamelMimeMessage *m)
-{
- return m->flags;
-}
-
-void
-camel_mime_message_set_flags (CamelMimeMessage *m, guint32 flags, guint32 set)
-{
- guint32 old;
-
- printf("%p setting flags %x mask %x\n", m, flags, set);
-
- old = m->flags;
- m->flags = (m->flags & ~flags) | (set & flags);
-
- printf("old = %x new = %x\n", old, m->flags);
-
- if (old != m->flags)
- gtk_signal_emit((GtkObject *)m, signals[MESSAGE_CHANGED], MESSAGE_FLAGS_CHANGED);
-}
-
-gboolean
-camel_flag_get(CamelFlag **list, const char *name)
-{
- CamelFlag *flag;
- flag = *list;
- while (flag) {
- if (!strcmp(flag->name, name))
- return TRUE;
- flag = flag->next;
- }
- return FALSE;
-}
-
-void
-camel_flag_set(CamelFlag **list, const char *name, gboolean value)
-{
- CamelFlag *flag, *tmp;
-
- /* this 'trick' works because flag->next is the first element */
- flag = (CamelFlag *)list;
- while (flag->next) {
- tmp = flag->next;
- if (!strcmp(flag->next->name, name)) {
- if (!value) {
- flag->next = tmp->next;
- g_free(tmp);
- }
- return;
- }
- flag = tmp;
- }
-
- if (value) {
- tmp = g_malloc(sizeof(*tmp) + strlen(name));
- strcpy(tmp->name, name);
- tmp->next = 0;
- flag->next = tmp;
- }
-}
-
-int
-camel_flag_list_size(CamelFlag **list)
-{
- int count=0;
- CamelFlag *flag;
-
- flag = *list;
- while (flag) {
- count++;
- flag = flag->next;
- }
- return count;
-}
-
-void
-camel_flag_list_free(CamelFlag **list)
-{
- CamelFlag *flag, *tmp;
- flag = *list;
- while (flag) {
- tmp = flag->next;
- g_free(flag);
- flag = tmp;
- }
- *list = NULL;
-}
-
-gboolean
-camel_mime_message_get_user_flag (CamelMimeMessage *m, const char *name)
-{
- g_return_val_if_fail(m->flags & CAMEL_MESSAGE_USER, FALSE);
-
- return camel_flag_get(&m->user_flags, name);
-}
-
-void
-camel_mime_message_set_user_flag (CamelMimeMessage *m, const char *name, gboolean value)
-{
- g_return_if_fail(m->flags & CAMEL_MESSAGE_USER);
-
- camel_flag_set(&m->user_flags, name, value);
- gtk_signal_emit((GtkObject *)m, signals[MESSAGE_CHANGED], MESSAGE_FLAGS_CHANGED);
-}
-
-
-
-/* FIXME: to be removed??? */
-static void
-set_message_number (CamelMimeMessage *mime_message, guint number)
-{
- mime_message->message_number = number;
-}
-
-static guint
-get_message_number (CamelMimeMessage *mime_message)
-{
- return mime_message->message_number;
-}
-
-
-
-guint
-camel_mime_message_get_message_number (CamelMimeMessage *mime_message)
-{
- return CMM_CLASS (mime_message)->get_message_number (mime_message);
-}
-
-/* mime_message */
-static int
-construct_from_parser(CamelMimePart *dw, CamelMimeParser *mp)
-{
- char *buf;
- int len;
- int state;
- int ret;
-
- d(printf("constructing mime-message\n"));
-
- d(printf("mime_message::construct_from_parser()\n"));
-
- /* let the mime-part construct the guts ... */
- ret = ((CamelMimePartClass *)parent_class)->construct_from_parser(dw, mp);
-
- if (ret == -1)
- return -1;
-
- /* ... then clean up the follow-on state */
- state = camel_mime_parser_step(mp, &buf, &len);
- switch (state) {
- case HSCAN_EOF: case HSCAN_FROM_END: /* this doesn't belong to us */
- camel_mime_parser_unstep(mp);
- case HSCAN_MESSAGE_END:
- break;
- default:
- g_error("Bad parser state: Expecing MESSAGE_END or EOF or ROM, got: %d", camel_mime_parser_state(mp));
- camel_mime_parser_unstep(mp);
- return -1;
- }
-
- d(printf("mime_message::construct_from_parser() leaving\n"));
-#warning "return a real error code"
- return 0;
-}
-
-static int
-write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelMimeMessage *mm = CAMEL_MIME_MESSAGE (data_wrapper);
-
- /* force mandatory headers ... */
- if (mm->from == NULL) {
- g_warning("No from set for message");
- camel_mime_message_set_from(mm, "");
- }
- if (mm->date_str == NULL) {
- g_warning("Application did not set date, using 'now'");
- camel_mime_message_set_date(mm, CAMEL_MESSAGE_DATE_CURRENT, 0);
- }
- if (mm->subject == NULL) {
- g_warning("Application did not set subject, creating one");
- camel_mime_message_set_subject(mm, "No Subject");
- }
-
- /* FIXME: "To" header needs to be set explicitly as well ... */
-
- camel_medium_set_header((CamelMedium *)mm, "Mime-Version", "1.0");
-
- return CAMEL_DATA_WRAPPER_CLASS (parent_class)->write_to_stream (data_wrapper, stream);
-}
-
-static char *
-format_address(const char *text)
-{
- struct _header_address *addr;
- char *ret;
-
- addr = header_address_decode(text);
- if (addr) {
- ret = header_address_list_format(addr);
- header_address_list_clear(&addr);
- } else {
- ret = g_strdup(text);
- }
- return ret;
-}
-
-/* FIXME: check format of fields. */
-static gboolean
-process_header(CamelMedium *medium, const char *header_name, const char *header_value)
-{
- CamelHeaderType header_type;
- CamelMimeMessage *message = CAMEL_MIME_MESSAGE (medium);
- CamelInternetAddress *addr;
-
- header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, header_name);
- switch (header_type) {
- case HEADER_FROM:
- g_free(message->from);
- message->from = format_address(header_value);
- break;
- case HEADER_REPLY_TO:
- g_free(message->reply_to);
- message->reply_to = format_address(header_value);
- break;
- case HEADER_SUBJECT:
- g_free(message->subject);
- message->subject = header_decode_string(header_value);
- break;
- case HEADER_TO:
- case HEADER_CC:
- case HEADER_BCC:
- addr = g_hash_table_lookup(message->recipients, header_name);
- if (header_value)
- camel_address_decode((CamelAddress *)addr, header_value);
- else
- camel_address_remove((CamelAddress *)addr, -1);
- break;
- case HEADER_DATE:
- g_free(message->date_str);
- message->date_str = g_strdup(header_value);
- if (header_value) {
- message->date = header_decode_date(header_value, &message->date_offset);
- } else {
- message->date = CAMEL_MESSAGE_DATE_CURRENT;
- }
- break;
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-static void
-set_header(CamelMedium *medium, const char *header_name, const void *header_value)
-{
- process_header(medium, header_name, header_value);
- parent_class->parent_class.set_header (medium, header_name, header_value);
-}
-
-static void
-add_header(CamelMedium *medium, const char *header_name, const void *header_value)
-{
- /* if we process it, then it must be forced unique as well ... */
- if (process_header(medium, header_name, header_value))
- parent_class->parent_class.set_header (medium, header_name, header_value);
- else
- parent_class->parent_class.add_header (medium, header_name, header_value);
-}
-
-static void
-remove_header(CamelMedium *medium, const char *header_name)
-{
- process_header(medium, header_name, NULL);
- parent_class->parent_class.remove_header (medium, header_name);
-}
-
diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h
deleted file mode 100644
index 40a170e244..0000000000
--- a/camel/camel-mime-message.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camelMimeMessage.h : class for a mime message
- *
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MIME_MESSAGE_H
-#define CAMEL_MIME_MESSAGE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-mime-part.h>
-#include <camel/camel-mime-utils.h>
-#include <camel/camel-internet-address.h>
-
-#define CAMEL_RECIPIENT_TYPE_TO "To"
-#define CAMEL_RECIPIENT_TYPE_CC "Cc"
-#define CAMEL_RECIPIENT_TYPE_BCC "Bcc"
-
-
-#define CAMEL_MIME_MESSAGE_TYPE (camel_mime_message_get_type ())
-#define CAMEL_MIME_MESSAGE(obj) (GTK_CHECK_CAST((obj), CAMEL_MIME_MESSAGE_TYPE, CamelMimeMessage))
-#define CAMEL_MIME_MESSAGE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MIME_MESSAGE_TYPE, CamelMimeMessageClass))
-#define CAMEL_IS_MIME_MESSAGE(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_MESSAGE_TYPE))
-
-
-/* specify local time */
-#define CAMEL_MESSAGE_DATE_CURRENT (~0)
-
-/* system flag bits */
-enum _CamelMessageFlags {
- CAMEL_MESSAGE_ANSWERED = 1<<0,
- CAMEL_MESSAGE_DELETED = 1<<1,
- CAMEL_MESSAGE_DRAFT = 1<<2,
- CAMEL_MESSAGE_FLAGGED = 1<<3,
- CAMEL_MESSAGE_SEEN = 1<<4,
- /* following flags are for the folder, and are not really permanent flags */
- CAMEL_MESSAGE_FOLDER_FLAGGED = 1<<16, /* for use by the folder implementation */
- CAMEL_MESSAGE_USER = 1<<31 /* supports user flags */
-};
-
-typedef struct _CamelFlag {
- struct _CamelFlag *next;
- char name[1];
-} CamelFlag;
-
-struct _CamelMimeMessage
-{
- CamelMimePart parent_object;
-
- /* header fields */
- time_t date;
- int date_offset; /* GMT offset */
- char *date_str; /* cached copy of date string */
-
- gchar *subject;
- gchar *reply_to;
-
- gchar *from;
-
- GHashTable *recipients; /* hash table of CamelInternetAddress's */
-
- /* other fields */
- guint32 flags; /* system flags */
- struct _CamelFlag *user_flags;
- gboolean expunged;
-
- guint message_number; /* set by folder object when retrieving message */
- gchar *message_uid;
-
- CamelFolder *folder;
-};
-
-enum _MessageChangeType {
- MESSAGE_FLAGS_CHANGED,
- MESSAGE_ENVELOPE_CHANGED,
-};
-
-typedef struct {
- CamelMimePartClass parent_class;
-
- /* signals */
- void (*message_changed) (CamelMimeMessage *, enum _MessageChangeType type);
-
- /* Virtual methods */
- void (*set_message_number) (CamelMimeMessage *mime_message,
- guint number);
- guint (*get_message_number) (CamelMimeMessage *mime_message);
-
-} CamelMimeMessageClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_mime_message_get_type (void);
-
-
-/* public methods */
-CamelMimeMessage * camel_mime_message_new (void);
-
-
-void camel_mime_message_set_date (CamelMimeMessage *mime_message, time_t date, int offset);
-void camel_mime_message_get_date (CamelMimeMessage *mime_message, time_t *date, int *offset);
-char *camel_mime_message_get_date_string (CamelMimeMessage *mime_message);
-
-const gchar * camel_mime_message_get_received_date (CamelMimeMessage *mime_message);
-const gchar * camel_mime_message_get_sent_date (CamelMimeMessage *mime_message);
-void camel_mime_message_set_reply_to (CamelMimeMessage *mime_message,
- const gchar *reply_to);
-const gchar * camel_mime_message_get_reply_to (CamelMimeMessage *mime_message);
-void camel_mime_message_set_subject (CamelMimeMessage *mime_message,
- const gchar *subject);
-const gchar * camel_mime_message_get_subject (CamelMimeMessage *mime_message);
-void camel_mime_message_set_from (CamelMimeMessage *mime_message,
- const gchar *from);
-const gchar * camel_mime_message_get_from (CamelMimeMessage *mime_message);
-
-
-void camel_mime_message_add_recipient (CamelMimeMessage *mime_message,
- const char *type, const char *name, const char *address);
-void camel_mime_message_remove_recipient_address (CamelMimeMessage *mime_message,
- const char *type, const char *address);
-void camel_mime_message_remove_recipient_name (CamelMimeMessage *mime_message,
- const char *type, const char *name);
-
-const CamelInternetAddress *camel_mime_message_get_recipients (CamelMimeMessage *mime_message,
- const char *type);
-
-guint32 camel_mime_message_get_flags (CamelMimeMessage *m);
-void camel_mime_message_set_flags (CamelMimeMessage *m, guint32 flags, guint32 set);
-gboolean camel_mime_message_get_user_flag (CamelMimeMessage *m, const char *name);
-void camel_mime_message_set_user_flag (CamelMimeMessage *m, const char *name, gboolean value);
-
-guint camel_mime_message_get_message_number (CamelMimeMessage *mime_message);
-
-/* message flag operations */
-gboolean camel_flag_get(CamelFlag **list, const char *name);
-void camel_flag_set(CamelFlag **list, const char *name, gboolean state);
-int camel_flag_list_size(CamelFlag **list);
-void camel_flag_list_free(CamelFlag **list);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MIME_MESSAGE_H */
diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c
deleted file mode 100644
index 74c7653df3..0000000000
--- a/camel/camel-mime-parser.c
+++ /dev/null
@@ -1,1774 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* What should hopefully be a fast mail parser */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <string.h>
-
-#include <stdio.h>
-#include <errno.h>
-
-#include <unicode.h>
-
-#include <regex.h>
-#include <ctype.h>
-
-#include <glib.h>
-#include "camel-mime-parser.h"
-#include "camel-mime-utils.h"
-#include "camel-mime-filter.h"
-#include "camel-stream.h"
-#include "camel-seekable-stream.h"
-
-#define r(x)
-#define h(x)
-#define c(x)
-#define d(x)
-
-/*#define PURIFY*/
-
-#define MEMPOOL
-
-#define STRUCT_ALIGN 4
-
-#ifdef PURIFY
-int inend_id = -1,
- inbuffer_id = -1;
-#endif
-
-#if 0
-extern int strdup_count;
-extern int malloc_count;
-extern int free_count;
-
-#define g_strdup(x) (strdup_count++, g_strdup(x))
-#define g_malloc(x) (malloc_count++, g_malloc(x))
-#define g_free(x) (free_count++, g_free(x))
-#endif
-
-#ifdef MEMPOOL
-typedef struct _MemPoolNode {
- struct _MemPoolNode *next;
-
- int free;
- char data[1];
-} MemPoolNode;
-
-typedef struct _MemPoolThresholdNode {
- struct _MemPoolThresholdNode *next;
- char data[1];
-} MemPoolThresholdNode;
-
-typedef struct _MemPool {
- int blocksize;
- int threshold;
- struct _MemPoolNode *blocks;
- struct _MemPoolThresholdNode *threshold_blocks;
-} MemPool;
-
-MemPool *mempool_new(int blocksize, int threshold);
-void *mempool_alloc(MemPool *pool, int size);
-void mempool_flush(MemPool *pool, int freeall);
-void mempool_free(MemPool *pool);
-
-MemPool *mempool_new(int blocksize, int threshold)
-{
- MemPool *pool;
-
- pool = g_malloc(sizeof(*pool));
- if (threshold >= blocksize)
- threshold = blocksize * 2 / 3;
- pool->blocksize = blocksize;
- pool->threshold = threshold;
- pool->blocks = NULL;
- pool->threshold_blocks = NULL;
- return pool;
-}
-
-void *mempool_alloc(MemPool *pool, int size)
-{
- size = (size + STRUCT_ALIGN) & (~(STRUCT_ALIGN-1));
- if (size>=pool->threshold) {
- MemPoolThresholdNode *n;
-
- n = g_malloc(sizeof(*n) - sizeof(char) + size);
- n->next = pool->threshold_blocks;
- pool->threshold_blocks = n;
- return &n->data[0];
- } else {
- MemPoolNode *n;
-
- n = pool->blocks;
- while (n) {
- if (n->free >= size) {
- n->free -= size;
- return &n->data[n->free];
- }
- n = n->next;
- }
-
- n = g_malloc(sizeof(*n) - sizeof(char) + pool->blocksize);
- n->next = pool->blocks;
- pool->blocks = n;
- n->free = pool->blocksize - size;
- return &n->data[n->free];
- }
-}
-
-void mempool_flush(MemPool *pool, int freeall)
-{
- MemPoolThresholdNode *tn, *tw;
- MemPoolNode *pw, *pn;
-
- tw = pool->threshold_blocks;
- while (tw) {
- tn = tw->next;
- g_free(tw);
- tw = tn;
- }
- pool->threshold_blocks = NULL;
-
- if (freeall) {
- pw = pool->blocks;
- while (pw) {
- pn = pw->next;
- g_free(pw);
- pw = pn;
- }
- pool->blocks = NULL;
- } else {
- pw = pool->blocks;
- while (pw) {
- pw->free = pool->blocksize;
- pw = pw->next;
- }
- }
-}
-
-void mempool_free(MemPool *pool)
-{
- if (pool) {
- mempool_flush(pool, 1);
- g_free(pool);
- }
-}
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
-#define SCAN_BUF 4096 /* size of read buffer */
-#define SCAN_HEAD 128 /* headroom guaranteed to be before each read buffer */
-
-/* a little hacky, but i couldn't be bothered renaming everything */
-#define _header_scan_state _CamelMimeParserPrivate
-#define _PRIVATE(o) (((CamelMimeParser *)(o))->priv)
-
-struct _header_scan_state {
-
- /* global state */
-
- enum _header_state state;
-
- /* for building headers during scanning */
- char *outbuf;
- char *outptr;
- char *outend;
-
- int fd; /* input for a fd input */
- CamelStream *stream; /* or for a stream */
-
- /* for scanning input buffers */
- char *realbuf; /* the real buffer, SCAN_HEAD*2 + SCAN_BUF bytes */
- char *inbuf; /* points to a subset of the allocated memory, the underflow */
- char *inptr; /* (upto SCAN_HEAD) is for use by filters so they dont copy all data */
- char *inend;
-
- int atleast;
-
- int seek; /* current offset to start of buffer */
- int unstep; /* how many states to 'unstep' (repeat the current state) */
-
- int midline; /* are we mid-line interrupted? */
- int scan_from; /* do we care about From lines? */
-
- int start_of_from; /* where from started */
- int start_of_headers; /* where headers started from the last scan */
-
- int header_start; /* start of last header, or -1 */
-
- struct _header_scan_stack *top_part; /* top of message header */
- int top_start; /* offset of start */
-
- struct _header_scan_stack *pending; /* if we're pending part info, from the wrong part end */
-
- /* filters to apply to all content before output */
- int filterid; /* id of next filter */
- struct _header_scan_filter *filters;
-
- /* per message/part info */
- struct _header_scan_stack *parts;
-
-};
-
-struct _header_scan_stack {
- struct _header_scan_stack *parent;
-
- enum _header_state savestate; /* state at invocation of this part */
-
-#ifdef MEMPOOL
- MemPool *pool; /* memory pool to keep track of headers/etc at this level */
-#endif
- struct _header_raw *headers; /* headers for this part */
-
- struct _header_content_type *content_type;
-
- char *boundary; /* for multipart/ * boundaries, including leading -- and trailing -- for the final part */
- int boundarylen; /* length of boundary, including leading -- */
-};
-
-struct _header_scan_filter {
- struct _header_scan_filter *next;
- int id;
- CamelMimeFilter *filter;
-};
-
-static void folder_scan_step(struct _header_scan_state *s, char **databuffer, int *datalength);
-static void folder_scan_drop_step(struct _header_scan_state *s);
-static int folder_scan_init_with_fd(struct _header_scan_state *s, int fd);
-static int folder_scan_init_with_stream(struct _header_scan_state *s, CamelStream *stream);
-static struct _header_scan_state *folder_scan_init(void);
-static void folder_scan_close(struct _header_scan_state *s);
-static struct _header_scan_stack *folder_scan_content(struct _header_scan_state *s, int *lastone, char **data, int *length);
-static struct _header_scan_stack *folder_scan_header(struct _header_scan_state *s, int *lastone);
-static int folder_scan_skip_line(struct _header_scan_state *s);
-static off_t folder_seek(struct _header_scan_state *s, off_t offset, int whence);
-static off_t folder_tell(struct _header_scan_state *s);
-#ifdef MEMPOOL
-static void header_append_mempool(struct _header_scan_state *s, struct _header_scan_stack *h, char *header, int offset);
-#endif
-
-static void camel_mime_parser_class_init (CamelMimeParserClass *klass);
-static void camel_mime_parser_init (CamelMimeParser *obj);
-
-static char *states[] = {
- "HSCAN_INITIAL",
- "HSCAN_FROM", /* got 'From' line */
- "HSCAN_HEADER", /* toplevel header */
- "HSCAN_BODY", /* scanning body of message */
- "HSCAN_MULTIPART", /* got multipart header */
- "HSCAN_MESSAGE", /* rfc822 message */
-
- "HSCAN_PART", /* part of a multipart */
- "<invalid>",
-
- "HSCAN_EOF", /* end of file */
- "HSCAN_FROM_END",
- "HSCAN_HEAER_END",
- "HSCAN_BODY_END",
- "HSCAN_MULTIPART_END",
- "HSCAN_MESSAGE_END",
-};
-
-static CamelObjectClass *camel_mime_parser_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_mime_parser_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelMimeParser",
- sizeof (CamelMimeParser),
- sizeof (CamelMimeParserClass),
- (GtkClassInitFunc) camel_mime_parser_class_init,
- (GtkObjectInitFunc) camel_mime_parser_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_object_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-finalise(GtkObject *o)
-{
- struct _header_scan_state *s = _PRIVATE(o);
-#ifdef PURIFY
- purify_watch_remove_all();
-#endif
- folder_scan_close(s);
-
- ((GtkObjectClass *)camel_mime_parser_parent)->finalize (o);
-}
-
-static void
-camel_mime_parser_class_init (CamelMimeParserClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- camel_mime_parser_parent = gtk_type_class (camel_object_get_type ());
-
- object_class->finalize = finalise;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_mime_parser_init (CamelMimeParser *obj)
-{
- struct _header_scan_state *s;
-
- s = folder_scan_init();
- _PRIVATE(obj) = s;
-}
-
-/**
- * camel_mime_parser_new:
- *
- * Create a new CamelMimeParser object.
- *
- * Return value: A new CamelMimeParser widget.
- **/
-CamelMimeParser *
-camel_mime_parser_new (void)
-{
- CamelMimeParser *new = CAMEL_MIME_PARSER ( gtk_type_new (camel_mime_parser_get_type ()));
- return new;
-}
-
-
-/**
- * camel_mime_parser_filter_add:
- * @m:
- * @mf:
- *
- * Add a filter that will be applied to any body content before it is passed
- * to the caller. Filters may be pipelined to perform multi-pass operations
- * on the content, and are applied in the order they were added.
- *
- * Note that filters are only applied to the body content of messages, and once
- * a filter has been set, all content returned by a filter_step() with a state
- * of HSCAN_BODY will have passed through the filter.
- *
- * Return value: An id that may be passed to filter_remove() to remove
- * the filter, or -1 if the operation failed.
- **/
-int
-camel_mime_parser_filter_add(CamelMimeParser *m, CamelMimeFilter *mf)
-{
- struct _header_scan_state *s = _PRIVATE(m);
- struct _header_scan_filter *f, *new;
-
- new = g_malloc(sizeof(*new));
- new->filter = mf;
- new->id = s->filterid++;
- if (s->filterid == -1)
- s->filterid++;
- new->next = 0;
- gtk_object_ref((GtkObject *)mf);
-
- /* yes, this is correct, since 'next' is the first element of the struct */
- f = (struct _header_scan_filter *)&s->filters;
- while (f->next)
- f = f->next;
- f->next = new;
- return new->id;
-}
-
-/**
- * camel_mime_parser_filter_remove:
- * @m:
- * @id:
- *
- * Remove a processing filter from the pipeline. There is no
- * restriction on the order the filters can be removed.
- **/
-void
-camel_mime_parser_filter_remove(CamelMimeParser *m, int id)
-{
- struct _header_scan_state *s = _PRIVATE(m);
- struct _header_scan_filter *f, *old;
-
- f = (struct _header_scan_filter *)&s->filters;
- while (f && f->next) {
- old = f->next;
- if (old->id == id) {
- gtk_object_unref((GtkObject *)old->filter);
- f->next = old->next;
- g_free(old);
- /* there should only be a single matching id, but
- scan the whole lot anyway */
- }
- f = f->next;
- }
-}
-
-/**
- * camel_mime_parser_header:
- * @m:
- * @name: Name of header.
- * @offset: Pointer that can receive the offset of the header in
- * the stream from the start of parsing.
- *
- * Lookup a header by name.
- *
- * Return value: The header value, or NULL if the header is not
- * defined.
- **/
-const char *
-camel_mime_parser_header(CamelMimeParser *m, const char *name, int *offset)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- if (s->parts &&
- s->parts->headers) {
- return header_raw_find(&s->parts->headers, name, offset);
- }
- return NULL;
-}
-
-/**
- * camel_mime_parser_headers_raw:
- * @m:
- *
- * Get the list of the raw headers which are defined for the
- * current state of the parser. These headers are valid
- * until the next call to parser_step(), or parser_drop_step().
- *
- * Return value: The raw headers, or NULL if there are no headers
- * defined for the current part or state. These are READ ONLY.
- **/
-struct _header_raw *
-camel_mime_parser_headers_raw(CamelMimeParser *m)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- if (s->parts)
- return s->parts->headers;
- return NULL;
-}
-
-/**
- * camel_mime_parser_init_with_fd:
- * @m:
- * @fd: A valid file descriptor.
- *
- * Initialise the scanner with an fd. The scanner's offsets
- * will be relative to the current file position of the file
- * descriptor. As a result, seekable descritors should
- * be seeked using the parser seek functions.
- *
- * An initial buffer will be read from the file descriptor
- * immediately, although no parsing will occur.
- *
- * Return value: Returns -1 on error.
- **/
-int
-camel_mime_parser_init_with_fd(CamelMimeParser *m, int fd)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- return folder_scan_init_with_fd(s, fd);
-}
-
-/**
- * camel_mime_parser_init_with_stream:
- * @m:
- * @stream:
- *
- * Initialise the scanner with a source stream. The scanner's
- * offsets will be relative to the current file position of
- * the stream. As a result, seekable streams should only
- * be seeked using the parser seek function.
- *
- * An initial buffer will be read from the stream
- * immediately, although no parsing will occur.
- *
- * Return value: -1 on error.
- **/
-int
-camel_mime_parser_init_with_stream(CamelMimeParser *m, CamelStream *stream)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- return folder_scan_init_with_stream(s, stream);
-}
-
-/**
- * camel_mime_parser_scan_from:
- * @m:
- * @scan_from: #TRUE if the scanner should scan From lines.
- *
- * Tell the scanner if it should scan "^From " lines or not.
- *
- * If the scanner is scanning from lines, two additional
- * states HSCAN_FROM and HSCAN_FROM_END will be returned
- * to the caller during parsing.
- **/
-void
-camel_mime_parser_scan_from(CamelMimeParser *m, int scan_from)
-{
- struct _header_scan_state *s = _PRIVATE(m);
- s->scan_from = scan_from;
-}
-
-/**
- * camel_mime_parser_content_type:
- * @m:
- *
- * Get the content type defined in the current part.
- *
- * Return value: A content_type structure, or NULL if there
- * is no content-type defined for this part of state of the
- * parser.
- **/
-struct _header_content_type *
-camel_mime_parser_content_type(CamelMimeParser *m)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- /* FIXME: should this search up until its found the 'right'
- content-type? can it? */
- if (s->parts)
- return s->parts->content_type;
- return NULL;
-}
-
-/**
- * camel_mime_parser_unstep:
- * @m:
- *
- * Cause the last step operation to repeat itself. If this is
- * called repeated times, then the same step will be repeated
- * that many times.
- *
- * Note that it is not possible to scan back using this function,
- * only to have a way of peeking the next state.
- **/
-void camel_mime_parser_unstep(CamelMimeParser *m)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- s->unstep++;
-}
-
-/**
- * camel_mime_parser_drop_step:
- * @m:
- *
- * Drop the last step call. This should only be used
- * in conjunction with seeking of the stream as the
- * stream may be in an undefined state relative to the
- * state of the parser.
- *
- * Use this call with care.
- **/
-void camel_mime_parser_drop_step(CamelMimeParser *m)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- s->unstep = 0;
- folder_scan_drop_step(s);
-}
-
-/**
- * camel_mime_parser_step:
- * @m:
- * @databuffer: Pointer to accept a pointer to the data
- * associated with this step (if any). May be #NULL,
- * in which case datalength is also ingored.
- * @datalength: Pointer to accept a pointer to the data
- * length associated with this step (if any).
- *
- * Parse the next part of the MIME message. If _unstep()
- * has been called, then continue to return the same state
- * for that many calls.
- *
- * If the step is HSCAN_BODY then the databuffer and datalength
- * pointers will be setup to point to the internal data buffer
- * of the scanner and may be processed as required. Any
- * filters will have already been applied to this data.
- *
- * Refer to the state diagram elsewhere for a full listing of
- * the states an application is gauranteed to get from the
- * scanner.
- *
- * Return value: The current new state of the parser
- * is returned.
- **/
-enum _header_state
-camel_mime_parser_step(CamelMimeParser *m, char **databuffer, int *datalength)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- d(printf("OLD STATE: '%s' :\n", states[s->state]));
-
- if (s->unstep <= 0) {
- char *dummy;
- int dummylength;
-
- if (databuffer == NULL) {
- databuffer = &dummy;
- datalength = &dummylength;
- }
-
- folder_scan_step(s, databuffer, datalength);
- } else
- s->unstep--;
-
- d(printf("NEW STATE: '%s' :\n", states[s->state]));
-
- return s->state;
-}
-
-/**
- * camel_mime_parser_tell:
- * @m:
- *
- * Return the current scanning offset. The meaning of this
- * value will depend on the current state of the parser.
- *
- * An incomplete listing of the states:
- *
- * HSCAN_INITIAL, The start of the current message.
- * HSCAN_HEADER, HSCAN_MESSAGE, HSCAN_MULTIPART, the character
- * position immediately after the end of the header.
- * HSCAN_BODY, Position within the message of the start
- * of the current data block.
- * HSCAN_*_END, The position of the character starting
- * the next section of the scan (the last position + 1 of
- * the respective current state).
- *
- * Return value: See above.
- **/
-off_t camel_mime_parser_tell(CamelMimeParser *m)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- return folder_tell(s);
-}
-
-/**
- * camel_mime_parser_tell_start_headers:
- * @m:
- *
- * Find out the position within the file of where the
- * headers started, this is cached by the parser
- * at the time.
- *
- * Return value: The header start position, or -1 if
- * no headers were scanned in the current state.
- **/
-off_t camel_mime_parser_tell_start_headers(CamelMimeParser *m)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- return s->start_of_headers;
-}
-
-/**
- * camel_mime_parser_tell_start_from:
- * @m:
- *
- * If the parser is scanning From lines, then this returns
- * the position of the start of the From line.
- *
- * Return value: The start of the from line, or -1 if there
- * was no From line, or From lines are not being scanned.
- **/
-off_t camel_mime_parser_tell_start_from(CamelMimeParser *m)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- return s->start_of_from;
-}
-
-/**
- * camel_mime_parser_seek:
- * @m:
- * @off: Number of bytes to offset the seek by.
- * @whence: SEEK_SET, SEEK_CUR, SEEK_END
- *
- * Reset the source position to a known value.
- *
- * Note that if the source stream/descriptor was not
- * positioned at 0 to begin with, and an absolute seek
- * is specified (whence != SEEK_CUR), then the seek
- * position may not match the desired seek position.
- *
- * Return value: The new seek offset, or -1 on
- * an error (for example, trying to seek on a non-seekable
- * stream or file descriptor).
- **/
-off_t camel_mime_parser_seek(CamelMimeParser *m, off_t off, int whence)
-{
- struct _header_scan_state *s = _PRIVATE(m);
- return folder_seek(s, off, whence);
-}
-
-/**
- * camel_mime_parser_state:
- * @m:
- *
- * Get the current parser state.
- *
- * Return value: The current parser state.
- **/
-enum _header_state camel_mime_parser_state(CamelMimeParser *m)
-{
- struct _header_scan_state *s = _PRIVATE(m);
- return s->state;
-}
-
-/**
- * camel_mime_parser_stream:
- * @m:
- *
- * Get the stream, if any, the parser has been initialised
- * with. May be used to setup sub-streams, but should not
- * be read from directly (without saving and restoring
- * the seek position in between).
- *
- * Return value: The stream from _init_with_stream(), or NULL
- * if the parser is reading from a file descriptor or is
- * uninitialised.
- **/
-CamelStream *camel_mime_parser_stream(CamelMimeParser *m)
-{
- struct _header_scan_state *s = _PRIVATE(m);
- return s->stream;
-}
-
-/**
- * camel_mime_parser_fd:
- * @m:
- *
- * Return the file descriptor, if any, the parser has been
- * initialised with.
- *
- * Should not be read from unless the parser it to terminate,
- * or the seek offset can be reset before the next parse
- * step.
- *
- * Return value: The file descriptor or -1 if the parser
- * is reading from a stream or has not been initialised.
- **/
-int camel_mime_parser_fd(CamelMimeParser *m)
-{
- struct _header_scan_state *s = _PRIVATE(m);
- return s->fd;
-}
-
-/* ********************************************************************** */
-/* Implementation */
-/* ********************************************************************** */
-
-/* read the next bit of data, ensure there is enough room 'atleast' bytes */
-static int
-folder_read(struct _header_scan_state *s)
-{
- int len;
- int inoffset;
-
- if (s->inptr<s->inend-s->atleast)
- return s->inend-s->inptr;
-#ifdef PURIFY
- purify_watch_remove(inend_id);
- purify_watch_remove(inbuffer_id);
-#endif
- /* check for any remaning bytes (under the atleast limit( */
- inoffset = s->inend - s->inptr;
- if (inoffset>0) {
- memcpy(s->inbuf, s->inptr, inoffset);
- }
- if (s->stream) {
- len = camel_stream_read(s->stream, s->inbuf+inoffset, SCAN_BUF-inoffset);
- } else {
- len = read(s->fd, s->inbuf+inoffset, SCAN_BUF-inoffset);
- }
- r(printf("read %d bytes, offset = %d\n", len, inoffset));
- if (len>=0) {
- /* add on the last read block */
- s->seek += s->inptr - s->inbuf;
- s->inptr = s->inbuf;
- s->inend = s->inbuf+len+inoffset;
- r(printf("content = %d '%.*s'\n",s->inend - s->inptr, s->inend - s->inptr, s->inptr));
- }
-
- g_assert(s->inptr<=s->inend);
-#ifdef PURIFY
- inend_id = purify_watch(&s->inend);
- inbuffer_id = purify_watch_n(s->inend+1, SCAN_HEAD-1, "rw");
-#endif
- r(printf("content = %d '%.*s'\n", s->inend - s->inptr, s->inend - s->inptr, s->inptr));
- /* set a sentinal, for the inner loops to check against */
- s->inend[0] = '\n';
- return s->inend-s->inptr;
-}
-
-/* return the current absolute position of the data pointer */
-static off_t
-folder_tell(struct _header_scan_state *s)
-{
- return s->seek + (s->inptr - s->inbuf);
-}
-
-/*
- need some way to prime the parser state, so this actually works for
- other than top-level messages
-*/
-static off_t
-folder_seek(struct _header_scan_state *s, off_t offset, int whence)
-{
- off_t newoffset;
- int len;
-
- if (s->stream) {
- if (CAMEL_IS_SEEKABLE_STREAM(s->stream)) {
- /* NOTE: assumes whence seekable stream == whence libc, which is probably
- the case (or bloody well should've been) */
- newoffset = camel_seekable_stream_seek((CamelSeekableStream *)s->stream, offset, whence);
- } else {
- newoffset = -1;
- errno = EINVAL;
- }
- } else {
- newoffset = lseek(s->fd, offset, whence);
- }
-#ifdef PURIFY
- purify_watch_remove(inend_id);
- purify_watch_remove(inbuffer_id);
-#endif
- if (newoffset != -1) {
- s->seek = newoffset;
- s->inptr = s->inbuf;
- s->inend = s->inbuf;
- if (s->stream)
- len = camel_stream_read(s->stream, s->inbuf, SCAN_BUF);
- else
- len = read(s->fd, s->inbuf, SCAN_BUF);
- if (len>=0) {
- s->inend = s->inbuf+len;
- s->inend[0] = '\n';
- } else
- newoffset = -1;
- }
-#ifdef PURIFY
- inend_id = purify_watch(&s->inend);
- inbuffer_id = purify_watch_n(s->inend+1, SCAN_HEAD-1, "rw");
-#endif
- return newoffset;
-}
-
-static void
-folder_push_part(struct _header_scan_state *s, struct _header_scan_stack *h)
-{
- h->parent = s->parts;
- s->parts = h;
-}
-
-static void
-folder_pull_part(struct _header_scan_state *s)
-{
- struct _header_scan_stack *h;
-
- h = s->parts;
- if (h) {
- s->parts = h->parent;
- g_free(h->boundary);
-#ifdef MEMPOOL
- mempool_free(h->pool);
-#else
- header_raw_clear(&h->headers);
-#endif
- header_content_type_unref(h->content_type);
- g_free(h);
- } else {
- g_warning("Header stack underflow!\n");
- }
-}
-
-static int
-folder_scan_skip_line(struct _header_scan_state *s)
-{
- int atleast = s->atleast;
- register char *inptr, *inend, c;
- int len;
-
- s->atleast = 1;
-
- while ( (len = folder_read(s)) > 0 && len > s->atleast) { /* ensure we have at least enough room here */
- inptr = s->inptr;
- inend = s->inend-1;
-
- c = -1;
- while (inptr<inend
- && (c = *inptr++)!='\n')
- ;
-
- s->inptr = inptr;
-
- if (c=='\n') {
- s->atleast = atleast;
- return 0;
- }
- }
-
- s->atleast = atleast;
-
- return -1; /* not found */
-}
-
-/* TODO: Is there any way to make this run faster? It gets called a lot ... */
-static struct _header_scan_stack *
-folder_boundary_check(struct _header_scan_state *s, const char *boundary, int *lastone)
-{
- struct _header_scan_stack *part;
- int len = s->atleast-2; /* make sure we dont access past the buffer */
-
- h(printf("checking boundary marker upto %d bytes\n", len));
- part = s->parts;
- while (part) {
- h(printf(" boundary: %s\n", part->boundary));
- h(printf(" against: '%.*s'\n", len, boundary));
- if (part->boundary
- && part->boundarylen <= len
- && memcmp(boundary, part->boundary, part->boundarylen)==0) {
- h(printf("matched boundary: %s\n", part->boundary));
- /* again, make sure we're in range */
- if (part->boundarylen <= len+2) {
- h(printf("checking lastone\n"));
- *lastone = (boundary[part->boundarylen]=='-'
- && boundary[part->boundarylen+1]=='-');
- } else {
- h(printf("not enough room to check last one?\n"));
- *lastone = FALSE;
- }
- /*printf("ok, we found it! : %s \n", (*lastone)?"Last one":"More to come?");*/
- return part;
- }
- part = part->parent;
- }
- return NULL;
-}
-
-#ifdef MEMPOOL
-static void
-header_append_mempool(struct _header_scan_state *s, struct _header_scan_stack *h, char *header, int offset)
-{
- struct _header_raw *l, *n;
- char *content;
-
- d(printf("Header: %s: %s\n", name, value));
-
- content = strchr(header, ':');
- if (content) {
- register int len;
- n = mempool_alloc(h->pool, sizeof(*n));
- n->next = NULL;
-
- len = content-header;
- n->name = mempool_alloc(h->pool, len+1);
- memcpy(n->name, header, len);
- n->name[len] = 0;
-
- content++;
-
- len = s->outptr - content;
- n->value = mempool_alloc(h->pool, len+1);
- memcpy(n->value, content, len);
- n->value[len] = 0;
-
- n->offset = offset;
-
- l = (struct _header_raw *)&h->headers;
- while (l->next) {
- l = l->next;
- }
- l->next = n;
- }
-
-}
-
-#define header_raw_append_parse(a, b, c) (header_append_mempool(s, h, b, c))
-
-#endif
-
-/* Copy the string start->inptr into the header buffer (s->outbuf),
- grow if necessary
- and track the start offset of the header */
-/* Basically an optimised version of g_byte_array_append() */
-#define header_append(s, start, inptr) \
-{ \
- register int headerlen = inptr-start; \
- \
- if (headerlen >= (s->outend - s->outptr)) { \
- register char *outnew; \
- register int len = ((s->outend - s->outbuf)+headerlen)*2+1; \
- outnew = g_realloc(s->outbuf, len); \
- s->outptr = s->outptr - s->outbuf + outnew; \
- s->outbuf = outnew; \
- s->outend = outnew + len; \
- } \
- memcpy(s->outptr, start, headerlen); \
- s->outptr += headerlen; \
- if (s->header_start == -1) \
- s->header_start = (start-s->inbuf) + s->seek; \
-}
-
-static struct _header_scan_stack *
-folder_scan_header(struct _header_scan_state *s, int *lastone)
-{
- int atleast = s->atleast;
- char *start;
- int len;
- struct _header_scan_stack *part, *overpart = s->parts;
- struct _header_scan_stack *h;
- char *inend;
- register char *inptr;
-
- h(printf("scanning first bit\n"));
-
- h = g_malloc0(sizeof(*h));
-#ifdef MEMPOOL
- h->pool = mempool_new(8192, 4096);
-#endif
-
- /* FIXME: this info should be cached ? */
- part = s->parts;
- s->atleast = 5;
- while (part) {
- if (part->boundary)
- s->atleast = MAX(s->atleast, part->boundarylen+2);
- part = part->parent;
- }
-#if 0
- s->atleast = MAX(s->atleast, 5);
- if (s->parts)
- s->atleast = MAX(s->atleast, s->parts->boundarylen+2);
-#endif
-
- *lastone = FALSE;
-retry:
-
- while ((len = folder_read(s))>0 && len >= s->atleast) { /* ensure we have at least enough room here */
- inptr = s->inptr;
- inend = s->inend-s->atleast;
-
- while (inptr<=inend) {
- /*printf(" '%.20s'\n", inptr);*/
-
- start = inptr;
-
- if (!s->midline
- && (part = folder_boundary_check(s, inptr, lastone))) {
- if ((s->outptr>s->outbuf) || (inptr-start))
- goto header_truncated; /* may not actually be truncated */
-
- goto normal_exit;
- }
-
- /* goto next line */
- while ((*inptr++)!='\n')
- ;
-
- /* check against the real buffer end, not our 'atleast limited' end */
- /* also make sure we have at least 1 char lookahead, so even if we found a \n at
- the end, well, make out we didn't, and re-scan it next pass */
- if (inptr>=s->inend) {
- inptr--;
- s->midline = TRUE;
- } else {
- s->midline = FALSE;
- }
-
- g_assert(inptr<=s->inend);
-
- header_append(s, start, inptr);
-
- h(printf("outbuf[0] = %02x '%c' oubuf[1] = %02x '%c'\n",
- s->outbuf[0], isprint(s->outbuf[0])?s->outbuf[0]:'.',
- s->outbuf[1], isprint(s->outbuf[1])?s->outbuf[1]:'.'));
-
- if (!s->midline
- && !(inptr[0] == ' ' || inptr[0] == '\t')) {
- if (s->outbuf[0] == '\n'
- || (s->outbuf[0] == '\r' && s->outbuf[1]=='\n')) {
- goto header_done;
- }
-
- /* we always have at least _1_ char here ... */
- if (s->outptr[-1] == '\n')
- s->outptr--;
- s->outptr[0] = 0;
-
- d(printf("header %.10s at %d\n", s->outbuf, s->header_start));
-
- header_raw_append_parse(&h->headers, s->outbuf, s->header_start);
-
- if (inptr[0]=='\n'
- || (inptr[0] == '\r' && inptr[1]=='\n')) {
- inptr++;
- goto header_done;
- }
- s->outptr = s->outbuf;
- s->header_start = -1;
- }
- }
- s->inptr = inptr;
- }
-
- /* ok, we're at the end of the data, just make sure we're not missing out some small
- truncated header markers */
- if (overpart) {
- overpart = overpart->parent;
- while (overpart) {
- if (overpart->boundary && (overpart->boundarylen+2) < s->atleast) {
- s->atleast = overpart->boundarylen+2;
- h(printf("Retrying next smaller part ...\n"));
- goto retry;
- }
- overpart = overpart->parent;
- }
- }
-
- if ((s->outptr > s->outbuf) || s->inend > s->inptr) {
- start = s->inptr;
- inptr = s->inend;
- goto header_truncated;
- }
-
- s->atleast = atleast;
-
- return h;
-
-header_truncated:
-
- header_append(s, start, inptr);
-
- if (s->outptr>s->outbuf && s->outptr[-1] == '\n')
- s->outptr--;
- s->outptr[0] = 0;
-
- if (s->outbuf[0] == '\n'
- || (s->outbuf[0] == '\r' && s->outbuf[1]=='\n')) {
- goto header_done;
- }
-
- header_raw_append_parse(&h->headers, s->outbuf, s->header_start);
-
-header_done:
- part = s->parts;
-
- s->outptr = s->outbuf;
-normal_exit:
- s->inptr = inptr;
- s->atleast = atleast;
- s->header_start = -1;
- return h;
-}
-
-static struct _header_scan_stack *
-folder_scan_content(struct _header_scan_state *s, int *lastone, char **data, int *length)
-{
- int atleast = s->atleast;
- register char *inptr;
- char *inend;
- char *start;
- int len;
- struct _header_scan_stack *part, *overpart = s->parts;
- int already_packed = FALSE;
-
- /*printf("scanning content\n");*/
-
- /* FIXME: this info should be cached ? */
- part = s->parts;
- s->atleast = 5;
- while (part) {
- if (part->boundary) {
- c(printf("boundary: %s\n", part->boundary));
- s->atleast = MAX(s->atleast, part->boundarylen+2);
- }
- part = part->parent;
- }
-/* s->atleast = MAX(s->atleast, 5);*/
-#if 0
- if (s->parts)
- s->atleast = MAX(s->atleast, s->parts->boundarylen+2);
-#endif
- *lastone = FALSE;
-
-retry:
- c(printf("atleast = %d\n", s->atleast));
-
- while ((len = folder_read(s))>0 && len >= s->atleast) { /* ensure we have at least enough room here */
- inptr = s->inptr;
- inend = s->inend-s->atleast;
- start = inptr;
-
- c(printf("inptr = %p, inend = %p\n", inptr, inend));
-
- while (inptr<=inend) {
- if (!s->midline
- && (part = folder_boundary_check(s, inptr, lastone))) {
- if ( (inptr-start) )
- goto content;
-
- goto normal_exit;
- }
-
- /* goto the next line */
- while ((*inptr++)!='\n')
- ;
-
- /* check against the real buffer end, not our 'atleast limited' end */
- if (inptr> s->inend) {
- inptr--;
- s->midline = TRUE;
- } else {
- s->midline = FALSE;
- }
-
- g_assert(inptr<=s->inend);
- }
-
- /* *sigh* so much for the beautiful simplicity of the code so far - here we
- have the snot to deal with the nasty end-cases that come from the read-ahead
- buffers we use */
- /* what this does, is if we are somewhere near the end of the buffer,
- force it to the front, and re-read, ensuring we bunch as much together
- as possible, for the final read, without copying too much of the time */
- /* make sure we dont loop forever, but also make sure we try smaller
- boundaries, if there are any, so we dont miss any. */
- /* this is not needed for the header scanner, since it copies its own
- data */
- c(printf("start offset = %d atleast = %d\n", start-s->inbuf, s->atleast));
- if (start > (s->inbuf + s->atleast)) {
- /* force a re-scan of this data */
- s->inptr = start;
- if (already_packed)
- goto smaller_boundary;
- c(printf("near the end, try and bunch things up a bit first\n"));
- already_packed = TRUE;
- } else {
- c(printf("dumping what i've got ...\n"));
- /* what would be nice here, is if that we're at eof, we bunch the last
- little bit in the same content, but i dont think this is easy */
- goto content_mid;
- }
- }
-
- c(printf("length read = %d\n", len));
-smaller_boundary:
-
- /* ok, we're at the end of the data, just make sure we're not missing out some small
- truncated header markers */
- if (overpart) {
- overpart = overpart->parent;
- while (overpart) {
- if (overpart->boundary && (overpart->boundarylen+2) < s->atleast) {
- s->atleast = overpart->boundarylen+2;
- c(printf("Retrying next smaller part ...\n"));
- goto retry;
- }
- overpart = overpart->parent;
- }
- }
-
- if (s->inend > s->inptr) {
- start = s->inptr;
- inptr = s->inend;
- goto content;
- }
-
- *length = 0;
- s->atleast = atleast;
- return NULL;
-
-content_mid:
- s->midline = TRUE;
-content:
- part = s->parts;
-normal_exit:
- s->atleast = atleast;
- s->inptr = inptr;
-
- *data = start;
- *length = inptr-start;
-
-/* printf("got %scontent: %.*s", s->midline?"partial ":"", inptr-start, start);*/
-
- return part;
-}
-
-
-static void
-folder_scan_close(struct _header_scan_state *s)
-{
- g_free(s->realbuf);
- g_free(s->outbuf);
- while (s->parts)
- folder_pull_part(s);
- if (s->fd != -1)
- close(s->fd);
- if (s->stream) {
- gtk_object_unref((GtkObject *)s->stream);
- }
- g_free(s);
-}
-
-
-static struct _header_scan_state *
-folder_scan_init(void)
-{
- struct _header_scan_state *s;
-
- s = g_malloc(sizeof(*s));
-
- s->fd = -1;
- s->stream = NULL;
-
- s->outbuf = g_malloc(1024);
- s->outptr = s->outbuf;
- s->outend = s->outbuf+1024;
-
- s->realbuf = g_malloc(SCAN_BUF + SCAN_HEAD*2);
- s->inbuf = s->realbuf + SCAN_HEAD;
- s->inptr = s->inbuf;
- s->inend = s->inbuf;
- s->atleast = 0;
-
- s->seek = 0; /* current character position in file of the last read block */
- s->unstep = 0;
-
- s->header_start = -1;
-
- s->start_of_from = -1;
- s->start_of_headers = -1;
-
- s->midline = FALSE;
- s->scan_from = FALSE;
-
- s->filters = NULL;
- s->filterid = 1;
-
- s->parts = NULL;
-
- s->state = HSCAN_INITIAL;
- return s;
-}
-
-static int
-folder_scan_init_with_fd(struct _header_scan_state *s, int fd)
-{
- int len;
-
- len = read(fd, s->inbuf, SCAN_BUF);
- if (len>=0) {
- s->inend = s->inbuf+len;
- s->inptr = s->inbuf;
- s->inend[0] = '\n';
- if (s->fd != -1)
- close(s->fd);
- s->fd = fd;
- if (s->stream) {
- gtk_object_unref((GtkObject *)s->stream);
- s->stream = NULL;
- }
- return 0;
- } else {
- return -1;
- }
-}
-
-static int
-folder_scan_init_with_stream(struct _header_scan_state *s, CamelStream *stream)
-{
- int len;
-
- len = camel_stream_read(stream, s->inbuf, SCAN_BUF);
- if (len >= 0) {
- s->inend = s->inbuf+len;
- s->inptr = s->inbuf;
- s->inend[0] = '\n';
- if (s->stream)
- gtk_object_unref((GtkObject *)s->stream);
- s->stream = stream;
- gtk_object_ref((GtkObject *)stream);
- if (s->fd != -1) {
- close(s->fd);
- s->fd = -1;
- }
- return 0;
- } else {
- return -1;
- }
-}
-
-#define USE_FROM
-
-static void
-folder_scan_step(struct _header_scan_state *s, char **databuffer, int *datalength)
-{
- struct _header_scan_stack *h, *hb;
- const char *content;
- const char *bound;
- int type;
- int state;
- struct _header_content_type *ct = NULL;
- struct _header_scan_filter *f;
- size_t presize;
-
-/* printf("\nSCAN PASS: state = %d '%s'\n", s->state, states[s->state]);*/
-
-tail_recurse:
- d({
- printf("\nSCAN STACK:\n");
- printf(" '%s' :\n", states[s->state]);
- hb = s->parts;
- while (hb) {
- printf(" '%s' : %s\n", states[hb->savestate], hb->boundary);
- hb = hb->parent;
- }
- printf("\n");
- });
-
- switch (s->state) {
-
- case HSCAN_INITIAL:
-#ifdef USE_FROM
- if (s->scan_from) {
- /* FIXME: it would be nice not to have to allocate this every pass */
- h = g_malloc0(sizeof(*h));
- h->boundary = g_strdup("From ");
- h->boundarylen = strlen(h->boundary);
- folder_push_part(s, h);
-
- h = s->parts;
- do {
- hb = folder_scan_content(s, &state, databuffer, datalength);
- } while (hb==h && *datalength>0);
-
- if (*datalength==0 && hb==h) {
- d(printf("found 'From '\n"));
- s->start_of_from = folder_tell(s);
- folder_scan_skip_line(s);
- h->savestate = HSCAN_INITIAL;
- s->state = HSCAN_FROM;
- } else {
- folder_pull_part(s);
- s->state = HSCAN_EOF;
- }
- return;
- } else {
- s->start_of_from = -1;
- }
-
-#endif
- case HSCAN_FROM:
- s->start_of_headers = folder_tell(s);
- h = folder_scan_header(s, &state);
-#ifdef USE_FROM
- if (s->scan_from)
- h->savestate = HSCAN_FROM_END;
- else
-#endif
- h->savestate = HSCAN_EOF;
-
- /* FIXME: should this check for MIME-Version: 1.0 as well? */
-
- type = HSCAN_HEADER;
- if ( (content = header_raw_find(&h->headers, "Content-Type", NULL))
- && (ct = header_content_type_decode(content))) {
- if (!strcasecmp(ct->type, "multipart")) {
- bound = header_content_type_param(ct, "boundary");
- if (bound) {
- d(printf("multipart, boundary = %s\n", bound));
- h->boundarylen = strlen(bound)+2;
- h->boundary = g_malloc(h->boundarylen+3);
- sprintf(h->boundary, "--%s--", bound);
- type = HSCAN_MULTIPART;
- } else {
- header_content_type_unref(ct);
- ct = header_content_type_decode("text/plain");
-/* We can't quite do this, as it will mess up all the offsets ... */
-/* header_raw_replace(&h->headers, "Content-Type", "text/plain", offset);*/
- g_warning("Multipart with no boundary, treating as text/plain");
- }
- } else if (!strcasecmp(ct->type, "message")) {
- if (!strcasecmp(ct->subtype, "rfc822")
- /*|| !strcasecmp(ct->subtype, "partial")*/) {
- type = HSCAN_MESSAGE;
- }
- }
- }
- h->content_type = ct;
- folder_push_part(s, h);
- s->state = type;
- return;
-
- case HSCAN_HEADER:
- s->state = HSCAN_BODY;
-
- case HSCAN_BODY:
- h = s->parts;
- *datalength = 0;
- presize = SCAN_HEAD;
- f = s->filters;
-
- do {
- hb = folder_scan_content(s, &state, databuffer, datalength);
- if (*datalength>0) {
- d(printf("Content raw: '%.*s'\n", *datalength, *databuffer));
-
- while (f) {
- camel_mime_filter_filter(f->filter, *databuffer, *datalength, presize,
- databuffer, datalength, &presize);
- f = f->next;
- }
- return;
- }
- } while (hb==h && *datalength>0);
-
- /* check for any filter completion data */
- while (f) {
- camel_mime_filter_filter(f->filter, *databuffer, *datalength, presize,
- databuffer, datalength, &presize);
- f = f->next;
- }
- if (*datalength > 0)
- return;
-
- s->state = HSCAN_BODY_END;
- break;
-
- case HSCAN_MULTIPART:
- h = s->parts;
- do {
- do {
- hb = folder_scan_content(s, &state, databuffer, datalength);
- if (*datalength>0) {
- /* FIXME: needs a state to return this shit??? */
- d(printf("Multipart Content: '%.*s'\n", *datalength, *databuffer));
- }
- } while (hb==h && *datalength>0);
- if (*datalength==0 && hb==h) {
- d(printf("got boundary: %s\n", hb->boundary));
- folder_scan_skip_line(s);
- if (!state) {
- s->state = HSCAN_FROM;
- folder_scan_step(s, databuffer, datalength);
- s->parts->savestate = HSCAN_MULTIPART; /* set return state for the new head part */
- return;
- }
- } else {
- break;
- }
- } while (1);
-
- s->state = HSCAN_MULTIPART_END;
- break;
-
- case HSCAN_MESSAGE:
- s->state = HSCAN_FROM;
- folder_scan_step(s, databuffer, datalength);
- s->parts->savestate = HSCAN_MESSAGE_END;
- break;
-
- case HSCAN_FROM_END:
- case HSCAN_BODY_END:
- case HSCAN_MULTIPART_END:
- case HSCAN_MESSAGE_END:
- s->state = s->parts->savestate;
- folder_pull_part(s);
- if (s->state & HSCAN_END)
- return;
- goto tail_recurse;
-
- case HSCAN_EOF:
- return;
-
- default:
- g_warning("Invalid state in camel-mime-parser: %d", s->state);
- break;
- }
-
- return;
-}
-
-/* drops the current state back one */
-static void
-folder_scan_drop_step(struct _header_scan_state *s)
-{
- switch (s->state) {
- case HSCAN_INITIAL:
- case HSCAN_EOF:
- return;
-
- case HSCAN_FROM:
- s->state = HSCAN_INITIAL;
- folder_pull_part(s);
- return;
-
- case HSCAN_MESSAGE:
- case HSCAN_HEADER:
- case HSCAN_MULTIPART:
-
- case HSCAN_FROM_END:
- case HSCAN_BODY_END:
- case HSCAN_MULTIPART_END:
- case HSCAN_MESSAGE_END:
-
- s->state = s->parts->savestate;
- folder_pull_part(s);
- if (s->state & HSCAN_END) {
- s->state &= ~HSCAN_END;
- }
- return;
- }
-}
-
-#ifdef STANDALONE
-int main(int argc, char **argv)
-{
- int fd;
- struct _header_scan_state *s;
- char *data;
- int len;
- int state;
- char *name = "/tmp/evmail/Inbox";
- struct _header_scan_stack *h;
- int i;
- int attach = 0;
-
- if (argc==2)
- name = argv[1];
-
- printf("opening: %s", name);
-
- for (i=1;i<argc;i++) {
- const char *encoding = NULL, *charset = NULL;
- char *attachname;
-
- name = argv[i];
- printf("opening: %s", name);
-
- fd = open(name, O_RDONLY);
- if (fd==-1) {
- perror("Cannot open mailbox");
- exit(1);
- }
- s = folder_scan_init(fd);
- s->scan_from = FALSE;
-#if 0
- h = g_malloc0(sizeof(*h));
- h->savestate = HSCAN_EOF;
- folder_push_part(s, h);
-#endif
- while (s->state != HSCAN_EOF) {
- folder_scan_step(s, &data, &len);
- printf("\n -- PARSER STEP RETURN -- %d '%s'\n\n", s->state, states[s->state]);
- switch (s->state) {
- case HSCAN_HEADER:
- if (s->parts->content_type
- && (charset = header_content_type_param(s->parts->content_type, "charset"))) {
- if (strcasecmp(charset, "us-ascii")) {
- folder_push_filter_charset(s, "UTF-8", charset);
- } else {
- charset = NULL;
- }
- } else {
- charset = NULL;
- }
-
- encoding = header_raw_find(&s->parts->headers, "Content-transfer-encoding");
- printf("encoding = '%s'\n", encoding);
- if (encoding && !strncasecmp(encoding, " base64", 7)) {
- printf("adding base64 filter\n");
- attachname = g_strdup_printf("attach.%d.%d", i, attach++);
- folder_push_filter_save(s, attachname);
- g_free(attachname);
- folder_push_filter_mime(s, 0);
- }
- if (encoding && !strncasecmp(encoding, " quoted-printable", 17)) {
- printf("adding quoted-printable filter\n");
- attachname = g_strdup_printf("attach.%d.%d", i, attach++);
- folder_push_filter_save(s, attachname);
- g_free(attachname);
- folder_push_filter_mime(s, 1);
- }
-
- break;
- case HSCAN_BODY:
- break;
- case HSCAN_BODY_END:
- if (encoding && !strncasecmp(encoding, " base64", 7)) {
- printf("removing filters\n");
- folder_filter_pull(s);
- folder_filter_pull(s);
- }
- if (encoding && !strncasecmp(encoding, " quoted-printable", 17)) {
- printf("removing filters\n");
- folder_filter_pull(s);
- folder_filter_pull(s);
- }
- if (charset) {
- folder_filter_pull(s);
- charset = NULL;
- }
- encoding = NULL;
- break;
- default:
- break;
- }
- }
- folder_scan_close(s);
- close(fd);
- }
- return 0;
-}
-
-#endif /* STANDALONE */
-
diff --git a/camel/camel-mime-parser.h b/camel/camel-mime-parser.h
deleted file mode 100644
index 2283ec6f98..0000000000
--- a/camel/camel-mime-parser.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _CAMEL_MIME_PARSER_H
-#define _CAMEL_MIME_PARSER_H
-
-#include <camel/camel-object.h>
-
-#include <camel/camel-mime-utils.h>
-#include <camel/camel-mime-filter.h>
-#include <camel/camel-stream.h>
-
-#define CAMEL_MIME_PARSER(obj) GTK_CHECK_CAST (obj, camel_mime_parser_get_type (), CamelMimeParser)
-#define CAMEL_MIME_PARSER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_parser_get_type (), CamelMimeParserClass)
-#define IS_CAMEL_MIME_PARSER(obj) GTK_CHECK_TYPE (obj, camel_mime_parser_get_type ())
-
-typedef struct _CamelMimeParserClass CamelMimeParserClass;
-
-/* NOTE: if you add more states, you may need to bump the
- start of the END tags to 16 or 32, etc - so they are
- the same as the matching start tag, with a bit difference */
-enum _header_state {
- HSCAN_INITIAL,
- HSCAN_FROM, /* got 'From' line */
- HSCAN_HEADER, /* toplevel header */
- HSCAN_BODY, /* scanning body of message */
- HSCAN_MULTIPART, /* got multipart header */
- HSCAN_MESSAGE, /* rfc822 message */
-
- HSCAN_PART, /* part of a multipart */
-
- HSCAN_END = 8, /* bit mask for 'end' flags */
-
- HSCAN_EOF = 8, /* end of file */
- HSCAN_FROM_END, /* end of whole from bracket */
- HSCAN_HEADER_END, /* dummy value */
- HSCAN_BODY_END, /* end of message */
- HSCAN_MULTIPART_END, /* end of multipart */
- HSCAN_MESSAGE_END, /* end of message */
-
-};
-
-struct _CamelMimeParser {
- CamelObject parent;
-
- struct _CamelMimeParserPrivate *priv;
-};
-
-struct _CamelMimeParserClass {
- CamelObjectClass parent_class;
-
- void (*message)(CamelMimeParser *, void *headers);
- void (*part)(CamelMimeParser *);
- void (*content)(CamelMimeParser *);
-};
-
-guint camel_mime_parser_get_type (void);
-CamelMimeParser *camel_mime_parser_new (void);
-
-/* using an fd will be a little faster, but not much (over a simple stream) */
-int camel_mime_parser_init_with_fd(CamelMimeParser *, int fd);
-int camel_mime_parser_init_with_stream(CamelMimeParser *m, CamelStream *stream);
-
-/* get the stream or fd back of the parser */
-CamelStream *camel_mime_parser_stream(CamelMimeParser *m);
-int camel_mime_parser_fd(CamelMimeParser *m);
-
-/* scan 'From' separators? */
-void camel_mime_parser_scan_from(CamelMimeParser *, int);
-
-/* what headers to save, MUST include ^Content-Type: */
-int camel_mime_parser_set_header_regex(CamelMimeParser *m, char *matchstr);
-
-/* normal interface */
-enum _header_state camel_mime_parser_step(CamelMimeParser *, char **, int *);
-void camel_mime_parser_unstep(CamelMimeParser *);
-void camel_mime_parser_drop_step(CamelMimeParser *m);
-enum _header_state camel_mime_parser_state(CamelMimeParser *);
-
-/* get content type for the current part/header */
-struct _header_content_type *camel_mime_parser_content_type(CamelMimeParser *);
-
-/* get/change raw header by name */
-const char *camel_mime_parser_header(CamelMimeParser *, const char *, int *offset);
-
-/* get all raw headers. READ ONLY! */
-struct _header_raw *camel_mime_parser_headers_raw(CamelMimeParser *);
-
-/* add a processing filter for body contents */
-int camel_mime_parser_filter_add(CamelMimeParser *, CamelMimeFilter *);
-void camel_mime_parser_filter_remove(CamelMimeParser *, int);
-
-/* these should be used with caution, because the state will not
- track the seeked position */
-/* FIXME: something to bootstrap the state? */
-off_t camel_mime_parser_tell(CamelMimeParser *);
-off_t camel_mime_parser_seek(CamelMimeParser *, off_t, int);
-
-off_t camel_mime_parser_tell_start_headers(CamelMimeParser *);
-off_t camel_mime_parser_tell_start_from(CamelMimeParser *);
-
-#endif /* ! _CAMEL_MIME_PARSER_H */
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
deleted file mode 100644
index e361335392..0000000000
--- a/camel/camel-mime-part-utils.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camel-mime-part-utils : Utility for mime parsing and so on
- *
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include <string.h>
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include "camel-mime-part-utils.h"
-#include "camel-mime-message.h"
-#include "camel-multipart.h"
-#include "camel-seekable-substream.h"
-#include "camel-stream-filter.h"
-#include "camel-stream-mem.h"
-#include "camel-mime-filter-basic.h"
-#include "camel-mime-filter-charset.h"
-
-#define d(x)
-
-/* simple data wrapper */
-static void
-simple_data_wrapper_construct_from_parser(CamelDataWrapper *dw, CamelMimeParser *mp)
-{
- GByteArray *buffer;
- char *buf;
- int len;
- off_t start, end; /* ignore the start may be used unitialised warning */
- CamelMimeFilter *fdec = NULL, *fch = NULL;
- struct _header_content_type *ct;
- int decid=-1, chrid=-1, cache=TRUE;
- CamelStream *source;
- CamelSeekableStream *seekable_source; /* and ignore the warning about this one too. */
- char *encoding;
-
- d(printf("constructing data-wrapper\n"));
-
- /* Ok, try and be smart. If we're storing a small message (typical) convert it,
- and store it in memory as we parse it ... if not, throw away the conversion
- and scan till the end ... */
-
- /* if we can't seek, dont have a stream/etc, then we must cache it */
- source = camel_mime_parser_stream(mp);
- if (source) {
- gtk_object_ref((GtkObject *)source);
- if (CAMEL_IS_SEEKABLE_STREAM (source)) {
- seekable_source = CAMEL_SEEKABLE_STREAM (source);
- cache = FALSE;
- }
- }
-
- /* first, work out conversion, if any, required, we dont care about what we dont know about */
- encoding = header_content_encoding_decode(camel_mime_parser_header(mp, "content-transfer-encoding", NULL));
- if (encoding) {
- if (!strcasecmp(encoding, "base64")) {
- d(printf("Adding base64 decoder ...\n"));
- fdec = (CamelMimeFilter *)camel_mime_filter_basic_new_type(CAMEL_MIME_FILTER_BASIC_BASE64_DEC);
- decid = camel_mime_parser_filter_add(mp, fdec);
- } else if (!strcasecmp(encoding, "quoted-printable")) {
- d(printf("Adding quoted-printable decoder ...\n"));
- fdec = (CamelMimeFilter *)camel_mime_filter_basic_new_type(CAMEL_MIME_FILTER_BASIC_QP_DEC);
- decid = camel_mime_parser_filter_add(mp, fdec);
- }
- g_free(encoding);
- }
-
- /* if we're doing text, then see if we have to convert it to UTF8 as well */
- ct = camel_mime_parser_content_type(mp);
- if (header_content_type_is(ct, "text", "*")) {
- const char *charset = header_content_type_param(ct, "charset");
- if (charset!=NULL
- && !(strcasecmp(charset, "us-ascii")==0
- || strcasecmp(charset, "utf-8")==0)) {
- d(printf("Adding conversion filter from %s to utf-8\n", charset));
- fch = (CamelMimeFilter *)camel_mime_filter_charset_new_convert(charset, "utf-8");
- if (fch) {
- chrid = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)fch);
- } else {
- g_warning("Cannot convert '%s' to 'utf-8', message display may be corrupt", charset);
- }
- }
-
- }
-
- buffer = g_byte_array_new();
-
- if (!cache) {
- start = camel_mime_parser_tell(mp) + seekable_source->bound_start;
- }
- while ( camel_mime_parser_step(mp, &buf, &len) != HSCAN_BODY_END ) {
- if (buffer) {
- if (buffer->len > 20480 && !cache) {
- /* is this a 'big' message? Yes? We dont want to convert it all then.*/
- camel_mime_parser_filter_remove(mp, decid);
- camel_mime_parser_filter_remove(mp, chrid);
- decid = -1;
- chrid = -1;
- g_byte_array_free(buffer, TRUE);
- buffer = NULL;
- } else {
- g_byte_array_append(buffer, buf, len);
- }
- }
- }
-
- if (buffer) {
- CamelStream *mem;
- d(printf("Small message part, kept in memory!\n"));
- mem = camel_stream_mem_new_with_byte_array(buffer);
- camel_data_wrapper_construct_from_stream (dw, mem);
- gtk_object_unref ((GtkObject *)mem);
- } else {
- CamelStream *sub;
- CamelStreamFilter *filter;
-
- d(printf("Big message part, left on disk ...\n"));
-
- end = camel_mime_parser_tell(mp) + seekable_source->bound_start;
- sub = camel_seekable_substream_new_with_seekable_stream_and_bounds (seekable_source, start, end);
- if (fdec || fch) {
- filter = camel_stream_filter_new_with_stream(sub);
- if (fdec) {
- camel_mime_filter_reset(fdec);
- camel_stream_filter_add(filter, fdec);
- }
- if (fch) {
- camel_mime_filter_reset(fch);
- camel_stream_filter_add(filter, fch);
- }
- camel_data_wrapper_construct_from_stream (dw, (CamelStream *)filter);
- gtk_object_unref ((GtkObject *)filter);
- } else {
- camel_data_wrapper_construct_from_stream (dw, sub);
- }
- gtk_object_unref ((GtkObject *)sub);
- }
-
- camel_mime_parser_filter_remove(mp, decid);
- camel_mime_parser_filter_remove(mp, chrid);
-
- if (fdec)
- gtk_object_unref((GtkObject *)fdec);
- if (fch)
- gtk_object_unref((GtkObject *)fch);
- if (source)
- gtk_object_unref((GtkObject *)source);
-
-}
-
-/* This replaces the data wrapper repository ... and/or could be replaced by it? */
-void
-camel_mime_part_construct_content_from_parser(CamelMimePart *dw, CamelMimeParser *mp)
-{
- CamelDataWrapper *content = NULL;
- char *buf;
- int len;
-
- switch (camel_mime_parser_state(mp)) {
- case HSCAN_HEADER:
- d(printf("Creating body part\n"));
- content = camel_simple_data_wrapper_new();
- simple_data_wrapper_construct_from_parser(content, mp);
- break;
- case HSCAN_MESSAGE:
- d(printf("Creating message part\n"));
- content = (CamelDataWrapper *)camel_mime_message_new();
- camel_mime_part_construct_from_parser((CamelMimePart *)content, mp);
- break;
- case HSCAN_MULTIPART: {
- CamelDataWrapper *bodypart;
-
-#warning This should use a camel-mime-multipart
- d(printf("Creating multi-part\n"));
- content = (CamelDataWrapper *)camel_multipart_new();
-
- /* get/set boundary? */
-
- while (camel_mime_parser_step(mp, &buf, &len) != HSCAN_MULTIPART_END) {
- camel_mime_parser_unstep(mp);
- bodypart = (CamelDataWrapper *)camel_mime_part_new();
- camel_mime_part_construct_from_parser((CamelMimePart *)bodypart, mp);
- camel_multipart_add_part((CamelMultipart *)content, (CamelMimePart *)bodypart);
- gtk_object_unref ((GtkObject *)bodypart);
- }
-
- d(printf("Created multi-part\n"));
- break; }
- default:
- g_warning("Invalid state encountered???: %d", camel_mime_parser_state(mp));
- }
- if (content) {
-#warning there just has got to be a better way ... to transfer the mime-type to the datawrapper
- /* would you believe you have to set this BEFORE you set the content object??? oh my god !!!! */
- camel_data_wrapper_set_mime_type_field (content,
- camel_mime_part_get_content_type ((CamelMimePart *)dw));
- camel_medium_set_content_object((CamelMedium *)dw, content);
- gtk_object_unref ((GtkObject *)content);
- }
-}
-
diff --git a/camel/camel-mime-part-utils.h b/camel/camel-mime-part-utils.h
deleted file mode 100644
index 1e1c3655aa..0000000000
--- a/camel/camel-mime-part-utils.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mime-part-utils : Utility for mime parsing and so on */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef CAMEL_MIME_PART_UTILS_H
-#define CAMEL_MIME_PART_UTILS_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-mime-part.h>
-
-void camel_mime_part_construct_content_from_parser(CamelMimePart *, CamelMimeParser *mp);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MIME_PART_UTILS_H */
-
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
deleted file mode 100644
index d727c98811..0000000000
--- a/camel/camel-mime-part.c
+++ /dev/null
@@ -1,705 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camelMimePart.c : Abstract class for a mime_part */
-
-/*
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include <string.h>
-#include "camel-mime-part.h"
-#include <stdio.h>
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include "hash-table-utils.h"
-#include "camel-mime-part-utils.h"
-#include <ctype.h>
-#include "camel-mime-parser.h"
-#include "camel-stream-mem.h"
-#include "camel-stream-filter.h"
-#include "camel-mime-filter-basic.h"
-#include "camel-exception.h"
-
-#define d(x)
-
-typedef enum {
- HEADER_UNKNOWN,
- HEADER_DESCRIPTION,
- HEADER_DISPOSITION,
- HEADER_CONTENT_ID,
- HEADER_ENCODING,
- HEADER_CONTENT_MD5,
- HEADER_CONTENT_LANGUAGES,
- HEADER_CONTENT_TYPE
-} CamelHeaderType;
-
-
-static GHashTable *header_name_table;
-
-
-static CamelMediumClass *parent_class=NULL;
-
-/* Returns the class for a CamelMimePart */
-#define CMP_CLASS(so) CAMEL_MIME_PART_CLASS (GTK_OBJECT(so)->klass)
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass)
-#define CMD_CLASS(so) CAMEL_MEDIUM_CLASS (GTK_OBJECT(so)->klass)
-
-/* from GtkObject */
-static void finalize (GtkObject *object);
-
-/* from CamelDataWrapper */
-static int write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static int construct_from_stream (CamelDataWrapper *dw, CamelStream *s);
-
-/* from CamelMedia */
-static void add_header (CamelMedium *medium, const char *header_name, const void *header_value);
-static void set_header (CamelMedium *medium, const char *header_name, const void *header_value);
-static void remove_header (CamelMedium *medium, const char *header_name);
-static const void *get_header (CamelMedium *medium, const char *header_name);
-
-static void set_content_object (CamelMedium *medium, CamelDataWrapper *content);
-
-/* from camel mime parser */
-static int construct_from_parser (CamelMimePart *, CamelMimeParser *);
-
-/* forward references */
-static void set_disposition (CamelMimePart *mime_part, const gchar *disposition);
-
-
-/* loads in a hash table the set of header names we */
-/* recognize and associate them with a unique enum */
-/* identifier (see CamelHeaderType above) */
-static void
-init_header_name_table()
-{
- header_name_table = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- g_hash_table_insert (header_name_table, "Content-Description", (gpointer)HEADER_DESCRIPTION);
- g_hash_table_insert (header_name_table, "Content-Disposition", (gpointer)HEADER_DISPOSITION);
- g_hash_table_insert (header_name_table, "Content-id", (gpointer)HEADER_CONTENT_ID);
- g_hash_table_insert (header_name_table, "Content-Transfer-Encoding", (gpointer)HEADER_ENCODING);
- g_hash_table_insert (header_name_table, "Content-MD5", (gpointer)HEADER_CONTENT_MD5);
- g_hash_table_insert (header_name_table, "Content-Type", (gpointer)HEADER_CONTENT_TYPE);
-
-}
-
-static void
-camel_mime_part_class_init (CamelMimePartClass *camel_mime_part_class)
-{
- CamelMediumClass *camel_medium_class = CAMEL_MEDIUM_CLASS (camel_mime_part_class);
- CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_mime_part_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_data_wrapper_class);
-
- parent_class = gtk_type_class (camel_medium_get_type ());
- init_header_name_table();
-
- camel_mime_part_class->construct_from_parser = construct_from_parser;
-
- /* virtual method overload */
- camel_medium_class->add_header = add_header;
- camel_medium_class->set_header = set_header;
- camel_medium_class->get_header = get_header;
- camel_medium_class->remove_header = remove_header;
- camel_medium_class->set_content_object = set_content_object;
-
- camel_data_wrapper_class->write_to_stream = write_to_stream;
- camel_data_wrapper_class->construct_from_stream= construct_from_stream;
-
- gtk_object_class->finalize = finalize;
-}
-
-static void
-camel_mime_part_init (gpointer object, gpointer klass)
-{
- CamelMimePart *camel_mime_part = CAMEL_MIME_PART (object);
-
- camel_mime_part->content_type = gmime_content_field_new ("text", "plain");
- camel_mime_part->description = NULL;
- camel_mime_part->disposition = NULL;
- camel_mime_part->content_id = NULL;
- camel_mime_part->content_MD5 = NULL;
- camel_mime_part->content_languages = NULL;
- camel_mime_part->encoding = CAMEL_MIME_PART_ENCODING_DEFAULT;
-
- camel_mime_part->temp_message_buffer = NULL;
- camel_mime_part->content_input_stream = NULL;
-}
-
-
-
-
-GtkType
-camel_mime_part_get_type (void)
-{
- static GtkType camel_mime_part_type = 0;
-
- if (!camel_mime_part_type) {
- GtkTypeInfo camel_mime_part_info =
- {
- "CamelMimePart",
- sizeof (CamelMimePart),
- sizeof (CamelMimePartClass),
- (GtkClassInitFunc) camel_mime_part_class_init,
- (GtkObjectInitFunc) camel_mime_part_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mime_part_type = gtk_type_unique (camel_medium_get_type (), &camel_mime_part_info);
- }
-
- return camel_mime_part_type;
-}
-
-
-static void
-finalize (GtkObject *object)
-{
- CamelMimePart *mime_part = CAMEL_MIME_PART (object);
-
- g_free (mime_part->description);
- g_free (mime_part->content_id);
- g_free (mime_part->content_MD5);
- string_list_free (mime_part->content_languages);
- header_disposition_unref(mime_part->disposition);
-
- if (mime_part->content_type) gmime_content_field_unref (mime_part->content_type);
- if (mime_part->temp_message_buffer) g_byte_array_free (mime_part->temp_message_buffer, TRUE);
-
- if (mime_part->content_input_stream) gtk_object_unref (GTK_OBJECT (mime_part->content_input_stream));
-
- header_raw_clear(&mime_part->headers);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/* **** */
-
-static gboolean
-process_header(CamelMedium *medium, const char *header_name, const char *header_value)
-{
- CamelMimePart *mime_part = CAMEL_MIME_PART (medium);
- CamelHeaderType header_type;
- char *text;
-
- /* Try to parse the header pair. If it corresponds to something */
- /* known, the job is done in the parsing routine. If not, */
- /* we simply add the header in a raw fashion */
-
- /* FIXMME: MUST check fields for validity before adding them! */
-
- header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, header_name);
- switch (header_type) {
- case HEADER_DESCRIPTION: /* raw header->utf8 conversion */
- text = header_decode_string(header_value);
- g_free(mime_part->description);
- mime_part->description = text;
- break;
- case HEADER_DISPOSITION:
- set_disposition (mime_part, header_value);
- break;
- case HEADER_CONTENT_ID:
- text = header_msgid_decode(header_value);
- g_free(mime_part->content_id);
- mime_part->content_id = text;
- break;
- case HEADER_ENCODING:
- text = header_token_decode(header_value);
- mime_part->encoding = camel_mime_part_encoding_from_string (text);
- g_free(text);
- break;
- case HEADER_CONTENT_MD5:
- g_free(mime_part->content_MD5);
- mime_part->content_MD5 = g_strdup(header_value);
- break;
- case HEADER_CONTENT_TYPE:
- gmime_content_field_construct_from_string (mime_part->content_type, header_value);
- break;
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-
-static void
-set_header (CamelMedium *medium, const char *header_name, const void *header_value)
-{
- CamelMimePart *part = (CamelMimePart *)medium;
-
- process_header(medium, header_name, header_value);
- header_raw_replace(&part->headers, header_name, header_value, -1);
-}
-
-static void
-add_header (CamelMedium *medium, const char *header_name, const void *header_value)
-{
- CamelMimePart *part = (CamelMimePart *)medium;
-
- /* Try to parse the header pair. If it corresponds to something */
- /* known, the job is done in the parsing routine. If not, */
- /* we simply add the header in a raw fashion */
-
- /* FIXMME: MUST check fields for validity before adding them! */
-
- /* If it was one of the headers we handled, it must be unique, set it instead of add */
- if (process_header(medium, header_name, header_value))
- header_raw_replace(&part->headers, header_name, header_value, -1);
- else
- header_raw_append(&part->headers, header_name, header_value, -1);
-}
-
-static void
-remove_header (CamelMedium *medium, const char *header_name)
-{
- CamelMimePart *part = (CamelMimePart *)medium;
-
- process_header(medium, header_name, NULL);
- header_raw_remove(&part->headers, header_name);
-}
-
-static const void *
-get_header (CamelMedium *medium, const char *header_name)
-{
- CamelMimePart *part = (CamelMimePart *)medium;
-
- return header_raw_find(&part->headers, header_name, NULL);
-}
-
-
-/* **** Content-Description */
-void
-camel_mime_part_set_description (CamelMimePart *mime_part, const gchar *description)
-{
- camel_medium_set_header (CAMEL_MEDIUM (mime_part),
- "Content-Description", description);
-}
-
-const gchar *
-camel_mime_part_get_description (CamelMimePart *mime_part)
-{
- return mime_part->description;
-}
-
-/* **** Content-Disposition */
-
-static void
-set_disposition (CamelMimePart *mime_part, const gchar *disposition)
-{
- header_disposition_unref(mime_part->disposition);
- if (disposition)
- mime_part->disposition = header_disposition_decode(disposition);
- else
- mime_part->disposition = NULL;
-}
-
-
-void
-camel_mime_part_set_disposition (CamelMimePart *mime_part, const gchar *disposition)
-{
- char *text;
-
- /* we poke in a new disposition (so we dont lose 'filename', etc) */
- if (mime_part->disposition == NULL) {
- set_disposition(mime_part, disposition);
- }
- if (mime_part->disposition != NULL) {
- g_free(mime_part->disposition->disposition);
- mime_part->disposition->disposition = g_strdup(disposition);
- }
- text = header_disposition_format(mime_part->disposition);
-
- camel_medium_set_header (CAMEL_MEDIUM (mime_part),
- "Content-Description", text);
-
- g_free(text);
-}
-
-const gchar *
-camel_mime_part_get_disposition (CamelMimePart *mime_part)
-{
- if (mime_part->disposition)
- return (mime_part->disposition)->disposition;
- else
- return NULL;
-}
-
-
-/* **** Content-Disposition: filename="xxx" */
-
-void
-camel_mime_part_set_filename (CamelMimePart *mime_part, gchar *filename)
-{
- char *str;
- if (mime_part->disposition == NULL)
- mime_part->disposition = header_disposition_decode("attachment");
-
- header_set_param(&mime_part->disposition->params, "filename", filename);
- str = header_disposition_format(mime_part->disposition);
-
- camel_medium_set_header (CAMEL_MEDIUM (mime_part),
- "Content-Disposition", str);
- g_free(str);
-}
-
-const gchar *
-camel_mime_part_get_filename (CamelMimePart *mime_part)
-{
- if (mime_part->disposition)
- return header_param(mime_part->disposition->params, "filename");
- return NULL;
-}
-
-
-/* **** Content-ID: */
-
-void
-camel_mime_part_set_content_id (CamelMimePart *mime_part, const char *contentid)
-{
- camel_medium_set_header (CAMEL_MEDIUM (mime_part), "Content-ID",
- contentid);
-}
-
-const gchar *
-camel_mime_part_get_content_id (CamelMimePart *mime_part)
-{
- return mime_part->content_id;
-}
-
-/* **** Content-MD5: */
-
-void
-camel_mime_part_set_content_MD5 (CamelMimePart *mime_part, const char *md5)
-{
- camel_medium_set_header (CAMEL_MEDIUM (mime_part), "Content-MD5", md5);
-}
-
-const gchar *
-camel_mime_part_get_content_MD5 (CamelMimePart *mime_part)
-{
- return mime_part->content_MD5;
-}
-
-/* **** Content-Transfer-Encoding: */
-
-void
-camel_mime_part_set_encoding (CamelMimePart *mime_part,
- CamelMimePartEncodingType encoding)
-{
- const char *text;
-
- text = camel_mime_part_encoding_to_string (encoding);
- camel_medium_set_header (CAMEL_MEDIUM (mime_part),
- "Content-Transfer-Encoding", text);
-}
-
-const CamelMimePartEncodingType
-camel_mime_part_get_encoding (CamelMimePart *mime_part)
-{
- return mime_part->encoding;
-}
-
-/* FIXME: do something with this stuff ... */
-
-void
-camel_mime_part_set_content_languages (CamelMimePart *mime_part, GList *content_languages)
-{
- if (mime_part->content_languages) string_list_free (mime_part->content_languages);
- mime_part->content_languages = content_languages;
-
- /* FIXME: translate to a header and set it */
-}
-
-const GList *
-camel_mime_part_get_content_languages (CamelMimePart *mime_part)
-{
- return mime_part->content_languages;
-}
-
-
-/* **** */
-
-/* **** Content-Type: */
-
-void
-camel_mime_part_set_content_type (CamelMimePart *mime_part, gchar *content_type)
-{
- camel_medium_set_header (CAMEL_MEDIUM (mime_part),
- "Content-Type", content_type);
-}
-
-GMimeContentField *
-camel_mime_part_get_content_type (CamelMimePart *mime_part)
-{
- return mime_part->content_type;
-}
-
-/*********/
-
-
-
-static void
-set_content_object (CamelMedium *medium, CamelDataWrapper *content)
-{
- CamelMimePart *mime_part = CAMEL_MIME_PART (medium);
- GMimeContentField *object_content_field;
-
- parent_class->set_content_object (medium, content);
-
- object_content_field = camel_data_wrapper_get_mime_type_field (content);
- if (mime_part->content_type &&
- (mime_part->content_type != object_content_field)) {
- char *txt;
-
- txt = header_content_type_format(object_content_field?object_content_field->content_type:NULL);
- camel_medium_set_header (CAMEL_MEDIUM (mime_part),
- "Content-Type", txt);
- }
-}
-
-/**********************************************************************/
-
-static int
-write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelMimePart *mp = CAMEL_MIME_PART (data_wrapper);
- CamelMedium *medium = CAMEL_MEDIUM (data_wrapper);
- CamelDataWrapper *content;
- int total = 0;
- int count;
-
- d(printf("mime_part::write_to_stream\n"));
-
- /* FIXME: something needs to be done about this ... */
- /* FIXME: need to count these bytes too */
-#warning content-languages should be stored as a header
-
- if (mp->headers) {
- struct _header_raw *h = mp->headers;
- while (h) {
- count = camel_stream_printf(stream, "%s%s%s\n", h->name, isspace(h->value[0]) ? ":" : ": ", h->value);
- if (count == -1)
- return -1;
- total += count;
- h = h->next;
- }
- }
-
- count = camel_stream_write (stream, "\n", 1);
- if (count == -1)
- return -1;
- total += count;
-
- content = camel_medium_get_content_object (medium);
- if (content) {
- /* I dont really like this here, but i dont know where else it might go ... */
-#define CAN_THIS_GO_ELSEWHERE
-#ifdef CAN_THIS_GO_ELSEWHERE
- CamelMimeFilter *filter = NULL;
- CamelStreamFilter *filter_stream = NULL;
-
- switch(mp->encoding) {
- case CAMEL_MIME_PART_ENCODING_BASE64:
- filter = (CamelMimeFilter *)camel_mime_filter_basic_new_type(CAMEL_MIME_FILTER_BASIC_BASE64_ENC);
- break;
- case CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE:
- filter = (CamelMimeFilter *)camel_mime_filter_basic_new_type(CAMEL_MIME_FILTER_BASIC_QP_ENC);
- break;
- default:
- break;
- }
- if (filter) {
- filter_stream = camel_stream_filter_new_with_stream(stream);
- camel_stream_filter_add(filter_stream, filter);
- gtk_object_unref((GtkObject *)filter);
- stream = (CamelStream *)filter_stream;
- }
-
-#endif
- count = camel_data_wrapper_write_to_stream (content, stream);
- if (filter_stream)
- gtk_object_unref((GtkObject *)filter_stream);
- if (count == -1)
- return -1;
- total += count;
- } else {
- g_warning("No content for medium, nothing to write");
- }
- return total;
-}
-
-/* mime_part */
-static int
-construct_from_parser(CamelMimePart *dw, CamelMimeParser *mp)
-{
- struct _header_raw *headers;
- char *buf;
- int len;
-
- d(printf("mime_part::construct_from_parser()\n"));
-
- switch (camel_mime_parser_step(mp, &buf, &len)) {
- case HSCAN_HEADER:
- case HSCAN_MESSAGE:
- case HSCAN_MULTIPART:
- /* we have the headers, build them into 'us' */
- headers = camel_mime_parser_headers_raw(mp);
- while (headers) {
- camel_medium_add_header((CamelMedium *)dw, headers->name, headers->value);
- headers = headers->next;
- }
- camel_mime_part_construct_content_from_parser(dw, mp);
- break;
- default:
- g_warning("Invalid state encountered???: %d", camel_mime_parser_state(mp));
- }
-
- d(printf("mime_part::construct_from_parser() leaving\n"));
-#warning "Need to work out how to detect a (fatally) bad parse in the parser"
- return 0;
-}
-
-/**
- * camel_mime_part_construct_from_parser:
- * @mime_part:
- * @mp:
- *
- *
- *
- * Return value:
- **/
-int
-camel_mime_part_construct_from_parser(CamelMimePart *mime_part, CamelMimeParser *mp)
-{
- return CMP_CLASS (mime_part)->construct_from_parser (mime_part, mp);
-}
-
-static int
-construct_from_stream(CamelDataWrapper *dw, CamelStream *s)
-{
- CamelMimeParser *mp;
- int ret;
-
- d(printf("mime_part::construct_from_stream()\n"));
-
- mp = camel_mime_parser_new();
- if (camel_mime_parser_init_with_stream(mp, s) == -1) {
- g_warning("Cannot create parser for stream");
- ret = -1;
- } else {
- ret = camel_mime_part_construct_from_parser((CamelMimePart *)dw, mp);
- }
- gtk_object_unref((GtkObject *)mp);
- return ret;
-}
-
-
-const gchar *
-camel_mime_part_encoding_to_string (CamelMimePartEncodingType encoding)
-{
- switch (encoding) {
- case CAMEL_MIME_PART_ENCODING_DEFAULT:
- case CAMEL_MIME_PART_ENCODING_7BIT:
- return "7bit";
- case CAMEL_MIME_PART_ENCODING_8BIT:
- return "8bit";
- case CAMEL_MIME_PART_ENCODING_BASE64:
- return "base64";
- case CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE:
- return "quoted-printable";
- default:
- break;
- }
- return "";
-}
-
-
-
-/* FIXME I am not sure this is the correct way to do this. */
-CamelMimePartEncodingType
-camel_mime_part_encoding_from_string (const gchar *string)
-{
- if (string == NULL)
- return CAMEL_MIME_PART_ENCODING_DEFAULT;
- else if (strcasecmp (string, "7bit") == 0)
- return CAMEL_MIME_PART_ENCODING_7BIT;
- else if (strcasecmp (string, "8bit") == 0)
- return CAMEL_MIME_PART_ENCODING_8BIT;
- else if (strcasecmp (string, "base64") == 0)
- return CAMEL_MIME_PART_ENCODING_BASE64;
- else if (strcasecmp (string, "quoted-printable") == 0)
- return CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE;
- else
- /* FIXME? Spit a warning? */
- return CAMEL_MIME_PART_ENCODING_DEFAULT;
-}
-
-
-/******************************/
-/** Misc utility functions **/
-
-/**
- * camel_mime_part_new:
- *
- * Return value: a new CamelMimePart
- **/
-CamelMimePart *
-camel_mime_part_new (void)
-{
- return (CamelMimePart *)gtk_object_new (CAMEL_MIME_PART_TYPE, NULL);
-}
-
-/**
- * camel_mime_part_set_content:
- * @camel_mime_part: Mime part
- * @data: data to put into the part
- * @length: length of @data
- * @type: Content-Type of the data
- *
- * Utility function used to set the content of a mime part object to
- * be the provided data. If @length is 0, this routine can be used as
- * a way to remove old content (in which case @data and @type are
- * ignored and may be %NULL).
- **/
-void
-camel_mime_part_set_content (CamelMimePart *camel_mime_part,
- const char *data, int length,
- const char *type) /* why on earth is the type last? */
-{
- CamelMedium *medium = CAMEL_MEDIUM (camel_mime_part);
-
- if (length) {
- CamelDataWrapper *dw;
- CamelStream *stream;
-
- dw = camel_data_wrapper_new ();
- camel_data_wrapper_set_mime_type (dw, type);
- stream = camel_stream_mem_new_with_buffer (data, length);
- camel_data_wrapper_construct_from_stream (dw, stream);
- gtk_object_unref (GTK_OBJECT (stream));
- camel_medium_set_content_object (medium, dw);
- gtk_object_unref (GTK_OBJECT (dw));
- } else {
- if (medium->content)
- gtk_object_unref (GTK_OBJECT (medium->content));
- medium->content = NULL;
- }
-}
diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h
deleted file mode 100644
index 9360a96848..0000000000
--- a/camel/camel-mime-part.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camel-mime-part.h : class for a mime part */
-
-/*
- *
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MIME_PART_H
-#define CAMEL_MIME_PART_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-medium.h>
-#include <camel/camel-mime-utils.h>
-#include <camel/camel-mime-parser.h>
-
-#define CAMEL_MIME_PART_TYPE (camel_mime_part_get_type ())
-#define CAMEL_MIME_PART(obj) (GTK_CHECK_CAST((obj), CAMEL_MIME_PART_TYPE, CamelMimePart))
-#define CAMEL_MIME_PART_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MIME_PART_TYPE, CamelMimePartClass))
-#define CAMEL_IS_MIME_PART(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_PART_TYPE))
-
-
-enum _CamelMimePartEncodingType {
- CAMEL_MIME_PART_ENCODING_DEFAULT,
- CAMEL_MIME_PART_ENCODING_7BIT,
- CAMEL_MIME_PART_ENCODING_8BIT,
- CAMEL_MIME_PART_ENCODING_BASE64,
- CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE,
- CAMEL_MIME_PART_NUM_ENCODINGS
-};
-typedef enum _CamelMimePartEncodingType CamelMimePartEncodingType;
-
-
-/* Do not change these values directly, you would regret it one day */
-struct _CamelMimePart
-{
- CamelMedium parent_object;
-
- /* All fields here are -** PRIVATE **- */
- gchar *description;
- CamelMimeDisposition *disposition;
- gchar *content_id;
- gchar *content_MD5;
- GList *content_languages;
- CamelMimePartEncodingType encoding;
-
- GByteArray *temp_message_buffer;
- GMimeContentField *content_type;
- CamelStream *content_input_stream;
-
- struct _header_raw *headers; /* mime headers */
-};
-
-typedef struct _CamelMimePartClass {
- CamelMediumClass parent_class;
-
- /* Virtual methods */
- int (*construct_from_parser) (CamelMimePart *, CamelMimeParser *);
-} CamelMimePartClass;
-
-/* Standard Gtk function */
-GtkType camel_mime_part_get_type (void);
-
-/* public methods */
-CamelMimePart * camel_mime_part_new (void);
-
-void camel_mime_part_set_description (CamelMimePart *mime_part, const gchar *description);
-const gchar *camel_mime_part_get_description (CamelMimePart *mime_part);
-
-void camel_mime_part_set_disposition (CamelMimePart *mime_part, const gchar *disposition);
-const gchar *camel_mime_part_get_disposition (CamelMimePart *mime_part);
-
-void camel_mime_part_set_filename (CamelMimePart *mime_part, gchar *filename);
-const gchar *camel_mime_part_get_filename (CamelMimePart *mime_part);
-
-void camel_mime_part_set_content_id (CamelMimePart *mime_part, const char *contentid);
-const gchar *camel_mime_part_get_content_id (CamelMimePart *mime_part);
-
-void camel_mime_part_set_content_MD5 (CamelMimePart *mime_part, const char *);
-const gchar *camel_mime_part_get_content_MD5 (CamelMimePart *mime_part);
-
-void camel_mime_part_set_encoding (CamelMimePart *mime_part, CamelMimePartEncodingType type);
-CamelMimePartEncodingType camel_mime_part_get_encoding (CamelMimePart *mime_part);
-
-void camel_mime_part_set_content_languages (CamelMimePart *mime_part, GList *content_languages);
-const GList *camel_mime_part_get_content_languages (CamelMimePart *mime_part);
-
-/* FIXME: what about content-type parameters? what about major/minor parts? */
-void camel_mime_part_set_content_type (CamelMimePart *mime_part, gchar *content_type);
-GMimeContentField *camel_mime_part_get_content_type (CamelMimePart *mime_part);
-
-const gchar * camel_mime_part_encoding_to_string (CamelMimePartEncodingType encoding);
-CamelMimePartEncodingType camel_mime_part_encoding_from_string (const gchar *string);
-
-/* construction */
-int camel_mime_part_construct_from_parser (CamelMimePart *, CamelMimeParser *);
-
-/* utility functions */
-void camel_mime_part_set_content (CamelMimePart *camel_mime_part,
- const char *content, int length, const char *type);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MIME_PART_H */
-
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
deleted file mode 100644
index 3a2828ff36..0000000000
--- a/camel/camel-mime-utils.c
+++ /dev/null
@@ -1,2371 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <unicode.h>
-
-#include <glib.h>
-#include <time.h>
-
-#include <ctype.h>
-#include <errno.h>
-
-#include "camel-mime-utils.h"
-
-#if 0
-int strdup_count = 0;
-int malloc_count = 0;
-int free_count = 0;
-
-#define g_strdup(x) (strdup_count++, g_strdup(x))
-#define g_malloc(x) (malloc_count++, g_malloc(x))
-#define g_free(x) (free_count++, g_free(x))
-#endif
-
-/* for all warnings ... */
-#define w(x) x
-
-#define d(x)
-#define d2(x)
-
-static char *base64_alphabet =
-"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-static unsigned char tohex[16] = {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
-};
-
-static unsigned char camel_mime_special_table[256] = {
- 5, 5, 5, 5, 5, 5, 5, 5, 5,167, 7, 5, 5, 39, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 178,128,140,128,128,128,128,128,140,140,128,128,140,128,136,132,
- 128,128,128,128,128,128,128,128,128,128,204,140,140, 4,140,132,
- 140,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
- 128,128,128,128,128,128,128,128,128,128,128,172,172,172,128,128,
- 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
- 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 5,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-};
-
-static unsigned char camel_mime_base64_rank[256] = {
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255, 62,255,255,255, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,255,255,255, 0,255,255,
- 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,255,255,255,255,255,
- 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-};
-
-/*
- if any of these change, then the tables above should be regenerated
- by compiling this with -DBUILD_TABLE, and running.
-
- gcc -o buildtable `glib-config --cflags --libs` -DBUILD_TABLE camel-mime-utils.c
- ./buildtable
-
-*/
-enum {
- IS_CTRL = 1<<0,
- IS_LWSP = 1<<1,
- IS_TSPECIAL = 1<<2,
- IS_SPECIAL = 1<<3,
- IS_SPACE = 1<<4,
- IS_DSPECIAL = 1<<5,
- IS_COLON = 1<<6, /* rather wasteful of space ... */
- IS_QPSAFE = 1<<7
-};
-
-#define is_ctrl(x) ((camel_mime_special_table[(unsigned char)(x)] & IS_CTRL) != 0)
-#define is_lwsp(x) ((camel_mime_special_table[(unsigned char)(x)] & IS_LWSP) != 0)
-#define is_tspecial(x) ((camel_mime_special_table[(unsigned char)(x)] & IS_TSPECIAL) != 0)
-#define is_type(x, t) ((camel_mime_special_table[(unsigned char)(x)] & (t)) != 0)
-#define is_ttoken(x) ((camel_mime_special_table[(unsigned char)(x)] & (IS_TSPECIAL|IS_LWSP|IS_CTRL)) == 0)
-#define is_atom(x) ((camel_mime_special_table[(unsigned char)(x)] & (IS_SPECIAL|IS_SPACE|IS_CTRL)) == 0)
-#define is_dtext(x) ((camel_mime_special_table[(unsigned char)(x)] & IS_DSPECIAL) == 0)
-#define is_fieldname(x) ((camel_mime_special_table[(unsigned char)(x)] & (IS_CTRL|IS_SPACE|IS_COLON)) == 0)
-#define is_qpsafe(x) ((camel_mime_special_table[(unsigned char)(x)] & IS_QPSAFE) != 0)
-
-/* only needs to be run to rebuild the tables above */
-#ifdef BUILD_TABLE
-
-#define CHARS_LWSP " \t\n\r"
-#define CHARS_TSPECIAL "()<>@,;:\\\"/[]?="
-#define CHARS_SPECIAL "()<>@,;:\\\".[]"
-#define CHARS_CSPECIAL "()\\\r" /* not in comments */
-#define CHARS_DSPECIAL "[]\\\r \t" /* not in domains */
-
-static void
-header_init_bits(unsigned char bit, unsigned char bitcopy, int remove, unsigned char *vals, int len)
-{
- int i;
-
- if (!remove) {
- for (i=0;i<len;i++) {
- camel_mime_special_table[vals[i]] |= bit;
- }
- if (bitcopy) {
- for (i=0;i<256;i++) {
- if (camel_mime_special_table[i] & bitcopy)
- camel_mime_special_table[i] |= bit;
- }
- }
- } else {
- for (i=0;i<256;i++)
- camel_mime_special_table[i] |= bit;
- for (i=0;i<len;i++) {
- camel_mime_special_table[vals[i]] &= ~bit;
- }
- if (bitcopy) {
- for (i=0;i<256;i++) {
- if (camel_mime_special_table[i] & bitcopy)
- camel_mime_special_table[i] &= ~bit;
- }
- }
- }
-}
-
-static void
-header_decode_init(void)
-{
- int i;
-
- for (i=0;i<256;i++) camel_mime_special_table[i] = 0;
- for (i=0;i<32;i++) camel_mime_special_table[i] |= IS_CTRL;
- camel_mime_special_table[127] = IS_CTRL;
- camel_mime_special_table[' '] = IS_SPACE;
- camel_mime_special_table[':'] = IS_COLON;
- header_init_bits(IS_LWSP, 0, 0, CHARS_LWSP, sizeof(CHARS_LWSP)-1);
- header_init_bits(IS_TSPECIAL, IS_CTRL, 0, CHARS_TSPECIAL, sizeof(CHARS_TSPECIAL)-1);
- header_init_bits(IS_SPECIAL, 0, 0, CHARS_SPECIAL, sizeof(CHARS_SPECIAL)-1);
- header_init_bits(IS_DSPECIAL, 0, FALSE, CHARS_DSPECIAL, sizeof(CHARS_DSPECIAL)-1);
- for (i=0;i<256;i++) if ((i>=33 && i<=60) || (i>=62 && i<=126) || i==32 || i==9) camel_mime_special_table[i] |= IS_QPSAFE;
-}
-
-void
-base64_init(void)
-{
- int i;
-
- memset(camel_mime_base64_rank, 0xff, sizeof(camel_mime_base64_rank));
- for (i=0;i<64;i++) {
- camel_mime_base64_rank[(unsigned int)base64_alphabet[i]] = i;
- }
- camel_mime_base64_rank['='] = 0;
-}
-
-int main(int argc, char **argv)
-{
- int i;
- void run_test(void);
-
- header_decode_init();
- base64_init();
-
- printf("static unsigned char camel_mime_special_table[256] = {\n\t");
- for (i=0;i<256;i++) {
- printf("%3d,", camel_mime_special_table[i]);
- if ((i&15) == 15) {
- printf("\n");
- if (i!=255) {
- printf("\t");
- }
- }
- }
- printf("};\n");
-
- printf("static unsigned char camel_mime_base64_rank[256] = {\n\t");
- for (i=0;i<256;i++) {
- printf("%3d,", camel_mime_base64_rank[i]);
- if ((i&15) == 15) {
- printf("\n");
- if (i!=255) {
- printf("\t");
- }
- }
- }
- printf("};\n");
-
- run_test();
-
- return 0;
-}
-
-#endif
-
-
-/* call this when finished encoding everything, to
- flush off the last little bit */
-int
-base64_encode_close(unsigned char *in, int inlen, unsigned char *out, int *state, int *save)
-{
- int c1, c2;
- unsigned char *outptr = out;
-
- if (inlen>0)
- outptr += base64_encode_step(in, inlen, outptr, state, save);
-
- c1 = ((char *)save)[1];
- c2 = ((char *)save)[2];
-
- switch (((char *)save)[0]) {
- case 2:
- outptr[2] = base64_alphabet [ ( (c2 &0x0f) << 2 ) ];
- goto skip;
- case 1:
- outptr[2] = '=';
- skip:
- outptr[0] = base64_alphabet [ c1 >> 2 ];
- outptr[1] = base64_alphabet [ c2 >> 4 | ( (c1&0x3) << 4 )];
- outptr[3] = '=';
- outptr += 4;
- break;
- }
- *outptr++ = '\n';
-
- *save = 0;
- *state = 0;
-
- return outptr-out;
-}
-
-/*
- performs an 'encode step', only encodes blocks of 3 characters to the
- output at a time, saves left-over state in state and save (initialise to
- 0 on first invocation).
-*/
-int
-base64_encode_step(unsigned char *in, int len, unsigned char *out, int *state, int *save)
-{
- register unsigned char *inptr, *outptr;
-
- if (len<=0)
- return 0;
-
- inptr = in;
- outptr = out;
-
- d(printf("we have %d chars, and %d saved chars\n", len, ((char *)save)[0]));
-
- if (len + ((char *)save)[0] > 2) {
- unsigned char *inend = in+len-2;
- register int c1, c2, c3;
- register int already;
-
- already = *state;
-
- switch (((char *)save)[0]) {
- case 1: c1 = ((char *)save)[1]; goto skip1;
- case 2: c1 = ((char *)save)[1];
- c2 = ((char *)save)[2]; goto skip2;
- }
-
- /* yes, we jump into the loop, no i'm not going to change it, its beautiful! */
- while (inptr < inend) {
- c1 = *inptr++;
- skip1:
- c2 = *inptr++;
- skip2:
- c3 = *inptr++;
- *outptr++ = base64_alphabet [ c1 >> 2 ];
- *outptr++ = base64_alphabet [ c2 >> 4 | ( (c1&0x3) << 4 ) ];
- *outptr++ = base64_alphabet [ ( (c2 &0x0f) << 2 ) | (c3 >> 6) ];
- *outptr++ = base64_alphabet [ c3 & 0x3f ];
- /* this is a bit ugly ... */
- if ((++already)>=19) {
- *outptr++='\n';
- already = 0;
- }
- }
-
- ((char *)save)[0] = 0;
- len = 2-(inptr-inend);
- *state = already;
- }
-
- d(printf("state = %d, len = %d\n",
- (int)((char *)save)[0],
- len));
-
- if (len>0) {
- register char *saveout;
-
- /* points to the slot for the next char to save */
- saveout = & (((char *)save)[1]) + ((char *)save)[0];
-
- /* len can only be 0 1 or 2 */
- switch(len) {
- case 2: *saveout++ = *inptr++;
- case 1: *saveout++ = *inptr++;
- }
- ((char *)save)[0]+=len;
- }
-
- d(printf("mode = %d\nc1 = %c\nc2 = %c\n",
- (int)((char *)save)[0],
- (int)((char *)save)[1],
- (int)((char *)save)[2]));
-
- return outptr-out;
-}
-
-int
-base64_decode_step(unsigned char *in, int len, unsigned char *out, int *state, unsigned int *save)
-{
- register unsigned char *inptr, *outptr;
- unsigned char *inend, c;
- register unsigned int v;
- int i;
-
- inend = in+len;
- outptr = out;
-
- /* convert 4 base64 bytes to 3 normal bytes */
- v=*save;
- i=*state;
- inptr = in;
- while (inptr<inend) {
- c = camel_mime_base64_rank[*inptr++];
- if (c != 0xff) {
- v = (v<<6) | c;
- i++;
- if (i==4) {
- *outptr++ = v>>16;
- *outptr++ = v>>8;
- *outptr++ = v;
- i=0;
- }
- }
- }
-
- *save = v;
- *state = i;
-
- /* quick scan back for '=' on the end somewhere */
- /* fortunately we can drop 1 output char for each trailing = (upto 2) */
- i=2;
- while (inptr>in && i) {
- inptr--;
- if (camel_mime_base64_rank[*inptr] != 0xff) {
- if (*inptr == '=')
- outptr--;
- i--;
- }
- }
-
- /* if i!= 0 then there is a truncation error! */
- return outptr-out;
-}
-
-int
-quoted_encode_close(unsigned char *in, int len, unsigned char *out, int *state, int *save)
-{
- register unsigned char *outptr = out;
-
- if (len>0)
- outptr += quoted_encode_step(in, len, outptr, state, save);
-
- /* hmm, not sure if this should really be added here, we dont want
- to add it to the content, afterall ...? */
- *outptr++ = '\n';
-
- *save = 0;
- *state = 0;
-
- return outptr-out;
-}
-
-/*
- FIXME: does not handle trailing spaces/tabs before end of line
-*/
-int
-quoted_encode_step(unsigned char *in, int len, unsigned char *out, int *state, int *save)
-{
- register unsigned char *inptr, *outptr, *inend;
- unsigned char c;
- register int sofar = *state;
-
- inptr = in;
- inend = in+len;
- outptr = out;
- while (inptr<inend) {
- c = *inptr++;
- if (is_qpsafe(c)) {
- /* check for soft line-break */
- if ((++sofar)>74) {
- *outptr++='=';
- *outptr++='\n';
- sofar = 1;
- }
- *outptr++=c;
- } else {
- if ((++sofar)>72) {
- *outptr++='=';
- *outptr++='\n';
- sofar = 3;
- }
- *outptr++ = '=';
- *outptr++ = tohex[(c>>4) & 0xf];
- *outptr++ = tohex[c & 0xf];
- }
- }
- *state = sofar;
- return outptr-out;
-}
-
-/*
- FIXME: this does not strip trailing spaces from lines (as it should, rfc 2045, section 6.7)
- Should it also canonicalise the end of line to CR LF??
-
- Note: Trailing rubbish (at the end of input), like = or =x or =\r will be lost.
-*/
-
-int
-quoted_decode_step(unsigned char *in, int len, unsigned char *out, int *savestate, int *saveme)
-{
- register unsigned char *inptr, *outptr;
- unsigned char *inend, c;
- int state, save;
-
- inend = in+len;
- outptr = out;
-
- d(printf("quoted-printable, decoding text '%.*s'\n", len, in));
-
- state = *savestate;
- save = *saveme;
- inptr = in;
- while (inptr<inend) {
- switch (state) {
- case 0:
- while (inptr<inend) {
- c = *inptr++;
- /* FIXME: use a specials table to avoid 3 comparisons for the common case */
- if (c=='=') {
- state = 1;
- break;
- }
-#ifdef CANONICALISE_EOL
- /*else if (c=='\r') {
- state = 3;
- } else if (c=='\n') {
- *outptr++ = '\r';
- *outptr++ = c;
- } */
-#endif
- else {
- *outptr++ = c;
- }
- }
- break;
- case 1:
- c = *inptr++;
- if (c=='\n') {
- /* soft break ... unix end of line */
- state = 0;
- } else {
- save = c;
- state = 2;
- }
- break;
- case 2:
- c = *inptr++;
- if (isxdigit(c) && isxdigit(save)) {
- c = toupper(c);
- save = toupper(save);
- *outptr++ = (((save>='A'?save-'A'+10:save-'0')&0x0f) << 4)
- | ((c>='A'?c-'A'+10:c-'0')&0x0f);
- } else if (c=='\n' && save == '\r') {
- /* soft break ... canonical end of line */
- } else {
- /* just output the data */
- *outptr++ = '=';
- *outptr++ = save;
- *outptr++ = c;
- }
- state = 0;
- break;
-#ifdef CANONICALISE_EOL
- case 3:
- /* convert \r -> to \r\n, leaves \r\n alone */
- c = *inptr++;
- if (c=='\n') {
- *outptr++ = '\r';
- *outptr++ = c;
- } else {
- *outptr++ = '\r';
- *outptr++ = '\n';
- *outptr++ = c;
- }
- state = 0;
- break;
-#endif
- }
- }
-
- *savestate = state;
- *saveme = save;
-
- return outptr-out;
-}
-
-/*
- this is for the "Q" encoding of international words,
- which is slightly different than plain quoted-printable
-*/
-static int
-quoted_decode(const unsigned char *in, int len, unsigned char *out)
-{
- register const unsigned char *inptr;
- register unsigned char *outptr;
- unsigned const char *inend;
- unsigned char c, c1;
- int ret = 0;
-
- inend = in+len;
- outptr = out;
-
- d(printf("decoding text '%.*s'\n", len, in));
-
- inptr = in;
- while (inptr<inend) {
- c = *inptr++;
- if (c=='=') {
- /* silently ignore truncated data? */
- if (inend-in>=2) {
- c = toupper(*inptr++);
- c1 = toupper(*inptr++);
- *outptr++ = (((c>='A'?c-'A'+10:c-'0')&0x0f) << 4)
- | ((c1>='A'?c1-'A'+10:c1-'0')&0x0f);
- } else {
- ret = -1;
- break;
- }
- } else if (c=='_') {
- *outptr++ = 0x20;
- } else if (c==' ' || c==0x09) {
- /* FIXME: this is an error! ignore for now ... */
- ret = -1;
- break;
- } else {
- *outptr++ = c;
- }
- }
- if (ret==0) {
- return outptr-out;
- }
- return -1;
-}
-
-/* rfc2047 version of quoted-printable */
-static int
-quoted_encode(const unsigned char *in, int len, unsigned char *out)
-{
- register const unsigned char *inptr, *inend;
- unsigned char *outptr;
- unsigned char c;
-
- inptr = in;
- inend = in+len;
- outptr = out;
- while (inptr<inend) {
- c = *inptr++;
- if (is_qpsafe(c) && !(c=='_' || c=='?')) {
- if (c==' ')
- c='_';
- *outptr++=c;
- } else {
- *outptr++ = '=';
- *outptr++ = tohex[(c>>4) & 0xf];
- *outptr++ = tohex[c & 0xf];
- }
- }
-
- printf("encoding '%.*s' = '%.*s'\n", len, in, outptr-out, out);
-
- return outptr-out;
-}
-
-
-static void
-header_decode_lwsp(const char **in)
-{
- const char *inptr = *in;
- char c;
-
- d2(printf("is ws: '%s'\n", *in));
-
- while (is_lwsp(*inptr) || *inptr =='(') {
- while (is_lwsp(*inptr)) {
- d2(printf("(%c)", *inptr));
- inptr++;
- }
- d2(printf("\n"));
-
- /* check for comments */
- if (*inptr == '(') {
- int depth = 1;
- inptr++;
- while (depth && (c=*inptr)) {
- if (c=='\\' && inptr[1]) {
- inptr++;
- } else if (c=='(') {
- depth++;
- } else if (c==')') {
- depth--;
- }
- inptr++;
- }
- }
- }
- *in = inptr;
-}
-
-/* decode rfc 2047 encoded string segment */
-static char *
-rfc2047_decode_word(const char *in, int len)
-{
- const char *inptr = in+2;
- const char *inend = in+len-2;
- char *encname;
- int tmplen;
- int ret;
- char *decword = NULL;
- char *decoded = NULL;
- char *outbase = NULL;
- char *inbuf, *outbuf;
- int inlen, outlen;
- unicode_iconv_t ic;
-
- d(printf("decoding '%.*s'\n", len, in));
-
- /* just make sure we're not passed shit */
- if (len<7
- || !(in[0]=='=' && in[1]=='?' && in[len-1]=='=' && in[len-2]=='?')) {
- d(printf("invalid\n"));
- return NULL;
- }
-
- inptr = memchr(inptr, '?', inend-inptr);
- if (inptr!=NULL
- && inptr<inend+2
- && inptr[2]=='?') {
- d(printf("found ?, encoding is '%c'\n", inptr[0]));
- inptr++;
- tmplen = inend-inptr-2;
- decword = alloca(tmplen); /* this will always be more-than-enough room */
- switch(toupper(inptr[0])) {
- case 'Q':
- inlen = quoted_decode(inptr+2, tmplen, decword);
- break;
- case 'B': {
- int state=0;
- unsigned int save=0;
- inlen = base64_decode_step((char *)inptr+2, tmplen, decword, &state, &save);
- /* if state != 0 then error? */
- break;
- }
- }
- d(printf("The encoded length = %d\n", inlen));
- if (inlen>0) {
- /* yuck, all this snot is to setup iconv! */
- tmplen = inptr-in-3;
- encname = alloca(tmplen+1);
- encname[tmplen]=0;
- memcpy(encname, in+2, tmplen);
-
- inbuf = decword;
-
- outlen = inlen*6;
- outbase = alloca(outlen);
- outbuf = outbase;
-
- /* TODO: Should this cache iconv converters? */
- ic = unicode_iconv_open("utf-8", encname);
- if (ic != (unicode_iconv_t)-1) {
- ret = unicode_iconv(ic, (const char **)&inbuf, &inlen, &outbuf, &outlen);
- unicode_iconv_close(ic);
- if (ret>=0) {
- *outbuf = 0;
- decoded = g_strdup(outbase);
- }
- } else {
- w(g_warning("Cannot decode charset, header display may be corrupt: %s: %s", encname, strerror(errno)));
- /* TODO: Should this do this, or just leave the encoded strings? */
- decword[inlen] = 0;
- decoded = g_strdup(decword);
- }
- }
- }
-
- d(printf("decoded '%s'\n", decoded));
-
- return decoded;
-}
-
-/* grrr, glib should have this ! */
-static GString *
-g_string_append_len(GString *st, const char *s, int l)
-{
- char *tmp;
-
- tmp = alloca(l+1);
- tmp[l]=0;
- memcpy(tmp, s, l);
- return g_string_append(st, tmp);
-}
-
-/* decodes a simple text, rfc822 */
-static char *
-header_decode_text(const char *in, int inlen)
-{
- GString *out;
- const char *inptr = in;
- const char *inend = in+inlen;
- char *encstart, *encend;
- char *decword;
-
- out = g_string_new("");
- while ( (encstart = strstr(inptr, "=?"))
- && (encend = strstr(encstart+2, "?=")) ) {
-
- decword = rfc2047_decode_word(encstart, encend-encstart+2);
- if (decword) {
- out = g_string_append_len(out, inptr, encstart-inptr);
- out = g_string_append_len(out, decword, strlen(decword));
- free(decword);
- } else {
- out = g_string_append_len(out, inptr, encend-inptr+2);
- }
- inptr = encend+2;
- }
- out = g_string_append_len(out, inptr, inend-inptr);
-
- encstart = out->str;
- g_string_free(out, FALSE);
-
- return encstart;
-}
-
-char *
-header_decode_string(const char *in)
-{
- if (in == NULL)
- return NULL;
- return header_decode_text(in, strlen(in));
-}
-
-static char *encoding_map[] = {
- "US-ASCII",
- "ISO-8859-1",
- "UTF-8"
-};
-
-/* FIXME: needs a way to cache iconv opens for different charsets? */
-static
-char *rfc2047_encode_word(const char *in, int len, char *type)
-{
- unicode_iconv_t ic;
- char *buffer, *out, *ascii;
- size_t inlen, outlen, enclen;
-
- d(printf("Converting '%.*s' to %s\n", len, in, type));
-
- /* convert utf8->encoding */
- outlen = len*6;
- buffer = alloca(outlen);
- inlen = len;
- out = buffer;
-
- /* if we can't convert from utf-8, just encode as utf-8 */
- if (!strcasecmp(type, "UTF-8")
- || (ic = unicode_iconv_open(type, "UTF-8")) == (unicode_iconv_t)-1) {
- memcpy(buffer, in, len);
- out = buffer+len;
- type = "UTF-8";
- } else {
- if (unicode_iconv(ic, &in, &inlen, &out, &outlen) == -1) {
- w(g_warning("Conversion problem: conversion truncated: %s", strerror(errno)));
- }
- unicode_iconv_close(ic);
- }
- enclen = out-buffer;
-
- /* now create qp version */
- ascii = alloca(enclen*3 + strlen(type) + 8);
- out = ascii;
- /* should determine which encoding is smaller, and use that? */
- out += sprintf(out, "=?%s?Q?", type);
- out += quoted_encode(buffer, enclen, out);
- sprintf(out, "?=");
-
- d(printf("converted = %s\n", ascii));
- return g_strdup(ascii);
-}
-
-
-/* TODO: Should this worry about quotes?? */
-char *
-header_encode_string(const unsigned char *in)
-{
- GString *out;
- const unsigned char *inptr = in, *start;
- int encoding;
- char *outstr;
-
- if (in == NULL)
- return NULL;
-
- /* do a quick us-ascii check (the common case?) */
- while (*inptr) {
- if (*inptr > 127)
- break;
- inptr++;
- }
- if (*inptr == 0)
- return g_strdup(in);
-
- /* This gets each word out of the input, and checks to see what charset
- can be used to encode it. */
- /* TODO: Work out when to merge subsequent words, or across word-parts */
- /* FIXME: Make sure a converted word is less than the encoding size */
- out = g_string_new("");
- inptr = in;
- encoding = 0;
- start = inptr;
- while (inptr && *inptr) {
- unicode_char_t c;
- const char *newinptr;
- newinptr = unicode_get_utf8(inptr, &c);
- if (newinptr == NULL) {
- w(g_warning("Invalid UTF-8 sequence encountered (pos %d, char '%c'): %s", (inptr-in), inptr[0], in));
- inptr++;
- continue;
- }
- inptr = newinptr;
- if (unicode_isspace(c)) {
- if (encoding == 0) {
- out = g_string_append_len(out, start, inptr-start);
- } else {
- char *text = rfc2047_encode_word(start, inptr-start-1, encoding_map[encoding]);
- out = g_string_append(out, text);
- out = g_string_append_c(out, c);
- g_free(text);
- }
- start = inptr;
- encoding = 0;
- } else if (c>127 && c < 256) {
- encoding = MAX(encoding, 1);
- } else if (c >=256) {
- encoding = MAX(encoding, 2);
- }
- }
- if (inptr-start) {
- if (encoding == 0) {
- out = g_string_append_len(out, start, inptr-start);
- } else {
- char *text = rfc2047_encode_word(start, inptr-start, encoding_map[encoding]);
- out = g_string_append(out, text);
- g_free(text);
- }
- }
- outstr = out->str;
- g_string_free(out, FALSE);
- return outstr;
-}
-
-
-/* these are all internal parser functions */
-
-static char *
-decode_token(const char **in)
-{
- const char *inptr = *in;
- const char *start;
-
- header_decode_lwsp(&inptr);
- start = inptr;
- while (is_ttoken(*inptr))
- inptr++;
- if (inptr>start) {
- *in = inptr;
- return g_strndup(start, inptr-start);
- } else {
- return NULL;
- }
-}
-
-char *
-header_token_decode(const char *in)
-{
- if (in == NULL)
- return NULL;
-
- return decode_token(&in);
-}
-
-/*
- <"> * ( <any char except <"> \, cr / \ <any char> ) <">
-*/
-static char *
-header_decode_quoted_string(const char **in)
-{
- const char *inptr = *in;
- char *out = NULL, *outptr;
- int outlen;
- int c;
-
- header_decode_lwsp(&inptr);
- if (*inptr == '"') {
- const char *intmp;
- int skip = 0;
-
- /* first, calc length */
- inptr++;
- intmp = inptr;
- while ( (c = *intmp++) && c!= '"' ) {
- if (c=='\\' && *intmp) {
- intmp++;
- skip++;
- }
- }
- outlen = intmp-inptr-skip;
- out = outptr = g_malloc(outlen+1);
- while ( (c = *inptr++) && c!= '"' ) {
- if (c=='\\' && *inptr) {
- c = *inptr++;
- }
- *outptr++ = c;
- }
- *outptr = 0;
- }
- *in = inptr;
- return out;
-}
-
-static char *
-header_decode_atom(const char **in)
-{
- const char *inptr = *in, *start;
-
- header_decode_lwsp(&inptr);
- start = inptr;
- while (is_atom(*inptr))
- inptr++;
- *in = inptr;
- if (inptr > start)
- return g_strndup(start, inptr-start);
- else
- return NULL;
-}
-
-static char *
-header_decode_word(const char **in)
-{
- const char *inptr = *in;
-
- header_decode_lwsp(&inptr);
- if (*inptr == '"') {
- *in = inptr;
- return header_decode_quoted_string(in);
- } else {
- *in = inptr;
- return header_decode_atom(in);
- }
-}
-
-static char *
-header_decode_value(const char **in)
-{
- const char *inptr = *in;
-
- header_decode_lwsp(&inptr);
- if (*inptr == '"') {
- d(printf("decoding quoted string\n"));
- return header_decode_quoted_string(in);
- } else if (is_ttoken(*inptr)) {
- d(printf("decoding token\n"));
- /* this may not have the right specials for all params? */
- return decode_token(in);
- }
- return NULL;
-}
-
-/* shoudl this return -1 for no int? */
-static int
-header_decode_int(const char **in)
-{
- const char *inptr = *in;
- int c, v=0;
-
- header_decode_lwsp(&inptr);
- while ( (c=*inptr++ & 0xff)
- && isdigit(c) ) {
- v = v*10+(c-'0');
- }
- *in = inptr-1;
- return v;
-}
-
-static int
-header_decode_param(const char **in, char **paramp, char **valuep)
-{
- const char *inptr = *in;
- char *param, *value=NULL;
-
- param = decode_token(&inptr);
- header_decode_lwsp(&inptr);
- if (*inptr == '=') {
- inptr++;
- value = header_decode_value(&inptr);
- }
-
- if (param && value) {
- *paramp = param;
- *valuep = value;
- *in = inptr;
- return 0;
- } else {
- g_free(param);
- g_free(value);
- return 1;
- }
-}
-
-char *
-header_param(struct _header_param *p, const char *name)
-{
- while (p && strcasecmp(p->name, name) != 0)
- p = p->next;
- if (p)
- return p->value;
- return NULL;
-}
-
-struct _header_param *
-header_set_param(struct _header_param **l, const char *name, const char *value)
-{
- struct _header_param *p = (struct _header_param *)l, *pn;
-
- while (p->next) {
- pn = p->next;
- if (!strcasecmp(pn->name, name)) {
- g_free(pn->value);
- if (value) {
- pn->value = g_strdup(value);
- return pn;
- } else {
- p->next = pn->next;
- g_free(pn);
- return NULL;
- }
- }
- p = pn;
- }
-
- if (value == NULL)
- return NULL;
-
- pn = g_malloc(sizeof(*pn));
- pn->next = 0;
- pn->name = g_strdup(name);
- pn->value = g_strdup(value);
- p->next = pn;
-
- return pn;
-}
-
-const char *
-header_content_type_param(struct _header_content_type *t, const char *name)
-{
- if (t==NULL)
- return NULL;
- return header_param(t->params, name);
-}
-
-void header_content_type_set_param(struct _header_content_type *t, const char *name, const char *value)
-{
- header_set_param(&t->params, name, value);
-}
-
-/**
- * header_content_type_is:
- * @ct: A content type specifier, or #NULL.
- * @type: A type to check against.
- * @subtype: A subtype to check against, or "*" to match any subtype.
- *
- * Returns #TRUE if the content type @ct is of type @type/@subtype.
- * The subtype of "*" will match any subtype. If @ct is #NULL, then
- * it will match the type "text/plain".
- *
- * Return value: #TRUE or #FALSE depending on the matching of the type.
- **/
-int
-header_content_type_is(struct _header_content_type *ct, const char *type, const char *subtype)
-{
- /* no type == text/plain or text/"*" */
- if (ct==NULL) {
- return (!strcasecmp(type, "text")
- && (!strcasecmp(subtype, "plain")
- || !strcasecmp(subtype, "*")));
- }
-
- return (ct->type != NULL
- && (!strcasecmp(ct->type, type)
- && ((ct->subtype != NULL
- && !strcasecmp(ct->subtype, subtype))
- || !strcasecmp("*", subtype))));
-}
-
-void
-header_param_list_free(struct _header_param *p)
-{
- struct _header_param *n;
-
- while (p) {
- n = p->next;
- g_free(p->name);
- g_free(p->value);
- g_free(p);
- p = n;
- }
-}
-
-struct _header_content_type *
-header_content_type_new(const char *type, const char *subtype)
-{
- struct _header_content_type *t = g_malloc(sizeof(*t));
-
- t->type = g_strdup(type);
- t->subtype = g_strdup(subtype);
- t->params = NULL;
- t->refcount = 1;
- return t;
-}
-
-void
-header_content_type_ref(struct _header_content_type *ct)
-{
- if (ct)
- ct->refcount++;
-}
-
-
-void
-header_content_type_unref(struct _header_content_type *ct)
-{
- if (ct) {
- if (ct->refcount <= 1) {
- header_param_list_free(ct->params);
- g_free(ct->type);
- g_free(ct->subtype);
- g_free(ct);
- } else {
- ct->refcount--;
- }
- }
-}
-
-/* for decoding email addresses, canonically */
-static char *
-header_decode_domain(const char **in)
-{
- const char *inptr = *in, *start;
- int go = TRUE;
- char *ret;
- GString *domain = g_string_new("");
-
- /* domain ref | domain literal */
- header_decode_lwsp(&inptr);
- while (go) {
- if (*inptr == '[') { /* domain literal */
- domain = g_string_append(domain, "[ ");
- inptr++;
- header_decode_lwsp(&inptr);
- start = inptr;
- while (is_dtext(*inptr)) {
- domain = g_string_append_c(domain, *inptr);
- inptr++;
- }
- if (*inptr == ']') {
- domain = g_string_append(domain, " ]");
- inptr++;
- } else {
- w(g_warning("closing ']' not found in domain: %s", *in));
- }
- } else {
- char *a = header_decode_atom(&inptr);
- if (a) {
- domain = g_string_append(domain, a);
- g_free(a);
- } else {
- w(g_warning("missing atom from domain-ref"));
- break;
- }
- }
- header_decode_lwsp(&inptr);
- if (*inptr == '.') { /* next sub-domain? */
- domain = g_string_append_c(domain, '.');
- inptr++;
- header_decode_lwsp(&inptr);
- } else
- go = FALSE;
- }
-
- *in = inptr;
-
- ret = domain->str;
- g_string_free(domain, FALSE);
- return ret;
-}
-
-static char *
-header_decode_addrspec(const char **in)
-{
- const char *inptr = *in;
- char *word;
- GString *addr = g_string_new("");
-
- header_decode_lwsp(&inptr);
-
- /* addr-spec */
- word = header_decode_word(&inptr);
- if (word) {
- addr = g_string_append(addr, word);
- header_decode_lwsp(&inptr);
- g_free(word);
- while (*inptr == '.' && word) {
- inptr++;
- addr = g_string_append_c(addr, '.');
- word = header_decode_word(&inptr);
- if (word) {
- addr = g_string_append(addr, word);
- header_decode_lwsp(&inptr);
- g_free(word);
- } else {
- w(g_warning("Invalid address spec: %s", *in));
- }
- }
- if (*inptr == '@') {
- inptr++;
- addr = g_string_append_c(addr, '@');
- word = header_decode_domain(&inptr);
- if (word) {
- addr = g_string_append(addr, word);
- g_free(word);
- } else {
- w(g_warning("Invalid address, missing domain: %s", *in));
- }
- } else {
- w(g_warning("Invalid addr-spec, missing @: %s", *in));
- }
- } else {
- w(g_warning("invalid addr-spec, no local part"));
- }
-
- /* FIXME: return null on error? */
-
- *in = inptr;
- word = addr->str;
- g_string_free(addr, FALSE);
- return word;
-}
-
-/*
- address:
- word *('.' word) @ domain |
- *(word) '<' [ *('@' domain ) ':' ] word *( '.' word) @ domain |
-
- 1*word ':' [ word ... etc (mailbox, as above) ] ';'
- */
-
-/* mailbox:
- word *( '.' word ) '@' domain
- *(word) '<' [ *('@' domain ) ':' ] word *( '.' word) @ domain
- */
-
-static struct _header_address *
-header_decode_mailbox(const char **in)
-{
- const char *inptr = *in;
- char *pre;
- int closeme = FALSE;
- GString *addr;
- GString *name = NULL;
- struct _header_address *address = NULL;
-
- addr = g_string_new("");
-
- /* for each address */
- pre = header_decode_word(&inptr);
- header_decode_lwsp(&inptr);
- if (!(*inptr == '.' || *inptr == '@' || *inptr==',' || *inptr=='\0')) { /* ',' and '\0' required incase it is a simple address, no @ domain part (buggy writer) */
- name = g_string_new("");
- while (pre) {
- char *text;
-
- text = header_decode_string(pre);
- name = g_string_append(name, text);
- g_free(pre);
- g_free(text);
-
- /* rfc_decode(pre) */
- pre = header_decode_word(&inptr);
- if (pre)
- name = g_string_append_c(name, ' ');
- }
- header_decode_lwsp(&inptr);
- if (*inptr == '<') {
- closeme = TRUE;
- inptr++;
- header_decode_lwsp(&inptr);
- if (*inptr == '@') {
- while (*inptr == '@') {
- inptr++;
- header_decode_domain(&inptr);
- header_decode_lwsp(&inptr);
- if (*inptr == ',') {
- inptr++;
- header_decode_lwsp(&inptr);
- }
- }
- if (*inptr == ':') {
- inptr++;
- } else {
- w(g_warning("broken route-address, missing ':': %s", *in));
- }
- }
- pre = header_decode_word(&inptr);
- header_decode_lwsp(&inptr);
- } else {
- w(g_warning("broken address? %s", *in));
- }
- }
-
- if (pre) {
- addr = g_string_append(addr, pre);
- } else {
- w(g_warning("No local-part for email address: %s", *in));
- }
-
- /* should be at word '.' localpart */
- while (*inptr == '.' && pre) {
- inptr++;
- g_free(pre);
- pre = header_decode_word(&inptr);
- if (pre) {
- addr = g_string_append_c(addr, '.');
- addr = g_string_append(addr, pre);
- }
- header_decode_lwsp(&inptr);
- }
- g_free(pre);
-
- /* now at '@' domain part */
- if (*inptr == '@') {
- char *dom;
-
- inptr++;
- addr = g_string_append_c(addr, '@');
- dom = header_decode_domain(&inptr);
- addr = g_string_append(addr, dom);
- g_free(dom);
- } else {
- w(g_warning("invalid address, no '@' domain part at %c: %s", *inptr, *in));
- }
-
- if (closeme) {
- header_decode_lwsp(&inptr);
- if (*inptr == '>') {
- inptr++;
- } else {
- w(g_warning("invalid route address, no closing '>': %s", *in));
- }
- } else if (name == NULL) { /* check for comment after address */
- char *text, *tmp;
- const char *comment = inptr;
-
- header_decode_lwsp(&inptr);
- if (inptr-comment > 3) { /* just guess ... */
- tmp = g_strndup(comment, inptr-comment);
- text = header_decode_string(tmp);
- name = g_string_new(text);
- g_free(tmp);
- g_free(text);
- }
- }
-
- *in = inptr;
-
- if (addr->len > 0) {
- address = header_address_new_name(name?name->str:"", addr->str);
- }
-
- g_string_free(addr, TRUE);
- if (name)
- g_string_free(name, TRUE);
-
- d(printf("got mailbox: %s\n", addr->str));
- return address;
-}
-
-static struct _header_address *
-header_decode_address(const char **in)
-{
- const char *inptr = *in;
- char *pre;
- GString *group = g_string_new("");
- struct _header_address *addr = NULL, *member;
-
- /* pre-scan, trying to work out format, discard results */
- header_decode_lwsp(&inptr);
- while ( (pre = header_decode_word(&inptr)) ) {
- group = g_string_append(group, pre);
- group = g_string_append(group, " ");
- g_free(pre);
- }
- header_decode_lwsp(&inptr);
- if (*inptr == ':') {
- d(printf("group detected: %s\n", group->str));
- addr = header_address_new_group(group->str);
- /* that was a group spec, scan mailbox's */
- inptr++;
- /* FIXME: check rfc 2047 encodings of words, here or above in the loop */
- header_decode_lwsp(&inptr);
- if (*inptr != ';') {
- int go = TRUE;
- do {
- member = header_decode_mailbox(&inptr);
- if (member)
- header_address_add_member(addr, member);
- header_decode_lwsp(&inptr);
- if (*inptr == ',')
- inptr++;
- else
- go = FALSE;
- } while (go);
- if (*inptr == ';') {
- inptr++;
- } else {
- w(g_warning("Invalid group spec, missing closing ';': %s", *in));
- }
- } else {
- inptr++;
- }
- *in = inptr;
- } else {
- addr = header_decode_mailbox(in);
- }
-
- g_string_free(group, TRUE);
-
- return addr;
-}
-
-char *
-header_msgid_decode(const char *in)
-{
- const char *inptr = in;
- char *msgid = NULL;
-
- d(printf("decoding Message-ID: '%s'\n", in));
-
- if (in == NULL)
- return NULL;
-
- header_decode_lwsp(&inptr);
- if (*inptr == '<') {
- inptr++;
- header_decode_lwsp(&inptr);
- msgid = header_decode_addrspec(&inptr);
- if (msgid) {
- header_decode_lwsp(&inptr);
- if (*inptr == '>') {
- inptr++;
- } else {
- w(g_warning("Missing closing '>' on message id: %s", in));
- }
- } else {
- w(g_warning("Cannot find message id in: %s", in));
- }
- } else {
- w(g_warning("missing opening '<' on message id: %s", in));
- }
-
- return msgid;
-}
-
-struct _header_address *
-header_mailbox_decode(const char *in)
-{
- if (in == NULL)
- return NULL;
-
- return header_decode_mailbox(&in);
-}
-
-struct _header_address *
-header_address_decode(const char *in)
-{
- const char *inptr = in, *last;
- struct _header_address *list = NULL, *addr;
-
- d(printf("decoding To: '%s'\n", in));
-
-#warning header_to_decode needs to return some structure
-
- if (in == NULL)
- return NULL;
-
- do {
- last = inptr;
- addr = header_decode_address(&inptr);
- if (addr)
- header_address_list_append(&list, addr);
- header_decode_lwsp(&inptr);
- if (*inptr == ',')
- inptr++;
- else
- break;
- } while (inptr != last);
-
- if (*inptr) {
- w(g_warning("Invalid input detected at %c (%d): %s\n or at: %s", *inptr, inptr-in, in, inptr));
- }
-
- if (inptr == last) {
- w(g_warning("detected invalid input loop at : %s", last));
- }
-
- return list;
-}
-
-void
-header_mime_decode(const char *in, int *maj, int *min)
-{
- const char *inptr = in;
- int major=-1, minor=-1;
-
- d(printf("decoding MIME-Version: '%s'\n", in));
-
- if (in != NULL) {
- header_decode_lwsp(&inptr);
- if (isdigit(*inptr)) {
- major = header_decode_int(&inptr);
- header_decode_lwsp(&inptr);
- if (*inptr == '.') {
- inptr++;
- header_decode_lwsp(&inptr);
- if (isdigit(*inptr))
- minor = header_decode_int(&inptr);
- }
- }
- }
-
- if (maj)
- *maj = major;
- if (min)
- *min = minor;
-
- d(printf("major = %d, minor = %d\n", major, minor));
-}
-
-static struct _header_param *
-header_param_list_decode(const char **in)
-{
- const char *inptr = *in;
- struct _header_param *head = NULL, *tail = NULL;
-
- header_decode_lwsp(&inptr);
- while (*inptr == ';') {
- char *param, *value;
- struct _header_param *p;
-
- inptr++;
- /* invalid format? */
- if (header_decode_param(&inptr, &param, &value) != 0)
- break;
-
- p = g_malloc(sizeof(*p));
- p->name = param;
- p->value = value;
- p->next = NULL;
- if (head == NULL)
- head = p;
- if (tail)
- tail->next = p;
- tail = p;
- header_decode_lwsp(&inptr);
- }
- *in = inptr;
- return head;
-}
-
-static void
-header_param_list_format_append(GString *out, struct _header_param *p)
-{
- int len = out->len;
- while (p) {
- int here = out->len;
- if (len+strlen(p->name)+strlen(p->value)>60) {
- out = g_string_append(out, "\n\t");
- len = 0;
- }
- /* FIXME: format the value properly */
- g_string_sprintfa(out, " ; %s=\"%s\"", p->name, p->value);
- len += (out->len - here);
- p = p->next;
- }
-}
-
-struct _header_content_type *
-header_content_type_decode(const char *in)
-{
- const char *inptr = in;
- char *type, *subtype = NULL;
- struct _header_content_type *t = NULL;
-
- if (in==NULL)
- return NULL;
-
- type = decode_token(&inptr);
- header_decode_lwsp(&inptr);
- if (type) {
- if (*inptr == '/') {
- inptr++;
- subtype = decode_token(&inptr);
- }
- if (subtype == NULL && (!strcasecmp(type, "text"))) {
- w(g_warning("text type with no subtype, resorting to text/plain: %s", in));
- subtype = g_strdup("plain");
- }
- if (subtype == NULL) {
- w(g_warning("MIME type with no subtype: %s", in));
- }
-
- t = header_content_type_new(type, subtype);
- t->params = header_param_list_decode(&inptr);
- g_free(type);
- g_free(subtype);
- } else {
- g_free(type);
- d(printf("cannot find MIME type in header (2) '%s'", in));
- }
- return t;
-}
-
-void
-header_content_type_dump(struct _header_content_type *ct)
-{
- struct _header_param *p;
-
- printf("Content-Type: ");
- if (ct==NULL) {
- printf("<NULL>\n");
- return;
- }
- printf("%s / %s", ct->type, ct->subtype);
- p = ct->params;
- if (p) {
- while (p) {
- printf(";\n\t%s=\"%s\"", p->name, p->value);
- p = p->next;
- }
- }
- printf("\n");
-}
-
-char *
-header_content_type_format(struct _header_content_type *ct)
-{
- GString *out;
- char *ret;
-
- if (ct==NULL)
- return NULL;
-
- out = g_string_new("");
- if (ct->type == NULL) {
- g_string_sprintfa(out, "text/plain");
- w(g_warning("Content-Type with no main type"));
- } else if (ct->subtype == NULL) {
- w(g_warning("Content-Type with no sub type: %s", ct->type));
- if (!strcasecmp(ct->type, "multipart"))
- g_string_sprintfa(out, "%s/mixed", ct->type);
- else
- g_string_sprintfa(out, "%s", ct->type);
- } else {
- g_string_sprintfa(out, "%s/%s", ct->type, ct->subtype);
- }
- header_param_list_format_append(out, ct->params);
-
- ret = out->str;
- g_string_free(out, FALSE);
- return ret;
-}
-
-char *
-header_content_encoding_decode(const char *in)
-{
- if (in)
- return decode_token(&in);
- return NULL;
-}
-
-CamelMimeDisposition *header_disposition_decode(const char *in)
-{
- CamelMimeDisposition *d = NULL;
- const char *inptr = in;
-
- if (in == NULL)
- return NULL;
-
- d = g_malloc(sizeof(*d));
- d->refcount = 1;
- d->disposition = decode_token(&inptr);
- if (d->disposition == NULL)
- w(g_warning("Empty disposition type"));
- d->params = header_param_list_decode(&inptr);
- return d;
-}
-
-void header_disposition_ref(CamelMimeDisposition *d)
-{
- if (d)
- d->refcount++;
-}
-void header_disposition_unref(CamelMimeDisposition *d)
-{
- if (d) {
- if (d->refcount<=1) {
- header_param_list_free(d->params);
- g_free(d->disposition);
- g_free(d);
- } else {
- d->refcount--;
- }
- }
-}
-
-char *header_disposition_format(CamelMimeDisposition *d)
-{
- GString *out;
- char *ret;
-
- if (d==NULL)
- return NULL;
-
- out = g_string_new("");
- if (d->disposition)
- out = g_string_append(out, d->disposition);
- else
- out = g_string_append(out, "attachment");
- header_param_list_format_append(out, d->params);
-
- ret = out->str;
- g_string_free(out, FALSE);
- return ret;
-}
-
-/* hrm, is there a library for this shit? */
-static struct {
- char *name;
- int offset;
-} tz_offsets [] = {
- { "UT", 0 },
- { "GMT", 0 },
- { "EST", -500 }, /* these are all US timezones. bloody yanks */
- { "EDT", -400 },
- { "CST", -600 },
- { "CDT", -500 },
- { "MST", -700 },
- { "MDT", -600 },
- { "PST", -800 },
- { "PDT", -700 },
- { "Z", 0 },
- { "A", -100 },
- { "M", -1200 },
- { "N", 100 },
- { "Y", 1200 },
-};
-
-static char *tz_months [] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-
-char *
-header_format_date(time_t time, int offset)
-{
- struct tm tm;
-
- d(printf("offset = %d\n", offset));
-
- d(printf("converting date %s", ctime(&time)));
-
- time += ((offset / 100) * (60*60)) + (offset % 100)*60;
-
- d(printf("converting date %s", ctime(&time)));
-
- memcpy(&tm, gmtime(&time), sizeof(tm));
-
- return g_strdup_printf("%02d %s %04d %02d:%02d:%02d %+05d",
- tm.tm_mday, tz_months[tm.tm_mon],
- tm.tm_year + 1900,
- tm.tm_hour, tm.tm_min, tm.tm_sec,
- offset);
-}
-
-/* convert a date to time_t representation */
-/* this is an awful mess oh well */
-time_t
-header_decode_date(const char *in, int *saveoffset)
-{
- const char *inptr = in;
- char *monthname;
- int year, offset = 0;
- struct tm tm;
- int i;
- time_t t;
-
- if (in == NULL) {
- if (saveoffset)
- *saveoffset = 0;
- return 0;
- }
-
- d(printf("\ndecoding date '%s'\n", inptr));
-
- memset(&tm, 0, sizeof(tm));
-
- header_decode_lwsp(&inptr);
- if (!isdigit(*inptr)) {
- char *day = decode_token(&inptr);
- /* we dont really care about the day, its only for display */
- if (day) {
- d(printf("got day: %s\n", day));
- g_free(day);
- header_decode_lwsp(&inptr);
- if (*inptr == ',')
- inptr++;
- else
- w(g_warning("day not followed by ','"));
- }
- }
- tm.tm_mday = header_decode_int(&inptr);
- monthname = decode_token(&inptr);
- if (monthname) {
- for (i=0;i<sizeof(tz_months)/sizeof(tz_months[0]);i++) {
- if (!strcasecmp(tz_months[i], monthname)) {
- tm.tm_mon = i;
- break;
- }
- }
- g_free(monthname);
- }
- year = header_decode_int(&inptr);
- if (year<100) {
- tm.tm_year = year;
- } else {
- tm.tm_year = year-1900;
- }
- /* get the time ... yurck */
- tm.tm_hour = header_decode_int(&inptr);
- header_decode_lwsp(&inptr);
- if (*inptr == ':')
- inptr++;
- tm.tm_min = header_decode_int(&inptr);
- header_decode_lwsp(&inptr);
- if (*inptr == ':')
- inptr++;
- tm.tm_sec = header_decode_int(&inptr);
- header_decode_lwsp(&inptr);
- if (*inptr == '+'
- || *inptr == '-') {
- offset = (*inptr++)=='-'?-1:1;
- offset = offset * header_decode_int(&inptr);
- d(printf("abs signed offset = %d\n", offset));
- } else if (isdigit(*inptr)) {
- offset = header_decode_int(&inptr);
- d(printf("abs offset = %d\n", offset));
- } else {
- char *tz = decode_token(&inptr);
-
- if (tz) {
- for (i=0;i<sizeof(tz_offsets)/sizeof(tz_offsets[0]);i++) {
- if (!strcasecmp(tz_offsets[i].name, tz)) {
- offset = tz_offsets[i].offset;
- break;
- }
- }
- g_free(tz);
- }
- /* some broken mailers seem to put in things like GMT+1030 instead of just +1030 */
- header_decode_lwsp(&inptr);
- if (*inptr == '+' || *inptr == '-') {
- int sign = (*inptr++)=='-'?-1:1;
- offset = offset + (header_decode_int(&inptr)*sign);
- }
- d(printf("named offset = %d\n", offset));
- }
-
- t = mktime(&tm);
-#if defined(HAVE_TIMEZONE)
- t -= timezone;
-#elif defined(HAVE_TM_GMTOFF)
- t += tm.tm_gmtoff;
-#else
-#error Neither HAVE_TIMEZONE nor HAVE_TM_GMTOFF defined. Rerun autoheader, autoconf, etc.
-#endif
-
- /* t is now GMT of the time we want, but not offset by the timezone ... */
-
- d(printf(" gmt normalized? = %s\n", ctime(&t)));
-
- /* this should convert the time to the GMT equiv time */
- t -= ( (offset/100) * 60*60) + (offset % 100)*60;
-
- d(printf(" gmt normalized for timezone? = %s\n", ctime(&t)));
-
- d({
- char *tmp;
- tmp = header_format_date(t, offset);
- printf(" encoded again: %s\n", tmp);
- g_free(tmp);
- });
-
- if (saveoffset)
- *saveoffset = offset;
-
- return t;
-}
-
-/* extra rfc checks */
-#define CHECKS
-
-#ifdef CHECKS
-static void
-check_header(struct _header_raw *h)
-{
- unsigned char *p;
-
- p = h->value;
- while (p && *p) {
- if (!isascii(*p)) {
- w(g_warning("Appending header violates rfc: %s: %s", h->name, h->value));
- return;
- }
- p++;
- }
-}
-#endif
-
-void
-header_raw_append_parse(struct _header_raw **list, const char *header, int offset)
-{
- register const char *in;
- int fieldlen;
- char *name;
-
- in = header;
- while (is_fieldname(*in))
- in++;
- fieldlen = in-header;
- while (is_lwsp(*in))
- in++;
- if (fieldlen == 0 || *in != ':') {
- printf("Invalid header line: '%s'\n", header);
- return;
- }
- in++;
- name = alloca(fieldlen+1);
- memcpy(name, header, fieldlen);
- name[fieldlen] = 0;
-
- header_raw_append(list, name, in, offset);
-}
-
-void
-header_raw_append(struct _header_raw **list, const char *name, const char *value, int offset)
-{
- struct _header_raw *l, *n;
-
- d(printf("Header: %s: %s\n", name, value));
-
- n = g_malloc(sizeof(*n));
- n->next = NULL;
- n->name = g_strdup(name);
- n->value = g_strdup(value);
- n->offset = offset;
-#ifdef CHECKS
- check_header(n);
-#endif
- l = (struct _header_raw *)list;
- while (l->next) {
- l = l->next;
- }
- l->next = n;
-
- /* debug */
-#if 0
- if (!strcasecmp(name, "To")) {
- printf("- Decoding To\n");
- header_to_decode(value);
- } else if (!strcasecmp(name, "Content-type")) {
- printf("- Decoding content-type\n");
- header_content_type_dump(header_content_type_decode(value));
- } else if (!strcasecmp(name, "MIME-Version")) {
- printf("- Decoding mime version\n");
- header_mime_decode(value);
- }
-#endif
-}
-
-static struct _header_raw *
-header_raw_find_node(struct _header_raw **list, const char *name)
-{
- struct _header_raw *l;
-
- l = *list;
- while (l) {
- if (!strcasecmp(l->name, name))
- break;
- l = l->next;
- }
- return l;
-}
-
-const char *
-header_raw_find(struct _header_raw **list, const char *name, int *offset)
-{
- struct _header_raw *l;
-
- l = header_raw_find_node(list, name);
- if (l) {
- if (offset)
- *offset = l->offset;
- return l->value;
- } else
- return NULL;
-}
-
-const char *
-header_raw_find_next(struct _header_raw **list, const char *name, int *offset, const char *last)
-{
- struct _header_raw *l;
-
- if (last == NULL || name == NULL)
- return NULL;
-
- l = *list;
- while (l && l->value != last)
- l = l->next;
- return header_raw_find(&l, name, offset);
-}
-
-static void
-header_raw_free(struct _header_raw *l)
-{
- g_free(l->name);
- g_free(l->value);
- g_free(l);
-}
-
-void
-header_raw_remove(struct _header_raw **list, const char *name)
-{
- struct _header_raw *l, *p;
-
- /* the next pointer is at the head of the structure, so this is safe */
- p = (struct _header_raw *)list;
- l = *list;
- while (l) {
- if (!strcasecmp(l->name, name)) {
- p->next = l->next;
- header_raw_free(l);
- l = p->next;
- } else {
- p = l;
- l = l->next;
- }
- }
-}
-
-void
-header_raw_replace(struct _header_raw **list, const char *name, const char *value, int offset)
-{
- header_raw_remove(list, name);
- header_raw_append(list, name, value, offset);
-}
-
-void
-header_raw_clear(struct _header_raw **list)
-{
- struct _header_raw *l, *n;
- l = *list;
- while (l) {
- n = l->next;
- header_raw_free(l);
- l = n;
- }
- *list = NULL;
-}
-
-
-/* ok, here's the address stuff, what a mess ... */
-struct _header_address *header_address_new(void)
-{
- struct _header_address *h;
- h = g_malloc0(sizeof(*h));
- h->type = HEADER_ADDRESS_NONE;
- h->refcount = 1;
- return h;
-}
-
-struct _header_address *header_address_new_name(const char *name, const char *addr)
-{
- struct _header_address *h;
-
- h = header_address_new();
- h->type = HEADER_ADDRESS_NAME;
- h->name = g_strdup(name);
- h->v.addr = g_strdup(addr);
- return h;
-}
-
-struct _header_address *header_address_new_group(const char *name)
-{
- struct _header_address *h;
-
- h = header_address_new();
- h->type = HEADER_ADDRESS_GROUP;
- h->name = g_strdup(name);
- return h;
-}
-
-void header_address_ref(struct _header_address *h)
-{
- if (h)
- h->refcount++;
-}
-
-void header_address_unref(struct _header_address *h)
-{
- if (h) {
- if (h->refcount <= 1) {
- if (h->type == HEADER_ADDRESS_GROUP) {
- header_address_list_clear(&h->v.members);
- } else if (h->type == HEADER_ADDRESS_NAME) {
- g_free(h->v.addr);
- }
- g_free(h->name);
- g_free(h);
- } else {
- h->refcount--;
- }
- }
-}
-
-void header_address_set_name(struct _header_address *h, const char *name)
-{
- if (h) {
- g_free(h->name);
- h->name = g_strdup(name);
- }
-}
-
-void header_address_set_addr(struct _header_address *h, const char *addr)
-{
- if (h) {
- if (h->type == HEADER_ADDRESS_NAME
- || h->type == HEADER_ADDRESS_NONE) {
- h->type = HEADER_ADDRESS_NAME;
- g_free(h->v.addr);
- h->v.addr = g_strdup(addr);
- } else {
- g_warning("Trying to set the address on a group");
- }
- }
-}
-
-void header_address_set_members(struct _header_address *h, struct _header_address *group)
-{
- if (h) {
- if (h->type == HEADER_ADDRESS_GROUP
- || h->type == HEADER_ADDRESS_NONE) {
- h->type = HEADER_ADDRESS_GROUP;
- header_address_list_clear(&h->v.members);
- /* should this ref them? */
- h->v.members = group;
- } else {
- g_warning("Trying to set the members on a name, not group");
- }
- }
-}
-
-void header_address_add_member(struct _header_address *h, struct _header_address *member)
-{
- if (h) {
- if (h->type == HEADER_ADDRESS_GROUP
- || h->type == HEADER_ADDRESS_NONE) {
- h->type = HEADER_ADDRESS_GROUP;
- header_address_list_append(&h->v.members, member);
- }
- }
-}
-
-void header_address_list_append_list(struct _header_address **l, struct _header_address **h)
-{
- if (l) {
- struct _header_address *n = (struct _header_address *)l;
-
- while (n->next)
- n = n->next;
- n->next = *h;
- }
-}
-
-
-void header_address_list_append(struct _header_address **l, struct _header_address *h)
-{
- if (h) {
- header_address_list_append_list(l, &h);
- h->next = NULL;
- }
-}
-
-void header_address_list_clear(struct _header_address **l)
-{
- struct _header_address *a, *n;
- a = *l;
- while (a) {
- n = a->next;
- header_address_unref(a);
- a = n;
- }
- *l = NULL;
-}
-
-static void
-header_address_list_format_append(GString *out, struct _header_address *a)
-{
- char *text;
-
- while (a) {
- switch (a->type) {
- case HEADER_ADDRESS_NAME:
-#warning needs to rfc2047 encode address phrase
- /* FIXME: 2047 encoding?? */
- if (a->name)
- g_string_sprintfa(out, "\"%s\" <%s>", a->name, a->v.addr);
- else
- g_string_sprintfa(out, "<%s>", a->v.addr);
- break;
- case HEADER_ADDRESS_GROUP:
- text = header_encode_string(a->name);
- g_string_sprintfa(out, "%s:\n ", text);
- header_address_list_format_append(out, a->v.members);
- g_string_sprintfa(out, ";");
- break;
- default:
- g_warning("Invalid address type");
- break;
- }
- a = a->next;
- }
-}
-
-/* FIXME: need a 'display friendly' version, as well as a 'rfc friendly' version? */
-char *
-header_address_list_format(struct _header_address *a)
-{
- GString *out;
- char *ret;
-
- if (a == NULL)
- return NULL;
-
- out = g_string_new("");
-
- header_address_list_format_append(out, a);
- ret = out->str;
- g_string_free(out, FALSE);
- return ret;
-}
-
-#ifdef BUILD_TABLE
-
-/* for debugging tests */
-/* should also have some regression tests somewhere */
-
-void run_test(void)
-{
- char *to = "gnome hacker dudes: license-discuss@opensource.org,
- \"Richard M. Stallman\" <rms@gnu.org>,
- Barry Chester <barry_che@antdiv.gov.au>,
- Michael Zucchi <zucchi.michael(this (is a nested) comment)@zedzone.mmc.com.au>,
- Miguel de Icaza <miguel@gnome.org>;,
- zucchi@zedzone.mmc.com.au, \"Foo bar\" <zed@zedzone>,
- <frob@frobzone>";
-
- header_to_decode(to);
-
- header_mime_decode("1.0");
- header_mime_decode("1.3 (produced by metasend V1.0)");
- header_mime_decode("(produced by metasend V1.0) 5.2");
- header_mime_decode("7(produced by metasend 1.0) . (produced by helix/send/1.0) 9 . 5");
- header_mime_decode("3.");
- header_mime_decode(".");
- header_mime_decode(".5");
- header_mime_decode("c.d");
- header_mime_decode("");
-
- header_msgid_decode(" <\"L3x2i1.0.Nm5.Xd-Wu\"@lists.redhat.com>");
- header_msgid_decode("<200001180446.PAA02065@beaker.htb.com.au>");
-
-}
-
-#endif /* BUILD_TABLE */
diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h
deleted file mode 100644
index f95f76363c..0000000000
--- a/camel/camel-mime-utils.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _CAMEL_MIME_UTILS_H
-#define _CAMEL_MIME_UTILS_H
-
-#include <time.h>
-
-struct _header_param {
- struct _header_param *next;
- char *name;
- char *value;
-};
-
-/* describes a content-type */
-struct _header_content_type {
- char *type;
- char *subtype;
- struct _header_param *params;
- unsigned int refcount;
-};
-
-/* a raw rfc822 header */
-/* the value MUST be US-ASCII */
-struct _header_raw {
- struct _header_raw *next;
- char *name;
- char *value;
- int offset; /* in file, if known */
-};
-
-typedef struct _CamelMimeDisposition {
- char *disposition;
- struct _header_param *params;
- unsigned int refcount;
-} CamelMimeDisposition;
-
-enum _header_address_type {
- HEADER_ADDRESS_NONE, /* uninitialised */
- HEADER_ADDRESS_NAME,
- HEADER_ADDRESS_GROUP
-};
-
-struct _header_address {
- struct _header_address *next;
- enum _header_address_type type;
- char *name;
- union {
- char *addr;
- struct _header_address *members;
- } v;
- unsigned int refcount;
-};
-
-/* Address lists */
-struct _header_address *header_address_new(void);
-struct _header_address *header_address_new_name(const char *name, const char *addr);
-struct _header_address *header_address_new_group(const char *name);
-void header_address_ref(struct _header_address *);
-void header_address_unref(struct _header_address *);
-void header_address_set_name(struct _header_address *, const char *name);
-void header_address_set_addr(struct _header_address *, const char *addr);
-void header_address_set_members(struct _header_address *, struct _header_address *group);
-void header_address_add_member(struct _header_address *, struct _header_address *member);
-void header_address_list_append_list(struct _header_address **l, struct _header_address **h);
-void header_address_list_append(struct _header_address **, struct _header_address *);
-void header_address_list_clear(struct _header_address **);
-
-struct _header_address *header_address_decode(const char *in);
-struct _header_address *header_mailbox_decode(const char *in);
-char *header_address_list_format(struct _header_address *a);
-
-/* structured header prameters */
-char *header_param(struct _header_param *p, const char *name);
-struct _header_param *header_set_param(struct _header_param **l, const char *name, const char *value);
-void header_param_list_free(struct _header_param *p);
-
-/* Content-Type header */
-struct _header_content_type *header_content_type_new(const char *type, const char *subtype);
-struct _header_content_type *header_content_type_decode(const char *in);
-void header_content_type_unref(struct _header_content_type *ct);
-void header_content_type_ref(struct _header_content_type *ct);
-const char *header_content_type_param(struct _header_content_type *t, const char *name);
-void header_content_type_set_param(struct _header_content_type *t, const char *name, const char *value);
-int header_content_type_is(struct _header_content_type *ct, const char *type, const char *subtype);
-char *header_content_type_format(struct _header_content_type *ct);
-
-/* DEBUGGING function */
-void header_content_type_dump(struct _header_content_type *ct);
-
-/* Content-Disposition header */
-CamelMimeDisposition *header_disposition_decode(const char *in);
-void header_disposition_ref(CamelMimeDisposition *);
-void header_disposition_unref(CamelMimeDisposition *);
-char *header_disposition_format(CamelMimeDisposition *d);
-
-/* decode the contents of a content-encoding header */
-char *header_content_encoding_decode(const char *in);
-
-/* raw headers */
-void header_raw_append(struct _header_raw **list, const char *name, const char *value, int offset);
-void header_raw_append_parse(struct _header_raw **list, const char *header, int offset);
-const char *header_raw_find(struct _header_raw **list, const char *name, int *ofset);
-const char *header_raw_find_next(struct _header_raw **list, const char *name, int *ofset, const char *last);
-void header_raw_replace(struct _header_raw **list, const char *name, const char *value, int offset);
-void header_raw_remove(struct _header_raw **list, const char *name);
-void header_raw_clear(struct _header_raw **list);
-
-/* decode a header which is a simple token */
-char *header_token_decode(const char *in);
-
-/* decode/encode a string type, like a subject line */
-char *header_decode_string(const char *in);
-char *header_encode_string(const unsigned char *in);
-
-/* decode an email date field into a GMT time, + optional offset */
-time_t header_decode_date(const char *in, int *saveoffset);
-char *header_format_date(time_t time, int offset);
-
-/* decode a message id */
-char *header_msgid_decode(const char *in);
-
-/* decode the mime-type header */
-void header_mime_decode(const char *in, int *maj, int *min);
-
-/* do incremental base64/quoted-printable (de/en)coding */
-int base64_decode_step(unsigned char *in, int len, unsigned char *out, int *state, unsigned int *save);
-
-int base64_encode_step(unsigned char *in, int len, unsigned char *out, int *state, int *save);
-int base64_encode_close(unsigned char *in, int inlen, unsigned char *out, int *state, int *save);
-
-int quoted_decode_step(unsigned char *in, int len, unsigned char *out, int *savestate, int *saveme);
-
-int quoted_encode_step(unsigned char *in, int len, unsigned char *out, int *state, int *save);
-int quoted_encode_close(unsigned char *in, int len, unsigned char *out, int *state, int *save);
-
-#endif /* ! _CAMEL_MIME_UTILS_H */
diff --git a/camel/camel-movemail.c b/camel/camel-movemail.c
deleted file mode 100644
index 3ba3ee9efb..0000000000
--- a/camel/camel-movemail.c
+++ /dev/null
@@ -1,500 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-movemail.c: mbox copying function */
-
-/*
- * Author:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-
-#include <sys/stat.h>
-#include <sys/uio.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "camel-movemail.h"
-#include "camel-exception.h"
-
-#include "camel-mime-parser.h"
-#include "camel-mime-filter.h"
-#include "camel-mime-filter-from.h"
-
-#define d(x)
-
-/* these could probably be exposed as a utility? (but only mbox needs it) */
-static int camel_movemail_copy_filter(int fromfd, int tofd, off_t start, size_t bytes, CamelMimeFilter *filter);
-static int camel_movemail_copy(int fromfd, int tofd, off_t start, size_t bytes);
-
-/**
- * camel_movemail: Copy an mbox file from a shared spool directory to a
- * new folder in a Camel store
- * @source: source file
- * @dest: destination file
- * @ex: a CamelException
- *
- * This copies an mbox file from a shared directory with multiple
- * readers and writers into a private (presumably Camel-controlled)
- * directory. Dot locking is used on the source file (but not the
- * destination).
- *
- * Return value: 1 if mail was copied, 0 if the source file contained
- * no mail, -1 if an error occurred.
- **/
-int
-camel_movemail (const char *source, const char *dest, CamelException *ex)
-{
- gboolean locked, error;
- int sfd, dfd, tmpfd;
- char *locktmpfile, *lockfile;
- struct stat st;
- time_t now, timeout;
- int nread, nwrote;
- char buf[BUFSIZ];
-
- camel_exception_clear (ex);
-
- /* Stat and then open the spool file. If it doesn't exist or
- * is empty, the user has no mail. (There's technically a race
- * condition here in that an MDA might have just now locked it
- * to deliver a message, but we don't care. In that case,
- * assuming it's unlocked is equivalent to pretending we were
- * called a fraction earlier.)
- */
- if (stat (source, &st) == -1) {
- if (errno == ENOENT)
- return 0;
-
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not check mail file %s: %s",
- source, g_strerror (errno));
- return -1;
- }
- if (st.st_size == 0)
- return 0;
-
- sfd = open (source, O_RDWR);
- if (sfd == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not open mail file %s: %s",
- source, g_strerror (errno));
- return -1;
- }
-
- dfd = open (dest, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
- if (dfd == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not open temporary mail "
- "file %s: %s", dest, g_strerror (errno));
- close (sfd);
- return -1;
- }
-
- /* Create the unique lock file. */
- locktmpfile = g_strdup_printf ("%s.lock.XXXXXX", source);
-#ifdef HAVE_MKSTEMP
- tmpfd = mkstemp (locktmpfile);
-#else
- if (mktemp (locktmpfile)) {
- tmpfd = open (locktmpfile, O_RDWR | O_CREAT | O_EXCL,
- S_IRUSR | S_IWUSR);
- } else
- tmpfd = -1;
-#endif
- if (tmpfd == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not create lock file "
- "for %s: %s", source, g_strerror (errno));
- close (sfd);
- close (dfd);
- unlink (dest);
- return -1;
- }
- close (tmpfd);
-
- lockfile = g_strdup_printf ("%s.lock", source);
- locked = FALSE;
- time (&timeout);
- timeout += 30;
-
- /* Loop trying to lock the file for 30 seconds. */
- while (time (&now) < timeout) {
- /* Try to make the lock. */
- if (symlink (locktmpfile, lockfile) == 0) {
- locked = TRUE;
- break;
- }
-
- /* If we fail for a reason other than that someone
- * else has the lock, then abort.
- */
- if (errno != EEXIST) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not create lock "
- "file for %s: %s", source,
- g_strerror (errno));
- break;
- }
-
- /* Check the modtime on the lock file. */
- if (stat (lockfile, &st) == -1) {
- /* If the lockfile disappeared, try again. */
- if (errno == ENOENT)
- continue;
-
- /* Some other error. Abort. */
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not test lock "
- "file for %s: %s", source,
- g_strerror (errno));
- break;
- }
-
- /* If the lock file is stale, remove it and try again. */
- if (st.st_mtime < now - 60) {
- unlink (lockfile);
- continue;
- }
-
- /* Otherwise, sleep and try again. */
- sleep (5);
- }
-
- if (!locked) {
- /* Something has gone awry. */
- if (now >= timeout) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Timed out trying to get "
- "lock file on %s. Try again "
- "later.", source);
- }
- g_free (lockfile);
- unlink (locktmpfile);
- g_free (locktmpfile);
- close (sfd);
- close (dfd);
- unlink (dest);
- return -1;
- }
-
- /* OK. We have the file locked now. */
-
- /* FIXME: Set a timer to keep the file locked. */
-
- error = FALSE;
- while (1) {
- int written = 0;
-
- nread = read (sfd, buf, sizeof (buf));
- if (nread == 0)
- break;
- else if (nread == -1) {
- if (errno == EINTR)
- continue;
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Error reading mail file: %s",
- g_strerror (errno));
- error = TRUE;
- break;
- }
-
- while (nread) {
- nwrote = write (dfd, buf + written, nread);
- if (nwrote == -1) {
- if (errno == EINTR)
- continue; /* continues inner loop */
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Error writing "
- "mail temp file: %s",
- g_strerror (errno));
- error = TRUE;
- break;
- }
- written += nwrote;
- nread -= nwrote;
- }
- }
-
- /* If no errors occurred copying the data, and we successfully
- * close the destination file, then truncate the source file.
- * If there is some sort of error, delete the destination file.
- */
- if (!error) {
- if (close (dfd) == 0)
- ftruncate (sfd, 0);
- else {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Failed to store mail in "
- "temp file %s: %s", dest,
- g_strerror (errno));
- unlink (dest);
- error = TRUE;
- }
- } else {
- close (dfd);
- unlink (dest);
- }
- close (sfd);
-
- /* Clean up lock files. */
- unlink (lockfile);
- g_free (lockfile);
- unlink (locktmpfile);
- g_free (locktmpfile);
-
- return error ? -1 : 1;
-}
-
-static int
-camel_movemail_copy(int fromfd, int tofd, off_t start, size_t bytes)
-{
- char buffer[4096];
- int written = 0;
-
- d(printf("writing %d bytes ... ", bytes));
-
- if (lseek(fromfd, start, SEEK_SET) != start)
- return -1;
-
- while (bytes>0) {
- int toread, towrite;
-
- toread = bytes;
- if (bytes>4096)
- toread = 4096;
- else
- toread = bytes;
- do {
- towrite = read(fromfd, buffer, toread);
- } while (towrite == -1 && errno == EINTR);
-
- if (towrite == -1)
- return -1;
-
- /* check for 'end of file' */
- if (towrite == 0) {
- d(printf("end of file?\n"));
- break;
- }
-
- do {
- toread = write(tofd, buffer, towrite);
- } while (toread == -1 && errno == EINTR);
-
- if (toread == -1)
- return -1;
-
- written += toread;
- bytes -= toread;
- }
-
- d(printf("written %d bytes\n", written));
-
- return written;
-}
-
-#define PRE_SIZE (32)
-
-static int
-camel_movemail_copy_filter(int fromfd, int tofd, off_t start, size_t bytes, CamelMimeFilter *filter)
-{
- char buffer[4096+PRE_SIZE];
- int written = 0;
- char *filterbuffer;
- int filterlen, filterpre;
-
- d(printf("writing %d bytes ... ", bytes));
-
- camel_mime_filter_reset(filter);
-
- if (lseek(fromfd, start, SEEK_SET) != start)
- return -1;
-
- while (bytes>0) {
- int toread, towrite;
-
- toread = bytes;
- if (bytes>4096)
- toread = 4096;
- else
- toread = bytes;
- do {
- towrite = read(fromfd, buffer+PRE_SIZE, toread);
- } while (towrite == -1 && errno == EINTR);
-
- if (towrite == -1)
- return -1;
-
- /* check for 'end of file' */
- if (towrite == 0) {
- d(printf("end of file?\n"));
- camel_mime_filter_complete(filter, buffer+PRE_SIZE, towrite, PRE_SIZE,
- &filterbuffer, &filterlen, &filterpre);
- towrite = filterlen;
- if (towrite == 0)
- break;
- } else {
- camel_mime_filter_filter(filter, buffer+PRE_SIZE, towrite, PRE_SIZE,
- &filterbuffer, &filterlen, &filterpre);
- towrite = filterlen;
- }
-
- do {
- toread = write(tofd, filterbuffer, towrite);
- } while (toread == -1 && errno == EINTR);
-
- if (toread == -1)
- return -1;
-
- written += toread;
- bytes -= toread;
- }
-
- d(printf("written %d bytes\n", written));
-
- return written;
-}
-
-/* write the headers back out again, but not he Content-Length header, because we dont
- want to maintain it! */
-static int
-solaris_header_write(int fd, struct _header_raw *header)
-{
- struct iovec iv[4];
- int outlen = 0, len;
-
- iv[1].iov_base = ":";
- iv[1].iov_len = 1;
- iv[3].iov_base = "\n";
- iv[3].iov_len = 1;
-
- while (header) {
- if (strcasecmp(header->name, "Content-Length")) {
- iv[0].iov_base = header->name;
- iv[0].iov_len = strlen(header->name);
- iv[2].iov_base = header->value;
- iv[2].iov_len = strlen(header->value);
-
- do {
- len = writev(fd, iv, 4);
- } while (len == -1 && errno == EINTR);
-
- if (len == -1)
- return -1;
- outlen += len;
- }
- header = header->next;
- }
-
- do {
- len = write(fd, "\n", 1);
- } while (len == -1 && errno == EINTR);
-
- if (len == -1)
- return -1;
-
- outlen += 1;
-
- d(printf("Wrote %d bytes of headers\n", outlen));
-
- return outlen;
-}
-
-/* Well, since Solaris is a tad broken wrt its 'mbox' folder format,
- we must convert it to a real mbox format. Thankfully this is
- mostly pretty easy */
-static int
-camel_movemail_solaris (int sfd, int dfd, CamelException *ex)
-{
- CamelMimeParser *mp;
- char *buffer;
- int len;
- CamelMimeFilterFrom *ffrom;
- int ret = 1;
-
- mp = camel_mime_parser_new();
- camel_mime_parser_scan_from(mp, TRUE);
- camel_mime_parser_init_with_fd(mp, sfd);
-
- ffrom = camel_mime_filter_from_new();
-
- while (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_FROM) {
- if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_FROM_END) {
- const char *cl;
- int length;
- int start, body;
- off_t newpos;
-
- ret = 0;
-
- start = camel_mime_parser_tell_start_from(mp);
- body = camel_mime_parser_tell(mp);
-
- /* write out headers, but NOT content-length header */
- solaris_header_write(dfd, camel_mime_parser_headers_raw(mp));
-
- cl = camel_mime_parser_header(mp, "content-length", NULL);
- if (cl == NULL) {
- g_warning("Required Content-Length header is missing from solaris mail box @ %d", (int)camel_mime_parser_tell(mp));
- camel_mime_parser_drop_step(mp);
- camel_mime_parser_drop_step(mp);
- camel_mime_parser_step(mp, &buffer, &len);
- camel_mime_parser_unstep(mp);
- length = camel_mime_parser_tell_start_from(mp) - body;
- newpos = -1;
- } else {
- length = atoi(cl);
- camel_mime_parser_drop_step(mp);
- camel_mime_parser_drop_step(mp);
- newpos = length+body;
- }
- /* copy body->length converting From lines */
- if (camel_movemail_copy_filter(sfd, dfd, body, length, (CamelMimeFilter *)ffrom) == -1)
- goto fail;
- if (newpos != -1)
- camel_mime_parser_seek(mp, newpos, SEEK_SET);
- } else {
- g_error("Inalid parser state: %d", camel_mime_parser_state(mp));
- }
- }
-
- gtk_object_unref((GtkObject *)mp);
- gtk_object_unref((GtkObject *)ffrom);
-
- return ret;
-
-fail:
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Error copying "
- "mail temp file: %s",
- g_strerror (errno));
-
-
- gtk_object_unref((GtkObject *)mp);
- gtk_object_unref((GtkObject *)ffrom);
-
- return -1;
-}
-
diff --git a/camel/camel-movemail.h b/camel/camel-movemail.h
deleted file mode 100644
index ea75c82603..0000000000
--- a/camel/camel-movemail.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-movemail.h: mbox copy function */
-
-/*
- * Author:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MOVEMAIL_H
-#define CAMEL_MOVEMAIL_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-exception.h>
-
-int camel_movemail (const char *source, const char *dest, CamelException *ex);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MOVEMAIL_H */
diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c
deleted file mode 100644
index ea1f7d356f..0000000000
--- a/camel/camel-multipart.c
+++ /dev/null
@@ -1,467 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-multipart.c : Abstract class for a multipart */
-
-#warning This should be a mostly abstract class, but it is not!
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "gmime-content-field.h"
-#include "camel-stream-mem.h"
-#include "camel-multipart.h"
-#include "camel-mime-part.h"
-#include "camel-exception.h"
-
-#define d(x)
-
-static void add_part (CamelMultipart *multipart,
- CamelMimePart *part);
-static void add_part_at (CamelMultipart *multipart,
- CamelMimePart *part,
- guint index);
-static void remove_part (CamelMultipart *multipart,
- CamelMimePart *part);
-static CamelMimePart * remove_part_at (CamelMultipart *multipart,
- guint index);
-static CamelMimePart * get_part (CamelMultipart *multipart,
- guint index);
-static guint get_number (CamelMultipart *multipart);
-static void set_boundary (CamelMultipart *multipart,
- gchar *boundary);
-static const gchar * get_boundary (CamelMultipart *multipart);
-static int write_to_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-static void finalize (GtkObject *object);
-
-static CamelDataWrapperClass *parent_class = NULL;
-
-
-
-/* Returns the class for a CamelMultipart */
-#define CMP_CLASS(so) CAMEL_MULTIPART_CLASS (GTK_OBJECT(so)->klass)
-
-/* Returns the class for a CamelDataWrapper */
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void
-camel_multipart_class_init (CamelMultipartClass *camel_multipart_class)
-{
- CamelDataWrapperClass *camel_data_wrapper_class =
- CAMEL_DATA_WRAPPER_CLASS (camel_multipart_class);
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_multipart_class);
-
- parent_class = gtk_type_class (camel_data_wrapper_get_type ());
-
- /* virtual method definition */
- camel_multipart_class->add_part = add_part;
- camel_multipart_class->add_part_at = add_part_at;
- camel_multipart_class->remove_part = remove_part;
- camel_multipart_class->remove_part_at = remove_part_at;
- camel_multipart_class->get_part = get_part;
- camel_multipart_class->get_number = get_number;
- camel_multipart_class->set_boundary = set_boundary;
- camel_multipart_class->get_boundary = get_boundary;
-
- /* virtual method overload */
- camel_data_wrapper_class->write_to_stream = write_to_stream;
-
- gtk_object_class->finalize = finalize;
-}
-
-static void
-camel_multipart_init (gpointer object, gpointer klass)
-{
- CamelMultipart *multipart = CAMEL_MULTIPART (object);
-
- camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (multipart),
- "multipart/mixed");
- camel_multipart_set_boundary (multipart, "=-=-=-=");
- multipart->preface = NULL;
- multipart->postface = NULL;
-}
-
-
-GtkType
-camel_multipart_get_type (void)
-{
- static GtkType camel_multipart_type = 0;
-
- if (!camel_multipart_type) {
- GtkTypeInfo camel_multipart_info =
- {
- "CamelMultipart",
- sizeof (CamelMultipart),
- sizeof (CamelMultipartClass),
- (GtkClassInitFunc) camel_multipart_class_init,
- (GtkObjectInitFunc) camel_multipart_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_multipart_type = gtk_type_unique (camel_data_wrapper_get_type (), &camel_multipart_info);
- }
-
- return camel_multipart_type;
-}
-
-static void
-unref_part (gpointer data, gpointer user_data)
-{
- GtkObject *part = GTK_OBJECT (data);
-
- gtk_object_unref (part);
-}
-
-static void
-finalize (GtkObject *object)
-{
- CamelMultipart *multipart = CAMEL_MULTIPART (object);
-
- g_list_foreach (multipart->parts, unref_part, NULL);
-
- if (multipart->boundary)
- g_free (multipart->boundary);
- if (multipart->preface)
- g_free (multipart->preface);
- if (multipart->postface)
- g_free (multipart->postface);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-
-/**
- * camel_multipart_new:
- *
- * Create a new CamelMultipart object.
- *
- * Return value: a new CamelMultipart
- **/
-CamelMultipart *
-camel_multipart_new (void)
-{
- CamelMultipart *multipart;
-
- multipart = (CamelMultipart *)gtk_type_new (CAMEL_MULTIPART_TYPE);
- multipart->preface = NULL;
- multipart->postface = NULL;
-
- return multipart;
-}
-
-
-static void
-add_part (CamelMultipart *multipart, CamelMimePart *part)
-{
- multipart->parts = g_list_append (multipart->parts, part);
- gtk_object_ref (GTK_OBJECT (part));
-}
-
-/**
- * camel_multipart_add_part:
- * @multipart: a CamelMultipart
- * @part: the part to add
- *
- * Appends the part to the multipart object.
- **/
-void
-camel_multipart_add_part (CamelMultipart *multipart, CamelMimePart *part)
-{
- g_return_if_fail (CAMEL_IS_MULTIPART (multipart));
- g_return_if_fail (CAMEL_IS_MIME_PART (part));
-
- CMP_CLASS (multipart)->add_part (multipart, part);
-}
-
-
-static void
-add_part_at (CamelMultipart *multipart, CamelMimePart *part, guint index)
-{
- multipart->parts = g_list_insert (multipart->parts, part, index);
- gtk_object_ref (GTK_OBJECT (part));
-}
-
-/**
- * camel_multipart_add_part_at:
- * @multipart: a CamelMultipart
- * @part: the part to add
- * @index: index to add the multipart at
- *
- * Adds the part to the multipart object after the @index'th
- * element. If @index is greater than the number of parts, it is
- * equivalent to camel_multipart_add_part().
- **/
-void
-camel_multipart_add_part_at (CamelMultipart *multipart,
- CamelMimePart *part, guint index)
-{
- g_return_if_fail (CAMEL_IS_MULTIPART (multipart));
- g_return_if_fail (CAMEL_IS_MIME_PART (part));
-
- CMP_CLASS (multipart)->add_part_at (multipart, part, index);
-}
-
-
-static void
-remove_part (CamelMultipart *multipart, CamelMimePart *part)
-{
- if (!multipart->parts)
- return;
- multipart->parts = g_list_remove (multipart->parts, part);
- gtk_object_unref (GTK_OBJECT (part));
-}
-
-/**
- * camel_multipart_remove_part:
- * @multipart: a CamelMultipart
- * @part: the part to remove
- *
- * Removes @part from @multipart.
- **/
-void
-camel_multipart_remove_part (CamelMultipart *multipart,
- CamelMimePart *part)
-{
- g_return_if_fail (CAMEL_IS_MULTIPART (multipart));
- g_return_if_fail (CAMEL_IS_MIME_PART (part));
-
- CMP_CLASS (multipart)->remove_part (multipart, part);
-}
-
-
-static CamelMimePart *
-remove_part_at (CamelMultipart *multipart, guint index)
-{
- GList *parts_list;
- GList *part_to_remove;
- CamelMimePart *removed_part;
-
- if (!(multipart->parts))
- return NULL;
-
- parts_list = multipart->parts;
- part_to_remove = g_list_nth (parts_list, index);
- if (!part_to_remove) {
- g_warning ("CamelMultipart::remove_part_at: "
- "part to remove is NULL\n");
- return NULL;
- }
- removed_part = CAMEL_MIME_PART (part_to_remove->data);
-
- multipart->parts = g_list_remove_link (parts_list, part_to_remove);
- if (part_to_remove->data)
- gtk_object_unref (GTK_OBJECT (part_to_remove->data));
- g_list_free_1 (part_to_remove);
-
- return removed_part;
-}
-
-/**
- * camel_multipart_remove_part_at:
- * @multipart: a CamelMultipart
- * @index: a zero-based index indicating the part to remove
- *
- * Remove the indicated part from the multipart object.
- *
- * Return value: the removed part. Note that it is gtk_object_unref()ed
- * before being returned, which may cause it to be destroyed.
- **/
-CamelMimePart *
-camel_multipart_remove_part_at (CamelMultipart *multipart, guint index)
-{
- g_return_val_if_fail (CAMEL_IS_MULTIPART (multipart), NULL);
-
- return CMP_CLASS (multipart)->remove_part_at (multipart, index);
-}
-
-
-static CamelMimePart *
-get_part (CamelMultipart *multipart, guint index)
-{
- GList *part;
-
- if (!(multipart->parts))
- return NULL;
-
- part = g_list_nth (multipart->parts, index);
- if (part)
- return CAMEL_MIME_PART (part->data);
- else
- return NULL;
-}
-
-/**
- * camel_multipart_get_part:
- * @multipart: a CamelMultipart
- * @index: a zero-based index indicating the part to get
- *
- * Return value: the indicated subpart, or %NULL
- **/
-CamelMimePart *
-camel_multipart_get_part (CamelMultipart *multipart, guint index)
-{
- g_return_val_if_fail (CAMEL_IS_MULTIPART (multipart), NULL);
-
- return CMP_CLASS (multipart)->get_part (multipart, index);
-}
-
-
-static guint
-get_number (CamelMultipart *multipart)
-{
- return g_list_length (multipart->parts);
-}
-
-/**
- * camel_multipart_get_number:
- * @multipart: a CamelMultipart
- *
- * Return value: the number of subparts in @multipart
- **/
-guint
-camel_multipart_get_number (CamelMultipart *multipart)
-{
- g_return_val_if_fail (CAMEL_IS_MULTIPART (multipart), 0);
-
- return CMP_CLASS (multipart)->get_number (multipart);
-}
-
-
-static void
-set_boundary (CamelMultipart *multipart, gchar *boundary)
-{
- CamelDataWrapper *cdw = CAMEL_DATA_WRAPPER (multipart);
-
- g_return_if_fail (cdw->mime_type != NULL);
-
- gmime_content_field_set_parameter (cdw->mime_type, "boundary",
- boundary);
-}
-
-/**
- * camel_multipart_set_boundary:
- * @multipart: a CamelMultipart
- * @boundary: the message boundary
- *
- * Sets the message boundary for @multipart to @boundary. This should
- * be a string which does not occur anywhere in any of @multipart's
- * subparts.
- **/
-void
-camel_multipart_set_boundary (CamelMultipart *multipart, gchar *boundary)
-{
- g_return_if_fail (CAMEL_IS_MULTIPART (multipart));
- g_return_if_fail (boundary != NULL);
-
- CMP_CLASS (multipart)->set_boundary (multipart, boundary);
-}
-
-
-static const gchar *
-get_boundary (CamelMultipart *multipart)
-{
- CamelDataWrapper *cdw = CAMEL_DATA_WRAPPER (multipart);
-
- g_return_val_if_fail (cdw->mime_type != NULL, NULL);
- return gmime_content_field_get_parameter (cdw->mime_type, "boundary");
-}
-
-/**
- * camel_multipart_get_boundary:
- * @multipart: a CamelMultipart
- *
- * Return value: @multipart's message boundary
- **/
-const gchar *
-camel_multipart_get_boundary (CamelMultipart *multipart)
-{
- return CMP_CLASS (multipart)->get_boundary (multipart);
-}
-
-/* this is MIME specific, doesn't belong here really */
-static int
-write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelMultipart *multipart = CAMEL_MULTIPART (data_wrapper);
- const gchar *boundary;
- int total = 0;
- int count;
- GList *node;
-
- /* get the bundary text */
- boundary = camel_multipart_get_boundary (multipart);
-
- /* we cannot write a multipart without a boundary string */
- g_return_val_if_fail (boundary && *boundary, -1);
-
- /*
- * write the preface text (usually something like
- * "This is a mime message, if you see this, then
- * your mail client probably doesn't support ...."
- */
- if (multipart->preface) {
- count = camel_stream_write_string (stream, multipart->preface);
- if (count == -1)
- return -1;
- total += count;
- }
-
- /*
- * Now, write all the parts, separated by the boundary
- * delimiter
- */
- node = multipart->parts;
- while (node) {
- count = camel_stream_printf (stream, "\n--%s\n", boundary);
- if (count == -1)
- return -1;
- total += count;
-
- count = camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (node->data), stream);
- if (count == -1)
- return -1;
- total += count;
- node = node->next;
- }
-
- /* write the terminating boudary delimiter */
- count = camel_stream_printf (stream, "\n--%s--\n", boundary);
- if (count == -1)
- return -1;
- total += count;
-
- /* and finally the postface */
- if (multipart->postface) {
- count = camel_stream_write_string (stream, multipart->postface);
- if (count == -1)
- return -1;
- total += count;
- }
-
- return total;
-}
diff --git a/camel/camel-multipart.h b/camel/camel-multipart.h
deleted file mode 100644
index 709e73e51d..0000000000
--- a/camel/camel-multipart.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-multipart.h : class for a multipart */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MULTIPART_H
-#define CAMEL_MULTIPART_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-data-wrapper.h>
-
-#define CAMEL_MULTIPART_TYPE (camel_multipart_get_type ())
-#define CAMEL_MULTIPART(obj) (GTK_CHECK_CAST((obj), CAMEL_MULTIPART_TYPE, CamelMultipart))
-#define CAMEL_MULTIPART_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MULTIPART_TYPE, CamelMultipartClass))
-#define CAMEL_IS_MULTIPART(o) (GTK_CHECK_TYPE((o), CAMEL_MULTIPART_TYPE))
-
-
-struct _CamelMultipart
-{
- CamelDataWrapper parent_object;
-
- CamelMimePart *parent;
- GList *parts;
- gchar *boundary;
- gchar *preface;
- gchar *postface;
-
-};
-
-
-
-typedef struct {
- CamelDataWrapperClass parent_class;
-
- /* Virtual methods */
- void (*add_part) (CamelMultipart *multipart, CamelMimePart *part);
- void (*add_part_at) (CamelMultipart *multipart, CamelMimePart *part, guint index);
- void (*remove_part) (CamelMultipart *multipart, CamelMimePart *part);
- CamelMimePart * (*remove_part_at) (CamelMultipart *multipart, guint index);
- CamelMimePart * (*get_part) (CamelMultipart *multipart, guint index);
- guint (*get_number) (CamelMultipart *multipart);
- void (*set_boundary) (CamelMultipart *multipart, gchar *boundary);
- const gchar * (*get_boundary) (CamelMultipart *multipart);
-
-} CamelMultipartClass;
-
-
-/* Standard Gtk function */
-GtkType camel_multipart_get_type (void);
-
-
-/* public methods */
-CamelMultipart * camel_multipart_new (void);
-void camel_multipart_add_part (CamelMultipart *multipart,
- CamelMimePart *part);
-void camel_multipart_add_part_at (CamelMultipart *multipart,
- CamelMimePart *part,
- guint index);
-void camel_multipart_remove_part (CamelMultipart *multipart,
- CamelMimePart *part);
-CamelMimePart * camel_multipart_remove_part_at (CamelMultipart *multipart,
- guint index);
-CamelMimePart * camel_multipart_get_part (CamelMultipart *multipart,
- guint index);
-guint camel_multipart_get_number (CamelMultipart *multipart);
-void camel_multipart_set_boundary (CamelMultipart *multipart,
- gchar *boundary);
-const gchar * camel_multipart_get_boundary (CamelMultipart *multipart);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MULTIPART_H */
-
diff --git a/camel/camel-news-address.c b/camel/camel-news-address.c
deleted file mode 100644
index 671f0a5559..0000000000
--- a/camel/camel-news-address.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "camel-news-address.h"
-
-
-static void camel_news_address_class_init (CamelNewsAddressClass *klass);
-static void camel_news_address_init (CamelNewsAddress *obj);
-
-static CamelAddressClass *camel_news_address_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_news_address_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelNewsAddress",
- sizeof (CamelNewsAddress),
- sizeof (CamelNewsAddressClass),
- (GtkClassInitFunc) camel_news_address_class_init,
- (GtkObjectInitFunc) camel_news_address_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_address_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-camel_news_address_class_init (CamelNewsAddressClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- camel_news_address_parent = gtk_type_class (camel_address_get_type ());
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_news_address_init (CamelNewsAddress *obj)
-{
-}
-
-/**
- * camel_news_address_new:
- *
- * Create a new CamelNewsAddress object.
- *
- * Return value: A new CamelNewsAddress widget.
- **/
-CamelNewsAddress *
-camel_news_address_new (void)
-{
- CamelNewsAddress *new = CAMEL_NEWS_ADDRESS ( gtk_type_new (camel_news_address_get_type ()));
- return new;
-}
diff --git a/camel/camel-news-address.h b/camel/camel-news-address.h
deleted file mode 100644
index e25f907351..0000000000
--- a/camel/camel-news-address.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _CAMEL_NEWS_ADDRESS_H
-#define _CAMEL_NEWS_ADDRESS_H
-
-#include <camel/camel-address.h>
-
-#define CAMEL_NEWS_ADDRESS(obj) GTK_CHECK_CAST (obj, camel_news_address_get_type (), CamelNewsAddress)
-#define CAMEL_NEWS_ADDRESS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_news_address_get_type (), CamelNewsAddressClass)
-#define IS_CAMEL_NEWS_ADDRESS(obj) GTK_CHECK_TYPE (obj, camel_news_address_get_type ())
-
-typedef struct _CamelNewsAddressClass CamelNewsAddressClass;
-
-struct _CamelNewsAddress {
- CamelAddress parent;
-
- struct _CamelNewsAddressPrivate *priv;
-};
-
-struct _CamelNewsAddressClass {
- CamelAddressClass parent_class;
-};
-
-guint camel_news_address_get_type (void);
-CamelNewsAddress *camel_news_address_new (void);
-
-#endif /* ! _CAMEL_NEWS_ADDRESS_H */
diff --git a/camel/camel-object.c b/camel/camel-object.c
deleted file mode 100644
index 3edce10d8a..0000000000
--- a/camel/camel-object.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-object.c: Base class for Camel */
-
-/*
- * Author:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel-object.h"
-
-static void
-camel_object_init (gpointer object, gpointer klass)
-{
- GTK_OBJECT_UNSET_FLAGS (object, GTK_FLOATING);
-}
-
-GtkType
-camel_object_get_type (void)
-{
- static GtkType camel_object_type = 0;
-
- if (!camel_object_type) {
- GtkTypeInfo camel_object_info =
- {
- "CamelObject",
- sizeof (CamelObject),
- sizeof (CamelObjectClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) camel_object_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_object_type = gtk_type_unique (gtk_object_get_type (), &camel_object_info);
- }
-
- return camel_object_type;
-}
diff --git a/camel/camel-object.h b/camel/camel-object.h
deleted file mode 100644
index 2c6b4d0d5c..0000000000
--- a/camel/camel-object.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-object.h: Base class for Camel */
-
-/*
- * Author:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef CAMEL_OBJECT_H
-#define CAMEL_OBJECT_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <camel/camel-types.h>
-
-#define CAMEL_OBJECT_TYPE (camel_object_get_type ())
-#define CAMEL_OBJECT(obj) (GTK_CHECK_CAST((obj), CAMEL_OBJECT_TYPE, CamelObject))
-#define CAMEL_OBJECT_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_OBJECT_TYPE, CamelObjectClass))
-#define CAMEL_IS_OBJECT(o) (GTK_CHECK_TYPE((o), CAMEL_OBJECT_TYPE))
-
-
-struct _CamelObject
-{
- GtkObject parent_object;
-
-};
-
-
-typedef struct {
- GtkObjectClass parent_class;
-
-} CamelObjectClass;
-
-
-/* Standard Gtk function */
-GtkType camel_object_get_type (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_OBJECT_H */
diff --git a/camel/camel-op-queue.c b/camel/camel-op-queue.c
deleted file mode 100644
index 3e17222f0a..0000000000
--- a/camel/camel-op-queue.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-/* MT safe */
-
-
-#include <config.h>
-#include "camel-op-queue.h"
-
-static GStaticMutex op_queue_mutex = G_STATIC_MUTEX_INIT;
-
-
-
-/**
- * camel_op_queue_new: create a new operation queue
- *
- * Create a new operation queue.
- *
- * Return value: the newly allcated object
- **/
-CamelOpQueue *
-camel_op_queue_new ()
-{
- CamelOpQueue *op_queue;
-
- op_queue = g_new (CamelOpQueue, 1);
- op_queue->ops_tail = NULL;
- op_queue->ops_head = NULL;
- op_queue->service_available = TRUE;
-
- return op_queue;
-}
-
-
-void
-camel_op_queue_free (CamelOpQueue *op_queue)
-{
- g_list_free (op_queue->ops_head);
- g_free (op_queue);
-}
-
-/**
- * camel_op_queue_push_op: Add an operation to the queue
- * @queue: queue object
- * @op: operation to add
- *
- * Add an operation to an operation queue.
- * The queue is a FIFO queue.
- **/
-void
-camel_op_queue_push_op (CamelOpQueue *queue, CamelOp *op)
-{
- g_assert (queue);
- g_static_mutex_lock (&op_queue_mutex);
- if (!queue->ops_tail) {
- queue->ops_head = g_list_prepend (NULL, op);
- queue->ops_tail = queue->ops_head;
- } else
- queue->ops_head = g_list_prepend (queue->ops_head, op);
- g_static_mutex_unlock (&op_queue_mutex);
-}
-
-
-/**
- * camel_op_queue_pop_op: Pop the next operation pending in the queue
- * @queue: queue object
- *
- * Pop the next operation pending in the queue.
- *
- * Return value:
- **/
-CamelOp *
-camel_op_queue_pop_op (CamelOpQueue *queue)
-{
- GList *op_list;
- CamelOp *op;
-
- g_assert (queue);
-
- g_static_mutex_lock (&op_queue_mutex);
- op_list = queue->ops_tail;
- if (!op_list) return NULL;
-
- queue->ops_tail = queue->ops_tail->prev;
- op = (CamelOp *)op_list->data;
- g_static_mutex_unlock (&op_queue_mutex);
-
- return op;
-}
-
-
-/**
- * camel_op_queue_run_next_op: run the next pending operation
- * @queue: queue object
- *
- * Run the next pending operation in the queue.
- *
- * Return value: TRUE if an operation was launched FALSE if there was no operation pending in the queue.
- **/
-gboolean
-camel_op_queue_run_next_op (CamelOpQueue *queue)
-{
- CamelOp *op;
-
- op = camel_op_queue_pop_op (queue);
- if (!op) return FALSE;
-
- return FALSE;
-}
-
-/**
- * camel_op_queue_set_service_availability: set the service availability for an operation queue
- * @queue: queue object
- * @available: availability flag
- *
- * set the service availability
- **/
-void
-camel_op_queue_set_service_availability (CamelOpQueue *queue, gboolean available)
-{
- g_static_mutex_lock (&op_queue_mutex);
- queue->service_available = available;
- g_static_mutex_unlock (&op_queue_mutex);
-}
-
-/**
- * camel_op_queue_get_service_availability: determine if an operation queue service is available
- * @queue: queue object
- *
- * Determine if the service associated to an operation queue is available.
- *
- * Return value: service availability.
- **/
-gboolean
-camel_op_queue_get_service_availability (CamelOpQueue *queue)
-{
- gboolean available;
-
- g_static_mutex_lock (&op_queue_mutex);
- available = queue->service_available;
- g_static_mutex_unlock (&op_queue_mutex);
- return available;
-}
-
diff --git a/camel/camel-op-queue.h b/camel/camel-op-queue.h
deleted file mode 100644
index 49fdc152d3..0000000000
--- a/camel/camel-op-queue.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_OP_QUEUE_H
-#define CAMEL_OP_QUEUE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include <camel/camel-marshal-utils.h>
-
-
-
-typedef struct
-{
- GList *ops_head;
- GList *ops_tail;
- gboolean service_available;
-
-} CamelOpQueue;
-
-
-/* public methods */
-CamelOpQueue *camel_op_queue_new ();
-void camel_op_queue_free (CamelOpQueue *op_queue);
-void camel_op_queue_push_op (CamelOpQueue *queue, CamelOp *op);
-CamelOp *camel_op_queue_pop_op (CamelOpQueue *queue);
-gboolean camel_op_queue_run_next_op (CamelOpQueue *queue);
-gboolean camel_op_queue_get_service_availability (CamelOpQueue *queue);
-void camel_op_queue_set_service_availability (CamelOpQueue *queue, gboolean available);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_OP_QUEUE_H */
-
diff --git a/camel/camel-provider.c b/camel/camel-provider.c
deleted file mode 100644
index 83a51c3579..0000000000
--- a/camel/camel-provider.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-provider.c: provider framework */
-
-/*
- *
- * Authors:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-/* FIXME: Shouldn't we add a version number to providers ? */
-
-#include "config.h"
-#include "camel-provider.h"
-#include "camel-exception.h"
-#include "hash-table-utils.h"
-
-#include <dirent.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <gmodule.h>
-
-char *camel_provider_type_name[CAMEL_NUM_PROVIDER_TYPES] = {
- "store",
- "transport"
-};
-
-/**
- * camel_provider_init:
- *
- * Initialize the Camel provider system by reading in the .urls
- * files in the provider directory and creating a hash table mapping
- * URLs to module names.
- *
- * A .urls file has the same initial prefix as the shared library it
- * correspond to, and consists of a series of lines containing the URL
- * protocols that that library handles.
- *
- * Return value: a hash table mapping URLs to module names
- **/
-GHashTable *
-camel_provider_init (void)
-{
- GHashTable *providers;
- DIR *dir;
- struct dirent *d;
- char *p, *name, buf[80];
- FILE *f;
-
- providers = g_hash_table_new (g_strcase_hash, g_strcase_equal);
-
- dir = opendir (CAMEL_PROVIDERDIR);
- if (!dir) {
- g_error ("Could not open camel provider directory: %s",
- g_strerror (errno));
- return NULL;
- }
-
- while ((d = readdir (dir))) {
- p = strchr (d->d_name, '.');
- if (!p || strcmp (p, ".urls") != 0)
- continue;
-
- name = g_strdup_printf ("%s/%s", CAMEL_PROVIDERDIR, d->d_name);
- f = fopen (name, "r");
- if (!f) {
- g_warning ("Could not read provider info file %s: %s",
- name, g_strerror (errno));
- g_free (name);
- continue;
- }
-
- p = strrchr (name, '.');
- strcpy (p, ".so");
- while ((fgets (buf, sizeof (buf), f))) {
- buf[sizeof (buf) - 1] = '\0';
- p = strchr (buf, '\n');
- if (p)
- *p = '\0';
-
- g_hash_table_insert (providers, g_strdup (buf), name);
- }
- fclose (f);
- }
-
- closedir (dir);
- return providers;
-}
-
-/**
- * camel_provider_load:
- * @session: the current session
- * @path: the path to a shared library
- * @ex: a CamelException
- *
- * Loads the provider at @path, and calls its initialization function,
- * passing @session as an argument. The provider should then register
- * itself with @session.
- **/
-void
-camel_provider_load (CamelSession *session, const char *path,
- CamelException *ex)
-{
- GModule *module;
- CamelProvider *(*camel_provider_module_init) ();
-
- if (!g_module_supported ()) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not load %s: Module loading "
- "not supported on this system.",
- path);
- return;
- }
-
- module = g_module_open (path, 0);
- if (!module) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not load %s: %s",
- path, g_module_error ());
- return;
- }
-
- if (!g_module_symbol (module, "camel_provider_module_init",
- (gpointer *)&camel_provider_module_init)) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not load %s: No initialization "
- "routine in module.", path);
- g_module_close (module);
- return;
- }
-
- camel_provider_module_init (session);
-}
diff --git a/camel/camel-provider.h b/camel/camel-provider.h
deleted file mode 100644
index 463f415d1b..0000000000
--- a/camel/camel-provider.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-provider.h : provider definition */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_PROVIDER_H
-#define CAMEL_PROVIDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <camel/camel-types.h>
-
-#define CAMEL_PROVIDER(obj) ((CamelProvider *)(obj))
-
-typedef enum {
- CAMEL_PROVIDER_STORE,
- CAMEL_PROVIDER_TRANSPORT,
- CAMEL_NUM_PROVIDER_TYPES
-} CamelProviderType;
-
-extern char *camel_provider_type_name[CAMEL_NUM_PROVIDER_TYPES];
-
-#define CAMEL_PROVIDER_IS_REMOTE (1 << 0)
-
-typedef struct {
- /* Provider name used in CamelURLs. */
- char *protocol;
-
- /* Provider name as used by people. (May be the same as protocol) */
- char *name;
-
- /* Description of the provider. A novice user should be able
- * to read this description, and the information provided by
- * an ISP, IS department, etc, and determine whether or not
- * this provider is relevant to him, and if so, which
- * information goes with it.
- */
- char *description;
-
- int flags;
-
- GtkType object_types [CAMEL_NUM_PROVIDER_TYPES];
-} CamelProvider;
-
-GHashTable *camel_provider_init (void);
-void camel_provider_load (CamelSession *session, const char *path,
- CamelException *ex);
-
-/* This is defined by each module, not by camel-provider.c. */
-void camel_provider_module_init (CamelSession *session);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_PROVIDER_H */
diff --git a/camel/camel-seekable-stream.c b/camel/camel-seekable-stream.c
deleted file mode 100644
index 507c69dd48..0000000000
--- a/camel/camel-seekable-stream.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-#include "camel-seekable-stream.h"
-
-static CamelStreamClass *parent_class = NULL;
-
-/* Returns the class for a CamelSeekableStream */
-#define CSS_CLASS(so) CAMEL_SEEKABLE_STREAM_CLASS (GTK_OBJECT(so)->klass)
-
-static off_t seek (CamelSeekableStream *stream, off_t offset,
- CamelStreamSeekPolicy policy);
-static off_t stream_tell (CamelSeekableStream *stream);
-static int reset (CamelStream *stream);
-static int set_bounds (CamelSeekableStream *stream, off_t start, off_t end);
-
-static void
-camel_seekable_stream_class_init (CamelSeekableStreamClass *camel_seekable_stream_class)
-{
- CamelStreamClass *camel_stream_class =
- CAMEL_STREAM_CLASS (camel_seekable_stream_class);
-
- parent_class = gtk_type_class (camel_stream_get_type ());
-
- /* seekable stream methods */
- camel_seekable_stream_class->seek = seek;
- camel_seekable_stream_class->tell = stream_tell;
- camel_seekable_stream_class->set_bounds = set_bounds;
-
- /* camel stream methods overload */
- camel_stream_class->reset = reset;
-}
-
-static void
-camel_seekable_stream_init (void *o)
-{
- CamelSeekableStream *stream = (CamelSeekableStream *)o;
-
- stream->bound_start = 0;
- stream->bound_end = CAMEL_STREAM_UNBOUND;
-}
-
-GtkType
-camel_seekable_stream_get_type (void)
-{
- static GtkType camel_seekable_stream_type = 0;
-
- if (!camel_seekable_stream_type) {
- GtkTypeInfo camel_seekable_stream_info =
- {
- "CamelSeekableStream",
- sizeof (CamelSeekableStream),
- sizeof (CamelSeekableStreamClass),
- (GtkClassInitFunc) camel_seekable_stream_class_init,
- (GtkObjectInitFunc) camel_seekable_stream_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_seekable_stream_type = gtk_type_unique (camel_stream_get_type (), &camel_seekable_stream_info);
- }
-
- return camel_seekable_stream_type;
-}
-
-
-static off_t
-seek (CamelSeekableStream *stream, off_t offset,
- CamelStreamSeekPolicy policy)
-{
- g_warning ("CamelSeekableStream::seek called on default "
- "implementation\n");
- return -1;
-}
-
-/**
- * camel_stream_seek:
- * @stream: a CamelStream object.
- * @offset: offset value
- * @policy: what to do with the offset
- *
- * Seek to the specified position in @stream.
- *
- * If @policy is CAMEL_STREAM_SET, seeks to @offset.
- *
- * If @policy is CAMEL_STREAM_CUR, seeks to the current position plus
- * @offset.
- *
- * If @policy is CAMEL_STREAM_END, seeks to the end of the stream plus
- * @offset.
- *
- * Regardless of @policy, the stream's final position will be clamped
- * to the range specified by its lower and upper bounds, and the
- * stream's eos state will be updated.
- *
- * Return value: new position, -1 if operation failed.
- **/
-off_t
-camel_seekable_stream_seek (CamelSeekableStream *stream, off_t offset,
- CamelStreamSeekPolicy policy)
-{
- g_return_val_if_fail (CAMEL_IS_SEEKABLE_STREAM (stream), -1);
-
- return CSS_CLASS (stream)->seek (stream, offset, policy);
-}
-
-
-static off_t
-stream_tell (CamelSeekableStream *stream)
-{
- return stream->position;
-}
-
-/**
- * camel_seekable_stream_tell:
- * @stream: seekable stream object
- *
- * Get the current position of a seekable stream.
- *
- * Return value: the position.
- **/
-off_t
-camel_seekable_stream_tell (CamelSeekableStream *stream)
-{
- g_return_val_if_fail (CAMEL_IS_SEEKABLE_STREAM (stream), -1);
-
- return CSS_CLASS (stream)->tell (stream);
-}
-
-static int
-set_bounds (CamelSeekableStream *stream, off_t start, off_t end)
-{
- /* store the bounds */
- stream->bound_start = start;
- stream->bound_end = end;
-
- if (start > stream->position)
- return camel_seekable_stream_seek (stream, start, CAMEL_STREAM_SET);
-
- return 0;
-}
-
-/**
- * camel_seekable_stream_set_bounds:
- * @stream: a seekable stream
- * @start: the first valid position
- * @end: the first invalid position, or CAMEL_STREAM_UNBOUND
- *
- * Set the range of valid data this stream is allowed to cover. If
- * there is to be no @end value, then @end should be set to
- * #CAMEL_STREAM_UNBOUND.
- *
- * Return value: -1 on error.
- **/
-int
-camel_seekable_stream_set_bounds (CamelSeekableStream *stream,
- off_t start, off_t end)
-{
- g_return_val_if_fail (CAMEL_IS_SEEKABLE_STREAM (stream), -1);
- g_return_val_if_fail (end == CAMEL_STREAM_UNBOUND || end >= start, -1);
-
- return CSS_CLASS (stream)->set_bounds (stream, start, end);
-}
-
-/* a default implementation of reset for seekable streams */
-static int
-reset (CamelStream *stream)
-{
- CamelSeekableStream *seekable_stream;
-
- seekable_stream = CAMEL_SEEKABLE_STREAM (stream);
-
- return camel_seekable_stream_seek (seekable_stream,
- seekable_stream->bound_start,
- CAMEL_STREAM_SET);
-}
-
-
-
-
-
-
diff --git a/camel/camel-seekable-stream.h b/camel/camel-seekable-stream.h
deleted file mode 100644
index f1cd5cdbca..0000000000
--- a/camel/camel-seekable-stream.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-fs.h :stream based on unix filesystem */
-
-/*
- * Author:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_SEEKABLE_STREAM_H
-#define CAMEL_SEEKABLE_STREAM_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-stream.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#define CAMEL_SEEKABLE_STREAM_TYPE (camel_seekable_stream_get_type ())
-#define CAMEL_SEEKABLE_STREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_SEEKABLE_STREAM_TYPE, CamelSeekableStream))
-#define CAMEL_SEEKABLE_STREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SEEKABLE_STREAM_TYPE, CamelSeekableStreamClass))
-#define CAMEL_IS_SEEKABLE_STREAM(o) (GTK_CHECK_TYPE((o), CAMEL_SEEKABLE_STREAM_TYPE))
-
-
-typedef enum
-{
- CAMEL_STREAM_SET = SEEK_SET,
- CAMEL_STREAM_CUR = SEEK_CUR,
- CAMEL_STREAM_END = SEEK_END
-} CamelStreamSeekPolicy;
-
-#define CAMEL_STREAM_UNBOUND (~0)
-
-struct _CamelSeekableStream
-{
- CamelStream parent_object;
-
- off_t position; /* current postion in the stream */
- off_t bound_start; /* first valid position */
- off_t bound_end; /* first invalid position */
-};
-
-typedef struct {
- CamelStreamClass parent_class;
-
- /* Virtual methods */
- off_t (*seek) (CamelSeekableStream *stream, off_t offset,
- CamelStreamSeekPolicy policy);
- off_t (*tell) (CamelSeekableStream *stream);
- int (*set_bounds) (CamelSeekableStream *stream,
- off_t start, off_t end);
-} CamelSeekableStreamClass;
-
-/* Standard Gtk function */
-GtkType camel_seekable_stream_get_type (void);
-
-/* public methods */
-off_t camel_seekable_stream_seek (CamelSeekableStream *stream, off_t offset,
- CamelStreamSeekPolicy policy);
-off_t camel_seekable_stream_tell (CamelSeekableStream *stream);
-int camel_seekable_stream_set_bounds (CamelSeekableStream *, off_t start, off_t end);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SEEKABLE_STREAM_H */
diff --git a/camel/camel-seekable-substream.c b/camel/camel-seekable-substream.c
deleted file mode 100644
index 4fc5b5d853..0000000000
--- a/camel/camel-seekable-substream.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-fs.c : file system based stream
- *
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-seekable-substream.h"
-
-static CamelSeekableStreamClass *parent_class = NULL;
-
-/* Returns the class for a CamelSeekableSubStream */
-#define CSS_CLASS(so) CAMEL_SEEKABLE_SUBSTREAM_CLASS (GTK_OBJECT(so)->klass)
-
-static int stream_read (CamelStream *stream, char *buffer, unsigned int n);
-static int stream_write (CamelStream *stream, const char *buffer, unsigned int n);
-static int stream_flush (CamelStream *stream);
-static int stream_close (CamelStream *stream);
-static gboolean eos (CamelStream *stream);
-static off_t stream_seek (CamelSeekableStream *stream, off_t offset,
- CamelStreamSeekPolicy policy);
-static void finalize (GtkObject *object);
-
-
-static void
-camel_seekable_substream_class_init (CamelSeekableSubstreamClass *camel_seekable_substream_class)
-{
- CamelSeekableStreamClass *camel_seekable_stream_class =
- CAMEL_SEEKABLE_STREAM_CLASS (camel_seekable_substream_class);
- CamelStreamClass *camel_stream_class =
- CAMEL_STREAM_CLASS (camel_seekable_substream_class);
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_seekable_substream_class);
-
- parent_class = gtk_type_class (camel_seekable_stream_get_type ());
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_stream_class->read = stream_read;
- camel_stream_class->write = stream_write;
- camel_stream_class->flush = stream_flush;
- camel_stream_class->close = stream_close;
- camel_stream_class->eos = eos;
-
- camel_seekable_stream_class->seek = stream_seek;
-
- gtk_object_class->finalize = finalize;
-}
-
-
-GtkType
-camel_seekable_substream_get_type (void)
-{
- static GtkType camel_seekable_substream_type = 0;
-
- if (!camel_seekable_substream_type) {
- GtkTypeInfo camel_seekable_substream_info =
- {
- "CamelSeekableSubstream",
- sizeof (CamelSeekableSubstream),
- sizeof (CamelSeekableSubstreamClass),
- (GtkClassInitFunc) camel_seekable_substream_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_seekable_substream_type = gtk_type_unique (camel_seekable_stream_get_type (), &camel_seekable_substream_info);
- }
-
- return camel_seekable_substream_type;
-}
-
-static void
-finalize (GtkObject *object)
-{
- CamelSeekableSubstream *seekable_substream =
- CAMEL_SEEKABLE_SUBSTREAM (object);
-
- if (seekable_substream->parent_stream)
- gtk_object_unref (GTK_OBJECT (seekable_substream->parent_stream));
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/**
- * camel_seekable_substream_new_with_seekable_stream_and_bounds:
- * @parent_stream: a seekable parent stream
- * @inf_bound: a lower bound
- * @sup_bound: an upper bound
- *
- * Creates a new CamelSeekableSubstream that references the portion
- * of @parent_stream from @inf_bound to @sup_bound. (If @sup_bound is
- * #CAMEL_STREAM_UNBOUND, it references to the end of stream, even if
- * the stream grows.)
- *
- * While the substream is open, the caller cannot assume anything about
- * the current position of @parent_stream. After the substream has been
- * closed, @parent_stream will stabilize again.
- *
- * Return value: the substream
- **/
-CamelStream *
-camel_seekable_substream_new_with_seekable_stream_and_bounds (CamelSeekableStream *parent_stream,
- off_t start, off_t end)
-{
- CamelSeekableSubstream *seekable_substream;
-
- g_return_val_if_fail (CAMEL_IS_SEEKABLE_STREAM (parent_stream), NULL);
-
- /* Create the seekable substream. */
- seekable_substream = gtk_type_new (camel_seekable_substream_get_type ());
-
- /* Initialize it. */
- seekable_substream->parent_stream = parent_stream;
- gtk_object_ref (GTK_OBJECT (parent_stream));
-
- /* Set the bound of the substream. We can ignore any possible error
- * here, because if we fail to seek now, it will try again later.
- */
- camel_seekable_stream_set_bounds ((CamelSeekableStream *)seekable_substream, start, end);
-
- return CAMEL_STREAM (seekable_substream);
-}
-
-static gboolean
-parent_reset (CamelSeekableSubstream *seekable_substream, CamelSeekableStream *parent)
-{
- CamelSeekableStream *seekable_stream =
- CAMEL_SEEKABLE_STREAM (seekable_substream);
-
- if (camel_seekable_stream_tell (parent) == seekable_stream->position)
- return TRUE;
-
- return camel_seekable_stream_seek (parent, seekable_stream->position, CAMEL_STREAM_SET)
- == seekable_stream->position;
-}
-
-static int
-stream_read (CamelStream *stream, char *buffer, unsigned int n)
-{
- CamelSeekableStream *parent;
- CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream);
- CamelSeekableSubstream *seekable_substream =
- CAMEL_SEEKABLE_SUBSTREAM (stream);
- int v;
-
- if (n == 0)
- return 0;
-
- parent = seekable_substream->parent_stream;
-
- /* Go to our position in the parent stream. */
- if (!parent_reset (seekable_substream, parent)) {
- stream->eos = TRUE;
- return 0;
- }
-
- /* Compute how many bytes should be read. */
- if (seekable_stream->bound_end != CAMEL_STREAM_UNBOUND)
- n = MIN (seekable_stream->bound_end - seekable_stream->position, n);
-
- if (n == 0) {
- stream->eos = TRUE;
- return 0;
- }
-
- v = camel_stream_read (CAMEL_STREAM (parent), buffer, n);
-
- /* ignore <0 - its an error, let the caller deal */
- if (v > 0)
- seekable_stream->position += v;
-
- return v;
-}
-
-static int
-stream_write (CamelStream *stream, const char *buffer, unsigned int n)
-{
- /* NOT VALID ON SEEKABLE SUBSTREAM */
- /* Well, its entirely valid, just not implemented */
- g_warning ("CamelSeekableSubstream:: seekable substream doesn't "
- "have a write method yet?\n");
- return -1;
-}
-
-static int
-stream_flush (CamelStream *stream)
-{
- /* NOT VALID ON SEEKABLE SUBSTREAM */
- g_warning ("CamelSeekableSubstream:: seekable substream doesn't "
- "have a flush method\n");
- return -1;
-}
-
-static int
-stream_close (CamelStream *stream)
-{
- /* we dont really want to close the substream ... */
- return 0;
-}
-
-static gboolean
-eos (CamelStream *stream)
-{
- CamelSeekableSubstream *seekable_substream =
- CAMEL_SEEKABLE_SUBSTREAM (stream);
- CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream);
- CamelSeekableStream *parent;
- gboolean eos;
-
- if (stream->eos)
- eos = TRUE;
- else {
- parent = seekable_substream->parent_stream;
- if (!parent_reset (seekable_substream, parent))
- return TRUE;
-
- eos = camel_stream_eos (CAMEL_STREAM (parent));
- if (!eos && (seekable_stream->bound_end != CAMEL_STREAM_UNBOUND)) {
- eos = seekable_stream->position >= seekable_stream->bound_end;
- }
- }
-
- return eos;
-}
-
-static off_t
-stream_seek (CamelSeekableStream *seekable_stream, off_t offset,
- CamelStreamSeekPolicy policy)
-{
- CamelSeekableSubstream *seekable_substream =
- CAMEL_SEEKABLE_SUBSTREAM (seekable_stream);
- CamelStream *stream = CAMEL_STREAM (seekable_stream);
- off_t real_offset = 0;
-
- stream->eos = FALSE;
-
- switch (policy) {
- case CAMEL_STREAM_SET:
- real_offset = offset;
- break;
-
- case CAMEL_STREAM_CUR:
- real_offset = seekable_stream->position + offset;
- break;
-
- case CAMEL_STREAM_END:
- real_offset = camel_seekable_stream_seek (seekable_substream->parent_stream,
- offset,
- CAMEL_STREAM_END);
- if (real_offset == -1)
- return -1;
- break;
- }
-
- if (seekable_stream->bound_end != CAMEL_STREAM_UNBOUND)
- real_offset = MIN (real_offset, seekable_stream->bound_end);
-
- if (real_offset<seekable_stream->bound_start)
- real_offset = seekable_stream->bound_start;
-
- seekable_stream->position = real_offset;
- return real_offset;
-}
diff --git a/camel/camel-seekable-substream.h b/camel/camel-seekable-substream.h
deleted file mode 100644
index 721d33380a..0000000000
--- a/camel/camel-seekable-substream.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-seekable-substream.h: stream that piggybacks on another stream */
-
-/*
- * Author:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_SEEKABLE_SUBSTREAM_H
-#define CAMEL_SEEKABLE_SUBSTREAM_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-seekable-stream.h>
-
-#define CAMEL_SEEKABLE_SUBSTREAM_TYPE (camel_seekable_substream_get_type ())
-#define CAMEL_SEEKABLE_SUBSTREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_SEEKABLE_SUBSTREAM_TYPE, CamelSeekableSubstream))
-#define CAMEL_SEEKABLE_SUBSTREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SEEKABLE_SUBSTREAM_TYPE, CamelSeekableSubstreamClass))
-#define CAMEL_IS_SEEKABLE_SUBSTREAM(o) (GTK_CHECK_TYPE((o), CAMEL_SEEKABLE_SUBSTREAM_TYPE))
-
-struct _CamelSeekableSubstream
-{
- CamelSeekableStream parent_object;
-
- /* --**-- Private fields --**-- */
- CamelSeekableStream *parent_stream;
-};
-
-typedef struct {
- CamelSeekableStreamClass parent_class;
-
-} CamelSeekableSubstreamClass;
-
-/* Standard Gtk function */
-GtkType camel_seekable_substream_get_type (void);
-
-/* public methods */
-
-/* obtain a new seekable substream */
-CamelStream *
-camel_seekable_substream_new_with_seekable_stream_and_bounds (CamelSeekableStream *parent_stream,
- off_t start, off_t end);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SEEKABLE_SUBSTREAM_H */
diff --git a/camel/camel-service.c b/camel/camel-service.c
deleted file mode 100644
index ae3867643f..0000000000
--- a/camel/camel-service.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-service.c : Abstract class for an email service */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-service.h"
-#include "camel-exception.h"
-
-#include <ctype.h>
-#include <stdlib.h>
-
-static CamelObjectClass *parent_class = NULL;
-
-/* Returns the class for a CamelService */
-#define CSERV_CLASS(so) CAMEL_SERVICE_CLASS (GTK_OBJECT(so)->klass)
-
-static gboolean _connect(CamelService *service, CamelException *ex);
-static gboolean _connect_with_url (CamelService *service, CamelURL *url,
- CamelException *ex);
-static gboolean _disconnect(CamelService *service, CamelException *ex);
-static gboolean _is_connected (CamelService *service);
-static GList * _query_auth_types (CamelService *service, CamelException *ex);
-static void _free_auth_types (CamelService *service, GList *authtypes);
-static void _finalize (GtkObject *object);
-static gboolean _set_url (CamelService *service, CamelURL *url,
- CamelException *ex);
-
-static void
-camel_service_class_init (CamelServiceClass *camel_service_class)
-{
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_service_class);
-
- parent_class = gtk_type_class (camel_object_get_type ());
-
- /* virtual method definition */
- camel_service_class->connect = _connect;
- camel_service_class->connect_with_url = _connect_with_url;
- camel_service_class->disconnect = _disconnect;
- camel_service_class->is_connected = _is_connected;
- camel_service_class->query_auth_types = _query_auth_types;
- camel_service_class->free_auth_types = _free_auth_types;
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-}
-
-GtkType
-camel_service_get_type (void)
-{
- static GtkType camel_service_type = 0;
-
- if (!camel_service_type) {
- GtkTypeInfo camel_service_info =
- {
- "CamelService",
- sizeof (CamelService),
- sizeof (CamelServiceClass),
- (GtkClassInitFunc) camel_service_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_service_type = gtk_type_unique (camel_object_get_type (),
- &camel_service_info);
- }
-
- return camel_service_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelService *camel_service = CAMEL_SERVICE (object);
-
- if (camel_service->url)
- camel_url_free (camel_service->url);
- if (camel_service->session)
- gtk_object_unref (GTK_OBJECT (camel_service->session));
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-/**
- * camel_service_new: create a new CamelService or subtype
- * @type: the GtkType of the class to create
- * @session: the session for the service
- * @url: the default URL for the service (may be NULL)
- * @ex: a CamelException
- *
- * Creates a new CamelService (or one of its subtypes), initialized
- * with the given parameters.
- *
- * Return value: the CamelService, or NULL.
- **/
-CamelService *
-camel_service_new (GtkType type, CamelSession *session, CamelURL *url,
- CamelException *ex)
-{
- CamelService *service;
-
- g_assert(session);
-
- service = CAMEL_SERVICE (gtk_object_new (type, NULL));
- service->session = session;
- gtk_object_ref (GTK_OBJECT (session));
- if (!url->empty) {
- if (!_set_url (service, url, ex))
- return NULL;
- }
-
- return service;
-}
-
-/**
- * _connect : connect to a service
- * @service: object to connect
- * @ex: a CamelException
- *
- * connect to the service using the parameters
- * stored in the session it is initialized with
- *
- * Return value: whether or not the connection succeeded
- **/
-static gboolean
-_connect (CamelService *service, CamelException *ex)
-{
- g_assert (service->session);
- /* XXX it's possible that this should be an exception
- * rather than an assertion... I'm not sure how the code
- * is supposed to be used.
- */
- g_assert (service->url);
-
- service->connected = TRUE;
- return TRUE;
-}
-
-
-
-/**
- * camel_service_connect:connect to a service
- * @service: CamelService object
- * @ex: a CamelException
- *
- * connect to the service using the parameters
- * stored in the session it is initialized with
- *
- * Return value: whether or not the connection succeeded
- **/
-gboolean
-camel_service_connect (CamelService *service, CamelException *ex)
-{
- return CSERV_CLASS(service)->connect(service, ex);
-}
-
-
-
-/**
- * _connect_with_url: connect to the specified address
- * @service: object to connect
- * @url: URL describing service to connect to
- * @ex: a CamelException
- *
- * Connect to the service, but do not use the session
- * default parameters to retrieve server's address
- *
- * Return value: whether or not the connection succeeded
- **/
-static gboolean
-_connect_with_url (CamelService *service, CamelURL *url, CamelException *ex)
-{
- g_assert (service->session);
-
- if (!_set_url (service, url, ex))
- return FALSE;
-
- return CSERV_CLASS(service)->connect (service, ex);
-}
-
-/**
- * camel_service_connect_with_url: connect a service
- * @service: the service to connect
- * @url: URL describing the service to connect to
- * @ex: a CamelException
- *
- * Connect to a service, but do not use the session
- * default parameters to retrieve server's address
- *
- * Return value: whether or not the connection succeeded
- **/
-gboolean
-camel_service_connect_with_url (CamelService *service, char *url_string,
- CamelException *ex)
-{
- CamelURL *url = camel_url_new (url_string, ex);
-
- if (!url)
- return FALSE;
- return CSERV_CLASS(service)->connect_with_url (service, url, ex);
-}
-
-
-
-/**
- * _disconnect : disconnect from a service
- * @service: object to disconnect
- * @ex: a CamelException
- *
- * disconnect from the service
- *
- * Return value: whether or not the disconnection succeeded without
- * errors. (Consult @ex if FALSE.)
- **/
-static gboolean
-_disconnect (CamelService *service, CamelException *ex)
-{
- service->connected = FALSE;
-
- return TRUE;
-}
-
-
-
-/**
- * camel_service_disconnect: disconnect from a service
- * @service: CamelService object
- * @ex: a CamelException
- *
- * disconnect from the service
- *
- * Return value: whether or not the disconnection succeeded without
- * errors. (Consult @ex if FALSE.)
- **/
-gboolean
-camel_service_disconnect (CamelService *service, CamelException *ex)
-{
- return CSERV_CLASS(service)->disconnect(service, ex);
-}
-
-
-
-/**
- * _is_connected: test if the service object is connected
- * @service: object to test
- *
- * Return value: whether or not the service is connected
- **/
-static gboolean
-_is_connected (CamelService *service)
-{
- return service->connected;
-}
-
-
-/**
- * camel_service_is_connected: test if the service object is connected
- * @service: object to test
- *
- * Return value: whether or not the service is connected
- **/
-gboolean
-camel_service_is_connected (CamelService *service)
-{
- return CSERV_CLASS(service)->is_connected(service);
-}
-
-
-/**
- * _set_url: Validate a URL and set it as the default for a service
- * @service: the CamelService
- * @url_string: the URL
- * @ex: a CamelException
- *
- * This converts the URL to a CamelURL, validates it for the service,
- * and sets it as the default URL for the service.
- *
- * Return value: success or failure
- **/
-static gboolean
-_set_url (CamelService *service, CamelURL *url, CamelException *ex)
-{
- char *url_string;
-
- if (service->url_flags & CAMEL_SERVICE_URL_NEED_USER &&
- (url->user == NULL || url->user[0] == '\0')) {
- url_string = camel_url_to_string (url, FALSE);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- "URL '%s' needs a username component",
- url_string);
- g_free (url_string);
- return FALSE;
- } else if (service->url_flags & CAMEL_SERVICE_URL_NEED_HOST &&
- (url->host == NULL || url->host[0] == '\0')) {
- url_string = camel_url_to_string (url, FALSE);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- "URL '%s' needs a host component",
- url_string);
- g_free (url_string);
- return FALSE;
- } else if (service->url_flags & CAMEL_SERVICE_URL_NEED_PATH &&
- (url->path == NULL || url->path[0] == '\0')) {
- url_string = camel_url_to_string (url, FALSE);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- "URL '%s' needs a path component",
- url_string);
- g_free (url_string);
- return FALSE;
- }
-
- if (service->url)
- camel_url_free (service->url);
- service->url = url;
- return TRUE;
-}
-
-/**
- * camel_service_get_url: get the url representing a service
- * @service: the service
- *
- * returns the URL representing a service. The returned URL must be
- * freed when it is no longer needed. For security reasons, this
- * routine does not return the password.
- *
- * Return value: the url name
- **/
-char *
-camel_service_get_url (CamelService *service)
-{
- return camel_url_to_string(service->url, FALSE);
-}
-
-
-/**
- * camel_service_get_session: return the session associated with a service
- * @service: the service
- *
- * returns the CamelSession associated with the service.
- *
- * Return value: the session
- **/
-CamelSession *
-camel_service_get_session (CamelService *service)
-{
- return service->session;
-}
-
-
-GList *
-_query_auth_types (CamelService *service, CamelException *ex)
-{
- return NULL;
-}
-
-/**
- * camel_service_query_auth_types: return a list of supported
- * authentication types.
- * @service: a CamelService
- * @ex: a CamelException
- *
- * This is used by the mail source wizard to get the list of
- * authentication types supported by the protocol, and information
- * about them.
- *
- * This may be called on a service with or without an associated URL.
- * If there is no URL, the routine must return a generic answer. If
- * the service does have a URL, the routine SHOULD connect to the
- * server and query what authentication mechanisms it supports. If
- * it cannot do that for any reason, it should set @ex accordingly.
- *
- * Return value: a list of CamelServiceAuthType records. The caller
- * must free the list by calling camel_service_free_auth_types when
- * it is done.
- **/
-GList *
-camel_service_query_auth_types (CamelService *service, CamelException *ex)
-{
- return CSERV_CLASS (service)->query_auth_types (service, ex);
-}
-
-static void
-_free_auth_types (CamelService *service, GList *authtypes)
-{
- ;
-}
-
-/**
- * camel_service_free_auth_types: free a type list returned by
- * camel_service_query_auth_types.
- * @service: the service
- * @authtypes: the list of authtypes
- *
- * This frees the data allocated by camel_service_query_auth_types.
- **/
-void
-camel_service_free_auth_types (CamelService *service, GList *authtypes)
-{
- CSERV_CLASS (service)->free_auth_types (service, authtypes);
-}
-
-
-
-/* URL utility routines */
-
-/**
- * camel_service_gethost: get a hostent for a CamelService's host
- * @service: a CamelService
- * @ex: a CamelException
- *
- * This is a convenience function to do a gethostbyname on the host
- * for the service's URL.
- *
- * Return value: a (statically-allocated) hostent.
- **/
-struct hostent *
-camel_service_gethost (CamelService *service, CamelException *ex)
-{
- struct hostent *h;
- char *hostname;
-
- if (service->url->host)
- hostname = service->url->host;
- else
- hostname = "localhost";
- h = gethostbyname (hostname);
- if (!h) {
- extern int h_errno;
-
- if (h_errno == HOST_NOT_FOUND || h_errno == NO_DATA) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- "No such host %s.", hostname);
- } else {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- "Temporarily unable to look up "
- "hostname %s.", hostname);
- }
- return NULL;
- }
-
- return h;
-}
diff --git a/camel/camel-service.h b/camel/camel-service.h
deleted file mode 100644
index c2f4f12020..0000000000
--- a/camel/camel-service.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-service.h : Abstract class for an email service */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_SERVICE_H
-#define CAMEL_SERVICE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-object.h>
-#include <camel/camel-url.h>
-#include <netdb.h>
-
-#define CAMEL_SERVICE_TYPE (camel_service_get_type ())
-#define CAMEL_SERVICE(obj) (GTK_CHECK_CAST((obj), CAMEL_SERVICE_TYPE, CamelService))
-#define CAMEL_SERVICE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SERVICE_TYPE, CamelServiceClass))
-#define CAMEL_IS_SERVICE(o) (GTK_CHECK_TYPE((o), CAMEL_SERVICE_TYPE))
-
-
-struct _CamelService {
- CamelObject parent_object;
-
- CamelSession *session;
- gboolean connected;
- CamelURL *url;
- int url_flags;
-
-};
-
-
-typedef struct {
- CamelObjectClass parent_class;
-
- gboolean (*connect) (CamelService *service,
- CamelException *ex);
- gboolean (*connect_with_url) (CamelService *service,
- CamelURL *url,
- CamelException *ex);
- gboolean (*disconnect) (CamelService *service,
- CamelException *ex);
-
- gboolean (*is_connected) (CamelService *service);
-
- GList * (*query_auth_types) (CamelService *service,
- CamelException *ex);
- void (*free_auth_types) (CamelService *service,
- GList *authtypes);
-
-} CamelServiceClass;
-
-
-
-/* flags for url_flags. (others can be added if needed) */
-#define CAMEL_SERVICE_URL_NEED_USER (1 << 1)
-#define CAMEL_SERVICE_URL_NEED_AUTH (1 << 2)
-#define CAMEL_SERVICE_URL_NEED_HOST (1 << 4)
-#define CAMEL_SERVICE_URL_NEED_PATH (1 << 6)
-
-
-/* query_auth_types returns a GList of these */
-typedef struct {
- char *name, *description, *authproto;
- gboolean need_password;
-} CamelServiceAuthType;
-
-
-/* public methods */
-CamelService * camel_service_new (GtkType type,
- CamelSession *session,
- CamelURL *url,
- CamelException *ex);
-
-gboolean camel_service_connect (CamelService *service,
- CamelException *ex);
-gboolean camel_service_connect_with_url (CamelService *service,
- char *url,
- CamelException *ex);
-gboolean camel_service_disconnect (CamelService *service,
- CamelException *ex);
-gboolean camel_service_is_connected (CamelService *service);
-
-char * camel_service_get_url (CamelService *service);
-CamelSession * camel_service_get_session (CamelService *service);
-
-GList * camel_service_query_auth_types (CamelService *service,
- CamelException *ex);
-void camel_service_free_auth_types (CamelService *service,
- GList *authtypes);
-
-/* convenience functions */
-struct hostent * camel_service_gethost (CamelService *service,
- CamelException *ex);
-
-
-/* Standard Gtk function */
-GtkType camel_service_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SERVICE_H */
-
diff --git a/camel/camel-session.c b/camel/camel-session.c
deleted file mode 100644
index 55a466e404..0000000000
--- a/camel/camel-session.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-session.c : Abstract class for an email session */
-
-/*
- *
- * Author:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel-session.h"
-#include "camel-store.h"
-#include "camel-transport.h"
-#include "camel-exception.h"
-#include "string-utils.h"
-#include "camel-url.h"
-#include "hash-table-utils.h"
-
-static void
-camel_session_init (CamelSession *session)
-{
- session->modules = camel_provider_init ();
- session->providers = g_hash_table_new (g_strcase_hash,
- g_strcase_equal);
-}
-
-GtkType
-camel_session_get_type (void)
-{
- static GtkType camel_session_type = 0;
-
- if (!camel_session_type) {
- GtkTypeInfo camel_session_info =
- {
- "CamelSession",
- sizeof (CamelSession),
- sizeof (CamelSessionClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) camel_session_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_session_type = gtk_type_unique (camel_object_get_type (),
- &camel_session_info);
- }
-
- return camel_session_type;
-}
-
-
-CamelSession *
-camel_session_new (CamelAuthCallback authenticator)
-{
- CamelSession *session = gtk_type_new (CAMEL_SESSION_TYPE);
-
- session->authenticator = authenticator;
- return session;
-}
-
-/**
- * camel_session_register_provider:
- * @session: a session object
- * @protocol: the protocol the provider provides for
- * @provider: provider object
- *
- * Registers a protocol to provider mapping for the session.
- **/
-void
-camel_session_register_provider (CamelSession *session,
- CamelProvider *provider)
-{
- g_return_if_fail (CAMEL_IS_SESSION (session));
- g_return_if_fail (provider != NULL);
-
- g_hash_table_insert (session->providers, provider->protocol, provider);
-}
-
-static void
-ensure_loaded (gpointer key, gpointer value, gpointer user_data)
-{
- CamelSession *session = user_data;
- char *name = key;
- char *path = value;
-
- if (!g_hash_table_lookup (session->providers, name)) {
- CamelException ex;
-
- camel_exception_init (&ex);
- camel_provider_load (session, path, &ex);
- camel_exception_clear (&ex);
- }
-}
-
-static gint
-provider_compare (gconstpointer a, gconstpointer b)
-{
- const CamelProvider *cpa = (const CamelProvider *)a;
- const CamelProvider *cpb = (const CamelProvider *)b;
-
- return strcmp (cpa->name, cpb->name);
-}
-
-static void
-add_to_list (gpointer key, gpointer value, gpointer user_data)
-{
- GList **list = user_data;
- CamelProvider *prov = value;
-
- *list = g_list_insert_sorted (*list, prov, provider_compare);
-}
-
-/**
- * camel_session_list_providers:
- * @session: the session
- * @load: whether or not to load in providers that are not already loaded
- *
- * This returns a list of available providers in this session. If @load
- * is %TRUE, it will first load in all available providers that haven't
- * yet been loaded.
- *
- * Return value: a GList of providers, which the caller must free.
- **/
-GList *
-camel_session_list_providers (CamelSession *session, gboolean load)
-{
- GList *list;
-
- g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
-
- if (load) {
- g_hash_table_foreach (session->modules, ensure_loaded,
- session);
- }
-
- list = NULL;
- g_hash_table_foreach (session->providers, add_to_list, &list);
- return list;
-}
-
-
-CamelService *
-camel_session_get_service (CamelSession *session, const char *url_string,
- CamelProviderType type, CamelException *ex)
-{
- CamelURL *url;
- const CamelProvider *provider;
-
- url = camel_url_new (url_string, ex);
- if (!url)
- return NULL;
-
- provider = g_hash_table_lookup (session->providers, url->protocol);
- if (!provider) {
- /* See if there's one we can load. */
- char *path;
-
- path = g_hash_table_lookup (session->modules, url->protocol);
- if (path) {
- camel_provider_load (session, path, ex);
- if (camel_exception_get_id (ex) !=
- CAMEL_EXCEPTION_NONE) {
- camel_url_free (url);
- return NULL;
- }
- }
- provider = g_hash_table_lookup (session->providers,
- url->protocol);
- }
-
- if (!provider || !provider->object_types[type]) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- "No %s available for protocol `%s'",
- camel_provider_type_name[type],
- url->protocol);
- camel_url_free (url);
- return NULL;
- }
-
- return camel_service_new (provider->object_types[type], session,
- url, ex);
-}
-
-
-/**
- * camel_session_query_authenticator: query the session authenticator
- * @session: session object
- * @prompt: prompt to use if authenticator can query the user
- * @secret: whether or not the data is secret (eg, a password)
- * @service: the service this query is being made by
- * @item: an identifier, unique within this service, for the information
- * @ex: a CamelException
- *
- * This function is used by a CamelService to request authentication
- * information it needs to complete a connection. If the authenticator
- * stores any authentication information in configuration files, it
- * should use @service and @item as keys to find the right piece of
- * information. If it doesn't store authentication information in config
- * files, it should use the given @prompt to ask the user for the
- * information. If @secret is set, the user's input should not be
- * echoed back. The authenticator should set @ex to
- * CAMEL_EXCEPTION_USER_CANCEL if the user did not provide the
- * information. The caller must g_free() the information when it is
- * done with it.
- *
- * Return value: the authentication information or NULL.
- **/
-char *
-camel_session_query_authenticator (CamelSession *session, char *prompt,
- gboolean secret,
- CamelService *service, char *item,
- CamelException *ex)
-{
- return session->authenticator (prompt, secret, service, item, ex);
-}
diff --git a/camel/camel-session.h b/camel/camel-session.h
deleted file mode 100644
index 81f8a3da85..0000000000
--- a/camel/camel-session.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-session.h : Abstract class for an email session */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_SESSION_H
-#define CAMEL_SESSION_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-object.h>
-#include <camel/camel-provider.h>
-
-#define CAMEL_SESSION_TYPE (camel_session_get_type ())
-#define CAMEL_SESSION(obj) (GTK_CHECK_CAST((obj), CAMEL_SESSION_TYPE, CamelSession))
-#define CAMEL_SESSION_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SESSION_TYPE, CamelSessionClass))
-#define CAMEL_IS_SESSION(o) (GTK_CHECK_TYPE((o), CAMEL_SESSION_TYPE))
-
-
-typedef char *(*CamelAuthCallback) (char *prompt, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex);
-
-struct _CamelSession
-{
- CamelObject parent_object;
-
- CamelAuthCallback authenticator;
-
- GHashTable *providers, *modules;
-};
-
-typedef struct {
- CamelObjectClass parent_class;
-
-} CamelSessionClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_session_get_type (void);
-
-
-CamelSession * camel_session_new (CamelAuthCallback
- authenticator);
-
-void camel_session_register_provider (CamelSession *session,
- CamelProvider *provider);
-GList * camel_session_list_providers (CamelSession *session,
- gboolean load);
-
-CamelService * camel_session_get_service (CamelSession *session,
- const char *url_string,
- CamelProviderType type,
- CamelException *ex);
-#define camel_session_get_store(session, url_string, ex) \
- ((CamelStore *) camel_session_get_service (session, url_string, CAMEL_PROVIDER_STORE, ex))
-#define camel_session_get_transport(session, url_string, ex) \
- ((CamelTransport *) camel_session_get_service (session, url_string, CAMEL_PROVIDER_TRANSPORT, ex))
-
-
-char * camel_session_query_authenticator (CamelSession *session,
- char *prompt,
- gboolean secret,
- CamelService *service,
- char *item,
- CamelException *ex);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SESSION_H */
diff --git a/camel/camel-simple-data-wrapper.c b/camel/camel-simple-data-wrapper.c
deleted file mode 100644
index f091211e3c..0000000000
--- a/camel/camel-simple-data-wrapper.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-simple-data-wrapper.c: a simple stream-backed data wrapper */
-
-/*
- * Author:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel-simple-data-wrapper.h"
-#include "camel-exception.h"
-
-#include <errno.h>
-
-static CamelDataWrapperClass *parent_class = NULL;
-
-/* Returns the class for a CamelDataWrapper */
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT (so)->klass)
-
-
-static int construct_from_stream (CamelDataWrapper *, CamelStream *);
-static int write_to_stream (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-
-static void finalize (GtkObject *object);
-
-static void
-camel_simple_data_wrapper_class_init (CamelSimpleDataWrapperClass *camel_simple_data_wrapper_class)
-{
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_simple_data_wrapper_class);
- CamelDataWrapperClass *camel_data_wrapper_class =
- CAMEL_DATA_WRAPPER_CLASS (camel_simple_data_wrapper_class);
-
- parent_class = gtk_type_class (camel_data_wrapper_get_type ());
-
- /* virtual method overload */
- camel_data_wrapper_class->write_to_stream = write_to_stream;
- camel_data_wrapper_class->construct_from_stream =
- construct_from_stream;
-
- gtk_object_class->finalize = finalize;
-}
-
-GtkType
-camel_simple_data_wrapper_get_type (void)
-{
- static GtkType camel_simple_data_wrapper_type = 0;
-
- if (!camel_simple_data_wrapper_type) {
- GtkTypeInfo camel_simple_data_wrapper_info =
- {
- "CamelSimpleDataWrapper",
- sizeof (CamelSimpleDataWrapper),
- sizeof (CamelSimpleDataWrapperClass),
- (GtkClassInitFunc) camel_simple_data_wrapper_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_simple_data_wrapper_type = gtk_type_unique (camel_data_wrapper_get_type (), &camel_simple_data_wrapper_info);
- }
-
- return camel_simple_data_wrapper_type;
-}
-
-
-static void
-finalize (GtkObject *object)
-{
- CamelSimpleDataWrapper *simple_data_wrapper =
- CAMEL_SIMPLE_DATA_WRAPPER (object);
-
- if (simple_data_wrapper->content)
- gtk_object_unref (GTK_OBJECT (simple_data_wrapper->content));
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/**
- * camel_simple_data_wrapper_new:
- *
- * Create a new camel data wrapper object.
- *
- * Return value:
- **/
-CamelDataWrapper *
-camel_simple_data_wrapper_new (void)
-{
- return gtk_type_new (camel_simple_data_wrapper_get_type ());
-}
-
-
-static int
-construct_from_stream (CamelDataWrapper *wrapper, CamelStream *stream)
-{
- CamelSimpleDataWrapper *simple_data_wrapper =
- CAMEL_SIMPLE_DATA_WRAPPER (wrapper);
-
- if (simple_data_wrapper->content)
- gtk_object_unref((GtkObject *)simple_data_wrapper->content);
-
- simple_data_wrapper->content = stream;
- gtk_object_ref (GTK_OBJECT (stream));
- return 0;
-}
-
-
-static int
-write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelSimpleDataWrapper *simple_data_wrapper =
- CAMEL_SIMPLE_DATA_WRAPPER (data_wrapper);
-
- if (simple_data_wrapper->content == NULL)
- return -1;
-
- if (camel_stream_reset (simple_data_wrapper->content) == -1)
- return -1;
-
- return camel_stream_write_to_stream (simple_data_wrapper->content, stream);
-}
diff --git a/camel/camel-simple-data-wrapper.h b/camel/camel-simple-data-wrapper.h
deleted file mode 100644
index 5346cd969d..0000000000
--- a/camel/camel-simple-data-wrapper.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-simple-data-wrapper.h: a simple stream-backed data wrapper */
-
-/*
- * Author:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_SIMPLE_DATA_WRAPPER_H
-#define CAMEL_SIMPLE_DATA_WRAPPER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-data-wrapper.h>
-
-#define CAMEL_SIMPLE_DATA_WRAPPER_TYPE (camel_data_wrapper_get_type ())
-#define CAMEL_SIMPLE_DATA_WRAPPER(obj) (GTK_CHECK_CAST((obj), CAMEL_SIMPLE_DATA_WRAPPER_TYPE, CamelSimpleDataWrapper))
-#define CAMEL_SIMPLE_DATA_WRAPPER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SIMPLE_DATA_WRAPPER_TYPE, CamelSimpleDataWrapperClass))
-#define CAMEL_IS_SIMPLE_DATA_WRAPPER(o) (GTK_CHECK_TYPE((o), CAMEL_SIMPLE_DATA_WRAPPER_TYPE))
-
-
-struct _CamelSimpleDataWrapper
-{
- CamelDataWrapper parent_object;
-
- CamelStream *content;
-};
-
-
-typedef struct {
- CamelDataWrapperClass parent_class;
-
-} CamelSimpleDataWrapperClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_simple_data_wrapper_get_type (void);
-
-
-/* convenience functions */
-CamelDataWrapper *camel_simple_data_wrapper_new (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SIMPLE_DATA_WRAPPER_H */
diff --git a/camel/camel-store.c b/camel/camel-store.c
deleted file mode 100644
index a303920c4e..0000000000
--- a/camel/camel-store.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-store.c : Abstract class for an email store */
-
-/*
- *
- * Authors:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-store.h"
-#include "camel-folder.h"
-#include "camel-exception.h"
-
-static CamelServiceClass *parent_class = NULL;
-
-/* Returns the class for a CamelStore */
-#define CS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-
-static CamelFolder *get_folder (CamelStore *store, const char *folder_name,
- CamelException *ex);
-
-static char *get_folder_name (CamelStore *store, const char *folder_name,
- CamelException *ex);
-static char *get_root_folder_name (CamelStore *store, CamelException *ex);
-static char *get_default_folder_name (CamelStore *store, CamelException *ex);
-
-static CamelFolder *lookup_folder (CamelStore *store, const char *folder_name);
-static void cache_folder (CamelStore *store, const char *folder_name,
- CamelFolder *folder);
-static void uncache_folder (CamelStore *store, CamelFolder *folder);
-
-static void finalize (GtkObject *object);
-
-static void
-camel_store_class_init (CamelStoreClass *camel_store_class)
-{
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_store_class);
-
- parent_class = gtk_type_class (camel_service_get_type ());
-
- /* virtual method definition */
- camel_store_class->get_folder = get_folder;
- camel_store_class->get_folder_name = get_folder_name;
- camel_store_class->get_root_folder_name = get_root_folder_name;
- camel_store_class->get_default_folder_name = get_default_folder_name;
- camel_store_class->lookup_folder = lookup_folder;
- camel_store_class->cache_folder = cache_folder;
- camel_store_class->uncache_folder = uncache_folder;
-
- /* virtual method override */
- gtk_object_class->finalize = finalize;
-}
-
-
-GtkType
-camel_store_get_type (void)
-{
- static GtkType camel_store_type = 0;
-
- if (!camel_store_type) {
- GtkTypeInfo camel_store_info =
- {
- "CamelStore",
- sizeof (CamelStore),
- sizeof (CamelStoreClass),
- (GtkClassInitFunc) camel_store_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_store_type = gtk_type_unique (CAMEL_SERVICE_TYPE, &camel_store_info);
- }
-
- return camel_store_type;
-}
-
-
-static void
-finalize (GtkObject *object)
-{
- CamelStore *store = CAMEL_STORE (object);
-
- if (store->folders) {
- if (g_hash_table_size (store->folders) != 0) {
- g_warning ("Folder cache for store %p contains "
- "%d folders at destruction.", store,
- g_hash_table_size (store->folders));
- }
- g_hash_table_destroy (store->folders);
- }
-}
-
-
-static CamelFolder *
-get_folder (CamelStore *store, const char *folder_name, CamelException *ex)
-{
- g_warning ("CamelStore::get_folder not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (store)));
- return NULL;
-}
-
-static char *
-get_folder_name (CamelStore *store, const char *folder_name,
- CamelException *ex)
-{
- g_warning ("CamelStore::get_folder_name not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (store)));
- return NULL;
-}
-
-static char *
-get_root_folder_name (CamelStore *store, CamelException *ex)
-{
- return g_strdup ("/");
-}
-
-static char *
-get_default_folder_name (CamelStore *store, CamelException *ex)
-{
- return CS_CLASS (store)->get_root_folder_name (store, ex);
-}
-
-static CamelFolder *
-lookup_folder (CamelStore *store, const char *folder_name)
-{
- if (store->folders)
- return g_hash_table_lookup (store->folders, folder_name);
- return NULL;
-}
-
-static void
-cache_folder (CamelStore *store, const char *folder_name, CamelFolder *folder)
-{
- if (!store->folders)
- return;
-
- if (g_hash_table_lookup (store->folders, folder_name)) {
- g_warning ("Caching folder %s that already exists.",
- folder_name);
- }
- g_hash_table_insert (store->folders, (gpointer)folder_name, folder);
- gtk_signal_connect_object (GTK_OBJECT (folder), "destroy",
- GTK_SIGNAL_FUNC (CS_CLASS (store)->uncache_folder),
- GTK_OBJECT (store));
-}
-
-static void
-uncache_folder (CamelStore *store, CamelFolder *folder)
-{
- g_hash_table_remove (store->folders,
- camel_folder_get_full_name (folder));
-}
-
-
-static CamelFolder *
-get_folder_internal (CamelStore *store, const char *folder_name,
- CamelException *ex)
-{
- CamelFolder *folder = NULL;
-
- /* Try cache first. */
- folder = CS_CLASS (store)->lookup_folder (store, folder_name);
-
- if (!folder) {
- folder = CS_CLASS (store)->get_folder (store, folder_name, ex);
- if (!folder)
- return NULL;
-
- CS_CLASS (store)->cache_folder (store, folder_name, folder);
- }
-
- gtk_object_ref (GTK_OBJECT (folder));
- return folder;
-}
-
-
-
-/**
- * camel_store_get_folder: Return the folder corresponding to a path.
- * @store: a CamelStore
- * @folder_name: name of the folder to get
- * @ex: a CamelException
- *
- * Returns the folder corresponding to the path "name". If the path
- * begins with the separator character, it is relative to the root
- * folder. Otherwise, it is relative to the default folder. The folder
- * does not necessarily already exist on the store. To test if it
- * already exists, use its "exists" method. If it does not exist, you
- * can create it with its "create" method.
- *
- * Return value: the folder
- **/
-CamelFolder *
-camel_store_get_folder (CamelStore *store, const char *folder_name,
- CamelException *ex)
-{
- char *name;
- CamelFolder *folder = NULL;
-
- name = CS_CLASS (store)->get_folder_name (store, folder_name, ex);
- if (name) {
- folder = get_folder_internal (store, name, ex);
- g_free (name);
- }
- return folder;
-}
-
-
-/**
- * camel_store_get_root_folder: return the top-level folder
- *
- * Returns the folder which is at the top of the folder hierarchy.
- * This folder may or may not be the same as the default folder.
- *
- * Return value: the top-level folder.
- **/
-CamelFolder *
-camel_store_get_root_folder (CamelStore *store, CamelException *ex)
-{
- char *name;
- CamelFolder *folder = NULL;
-
- name = CS_CLASS (store)->get_root_folder_name (store, ex);
- if (name) {
- folder = get_folder_internal (store, name, ex);
- g_free (name);
- }
- return folder;
-}
-
-/**
- * camel_store_get_default_folder: return the store default folder
- *
- * The default folder is the folder which is presented to the user in
- * the default configuration. This defaults to the root folder if
- * the store doesn't override it.
- *
- * Return value: the default folder.
- **/
-CamelFolder *
-camel_store_get_default_folder (CamelStore *store, CamelException *ex)
-{
- char *name;
- CamelFolder *folder = NULL;
-
- name = CS_CLASS (store)->get_default_folder_name (store, ex);
- if (name) {
- folder = get_folder_internal (store, name, ex);
- g_free (name);
- }
- return folder;
-}
-
diff --git a/camel/camel-store.h b/camel/camel-store.h
deleted file mode 100644
index 7f1aa89d59..0000000000
--- a/camel/camel-store.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-store.h : Abstract class for an email store */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_STORE_H
-#define CAMEL_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-service.h>
-
-#define CAMEL_STORE_TYPE (camel_store_get_type ())
-#define CAMEL_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_STORE_TYPE, CamelStore))
-#define CAMEL_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STORE_TYPE, CamelStoreClass))
-#define CAMEL_IS_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_STORE_TYPE))
-
-
-struct _CamelStore
-{
- CamelService parent_object;
-
- GHashTable *folders;
-
-};
-
-
-
-typedef struct {
- CamelServiceClass parent_class;
-
- CamelFolder * (*get_folder) (CamelStore *store,
- const char *folder_name,
- CamelException *ex);
-
- char * (*get_folder_name) (CamelStore *store,
- const char *folder_name,
- CamelException *ex);
- char * (*get_root_folder_name) (CamelStore *store,
- CamelException *ex);
- char * (*get_default_folder_name) (CamelStore *store,
- CamelException *ex);
-
- CamelFolder * (*lookup_folder) (CamelStore *store,
- const char *folder_name);
- void (*cache_folder) (CamelStore *store,
- const char *folder_name,
- CamelFolder *folder);
- void (*uncache_folder) (CamelStore *store,
- CamelFolder *folder);
-
-} CamelStoreClass;
-
-
-/* Standard Gtk function */
-GtkType camel_store_get_type (void);
-
-/* public methods */
-CamelFolder * camel_store_get_folder (CamelStore *store,
- const char *folder_name,
- CamelException *ex);
-CamelFolder * camel_store_get_root_folder (CamelStore *store,
- CamelException *ex);
-CamelFolder * camel_store_get_default_folder (CamelStore *store,
- CamelException *ex);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STORE_H */
diff --git a/camel/camel-stream-buffer.c b/camel/camel-stream-buffer.c
deleted file mode 100644
index 68dcc7ad21..0000000000
--- a/camel/camel-stream-buffer.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-
-/* camel-stream-buffer.c : Buffer any other other stream
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-#include "camel-stream-buffer.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-
-static CamelStreamBufferClass *parent_class = NULL;
-
-enum {
- BUF_USER = 1<<0, /* user-supplied buffer, do not free */
-};
-
-#define BUF_SIZE 1024
-
-static int stream_read (CamelStream *stream, char *buffer, unsigned int n);
-static int stream_write (CamelStream *stream, const char *buffer, unsigned int n);
-static int stream_flush (CamelStream *stream);
-static int stream_close (CamelStream *stream);
-static gboolean stream_eos (CamelStream *stream);
-
-static void finalize (GtkObject *object);
-static void destroy (GtkObject *object);
-
-static void init_vbuf(CamelStreamBuffer *sbf, CamelStream *s, CamelStreamBufferMode mode, char *buf, guint32 size);
-static void init(CamelStreamBuffer *sbuf, CamelStream *s, CamelStreamBufferMode mode);
-
-static void
-camel_stream_buffer_class_init (CamelStreamBufferClass *camel_stream_buffer_class)
-{
- CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_buffer_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_buffer_class);
-
- parent_class = gtk_type_class (camel_stream_get_type ());
-
- /* virtual method definition */
- camel_stream_buffer_class->init = init;
- camel_stream_buffer_class->init_vbuf = init_vbuf;
-
- /* virtual method overload */
- camel_stream_class->read = stream_read;
- camel_stream_class->write = stream_write;
- camel_stream_class->flush = stream_flush;
- camel_stream_class->close = stream_close;
- camel_stream_class->eos = stream_eos;
-
- gtk_object_class->finalize = finalize;
- gtk_object_class->destroy = destroy;
-
-}
-
-static void
-camel_stream_buffer_init (gpointer object, gpointer klass)
-{
- CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (object);
-
- sbf->flags = 0;
- sbf->size = BUF_SIZE;
- sbf->buf = g_malloc(BUF_SIZE);
- sbf->ptr = sbf->buf;
- sbf->end = sbf->buf;
- sbf->mode = CAMEL_STREAM_BUFFER_READ | CAMEL_STREAM_BUFFER_BUFFER;
- sbf->stream = 0;
- sbf->linesize = 80;
- sbf->linebuf = g_malloc(sbf->linesize);
-}
-
-GtkType
-camel_stream_buffer_get_type (void)
-{
- static GtkType camel_stream_buffer_type = 0;
-
- gdk_threads_enter ();
- if (!camel_stream_buffer_type) {
- GtkTypeInfo camel_stream_buffer_info =
- {
- "CamelStreamBuffer",
- sizeof (CamelStreamBuffer),
- sizeof (CamelStreamBufferClass),
- (GtkClassInitFunc) camel_stream_buffer_class_init,
- (GtkObjectInitFunc) camel_stream_buffer_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_stream_buffer_type = gtk_type_unique (camel_stream_get_type (), &camel_stream_buffer_info);
- }
- gdk_threads_leave ();
- return camel_stream_buffer_type;
-}
-
-
-static void
-destroy (GtkObject *object)
-{
- CamelStreamBuffer *stream_buffer = CAMEL_STREAM_BUFFER (object);
-
- /* NOP to remove warnings */
- stream_buffer->buf = stream_buffer->buf;
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-
-static void
-finalize (GtkObject *object)
-{
- CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (object);
-
- if (!(sbf->flags & BUF_USER)) {
- g_free(sbf->buf);
- }
- if (sbf->stream)
- gtk_object_unref(GTK_OBJECT(sbf->stream));
-
- g_free(sbf->linebuf);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-set_vbuf(CamelStreamBuffer *sbf, char *buf, CamelStreamBufferMode mode, int size)
-{
- if (sbf->buf && !(sbf->flags & BUF_USER)) {
- g_free(sbf->buf);
- }
- if (buf) {
- sbf->buf = buf;
- sbf->flags |= BUF_USER;
- } else {
- sbf->buf = g_malloc(size);
- sbf->flags &= ~BUF_USER;
- }
- sbf->size = size;
- sbf->mode = mode;
-}
-
-static void
-init_vbuf(CamelStreamBuffer *sbf, CamelStream *s, CamelStreamBufferMode mode, char *buf, guint32 size)
-{
- set_vbuf(sbf, buf, mode, size);
- if (sbf->stream)
- gtk_object_unref(GTK_OBJECT(sbf->stream));
- sbf->stream = s;
- gtk_object_ref(GTK_OBJECT(sbf->stream));
-}
-
-static void
-init(CamelStreamBuffer *sbuf, CamelStream *s, CamelStreamBufferMode mode)
-{
- init_vbuf(sbuf, s, mode, NULL, BUF_SIZE);
-}
-
-
-/**
- * camel_stream_buffer_new:
- * @stream: Existing stream to buffer.
- * @mode: Operational mode of buffered stream.
- *
- * Create a new buffered stream of another stream. A default
- * buffer size (1024 bytes), automatically managed will be used
- * for buffering.
- *
- * See camel_stream_buffer_new_with_vbuf() for details on the
- * @mode parameter.
- *
- * Return value: A newly created buffered stream.
- **/
-CamelStream *
-camel_stream_buffer_new (CamelStream *stream, CamelStreamBufferMode mode)
-{
- CamelStreamBuffer *sbf;
- sbf = gtk_type_new (camel_stream_buffer_get_type ());
- CAMEL_STREAM_BUFFER_CLASS (GTK_OBJECT(sbf)->klass)->init (sbf, stream, mode);
-
- return CAMEL_STREAM (sbf);
-}
-
-/**
- * camel_stream_buffer_new_with_vbuf:
- * @stream: An existing stream to buffer.
- * @mode: Mode to buffer in.
- * @buf: Memory to use for buffering.
- * @size: Size of buffer to use.
- *
- * Create a new stream which buffers another stream, @stream.
- *
- * The following values are available for @mode:
- *
- * CAMEL_STREAM_BUFFER_BUFFER, Buffer the input/output in blocks.
- * CAMEL_STREAM_BUFFER_NEWLINE, Buffer on newlines (for output).
- * CAMEL_STREAM_BUFFER_NONE, Perform no buffering.
- *
- * Note that currently this is ignored and CAMEL_STREAM_BUFFER_BUFFER
- * is always used.
- *
- * In addition, one of the following mode options should be or'd
- * together with the buffering mode:
- *
- * CAMEL_STREAM_BUFFER_WRITE, Buffer in write mode.
- * CAMEL_STREAM_BUFFER_READ, Buffer in read mode.
- *
- * Buffering can only be done in one direction for any
- * buffer instance.
- *
- * If @buf is non-NULL, then use the memory pointed to
- * (for upto @size bytes) as the buffer for all buffering
- * operations. It is upto the application to free this buffer.
- * If @buf is NULL, then allocate and manage @size bytes
- * for all buffering.
- *
- * Return value: A new stream with buffering applied.
- **/
-CamelStream *camel_stream_buffer_new_with_vbuf (CamelStream *stream, CamelStreamBufferMode mode, char *buf, guint32 size)
-{
- CamelStreamBuffer *sbf;
- sbf = gtk_type_new (camel_stream_buffer_get_type ());
- CAMEL_STREAM_BUFFER_CLASS (GTK_OBJECT(sbf)->klass)->init_vbuf (sbf, stream, mode, buf, size);
-
- return CAMEL_STREAM (sbf);
-}
-
-static int
-stream_read (CamelStream *stream, char *buffer, unsigned int n)
-{
- CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
- int bytes_read = 1;
- int bytes_left;
- char *bptr = buffer;
-
- g_return_val_if_fail( (sbf->mode & CAMEL_STREAM_BUFFER_MODE) == CAMEL_STREAM_BUFFER_READ, 0);
-
- while (n && bytes_read > 0) {
- bytes_left = sbf->end - sbf->ptr;
- if (bytes_left < n) {
- if (bytes_left > 0) {
- memcpy(bptr, sbf->ptr, bytes_left);
- n -= bytes_left;
- bptr += bytes_left;
- sbf->ptr += bytes_left;
- }
- /* if we are reading a lot, then read directly to the destination buffer */
- if (n >= sbf->size/3) {
- bytes_read = camel_stream_read(sbf->stream, bptr, n);
- if (bytes_read>0) {
- n -= bytes_read;
- bptr += bytes_read;
- }
- } else {
- bytes_read = camel_stream_read(sbf->stream, sbf->buf, sbf->size);
- if (bytes_read>0) {
- sbf->ptr = sbf->buf;
- sbf->end = sbf->buf+bytes_read;
- memcpy(bptr, sbf->ptr, n);
- sbf->ptr += n;
- bptr += n;
- n -= bytes_read;
- }
- }
- } else {
- memcpy(bptr, sbf->ptr, bytes_left);
- sbf->ptr += n;
- bptr += n;
- n = 0;
- }
- }
-
- return bptr-buffer;
-}
-
-static int
-stream_write (CamelStream *stream, const char *buffer, unsigned int n)
-{
- CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
- const char *bptr = buffer;
- int bytes_written = 1;
- int bytes_left;
- int total = n;
-
- g_return_val_if_fail( (sbf->mode & CAMEL_STREAM_BUFFER_MODE) == CAMEL_STREAM_BUFFER_WRITE, 0);
-
- while (n && bytes_written > 0) {
- bytes_left = sbf->size - (sbf->ptr-sbf->buf);
- if (bytes_left<n) {
- memcpy(sbf->ptr, bptr, bytes_left);
- n -= bytes_left;
- bptr += bytes_left;
- bytes_written = camel_stream_write(sbf->stream, sbf->buf, sbf->size);
- sbf->ptr = sbf->buf;
- /* if we are writing a lot, write directly to the stream */
- if (n >= sbf->size/3) {
- bytes_written = camel_stream_write(sbf->stream, bptr, n);
- if (bytes_written >0) {
- bytes_written = n;
- n -= bytes_written;
- bptr += bytes_written;
- }
- } else {
- memcpy(sbf->ptr, bptr, n);
- sbf->ptr += n;
- bptr += n;
- n = 0;
- }
- } else {
- memcpy(sbf->ptr, bptr, n);
- sbf->ptr += n;
- bptr += n;
- n = 0;
- }
- }
- if (bytes_written == -1)
- return -1;
- return total;
-}
-
-static int
-stream_flush (CamelStream *stream)
-{
- CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
-
- if ((sbf->mode & CAMEL_STREAM_BUFFER_MODE) == CAMEL_STREAM_BUFFER_WRITE) {
- int len = sbf->ptr-sbf->buf;
- int written = camel_stream_write(sbf->stream, sbf->buf, len);
- if (written > 0)
- sbf->ptr += written;
- if (written != len)
- return -1;
- } else {
- /* nothing to do for read mode 'flush' */
- }
-
- return camel_stream_flush(sbf->stream);
-}
-
-static int
-stream_close (CamelStream *stream)
-{
- CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
-
- if (stream_flush(stream) == -1)
- return -1;
- return camel_stream_close(sbf->stream);
-}
-
-static gboolean
-stream_eos (CamelStream *stream)
-{
- CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
-
- return camel_stream_eos(sbf->stream) && sbf->ptr == sbf->end;
-}
-
-/**
- * camel_stream_buffer_gets:
- * @sbf: A CamelStreamBuffer.
- * @buf: Memory to write the string to.
- * @max: Maxmimum number of characters to store.
- *
- * Read a line of characters up to the next newline character or
- * @max characters.
- *
- * If the newline character is encountered, then it will be
- * included in the buffer @buf. The buffer will be #NUL terminated.
- *
- * Return value: The number of characters read, or 0 for end of file,
- * and -1 on error.
- **/
-int camel_stream_buffer_gets(CamelStreamBuffer *sbf, char *buf, unsigned int max)
-{
- register char *outptr, *inptr, *inend, c, *outend;
- int bytes_read;
-
- outptr = buf;
- inptr = sbf->ptr;
- inend = sbf->end;
- outend = buf+max-1; /* room for NUL */
-
- do {
- while (inptr<inend && outptr<outend) {
- c = *inptr++;
- *outptr++ = c;
- if (c=='\n') {
- *outptr = 0;
- sbf->ptr = inptr;
- return outptr-buf;
- }
- }
- if (outptr == outend)
- break;
-
- bytes_read = camel_stream_read(sbf->stream, sbf->buf, sbf->size);
- if (bytes_read == -1)
- return -1;
- inptr = sbf->ptr = sbf->buf;
- inend = sbf->end = sbf->buf + bytes_read;
- } while (bytes_read>0);
-
- sbf->ptr = inptr;
- if (outptr<=outend)
- *outptr = 0;
-
- return outptr-buf;
-}
-
-/**
- * camel_stream_buffer_read_line: read a complete line from the stream
- * @sbf: A CamelStreamBuffer
- *
- * This function reads a complete newline-terminated line from the stream
- * and returns it in allocated memory. The trailing newline (and carriage
- * return if any) are not included in the returned string.
- *
- * Return value: the line read, which the caller must free when done with,
- * or NULL on eof. If an error occurs, @ex will be set.
- **/
-char *
-camel_stream_buffer_read_line (CamelStreamBuffer *sbf)
-{
- unsigned char *p;
- int nread;
-
- p = sbf->linebuf;
-
- while (1) {
- nread = camel_stream_buffer_gets (sbf, p, sbf->linesize - (p - sbf->linebuf));
- if (nread <=0) {
- if (p > sbf->linebuf)
- break;
- return NULL;
- }
-
- p += nread;
- if (p[-1] == '\n')
- break;
-
- nread = p - sbf->linebuf;
- sbf->linesize *= 2;
- sbf->linebuf = g_realloc (sbf->linebuf, sbf->linesize);
- p = sbf->linebuf + nread;
- }
-
- p--;
- if (p[-1] == '\r')
- p--;
- p[0] = 0;
-
- return g_strdup(sbf->linebuf);
-}
-
diff --git a/camel/camel-stream-buffer.h b/camel/camel-stream-buffer.h
deleted file mode 100644
index 367735e4e1..0000000000
--- a/camel/camel-stream-buffer.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-buffer.h :stream which buffers another stream */
-
-/*
- *
- * Author :
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright 2000 Helix Code Inc. (http://www.helixcode.com) .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_STREAM_BUFFER_H
-#define CAMEL_STREAM_BUFFER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-seekable-stream.h>
-#include <stdio.h>
-
-#define CAMEL_STREAM_BUFFER_TYPE (camel_stream_buffer_get_type ())
-#define CAMEL_STREAM_BUFFER(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_BUFFER_TYPE, CamelStreamBuffer))
-#define CAMEL_STREAM_BUFFER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STREAM_BUFFER_TYPE, CamelStreamBufferClass))
-#define CAMEL_IS_STREAM_BUFFER(o) (GTK_CHECK_TYPE((o), CAMEL_STREAM_BUFFER_TYPE))
-
-typedef enum
-{
- CAMEL_STREAM_BUFFER_BUFFER = 0,
- CAMEL_STREAM_BUFFER_NEWLINE,
- CAMEL_STREAM_BUFFER_NONE,
- CAMEL_STREAM_BUFFER_READ = 0x00,
- CAMEL_STREAM_BUFFER_WRITE = 0x80,
- CAMEL_STREAM_BUFFER_MODE = 0x80
-} CamelStreamBufferMode;
-
-struct _CamelStreamBuffer
-{
- CamelStream parent_object;
-
- /* these are all of course, private */
- CamelStream *stream;
-
- unsigned char *buf, *ptr, *end;
- int size;
-
- unsigned char *linebuf; /* for reading lines at a time */
- int linesize;
-
- CamelStreamBufferMode mode;
- unsigned int flags; /* internal flags */
-};
-
-
-typedef struct {
- CamelStreamClass parent_class;
-
- /* Virtual methods */
- void (*init) (CamelStreamBuffer *stream_buffer, CamelStream *stream,
- CamelStreamBufferMode mode);
- void (*init_vbuf) (CamelStreamBuffer *stream_buffer,
- CamelStream *stream, CamelStreamBufferMode mode,
- char *buf, guint32 size);
-
-} CamelStreamBufferClass;
-
-
-/* Standard Gtk function */
-GtkType camel_stream_buffer_get_type (void);
-
-
-/* public methods */
-CamelStream *camel_stream_buffer_new (CamelStream *s,
- CamelStreamBufferMode mode);
-CamelStream *camel_stream_buffer_new_with_vbuf (CamelStream *s,
- CamelStreamBufferMode mode,
- char *buf, guint32 size);
-
-/* unimplemented
- CamelStream *camel_stream_buffer_set_vbuf (CamelStreamBuffer *b, CamelStreamBufferMode mode, char *buf, guint32 size); */
-
-/* read a line of characters */
-int camel_stream_buffer_gets (CamelStreamBuffer *b, char *buf, unsigned int max);
-
-char *camel_stream_buffer_read_line (CamelStreamBuffer *sbf);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_BUFFER_H */
diff --git a/camel/camel-stream-filter.c b/camel/camel-stream-filter.c
deleted file mode 100644
index 3aaa1a20ed..0000000000
--- a/camel/camel-stream-filter.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "camel-stream-filter.h"
-
-struct _filter {
- struct _filter *next;
- int id;
- CamelMimeFilter *filter;
-};
-
-struct _CamelStreamFilterPrivate {
- struct _filter *filters;
- int filterid; /* next filter id */
-
- char *realbuffer; /* buffer - READ_PAD */
- char *buffer; /* READ_SIZE bytes */
-
- char *filtered; /* the filtered data */
- size_t filteredlen;
-
- int last_was_read; /* was the last op read or write? */
-};
-
-#define READ_PAD (64) /* bytes padded before buffer */
-#define READ_SIZE (4096)
-
-#define _PRIVATE(o) (((CamelStreamFilter *)(o))->priv)
-
-static void camel_stream_filter_class_init (CamelStreamFilterClass *klass);
-static void camel_stream_filter_init (CamelStreamFilter *obj);
-
-static int do_read (CamelStream *stream, char *buffer, unsigned int n);
-static int do_write (CamelStream *stream, const char *buffer, unsigned int n);
-static int do_flush (CamelStream *stream);
-static int do_close (CamelStream *stream);
-static gboolean do_eos (CamelStream *stream);
-static int do_reset (CamelStream *stream);
-
-static CamelStreamClass *camel_stream_filter_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_stream_filter_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelStreamFilter",
- sizeof (CamelStreamFilter),
- sizeof (CamelStreamFilterClass),
- (GtkClassInitFunc) camel_stream_filter_class_init,
- (GtkObjectInitFunc) camel_stream_filter_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_stream_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-finalise(GtkObject *o)
-{
- CamelStreamFilter *filter = (CamelStreamFilter *)o;
- struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
- struct _filter *fn, *f;
-
- f = p->filters;
- while (f) {
- fn = f->next;
- gtk_object_unref((GtkObject *)f->filter);
- g_free(f);
- f = fn;
- }
- g_free(p->realbuffer);
- g_free(p);
- gtk_object_unref((GtkObject *)filter->source);
-
- GTK_OBJECT_CLASS (camel_stream_filter_parent)->finalize (o);
-}
-
-
-static void
-camel_stream_filter_class_init (CamelStreamFilterClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- CamelStreamClass *camel_stream_class = (CamelStreamClass *) klass;
-
- camel_stream_filter_parent = gtk_type_class (camel_stream_get_type ());
-
- object_class->finalize = finalise;
-
- camel_stream_class->read = do_read;
- camel_stream_class->write = do_write;
- camel_stream_class->flush = do_flush;
- camel_stream_class->flush = do_close;
- camel_stream_class->eos = do_eos;
- camel_stream_class->reset = do_reset;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_stream_filter_init (CamelStreamFilter *obj)
-{
- struct _CamelStreamFilterPrivate *p;
-
- _PRIVATE(obj) = p = g_malloc0(sizeof(*p));
- p->realbuffer = g_malloc(READ_SIZE + READ_PAD);
- p->buffer = p->realbuffer + READ_PAD;
- p->last_was_read = TRUE;
-}
-
-/**
- * camel_stream_filter_new:
- *
- * Create a new CamelStreamFilter object.
- *
- * Return value: A new CamelStreamFilter object.
- **/
-CamelStreamFilter *
-camel_stream_filter_new_with_stream(CamelStream *stream)
-{
- CamelStreamFilter *new = CAMEL_STREAM_FILTER ( gtk_type_new (camel_stream_filter_get_type ()));
-
- new->source = stream;
- gtk_object_ref ((GtkObject *)stream);
-
- return new;
-}
-
-
-/**
- * camel_stream_filter_add:
- * @filter: Initialised CamelStreamFilter.
- * @mf: Filter to perform processing on stream.
- *
- * Add a new CamelMimeFilter to execute during the processing of this
- * stream. Each filter added is processed after the previous one.
- *
- * Note that a filter should only be added to a single stream
- * at a time, otherwise unpredictable results may occur.
- *
- * Return value: A filter id for this CamelStreamFilter.
- **/
-int
-camel_stream_filter_add(CamelStreamFilter *filter, CamelMimeFilter *mf)
-{
- struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
- struct _filter *fn, *f;
-
- fn = g_malloc(sizeof(*fn));
- fn->id = p->filterid++;
- fn->filter = mf;
- gtk_object_ref((GtkObject *)mf);
-
- /* sure, we could use a GList, but we wouldn't save much */
- f = (struct _filter *)&p->filters;
- while (f->next)
- f = f->next;
- f->next = fn;
- fn->next = NULL;
- return fn->id;
-}
-
-/**
- * camel_stream_filter_remove:
- * @filter: Initialised CamelStreamFilter.
- * @id: Filter id, as returned from camel_stream_filter_add().
- *
- * Remove a processing filter from the stream, by id.
- **/
-void
-camel_stream_filter_remove(CamelStreamFilter *filter, int id)
-{
- struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
- struct _filter *fn, *f;
-
- f = (struct _filter *)&p->filters;
- while (f && f->next) {
- fn = f->next;
- if (fn->id == id) {
- f->next = fn->next;
- gtk_object_unref((GtkObject *)fn->filter);
- g_free(fn);
- }
- f = f->next;
- }
-}
-
-static int
-do_read (CamelStream *stream, char *buffer, unsigned int n)
-{
- CamelStreamFilter *filter = (CamelStreamFilter *)stream;
- struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
- int size;
- struct _filter *f;
-
- p->last_was_read = TRUE;
-
- if (p->filteredlen<=0) {
- int presize = READ_SIZE;
-
- size = camel_stream_read(filter->source, p->buffer, READ_SIZE);
- if (size<=0) {
- /* this is somewhat untested */
- if (camel_stream_eos(filter->source)) {
- f = p->filters;
- p->filtered = p->buffer;
- p->filteredlen = 0;
- while (f) {
- camel_mime_filter_complete(f->filter, p->filtered, p->filteredlen, presize, &p->filtered, &p->filteredlen, &presize);
- f = f->next;
- }
- size = p->filteredlen;
- }
- if (size<=0)
- return size;
- } else {
- f = p->filters;
- p->filtered = p->buffer;
- p->filteredlen = size;
- while (f) {
- camel_mime_filter_filter(f->filter, p->filtered, p->filteredlen, presize, &p->filtered, &p->filteredlen, &presize);
- f = f->next;
- }
- }
- }
-
- size = MIN(n, p->filteredlen);
- memcpy(buffer, p->filtered, size);
- p->filteredlen -= size;
- p->filtered += size;
-
- return size;
-}
-
-static int
-do_write (CamelStream *stream, const char *buf, unsigned int n)
-{
- CamelStreamFilter *filter = (CamelStreamFilter *)stream;
- struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
- struct _filter *f;
- int presize;
- char *buffer = (char *)buf;
-
- p->last_was_read = FALSE;
-
- f = p->filters;
- presize = 0;
- while (f) {
- camel_mime_filter_filter(f->filter, buffer, n, presize, &buffer, &n, &presize);
- f = f->next;
- }
-
- return camel_stream_write(filter->source, buffer, n);
-}
-
-static int
-do_flush (CamelStream *stream)
-{
- CamelStreamFilter *filter = (CamelStreamFilter *)stream;
- struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
- struct _filter *f;
- char *buffer;
- int len, presize;
-
- if (p->last_was_read) {
- g_warning("Flushing a filter stream without writing to it");
- return 0;
- }
-
- buffer = "";
- len = 0;
- presize = 0;
- f = p->filters;
- while (f) {
- camel_mime_filter_complete(f->filter, buffer, len, presize, &buffer, &len, &presize);
- f = f->next;
- }
- if (len>0 && camel_stream_write(filter->source, buffer, len) == -1)
- return -1;
- return camel_stream_flush(filter->source);
-}
-
-static int
-do_close (CamelStream *stream)
-{
- CamelStreamFilter *filter = (CamelStreamFilter *)stream;
- struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
-
- if (!p->last_was_read) {
- do_flush(stream);
- }
- return camel_stream_close(filter->source);
-}
-
-static gboolean
-do_eos (CamelStream *stream)
-{
- CamelStreamFilter *filter = (CamelStreamFilter *)stream;
- struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
-
- if (p->filteredlen >0)
- return FALSE;
-
- return camel_stream_eos(filter->source);
-}
-
-static int
-do_reset (CamelStream *stream)
-{
- CamelStreamFilter *filter = (CamelStreamFilter *)stream;
- struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
- struct _filter *f;
-
- p->filteredlen = 0;
-
- /* and reset filters */
- f = p->filters;
- while (f) {
- camel_mime_filter_reset(f->filter);
- f = f->next;
- }
-
- return camel_stream_reset(filter->source);
-}
-
diff --git a/camel/camel-stream-filter.h b/camel/camel-stream-filter.h
deleted file mode 100644
index 0bc73732ec..0000000000
--- a/camel/camel-stream-filter.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _CAMEL_STREAM_FILTER_H
-#define _CAMEL_STREAM_FILTER_H
-
-#include <camel/camel-stream.h>
-#include <camel/camel-mime-filter.h>
-
-#define CAMEL_STREAM_FILTER(obj) GTK_CHECK_CAST (obj, camel_stream_filter_get_type (), CamelStreamFilter)
-#define CAMEL_STREAM_FILTER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_stream_filter_get_type (), CamelStreamFilterClass)
-#define IS_CAMEL_STREAM_FILTER(obj) GTK_CHECK_TYPE (obj, camel_stream_filter_get_type ())
-
-typedef struct _CamelStreamFilterClass CamelStreamFilterClass;
-
-struct _CamelStreamFilter {
- CamelStream parent;
-
- CamelStream *source;
-
- struct _CamelStreamFilterPrivate *priv;
-};
-
-struct _CamelStreamFilterClass {
- CamelStreamClass parent_class;
-};
-
-guint camel_stream_filter_get_type (void);
-
-CamelStreamFilter *camel_stream_filter_new_with_stream (CamelStream *stream);
-
-int camel_stream_filter_add (CamelStreamFilter *filter, CamelMimeFilter *);
-void camel_stream_filter_remove (CamelStreamFilter *filter, int id);
-
-#endif /* ! _CAMEL_STREAM_FILTER_H */
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c
deleted file mode 100644
index 4b5a6015a4..0000000000
--- a/camel/camel-stream-fs.c
+++ /dev/null
@@ -1,310 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camel-stream-fs.c : file system based stream */
-
-/*
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel-stream-fs.h"
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-static CamelSeekableStreamClass *parent_class = NULL;
-
-/* Returns the class for a CamelStreamFS */
-#define CSFS_CLASS(so) CAMEL_STREAM_FS_CLASS (GTK_OBJECT(so)->klass)
-
-static int stream_read (CamelStream *stream, char *buffer, unsigned int n);
-static int stream_write (CamelStream *stream, const char *buffer, unsigned int n);
-static int stream_flush (CamelStream *stream);
-static int stream_close (CamelStream *stream);
-static off_t stream_seek (CamelSeekableStream *stream, off_t offset,
- CamelStreamSeekPolicy policy);
-static void finalize (GtkObject *object);
-
-static void
-camel_stream_fs_class_init (CamelStreamFsClass *camel_stream_fs_class)
-{
- CamelSeekableStreamClass *camel_seekable_stream_class =
- CAMEL_SEEKABLE_STREAM_CLASS (camel_stream_fs_class);
- CamelStreamClass *camel_stream_class =
- CAMEL_STREAM_CLASS (camel_stream_fs_class);
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_stream_fs_class);
-
- parent_class = gtk_type_class (camel_seekable_stream_get_type ());
-
- /* virtual method overload */
- camel_stream_class->read = stream_read;
- camel_stream_class->write = stream_write;
- camel_stream_class->flush = stream_flush;
- camel_stream_class->close = stream_close;
-
- camel_seekable_stream_class->seek = stream_seek;
-
- gtk_object_class->finalize = finalize;
-}
-
-static void
-camel_stream_fs_init (gpointer object, gpointer klass)
-{
- CamelStreamFs *stream = CAMEL_STREAM_FS (object);
-
- stream->fd = -1;
-}
-
-GtkType
-camel_stream_fs_get_type (void)
-{
- static GtkType camel_stream_fs_type = 0;
-
- if (!camel_stream_fs_type) {
- GtkTypeInfo camel_stream_fs_info =
- {
- "CamelStreamFs",
- sizeof (CamelStreamFs),
- sizeof (CamelStreamFsClass),
- (GtkClassInitFunc) camel_stream_fs_class_init,
- (GtkObjectInitFunc) camel_stream_fs_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_stream_fs_type = gtk_type_unique (camel_seekable_stream_get_type (), &camel_stream_fs_info);
- }
-
- return camel_stream_fs_type;
-}
-
-static void
-finalize (GtkObject *object)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (object);
-
- if (stream_fs->fd != -1)
- close (stream_fs->fd);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/**
- * camel_stream_fs_new_with_fd:
- * @fd: a file descriptor
- *
- * Returns a stream associated with the given file descriptor.
- * When the stream is destroyed, the file descriptor will be closed.
- *
- * Return value: the stream
- **/
-CamelStream *
-camel_stream_fs_new_with_fd (int fd)
-{
- CamelStreamFs *stream_fs;
- off_t offset;
-
- stream_fs = gtk_type_new (camel_stream_fs_get_type ());
- stream_fs->fd = fd;
- offset = lseek (fd, 0, SEEK_CUR);
- if (offset == -1)
- offset = 0;
- CAMEL_SEEKABLE_STREAM (stream_fs)->position = offset;
-
- return CAMEL_STREAM (stream_fs);
-}
-
-/**
- * camel_stream_fs_new_with_fd_and_bounds:
- * @fd: a file descriptor
- * @start: the first valid position in the file
- * @end: the first invalid position in the file, or CAMEL_STREAM_UNBOUND
- *
- * Returns a stream associated with the given file descriptor and bounds.
- * When the stream is destroyed, the file descriptor will be closed.
- *
- * Return value: the stream
- **/
-CamelStream *
-camel_stream_fs_new_with_fd_and_bounds (int fd, off_t start, off_t end)
-{
- CamelStream *stream;
-
- stream = camel_stream_fs_new_with_fd (fd);
- camel_seekable_stream_set_bounds (CAMEL_SEEKABLE_STREAM (stream), start, end);
-
- return stream;
-}
-
-/**
- * camel_stream_fs_new_with_name:
- * @name: a local filename
- * @flags: flags as in open(2)
- * @mode: a file mode
- *
- * Creates a new CamelStream corresponding to the named file, flags,
- * and mode.
- *
- * Return value: the stream, or #NULL on error.
- **/
-CamelStream *
-camel_stream_fs_new_with_name (const char *name, int flags, mode_t mode)
-{
- int fd;
-
- fd = open (name, flags, mode);
- if (fd == -1) {
- return NULL;
- }
-
- return camel_stream_fs_new_with_fd (fd);
-}
-
-/**
- * camel_stream_fs_new_with_name_and_bounds:
- * @name: a local filename
- * @flags: flags as in open(2)
- * @mode: a file mode
- * @start: the first valid position in the file
- * @end: the first invalid position in the file, or CAMEL_STREAM_UNBOUND
- *
- * Creates a new CamelStream corresponding to the given arguments.
- *
- * Return value: the stream, or NULL on error.
- **/
-CamelStream *
-camel_stream_fs_new_with_name_and_bounds (const char *name, int flags,
- mode_t mode, off_t start, off_t end)
-{
- CamelStream *stream;
-
- stream = camel_stream_fs_new_with_name (name, flags, mode);
- if (stream == NULL)
- return NULL;
-
- camel_seekable_stream_set_bounds (CAMEL_SEEKABLE_STREAM (stream),
- start, end);
-
- return stream;
-}
-
-
-static int
-stream_read (CamelStream *stream, char *buffer, unsigned int n)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream);
- CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
- int nread;
-
- if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
- n = MIN (seekable->bound_end - seekable->position, n);
-
- do {
- nread = read (stream_fs->fd, buffer, n);
- } while (nread == -1 && errno == EINTR);
-
- if (nread > 0)
- seekable->position += nread;
- else if (nread == 0)
- stream->eos = TRUE;
-
- return nread;
-}
-
-static int
-stream_write (CamelStream *stream, const char *buffer, unsigned int n)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream);
- CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
- int v, written = 0;
-
- if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
- n = MIN (seekable->bound_end - seekable->position, n);
-
- do {
- v = write (stream_fs->fd, buffer, n);
- if (v > 0)
- written += v;
- } while (v == -1 && errno == EINTR);
-
- if (written > 0)
- seekable->position += written;
- else if (v == -1)
- return -1;
-
- return written;
-}
-
-static int
-stream_flush (CamelStream *stream)
-{
- return fsync(((CamelStreamFs *)stream)->fd);
-}
-
-static int
-stream_close (CamelStream *stream)
-{
- return close(((CamelStreamFs *)stream)->fd);
-}
-
-static off_t
-stream_seek (CamelSeekableStream *stream, off_t offset, CamelStreamSeekPolicy policy)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream);
- off_t real = 0;
-
- switch (policy) {
- case CAMEL_STREAM_SET:
- real = offset;
- break;
- case CAMEL_STREAM_CUR:
- real = stream->position + offset;
- break;
- case CAMEL_STREAM_END:
- if (stream->bound_end != CAMEL_STREAM_UNBOUND) {
- real = lseek(stream_fs->fd, offset, SEEK_END);
- if (real != -1)
- stream->position = real;
- return real;
- }
- real = stream->bound_end + offset;
- break;
- }
-
- if (stream->bound_end != CAMEL_STREAM_UNBOUND)
- real = MIN (real, stream->bound_end);
- real = MAX (real, stream->bound_start);
-
- real = lseek(stream_fs->fd, real, SEEK_SET);
- if (real == -1)
- return -1;
-
- if (real != stream->position && ((CamelStream *)stream)->eos)
- ((CamelStream *)stream)->eos = FALSE;
-
- stream->position = real;
-
- return real;
-}
diff --git a/camel/camel-stream-fs.h b/camel/camel-stream-fs.h
deleted file mode 100644
index 08ae49bddf..0000000000
--- a/camel/camel-stream-fs.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-fs.h :stream based on unix filesystem */
-
-/*
- * Author:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_STREAM_FS_H
-#define CAMEL_STREAM_FS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-seekable-stream.h>
-
-/* for open flags */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#define CAMEL_STREAM_FS_TYPE (camel_stream_fs_get_type ())
-#define CAMEL_STREAM_FS(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_FS_TYPE, CamelStreamFs))
-#define CAMEL_STREAM_FS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STREAM_FS_TYPE, CamelStreamFsClass))
-#define CAMEL_IS_STREAM_FS(o) (GTK_CHECK_TYPE((o), CAMEL_STREAM_FS_TYPE))
-
-struct _CamelStreamFs
-{
- CamelSeekableStream parent_object;
-
- int fd; /* file descriptor on the underlying file */
-};
-
-typedef struct {
- CamelSeekableStreamClass parent_class;
-
-} CamelStreamFsClass;
-
-/* Standard Gtk function */
-GtkType camel_stream_fs_get_type (void);
-
-/* public methods */
-CamelStream * camel_stream_fs_new_with_name (const char *name, int flags, mode_t mode);
-CamelStream * camel_stream_fs_new_with_name_and_bounds (const char *name, int flags, mode_t mode,
- off_t start, off_t end);
-
-CamelStream * camel_stream_fs_new_with_fd (int fd);
-CamelStream * camel_stream_fs_new_with_fd_and_bounds (int fd, off_t start, off_t end);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_FS_H */
diff --git a/camel/camel-stream-mem.c b/camel/camel-stream-mem.c
deleted file mode 100644
index ca384485b6..0000000000
--- a/camel/camel-stream-mem.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-mem.c: memory buffer based stream */
-
-/*
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel-stream-mem.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-
-static CamelStreamClass *parent_class = NULL;
-
-/* Returns the class for a CamelStreamMem */
-#define CSM_CLASS(so) CAMEL_STREAM_MEM_CLASS (GTK_OBJECT(so)->klass)
-
-static int stream_read (CamelStream *stream, char *buffer, unsigned int n);
-static int stream_write (CamelStream *stream, const char *buffer, unsigned int n);
-static gboolean stream_eos (CamelStream *stream);
-static off_t stream_seek (CamelSeekableStream *stream, off_t offset,
- CamelStreamSeekPolicy policy);
-
-static void finalize (GtkObject *object);
-
-static void
-camel_stream_mem_class_init (CamelStreamMemClass *camel_stream_mem_class)
-{
- CamelSeekableStreamClass *camel_seekable_stream_class =
- CAMEL_SEEKABLE_STREAM_CLASS (camel_stream_mem_class);
- CamelStreamClass *camel_stream_class =
- CAMEL_STREAM_CLASS (camel_stream_mem_class);
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_stream_mem_class);
-
- parent_class = gtk_type_class (camel_stream_get_type ());
-
- /* virtual method overload */
- camel_stream_class->read = stream_read;
- camel_stream_class->write = stream_write;
- camel_stream_class->eos = stream_eos;
-
- camel_seekable_stream_class->seek = stream_seek;
-
- gtk_object_class->finalize = finalize;
-}
-
-static void
-camel_stream_mem_init (gpointer object, gpointer klass)
-{
- CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (object);
-
- stream_mem->owner = FALSE;
- stream_mem->buffer = 0;
-}
-
-GtkType
-camel_stream_mem_get_type (void)
-{
- static GtkType camel_stream_mem_type = 0;
-
- if (!camel_stream_mem_type) {
- GtkTypeInfo camel_stream_mem_info =
- {
- "CamelStreamMem",
- sizeof (CamelStreamMem),
- sizeof (CamelStreamMemClass),
- (GtkClassInitFunc) camel_stream_mem_class_init,
- (GtkObjectInitFunc) camel_stream_mem_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_stream_mem_type = gtk_type_unique (camel_seekable_stream_get_type (), &camel_stream_mem_info);
- }
-
- return camel_stream_mem_type;
-}
-
-
-CamelStream *
-camel_stream_mem_new (void)
-{
- return camel_stream_mem_new_with_byte_array (g_byte_array_new ());
-}
-
-CamelStream *
-camel_stream_mem_new_with_buffer (const char *buffer, size_t len)
-{
- GByteArray *ba;
-
- ba = g_byte_array_new ();
- g_byte_array_append (ba, (const guint8 *)buffer, len);
- return camel_stream_mem_new_with_byte_array (ba);
-}
-
-CamelStream *
-camel_stream_mem_new_with_byte_array (GByteArray *byte_array)
-{
- CamelStreamMem *stream_mem;
-
- stream_mem = gtk_type_new (camel_stream_mem_get_type ());
- stream_mem->buffer = byte_array;
- stream_mem->owner = TRUE;
-
- return CAMEL_STREAM (stream_mem);
-}
-
-/* note: with these functions the caller is the 'owner' of the buffer */
-void camel_stream_mem_set_byte_array (CamelStreamMem *s, GByteArray *buffer)
-{
- if (s->buffer && s->owner)
- g_byte_array_free(s->buffer, TRUE);
- s->owner = FALSE;
- s->buffer = buffer;
-}
-
-void camel_stream_mem_set_buffer (CamelStreamMem *s, const char *buffer,
- size_t len)
-{
- GByteArray *ba;
-
- ba = g_byte_array_new ();
- g_byte_array_append (ba, (const guint8 *)buffer, len);
- camel_stream_mem_set_byte_array(s, ba);
-}
-
-static void
-finalize (GtkObject *object)
-{
- CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (object);
-
- if (stream_mem->buffer && stream_mem->owner)
- g_byte_array_free (stream_mem->buffer, TRUE);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static int
-stream_read (CamelStream *stream, char *buffer, unsigned int n)
-{
- CamelStreamMem *camel_stream_mem = CAMEL_STREAM_MEM (stream);
- CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
-
- if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
- n = MIN(seekable->bound_end - seekable->position, n);
-
- n = MIN (n, camel_stream_mem->buffer->len - seekable->position);
- if (n > 0) {
- memcpy (buffer, camel_stream_mem->buffer->data +
- seekable->position, n);
- seekable->position += n;
- } else
- n = -1;
-
- return n;
-}
-
-static int
-stream_write (CamelStream *stream, const char *buffer, unsigned int n)
-{
- CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (stream);
- CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
-
- if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
- n = MIN(seekable->bound_end - seekable->position, n);
-
-#warning "g_byte_arrays use g_malloc and so are totally unsuitable for this object"
- if (seekable->position == stream_mem->buffer->len) {
- stream_mem->buffer =
- g_byte_array_append (stream_mem->buffer, (const guint8 *)buffer, n);
- } else {
- g_byte_array_set_size (stream_mem->buffer,
- n+stream_mem->buffer->len);
- memcpy (stream_mem->buffer->data + seekable->position, buffer, n);
- }
- seekable->position += n;
-
- return n;
-}
-
-static gboolean
-stream_eos (CamelStream *stream)
-{
- CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (stream);
- CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream);
-
- return stream_mem->buffer->len <= seekable_stream->position;
-}
-
-static off_t
-stream_seek (CamelSeekableStream *stream, off_t offset,
- CamelStreamSeekPolicy policy)
-{
- off_t position;
- CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (stream);
-
- switch (policy) {
- case CAMEL_STREAM_SET:
- position = offset;
- break;
- case CAMEL_STREAM_CUR:
- position = stream->position + offset;
- break;
- case CAMEL_STREAM_END:
- position = (stream_mem->buffer)->len + offset;
- break;
- }
-
- if (stream->bound_end == CAMEL_STREAM_UNBOUND)
- position = MIN (position, stream->bound_end);
- if (stream->bound_start == CAMEL_STREAM_UNBOUND)
- position = MAX (position, 0);
- else
- position = MAX (position, stream->bound_start);
-
- if (position > stream_mem->buffer->len) {
- int oldlen = stream_mem->buffer->len;
- g_byte_array_set_size (stream_mem->buffer, position);
- memset (stream_mem->buffer->data + oldlen, 0,
- position - oldlen);
- }
-
- stream->position = position;
-
- return position;
-}
diff --git a/camel/camel-stream-mem.h b/camel/camel-stream-mem.h
deleted file mode 100644
index e508644e6b..0000000000
--- a/camel/camel-stream-mem.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-mem.h: stream based on memory buffer */
-
-/*
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_STREAM_MEM_H
-#define CAMEL_STREAM_MEM_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-seekable-stream.h>
-#include <sys/types.h>
-
-#define CAMEL_STREAM_MEM_TYPE (camel_stream_mem_get_type ())
-#define CAMEL_STREAM_MEM(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_MEM_TYPE, CamelStreamMem))
-#define CAMEL_STREAM_MEM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STREAM_MEM_TYPE, CamelStreamMemClass))
-#define CAMEL_IS_STREAM_MEM(o) (GTK_CHECK_TYPE((o), CAMEL_STREAM_MEM_TYPE))
-
-struct _CamelStreamMem
-{
- CamelSeekableStream parent_object;
-
- gboolean owner; /* do we own the buffer? */
- GByteArray *buffer;
-};
-
-typedef struct {
- CamelSeekableStreamClass parent_class;
-
- /* Virtual methods */
-} CamelStreamMemClass;
-
-/* Standard Gtk function */
-GtkType camel_stream_mem_get_type (void);
-
-/* public methods */
-CamelStream *camel_stream_mem_new (void);
-CamelStream *camel_stream_mem_new_with_byte_array (GByteArray *buffer);
-CamelStream *camel_stream_mem_new_with_buffer (const char *buffer, size_t len);
-
-/* these are really only here for implementing classes */
-void camel_stream_mem_set_byte_array (CamelStreamMem *, GByteArray *buffer);
-void camel_stream_mem_set_buffer (CamelStreamMem *, const char *buffer, size_t len);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_MEM_H */
diff --git a/camel/camel-stream.c b/camel/camel-stream.c
deleted file mode 100644
index 244b6cf9d8..0000000000
--- a/camel/camel-stream.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camel-stream.c : abstract class for a stream */
-
-/*
- * Author:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel-stream.h"
-
-static CamelObjectClass *parent_class = NULL;
-
-/* Returns the class for a CamelStream */
-#define CS_CLASS(so) CAMEL_STREAM_CLASS (GTK_OBJECT(so)->klass)
-
-static int stream_flush (CamelStream *stream);
-static int stream_close (CamelStream *stream);
-static gboolean stream_eos (CamelStream *stream);
-
-
-static void
-camel_stream_class_init (CamelStreamClass *camel_stream_class)
-{
- parent_class = gtk_type_class (camel_object_get_type ());
-
- /* virtual method definition */
- camel_stream_class->flush = stream_flush;
- camel_stream_class->close = stream_close;
- camel_stream_class->eos = stream_eos;
-}
-
-GtkType
-camel_stream_get_type (void)
-{
- static GtkType camel_stream_type = 0;
-
- if (!camel_stream_type) {
- GtkTypeInfo camel_stream_info =
- {
- "CamelStream",
- sizeof (CamelStream),
- sizeof (CamelStreamClass),
- (GtkClassInitFunc) camel_stream_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_stream_type = gtk_type_unique (camel_object_get_type (),
- &camel_stream_info);
- }
-
- return camel_stream_type;
-}
-
-/**
- * camel_stream_read:
- * @stream: a CamelStream.
- * @buffer: buffer where bytes pulled from the stream are stored.
- * @n: max number of bytes to read.
- *
- * Read at most @n bytes from the @stream object and stores them
- * in the buffer pointed at by @buffer.
- *
- * Return value: number of bytes actually read, or -1 on error and
- * set errno.
- **/
-int
-camel_stream_read (CamelStream *stream, char *buffer, unsigned int n)
-{
- g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
- g_return_val_if_fail (n == 0 || buffer, -1);
-
- return CS_CLASS (stream)->read (stream, buffer, n);
-}
-
-/**
- * camel_stream_write:
- * @stream: a CamelStream object.
- * @buffer: buffer to write.
- * @n: number of bytes to write
- *
- * Write @n bytes from the buffer pointed at by @buffer into @stream.
- *
- * Return value: the number of bytes actually written to the stream,
- * or -1 on error.
- **/
-int
-camel_stream_write (CamelStream *stream, const char *buffer, unsigned int n)
-{
- g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
- g_return_val_if_fail (n == 0 || buffer, -1);
-
- return CS_CLASS (stream)->write (stream, buffer, n);
-}
-
-
-static int
-stream_flush (CamelStream *stream)
-{
- /* nothing */
- return 0;
-}
-
-/**
- * camel_stream_flush:
- * @stream: a CamelStream object
- *
- * Flushes the contents of the stream to its backing store. Only meaningful
- * on writable streams.
- *
- * Return value: -1 on error.
- **/
-int
-camel_stream_flush (CamelStream *stream)
-{
- g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
-
- return CS_CLASS (stream)->flush (stream);
-}
-
-
-static int
-stream_close (CamelStream *stream)
-{
- /* nothing */
- return 0;
-}
-
-/**
- * camel_stream_close:
- * @stream:
- *
- * Close a stream.
- *
- * Return value: -1 on error.
- **/
-int
-camel_stream_close (CamelStream *stream)
-{
- g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
-
- return CS_CLASS (stream)->close (stream);
-}
-
-
-static gboolean
-stream_eos (CamelStream *stream)
-{
- return stream->eos;
-}
-
-/**
- * camel_stream_eos:
- * @stream: a CamelStream object
- *
- * Test if there are bytes left to read on the @stream object.
- *
- * Return value: %TRUE if all the contents on the stream has been read, or
- * %FALSE if information is still available.
- **/
-gboolean
-camel_stream_eos (CamelStream *stream)
-{
- g_return_val_if_fail (CAMEL_IS_STREAM (stream), TRUE);
-
- return CS_CLASS (stream)->eos (stream);
-}
-
-
-/**
- * camel_stream_reset: reset a stream
- * @stream: the stream object
- *
- * Reset a stream. That is, put it in a state where it can be read
- * from the beginning again. Not all streams in Camel are seekable,
- * but they must all be resettable.
- *
- * Return value: -1 on error.
- **/
-int
-camel_stream_reset (CamelStream *stream)
-{
- g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
-
- return CS_CLASS (stream)->reset (stream);
-}
-
-/***************** Utility functions ********************/
-
-/**
- * camel_stream_write_string:
- * @stream: a stream object
- * @string: a string
- *
- * Writes the string to the stream.
- *
- * Return value: the number of characters output, -1 on error.
- **/
-int
-camel_stream_write_string (CamelStream *stream, const char *string)
-{
- return camel_stream_write (stream, string, strlen (string));
-}
-
-/**
- * camel_stream_printf:
- * @stream: a stream object
- * @fmt: a printf-style format string
- *
- * This printfs the given data to @stream.
- *
- * Return value: the number of characters output, -1 on error.
- **/
-int
-camel_stream_printf (CamelStream *stream, const char *fmt, ... )
-{
- va_list args;
- char *string;
- int ret;
-
- g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
-
- va_start (args, fmt);
- string = g_strdup_vprintf (fmt, args);
- va_end (args);
-
- if (!string)
- return -1;
-
- ret = camel_stream_write (stream, string, strlen (string));
- g_free (string);
- return ret;
-}
-
-/**
- * camel_stream_write_to_stream:
- * @stream: Source CamelStream.
- * @output_stream: Destination CamelStream.
- *
- * Write all of a stream (until eos) into another stream, in a blocking
- * fashion.
- *
- * Return value: Returns -1 on error, or the number of bytes succesfully
- * copied across streams.
- **/
-int
-camel_stream_write_to_stream (CamelStream *stream, CamelStream *output_stream)
-{
- char tmp_buf[4096];
- int total = 0;
- int nb_read;
- int nb_written;
-
- g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
- g_return_val_if_fail (CAMEL_IS_STREAM (output_stream), -1);
-
- while (!camel_stream_eos (stream)) {
- nb_read = camel_stream_read (stream, tmp_buf, sizeof (tmp_buf));
- if (nb_read < 0)
- return -1;
- else if (nb_read > 0) {
- nb_written = 0;
-
- while (nb_written < nb_read) {
- int len = camel_stream_write (output_stream, tmp_buf + nb_written, nb_read - nb_written);
- if (len < 0)
- return -1;
- nb_written += len;
- }
- total += nb_written;
- }
- }
- return total;
-}
diff --git a/camel/camel-stream.h b/camel/camel-stream.h
deleted file mode 100644
index 44562b3321..0000000000
--- a/camel/camel-stream.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camel-stream.h : class for an abstract stream */
-
-/*
- * Author:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_STREAM_H
-#define CAMEL_STREAM_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-object.h>
-#include <stdarg.h>
-
-#define CAMEL_STREAM_TYPE (camel_stream_get_type ())
-#define CAMEL_STREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_TYPE, CamelStream))
-#define CAMEL_STREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STREAM_TYPE, CamelStreamClass))
-#define CAMEL_IS_STREAM(o) (GTK_CHECK_TYPE((o), CAMEL_STREAM_TYPE))
-
-struct _CamelStream
-{
- CamelObject parent_object;
-
- gboolean eos;
-};
-
-typedef struct {
- CamelObjectClass parent_class;
-
- /* Virtual methods */
-
- int (*read) (CamelStream *stream, char *buffer, unsigned int n);
- int (*write) (CamelStream *stream, const char *buffer, unsigned int n);
- int (*close) (CamelStream *stream);
- int (*flush) (CamelStream *stream);
- gboolean (*eos) (CamelStream *stream);
- int (*reset) (CamelStream *stream);
-
-} CamelStreamClass;
-
-/* Standard Gtk function */
-GtkType camel_stream_get_type (void);
-
-/* public methods */
-int camel_stream_read (CamelStream *stream, char *buffer, unsigned int n);
-int camel_stream_write (CamelStream *stream, const char *buffer, unsigned int n);
-int camel_stream_flush (CamelStream *stream);
-int camel_stream_close (CamelStream *stream);
-gboolean camel_stream_eos (CamelStream *stream);
-int camel_stream_reset (CamelStream *stream);
-
-/* utility macros and funcs */
-int camel_stream_write_string (CamelStream *stream, const char *string);
-int camel_stream_printf (CamelStream *stream, const char *fmt, ... ) G_GNUC_PRINTF (2, 3);
-int camel_stream_vprintf (CamelStream *stream, const char *fmt, va_list ap);
-
-/* Write a whole stream to another stream, until eof or error on
- * either stream.
- */
-int camel_stream_write_to_stream (CamelStream *stream, CamelStream *output_stream);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_H */
diff --git a/camel/camel-thread-proxy.c b/camel/camel-thread-proxy.c
deleted file mode 100644
index 9553499e8f..0000000000
--- a/camel/camel-thread-proxy.c
+++ /dev/null
@@ -1,514 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-pt-proxy.c : proxy folder using posix threads */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#include <config.h>
-#include "camel-marshal-utils.h"
-#include "camel-thread-proxy.h"
-#include <pthread.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-
-
-/* vocabulary:
- * operation: commanded by the main thread, executed by the child thread
- * callback: commanded by the child thread, generally when an operation is
- * completed. Executed in the main thread,
- */
-
-/* needed for proper casts of async funcs when
- * calling pthreads_create
- */
-typedef void * (*thread_call_func) (void *);
-
-/* forward declarations */
-static gboolean
-_thread_notification_catch (GIOChannel *source,
- GIOCondition condition,
- gpointer data);
-
-static void
-_notify_availability (CamelThreadProxy *proxy, gchar op_name);
-
-static int
-_init_notify_system (CamelThreadProxy *proxy);
-
-
-
-/**
- * camel_thread_proxy_new: create a new proxy object
- *
- * Create a new proxy object. This proxy object can be used
- * to run async operations and this operations can trigger
- * callbacks. It can also be used to proxy signals.
- *
- * Return value: The newly created proxy object
- **/
-CamelThreadProxy *
-camel_thread_proxy_new (void)
-{
- CamelThreadProxy *proxy;
-
- proxy = g_new (CamelThreadProxy, 1);
- if (!proxy)
- return NULL;
-
- proxy->server_op_queue = camel_op_queue_new ();
- proxy->client_op_queue = camel_op_queue_new ();
- proxy->signal_data_cond = g_cond_new();
- proxy->signal_data_mutex = g_mutex_new();
- if (_init_notify_system (proxy) < 0) {
- g_free (proxy);
- return NULL;
- }
- return proxy;
-}
-
-
-/**
- * camel_thread_proxy_free: free a proxy object
- * @proxy: proxy object to free
- *
- * free a proxy object
- **/
-void
-camel_thread_proxy_free (CamelThreadProxy *proxy)
-{
- g_cond_free (proxy->signal_data_cond);
- g_mutex_free (proxy->signal_data_mutex);
- camel_op_queue_free (proxy->server_op_queue);
- camel_op_queue_free (proxy->client_op_queue);
-}
-
-
-
-
-
-/* Operations handling */
-
-
-/**
- * _op_run_free_notify:
- * @folder: folder to notify when the operation is completed.
- * @op: operation to run.
- *
- * run an operation, free the operation field
- * and then notify the main thread of the op
- * completion.
- *
- * this routine is intended to be called
- * in a new thread (in _run_next_op_in_thread)
- *
- **/
-void
-_op_run_free_and_notify (CamelOp *op)
-{
- CamelThreadProxy *th_proxy;
-
- camel_op_run (op);
- camel_op_free (op);
- th_proxy = camel_op_get_user_data (op);
- _notify_availability (th_proxy, 'a');
-}
-
-
-/**
- * _run_next_op_in_thread:
- * @proxy_object:
- *
- * run the next operation pending in the proxy
- * operation queue
- **/
-static void
-_run_next_op_in_thread (CamelThreadProxy *proxy)
-{
- CamelOp *op;
- CamelOpQueue *server_op_queue;
- pthread_t thread;
-
- server_op_queue = proxy->server_op_queue;
- /* get the next pending operation */
- op = camel_op_queue_pop_op (server_op_queue);
- if (!op) {
- camel_op_queue_set_service_availability (server_op_queue, TRUE);
- return;
- }
-
- /* run the operation in a child thread */
- pthread_create (&thread, NULL, (thread_call_func) _op_run_free_and_notify, op);
-}
-
-
-
-/**
- * camel_thread_proxy_push_op: push an operation in the proxy operation queue
- * @proxy: proxy object
- * @op: operation to push in the execution queue
- *
- * if no thread is currently running, executes the
- * operation directly, otherwise push the operation
- * in the proxy operation queue.
- **/
-void
-camel_thread_proxy_push_op (CamelThreadProxy *proxy, CamelOp *op)
-{
- CamelOpQueue *server_op_queue;
-
- g_assert (proxy);
- server_op_queue = proxy->server_op_queue;
-
- /* put the proxy object in the user data
- so that it can be notified when the
- operation is completed */
- camel_op_set_user_data (op, (gpointer)proxy);
-
- /* get next operation */
- camel_op_queue_push_op (server_op_queue, op);
-
- if (camel_op_queue_get_service_availability (server_op_queue)) {
- /* no thread is currently running, run
- * the next operation. */
- camel_op_queue_set_service_availability (server_op_queue, FALSE);
- /* when the operation is completed in the
- child thread the main thread gets
- notified and executes next operation
- (see _thread_notification_catch, case 'a')
- so there is no need to set the service
- availability to FALSE except here
- */
- _run_next_op_in_thread (proxy);
- }
-}
-/**
- * _op_run_and_free: Run an operation and free it
- * @op: Operation object
- *
- * Run an operation object in the current thread
- * and free it.
- **/
-static void
-_op_run_and_free (CamelOp *op)
-{
- camel_op_run (op);
- camel_op_free (op);
-}
-
-
-
-
-
-
-/* Callbacks handling */
-
-/**
- * _run_next_cb: Run next callback pending in a proxy object
- * @proxy: Proxy object
- *
- * Run next callback in the callback queue of a proxy object
- **/
-static void
-_run_next_cb (CamelThreadProxy *proxy)
-{
- CamelOp *op;
- CamelOpQueue *client_op_queue;
-
- client_op_queue = proxy->client_op_queue;
-
- /* get the next pending operation */
- op = camel_op_queue_pop_op (client_op_queue);
- if (!op) return;
-
- /* run the operation in the main thread */
- _op_run_and_free (op);
-}
-
-
-/**
- * camel_thread_proxy_push_cb: push a callback in the client queue
- * @proxy: proxy object concerned by the callback
- * @cb: callback to push
- *
- * Push an operation in the client queue, ie the queue
- * containing the operations (callbacks) intended to be
- * executed in the main thread.
- **/
-void
-camel_thread_proxy_push_cb (CamelThreadProxy *proxy, CamelOp *cb)
-{
- CamelOpQueue *client_op_queue;
-
- client_op_queue = proxy->client_op_queue;
-
- /* put the proxy object in the user data
- so that it can be notified when the
- operation is completed */
- camel_op_set_user_data (cb, (gpointer)proxy);
-
- /* push the callback in the client queue */
- camel_op_queue_push_op (client_op_queue, cb);
-
- /* tell the main thread a new callback is there */
- _notify_availability (proxy, 'c');
-}
-
-
-
-/**
- * _init_notify_system: set the notify channel up
- * @proxy: proxy object
- *
- * called once to set the notification channel up
- **/
-static int
-_init_notify_system (CamelThreadProxy *proxy)
-{
- int filedes[2];
-
- /* set up the notification channel */
- if (pipe (filedes) < 0) {
- g_warning ("could not create pipe in "
- "CamelThreadProxy::_init_notify_system\n");
- return -1;
- }
-
-
- proxy->pipe_client_fd = filedes [0];
- proxy->pipe_server_fd = filedes [1];
- proxy->notify_source = g_io_channel_unix_new (filedes [0]);
- proxy->notify_channel = g_io_channel_unix_new (filedes [1]);
-
- /* the _thread_notification_catch function
- * will be called in the main thread when the
- * child thread writes some data in the channel */
- g_io_add_watch (proxy->notify_source, G_IO_IN,
- _thread_notification_catch,
- proxy);
-
- return 1;
-}
-
-/**
- * _notify_availability: notify the main thread from an event
- * @proxy: proxy object
- * @op_name: operation name
- *
- * called by child thread to notify the main
- * thread something is available for him.
- * What this thing is depends on @op_name:
- *
- * 'a' : thread available. That means the thread is ready
- * to process an operation.
- * 's' : a signal is available. Used by the signal proxy.
- *
- */
-static void
-_notify_availability (CamelThreadProxy *proxy, gchar op_name)
-{
- GIOChannel *notification_channel;
- guint bytes_written;
-
- notification_channel = proxy->notify_channel;
-
- do {
- /* the write operation will trigger the
- * watch on the main thread side */
- g_io_channel_write (notification_channel,
- &op_name,
- 1,
- &bytes_written);
- } while (bytes_written < 1);
-}
-
-
-
-/* signal proxying */
-
-
-
-/**
- * _signal_marshaller_server_side: called in the child thread to proxy a signal
- * @object:
- * @data:
- * @n_args:
- * @args:
- *
- *
- **/
-static void
-_signal_marshaller_server_side (GtkObject *object,
- gpointer data,
- guint n_args,
- GtkArg *args)
-{
- CamelThreadProxy *proxy;
- guint signal_id;
-
- proxy = CAMEL_THREAD_PROXY (gtk_object_get_data (object, "__proxy__"));
- signal_id = (guint)data;
- g_assert (proxy);
-
- g_mutex_lock (proxy->signal_data_mutex);
-
- /* we are going to wait for the main client thread
- * to have emitted the last signal we asked him
- * to proxy.
- */
- while (proxy->signal_data.args)
- g_cond_wait (proxy->signal_data_cond,
- proxy->signal_data_mutex);
-
- proxy->signal_data.signal_id = signal_id;
- proxy->signal_data.args = args;
-
-
- g_mutex_unlock (proxy->signal_data_mutex);
-
- /* tell the main thread there is a signal pending */
- _notify_availability (proxy, 's');
-}
-
-
-static void
-_signal_marshaller_client_side (CamelThreadProxy *proxy)
-{
- g_mutex_lock (proxy->signal_data_mutex);
- g_assert (proxy->signal_data.args);
-
- /* emit the pending signal */
- gtk_signal_emitv (GTK_OBJECT (proxy),
- proxy->signal_data.signal_id,
- proxy->signal_data.args);
-
- proxy->signal_data.args = NULL;
-
- /* if waiting for the signal to be treated,
- * awake the client thread up
- */
- g_cond_signal (proxy->signal_data_cond);
- g_mutex_unlock (proxy->signal_data_mutex);
-}
-
-
-/**
- * camel_thread_proxy_add_signals: init the signal proxy
- * @proxy: proxy
- * @proxy_object: Proxy Gtk Object
- * @real_object: Real Gtk Object
- * @signal_to_proxy: NULL terminated array of signal name
- *
- * Add some signals to the list of signals to be
- * proxied by the proxy object.
- * The signals emitted by the real object in the child
- * thread are reemited by the proxy object in the
- * main thread.
- **/
-void
-camel_thread_proxy_add_signals (CamelThreadProxy *proxy,
- GtkObject *proxy_object,
- GtkObject *real_object,
- char *signal_to_proxy[])
-{
- guint i;
-
- for (i=0; signal_to_proxy[i]; i++) {
- /* connect the signal to the signal marshaller
- * user_data is the signal id */
- gtk_signal_connect_full (GTK_OBJECT (real_object),
- signal_to_proxy[i],
- NULL,
- _signal_marshaller_server_side,
- (gpointer)gtk_signal_lookup (signal_to_proxy[i],
- GTK_OBJECT_CLASS (real_object)->type),
- NULL,
- TRUE,
- FALSE);
- }
-}
-
-/**** catch notification from child thread ****/
-/**
- * _thread_notification_catch: call by glib loop when data is available on the thread io channel
- * @source:
- * @condition:
- * @data:
- *
- * called by watch set on the IO channel
- *
- * Return value: TRUE because we don't want the watch to be removed
- **/
-static gboolean
-_thread_notification_catch (GIOChannel *source,
- GIOCondition condition,
- gpointer data)
-{
- CamelThreadProxy *proxy = CAMEL_THREAD_PROXY (data);
- gchar op_name;
- guint bytes_read;
- GIOError error;
-
- error = g_io_channel_read (source,
- &op_name,
- 1,
- &bytes_read);
-
- while ((!error) && (bytes_read == 1)) {
-
- switch (op_name) {
- case 'a': /* the thread is OK for a new operation */
- _run_next_op_in_thread (proxy);
- break;
- case 's': /* there is a pending signal to proxy */
- _signal_marshaller_client_side (proxy);
- break;
- case 'c': /* there is a cb pending in the main thread */
- _run_next_cb (proxy);
- break;
- }
-
- error = g_io_channel_read (source,
- &op_name,
- 1,
- &bytes_read);
-
- }
-
- /* do not remove the io watch */
- return TRUE;
-}
-
-
-
-
-
-
-
-
-
-
-
diff --git a/camel/camel-thread-proxy.h b/camel/camel-thread-proxy.h
deleted file mode 100644
index 050d8ed598..0000000000
--- a/camel/camel-thread-proxy.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-pt-proxy.h : proxy folder using posix threads */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-
-
-#ifndef CAMEL_THREAD_PROXY_H
-#define CAMEL_THREAD_PROXY_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-op-queue.h>
-
-#define CAMEL_THREAD_PROXY(o) (CamelThreadProxy *)(o)
-
-
-typedef struct {
- guint signal_id;
- GtkArg *args;
-} CamelThreadProxySignalData;
-
-
-typedef struct {
-
- GtkObject *real_object;
- GtkObject *proxy_object;
-
- CamelOpQueue *server_op_queue;
- CamelOpQueue *client_op_queue;
-
-
- gint pipe_client_fd;
- gint pipe_server_fd;
- GIOChannel *notify_source;
- GIOChannel *notify_channel;
-
- /* signal proxy */
- GMutex *signal_data_mutex;
- GCond *signal_data_cond;
- CamelThreadProxySignalData signal_data;
-
-} CamelThreadProxy;
-
-
-CamelThreadProxy *camel_thread_proxy_new (void);
-void camel_thread_proxy_free (CamelThreadProxy *proxy);
-
-void camel_thread_proxy_push_op (CamelThreadProxy *proxy, CamelOp *op);
-void camel_thread_proxy_push_cb (CamelThreadProxy *proxy, CamelOp *cb);
-
-void camel_thread_proxy_add_signals (CamelThreadProxy *proxy,
- GtkObject *proxy_object,
- GtkObject *real_object,
- char *signal_to_proxy[]);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_THREAD_PROXY_H */
-
-
diff --git a/camel/camel-transport.c b/camel/camel-transport.c
deleted file mode 100644
index 849248a6e7..0000000000
--- a/camel/camel-transport.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-transport.c : Abstract class for an email transport */
-
-/*
- *
- * Author :
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-transport.h"
-#include "camel-exception.h"
-
-/* Returns the class for a CamelTransport */
-#define CT_CLASS(so) CAMEL_TRANSPORT_CLASS (GTK_OBJECT(so)->klass)
-
-GtkType
-camel_transport_get_type (void)
-{
- static GtkType camel_transport_type = 0;
-
- if (!camel_transport_type) {
- GtkTypeInfo camel_transport_info =
- {
- "CamelTransport",
- sizeof (CamelTransport),
- sizeof (CamelTransportClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_transport_type = gtk_type_unique (CAMEL_SERVICE_TYPE, &camel_transport_info);
- }
-
- return camel_transport_type;
-}
-
-
-/**
- * camel_transport_can_send: Determine if a message is send-able on a transport
- * @transport: the transport
- * @message: the message
- *
- * Determines if a CamelMedium is of an appropriate subclass to send
- * via the given @transport. (Mail transports are not able to send
- * netnews articles, and vice versa.)
- *
- * Return value: TRUE or FALSE
- **/
-gboolean
-camel_transport_can_send (CamelTransport *transport, CamelMedium *message)
-{
- return CT_CLASS (transport)->can_send (transport, message);
-}
-
-/**
- * camel_transport_send: Send a message via a transport
- * @transport: the transport
- * @message: the message
- * @ex: a CamelException
- *
- * Sends the message to the recipients indicated in the message.
- *
- * Return value: success or failure.
- **/
-gboolean
-camel_transport_send (CamelTransport *transport, CamelMedium *message,
- CamelException *ex)
-{
- return CT_CLASS (transport)->send (transport, message, ex);
-}
-
-/**
- * camel_transport_send_to: Send a message non-standard recipients
- * @transport: the transport
- * @message: the message
- * @recipients: the recipients
- * @ex: a CamelException
- *
- * Sends the message to the given recipients, rather than to the
- * recipients indicated in the message.
- *
- * Return value: success or failure.
- **/
-gboolean
-camel_transport_send_to (CamelTransport *transport, CamelMedium *message,
- GList *recipients, CamelException *ex)
-{
- return CT_CLASS (transport)->send_to (transport, message,
- recipients, ex);
-}
diff --git a/camel/camel-transport.h b/camel/camel-transport.h
deleted file mode 100644
index fc8f0e3076..0000000000
--- a/camel/camel-transport.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-transport.h : Abstract class for an email transport */
-
-/*
- *
- * Author :
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_TRANSPORT_H
-#define CAMEL_TRANSPORT_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-service.h>
-
-#define CAMEL_TRANSPORT_TYPE (camel_transport_get_type ())
-#define CAMEL_TRANSPORT(obj) (GTK_CHECK_CAST((obj), CAMEL_TRANSPORT_TYPE, CamelTransport))
-#define CAMEL_TRANSPORT_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_TRANSPORT_TYPE, CamelTransportClass))
-#define CAMEL_IS_TRANSPORT(o) (GTK_CHECK_TYPE((o), CAMEL_TRANSPORT_TYPE))
-
-
-struct _CamelTransport
-{
- CamelService parent_object;
-
-};
-
-
-
-typedef struct {
- CamelServiceClass parent_class;
-
- gboolean (*can_send) (CamelTransport *transport, CamelMedium *message);
- gboolean (*send) (CamelTransport *transport, CamelMedium *message,
- CamelException *ex);
- gboolean (*send_to) (CamelTransport *transport,
- CamelMedium *message, GList *recipients,
- CamelException *ex);
-} CamelTransportClass;
-
-
-/* public methods */
-gboolean camel_transport_can_send (CamelTransport *transport,
- CamelMedium *message);
-
-gboolean camel_transport_send (CamelTransport *transport,
- CamelMedium *message,
- CamelException *ex);
-
-gboolean camel_transport_send_to (CamelTransport *transport,
- CamelMedium *message,
- GList *recipients,
- CamelException *ex);
-
-/* Standard Gtk function */
-GtkType camel_transport_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_TRANSPORT_H */
diff --git a/camel/camel-types.h b/camel/camel-types.h
deleted file mode 100644
index 706440b64d..0000000000
--- a/camel/camel-types.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef CAMEL_TYPES_H
-#define CAMEL_TYPES_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-typedef struct _CamelAddress CamelAddress;
-typedef struct _CamelDataWrapper CamelDataWrapper;
-typedef struct _CamelException CamelException;
-typedef struct _CamelFolder CamelFolder;
-typedef struct _CamelFolderSearch CamelFolderSearch;
-typedef struct _CamelFolderSummary CamelFolderSummary;
-typedef struct _CamelInternetAddress CamelInternetAddress;
-typedef struct _CamelMedium CamelMedium;
-typedef struct _CamelMimeFilter CamelMimeFilter;
-typedef struct _CamelMimeFilterBasic CamelMimeFilterBasic;
-typedef struct _CamelMimeFilterCharset CamelMimeFilterCharset;
-typedef struct _CamelMimeFilterIndex CamelMimeFilterIndex;
-typedef struct _CamelMimeFilterSave CamelMimeFilterSave;
-typedef struct _CamelMimeMessage CamelMimeMessage;
-typedef struct _CamelMimeParser CamelMimeParser;
-typedef struct _CamelMimePart CamelMimePart;
-typedef struct _CamelMultipart CamelMultipart;
-typedef struct _CamelNewsAddress CamelNewsAddress;
-typedef struct _CamelObject CamelObject;
-typedef struct _CamelSeekableStream CamelSeekableStream;
-typedef struct _CamelSeekableSubstream CamelSeekableSubstream;
-typedef struct _CamelService CamelService;
-typedef struct _CamelSession CamelSession;
-typedef struct _CamelSimpleDataWrapper CamelSimpleDataWrapper;
-typedef struct _CamelStore CamelStore;
-typedef struct _CamelStream CamelStream;
-typedef struct _CamelStreamBuffer CamelStreamBuffer;
-typedef struct _CamelStreamDataWrapper CamelStreamDataWrapper;
-typedef struct _CamelStreamFilter CamelStreamFilter;
-typedef struct _CamelStreamFs CamelStreamFs;
-typedef struct _CamelStreamMem CamelStreamMem;
-typedef struct _CamelTransport CamelTransport;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_TYPES_H */
diff --git a/camel/camel-url.c b/camel/camel-url.c
deleted file mode 100644
index 96721bda24..0000000000
--- a/camel/camel-url.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-url.c : utility functions to parse URLs */
-
-
-/*
- * Authors:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- * Dan Winship <danw@helixcode.com>
- * Tiago Antào <tiagoantao@bigfoot.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "camel-url.h"
-#include "camel-exception.h"
-
-/**
- * camel_url_new: create a CamelURL object from a string
- * @url_string: The string containing the URL to scan
- *
- * This routine takes a string and parses it as a URL of the form:
- *
- * protocol://user;AUTH=mech:password@host:port/path
- *
- * The protocol, followed by a ":" is required. If it is followed by
- * "//", there must be an "authority" containing at least a host,
- * which ends at the end of the string or at the next "/". If there
- * is an "@" in the authority, there must be a username before it,
- * and the host comes after it. The authmech, password, and port are
- * optional, and the punctuation that preceeds them is omitted if
- * they are. Everything after the authority (or everything after the
- * protocol if there was no authority) is the path. We consider the
- * "/" between the authority and the path to be part of the path,
- * although this is incorrect according to RFC 1738.
- *
- * The port, if present, must be numeric.
- *
- * If nothing but the protocol (and the ":") is present, the "empty"
- * flag will be set on the returned URL.
- *
- * Return value: a CamelURL structure containing the URL items.
- **/
-CamelURL *
-camel_url_new (const char *url_string, CamelException *ex)
-{
- CamelURL *url;
- char *semi, *colon, *at, *slash;
- char *p;
-
- /* Find protocol: initial substring until ":" */
- colon = strchr (url_string, ':');
- if (!colon) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- "URL string `%s' contains no protocol",
- url_string);
- return NULL;
- }
-
- url = g_new0 (CamelURL, 1);
- url->protocol = g_strndup (url_string, colon - url_string);
- g_strdown (url->protocol);
-
- /* Check protocol */
- p = url->protocol;
- while (*p) {
- if (!((*p >= 'a' && *p <= 'z') ||
- (*p == '-') || (*p == '+') || (*p == '.'))) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- "URL string `%s' contains an invalid protocol",
- url_string);
- return NULL;
- }
- p++;
- }
-
- if (strncmp (colon, "://", 3) != 0) {
- if (*(colon + 1)) {
- url->path = g_strdup (colon + 1);
- camel_url_decode (url->path);
- } else
- url->empty = TRUE;
- return url;
- }
-
- url_string = colon + 3;
-
- /* If there is an @ sign in the authority, look for user,
- * authmech, and password before it.
- */
- slash = strchr (url_string, '/');
- at = strchr (url_string, '@');
- if (at && (!slash || at < slash)) {
- colon = strchr (url_string, ':');
- if (colon && colon < at) {
- url->passwd = g_strndup (colon + 1, at - colon - 1);
- camel_url_decode (url->passwd);
- } else {
- url->passwd = NULL;
- colon = at;
- }
-
- semi = strchr(url_string, ';');
- if (semi && (semi < colon || (!colon && semi < at)) &&
- !strncasecmp (semi, ";auth=", 6)) {
- url->authmech = g_strndup (semi + 6,
- colon - semi - 6);
- camel_url_decode (url->authmech);
- } else {
- url->authmech = NULL;
- semi = colon;
- }
-
- url->user = g_strndup (url_string, semi - url_string);
- camel_url_decode (url->user);
- url_string = at + 1;
- } else
- url->user = url->passwd = url->authmech = NULL;
-
- /* Find host and port. */
- slash = strchr (url_string, '/');
- colon = strchr (url_string, ':');
- if (slash && colon > slash)
- colon = NULL;
-
- if (colon) {
- url->host = g_strndup (url_string, colon - url_string);
- url->port = strtoul (colon + 1, &colon, 10);
- if (*colon && colon != slash) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- "Port number in URL `%s' is non-"
- "numeric", url_string);
- camel_url_free (url);
- return NULL;
- }
- } else if (slash) {
- url->host = g_strndup (url_string, slash - url_string);
- camel_url_decode (url->host);
- url->port = 0;
- } else {
- url->host = g_strdup (url_string);
- camel_url_decode (url->host);
- url->port = 0;
- }
-
- if (!slash)
- slash = "/";
- url->path = g_strdup (slash);
- camel_url_decode (url->path);
-
- return url;
-}
-
-char *
-camel_url_to_string (CamelURL *url, gboolean show_passwd)
-{
- char *return_result;
- char *user = NULL, *authmech = NULL, *passwd = NULL;
- char *host = NULL, *path = NULL;
- char port[20];
-
- if (url->user)
- user = camel_url_encode (url->user, TRUE, ":;@/");
- if (url->authmech)
- authmech = camel_url_encode (url->authmech, TRUE, ":@/");
- if (show_passwd && url->passwd)
- passwd = camel_url_encode (url->passwd, TRUE, "@/");
- if (url->host)
- host = camel_url_encode (url->host, TRUE, ":/");
- if (url->port)
- g_snprintf (port, sizeof (port), "%d", url->port);
- else
- *port = '\0';
- if (url->path)
- path = camel_url_encode (url->path, FALSE, NULL);
-
- return_result = g_strdup_printf ("%s:%s%s%s%s%s%s%s%s%s%s%s",
- url->protocol,
- host ? "//" : "",
- user ? user : "",
- authmech ? ";auth=" : "",
- authmech ? authmech : "",
- passwd ? ":" : "",
- passwd ? passwd : "",
- user ? "@" : "",
- host ? host : "",
- *port ? ":" : "",
- port,
- path ? path : "");
- g_free (user);
- g_free (authmech);
- g_free (passwd);
- g_free (host);
- g_free (path);
-
- return return_result;
-}
-
-void
-camel_url_free (CamelURL *url)
-{
- g_assert (url);
-
- g_free (url->protocol);
- g_free (url->user);
- g_free (url->authmech);
- g_free (url->passwd);
- g_free (url->host);
- g_free (url->path);
-
- g_free (url);
-}
-
-
-/**
- * camel_url_encode:
- * @part: a URL part
- * @escape_unsafe: whether or not to %-escape "unsafe" characters.
- * ("%#<>{}|\^~[]`)
- * @escape_extra: additional characters to escape.
- *
- * This %-encodes the given URL part and returns the escaped version
- * in allocated memory, which the caller must free when it is done.
- **/
-char *
-camel_url_encode (char *part, gboolean escape_unsafe, char *escape_extra)
-{
- char *work, *p;
-
- /* worst case scenario = 3 times the initial */
- p = work = g_malloc (3 * strlen (part) + 1);
-
- while (*part) {
- if (((guchar) *part >= 127) || ((guchar) *part <= ' ') ||
- (escape_unsafe && strchr ("\"%#<>{}|\\^~[]`", *part)) ||
- (escape_extra && strchr (escape_extra, *part))) {
- sprintf (p, "%%%.02hX", (guchar) *part++);
- p += 3;
- } else
- *p++ = *part++;
- }
- *p = '\0';
-
- return work;
-}
-
-#define HEXVAL(c) (isdigit (c) ? (c) - '0' : tolower (c) - 'a' + 10)
-
-/**
- * camel_url_decode:
- * @part: a URL part
- *
- * %-decodes the passed-in URL *in place*. The decoded version is
- * never longer than the encoded version, so there does not need to
- * be any additional space at the end of the string.
- */
-void
-camel_url_decode (char *part)
-{
- guchar *s, *d;
-
- s = d = (guchar *)part;
- while (*s) {
- if (*s == '%') {
- if (isxdigit (s[1]) && isxdigit (s[2])) {
- *d++ = HEXVAL (s[1]) * 16 + HEXVAL (s[2]);
- s += 3;
- } else
- *d++ = *s++;
- } else
- *d++ = *s++;
- }
- *d = '\0';
-}
diff --git a/camel/camel-url.h b/camel/camel-url.h
deleted file mode 100644
index f2a4c645f5..0000000000
--- a/camel/camel-url.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-url.h : utility functions to parse URLs */
-
-/*
- * Authors:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_URL_H
-#define CAMEL_URL_H 1
-
-#include <glib.h>
-#include <camel/camel-types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-typedef struct {
- char *protocol;
- char *user;
- char *authmech;
- char *passwd;
- char *host;
- int port;
- char *path;
-
- /* This is set if the URL contained only a protocol. */
- gboolean empty;
-} CamelURL;
-
-CamelURL *camel_url_new (const char *url_string, CamelException *ex);
-char *camel_url_to_string (CamelURL *url, gboolean show_password);
-void camel_url_free (CamelURL *url);
-
-char *camel_url_encode (char *part, gboolean escape_unsafe,
- char *escape_extra);
-void camel_url_decode (char *part);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* URL_UTIL_H */
diff --git a/camel/camel.c b/camel/camel.c
deleted file mode 100644
index 0121c1082f..0000000000
--- a/camel/camel.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel.h"
-#include <unicode.h>
-
-gint
-camel_init(void)
-{
-
-
-#ifdef ENABLE_THREADS
-#ifdef G_THREADS_ENABLED
- g_thread_init (NULL);
-#else /* G_THREADS_ENABLED */
- printf ("Threads are not supported by your version of glib\n");
-#endif /* G_THREADS_ENABLED */
-#endif /* ENABLE_THREADS */
-
- unicode_init ();
-
- return 0;
-}
diff --git a/camel/camel.h b/camel/camel.h
deleted file mode 100644
index d3a65b1312..0000000000
--- a/camel/camel.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_H
-#define CAMEL_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-data-wrapper.h>
-#include <camel/camel-exception.h>
-#include <camel/camel-folder.h>
-#include <camel/camel-medium.h>
-#include <camel/camel-mime-filter-basic.h>
-#include <camel/camel-mime-filter-charset.h>
-#include <camel/camel-mime-filter-index.h>
-#include <camel/camel-mime-filter-save.h>
-#include <camel/camel-mime-filter.h>
-#include <camel/camel-mime-message.h>
-#include <camel/camel-mime-parser.h>
-#include <camel/camel-mime-part-utils.h>
-#include <camel/camel-mime-part.h>
-#include <camel/camel-mime-utils.h>
-#include <camel/camel-movemail.h>
-#include <camel/camel-multipart.h>
-#include <camel/camel-provider.h>
-#include <camel/camel-seekable-stream.h>
-#include <camel/camel-seekable-substream.h>
-#include <camel/camel-service.h>
-#include <camel/camel-session.h>
-#include <camel/camel-store.h>
-#include <camel/camel-stream-buffer.h>
-#include <camel/camel-stream-filter.h>
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-#include <camel/camel-stream.h>
-#include <camel/camel-transport.h>
-#include <camel/camel-url.h>
-#include <camel/gmime-content-field.h>
-#include <camel/gstring-util.h>
-#include <camel/hash-table-utils.h>
-#include <camel/md5-utils.h>
-#include <camel/string-utils.h>
-
-gint camel_init (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_H */
diff --git a/camel/devel-docs/camel_stream.dia b/camel/devel-docs/camel_stream.dia
deleted file mode 100644
index d91d1bb153..0000000000
--- a/camel/devel-docs/camel_stream.dia
+++ /dev/null
Binary files differ
diff --git a/camel/gmime-content-field.c b/camel/gmime-content-field.c
deleted file mode 100644
index 4d38314873..0000000000
--- a/camel/gmime-content-field.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mime-content_field.c : mime content type field utilities */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include <string.h>
-#include "camel-mime-utils.h"
-
-/**
- * gmime_content_field_new: Creates a new GMimeContentField object
- * @type: mime type
- * @subtype: mime subtype
- *
- * Creates a GMimeContentField object and initialize it with
- * a mime type and a mime subtype. For example,
- * gmime_content_field_new ("application", "postcript");
- * will create a content field with complete mime type
- * "application/postscript"
- *
- * Return value: The newly created GMimeContentField object
- **/
-GMimeContentField *
-gmime_content_field_new (const gchar *type, const gchar *subtype)
-{
- GMimeContentField *ctf;
-
- ctf = g_new (GMimeContentField, 1);
- ctf->content_type = header_content_type_new(type, subtype);
- ctf->type = ctf->content_type->type;
- ctf->subtype = ctf->content_type->subtype;
- ctf->ref = 1;
- return ctf;
-}
-
-/**
- * gmime_content_field_ref: add a reference to a GMimeContentField object
- * @content_field: GMimeContentField object
- *
- * Tell a GMimeContentField object that something holds a reference
- * on him. This, coupled with the corresponding
- * gmime_content_field_unref() method allow several
- * objects to use the same GMimeContentField object.
- **/
-void
-gmime_content_field_ref (GMimeContentField *content_field)
-{
- content_field->ref += 1;
- header_content_type_ref (content_field->content_type);
-}
-
-/**
- * gmime_content_field_unref: remove a reference to a GMimeContentField object
- * @content_field: GMimeContentField object
- *
- * Tell a GMimeContentField object that something which
- * was holding a reference to him does not need it anymore.
- * When no more reference exist, the GMimeContentField object
- * is freed using gmime_content_field_free().
- *
- **/
-void
-gmime_content_field_unref (GMimeContentField *content_field)
-{
- if (!content_field) return;
-
- content_field->ref -= 1;
- header_content_type_unref (content_field->content_type);
- if (content_field->ref <= 0)
- g_free (content_field);
-}
-
-
-
-/**
- * gmime_content_field_set_parameter: set a parameter for a GMimeContentField object
- * @content_field: content field
- * @attribute: parameter name
- * @value: paramteter value
- *
- * set a parameter (called attribute in RFC 2045) of a content field. Meaningfull
- * or valid parameters name depend on the content type object. For example,
- * gmime_content_field_set_parameter (cf, "charset", "us-ascii");
- * will make sense for a "text/plain" content field but not for a
- * "image/gif". This routine does not check parameter validity.
- **/
-void
-gmime_content_field_set_parameter (GMimeContentField *content_field, const gchar *attribute, const gchar *value)
-{
- header_content_type_set_param(content_field->content_type, attribute, value);
-}
-
-/**
- * gmime_content_field_write_to_stream: write a mime content type to a stream
- * @content_field: content type object
- * @stream: the stream
- *
- *
- **/
-void
-gmime_content_field_write_to_stream (GMimeContentField *content_field, CamelStream *stream)
-{
- char *txt;
-
- if (!content_field)
- return;
-
- txt = header_content_type_format(content_field->content_type);
- if (txt) {
- camel_stream_printf (stream, "Content-Type: %s\n", txt);
- g_free(txt);
- }
-}
-
-/**
- * gmime_content_field_get_mime_type: return the mime type of the content field object
- * @content_field: content field object
- *
- * A RFC 2045 content type field contains the mime type in the
- * form "type/subtype" (example : "application/postscript") and some
- * parameters (attribute/value pairs). This routine returns the mime type
- * in a gchar object. THIS OBJECT MUST BE FREED BY THE CALLER.
- *
- * Return value: the mime type in the form "type/subtype" or NULL if not defined.
- **/
-gchar *
-gmime_content_field_get_mime_type (GMimeContentField *content_field)
-{
- gchar *mime_type;
-
- if (!content_field->content_type->type) return NULL;
-
- if (content_field->content_type->subtype)
- mime_type = g_strdup_printf ("%s/%s", content_field->content_type->type, content_field->content_type->subtype);
- else
- mime_type = g_strdup (content_field->content_type->type);
- return mime_type;
-}
-
-/**
- * gmime_content_field_get_parameter: return the value of a mime type parameter
- * @content_field: content field object
- * @name: name of the parameter
- *
- * Returns the value of a parameter contained in the content field
- * object. The content type is formed of a mime type, a mime subtype,
- * and a parameter list. Each parameter is a name/value pair. This
- * routine returns the value assiciated to a given name.
- * When the parameter does not exist, NULL is returned.
- *
- * Return value: parameter value, or NULL if not found.
- **/
-const gchar *
-gmime_content_field_get_parameter (GMimeContentField *content_field, const gchar *name)
-{
- g_assert (content_field);
-
- g_assert (name);
- return header_content_type_param(content_field->content_type, name);
-}
-
-
-
-
-/**
- * gmime_content_field_construct_from_string: construct a ContentType object by parsing a string.
- *
- * @content_field: content type object to construct
- * @string: string containing the content type field
- *
- * Parse a string containing a content type field as defined in
- * RFC 2045, and construct the corresponding ContentType object.
- * The string is not modified and not used in the ContentType
- * object. It can and must be freed by the calling part.
- **/
-void
-gmime_content_field_construct_from_string (GMimeContentField *content_field, const gchar *string)
-{
- struct _header_content_type *new;
-
- g_assert (string);
- g_assert (content_field);
-
- new = header_content_type_decode(string);
- if (content_field->content_type)
- header_content_type_unref(content_field->content_type);
-
- if (new == NULL) {
- new = header_content_type_new(NULL, NULL);
- g_warning("Cannot parse content-type string: %s", string);
- }
- content_field->content_type = new;
- content_field->type = new->type;
- content_field->subtype = new->subtype;
-}
-
-/**
- * gmime_content_field_is_type:
- * @content_field: An initialised GMimeContentField.
- * @type: MIME Major type name.
- * @subtype: MIME subtype.
- *
- * Returns true if the content_field is of the type @type and subtype @subtype.
- * If @subtype is the special wildcard "*", then it will match any type.
- *
- * If the @content_field is empty, then it will match "text/plain", or "text/ *".
- *
- * Return value:
- **/
-int
-gmime_content_field_is_type (GMimeContentField *content_field, const char *type, const char *subtype)
-{
- return header_content_type_is(content_field->content_type, type, subtype);
-}
diff --git a/camel/gmime-content-field.h b/camel/gmime-content-field.h
deleted file mode 100644
index 5a28d0fedb..0000000000
--- a/camel/gmime-content-field.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mime-content_field.h : mime content type field utilities */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef GMIME_CONTENT_FIELD_H
-#define GMIME_CONTENT_FIELD_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include <stdio.h>
-#include <camel/camel-stream.h>
-#include <camel/camel-mime-utils.h>
-
-typedef struct {
- struct _header_content_type *content_type;
-
- /* these should be deprecated (use the accessors) */
- char *type; /* these are only copies of the ones in content_type */
- char *subtype;
-
- gint ref;
-
-} GMimeContentField;
-
-GMimeContentField *gmime_content_field_new (const gchar *type, const gchar *subtype);
-void gmime_content_field_ref (GMimeContentField *content_field);
-void gmime_content_field_unref (GMimeContentField *content_field);
-
-void gmime_content_field_set_parameter (GMimeContentField *content_field, const gchar *attribute, const gchar *value);
-void gmime_content_field_write_to_stream (GMimeContentField *content_field, CamelStream *stream);
-void gmime_content_field_construct_from_string (GMimeContentField *content_field, const gchar *string);
-void gmime_content_field_free (GMimeContentField *content_field);
-gchar * gmime_content_field_get_mime_type (GMimeContentField *content_field);
-const gchar *gmime_content_field_get_parameter (GMimeContentField *content_field, const gchar *name);
-
-int gmime_content_field_is_type (GMimeContentField *content_field, const char *type, const char *subtype);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* GMIME_CONTENT_FIELD_H */
diff --git a/camel/gstring-util.c b/camel/gstring-util.c
deleted file mode 100644
index a0c1345b71..0000000000
--- a/camel/gstring-util.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* gstring-util : utilities for gstring object */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#include <config.h>
-#include "gstring-util.h"
-#include <string.h>
-
-/**
- * g_string_equals : test if two string are equal
- *
- * @string1 : first string
- * @string2 : second string
- *
- * @Return Value : true if the strings equal, false otherwise
- **/
-gboolean
-g_string_equals (GString *string1, GString *string2)
-{
- g_assert (string1);
- g_assert (string2);
- return !strcmp (string1->str, string2->str);
-}
-
-
-
-
-/**
- * g_string_clone : clone a GString
- *
- * @string : the string to clone
- *
- * @Return Value : the clone ...
- **/
-GString *
-g_string_clone (GString *string)
-{
- return g_string_new (string->str);
-}
-
-/**
- * g_string_append_g_string : append a GString to another GString
- *
- * @dest_string : string which will be appended
- * @other_string : string to append
- *
- **/
-void
-g_string_append_g_string(GString *dest_string, GString *other_string)
-{
- g_assert(other_string);
- g_assert(dest_string);
-
- if (other_string->len)
- g_string_append(dest_string, other_string->str);
-}
-
-/**
- * g_string_equal_for_hash: test equality of two GStrings for hash tables
- * @v: string 1
- * @v2: string 2
- *
- *
- *
- * Return value:
- **/
-gint
-g_string_equal_for_hash (gconstpointer v, gconstpointer v2)
-{
- return strcmp ( ((const GString*)v)->str, ((const GString*)v2)->str) == 0;
-}
-
-gint
-g_string_equal_for_glist (gconstpointer v, gconstpointer v2)
-{
- return !strcmp ( ((const GString*)v)->str, ((const GString*)v2)->str) == 0;
-}
-
-
-/**
- * g_string_hash: computes a hash value for a Gstring
- * @v: Gstring object
- *
- *
- *
- * Return value:
- **/
-guint
-g_string_hash (gconstpointer v)
-{
- return g_str_hash(((const GString*)v)->str);
-}
-
-
-
-
-/* utility func : frees a GString element in a GList */
-static void
-__g_string_list_free_string (gpointer data, gpointer user_data)
-{
- GString *string = (GString *)data;
- g_string_free(string, TRUE);
-}
-
-
-void
-g_string_list_free (GList *string_list)
-{
- g_list_foreach(string_list, __g_string_list_free_string, NULL);
- g_list_free(string_list);
-}
-
-
-
-
-
-
-GList *
-g_string_split (GString *string, char sep, gchar *trim_chars, GStringTrimOption trim_options)
-{
- GList *result = NULL;
- gint first, last, pos;
- gchar *str;
- gchar *new_str;
- GString *new_gstring;
-
- g_assert (string);
- str = string->str;
- if (!str) return NULL;
-
- first = 0;
- last = strlen(str) - 1;
-
- /* strip leading and trailing separators */
- while ( (first<=last) && (str[first]==sep) )
- first++;
- while ( (first<=last) && (str[last]==sep) )
- last--;
-
-
- while (first<=last) {
- pos = first;
- /* find next separator */
- while ((pos<=last) && (str[pos]!=sep)) pos++;
- if (first != pos) {
- new_str = g_strndup (str+first, pos-first);
- new_gstring = g_string_new (new_str);
- g_free (new_str);
- /* could do trimming in line to speed up this code */
- if (trim_chars) g_string_trim (new_gstring, trim_chars, trim_options);
- result = g_list_append (result, new_gstring);
- }
- first = pos + 1;
- }
-
- return result;
-}
-
-
-void
-g_string_trim (GString *string, gchar *chars, GStringTrimOption options)
-{
- gint first_ok;
- gint last_ok;
- guint length;
- gchar *str;
-
- if ((!string) || (!string->str))
- return;
- str = string->str;
- length = strlen (str);
- if (!length)
- return;
-
- first_ok = 0;
- last_ok = length - 1;
-
- if (options & GSTRING_TRIM_STRIP_LEADING)
- while ( (first_ok <= last_ok) && (strchr (chars, str[first_ok])) )
- first_ok++;
-
- if (options & GSTRING_TRIM_STRIP_TRAILING)
- while ( (first_ok <= last_ok) && (strchr (chars, str[last_ok])) )
- last_ok++;
-
- if (first_ok > 0)
- g_string_erase (string, 0, first_ok);
-
- if (last_ok < length-1)
- g_string_truncate (string, last_ok - first_ok +1);
-
-}
diff --git a/camel/gstring-util.h b/camel/gstring-util.h
deleted file mode 100644
index 487bbc8a3b..0000000000
--- a/camel/gstring-util.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* gstring-util : utilities for gstring object */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#ifndef GSTRING_UTIL_H
-#define GSTRING_UTIL_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-
-typedef enum {
- GSTRING_TRIM_NONE = 0,
- GSTRING_TRIM_STRIP_TRAILING = 1,
- GSTRING_TRIM_STRIP_LEADING = 2
-} GStringTrimOption;
-
-
-gboolean g_string_equals (GString *string1, GString *string2);
-GString *g_string_clone (GString *string);
-void g_string_append_g_string (GString *dest_string,
- GString *other_string);
-
-gboolean g_string_equal_for_hash (gconstpointer v, gconstpointer v2);
-gboolean g_string_equal_for_glist (gconstpointer v, gconstpointer v2);
-guint g_string_hash (gconstpointer v);
-void g_string_list_free (GList *string_list);
-
-GList *g_string_split (GString *string, char sep,
- gchar *trim_chars, GStringTrimOption trim_options);
-void g_string_trim (GString *string, gchar *chars,
- GStringTrimOption options);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* GSTRING_UTIL_H */
diff --git a/camel/hash-table-utils.c b/camel/hash-table-utils.c
deleted file mode 100644
index b04eaa3ce7..0000000000
--- a/camel/hash-table-utils.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* generic utilities for hash tables */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <ctype.h>
-#include "glib.h"
-#include "hash-table-utils.h"
-
-
-/*
- * free a (key/value) hash table pair.
- * to be called in a g_hash_table_foreach()
- * before g_hash_table_destroy().
- */
-void
-g_hash_table_generic_free (gpointer key, gpointer value, gpointer user_data)
-{
- g_free (key);
- g_free (value);
-}
-
-
-
-/***/
-/* use these two funcs for case insensitive hash table */
-
-gint
-g_strcase_equal (gconstpointer a, gconstpointer b)
-{
- return (g_strcasecmp ((gchar *)a, (gchar *)b) == 0);
-}
-
-
-/* modified g_str_hash from glib/gstring.c
- because it would have been too slow to
- us g_strdown() on the string */
-/* a char* hash function from ASU */
-guint
-g_strcase_hash (gconstpointer v)
-{
- const char *s = (char*)v;
- const char *p;
- guint h=0, g;
-
- for(p = s; *p != '\0'; p += 1) {
- h = ( h << 4 ) + toupper(*p);
- if ( ( g = h & 0xf0000000 ) ) {
- h = h ^ (g >> 24);
- h = h ^ g;
- }
- }
-
- return h /* % M */;
-}
-
-
-
-/***/
diff --git a/camel/hash-table-utils.h b/camel/hash-table-utils.h
deleted file mode 100644
index 2904991848..0000000000
--- a/camel/hash-table-utils.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* generic utilities for hash tables */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef HASH_TABLE_UTILS_H
-#define HASH_TABLE_UTILS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-void g_hash_table_generic_free (gpointer key, gpointer value, gpointer user_data);
-
-gint g_strcase_equal (gconstpointer a, gconstpointer b);
-guint g_strcase_hash (gconstpointer v);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* HASH_TABLE_UTILS_H */
diff --git a/camel/md5-utils.c b/camel/md5-utils.c
deleted file mode 100644
index 7363eaec40..0000000000
--- a/camel/md5-utils.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to md5_init, call md5_update as
- * needed on buffers full of bytes, and then call md5_Final, which
- * will fill a supplied 16-byte array with the digest.
- */
-
-/* parts of this file are :
- * Written March 1993 by Branko Lankester
- * Modified June 1993 by Colin Plumb for altered md5.c.
- * Modified October 1995 by Erik Troan for RPM
- */
-
-
-#include "md5-utils.h"
-#include <stdio.h>
-
-static void md5_transform (guint32 buf[4], const guint32 in[16]);
-
-static gint _ie = 0x44332211;
-static union _endian { gint i; gchar b[4]; } *_endian = (union _endian *)&_ie;
-#define IS_BIG_ENDIAN() (_endian->b[0] == '\x44')
-#define IS_LITTLE_ENDIAN() (_endian->b[0] == '\x11')
-
-
-/*
- * Note: this code is harmless on little-endian machines.
- */
-static void
-_byte_reverse (guchar *buf, guint32 longs)
-{
- guint32 t;
- do {
- t = (guint32) ((guint32) buf[3] << 8 | buf[2]) << 16 |
- ((guint32) buf[1] << 8 | buf[0]);
- *(guint32 *) buf = t;
- buf += 4;
- } while (--longs);
-}
-
-/**
- * md5_init: Initialise an md5 context object
- * @ctx: md5 context
- *
- * Initialise an md5 buffer.
- *
- **/
-void
-md5_init (MD5Context *ctx)
-{
- ctx->buf[0] = 0x67452301;
- ctx->buf[1] = 0xefcdab89;
- ctx->buf[2] = 0x98badcfe;
- ctx->buf[3] = 0x10325476;
-
- ctx->bits[0] = 0;
- ctx->bits[1] = 0;
-
- if (IS_BIG_ENDIAN())
- ctx->doByteReverse = 1;
- else
- ctx->doByteReverse = 0;
-}
-
-
-
-/**
- * md5_update: add a buffer to md5 hash computation
- * @ctx: conetxt object used for md5 computaion
- * @buf: buffer to add
- * @len: buffer length
- *
- * Update context to reflect the concatenation of another buffer full
- * of bytes. Use this to progressively construct an md5 hash.
- **/
-void
-md5_update (MD5Context *ctx, const guchar *buf, guint32 len)
-{
- guint32 t;
-
- /* Update bitcount */
-
- t = ctx->bits[0];
- if ((ctx->bits[0] = t + ((guint32) len << 3)) < t)
- ctx->bits[1]++; /* Carry from low to high */
- ctx->bits[1] += len >> 29;
-
- t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
-
- /* Handle any leading odd-sized chunks */
-
- if (t) {
- guchar *p = (guchar *) ctx->in + t;
-
- t = 64 - t;
- if (len < t) {
- memcpy (p, buf, len);
- return;
- }
- memcpy (p, buf, t);
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 16);
- md5_transform (ctx->buf, (guint32 *) ctx->in);
- buf += t;
- len -= t;
- }
- /* Process data in 64-byte chunks */
-
- while (len >= 64) {
- memcpy (ctx->in, buf, 64);
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 16);
- md5_transform (ctx->buf, (guint32 *) ctx->in);
- buf += 64;
- len -= 64;
- }
-
- /* Handle any remaining bytes of data. */
-
- memcpy (ctx->in, buf, len);
-}
-
-
-
-
-
-/*
- * Final wrapup - pad to 64-byte boundary with the bit pattern
- * 1 0* (64-bit count of bits processed, MSB-first)
- */
-/**
- * md5_final: copy the final md5 hash to a bufer
- * @digest: 16 bytes buffer
- * @ctx: context containing the calculated md5
- *
- * copy the final md5 hash to a bufer
- **/
-void
-md5_final (MD5Context *ctx, guchar digest[16])
-{
- guint32 count;
- guchar *p;
-
- /* Compute number of bytes mod 64 */
- count = (ctx->bits[0] >> 3) & 0x3F;
-
- /* Set the first char of padding to 0x80. This is safe since there is
- always at least one byte free */
- p = ctx->in + count;
- *p++ = 0x80;
-
- /* Bytes of padding needed to make 64 bytes */
- count = 64 - 1 - count;
-
- /* Pad out to 56 mod 64 */
- if (count < 8) {
- /* Two lots of padding: Pad the first block to 64 bytes */
- memset (p, 0, count);
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 16);
- md5_transform (ctx->buf, (guint32 *) ctx->in);
-
- /* Now fill the next block with 56 bytes */
- memset (ctx->in, 0, 56);
- } else {
- /* Pad block to 56 bytes */
- memset (p, 0, count - 8);
- }
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 14);
-
- /* Append length in bits and transform */
- ((guint32 *) ctx->in)[14] = ctx->bits[0];
- ((guint32 *) ctx->in)[15] = ctx->bits[1];
-
- md5_transform (ctx->buf, (guint32 *) ctx->in);
- if (ctx->doByteReverse)
- _byte_reverse ((guchar *) ctx->buf, 4);
- memcpy (digest, ctx->buf, 16);
-}
-
-
-
-
-/* The four core functions - F1 is optimized somewhat */
-
-/* #define F1(x, y, z) (x & y | ~x & z) */
-#define F1(x, y, z) (z ^ (x & (y ^ z)))
-#define F2(x, y, z) F1(z, x, y)
-#define F3(x, y, z) (x ^ y ^ z)
-#define F4(x, y, z) (y ^ (x | ~z))
-
-/* This is the central step in the MD5 algorithm. */
-#define MD5STEP(f, w, x, y, z, data, s) \
- ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
-
-/*
- * The core of the MD5 algorithm, this alters an existing MD5 hash to
- * reflect the addition of 16 longwords of new data. md5_Update blocks
- * the data and converts bytes into longwords for this routine.
- */
-static void
-md5_transform (guint32 buf[4], const guint32 in[16])
-{
- register guint32 a, b, c, d;
-
- a = buf[0];
- b = buf[1];
- c = buf[2];
- d = buf[3];
-
- MD5STEP (F1, a, b, c, d, in[0] + 0xd76aa478, 7);
- MD5STEP (F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
- MD5STEP (F1, c, d, a, b, in[2] + 0x242070db, 17);
- MD5STEP (F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
- MD5STEP (F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
- MD5STEP (F1, d, a, b, c, in[5] + 0x4787c62a, 12);
- MD5STEP (F1, c, d, a, b, in[6] + 0xa8304613, 17);
- MD5STEP (F1, b, c, d, a, in[7] + 0xfd469501, 22);
- MD5STEP (F1, a, b, c, d, in[8] + 0x698098d8, 7);
- MD5STEP (F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
- MD5STEP (F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
- MD5STEP (F1, b, c, d, a, in[11] + 0x895cd7be, 22);
- MD5STEP (F1, a, b, c, d, in[12] + 0x6b901122, 7);
- MD5STEP (F1, d, a, b, c, in[13] + 0xfd987193, 12);
- MD5STEP (F1, c, d, a, b, in[14] + 0xa679438e, 17);
- MD5STEP (F1, b, c, d, a, in[15] + 0x49b40821, 22);
-
- MD5STEP (F2, a, b, c, d, in[1] + 0xf61e2562, 5);
- MD5STEP (F2, d, a, b, c, in[6] + 0xc040b340, 9);
- MD5STEP (F2, c, d, a, b, in[11] + 0x265e5a51, 14);
- MD5STEP (F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
- MD5STEP (F2, a, b, c, d, in[5] + 0xd62f105d, 5);
- MD5STEP (F2, d, a, b, c, in[10] + 0x02441453, 9);
- MD5STEP (F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
- MD5STEP (F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
- MD5STEP (F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
- MD5STEP (F2, d, a, b, c, in[14] + 0xc33707d6, 9);
- MD5STEP (F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
- MD5STEP (F2, b, c, d, a, in[8] + 0x455a14ed, 20);
- MD5STEP (F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
- MD5STEP (F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
- MD5STEP (F2, c, d, a, b, in[7] + 0x676f02d9, 14);
- MD5STEP (F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-
- MD5STEP (F3, a, b, c, d, in[5] + 0xfffa3942, 4);
- MD5STEP (F3, d, a, b, c, in[8] + 0x8771f681, 11);
- MD5STEP (F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
- MD5STEP (F3, b, c, d, a, in[14] + 0xfde5380c, 23);
- MD5STEP (F3, a, b, c, d, in[1] + 0xa4beea44, 4);
- MD5STEP (F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
- MD5STEP (F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
- MD5STEP (F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
- MD5STEP (F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
- MD5STEP (F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
- MD5STEP (F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
- MD5STEP (F3, b, c, d, a, in[6] + 0x04881d05, 23);
- MD5STEP (F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
- MD5STEP (F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
- MD5STEP (F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
- MD5STEP (F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-
- MD5STEP (F4, a, b, c, d, in[0] + 0xf4292244, 6);
- MD5STEP (F4, d, a, b, c, in[7] + 0x432aff97, 10);
- MD5STEP (F4, c, d, a, b, in[14] + 0xab9423a7, 15);
- MD5STEP (F4, b, c, d, a, in[5] + 0xfc93a039, 21);
- MD5STEP (F4, a, b, c, d, in[12] + 0x655b59c3, 6);
- MD5STEP (F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
- MD5STEP (F4, c, d, a, b, in[10] + 0xffeff47d, 15);
- MD5STEP (F4, b, c, d, a, in[1] + 0x85845dd1, 21);
- MD5STEP (F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
- MD5STEP (F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
- MD5STEP (F4, c, d, a, b, in[6] + 0xa3014314, 15);
- MD5STEP (F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
- MD5STEP (F4, a, b, c, d, in[4] + 0xf7537e82, 6);
- MD5STEP (F4, d, a, b, c, in[11] + 0xbd3af235, 10);
- MD5STEP (F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
- MD5STEP (F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-
- buf[0] += a;
- buf[1] += b;
- buf[2] += c;
- buf[3] += d;
-}
-
-
-
-
-/**
- * md5_get_digest: get the md5 hash of a buffer
- * @buffer: byte buffer
- * @buffer_size: buffer size (in bytes)
- * @digest: 16 bytes buffer receiving the hash code.
- *
- * Get the md5 hash of a buffer. The result is put in
- * the 16 bytes buffer @digest .
- **/
-void
-md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16])
-{
- MD5Context ctx;
-
- md5_init (&ctx);
- md5_update (&ctx, buffer, buffer_size);
- md5_final (&ctx, digest);
-
-}
-
-
-/**
- * md5_get_digest_from_stream: get the md5 hash of a stream
- * @stream: stream
- * @digest: 16 bytes buffer receiving the hash code.
- *
- * Get the md5 hash of a stream. The result is put in
- * the 16 bytes buffer @digest .
- **/
-void
-md5_get_digest_from_stream (CamelStream *stream, guchar digest[16])
-{
- MD5Context ctx;
- guchar tmp_buf[1024];
- gint nb_bytes_read;
-
- md5_init (&ctx);
-
- nb_bytes_read = camel_stream_read (stream, tmp_buf, 1024);
- while (nb_bytes_read) {
- md5_update (&ctx, tmp_buf, nb_bytes_read);
- nb_bytes_read = camel_stream_read (stream, tmp_buf, 1024);
- }
-
- md5_final (&ctx, digest);
-
-}
-
-
-
-
-/**
- * md5_get_digest_from_file: get the md5 hash of a file
- * @filename: file name
- * @digest: 16 bytes buffer receiving the hash code.
- *
- * Get the md5 hash of a file. The result is put in
- * the 16 bytes buffer @digest .
- **/
-void
-md5_get_digest_from_file (const gchar *filename, guchar digest[16])
-{
- MD5Context ctx;
- guchar tmp_buf[1024];
- gint nb_bytes_read;
- FILE *fp;
-
- printf("generating checksum\n");
-
- md5_init (&ctx);
- fp = fopen(filename, "r");
- if (!fp) {
- return;
- }
-
- while ((nb_bytes_read = fread (tmp_buf, sizeof (guchar), 1024, fp)) > 0)
- md5_update (&ctx, tmp_buf, nb_bytes_read);
-
- if (ferror(fp)) {
- fclose(fp);
- return;
- }
-
-
- md5_final (&ctx, digest);
-
- printf("checksum done\n");
-}
-
-
-
-
diff --git a/camel/md5-utils.h b/camel/md5-utils.h
deleted file mode 100644
index c911250d56..0000000000
--- a/camel/md5-utils.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to rpmMD5Init, call rpmMD5Update as
- * needed on buffers full of bytes, and then call rpmMD5Final, which
- * will fill a supplied 16-byte array with the digest.
- */
-
-/* parts of this file are :
- * Written March 1993 by Branko Lankester
- * Modified June 1993 by Colin Plumb for altered md5.c.
- * Modified October 1995 by Erik Troan for RPM
- */
-
-
-#ifndef MD5_UTILS_H
-#define MD5_UTILS_H
-
-#include <glib.h>
-#include <camel/camel-stream.h>
-
-typedef struct {
- guint32 buf[4];
- guint32 bits[2];
- guchar in[64];
- gint doByteReverse;
-
-} MD5Context ;
-
-
-void md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16]);
-void md5_get_digest_from_stream (CamelStream *stream, guchar digest[16]);
-
-/* use this one when speed is needed */
-/* for use in provider code only */
-void md5_get_digest_from_file (const gchar *filename, guchar digest[16]);
-
-/* raw routines */
-void md5_init (MD5Context *ctx);
-void md5_update (MD5Context *ctx, const guchar *buf, guint32 len);
-void md5_final (MD5Context *ctx, guchar digest[16]);
-
-
-#endif /* MD5_UTILS_H */
diff --git a/camel/providers/.cvsignore b/camel/providers/.cvsignore
deleted file mode 100644
index 3dda72986f..0000000000
--- a/camel/providers/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile.in
-Makefile
diff --git a/camel/providers/MH/.cvsignore b/camel/providers/MH/.cvsignore
deleted file mode 100644
index 2e7b174532..0000000000
--- a/camel/providers/MH/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile.in
-Makefile
-.deps
-*.lo
-*.la
-.libs
diff --git a/camel/providers/MH/Makefile.am b/camel/providers/MH/Makefile.am
deleted file mode 100644
index 59662a07dd..0000000000
--- a/camel/providers/MH/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelmhincludedir = $(includedir)/camel
-
-
-lib_LTLIBRARIES = libcamelmh.la
-
-INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \
- -I$(top_srcdir)/intl \
- $(GTK_INCLUDEDIR) -I$(top_srcdir)/camel \
- -DG_LOG_DOMAIN=\"camel-mh-provider\"
-
-libcamelmh_la_SOURCES = \
- camel-mh-folder.c \
- camel-mh-provider.c \
- camel-mh-store.c \
- mh-summary.c \
- mh-uid.c \
- mh-utils.c
-
-libcamelmhinclude_HEADERS = \
- camel-mh-folder.h \
- camel-mh-store.h \
- mh-summary.c \
- mh-uid.h \
- mh-utils.h
-
-
-libcamelmh_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-
-EXTRA_DIST =
diff --git a/camel/providers/MH/camel-mh-folder.c b/camel/providers/MH/camel-mh-folder.c
deleted file mode 100644
index f4ff8f305a..0000000000
--- a/camel/providers/MH/camel-mh-folder.c
+++ /dev/null
@@ -1,1022 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-folder.c : Abstract class for an email folder */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include "camel-mh-folder.h"
-#include "camel-mh-store.h"
-#include "gstring-util.h"
-#include "camel-log.h"
-#include "camel-stream-fs.h"
-#include "camel-stream-buffered-fs.h"
-#include "camel-folder-summary.h"
-#include "gmime-utils.h"
-#include "mh-utils.h"
-#include "mh-uid.h"
-#include "mh-summary.h"
-
-
-static CamelFolderClass *parent_class=NULL;
-
-/* Returns the class for a CamelMhFolder */
-#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMHS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void _set_name(CamelFolder *folder, const gchar *name, CamelException *ex);
-static void _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _create(CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean _delete_messages (CamelFolder *folder, CamelException *ex);
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message (CamelFolder *folder, gint number, CamelException *ex);
-static gint _get_message_count (CamelFolder *folder, CamelException *ex);
-static gint _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static void _expunge (CamelFolder *folder, CamelException *ex);
-static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex);
-static void _open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex);
-static void _close (CamelFolder *folder, gboolean expunge, CamelException *ex);
-
-static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-static GList *_get_uid_list (CamelFolder *folder, CamelException *ex);
-
-/* some utility functions */
-static int copy_reg (const char *src_path, const char *dst_path, CamelException *ex);
-
-static void
-camel_mh_folder_class_init (CamelMhFolderClass *camel_mh_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_mh_folder_class);
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_folder_class->init_with_store = _init_with_store;
- camel_folder_class->set_name = _set_name;
- camel_folder_class->exists = _exists;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->list_subfolders = _list_subfolders;
- camel_folder_class->get_message = _get_message;
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->append_message = _append_message;
- camel_folder_class->expunge = _expunge;
- camel_folder_class->copy_message_to = _copy_message_to;
- camel_folder_class->open = _open;
- camel_folder_class->close = _close;
- camel_folder_class->get_message_uid = _get_message_uid;
- camel_folder_class->get_message_by_uid = _get_message_by_uid;
- camel_folder_class->get_uid_list = _get_uid_list;
-
-}
-
-
-
-
-
-
-
-GtkType
-camel_mh_folder_get_type (void)
-{
- static GtkType camel_mh_folder_type = 0;
-
- if (!camel_mh_folder_type) {
- GtkTypeInfo camel_mh_folder_info =
- {
- "CamelMhFolder",
- sizeof (CamelMhFolder),
- sizeof (CamelMhFolderClass),
- (GtkClassInitFunc) camel_mh_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mh_folder_type = gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_mh_folder_info);
- }
-
- return camel_mh_folder_type;
-}
-
-
-
-static gint
-_message_name_compare (gconstpointer a, gconstpointer b)
-{
- gchar *m1 = (gchar *)a;
- gchar *m2 = (gchar *)b;
- gint len_diff;
-
- return (atoi (m1) - atoi (m2));
-}
-
-
-static void
-_init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex)
-{
- /* call parent method */
- parent_class->init_with_store (folder, parent_store, ex);
-
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- folder->has_summary_capability = TRUE;
- folder->has_uid_capability = TRUE;
-
- folder->summary = NULL;
-
-}
-
-
-
-static void
-_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- struct dirent *dir_entry;
- DIR *dir_handle;
-
-
- if (folder->open_state == FOLDER_OPEN) return;
-
-
- /* create message list */
- /* read the whole folder and sort message names */
- dir_handle = opendir (mh_folder->directory_path);
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while (dir_entry != NULL) {
- /* tests if the entry correspond to a message file */
- if (mh_is_a_message_file (dir_entry->d_name, mh_folder->directory_path))
- /* add the file name to the list */
- mh_folder->file_name_list = g_list_insert_sorted (mh_folder->file_name_list,
- g_strdup (dir_entry->d_name),
- _message_name_compare);
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- /* get (or create) uid list */
- if (!(mh_load_uid_list (mh_folder) > 0))
- mh_generate_uid_list (mh_folder);
-
- /* get or create summary */
- /* it is important that it comes after uid list reading/generation */
- if (!(mh_load_summary (mh_folder) > 0))
- mh_generate_summary (folder);
- printf ("**** summary = %p\n", folder->summary);
-
-}
-
-
-
-static void
-_close (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
-
- /* save uid list, if any */
- if (mh_folder->uid_array)
- mh_save_uid_list (mh_folder);
-
- /* save summary, if any */
- if (folder->summary)
- mh_save_summary (mh_folder);
-
- /* call parent implementation */
- parent_class->close (folder, expunge, ex);
-}
-
-
-
-
-
-/**
- * camel_mh_folder_set_name: set the name of an MH folder
- * @folder: the folder to set the name
- * @name: a string representing the (short) name
- *
- *
- *
- **/
-static void
-_set_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- const gchar *root_dir_path;
- gchar *full_name;
- const gchar *parent_full_name;
- gchar separator;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMhFolder::set_name\n");
- g_assert (folder);
- g_assert (name);
- g_assert (folder->parent_store);
-
- /* call default implementation */
- parent_class->set_name (folder, name, ex);
-
- if (mh_folder->directory_path) g_free (mh_folder->directory_path);
-
- separator = camel_store_get_separator (folder->parent_store);
- root_dir_path = camel_mh_store_get_toplevel_dir (CAMEL_MH_STORE(folder->parent_store));
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::set_name full_name is %s\n", folder->full_name);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::set_name root_dir_path is %s\n", root_dir_path);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::separator is %c\n", separator);
-
- mh_folder->directory_path = g_strdup_printf ("%s%c%s", root_dir_path, separator, folder->full_name);
-
- if (!camel_folder_exists (folder, ex)) return;
-
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::set_name mh_folder->directory_path is %s\n",
- mh_folder->directory_path);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMhFolder::set_name\n");
-}
-
-
-
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- struct stat stat_buf;
- gint stat_error;
- gboolean exists;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMhFolder::exists\n");
- g_assert (folder);
-
- if (!mh_folder->directory_path) return FALSE;
-
- stat_error = stat (mh_folder->directory_path, &stat_buf);
- if (stat_error == -1) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::exists when executing stat on %s, stat_error = %d\n",
- mh_folder->directory_path, stat_error);
- CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
- return FALSE;
- }
- exists = S_ISDIR (stat_buf.st_mode);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMhFolder::exists\n");
- return exists;
-}
-
-
-static gboolean
-_create (CamelFolder *folder, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- mode_t dir_mode = S_IRWXU;
- gint mkdir_error;
-
- g_assert(folder);
-
- /* call default implementation */
- parent_class->create (folder, ex);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return FALSE;
-
- if (camel_folder_exists (folder, ex)) return TRUE;
-
- mkdir_error = mkdir (directory_path, dir_mode);
- return (mkdir_error == -1);
-}
-
-
-
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
-
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- gint rmdir_error = 0;
-
- g_assert(folder);
-
- /* call default implementation */
- parent_class->delete (folder, recurse, ex);
- /* the default implementation will care about deleting
- messages first and recursing the operation if
- necessary */
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return FALSE;
-
- if (!camel_folder_exists (folder, ex)) return TRUE;
-
- /* physically delete the directory */
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::delete removing directory %s\n", directory_path);
- rmdir_error = rmdir (directory_path);
- if (rmdir_error == -1) {
- CAMEL_LOG_WARNING ("CamelMhFolder::delete Error when removing directory %s\n", directory_path);
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
- }
-
- return (rmdir_error != -1);
-}
-
-
-static gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
-
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- struct stat stat_buf;
- gint stat_error = 0;
- gchar *entry_name;
- struct dirent *dir_entry;
- gint unlink_error = 0;
- DIR *dir_handle;
-
- g_assert(folder);
-
- /* call default implementation */
- parent_class->delete_messages (folder, ex);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return FALSE;
-
- if (!camel_folder_exists (folder, ex)) return TRUE;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while ((stat_error != -1) && (unlink_error != -1) && (dir_entry != NULL)) {
-
- /* get the name of the next entry in the dir */
- entry_name = dir_entry->d_name;
- stat_error = stat (mh_folder->directory_path, &stat_buf);
-
- /* is it a regular file ? */
- if ((stat_error != -1) && S_ISREG(stat_buf.st_mode)) {
- /* yes, delete it */
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::delete_messages removing file %s\n", entry_name);
- unlink_error = unlink(entry_name);
-
- if (unlink_error == -1) {
- CAMEL_LOG_WARNING ("CamelMhFolder::delete_messages Error when deleting file %s\n",
- entry_name);
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
- }
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- return ((stat_error != -1) && (unlink_error != -1));
-
-}
-
-
-
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- GList *subfolder_name_list = NULL;
-
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- struct stat stat_buf;
- gint stat_error = 0;
- GList *file_list;
- gchar *entry_name;
- gchar *full_entry_name;
- struct dirent *dir_entry;
- DIR *dir_handle;
-
- g_assert(folder);
-
- /* call default implementation */
- parent_class->delete_messages (folder, ex);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return NULL;
-
- if (!camel_folder_exists (folder, ex)) return NULL;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while ((stat_error != -1) && (dir_entry != NULL)) {
-
- /* get the name of the next entry in the dir */
- entry_name = dir_entry->d_name;
- full_entry_name = g_strdup_printf ("%s/%s", mh_folder->directory_path, entry_name);
- stat_error = stat (full_entry_name, &stat_buf);
- g_free (full_entry_name);
-
- /* is it a directory ? */
- if ((stat_error != -1) && S_ISDIR (stat_buf.st_mode)) {
- /* yes, add it to the list */
- if (entry_name[0] != '.') {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::list_subfolders adding %s\n", entry_name);
- subfolder_name_list = g_list_append (subfolder_name_list, g_strdup (entry_name));
- }
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- return subfolder_name_list;
-}
-
-
-
-
-
-static void
-_filename_free (gpointer data)
-{
- g_free ((gchar *)data);
-}
-
-
-/* slow routine, may be optimixed, or we should use
- caches if users complain */
-static CamelMimeMessage *
-_get_message (CamelFolder *folder, gint number, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- gchar *message_name;
- gchar *message_file_name;
- CamelStream *input_stream = NULL;
- CamelMimeMessage *message = NULL;
- GList *message_list = NULL;
-
- g_assert(folder);
-
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return NULL;
-
-
-
- message_name = g_list_nth_data (mh_folder->file_name_list, number);
-
- if (message_name != NULL) {
- CAMEL_LOG_FULL_DEBUG ("CanelMhFolder::get_message message number = %d, name = %s\n",
- number, message_name);
- message_file_name = g_strdup_printf ("%s/%s", directory_path, message_name);
- input_stream = camel_stream_buffered_fs_new_with_name (message_file_name, CAMEL_STREAM_BUFFERED_FS_READ);
-
- if (input_stream != NULL) {
-#warning use session field here
- message = camel_mime_message_new ();
- camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (message), input_stream);
- gtk_object_unref (GTK_OBJECT (input_stream));
- message->message_number = number;
- gtk_object_set_data_full (GTK_OBJECT (message), "filename",
- g_strdup (message_name), _filename_free);
-
-#warning Set flags and all this stuff here
- }
- g_free (message_file_name);
- } else
- CAMEL_LOG_FULL_DEBUG ("CanelMhFolder::get_message message number = %d, not found\n", number);
-
-
- return message;
-}
-
-
-
-static gint
-_get_message_count (CamelFolder *folder, CamelException *ex)
-{
-
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- struct dirent *dir_entry;
- DIR *dir_handle;
- guint message_count = 0;
-
- g_assert(folder);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return -1;
-
- if (!camel_folder_exists (folder, ex)) return 0;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while (dir_entry != NULL) {
- /* tests if the entry correspond to a message file */
- if (mh_is_a_message_file (dir_entry->d_name, directory_path))
- message_count++;
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::get_message_count found %d messages\n", message_count);
- return message_count;
-}
-
-
-
-static gboolean
-_find_next_free_message_file (CamelFolder *folder, gint *new_msg_number, gchar **new_msg_filename, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- struct dirent *dir_entry;
- DIR *dir_handle;
- gint last_max_message_number = 0;
- gint current_message_number;
-
- g_assert(folder);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return FALSE;
-
- if (!camel_folder_exists (folder, ex)) return FALSE;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while (dir_entry != NULL) {
- /* tests if the entry correspond to a message file */
- if (mh_is_a_message_file (dir_entry->d_name, directory_path)) {
- /* see if the message number is the biggest found */
- current_message_number = atoi (dir_entry->d_name);
- if (current_message_number > last_max_message_number)
- last_max_message_number = current_message_number;
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
- closedir (dir_handle);
-
- *new_msg_number = last_max_message_number + 1;
- *new_msg_filename = g_strdup_printf ("%s/%d", directory_path, *new_msg_number);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::find_next_free_message_file new message path is %s\n",
- *new_msg_filename);
- return TRUE;
-
-
-}
-static gint
-_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- guint new_msg_number;
- gchar *new_msg_filename;
- CamelStream *output_stream;
- gboolean error;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMhFolder::append_message\n");
- if (!_find_next_free_message_file (folder, &new_msg_number, &new_msg_filename, ex))
- return -1;
-
- output_stream = camel_stream_fs_new_with_name (new_msg_filename, CAMEL_STREAM_FS_WRITE);
- if (output_stream != NULL) {
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream);
- camel_stream_close (output_stream);
- } else {
- CAMEL_LOG_WARNING ("CamelMhFolder::append_message could not open %s for writing\n",
- new_msg_filename);
- CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
- error = TRUE;
- }
-
- g_free (new_msg_filename);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMhFolder::append_message\n");
- if (error) return -1;
- else return new_msg_number;
-}
-
-
-
-
-
-static void
-_expunge (CamelFolder *folder, CamelException *ex)
-{
- /* For the moment, we look in the folder active message
- * list. I did not make my mind for the moment, should
- * the gtk_object->destroy signal be used to expunge
- * freed messages objects marked DELETED ?
- */
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- CamelMimeMessage *message;
- GList *message_node;
- gchar *fullpath;
- gchar *filename;
- gint unlink_error;
- const gchar *directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelFolder::expunge\n");
-
- message_node = folder->message_list;
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return;
-
- /* look in folder message list which messages
- * need to be expunged */
- while ( message_node) {
- message = CAMEL_MIME_MESSAGE (message_node->data);
-
- if (message && camel_mime_message_get_flag (message, "DELETED")) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::expunge, expunging message %d\n", message->message_number);
- /* expunge the message */
- filename = gtk_object_get_data (GTK_OBJECT (message), "filename");
- fullpath = g_strdup_printf ("%s/%s", directory_path, filename);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::expunge, message fullpath is %s\n",
- fullpath);
- unlink_error = unlink(fullpath);
- if (unlink_error != -1) {
- message->expunged = TRUE;
- } else {
- CAMEL_LOG_WARNING ("CamelMhFolder:: could not unlink %s (message %d)\n",
- fullpath, message->message_number);
- CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
- }
- }
- message_node = message_node->next;
- CAMEL_LOG_FULL_DEBUG ("CamelFolder::expunge, examined message node %p\n", message_node);
- }
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolder::expunge\n");
-}
-
-
-static void
-_copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex)
-{
- gchar *src_msg_filename;
- guint dest_msg_number;
- gchar *dest_msg_filename;
-
- if (IS_CAMEL_MH_FOLDER (dest_folder)) {
- /*g_return_if_fail (message->parent_folder == folder);*/
-
- if (!_find_next_free_message_file (dest_folder, &dest_msg_number, &dest_msg_filename, ex))
- return;
- src_msg_filename = gtk_object_get_data (GTK_OBJECT (message), "fullpath");
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::copy_to copy file %s to %s\n", src_msg_filename, dest_msg_filename);
- copy_reg (src_msg_filename, dest_msg_filename, ex);
-
- } else
- parent_class->copy_message_to (folder, message, dest_folder, ex);
-}
-
-
-
-/** UID **/
-
-static const gchar *
-_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- GArray *uid_array;
- gboolean found = FALSE;
- MhUidCouple *uid_couple;
- gchar *filename;
- guint file_number;
- gint i;
-
- /* if the message already has its uid stored,
- return it */
- if (message->message_uid)
- return (message->message_uid);
-
- /* else, it has a filename associated to it */
- filename = gtk_object_get_data (GTK_OBJECT (message), "filename");
- file_number = atoi (file_number);
-
- uid_array = mh_folder->uid_array;
- uid_couple = (MhUidCouple *)uid_array->data;
-
- /* look in the uid array for the file number */
- found = (uid_couple->file_number == file_number);
- for (i=0; (i<uid_array->len) && (!found); i++) {
- uid_couple++;
- found = (uid_couple->file_number == file_number);
- }
-
- if (found) return uid_couple->uid;
- else return NULL;
-
-}
-
-
-static CamelMimeMessage *
-_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- GArray *uid_array;
- gboolean found = FALSE;
- MhUidCouple *uid_couple;
- gint file_number;
- gchar *filename;
- CamelMimeMessage *message = NULL;
- CamelStream *input_stream;
- int i;
-
- /*
- * because they are constructed with md5
- * signatures, all MH uids are 16 bytes long
- */
- if (strlen (uid) != 16) return NULL;
-
- uid_array = mh_folder->uid_array;
- uid_couple = (MhUidCouple *)uid_array->data;
-
- found = !strncmp (uid, uid_couple->uid, 16 * sizeof (guchar));
- for (i=0; (i<uid_array->len) && (!found); i++) {
- uid_couple++;
- found = !strncmp (uid, uid_couple->uid, 16 * sizeof (guchar));
- }
- if (found) {
- /* physically retrieve the message */
- file_number = uid_couple->file_number;
- filename = g_strdup_printf ("%d", file_number);
- input_stream = camel_stream_buffered_fs_new_with_name (filename, CAMEL_STREAM_BUFFERED_FS_READ);
-
- if (input_stream != NULL) {
-#warning use session field here
- message = camel_mime_message_new ();
- camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (message), input_stream);
- gtk_object_unref (GTK_OBJECT (input_stream));
-
- /* set message UID in CamelMimeMessage */
- message->message_uid = g_strdup (uid);
-
- }
- g_free (filename);
- }
-
- return message;
-
-}
-
-static GList *
-_get_uid_list (CamelFolder *folder, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- GList *uid_list;
- GArray *uid_array;
- MhUidCouple *uid_couple;
- int i;
-
- uid_array = mh_folder->uid_array;
- uid_couple = (MhUidCouple *)uid_array->data;
-
- for (i=0; i<uid_array->len; i++) {
- uid_list = g_list_prepend (uid_list, uid_couple->uid);
- uid_couple++;
- }
-
- return uid_list;
-}
-
-
-
-
-
-
-
-
-/************************************************************************/
-
-/*** Took directly from GNU fileutils-4.0 ***/
-/* Copyright (C) 89, 90, 91, 95, 96, 97, 1998 Free Software Foundation. */
-/* This may be rwritten soon. -Bertrand */
-
-
-/* Write LEN bytes at PTR to descriptor DESC, retrying if interrupted.
- Return LEN upon success, write's (negative) error code otherwise. */
-int
-full_write (int desc, const char *ptr, size_t len)
-{
- int total_written;
-
- total_written = 0;
- while (len > 0)
- {
- int written = write (desc, ptr, len);
- if (written < 0)
- {
- if (errno == EINTR)
- continue;
- return written;
- }
- total_written += written;
- ptr += written;
- len -= written;
- }
- return total_written;
-}
-
-
-
-
-static int
-copy_reg (const char *src_path, const char *dst_path, CamelException *ex)
-{
- char *buf;
- int buf_size;
- int dest_desc;
- int source_desc;
- int n_read;
- struct stat sb;
- char *cp;
- int *ip;
- int return_val = 0;
- off_t n_read_total = 0;
- int last_write_made_hole = 0;
- int make_holes = TRUE;
-
- source_desc = open (src_path, O_RDONLY);
- if (source_desc < 0)
- {
- /* If SRC_PATH doesn't exist, then chances are good that the
- user did something like this `cp --backup foo foo': and foo
- existed to start with, but copy_internal renamed DST_PATH
- with the backup suffix, thus also renaming SRC_PATH. */
- if (errno == ENOENT)
- error (0, 0, "`%s' and `%s' are the same file",
- src_path, dst_path);
- else
- error (0, errno, "%s", src_path);
-
- return -1;
- }
-
- /* Create the new regular file with small permissions initially,
- to not create a security hole. */
-
- dest_desc = open (dst_path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
- if (dest_desc < 0)
- {
- error (0, errno, "cannot create regular file `%s'", dst_path);
- return_val = -1;
- goto ret2;
- }
-
- /* Find out the optimal buffer size. */
-
- if (fstat (dest_desc, &sb))
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- goto ret;
- }
-
- buf_size = 8192;
-
-
-
- /* Make a buffer with space for a sentinel at the end. */
-
- buf = (char *) alloca (buf_size + sizeof (int));
-
- for (;;)
- {
- n_read = read (source_desc, buf, buf_size);
- if (n_read < 0)
- {
- if (errno == EINTR)
- continue;
- error (0, errno, "%s", src_path);
- return_val = -1;
- goto ret;
- }
- if (n_read == 0)
- break;
-
- n_read_total += n_read;
-
- ip = 0;
- if (make_holes)
- {
- buf[n_read] = 1; /* Sentinel to stop loop. */
-
- /* Find first nonzero *word*, or the word with the sentinel. */
-
- ip = (int *) buf;
- while (*ip++ == 0)
- ;
-
- /* Find the first nonzero *byte*, or the sentinel. */
-
- cp = (char *) (ip - 1);
- while (*cp++ == 0)
- ;
-
- /* If we found the sentinel, the whole input block was zero,
- and we can make a hole. */
-
- if (cp > buf + n_read)
- {
- /* Make a hole. */
- if (lseek (dest_desc, (off_t) n_read, SEEK_CUR) < 0L)
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- goto ret;
- }
- last_write_made_hole = 1;
- }
- else
- /* Clear to indicate that a normal write is needed. */
- ip = 0;
- }
- if (ip == 0)
- {
- if (full_write (dest_desc, buf, n_read) < 0)
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- goto ret;
- }
- last_write_made_hole = 0;
- }
- }
-
- /* If the file ends with a `hole', something needs to be written at
- the end. Otherwise the kernel would truncate the file at the end
- of the last write operation. */
-
- if (last_write_made_hole)
- {
-#if HAVE_FTRUNCATE
- /* Write a null character and truncate it again. */
- if (full_write (dest_desc, "", 1) < 0
- || ftruncate (dest_desc, n_read_total) < 0)
-#else
- /* Seek backwards one character and write a null. */
- if (lseek (dest_desc, (off_t) -1, SEEK_CUR) < 0L
- || full_write (dest_desc, "", 1) < 0)
-#endif
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- }
- }
-
-ret:
- if (close (dest_desc) < 0)
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- }
-ret2:
- if (close (source_desc) < 0)
- {
- error (0, errno, "%s", src_path);
- return_val = -1;
- }
-
- return return_val;
-}
diff --git a/camel/providers/MH/camel-mh-folder.h b/camel/providers/MH/camel-mh-folder.h
deleted file mode 100644
index 40800375eb..0000000000
--- a/camel/providers/MH/camel-mh-folder.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-folder.h : Abstract class for an email folder */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MH_FOLDER_H
-#define CAMEL_MH_FOLDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-folder.h"
-/* #include "camel-store.h" */
-
-#define CAMEL_MH_FOLDER_TYPE (camel_mh_folder_get_type ())
-#define CAMEL_MH_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_MH_FOLDER_TYPE, CamelMhFolder))
-#define CAMEL_MH_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MH_FOLDER_TYPE, CamelMhFolderClass))
-#define IS_CAMEL_MH_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_MH_FOLDER_TYPE))
-
-
-typedef struct {
- CamelFolder parent_object;
-
- gchar *directory_path;
- GList *file_name_list;
- GArray *uid_array;
-
-} CamelMhFolder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMhFolderClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mh_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MH_FOLDER_H */
diff --git a/camel/providers/MH/camel-mh-provider.c b/camel/providers/MH/camel-mh-provider.c
deleted file mode 100644
index 316b8a0797..0000000000
--- a/camel/providers/MH/camel-mh-provider.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-provider.c: mh provider registration code */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "config.h"
-#include "camel-mh-store.h"
-#include "camel-provider.h"
-#include "camel-log.h"
-
-
-static CamelProvider _mh_provider = {
- (GtkType) 0,
- PROVIDER_STORE,
- "mh",
- "Camel default mh provider",
- "This is a very simple provider, mh is a bad protocol anyway",
- (GModule *) NULL
-};
-
-
-
-CamelProvider *
-camel_provider_module_init ()
-{
- _mh_provider.object_type = camel_mh_store_get_type();
- return &_mh_provider;
-}
diff --git a/camel/providers/MH/camel-mh-store.c b/camel/providers/MH/camel-mh-store.c
deleted file mode 100644
index 60ba07f47b..0000000000
--- a/camel/providers/MH/camel-mh-store.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-store.c : class for an mh store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "camel-mh-store.h"
-#include "camel-mh-folder.h"
-#include "url-util.h"
-
-static CamelStoreClass *parent_class=NULL;
-
-/* Returns the class for a CamelMhStore */
-#define CMHS_CLASS(so) CAMEL_MH_STORE_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-static void _init (CamelStore *store, CamelSession *session, const gchar *url_name);
-static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name);
-
-
-static void
-camel_mh_store_class_init (CamelMhStoreClass *camel_mh_store_class)
-{
- CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_mh_store_class);
-
- parent_class = gtk_type_class (camel_store_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_store_class->init = _init;
- camel_store_class->get_folder = _get_folder;
-}
-
-
-
-static void
-camel_mh_store_init (gpointer object, gpointer klass)
-{
- CamelMhStore *mh_store = CAMEL_MH_STORE (object);
- CamelStore *store = CAMEL_STORE (object);
-
- store->separator = '/';
-}
-
-
-
-
-GtkType
-camel_mh_store_get_type (void)
-{
- static GtkType camel_mh_store_type = 0;
-
- if (!camel_mh_store_type) {
- GtkTypeInfo camel_mh_store_info =
- {
- "CamelMhStore",
- sizeof (CamelMhStore),
- sizeof (CamelMhStoreClass),
- (GtkClassInitFunc) camel_mh_store_class_init,
- (GtkObjectInitFunc) camel_mh_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mh_store_type = gtk_type_unique (CAMEL_STORE_TYPE, &camel_mh_store_info);
- }
-
- return camel_mh_store_type;
-}
-
-
-
-
-/* These evil public functions are here for test only */
-void
-camel_mh_store_set_toplevel_dir (CamelMhStore *store, const gchar *toplevel)
-{
- store->toplevel_dir = g_strdup (toplevel);
- CAMEL_STORE(store)->separator = '/';
-}
-
-
-const gchar *
-camel_mh_store_get_toplevel_dir (CamelMhStore *store)
-{
- return store->toplevel_dir;
-}
-
-
-
-static void
-_init (CamelStore *store, CamelSession *session, const gchar *url_name)
-{
- CamelMhStore *mh_store = CAMEL_MH_STORE (store);
- Gurl *store_url;
-
- g_assert (url_name);
- /* call parent implementation */
- parent_class->init (store, session, url_name);
-
-
- /* find the path in the URL*/
- store_url = g_url_new (url_name);
-
- g_return_if_fail (store_url);
- g_return_if_fail (store_url->path);
-
- mh_store->toplevel_dir = g_strdup (store_url->path);
- g_url_free (store_url);
-
-
-
-}
-
-
-static CamelFolder *
-_get_folder (CamelStore *store, const gchar *folder_name)
-{
- CamelMhFolder *new_mh_folder;
- CamelFolder *new_folder;
-
- /* check if folder has already been created */
- /* call the standard routine for that when */
- /* it is done ... */
-
- new_mh_folder = gtk_type_new (CAMEL_MH_FOLDER_TYPE);
- new_folder = CAMEL_FOLDER (new_mh_folder);
-
- CF_CLASS (new_folder)->init_with_store (new_folder, store, NULL);
- CF_CLASS (new_folder)->set_name (new_folder, folder_name, NULL);
-
-
- return new_folder;
-}
diff --git a/camel/providers/MH/camel-mh-store.h b/camel/providers/MH/camel-mh-store.h
deleted file mode 100644
index 924a5a6fc5..0000000000
--- a/camel/providers/MH/camel-mh-store.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mhstore.h : class for an mh store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MH_STORE_H
-#define CAMEL_MH_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-store.h"
-
-#define CAMEL_MH_STORE_TYPE (camel_mh_store_get_type ())
-#define CAMEL_MH_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_MH_STORE_TYPE, CamelMhStore))
-#define CAMEL_MH_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MH_STORE_TYPE, CamelMhStoreClass))
-#define IS_CAMEL_MH_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_MH_STORE_TYPE))
-
-
-typedef struct {
- CamelStore parent_object;
-
- gchar *toplevel_dir;
-} CamelMhStore;
-
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-
-} CamelMhStoreClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mh_store_get_type (void);
-
-void camel_mh_store_set_toplevel_dir (CamelMhStore *store, const gchar *toplevel);
-const gchar *camel_mh_store_get_toplevel_dir (CamelMhStore *store);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MH_STORE_H */
-
-
diff --git a/camel/providers/MH/mh-summary.c b/camel/providers/MH/mh-summary.c
deleted file mode 100644
index 5a964696e0..0000000000
--- a/camel/providers/MH/mh-summary.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-
-#include "mh-uid.h"
-#include "camel-log.h"
-#include "camel-stream.h"
-#include "camel-stream-fs.h"
-#include "camel-stream-buffered-fs.h"
-#include "gmime-utils.h"
-#include "mh-utils.h"
-
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-void
-mh_generate_summary (CamelFolder *folder)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- CamelFolderSummary *summary;
- CamelMessageInfo *message_info;
- CamelFolderInfo *subfolder_info;
- CamelStream *message_stream;
- guint file_number;
- gchar *message_fullpath;
- gchar *directory_path;
- GArray *header_array;
- MhUidCouple *uid_couple;
- Rfc822Header *cur_header;
- int i;
- int n_file;
- GArray *uid_array;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary entering \n");
-
- g_assert (folder);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary folder has no directory path\n");
- return;
- }
-
- summary = camel_folder_summary_new ();
- folder->summary = summary;
-
- uid_array = mh_folder->uid_array;
-
- if (!uid_array) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary "
- "no uid list, that probably means there is "
- "no message in this folder, exiting \n");
- return;
- }
- uid_couple = (MhUidCouple *)uid_array->data;
-
- for (n_file=0; n_file<uid_array->len; n_file++) {
-
- file_number = uid_couple->file_number;
-
- message_info = g_new0 (CamelMessageInfo, 1);
- message_info->uid = g_new0 (guchar, 17);
- strncpy (message_info->uid, uid_couple->uid, 16);
-
-
- message_fullpath = g_strdup_printf ("%s/%d", directory_path, file_number);
- message_stream = camel_stream_buffered_fs_new_with_name (message_fullpath,
- CAMEL_STREAM_BUFFERED_FS_READ);
- if (!message_stream) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary "
- "could not open %d for reading\n", message_fullpath);
- g_free (message_fullpath);
- return;
- }
- g_free (message_fullpath);
-
- header_array = get_header_array_from_stream (message_stream);
- gtk_object_unref (GTK_OBJECT (message_stream));
-
- for (i=0; i<header_array->len; i++) {
- cur_header = (Rfc822Header *)header_array->data + i;
- if (!g_strcasecmp (cur_header->name, "subject")) {
- message_info->subject = cur_header->value;
- g_free (cur_header->name);
- } else if (!g_strcasecmp (cur_header->name, "sender")) {
- message_info->date = cur_header->value;
- g_free (cur_header->name);
- } else if (!g_strcasecmp (cur_header->name, "date")) {
- message_info->date = cur_header->value;
- g_free (cur_header->name);
- } else {
- g_free (cur_header->name);
- g_free (cur_header->value);
- }
- }
- g_array_free (header_array, TRUE);
-
- summary->message_info_list = g_list_append (summary->message_info_list, message_info);
-
- /* next message in the uid list */
- uid_couple++;
- }
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary leaving \n");
-
-}
-
-
-void
-mh_save_summary (CamelMhFolder *mh_folder)
-{
- GArray *uid_array;
- MhUidCouple *first_uid_couple;
- CamelFolderSummary *summary;
- GList *msg_info_list;
- CamelMessageInfo *msg_info;
- gchar *directory_path = mh_folder->directory_path;
- gchar *summary_file_path;
- gint fd;
- gint i;
- gint field_lgth;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::save_summary entering \n");
-
- summary = CAMEL_FOLDER (mh_folder)->summary;
- if (!summary) return;
-
- summary_file_path = g_strdup_printf ("%s/%s", directory_path, ".camel-summary");
- CAMEL_LOG_FULL_DEBUG ("In the process of writing %s\n", summary_file_path);
- fd = open (summary_file_path, O_WRONLY | O_CREAT );
-
- if (!fd) {
- CAMEL_LOG_FULL_DEBUG ("could not open file %s for writing. Exiting.\n", summary_file_path);
- g_free (summary_file_path);
- return;
- }
- g_free (summary_file_path);
-
- msg_info_list = summary->message_info_list;
- while (msg_info_list) {
- msg_info = msg_info_list->data;
- /* write subject */
- field_lgth = msg_info->subject ? strlen (msg_info->subject) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->subject, field_lgth);
-
- /* write uid */
- field_lgth = msg_info->uid ? strlen (msg_info->uid) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->uid, field_lgth);
-
- /* write date */
- field_lgth = msg_info->date ? strlen (msg_info->date) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->date, field_lgth);
-
- /* write sender */
- field_lgth = msg_info->sender ? strlen (msg_info->sender) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->sender, field_lgth);
-
- msg_info_list = msg_info_list->next;
-
- }
-
- close (fd);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::save_summary leaving \n");
-
-}
-
-
-
-
-
-gint
-mh_load_summary (CamelMhFolder *mh_folder)
-{
- GArray *uid_array;
- MhUidCouple *first_uid_couple;
- CamelFolderSummary *summary;
- CamelMessageInfo *msg_info;
- gchar *directory_path = mh_folder->directory_path;
- gchar *summary_file_path;
- gint fd;
- gint i;
- gint field_lgth;
- gboolean file_eof;
- gint stat_error;
- struct stat stat_buf;
-
- summary = CAMEL_FOLDER (mh_folder)->summary;
- if (summary) return 1; /* should we regenerate it ? */
-
- summary_file_path = g_strdup_printf ("%s/%s", directory_path, ".camel-summary");
- CAMEL_LOG_FULL_DEBUG ("In the process of reading %s\n", summary_file_path);
- fd = open (summary_file_path, O_RDONLY);
- /* tests if file exists */
- stat_error = stat (summary_file_path, &stat_buf);
-
- if (!((stat_error != -1) && S_ISREG (stat_buf.st_mode))) {
- CAMEL_LOG_FULL_DEBUG ("could not open file %s for reading. Exiting.\n", summary_file_path);
- g_free (summary_file_path);
- return -1;
- }
- g_free (summary_file_path);
-
- for (;;) {
- /* read subject */
- file_eof = (read (fd, &field_lgth, sizeof (gint)) <= 0);
- if (file_eof) break;
-
-
- /* allcate a summary if needed */
- if (!summary)
- summary = camel_folder_summary_new ();
- /* allocate a message info struct */
- msg_info = g_new0 (CamelMessageInfo, 1);
-
- if (!file_eof && (field_lgth > 0)) {
- msg_info->subject = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->subject, field_lgth);
- } else
- msg_info->subject = NULL;
-
- /* read uid */
- if (!file_eof) file_eof = (read (fd, &field_lgth, sizeof (gint)) <= 0);
- if (!file_eof && (field_lgth > 0)) {
- msg_info->uid = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->uid, field_lgth);
- } else
- msg_info->uid = NULL;
-
- /* read date */
- if (!file_eof) file_eof = (read (fd, &field_lgth, sizeof (gint)) <= 0);
- if (!file_eof && (field_lgth > 0)) {
- msg_info->date = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->date, field_lgth);
- } else
- msg_info->date = NULL;
-
- /* read sender */
- if (!file_eof) file_eof = (read (fd, &field_lgth, sizeof (gint)) <= 0);
- if (!file_eof && (field_lgth > 0)) {
- msg_info->sender = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->sender, field_lgth);
- } else
- msg_info->sender = NULL;
-
- summary->message_info_list = g_list_prepend (summary->message_info_list,
- msg_info);
- }
-
- CAMEL_FOLDER (mh_folder)->summary = summary;
-
- close (fd);
- return 1;
-}
-
-
diff --git a/camel/providers/MH/mh-summary.h b/camel/providers/MH/mh-summary.h
deleted file mode 100644
index 27c9a21f60..0000000000
--- a/camel/providers/MH/mh-summary.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef MH_SUMMARY_H
-#define MH_SUMMARY_H 1
-
-#include <glib.h>
-#include "camel-mh-folder.h"
-
-void mh_generate_summary (CamelFolder *folder);
-void mh_save_summary (CamelMhFolder *mh_folder);
-gint mh_load_summary (CamelMhFolder *mh_folder);
-
-#endif /* MH_SUMMARY_H */
diff --git a/camel/providers/MH/mh-uid.c b/camel/providers/MH/mh-uid.c
deleted file mode 100644
index ebcccacd23..0000000000
--- a/camel/providers/MH/mh-uid.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-
-#include "mh-uid.h"
-#include "camel-log.h"
-#include "camel-stream.h"
-#include "camel-stream-fs.h"
-#include "camel-stream-buffered-fs.h"
-#include "gmime-utils.h"
-#include "md5-utils.h"
-#include "mh-utils.h"
-
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-void
-mh_uid_get_for_file (gchar *filename, guchar uid[16])
-{
- CamelStream *message_stream;
- GArray *header_array;
- Rfc822Header *cur_header;
- int i;
- MD5Context ctx;
-
-
- message_stream = camel_stream_buffered_fs_new_with_name (filename,
- CAMEL_STREAM_BUFFERED_FS_READ);
- header_array = get_header_array_from_stream (message_stream);
- gtk_object_unref (GTK_OBJECT (message_stream));
-
- md5_init (&ctx);
- for (i=0; i<header_array->len; i++) {
- cur_header = (Rfc822Header *)header_array->data + i;
- if (!g_strcasecmp (cur_header->name, "subject")) {
- md5_update (&ctx, cur_header->value, strlen (cur_header->value));
- } else if (!g_strcasecmp (cur_header->name, "sender")) {
- md5_update (&ctx, cur_header->value, strlen (cur_header->value));
- } else if (!g_strcasecmp (cur_header->name, "date")) {
- md5_update (&ctx, cur_header->value, strlen (cur_header->value));
- }
-
- g_free (cur_header->name);
- g_free (cur_header->value);
-
- }
-
- g_array_free (header_array, TRUE);
-
- md5_final (&ctx, uid);
-}
-
-
-
-
-void
-mh_save_uid_list (CamelMhFolder *mh_folder)
-{
- GArray *uid_array;
- MhUidCouple *first_uid_couple;
- gchar *directory_path = mh_folder->directory_path;
- gchar *uidfile_path;
- int fd;
- int i;
-
-
- uidfile_path = g_strdup_printf ("%s/%s", directory_path, ".camel-uid-list");
- CAMEL_LOG_FULL_DEBUG ("In the process of writing %s\n", uidfile_path);
- fd = open (uidfile_path, O_WRONLY | O_CREAT );
-
- if (!fd) {
- CAMEL_LOG_FULL_DEBUG ("could not open file %s for writing. Exiting.\n", uidfile_path);
- g_free (uidfile_path);
- return;
- }
- g_free (uidfile_path);
-
- uid_array = mh_folder->uid_array;
- first_uid_couple = (MhUidCouple *)uid_array->data;
-
- /* write the number of uid contained in the file */
- write (fd, &(uid_array->len), sizeof (guint));
- CAMEL_LOG_FULL_DEBUG ("%d entrie present in the list\n", uid_array->len);
- /* now write the array of uid self */
- write (fd, first_uid_couple, sizeof (MhUidCouple) * uid_array->len);
-
- close (fd);
-}
-
-
-gint
-mh_load_uid_list (CamelMhFolder *mh_folder)
-{
- GArray *new_uid_array;
- MhUidCouple *first_uid_couple;
- gchar *directory_path = mh_folder->directory_path;
- gchar *uidfile_path;
- int fd;
- guint uid_nb;
- struct stat stat_buf;
- gint stat_error = 0;
-
- uidfile_path = g_strdup_printf ("%s/%s", directory_path, ".camel-uid-list");
-
- /* tests if file exists */
- stat_error = stat (uidfile_path, &stat_buf);
-
-
- if (!((stat_error != -1) && S_ISREG (stat_buf.st_mode))) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::load_uid_list "
- "file %s does not exist. Exiting.\n", uidfile_path);
- g_free (uidfile_path);
- return -1;
- }
-
- fd = open (uidfile_path, O_RDONLY);
- g_free (uidfile_path);
- if (!fd) return -1;
-
- if (mh_folder->uid_array) g_array_free (mh_folder->uid_array, FALSE);
-
- /* read the number of uids in the file */
- read (fd, &uid_nb, sizeof (guint));
- CAMEL_LOG_FULL_DEBUG ("reading %d uid_entries\n", uid_nb);
- new_uid_array = g_array_new (FALSE, FALSE, sizeof (MhUidCouple));
- new_uid_array = g_array_set_size (new_uid_array, uid_nb);
- first_uid_couple = (MhUidCouple *)new_uid_array->data;
-
-
- read (fd, first_uid_couple, sizeof (MhUidCouple) * uid_nb);
-
- mh_folder->uid_array = new_uid_array;
-
- return 1;
-}
-
-
-gint
-mh_generate_uid_list (CamelMhFolder *mh_folder)
-{
- GArray *new_uid_array;
- const gchar *directory_path;
- struct dirent *dir_entry;
- DIR *dir_handle;
- gchar *msg_path;
- guint msg_count;
- MhUidCouple *uid_couple;
- guint file_number;
-
- g_assert (mh_folder);
- CAMEL_LOG_FULL_DEBUG ("in the process of creating uid list \n");
- directory_path = mh_folder->directory_path;
- if (!directory_path) {
- CAMEL_LOG_FULL_DEBUG ("folder has no directory path. Exiting\n");
- return -1;
- }
-
- msg_count = camel_folder_get_message_count (CAMEL_FOLDER (mh_folder), NULL);
- if (!msg_count) {
- CAMEL_LOG_FULL_DEBUG ("no message in %s. Exiting\n", directory_path);
- return -1;
- }
-
- new_uid_array = g_array_new (FALSE, FALSE, sizeof (MhUidCouple));
- new_uid_array = g_array_set_size (new_uid_array, msg_count);
- uid_couple = (MhUidCouple *)new_uid_array->data;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while (dir_entry != NULL) {
-
- /* tests if the entry correspond to a message file */
- if (mh_is_a_message_file (dir_entry->d_name, directory_path)) {
-
- /* get the uid for this message */
- msg_path = g_strdup_printf ("%s/%s", directory_path, dir_entry->d_name);
- mh_uid_get_for_file (msg_path, uid_couple->uid);
- g_free (msg_path);
-
- /* convert filename into file number */
- uid_couple->file_number = atoi (dir_entry->d_name);
- uid_couple++;
- }
-
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
- mh_folder->uid_array = new_uid_array;
-}
diff --git a/camel/providers/MH/mh-uid.h b/camel/providers/MH/mh-uid.h
deleted file mode 100644
index 63dfe5b159..0000000000
--- a/camel/providers/MH/mh-uid.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef MH_UID_H
-#define MH_UID_H 1
-
-#include <glib.h>
-#include "camel-mh-folder.h"
-
-
-typedef struct {
- gchar uid[16];
- guint file_number;
-} MhUidCouple;
-
-void mh_uid_get_for_file (gchar *filename, guchar uid[16]);
-void mh_save_uid_list (CamelMhFolder *mh_folder);
-gint mh_load_uid_list (CamelMhFolder *mh_folder);
-gint mh_generate_uid_list (CamelMhFolder *mh_folder);
-
-#endif /* MH_UID_H */
diff --git a/camel/providers/MH/mh-utils.c b/camel/providers/MH/mh-utils.c
deleted file mode 100644
index 51bb84bc65..0000000000
--- a/camel/providers/MH/mh-utils.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "mh-utils.h"
-
-#include <sys/stat.h>
-
-gboolean
-mh_is_a_message_file (const gchar *file_name, const gchar *file_path)
-{
- struct stat stat_buf;
- gint stat_error = 0;
- gboolean ok;
- gchar *full_file_name;
- int i;
-
- /* test if the name is a number */
- i=0;
- while ((file_name[i] != '\0') && (file_name[i] >= '0') && (file_name[i] <= '9'))
- i++;
- if ((i==0) || (file_name[i] != '\0')) return FALSE;
-
- /* is it a regular file ? */
- full_file_name = g_strdup_printf ("%s/%s", file_path, file_name);
- stat_error = stat (full_file_name, &stat_buf);
- g_free (full_file_name);
-
- return ((stat_error != -1) && S_ISREG (stat_buf.st_mode));
-}
-
diff --git a/camel/providers/MH/mh-utils.h b/camel/providers/MH/mh-utils.h
deleted file mode 100644
index 968228b0a3..0000000000
--- a/camel/providers/MH/mh-utils.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef MH_UTILS_H
-#define MH_UTILS_H 1
-
-#include <glib.h>
-
-gboolean mh_is_a_message_file (const gchar *file_name, const gchar *file_path);
-
-#endif /* MH_UTILS_H */
diff --git a/camel/providers/Makefile.am b/camel/providers/Makefile.am
deleted file mode 100644
index c3829d39b2..0000000000
--- a/camel/providers/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS = mbox pop3 sendmail vee
-
-# these ones are disabled for the moment.
-# MH maildir nntp smtp
diff --git a/camel/providers/maildir/.cvsignore b/camel/providers/maildir/.cvsignore
deleted file mode 100644
index 2e7b174532..0000000000
--- a/camel/providers/maildir/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile.in
-Makefile
-.deps
-*.lo
-*.la
-.libs
diff --git a/camel/providers/maildir/Makefile.am b/camel/providers/maildir/Makefile.am
deleted file mode 100644
index 07f05d443b..0000000000
--- a/camel/providers/maildir/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelmaildirincludedir = $(includedir)/camel
-
-lib_LTLIBRARIES = libcamelmaildir.la
-
-INCLUDES = -I.. -I$(srcdir)/.. -I$(top_srcdir)/intl -I$(top_srcdir)/camel \
- $(GTK_INCLUDEDIR) -I$(includedir) \
- -DG_LOG_DOMAIN=\"camel-maildir-provider\"
-
-libcamelmaildir_la_SOURCES = \
- camel-maildir-folder.c \
- camel-maildir-provider.c \
- camel-maildir-store.c
-
-libcamelmaildirinclude_HEADERS = \
- camel-maildir-folder.h \
- camel-maildir-store.h
-
-libcamelmaildir_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-EXTRA_DIST =
diff --git a/camel/providers/maildir/camel-maildir-folder.c b/camel/providers/maildir/camel-maildir-folder.c
deleted file mode 100644
index 2cb81f3e81..0000000000
--- a/camel/providers/maildir/camel-maildir-folder.c
+++ /dev/null
@@ -1,802 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildir-folder.c : camel-folder subclass for maildir folders */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * AUTHORS : Jukka Zitting
- *
- */
-
-
-#include <config.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <errno.h>
-#include <time.h>
-#include <string.h>
-#include "camel-maildir-folder.h"
-#include "camel-maildir-store.h"
-#include "camel-stream-fs.h"
-#include "camel-log.h"
-
-static CamelFolderClass *parent_class=NULL;
-
-/* Returns the class for a CamelMaildirFolder */
-#define CMAILDIRF_CLASS(so) CAMEL_MAILDIR_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMAILDIRS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-
-static void _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex);
-static void _set_name (CamelFolder *folder, const gchar *name, CamelException *ex);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _create (CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean _delete_messages (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message (CamelFolder *folder, gint number, CamelException *ex);
-static gint _get_message_count (CamelFolder *folder, CamelException *ex);
-static void _expunge (CamelFolder *folder, CamelException *ex);
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-
-/* fs utility functions */
-static DIR * _xopendir (const gchar *path);
-static gboolean _xstat (const gchar *path, struct stat *buf);
-static gboolean _xmkdir (const gchar *path);
-static gboolean _xrename (const gchar *from, const gchar *to);
-static gboolean _xunlink (const gchar *path);
-static gboolean _xrmdir (const gchar *path);
-/* ** */
-
-static void
-camel_maildir_folder_class_init (CamelMaildirFolderClass *camel_maildir_folder_class)
-{
- CamelFolderClass *camel_folder_class =
- CAMEL_FOLDER_CLASS (camel_maildir_folder_class);
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_folder_class->init_with_store = _init_with_store;
- camel_folder_class->set_name = _set_name;
- camel_folder_class->exists = _exists;
- camel_folder_class->create = _create;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->expunge = _expunge;
- camel_folder_class->get_message = _get_message;
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->list_subfolders = _list_subfolders;
-}
-
-GtkType
-camel_maildir_folder_get_type (void)
-{
- static GtkType camel_maildir_folder_type = 0;
-
- if (!camel_maildir_folder_type) {
- GtkTypeInfo camel_maildir_folder_info =
- {
- "CamelMaildirFolder",
- sizeof (CamelMaildirFolder),
- sizeof (CamelMaildirFolderClass),
- (GtkClassInitFunc) camel_maildir_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_maildir_folder_type =
- gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_maildir_folder_info);
- }
-
- return camel_maildir_folder_type;
-}
-
-
-
-
-
-
-/**
- * CamelMaildirFolder::init_with_store: initializes the folder object
- * @folder: folder object to initialize
- * @parent_store: parent store object of the folder
- *
- * Simply tells that the folder can contain messages but not subfolders.
- * Perhaps we'll later implement subfolders too...
- */
-static void
-_init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::init_with_store\n");
- g_assert (folder);
- g_assert (parent_store);
-
- /* call parent method */
- parent_class->init_with_store (folder, parent_store, ex);
-
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- folder->has_summary_capability = FALSE;
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::init_with_store\n");
-}
-
-/**
- * CamelMaildirFolder::set_name: sets the name of the folder
- * @folder: folder object
- * @name: name of the folder
- *
- * Sets the name of the folder object. The existence of a folder with
- * the given name is not checked in this function.
- */
-static void
-_set_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder;
- CamelMaildirStore *maildir_store;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::set_name\n");
- g_assert (folder);
- g_assert (name);
- g_assert (folder->parent_store);
-
- maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- maildir_store = CAMEL_MAILDIR_STORE (folder->parent_store);
-
- /* call default implementation */
- parent_class->set_name (folder, name, ex);
-
- if (maildir_folder->directory_path)
- g_free (maildir_folder->directory_path);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::set_name full_name is %s\n", folder->full_name);
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::set_name toplevel_dir is %s\n", maildir_store->toplevel_dir);
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::set_name separator is %c\n", camel_store_get_separator (folder->parent_store));
-
- if (folder->full_name && folder->full_name[0])
- maildir_folder->directory_path =
- g_strconcat (maildir_store->toplevel_dir, G_DIR_SEPARATOR_S,
- folder->full_name, NULL);
- else
- maildir_folder->directory_path = g_strdup (maildir_store->toplevel_dir);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::set_name: name set to %s\n", name);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::set_name\n");
-}
-
-/**
- * CamelMaildirFolder::exists: tests whether the named maildir exists
- * @folder: folder object
- *
- * A created maildir folder object doesn't necessarily exist yet in the
- * filesystem. This function checks whether the maildir exists.
- * The structure of the maildir is stated in the maildir.5 manpage.
- *
- * maildir.5:
- * A directory in maildir format has three subdirectories,
- * all on the same filesystem: tmp, new, and cur.
- *
- * Return value: TRUE if the maildir exists, FALSE otherwise
- */
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- static const gchar *dir[3] = { "new", "cur", "tmp" };
- gint i;
- struct stat statbuf;
- const gchar *maildir;
- gchar *path;
- gboolean rv = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::exists\n");
- g_assert (folder);
- g_return_val_if_fail (maildir_folder->directory_path, FALSE);
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMailFolder::exists: checking maildir %s\n",
- maildir);
-
- /* check whether the toplevel directory exists */
- rv = _xstat (maildir, &statbuf) && S_ISDIR (statbuf.st_mode);
-
- /* check whether the maildir subdirectories exist */
- for (i = 0; rv && i < 3; i++) {
- path = g_strconcat (maildir, G_DIR_SEPARATOR_S, dir[i], NULL);
-
- rv = _xstat (path, &statbuf) && S_ISDIR (statbuf.st_mode);
-
- g_free (path);
- }
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::exists: %s\n",
- (rv) ? "maildir found" : "maildir not found");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::exists\n");
- return rv;
-}
-
-/**
- * CamelMaildirFolder::create: creates the named maildir
- * @folder: folder object
- *
- * A created maildir folder object doesn't necessarily exist yet in the
- * filesystem. This function creates the maildir if it doesn't yet exist.
- * The structure of the maildir is stated in the maildir.5 manpage.
- *
- * maildir.5:
- * A directory in maildir format has three subdirectories,
- * all on the same filesystem: tmp, new, and cur.
- *
- * Return value: TRUE if the maildir existed already or was created,
- * FALSE otherwise
- */
-static gboolean
-_create (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- static const gchar *dir[3] = { "new", "cur", "tmp" };
- gint i;
- const gchar *maildir;
- gchar *path;
- gboolean rv = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::create\n");
- g_assert (folder);
-
- /* check whether the maildir already exists */
- if (camel_folder_exists (folder, ex)) return TRUE;
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMailFolder::create: creating maildir %s\n",
- maildir);
-
- /* create the toplevel directory */
- rv = _xmkdir (maildir);
-
- /* create the maildir subdirectories */
- for (i = 0; rv && i < 3; i++) {
- path = g_strconcat (maildir, G_DIR_SEPARATOR_S, dir[i], NULL);
-
- rv = _xmkdir (path);
-
- g_free (path);
- }
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::create: %s\n",
- rv ? "maildir created" : "an error occurred");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::create\n");
- return rv;
-}
-
-/**
- * CamelMaildirFolder::delete: delete the maildir folder
- * @folder: the folder object
- * @recurse:
- *
- * This function empties and deletes the maildir folder. The subdirectories
- * "tmp", "cur", and "new" are removed first and then the toplevel maildir
- * directory is deleted. All files from the directories are deleted as well,
- * so you should be careful when using this function. If a subdirectory cannot
- * be deleted, then the operation it is stopped. Thus if an error occurs, the
- * maildir directory won't be removed, but it might no longer be a valid maildir.
- */
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- static const gchar *dir[3] = { "new", "cur", "tmp" };
- gint i;
- const gchar *maildir;
- gchar *path;
- gboolean rv = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::create\n");
- g_assert (folder);
-
- /* check whether the maildir already exists */
- if (!camel_folder_exists (folder, ex)) return TRUE;
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMailFolder::delete: deleting maildir %s\n",
- maildir);
-
- /* delete the maildir subdirectories */
- for (i = 0; rv && i < 3; i++) {
- path = g_strconcat (maildir, G_DIR_SEPARATOR_S, dir[i], NULL);
-
- rv = _xrmdir (path);
-
- g_free (path);
- }
-
- /* create the toplevel directory */
- if (rv)
- rv = _xrmdir (maildir);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::delete: %s\n",
- rv ? "maildir deleted" : "an error occurred");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::delete\n");
- return rv;
-}
-
-/**
- * CamelMaildirFolder::delete_messages: empty the maildir folder
- * @folder: the folder object
- *
- * This function empties the maildir folder. All messages from the
- * "cur" subdirectory are deleted. If a message cannot be deleted, then
- * it is just skipped and the rest of the messages are still deleted.
- * Files with names starting with a dot are skipped as described in the
- * maildir.5 manpage.
- *
- * maildir.5:
- * It is a good idea for readers to skip all filenames in new
- * and cur starting with a dot. Other than this, readers
- * should not attempt to parse filenames.
- *
- * Return value: FALSE on error and if some messages could not be deleted.
- * TRUE otherwise.
- */
-static gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- const gchar *maildir;
- gchar *curdir, *file;
- DIR *dir_handle;
- struct dirent *dir_entry;
- gboolean rv = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::delete_messages\n");
- g_assert (folder);
-
- /* call default implementation */
- parent_class->delete_messages (folder, ex);
-
- /* Check if the folder didn't exist */
- if (!camel_folder_exists (folder, ex)) return TRUE;
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::delete_messages: "
- "deleting messages from %s\n", maildir);
-
- /* delete messages from the maildir subdirectory "cur" */
- curdir = g_strconcat (maildir, G_DIR_SEPARATOR_S, "cur", NULL);
-
- dir_handle = _xopendir (curdir);
- if (dir_handle) {
- while ((dir_entry = readdir (dir_handle))) {
- if (dir_entry->d_name[0] == '.') continue;
- file = g_strconcat (curdir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, NULL);
-
- if (!_xunlink (file)) rv = FALSE;
-
- g_free (file);
- }
- closedir (dir_handle);
- } else
- rv = FALSE;
-
- g_free (curdir);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::delete_messages: %s\n",
- rv ? "messages deleted" : "an error occurred");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::delete_messages\n");
- return rv;
-}
-
-/**
- * CamelMaildirFolder::get_message: get a message from maildir
- * @folder: the folder object
- * @number: number of the message within the folder
- *
- * Return value: the message, NULL on error
- */
-static CamelMimeMessage *
-_get_message (CamelFolder *folder, gint number, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER(folder);
- DIR *dir_handle;
- struct dirent *dir_entry;
- CamelStream *stream;
- CamelMimeMessage *message = NULL;
- const gchar *maildir;
- gchar *curdir, *file = NULL;
- gint count = -1;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::get_message\n");
- g_assert(folder);
-
- /* Check if the folder exists */
- if (!camel_folder_exists (folder, ex)) return NULL;
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message: "
- "getting message #%d from %s\n", number, maildir);
-
- /* Count until the desired message is reached */
- curdir = g_strconcat (maildir, G_DIR_SEPARATOR_S, "cur", NULL);
- if ((dir_handle = _xopendir (curdir))) {
- while ((count < number) && (dir_entry = readdir (dir_handle)))
- if (dir_entry->d_name[0] != '.') count++;
-
- if (count == number)
- file = g_strconcat (curdir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, NULL);
-
- closedir (dir_handle);
- }
- g_free (curdir);
- if (!file) return NULL;
-
- /* Create the message object */
- message = camel_mime_message_new ();
- stream = camel_stream_fs_new_with_name (file, CAMEL_STREAM_FS_READ);
-
- if (!message || !stream) {
- g_free (file);
- if (stream) gtk_object_unref (GTK_OBJECT (stream));
- if (message) gtk_object_unref (GTK_OBJECT (message));
- return NULL;
- }
-
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (message),
- stream);
- gtk_object_unref (GTK_OBJECT (stream));
- gtk_object_set_data_full (GTK_OBJECT (message),
- "fullpath", file, g_free);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message: "
- "message %p created from %s\n", message, file);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::get_message\n");
- return message;
-}
-
-/**
- * CamelMaildirFolder::get_message_count: count messages in maildir
- * @folder: the folder object
- *
- * Returns the number of messages in the maildir folder. New messages
- * are included in this count.
- *
- * Return value: number of messages in the maildir, -1 on error
- */
-static gint
-_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER(folder);
- const gchar *maildir;
- gchar *newdir, *curdir, *newfile, *curfile;
- DIR *dir_handle;
- struct dirent *dir_entry;
- guint count = 0;
-
- CAMEL_LOG_FULL_DEBUG ("Entering "
- "CamelMaildirFolder::get_message_count\n");
- g_assert(folder);
-
- /* check if the maildir exists */
- if (!camel_folder_exists (folder, ex)) return -1;
-
- maildir = maildir_folder->directory_path;
-
- newdir = g_strconcat (maildir, G_DIR_SEPARATOR_S, "new", NULL);
- curdir = g_strconcat (maildir, G_DIR_SEPARATOR_S, "cur", NULL);
-
- /* Check new messages */
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message_count: "
- "getting new messages from %s\n", newdir);
- if ((dir_handle = _xopendir (newdir))) {
- while ((dir_entry = readdir (dir_handle))) {
- if (dir_entry->d_name[0] == '.') continue;
- newfile = g_strconcat (newdir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, NULL);
- curfile = g_strconcat (curdir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, ":2,", NULL);
-
- _xrename (newfile, curfile);
-
- g_free (curfile);
- g_free (newfile);
- }
- closedir (dir_handle);
- }
-
- /* Count messages */
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message_count: "
- "counting messages in %s\n", curdir);
- if ((dir_handle = _xopendir (curdir))) {
- while ((dir_entry = readdir (dir_handle)))
- if (dir_entry->d_name[0] != '.') count++;
- closedir (dir_handle);
- }
-
- g_free (curdir);
- g_free (newdir);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message_count: "
- " found %d messages\n", count);
- CAMEL_LOG_FULL_DEBUG ("Leaving "
- "CamelMaildirFolder::get_message_count\n");
- return count;
-}
-
-
-
-
-/**
- * CamelMaildirFolder::expunge: expunge messages marked as deleted
- * @folder: the folder object
- *
- * Physically deletes the messages marked as deleted in the folder.
- */
-static void
-_expunge (CamelFolder *folder, CamelException *ex)
-{
- CamelMimeMessage *message;
- GList *node;
- gchar *fullpath;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::expunge\n");
- g_assert(folder);
-
- /* expunge messages marked for deletion */
- for (node = folder->message_list; node; node = g_list_next(node)) {
- message = CAMEL_MIME_MESSAGE (node->data);
- if (!message) {
- CAMEL_LOG_WARNING ("CamelMaildirFolder::expunge: "
- "null message in node %p\n", node);
- continue;
- }
-
- if (camel_mime_message_get_flag (message, "DELETED")) {
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::expunge: "
- "expunging message #%d\n",
- message->message_number);
-
- /* expunge the message */
- fullpath = gtk_object_get_data (GTK_OBJECT (message),
- "fullpath");
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::expunge: "
- "message fullpath is %s\n",
- fullpath);
-
- if (_xunlink (fullpath))
- message->expunged = TRUE;
- } else {
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::expunge: "
- "skipping message #%d\n",
- message->message_number);
- }
- }
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::expunge\n");
-}
-
-
-
-
-/**
- * CamelMaildirFolder::list_subfolders: return a list of subfolders
- * @folder: the folder object
- *
- * Returns the names of the maildir subfolders in a list.
- *
- * Return value: list of subfolder names
- */
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- const gchar *maildir;
- gchar *subdir;
- struct stat statbuf;
- struct dirent *dir_entry;
- DIR *dir_handle;
- GList *subfolders = NULL;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::list_subfolders\n");
- g_assert (folder);
-
- /* check if the maildir exists */
- if (!camel_folder_exists (folder, ex)) return NULL;
-
- /* scan through the maildir toplevel directory */
- maildir = maildir_folder->directory_path;
- if ((dir_handle = _xopendir (maildir))) {
- while ((dir_entry = readdir (dir_handle))) {
- if (dir_entry->d_name[0] == '.') continue;
- if (strcmp (dir_entry->d_name, "new") == 0) continue;
- if (strcmp (dir_entry->d_name, "cur") == 0) continue;
- if (strcmp (dir_entry->d_name, "tmp") == 0) continue;
-
- subdir = g_strconcat (maildir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, NULL);
-
- if (_xstat (subdir, &statbuf)
- && S_ISDIR (statbuf.st_mode))
- subfolders =
- g_list_append (
- subfolders,
- g_strdup (dir_entry->d_name));
-
- g_free (subdir);
- }
- closedir (dir_handle);
- }
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::list_subfolders\n");
- return subfolders;
-}
-
-
-
-
-
-
-
-/*
- * fs utility function
- *
- */
-
-static DIR *
-_xopendir (const gchar *path)
-{
- DIR *handle;
- g_assert (path);
-
- handle = opendir (path);
- if (!handle) {
- CAMEL_LOG_WARNING ("ERROR: opendir (%s);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- }
-
- return handle;
-}
-
-static gboolean
-_xstat (const gchar *path, struct stat *buf)
-{
- gint stat_error;
- g_assert (path);
- g_assert (buf);
-
- stat_error = stat (path, buf);
- if (stat_error == 0) {
- return TRUE;
- } else if (errno == ENOENT) {
- buf->st_mode = 0;
- return TRUE;
- } else {
- CAMEL_LOG_WARNING ("ERROR: stat (%s, %p);\n", path, buf);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-}
-
-static gboolean
-_xmkdir (const gchar *path)
-{
- g_assert (path);
-
- if (mkdir (path, S_IRWXU) == -1) {
- CAMEL_LOG_WARNING ("ERROR: mkdir (%s, S_IRWXU);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-_xrename (const gchar *from, const gchar *to)
-{
- g_assert (from);
- g_assert (to);
-
- if (rename (from, to) == 0) {
- return TRUE;
- } else {
- CAMEL_LOG_WARNING ("ERROR: rename (%s, %s);\n", from, to);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-}
-
-static gboolean
-_xunlink (const gchar *path)
-{
- g_assert (path);
-
- if (unlink (path) == 0) {
- return TRUE;
- } else if (errno == ENOENT) {
- return TRUE;
- } else {
- CAMEL_LOG_WARNING ("ERROR: unlink (%s);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-}
-
-static gboolean
-_xrmdir (const gchar *path)
-{
- DIR *dir_handle;
- struct dirent *dir_entry;
- gchar *file;
- struct stat statbuf;
- g_assert (path);
-
- dir_handle = opendir (path);
- if (!dir_handle && errno == ENOENT) {
- return TRUE;
- } else if (!dir_handle) {
- CAMEL_LOG_WARNING ("ERROR: opendir (%s);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-
- while ((dir_entry = readdir (dir_handle))) {
- file = g_strconcat (path, G_DIR_SEPARATOR_S, dir_entry->d_name,
- NULL);
- if (_xstat (file, &statbuf) && S_ISREG (statbuf.st_mode))
- _xunlink (file);
- g_free (file);
- }
-
- closedir (dir_handle);
-
- if (rmdir (path) == 0) {
- return TRUE;
- } else if (errno == ENOENT) {
- return TRUE;
- } else {
- CAMEL_LOG_WARNING ("ERROR: rmdir (%s);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-}
-
-/** *** **/
-
diff --git a/camel/providers/maildir/camel-maildir-folder.h b/camel/providers/maildir/camel-maildir-folder.h
deleted file mode 100644
index 5997da2011..0000000000
--- a/camel/providers/maildir/camel-maildir-folder.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildir-folder.h : Abstract class for an email folder */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#ifndef CAMEL_MAILDIR_FOLDER_H
-#define CAMEL_MAILDIR_FOLDER_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-folder.h"
-/* #include "camel-store.h" */
-
-#define CAMEL_MAILDIR_FOLDER_TYPE (camel_maildir_folder_get_type ())
-#define CAMEL_MAILDIR_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_MAILDIR_FOLDER_TYPE, CamelMaildirFolder))
-#define CAMEL_MAILDIR_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MAILDIR_FOLDER_TYPE, CamelMaildirFolderClass))
-#define IS_CAMEL_MAILDIR_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_MAILDIR_FOLDER_TYPE))
-
-
-typedef struct {
- CamelFolder parent_object;
-
- gchar *directory_path;
-} CamelMaildirFolder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMaildirFolderClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_maildir_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MAILDIR_FOLDER_H */
diff --git a/camel/providers/maildir/camel-maildir-provider.c b/camel/providers/maildir/camel-maildir-provider.c
deleted file mode 100644
index cd5521adc0..0000000000
--- a/camel/providers/maildir/camel-maildir-provider.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildir-provider.c: maildir provider registration code */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "config.h"
-#include "camel-maildir-store.h"
-#include "camel-provider.h"
-#include "camel-log.h"
-
-
-static CamelProvider _maildir_provider = {
- (GtkType) 0,
- PROVIDER_STORE,
- "maildir",
- "Maildir provider for Camel",
- "This maildir provider is based on the default MH provider of Camel",
- (GModule *) NULL
-};
-
-
-
-CamelProvider *
-camel_provider_module_init ()
-{
- _maildir_provider.object_type = camel_maildir_store_get_type();
- return &_maildir_provider;
-}
diff --git a/camel/providers/maildir/camel-maildir-store.c b/camel/providers/maildir/camel-maildir-store.c
deleted file mode 100644
index 8f37494003..0000000000
--- a/camel/providers/maildir/camel-maildir-store.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildir-store.c : class for an maildir store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "camel-maildir-store.h"
-#include "camel-maildir-folder.h"
-#include "url-util.h"
-
-static CamelStoreClass *parent_class=NULL;
-
-/* Returns the class for a CamelMaildirStore */
-#define CMAILDIRS_CLASS(so) CAMEL_MAILDIR_STORE_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMAILDIRF_CLASS(so) CAMEL_MAILDIR_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-static void _init (CamelStore *store, CamelSession *session,
- const gchar *url_name);
-static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name);
-
-static void
-camel_maildir_store_class_init (
- CamelMaildirStoreClass *camel_maildir_store_class)
-{
- CamelStoreClass *camel_store_class =
- CAMEL_STORE_CLASS (camel_maildir_store_class);
-
- parent_class = gtk_type_class (camel_store_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_store_class->init = _init;
- camel_store_class->get_folder = _get_folder;
-}
-
-static void
-camel_maildir_store_init (gpointer object, gpointer klass)
-{
- CamelMaildirStore *maildir_store = CAMEL_MAILDIR_STORE (object);
- CamelStore *store = CAMEL_STORE (object);
-
- store->separator = G_DIR_SEPARATOR;
-}
-
-GtkType
-camel_maildir_store_get_type (void)
-{
- static GtkType camel_maildir_store_type = 0;
-
- if (!camel_maildir_store_type) {
- GtkTypeInfo camel_maildir_store_info =
- {
- "CamelMaildirStore",
- sizeof (CamelMaildirStore),
- sizeof (CamelMaildirStoreClass),
- (GtkClassInitFunc) camel_maildir_store_class_init,
- (GtkObjectInitFunc) camel_maildir_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_maildir_store_type =
- gtk_type_unique (CAMEL_STORE_TYPE,
- &camel_maildir_store_info);
- }
-
- return camel_maildir_store_type;
-}
-
-static void
-_init (CamelStore *store, CamelSession *session, const gchar *url_name)
-{
- CamelMaildirStore *maildir_store = CAMEL_MAILDIR_STORE (store);
- Gurl *store_url;
- g_assert (url_name);
-
- /* call parent implementation */
- parent_class->init (store, session, url_name);
-
- /* find the path in the URL*/
- store_url = g_url_new (url_name);
-
- g_return_if_fail (store_url);
- g_return_if_fail (store_url->path);
-
- maildir_store->toplevel_dir = g_strdup (store_url->path);
-
- g_url_free (store_url);
-}
-
-static CamelFolder *
-_get_folder (CamelStore *store, const gchar *folder_name)
-{
- CamelMaildirStore *maildir_store = CAMEL_MAILDIR_STORE (store);
- CamelMaildirFolder *new_maildir_folder;
- CamelFolder *new_folder;
-
- new_maildir_folder = gtk_type_new (CAMEL_MAILDIR_FOLDER_TYPE);
- new_folder = CAMEL_FOLDER (new_maildir_folder);
-
- CF_CLASS (new_folder)->init_with_store (new_folder, store, NULL);
- CF_CLASS (new_folder)->set_name (new_folder, folder_name, NULL);
-
- return new_folder;
-}
diff --git a/camel/providers/maildir/camel-maildir-store.h b/camel/providers/maildir/camel-maildir-store.h
deleted file mode 100644
index 1a95ed1436..0000000000
--- a/camel/providers/maildir/camel-maildir-store.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildirstore.h : class for an maildir store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MAILDIR_STORE_H
-#define CAMEL_MAILDIR_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-store.h"
-
-#define CAMEL_MAILDIR_STORE_TYPE (camel_maildir_store_get_type ())
-#define CAMEL_MAILDIR_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_MAILDIR_STORE_TYPE, CamelMaildirStore))
-#define CAMEL_MAILDIR_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MAILDIR_STORE_TYPE, CamelMaildirStoreClass))
-#define IS_CAMEL_MAILDIR_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_MAILDIR_STORE_TYPE))
-
-
-typedef struct {
- CamelStore parent_object;
-
- gchar *toplevel_dir;
-} CamelMaildirStore;
-
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-
-} CamelMaildirStoreClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_maildir_store_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MAILDIR_STORE_H */
-
-
diff --git a/camel/providers/mbox/.cvsignore b/camel/providers/mbox/.cvsignore
deleted file mode 100644
index fd6b811c68..0000000000
--- a/camel/providers/mbox/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
diff --git a/camel/providers/mbox/Makefile.am b/camel/providers/mbox/Makefile.am
deleted file mode 100644
index defd6925cc..0000000000
--- a/camel/providers/mbox/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelmboxincludedir = $(includedir)/camel
-
-
-providerdir = $(pkglibdir)/camel-providers/$(VERSION)
-
-provider_LTLIBRARIES = libcamelmbox.la
-provider_DATA = libcamelmbox.urls
-
-INCLUDES = -I.. \
- -I$(srcdir)/.. \
- -I$(top_srcdir)/camel \
- -I$(top_srcdir)/intl \
- -I$(top_srcdir)/libibex \
- -I$(top_srcdir)/e-util \
- -I$(top_srcdir) \
- -I$(includedir) \
- $(GTK_INCLUDEDIR) \
- -DG_LOG_DOMAIN=\"camel-mbox-provider\"
-
-libcamelmbox_la_SOURCES = \
- camel-mbox-folder.c \
- camel-mbox-provider.c \
- camel-mbox-store.c \
- camel-mbox-summary.c
-
-libcamelmboxinclude_HEADERS = \
- camel-mbox-folder.h \
- camel-mbox-store.h \
- camel-mbox-summary.h
-
-libcamelmbox_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-libcamelmbox_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS)
-#libcamelmbox_la_LIBADD = $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS)
-
-EXTRA_DIST = libcamelmbox.urls
-
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
deleted file mode 100644
index ccf57f02b7..0000000000
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ /dev/null
@@ -1,855 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camel-mbox-folder.c : Abstract class for an email folder */
-
-/*
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright (C) 1999, 2000 Helix Code Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-
-#include "camel-mbox-folder.h"
-#include "camel-mbox-store.h"
-#include "string-utils.h"
-#include "camel-stream-fs.h"
-#include "camel-mbox-summary.h"
-#include "camel-data-wrapper.h"
-#include "camel-mime-message.h"
-#include "camel-stream-filter.h"
-#include "camel-mime-filter-from.h"
-#include "camel-exception.h"
-
-#define d(x)
-
-static CamelFolderClass *parent_class=NULL;
-
-/* Returns the class for a CamelMboxFolder */
-#define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMBOXS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void mbox_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar separator, CamelException *ex);
-
-static void mbox_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex);
-static void mbox_close (CamelFolder *folder, gboolean expunge, CamelException *ex);
-static gboolean mbox_exists (CamelFolder *folder, CamelException *ex);
-static gboolean mbox_create(CamelFolder *folder, CamelException *ex);
-static gboolean mbox_delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean mbox_delete_messages (CamelFolder *folder, CamelException *ex);
-static gint mbox_get_message_count (CamelFolder *folder, CamelException *ex);
-static void mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static GPtrArray *mbox_get_uids (CamelFolder *folder, CamelException *ex);
-static GPtrArray *mbox_get_subfolder_names (CamelFolder *folder, CamelException *ex);
-static GPtrArray *mbox_get_summary (CamelFolder *folder, CamelException *ex);
-static void mbox_free_summary (CamelFolder *folder, GPtrArray *array);
-static CamelMimeMessage *mbox_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-
-static void mbox_expunge (CamelFolder *folder, CamelException *ex);
-#if 0
-static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex);
-static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-#endif
-
-static void mbox_delete_message_by_uid(CamelFolder *folder, const gchar *uid, CamelException *ex);
-
-static const CamelMessageInfo *mbox_summary_get_by_uid(CamelFolder *f, const char *uid);
-
-static GList *mbox_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
-
-static void mbox_finalize (GtkObject *object);
-
-static void
-camel_mbox_folder_class_init (CamelMboxFolderClass *camel_mbox_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_mbox_folder_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_class);
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_folder_class->init = mbox_init;
- camel_folder_class->open = mbox_open;
- camel_folder_class->close = mbox_close;
- camel_folder_class->exists = mbox_exists;
- camel_folder_class->create = mbox_create;
- camel_folder_class->delete = mbox_delete;
- camel_folder_class->delete_messages = mbox_delete_messages;
- camel_folder_class->get_message_count = mbox_get_message_count;
- camel_folder_class->append_message = mbox_append_message;
- camel_folder_class->get_uids = mbox_get_uids;
- camel_folder_class->get_subfolder_names = mbox_get_subfolder_names;
- camel_folder_class->get_summary = mbox_get_summary;
- camel_folder_class->free_summary = mbox_free_summary;
- camel_folder_class->expunge = mbox_expunge;
-
- camel_folder_class->get_message_by_uid = mbox_get_message_by_uid;
- camel_folder_class->delete_message_by_uid = mbox_delete_message_by_uid;
-
- camel_folder_class->search_by_expression = mbox_search_by_expression;
-
- camel_folder_class->summary_get_by_uid = mbox_summary_get_by_uid;
-
- gtk_object_class->finalize = mbox_finalize;
-
-}
-
-static void
-mbox_finalize (GtkObject *object)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (object);
-
- g_free (mbox_folder->folder_file_path);
- g_free (mbox_folder->folder_dir_path);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-GtkType
-camel_mbox_folder_get_type (void)
-{
- static GtkType camel_mbox_folder_type = 0;
-
- if (!camel_mbox_folder_type) {
- GtkTypeInfo camel_mbox_folder_info =
- {
- "CamelMboxFolder",
- sizeof (CamelMboxFolder),
- sizeof (CamelMboxFolderClass),
- (GtkClassInitFunc) camel_mbox_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mbox_folder_type = gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_mbox_folder_info);
- }
-
- return camel_mbox_folder_type;
-}
-
-static void
-mbox_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name, gchar separator,
- CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
- const gchar *root_dir_path;
-
- /* call parent method */
- parent_class->init (folder, parent_store, parent_folder,
- name, separator, ex);
- if (camel_exception_get_id (ex))
- return;
-
- /* we assume that the parent init
- method checks for the existance of @folder */
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- folder->has_summary_capability = TRUE;
- folder->has_search_capability = TRUE;
-
- folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
- CAMEL_MESSAGE_DELETED |
- CAMEL_MESSAGE_DRAFT |
- CAMEL_MESSAGE_FLAGGED |
- CAMEL_MESSAGE_SEEN |
- CAMEL_MESSAGE_USER;
-
- mbox_folder->summary = NULL;
- mbox_folder->search = NULL;
-
- /* now set the name info */
- g_free (mbox_folder->folder_file_path);
- g_free (mbox_folder->folder_dir_path);
- g_free (mbox_folder->index_file_path);
-
- root_dir_path = camel_mbox_store_get_toplevel_dir (CAMEL_MBOX_STORE(folder->parent_store));
-
- mbox_folder->folder_file_path = g_strdup_printf ("%s/%s", root_dir_path, folder->full_name);
- mbox_folder->summary_file_path = g_strdup_printf ("%s/%s-ev-summary", root_dir_path, folder->full_name);
- mbox_folder->folder_dir_path = g_strdup_printf ("%s/%s.sdb", root_dir_path, folder->full_name);
- mbox_folder->index_file_path = g_strdup_printf ("%s/%s.ibex", root_dir_path, folder->full_name);
-}
-
-static void
-mbox_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- int forceindex;
- struct stat st;
-
- /* call parent class */
- parent_class->open (folder, mode, ex);
- if (camel_exception_get_id(ex))
- return;
-
- /* if we have no index file, force it */
- forceindex = stat(mbox_folder->index_file_path, &st) == -1;
-
- printf("loading ibex\n");
- mbox_folder->index = ibex_open(mbox_folder->index_file_path, O_CREAT|O_RDWR, 0600);
- printf("loaded ibex\n");
- if (mbox_folder->index == NULL) {
- /* yes, this isn't fatal at all */
- g_warning("Could not open/create index file: %s: indexing not performed",
- strerror(errno));
- }
-
- /* no summary (disk or memory), and we're proverbially screwed */
- printf("loading summary\n");
- mbox_folder->summary = camel_mbox_summary_new(mbox_folder->summary_file_path, mbox_folder->folder_file_path, mbox_folder->index);
- if (mbox_folder->summary == NULL
- || camel_mbox_summary_load(mbox_folder->summary, forceindex) == -1) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID, /* FIXME: right error code */
- "Could not create summary");
- return;
- }
- printf("summary loaded\n");
-}
-
-static void
-mbox_close (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
-
- /* call parent implementation */
- parent_class->close (folder, expunge, ex);
-
- if (expunge) {
- mbox_expunge(folder, ex);
- }
-
- /* save index */
- if (mbox_folder->index) {
- ibex_close(mbox_folder->index);
- mbox_folder->index = NULL;
- }
- if (mbox_folder->summary) {
- camel_folder_summary_save ((CamelFolderSummary *)mbox_folder->summary);
- gtk_object_unref((GtkObject *)mbox_folder->summary);
- mbox_folder->summary = NULL;
- }
- if (mbox_folder->search) {
- gtk_object_unref((GtkObject *)mbox_folder->search);
- mbox_folder->search = NULL;
- }
-}
-
-static void
-mbox_expunge (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox = (CamelMboxFolder *)folder;
-
- if (camel_mbox_summary_expunge(mbox->summary) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID, /* FIXME: right error code */
- "Could not expunge: %s", strerror(errno));
- }
-
- /* TODO: check it actually changed */
- gtk_signal_emit_by_name((GtkObject *)folder, "folder_changed", 0);
-}
-
-/* FIXME: clean up this snot */
-static gboolean
-mbox_exists (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder;
- struct stat stat_buf;
- gint stat_error;
- gboolean exists;
-
- g_assert(folder != NULL);
-
- mbox_folder = CAMEL_MBOX_FOLDER (folder);
-
- /* check if the mbox file path is determined */
- if (!mbox_folder->folder_file_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "undetermined folder file path. Maybe use set_name ?");
- return FALSE;
- }
-
- /* check if the mbox dir path is determined */
- if (!mbox_folder->folder_dir_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "undetermined folder directory path. Maybe use set_name ?");
- return FALSE;
- }
-
-
- /* we should not check for that here */
-#if 0
- /* check if the mbox directory exists */
- access_result = access (mbox_folder->folder_dir_path, F_OK);
- if (access_result < 0) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- strerror(errno));
- return FALSE;
- }
- stat_error = stat (mbox_folder->folder_dir_path, &stat_buf);
- if (stat_error == -1) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- strerror(errno));
- return FALSE;
- }
- exists = S_ISDIR (stat_buf.st_mode);
- if (!exists) return FALSE;
-#endif
-
-
- /* check if the mbox file exists */
- stat_error = stat (mbox_folder->folder_file_path, &stat_buf);
- if (stat_error == -1)
- return FALSE;
-
- exists = S_ISREG (stat_buf.st_mode);
- /* we should check the rights here */
-
- return exists;
-}
-
-/* FIXME: clean up this snot */
-static gboolean
-mbox_create (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- const gchar *folder_file_path, *folder_dir_path;
- mode_t dir_mode = S_IRWXU;
- gint mkdir_error;
- gboolean folder_already_exists;
- int creat_fd;
-
- g_assert(folder != NULL);
-
- /* call default implementation */
- parent_class->create (folder, ex);
-
- /* get the paths of what we need to create */
- folder_file_path = mbox_folder->folder_file_path;
- folder_dir_path = mbox_folder->folder_dir_path;
-
- if (!(folder_file_path || folder_dir_path)) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- /* if the folder already exists, simply return */
- folder_already_exists = camel_folder_exists (folder,ex);
- if (camel_exception_get_id (ex))
- return FALSE;
-
- if (folder_already_exists)
- return TRUE;
-
-
- /* create the directory for the subfolders */
- mkdir_error = mkdir (folder_dir_path, dir_mode);
- if (mkdir_error == -1)
- goto io_error;
-
-
- /* create the mbox file */
- /* it must be rw for the user and none for the others */
- creat_fd = open (folder_file_path,
- O_WRONLY | O_CREAT | O_APPEND,
- 0600);
- if (creat_fd == -1)
- goto io_error;
-
- close (creat_fd);
-
- return TRUE;
-
- /* exception handling for io errors */
- io_error :
- if (errno == EACCES) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "You don't have the permission to create the mbox file.");
- return FALSE;
- } else {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to create the mbox file.");
- return FALSE;
- }
-}
-
-
-/* FIXME: cleanup */
-static gboolean
-mbox_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- const gchar *folder_file_path, *folder_dir_path;
- gint rmdir_error = 0;
- gint unlink_error = 0;
- gboolean folder_already_exists;
-
- g_assert(folder != NULL);
-
- /* check if the folder object exists */
-
- /* in the case where the folder does not exist,
- return immediatly */
- folder_already_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex))
- return FALSE;
-
- if (!folder_already_exists)
- return TRUE;
-
-
- /* call default implementation.
- It should delete the messages in the folder
- and recurse the operation to subfolders */
- parent_class->delete (folder, recurse, ex);
-
-
- /* get the paths of what we need to be deleted */
- folder_file_path = mbox_folder->folder_file_path;
- folder_dir_path = mbox_folder->folder_file_path;
-
- if (!(folder_file_path || folder_dir_path)) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- /* physically delete the directory */
- rmdir_error = rmdir (folder_dir_path);
- if (rmdir_error == -1)
- switch (errno) {
- case EACCES :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "Not enough permission to delete the mbox folder");
- return FALSE;
- break;
-
- case ENOTEMPTY :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NON_EMPTY,
- "mbox folder not empty. Cannot delete it. Maybe use recurse flag ?");
- return FALSE;
- break;
- default :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to delete the mbox folder.");
- return FALSE;
- }
-
- /* physically delete the file */
- unlink_error = unlink (folder_dir_path);
- if (unlink_error == -1)
- switch (errno) {
- case EACCES :
- case EPERM :
- case EROFS :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "Not enough permission to delete the mbox file");
- return FALSE;
- break;
-
- case EFAULT :
- case ENOENT :
- case ENOTDIR :
- case EISDIR :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
- "Invalid mbox file");
- return FALSE;
- break;
-
- default :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to delete the mbox folder.");
- return FALSE;
- }
-
-
- return TRUE;
-}
-
-/* TODO: remove this */
-gboolean
-mbox_delete_messages (CamelFolder *folder, CamelException *ex)
-{
-
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- const gchar *folder_file_path;
- gboolean folder_already_exists;
- int creat_fd;
- g_assert(folder!=NULL);
-
- /* in the case where the folder does not exist,
- return immediatly */
- folder_already_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- if (!folder_already_exists) return TRUE;
-
-
-
- /* get the paths of the mbox file we need to delete */
- folder_file_path = mbox_folder->folder_file_path;
-
- if (!folder_file_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- /* create the mbox file */
- /* it must be rw for the user and none for the others */
- creat_fd = open (folder_file_path,
- O_WRONLY | O_TRUNC,
- 0600);
- if (creat_fd == -1)
- goto io_error;
- close (creat_fd);
-
- return TRUE;
-
- /* exception handling for io errors */
- io_error :
- if (errno == EACCES) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "You don't have the permission to write in the mbox file.");
- return FALSE;
- } else {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to write in the mbox file.");
- return FALSE;
- }
-
-
-}
-
-static gint
-mbox_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
-
- g_assert (folder);
- g_assert (mbox_folder->summary);
-
- return camel_folder_summary_count((CamelFolderSummary *)mbox_folder->summary);
-}
-
-/* FIXME: this may need some tweaking for performance? */
-static void
-mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- CamelStream *output_stream = NULL, *filter_stream = NULL;
- CamelMimeFilter *filter_from;
- struct stat st;
- off_t seek = -1;
- char *xev;
- guint32 uid;
-
- if (stat(mbox_folder->folder_file_path, &st) != 0)
- goto fail;
-
- output_stream = camel_stream_fs_new_with_name (mbox_folder->folder_file_path, O_RDWR, 0600);
- if (output_stream == NULL)
- goto fail;
-
- seek = camel_seekable_stream_seek((CamelSeekableStream *)output_stream, st.st_size, SEEK_SET);
- if (seek != st.st_size)
- goto fail;
-
- /* assign a new x-evolution header/uid */
- camel_medium_remove_header((CamelMedium *)message, "X-Evolution");
- uid = camel_folder_summary_next_uid((CamelFolderSummary *)mbox_folder->summary);
- xev = g_strdup_printf("%08x-%04x", uid, message->flags & 0xffff);
- camel_medium_add_header((CamelMedium *)message, "X-Evolution", xev);
- g_free(xev);
-
- /* we must write this to the non-filtered stream ... */
- if (camel_stream_write_string (output_stream, "From - \n") == -1)
- goto fail;
-
- /* and write the content to the filtering stream, that translated '\nFrom' into '\n>From' */
- filter_stream = (CamelStream *)camel_stream_filter_new_with_stream(output_stream);
- filter_from = (CamelMimeFilter *)camel_mime_filter_from_new();
- camel_stream_filter_add((CamelStreamFilter *)filter_stream, filter_from);
- if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), filter_stream) == -1)
- goto fail;
-
- if (camel_stream_close (filter_stream) == -1)
- goto fail;
-
- /* filter stream ref's the output stream itself, so we need to unref it too */
- gtk_object_unref (GTK_OBJECT (filter_from));
- gtk_object_unref (GTK_OBJECT (filter_stream));
- gtk_object_unref (GTK_OBJECT (output_stream));
-
- /* force a summary update - will only update from the new position, if it can */
- camel_mbox_summary_update(mbox_folder->summary, seek);
- return;
-
-fail:
- if (camel_exception_is_set (ex)) {
- camel_exception_setv (ex, camel_exception_get_id (ex),
- "Cannot append message to mbox file: %s",
- camel_exception_get_description (ex));
- } else {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Cannot append message to mbox file: %s",
- g_strerror (errno));
- }
- if (filter_stream) {
- /*camel_stream_close (filter_stream);*/
- gtk_object_unref ((GtkObject *)filter_stream);
- }
- if (output_stream)
- gtk_object_unref ((GtkObject *)output_stream);
-
- if (filter_from)
- gtk_object_unref ((GtkObject *)filter_from);
-
- /* make sure the file isn't munged by us */
- if (seek != -1) {
- int fd = open(mbox_folder->folder_file_path, O_WRONLY, 0600);
- if (fd != -1) {
- ftruncate(fd, st.st_size);
- close(fd);
- }
- }
-}
-
-static GPtrArray *
-mbox_get_uids (CamelFolder *folder, CamelException *ex)
-{
- GPtrArray *array;
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
- int i, count;
-
- count = camel_folder_summary_count((CamelFolderSummary *)mbox_folder->summary);
- array = g_ptr_array_new ();
- g_ptr_array_set_size (array, count);
- for (i=0;i<count;i++) {
- CamelMboxMessageInfo *info = (CamelMboxMessageInfo *)camel_folder_summary_index((CamelFolderSummary *)mbox_folder->summary, i);
- array->pdata[i] = g_strdup(info->info.uid);
- }
-
- return array;
-}
-
-static GPtrArray *
-mbox_get_subfolder_names (CamelFolder *folder, CamelException *ex)
-{
- /* No subfolders. */
- return g_ptr_array_new ();
-}
-
-static void
-mbox_delete_message_by_uid(CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelMessageInfo *info;
- CamelMboxFolder *mf = (CamelMboxFolder *)folder;
-
- info = camel_folder_summary_uid((CamelFolderSummary *)mf->summary, uid);
- if (info) {
- info->flags |= CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_folder_summary_touch((CamelFolderSummary *)mf->summary);
- }
-}
-
-/* track flag changes in the summary */
-static void
-message_changed(CamelMimeMessage *m, int type, CamelMboxFolder *mf)
-{
- CamelMessageInfo *info;
- CamelFlag *flag;
-
- printf("Message changed: %s: %d\n", m->message_uid, type);
- switch (type) {
- case MESSAGE_FLAGS_CHANGED:
- info = camel_folder_summary_uid((CamelFolderSummary *)mf->summary, m->message_uid);
- if (info) {
- info->flags = m->flags | CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_flag_list_free(&info->user_flags);
- flag = m->user_flags;
- while (flag) {
- camel_flag_set(&info->user_flags, flag->name, TRUE);
- flag = flag->next;
- }
- camel_folder_summary_touch((CamelFolderSummary *)mf->summary);
- } else
- g_warning("Message changed event on message not in summary: %s", m->message_uid);
- break;
- default:
- printf("Unhandled message change event: %d\n", type);
- break;
- }
-}
-
-static CamelMimeMessage *
-mbox_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- CamelStream *message_stream = NULL;
- CamelMimeMessage *message = NULL;
- CamelMboxMessageInfo *info;
- CamelMimeParser *parser = NULL;
- char *buffer;
- int len;
-
- /* get the message summary info */
- info = (CamelMboxMessageInfo *)camel_folder_summary_uid((CamelFolderSummary *)mbox_folder->summary, uid);
-
- if (info == NULL) {
- errno = ENOENT;
- goto fail;
- }
-
- /* if this has no content, its an error in the library */
- g_assert(info->info.content);
- g_assert(info->frompos != -1);
-
- /* where we read from */
- message_stream = camel_stream_fs_new_with_name (mbox_folder->folder_file_path, O_RDONLY, 0);
- if (message_stream == NULL)
- goto fail;
-
- /* we use a parser to verify the message is correct, and in the correct position */
- parser = camel_mime_parser_new();
- camel_mime_parser_init_with_stream(parser, message_stream);
- gtk_object_unref((GtkObject *)message_stream);
- camel_mime_parser_scan_from(parser, TRUE);
-
- camel_mime_parser_seek(parser, info->frompos, SEEK_SET);
- if (camel_mime_parser_step(parser, &buffer, &len) != HSCAN_FROM) {
- g_warning("File appears truncated");
- goto fail;
- }
-
- if (camel_mime_parser_tell_start_from(parser) != info->frompos) {
- g_warning("Summary doesn't match the folder contents! eek!");
- errno = EINVAL;
- goto fail;
- }
-
- message = camel_mime_message_new();
- if (camel_mime_part_construct_from_parser((CamelMimePart *)message, parser) == -1) {
- g_warning("Construction failed");
- goto fail;
- }
-
- /* we're constructed, finish setup and clean up */
- message->folder = folder;
- gtk_object_ref((GtkObject *)folder);
- message->message_uid = g_strdup(uid);
- message->flags = info->info.flags;
- gtk_signal_connect((GtkObject *)message, "message_changed", message_changed, folder);
-
- gtk_object_unref((GtkObject *)parser);
-
- return message;
-
-fail:
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- "Cannot get message: %s",
- g_strerror(errno));
-
- if (parser)
- gtk_object_unref((GtkObject *)parser);
- if (message)
- gtk_object_unref((GtkObject *)message);
-
- return NULL;
-}
-
-GPtrArray *
-mbox_get_summary (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
-
- return ((CamelFolderSummary *)mbox_folder->summary)->messages;
-}
-
-void
-mbox_free_summary (CamelFolder *folder, GPtrArray *array)
-{
- /* no-op */
-}
-
-/* get a single message info, by uid */
-static const CamelMessageInfo *
-mbox_summary_get_by_uid(CamelFolder *f, const char *uid)
-{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)f;
-
- return camel_folder_summary_uid((CamelFolderSummary *)mbox_folder->summary, uid);
-}
-
-static GList *
-mbox_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
-
- if (mbox_folder->search == NULL) {
- mbox_folder->search = camel_folder_search_new();
- }
-
- camel_folder_search_set_folder(mbox_folder->search, folder);
- if (mbox_folder->summary)
- /* FIXME: dont access summary array directly? */
- camel_folder_search_set_summary(mbox_folder->search, ((CamelFolderSummary *)mbox_folder->summary)->messages);
- camel_folder_search_set_body_index(mbox_folder->search, mbox_folder->index);
-
- return camel_folder_search_execute_expression(mbox_folder->search, expression, ex);
-}
diff --git a/camel/providers/mbox/camel-mbox-folder.h b/camel/providers/mbox/camel-mbox-folder.h
deleted file mode 100644
index d7dc361f14..0000000000
--- a/camel/providers/mbox/camel-mbox-folder.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-folder.h : Abstract class for an email folder */
-
-/*
- *
- * Author : Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MBOX_FOLDER_H
-#define CAMEL_MBOX_FOLDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-search.h>
-#include <libibex/ibex.h>
-#include "camel-mbox-summary.h"
-
-/* #include "camel-store.h" */
-
-#define CAMEL_MBOX_FOLDER_TYPE (camel_mbox_folder_get_type ())
-#define CAMEL_MBOX_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_MBOX_FOLDER_TYPE, CamelMboxFolder))
-#define CAMEL_MBOX_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MBOX_FOLDER_TYPE, CamelMboxFolderClass))
-#define IS_CAMEL_MBOX_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_MBOX_FOLDER_TYPE))
-
-typedef struct {
- CamelFolder parent_object;
-
- gchar *folder_file_path; /* contains the messages */
- gchar *summary_file_path; /* contains the messages summary */
- gchar *folder_dir_path; /* contains the subfolders */
- gchar *index_file_path; /* index of body contents */
-
- ibex *index; /* index for this folder */
- CamelMboxSummary *summary;
- CamelFolderSearch *search; /* used to run searches, we just use the real thing (tm) */
-} CamelMboxFolder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMboxFolderClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mbox_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MBOX_FOLDER_H */
diff --git a/camel/providers/mbox/camel-mbox-provider.c b/camel/providers/mbox/camel-mbox-provider.c
deleted file mode 100644
index 04ce88de12..0000000000
--- a/camel/providers/mbox/camel-mbox-provider.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-provider.c: mbox provider registration code */
-
-/*
- * Authors :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright (C) 2000 HelixCode (www.helixcode.com).
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "config.h"
-#include "camel-mbox-store.h"
-#include "camel-provider.h"
-#include "camel-session.h"
-
-static CamelProvider mbox_provider = {
- "mbox",
- "UNIX mbox-format mail files",
-
- "For reading mail delivered by the local system, and for "
- "storing mail on local disk.",
-
- 0,
-
- { 0, 0 }
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- mbox_provider.object_types[CAMEL_PROVIDER_STORE] =
- camel_mbox_store_get_type();
-
- camel_session_register_provider (session, &mbox_provider);
-}
diff --git a/camel/providers/mbox/camel-mbox-store.c b/camel/providers/mbox/camel-mbox-store.c
deleted file mode 100644
index 8db2f9338e..0000000000
--- a/camel/providers/mbox/camel-mbox-store.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-store.c : class for an mbox store */
-
-/*
- *
- * Copyright (C) 2000 Helix Code, Inc. <bertrand@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-
-#include "camel-mbox-store.h"
-#include "camel-mbox-folder.h"
-#include "camel-exception.h"
-#include "camel-url.h"
-
-/* Returns the class for a CamelMboxStore */
-#define CMBOXS_CLASS(so) CAMEL_MBOX_STORE_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-static CamelFolder *get_folder (CamelStore *store, const char *folder_name,
- CamelException *ex);
-static char *get_folder_name (CamelStore *store, const char *folder_name,
- CamelException *ex);
-
-static void
-camel_mbox_store_class_init (CamelMboxStoreClass *camel_mbox_store_class)
-{
- CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_mbox_store_class);
-
- /* virtual method overload */
- camel_store_class->get_folder = get_folder;
- camel_store_class->get_folder_name = get_folder_name;
-}
-
-
-
-static void
-camel_mbox_store_init (gpointer object, gpointer klass)
-{
- CamelService *service = CAMEL_SERVICE (object);
- CamelStore *store = CAMEL_STORE (object);
-
- service->url_flags = CAMEL_SERVICE_URL_NEED_PATH;
-
- /* mbox names are filenames, so they are case-sensitive. */
- store->folders = g_hash_table_new (g_str_hash, g_str_equal);
-}
-
-
-
-
-GtkType
-camel_mbox_store_get_type (void)
-{
- static GtkType camel_mbox_store_type = 0;
-
- if (!camel_mbox_store_type) {
- GtkTypeInfo camel_mbox_store_info =
- {
- "CamelMboxStore",
- sizeof (CamelMboxStore),
- sizeof (CamelMboxStoreClass),
- (GtkClassInitFunc) camel_mbox_store_class_init,
- (GtkObjectInitFunc) camel_mbox_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mbox_store_type = gtk_type_unique (CAMEL_STORE_TYPE, &camel_mbox_store_info);
- }
-
- return camel_mbox_store_type;
-}
-
-
-const gchar *
-camel_mbox_store_get_toplevel_dir (CamelMboxStore *store)
-{
- CamelURL *url = CAMEL_SERVICE (store)->url;
-
- g_assert(url != NULL);
- return url->path;
-}
-
-
-
-static CamelFolder *
-get_folder (CamelStore *store, const char *folder_name, CamelException *ex)
-{
- CamelMboxFolder *new_mbox_folder;
- CamelFolder *new_folder;
-
- new_mbox_folder = gtk_type_new (CAMEL_MBOX_FOLDER_TYPE);
- new_folder = CAMEL_FOLDER (new_mbox_folder);
-
- /* XXX We shouldn't be passing NULL here, but it's equivalent to
- * what was there before, and there's no
- * CamelMboxFolder::get_subfolder yet anyway...
- */
- CF_CLASS (new_folder)->init (new_folder, store, NULL,
- folder_name, '/', ex);
-
- return new_folder;
-}
-
-static char *
-get_folder_name (CamelStore *store, const char *folder_name,
- CamelException *ex)
-{
- return g_strdup (folder_name);
-}
diff --git a/camel/providers/mbox/camel-mbox-store.h b/camel/providers/mbox/camel-mbox-store.h
deleted file mode 100644
index 06a971ada4..0000000000
--- a/camel/providers/mbox/camel-mbox-store.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-store.h : class for an mbox store */
-
-/*
- *
- * Copyright (C) 2000 Helix Code, Inc. <bertrand@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MBOX_STORE_H
-#define CAMEL_MBOX_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-store.h"
-
-#define CAMEL_MBOX_STORE_TYPE (camel_mbox_store_get_type ())
-#define CAMEL_MBOX_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_MBOX_STORE_TYPE, CamelMboxStore))
-#define CAMEL_MBOX_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MBOX_STORE_TYPE, CamelMboxStoreClass))
-#define IS_CAMEL_MBOX_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_MBOX_STORE_TYPE))
-
-
-typedef struct {
- CamelStore parent_object;
-
-} CamelMboxStore;
-
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-} CamelMboxStoreClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mbox_store_get_type (void);
-
-const gchar *camel_mbox_store_get_toplevel_dir (CamelMboxStore *store);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MBOX_STORE_H */
-
-
diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c
deleted file mode 100644
index 46b180e999..0000000000
--- a/camel/providers/mbox/camel-mbox-summary.c
+++ /dev/null
@@ -1,740 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "camel-mbox-summary.h"
-#include <camel/camel-mime-message.h>
-
-#include <sys/stat.h>
-#include <sys/uio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#define io(x)
-#define d(x)
-
-#define CAMEL_MBOX_SUMMARY_VERSION (0x1000)
-
-struct _CamelMboxSummaryPrivate {
-};
-
-#define _PRIVATE(o) (((CamelMboxSummary *)(o))->priv)
-
-static int summary_header_load(CamelFolderSummary *, FILE *);
-static int summary_header_save(CamelFolderSummary *, FILE *);
-
-static CamelMessageInfo * message_info_new(CamelFolderSummary *, struct _header_raw *);
-static CamelMessageInfo * message_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
-static CamelMessageInfo * message_info_load(CamelFolderSummary *, FILE *);
-static int message_info_save(CamelFolderSummary *, FILE *, CamelMessageInfo *);
-/*static void message_info_free(CamelFolderSummary *, CamelMessageInfo *);*/
-
-static void camel_mbox_summary_class_init (CamelMboxSummaryClass *klass);
-static void camel_mbox_summary_init (CamelMboxSummary *obj);
-static void camel_mbox_summary_finalise (GtkObject *obj);
-
-static CamelFolderSummaryClass *camel_mbox_summary_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_mbox_summary_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelMboxSummary",
- sizeof (CamelMboxSummary),
- sizeof (CamelMboxSummaryClass),
- (GtkClassInitFunc) camel_mbox_summary_class_init,
- (GtkObjectInitFunc) camel_mbox_summary_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_folder_summary_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-camel_mbox_summary_class_init (CamelMboxSummaryClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- CamelFolderSummaryClass *sklass = (CamelFolderSummaryClass *) klass;
-
- camel_mbox_summary_parent = gtk_type_class (camel_folder_summary_get_type ());
-
- object_class->finalize = camel_mbox_summary_finalise;
-
- sklass->summary_header_load = summary_header_load;
- sklass->summary_header_save = summary_header_save;
-
- sklass->message_info_new = message_info_new;
- sklass->message_info_new_from_parser = message_info_new_from_parser;
- sklass->message_info_load = message_info_load;
- sklass->message_info_save = message_info_save;
- /*sklass->message_info_free = message_info_free;*/
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_mbox_summary_init (CamelMboxSummary *obj)
-{
- struct _CamelMboxSummaryPrivate *p;
- struct _CamelFolderSummary *s = (CamelFolderSummary *)obj;
-
- p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
-
- /* subclasses need to set the right instance data sizes */
- s->message_info_size = sizeof(CamelMboxMessageInfo);
- s->content_info_size = sizeof(CamelMboxMessageContentInfo);
-
- /* and a unique file version */
- s->version += CAMEL_MBOX_SUMMARY_VERSION;
-}
-
-static void
-camel_mbox_summary_finalise (GtkObject *obj)
-{
- CamelMboxSummary *mbs = (CamelMboxSummary *)obj;
-
- g_free(mbs->folder_path);
-
- ((GtkObjectClass *)(camel_mbox_summary_parent))->finalize((GtkObject *)obj);
-}
-
-/**
- * camel_mbox_summary_new:
- *
- * Create a new CamelMboxSummary object.
- *
- * Return value: A new CamelMboxSummary widget.
- **/
-CamelMboxSummary *
-camel_mbox_summary_new (const char *filename, const char *mbox_name, ibex *index)
-{
- CamelMboxSummary *new = CAMEL_MBOX_SUMMARY ( gtk_type_new (camel_mbox_summary_get_type ()));
- if (new) {
- /* ?? */
- camel_folder_summary_set_build_content((CamelFolderSummary *)new, TRUE);
- camel_folder_summary_set_filename((CamelFolderSummary *)new, filename);
- new->folder_path = g_strdup(mbox_name);
- new->index = index;
- }
- return new;
-}
-
-
-static int summary_header_load(CamelFolderSummary *s, FILE *in)
-{
- CamelMboxSummary *mbs = (CamelMboxSummary *)s;
-
- if (((CamelFolderSummaryClass *)camel_mbox_summary_parent)->summary_header_load(s, in) == -1)
- return -1;
-
- return camel_folder_summary_decode_uint32(in, &mbs->folder_size);
-}
-
-static int summary_header_save(CamelFolderSummary *s, FILE *out)
-{
- CamelMboxSummary *mbs = (CamelMboxSummary *)s;
-
- if (((CamelFolderSummaryClass *)camel_mbox_summary_parent)->summary_header_save(s, out) == -1)
- return -1;
-
- return camel_folder_summary_encode_uint32(out, mbs->folder_size);
-}
-
-static int
-header_evolution_decode(const char *in, guint32 *uid, guint32 *flags)
-{
- char *header;
- if (in
- && (header = header_token_decode(in))) {
- if (strlen(header) == strlen("00000000-0000")
- && sscanf(header, "%08x-%04x", uid, flags) == 2) {
- g_free(header);
- return *uid;
- }
- g_free(header);
- }
-
- return -1;
-}
-
-static char *
-header_evolution_encode(guint32 uid, guint32 flags)
-{
- return g_strdup_printf("%08x-%04x", uid, flags & 0xffff);
-}
-
-static CamelMessageInfo * message_info_new(CamelFolderSummary *s, struct _header_raw *h)
-{
- CamelMessageInfo *mi;
-
- mi = ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_new(s, h);
- if (mi) {
- const char *xev;
- guint32 uid, flags;
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
-
- xev = header_raw_find(&h, "X-Evolution", NULL);
- if (xev
- && header_evolution_decode(xev, &uid, &flags) != -1) {
- g_free(mi->uid);
- mi->uid = g_strdup_printf("%u", uid);
- mi->flags = flags;
- } else {
- /* to indicate it has no xev header? */
- mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED|CAMEL_MESSAGE_FOLDER_NOXEV;
- mi->uid = g_strdup_printf("%u", camel_folder_summary_next_uid(s));
- }
- mbi->frompos = -1;
- }
- return mi;
-}
-
-static CamelMessageInfo * message_info_new_from_parser(CamelFolderSummary *s, CamelMimeParser *mp)
-{
- CamelMessageInfo *mi;
- CamelMboxSummary *mbs = (CamelMboxSummary *)s;
-
- mi = ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_new_from_parser(s, mp);
- if (mi) {
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
-
- mbi->frompos = camel_mime_parser_tell_start_from(mp);
-
- /* do we want to index this message as we add it, as well? */
- if (mbs->index_force
- || (mi->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0
- || !ibex_contains_name(mbs->index, mi->uid)) {
- camel_folder_summary_set_index(s, mbs->index);
- } else {
- camel_folder_summary_set_index(s, NULL);
- }
- }
- return mi;
-}
-
-static CamelMessageInfo * message_info_load(CamelFolderSummary *s, FILE *in)
-{
- CamelMessageInfo *mi;
-
- io(printf("loading mbox message info\n"));
-
- mi = ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_load(s, in);
- if (mi) {
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
-
- camel_folder_summary_decode_uint32(in, &mbi->frompos);
- }
- return mi;
-}
-
-static int message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
-{
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
-
- io(printf("saving mbox message info\n"));
-
- ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_save(s, out, mi);
-
- return camel_folder_summary_encode_uint32(out, mbi->frompos);
-}
-
-static int
-summary_rebuild(CamelMboxSummary *mbs, off_t offset)
-{
- CamelMimeParser *mp;
- int fd;
- int ok = 0;
-
- printf("(re)Building summary from %d (%s)\n", (int)offset, mbs->folder_path);
-
- fd = open(mbs->folder_path, O_RDONLY);
- mp = camel_mime_parser_new();
- camel_mime_parser_init_with_fd(mp, fd);
- camel_mime_parser_scan_from(mp, TRUE);
- camel_mime_parser_seek(mp, offset, SEEK_SET);
-
- if (offset > 0) {
- if (camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM) {
- if (camel_mime_parser_tell_start_from(mp) != offset) {
- g_warning("The next message didn't start where I expected\nbuilding summary from start");
- camel_mime_parser_drop_step(mp);
- offset = 0;
- camel_mime_parser_seek(mp, offset, SEEK_SET);
- camel_folder_summary_clear((CamelFolderSummary *)mbs);
- } else {
- camel_mime_parser_unstep(mp);
- }
- } else {
- gtk_object_unref((GtkObject *)mp);
- /* end of file - no content? */
- printf("We radn out of file?\n");
- return 0;
- }
- }
-
- while (camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM) {
- CamelMessageInfo *info;
-
- info = camel_folder_summary_add_from_parser((CamelFolderSummary *)mbs, mp);
- if (info == NULL) {
- printf("Could not build info from file?\n");
- ok = -1;
- break;
- }
-
- g_assert(camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM_END);
- }
-
- /* update the file size in the summary */
- if (ok != -1)
- mbs->folder_size = camel_mime_parser_seek(mp, 0, SEEK_CUR);
- printf("updating folder size = %d\n", mbs->folder_size);
- gtk_object_unref((GtkObject *)mp);
-
- return ok;
-}
-
-int
-camel_mbox_summary_update(CamelMboxSummary *mbs, off_t offset)
-{
- int ret;
-
- mbs->index_force = FALSE;
- ret = summary_rebuild(mbs, offset);
-
-#if 0
-#warning "Saving full summary and index after every summarisation is slow ..."
- if (ret != -1) {
- if (camel_folder_summary_save((CamelFolderSummary *)mbs) == -1)
- g_warning("Could not save summary: %s", strerror(errno));
- printf("summary saved\n");
- if (mbs->index)
- ibex_save(mbs->index);
- printf("ibex saved\n");
- }
-#endif
- return ret;
-}
-
-int
-camel_mbox_summary_load(CamelMboxSummary *mbs, int forceindex)
-{
- CamelFolderSummary *s = (CamelFolderSummary *)mbs;
- struct stat st;
- int ret = 0;
- off_t minstart;
-
- mbs->index_force = forceindex;
-
- /* is the summary out of date? */
- if (stat(mbs->folder_path, &st) == -1) {
- camel_folder_summary_clear(s);
- printf("Cannot summarise folder: '%s': %s\n", mbs->folder_path, strerror(errno));
- return -1;
- }
-
- if (forceindex || camel_folder_summary_load(s) == -1) {
- camel_folder_summary_clear(s);
- ret = summary_rebuild(mbs, 0);
- } else {
- minstart = st.st_size;
-#if 0
- /* find out the first unindexed message ... */
- /* TODO: For this to work, it has to check that the message is
- indexable, and contains content ... maybe it cannot be done
- properly? */
- for (i=0;i<camel_folder_summary_count(s);i++) {
- CamelMessageInfo *mi = camel_folder_summary_index(s, i);
- if (!ibex_contains_name(mbs->index, mi->uid)) {
- minstart = ((CamelMboxMessageInfo *)mi)->frompos;
- printf("Found unindexed message: %s\n", mi->uid);
- break;
- }
- }
-#endif
- /* is the summary uptodate? */
- if (st.st_size == mbs->folder_size && st.st_mtime == s->time) {
- printf("Summary time and date match mbox\n");
- if (minstart < st.st_size) {
- /* FIXME: Only clear the messages and reindex from this point forward */
- camel_folder_summary_clear(s);
- ret = summary_rebuild(mbs, 0);
- }
- } else {
- if (mbs->folder_size < st.st_size) {
- printf("Index is for a smaller mbox\n");
- if (minstart < mbs->folder_size) {
- /* FIXME: only make it rebuild as necessary */
- camel_folder_summary_clear(s);
- ret = summary_rebuild(mbs, 0);
- } else {
- ret = summary_rebuild(mbs, mbs->folder_size);
- }
- } else {
- printf("index is for a bigger mbox\n");
- camel_folder_summary_clear(s);
- ret = summary_rebuild(mbs, 0);
- }
- }
- }
-
- if (ret != -1) {
- mbs->folder_size = st.st_size;
- s->time = st.st_mtime;
- printf("saving summary\n");
- if (camel_folder_summary_save(s) == -1)
- g_warning("Could not save summary: %s", strerror(errno));
- printf("summary saved\n");
- if (mbs->index)
- ibex_save(mbs->index);
- printf("ibex saved\n");
- }
-
- return ret;
-}
-
-static int
-header_write(int fd, struct _header_raw *header, char *xevline)
-{
- struct iovec iv[4];
- int outlen = 0, len;
-
- iv[1].iov_base = ":";
- iv[1].iov_len = 1;
- iv[3].iov_base = "\n";
- iv[3].iov_len = 1;
-
- while (header) {
- if (strcasecmp(header->name, "X-Evolution")) {
- iv[0].iov_base = header->name;
- iv[0].iov_len = strlen(header->name);
- iv[2].iov_base = header->value;
- iv[2].iov_len = strlen(header->value);
-
- do {
- len = writev(fd, iv, 4);
- } while (len == -1 && errno == EINTR);
-
- if (len == -1)
- return -1;
- outlen += len;
- }
- header = header->next;
- }
-
- iv[0].iov_base = "X-Evolution: ";
- iv[0].iov_len = strlen(iv[0].iov_base);
- iv[1].iov_base = xevline;
- iv[1].iov_len = strlen(xevline);
- iv[2].iov_base = "\n\n";
- iv[2].iov_len = 2;
-
- do {
- len = writev(fd, iv, 3);
- } while (len == -1 && errno == EINTR);
-
- if (len == -1)
- return -1;
-
- outlen += 1;
-
- d(printf("Wrote %d bytes of headers\n", outlen));
-
- return outlen;
-}
-
-static int
-copy_block(int fromfd, int tofd, off_t start, size_t bytes)
-{
- char buffer[4096];
- int written = 0;
-
- d(printf("writing %d bytes ... ", bytes));
-
- if (lseek(fromfd, start, SEEK_SET) != start)
- return -1;
-
- while (bytes>0) {
- int toread, towrite;
-
- toread = bytes;
- if (bytes>4096)
- toread = 4096;
- else
- toread = bytes;
- do {
- towrite = read(fromfd, buffer, toread);
- } while (towrite == -1 && errno == EINTR);
-
- if (towrite == -1)
- return -1;
-
- /* check for 'end of file' */
- if (towrite == 0) {
- d(printf("end of file?\n"));
- break;
- }
-
- do {
- toread = write(tofd, buffer, towrite);
- } while (toread == -1 && errno == EINTR);
-
- if (toread == -1)
- return -1;
-
- written += toread;
- bytes -= toread;
- }
-
- d(printf("written %d bytes\n", written));
-
- return written;
-}
-
-int
-camel_mbox_summary_expunge(CamelMboxSummary *mbs)
-{
- CamelMimeParser *mp=NULL;
- int i, count;
- CamelMboxMessageInfo *info;
- CamelFolderSummary *s = (CamelFolderSummary *)mbs;
-
- int fd=-1, fdout=-1;
- off_t offset = 0;
- char *tmpname=0;
- char *buffer, *xevnew = NULL;
- const char *xev;
- int len;
- guint32 uid, flags;
- int quick = TRUE, work = FALSE;
-
- /* make sure we're in sync */
- count = camel_folder_summary_count(s);
- if (count>0) {
- CamelMessageInfo *mi = camel_folder_summary_index(s, count-1);
- camel_mbox_summary_update(mbs, mi->content->endpos);
- } else {
- camel_mbox_summary_update(mbs, 0);
- }
-
- /* check if we have any work to do */
- d(printf("Performing expunge, %d messages in inbox\n", count));
- for (i=0;quick && i<count;i++) {
- info = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
- if (info->info.flags & (CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_FOLDER_NOXEV))
- quick = FALSE;
- else
- work |= (info->info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0;
- }
-
- d(printf("Options: %s %s\n", quick?"quick":"", work?"Work":""));
-
- if (quick && !work)
- return 0;
-
- fd = open(mbs->folder_path, O_RDWR);
- if (fd == -1)
- return -1;
-
- mp = camel_mime_parser_new();
- camel_mime_parser_scan_from(mp, TRUE);
- camel_mime_parser_init_with_fd(mp, fd);
-
- if (!quick) {
- tmpname = alloca(strlen(mbs->folder_path)+5);
- sprintf(tmpname, "%s.tmp", mbs->folder_path);
- d(printf("Writing tmp file to %s\n", tmpname));
- retry_out:
- fdout = open(tmpname, O_WRONLY|O_CREAT|O_EXCL, 0600);
- if (fdout == -1) {
- if (errno == EEXIST)
- if (unlink(tmpname) != -1)
- goto retry_out;
- tmpname = 0;
- goto error;
- }
- }
-
- for (i=0;i<count;i++) {
- off_t frompos, bodypos;
- off_t xevoffset;
-
- info = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
-
- g_assert(info);
-
- d(printf("Looking at message %s\n", info->info.uid));
-
- if (info->info.flags & CAMEL_MESSAGE_DELETED) {
- d(printf("Deleting %s\n", info->info.uid));
-
- g_assert(!quick);
- offset -= (info->info.content->endpos - info->frompos);
- if (mbs->index)
- ibex_unindex(mbs->index, info->info.uid);
- camel_folder_summary_remove(s, (CamelMessageInfo *)info);
- count--;
- i--;
- info = NULL;
- } else if (info->info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_FLAGGED)) {
- int xevok = FALSE;
-
- d(printf("Updating header for %s flags = %08x\n", info->info.uid, info->info.flags));
-
- /* find the next message, header parts */
- camel_mime_parser_seek(mp, info->frompos, SEEK_SET);
- if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_FROM)
- goto error;
-
- if (camel_mime_parser_tell_start_from(mp) != info->frompos) {
- g_error("Summary/mbox mismatch, aborting expunge");
- goto error;
- }
-
- if (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_FROM_END)
- goto error;
-
- xev = camel_mime_parser_header(mp, "X-Evolution", (int *)&xevoffset);
- if (xev && header_evolution_decode(xev, &uid, &flags) != -1) {
- char name[64];
-
- sprintf(name, "%u", uid);
- if (strcmp(name, info->info.uid)) {
- d(printf("Summary mismatch, aborting leaving mailbox intact\n"));
- goto error;
- }
- xevok = TRUE;
- }
- xevnew = header_evolution_encode(strtoul(info->info.uid, NULL, 10), info->info.flags & 0xffff);
- if (quick) {
- if (!xevok) {
- g_error("The summary told me I had an X-Evolution header, but i dont!");
- goto error;
- }
- buffer = g_strdup_printf("X-Evolution: %s", xevnew);
- do {
- len = write(fd, buffer, strlen(buffer));
- } while (len == -1 && errno == EINTR);
- g_free(buffer);
- if (len == -1) {
- goto error;
- }
- } else {
- frompos = lseek(fdout, 0, SEEK_CUR);
- write(fdout, "From -\n", strlen("From -\n"));
- if (header_write(fdout, camel_mime_parser_headers_raw(mp), xevnew) == -1) {
- d(printf("Error writing to tmp mailbox\n"));
- goto error;
- }
- bodypos = lseek(fdout, 0, SEEK_CUR);
- d(printf("pos = %d, endpos = %d, bodypos = %d\n",
- info->info.content->pos,
- info->info.content->endpos,
- info->info.content->bodypos));
- if (copy_block(fd, fdout, info->info.content->bodypos, info->info.content->endpos - info->info.content->bodypos) == -1) {
- g_warning("Cannot copy data to output fd");
- goto error;
- }
- info->frompos = frompos;
- offset = bodypos - info->info.content->bodypos;
- }
- info->info.flags &= 0xffff;
- g_free(xevnew); xevnew = NULL;
- camel_mime_parser_drop_step(mp);
- camel_mime_parser_drop_step(mp);
- } else {
- d(printf("Nothing to do for this message\n"));
- }
- if (!quick && info!=NULL && offset!=0) {
- camel_folder_summary_offset_content(info->info.content, offset);
- d(printf("pos = %d, endpos = %d, bodypos = %d\n",
- info->info.content->pos,
- info->info.content->endpos,
- info->info.content->bodypos));
- }
- }
-
- d(printf("Closing folders\n"));
-
- if (close(fd) == -1) {
- g_warning("Cannot close source folder: %s", strerror(errno));
- goto error;
- }
-
- if (!quick) {
- struct stat st;
-
- if (close(fdout) == -1) {
- g_warning("Cannot close tmp folder: %s", strerror(errno));
- goto error;
- }
-
- if (rename(tmpname, mbs->folder_path) == -1) {
- g_warning("Cannot rename folder: %s", strerror(errno));
- goto error;
- }
- tmpname = 0;
-
- if (stat(mbs->folder_path, &st) == -1)
- goto error;
-
- camel_folder_summary_touch(s);
- s->time = st.st_mtime;
- mbs->folder_size = st.st_size;
- camel_folder_summary_save(s);
- if (mbs->index)
- ibex_save(mbs->index);
- }
-
- gtk_object_unref((GtkObject *)mp);
-
- return 0;
-error:
- d(printf("Error occured: %s\n", strerror(errno)));
- count = errno;
-
- close(fd);
- close(fdout);
-
- g_free(xevnew);
-
- if (tmpname)
- unlink(tmpname);
- if (mp)
- gtk_object_unref((GtkObject *)mp);
-
- errno = count;
- return -1;
-}
diff --git a/camel/providers/mbox/camel-mbox-summary.h b/camel/providers/mbox/camel-mbox-summary.h
deleted file mode 100644
index 6d98fd051d..0000000000
--- a/camel/providers/mbox/camel-mbox-summary.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef _CAMEL_MBOX_SUMMARY_H
-#define _CAMEL_MBOX_SUMMARY_H
-
-#include <gtk/gtk.h>
-#include <camel/camel-folder-summary.h>
-#include <libibex/ibex.h>
-
-#define CAMEL_MBOX_SUMMARY(obj) GTK_CHECK_CAST (obj, camel_mbox_summary_get_type (), CamelMboxSummary)
-#define CAMEL_MBOX_SUMMARY_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mbox_summary_get_type (), CamelMboxSummaryClass)
-#define IS_CAMEL_MBOX_SUMMARY(obj) GTK_CHECK_TYPE (obj, camel_mbox_summary_get_type ())
-
-typedef struct _CamelMboxSummary CamelMboxSummary;
-typedef struct _CamelMboxSummaryClass CamelMboxSummaryClass;
-
-/* extra summary flags */
-enum {
- CAMEL_MESSAGE_FOLDER_NOXEV = 1<<16,
-/* CAMEL_MESSAGE_FOLDER_FLAGGED = 1<<17,*/
-};
-
-typedef struct _CamelMboxMessageContentInfo {
- CamelMessageContentInfo info;
-} CamelMboxMessageContentInfo;
-
-typedef struct _CamelMboxMessageInfo {
- CamelMessageInfo info;
-
- off_t frompos;
-} CamelMboxMessageInfo;
-
-struct _CamelMboxSummary {
- CamelFolderSummary parent;
-
- struct _CamelMboxSummaryPrivate *priv;
-
- char *folder_path; /* name of matching folder */
- size_t folder_size; /* size of the mbox file, last sync */
-
- ibex *index;
- int index_force; /* do we force index during creation? */
-};
-
-struct _CamelMboxSummaryClass {
- CamelFolderSummaryClass parent_class;
-};
-
-guint camel_mbox_summary_get_type (void);
-CamelMboxSummary *camel_mbox_summary_new (const char *filename, const char *mbox_name, ibex *index);
-
-/* load/check the summary */
-int camel_mbox_summary_load(CamelMboxSummary *mbs, int forceindex);
-/* incremental update */
-int camel_mbox_summary_update(CamelMboxSummary *mbs, off_t offset);
-/* perform a folder expunge */
-int camel_mbox_summary_expunge(CamelMboxSummary *mbs);
-
-#endif /* ! _CAMEL_MBOX_SUMMARY_H */
diff --git a/camel/providers/mbox/libcamelmbox.urls b/camel/providers/mbox/libcamelmbox.urls
deleted file mode 100644
index e021190356..0000000000
--- a/camel/providers/mbox/libcamelmbox.urls
+++ /dev/null
@@ -1 +0,0 @@
-mbox
diff --git a/camel/providers/nntp/.cvsignore b/camel/providers/nntp/.cvsignore
deleted file mode 100644
index fd6b811c68..0000000000
--- a/camel/providers/nntp/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
diff --git a/camel/providers/nntp/Makefile.am b/camel/providers/nntp/Makefile.am
deleted file mode 100644
index 6c37e2112f..0000000000
--- a/camel/providers/nntp/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelnntpincludedir = $(includedir)/camel
-
-providerdir = $(pkglibdir)/camel-providers/$(VERSION)
-
-provider_LTLIBRARIES = libcamelnntp.la
-provider_DATA = libcamelnntp.urls
-
-INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \
- -I$(top_srcdir)/intl \
- $(GTK_INCLUDEDIR) -I$(top_srcdir)/camel \
- -I$(srcdir)/../mbox \
- -DG_LOG_DOMAIN=\"camel-nntp-provider\"
-
-libcamelnntp_la_SOURCES = \
- camel-nntp-folder.c \
- camel-nntp-provider.c \
- camel-nntp-store.c \
- camel-nntp-utils.c
-
-libcamelnntpinclude_HEADERS = \
- camel-nntp-folder.h \
- camel-nntp-store.h
-
-
-libcamelnntp_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-EXTRA_DIST = libcamelnntp.urls
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c
deleted file mode 100644
index 8bc623add7..0000000000
--- a/camel/providers/nntp/camel-nntp-folder.c
+++ /dev/null
@@ -1,617 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-folder.c : Abstract class for an email folder */
-
-/*
- * Author : Chris Toshok <toshok@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-
-#include "camel-folder-summary.h"
-#include "camel-nntp-store.h"
-#include "camel-nntp-folder.h"
-#include "camel-nntp-store.h"
-#include "camel-nntp-utils.h"
-
-#include "string-utils.h"
-#include "camel-stream-mem.h"
-#include "camel-stream-buffer.h"
-#include "camel-data-wrapper.h"
-#include "camel-mime-message.h"
-#include "camel-folder-summary.h"
-
-#include "camel-exception.h"
-
-static CamelFolderClass *parent_class=NULL;
-
-/* Returns the class for a CamelNNTPFolder */
-#define CNNTPF_CLASS(so) CAMEL_NNTP_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CNNTPS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void _init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar separator, CamelException *ex);
-
-static void _open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex);
-static void _close (CamelFolder *folder, gboolean expunge, CamelException *ex);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _create(CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean _delete_messages (CamelFolder *folder, CamelException *ex);
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex);
-static gint _get_message_count (CamelFolder *folder, CamelException *ex);
-static void _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static GPtrArray *_get_uid_array (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-#if 0
-static void _expunge (CamelFolder *folder, CamelException *ex);
-static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex);
-#endif
-static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-
-static void _finalize (GtkObject *object);
-
-static void
-camel_nntp_folder_class_init (CamelNNTPFolderClass *camel_nntp_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_nntp_folder_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_class);
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_folder_class->init = _init;
- camel_folder_class->open = _open;
- camel_folder_class->close = _close;
- camel_folder_class->exists = _exists;
- camel_folder_class->create = _create;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->list_subfolders = _list_subfolders;
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->get_uid_array = _get_uid_array;
- camel_folder_class->get_message_by_uid = _get_message_by_uid;
-#if 0
- camel_folder_class->append_message = _append_message;
- camel_folder_class->expunge = _expunge;
- camel_folder_class->copy_message_to = _copy_message_to;
- camel_folder_class->get_message_uid = _get_message_uid;
-#endif
-
- gtk_object_class->finalize = _finalize;
-
-}
-
-static void
-_finalize (GtkObject *object)
-{
- CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (object);
-
- g_free (nntp_folder->summary_file_path);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-GtkType
-camel_nntp_folder_get_type (void)
-{
- static GtkType camel_nntp_folder_type = 0;
-
- if (!camel_nntp_folder_type) {
- GtkTypeInfo camel_nntp_folder_info =
- {
- "CamelNNTPFolder",
- sizeof (CamelNNTPFolder),
- sizeof (CamelNNTPFolderClass),
- (GtkClassInitFunc) camel_nntp_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_nntp_folder_type = gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_nntp_folder_info);
- }
-
- return camel_nntp_folder_type;
-}
-
-static void
-_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name, gchar separator,
- CamelException *ex)
-{
- /* call parent method */
- parent_class->init (folder, parent_store, parent_folder,
- name, separator, ex);
- if (camel_exception_get_id (ex)) return;
-
- /* we assume that the parent init
- method checks for the existance of @folder */
-
- if (!strcmp(name, "/"))
- {
- folder->has_summary_capability = FALSE;
- folder->can_hold_messages = FALSE;
- folder->can_hold_folders = TRUE;
- }
- else
- {
- folder->has_summary_capability = TRUE;
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- }
-
- folder->has_uid_capability = TRUE;
- folder->has_search_capability = FALSE;
-}
-
-/* internal method used to :
- - test for the existence of a summary file
- - test the sync between the summary and the newsgroup
- - load the summary or create it if necessary
-*/
-static void
-_check_get_or_maybe_generate_summary_file (CamelNNTPFolder *nntp_folder,
- CamelException *ex)
-{
- CamelFolder *folder = CAMEL_FOLDER (nntp_folder);
-
- nntp_folder->summary = camel_folder_summary_new ();
- camel_folder_summary_set_filename (nntp_folder->summary, nntp_folder->summary_file_path);
-
- if (-1 == camel_folder_summary_load (nntp_folder->summary)) {
- /* Bad or nonexistant summary file */
- camel_nntp_get_headers (CAMEL_FOLDER( folder )->parent_store, nntp_folder, ex);
- if (camel_exception_get_id (ex))
- return;
-
- /* XXX check return value */
- camel_folder_summary_save (nntp_folder->summary);
- }
-}
-
-
-static void
-_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex)
-{
- CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder);
- const gchar *root_dir_path;
-
- /* call parent class */
- parent_class->open (folder, mode, ex);
- if (camel_exception_get_id(ex))
- return;
-
-#if 0
- /* get (or create) uid list */
- if (!(nntp_load_uid_list (nntp_folder) > 0))
- nntp_generate_uid_list (nntp_folder);
-#endif
-
- root_dir_path = camel_nntp_store_get_toplevel_dir (CAMEL_NNTP_STORE(folder->parent_store));
-
- nntp_folder->summary_file_path = g_strdup_printf ("%s/%s-ev-summary", root_dir_path, folder->name);
-
- _check_get_or_maybe_generate_summary_file (nntp_folder, ex);
-}
-
-
-static void
-_close (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder);
- CamelFolderSummary *summary = nntp_folder->summary;
-
- /* call parent implementation */
- parent_class->close (folder, expunge, ex);
-
- /* XXX only if dirty? */
- camel_folder_summary_save (summary);
-}
-
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
-#if 0
- CamelNNTPFolder *nntp_folder;
- struct stat stat_buf;
- gint stat_error;
- gboolean exists;
-
- g_assert(folder != NULL);
-
- nntp_folder = CAMEL_NNTP_FOLDER (folder);
-
- /* check if the nntp summary path is determined */
- if (!nntp_folder->summary_file_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "undetermined folder summary path. Maybe use set_name ?");
- return FALSE;
- }
-
- /* check if the nntp file exists */
- stat_error = stat (nntp_folder->summary_file_path, &stat_buf);
- if (stat_error == -1)
- return FALSE;
-
- exists = S_ISREG (stat_buf.st_mode);
- /* we should check the rights here */
-
- return exists;
-#endif
- return TRUE;
-}
-
-static gboolean
-_create (CamelFolder *folder, CamelException *ex)
-{
-#if 0
- CamelNNTPSummary *summary;
- g_assert(folder != NULL);
-
- /* call default implementation */
- parent_class->create (folder, ex);
-
- /* create the summary object */
- summary = CAMEL_NNTP_SUMMARY (gtk_object_new (camel_nntp_summary_get_type (), NULL));
- summary->nb_message = 0;
- summary->next_uid = 1;
- summary->nntp_file_size = 0;
- summary->message_info = g_array_new (FALSE, FALSE, sizeof (CamelNNTPSummaryInformation));
-#endif
-
- return TRUE;
-}
-
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
-#if 0
- gboolean folder_already_exists;
-
- g_assert(folder != NULL);
-
- /* check if the folder object exists */
-
- /* in the case where the folder does not exist,
- return immediatly */
- folder_already_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex))
- return FALSE;
-
- if (!folder_already_exists)
- return TRUE;
-
-
- /* call default implementation.
- It should delete the messages in the folder
- and recurse the operation to subfolders */
- parent_class->delete (folder, recurse, ex);
-#endif
- return TRUE;
-}
-
-gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
-
- gboolean folder_already_exists;
-
- g_assert(folder!=NULL);
-
- /* in the case where the folder does not exist,
- return immediatly */
- folder_already_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- if (!folder_already_exists) return TRUE;
-
- return TRUE;
-}
-
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- /* newsgroups don't have subfolders */
- return NULL;
-}
-
-static gint
-_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER(folder);
-
- g_assert (folder);
- g_assert (nntp_folder->summary);
-
- return camel_folder_summary_count(nntp_folder->summary);
-}
-
-#if 0
-static void
-_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder);
-#if 0
- CamelNNTPSummary *summary = CAMEL_NNTP_SUMMARY (folder->summary);
-#endif
- CamelStream *output_stream;
- guint32 tmp_file_size;
- guint32 next_uid;
- gint tmp_file_fd;
- GArray *message_info_array;
-#if 0
- GArray *nntp_summary_info;
-#endif
- gchar *tmp_message_filename;
- gint fd1, fd2;
- int i;
-
- /* write the message itself */
- output_stream = camel_stream_fs_new_with_name (tmp_message_filename,
- CAMEL_STREAM_FS_WRITE);
- if (output_stream != NULL) {
- camel_stream_write_string (output_stream, "From - \n");
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream);
- }
- camel_stream_flush (output_stream);
- gtk_object_unref (GTK_OBJECT (output_stream));
-
- /* at this point we have saved the message to a
- temporary file, now, we have to add the x-evolution
- field and also update the main summary */
-
- /*
- First : parse the nntp file, but only from the
- position where the message has been added,
- wich happens to be the last postion in the
- nntp file before we added the message.
- This position is still stored in the summary
- for the moment
- */
- next_uid = summary->next_uid;
- tmp_file_fd = open (tmp_message_filename, O_RDONLY);
- message_info_array =
- camel_nntp_parse_file (tmp_file_fd, "From - ", 0,
- &tmp_file_size, &next_uid, TRUE,
- NULL, 0, ex);
-
- close (tmp_file_fd);
-
- /* get the value of the last available UID
- as saved in the summary file, again */
- next_uid = summary->next_uid;
-
- /* make sure all our of message info's have 0 uid - ignore any
- set elsewhere */
- for (i=0;i<message_info_array->len;i++) {
- g_array_index(message_info_array, CamelNNTPParserMessageInfo, i).uid = 0;
- }
-
- /*
- OK, this is not very efficient, we should not use the same
- method as for parsing an entire mail file,
- but I have no time to write a simpler parser
- */
-#if 0
- next_uid = camel_nntp_write_xev (nntp_folder, tmp_message_filename,
- message_info_array, &tmp_file_size, next_uid, ex);
-
-#endif
- if (camel_exception_get_id (ex)) {
- /* ** FIXME : free the preparsed information */
- return;
- }
-
-#if 0
- nntp_summary_info =
- parsed_information_to_nntp_summary (message_info_array);
-#endif
-
- /* store the number of messages as well as the summary array */
- summary->nb_message += 1;
- summary->next_uid = next_uid;
-
- ((CamelNNTPSummaryInformation *)(nntp_summary_info->data))->position +=
- summary->nntp_file_size;
- summary->nntp_file_size += tmp_file_size;
-
- camel_nntp_summary_append_entries (summary, nntp_summary_info);
- g_array_free (nntp_summary_info, TRUE);
-
-
- /* append the temporary file message to the nntp file */
- fd1 = open (tmp_message_filename, O_RDONLY);
- fd2 = open (nntp_folder->folder_file_path,
- O_WRONLY | O_CREAT | O_APPEND,
- 0600);
-
- if (fd2 == -1) {
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "could not open the nntp folder file for appending the message\n"
- "\t%s\n"
- "Full error is : %s\n",
- nntp_folder->folder_file_path,
- strerror (errno));
- return;
- }
-
- camel_nntp_copy_file_chunk (fd1,
- fd2,
- tmp_file_size,
- ex);
- close (fd1);
- close (fd2);
-
- /* remove the temporary file */
- unlink (tmp_message_filename);
-
- g_free (tmp_message_filename);
-}
-#endif
-
-
-
-static GPtrArray *
-_get_uid_array (CamelFolder *folder, CamelException *ex)
-{
- CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder);
- GPtrArray *message_info_array, *out;
- CamelMessageInfo *message_info;
- int i;
-
- message_info_array = nntp_folder->summary->messages;
-
- out = g_ptr_array_new ();
- g_ptr_array_set_size (out, message_info_array->len);
-
- for (i=0; i<message_info_array->len; i++) {
- message_info = (CamelMessageInfo *)(message_info_array->pdata) + i;
- out->pdata[i] = g_strdup (message_info->uid);
- }
-
- return out;
-}
-
-static CamelMimeMessage *
-_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelStream *nntp_istream;
- CamelStream *message_stream;
- CamelMimeMessage *message = NULL;
- CamelStore *parent_store;
- char *buf;
- int buf_len;
- int buf_alloc;
- int status;
- gboolean done;
-
- /* get the parent store */
- parent_store = camel_folder_get_parent_store (folder, ex);
- if (camel_exception_get_id (ex)) {
- return NULL;
- }
-
- status = camel_nntp_command (CAMEL_NNTP_STORE( parent_store ), NULL, "ARTICLE %s", uid);
-
- nntp_istream = CAMEL_NNTP_STORE (parent_store)->istream;
-
- /* if the uid was not found, raise an exception and return */
- if (status != CAMEL_NNTP_OK) {
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- "message %s not found.",
- uid);
- return NULL;
- }
-
- /* XXX ick ick ick. read the entire message into a buffer and
- then create a stream_mem for it. */
- buf_alloc = 2048;
- buf_len = 0;
- buf = malloc(buf_alloc);
- done = FALSE;
-
- buf[0] = 0;
-
- while (!done) {
- char *line = camel_stream_buffer_read_line ( CAMEL_STREAM_BUFFER ( nntp_istream ), ex);
- int line_length;
-
- /* XXX check exception */
-
- line_length = strlen ( line );
-
- if (!strcmp(line, ".")) {
- done = TRUE;
- g_free (line);
- }
- else {
- if (buf_len + line_length > buf_alloc) {
- buf_alloc *= 2;
- buf = realloc (buf, buf_alloc);
- }
- strcat(buf, line);
- strcat(buf, "\n");
- buf_len += strlen(line) + 1;
- g_free (line);
- }
- }
-
- /* create a stream bound to the message */
- message_stream = camel_stream_mem_new_with_buffer(buf, buf_len);
-
- message = camel_mime_message_new ();
- if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)message, message_stream) == -1) {
- gtk_object_unref ((GtkObject *)message);
- gtk_object_unref ((GtkObject *)message_stream);
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_UID, /* XXX */
- "Could not create message for uid %s.", uid);
-
- return NULL;
- }
- gtk_object_unref ((GtkObject *)message_stream);
-
- /* init other fields? */
- message->folder = folder;
- gtk_object_ref((GtkObject *)folder);
- message->message_uid = g_strdup(uid);
-
-#if 0
- gtk_signal_connect((GtkObject *)message, "message_changed", message_changed, folder);
-#endif
-
- return message;
-}
-
-/* get message info for a range of messages */
-static GPtrArray *
-summary_get_message_info (CamelFolder *folder, int first, int count)
-{
- GPtrArray *array = g_ptr_array_new();
- int i, maxcount;
- CamelNNTPFolder *nntp_folder = (CamelNNTPFolder *)folder;
-
- maxcount = camel_folder_summary_count(nntp_folder->summary);
- maxcount = MIN(first + count, maxcount);
- for (i=first;i<maxcount;i++)
- g_ptr_array_add(array, g_ptr_array_index(nntp_folder->summary->messages, i));
-
- return array;
-}
diff --git a/camel/providers/nntp/camel-nntp-folder.h b/camel/providers/nntp/camel-nntp-folder.h
deleted file mode 100644
index 7a445d697f..0000000000
--- a/camel/providers/nntp/camel-nntp-folder.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-folder.h : NNTP group (folder) support. */
-
-/*
- *
- * Author : Chris Toshok <toshok@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_NNTP_FOLDER_H
-#define CAMEL_NNTP_FOLDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-folder.h"
-
-/* #include "camel-store.h" */
-
-#define CAMEL_NNTP_FOLDER_TYPE (camel_nntp_folder_get_type ())
-#define CAMEL_NNTP_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_NNTP_FOLDER_TYPE, CamelNNTPFolder))
-#define CAMEL_NNTP_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_NNTP_FOLDER_TYPE, CamelNNTPFolderClass))
-#define IS_CAMEL_NNTP_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_NNTP_FOLDER_TYPE))
-
-
-typedef struct {
- CamelFolder parent_object;
-
- gchar *summary_file_path; /* contains the messages summary */
- CamelFolderSummary *summary;
-} CamelNNTPFolder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelNNTPFolderClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_nntp_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_NNTP_FOLDER_H */
diff --git a/camel/providers/nntp/camel-nntp-provider.c b/camel/providers/nntp/camel-nntp-provider.c
deleted file mode 100644
index fe50a1f952..0000000000
--- a/camel/providers/nntp/camel-nntp-provider.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-provider.c: nntp provider registration code */
-
-/*
- * Authors :
- * Chris Toshok <toshok@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc. (www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "config.h"
-#include "camel-nntp-store.h"
-#include "camel-provider.h"
-#include "camel-session.h"
-
-static CamelProvider news_provider = {
- "news",
- "USENET news",
-
- "This is a read-only provider for USENET newsgroups.",
-
- CAMEL_PROVIDER_IS_REMOTE,
-
- { 0, 0 }
-};
-
-static CamelProvider nntp_provider = {
- "nntp",
- "USENET news via NNTP",
-
- "This is a provider for reading from and posting to"
- "USENET newsgroups.",
-
- CAMEL_PROVIDER_IS_REMOTE,
-
- { 0, 0 }
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- news_provider.object_types[CAMEL_PROVIDER_STORE] =
- camel_nntp_store_get_type();
-#ifdef NOTYET
- nntp_provider.object_types[CAMEL_PROVIDER_TRANSPORT] =
- camel_nntp_transport_get_type();
-#endif
-
- camel_session_register_provider (session, &news_provider);
- camel_session_register_provider (session, &nntp_provider);
-}
-
-
-
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
deleted file mode 100644
index 2a0084eee2..0000000000
--- a/camel/providers/nntp/camel-nntp-store.c
+++ /dev/null
@@ -1,486 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-store.c : class for an nntp store */
-
-/*
- *
- * Copyright (C) 2000 Helix Code, Inc. <toshok@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "libgnome/libgnome.h"
-
-#include "camel-folder-summary.h"
-#include "camel-nntp-store.h"
-#include "camel-nntp-folder.h"
-#include "camel-stream-buffer.h"
-#include "camel-stream-fs.h"
-#include "camel-exception.h"
-#include "camel-url.h"
-#include "string-utils.h"
-
-#define NNTP_PORT 119
-
-static CamelServiceClass *service_class = NULL;
-
-/* Returns the class for a CamelNNTPStore */
-#define CNNTPS_CLASS(so) CAMEL_NNTP_STORE_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CNNTPF_CLASS(so) CAMEL_NNTP_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex);
-static char *_get_folder_name (CamelStore *store, const char *folder_name,
- CamelException *ex);
-
-static gboolean nntp_connect (CamelService *service, CamelException *ex);
-static gboolean nntp_disconnect (CamelService *service, CamelException *ex);
-
-static void
-camel_nntp_store_class_init (CamelNNTPStoreClass *camel_nntp_store_class)
-{
- CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_nntp_store_class);
-
- service_class = gtk_type_class (camel_service_get_type ());
-
- /* virtual method overload */
- camel_store_class->get_folder = _get_folder;
- camel_store_class->get_folder_name = _get_folder_name;
-}
-
-
-
-static void
-camel_nntp_store_init (gpointer object, gpointer klass)
-{
- CamelService *service = CAMEL_SERVICE (object);
-
- service->url_flags = CAMEL_SERVICE_URL_NEED_HOST;
-}
-
-GtkType
-camel_nntp_store_get_type (void)
-{
- static GtkType camel_nntp_store_type = 0;
-
- if (!camel_nntp_store_type) {
- GtkTypeInfo camel_nntp_store_info =
- {
- "CamelNNTPStore",
- sizeof (CamelNNTPStore),
- sizeof (CamelNNTPStoreClass),
- (GtkClassInitFunc) camel_nntp_store_class_init,
- (GtkObjectInitFunc) camel_nntp_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_nntp_store_type = gtk_type_unique (CAMEL_STORE_TYPE, &camel_nntp_store_info);
- }
-
- return camel_nntp_store_type;
-}
-
-static CamelFolder *
-_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex)
-{
- CamelNNTPFolder *new_nntp_folder;
- CamelFolder *new_folder;
-
- /* check if folder has already been created */
- /* call the standard routine for that when */
- /* it is done ... */
-
- new_nntp_folder = gtk_type_new (CAMEL_NNTP_FOLDER_TYPE);
- new_folder = CAMEL_FOLDER (new_nntp_folder);
-
- /* XXX We shouldn't be passing NULL here, but it's equivalent to
- * what was there before, and there's no
- * CamelNNTPFolder::get_subfolder yet anyway...
- */
- CF_CLASS (new_folder)->init (new_folder, store, NULL,
- folder_name, '/', ex);
-
- return new_folder;
-}
-
-
-static char *
-_get_folder_name (CamelStore *store, const char *folder_name,
- CamelException *ex)
-{
- return g_strdup (folder_name);
-}
-
-/**
- * camel_nntp_store_open: Connect to the server if we are currently
- * disconnected.
- * @store: the store
- * @ex: a CamelException
- *
- **/
-void
-camel_nntp_store_open (CamelNNTPStore *store, CamelException *ex)
-{
- CamelService *service = CAMEL_SERVICE (store);
- if (!camel_service_is_connected (service))
- nntp_connect (service, ex);
-}
-
-/**
- * camel_nntp_store_close: Close the connection to the server
- * @store: the store
- * @ex: a CamelException
- *
- **/
-void
-camel_nntp_store_close (CamelNNTPStore *store, gboolean expunge,
- CamelException *ex)
-{
- camel_nntp_command (store, NULL, "QUIT");
-
- nntp_disconnect (CAMEL_SERVICE (store), ex);
-}
-
-static gboolean
-nntp_connect (CamelService *service, CamelException *ex)
-{
- struct hostent *h;
- struct sockaddr_in sin;
- int fd;
- char *buf;
- CamelNNTPStore *store = CAMEL_NNTP_STORE (service);
-
- if (!service_class->connect (service, ex))
- return FALSE;
-
- h = camel_service_gethost (service, ex);
- if (!h)
- return FALSE;
-
- sin.sin_family = h->h_addrtype;
- sin.sin_port = htons (service->url->port ? service->url->port : NNTP_PORT);
- memcpy (&sin.sin_addr, h->h_addr, sizeof (sin.sin_addr));
-
- fd = socket (h->h_addrtype, SOCK_STREAM, 0);
- if (fd == -1 ||
- connect (fd, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- "Could not connect to %s (port %s): %s",
- service->url->host, service->url->port,
- strerror(errno));
- if (fd > -1)
- close (fd);
- return FALSE;
- }
-
- store->ostream = camel_stream_fs_new_with_fd (fd);
- store->istream = camel_stream_buffer_new (store->ostream,
- CAMEL_STREAM_BUFFER_READ);
-
- /* Read the greeting */
- buf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (store->istream), ex /* XX check this */);
- if (!buf) {
- return -1;
- }
-
- g_free (buf);
-
- /* get a list of extensions that the server supports */
- if (CAMEL_NNTP_OK == camel_nntp_command (store, NULL, "LIST EXTENSIONS")) {
- char *ext_response = camel_nntp_command_get_additional_data(store);
-
- g_free (ext_response);
- }
-
- return TRUE;
-}
-
-static gboolean
-nntp_disconnect (CamelService *service, CamelException *ex)
-{
- CamelNNTPStore *store = CAMEL_NNTP_STORE (service);
-
- if (!service->connected)
- return TRUE;
-
- if (!service_class->disconnect (service, ex))
- return FALSE;
-
- gtk_object_unref (GTK_OBJECT (store->ostream));
- gtk_object_unref (GTK_OBJECT (store->istream));
- store->ostream = NULL;
- store->istream = NULL;
- return TRUE;
-}
-
-/**
- * camel_nntp_command: Send a command to a NNTP server.
- * @store: the NNTP store
- * @ret: a pointer to return the full server response in
- * @fmt: a printf-style format string, followed by arguments
- *
- * This command sends the command specified by @fmt and the following
- * arguments to the connected NNTP store specified by @store. It then
- * reads the server's response and parses out the status code. If
- * the caller passed a non-NULL pointer for @ret, camel_nntp_command
- * will set it to point to an buffer containing the rest of the
- * response from the NNTP server. (If @ret was passed but there was
- * no extended response, @ret will be set to NULL.) The caller must
- * free this buffer when it is done with it.
- *
- * Return value: one of CAMEL_NNTP_OK (command executed successfully),
- * CAMEL_NNTP_ERR (command encounted an error), or CAMEL_NNTP_FAIL
- * (a protocol-level error occurred, and Camel is uncertain of the
- * result of the command.)
- **/
-int
-camel_nntp_command (CamelNNTPStore *store, char **ret, char *fmt, ...)
-{
- char *cmdbuf, *respbuf;
- va_list ap;
- int status;
- int resp_code;
- CamelException *ex;
-
- va_start (ap, fmt);
- cmdbuf = g_strdup_vprintf (fmt, ap);
- va_end (ap);
-
- ex = camel_exception_new();
-
- /* make sure we're connected */
- if (store->ostream == NULL)
- nntp_connect (CAMEL_SERVICE (store), ex);
-
- if (camel_exception_get_id (ex)) {
- camel_exception_free (ex);
- return CAMEL_NNTP_FAIL;
- }
-
- /* Send the command */
- camel_stream_write (store->ostream, cmdbuf, strlen (cmdbuf), ex /* XXX */);
- g_free (cmdbuf);
- camel_stream_write (store->ostream, "\r\n", 2, ex /* XXX */);
-
- /* Read the response */
- respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (store->istream), ex /* XXX */);
- resp_code = atoi (respbuf);
-
- if (resp_code < 400)
- status = CAMEL_NNTP_OK;
- else if (resp_code < 500)
- status = CAMEL_NNTP_ERR;
- else
- status = CAMEL_NNTP_FAIL;
-
- if (ret) {
- *ret = strchr (respbuf, ' ');
- if (*ret)
- *ret = g_strdup (*ret + 1);
- }
- g_free (respbuf);
-
- return status;
-}
-
-/**
- * camel_nntp_command_get_additional_data: get "additional data" from
- * a NNTP command.
- * @store: the NNTP store
- *
- * This command gets the additional data returned by
- * This command gets the additional data returned by "multi-line" POP
- * commands, such as LIST, RETR, TOP, and UIDL. This command _must_
- * be called after a successful (CAMEL_NNTP_OK) call to
- * camel_nntp_command for a command that has a multi-line response.
- * The returned data is un-byte-stuffed, and has lines termined by
- * newlines rather than CR/LF pairs.
- *
- * Return value: the data, which the caller must free.
- **/
-char *
-camel_nntp_command_get_additional_data (CamelNNTPStore *store)
-{
- CamelStreamBuffer *stream = CAMEL_STREAM_BUFFER (store->istream);
- GPtrArray *data;
- char *buf;
- int i, status = CAMEL_NNTP_OK;
- CamelException *ex = camel_exception_new();
-
- data = g_ptr_array_new ();
- while (1) {
- buf = camel_stream_buffer_read_line (stream, ex /* XXX */);
- if (!buf) {
- status = CAMEL_NNTP_FAIL;
- break;
- }
-
- if (!strcmp (buf, "."))
- break;
- if (*buf == '.')
- memmove (buf, buf + 1, strlen (buf));
- g_ptr_array_add (data, buf);
- }
-
- if (status == CAMEL_NNTP_OK) {
- /* Append an empty string to the end of the array
- * so when we g_strjoinv it, we get a "\n" after
- * the last real line.
- */
- g_ptr_array_add (data, "");
- g_ptr_array_add (data, NULL);
- buf = g_strjoinv ("\n", (char **)data->pdata);
- } else
- buf = NULL;
-
- for (i = 0; i < data->len - 2; i++)
- g_free (data->pdata[i]);
- g_ptr_array_free (data, TRUE);
-
- return buf;
-}
-
-void
-camel_nntp_store_subscribe_group (CamelStore *store,
- const gchar *group_name)
-{
- gchar *root_dir = camel_nntp_store_get_toplevel_dir(CAMEL_NNTP_STORE(store));
- char *ret = NULL;
- CamelException *ex = camel_exception_new();
-
- camel_nntp_store_open(CAMEL_NNTP_STORE(store), ex);
-
- if (camel_exception_get_id (ex)) {
- g_free (root_dir);
- camel_exception_free (ex);
- return;
- }
-
- if (CAMEL_NNTP_OK == camel_nntp_command ( CAMEL_NNTP_STORE (store),
- &ret, "GROUP %s", group_name)) {
- /* we create an empty summary file here, so that when
- the group is opened we'll know we need to build it. */
- gchar *summary_file;
- int fd;
- summary_file = g_strdup_printf ("%s/%s-ev-summary", root_dir, group_name);
-
- fd = open (summary_file, O_CREAT | O_RDWR, 0666);
- close (fd);
-
- g_free (summary_file);
- }
- if (ret) g_free (ret);
-
- g_free (root_dir);
- camel_exception_free (ex);
-}
-
-void
-camel_nntp_store_unsubscribe_group (CamelStore *store,
- const gchar *group_name)
-{
- gchar *root_dir = camel_nntp_store_get_toplevel_dir(CAMEL_NNTP_STORE(store));
- gchar *summary_file;
-
- summary_file = g_strdup_printf ("%s/%s-ev-summary", root_dir, group_name);
- if (g_file_exists (summary_file))
- unlink (summary_file);
- g_free (summary_file);
-
- g_free (root_dir);
-}
-
-GList *
-camel_nntp_store_list_subscribed_groups(CamelStore *store)
-{
- GList *group_name_list = NULL;
- struct stat stat_buf;
- gint stat_error = 0;
- gchar *entry_name;
- gchar *full_entry_name;
- gchar *real_group_name;
- struct dirent *dir_entry;
- DIR *dir_handle;
- gchar *root_dir = camel_nntp_store_get_toplevel_dir(CAMEL_NNTP_STORE(store));
-
- dir_handle = opendir (root_dir);
- g_return_val_if_fail (dir_handle, NULL);
-
- /* read the first entry in the directory */
- dir_entry = readdir (dir_handle);
- while ((stat_error != -1) && (dir_entry != NULL)) {
-
- /* get the name of the next entry in the dir */
- entry_name = dir_entry->d_name;
- full_entry_name = g_strdup_printf ("%s/%s", root_dir, entry_name);
- stat_error = stat (full_entry_name, &stat_buf);
- g_free (full_entry_name);
-
- /* is it a normal file ending in -ev-summary ? */
- if ((stat_error != -1) && S_ISREG (stat_buf.st_mode)) {
- gboolean summary_suffix_found;
-
- real_group_name = string_prefix (entry_name, "-ev-summary",
- &summary_suffix_found);
-
- if (summary_suffix_found)
- /* add the folder name to the list */
- group_name_list = g_list_append (group_name_list,
- real_group_name);
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- return group_name_list;
-}
-
-gchar *
-camel_nntp_store_get_toplevel_dir (CamelNNTPStore *store)
-{
- CamelURL *url = CAMEL_SERVICE (store)->url;
- char *news_dir;
- char *top_dir;
-
- g_assert(url != NULL);
-
- news_dir = gnome_util_prepend_user_home ("evolution/news");
-
- top_dir = g_strdup_printf( "%s/%s",
- news_dir,
- url->host );
-
- g_free (news_dir);
-
- return top_dir;
-}
diff --git a/camel/providers/nntp/camel-nntp-store.h b/camel/providers/nntp/camel-nntp-store.h
deleted file mode 100644
index 257772d7cb..0000000000
--- a/camel/providers/nntp/camel-nntp-store.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-store.h : class for an nntp store */
-
-/*
- *
- * Copyright (C) 2000 Helix Code, Inc. <toshok@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_NNTP_STORE_H
-#define CAMEL_NNTP_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-store.h"
-
-#define CAMEL_NNTP_STORE_TYPE (camel_nntp_store_get_type ())
-#define CAMEL_NNTP_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_NNTP_STORE_TYPE, CamelNNTPStore))
-#define CAMEL_NNTP_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_NNTP_STORE_TYPE, CamelNNTPStoreClass))
-#define IS_CAMEL_NNTP_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_NNTP_STORE_TYPE))
-
-
-typedef struct {
- CamelStore parent_object;
-
-#define CAMEL_NNTP_EXT_XOVER 0x01
- guint32 extensions;
-
- CamelStream *istream, *ostream;
-} CamelNNTPStore;
-
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-} CamelNNTPStoreClass;
-
-
-/* public methods */
-void camel_nntp_store_open (CamelNNTPStore *store, CamelException *ex);
-void camel_nntp_store_close (CamelNNTPStore *store, gboolean expunge,
- CamelException *ex);
-
-void camel_nntp_store_subscribe_group (CamelStore *store, const gchar *group_name);
-void camel_nntp_store_unsubscribe_group (CamelStore *store, const gchar *group_name);
-GList *camel_nntp_store_list_subscribed_groups(CamelStore *store);
-
-gchar *camel_nntp_store_get_toplevel_dir (CamelNNTPStore *store);
-
-/* support functions */
-enum { CAMEL_NNTP_OK, CAMEL_NNTP_ERR, CAMEL_NNTP_FAIL };
-int camel_nntp_command (CamelNNTPStore *store, char **ret, char *fmt, ...);
-char *camel_nntp_command_get_additional_data (CamelNNTPStore *store);
-
-/* Standard Gtk function */
-GtkType camel_nntp_store_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_NNTP_STORE_H */
-
-
diff --git a/camel/providers/nntp/camel-nntp-utils.c b/camel/providers/nntp/camel-nntp-utils.c
deleted file mode 100644
index 7100be0aed..0000000000
--- a/camel/providers/nntp/camel-nntp-utils.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-utils.c : utilities used by the nntp code. */
-
-/*
- * Author : Chris Toshok <toshok@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "camel-folder-summary.h"
-#include "camel-nntp-folder.h"
-#include "camel-nntp-store.h"
-#include "camel-nntp-utils.h"
-#include "camel-stream-buffer.h"
-#include "camel-stream-mem.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-static void
-get_XOVER_headers(CamelNNTPStore *nntp_store, CamelFolder *folder,
- int first_message, int last_message, CamelException *ex)
-{
- int status;
- CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder);
-
- status = camel_nntp_command (nntp_store, NULL,
- "XOVER %d-%d",
- first_message,
- last_message);
-
- if (status == CAMEL_NNTP_OK) {
- CamelStream *nntp_istream = nntp_store->istream;
- gboolean done = FALSE;
-
- while (!done) {
- char *line;
-
- line = camel_stream_buffer_read_line (
- CAMEL_STREAM_BUFFER ( nntp_istream ), ex /* XXX */);
-
- if (*line == '.') {
- done = TRUE;
- }
- else {
- CamelMessageInfo *new_info = g_new0(CamelMessageInfo, 1);
- char **split_line = g_strsplit (line, "\t", 7);
-
- new_info->subject = g_strdup(split_line[1]);
- new_info->from = g_strdup(split_line[2]);
- new_info->to = g_strdup(folder->name);
-#if 0
- new_info->date_sent = g_strdup(split_line[3]);
- /* XXX do we need to fill in both dates? */
- new_info->headers.date_received = g_strdup(split_line[3]);
-#endif
- new_info->size = atoi(split_line[5]);
- new_info->uid = g_strdup(split_line[4]);
- g_strfreev (split_line);
-
- camel_folder_summary_add (nntp_folder->summary, new_info);
- }
- g_free (line);
- }
- }
-}
-
-#if 0
-static GArray*
-get_HEAD_headers(CamelNNTPStore *nntp_store, CamelFolder *folder,
- int first_message, int last_message, CamelException *ex)
-{
- int i;
- int status;
- GArray *array;
- CamelMessageInfo info;
-
- array = g_array_new(FALSE, FALSE, sizeof(CamelMessageInfo));
-
- for (i = first_message; i < last_message; i ++) {
- status = camel_nntp_command (nntp_store, NULL,
- "HEAD %d", i);
-
- if (status == CAMEL_NNTP_OK) {
- gboolean done = FALSE;
- char *buf;
- int buf_len;
- int buf_alloc;
- int h;
- CamelStream *header_stream;
- GArray *header_array;
- CamelStream *nntp_istream;
-
- buf_alloc = 2048;
- buf_len = 0;
- buf = malloc(buf_alloc);
- done = FALSE;
-
- buf[0] = 0;
-
- nntp_istream = nntp_store->istream;
-
- while (!done) {
- char *line;
- int line_length;
-
- line = camel_stream_buffer_read_line (
- CAMEL_STREAM_BUFFER ( nntp_istream ));
- line_length = strlen ( line );
-
- if (*line == '.') {
- done = TRUE;
- }
- else {
- if (buf_len + line_length > buf_alloc) {
- buf_alloc *= 2;
- buf = realloc (buf, buf_alloc);
- }
- strcat(buf, line);
- strcat(buf, "\n");
- buf_len += strlen(line);
- g_free (line);
- }
- }
-
- /* create a stream from which to parse the headers */
- header_stream = camel_stream_mem_new_with_buffer(buf,
- buf_len,
- CAMEL_STREAM_MEM_READ);
-
- header_array = get_header_array_from_stream (header_stream);
-
- memset (&info, 0, sizeof(info));
-
- for (h = 0; h < header_array->len; h ++) {
- Rfc822Header *header = &((Rfc822Header*)header_array->data)[h];
- if (!g_strcasecmp(header->name, "From"))
- info.from = g_strdup(header->value);
- else if (!g_strcasecmp(header->name, "To"))
- info.to = g_strdup(header->value);
- else if (!g_strcasecmp(header->name, "Subject"))
- info.subject = g_strdup(header->value);
- else if (!g_strcasecmp(header->name, "Message-ID"))
- info.uid = g_strdup(header->value);
- else if (!g_strcasecmp(header->name, "Date")) {
-#if 0
- info.date_sent = g_strdup(header->value);
- info.date_received = g_strdup(header->value);
-#endif
- }
- }
- g_array_append_val(array, info);
- }
- else if (status == CAMEL_NNTP_FAIL) {
- /* nasty things are afoot */
- g_warning ("failure doing HEAD\n");
- break;
- }
- }
- return array;
-}
-#endif
-
-void
-camel_nntp_get_headers (CamelStore *store,
- CamelNNTPFolder *nntp_folder,
- CamelException *ex)
-{
- CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (store);
- CamelFolder *folder = CAMEL_FOLDER (nntp_folder);
- char *ret;
- int first_message, nb_message, last_message;
- int status;
-
- status = camel_nntp_command (nntp_store, &ret,
- "GROUP %s", folder->name);
-
- sscanf (ret, "%d %d %d", &nb_message, &first_message, &last_message);
- g_free (ret);
-
- if (status != CAMEL_NNTP_OK) {
- /* XXX throw invalid group exception */
- printf ("invalid group\n");
- return;
- }
-
- if (nntp_store->extensions & CAMEL_NNTP_EXT_XOVER) {
- get_XOVER_headers (nntp_store, folder, first_message, last_message, ex);
- }
- else {
-#if 0
- get_HEAD_headers (nntp_store, folder, first_message, last_message, ex);
-#endif
- }
-}
-
diff --git a/camel/providers/nntp/camel-nntp-utils.h b/camel/providers/nntp/camel-nntp-utils.h
deleted file mode 100644
index f28697c744..0000000000
--- a/camel/providers/nntp/camel-nntp-utils.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-utils.h : Utilities for the NNTP provider */
-
-/*
- *
- * Author : Chris Toshok <toshok@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code .
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_NNTP_UTILS_H
-#define CAMEL_NNTP_UTILS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-void camel_nntp_get_headers (CamelStore *store, CamelNNTPFolder *nntp_folder, CamelException *ex);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_NNTP_UTILS_H */
diff --git a/camel/providers/nntp/libcamelnntp.urls b/camel/providers/nntp/libcamelnntp.urls
deleted file mode 100644
index dee2e70f14..0000000000
--- a/camel/providers/nntp/libcamelnntp.urls
+++ /dev/null
@@ -1,2 +0,0 @@
-news
-nntp
diff --git a/camel/providers/pop3/.cvsignore b/camel/providers/pop3/.cvsignore
deleted file mode 100644
index 7d926a5545..0000000000
--- a/camel/providers/pop3/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
diff --git a/camel/providers/pop3/Makefile.am b/camel/providers/pop3/Makefile.am
deleted file mode 100644
index f30d73e736..0000000000
--- a/camel/providers/pop3/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelpop3includedir = $(includedir)/camel
-
-providerdir = $(pkglibdir)/camel-providers/$(VERSION)
-
-provider_LTLIBRARIES = libcamelpop3.la
-provider_DATA = libcamelpop3.urls
-
-INCLUDES = \
- -I.. \
- -I$(srcdir)/.. \
- -I$(srcdir)/../../.. \
- -I$(includedir) \
- -I$(top_srcdir)/intl \
- $(GTK_INCLUDEDIR) \
- -I$(top_srcdir)/camel \
- $(KRB4_CFLAGS) \
- -DG_LOG_DOMAIN=\"camel-pop3-provider\"
-
-libcamelpop3_la_SOURCES = \
- camel-pop3-folder.c \
- camel-pop3-provider.c \
- camel-pop3-store.c
-
-libcamelpop3include_HEADERS = \
- camel-pop3-folder.h \
- camel-pop3-store.h
-
-
-libcamelpop3_la_LDFLAGS = $(KRB4_LDFLAGS) -version-info 0:0:0 -rpath $(libdir)
-
-EXTRA_DIST = libcamelpop3.urls
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
deleted file mode 100644
index 45687e4f33..0000000000
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-pop3-folder.c : class for a pop3 folder */
-
-/*
- * Authors:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc. (www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "camel-pop3-folder.h"
-#include "camel-pop3-store.h"
-#include "camel-exception.h"
-#include "camel-stream-mem.h"
-#include "camel-mime-message.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#define CF_CLASS(o) (CAMEL_FOLDER_CLASS (GTK_OBJECT (o)->klass))
-static CamelFolderClass *parent_class;
-
-static void pop3_open (CamelFolder *folder, CamelFolderOpenMode mode,
- CamelException *ex);
-static void pop3_close (CamelFolder *folder, gboolean expunge,
- CamelException *ex);
-static gboolean delete_messages (CamelFolder *folder, CamelException *ex);
-
-static gint get_message_count (CamelFolder *folder, CamelException *ex);
-static GPtrArray *get_uids (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *get_message_by_uid (CamelFolder *folder,
- const char *uid,
- CamelException *ex);
-static void delete_message_by_uid (CamelFolder *folder, const char *uid,
- CamelException *ex);
-
-
-static void
-camel_pop3_folder_class_init (CamelPop3FolderClass *camel_pop3_folder_class)
-{
- CamelFolderClass *camel_folder_class =
- CAMEL_FOLDER_CLASS (camel_pop3_folder_class);
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method overload */
- camel_folder_class->open = pop3_open;
- camel_folder_class->close = pop3_close;
- camel_folder_class->delete_messages = delete_messages;
-
- camel_folder_class->get_message_count = get_message_count;
- camel_folder_class->get_uids = get_uids;
-
- camel_folder_class->get_message_by_uid = get_message_by_uid;
- camel_folder_class->delete_message_by_uid = delete_message_by_uid;
-}
-
-
-static void
-camel_pop3_folder_init (gpointer object, gpointer klass)
-{
- CamelPop3Folder *pop3_folder = CAMEL_POP3_FOLDER (object);
- CamelFolder *folder = CAMEL_FOLDER (object);
-
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = FALSE;
- folder->has_summary_capability = FALSE;
- folder->has_search_capability = FALSE;
-
- pop3_folder->count = -1;
-}
-
-
-GtkType
-camel_pop3_folder_get_type (void)
-{
- static GtkType camel_pop3_folder_type = 0;
-
- if (!camel_pop3_folder_type) {
- GtkTypeInfo camel_pop3_folder_info =
- {
- "CamelPop3Folder",
- sizeof (CamelPop3Folder),
- sizeof (CamelPop3FolderClass),
- (GtkClassInitFunc) camel_pop3_folder_class_init,
- (GtkObjectInitFunc) camel_pop3_folder_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_pop3_folder_type = gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_pop3_folder_info);
- }
-
- return camel_pop3_folder_type;
-}
-
-
-CamelFolder *camel_pop3_folder_new (CamelStore *parent, CamelException *ex)
-{
- CamelFolder *folder =
- CAMEL_FOLDER (gtk_object_new (camel_pop3_folder_get_type (),
- NULL));
-
- CF_CLASS (folder)->init (folder, parent, NULL, "inbox", '/', ex);
- return folder;
-}
-
-static void
-pop3_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex)
-{
- camel_pop3_store_open (CAMEL_POP3_STORE (folder->parent_store), ex);
- if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_NONE)
- parent_class->open (folder, mode, ex);
-}
-
-static void
-pop3_close (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- camel_pop3_store_close (CAMEL_POP3_STORE (folder->parent_store),
- expunge, ex);
- if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_NONE)
- parent_class->close (folder, expunge, ex);
-}
-
-static gboolean
-delete_messages (CamelFolder *folder, CamelException *ex)
-{
- int msgs;
- gboolean status;
-
- msgs = get_message_count (folder, ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE)
- return FALSE;
-
- status = TRUE;
- for (; msgs > 0; msgs--) {
- status = status &&
- (camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store),
- NULL, "DELE %d", msgs) ==
- CAMEL_POP3_OK);
- }
-
- if (!status) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- "Unable to delete all messages.");
- }
-
- return status;
-}
-
-
-static CamelMimeMessage *
-get_message_by_uid (CamelFolder *folder, const char *uid, CamelException *ex)
-{
- int status;
- char *result, *body;
- CamelStream *msgstream;
- CamelMimeMessage *msg;
-
- status = camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store),
- &result, "RETR %d", atoi (uid));
- if (status != CAMEL_POP3_OK) {
- CamelService *service = CAMEL_SERVICE (folder->parent_store);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- "Could not retrieve message from POP "
- "server %s: %s.", service->url->host,
- status == CAMEL_POP3_ERR ? result :
- "Unknown error");
- g_free (result);
- return NULL;
- }
- g_free (result);
-
- body = camel_pop3_command_get_additional_data (CAMEL_POP3_STORE (folder->parent_store), ex);
- if (!body) {
- CamelService *service = CAMEL_SERVICE (folder->parent_store);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- "Could not retrieve message from POP "
- "server %s: %s", service->url->host,
- camel_exception_get_description (ex));
- return NULL;
- }
-
- msgstream = camel_stream_mem_new_with_buffer (body, strlen (body));
- msg = camel_mime_message_new ();
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg),
- msgstream);
- gtk_object_unref (GTK_OBJECT (msgstream));
-
- return msg;
-}
-
-static void
-delete_message_by_uid (CamelFolder *folder, const char *uid,
- CamelException *ex)
-{
- int status;
- char *resp;
-
- status = camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store),
- &resp, "DELE %d", atoi (uid));
- if (status != CAMEL_POP3_OK) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- "Unable to delete message %s%s%s",
- uid, resp ? ": " : "",
- resp ? resp : "");
- }
- g_free (resp);
-}
-
-static gint
-get_message_count (CamelFolder *folder, CamelException *ex)
-{
- CamelPop3Folder *pop3_folder = CAMEL_POP3_FOLDER (folder);
- int status;
- char *result;
-
- if (pop3_folder->count != -1)
- return pop3_folder->count;
-
- status = camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store),
- &result, "STAT");
- if (status != CAMEL_POP3_OK) {
- CamelService *service = CAMEL_SERVICE (folder->parent_store);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- "Could not get message count from POP "
- "server %s: %s.", service->url->host,
- status == CAMEL_POP3_ERR ? result :
- "Unknown error");
- g_free (result);
- return -1;
- }
-
- pop3_folder->count = atoi (result);
- g_free (result);
- return pop3_folder->count;
-}
-
-static GPtrArray *
-get_uids (CamelFolder *folder, CamelException *ex)
-{
- int count, i;
- GPtrArray *array;
-
- count = get_message_count (folder, ex);
- if (count == -1)
- return NULL;
-
- array = g_ptr_array_new ();
- g_ptr_array_set_size (array, count);
- for (i = 0; i < count; i++)
- array->pdata[i] = g_strdup_printf ("%d", i + 1);
-
- return array;
-}
diff --git a/camel/providers/pop3/camel-pop3-folder.h b/camel/providers/pop3/camel-pop3-folder.h
deleted file mode 100644
index 2a478dc283..0000000000
--- a/camel/providers/pop3/camel-pop3-folder.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-pop3-folder.h : Class for a POP3 folder */
-
-/*
- * Author:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc. (www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_POP3_FOLDER_H
-#define CAMEL_POP3_FOLDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-folder.h"
-
-#define CAMEL_POP3_FOLDER_TYPE (camel_pop3_folder_get_type ())
-#define CAMEL_POP3_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_POP3_FOLDER_TYPE, CamelPop3Folder))
-#define CAMEL_POP3_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_POP3_FOLDER_TYPE, CamelPop3FolderClass))
-#define IS_CAMEL_POP3_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_POP3_FOLDER_TYPE))
-
-
-typedef struct {
- CamelFolder parent_object;
-
- CamelMessageInfo *msg_info;
- int count;
-
-} CamelPop3Folder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelPop3FolderClass;
-
-
-/* public methods */
-CamelFolder *camel_pop3_folder_new (CamelStore *parent, CamelException *ex);
-
-/* Standard Gtk function */
-GtkType camel_pop3_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_POP3_FOLDER_H */
diff --git a/camel/providers/pop3/camel-pop3-provider.c b/camel/providers/pop3/camel-pop3-provider.c
deleted file mode 100644
index dc6e2b9442..0000000000
--- a/camel/providers/pop3/camel-pop3-provider.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-pop3-provider.c: pop3 provider registration code */
-
-/*
- * Authors :
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc. (www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "config.h"
-#include "camel-pop3-store.h"
-#include "camel-provider.h"
-#include "camel-session.h"
-
-static CamelProvider pop3_provider = {
- "pop",
- "POP",
-
- "For connecting to POP servers. The POP protocol can also be used "
- "to retrieve mail from certain web mail providers and proprietary "
- "email systems.",
-
- CAMEL_PROVIDER_IS_REMOTE,
-
- { 0, 0 }
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- pop3_provider.object_types[CAMEL_PROVIDER_STORE] =
- camel_pop3_store_get_type();
-
- camel_session_register_provider (session, &pop3_provider);
-}
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
deleted file mode 100644
index bc39d4ab2b..0000000000
--- a/camel/providers/pop3/camel-pop3-store.c
+++ /dev/null
@@ -1,612 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-pop3-store.c : class for a pop3 store */
-
-/*
- * Authors:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc. (www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "config.h"
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "camel-pop3-store.h"
-#include "camel-pop3-folder.h"
-#include "camel-stream-buffer.h"
-#include "camel-stream-fs.h"
-#include "camel-session.h"
-#include "camel-exception.h"
-#include "camel-url.h"
-#include "md5-utils.h"
-
-/* Specified in RFC 1939 */
-#define POP3_PORT 110
-
-#ifdef HAVE_KRB4
-/* Specified nowhere */
-#define KPOP_PORT 1109
-
-#include <krb.h>
-#endif
-
-static CamelServiceClass *service_class = NULL;
-
-static void finalize (GtkObject *object);
-
-static gboolean pop3_connect (CamelService *service, CamelException *ex);
-static gboolean pop3_disconnect (CamelService *service, CamelException *ex);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
-static void free_auth_types (CamelService *service, GList *authtypes);
-
-static CamelFolder *get_folder (CamelStore *store, const char *folder_name,
- CamelException *ex);
-static char *get_folder_name (CamelStore *store, const char *folder_name,
- CamelException *ex);
-static char *get_root_folder_name (CamelStore *store, CamelException *ex);
-
-
-static void
-camel_pop3_store_class_init (CamelPop3StoreClass *camel_pop3_store_class)
-{
- GtkObjectClass *object_class =
- GTK_OBJECT_CLASS (camel_pop3_store_class);
- CamelServiceClass *camel_service_class =
- CAMEL_SERVICE_CLASS (camel_pop3_store_class);
- CamelStoreClass *camel_store_class =
- CAMEL_STORE_CLASS (camel_pop3_store_class);
-
- service_class = gtk_type_class (camel_service_get_type ());
-
- /* virtual method overload */
- object_class->finalize = finalize;
-
- camel_service_class->connect = pop3_connect;
- camel_service_class->disconnect = pop3_disconnect;
- camel_service_class->query_auth_types = query_auth_types;
- camel_service_class->free_auth_types = free_auth_types;
-
- camel_store_class->get_folder = get_folder;
- camel_store_class->get_folder_name = get_folder_name;
- camel_store_class->get_root_folder_name = get_root_folder_name;
-}
-
-
-
-static void
-camel_pop3_store_init (gpointer object, gpointer klass)
-{
- CamelService *service = CAMEL_SERVICE (object);
- CamelStore *store = CAMEL_STORE (object);
-
- service->url_flags = ( CAMEL_SERVICE_URL_NEED_USER |
- CAMEL_SERVICE_URL_NEED_HOST );
- store->folders = g_hash_table_new (g_str_hash, g_str_equal);
-}
-
-
-
-
-GtkType
-camel_pop3_store_get_type (void)
-{
- static GtkType camel_pop3_store_type = 0;
-
- if (!camel_pop3_store_type) {
- GtkTypeInfo camel_pop3_store_info =
- {
- "CamelPop3Store",
- sizeof (CamelPop3Store),
- sizeof (CamelPop3StoreClass),
- (GtkClassInitFunc) camel_pop3_store_class_init,
- (GtkObjectInitFunc) camel_pop3_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_pop3_store_type = gtk_type_unique (CAMEL_STORE_TYPE, &camel_pop3_store_info);
- }
-
- return camel_pop3_store_type;
-}
-
-static void
-finalize (GtkObject *object)
-{
- CamelException ex;
-
- camel_exception_init (&ex);
- pop3_disconnect (CAMEL_SERVICE (object), &ex);
- camel_exception_clear (&ex);
-}
-
-
-static CamelServiceAuthType password_authtype = {
- "Password",
-
- "This option will connect to the POP server using the APOP "
- "protocol if possible, or a plaintext password if not.",
-
- "",
- TRUE
-};
-
-#ifdef HAVE_KRB4
-static CamelServiceAuthType kpop_authtype = {
- "Kerberos 4 (KPOP)",
-
- "This will connect to the POP server and use Kerberos 4 "
- "to authenticate to it.",
-
- "+KPOP",
- FALSE
-};
-#endif
-
-static gboolean
-try_connect (CamelService *service, CamelException *ex)
-{
- struct hostent *h;
- struct sockaddr_in sin;
- int fd;
-
- h = camel_service_gethost (service, ex);
- if (!h)
- return FALSE;
-
- sin.sin_family = h->h_addrtype;
- if (service->url->port)
- sin.sin_port = htons (service->url->port);
- else
- sin.sin_port = htons (POP3_PORT);
- memcpy (&sin.sin_addr, h->h_addr, sizeof (sin.sin_addr));
-
- fd = socket (h->h_addrtype, SOCK_STREAM, 0);
- if (fd == -1 ||
- connect (fd, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
- if (fd > -1)
- close (fd);
- return FALSE;
- }
-
- close (fd);
- return TRUE;
-}
-
-static GList *
-query_auth_types (CamelService *service, CamelException *ex)
-{
- GList *ret = NULL;
- gboolean passwd = TRUE;
-#ifdef HAVE_KRB4
- gboolean kpop = TRUE;
- int saved_port;
-#endif
-
- if (service->url) {
- passwd = try_connect (service, ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE)
- return NULL;
-#ifdef HAVE_KRB4
- saved_port = service->url->port;
- service->url->port = KPOP_PORT;
- kpop = try_connect (service, ex);
- service->url->port = saved_port;
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE)
- return NULL;
-#endif
- }
-
- if (passwd)
- ret = g_list_append (ret, &password_authtype);
-#ifdef HAVE_KRB4
- if (kpop)
- ret = g_list_append (ret, &kpop_authtype);
-#endif
-
- if (!ret) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- "Could not connect to POP server on "
- "%s.", service->url->host);
- }
-
- return ret;
-}
-
-static void
-free_auth_types (CamelService *service, GList *authtypes)
-{
- g_list_free (authtypes);
-}
-
-/**
- * camel_pop3_store_open: Connect to the server if we are currently
- * disconnected.
- * @store: the store
- * @ex: a CamelException
- *
- * The POP protocol does not allow deleted messages to be expunged
- * except by closing the connection. Thus, camel_pop3_folder_{open,close}
- * sometimes need to connect to or disconnect from the server. This
- * routine reconnects to the server if we have disconnected.
- *
- **/
-void
-camel_pop3_store_open (CamelPop3Store *store, CamelException *ex)
-{
- CamelService *service = CAMEL_SERVICE (store);
-
- if (!camel_service_is_connected (service))
- pop3_connect (service, ex);
-}
-
-/**
- * camel_pop3_store_close: Close the connection to the server and
- * possibly expunge deleted messages.
- * @store: the store
- * @expunge: whether or not to expunge deleted messages
- * @ex: a CamelException
- *
- * See camel_pop3_store_open for an explanation of why this is needed.
- *
- **/
-void
-camel_pop3_store_close (CamelPop3Store *store, gboolean expunge,
- CamelException *ex)
-{
- if (expunge)
- camel_pop3_command (store, NULL, "QUIT");
- else
- camel_pop3_command (store, NULL, "RSET");
- pop3_disconnect (CAMEL_SERVICE (store), ex);
-}
-
-static gboolean
-pop3_connect (CamelService *service, CamelException *ex)
-{
- struct hostent *h;
- struct sockaddr_in sin;
- int fd, status;
- char *buf, *apoptime, *apopend, *msg;
- CamelPop3Store *store = CAMEL_POP3_STORE (service);
-#ifdef HAVE_KRB4
- gboolean kpop = (service->url->authmech &&
- !strcmp (service->url->authmech, "+KPOP"));
-#endif
-
- h = camel_service_gethost (service, ex);
- if (!h)
- return FALSE;
-
- if (!service->url->authmech && !service->url->passwd) {
- char *prompt = g_strdup_printf ("Please enter the POP3 password for %s@%s",
- service->url->user, h->h_name);
- service->url->passwd =
- camel_session_query_authenticator (camel_service_get_session (service),
- prompt, TRUE,
- service, "password",
- ex);
- g_free (prompt);
- if (!service->url->passwd)
- return FALSE;
- }
-
- sin.sin_family = h->h_addrtype;
- if (service->url->port)
- sin.sin_port = service->url->port;
-#ifdef HAVE_KRB4
- else if (kpop)
- sin.sin_port = KPOP_PORT;
-#endif
- else
- sin.sin_port = POP3_PORT;
- sin.sin_port = htons (sin.sin_port);
- memcpy (&sin.sin_addr, h->h_addr, sizeof (sin.sin_addr));
-
- fd = socket (h->h_addrtype, SOCK_STREAM, 0);
- if (fd == -1 ||
- connect (fd, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- "Could not connect to %s (port %s): %s",
- service->url->host, service->url->port,
- strerror(errno));
- if (fd > -1)
- close (fd);
- return FALSE;
- }
-
-#ifdef HAVE_KRB4
- if (kpop) {
- KTEXT_ST ticket_st;
- MSG_DAT msg_data;
- CREDENTIALS cred;
- Key_schedule schedule;
- char *hostname;
-
- /* Need to copy hostname, because krb_realmofhost will
- * call gethostbyname as well, and gethostbyname uses
- * static storage.
- */
- hostname = g_strdup (h->h_name);
- status = krb_sendauth (0, fd, &ticket_st, "pop", hostname,
- krb_realmofhost (hostname), 0,
- &msg_data, &cred, schedule,
- NULL, NULL, "KPOPV0.1");
- g_free (hostname);
- if (status != KSUCCESS) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- "Could not authenticate to KPOP "
- "server: %s",
- krb_err_txt[status]);
- close (fd);
- return FALSE;
- }
-
- if (!service->url->passwd)
- service->url->passwd = g_strdup (service->url->user);
- }
-#endif /* HAVE_KRB4 */
-
- store->ostream = camel_stream_fs_new_with_fd (fd);
- store->istream = camel_stream_buffer_new (store->ostream,
- CAMEL_STREAM_BUFFER_READ);
-
- /* Read the greeting, note APOP timestamp, if any. */
- buf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (store->istream));
- if (!buf) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- "Could not read greeting from POP "
- "server: %s",
- camel_exception_get_description (ex));
- gtk_object_unref (GTK_OBJECT (store->ostream));
- gtk_object_unref (GTK_OBJECT (store->istream));
- return FALSE;
- }
- apoptime = strchr (buf, '<');
- apopend = apoptime ? strchr (apoptime, '>') : NULL;
- if (apoptime && apopend)
- apoptime = g_strndup (apoptime, apopend - apoptime + 1);
- else
- apoptime = NULL;
- g_free (buf);
-
- /* Authenticate via APOP if we can, USER/PASS if we can't. */
- if (apoptime) {
- char *secret, md5asc[32], *d;
- unsigned char md5sum[16], *s;
-
- secret = g_strdup_printf ("%s%s", apoptime,
- service->url->passwd);
- md5_get_digest (secret, strlen (secret), md5sum);
- g_free (apoptime);
- g_free (secret);
-
- for (s = md5sum, d = md5asc; d < md5asc + 32; s++, d += 2)
- sprintf (d, "%.2x", *s);
-
- status = camel_pop3_command (store, &msg, "APOP %s %s",
- service->url->user, md5asc);
- } else {
- status = camel_pop3_command (store, &msg, "USER %s",
- service->url->user);
- if (status != CAMEL_POP3_OK) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- "Unable to connect to POP "
- "server. Error sending username:"
- " %s", msg ? msg : "(Unknown)");
- g_free (msg);
- gtk_object_unref (GTK_OBJECT (store->ostream));
- gtk_object_unref (GTK_OBJECT (store->istream));
- return FALSE;
- }
-
- status = camel_pop3_command(store, &msg, "PASS %s",
- service->url->passwd);
- }
-
- if (status != CAMEL_POP3_OK) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- "Unable to authenticate to POP "
- "server. Error sending password:"
- " %s", msg ? msg : "(Unknown)");
- g_free (msg);
- gtk_object_unref (GTK_OBJECT (store->ostream));
- gtk_object_unref (GTK_OBJECT (store->istream));
- return FALSE;
- }
-
- service_class->connect (service, ex);
- return TRUE;
-}
-
-static gboolean
-pop3_disconnect (CamelService *service, CamelException *ex)
-{
- CamelPop3Store *store = CAMEL_POP3_STORE (service);
-
- if (!service->connected)
- return TRUE;
-
- if (!service_class->disconnect (service, ex))
- return FALSE;
-
- gtk_object_unref (GTK_OBJECT (store->ostream));
- gtk_object_unref (GTK_OBJECT (store->istream));
- store->ostream = NULL;
- store->istream = NULL;
- return TRUE;
-}
-
-static CamelFolder *
-get_folder (CamelStore *store, const char *folder_name, CamelException *ex)
-{
- return camel_pop3_folder_new (store, ex);
-}
-
-static char *
-get_folder_name (CamelStore *store, const char *folder_name,
- CamelException *ex)
-{
- if (!g_strcasecmp (folder_name, "inbox"))
- return g_strdup ("inbox");
- else {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID,
- "No such folder `%s'.", folder_name);
- return NULL;
- }
-}
-
-static char *
-get_root_folder_name (CamelStore *store, CamelException *ex)
-{
- return g_strdup ("inbox");
-}
-
-
-/**
- * camel_pop3_command: Send a command to a POP3 server.
- * @store: the POP3 store
- * @ret: a pointer to return the full server response in
- * @fmt: a printf-style format string, followed by arguments
- *
- * This command sends the command specified by @fmt and the following
- * arguments to the connected POP3 store specified by @store. It then
- * reads the server's response and parses out the status code. If
- * the caller passed a non-NULL pointer for @ret, camel_pop3_command
- * will set it to point to an buffer containing the rest of the
- * response from the POP3 server. (If @ret was passed but there was
- * no extended response, @ret will be set to NULL.) The caller must
- * free this buffer when it is done with it.
- *
- * Return value: one of CAMEL_POP3_OK (command executed successfully),
- * CAMEL_POP3_ERR (command encounted an error), or CAMEL_POP3_FAIL
- * (a protocol-level error occurred, and Camel is uncertain of the
- * result of the command.)
- **/
-int
-camel_pop3_command (CamelPop3Store *store, char **ret, char *fmt, ...)
-{
- char *cmdbuf, *respbuf;
- va_list ap;
- int status;
-
- va_start (ap, fmt);
- cmdbuf = g_strdup_vprintf (fmt, ap);
- va_end (ap);
-
- /* Send the command */
- if (camel_stream_printf (store->ostream, "%s\r\n", cmdbuf) == -1) {
- g_free (cmdbuf);
- if (*ret)
- *ret = g_strdup(strerror(errno));
- return CAMEL_POP3_FAIL;
- }
- g_free (cmdbuf);
-
- /* Read the response */
- respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (store->istream));
- if (respbuf == NULL) {
- if (*ret)
- *ret = g_strdup(strerror(errno));
- return CAMEL_POP3_FAIL;
- }
- if (!strncmp (respbuf, "+OK", 3))
- status = CAMEL_POP3_OK;
- else if (!strncmp (respbuf, "-ERR", 4))
- status = CAMEL_POP3_ERR;
- else
- status = CAMEL_POP3_FAIL;
-
- if (ret) {
- if (status != CAMEL_POP3_FAIL) {
- *ret = strchr (respbuf, ' ');
- if (*ret)
- *ret = g_strdup (*ret + 1);
- } else
- *ret = NULL;
- }
- g_free (respbuf);
-
- return status;
-}
-
-/**
- * camel_pop3_command_get_additional_data: get "additional data" from
- * a POP3 command.
- * @store: the POP3 store
- *
- * This command gets the additional data returned by "multi-line" POP
- * commands, such as LIST, RETR, TOP, and UIDL. This command _must_
- * be called after a successful (CAMEL_POP3_OK) call to
- * camel_pop3_command for a command that has a multi-line response.
- * The returned data is un-byte-stuffed, and has lines termined by
- * newlines rather than CR/LF pairs.
- *
- * Return value: the data, which the caller must free.
- **/
-char *
-camel_pop3_command_get_additional_data (CamelPop3Store *store,
- CamelException *ex)
-{
- CamelStreamBuffer *stream = CAMEL_STREAM_BUFFER (store->istream);
- GPtrArray *data;
- char *buf;
- int i, status = CAMEL_POP3_OK;
-
- data = g_ptr_array_new ();
- while (1) {
- buf = camel_stream_buffer_read_line (stream);
- if (!buf) {
- status = CAMEL_POP3_FAIL;
- break;
- }
-
- if (!strcmp (buf, "."))
- break;
- if (*buf == '.')
- memmove (buf, buf + 1, strlen (buf));
- g_ptr_array_add (data, buf);
- }
-
- if (status == CAMEL_POP3_OK) {
- /* Append an empty string to the end of the array
- * so when we g_strjoinv it, we get a "\n" after
- * the last real line.
- */
- g_ptr_array_add (data, "");
- g_ptr_array_add (data, NULL);
- buf = g_strjoinv ("\n", (char **)data->pdata);
- } else
- buf = NULL;
-
- for (i = 0; i < data->len - 2; i++)
- g_free (data->pdata[i]);
- g_ptr_array_free (data, TRUE);
-
- return buf;
-}
diff --git a/camel/providers/pop3/camel-pop3-store.h b/camel/providers/pop3/camel-pop3-store.h
deleted file mode 100644
index e68f0fd142..0000000000
--- a/camel/providers/pop3/camel-pop3-store.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-pop3-store.h : class for an pop3 store */
-
-/*
- * Authors:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc. (www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_POP3_STORE_H
-#define CAMEL_POP3_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "camel-store.h"
-
-#define CAMEL_POP3_STORE_TYPE (camel_pop3_store_get_type ())
-#define CAMEL_POP3_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_POP3_STORE_TYPE, CamelPop3Store))
-#define CAMEL_POP3_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_POP3_STORE_TYPE, CamelPop3StoreClass))
-#define IS_CAMEL_POP3_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_POP3_STORE_TYPE))
-
-
-typedef struct {
- CamelStore parent_object;
-
- CamelStream *istream, *ostream;
-
-} CamelPop3Store;
-
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-} CamelPop3StoreClass;
-
-
-/* public methods */
-void camel_pop3_store_open (CamelPop3Store *store, CamelException *ex);
-void camel_pop3_store_close (CamelPop3Store *store, gboolean expunge,
- CamelException *ex);
-
-/* support functions */
-enum { CAMEL_POP3_OK, CAMEL_POP3_ERR, CAMEL_POP3_FAIL };
-int camel_pop3_command (CamelPop3Store *store, char **ret, char *fmt, ...);
-char *camel_pop3_command_get_additional_data (CamelPop3Store *store,
- CamelException *ex);
-
-/* Standard Gtk function */
-GtkType camel_pop3_store_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_POP3_STORE_H */
-
-
diff --git a/camel/providers/pop3/libcamelpop3.urls b/camel/providers/pop3/libcamelpop3.urls
deleted file mode 100644
index 7fffa4d861..0000000000
--- a/camel/providers/pop3/libcamelpop3.urls
+++ /dev/null
@@ -1 +0,0 @@
-pop
diff --git a/camel/providers/sendmail/.cvsignore b/camel/providers/sendmail/.cvsignore
deleted file mode 100644
index cacc3c5d5f..0000000000
--- a/camel/providers/sendmail/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-Makefile
-Makefile.in
-.deps
-.libs
-*.lo
-*.la
-*.o
diff --git a/camel/providers/sendmail/Makefile.am b/camel/providers/sendmail/Makefile.am
deleted file mode 100644
index 511c860315..0000000000
--- a/camel/providers/sendmail/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelsendmailincludedir = $(includedir)/camel
-
-
-providerdir = $(pkglibdir)/camel-providers/$(VERSION)
-
-provider_LTLIBRARIES = libcamelsendmail.la
-provider_DATA = libcamelsendmail.urls
-
-INCLUDES = \
- -I.. \
- -I$(srcdir)/.. \
- -I$(srcdir)/../../.. \
- -I$(includedir) \
- -I$(top_srcdir)/intl \
- $(GTK_INCLUDEDIR) -I$(top_srcdir)/camel \
- -DG_LOG_DOMAIN=\"camel-sendmail-provider\"
-
-libcamelsendmail_la_SOURCES = \
- camel-sendmail-provider.c \
- camel-sendmail-transport.c
-
-libcamelsendmailinclude_HEADERS = \
- camel-sendmail-transport.h
-
-libcamelsendmail_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-EXTRA_DIST = libcamelsendmail.urls
diff --git a/camel/providers/sendmail/camel-sendmail-provider.c b/camel/providers/sendmail/camel-sendmail-provider.c
deleted file mode 100644
index 16ebce8b12..0000000000
--- a/camel/providers/sendmail/camel-sendmail-provider.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-sendmail-provider.c: sendmail provider registration code */
-
-/*
- * Authors :
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc. (www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "config.h"
-#include "camel-provider.h"
-#include "camel-sendmail-transport.h"
-#include "camel-session.h"
-
-static CamelProvider sendmail_provider = {
- "sendmail",
- "Sendmail",
-
- "For delivering mail by passing it to the \"sendmail\" program "
- "on the local system.",
-
- 0,
-
- { 0, 0 }
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- sendmail_provider.object_types[CAMEL_PROVIDER_TRANSPORT] =
- camel_sendmail_transport_get_type();
-
- camel_session_register_provider (session, &sendmail_provider);
-}
-
-
-
diff --git a/camel/providers/sendmail/camel-sendmail-transport.c b/camel/providers/sendmail/camel-sendmail-transport.c
deleted file mode 100644
index 3b84d5cb90..0000000000
--- a/camel/providers/sendmail/camel-sendmail-transport.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-sendmail-transport.c: Sendmail-based transport class. */
-
-/*
- *
- * Author :
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "camel-sendmail-transport.h"
-#include "camel-mime-message.h"
-#include "camel-data-wrapper.h"
-#include "camel-stream-fs.h"
-#include "camel-exception.h"
-
-static gboolean _can_send (CamelTransport *transport, CamelMedium *message);
-static gboolean _send (CamelTransport *transport, CamelMedium *message,
- CamelException *ex);
-static gboolean _send_to (CamelTransport *transport, CamelMedium *message,
- GList *recipients, CamelException *ex);
-
-
-static void
-camel_sendmail_transport_class_init (CamelSendmailTransportClass *camel_sendmail_transport_class)
-{
- CamelTransportClass *camel_transport_class =
- CAMEL_TRANSPORT_CLASS (camel_sendmail_transport_class);
-
- /* virtual method overload */
- camel_transport_class->can_send = _can_send;
- camel_transport_class->send = _send;
- camel_transport_class->send_to = _send_to;
-}
-
-GtkType
-camel_sendmail_transport_get_type (void)
-{
- static GtkType camel_sendmail_transport_type = 0;
-
- if (!camel_sendmail_transport_type) {
- GtkTypeInfo camel_sendmail_transport_info =
- {
- "CamelSendmailTransport",
- sizeof (CamelSendmailTransport),
- sizeof (CamelSendmailTransportClass),
- (GtkClassInitFunc) camel_sendmail_transport_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_sendmail_transport_type = gtk_type_unique (CAMEL_TRANSPORT_TYPE, &camel_sendmail_transport_info);
- }
-
- return camel_sendmail_transport_type;
-}
-
-
-static gboolean
-_can_send (CamelTransport *transport, CamelMedium *message)
-{
- return CAMEL_IS_MIME_MESSAGE (message);
-}
-
-
-static gboolean
-_send_internal (CamelMedium *message, char **argv, CamelException *ex)
-{
- int fd[2], nullfd, wstat;
- sigset_t mask, omask;
- CamelStream *out;
- pid_t pid;
-
- g_assert (CAMEL_IS_MIME_MESSAGE (message));
-
- if (pipe (fd) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not create pipe to sendmail: "
- "%s: mail not sent",
- g_strerror (errno));
- return FALSE;
- }
-
- /* Block SIGCHLD so the calling application doesn't notice
- * sendmail exiting before we do.
- */
- sigemptyset (&mask);
- sigaddset (&mask, SIGCHLD);
- sigprocmask (SIG_BLOCK, &mask, &omask);
-
- pid = fork ();
- switch (pid) {
- case -1:
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not fork sendmail: "
- "%s: mail not sent", g_strerror (errno));
- sigprocmask (SIG_SETMASK, &omask, NULL);
- return FALSE;
-
- case 0:
- /* Child process */
- nullfd = open ("/dev/null", O_RDWR);
- dup2 (fd[0], STDIN_FILENO);
- dup2 (nullfd, STDOUT_FILENO);
- dup2 (nullfd, STDERR_FILENO);
- close (nullfd);
- close (fd[1]);
-
- execv (SENDMAIL_PATH, argv);
- _exit (255);
- }
-
- /* Parent process. Write the message out. */
- close (fd[0]);
- out = camel_stream_fs_new_with_fd (fd[1]);
- if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), out) == -1
- || camel_stream_close(out) == -1) {
- gtk_object_unref (GTK_OBJECT (out));
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not send message: %s",
- strerror(errno));
- return FALSE;
- }
- gtk_object_unref (GTK_OBJECT (out));
-
- /* Wait for sendmail to exit. */
- while (waitpid (pid, &wstat, 0) == -1 && errno == EINTR)
- ;
- sigprocmask (SIG_SETMASK, &omask, NULL);
-
- if (!WIFEXITED (wstat)) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "sendmail exited with signal %s: "
- "mail not sent.",
- g_strsignal (WTERMSIG (wstat)));
- return FALSE;
- } else if (WEXITSTATUS (wstat) != 0) {
- if (WEXITSTATUS (wstat) == 255) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not execute "
- SENDMAIL_PATH ": mail not sent.");
- } else {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "sendmail exited with status "
- "%d: mail not sent.",
- WEXITSTATUS (wstat));
- }
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-_send_to (CamelTransport *transport, CamelMedium *message,
- GList *recipients, CamelException *ex)
-{
- GList *r;
- char **argv;
- int i, len;
- gboolean status;
-
- len = g_list_length (recipients);
- argv = g_malloc ((len + 4) * sizeof (char *));
- argv[0] = "sendmail";
- argv[1] = "-i";
- argv[2] = "--";
-
- for (i = 1, r = recipients; i <= len; i++, r = r->next)
- argv[i + 2] = r->data;
- argv[i + 2] = NULL;
-
- status = _send_internal (message, argv, ex);
- g_free (argv);
- return status;
-}
-
-static gboolean
-_send (CamelTransport *transport, CamelMedium *message,
- CamelException *ex)
-{
- char *argv[4] = { "sendmail", "-t", "-i", NULL };
-
- return _send_internal (message, argv, ex);
-}
diff --git a/camel/providers/sendmail/camel-sendmail-transport.h b/camel/providers/sendmail/camel-sendmail-transport.h
deleted file mode 100644
index 3f3714584a..0000000000
--- a/camel/providers/sendmail/camel-sendmail-transport.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-sendmail-transport.h: Sendmail-based transport class */
-
-/*
- *
- * Author :
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_SENDMAIL_TRANSPORT_H
-#define CAMEL_SENDMAIL_TRANSPORT_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-transport.h"
-
-#define CAMEL_SENDMAIL_TRANSPORT_TYPE (camel_sendmail_transport_get_type ())
-#define CAMEL_SENDMAIL_TRANSPORT(obj) (GTK_CHECK_CAST((obj), CAMEL_SENDMAIL_TRANSPORT_TYPE, CamelSendmailTransport))
-#define CAMEL_SENDMAIL_TRANSPORT_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SENDMAIL_TRANSPORT_TYPE, CamelSendmailTransportClass))
-#define CAMEL_IS_SENDMAIL_TRANSPORT(o) (GTK_CHECK_TYPE((o), CAMEL_SENDMAIL_TRANSPORT_TYPE))
-
-
-typedef struct {
- CamelTransport parent_object;
-
-} CamelSendmailTransport;
-
-
-typedef struct {
- CamelTransportClass parent_class;
-
-} CamelSendmailTransportClass;
-
-
-/* Standard Gtk function */
-GtkType camel_sendmail_transport_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SENDMAIL_TRANSPORT_H */
diff --git a/camel/providers/sendmail/libcamelsendmail.urls b/camel/providers/sendmail/libcamelsendmail.urls
deleted file mode 100644
index ccad52828e..0000000000
--- a/camel/providers/sendmail/libcamelsendmail.urls
+++ /dev/null
@@ -1 +0,0 @@
-sendmail
diff --git a/camel/providers/smtp/.cvsignore b/camel/providers/smtp/.cvsignore
deleted file mode 100644
index 09980ae6ba..0000000000
--- a/camel/providers/smtp/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
diff --git a/camel/providers/smtp/Makefile.am b/camel/providers/smtp/Makefile.am
deleted file mode 100644
index b14375bfc0..0000000000
--- a/camel/providers/smtp/Makefile.am
+++ /dev/null
@@ -1,32 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelsmtpincludedir = $(includedir)/camel
-
-providerdir = $(pkglibdir)/camel-providers/$(VERSION)
-
-provider_LTLIBRARIES = libcamelsmtp.la
-provider_DATA = libcamelsmtp.urls
-
-INCLUDES = \
- -I.. \
- -I$(srcdir)/.. \
- -I$(srcdir)/../../.. \
- -I$(includedir) \
- -I$(top_srcdir)/intl \
- $(GTK_INCLUDEDIR) \
- -I$(top_srcdir)/camel \
- -DG_LOG_DOMAIN=\"camel-smtp-provider\"
-
-libcamelsmtp_la_SOURCES = \
- camel-smtp-provider.c \
- camel-smtp-transport.c
-
-libcamelsmtpinclude_HEADERS = \
- camel-smtp-transport.h
-
-
-libcamelsmtp_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-EXTRA_DIST = libcamelsmtp.urls
diff --git a/camel/providers/smtp/camel-smtp-provider.c b/camel/providers/smtp/camel-smtp-provider.c
deleted file mode 100644
index c82755d481..0000000000
--- a/camel/providers/smtp/camel-smtp-provider.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-smtp-provider.c: smtp provider registration code */
-
-/*
- * Authors :
- * Jeffrey Stedfast <fejj@stampede.org>
- *
- * Copyright (C) 2000 Helix Code, Inc. (www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "config.h"
-#include "camel-smtp-transport.h"
-#include "camel-provider.h"
-#include "camel-session.h"
-
-static CamelProvider smtp_provider = {
- "smtp",
- "SMTP",
-
- "For delivering mail by connecting to a remote mailhub using SMTP."
- "(NOT YET TESTED!)",
-
- 0,
-
- { 0, 0 }
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- smtp_provider.object_types[CAMEL_PROVIDER_TRANSPORT] =
- camel_smtp_transport_get_type();
-
- camel_session_register_provider (session, &smtp_provider);
-}
-
-
-
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
deleted file mode 100644
index b7af97674e..0000000000
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ /dev/null
@@ -1,735 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-smtp-transport.c : class for a smtp transport */
-
-/*
- * Authors:
- * Jeffrey Stedfast <fejj@stampede.org>
- *
- * Copyright (C) 2000 Helix Code, Inc. (www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "config.h"
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#undef MIN
-#undef MAX
-#include "camel-smtp-transport.h"
-#include "camel-mime-message.h"
-#include "camel-stream-buffer.h"
-#include "camel-stream-fs.h"
-#include "camel-session.h"
-#include "camel-exception.h"
-#include "md5-utils.h"
-
-/* Specified in RFC 821 */
-#define SMTP_PORT 25
-
-/* camel smtp transport class prototypes */
-static gboolean _can_send (CamelTransport *transport, CamelMedium *message);
-static gboolean _send (CamelTransport *transport, CamelMedium *message, CamelException *ex);
-static gboolean _send_to (CamelTransport *transport, CamelMedium *message, GList *recipients, CamelException *ex);
-
-/* support prototypes */
-static gboolean smtp_connect (CamelService *service, CamelException *ex);
-static gboolean smtp_disconnect (CamelService *service, CamelException *ex);
-static GList *esmtp_get_authtypes(gchar *buffer);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
-static void free_auth_types (CamelService *service, GList *authtypes);
-static gchar *smtp_get_email_addr_from_text (gchar *text);
-static gboolean smtp_helo (CamelSmtpTransport *transport, CamelException *ex);
-static gboolean smtp_mail (CamelSmtpTransport *transport, gchar *sender, CamelException *ex);
-static gboolean smtp_rcpt (CamelSmtpTransport *transport, gchar *recipient, CamelException *ex);
-static gboolean smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException *ex);
-static gboolean smtp_rset (CamelSmtpTransport *transport, CamelException *ex);
-static gboolean smtp_quit (CamelSmtpTransport *transport, CamelException *ex);
-
-/* private data members */
-static CamelServiceClass *service_class = NULL;
-static gboolean smtp_is_esmtp = FALSE;
-static struct sockaddr_in localaddr;
-static GList *esmtp_supported_authtypes = NULL;
-
-static void
-camel_smtp_transport_class_init (CamelSmtpTransportClass *camel_smtp_transport_class)
-{
- CamelTransportClass *camel_transport_class =
- CAMEL_TRANSPORT_CLASS (camel_smtp_transport_class);
- CamelServiceClass *camel_service_class =
- CAMEL_SERVICE_CLASS (camel_smtp_transport_class);
-
- service_class = gtk_type_class (camel_service_get_type ());
-
- /* virtual method overload */
- camel_service_class->connect = smtp_connect;
- camel_service_class->disconnect = smtp_disconnect;
- camel_service_class->query_auth_types = query_auth_types;
- camel_service_class->free_auth_types = free_auth_types;
-
- camel_transport_class->can_send = _can_send;
- camel_transport_class->send = _send;
- camel_transport_class->send_to = _send_to;
-}
-
-static void
-camel_smtp_transport_init (gpointer object, gpointer klass)
-{
- CamelService *service = CAMEL_SERVICE (object);
-
- service->url_flags = CAMEL_SERVICE_URL_NEED_HOST;
-}
-
-GtkType
-camel_smtp_transport_get_type (void)
-{
- static GtkType camel_smtp_transport_type = 0;
-
- if (!camel_smtp_transport_type) {
- GtkTypeInfo camel_smtp_transport_info =
- {
- "CamelSmtpTransport",
- sizeof (CamelSmtpTransport),
- sizeof (CamelSmtpTransportClass),
- (GtkClassInitFunc) camel_smtp_transport_class_init,
- (GtkObjectInitFunc) camel_smtp_transport_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_smtp_transport_type = gtk_type_unique (CAMEL_TRANSPORT_TYPE, &camel_smtp_transport_info);
- }
-
- return camel_smtp_transport_type;
-}
-
-static gboolean
-smtp_connect (CamelService *service, CamelException *ex)
-{
- struct hostent *h;
- struct sockaddr_in sin;
- gint fd, num, i;
- guint32 addrlen;
- gchar *pass = NULL, *respbuf = NULL;
- CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
-
- if (!service_class->connect (service, ex))
- return FALSE;
-
- h = camel_service_gethost (service, ex);
- if (!h)
- return FALSE;
-
- sin.sin_family = h->h_addrtype;
- sin.sin_port = htons (service->url->port ? service->url->port : SMTP_PORT);
- memcpy (&sin.sin_addr, h->h_addr, sizeof (sin.sin_addr));
-
- fd = socket (h->h_addrtype, SOCK_STREAM, 0);
- if (fd == -1 || connect (fd, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- "Could not connect to %s (port %s): %s",
- service->url->host, service->url->port,
- strerror(errno));
- if (fd > -1)
- close (fd);
- g_free (pass);
- return FALSE;
- }
-
- /* get the localaddr - needed later by smtp_helo */
- addrlen = sizeof(localaddr);
- getsockname(fd, (struct sockaddr*)&localaddr, &addrlen);
-
- transport->ostream = camel_stream_fs_new_with_fd (fd);
- transport->istream = camel_stream_buffer_new (transport->ostream,
- CAMEL_STREAM_BUFFER_READ);
-
- /* Read the greeting, note whether the server is ESMTP and if it requests AUTH. */
- do {
- /* Check for "220" */
- g_free(respbuf);
- respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream), ex);
- if ( !respbuf || strncmp(respbuf, "220", 3) ) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Welcome response error: "
- "%s: possibly non-fatal",
- g_strerror (errno));
- return FALSE;
- }
- if (strstr(respbuf, "ESMTP"))
- smtp_is_esmtp = TRUE;
- } while ( *(respbuf+3) == '-' ); /* if we got "220-" then loop again */
- g_free(respbuf);
-
- /* send HELO (or EHLO, depending on the service type) */
- smtp_helo(transport, ex);
-
- /* check to see if AUTH is required, if so...then AUTH ourselves */
- if (smtp_is_esmtp && esmtp_supported_authtypes) {
- /* not really supported yet, but we can at least show what auth types are supported */
- fprintf(stderr, "camel-smtp-transport: %s requires AUTH\n", service->url->host);
- num = g_list_length(esmtp_supported_authtypes);
- for (i = 0; i < num; i++)
- fprintf(stderr, "Supported AUTH: %s\n", (gchar *) g_list_nth_data(esmtp_supported_authtypes, i));
- g_list_free(esmtp_supported_authtypes);
- esmtp_supported_authtypes = NULL;
- }
-
- return TRUE;
-}
-
-static gboolean
-smtp_disconnect (CamelService *service, CamelException *ex)
-{
- CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
-
- if (!service->connected)
- return TRUE;
-
- /* send the QUIT command to the SMTP server */
- smtp_quit(transport, ex);
-
- if (!service_class->disconnect (service, ex))
- return FALSE;
-
- gtk_object_unref (GTK_OBJECT (transport->ostream));
- gtk_object_unref (GTK_OBJECT (transport->istream));
- transport->ostream = NULL;
- transport->istream = NULL;
-
- return TRUE;
-}
-
-static GList
-*esmtp_get_authtypes(gchar *buffer)
-{
- GList *ret = NULL;
- gchar *start, *end;
-
- if (!(start = strstr(buffer, " AUTH ")))
- return NULL;
-
- /* advance to the first token */
- for (start += 6; *start && *start != ' '; start++);
-
- for ( ; *start; ) {
- /* advance to the end of the token */
- for (end = start; *end && *end != ' '; end++);
-
- ret = g_list_append(ret, g_strndup(start, end - start));
-
- /* advance to the next token */
- for (start = end; *start && *start != ' '; start++);
- }
-
- return ret;
-}
-
-static CamelServiceAuthType no_authtype = {
- "No authentication required",
-
- "This option will connect to the SMTP server without using any "
- "kind of authentication. This should be fine for connecting to "
- "most SMTP servers."
-
- "",
- FALSE
-};
-
-static CamelServiceAuthType cram_md5_authtype = {
- "CRAM-MD5",
-
- "This option will connect to the SMTP server using CRAM-MD5 "
- "authentication.",
-
- "CRAM-MD5",
- TRUE
-};
-
-static GList
-*query_auth_types (CamelService *service, CamelException *ex)
-{
- /* FIXME: Re-enable this when auth types are actually
- * implemented.
- */
-
- return NULL;
-}
-
-static void
-free_auth_types (CamelService *service, GList *authtypes)
-{
- g_list_free (authtypes);
-}
-
-static gboolean
-_can_send (CamelTransport *transport, CamelMedium *message)
-{
- return CAMEL_IS_MIME_MESSAGE (message);
-}
-
-static gboolean
-_send_to (CamelTransport *transport, CamelMedium *message,
- GList *recipients, CamelException *ex)
-{
- GList *r;
- gchar *recipient, *s, *sender;
- guint i, len;
- CamelService *service = CAMEL_SERVICE (transport);
- CamelSmtpTransport *smtp_transport = CAMEL_SMTP_TRANSPORT(transport);
-
- if (!camel_service_is_connected (service))
- smtp_connect (service, ex);
-
- s = g_strdup(camel_mime_message_get_from (CAMEL_MIME_MESSAGE(message)));
- if (!s) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Cannot send message: "
- "sender address not defined.");
- return FALSE;
- }
-
- sender = smtp_get_email_addr_from_text(s);
- smtp_mail(smtp_transport, sender, ex);
- g_free(sender);
- g_free(s);
-
- if (!(len = g_list_length(recipients))) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Cannot send message: "
- "no recipients defined.");
- return FALSE;
- }
- for (i = 0, r = recipients; i < len; i++, r = r->next) {
- recipient = smtp_get_email_addr_from_text(r->data);
- if (!smtp_rcpt(smtp_transport, recipient, ex)) {
- g_free(recipient);
- return FALSE;
- }
- g_free(recipient);
- }
-
- if (!smtp_data(smtp_transport, message, ex))
- return FALSE;
-
- /* reset the service for our next transfer session */
- smtp_rset(smtp_transport, ex);
-
- return TRUE;
-}
-
-static gboolean
-_send (CamelTransport *transport, CamelMedium *message,
- CamelException *ex)
-{
- const CamelInternetAddress *to, *cc, *bcc;
- GList *recipients = NULL;
- guint index, len;
-
- to = camel_mime_message_get_recipients ((CamelMimeMessage *) message, CAMEL_RECIPIENT_TYPE_TO);
- cc = camel_mime_message_get_recipients ((CamelMimeMessage *) message, CAMEL_RECIPIENT_TYPE_CC);
- bcc = camel_mime_message_get_recipients ((CamelMimeMessage *) message, CAMEL_RECIPIENT_TYPE_BCC);
-
- /* get all of the To addresses into our recipient list */
- len = ((CamelAddress *)to)->addresses->len;
- for (index = 0; index < len; index++) {
- const char *addr;
-
- if (camel_internet_address_get(to, index, NULL, &addr))
- recipients = g_list_append(recipients, g_strdup(addr));
- }
-
- /* get all of the Cc addresses into our recipient list */
- len = ((CamelAddress *)cc)->addresses->len;
- for (index = 0; index < len; index++) {
- const char *addr;
-
- if (camel_internet_address_get(cc, index, NULL, &addr))
- recipients = g_list_append(recipients, g_strdup(addr));
- }
-
- /* get all of the Bcc addresses into our recipient list */
- len = ((CamelAddress *)bcc)->addresses->len;
- for (index = 0; index < len; index++) {
- const char *addr;
-
- if (camel_internet_address_get(bcc, index, NULL, &addr))
- recipients = g_list_append(recipients, g_strdup(addr));
- }
-
- return _send_to (transport, message, recipients, ex);
-}
-
-static gchar
-*smtp_get_email_addr_from_text (gchar *text)
-{
- /* get the actual email address from the string passed and place it in addr
- * we can assume the address will be in one of the following forms:
- * 1) The Name <person@host.com>
- * 2) <person@host.com>
- * 3) person@host.com
- * 4) person@host.com (The Name)
- */
-
- gchar *tmp, *addr = NULL;
- gchar *addr_strt; /* points to start of addr */
- gchar *addr_end; /* points to end of addr */
- gchar *ptr1;
-
-
- /* check the incoming args */
- if (!text || !*text)
- return NULL;
-
- /* scan the string for an open brace */
- for (addr_strt = text; *addr_strt; addr_strt++)
- if (*addr_strt == '<')
- break;
-
- if (*addr_strt) {
- /* we found an open brace, let's look for it's counterpart */
- for (addr_end = addr_strt; *addr_end; addr_end++)
- if (*addr_end == '>')
- break;
-
- /* if we didn't find it, or braces are empty... */
- if (!(*addr_end) || (addr_strt == addr_end - 1))
- return NULL;
-
- /* addr_strt points to '<' and addr_end points to '>'.
- * Now let's adjust 'em slightly to point to the beginning
- * and ending of the email addy
- */
- addr_strt++;
- addr_end--;
- } else {
- /* no open brace...assume type 3 or 4? */
- addr_strt = text;
-
- /* find the end of the email addr/string */
- for (addr_end = addr_strt; *addr_end || *addr_end == ' '; addr_end++);
-
- addr_end--; /* points to NULL, move it back one char */
- }
-
- /* now addr_strt & addr_end point to the beginning & ending of the email addy */
-
- /* copy the string into addr */
- addr = g_strndup(addr_strt, (gint)(addr_end - addr_strt + 1));
-
- for (ptr1 = addr_strt; ptr1 <= addr_end; ptr1++) /* look for an '@' sign */
- if (*ptr1 == '@')
- break;
-
- if (*ptr1 != '@') {
- /* here we found out the name doesn't have an '@' part
- * let's figure out what machine we're on & stick it on the end
- */
- gchar hostname[MAXHOSTNAMELEN];
-
- if (gethostname(hostname, MAXHOSTNAMELEN)) {
- g_free(addr);
- return NULL;
- }
- tmp = addr;
- addr = g_strconcat(tmp, "@", hostname, NULL);
- g_free(tmp);
- }
-
- return addr;
-}
-
-static gboolean
-smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
-{
- /* say hello to the server */
- gchar *cmdbuf, *respbuf = NULL;
- struct hostent *host;
-
- /* get the local host name */
- host = gethostbyaddr((gchar *)&localaddr.sin_addr, sizeof(localaddr.sin_addr), AF_INET);
-
- /* hiya server! how are you today? */
- if (smtp_is_esmtp)
- cmdbuf = g_strdup_printf ("EHLO %s\r\n", host && host->h_name ? host->h_name : inet_ntoa(localaddr.sin_addr));
- else
- cmdbuf = g_strdup_printf ("HELO %s\r\n", host && host->h_name ? host->h_name : inet_ntoa(localaddr.sin_addr));
- if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf), ex) == -1) {
- g_free(cmdbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "HELO request timed out: "
- "%s: non-fatal",
- g_strerror (errno));
- return FALSE;
- }
- g_free(cmdbuf);
-
- do {
- /* Check for "250" */
- g_free(respbuf);
- respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream), ex);
- if ( !respbuf || strncmp(respbuf, "250", 3) ) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "HELO response error: "
- "%s: non-fatal",
- g_strerror (errno));
- return FALSE;
- }
-
- if (smtp_is_esmtp && strstr(respbuf, "AUTH")) {
- /* parse for supported AUTH types */
- g_strchomp(respbuf);
- esmtp_supported_authtypes = esmtp_get_authtypes(respbuf);
- }
- } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */
- g_free(respbuf);
-
- return TRUE;
-}
-
-static gboolean
-smtp_mail (CamelSmtpTransport *transport, gchar *sender, CamelException *ex)
-{
- /* we gotta tell the smtp server who we are. (our email addy) */
- gchar *cmdbuf, *respbuf = NULL;
-
- /* enclose address in <>'s since some SMTP daemons *require* that */
- cmdbuf = g_strdup_printf("MAIL FROM: <%s>\r\n", sender);
- if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf), ex) == -1) {
- g_free(cmdbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "MAIL FROM request timed out: "
- "%s: mail not sent",
- g_strerror (errno));
- return FALSE;
- }
- g_free(cmdbuf);
-
- do {
- /* Check for "250 Sender OK..." */
- g_free(respbuf);
- respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream), ex);
- if ( !respbuf || strncmp(respbuf, "250", 3) ) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "MAIL FROM response error: "
- "%s: mail not sent",
- g_strerror (errno));
- return FALSE;
- }
- } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */
- g_free(respbuf);
-
- return TRUE;
-}
-
-static gboolean
-smtp_rcpt (CamelSmtpTransport *transport, gchar *recipient, CamelException *ex)
-{
- /* we gotta tell the smtp server who we are going to be sending
- * our email to */
- gchar *cmdbuf, *respbuf = NULL;
-
- /* enclose address in <>'s since some SMTP daemons *require* that */
- cmdbuf = g_strdup_printf("RCPT TO: <%s>\r\n", recipient);
- if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf), ex) == -1) {
- g_free(cmdbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "RCPT TO request timed out: "
- "%s: mail not sent",
- g_strerror (errno));
- return FALSE;
- }
- g_free(cmdbuf);
-
- do {
- /* Check for "250 Sender OK..." */
- g_free(respbuf);
- respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream), ex);
- if ( !respbuf || strncmp(respbuf, "250", 3) ) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "RCPT TO response error: "
- "%s: mail not sent",
- g_strerror (errno));
- return FALSE;
- }
- } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */
- g_free(respbuf);
-
- return TRUE;
-}
-
-static gboolean
-smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException *ex)
-{
- /* now we can actually send what's important :p */
- gchar *cmdbuf, *respbuf = NULL;
- gchar *buf, *chunk;
- CamelStream *message_stream;
-
- /* enclose address in <>'s since some SMTP daemons *require* that */
- cmdbuf = g_strdup("DATA\r\n");
- if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf), ex) == -1) {
- g_free(cmdbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "DATA request timed out: "
- "%s: mail not sent",
- g_strerror (errno));
- return FALSE;
- }
- g_free(cmdbuf);
-
- respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream), ex);
- if ( !respbuf || strncmp(respbuf, "354", 3) ) {
- /* we should have gotten instructions on how to use the DATA command:
- * 354 Enter mail, end with "." on a line by itself
- */
- g_free(respbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "DATA response error: "
- "%s: mail not sent",
- g_strerror (errno));
- return FALSE;
- }
-
- /* now to send the actual data */
- message_stream = camel_stream_buffer_new(camel_data_wrapper_get_output_stream (CAMEL_DATA_WRAPPER (message)), CAMEL_STREAM_BUFFER_READ);
- while (1) {
- /* send 1 line at a time */
- buf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER(message_stream), ex);
- if (!buf)
- break;
-
- /* check for a lone '.' */
- if (!strcmp(buf, "."))
- chunk = g_strconcat(buf, ".\r\n", NULL);
- else
- chunk = g_strconcat(buf, "\r\n", NULL);
-
- /* write the line */
- if ( camel_stream_write (transport->ostream, chunk, strlen(chunk), ex) == -1) {
- g_free(chunk);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "DATA send timed out: message body: "
- "%s: mail not sent",
- g_strerror (errno));
- return FALSE;
- }
- g_free(chunk);
- }
-
- /* terminate the message body */
- if ( camel_stream_write (transport->ostream, "\r\n.\r\n", 5, ex) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "DATA send timed out: message termination: "
- "%s: mail not sent",
- g_strerror (errno));
- return FALSE;
- }
-
- do {
- /* Check for "250 Sender OK..." */
- g_free(respbuf);
- respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream), ex);
- if ( !respbuf || strncmp(respbuf, "250", 3) ) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "DATA response error: message termination: "
- "%s: mail not sent",
- g_strerror (errno));
- return FALSE;
- }
- } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */
- g_free(respbuf);
-
- return TRUE;
-}
-
-static gboolean
-smtp_rset (CamelSmtpTransport *transport, CamelException *ex)
-{
- /* we are going to reset the smtp server (just to be nice) */
- gchar *cmdbuf, *respbuf = NULL;
-
- cmdbuf = g_strdup ("RSET\r\n");
- if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf), ex) == -1) {
- g_free(cmdbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "RSET request timed out: "
- "%s",
- g_strerror (errno));
- return FALSE;
- }
- g_free(cmdbuf);
-
- do {
- /* Check for "250" */
- g_free(respbuf);
- respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream), ex);
- if ( !respbuf || strncmp(respbuf, "250", 3) ) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "RSET response error: "
- "%s",
- g_strerror (errno));
- return FALSE;
- }
- } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */
- g_free(respbuf);
-
- return TRUE;
-}
-
-static gboolean
-smtp_quit (CamelSmtpTransport *transport, CamelException *ex)
-{
- /* we are going to reset the smtp server (just to be nice) */
- gchar *cmdbuf, *respbuf = NULL;
-
- cmdbuf = g_strdup ("QUIT\r\n");
- if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf), ex) == -1) {
- g_free(cmdbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "QUIT request timed out: "
- "%s: non-fatal",
- g_strerror (errno));
- return FALSE;
- }
- g_free(cmdbuf);
-
- do {
- /* Check for "221" */
- g_free(respbuf);
- respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream), ex);
- if ( !respbuf || strncmp(respbuf, "221", 3) ) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "QUIT response error: "
- "%s: non-fatal",
- g_strerror (errno));
- return FALSE;
- }
- } while ( *(respbuf+3) == '-' ); /* if we got "221-" then loop again */
- g_free(respbuf);
-
- return TRUE;
-}
diff --git a/camel/providers/smtp/camel-smtp-transport.h b/camel/providers/smtp/camel-smtp-transport.h
deleted file mode 100644
index 54343e59d8..0000000000
--- a/camel/providers/smtp/camel-smtp-transport.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-smtp-transport.h : class for an smtp transfer */
-
-/*
- * Authors:
- * Jeffrey Stedfast <fejj@stampede.org>
- *
- * Copyright (C) 2000 Helix Code, Inc. (www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_SMTP_TRANSPORT_H
-#define CAMEL_SMTP_TRANSPORT_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-transport.h"
-
-#define CAMEL_SMTP_TRANSPORT_TYPE (camel_smtp_transport_get_type ())
-#define CAMEL_SMTP_TRANSPORT(obj) (GTK_CHECK_CAST((obj), CAMEL_SMTP_TRANSPORT_TYPE, CamelSmtpTransport))
-#define CAMEL_SMTP_TRANSPORT_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SMTP_TRANSPORT_TYPE, CamelSmtpTransportClass))
-#define IS_CAMEL_SMTP_TRANSPORT(o) (GTK_CHECK_TYPE((o), CAMEL_SMTP_TRANSPORT_TYPE))
-
-
-typedef struct {
- CamelTransport parent_object;
-
- CamelStream *istream, *ostream;
-
-} CamelSmtpTransport;
-
-
-
-typedef struct {
- CamelTransportClass parent_class;
-
-} CamelSmtpTransportClass;
-
-
-/* Standard Gtk function */
-GtkType camel_smtp_transport_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SMTP_TRANSPORT_H */
-
-
diff --git a/camel/providers/smtp/libcamelsmtp.urls b/camel/providers/smtp/libcamelsmtp.urls
deleted file mode 100644
index ec2fc0fc16..0000000000
--- a/camel/providers/smtp/libcamelsmtp.urls
+++ /dev/null
@@ -1 +0,0 @@
-smtp
diff --git a/camel/providers/vee/Makefile.am b/camel/providers/vee/Makefile.am
deleted file mode 100644
index 601defcb80..0000000000
--- a/camel/providers/vee/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelveeincludedir = $(includedir)/camel
-
-
-providerdir = $(pkglibdir)/camel-providers/$(VERSION)
-
-provider_LTLIBRARIES = libcamelvee.la
-provider_DATA = libcamelvee.urls
-
-INCLUDES = -I.. \
- -I$(srcdir)/.. \
- -I$(top_srcdir)/camel \
- -I$(top_srcdir)/intl \
- -I$(top_srcdir)/libibex \
- -I$(top_srcdir)/e-util \
- -I$(top_srcdir) \
- -I$(includedir) \
- $(GTK_INCLUDEDIR) \
- -DG_LOG_DOMAIN=\"camel-vee-provider\"
-
-libcamelvee_la_SOURCES = \
- camel-vee-folder.c \
- camel-vee-provider.c \
- camel-vee-store.c
-
-libcamelveeinclude_HEADERS = \
- camel-vee-folder.h \
- camel-vee-store.h
-
-libcamelvee_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-libcamelvee_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS)
-#libcamelvee_la_LIBADD = $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS)
-
-EXTRA_DIST = libcamelvee.urls
-
diff --git a/camel/providers/vee/camel-vee-folder.c b/camel/providers/vee/camel-vee-folder.c
deleted file mode 100644
index 3d4050cf19..0000000000
--- a/camel/providers/vee/camel-vee-folder.c
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "camel-exception.h"
-#include "camel-vee-folder.h"
-#include "camel-folder-summary.h"
-#include "camel-mime-message.h"
-
-#include <string.h>
-
-/* our message info includes the parent folder */
-typedef struct _CamelVeeMessageInfo {
- CamelMessageInfo info;
- CamelFolder *folder;
-} CamelVeeMessageInfo;
-
-struct _CamelVeeFolderPrivate {
- GList *folders;
-};
-
-#define _PRIVATE(o) (((CamelVeeFolder *)(o))->priv)
-
-static void vee_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar separator, CamelException *ex);
-
-static void vee_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex);
-static void vee_close (CamelFolder *folder, gboolean expunge, CamelException *ex);
-static gboolean vee_exists (CamelFolder *folder, CamelException *ex);
-
-static GPtrArray *vee_get_uids (CamelFolder *folder, CamelException *ex);
-GPtrArray *vee_get_summary (CamelFolder *folder, CamelException *ex);
-void vee_free_summary (CamelFolder *folder, GPtrArray *array);
-
-static gint vee_get_message_count (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *vee_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-
-static void vee_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-
-static const CamelMessageInfo *vee_summary_get_by_uid(CamelFolder *f, const char *uid);
-static GList *vee_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
-
-
-static void camel_vee_folder_class_init (CamelVeeFolderClass *klass);
-static void camel_vee_folder_init (CamelVeeFolder *obj);
-static void camel_vee_folder_finalise (GtkObject *obj);
-
-static void vee_folder_build(CamelVeeFolder *vf, CamelException *ex);
-
-static CamelFolderClass *camel_vee_folder_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_vee_folder_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelVeeFolder",
- sizeof (CamelVeeFolder),
- sizeof (CamelVeeFolderClass),
- (GtkClassInitFunc) camel_vee_folder_class_init,
- (GtkObjectInitFunc) camel_vee_folder_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_folder_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-camel_vee_folder_class_init (CamelVeeFolderClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- CamelFolderClass *folder_class = (CamelFolderClass *) klass;
-
- camel_vee_folder_parent = gtk_type_class (camel_folder_get_type ());
-
- printf("vfolder class init\n");
-
- folder_class->init = vee_init;
- folder_class->open = vee_open;
- folder_class->close = vee_close;
- folder_class->exists = vee_exists;
-
- folder_class->get_uids = vee_get_uids;
- folder_class->get_summary = vee_get_summary;
- folder_class->free_summary = vee_free_summary;
- folder_class->get_message_by_uid = vee_get_message_by_uid;
- folder_class->append_message = vee_append_message;
-
- folder_class->summary_get_by_uid = vee_summary_get_by_uid;
-
- folder_class->get_message_count = vee_get_message_count;
- folder_class->search_by_expression = vee_search_by_expression;
-
- object_class->finalize = camel_vee_folder_finalise;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_vee_folder_init (CamelVeeFolder *obj)
-{
- struct _CamelVeeFolderPrivate *p;
-
- printf("vfolder init\n");
-
- p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
-}
-
-static void
-camel_vee_folder_finalise (GtkObject *obj)
-{
- CamelVeeFolder *vf = (CamelVeeFolder *)obj;
- struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
- GList *node;
-
- node = p->folders;
- while (node) {
- CamelFolder *f = node->data;
- gtk_object_unref((GtkObject *)f);
- node = g_list_next(node);
- }
-
- ((GtkObjectClass *)(camel_vee_folder_parent))->finalize((GtkObject *)obj);
-}
-
-/**
- * camel_vee_folder_new:
- *
- * Create a new CamelVeeFolder object.
- *
- * Return value: A new CamelVeeFolder widget.
- **/
-CamelVeeFolder *
-camel_vee_folder_new (void)
-{
- CamelVeeFolder *new = CAMEL_VEE_FOLDER ( gtk_type_new (camel_vee_folder_get_type ()));
- return new;
-}
-
-
-void
-camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub)
-{
- struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
-
- gtk_object_ref((GtkObject *)sub);
- p->folders = g_list_append(p->folders, sub);
-}
-
-
-static void vee_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar separator, CamelException *ex)
-{
- CamelVeeFolder *vf = (CamelVeeFolder *)folder;
- char *namepart, *searchpart;
-
- namepart = g_strdup(name);
- searchpart = strchr(namepart, '?');
- if (searchpart == NULL) {
- /* no search, no result! */
- searchpart = "(body-contains \"=some-invalid_string-sequence=xx\")";
- } else {
- *searchpart++ = 0;
- }
-
- camel_vee_folder_parent->init (folder, parent_store, parent_folder, name, separator, ex);
- if (camel_exception_get_id (ex))
- return;
-
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = FALSE;
- folder->has_summary_capability = TRUE;
- folder->has_search_capability = TRUE;
-
- /* FIXME: what to do about user flags if the subfolder doesn't support them? */
- folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
- CAMEL_MESSAGE_DELETED |
- CAMEL_MESSAGE_DRAFT |
- CAMEL_MESSAGE_FLAGGED |
- CAMEL_MESSAGE_SEEN;
-
- vf->messages = g_ptr_array_new();
- vf->messages_uid = g_hash_table_new(g_str_hash, g_str_equal);
-
- vf->expression = g_strdup_printf("(or\n (match-all (user-flag \"%s\"))\n %s\n)", namepart, searchpart);
- vf->vname = g_strdup(namepart);
-
- printf("VFolder expression is %s\n", vf->expression);
- printf("VFolder full name = %s\n", camel_folder_get_full_name(folder));
-
- g_free(namepart);
-}
-
-static void vee_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex)
-{
- CamelVeeFolder *vf = (CamelVeeFolder *)folder;
-
- camel_vee_folder_parent->open (folder, mode, ex);
- if (camel_exception_get_id(ex))
- return;
-
- /* perform search on folders to be searched ... */
- vee_folder_build(vf, ex);
-}
-
-static void vee_close (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- camel_vee_folder_parent->close (folder, expunge, ex);
-
- /* FIXME: close vfolder? */
-}
-
-/* vfolders always exist? */
-static gboolean vee_exists (CamelFolder *folder, CamelException *ex)
-{
- return TRUE;
-}
-
-static void vee_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelVeeFolder *vf = (CamelVeeFolder *)folder;
-
- if (message->folder && message->folder->permanent_flags & CAMEL_MESSAGE_USER) {
- /* set the flag on the message ... */
- camel_mime_message_set_user_flag(message, vf->vname, TRUE);
- } else {
- /* FIXME: error code */
- camel_exception_setv(ex, 1, "Cannot append this message to virtual folder");
- }
-}
-
-static gint vee_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- CamelVeeFolder *vf = (CamelVeeFolder *)folder;
-
- return vf->messages->len;
-}
-
-static CamelMimeMessage *vee_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelVeeMessageInfo *mi;
-
- mi = (CamelVeeMessageInfo *)vee_summary_get_by_uid(folder, uid);
- if (mi == NULL) {
- camel_exception_setv(ex, 1, "Failed");
- return NULL;
- }
- return camel_folder_get_message_by_uid(mi->folder, strchr(mi->info.uid, ':')+1, ex);
-}
-
-GPtrArray *vee_get_summary (CamelFolder *folder, CamelException *ex)
-{
- CamelVeeFolder *vf = (CamelVeeFolder *)folder;
-
- return vf->messages;
-}
-
-void vee_free_summary (CamelFolder *folder, GPtrArray *array)
-{
- /* no op */
-}
-
-static const CamelMessageInfo *vee_summary_get_by_uid(CamelFolder *f, const char *uid)
-{
- CamelVeeFolder *vf = (CamelVeeFolder *)f;
-
- return g_hash_table_lookup(vf->messages_uid, uid);
-}
-
-static GPtrArray *vee_get_uids (CamelFolder *folder, CamelException *ex)
-{
- GPtrArray *result;
- int i;
- CamelVeeFolder *vf = (CamelVeeFolder *)folder;
-
- result = g_ptr_array_new ();
- g_ptr_array_set_size (result, vf->messages->len);
- for (i=0;i<vf->messages->len;i++) {
- CamelMessageInfo *mi = g_ptr_array_index(vf->messages, i);
- result->pdata[i] = g_strdup(mi->uid);
- }
-
- return result;
-}
-
-static GList *
-vee_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex)
-{
- GList *result = NULL, *node;
- char *expr;
- CamelVeeFolder *vf = (CamelVeeFolder *)folder;
- struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
-
- expr = g_strdup_printf("(and %s %s)", vf->expression, expression);
- node = p->folders;
- while (node) {
- CamelFolder *f = node->data;
- GList *matches, *match;
- matches = camel_folder_search_by_expression(f, vf->expression, ex);
- match = matches;
- while (match) {
- char *uid = match->data;
- result = g_list_prepend(result, g_strdup_printf("%p:%s", f, uid));
- match = g_list_next(match);
- }
- g_list_free(matches);
- node = g_list_next(node);
- }
- return result;
-}
-
-/*
- need incremental update, based on folder.
- Need to watch folders for changes and update accordingly.
-*/
-
-/* this does most of the vfolder magic */
-static void
-vee_folder_build(CamelVeeFolder *vf, CamelException *ex)
-{
- struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
- GList *node;
-
- GPtrArray *messages;
- GHashTable *messages_uid;
-
- {
- int i;
-
- for (i=0;i<vf->messages->len;i++) {
- CamelVeeMessageInfo *mi = g_ptr_array_index(vf->messages, i);
- g_free(mi->info.subject);
- g_free(mi->info.to);
- g_free(mi->info.from);
- g_free(mi->info.uid);
- camel_flag_list_free(&mi->info.user_flags);
- }
- }
-
- messages = g_ptr_array_new();
- messages_uid = g_hash_table_new(g_str_hash, g_str_equal);
-
- node = p->folders;
- while (node) {
- GList *matches, *match;
- CamelFolder *f = node->data;
- CamelVeeMessageInfo *mi;
- const CamelMessageInfo *info;
- CamelFlag *flag;
-
- matches = camel_folder_search_by_expression(f, vf->expression, ex);
- match = matches;
- while (match) {
- info = camel_folder_summary_get_by_uid(f, match->data);
- if (info) {
- mi = g_malloc0(sizeof(*mi));
- mi->info.subject = g_strdup(info->subject);
- mi->info.to = g_strdup(info->to);
- mi->info.from = g_strdup(info->from);
- mi->info.uid = g_strdup_printf("%p:%s", f, info->uid);
- mi->info.flags = info->flags;
- mi->info.size = info->size;
- mi->info.date_sent = info->date_sent;
- mi->info.date_received = info->date_received;
- flag = info->user_flags;
- while (flag) {
- camel_flag_set(&mi->info.user_flags, flag->name, TRUE);
- flag = flag->next;
- }
- mi->info.content = NULL;
- mi->folder = f;
- g_ptr_array_add(messages, mi);
- g_hash_table_insert(messages_uid, mi->info.uid, mi);
- }
- match = g_list_next(match);
- }
- g_list_free(matches);
- node = g_list_next(node);
- }
-
- g_ptr_array_free(vf->messages, TRUE);
- vf->messages = messages;
- g_hash_table_destroy(vf->messages_uid);
- vf->messages_uid = messages_uid;
-}
-
-
-/*
-
- (match-folder "folder1" "folder2")
-
- */
diff --git a/camel/providers/vee/camel-vee-folder.h b/camel/providers/vee/camel-vee-folder.h
deleted file mode 100644
index ea2a82a25b..0000000000
--- a/camel/providers/vee/camel-vee-folder.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef _CAMEL_VEE_FOLDER_H
-#define _CAMEL_VEE_FOLDER_H
-
-#include <gtk/gtk.h>
-#include <camel/camel-folder.h>
-
-#define CAMEL_VEE_FOLDER(obj) GTK_CHECK_CAST (obj, camel_vee_folder_get_type (), CamelVeeFolder)
-#define CAMEL_VEE_FOLDER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_vee_folder_get_type (), CamelVeeFolderClass)
-#define IS_CAMEL_VEE_FOLDER(obj) GTK_CHECK_TYPE (obj, camel_vee_folder_get_type ())
-
-typedef struct _CamelVeeFolder CamelVeeFolder;
-typedef struct _CamelVeeFolderClass CamelVeeFolderClass;
-
-struct _CamelVeeFolder {
- CamelFolder parent;
-
- struct _CamelVeeFolderPrivate *priv;
-
- char *expression; /* query expression */
- char *vname; /* local name */
- CamelFolder *local; /* local storage for folder */
-
- /* FIXME: Move this to a summary object??? */
- GPtrArray *messages; /* message info's */
- GHashTable *messages_uid;
-};
-
-struct _CamelVeeFolderClass {
- CamelFolderClass parent_class;
-};
-
-guint camel_vee_folder_get_type (void);
-CamelVeeFolder *camel_vee_folder_new (void);
-
-void camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub);
-
-#endif /* ! _CAMEL_VEE_FOLDER_H */
diff --git a/camel/providers/vee/camel-vee-provider.c b/camel/providers/vee/camel-vee-provider.c
deleted file mode 100644
index b9c20b4561..0000000000
--- a/camel/providers/vee/camel-vee-provider.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "config.h"
-#include "camel-vee-store.h"
-#include "camel-provider.h"
-#include "camel-session.h"
-
-static CamelProvider vee_provider = {
- "vfolder",
- "Virtual folder email provider",
-
- "For reading mail as a query of another set of folders",
-
- 0,
-
- { 0, 0 }
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- vee_provider.object_types[CAMEL_PROVIDER_STORE] =
- camel_vee_store_get_type();
-
- camel_session_register_provider (session, &vee_provider);
-}
diff --git a/camel/providers/vee/camel-vee-store.c b/camel/providers/vee/camel-vee-store.c
deleted file mode 100644
index b62a6b9fab..0000000000
--- a/camel/providers/vee/camel-vee-store.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "camel-vee-store.h"
-#include "camel-vee-folder.h"
-
-static CamelFolder *vee_get_folder (CamelStore *store, const char *folder_name, CamelException *ex);
-static char *vee_get_folder_name (CamelStore *store, const char *folder_name, CamelException *ex);
-
-struct _CamelVeeStorePrivate {
-};
-
-#define _PRIVATE(o) (((CamelVeeStore *)(o))->priv)
-
-static void camel_vee_store_class_init (CamelVeeStoreClass *klass);
-static void camel_vee_store_init (CamelVeeStore *obj);
-static void camel_vee_store_finalise (GtkObject *obj);
-
-static CamelStoreClass *camel_vee_store_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-camel_vee_store_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "CamelVeeStore",
- sizeof (CamelVeeStore),
- sizeof (CamelVeeStoreClass),
- (GtkClassInitFunc) camel_vee_store_class_init,
- (GtkObjectInitFunc) camel_vee_store_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (camel_store_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-
-camel_vee_store_class_init (CamelVeeStoreClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- CamelStoreClass *store_class = (CamelStoreClass *) klass;
-
- camel_vee_store_parent = gtk_type_class (camel_store_get_type ());
-
- /* virtual method overload */
- store_class->get_folder = vee_get_folder;
- store_class->get_folder_name = vee_get_folder_name;
-
- object_class->finalize = camel_vee_store_finalise;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-camel_vee_store_init (CamelVeeStore *obj)
-{
- struct _CamelVeeStorePrivate *p;
-
- p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
-}
-
-static void
-camel_vee_store_finalise (GtkObject *obj)
-{
- ((GtkObjectClass *)(camel_vee_store_parent))->finalize((GtkObject *)obj);
-}
-
-/**
- * camel_vee_store_new:
- *
- * Create a new CamelVeeStore object.
- *
- * Return value: A new CamelVeeStore widget.
- **/
-CamelVeeStore *
-camel_vee_store_new (void)
-{
- CamelVeeStore *new = CAMEL_VEE_STORE ( gtk_type_new (camel_vee_store_get_type ()));
- return new;
-}
-
-static CamelFolder *
-vee_get_folder (CamelStore *store, const char *folder_name, CamelException *ex)
-{
- CamelFolder *folder;
-
- folder = gtk_type_new (camel_vee_folder_get_type());
-
- printf("my type is: %s\n", gtk_type_name(((GtkObject *)folder)->klass->type));
-
- ((CamelFolderClass *)((GtkObject *)folder)->klass)->init (folder, store, NULL, folder_name, '/', ex);
- return folder;
-}
-
-static char *
-vee_get_folder_name (CamelStore *store, const char *folder_name, CamelException *ex)
-{
-#warning "What purpose does this function serve?"
- return g_strdup(folder_name);
-}
-
diff --git a/camel/providers/vee/camel-vee-store.h b/camel/providers/vee/camel-vee-store.h
deleted file mode 100644
index 848769296a..0000000000
--- a/camel/providers/vee/camel-vee-store.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef _CAMEL_VEE_STORE_H
-#define _CAMEL_VEE_STORE_H
-
-#include <gtk/gtk.h>
-#include <camel/camel-store.h>
-
-#define CAMEL_VEE_STORE(obj) GTK_CHECK_CAST (obj, camel_vee_store_get_type (), CamelVeeStore)
-#define CAMEL_VEE_STORE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_vee_store_get_type (), CamelVeeStoreClass)
-#define IS_CAMEL_VEE_STORE(obj) GTK_CHECK_TYPE (obj, camel_vee_store_get_type ())
-
-typedef struct _CamelVeeStore CamelVeeStore;
-typedef struct _CamelVeeStoreClass CamelVeeStoreClass;
-
-struct _CamelVeeStore {
- CamelStore parent;
-
- struct _CamelVeeStorePrivate *priv;
-};
-
-struct _CamelVeeStoreClass {
- CamelStoreClass parent_class;
-};
-
-guint camel_vee_store_get_type (void);
-CamelVeeStore *camel_vee_store_new (void);
-
-#endif /* ! _CAMEL_VEE_STORE_H */
diff --git a/camel/providers/vee/libcamelvee.urls b/camel/providers/vee/libcamelvee.urls
deleted file mode 100644
index 6fa58dadb5..0000000000
--- a/camel/providers/vee/libcamelvee.urls
+++ /dev/null
@@ -1 +0,0 @@
-vfolder
diff --git a/camel/string-utils.c b/camel/string-utils.c
deleted file mode 100644
index 42fb93538a..0000000000
--- a/camel/string-utils.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* string-util : utilities for gchar* strings */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "string-utils.h"
-#include "string.h"
-
-gboolean
-string_equal_for_glist (gconstpointer v, gconstpointer v2)
-{
- return (!strcmp ( ((const gchar *)v), ((const gchar*)v2))) == 0;
-}
-
-/* utility func : frees a gchar element in a GList */
-static void
-__string_list_free_string (gpointer data, gpointer user_data)
-{
- gchar *string = (gchar *)data;
- g_free (string);
-}
-
-void
-string_list_free (GList *string_list)
-{
- if (string_list == NULL) return;
-
- g_list_foreach (string_list, __string_list_free_string, NULL);
- g_list_free (string_list);
-}
-
-
-
-
-
-
-GList *
-string_split (const gchar *string, char sep, const gchar *trim_chars, StringTrimOption trim_options)
-{
- GList *result = NULL;
- gint first, last, pos;
- gchar *new_string;
-
- g_assert (string);
-
- first = 0;
- last = strlen(string) - 1;
-
- /* strip leading and trailing separators */
- while ( (first<=last) && (string[first]==sep) )
- first++;
- while ( (first<=last) && (string[last]==sep) )
- last--;
-
-
- while (first<=last) {
- pos = first;
- /* find next separator */
- while ((pos<=last) && (string[pos]!=sep)) pos++;
- if (first != pos) {
- new_string = g_strndup (string+first, pos-first);
- /* could do trimming in line to speed up this code */
- if (trim_chars) string_trim (new_string, trim_chars, trim_options);
- result = g_list_append (result, new_string);
- }
- first = pos + 1;
- }
-
- return result;
-}
-
-
-void
-string_trim (gchar *string, const gchar *trim_chars, StringTrimOption options)
-{
- gint first_ok;
- gint last_ok;
- guint length;
-
- g_return_if_fail (string);
- length = strlen (string);
- if (length==0)
- return;
-
- first_ok = 0;
- last_ok = length - 1;
-
- if (options & STRING_TRIM_STRIP_LEADING)
- while ( (first_ok <= last_ok) && (strchr (trim_chars, string[first_ok])!=NULL) )
- first_ok++;
-
- if (options & STRING_TRIM_STRIP_TRAILING)
- while ( (first_ok <= last_ok) && (strchr (trim_chars, string[last_ok])!=NULL) )
- last_ok--;
-
- if (first_ok > 0)
- memmove (string, string+first_ok, last_ok - first_ok + 1);
- string[last_ok - first_ok +1] = '\0';
-
-}
-
-
-
-
-
-/**
- * remove_suffix: remove a suffix from a string
- * @s: the string to remove the suffix from.
- * @suffix: the suffix to remove
- * @suffix_found : suffix found flag
- *
- * Remove a suffix from a string. If the
- * string ends with the full suffix, a copy
- * of the string without the suffix is returned and
- * @suffix_found is set to %TRUE.
- * Otherwise, NULL is returned and
- * @suffix_found is set to %FALSE.
- *
- * Return value: an allocated copy of the string without the suffix or NULL if the suffix was not found.
- **/
-gchar *
-string_prefix (const gchar *s, const gchar *suffix, gboolean *suffix_found)
-{
- guint s_len, suf_len;
- guint suffix_pos;
- char *result_string;
-
- g_assert (s);
- g_assert (suffix);
- g_assert (suffix_found);
-
- s_len = strlen (s);
- suf_len = strlen (suffix);
-
- /* if the string is shorter than the suffix, do nothing */
- if (s_len < suf_len) {
- *suffix_found = FALSE;
- return NULL;
- }
-
- /* theoretical position of the prefix */
- suffix_pos = s_len - suf_len;
-
- /* compare the right hand side of the string with the suffix */
- if (!strncmp (s+suffix_pos, suffix, suf_len)) {
-
- /* if the suffix matches, check that there are
- characters before */
- if (suffix_pos == 0) {
- result_string = NULL;
- *suffix_found = TRUE;
- } else {
- result_string = g_strndup (s, suffix_pos);
- *suffix_found = TRUE;
- }
-
- } else {
- result_string = NULL;
- *suffix_found = FALSE;
- }
-
- return result_string;
-}
diff --git a/camel/string-utils.h b/camel/string-utils.h
deleted file mode 100644
index 665aafc01e..0000000000
--- a/camel/string-utils.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* string-util : utilities for normal gchar * strings */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#ifndef STRING_UTIL_H
-#define STRING_UTIL_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-
-typedef enum {
- STRING_TRIM_NONE = 0,
- STRING_TRIM_STRIP_TRAILING = 1,
- STRING_TRIM_STRIP_LEADING = 2
-} StringTrimOption;
-
-
-
-gboolean string_equal_for_glist (gconstpointer v, gconstpointer v2);
-
-void string_list_free (GList *string_list);
-
-GList *string_split (const gchar *string, char sep,
- const gchar *trim_chars, StringTrimOption trim_options);
-void string_trim (gchar *string, const gchar *chars,
- StringTrimOption options);
-
-gchar *string_prefix (const gchar *s, const gchar *suffix, gboolean *suffix_found);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* STRING_UTIL_H */