aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/.cvsignore11
-rw-r--r--camel/CODING.STYLE19
-rw-r--r--camel/ChangeLog10577
-rw-r--r--camel/Makefile.am173
-rw-r--r--camel/README57
-rw-r--r--camel/README.COPYRIGHT47
-rw-r--r--camel/README.HACKING14
-rw-r--r--camel/README.mt171
-rw-r--r--camel/broken-date-parser.c315
-rw-r--r--camel/broken-date-parser.h41
-rw-r--r--camel/camel-address.c240
-rw-r--r--camel/camel-address.h69
-rw-r--r--camel/camel-charset-map-private.h4345
-rw-r--r--camel/camel-charset-map.c287
-rw-r--r--camel/camel-charset-map.h38
-rw-r--r--camel/camel-data-wrapper.c290
-rw-r--r--camel/camel-data-wrapper.h93
-rw-r--r--camel/camel-exception-list.def37
-rw-r--r--camel/camel-exception.c277
-rw-r--r--camel/camel-exception.h89
-rw-r--r--camel/camel-filter-driver.c826
-rw-r--r--camel/camel-filter-driver.h93
-rw-r--r--camel/camel-filter-search.c449
-rw-r--r--camel/camel-filter-search.h44
-rw-r--r--camel/camel-folder-search.c853
-rw-r--r--camel/camel-folder-search.h122
-rw-r--r--camel/camel-folder-summary.c2815
-rw-r--r--camel/camel-folder-summary.h334
-rw-r--r--camel/camel-folder-thread.c626
-rw-r--r--camel/camel-folder-thread.h55
-rw-r--r--camel/camel-folder.c1675
-rw-r--r--camel/camel-folder.h305
-rw-r--r--camel/camel-internet-address.c509
-rw-r--r--camel/camel-internet-address.h55
-rw-r--r--camel/camel-lock.c405
-rw-r--r--camel/camel-lock.h64
-rw-r--r--camel/camel-medium.c267
-rw-r--r--camel/camel-medium.h92
-rw-r--r--camel/camel-mime-filter-basic.c222
-rw-r--r--camel/camel-mime-filter-basic.h58
-rw-r--r--camel/camel-mime-filter-bestenc.c289
-rw-r--r--camel/camel-mime-filter-bestenc.h88
-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-crlf.c150
-rw-r--r--camel/camel-mime-filter-crlf.h62
-rw-r--r--camel/camel-mime-filter-from.c221
-rw-r--r--camel/camel-mime-filter-from.h49
-rw-r--r--camel/camel-mime-filter-index.c156
-rw-r--r--camel/camel-mime-filter-index.h55
-rw-r--r--camel/camel-mime-filter-linewrap.c140
-rw-r--r--camel/camel-mime-filter-linewrap.h51
-rw-r--r--camel/camel-mime-filter-save.c144
-rw-r--r--camel/camel-mime-filter-save.h50
-rw-r--r--camel/camel-mime-filter.c255
-rw-r--r--camel/camel-mime-filter.h84
-rw-r--r--camel/camel-mime-message.c802
-rw-r--r--camel/camel-mime-message.h129
-rw-r--r--camel/camel-mime-parser.c1956
-rw-r--r--camel/camel-mime-parser.h133
-rw-r--r--camel/camel-mime-part-utils.c243
-rw-r--r--camel/camel-mime-part-utils.h45
-rw-r--r--camel/camel-mime-part.c745
-rw-r--r--camel/camel-mime-part.h130
-rw-r--r--camel/camel-mime-utils.c3401
-rw-r--r--camel/camel-mime-utils.h197
-rw-r--r--camel/camel-movemail.c596
-rw-r--r--camel/camel-movemail.h45
-rw-r--r--camel/camel-multipart.c518
-rw-r--r--camel/camel-multipart.h105
-rw-r--r--camel/camel-news-address.c65
-rw-r--r--camel/camel-news-address.h45
-rw-r--r--camel/camel-object.c973
-rw-r--r--camel/camel-object.h146
-rw-r--r--camel/camel-operation.c540
-rw-r--r--camel/camel-operation.h66
-rw-r--r--camel/camel-private.h180
-rw-r--r--camel/camel-provider.c148
-rw-r--r--camel/camel-provider.h120
-rw-r--r--camel/camel-remote-store.c643
-rw-r--r--camel/camel-remote-store.h83
-rw-r--r--camel/camel-sasl-anonymous.c137
-rw-r--r--camel/camel-sasl-anonymous.h68
-rw-r--r--camel/camel-sasl-cram-md5.c139
-rw-r--r--camel/camel-sasl-cram-md5.h59
-rw-r--r--camel/camel-sasl-kerberos4.c220
-rw-r--r--camel/camel-sasl-kerberos4.h62
-rw-r--r--camel/camel-sasl-plain.c89
-rw-r--r--camel/camel-sasl-plain.h57
-rw-r--r--camel/camel-sasl.c240
-rw-r--r--camel/camel-sasl.h77
-rw-r--r--camel/camel-search-private.c466
-rw-r--r--camel/camel-search-private.h46
-rw-r--r--camel/camel-seekable-stream.c201
-rw-r--r--camel/camel-seekable-stream.h88
-rw-r--r--camel/camel-seekable-substream.c300
-rw-r--r--camel/camel-seekable-substream.h70
-rw-r--r--camel/camel-service.c522
-rw-r--r--camel/camel-service.h130
-rw-r--r--camel/camel-session.c539
-rw-r--r--camel/camel-session.h147
-rw-r--r--camel/camel-store.c770
-rw-r--r--camel/camel-store.h190
-rw-r--r--camel/camel-stream-buffer.c453
-rw-r--r--camel/camel-stream-buffer.h109
-rw-r--r--camel/camel-stream-filter.c381
-rw-r--r--camel/camel-stream-filter.h52
-rw-r--r--camel/camel-stream-fs.c371
-rw-r--r--camel/camel-stream-fs.h75
-rw-r--r--camel/camel-stream-mem.c246
-rw-r--r--camel/camel-stream-mem.h75
-rw-r--r--camel/camel-stream-null.c90
-rw-r--r--camel/camel-stream-null.h44
-rw-r--r--camel/camel-stream-ssl.c254
-rw-r--r--camel/camel-stream-ssl.h62
-rw-r--r--camel/camel-stream.c271
-rw-r--r--camel/camel-stream.h91
-rw-r--r--camel/camel-tcp-stream-raw.c293
-rw-r--r--camel/camel-tcp-stream-raw.h64
-rw-r--r--camel/camel-tcp-stream-ssl.c284
-rw-r--r--camel/camel-tcp-stream-ssl.h69
-rw-r--r--camel/camel-tcp-stream.c152
-rw-r--r--camel/camel-tcp-stream.h117
-rw-r--r--camel/camel-transport.c104
-rw-r--r--camel/camel-transport.h87
-rw-r--r--camel/camel-types.h73
-rw-r--r--camel/camel-uid-cache.c186
-rw-r--r--camel/camel-uid-cache.h56
-rw-r--r--camel/camel-url.c373
-rw-r--r--camel/camel-url.h71
-rw-r--r--camel/camel-vee-folder.c942
-rw-r--r--camel/camel-vee-folder.h58
-rw-r--r--camel/camel-vee-store.c110
-rw-r--r--camel/camel-vee-store.h50
-rw-r--r--camel/camel.c88
-rw-r--r--camel/camel.h77
-rw-r--r--camel/devel-docs/camel_data_wrapper.diabin3062 -> 0 bytes
-rw-r--r--camel/devel-docs/camel_parser_states.diabin2505 -> 0 bytes
-rw-r--r--camel/devel-docs/camel_stream.diabin2669 -> 0 bytes
-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/providers/.cvsignore2
-rw-r--r--camel/providers/Makefile.am11
-rw-r--r--camel/providers/cache/.cvsignore11
-rw-r--r--camel/providers/cache/Makefile.am35
-rw-r--r--camel/providers/cache/camel-cache-folder.c810
-rw-r--r--camel/providers/cache/camel-cache-folder.h88
-rw-r--r--camel/providers/cache/camel-cache-map.c255
-rw-r--r--camel/providers/cache/camel-cache-map.h64
-rw-r--r--camel/providers/cache/camel-cache-provider.c51
-rw-r--r--camel/providers/cache/camel-cache-store.c297
-rw-r--r--camel/providers/cache/camel-cache-store.h68
-rw-r--r--camel/providers/cache/libcamelcache.urls1
-rw-r--r--camel/providers/imap/.cvsignore11
-rw-r--r--camel/providers/imap/Makefile.am52
-rw-r--r--camel/providers/imap/camel-imap-command.c578
-rw-r--r--camel/providers/imap/camel-imap-command.h59
-rw-r--r--camel/providers/imap/camel-imap-folder.c1152
-rw-r--r--camel/providers/imap/camel-imap-folder.h83
-rw-r--r--camel/providers/imap/camel-imap-private.h88
-rw-r--r--camel/providers/imap/camel-imap-provider.c113
-rw-r--r--camel/providers/imap/camel-imap-search.c151
-rw-r--r--camel/providers/imap/camel-imap-search.h51
-rw-r--r--camel/providers/imap/camel-imap-store.c1135
-rw-r--r--camel/providers/imap/camel-imap-store.h90
-rw-r--r--camel/providers/imap/camel-imap-summary.c215
-rw-r--r--camel/providers/imap/camel-imap-summary.h70
-rw-r--r--camel/providers/imap/camel-imap-types.h39
-rw-r--r--camel/providers/imap/camel-imap-utils.c568
-rw-r--r--camel/providers/imap/camel-imap-utils.h62
-rw-r--r--camel/providers/imap/camel-imap-wrapper.c234
-rw-r--r--camel/providers/imap/camel-imap-wrapper.h70
-rw-r--r--camel/providers/imap/libcamelimap.urls1
-rw-r--r--camel/providers/local/.cvsignore11
-rw-r--r--camel/providers/local/Makefile.am57
-rw-r--r--camel/providers/local/camel-local-folder.c349
-rw-r--r--camel/providers/local/camel-local-folder.h96
-rw-r--r--camel/providers/local/camel-local-private.h60
-rw-r--r--camel/providers/local/camel-local-provider.c80
-rw-r--r--camel/providers/local/camel-local-store.c311
-rw-r--r--camel/providers/local/camel-local-store.h68
-rw-r--r--camel/providers/local/camel-local-summary.c557
-rw-r--r--camel/providers/local/camel-local-summary.h86
-rw-r--r--camel/providers/local/camel-maildir-folder.c227
-rw-r--r--camel/providers/local/camel-maildir-folder.h59
-rw-r--r--camel/providers/local/camel-maildir-store.c198
-rw-r--r--camel/providers/local/camel-maildir-store.h56
-rw-r--r--camel/providers/local/camel-maildir-summary.c751
-rw-r--r--camel/providers/local/camel-maildir-summary.h84
-rw-r--r--camel/providers/local/camel-mbox-folder.c434
-rw-r--r--camel/providers/local/camel-mbox-folder.h63
-rw-r--r--camel/providers/local/camel-mbox-provider.c59
-rw-r--r--camel/providers/local/camel-mbox-store.c169
-rw-r--r--camel/providers/local/camel-mbox-store.h59
-rw-r--r--camel/providers/local/camel-mbox-summary.c880
-rw-r--r--camel/providers/local/camel-mbox-summary.h63
-rw-r--r--camel/providers/local/camel-mh-folder.c212
-rw-r--r--camel/providers/local/camel-mh-folder.h59
-rw-r--r--camel/providers/local/camel-mh-store.c134
-rw-r--r--camel/providers/local/camel-mh-store.h56
-rw-r--r--camel/providers/local/camel-mh-summary.c393
-rw-r--r--camel/providers/local/camel-mh-summary.h53
-rw-r--r--camel/providers/local/libcamellocal.urls3
-rw-r--r--camel/providers/nntp/.cvsignore12
-rw-r--r--camel/providers/nntp/Makefile.am53
-rw-r--r--camel/providers/nntp/camel-nntp-auth.c90
-rw-r--r--camel/providers/nntp/camel-nntp-auth.h43
-rw-r--r--camel/providers/nntp/camel-nntp-folder.c265
-rw-r--r--camel/providers/nntp/camel-nntp-folder.h74
-rw-r--r--camel/providers/nntp/camel-nntp-grouplist.c214
-rw-r--r--camel/providers/nntp/camel-nntp-grouplist.h49
-rw-r--r--camel/providers/nntp/camel-nntp-newsrc.c645
-rw-r--r--camel/providers/nntp/camel-nntp-newsrc.h34
-rw-r--r--camel/providers/nntp/camel-nntp-provider.c110
-rw-r--r--camel/providers/nntp/camel-nntp-resp-codes.h53
-rw-r--r--camel/providers/nntp/camel-nntp-store.c852
-rw-r--r--camel/providers/nntp/camel-nntp-store.h113
-rw-r--r--camel/providers/nntp/camel-nntp-types.h34
-rw-r--r--camel/providers/nntp/camel-nntp-utils.c256
-rw-r--r--camel/providers/nntp/camel-nntp-utils.h42
-rw-r--r--camel/providers/nntp/libcamelnntp.urls2
-rw-r--r--camel/providers/nntp/test-newsrc.c10
-rw-r--r--camel/providers/pop3/.cvsignore10
-rw-r--r--camel/providers/pop3/Makefile.am36
-rw-r--r--camel/providers/pop3/camel-pop3-folder.c354
-rw-r--r--camel/providers/pop3/camel-pop3-folder.h72
-rw-r--r--camel/providers/pop3/camel-pop3-provider.c60
-rw-r--r--camel/providers/pop3/camel-pop3-store.c681
-rw-r--r--camel/providers/pop3/camel-pop3-store.h79
-rw-r--r--camel/providers/pop3/libcamelpop3.urls1
-rw-r--r--camel/providers/sendmail/.cvsignore11
-rw-r--r--camel/providers/sendmail/Makefile.am29
-rw-r--r--camel/providers/sendmail/camel-sendmail-provider.c62
-rw-r--r--camel/providers/sendmail/camel-sendmail-transport.c223
-rw-r--r--camel/providers/sendmail/camel-sendmail-transport.h64
-rw-r--r--camel/providers/sendmail/libcamelsendmail.urls1
-rw-r--r--camel/providers/smtp/.cvsignore10
-rw-r--r--camel/providers/smtp/Makefile.am33
-rw-r--r--camel/providers/smtp/camel-smtp-provider.c62
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c836
-rw-r--r--camel/providers/smtp/camel-smtp-transport.h81
-rw-r--r--camel/providers/smtp/libcamelsmtp.urls1
-rw-r--r--camel/providers/vee/.cvsignore11
-rw-r--r--camel/providers/vee/libcamelvee.urls1
-rw-r--r--camel/string-utils.c206
-rw-r--r--camel/string-utils.h68
-rw-r--r--camel/tests/.cvsignore7
-rw-r--r--camel/tests/Makefile.am4
-rw-r--r--camel/tests/README44
-rwxr-xr-xcamel/tests/data/gendoc.pl65
-rwxr-xr-xcamel/tests/data/genline.pl72
-rwxr-xr-xcamel/tests/data/getaddr.pl32
-rw-r--r--camel/tests/folder/.cvsignore12
-rw-r--r--camel/tests/folder/Makefile.am29
-rw-r--r--camel/tests/folder/README11
-rw-r--r--camel/tests/folder/test1.c59
-rw-r--r--camel/tests/folder/test2.c60
-rw-r--r--camel/tests/folder/test3.c344
-rw-r--r--camel/tests/folder/test4.c73
-rw-r--r--camel/tests/folder/test5.c73
-rw-r--r--camel/tests/folder/test6.c74
-rw-r--r--camel/tests/folder/test7.c74
-rw-r--r--camel/tests/folder/test8.c223
-rw-r--r--camel/tests/folder/test9.c234
-rw-r--r--camel/tests/lib/.cvsignore12
-rw-r--r--camel/tests/lib/Makefile.am13
-rw-r--r--camel/tests/lib/address-data.h93
-rw-r--r--camel/tests/lib/addresses.c51
-rw-r--r--camel/tests/lib/addresses.h5
-rw-r--r--camel/tests/lib/camel-test.c350
-rw-r--r--camel/tests/lib/camel-test.h68
-rw-r--r--camel/tests/lib/folders.c526
-rw-r--r--camel/tests/lib/folders.h20
-rw-r--r--camel/tests/lib/messages.c153
-rw-r--r--camel/tests/lib/messages.h12
-rw-r--r--camel/tests/lib/streams.c244
-rw-r--r--camel/tests/lib/streams.h12
-rw-r--r--camel/tests/message/.cvsignore15
-rw-r--r--camel/tests/message/Makefile.am23
-rw-r--r--camel/tests/message/README5
-rw-r--r--camel/tests/message/test1.c200
-rw-r--r--camel/tests/message/test2.c327
-rw-r--r--camel/tests/message/test3.c199
-rw-r--r--camel/tests/stream/.cvsignore11
-rw-r--r--camel/tests/stream/Makefile.am21
-rw-r--r--camel/tests/stream/README4
-rw-r--r--camel/tests/stream/test1.c119
-rw-r--r--camel/tests/stream/test2.c53
-rw-r--r--camel/tests/stream/test3.c104
291 files changed, 0 insertions, 74330 deletions
diff --git a/camel/.cvsignore b/camel/.cvsignore
deleted file mode 100644
index 3fa8afaa38..0000000000
--- a/camel/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
-*.bb
-*.bbg
-*.da
-*.gcov
diff --git a/camel/CODING.STYLE b/camel/CODING.STYLE
deleted file mode 100644
index 58e9c68bbe..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 initial 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 f212e25d46..0000000000
--- a/camel/ChangeLog
+++ /dev/null
@@ -1,10577 +0,0 @@
-2001-03-01 Dan Winship <danw@ximian.com>
-
- * camel-sasl.c (camel_sasl_challenge): Take a GByteArray as input
- as well. Comment that you can pass %NULL for @token to get the
- initial auth data for mechanisms that are client-initiated.
- (camel_sasl_challenge_base64): Convenience function for protocols
- that use base64-encoded SASL.
- (camel_sasl_authenticated): Implement this... (it was prototyped
- already)
- (camel_sasl_new): Function to take a service name, a mechanism
- name, and a CamelService, and return a CamelSasl for it.
- (camel_sasl_authtype, camel_sasl_authtype_list): Functions to
- return CamelServiceAuthType information about SASL mechanisms, to
- allow providers to deal with them generically.
-
- * camel-sasl-anonymous.c, camel-sasl-plain.c: Update/simplify for
- CamelSasl changes. Both of these are single-round
- (client-initiated) mechanisms, so they don't need to keep state.
- (camel_sasl_plain_new): Removed; use camel_sasl_new instead.
- (Can't get rid of camel_sasl_anonymous_new though...)
-
- * camel-sasl-cram-md5.c: Update/simplify for CamelSasl changes.
- (camel_sasl_cram_md5_new): Removed; use camel_sasl_new instead.
- (cram_md5_challenge): Use md5_get_digest where possible, and
- various other minor simplifications. CRAM-MD5 only has a single
- round, so there's no need to keep track of state. This code is now
- tested (against Cyrus IMAPd) and known to work.
-
- * camel-sasl-kerberos4.h: Update/simplify for CamelSasl changes.
- Make only a single #ifdef HAVE_KRB4. Remove stuff from priv that
- isn't needed between rounds.
- (camel_sasl_kerberos4_new): Removed; use camel_sasl_new instead
- (krb4_challenge): Fix up the logic I broke in my previous "at
- least make it compile" fixes, update to match other changes, and
- remove IMAP-isms that shouldn't be in the generic code. This still
- isn't tested, because we're stuck behind a NAT right now...
-
- * providers/imap/camel-imap-store.c: Add an "authtypes" hash table
- to CamelImapStore recording the supported authtypes.
- (connect_to_server): Record supported authtypes in the authtypes
- hash rather than the capabilities bitmask, since now the IMAP code
- is no longer responsible for keeping track of which authtypes we
- support.
- (query_auth_types): Use camel_sasl_authtype_list to get the
- SASL-supported authtypes.
- (try_auth): New function to try a SASL auth mechanism. Sort of
- formerly imap_try_kerberos_v4_auth.
- (imap_connect): Get rid of the krb4-specific bits and genericize
- them for any SASL authtype.
-
- * providers/imap/Makefile.am: Remove camel-imap-auth.[ch] (moved
- into camel-imap-store.c since it's now constant size) and the
- KRB4_CFLAGS and KRB4_LDFLAGS references.
-
-2001-03-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-sasl-anonymous.c (anon_challenge): Don't base64 encode the
- data, leave that up to the provider to do if it needs to. Also
- save on some memory allocations and stuff.
-
- * camel-sasl-cram-md5.c (cram_md5_challenge): Same here. Also get
- rid of the need for the temp buf as we can just write it to the
- GByteArray.
-
-2001-03-02 Not Zed <NotZed@Ximian.com>
-
- * camel-mime-utils.c (rfc2047_encode_word, rfc2047_decode_word):
- Reconstify variables to match iconv.
-
- * camel-search-private.c (camel_ustrstrcase): Change some
- assertions back into valid returns.
-
-2001-03-01 Dan Winship <danw@ximian.com>
-
- * Makefile.am (libcamel_la_LIBADD, INCLUDES): camel depends on
- krb4 now (where available), for camel-sasl-kerberos4.c
-
- * camel-sasl-kerberos4.[ch]: Make this at least compile. Dunno if
- it works yet.
-
-2001-03-01 Peter Williams <peterw@ximian.com>
-
- * camel-url.c (camel_url_new): Assert url_string != NULL.
-
-2001-02-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * Makefile.am: Added camel-sasl-anonymous.[c,h] to the build.
-
- * camel-sasl-anonymous.[c,h]: new SASL class for ANONYMOUS
-
- * camel-sasl-plain.c (plain_challenge): Oops, have a state for
- setting sasl->authenticated = TRUE;
-
- * camel-sasl-cram-md5.c (cram_md5_challenge): Same here.
-
-2001-02-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-utils.c (header_decode_date): A fix for broken
- mailers that send 2-digit years (ie "Wed, 28 Feb 01
- 04:59:41"). Fixes bug #1633.
-
- * camel-filter-driver.c (camel_filter_driver_filter_folder): Check
- to make sure message isn't NULL.
-
-2001-02-28 Dan Winship <danw@ximian.com>
-
- * camel-remote-store.c (remote_recv_line): If we get back 0 bytes
- from camel_stream_buffer_gets, that means the socket got
- disconnected, so set an exception. (Noticed because of a message
- that crashes our IMAP server when you try to look at it. :)
-
-2001-02-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * Makefile.am: Added camel-sasl*.[c,h] to the build.
-
- * camel-sasl.[c,h]: new "abstract" SASL class
-
- * camel-sasl-kerberos4.[c,h]: new SASL class for KERBEROS_V4
-
- * camel-sasl-cram-md5.[c,h]: new SASL class for CRAM-MD5
-
- * camel-sasl-plain.[c,h]: new SASL class for PLAIN
-
- * providers/imap/camel-imap-auth.c: Removed the base64 functions.
-
- * camel-mime-utils.c (base64_encode_simple): Moved here from
- camel-imap-auth.c
- (base64_decode_simple): Same.
-
-2001-02-26 Dan Winship <danw@ximian.com>
-
- * providers/imap/camel-imap-folder.c (imap_sync): Group messages
- into sets with the same flags and use the IMAP message set
- notation rather than doing a separate STORE FLAGS for each one.
- This cuts the network traffic down to just a handful of commands
- per sync rather than one per changed message. Removed the progress
- notification stuff since it's no longer meaningful and should
- hopefully be unnecessary.
- (imap_copy_message_to): move the former sync_message function
- into here, since it's no longer shared with imap_sync.
-
-2001-02-26 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-utils.c: Made thread-safe and moved to above the test
- code.
-
- * camel-mime-message.c (camel_mime_message_init): Set the
- message_id to NULL.
- (camel_mime_message_finalize): Free the message_id.
- (camel_mime_message_set_message_id): New function to set the
- Message-Id.
- (camel_mime_message_get_message_id): New function to get the
- Message-Id.
- (process_header): Decode the message-id.
-
-2001-02-24 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-store.c (construct): init the vTrash folder here instead
- of in store_init.
- (camel_store_class_init): init service_class->construct.
- (camel_store_finalize): We only need to unref the vtrash folder.
- (init_trash): don't create a vstore since we don't need it.
-
-2001-02-23 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-store.c (camel_store_class_init): init get_trash and
- init_trash.
- (camel_store_init): call the virtual init_trash function.
- (camel_store_finalize): unref the vtrash folder/store if present.
- (camel_store_get_folder): Add the new folder to the vtrash
- vfolder.
- (init_trash): default implementation of init_trash.
- (get_trash): default implementation of get_trash.
-
- * camel-vee-store.c (vee_init_trash): No-op.
- (vee_get_trash): return NULL
-
-2001-02-23 Not Zed <NotZed@Ximian.com>
-
- * camel-folder-summary.c (camel_message_info_new_from_header):
- Doh, cut and paste problem, use mlist not cc.
-
- * camel-folder.c (move_message_to):
- (copy_message_to): If the source folder doesn't support a
- summary, dont try and get the message info from it.
-
- * camel-filter-search.c (check_header): Implement a pseudo-header
- "x-camel-mlist" which just looks up in the message info for a
- match.
-
- * camel-folder-search.c (check_header): Add pseudo-header
- "x-camel-mlist" which can be used to match on mailing list.
-
- * providers/imap/camel-imap-folder.c (imap_sync): Add some
- internal progress reporting.
- (imap_rescan): Do some progress reporting.
-
- * camel-mime-part.c (init_header_name_table): Add the message-id
- to the formatted table, so we dont try and wrap it, and break it.
-
-2001-02-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-folder.h: Remove the 'FIXME: remove because this isn't
- required...' comment for copy_message_to since we now need and
- cherish its existance in the filter-driver code ;-)
-
- * camel-filter-driver.c (camel_filter_driver_filter_message): Now
- takes a UID and CamelFolder arguments (which can be NULL) to allow
- for possible optimizations when copying messages between folders
- on the same store.
- (camel_filter_driver_filter_mbox): Updated (passes NULL for both
- since this case can't be optimized anyway).
- (camel_filter_driver_filter_folder): Updated to pass in the uid
- and folder of the message.
-
-2001-02-22 Dan Winship <danw@ximian.com>
-
- * providers/imap/camel-imap-summary.h (CAMEL_IMAP_SERVER_FLAGS):
- #define this as the set of all IMAP system flags
-
- * providers/imap/camel-imap-folder.c (sync_message): after syncing
- flags, set server_flags to (flags & CAMEL_IMAP_SERVER_FLAGS)
- rather than just "flags", since any other flags won't have been
- synced. Prevents the CAMEL_MESSAGE_ATTACHMENTS flag from getting
- lost.
-
-2001-02-22 Not Zed <NotZed@Ximian.com>
-
- * providers/vee/*: Removed all files.
-
- * camel-private.h: Move camel-vee-private.h stuff into here.
-
- * camel-session.c: Move the vee_provider here, and initialise it
- always as part of a session. The vfolder provider is always
- available.
-
- * providers/Makefile.am: Remove "vee" from the build list, now
- built as part of the main library.
-
- * Makefile.am (libcamelinclude_HEADERS):
- (libcamel_la_SOURCES): Added camel-vee-store.[ch],
- camel-vee-folder.[ch].
-
- * providers/vee/camel-vee-folder.c (vee_folder_build): Removed,
- not used.
- (camel_vee_folder_new): Removed call to build_folder.
- (vee_get_message): Dont try and free the mi if we didn't get it.
-
- * camel-folder.c (camel_folder_change_info_new): Added a hash
- table of what we have in the lists, plus moved private things into
- private pointer.
- (camel_folder_change_info_add_source): Fixed up private accesses.
- (camel_folder_change_info_add_uid): Changed to use a hashtable to
- see if we already have the uid, etc.
- (camel_folder_change_info_remove_uid): Similar.
- (change_info_remove): Likewise.
- (camel_folder_change_info_clear): Fixes for privatisations.
- (camel_folder_change_info_free): "
-
-2001-02-21 Dan Winship <danw@ximian.com>
-
- * providers/imap/camel-imap-folder.c (fetch_medium): Fixes for
- IMAP4-pre-rev1 from Torsten Schulz.
-
-2001-02-20 Not Zed <NotZed@Ximian.com>
-
- * camel-mime-utils.c (mail_list_magic): Take the ^Header: part out
- of the expression, since we look that up ourselves.
- (header_raw_check_mailing_list): When getting the match, get match
- 1, not match 0, we dont want the full string match.
-
- * camel-folder-summary.c (CAMEL_FOLDER_SUMMARY_VERSION): Bumped
- for summary change.
- (message_info_new): Extract the mlist info from the headers.
- (message_info_load): Load mlist from summary.
- (message_info_save): Save mlist to summary.
- (message_info_free): Save the mlist entry.
- (camel_message_info_new_from_header): Extract mailing list header.
- (camel_message_info_dup_to): Copy the mlist entry.
- (camel_message_info_free): Free mlist.
- (message_info_dump): Dump the mlist.
-
- * camel-folder-summary.h: Add an mlist (mailing list) string to
- the summary.
-
-2001-02-19 Not Zed <NotZed@Ximian.com>
-
- * providers/vee/camel-vee-folder.c (camel_vee_folder_new): Added
- flags argument.
- (message_changed): Add support for the auto-update flag, in which
- case we auto-match the content as it changes.
- (camel_vee_folder_init): Remoive "DYNAMIC" optionality
- (camel_vee_folder_finalise): "
- (vee_expunge): As we expunge folders, re-sync their content by
- rerunning the query.
-
- * providers/vee/camel-vee-store.c (vee_get_folder): Pass flags to
- folder new.
-
-2001-02-18 Not Zed <NotZed@Ximian.com>
-
- * providers/vee/Makefile.am (noinst_HEADERS): Added
- camel-vee-private.h.
-
- * providers/vee/camel-vee-private.h: New file to add locking stuff
- for vee folders.
-
- * providers/vee/camel-vee-folder.c (camel_vee_folder_new): Add
- locking around unmatched setup.
- (camel_vee_folder_init): Setup lock.
- (camel_vee_folder_finalise): Free locks.
- (folder_changed): Add locking.
- (unmatched_finalise): "
- (message_changed): "
- (vee_folder_build): "
-
-2001-02-17 Not Zed <NotZed@Ximian.com>
-
- * providers/vee/camel-vee-folder.c (vee_folder_add): Check uid
- doesn't exist before adding it.
-
-2001-02-16 Not Zed <NotZed@Ximian.com>
-
- * providers/vee/camel-vee-folder.c (camel_vee_folder_new): Create
- a new virtual virtual folder UNMATCHED, to store all messages that
- dont match other vfolders.
- (unmatched_folder_changed): When a vfolder issues a changed event,
- use its info to update the unmatched folder info.
- (unmatched_finalise): When a vfolder is finalised, remove any uids
- it has as if we had a removed event for it.
-
-2001-02-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-filter-driver.c (camel_filter_driver_finalise): Thaw the
- defaultfolder.
- (camel_filter_driver_set_default_folder): Thaw the defaultfolder
- we're about to replace, and freeze the new defaultfolder.
-
-2001-02-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/vee/camel-vee-folder.c (camel_vee_folder_new): Emit
- the folder_created signal here.
-
- * providers/local/camel-local-folder.c
- (camel_local_folder_construct): Emit the folder_created signal.
-
- * providers/local/camel-local-store.c (delete_folder): On error,
- free the 'name' string so we don't leak. Also emit the
- folder_deleted signal.
-
- * providers/imap/camel-imap-store.c (subscribe_folder): Emit the
- folder_created signal.
- (unsubscribe_folder): Emit the folder_deleted signal.
-
- * camel-store.c (camel_store_class_init): Added folder_created and
- folder_deleted signal defs.
-
-2001-02-15 Dan Winship <danw@ximian.com>
-
- * camel-folder-thread.c (container_parent_child): Deal with
- out-of-order References headers so they don't cause messages to
- disappear in threaded view.
-
- * providers/imap/camel-imap-folder.c (fetch_medium): IMAP4
- (pre-rev1) doesn't allow BODY.PEEK[], so use RFC822.PEEK instead
- in that case.
-
-2001-02-14 Christopher James Lahey <clahey@ximian.com>
-
- * camel-mime-filter-charset.c (complete, filter),
- camel-mime-utils.c (rfc2047_decode_word, rfc2047_encode_word):
- Changed this code to match the glibc iconv signature.
-
-2001-02-14 Dan Winship <danw@ximian.com>
-
- * camel-store.c (camel_store_create_folder): New method to create
- a folder when you don't know its full name.
-
- * providers/imap/camel-imap-store.c (create_folder): Implement.
- (create_folder): Oops, and fix bug involving namespaces
-
-2001-02-12 Not Zed <NotZed@Ximian.com>
-
- * camel-mime-part.c (init_header_name_table): Add address headers
- to list that we dont fold when writing. The are properly
- formatted as we build them.
- (write_to_stream): DOH, lookup the header name in the formatted
- hash table, not the value, that would never have worked.
-
- * camel-internet-address.c
- (camel_internet_address_encode_address): Changed to take a
- parameter saying how much we've printed so far. We now fold the
- header as we format it. We dont fold addresses, even if they are
- too long, we simply put them on another line by themselves: this
- should make the result more parsable by mailers that can't handle
- split up addresses (which are legal).
- (internet_encode): Fix for changes to above.
-
-2001-02-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/local/camel-local-provider.c: mbox, mh, and maildir
- camel-url's need absolute paths.
-
- * camel-provider.h (CAMEL_URL_PATH_IS_ABSOLUTE): New flaggy flag.
-
-2001-02-08 Dan Winship <danw@ximian.com>
-
- * camel-store.c: Rewrite a bunch. Replace the existing folder
- cache stuff with much simpler code that still handles all the
- existing cases. Now the folder hash table is always created by the
- base class, using hash and compare functions provided by the class
- implementation. (If they are set to NULL, CamelStore won't cache
- folders.) lookup_folder, cache_folder, and uncache_folder are no
- longer class methods, and get_name is gone completely.
-
- (camel_store_get_inbox): Renamed from
- camel_store_get_default_folder, since that wasn't being used, and
- this is what we actually need.
- (camel_store_get_root_folder): Removed, since it's not needed for
- anything given get_folder_info.
-
- * camel-remote-store.c:
- * providers/local/camel-local-store.c:
- * providers/local/camel-mbox-store.c:
- * providers/local/camel-mh-store.c:
- * providers/local/camel-maildir-store.c:
- * providers/nntp/camel-nntp-store.c:
- * providers/pop3/camel-pop3-store.c:
- * providers/vee/camel-vee-store.c: Minor updates for CamelStore
- changes
-
- * providers/imap/camel-imap-store.c (camel_imap_store_class_init):
- Update for CamelStore changes.
- (hash_folder_name, compare_folder_name): treat INBOX
- case-insensitively, otherwise use g_str_hash and g_str_equal.
-
- * camel-service.c (camel_service_construct): Remove
- camel_service_new and create camel_service_construct (as a class
- method) in its place.
-
- * camel-session.c (camel_session_get_service): Use
- camel_object_new and camel_service_construct to replace
- camel_service_new.
-
- * providers/local/camel-local-store.c (construct): Append a '/' to
- the URL path if it doesn't end with one
-
-2001-01-31 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-tcp-stream-ssl.c: Oops, include the camel-tcp-stream-ssl
- header instead of the raw one.
-
-2001-02-07 Not Zed <NotZed@Ximian.com>
-
- * camel-operation.c (camel_operation_start): Changed to push the
- operation into a status stack.
- (camel_operation_progress): Changed to only accept % complete.
- (camel_operation_reset): Free status stack as well.
-
- * providers/pop3/camel-pop3-folder.c (pop3_get_message): Get the
- octect count from the return line, and pass it to
- get_additional_data().
- (pop3_refresh_info): Added status stuff.
-
- * providers/pop3/camel-pop3-store.c
- (camel_pop3_command_get_additional_data): Added a total bytes
- expected argument for progress reporting & fixed callers.
- (camel_pop3_command_get_additional_data): Added progress
- reporting.
-
- * providers/local/camel-mbox-summary.c (mbox_summary_sync_full):
- (mbox_summary_sync_quick):
- (summary_rebuild): Added progress reporting stuff.
-
-2001-02-07 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-search-private.c (CAMEL_SEARCH_COMPARE): Macro for making
- comparisons easy.
- (camel_ustrcasecmp): Use CAMEL_SEARCH_COMPARE and check for
- end-of-string before the utf-8 error check.
- (camel_ustrncasecmp): Same.
- (camel_search_header_match): Strip leading spaces before doing
- anything else. Also use vlen and mlen so as to not need to do 500
- strlen()'s.
- (camel_ustrcasecmp): Don't get_utf8() for the 2 strings in the
- comparison part of the loop because of short-circuit expression
- evaluation. (blame JPR if this is the wrong term!)
- (camel_ustrncasecmp): Same.
-
-2001-02-06 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-search-private.c (utf8_get): Rewrote using unicode_get_utf8().
- (camel_ustrcasecmp): Use unicode_char_t
- (camel_ustrncasecmp): Same.
-
-2001-02-06 Christopher James Lahey <clahey@ximian.com>
-
- * camel-mime-filter-charset.c (complete, filter),
- camel-mime-utils.c (rfc2047_decode_word, rfc2047_encode_word):
- Made these pass char ** as the second parameter to iconv.
-
-2001-02-06 Not Zed <NotZed@Ximian.com>
-
- * camel-session.c: Removed all the camel_cancel stuff.
-
- * camel-stream-fs.c (stream_read): Change to use camel_operation.
- (stream_write): "
-
- * camel-remote-store.c (socket_connect): Change to use
- camel_operation rather than camel_cancel stuff.
- Removed gal include, WTF is that doing there anyway?
-
- * Makefile.am (libcamel_la_SOURCES):
- (libcamelinclude_HEADERS): Added camel-operation.[ch], stuff to
- handle notification and cancellation.
-
- * camel-search-private.c: Removed unwanted header. It was never
- put in for a reason. Stop fixing irrelevant warnings.
-
- (camel_ustrstrcase): Our own strstrcase impl for utf8 strings.
- (camel_ustrcasecmp): Ditto for strcasecmp.
- (camel_ustrncasecmp): And strncasecmp.
- (utf8_get): Simpler interface to utf8 string processing.
- (camel_search_header_match): Use the new things.
-
-2001-02-05 Not Zed <NotZed@Ximian.com>
-
- * camel-folder.c (get_summary): Removed some old variables/a small
- memleak.
- (free_summary): Removed old variables.
-
- * camel-mime-utils.c (header_raw_check_mailing_list): New utility
- function to get the mailing list (if any) that a set of headers
- came from.
-
-2001-02-05 Christopher James Lahey <clahey@helixcode.com>
-
- * camel-stream-fs.c: Added a missing #include.
-
- * camel-search-private.c: Added a missing #include.
-
-2001-02-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-remote-store.c (remote_query_auth_types): Oops. Change
- this too.
-
- * providers/smtp/camel-smtp-transport.c (query_auth_types): Updated.
-
- * providers/nntp/camel-nntp-store.c (nntp_store_query_auth_types):
- Updated.
-
- * providers/pop3/camel-pop3-store.c (query_auth_types): Updated.
-
- * providers/imap/camel-imap-store.c (query_auth_types): Updated.
-
- * camel-service.c (camel_service_query_auth_types): Now takes a
- boolean value to specify whether or not to connect when
- constructing a supported authtype list.
-
-2001-02-05 Not Zed <NotZed@Ximian.com>
-
- * camel-stream-filter.c (do_write): Revert jeff's earlier change,
- the change below is the more-correct fix. All his was doing was
- ignoring the return code & looping actually :)
-
- * camel-stream-fs.c (stream_write): Since we are non-blocking on
- the outgoing fd, keep looping if writing out large blocks, so we
- can keep checking for cancel, etc.
-
-2001-02-02 Not Zed <NotZed@Ximian.com>
-
- * camel-folder-thread.c (camel_folder_thread_messages_new): When
- we drop a fake node, dont skip checking the next in the list.
- (camel_folder_thread_messages_new): Add an assertion check just to
- make sure we dont get any pseudo nodes, and spit a warning if we
- do.
-
-2001-02-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-stream-filter.c (do_write): Make do_write loop until the
- entire buffer is written.
-
-2001-02-02 Not Zed <NotZed@Ximian.com>
-
- * camel-stream-fs.c: Add missing header for cancel check stuff.
-
- * camel-session.c (camel_cancel_cancel): Fix a wrong cast.
-
- * camel-mime-part.c (init_header_name_table): Setup a new table
- header_formatted_table, that lists headers that we dont want to
- fold (they've already been folded).
- (write_to_stream): Check for already formatted headers, and dont
- try and fold them. This is a fix for bug #1097.
-
-2001-02-01 Not Zed <NotZed@Ximian.com>
-
- * camel-mime-utils.c (header_fold): If we are folding, drop the
- space at the end of the line.
-
-2001-01-30 Not Zed <NotZed@Ximian.com>
-
- * camel-remote-store.c (timeout_cb): Remvoe the stream locking
- here. I think this was leading to a deadlock when a keepalive is
- being sent, in imap.
-
-2001-01-29 Not Zed <NotZed@Ximian.com>
-
- * providers/imap/camel-imap-command.c
- (imap_command_strdup_vprintf): Include the terminating NUL in the
- calculated string length. This hit memcheck.
-
-2001-01-25 Not Zed <NotZed@Ximian.com>
-
- * tests/folder/test3.c: Changed the subject search to handle case
- sensitive when it is mixed case.
-
- * Makefile.am (libcamel_la_SOURCES): Added camel-ssearch-private.c
- (noinst_HEADERS): Added camel-search-private.h
-
- * camel-folder-search.c (check_header): New function to do the
- work of the various header checks.
- (search_header_matches):
- (search_header_starts_with):
- (search_header_ends_with):
- (search_header_contains): Use check_header to do the work.
- (build_match_regex): Removed.
-
- * camel-search-private.c (header_soundex): New
- function to match words to phrases using soundex algorithm.
-
- * camel-filter-search.c (soundexcmp): Removed.
- (check_match): Moved to search-private.h
-
-2001-01-24 Not Zed <NotZed@Ximian.com>
-
- * camel-search-private.c (camel_search_build_match_regex): Added
- extra flags, so the same function can be used for
- start/end/whole/partial matches.
- (camel_search_header_match): Convenience function to check a
- single header against all sorts of different matches.
-
- * providers/imap/camel-imap-search.c (imap_body_contains): Fix for
- e_sexp api changes.
-
- * camel-folder-search.c: Fix for e_sexp api changes.
- (search_header_contains): Free args/quit on unknown header.
- (search_header_matches): "
- (search_header_starts_with): "
- (search_header_ends_with): "
- (match_message): Add an exception argument.
- (search_body_contains): Free args/quit on fatal error.
- (message_body_contains): Removed (moved to
- camel-search-private.c), fixed callers.
-
- * camel-filter-search.c: Fix for e_sexp api changes.
- (build_match_regex, message_body_contains): Moved into
- camel-filter-private.c Fixed callers.
- (check_header): moved guts to camel-search-private, and
- changed to use regex's for everything. Just calls that with the
- right args.
- (check_header): GEts the header, decodes it, and checks for
- failure, and whatnot.
- (check_match): Removed.
- (header_soundex): Changed significantly. Now it soundexes each
- word in the header separately, and compares it to the first
- argument.
-
- * tests/folder/test9.c (main): Fix for api changes.
- (main): Added tests to see that invalid match and action
- rules are properly detected.
-
- * camel-filter-driver.c (camel_filter_driver_filter_mbox): Remove
- the 'finished message' bit.
- (camel_filter_driver_filter_message): Remove an accidentally
- checked in debug.
- (camel_filter_driver_filter_message): Fix for e-sexp api changes.
-
-2001-01-23 Dan Winship <danw@ximian.com>
-
- * providers/imap/camel-imap-wrapper.c: Add a lock around the
- delayed loading, so two threads won't try to do it at the same
- time.
-
-2001-01-22 Dan Winship <danw@ximian.com>
-
- * providers/vee/camel-vee-folder.c (camel_vee_folder_new): Set the
- CamelFolder::name to just the base part of the vfolder name (the
- non-query part)
-
-2001-01-23 Not Zed <NotZed@Ximian.com>
-
- * camel-filter-search.c (camel_filter_search_match): Perform error
- checking on parsing/execution.
-
- * camel-folder-search.c (camel_folder_search_execute_expression):
- Perform error handling on search expression.
- (CamelFolderSearchPrivate): Add a camelexception for error
- returns.
- (camel_folder_search_execute_expression): Setup exception pointer.
- (search_match_all): Quit on error.
-
- * providers/imap/camel-imap-summary.c (message_info_load): Removed
- some debug 'warnings', as they should now be displayed at the
- toplevel loader, and just made the code match similar code
- elsewhere.
-
- * providers/local/camel-mbox-summary.c (message_info_load): Error
- handling.
- (message_info_save): more error handling.
-
- * camel-folder-summary.c (message_info_load): Add error handling
- and sanity checking.
- (camel_folder_summary_load): Add error checks.
- (perform_content_info_load): Error + sanity checks.
- (content_info_load): error + sanity checks.
-
- * camel-filter-driver.c (close_folder): avoid /0 by updating after
- we've done the sync.
- (close_folders): Setup the first progress report to start it off.
- (camel_filter_driver_filter_message): Fix a fixme, check errors in
- e_sexp parsing, etc.
-
-2001-01-22 Christopher James Lahey <clahey@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_selected):
- Initialize the value of the variable exists here.
-
-2001-01-22 Not Zed <NotZed@Ximian.com>
-
- * .cvsignore */*/.cvsignore: Added profiling temp
- files.
-
- * camel-folder-thread.c (camel_folder_thread_messages_new): When
- removing phantom nodes, check for the end node too.
-
- * camel-filter-driver.[ch]: Changed status vars to be
- CAMEL_FILTER_STATUS_ etc.
-
-2001-01-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-utils.c (header_param_list_format_append): Make the
- output a little prettier. Okay, so I'm anal...
-
-2001-01-21 Not Zed <NotZed@Ximian.com>
-
- * camel-filter-driver.h: Added an exception to
- CamelFilterGetFolderFunc.
-
- * camel-filter-driver.c (camel_filter_driver_filter_message):
- Remove source parameter, as it is determined elsewhere now.
- (camel_filter_driver_filter_folder): Same here.
- (camel_filter_driver_filter_mbox): And here.
- (do_move): If we cannot open a folder, quit, rather than ignoring
- it.
- (do_copy): Here too.
- (open_folder): Pass an exception into get_folder callback.
- (camel_filter_driver_filter_folder): Report that we're syncing,
- when we are.
- (camel_filter_driver_filter_mbox): And here too.
- (close_folder): And here.
-
-2001-01-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-filter-driver.c (camel_filter_driver_filter_message): Set
- the deleted bit *before* copying to the default folder, this way
- if they are importing mail and have a rule to delete it, it
- doesn't get copied to the default folder un-deleted.
-
-2001-01-19 Dan Winship <danw@ximian.com>
-
- * providers/imap/camel-imap-store.c
- (get_subscribed_folders_by_hand): If LISTing a subscribed folder
- doesn't return a LIST response, just ignore that folder. Yay
- RFC2060.
- (subscribe_folder): add a missing UNLOCK
-
-2001-01-19 Kjartan Maraas <kmaraas@gnome.org>
-
- * providers/smtp/camel-smtp-provider.c: Mark strings for translation.
-
-2001-01-19 Not Zed <NotZed@Ximian.com>
-
- * camel-filter-driver.c (report_status): Add a percentage complete
- indicator to the status thing.
- (camel_filter_driver_filter_mbox): Add percentage complete to
- reporting.
- (camel_filter_driver_filter_folder): Same.
-
-2001-01-18 Dan Winship <danw@ximian.com>
-
- * camel-store.c (camel_folder_info_build): More tweaking... skip
- separator characters after the namespace character. (Gets rid of
- the shell folder registration warning some people have had with
- IMAP)
-
- * providers/imap/camel-imap-store.c (imap_connect): I'm sure there
- was some clever reason I was storing the flags of the folder in
- the hash table rather than just "1", but I don't remember what it
- was now. Anyway, since we only ever test NULL/non-NULL, store 1,
- since flags is sometimes 0.
-
- * providers/imap/camel-imap-folder.c (imap_update_summary): Oops.
- Somewhere in one of the reorgs, the code to add new messages to
- the CamelFolderChangeInfo structure got removed. Fix that.
-
-2001-01-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/imap/camel-imap-summary.c (message_info_load): Add
- some g_warnings() to help debug later if I ever get the segfaults
- I was getting earlier. Can't seem to reproduce them after my
- previous "fix".
-
- * camel-folder-summary.c (camel_folder_summary_load): Undid my
- change here, NotZed said it was wrong and that if it gets a NULL
- mi then it should abort and not continue.
-
-2001-01-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-folder-summary.c (camel_folder_summary_load): Make sure
- that the message-info is non-null before we go accessing inner
- parts of it and/or adding it to the summary array. I may not have
- handled the error correctly, but it does seem to work
- correctly. If NotZed could double-check this it'd be great.
-
- * providers/smtp/camel-smtp-transport.c (get_smtp_error_string):
- New smtp error-code to string mapping function.
- (smtp_connect): Use the new error->string function for reporting
- useful errors.
- (smtp_helo): Same. Also use a case-insensitive strstr for 8BITMIEM
- as it seems Exchange sends back lowercase for that one single SMTP
- extension. Everything else is uppercase. I'm seeing a lack of love
- for that extension by Microsoft dudes...
- (smtp_mail): Use get_smtp_error_string.
- (smtp_rcpt): Same.
- (smtp_data): Same.
- (smtp_quit): Same.
- (smtp_rset): Same.
-
-2001-01-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-folder-summary.c (camel_folder_summary_array): Add an int
- i so this code will compile. Should I be worried about how well
- this code will work? ;-)
-
-2001-01-17 Not Zed <NotZed@Ximian.com>
-
- * camel-folder.c (free_summary): Call
- camel_folder_summary_array_free() to do the work.
- (get_summary): Use camel_folder_summary_array() to get the array
- atomically. These fixes allow folder/test8 to work again, and fix
- a sort of race where the summary size can change while we were
- making a copy of it.
-
- * camel-folder-summary.c (camel_folder_summary_array): Get the
- summary array atomically, so it can't contain empty records.
- (camel_folder_summary_array_free): And free it.
-
- * tests/lib/camel-test.c (die): If we are verbose & in threads,
- then goto sleep so we can debug.
-
- * tests/folder/test8.c (worker): Add a missing pull() for
- comnparing content.
-
- * camel-filter-search.c: Fix the symbol table, so match-all is an
- immediate function, as it should be.
-
- * tests/folder/test9.c (main): New test, tests some filtering
- things.
-
- * tests/message/test3.c (main): Dont use a boundary string with
- spaces in it. Folding can corrupt it. Maybe the folding isn't
- working entirely right, but anyway.
-
- * camel-session.c: Debug out the debug.
-
- * camel-filter-driver.c (camel_filter_driver_filter_folder): Plug
- a messageinfo leak.
-
-2001-01-16 Dan Winship <danw@ximian.com>
-
- Delayed loading of IMAP message parts.
-
- * camel-types.h: typedef CamelMessageInfo and
- CamelMessageContentInfo here
-
- * camel-folder-summary.h: Add a "size" field to
- CamelMessageContentInfo.
-
- * camel-folder-summary.c (camel_folder_summary_content_info_new,
- camel_folder_summary_content_info_free): Renamed and made
- non-static for providers that construct their own content info.
- (content_info_load, content_info_save): load/save size
-
- * camel-data-wrapper.c (camel_data_wrapper_is_offline): New
- function to return if a data wrapper's contents are "offline". (So
- that, for example, we don't make thumbnails of images that haven't
- been loaded off the IMAP server yet.) Defaults to FALSE.
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_selected):
- Fix a bug in re-selecting a folder when messages have been
- expunged from it by another client in the meantime.
- (imap_get_message): Rewrite. If the message is larger than a
- certain size, just create a skeleton message containing
- CamelImapWrappers that will read parts as needed. This way, large
- attachments only need to be downloaded if the user looks at them,
- and multipart/alternative alternatives that aren't used will never
- be downloaded at all.
- (imap_update_summary): Rewrite this a bunch too to make the
- parsing more robust.
-
- * providers/imap/camel-imap-summary.c
- (CAMEL_IMAP_SUMMARY_VERSION): bump.
- (camel_imap_summary_new): Set build_content to TRUE.
- (content_info_load, content_info_save): Only save/load the content
- for messages that have it. (The content info gets created as a
- side effect of imap_get_message.)
-
- * providers/imap/camel-imap-utils.c (imap_parse_body): New routine
- (and helpers) to parse an IMAP 'body' FETCH response and fill in a
- CamelMessageContentInfo from it.
-
- * providers/imap/Makefile.am (libcamelimap_la_SOURCES,
- libcamelimap_la_HEADERS): add camel-imap-wrapper.
-
-2001-01-16 Dan Winship <danw@ximian.com>
-
- * camel-tcp-stream-raw.c (stream_getsockopt, stream_setsockopt):
- * camel-stream-fs.c (stream_read, stream_write):
- * camel-remote-store.c (socket_connect): fcntl(fd, F_GETFL)
- returns the flags as the return value, not via a passed in
- pointer. And F_SETFL looks for an int, not a long, and you have to
- pass it what it's expecting because it's a va_arg parameter. (Yes,
- the man page lies on Linux. But check the UNIX98 spec or the glibc
- source.) Also, fix another bug in socket_connect: if we manage to
- connect right away, unset O_NONBLOCK so it doesn't mess us up
- later.
-
- Fixes a bunch of problems with non-blocking I/O being done in the
- allegedly-blocking case and then returning EWOULDBLOCK.
-
-2001-01-16 Chris Toshok <toshok@ximian.com>
-
- * providers/Makefile.am (NNTP_DIR): set to nntp if ENABLE_NNTP
- (SUBDIRS): use $(NNTP_DIR)
-
-2001-01-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/smtp/camel-smtp-transport.c (smtp_rcpt): Don't check
- errno as it's not being set. Fixes bug #1150.
-
-2001-01-16 Jeffrey Stedfast <fejj@ximian.com>
-
- Ugh, this design is ugly like my butt.
-
- * camel-session.c (camel_session_query_cert_authenticator): New
- function which will be useful when we integrate SSL.
-
- * camel-tcp-stream-ssl.c (ssl_auth_cert): Callback to authenticate
- a certificate.
- (ssl_bad_cert): Callback that gets the reason the certificate is
- bad and then calls camel's cert-authenticator callback to notify
- the user and to allow the user to override the check.
- (stream_connect): Set the URL we expect to connect with and setup
- the auth_cert and bad_cert callbacks.
- (camel_tcp_stream_ssl_new): Now takes a CamelSession and a
- expected_host argument that it will use for certificate
- authentication.
- (camel_tcp_stream_ssl_finalize): Unref the session and free the
- expected_host.
-
-2001-01-16 Not Zed <NotZed@Ximian.com>
-
- * camel-filter-search.c (header_exists): Changed to support
- multiple args (or'd together).
- (header_contains): Cleaned up to match the search code. Why did
- fejj change it? I'll never know.
- (header_matches):
- (header_starts_with):
- (header_ends_with): Big cleanup of fejj's "i'm the cut & paste
- king" code. Also properly handle or'ing of additional args to
- match what the folder-search code should do.
- (check_match): New function which does the annoying matching
- stuff (for header matches).
- (check_header): Similarly, handles or'ing of the matches together.
- (header_contains):
- (header_matches):
- (header_starts_with):
- (header_ends_with): Call check_header to do the actual work.
- (header_soundex): And here too.
- (match_all): Yeah like match-all isn't passed expression results,
- its passed expression terms. Fix this so match-all works like it
- should, by executing the contained expression.
- (message_body_contains): Copied directly from
- camel-folder-search.c, a more robust/faster/simpler body search
- code.
- (mime_part_matches): Removed entirely.
- (handle_multipart): Removed entirely.
- (build_match_regex): Copied from camel-folder-search. Builds a
- set of simple strings into a regex pattern that matches any of
- them (for faster & simpler matching). Expanded to accept regex
- patterns itself, so it can merge them together.
- (body_contains): Use build match/match message to match using a
- built regex.
- (body_regex): Likewise, this time we tell it we're building a
- regex though.
- (header_full_regex): Use build_match_regex to take the drudgery
- out of it, and expand it to handle multiple regex's at once.
- (get_full_header): slightly cleaner (well i dunno, the sprintf
- stuff just got to me).
- (header_regex): Cleaned up to use build_match_Regex too, and to
- properly check types.
- (filter_message_search): Just allocate 'fms' on the stack.
-
- * camel-filter-driver.c (camel_filter_driver_finalise):
- (camel_filter_driver_init):
- (camel_filter_driver_class_init):
- (camel_filter_driver_get_type): Changed from gtk object to camel
- object.
- (camel_filter_driver_add_rule): New function to add a rule to be
- processed in sexp form.
- (camel_filter_driver_init): Init the rules list.
- (camel_filter_driver_finalise): Clear the rules/rules list.
- (camel_filter_driver_filter_message): Scan rules list directly
- rather than creating on the fly.
-
- * Makefile.am (libcamelinclude_HEADERS): Added camel-filter-driver.h
- (libcamel_la_SOURCES): Added camel-filter-driver.c, code taken
- from filter-driver, which can drive, uh, filters based on sexp's.
- (libcamelinclude_HEADERS):
- (libcamel_la_SOURCES): Added camel-filter-search.[ch]
-
- * camel-folder-summary.c (camel_folder_summary_decode_string):
- Chganged len back to be unsigned. And do a simple range check on
- the string value to try and detect corrupted summary files.
-
- * providers/imap/camel-imap-command.c (imap_read_untagged): Handle
- cancelled stream reads with an appropriate exception.
-
- * providers/imap/camel-imap-private.h: Fix the include-once
- macro. Doh, confliced with camel-private.h.
-
- * providers/imap/camel-imap-store.c (imap_store_refresh_folders):
- A copy of camel_remote_store_refresh_folders. We avoid locking
- each folder when we call it though. This should be removed when i
- can work out how to remove the folder lock from this function
- easily.
-
- * camel-stream-fs.c (stream_write): Fix n' argument of select.
- (stream_read): Likewise.
-
- * camel-remote-store.c (socket_connect): Bump the connect timeout
- upto 4 minutes.
- (socket_connect): Oops, fix the 'n' argument of select.
-
- * camel-session.c (camel_cancel_cancel): If we are given no
- cancellation node, then do it for all active ones.
-
-2001-01-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-stream-fs.c (stream_close): If the close() is successful,
- set the fd to -1.
-
- * camel-tcp-stream-raw.c: Removed the disconnect() method.
- (stream_close): If the close() is successful, set the sockfd to
- -1.
-
- * camel-tcp-stream-ssl.c: Removed the disconnect() method.
- (stream_close): If the close() is successful, set the sockfd to
- NULL.
-
- * camel-tcp-stream.c (camel_tcp_stream_disconnect): Removed,
- easier to just use the close() method as it did the same thing
- anyway.
-
-2001-01-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-tcp-stream-raw.c (stream_getsockopt): Updated to be able
- to get the CAMEL_SOCKOPT_NONBLOCKING socket opt.
- (stream_setsockopt): Updated to be able to set the
- CAMEL_SOCKOPT_NONBLOCKING socket opt.
-
-2001-01-15 Peter Williams <peterw@ximian.com>
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Lock
- around the imap_rescan, which needs it.
-
-2001-01-15 Not Zed <NotZed@Ximian.com>
-
- * camel-remote-store.c (socket_connect): A cancellable connection
- routine.
- (remote_send_string): Return cancelled exception if we were.
- (remote_send_stream): "
- (remote_recv_line): "
-
- * camel-stream-fs.c (stream_read): First cut at cancellation
- stuff. Its looking a bit ugly.
-
-2001-01-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-tcp-stream-ssl.c (stream_connect): Uses an SSL socket now
- although there's still a few things missing (like certificate
- handling and such).
-
- * camel.c (camel_ssl_init): A replacement function for
- camel_init() that also initializes SSL.
-
-2001-01-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-tcp-stream-ssl.c (stream_getsockopt): Implemented.
- (stream_setsockopt): Implemented.
-
- * camel-tcp-stream-raw.c (stream_getsockopt): Implemented.
- (stream_setsockopt): Implemented.
-
- * camel-tcp-stream.c (camel_tcp_stream_getsockopt): New method.
- (camel_tcp_stream_setsockopt): Another new method. I think you get
- the idea of what these are for so I won't explain them.
-
-2001-01-14 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-tcp-stream-ssl.[c,h]: New CamelTcpStream class that
- implements nspr sockets and eventually will use nss for
- SSL/TLS. Currently doesn't do any SSL/TLS but it should still
- work. It's functionally equivalent to CamelTcpStreamRaw at the
- moment only it uses nspr i/o.
-
- * camel-tcp-stream-raw.[c,h]: New CamelTcpStream class that
- implements native sockets. Should be usable but may have some bugs
- yet.
-
-2001-01-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-tcp-stream.[c,h]: New abstract class for TCP streams. The
- next step is to write child classes (CamelTcpStreamBSD and
- CamelTcpStreamSSL). The BSD stream will use normal BSD sockets
- while SSL will use Mozilla's NSPR and NSS libraries to do Secure
- Socket Layers which wille ventually replace CamelStreamSSL which I
- just commit'd. Oh well.
-
-2001-01-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-stream-ssl.[c,h]: New stream for handling SSL/TLS
- connections.
-
-2001-01-12 Not Zed <NotZed@Ximian.com>
-
- * camel-folder-thread.c (camel_folder_thread_messages_new):
- Perform a final pass, removing any pseudo nodes we added earlier.
- Quick patch to test the idea.
- (camel_folder_thread_messages_new): Added casts to rmeove some
- warnings for the analites out there.
-
-2001-01-11 Dan Winship <danw@ximian.com>
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_selected):
- Fix a bug in previous commit: don't check for deleted messages if
- there are no known messages in the folder (because it would end up
- sending "FETCH 0 ...").
- (imap_copy_message_to): Fix this up: sync flags to the server
- before copying so that they end up correct in the remote folder.
- And poke the destination folder after doing the copy so it notices
- the new message right away.
- (imap_move_message_to): Call imap_copy_message_to for most of the
- work rather than duplicating the code (since it's much more
- complicated now).
-
-2001-01-11 Dan Winship <danw@ximian.com>
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_selected):
- New function to check for added/deleted messages when re-selecting
- a folder.
- (imap_refresh_info, imap_rescan, imap_update_summary): Various
- locking tweaks that turn out to be irrelevant since command_lock
- is recursive, but whatever.
-
- * providers/imap/camel-imap-command.c (camel_imap_command): When
- selecting a new folder, call camel_imap_folder_selected on it.
-
- * camel-folder.c (camel_folder_copy_message_to): Fix a locking
- problem. (One branch of an if statement was returning with the
- lock still locked.) Also remove the deprecation comments, to match
- move_message_to.
-
-2001-01-10 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/local/camel-local-provider.c: Changed the descriptions
- for mh, mbox, and maildir to be more "user-friendly".
-
-2001-01-10 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-types.h: New header to prevent
- recursive #include problems
-
- * providers/imap/*.h: Replace some #includes with #include
- "camel-imap-types.h", remove typedefs that were moved to
- camel-imap-types.h
-
- * providers/imap/*.c: Add #includes to make up for #includes
- removed from .h files
-
- * providers/imap/Makefile.am (libcamelimapinclude_HEADERS): Add
- camel-imap-types.h
-
-2001-01-10 Dan Winship <danw@helixcode.com>
-
- * camel-store.c (camel_store_sync): New class function, parallel
- to camel_folder_sync. (The default implementation just calls
- camel_folder_sync on each cached folder.)
-
- * providers/imap/camel-imap-store.c (get_folder_info): Call
- camel_store_sync before doing anything else so that the IMAP
- server and Camel are working from the same data. Don't ask the
- server for the unread message count of the current folder, since
- UW will return often-incorrect cached data, and we can calculate
- it without talking to the server anyway.
-
-2001-01-09 Dan Winship <danw@helixcode.com>
-
- Mostly IMAP changes. Use the NAMESPACE extension (where
- available). Deal with servers that don't return LIST flags in
- response to LSUB (like UW) to get rid of the "not a selectable
- folder" error messages in the UI. Take advantage of the \Marked
- and \Unmarked flags to try to speed up the folder scan by not
- doing STATUS on unmarked folders. Some further tweaks on the shape
- of the resulting folder tree in various situations...
-
- * camel-store.h: Remove the (read) message_count, since nothing
- uses it, and we can speed up IMAP a bit this way.
-
- * camel-store.c (camel_folder_info_build): Redo this a bit to make
- it more useful for IMAP since that's the only thing that uses it.
-
- * camel-remote-store.c (camel_remote_store_connected): Public
- function to check if the store is connected, and try to connect it
- if it's not.
- (remote_send_string, remote_send_stream, remote_recv_line): Use
- that.
-
- * providers/imap/camel-imap-store.c (camel_imap_store_finalize):
- fix up for changes.
- (camel_imap_store_init): Initialize subscribed_folders to NULL
- rather than an empty hash table.
- (imap_connect): Get the list of subscribed folders here. If the
- server doesn't claim that any of them are either Marked or
- Unmarked, then assume that it doesn't do that for LSUB and
- remember that for later. If the server supports the NAMESPACE
- extension and the user didn't specify a namespace, use the
- server-provided one.
- (imap_disconnect): Free the list of subscribed folders, and the
- namespace.
- (get_folder): check camel_remote_store_connected
- (get_folder_info): check camel_remote_store_connected. Add a bunch
- of new cleverness. If we learned that the server doesn't do LSUB
- usefully, do a bunch of LISTs by hand. Then, if we're getting
- unread counts, only do it for folders that weren't listed as
- Unmarked. Also, deal with namespaces that end with the separator
- character, and update for changes to camel_folder_info_build.
- (folder_subscribed): Add a g_return_val_if_fail.
- (subscribe_folder, unsubscribe_folder): check
- camel_remote_store_connected.
-
- * providers/nntp/camel-nntp-store.c (build_folder_info,
- build_folder_info_from_grouplist, nntp_store_get_folder_info):
- Don't fill in message_count since it doesn't exist any more.
-
-2001-01-09 Dan Winship <danw@helixcode.com>
-
- Kill off a long-hated Camel kludge: "empty" URLs and
- query_auth_types_generic.
-
- * camel-url.c: Remove "empty" from CamelURL.
- (camel_url_new): No longer set it.
- (camel_url_to_string): Treat "" as equivalent to NULL for
- authmech. (Unrelated change, but it simplifies some stuff with the
- new config dialog.)
-
- * camel-service.c (camel_service_new): Remove url->empty check: if
- the URL isn't valid, we don't create the service.
- (camel_service_query_auth_types): No longer need to switch between
- generic and connected variants.
-
- * providers/smtp/camel-smtp-transport.c (query_auth_types):
- * providers/pop3/camel-pop3-store.c (query_auth_types):
- * providers/nntp/camel-nntp-store.c (nntp_store_query_auth_types):
- * providers/imap/camel-imap-store.c (query_auth_types):
- * camel-remote-store.c (remote_query_auth_types): Remove generic
- version, rename connected version.
-
-2001-01-06 Not Zed <NotZed@HelixCode.com>
-
- * providers/vee/camel-vee-folder.c (vee_folder_build_folder): Dont
- try and unref a messageinfo that wasn't there, and use the right
- free function too. Modified patch from Iain.
- (vee_move_message_to): New method, call the real folders'
- move_message_to method.
-
-2001-01-04 JP Rosevear <jpr@helixcode.com>
-
- * tests/lib/Makefile.am: fix includes for compilation
-
- * tests/message/Makefile.am: Build test3 again
-
- * tests/message/test2.c: Kill warnings with header includes
-
- * tests/message/test3.c: ditto
-
- * tests/lib/streams.c: ditto
-
- * tests/lib/camel-test.c: ditto
-
- * tests/lib/messages.c: ditto
-
- * tests/lib/folders.c: ditto
-
-2001-01-04 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_rescan): Fix two
- problems in figuring out server-expunged messages.
-
-2001-01-04 Not Zed <NotZed@HelixCode.com>
-
- * camel-folder.c (thaw): If we have a lot of messages changed,
- promote it to a folder changed event.
-
-2000-01-03 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-folder-search.c (search_header_matches): Implemented.
- (search_header_exists): Implemented.
- (search_header_starts_with): Implemented.
- (search_header_ends_with): Implemented.
-
-2001-01-03 Christopher James Lahey <clahey@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_new):
- Initialize the exists variable so that we don't do random things
- if the imap server misbehaves.
-
-2000-12-29 Not Zed <NotZed@HelixCode.com>
-
- * camel-folder.c (camel_folder_move_message_to): REmove warning,
- this isn't really deprecated, sigh.
-
- * camel-mime-utils.c (header_fold): Comment out some debug.
-
-2001-01-02 Christopher James Lahey <clahey@helixcode.com>
-
- * providers/maildir/, providers/mbox/, providers/mh/: Removed
- these directories since they're unused.
-
-2001-01-02 Dan Winship <danw@helixcode.com>
-
- IMAP randomness.
-
- * providers/imap/camel-imap-stream.[ch]: Remove. To be replaced.
-
- * providers/imap/Makefile.am (libcamelimapinclude_HEADERS): Remove
- camel-imap-stream.h
-
- * providers/imap/camel-imap-utils.c (imap_parse_flag_list): Take a
- char ** instead of char *, to return the position at the end of
- parsing like the string parsing functions.
- (imap_parse_string_generic): New function to parse a string,
- nstring, or astring.
- (imap_parse_nstring, imap_parse_astring): Now macros
- (imap_parse_string): Added
-
- * providers/imap/camel-imap-folder.h: Remove the "exists" field
- from CamelImapFolder.
-
- * providers/imap/camel-imap-folder.c: Remove unused include of
- camel-imap-stream.h.
- (camel_imap_folder_init): Remove no-longer-relevant summary
- initialization.
- (camel_imap_folder_new): Update for imap_parse_flag_list change,
- exists removal, and imap_rescan.
- (imap_rescan): New function that does most of the work of the old
- imap_refresh_info, but taking "exists" as an argument instead of
- getting it from the folder. Also calls camel_imap_folder_changed
- to do the summary updating and signalling, rather than duplicating
- that code.
- (imap_refresh_info): Just call imap_rescan (using the size of the
- folder summary as "exists").
- (imap_update_summary): Update for imap_parse_flag_list change
- (camel_imap_folder_changed): Update for "exists" change.
-
-2001-01-02 Dan Winship <danw@helixcode.com>
-
- * camel-mime-utils.c (header_content_type_simple): New function to
- return just foo/bar with no parameters.
-
- * camel-data-wrapper.c (get_mime_type): Use
- header_content_type_simple rather than header_content_type_format.
-
-2000-12-28 Dan Winship <danw@helixcode.com>
-
- * gmime-content-field.[ch]: Remove this. It was only a thin
- wrapper around struct _header_content_type anyway, and didn't
- match the naming scheme of anything else.
-
- * Makefile.am: Remove gmime-content-field.[ch]
-
- * camel.h: Remove gmime-content-field.h
-
- * camel-types.h: Add CamelContentType as a typedef for struct
- _header_content_type (especially for use outside of camel).
-
- * camel-multipart.c:
- * camel-mime-part.c:
- * camel-mime-message.c:
- * camel-folder-summary.c:
- * camel-folder-search.c:
- * camel-data-wrapper.[ch]: Use CamelContentType and
- header_content_type_* functions rather than the GMime stuff.
-
- * camel-mime-part-utils.c:
- * camel-medium.c: Remove unused gmime-content-field.h include.
-
-2000-12-27 Dan Winship <danw@helixcode.com>
-
- * providers/pop3/camel-pop3-store.c (connect_to_server): Fix the
- APOP check to not crash on servers that don't return any
- information on the +OK greeting line.
-
-2000-12-24 Not Zed <NotZed@HelixCode.com>
-
- * providers/imap/camel-imap-search.c (imap_body_contains): Lock
- the command channel while searching.
- (imap_body_contains): If performing a whole uid search, then add
- references to our own summary items, dont look it up in the
- folder. This way they can't vanish unexpectedly.
-
- * providers/imap/camel-imap-folder.h (CamelImapFolder): Added a
- private field.
- (CamelImapFolder): Removed summary again from here.
-
- * providers/imap/camel-imap-private.h: Added lock for imap
- searches.
-
- * Merge from camel-mt-branch.
-
- * providers/imap/camel-imap-folder.c (imap_update_summary): Merge
- fix, use the folder->summary.
- (imap_get_message_flags, imap_set_message_flags,
- imap_get_message_user_flag, imap_set_message_user_flag): Removed
- again.
- (camel_imap_folder_init): Setup private data/lock.
- (imap_finalize): Free private data/search lock.
- (imap_search_free): Lock the search_lock.
- (imap_search_by_expression): Lock the search lock when using the
- search object. Also copy/ref hte summary, rather than getting it
- directly.
- (imap_refresh_info): Free any info lookups. Use folder->summary
- not imap_folder->summary. And lock around commands.
- (camel_imap_folder_changed): Use folder->summary again.
- (camel_imap_folder_changed): Make sure we unref the summary lookup.
-
-2000-12-22 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-store.c (get_folder_info): When
- getting the top-level folder list, include INBOX even if it's not
- subscribed. Don't show subscribed folders outside of the given
- namespace. Do a better job of pruning the namespace from the
- returned folder tree.
-
-2000-12-21 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-search.c: New CamelFolderSearch
- subclass that just reimplements body_contains (using the IMAP
- SEARCH command). All other kinds of searching are done against the
- local summary.
-
- * providers/imap/camel-imap-folder.c (imap_search_by_expression):
- Use a CamelImapSearch to do searching.
-
- * providers/imap/camel-imap-utils.c (imap_translate_sexp, etc): No
- longer needed.
-
- * camel-folder-search.h: Add missing CAMEL_FOLDER_SEARCH_TYPE
- #define
-
-2000-12-21 Dan Winship <danw@helixcode.com>
-
- * camel-stream-buffer.c (camel_stream_buffer_gets): Update the
- doc comment: since it always NUL-terminates the buffer, it reads
- at most @max-1 bytes, not @max.
-
- * camel-remote-store.c (remote_recv_line): Fix the "did
- camel_stream_buffer_gets fill the whole buffer" check. Fixes a bug
- when reading lines longer than 1024 characters (eg, IMAP SEARCH
- responses in very large folders).
-
-2000-12-19 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_refresh_info): Oops.
- Don't do "FETCH 1:0" when the folder is empty.
- (imap_protocol_get_summary_specifier): Request RFC822.SIZE too.
- (imap_update_summary): Parse RFC822.SIZE and add it to the
- summary.
-
-2000-12-18 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-summary.c: Add "guint32 server_flags"
- to CamelImapMessageInfo to keep track of the last known message
- flag state on the server.
- (message_info_save, message_info_load): Save/load the
- server_flags.
-
- * providers/imap/camel-imap-folder.c: Make this use
- CamelFolderChangeInfo and emit folder_changed notifications as it
- gets them rather than only on refresh_info.
- (imap_refresh_info): Notice flags that get cleared on the server
- as well as flags that get set.
- (imap_update_summary): Remove a comment that never actually
- applied to the committed code.
-
-2000-12-15 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-command.c (camel_imap_command): Change
- the semantics of fmt: Now %S (capital S) means an IMAP "string",
- (which can be sent as either a quoted string or a literal). If
- the server supports LITERAL+, these will be sent as extended
- literals (which don't require any special escaping). Otherwise
- they'll be sent as quoted strings (and it now properly deals with
- " or \ in the string).
- (imap_command_strdup_vprintf): Utility routine that does the real
- work for the functionality mentioned above.
-
- * providers/imap/camel-imap-utils.c (imap_quote_string): Turns a
- string into a proper IMAP "quoted string".
-
- * providers/imap/camel-imap-store.c:
- * providers/imap/camel-imap-folder.c: Use %S instead of "%s" where
- appropriate.
-
-2000-12-22 Not Zed <NotZed@HelixCode.com>
-
- * camel-folder-summary.c (GLOBAL_INFO_UNLOCK): Doh, cut and paste
- victim again, call unlock instead of lock!
- (summary_assign_uid): Unlock around trying to get a new uid, if we
- have a clash.
-
-2000-12-21 Not Zed <NotZed@HelixCode.com>
-
- * tests/folder/Makefile.am (TESTS): reenabled the tests here.
-
- * providers/nntp/camel-nntp-newsrc.c (CamelNNTPNewsrc): Add a
- lock. Made completely mt-safe. Sigh, this is all so i can
- support snooping of the set_flags stuff inside camel-nntp-folder,
- since i've removed the global folder lock from all of the other
- folder summary operations.
- (camel_nntp_newsrc_read_for_server): Setup lock.
- (camel_nntp_newsrc_get_highest_article_read): Lock internal access.
- (camel_nntp_newsrc_get_num_articles_read):
- (camel_nntp_newsrc_mark_article_read):
- (camel_nntp_newsrc_mark_range_read):
- (camel_nntp_newsrc_article_is_read):
- (camel_nntp_newsrc_group_is_subscribed):
- (camel_nntp_newsrc_unsubscribe_group):
- (camel_nntp_newsrc_subscribe_group):
- (camel_nntp_newsrc_get_subscribed_group_names):
- (camel_nntp_newsrc_get_all_group_names): "
- (camel_nntp_newsrc_write_to_file): Lock internal accesses.
- (camel_nntp_newsrc_write): Lock around diry stuff.
-
- * providers/local/camel-maildir-summary.c (maildir_summary_check):
- Lock around our internal poking of the summary hashtable/array.
- (maildir_summary_sync): And the same here too.
-
- * camel-folder-summary.c: Moved the summaryprivate data into
- camel-private.h. Only needed for the locks really.
- (camel_folder_summary_init): Setup locks.
- (camel_folder_summary_set_filename): Lock.
- (camel_folder_summary_index): lock
- (camel_folder_summary_uid): Lock
- (camel_folder_summary_next_uid): "
- (camel_folder_summary_set_uid): "
- (camel_folder_summary_load): Lock around whole load. Hrm,
- probably not required.
- (camel_folder_summary_save): Lock around whole save, this is
- reqwuired, unless we ref/copy the whole list first, and i couldn't
- be bothreed.
- (camel_folder_summary_add): lock
- (summary_assign_uid): Lock around internal accesses.
- (camel_folder_summary_info_new_from_parser): Lock around filtr stuff.
- (camel_folder_summary_info_ref): Add locking. Could probably use
- its own lock?
- (camel_folder_summary_touch): Add locking, likewise.
- (camel_folder_summary_clear): Lock. If the preiovus two are
- changed, then so this will need mroe locking.
- (camel_folder_summary_info_free): Lock around refcounting.
- (camel_folder_summary_remove): Locking.
- (camel_folder_summary_remove_uid): Lock ref, unlock, unref. Also
- fixed a bug that would have made this never work, freeing the key,
- which isn't allocated.
- (camel_folder_summary_remove_index): lock, ref, unlock unref also.
- (camel_message_info_ref): Lock using a separate global lock, since
- we have no context here.
- (camel_message_info_free): Here too.
- (content_info_alloc): Use an alocation lock here. avoids races
- with setting up content_info_chunks, etc.
- (camel_folder_summary_info_new): And here too.
- (camel_folder_summary_load): Changed to use a differnet lock for
- loading/saving.
- (camel_folder_summary_init): Doh, i do need a reflock afterall,
- set one up.
- (camel_folder_summary_finalize): Free it.
- (camel_folder_summary_index): Add a reflock.
- (camel_folder_summary_uid): And here too.
- (camel_folder_summary_info_free): Use reflock instead of
- summary_lock.
- (camel_folder_summary_info_ref): Likewise.
- (camel_folder_summary_remove_uid): Add reflocking.
- (camel_folder_summary_remove_index): And here too.
-
- * providers/vee/camel-vee-folder.c (camel_vee_folder_new): Setup a
- summary object.
- (vee_folder_build): Build each item into the real summary object.
- (vee_folder_add, vee_folder_add_uid, vee_folder_add_change): New
- functions to add a single record to the vfolder summary.
- (vee_folder_build_folder): Use a real summary.
- (vee_get_uids): Removed, use default impl.
- (vee_free_message_info): "
- (vee_get_message_info): "
- (vee_get_summary): "
- (vee_get_unread_message_count): "
- (vee_get_message_count): "
- (vee_sync): Make vee-folder-sync sync all subordinate folders.
- Well i dont think this is right, but enough peopl ehave aksed for
- it.
- (vee_expunge): Same for expunge.
- (vee_set_message_flags): Call parent class, then mirror flags to
- subfolder.
- (vee_get_message_user_flag): Removed, we just use the default
- impl, and our flags should always match.
- (vee_set_message_user_flag): Snoop the set and set on subfolder.
- (vee_get_message_flags): Removed, jsut use parent impl, assume our
- copy matches the real ones.
- (get_real_message): Removed. We sort ofneed to keep the
- summaryitem refed while we use it, so this doesn't make as much
- sense as it did once.
- (camel_vee_folder_finalise): Unhook listening events as we unref
- folders.
- (camel_vee_folder_new): Set the summary messageinfo data size
- properly.
- (vfolder_remove_match): Fixed for summary change.
- (folder_changed): ditto. Also stopped changed items from being
- re-searched and possibly removed. Might have to resort to the old
- whole-search idea again.
- (message_changed): Similarly. Might be easier just not to bother
- with a whole search.
-
- * providers/vee/camel-vee-folder.h: Removes summary
- hashtable/array, and use a real summary object. Sigh, more work.
-
- * providers/nntp/camel-nntp-folder.c (nntp_folder_sync): Move
- summary to folder object.
- (nntp_folder_get_message_count): Removed, use default impl.
- (nntp_folder_set_message_flags): Call parent impl to do the work,
- but snoop for newsrc.
- (nntp_folder_get_uids): Removed, use default impl.
- (nntp_folder_get_summary): "
- (nntp_folder_get_message_info): "
- (nntp_folder_free_message_info): "
- (camel_nntp_folder_new): moved summary to folder class
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_init):
- Move summary to folder object.
- (camel_imap_folder_new): "
- (imap_finalize): No longer unref the summary (or infact, do
- anything else either).
- (imap_refresh_info): move summary to folder object.
- (imap_sync): "
- (imap_get_message_count): Removed, use default impl.
- (imap_get_unread_message_count): "
- (imap_get_uids): "
- (imap_get_summary): "
- (imap_free_summary): "
- (imap_get_message_info): "
- (imap_free_message_info): "
- (imap_get_message_flags): "
- (imap_set_message_flags): "
- (imap_get_message_user_flag): ", this changes functionality, but
- only by providing non-permanent flags.
- (imap_set_message_user_flag): "
- (imap_update_summary): move summary to folder object, and use
- camel_folder_summary_info_new_from_header, instead of calling the
- virtual function directly.
-
- * providers/local/camel-maildir-folder.c (maildir_append_message):
- move summary to folder object, again.
- (maildir_get_message): "
-
- * providers/local/camel-mh-folder.c (mh_append_message): move
- summary to folder object.
- (mh_get_message): "
-
- * providers/local/camel-mbox-folder.c (mbox_append_message): Move
- summary to folder object
- (mbox_get_message): "
- (mbox_set_message_user_flag): We need our own copy of this, sigh,
- so we can track if the xev needs a rewrite (probably, its only a
- guide anyway).
- (mbox_set_message_user_tag): Same same with this one.
- (camel_mbox_folder_class_init): Link in these new virtual functions.
-
- * providers/local/camel-local-folder.h (CamelLocalFolder): removed
- summary.
-
- * providers/local/camel-local-folder.c (local_get_message_count):
- (local_get_unread_message_count):
- (local_get_uids):
- (local_get_summary):
- (local_free_summary):
- (local_get_message_info):
- (local_free_message_info):
- (local_get_message_flags):
- (local_set_message_flags):
- (local_get_message_user_flag):
- (local_set_message_user_flag):
- (local_get_message_user_tag):
- (local_set_message_user_tag): Removed, all now use default
- implementation.
- (camel_local_folder_class_init): Removed overrides.
- (local_init): Clear folder->summary.
- (local_finalize): move summary to folder.
- (camel_local_folder_construct): "
- (local_sync): "
-
- * camel-folder.c (free_summary): Provide a real impl.
- (get_summary): "
- (free_uids): "
- (get_uids): "
- (free_message_info): "
- (get_message_info): "
- (set_message_user_tag): "
- (get_message_user_tag): "
- (set_message_user_flag): "
- (get_message_user_flag): " Sigh, the last so far.
- (get_message_flags): Sigh, 1 more afterall.
- (get_unread_message_count): And and this.
- (get_message_count): and this!
- (set_message_flags): Sigh, and this.
- (camel_folder_finalize): Unref the summary if we have it.
- (camel_folder_free_uids): Remove locking.
- (camel_folder_get_message_flags): Remove locks, since the summary
- is now mt-safe.
- (camel_folder_set_message_flags): "
- (camel_folder_get_message_user_flag): "
- (camel_folder_set_message_user_flag): "
- (camel_folder_get_message_user_tag): "
- (camel_folder_set_message_user_tag): "
- (camel_folder_get_message_info): "
- (camel_folder_free_message_info): "
- (camel_folder_get_uids): "
- (camel_folder_free_summary): "
- (camel_folder_get_unread_message_count): "
- (get_unread_message_count): Check we got info, no big deal, but
- the summary might change while we're counting, and upset the count
- slightly.
- (camel_folder_get_message_count): Remove locks.
-
- * camel-folder.h (struct _CamelFolder): Added CamelFolderSummary
- to the base folder object. Sigh, this is going to be a lot of
- work ...
-
- * camel-service.c (camel_service_init, finalise): changed
- connect_lock to be recursive e_mutex.
-
- * camel-remote-store.c (camel_remote_store_init, finalise): Changed
- stream_lock to recursive e_mutex.
-
- * camel-private.h (RemoteStorePrivate, ServicePrivate): Use
- recursive mutexes for connect_lock & stream_lock. Ick. Because
- of the imap code.
-
- * providers/imap/camel-imap-private.h: Change the command_lock to
- be an EMutex.
-
- * providers/imap/camel-imap-store.c (connect_to_server): Removed
- the command_lock stuff. If we are just connected again, it should
- be safe to assume we have exclusive access at this point without
- it (and yes, removes a deadlock).
- (imap_create): Remove a lock that wasn't even supposed to be
- there.
- (camel_imap_store_finalize, init): g_mutex->e_mutex(E_MUTEX_REC).
- Use a recursive mutex since the imap code is multiply recursivly
- calling some functions (sigh, it would be nice to fix this).
-
-2000-12-20 Not Zed <NotZed@HelixCode.com>
-
- * camel-folder.c (folder_changed): Change the locks to inside the
- if. Stops a deadloc,k and we dont need a lock to read a value.
- (message_changed): Likewise.
-
- * camel.c (camel_init): Blah, comment out g_thread_init, leave it
- to the caller, since it can only ever be done once.
-
- * camel-folder-thread.c (camel_folder_thread_messages_new): Ref
- and save the folder in the thread return. Also get the summary
- once, and access that for the messageinfo's. Added bonus that now
- threads should come out in a similar order. We need to do this so
- that the messageinfo's dont get unref'd under us, and using the
- summary directly simplifies memory management.
- (camel_folder_thread_messages_destroy): Free the summary/unref the
- folder.
-
- * camel-folder-thread.h: Add a folder to CamelFolderThread struct.
-
-2000-12-19 Not Zed <NotZed@HelixCode.com>
-
- * providers/imap/camel-imap-utils.c (imap_translate_sexp): Unref
- using e_sexp_unref, since it is no longer an object.
-
- * tests/lib/camel-test.c: Added a global lock, and made it
- thread-aware.
-
- * camel-exception.c: Add a global lock. Not sure its really
- needed here, but it doesn't really hurt.
- (camel_exception_clear): Lock around access.
- (camel_exception_set): Same.
- (camel_exception_setv): "
- (camel_exception_xfer): "
-
- * providers/local/Makefile.am (noinst_HEADERS): Added, for
- camel-local-private.h
-
- * camel-folder.c (camel_folder_search_by_expression): Removed
- locking here, now upto the implementing class to lock.
- (camel_folder_search_free): Removed the folder lock here too, for
- consistency really, and the locking probably wasn't needed.
-
- * providers/local/camel-local-folder.c (local_get_summary):
- Changed to copy/ref the summary items.
- (local_free_summary): Unref the summary items/free the array.
- (local_get_unread_message_count): Free info lookups.
- (local_search_by_expression): Perform more fine-grained locking,
- and dont lock the whole folder while searching, just the search
- object. Dum de dum, it *would* be possible to not even have to
- lock the search, by using our own copy of the search object each
- time. Could be investigated.
- (local_init): Init priaate data/lock.
- (local_finalize): Free private data/lock.
- (local_search_free): Also lock around the search object, because
- it accesses global data inside.
-
- * README.mt: Some info about the mt code development.
-
- * camel-folder-search.c (match_message): Put in a warning, this
- plain deadlocks so far, but i'm going to bed now.
- (camel_folder_search_finalize): Use e_sexp_unref() since its no
- longer an object.
-
- * camel-session.c (camel_session_init): Init private data/lock.
- (camel_session_finalise): Free private data/lock.
- (camel_session_register_provider): Lock hash insert.
- (service_cache_remove): Lock.
- (camel_session_list_providers): "
- (camel_session_get_service): Lock the whole function.
-
- * camel-session.h (struct _CamelSession): Added private data.
-
- * providers/imap/camel-imap-store.c (camel_imap_store_init): Setup
- private data.
- (camel_imap_store_finalize): Free private data.
- (connect_to_server): Lock around command calls. I dont think its
- needed, but it shouldn't hurt either.
- (imap_connect): Lock around command calls. Again, I don think it
- is needed, but wont hurt.
- (imap_disconnect): ditto for this one.
- (imap_create): Lock around command.
- (get_folder): "
- (get_folder_info): "
- (subscribe_folder): "
- (unsubscribe_folder): "
- (imap_keepalive): "
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Lock
- around calling a command.
- (imap_refresh_info): Likewise.
- (imap_sync): "
- (imap_append_message): "
- (imap_copy_message_to): "
- (imap_move_message_to): "
- (imap_get_message): "
- (imap_update_summary): "
- (imap_search_by_expression): ", also minor logic cleanup.
- (imap_get_summary): Copy/ref the summary items.
- (imap_free_summary): And free it now too.
-
- * providers/imap/camel-imap-auth.c (imap_try_kerberos_v4_auth):
- Lock the command stream for the command session.
-
- * providers/imap/camel-imap-private.h: Private (locking info)
- stuff for imap provider.
- (CAMEL_IMAP_STORE_UNLOCK): Fix to call unlock, rather than lock!
-
- * camel-service.c (camel_service_query_auth_types): Lock also for
- the connection here, incase the service needs to connect.
-
- * camel-remote-store.c (camel_remote_store_init): Init private
- data/lock.
- (camel_remote_store_finalise): Readded, free private data/lock.
- (remote_send_stream): Changed to return the number of bytes
- written, like a good little stream function should.
- (camel_remote_store_send_string): Lock for stream access.
- (camel_remote_store_send_stream): Same here.
- (camel_remote_store_recv_line): And here.
- (camel_remote_store_refresh_folders): Lock the store for cache
- access.
- (timeout_cb): Lock for stream access.
-
-2000-12-18 Not Zed <NotZed@HelixCode.com>
-
- * camel-service.c (camel_service_init): Init private data.
- (camel_service_finalise): Free private data.
- (camel_service_connect): Lock around connection access.
- (camel_service_disconnect): "
-
- * camel-service.h (struct _CamelService): Added private field.
-
- * camel-store.c (camel_store_init): Init private data/lock.
- (camel_store_finalize): Free private data/lock.
- (camel_store_get_folder): Lock internal calls.
- (camel_store_delete_folder): "
- (camel_store_rename_folder): "
- (camel_store_get_root_folder): "
- (camel_store_get_default_folder): "
- (camel_store_get_folder_info): "
- (camel_store_folder_subscribed): "
- (camel_store_subscribe_folder): "
- (camel_store_unsubscribe_folder): "
- (lookup_folder): Lock accesses to the folder cache.
- (cache_folder): "
- (uncache_folder): And here too.
-
- * camel-store.h (struct _CamelStore): Added a private field.
-
- * Makefile.am (noinst_HEADERS): Add camel-private.h. There is a
- comment in that header as to why it ins't installed.
-
- * camel-private.h: New header for private data, that subclasses
- can get to.
-
- * tests/lib/camel-test.c (camel_test_init): If we do have threads
- enabled already, dont call g_thread_init().
-
- * tests/lib/folders.c (test_folder_counts): Add free of info.
- (test_folder_message): And here too.
-
- * providers/local/camel-maildir-summary.c (remove_summary): Free
- info.
- (maildir_summary_check): Free info lookups.
-
- * providers/local/camel-mh-summary.c (message_info_new): Removed,
- didn't add value.
- (remove_summary): free info after being used.
- (mh_summary_check): Free info lookups.
- (mh_summary_sync): and here too.
-
- * providers/local/camel-mbox-summary.c (summary_update): Free info
- lookups.
- (mbox_summary_sync_full): Likewise.
- (mbox_summary_sync_quick): And here.
- (mbox_summary_sync): ... and here.
-
- * providers/local/camel-maildir-folder.c (maildir_get_message):
- Free messageinfo lookups.
-
- * providers/local/camel-mh-folder.c (mh_get_message): Free
- messageinfo lookups.
-
- * providers/local/camel-mbox-folder.c (mbox_get_message): Free
- messageinfo lookups.
-
- * providers/local/camel-local-summary.c
- (message_info_new_from_message): Removed, since it wasn't doing
- anything useful.
- (message_info_new_from_parser): Same. And some other dead code.
-
- * providers/local/camel-local-folder.c (local_get_message_info):
- deconstify.
- (local_free_message_info):new func to free info.
- (local_get_uids):
- (local_get_message_flags):
- (local_set_message_flags):
- (local_get_message_user_flag):
- (local_set_message_user_flag):
- (local_get_message_user_tag):
- (local_set_message_user_tag): Free all info lookups.
- (local_expunge): Dont call camel_folder_* functions, to avoid a deadlock.
-
- * providers/nntp/camel-nntp-folder.c
- (nntp_folder_get_message_info): deconstify.
- (nntp_folder_free_message_info): Free summary item.
- (nntp_folder_get_message_flags): Free summary lookup.
- (nntp_folder_set_message_flags): and here.
- (nntp_folder_get_uids): And here.
-
- * providers/imap/camel-imap-auth.c: Make base64_*_simple optional
- with the HAVE_KRB4 flag.
-
- * providers/imap/camel-imap-folder.c (imap_free_message_info):
- Added a free of the message info.
- (imap_refresh_info):
- (imap_sync):
- (imap_refresh_info):
- (imap_get_unread_message_count):
- (imap_get_uids):
- (imap_get_message_flags):
- (imap_set_message_flags): Free any summary lookups.
- (imap_get_message_flags): Get the message info directly from the
- summary, not via the folder interface.
- (imap_move_message_to): Dont call folder functions directly
- (delete_message), as it will deadlock since we already have the
- lock.
-
- * providers/vee/camel-vee-folder.c (vee_free_message_info): Free/unref
- the messageinfo.
- (vee_get_message_info): First ref the internal copy, then return it.
- (folder_changed): Free all got message info's.
- (message_changed): And here.
- (get_real_message): And here.
- (vee_folder_build): and here.
- (vee_folder_build_folder): ... and here.
-
- * camel-folder-summary.c (camel_folder_summary_info_new):
- Initialise the messageinfo refcount to 1.
- (camel_folder_summary_info_free): Down the refcount till we need
- to free.
- (camel_folder_summary_info_ref): New function to up the refcount.
- (camel_message_info_dup_to): Sewt the refcount of the dest to 1.
- (camel_message_info_new): Set refcount to 1.
- (camel_message_info_new_from_header): Dont allocate the mi
- ourselves.
- (camel_message_info_free): Handle refcounting.
- (camel_message_info_ref): New function.
- (camel_folder_summary_index): Ref the messageinfo before returning
- it.
- (camel_folder_summary_uid): Likewise.
- (camel_folder_summary_save): Access the messageinfo array
- directly, rather than through accessors (saves ref/unref).
- (camel_folder_summary_clear): Likewise.
- (camel_folder_summary_remove_index): Likewise.
- (main): Free lookups.
-
- * camel-folder-summary.h (CamelMessageInfo): Added a refcount
- value.
-
- * camel-folder.c (camel_folder_free_message_info): New function to
- 'free' a message info.
- (camel_folder_get_message_info): Deconstify return.
- (camel_folder_lock): New (internal) function to thread-lock the
- folder.
- (camel_folder_unlock): Likewise for unlocking.
- (freeze):
- (thaw): Lock around access to folder->frozen/changed_frozen.
- (folder_changed): Likewise.
- (message_changed): Likewise.
- (camel_folder_init): Init private data, locks and moved frozen
- info.
- (camel_folder_finalize): Free new private data, locks and moved
- frozen info.
- (copy_message_to): Free the messageinfo after we've used it.
- (move_message_to): And here too.
- (camel_folder_sync): Lock around virtual method invocation. Just
- locking around any virtual method that is known to need it. This
- is the first cut at locking.
- (camel_folder_refresh_info): "
- (camel_folder_expunge): "
- (camel_folder_get_message_count): "
- (camel_folder_get_unread_message_count): "
- (camel_folder_append_message): "
- (camel_folder_set_message_flags): "
- (camel_folder_get_message_flags): "
- (camel_folder_get_message_user_flag): "
- (camel_folder_set_message_user_flag): "
- (camel_folder_get_message_user_tag): "
- (camel_folder_set_message_user_tag): "
- (camel_folder_get_message): "
- (camel_folder_get_uids): "
- (camel_folder_free_uids): "
- (camel_folder_get_summary): "
- (camel_folder_search_by_expression): "
- (camel_folder_free_summary): "
- (camel_folder_search_free): "
- (camel_folder_move_message_to): "
- (camel_folder_copy_message_to): "
- (copy_message_to): Dont call any of our own folder functions
- directly, otherwise we will deadlock.
- (move_message_to): Likewise.
-
- * camel-folder.h (CamelFolder): Added free_message_info() function
- & deconstify get_message_info()'s return.
- (CamelFolder): Add a private field (for locks).
- (struct _CamelFolder): Moved changed_changed/frozen into private
- data, since it really is private and now needs locked access.
-
-2000-12-15 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-utils.c (header_fold): When checking to see if we
- need to fold the header, when we come accross a \n, make sure to
- start at p + 1 the next time through the loop or else we get into
- an infinite loop.
-
-2000-12-13 Dan Winship <danw@helixcode.com>
-
- * Namespace cleanup: change a bunch of IS_CAMEL_* macros to
- CAMEL_IS_*
-
-2000-12-13 Chris Toshok <toshok@helixcode.com>
-
- * providers/imap/camel-imap-auth.c: add #include <sys/types.h> for
- freebsd.
-
-2000-12-12 Christopher James Lahey <clahey@helixcode.com>
-
- * camel-folder-summary.c, camel-folder-summary.h: Added #ifndef
- NO_WARNINGS around a #warning. Added (void) to the prototype and
- declaration of camel_message_info_new.
-
- * camel-mime-message.h: Added an include for
- camel-mime-filter-bestenc.h. Added a prototype for
- camel_mime_message_set_best_encoding. Reformatted prototypes to
- line up.
-
- * camel-mime-parser.c: Added #if d(!)0 around the states string
- lookup table since it's only used in debugging output.
-
- * camel-seekable-substream.c (stream_flush): Added a cast.
-
- * providers/imap/camel-imap-auth.c: Added #include <netinet/in.h>.
-
- * providers/imap/camel-imap-folder.c (imap_refresh_info): Made uid
- and flags const to fix warnings here.
-
- * providers/imap/camel-imap-store.c (get_folder_info): Made p
- const to fix warnings here.
-
-2000-12-12 Dan Winship <danw@helixcode.com>
-
- * tests/lib/Makefile.am: Add missing .h file. (From campd.)
-
-2000-12-11 Not Zed <NotZed@HelixCode.com>
-
- * providers/smtp/camel-smtp-transport.c (smtp_data): Remove use of
- linewrap filter. Headers are now wrapped. encode_8bit already
- enforces a 998 octet line limit.
- (smtp_data): Also fixed a memleak, we always have to unref our own
- copy of the filters. We also dont need to remove them manually,
- so dont bother. The type's an int too ...
-
- * camel-internet-address.c (internet_unformat): When scanning past
- quotes, remove them also.
- (camel_internet_address_format_address): If the name contains "'s,
- or ','s then strip and quotes and wrap the whole lot in one set of
- quotes.
-
- * Makefile.am (noinst_HEADERS): We dont want to install
- camel-charset-map-private.h, ever. There are probably other
- similar files ..?
-
- * camel-mime-part.c (write_to_stream): Fold header lines
- appropriately as we're writing them out.
-
- * camel-mime-utils.c (header_fold): Add a new argument, headerlen,
- tells it how long the associated header token is.
- (header_fold): Also,k check to see if we need to fold first, using
- a better algorithm, and also accept already-folded lines, and
- re-process accordingly.
- (rfc2047_decode_word): Add a little buffer space to iconv output
- for shifting overheads?
- (rfc2047_decode_word): finish the iconv with a null call, to flush
- shift state, etc.
- (rfc2047_encode_word): Attempt to break up long words into
- appropriately sized, independent, chunks. See rfc2047, section 2.
- (header_decode_mailbox): Dont add in extra spaces into the output
- if we are decoding adjacent encoded words. We can only guess this
- case, as some broken mailers put encoded words inside quoted
- words.
- (header_encode_phrase): Dont merge words if they are going to end
- up too long. Also change back ot only merge consecutive words of
- the same type. e.g. 'foo. blah fum.' -> "foo." blah "fum." or
- 'iam an. idiot' -> iam "an." idiot
-
- * camel-medium.c (camel_medium_set_header): Hrm, we actually want
- to call set_header, not add_header here, probably explains some
- duplicate X-Evolution headers i was trying to track down. Also
- changed the api to handle a NULL value == remove the header.
-
- * providers/local/camel-maildir-summary.c
- (maildir_summary_decode_x_evolution): Always return error, we dont
- use x-evolution for maildir.
- (maildir_summary_encode_x_evolution): Always return a NULL string,
- likewise.
- (maildir_summary_add): Hook in here, since the _new function
- doesn't have access to any flags from the caller. If we have
- flags, then update the filename again. Not ideal, but should
- work.
-
-2000-12-08 JP Rosevear <jpr@helixcode.com>
-
- * tests/message/Makefile.am: Remove test3 from build until the files
- show up
-
-2000-12-09 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-message.c (camel_mime_message_set_date): Change the
- sign of the default date offset when none is supplied.
- (camel_mime_message_set_date): Also do dst if its dst (forward 1
- hour). Fixes #928 + some.
-
-2000-12-06 Not Zed <NotZed@HelixCode.com>
-
- * tests/lib/camel-test.h (check): Change line no format so that
- emacs can detect it.
-
-2000-12-06 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_refresh_info): We want
- to bitwise-or the server and cached flags here so that we keep the
- flags that we have set locally and set any additional flags that a
- parallel connection may have set.
-
-2000-12-05 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.c (smtp_data): If the data
- wrapper fails to be written to the stream, unref it and the
- filters before returning.
-
-2000-12-05 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_message): use
- BODY.PEEK[] rather than RFC822, so the message doesn't get marked
- as \Seen.
- (imap_refresh_info): Fix a really really really dumb bug.
-
-2000-12-05 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_set_message_flags): Fix
- the check for "flags aren't actually changing".
-
- * providers/local/camel-local-folder.c (local_set_message_flags,
- local_set_message_user_flag, local_set_message_user_tag): Don't
- emit message_changed unless the flags actually changed.
-
- * providers/nntp/camel-nntp-folder.c
- (nntp_folder_set_message_flags): Don't emit message_changed unless
- the flags actually changed. Fix the check for marked as seen.
-
-2000-12-05 Not Zed <NotZed@HelixCode.com>
-
- * camel-seekable-substream.c (stream_flush): stream_flush does
- make sense for a substream afterall (if you have a stream_write).
- (stream_write): Implement this.
- (stream_seek): Change the STREAM_END behaviour to be more sane.
- if bounded go from the end of the bound, if unbounded, go from the
- end of the parent stream.
-
- * camel-stream-mem.c (stream_read): Dont return error if reading
- past the end of data, just return 0.
-
- * camel-stream-fs.c (camel_stream_fs_init): Initialise the stream
- to be unbound.
- (stream_seek): Fix the logic when seeking from the end of an
- unbounded stream.
- (camel_stream_fs_new_with_fd): If the fd is invalid (-1), then
- return NULL immediately.
- (stream_seek): Range check a SEEK_END so it fits within
- bound_start.
-
-2000-12-01 Not Zed <NotZed@HelixCode.com>
-
- * tests/lib/folders.c (test_folder_basic): New test to perform
- basic store operations on folders (taken from folders/test1).
- (test_folder_message_ops): Tkane the guts out of folders/test2.
-
-2000-12-04 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.c (smtp_connect): i18n-ize
- exception strings.
- (get_name): And here.
- (_send_to): Here too.
- (smtp_helo): And here and there...
- (smtp_mail): And around the square...
- (smtp_rcpt): Saying catch me if you can...
- (smtp_data): And here three.
- (smtp_rset): And here.
- (smtp_quit): And finally here.
-
-2000-12-01 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-folder-search.h: Added system_flag to CamelFolderSearchClass
-
- * camel-folder-summary.c (camel_system_flag_get): Convenience
- function to return whether or not a flag is set using a string as
- the flag name.
- (camel_system_flag): Return the integer value of the flag string.
-
- * camel-folder-search.c (search_system_flag): New ESExp callback
- for allowing vfoldering on CamelMessageInfo flags.
-
-2000-12-01 Dan Winship <danw@helixcode.com>
-
- * camel-service.c (camel_service_disconnect): Don't
- g_return_if_fail if the service is already disconnected. Just
- return.
-
- * providers/pop3/camel-pop3-store.c (pop3_try_authenticate):
- Return FALSE (don't try again) if we get CAMEL_POP3_FAIL.
- (pop3_connect): If we don't succeed, disconnect.
-
-2000-11-30 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c
- (parse_list_response_as_folder_info): Fix a possible bug where
- 'name' could be uninitialized.
-
- * camel-folder-summary.c (camel_message_info_new): New convenience
- function, doesn't do much but it sure makes code cleaner to read.
- (camel_message_info_new_from_header): This one makes my life heaven.
-
-2000-11-30 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-summary.c (camel_imap_summary_new):
- Handle the case where the summary failed to load - clear the
- summary and then set the dirty bit so that it is sure to save
- later. Is this the right fix?
-
-2000-11-30 Dan Winship <danw@helixcode.com>
-
- * camel-exception.c (camel_exception_setv): Remove unused
- variable.
-
-2000-11-30 Not Zed <NotZed@HelixCode.com>
-
- * providers/local/camel-mbox-folder.c (mbox_get_message): Remove
- assertion that content is there, when it no longer can be.
-
- * camel-folder-summary.h: Removed pos/bodypos/endpos from
- camelmeessagecontentinfo.
- (CamelMessageFlags): Added an attachments flag.
-
- * providers/local/camel-local-summary.h: Added load virtual
- function.
-
- * tests/lib/folders.c (test_message_info): Accessors.
- (test_folder_message): "
-
- * camel-folder-thread.c (get_root_subject): Fix accessors.
- (dump_tree_rec): "
-
- * camel-folder-search.c (camel_folder_search_execute_expression):
- Accessors for messageinfo.
- (search_match_all): "
- (search_header_contains): "
- (search_header_contains): "
- (search_body_contains): "
- (camel_folder_search_execute_expression): Use mepool_strdup.
-
- * providers/local/camel-mbox-summary.c (summary_update): Accessors
- for messageinfo.
- (mbox_summary_sync_full): "
-
- * providers/local/camel-mh-summary.c (remove_summary): Accessors
- for messageinfo.
- (mh_summary_check): "
- (mh_summary_sync_message): "
- (mh_summary_sync): "
-
- * providers/local/camel-mh-folder.c (mh_append_message): Use
- accessor for uid.
-
- * providers/local/camel-local-summary.c
- (local_summary_decode_x_evolution): Use accessor to uid.
- (local_summary_encode_x_evolution): Likewise.
- (message_info_new): And here.
- (camel_local_summary_load): Call virtual load function.
- (local_summary_load): Default load function, load summary.
- (camel_local_summary_load): Check file exists before trying to
- load.
- (camel_local_summary_construct): Turn off building content info!
- (CAMEL_LOCAL_SUMMARY_VERSION): Bump, since we dont build content
- info anymore.
- (camel_local_summary_load): After a successful load/check, do a
- save too so we dont have to go through it again randomly.
-
- * providers/nntp/camel-nntp-utils.c (get_XOVER_headers): Use
- accessors for messageinfo.
-
- * providers/nntp/camel-nntp-folder.c (nntp_folder_get_uids): Use
- accessors for uid.
-
- * providers/imap/camel-imap-folder.c (imap_refresh_info): Use
- accessor for uid.
- (imap_sync): Likewise.
- (imap_get_uids): Likewise.
- (imap_update_summary): And here.
-
- * providers/vee/camel-vee-folder.c (vfolder_remove_match): Use
- accessor for uid.
- (vfolder_add_match): Handle estrv stuff.
- (vfolder_change_match): Accessor for uid.
- (get_real_message): "
- (vee_get_uids): "
- (vee_folder_build): " + estrv.
- (vee_folder_build_folder): "
-
- * providers/local/camel-maildir-folder.c (maildir_append_message):
- Use acccessors for uid's.
- (maildir_get_message): Here too.
-
- * providers/local/camel-maildir-summary.c
- (camel_maildir_summary_init): Setup the string count for us.
- (message_info_new): Access the string array directly.
- (message_info_free): No need to free string if using array.
- (camel_maildir_summary_info_to_name): Use accessor to get to uid.
- (remove_summary): And here.
- (maildir_summary_check): Likewise.
- (maildir_summary_sync): And here.
- (maildir_summary_load): Load up a cache of uid->filename mappings
- before loading the actual summary file. This saves us having to
- waste the diskspace storing the filenames in the summary itself,
- and also helps us sync the summary better on load.
- (message_info_load): If we have the load_map setup, and the uid
- exists, then set the filename cache from it, and update the flags
- from the name, incase our summary mismatches it.
-
- * camel-folder-summary.c (camel_folder_summary_init): Setup string
- count for compressed info record. An optional compile mode which
- stores all strings for a given messageinfo into a packed array,
- which should save 36-50 bytes/record.
- (camel_folder_summary_info_new): Init the string array.
- (message_info_new): Set the string array items, as required.
- (message_info_load): And here too.
- (message_info_save): Use accessors to get to strings.
- (message_info_free): Free strings as one.
- (camel_message_info_dup_to): Handle packed array case.
- (camel_folder_summary_add): Use accessors. And pack the strv
- before storing it.
- (summary_assign_uid): New function to assign a unique uid to a
- message, if it doesn't have one.
- (camel_folder_summary_add): Call assign_uid instead of doing it
- ourselves.
- (camel_folder_summary_info_new_from_parser): "
- (camel_folder_summary_info_new_from_message): "
- (camel_folder_summary_encode_string): constify.
- (camel_folder_summary_encode_token): "
- (summary_build_content_info_message): Fix accessors to messageinfo.
- (CAMEL_FOLDER_SUMMARY_VERSION): Bumped, for removal of
- contentinfo->pos data.
- (camel_folder_summary_info_new_from_parser): Calculate the size
- based on the parser position, not the removed contentinfo stuff.
- (camel_folder_summary_info_new_from_message): Remove size stuff.
- (camel_folder_summary_offset_content): Removed, no longer means anything.
- (content_info_new):
- (content_info_load):
- (content_info_save):
- (summary_build_content_info): Remove stuff for contentinfo->pos*.
- (summary_build_content_info): Take a msginfo argument, set
- attachments flag if we find any attachments.
- (summary_build_content_info_message): set attachments flag if we
- find any attachments.
- (camel_folder_summary_info_new_from_parser): Always scan the
- content info, even if we dont save it.
- (camel_folder_summary_info_new_from_message): And here too.
- (summary_build_content_info): Only create the contentinfo stuff if
- we have it turned on, otherwise just parse and discard.
- (summary_build_content_info_message): Likewise.
-
-2000-11-29 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-store.c (camel_store_get_folder): Updated the gtk-doc
- comment.
-
-2000-11-29 Dan Winship <danw@helixcode.com>
-
- * camel-mime-utils.c:
- * camel-mime-filter-charset.c: Use iconv instead of unicode_iconv.
-
- * providers/imap/camel-imap-command.c (imap_read_untagged): Fix
- some off-by-one-ness.
-
- * camel-stream-buffer.c (stream_read): Fix another bug found in
- previously-unused code here.
-
-2000-11-29 Ettore Perazzoli <ettore@helixcode.com>
-
- * tests/lib/Makefile.am (INCLUDES): `$(top_srcdir)' for builddir
- != srcdir compilation.
-
-2000-11-29 Not Zed <NotZed@HelixCode.com>
-
- * tests/message/test2.c (main): Add a missed unref.
-
- * camel-stream-mem.c (camel_stream_mem_set_buffer): We must set
- ourselves as the owner of the byte-array.
- Weird, someone has modified this file (its been reindented), but i
- can't see any changelogs ...
-
- * tests/lib/messages.c (content_finalise): Fix memleak in tester,
- free byte array when our content object is deleted.
-
- * camel-folder-search.c (camel_folder_search_finalize): Yeah
- great, so the sexp is a gtk object, not a camel object. Isn't
- that going to be fun to fix?
-
- * camel-session.c (camel_session_finalise): Free the storage path.
-
- * providers/local/camel-local-store.c (camel_local_store_init): If
- store->folders is setup, free it first, then overwrite. Hmm,
- this seems a bit crappy to me.
-
- * camel-store.c (camel_store_init): Dont setup store->folders if
- its already setup.
-
- * camel-exception.c (camel_exception_setv): Removed a memleak. no
- need to strdup after a strdup_printf!!!
-
- * camel-address.c (camel_address_finalize): Free the address
- ptrarray, once finished.
-
- * providers/local/camel-local-folder.c (local_finalize): Make sure
- we dont leave the folder locked on close.
- (local_finalize): Free summary/search.
-
- * providers/local/camel-mh-summary.c (mh_summary_next_uid_string):
- Small memleak, always free name after using it.
-
- * camel-mime-part.c (set_content_object): Free txt after setting
- the header.
-
- * providers/local/camel-maildir-summary.c (maildir_summary_check):
- Fix a memleak, close the dir after scanning new.
- (message_info_free): Added so we can free the filename cached in
- the messageinfo.
- (camel_maildir_summary_finalise): Free the hostname.
-
- * tests/folder/test[12].c (main): Clear out camel-test before
- starting.
-
- * providers/local/camel-mbox-summary.c (mbox_summary_sync_quick):
- Because encode_x_evolution folds the line (sigh, because
- encode_param does, unlike every other function in
- camel-mime-utils), unfold the encoded result before comparing.
- (mbox_summary_sync_quick): Another small memleak, free xevnew once
- finished with it.
-
- * camel-mime-utils.c (header_decode_quoted_string): Removed a
- redundant check for c=0.
- (header_unfold): New function to un-fold headers.
-
- * providers/local/camel-local-summary.c
- (local_summary_encode_x_evolution): some problems with encoding
- tags, using the wrong output strings.
- (local_summary_encode_x_evolution): We dont need to append a ;
- either, param_list_format_append() will do it for us.
-
-2000-11-28 JP Rosevear <jpr@helixcode.com>
-
- * camel-lock.c: No longer hard code the enabled lock types
-
-2000-11-28 Dan Winship <danw@helixcode.com>
-
- * camel-remote-store.c (remote_recv_line): Don't set exception to
- g_strerror (errno) when nread == 0, because it won't have been
- set.
-
- * providers/pop3/camel-pop3-folder.c (pop3_finalize): Don't try to
- free things if they haven't been set yet.
-
-2000-11-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.c (smtp_connect): Clear the
- exception if EHLO fails before trying HELO in the cases where the
- SMTP provider doesn't announce its ESMTPness.
-
-2000-11-28 Not Zed <NotZed@HelixCode.com>
-
- * providers/local/camel-maildir-summary.c
- (camel_maildir_summary_init): Set the info size's properly, oops!
-
- * tests/lib/folders.[ch]: Folder testing helpers.
-
- * tests/folder/test2.c: Test basic message ops on folders.
-
- * tests/folder/test1.c (main): Test basic folder ops on (local)
- stores.
-
- * providers/local/camel-local-provider.c
- (camel_provider_module_init): Removed some debug.
-
- * providers/local/camel-maildir-folder.c
- (camel_maildir_folder_class_init): fix parent class.
-
- * providers/local/camel-mh-folder.c (camel_mh_folder_class_init):
- Fix parent class (damn cut & paste).
-
- * providers/local/camel-maildir-store.c (get_folder): Call parent
- impl.
- (camel_maildir_store_class_init): Fix parent class setup.
- (delete_folder): Check the folder exists before trying to delete
- it.
- (delete_folder): Try and make the delete operation atomic/rollback
- failures. e.g. if one directory isn't empty, then create the
- other empty ones back. Also clear the tmp directory fully first.
-
- * providers/local/camel-mbox-store.c (get_folder): Call parent
- impl.
- (camel_mbox_store_class_init): parent class is camel_local_store,
- not camel_folder, oops.
- (delete_folder): Return an error if it doesn't exist, rather than
- covering it up.
-
- * providers/local/camel-mh-store.c (get_folder): Call parent impl.
- (camel_mh_store_class_init): fix parent class setup.
- (delete_folder): Error if it doesn't exist now.
-
- * camel-folder.c (camel_folder_move_message_to):
- (camel_folder_copy_message_to): Added warnings as these functions
- are going to be removed later.
-
- * camel-store.c (camel_store_get_root_folder): Fix for an early
- api change. We want CAMEL_STORE_FOLDER_CREATE, not TRUE, since
- its a flag.
- (camel_store_get_default_folder): And here too.
-
- * providers/local/camel-local-store.c (xrename): Handle renaming
- folders differently to renaming files.
- (get_default_folder_name): local stores dont have a default
- folder, so make it so. Or at least, it doesn't seem to make sense
- to have one.
- (get_root_folder_name): Same for root.
- (get_folder): Added parent implementation, that makes sure the
- service path exists, if we are creating a new folder (but doesn't
- create the folder).
-
-2000-11-27 Not Zed <NotZed@HelixCode.com>
-
- * providers/local/camel-local-store.c (xrename): Fixed races. Use
- link/unlink, rather than rename, to properly detect overwriting
- another file. And allow some files to be missing.
-
-2000-11-28 Radek Doulik <rodo@helixcode.com>
-
- * providers/local/camel-local-summary.c
- (local_summary_decode_x_evolution): add scan = scan->next; to
- avoid infinite loop
-
-2000-11-27 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-command.c (imap_read_untagged): Make
- this gratuitously more complicated. No wait, I mean, fix bugs. Now
- fully handles NULs in the data stream (which "can't happen" but
- do) and also handles responses containing multiple literals. Also
- does less copying than the original code.
-
- * camel-stream-buffer.c (stream_read): Fix a bug that could make
- it lose sync and/or overrun buffers.
-
-2000-11-27 JP Rosevear <jpr@helixcode.com>
-
- * providers/local/.cvsignore: shush
-
-2000-11-27 Not Zed <NotZed@HelixCode.com>
-
- * providers/Makefile.am: Removed mh, mbox, added local, to the default.
-
-2000-11-24 Not Zed <NotZed@HelixCode.com>
-
- * tests/data/getaddr.pl: little util to scan mailboxes for any and
- every address they contain.
-
- * tests/message/test2.c (main): Added a bunch of stuff to test
- decoding/reencoding/etc of internationalised addresses.
-
- * tests/message/lib/address-data.h: Copy of some unicode/other
- testing data. **Beware** of editing this file in emacs, it'll
- probably try and convert all the characters to something
- unusable.
-
- * tests/lib/camel-test.c (camel_test_break): Add a debugger hook
- point.
-
- * camel-mime-utils.c (quoted_encode): Check for space and convert
- to _ separately.
- (header_decode_mailbox): Fixed the 'check comments for realname'
- code, problem was the domain getting code was skipping all
- whitespace/comments before we could get a look-in. This is
- approximate but fairly robust.
- (header_decode_text): Dont use the c-type isspace func here, we
- want a specific whitespace only.
- (header_decode_text): If we have decoded words next to each other,
- do not insert whitespaces between them, which is what rfc2047 requires.
- (header_decode_text): Make c unsigned too.
-
- * tests/README: Added at least some explanation of all this stuff.
-
- * tests/lib/camel-test.h (check_msg): Added a non-gcc version of
- the fail command, we dont get the expression that failed, but no
- matter. Should be (more) portable now.
- (check, check_msg): Put the file/lineno in the default message.
-
- * Makefile.am (SUBDIRS): Add tests.
-
- * camel-mime-filter-basic.c (filter): Well, I'll add the extra
- bytes here too, lathough not strictly needed, might save a
- re-malloc when we get to complete().
-
- * camel-mime-filter-charset.c (filter): Make sure we have room if
- we only convert very short data.
- (complete): and here too.
-
- * tests/Makefile.am: Initial test harness & tests. Requires gcc
- for this.
-
- * camel-internet-address.c (d): Turn off debug.
-
- * camel-charset-map.c (camel_charset_step): Oops, & masks for set
- intersection, not | them. Dunno how this got even close to
- working.
-
-2000-11-23 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-filter-basic.c (filter): For base64 encoding, the
- output size for 0, 1, or 2 bytes of input can exceed input*2, so
- make sure we account for that as well.
- (complete): And here.
- (complete): Similarly for qp encoding, if we have a trailing
- space, we need some extra bytes (not needed for 'filter()', as any
- such bytes are stored in state/save).
-
- * camel-mime-utils.c (quoted_decode_step): Removed fixme not required.
- (quoted_encode_close): Dont append a trailing afterall. Otherwise
- a pass through the encode/decode will grow the message each time.
-
-2000-11-22 Radek Doulik <rodo@helixcode.com>
-
- * camel-mime-utils.c (header_msgid_generate): check for return
- values
-
-2000-11-21 Dan Winship <danw@helixcode.com>
-
- * camel-lock.c:
- * camel-movemail.c: add #ifdef HAVE_ALLOCA_H
-
-2000-11-21 Not Zed <NotZed@HelixCode.com>
-
- * providers/local/camel-mh-summary.c (mh_summary_sync_message):
- Shite, -1 on error, >=0 on success. So i've just been truncating
- all the messages I touched, good one zed.
- (mh_summary_sync_message): Sigh, and write to the right damn fd as
- well.
- (mh_summary_sync_message): Argh, and we need to compare the length
- of the old xev -1 to the new xev, to check if we can optimise it.
-
- * camel-folder.c (camel_folder_change_info_new): Init the pool.
- (camel_folder_change_info_add_source): Allocate string in the
- pool.
- (camel_folder_change_info_add_source_list):
- (camel_folder_change_info_add_update): No longer free the key, as
- it cannot be yet.
- (change_info_add_uid): Add a new arg, copy, telling it whether to
- copy the uid argument or not, and copy using mempool_strdup.
- (change_info_cat): Tell add_uid to copy the string.
- (camel_folder_change_info_add_update): Call add_uid directly.
- (change_info_remove): Call add_uid directly, with no copy, and
- dont free the key.
- (change_info_free_update): No longer required since we dont malloc
- the keys.
- (camel_folder_change_info_add_uid): Fix for add_uid change.
- (camel_folder_change_info_remove_uid):
- (camel_folder_change_info_change_uid):
- (change_info_clear): No longer needed, just set the size to 0 on
- the array directly.
- (camel_folder_change_info_clear): Empty the arrays directly, and
- flush the mempool too, and also clear uid_source, incase anyone
- was silly enough to call us in the wrong order.
- (camel_folder_change_info_free): Dont bother clearing the array's
- contents, just free the pool and throw away all the indexes.
-
- * camel-folder.h: Added a mempool to CamelFolderChangeInfo to
- store the uid's we get.
-
- * camel-folder-search.c (search_match_all): If we are only
- matching a single info, just use that/do the search.
- (camel_folder_search_match_expression): New function. Matches a
- single message info against an expression.
- (camel_folder_search_init): Init a hash table used to map the
- returned gptrarrays' to mempools.
- (camel_folder_search_execute_expression): Store all of the string
- data in a mempool, slightly faster, less wasted space (usually),.
- (camel_folder_search_free_result): Check for the mempool that
- stores the data for the list, and free that if we have it,
- otherwise assume we need to use g_free() (which should only happen
- if the list is empty at the moment).
- : commented out the debugging prints. Got sick of 'executing
- header search' crap.
-
- * providers/vee/camel-vee-folder.c (camel_vee_folder_init): Init
- changes.
- (camel_vee_folder_finalise): Free changes.
- (vfolder_add_match): Simple helper to add a new matching info
- record.
- (camel_vee_folder_add_folder): Only trigger a changed event if we
- have changes.
- (vfolder_change_match): New function, changes our local vfolder
- info to match the source.
- (vfolder_add_match): Add a new info to the vfolder list.
- (vfolder_remove_match): Remove a no-longer matching info from the
- vfolder summary.
- (message_changed): check if the message still matches, and
- remove/etc as required.
- (camel_vee_folder_finalise, init): init/free search object.
- (vee_folder_build_folder): Build the changes to the folder into
- the changes data, as we go.
- (folder_changed): If the folder gave us an explicit list of
- changes, then process each one separately (unless there's a lot
- added/changed).
-
- * providers/vee/camel-vee-folder.h: Added a changes field to the
- folder.
-
- * Makefile.am (libcamel_la_SOURCES): Added
- camel-folder-thread.[ch].
-
- * camel-folder-thread.c: message-threading algorithm, taken from
- evolutions' mail component, as it is generally more useful than
- just for evolution itself. Changed to use e-memchunks as well to
- speed it up a little and use less mem.
-
-2000-11-20 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-remote-store.c (remote_recv_line): Fixed to return the
- correct bytecount in all cases which is the real fix to
- imap_parse_nstring.
-
- * providers/imap/camel-imap-command.c (imap_read_untagged): Again,
- don't use strlen for the post-data, use 'n'.
-
- * providers/imap/camel-imap-utils.c (imap_parse_nstring): Undo my
- previous temp-fix.
-
-2000-11-20 Not Zed <NotZed@HelixCode.com>
-
- * providers/nntp/camel-nntp-utils.c (get_XOVER_headers): Fixes for
- the summary messageid changes. Hash the messageid and store it.
- (get_XOVER_headers): Use camel_folder_summary_info_new() to create
- the summary item before adding it.
-
- * camel-folder-summary.h (CamelMessageInfo): Changed the
- messgae-id to be an 8 byte md5 hash, and the references list to be
- an array of these.
-
- * providers/local/camel-mh-summary.c (mh_summary_sync_message):
- New function, sync out the message info stuff. Only updates the
- X-Ev header if it can get away with it, otherwise writes out a
- whole new message.
- (mh_summary_sync): Added more functionality. All summary info is
- now written to the X-Ev header, etc, and new messages re-written
- if required during the sync process.
-
- * providers/local/camel-local-folder.c
- (local_set_message_user_flag): Set the XEVCHANGE flag.
- (local_set_message_user_tag): And here too.
-
- * providers/local/camel-local-summary.h: New flag
- CAMEL_MESSAGE_FOLDER_XEVCHANGE to indicate the XEV header has
- probably changed size and needs to be rewritten in whole.
-
- * camel-folder-summary.c (next_uid_string): Want this static, not
- const.
- (message_info_new): Store the references and message-id values as
- 64 bit, binary hashes.
- (message_info_load): fix for message-id/references changes.
- (message_info_save): Likewise.
- (camel_message_info_dup_to): And here.
- (camel_message_info_free): And here too. No longer free
- message_id, and simple free for references array.
- (CAMEL_FOLDER_SUMMARY_VERSION): Bumped file revision.
- (camel_folder_summary_init): Init memchunk allocators to empty.
- (camel_folder_summary_finalize): Free memchunk allocators if
- there.
- (message_info_new): Use the chunk allocator to allocate message
- info's.
- (camel_folder_summary_info_new): New helper to allocate the
- message info, and setup the memchunk if required.
- (content_info_alloc): Likewise for content info's.
- (message_info_load): Use summary_info_new_empty.
- (content_info_new): Use content_info_alloc.
- (content_info_load): "
- (content_info_free): Free the content info as a memchunk.
- (message_info_free): Free everything directly and the base as a
- memchunk, rather than calling camel_message_info_free(), which
- assumes a malloc'd array.
-
- * providers/local/camel-local-summary.c: Include ctype.h, kill a
- warning.
- (local_summary_decode_x_evolution): If we get a NULL message info,
- then dont try and set anything, just check for validity.
- (camel_local_summary_write_headers): New function to write a set
- of headers to an fd.
- (camel_local_summary_check): Added some statistic generation
- stuff for memory profiling.
-
- * providers/local/camel-mbox-summary.c (header_write): Changed to
- use stdoi functions to write out the header to a buffered stream,
- instead of using writev, which is apparently slow (and writing
- each line separately is slow anyway).
- (mbox_summary_sync_full): New implementation. Does things
- differently, doesn't use or require the content info stuff.
- (summary_rebuild): Dont return an error if we start scanning at
- the end of file.
- (mbox_summary_sync_full): If we are not writing out new headers,
- make sure we copy the From line as we go, and update frompos
- appropriately.
- (mbox_summary_sync_full): Always copy the From line from the
- existing one, rather than trying to make one up ourselves.
- (mbox_summary_sync): If we can get by with a quick-sync, then try
- it, if that fails, then try a full sync anyway.
- (mbox_summary_sync_quick): Quick sync. Only update system flags,
- etc.
- (mbox_summary_sync_full): Use the proper local summary encode_xev
- function.
- (header_evolution_decode): Removed, no longer needed.
- (header_evolution_encode): Same.
- (copy_block): No longer needed, removed.
- (header_write): Removed, replaced with
- camel_local_summary_write_headers.
- (mbox_summary_sync_full): Fixed for header_write change.
-
- * camel-mime-parser.c (folder_scan_step): Implement the new
- optional parser state HSCAN_PRE_FROM, that returns the (currently
- unfiltered) input data.
- (folder_scan_drop_step): Do the right thing for the PRE_FROM
- state.
- (camel_mime_parser_scan_from): Update the doco.
- (camel_mime_parser_scan_pre_from): Ok, make this behaviour
- optional, it simplifies a lot of loops that dont otherwise need to
- know about it.
- (folder_scan_step): Made the PRE_FROM state optional.
- (struct _header_scan_state): Made the bool vars 1 bit.
- (folder_pull_part): Free the from_line buffer if it is there.
- (folder_scan_skip_line): Added a new arg, can save the skpped data
- to a byte_array, as we go.
- (folder_scan_step): Fixed calls to skip_line approrpiately. Now
- we save the from line as we parse it.
- (camel_mime_parser_read): New function to read from the mime
- parser buffer directly. Useful if you use the parser to read the
- first/some headers, then need to scan the rest of the data,
- without needing to use a seek(), or allocate your own buffers.
-
- * camel-mime-parser.h (struct _header_state): Added a new parser state,
- pre-from which returns any data found before a from line during
- parsing (all other data can be retrieved by the caller except
- this).
-
-2000-11-17 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-utils.c (imap_parse_nstring): When
- extracting a literal string, capture up until the end of the last
- line - this we we don't lose any data if the byte count is off.
-
- * providers/imap/camel-imap-command.c (imap_read_untagged): Use
- the byte-read count to decrement the number of bytes left to read
- rather than using strlen. Not only does this protect against a DoS
- (embedded NUL chars in the literal string would make strlen
- inaccurate) but it also improves performace a little.
-
- * camel-remote-store.c (remote_recv_line): *Sigh* Return the
- number of bytes read on success rather than 0. Also don't use
- camel_stream_buffer_read_line since we can't get an accurate octet
- count.
-
-2000-11-17 Not Zed <NotZed@HelixCode.com>
-
- * providers/local/camel-local-summary.c (local_summary_add): Clear
- the NOXEV/FLAGGED bits, since we do have an xev header. um m,
- maybe this is right, this assumes a write is following. Maybe
- this should be done in folder::append() instead ...
-
- * camel-stream-buffer.c (camel_stream_buffer_gets): We should
- always terminate the string. No need to check outptr is in range,
- its already been checked.
-
- * providers/local/camel-mbox-summary.c (mbox_summary_sync): When
- we update the summary, do it from mbox_summary->folder_size, not
- the content info endpos (which isn't any good anymore anyway).
-
- * providers/local/camel-mbox-folder.c (mbox_append_message): Set
- the frompos from the current folder size, since summary_add wont
- have initialised it to anything useful.
-
-2000-11-16 Not Zed <NotZed@HelixCode.com>
-
- * providers/local/camel-local-summary.c
- (local_summary_encode_x_evolution): Check the uid string is all
- digits before trying to write a 'standard' x-ev header.
-
- * providers/local/camel-maildir-summary.c
- (camel_maildir_summary_info_to_name): Convert an info into a
- maildir name:info filename.
- (camel_maildir_summary_name_to_info): Convert a name:info filename
- into an info, and tell us if it didn't match it.
- (message_info_new): When creating a new filename, gets its info
- from the flags field. Likewise if creating from an existing file,
- extract the flags.
- (maildir_summary_sync): Remove a small memleak. Also, if our
- flags and that requires a filename change, perform that here.
- (message_info_new): Get the received date from the filename.
- Also, dont overwirte the uid if we have one.
- (maildir_summary_check): Sort the summary in received order before
- completion.
- (maildir_summary_next_uid_string): Test the name for collusions
- before we give it out. Retry, and if that fails, well, I guess we
- collide :(
-
- * providers/local/camel-mbox-folder.c (mbox_lock): Implement mbox
- locking.
- (mbox_unlock): And unlocking.
- (mbox_append_message): Lock the folder for write before doing
- anything.
- (mbox_get_message): Lock the folder for read before doing
- anything.
-
- * providers/local/camel-local-folder.c (camel_local_folder_lock):
- Implement something here. We handle the recursive ability but
- pass the locking to the folder itself.
- (camel_local_folder_unlock): Likewise for unlocking.
- (local_lock): Default - do nothing, return success.
- (local_unlock): Same.
- (local_sync): Changed slightly for locking api changes, and also,
- only lock around the sync process itself.
-
- * camel-lock.c: New file - utility functions for locking using
- different strategies and/or for locking folders safely.
-
- * Makefile.am (libcamel_la_SOURCES): Adde camel-lock.[ch]
-
-2000-11-15 Radek Doulik <rodo@helixcode.com>
-
- * camel-mime-utils.c: mime_guess_type_from_file_name moved back to
- composer as it introduced unwanted VFS dependency
- removed #include <libgnomevfs/gnome-vfs.h>
-
-2000-11-15 Not Zed <NotZed@HelixCode.com>
-
- * providers/Makefile.am: Removed local again, not quite ready.
-
-2000-11-14 Not Zed <NotZed@HelixCode.com>
-
- * camel-folder-summary.c (message_info_new_from_message): Use
- message_info_new to create the summary from headers, instead of
- getting directly from the message.
- (format_recipients): No longer required.
-
- * providers/Makefile.am (SUBDIRS): Added local.
-
-2000-11-11 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-parser.c (folder_push_part): Make sure 'atleast' is
- at least 1, always. This is possibly a temporary fix for a
- bad failure mode on bad multipart messages.
- (folder_scan_content): Go until inend, not inend+1. Changed the
- continuation and retry logic to be simpler and more robust. If we
- can't find a marker within
- the atleast we need, just set it to 1, and try again, rather than
- just going to the next smaller limit (boundary check checks the
- length anyway).
- (header_append): streamline the empty line case. And strip
- trailing \r's if there are any (\n's already stripped).
- (folder_scan_header): Reordered and cleaned up a lot. Check for
- continuation only once, and compress lwsp then. Assume the header
- buffer already has end of line's stripped, and simplify some things:
- Only check for end of headers once and easier.
- Dont check to remove end of line character
- Dont bother testing inptr-start if we get a boundary match - it is
- always zero.
- (folder_scan_header): Removed the unused part variable, and a few
- pointless assignments.
- (folder_scan_header): Change the end limit to be 1 higher, to make
- sure we get all content.
- (folder_scan_content): And here too.
- (folder_scan_header): Killed a warning.
- (folder_push_part): Removed a bad comment. Actually
- boundarylenfinal can be zero for a new message not in a
- multipart. So we fix that here.
-
-2000-11-09 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-utils.c (header_decode_param_list): Renamed from
- header_param_list_decode.
- (header_param_list_decode): New external function to decode a
- parameter list.
- (header_param_list_format_append): Made public.
- (header_param_list_format): Another new public helper function for
- formatting just a param list.
-
- * camel-folder-summary.c (next_uid_string): Default implementation
- is the same as before.
- (camel_folder_summary_class_init): And set it up.
-
- * camel-folder-summary.h: Make next_uid_string a virtual function.
-
- * camel-folder.c (camel_folder_change_info_changed): New function
- to return true if the changeset contains any changes.
-
-2000-11-14 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-stream.c (camel_stream_printf): Don't cast an int to a
- ssize_t.
-
-2000-11-10 Dan Winship <danw@helixcode.com>
-
- * providers/mbox/camel-mbox-summary.c
- (camel_mbox_summary_build_from): put a space before a single-digit
- day of the month since it seems some mailers are fantastically
- picky about this. (bugs.gnome.org #27232)
-
-2000-11-10 Radek Doulik <rodo@helixcode.com>
-
- * camel-mime-utils.c (header_msgid_generate): fix ids ending with '.'
-
-2000-11-09 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-auth.c (imap_try_kerberos_v4_auth):
- Fix error handling. (Only send a "*" to bail out of authentication
- if the server hasn't already bailed on us.)
-
-2000-11-08 Radek Doulik <rodo@helixcode.com>
-
- * camel-mime-utils.c (mime_guess_type_from_file_name): new
- function, moved from composer
-
-2000-11-08 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-message.c (find_best_encoding): Keep track of the
- caller bestenc flags that make sense.
-
- * camel-mime-filter-bestenc.c (filter): Added code to detect when
- we have "^From " lines in the sequence of text.
- (camel_mime_filter_bestenc_get_best_encoding): Added a new flag
- CAMEL_BESTENC_NO_FROM: if set, it will not allow any lines
- matching "^From " to appear in the output - currently forcing
- base64 encoding to achieve this.
-
- * camel-mime-parser.c (folder_scan_step): Call
- camel_mime-filter_complete() once we're done, rather than
- filter_filter().
- (folder_scan_content): Some fixes for state changing; so that when
- we do find another boundary it is properly flagged. Since we
- strip the last \n off all data, we must take that into account
- too. Sigh. Fixes a rather nasty set of bugs where multipart
- messages could start including following messages as parts, etc.
- (struct _header_scan_stack): Added new parameter,
- boundarylenfinal, which holds the length of the final boundary, if
- it is different (e.g. for From lines, whihc aren't)
- (folder_scan_step): Setup teh boundarylenfinal value when creating
- a new boundary.
- (folder_scan_content): Hmm, if we hit the end-of-buffer sentinal,
- reset the scanner back to leave 'atleast' chars in the buffer
- still, dump that content, and retry again. Stops us losing a
- check for a boundary on some data we haven't really looked at yet!
- (folder_scan_content): Use boundarylenfinal to calculate
- 'atleast'.
- (folder_scan_header): And here too.
- (folder_boundary_check): Use the atleast value directly, dont
- truncate it. Use the boundarylen/boundarylenfinal values directly
- too.
- (struct _header_scan_stack): Add an atleast parameter to cache the
- atleast info.
- (folder_push_part): Determine/set 'atleast', every time we add a
- new part.
- (folder_scan_header): Get the cached atleast info from the current
- part.
- (folder_scan_content): And here too.
- (folder_scan_header): Fix a problem where a part starting with
- " text" would be interpreted as a followon header wrongly.
-
- * camel-mime-filter-charset.c (complete): Add some assertions to
- find a bug.
-
-2000-11-07 Ettore Perazzoli <ettore@helixcode.com>
-
- * camel-service.c (get_name): Strdup the "???" string you return,
- so that the expected semantics for `::get_name()' is respected.
-
-2000-11-07 Dan Winship <danw@helixcode.com>
-
- * camel-stream-filter.c (d): Kill debugging, as it causes lots of
- evolution-mail spewage.
-
-2000-11-07 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-filter-bestenc.c (complete): Implement a complete()
- function, now we need one.
- (filter): Upgraded to match rfrc2045 properly. Checks also for
- length of line and valid CRLF sequences.
- (camel_mime_filter_bestenc_get_best_encoding): Do the work of
- working out what is the best encoding given what we found about
- the stream.
-
- * camel-mime-part.c (camel_mime_part_encoding_to_string): Use a
- lookup table to get the encoding naem, and add the binary type.
- (camel_mime_part_encoding_from_string): Likewise for the reverse.
-
- * camel-mime-part.h: Added the binary encoding type, see rfc2045.
-
- * camel-mime-utils.c (header_param_list_format_append): Dont put a
- space before ;'s in parameter lists, makes them more
- readable/consistent.
-
- * camel-mime-message.c (multipart_has_8bit_parts): Cleaned up the
- old stuff, well removed it.
- (camel_mime_message_set_best_encoding): Added another argument
- that lets you select what you want to set the best of. i.e. for
- smtp transport we only need 7 bit, and dont need to optimise the
- charset (although of course, we should always).
- (find_best_encoding): Implement this feature, if we are not
- getting the best charset, use the one we have.
- (best_encoding): Set the charset on the part appropriately. Sigh,
- the interfaces for this are nonexistant.
- (find_best_encoding): Tell the bestenc filter that lf should be
- treated as crlf for the purposes of determining encodings.
-
-2000-11-06 Not Zed <NotZed@HelixCode.com>
-
- * camel-charset-map.c (camel_charset_init): Init function for an
- iterative charset determinator.
- (camel_charset_step): Iterate another buffer.
- (camel_charset_mask): Removed, since it couldn't have worked.
- (camel_charset_best): Use the iterative interface to do the work.
- (camel_charset_best_name): Get the best name for a charset so far.
-
- * camel-mime-filter-bestenc.c: New class, a stream
- filter that can be used to memory-efficiently determine the best
- encoding and/or charset to use for a given stream of bytes.
-
- * Makefile.am (libcamelinclude_HEADERS): Added stream-null*.
- (libcamel_la_SOURCES): Added bestenc*
-
- * camel-stream-null.c: New class, a null-stream, that always
- succeeds, and never has any contents.
-
- * camel-stream.c: Minor pointless changes. Was going to do
- something else but changed my mind. Added trivial default
- implementations for all callbacks.
-
- * camel-mime-message.h: Cleaned up some old cruft.
-
- * camel-folder-summary.c (camel_folder_summary_format_address):
- address_list_format() no longer encodes, so we dont need to decode
- it.
-
- * camel-address.c (camel_address_unformat): New function, attempts
- to reverse the formatting process on display addresses.
- (camel_address_length): New function to get the number of
- addresses, without having to peek the structure.
-
- * camel-mime-message.c (camel_mime_message_set_from): Fix a typo.
- (camel_mime_message_finalize): Only unref from/reply_to if we have
- it.
- (camel_mime_message_set_recipients): New function - set the
- recipients as a CamelInternetAddress. This function effectively
- deprecates the older recipient setting functions.
- (camel_mime_message_add_recipient): What the hell, i'll bite the
- bullet. Terminate this function. The old api was ambiguious and
- inefficient and didn't work right anyway.
- (camel_mime_message_remove_recipient_address): And this one.
- (camel_mime_message_remove_recipient_name): And this one too.
- (camel_mime_message_set_recipients): If we set an empty header,
- then remove it from the header list. Allow a null receipient
- object to clear a header.
- (camel_mime_message_set_from): Likewise, if setting an empty from
- address.
- (camel_mime_message_encode_8bit_parts): Eeek!!
- camel_stream_mem_new_with_byte_array owns the byte_array we give
- it, so make sure we dont free any of it!
- (camel_mime_message_encode_8bit_parts): Infact, i'll just rewrite
- the whole lot, its a bit of a mess. Should really rename it and
- make it a little more useful too, lets see ...
- (best_encoding): This has a string interface? Oh boy.
- (camel_mime_message_foreach_part): New experimental function to
- iterate over all message parts. Might not remain.
- (camel_mime_message_has_8bit_parts): New implementation using
- foreach_part. Fixed a couple of problems.
- (find_best_encoding): New function, that finds the best encoding
- for a given part (will probably be moved to camel-mime-part), and
- also the best charset to use if it is a text part. Since one
- affects the other it is a two pass process, but uses streams and
- not memory to achieve this.
- (camel_mime_message_set_best_encoding): Uses the function above to
- configure an entire message for the best encoding possible given
- transport constraints.
- (camel_mime_message_encode_8bit_parts): Reimplemented to use the
- function above to perform the work.
-
- * camel-internet-address.c
- (camel_internet_address_format_address): Dont put <> around a lone
- address with no real name.
- (camel_internet_address_encode_address): Similarly.
- (internet_decode): Actually return the count of decoded addresses.
- (internet_unformat): Implement the unformatting routine.
-
-2000-11-05 Not Zed <NotZed@HelixCode.com>
-
- * providers/smtp/camel-smtp-transport.c (_send_to): Changed to get
- the internetaddress directly, rather than having to parse it
- itself.
-
- * camel-address.c (camel_address_format): Added a new function
- which will format address, suitable for display.
- (camel_address_cat): Concatentate 1 camel address onto another.
- It is upto the caller to ensure the addresses are of compatible
- types.
- (camel_address_new_clone): New function to create a new address by
- copying an existing one of the same type.
- (camel_address_copy): New helper function to copy an address.
-
- * camel-mime-message.h (struct _CamelMimeMessage): Removed cached
- copy of date string.
- (struct _CamelMimeMessage): Added date_received info.
-
- * camel-mime-message.c (camel_mime_message_get_date_string):
- Removed. Nothing uses it anyway, and it is redundant.
- (camel_mime_message_finalize): No more date_str.
- (camel_mime_message_init): No more date_str, initialise
- date_received*
- (write_to_stream): Change the check for a date header.
- (process_header): No longer track the date_str.
- (camel_mime_message_get_received_date): Removed. totally invalid
- anyway.
- (camel_mime_message_get_sent_date): Removed. Redundant. The only
- 'date' is the sent date, the received date is just made up.
- (camel_mime_message_get_date): Args changed to be more consistent
- with utility functions.
- (camel_mime_message_get_date): Dont set the date when we're asked
- for it (if its not set by the time its written, it'll be set
- then).
- (camel_mime_message_get_date_received): Actually do 'the right
- thing' here, if we have a received header, use that to determine
- the received date. And return the data in the same format as
- get_date.
- (camel_mime_message_set_from): Changed the api to better match
- what we should be doing. Pass a camelinternetaddress, etc.
- (camel_mime_message_set_reply_to): Cahnged similarly to take an
- internetaddress.
- (camel_mime_message_get_reply_to): Likewise.
- (camel_mime_message_finalize): Unref the from/reply_to objects.
- (format_address): Removed, no longer needed.
- (process_header): Changed to store the from/reply_to as
- internetaddress's.
- (write_to_stream): Set the from header directly to empty, if we
- dont have one. Maybe we should just abort, and/or create one
- based on the current user.
-
- * camel-mime-utils.c (header_address_list_format): Renamed to
- header_address_list_encode, which is what it is actually doing.
- (header_address_list_format_append): Similarly.
- (encoding_map[]): Removed, no longer used.
- (header_address_list_encode_append): Take another arg, do we
- encode the address (for internet), or not (for display - utf8
- only).
- (header_address_list_format): Re-added this function, but now it
- generates a display version only. Surprise surprise, that is all
- anythign needs to generate anyway. Sigh.
-
- * camel-internet-address.c (camel_internet_address_get): Return
- false if we get an invalid index only.
- (camel_internet_address_encode_address): Helper function to encode
- a single address for mailing.
- (internet_encode): Use the above function to format it.
- (camel_internet_address_format_address): Format a single address
- for display.
- (internet_format): Implement the display version.
- (camel_internet_address_class_init): Init the internet_format
- virtual function.
- (internet_cat): Implement virtual function to concatenate
- addresses.
-
- * camel-folder-summary.c
- (camel_folder_summary_info_new_from_header): new function, only
- build the summary info, dont add it.
- (camel_folder_summary_info_new_from_parser): Likewise, for new
- info from parser.
- (camel_folder_summary_add_from_parser): Cahnged to call function
- above to build info.
- (camel_folder_summary_add_from_header): Changed to call function
- above, to build info.
- (camel_folder_summary_info_free): New function to free the summary
- message info.
- (camel_folder_summary_clear): Changed to clal above to free info.
- (camel_folder_summary_remove): Likewise.
- (camel_folder_summary_add): Cleaned up the clashing uid
- re-assignment logic a little bit.
- (camel_folder_summary_decode_uint32): Fixed a typo, 01 != -1.
- (camel_folder_summary_decode_time_t): Return -1 on error.
- (camel_folder_summary_encode_off_t): New function to encode an
- off_t type.
- (camel_folder_summary_decode_off_t): And likewise for the reverse.
- (CAMEL_FOLDER_SUMMARY_VERSION): Bumped the summary version, since
- we're now encoding time/off_t's right.
- (summary_header_save): Use time_t encoder to save the timestamp.
- (summary_header_load): Likewise for decoding the timestamp.
- (content_info_load): Decode off_t types directly, now we can.
- (content_info_save): And likewise for encoding.
- (camel_folder_summary_add_from_message): New function, create a
- summary item from an existing message and add it.
- (camel_folder_summary_info_new_from_message): New function, create
- a summary item from an existing message.
- (summary_build_content_info_message): New function to do the dirty
- work of building the conent info/indexing, from a message source.
- (format_recipients): Format an internetaddress suitable for the
- summary.
- (message_info_new_from_message): Build a new summary item from a
- mime message.
- (content_info_new_from_message): Build a new conent info from a
- mime part.
- (camel_folder_summary_class_init): Init the new class functions.
- (message_info_new_from_message): Fixed for message api change.
-
- Added documentation to the functions.
-
-2000-11-03 Radek Doulik <rodo@helixcode.com>
-
- * camel-mime-utils.c (header_msgid_generate): new function,
- generates simple message/content id
-
-2000-11-04 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-part-utils.c
- (camel_mime_part_construct_content_from_parser): Set the
- preface/postface from the parser into the multipart object.
-
- * camel-multipart.c (camel_multipart_set_postface): Function to
- set the postface text on a multipart.
- (camel_multipart_set_preface): Similarly for preface text.
-
- * camel-mime-parser.c (folder_scan_content): If we scan until a
- boundary, then we do not include the \n that starts the boundary
- line in the content.
- (struct _header_scan_stack): Added a ByteArray to store the
- multipart pre/post-text as we're scanning.
- (folder_pull_part): Free pre/posttext if they are allocated.
- (folder_scan_step): Build into the pre/posttext arrays as we
- encounter data.
- (camel_mime_parser_preface): REturn the multipart preface text, if
- there is any scanned.
- (camel_mime_parser_postface): Likewise for postface text.
- (byte_array_to_string): helper function for above.
-
- * providers/mbox/camel-mbox-folder.c (mbox_append_message): Change
- the from line to be "\nFrom ..." always, so no need to
- check/append a \n to messages.
- (mbox_append_message): Open the output stream with append mode
- [assuming this is more efficient than seeking to the end]
- And dont prepend \n on the From line if its the first in the
- mbox.
- (mbox_append_message): Pass the offset of the real start of the
- "From " line when we perform the update (which may != 'seek')
-
- * camel-mime-filter-charset.c (complete): Removed the terminating
- NUL 'fix'.
-
- * camel-stream-filter.c (do_read): Added some debug.
- (do_flush): And here.
- (do_write): And here too.
- (do_write): ARGH!!! ARGH! Ok, so the filter stream was writing a
- different number of bytes than the requester was asking it to
- write (because of filtering, of course!). So instead of returning
- the true number of written bytes, we'll return what they asked us
- to write - unless there is an error in which case we return -1.
-
- * camel-mime-utils.c (base64_encode_close): Sigh, forgot to make
- it unsigned. I think this is actually a gcc bug as (48 >> 2)
- somehow ended up negative, when it obviously should not, even if
- the data load was signed.
-
-2000-11-03 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-url.c: Undo my incorrect fix - I misunderstood danw -
- sorry!
-
-2000-11-03 Dan Winship <danw@helixcode.com>
-
- * providers/pop3/camel-pop3-store.c (camel_pop3_store_expunge):
- Unbreak this.
-
-2000-11-03 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-url.c (camel_url_to_string): If show_pass, then base64 the
- password before writing it to the output string.
- (camel_url_new): Assume password has been base64 encoded and
- decode accordingly.
-
-2000-11-03 Dan Winship <danw@helixcode.com>
-
- * camel-provider.h: Add an "url_flags" field to CamelProvider.
- Move the CAMEL_SERVICE_URL_* defines here and remove the SERVICE_
- part of the name.
-
- * camel-service.h: Remove CAMEL_SERVICE_URL_* flags and
- service->url_flags field.
-
- * camel-service.c (check_url, get_path): Get URL flags from
- service->provider, update for changed flag names.
-
- * providers/*/camel-*-provider.c: Add URL flags to provider
- structures.
-
- * providers/*/camel-*-{store,transport}.c, camel-remote-store.c:
- Remove service->url_flags initialization.
-
-2000-11-02 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (get_folder_info): Quote
- foldernames when sending to the IMAP server because the folder
- name might contain spaces.
-
-2000-11-02 Not Zed <NotZed@HelixCode.com>
-
- * Merged in camel-incremental-branch.
-
-2000-11-01 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-store.c (get_folder_info): Remove old
- subbed folders from hash table after freeing them.
-
- * providers/imap/camel-imap-folder.c (imap_get_full_name): Deal
- correctly with namespace == ""
-
-2000-11-01 Gediminas Paulauskas <menesis@delfi.lt>
-
- * camel-charset-map.c, camel-charset-map-private.h: synced all charsets
- with ones found in libunicode. Just include more "iso/*.h" and rebuild
- ...private.h with this.
-
-2000-10-31 Dan Winship <danw@helixcode.com>
-
- * camel-service.c (service_disconnect): Add a new argument, clean,
- that says whether or not to try to disconnect cleanly.
-
- * camel-remote-store.c (remote_send_string, remote_send_stream,
- remote_recv_line): disconnect uncleanly on failure to prevent
- infinite loops when providers would normally send commands from
- disconnect(). Remove some unneeded CamelException goo.
-
- * providers/smtp/camel-smtp-transport.c (smtp_disconnect):
- * providers/pop3/camel-pop3-store.c (pop3_disconnect):
- * providers/nntp/camel-nntp-store.c (nntp_store_disconnect):
- * providers/imap/camel-imap-store.c (imap_disconnect): Don't send
- QUIT/LOGOUT if !clean.
-
-2000-10-30 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-auth.c: New file with code for IMAP
- authentication mechanisms. (Currently just krb4, and without
- integrity/privacy protection).
-
- * providers/imap/Makefile.am: Add camel-imap-auth.[ch] and krb4
- CFLAGS/LDFLAGS
-
- * providers/imap/camel-imap-store.c (connect_to_server): Split out
- from imap_connect. Just does the basic connect and CAPABILITY
- check. Redo the CAPABILITY code more robustly.
- (query_auth_types_connected): Do this right rather than punting to
- query_auth_types_generic. Check for KERBEROS_V4 if compiled with
- krb4 support.
- (query_auth_types_generic): Mention KERBEROS_V4 if compiled with
- krb4 support.
- (imap_connect): Use connect_to_server().
-
- * camel-mime-utils.c (base64_encode_step, base64_encode_close):
- Take an additional argument, "break_lines", saying whether or not
- to add '\n's to the output.
-
- * camel-multipart.c (set_boundary):
- * camel-mime-filter-basic.c (filter, complete): Update for base64
- api change.
-
-2000-10-30 Peter Williams <peterw@helixcode.com>
-
- * providers/imap/camel-imap-store.c (unsubscribe_folder): Correct
- parameters to g_hash_table_lookup_extended.
-
-2000-10-29 Dan Winship <danw@helixcode.com>
-
- Improved IMAP namespace handling: leave the namespace in the
- folder names rather than constantly prepending it and stripping it
- off. Also some subscription fixes.
-
- * camel-store.c (camel_folder_info_build): Fix for the case where
- @top isn't in @folders.
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Add
- a "short_name" argument rather than figuring it out ourselves.
- (imap_get_full_name): Implementation of CamelFolder::get_full_name
- that strips off namespace so the user doesn't have to see it.
- (imap_append_message, imap_copy_message_to, imap_move_message_to):
- Use folder->full_name rather than calling
- camel_imap_store_get_folder_path.
-
- * providers/imap/camel-imap-utils.c (imap_parse_list_response):
- Update this: make @flags a bitmask and @sep a char rather than a
- string. Make all of the out arguments optional. Handle literals in
- the server response.
-
- * providers/imap/camel-imap-store.c (imap_connect): Do a better
- job of getting the correct dir_sep for the namespace we're using.
- Construct a base_url here that will be used by get_folder_info.
- (camel_imap_store_folder_path): Removed
- (imap_folder_exists): Add an argument to return the short name of
- the folder (parsed out of the LIST response). Update for
- imap_parse_list_response change.
- (get_folder): Update for the various other changes.
- (get_folder_info): Update for the various other changes. Be more
- consistent about the returned layout: put everything underneath
- the "namespace" directory, including INBOX, even if it doesn't
- belong there. Don't destroy the list of subscribed folders until
- we've actually gotten the new list.
- (folder_subscribed, subscribe_folder, unsubscribe_folder): Use
- folder_name directly rather than camel_imap_store_folder_Path.
-
- * providers/imap/camel-imap-command.c (camel_imap_command): Update
- for folder name changes.
-
-2000-10-29 Dan Winship <danw@helixcode.com>
-
- * camel.h: Remove md5-utils.h include since it's not part of Camel
- any more.
-
- * camel-charset-map.c: Kill some warnings.
-
- * providers/nntp/camel-nntp-grouplist.c
- (camel_nntp_get_grouplist_from_file, camel_nntp_grouplist_save):
- Clean up warnings about time_t casts.
-
- * providers/smtp/camel-smtp-transport.c: Remove unused md5-utils.h
- include.
-
- * providers/pop3/camel-pop3-store.c: Undefine the "_" macro
- defined by krb4's des.h when compiling with krb support.
- Fix md5-utils.h include.
-
-2000-10-27 Dan Winship <danw@helixcode.com>
-
- * camel-mime-utils.c (header_param_list_format_append): Only quote
- Content-type parameters when the quoting is mandatory, and deal
- with embedded quotes/backslashes when quoting.
-
-2000-10-27 <jpr@helixcode.com>
-
- * providers/pop3/Makefile.am: Tidy up build
-
- * providers/smtp/Makefile.am: ditto
-
- * Makefile.am: Move md5-utils.[hc] to e-util because the
- addressbook is going to use md5 hashes for pilot syncing.
- Maybe the calendar conduits as well because this is a good idea
- Chris had.
-
-2000-10-26 Kjartan Maraas <kmaraas@gnome.org>
-
- * camel-exceptions-list.def: Add newline to kill warnings.
-
-2000-10-25 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-store.c (get_folder_info): Fix folder
- listing code infinite loop.
-
- * camel-store.h: Add a "parent" field to CamelFolderInfo.
-
- * camel-store.c (camel_folder_info_build): Deal with "parent"
- (camel_store_folder_subscribed, camel_store_subscribe_folder,
- camel_store_unsubscribe_folder): Add g_return_if_fails checking
- that the folder supports subscriptions.
-
- * providers/imap/camel-imap-store.c (folder_subscribed,
- subscribe_folder, unsubscribe_folder): Remove "+ 1"s since the
- mail subscribe UI won't prepend / to the folder names now.
- (get_folder_info): Clear the "parent" field of the folderinfos
- when removing an empty top level.
-
- * providers/nntp/camel-nntp-store.c (nntp_store_folder_subscribed,
- nntp_store_subscribe_folder, nntp_store_unsubscribe_folder):
- Remove "+ 1"s since the mail subscribe UI won't prepend / to the
- folder names now.
-
-2000-10-24 Chris Toshok <toshok@helixcode.com>
-
- * providers/imap/camel-imap-store.h: add subscribed_folders.
-
- * providers/imap/camel-imap-store.c (camel_imap_store_class_init):
- fill in vtable entries for subscription functions.
- (camel_imap_store_finalize): new function, so we can free up our
- subscribed_folders hashtable.
- (camel_imap_store_init): set CAMEL_STORE_SUBSCRIPTIONS in the
- CamelStore flags, and create our subscribed_folders hashtable.
- (camel_imap_store_get_type): camel_imap_store_finalize is our
- finalize function.
- (get_folder_info): if we're looking at subscribed_only, clear out
- the subscribed_folders hashtable, use LSUB instead of LIST, and
- insert folder paths (prepended by their namespace if there is one)
- into subscribed_folders. INBOX subscription support needs work,
- since we always show it, regardless of it's subscribed state.
- (folder_subscribed): new function. just look up the folder_path
- in the hashtable.
- (subscribe_folder): new function. use the imap SUBSCRIBE command,
- and if successful add it to the hashtable.
- (unsubscribe_folder): new function. use the imap UNSUBSCRIBE
- command, and if successful remove it from the hashtable.
-
-2000-10-24 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-store.c (get_folder_info): Fill in the
- message_count and unread_message_count flags (if !fast).
-
-2000-10-23 Dan Winship <danw@helixcode.com>
-
- * camel-object.h: #include gnome-i18n.h (and gnome-defs.h since
- the former depends on it.)
-
- * *: Add lots of _() and N_().
-
-2000-10-23 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/Makefile.am (libcamelnntpinclude_HEADERS): add
- camel-nntp-types.h.
-
-2000-10-23 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-command.c (imap_read_untagged): Fix a
- "how could this have been working before" memory overrun bug
- found by Vlad.
-
- * camel-op-queue.[ch], camel-thread-proxy.[ch]: These should have
- gone away a long time ago.
-
-2000-10-20 Chris Toshok <toshok@helixcode.com>
-
- * providers/Makefile.am (SUBDIRS): re-enable the nntp provider.
-
-2000-10-20 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-store.c (build_folder_info): add
- function to build a tree from the nntp group names (using '.' as a
- heirarchy separator.) #ifdefed INFO_AS_TREE only.
- (build_folder_info_from_grouplist): if INFO_AS_TREE is selected,
- call build_folder_info instead of appending a new CamelFolderInfo
- to our list.
- (ensure_news_dir_exists): use e_mkdir_hier instead of failing if a
- parent directory (~/evolution/news generally) isn't there.
-
-2000-10-19 Chris Toshok <toshok@helixcode.com>
-
- * camel-folder-search.c: #include <sys/types.h> before <regex.h>
-
-2000-10-19 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-utils.c (imap_parse_list_response):
- Fix a bug with "INBOX" (or anything else with NIL hierarchy
- separator) as the namespace.
-
- * providers/imap/camel-imap-folder.c (imap_refresh_info): Emit
- message_changed and folder_changed as appropriate.
-
-2000-10-19 Dan Winship <danw@helixcode.com>
-
- * camel-folder.c (camel_folder_refresh_info): Update comment here
- so refresh_info isn't just for reconnects any more. Make the
- default implementation a no-op rather than an error.
-
- * providers/nntp/camel-nntp-folder.c: Move refresh_info impl into
- camel_nntp_folder_new, since it would have leaked memory and not
- done anything useful if it was called later.
-
- * providers/mbox/camel-mbox-folder.c: Remove no-longer-necessary
- refresh_info impl.
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_changed):
- Update imap_folder->exists, but don't actually load the new
- messages. This is a temporary workaround to deal with the IMAP
- provider stealing the message list focus at annoying times.
- (imap_copy_message_to, imap_move_message_to): Emit a
- folder_changed by hand, for now.
-
-2000-10-19 Ettore Perazzoli <ettore@helixcode.com>
-
- * providers/imap/Makefile.am (libcamelimapinclude_HEADERS): Add
- `camel-imap-stream.h'.
-
- * Makefile.am (libcamelinclude_HEADERS): Add `camel-charset-map.h'
- and `camel-charset-map-private.h'.
-
-2000-10-18 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-part.c (camel_mime_part_set_description): The correct
- fix this time - the description should be encoded here and not in
- the camel-medium layer.
-
-2000-10-30 Not Zed <NotZed@HelixCode.com>
-
- * camel-folder.c (camel_folder_change_info_add_update): Fixed the
- changeset logic, which was completely wrong.
-
-2000-10-27 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-utils.c (quoted_encode_step): Removed is_blank() stuff.
- (header_decode_init): When we set the 'space' bit, dont clear all
- the others.
- (quoted_encode): Put back the safemask. Yes we totally need it,
- see rfc 2047 section 5, parts (1) and (3).
- (CHARS_PSPECIAL): Remove '=' and '_' from the list of allowed
- characters (this is an allowed list, not a not-allowed list, like
- the ESPECIAL).
- (camel_mime_special_table): Updated for fixes to definitions.
- (CHARS_ESPECIAL): Added '_' to list of characters that should be
- encoded.
-
-2000-10-26 Not Zed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_update):
- Use the new camel_folder_change_info_* stuff to build the update
- diff, rather than doing it ourselves.
-
- * camel-folder.c (camel_folder_change_info_add_source): Add a
- 'source' list, used to create change lists.
- (camel_folder_change_info_add_source_list): Add a list of uid's,
- convenience function.
- (camel_folder_change_info_add_update): Add a uid to the list of
- uid's in the new updated list.
- (camel_folder_change_info_add_update_list): Add a bunch of uid's
- at once for the same purpose.
- (camel_folder_change_info_build_diff): Take the source list, the
- update list, and find the differences, building on the added or
- removed list as appropriate.
-
-2000-10-20 Not Zed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-summary.c (removed_uids): REnamed from
- add_uid.
- (camel_mbox_summary_update): Oops, fix the reversed logic for
- determining the uid changesets.
-
- * camel-folder.c (message_changed): Oops, we want to change the
- uid, not add it.
-
-2000-10-19 Not Zed <NotZed@HelixCode.com>
-
- * providers/mh/camel-mh-summary.c (camel_mh_summary_sync): Added a
- change list argument, and add expunged uid's to it.
-
- * providers/mh/camel-mh-folder.c (mh_init): Setup the change list.
- (mh_finalize): And free it.
- (mh_sync): Track changes, and send a folder_changed signal as
- appropriate.
- (mh_expunge): Likewise.
- (mh_append_message): Add the new uid to the change list and
- trigger a folder_changed event.
-
- * providers/mbox/camel-mbox-folder.c (camel_mbox_folder_new):
- Setup a mbox list of changes structure.
- (mbox_finalize): And free it.
- (mbox_expunge): Include the change list with the folder_changed
- event, and clear it off.
- (mbox_sync): And the same for when we are just syncing the folder.
- (mbox_append_message): And do the same here, after we've updated
- the folder.
-
- * providers/mbox/camel-mbox-summary.c
- (camel_mbox_summary_build_from): Use gmtime_r to get the time
- thread-safely.
- (camel_mbox_summary_sync): Added a changeinfo argument. Add any
- removed or changed messages to the changelists as appropriate.
- (camel_mbox_summary_update): Added a changeinfo argument.
- Genereate a list of added/removed uid's based on the difference
- before and after rebuilding the summary.
-
- * camel-folder.c (camel_folder_change_info_new):
- (camel_folder_change_info_add_uid):
- (change_info_add_uid):
- (camel_folder_change_info_remove_uid):
- (camel_folder_change_info_change_uid):
- (change_info_clear):
- (camel_folder_change_info_clear):
- (camel_folder_change_info_free):
- (change_info_cat):
- (camel_folder_change_info_cat): Bunch of utility functions for
- working with change info lists.
- (camel_folder_init): Init the change info list.
- (camel_folder_finalize): And free it.
- (thaw): Changed to pass through a list of changes, or to get the
- changed message uids from the camelfolderchangeinfo struct, and
- reset it.
- (folder_changed): Add the changed lists to the frozen change list
- if we are frozen.
- (message_changed): Add the message to the changed list if we are
- in the frozen state.
-
- * camel-folder.h (CamelFolderChangeInfo): New structure to hold
- information for the folder_changed event.
-
-2000-10-18 Ettore Perazzoli <ettore@helixcode.com>
-
- * camel-mime-filter-charset.c (complete): Put a zero at the start
- of the outbuf.
-
-2000-10-18 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-part.c (add_header): No, we must not encode the
- headers here. These interfaces ARE raw interfaces as they are
- defined in camel_medium. Also removed a bogus/meaningless FIXME.
- (set_header): Likewise here, we must not.
- (process_header): Removed another bogus comment.
-
- * camel-object.c (shared_is_of_type): Comment out the spitting of
- a big warning when we're trying to determine types from code.
-
- * providers/mbox/camel-mbox-summary.c
- (message_info_new_from_parser): Only call ibex funcitons if we
- have an index.
-
- * providers/mh/camel-mh-summary.c (camel_mh_summary_add): Only
- call ibex functions if we have an index.
- (remove_summary): Likewise.
- (camel_mh_summary_check): Likewise.
-
- * providers/nntp/camel-nntp-store.c (nntp_store_get_folder):
- get_folder -> flags argument.
-
- * providers/vee/camel-vee-store.c (vee_get_folder): create->flags.
-
- * providers/pop3/camel-pop3-store.c (get_folder): Changed create
- -> flags.
-
- * providers/imap/camel-imap-store.c (get_folder): Added flags
- argument.
-
- * providers/mh/camel-mh-folder.c (camel_mh_folder_new): Added
- flags argument, and fixed code appropriately.
-
- * providers/mh/camel-mh-store.c (get_folder): Added flags argument.
-
- * camel-folder-search.c (message_body_contains): Perform a regex
- match on the contents of messages. This wont quite work yet as
- message contents are encoded when written to a stream.
- (build_match_regex): Converts a number of strings into a regex
- matching pattern, escaping special chars.
- (match_message): match a single message from a folder, by uid.
- Slow.
- (search_body_contains): Changed to support matching where no index
- is supplied. Matches are performed by retrieving message
- contents, etc.
- () WTF? camel should not be including any widget headers.
-
- * providers/mbox/camel-mbox-folder.c (camel_mbox_folder_new):
- Added flags argument.
- (mbox_refresh_info): Changed into a NOP, the refresh info code
- moved into the new function.
- (camel_mbox_folder_new): If we have an index requested, build one,
- otherwise, remove an old one, or just dont do anything.
-
- * providers/mbox/camel-mbox-store.c (get_folder): Changed create
- to flags, changed code to suit.
-
- * camel-store.c (camel_store_get_folder): Changed create to flags.
- (get_folder_internal): And here.
- (get_folder): And here too.
-
- * camel-store.h (camel_store_get_folder): Change the create
- argument to be a flags argument.
-
-2000-10-17 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_refresh_info): Remove
- cached info at the end of the summary when the folder shrinks
- between sessions. Also remove an untrue comment.
- (camel_imap_folder_new): Move the summary creation to after the
- folder selection again, since it depends on the uidvalidity
- having been set.
-
- * providers/imap/camel-imap-store.c (get_folder): Fix up
- summary_file to not include the namespace twice.
-
-2000-10-17 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-part.c (set_header): Encode the header value.
- (add_header): Same.
-
-2000-10-17 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-filter.c: Added some malloc check debugging stuff.
-
- * camel-mime-parser.c
- (struct _header_scan_state): Removed top_part, top_start, and
- pending. I can't even remember why they were there, and they're
- not used anymore.
-
- * camel-mime-filter-basic.c (filter): Forgot to up the space here
- too.
-
-2000-10-14 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-filter-basic.c (complete): Ok, so we hit a fixme, 3x
- just wasn't enough for some sequences.
-
-2000-10-16 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-command.c
- (imap_read_response): Don't imap_next_word(respbuf + 2), instead
- use imap_next_word(respbuf) or else we'll skip over the second
- token.
-
-2000-10-16 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-command.c
- (camel_imap_response_extract): Don't free 'resp' as it doesn't
- point to the beginning of the allocated data, instead free
- response->untagged->pdata[i]. Also, if '*resp' is equal to a space
- character, then set resp = imap_next_word (resp) rather than
- expecting resp++ to work (there's a list broken IMAP daemons that
- like to put extra spaces between tokens).
- (imap_read_response): Don't expect 'respbuf+2' to be where the
- untagged number response to start (see above fix for an
- explanation).
-
-2000-10-16 Chris Toshok <toshok@helixcode.com>
-
- * camel-service.c (get_path): when using the construct (flags &
- CAMEL_SERVICE_URL_NEED_*) make sure to do ((flags &
- CAMEL_SERVICE_URL_NEED_*) == CAMEL_SERVICE_URL_NEED_*)
- (check_url): same.
-
-2000-10-16 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (imap_disconnect): Only send
- the LOGOUT command if the store is connected.
- (imap_connect): Set the 'connected' state to TRUE when we
- successfully connect.
- (get_folder_info): if (!topfi), 'topfi' was allocated but then
- 'fi' was set. I think Dan meant to set topfi since fi is an
- uninitialized value at this point.
-
- * providers/imap/camel-imap-command.c (imap_read_response): Check
- for the untagged BYE response and set the 'connected' state to
- FALSE if we receive the BYE response. Return NULL if we get a BYE
- response.
-
-2000-10-16 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-store.c (get_folder_info): Deal with
- the possibility of not getting a LIST response back for the top
- level.
-
-2000-10-12 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-summary.c: Simple subclass of
- CamelFolderSummary that also keeps a UIDVALIDITY value (and
- doesn't, for the moment, build content info).
-
- * providers/imap/camel-imap-folder.c:
- (various): Use a CamelImapSummary to store/fetch summary info.
- (camel_imap_folder_new): Take a path to a file to use for the
- summary. Set the folder's permanent_flags correctly according to
- the server response. Read in the summary (checking the
- UIDVALIDITY) and update it if it's out of date.
- (imap_refresh_info): Just fetch UIDs and flags. If the UIDs all
- match, update the flags as needed and be done with it. Otherwise,
- delete messages that have been expunged from the server and fetch
- full summary info for any new messages.
- (imap_sync): Save the summary to disk.
- (imap_update_summary): Renamed from imap_get_summary_internal. Can
- now be told to get summary for only a subset of messages. Use
- camel-mime-utils functions rather than rolling our own header
- parsing.
- (imap_get_message_info_internal): Merged into imap_update_summary.
- (imap_set_message_flags): Don't marked the message FOLDER_FLAGGED
- if we're not actually changing the value of any of the flags.
- (camel_imap_folder_changed): Deal with EXISTS rather than RECENT.
-
- * providers/imap/camel-imap-store.c (imap_connect): Call
- camel_session_get_storage_path and save the value.
- (get_folder): Create a local directory to store summary
- information and pass a summary file name to camel_imap_folder_new.
- Don't call camel_folder_refresh_info from here any more since
- camel_imap_folder_new does it again.
-
- * providers/imap/camel-imap-command.c (camel_imap_command): Add a
- special case to this to make it possible to get the repsonses from
- a SELECT and still have store->current_folder be updated
- correctly.
- (imap_read_response): parse EXISTS rather than RECENT
-
- * camel-session.c (camel_session_get_storage_path): Use
- e_mkdir_hier.
-
- * camel-folder-summary.c (camel_folder_summary_remove_index): New
- function.
-
- * camel-mime-utils.c (header_raw_append_parse): fix this.
- (camel-mime-parser.c doesn't use this code because of the MEMPOOL
- optimization, so nothing was ever actually calling it before.)
-
-2000-10-11 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-part.h (struct _CamelMimePart): Removed
- temp_message_buffer, and content_input_stream fields which seem to
- have come from nowhere, and are unused.
-
- * camel-mime-utils.c: Added a note about touching this file.
- Nobody is to touch it without asking me first. That goes for you
- too Jeff.
- (header_decode_text): In what way is this broken?
-
-2000-10-10 Not Zed <NotZed@HelixCode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_summary_internal):
- Fix camel_summary_* function rename
- (imap_get_message_info_internal): Likewise.
-
- * camel-mime-parser.c (camel_mime_parser_finalise): Fixed a spelling mistake.
-
- * camel-folder-summary.c (camel_summary_format_address): Uh, why
- do we encode and then decode here ... sigh. This is not the way
- to fix this.
- (camel_folder_summary_format_address): Renamed to a proper name,
- this was only supposed to be a private function.
- (camel_folder_summary_format_string): Likewise. Oh i see why it
- was made public, code reuse by cut & paste. Joy.
-
-2000-10-11 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-store.c (nntp_store_unsubscribe_folder): remove the leading '/'.
- (nntp_store_subscribe_folder): same.
- (nntp_store_folder_subscribed): same.
-
-2000-10-11 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_move_message_to): Quote
- the mailbox name as it may contain spaces.
- (imap_copy_message_to): Same.
-
-2000-10-10 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-store.c
- (build_folder_info_from_grouplist): fill in message_count and
- unread_message_count properly.
-
- * providers/nntp/camel-nntp-newsrc.h: reformat.
-
- * providers/nntp/camel-nntp-grouplist.c
- (camel_nntp_get_grouplist_from_file): remove spew.
-
- * providers/nntp/camel-nntp-newsrc.c
- (camel_nntp_newsrc_group_get_num_articles_read): new function.
- (camel_nntp_newsrc_group_get_highest_article_read): robustification.
-
-2000-10-10 Joe Shaw <joe@helixcode.com>
-
- * providers/imap/camel-imap-store.c
- (parse_list_response_as_folder_info): Check before dereferencing the
- sep pointer.
-
-2000-10-10 Jacob "Ulysses" Berkman <jacob@helixcode.com>
-
- * camel-*.c: teach camel about "its" vs. "it's"
-
-2000-10-09 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-store.c (finalize): write out the
- newsrc.
- (nntp_store_get_name): if @brief, just return host.
-
- * providers/nntp/camel-nntp-newsrc.c: robustification and bug
- fixes.
-
-2000-10-06 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-folder-summary.c (camel_summary_format_address): Decode
- the resulting string.
-
-2000-10-06 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-grouplist.c: new file.
-
- * providers/nntp/camel-nntp-grouplist.h: new file.
-
- * providers/nntp/camel-nntp-types.h: new file.
-
-2000-10-06 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-utils.c (quoted_encode): Fix so that we don't encode
- every single char in the word. Also, do we need a safemask? I
- don't see why we would.
- (header_encode_string): Don't strip off the last char!!
-
-2000-10-06 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/Makefile.am (libcamelnntpinclude_HEADERS): add
- camel-nntp-grouplist.h
- (libcamelnntp_la_SOURCES): add camel-nntp-grouplist.c
-
- * providers/nntp/camel-nntp-provider.c: add our own hash functions
- for nntp urls.
-
- * providers/nntp/camel-nntp-newsrc.c
- (camel_nntp_newsrc_group_is_subscribed): new function.
- (camel_nntp_newsrc_subscribe_group): new function.
- (camel_nntp_newsrc_unsubscribe_group): new function.
-
- * providers/nntp/camel-nntp-newsrc.h: add prototypes for
- _group_is_subscribed, _subscribe_group, and _unsubscribe_group.
-
- * providers/nntp/camel-nntp-store.c
- (build_folder_info_from_grouplist): new function.
- (nntp_store_get_folder_info): add subscribed_only_parameter. if
- it's FALSE, load the grouplist and call
- build_folder_info_from_grouplist.
- (nntp_store_folder_subscribed): implement.
- (nntp_store_subscribe_folder): implement.
- (nntp_store_unsubscribe_folder): implement.
- (camel_nntp_store_init): add CAMEL_STORE_SUBSCRIPTIONS to the
- store's flags.
-
- * providers/mh/camel-mh-store.c (get_folder_info): add
- subscribed_only parameter.
-
- * providers/mbox/camel-mbox-store.c (get_folder_info): add
- subscribed_only parameter.
-
- * providers/imap/camel-imap-store.c (get_folder_info): add
- subscribed_only parameter.
-
- * camel-store.c (camel_store_supports_subscriptions): new function.
- (camel_store_folder_subscribed): new function.
- (camel_store_subscribe_folder): new function.
- (camel_store_unsubscribe_folder): new function.
-
- * camel-store.h: add prototypes and virtual functions for the
- subscribe implementation. also, add a subscribed_only argument to
- camel_store_get_folder_info.
-
-2000-10-05 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-utils.c (header_address_list_format_append): Encode
- the name part of the address and don't quote the name.
- (header_decode_text): Rewrote from scratch, the old code was badly
- broken.
-
-2000-10-05 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-message.c (camel_mime_message_set_reply_to): Use the
- camel_address_encode function again.
- (camel_mime_message_set_from): Same.
-
-2000-10-05 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-utils.c (quoted_encode_step): Modified to not encode
- space chars in the middle of a line.
- (isblank): New macro if we're not on a system with the GNU isblank
- extension.
-
- * camel-mime-message.c (camel_mime_message_set_from): Reversed my
- changes, don't header_encode_phrase - it generates broken headers.
- (camel_mime_message_set_reply_to): Same.
-
-2000-10-04 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-utils.c (camel_nntp_get_headers):
- revert to old method (only use XOVER if OVER is supported.)
-
- * providers/nntp/camel-nntp-store.c
- (camel_nntp_store_get_overview_fmt): handle the case where the
- OVER extension isn't listed but LIST OVERVIEW.FMT works (again,
- INN 2.2). enable the OVER extension in this case.
-
-2000-10-04 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-utils.c (get_XOVER_headers): return a
- gboolean so we can tell if this command worked. we can't key off
- the OVER extension being present because at least one server (INN
- 2.2) doesn't report the OVER extension but implements the XOVER
- command. This could of course just be because I'm a loser for
- thinking they were related in the first place.
- (camel_nntp_get_headers): always try XOVER first, and if it fails
- revert to the slow method.
-
-2000-10-04 Dan Winship <danw@helixcode.com>
-
- * providers/mbox/camel-mbox-store.c (get_folder): Fix a case where
- a variable was free'd and then possibly used in an error message.
-
-2000-10-04 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-provider.c
- (camel_provider_module_init): news: -> nntp:.
-
-2000-10-04 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-store.c (nntp_store_get_folder_info):
- use "nntp:" instead of "news:" since "news:" urls aren't supposed
- to have host/user/port info in them. also, if there's a user
- defined in the url, put it in the urls for our folders.
-
-2000-10-04 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-auth.c (camel_nntp_auth_authenticate):
- borrow some code from the imap provider to query the user for
- their password, and pass the user/passwd to nntp. be extra
- paranoid and zero out the password before freeing it.
-
- * providers/nntp/camel-nntp-store.c (camel_nntp_store_init): add
- ALLOW_USER/ALLOW_PASSWORD/ALLOW_AUTH to the url flags.
- (nntp_store_query_auth_types_generic): return our list of
- auth_types.
- (nntp_store_query_auth_types_connected): broken, return same as in
- query_auth_types_generic.
-
-2000-10-04 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-store.c (imap_connect): IMAP4
- (pre-rev1) doesn't support the 'LIST "" ""' idiom, so don't use
- it. Just assume the dir_sep is '/'. Shrug.
-
-2000-10-04 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-message.c (camel_mime_message_set_reply_to): Use
- header_encode_phrase instead.
- (camel_mime_message_set_from): Same.
-
-2000-10-04 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-utils.c (header_content_type_is): Handle the case
- where ct != NULL, but type and subtype are, and also match that
- against text/plain.
-
- * camel-folder-summary.c: Bump summary file version.
- (message_info_save): Save the size from the messageinfo.
- (message_info_load): Load the size from the summary file.
- (message_info_load): Fixed up the time_t saving/loading. There
- was a reason the warning was left there ... obviously nobody could
- read the comment "/* warnings, leave them here */", why do i even
- bother.
- (camel_folder_summary_decode_time_t): Decode a time_t value from
- the summary file.
- (camel_folder_summary_encode_time_t): Encode a time_t value to the
- summary file.
-
-2000-10-03 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-command.c (camel_imap_command): Quote
- the mailbox name when sending a SELECT request otherwise mailboxes
- with spaces in their names will cause problems.
-
- * camel-mime-message.c (camel_mime_message_set_reply_to): encode
- before setting.
- (camel_mime_message_set_from): Same.
-
-2000-10-03 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-command.c: New file containing
- camel_imap_command and friends. Major camel_imap_command rewrite
- to remove duplicated code, make the parsing of literals be
- more safe/correct, deal with RECENT/EXPUNGE responses more
- consistently, and make it possible to implement the AUTHENTICATE
- command.
-
- * providers/imap/camel-imap-utils.c (imap_parse_nstring): New
- function, to parse an IMAP "nstring".
-
- * providers/imap/camel-imap-store.c: Move command stuff to
- camel-imap-command.c. Update for camel_imap_command changes.
-
- * providers/imap/camel-imap-folder.c: Update for
- camel_imap_command changes.
- (imap_append_message): CRLF filter the message before sending it.
-
- * providers/imap/Makefile.am: Add camel-imap-command.[ch], remove
- camel-imap-stream.[ch] for now.
-
-2000-10-02 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-message.c (camel_mime_message_has_8bit_parts): New
- convenience function to determine if there are any 8bit mime parts
- in a mime message.
- (camel_mime_message_encode_8bit_parts): New convenience function
- to recursively reencode all 8bit mime parts to either
- quoted-printable or base64 depending on which would be the best
- encoding for that part.
-
- * providers/smtp/camel-smtp-transport.c (smtp_data): If the mime
- message contains 8bit parts and the server doesn't support 8bit
- transfers, reencode those parts before proceding with the send.
- (smtp_mail): If the mime message contains 8bit parts and the
- server supports the 8BITMIME extension to SMTP, notify the server
- that we'll be sending it 8bit mime parts.
- (_send_to): Find out if the message contains 8bit parts.
-
-2000-10-02 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.c (_send_to): Use the
- CamelInternetAddress parser.
- (smtp_get_email_addr_from_text): deprecated.
-
-2000-10-02 Dan Winship <danw@helixcode.com>
-
- * camel-provider.h: Remove default_ports.
-
- * camel-remote-store.c (remote_connect): Get default_port from
- CamelRemoteStore rather than CamelProvider.
-
- * providers/{imap,nntp,pop3}/camel-*-store.c: Initialize
- CamelRemoteStore::default_port
-
- * providers/*/camel-*-provider.c: Remove default_ports.
-
-2000-10-02 Dan Winship <danw@helixcode.com>
-
- * camel-folder.[ch]: Remove
- camel_folder_{get,free}_subfolder_info, as we want to be able to
- scan the whole subfolder tree without having to open any folders,
- so this needs to be in CamelStore. Remove can_hold_folders and
- can_hold_messages flags; things that don't hold messages are no
- longer considered CamelFolders.
-
- * camel-folder-summary.[ch]: Remove CamelFolderInfo stuff.
-
- * camel-store.[ch]: Add camel_store_{get,free}_folder_info, as
- well as camel_store_free_folder_info_full and ..._nop for default
- implementations, and camel_folder_info_free and
- camel_folder_info_build as convenience functions. Turn
- CamelFolderInfo into a tree structure and also add an "url"
- member.
-
- * providers/*/camel-*-folder.c: Remove subfolder_info and can_hold
- stuff.
- * providers/*/camel-*-store.c: Add folder_info stuff.
-
- * providers/imap/camel-imap-folder.c (imap_summary_free): Free the
- summary elements with camel_message_info_free, not
- camel_folder_info_free. Oops.
-
- * providers/imap/camel-imap-utils.c: const poison
-
-2000-09-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.c: Fixed some memory leaks.
- (camel_smtp_transport_init): Initialize supports_8bit to FALSE.
- (smtp_helo): If server supports 8bit, set supports_8bit to TRUE.
-
- * camel-transport.h (struct _CamelTransport): Added variable
- gboolean supports_8bit (we'll need this eventually? - see bugzilla
- bug #53)
-
- * providers/smtp/camel-smtp-transport.c
- (smtp_get_email_addr_from_text): Ugh, no wonder people were
- getting illegal seek warnings *sigh*. I guess I can only blame
- myself for this one though :-(
-
-2000-09-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.c (_send_to): Don't send the
- recipient data through smtp_get_email_addr_from_text - this is a
- complete waste. In fact, we don't want to have to use that
- function ever.
-
- * camel-internet-address.c, camel-address.c: Added some gtk-doc
- comments.
-
-2000-09-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-utils.c (header_encode_string): Make sure to add the
- space char after an encoded word when the encoding is iso-8859-1.
-
-2000-09-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_message): When
- getting a literal string response, don't include the \r\n after
- the closing } (as in: "... {798}\r\n...")
-
- * providers/imap/camel-imap-stream.c (stream_read): Same.
-
-2000-09-28 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-utils.c (header_fold): New function to fold headers.
-
-2000-09-27 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-parser.c (folder_scan_header): If we had an empty
- header, then it must be end of the headers too.
- (folder_scan_init): No we dont need to init the outbuf with a nul
- terminator.
-
- * camel-folder-summary.c (camel_folder_summary_set_uid): New
- function to reset the uid to a higher value.
-
- * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_sync):
- "something failed (yo!)" what sort of crap is this? Fixed all the
- indenting again, what wanker keeps running stuff through indent?
- (message_info_new): Check the uid we loaded off the disk, if it
- existed already, assign a new one. If it didn't then make sure
- the nextuid is higher.
-
- * camel-charset-map.c: New file, used to build a large unicode
- decoding mapping table, and use it to determine what is the
- lowest charset a given word can be encoded with. Uses tables from
- libunicode's source.
-
- * camel-internet-address.c (internet_encode): Use
- header_phrase_encode to properly encode the fullname, as required.
- refixed indenting. Who keeps doing that?
- (camel_internet_address_find_address): Changed fatal return/warnings
- into assertions.
-
- * camel-mime-utils.c (header_raw_append_parse): Check : explicitly
- (removed from is_fieldname() macro).
- (camel_mime_special_table): Changed to short, so we can represent
- more bit types.
- (quoted_encode): Take a mask of the safe chars for this encoding.
- (header_address_decode): Removed a #warning that makes no sense
- anymore.
- (header_decode_date): Fixed the 'broken date' parser code, if it
- ever decoded it it just threw away the result.
- (header_encode_string): Use better charset matching for encoding
- strings as well.
-
-2000-08-31 Not Zed <NotZed@HelixCode.com>
-
- * providers/mh/camel-mh-summary.c (camel_mh_summary_sync): Save
- the index if we do a sync.
- (camel_mh_summary_check): Save the index here too. Probably.
-
-2000-09-27 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-store.c (camel_imap_command_extended):
- Return untagged data in a GPtrArray rather than a string, since it
- saves processing time and is much easier to deal with for several
- commands. Update for camel_imap_folder_changed change.
- (camel_imap_fetch_command): Update for camel_imap_folder_changed
- change.
- (imap_connect, imap_folder_exists): Update for
- camel_imap_command_extended change.
-
- * providers/imap/camel-imap-folder.c
- (imap_get_message_count_internal,
- imap_get_subfolder_info_internal, imap_search_by_expression):
- Update for camel_imap_command_extended change.
-
- (imap_get_summary_internal, imap_get_message_info_internal): Use
- camel_imap_fetch_command here now to get around the
- camel_imap_command_extended change.
-
- (camel_imap_folder_changed): turn expunged into a GArray of ints
- rather than a GPtrArray of strings representing ints.
-
-2000-09-26 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c
- (imap_get_message_count_internal): Quote the folder name as it may
- contain spaces.
- (imap_get_subfolder_info_internal): Same.
-
- * providers/imap/camel-imap-utils.c (imap_parse_list_response): Do
- proper unquoting for folder names.
- (func_get_current_date): Implemented.
-
- * providers/imap/camel-imap-store.c
- (imap_folder_exists): Quote the folder name as it may have spaces.
- (imap_create): Same.
- (check_current_folder): Same.
-
-2000-09-22 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-folder.c
- (imap_get_subfolder_info_internal): The root folder's name is "",
- not the namespace.
- (camel_imap_folder_new): constify folder_name.
-
- * providers/imap/camel-imap-store.c (get_folder): Create the
- folder with folder_name, not folder_path.
- (camel_imap_command_preliminary): Don't free cmdid here.
-
-2000-09-21 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-utils.c (imap_create_flag_list): New
- function to convert Camel flags to an IMAP flag_list.
- (imap_parse_flag_list): Contrariwise.
-
- * providers/imap/camel-imap-store.c (camel_imap_command_*): Make
- the @ret arg actually optional, as (mostly) documented.
- (various): Don't pass "&result" to camel_imap_command_* if we're
- just going to immediately free it. Don't record status if we're
- not going to look at it.
-
- * providers/imap/camel-imap-folder.c: Likewise.
- (imap_summary_free): Use camel_folder_info_free.
- (imap_sync): Use imap_create_flag_list. Clear
- CAMEL_MESSAGE_FOLDER_FLAGGED after syncing so we don't keep
- re-syncing.
- (imap_append_message): Use imap_create_flag_list. Don't leak the
- memstream if the append fails.
- (imap_move_message_to): Use camel_folder_delete_message rather
- than doing it by hand.
- (imap_get_summary_internal, imap_get_message_info_internal): Use
- imap_parse_flag_list and header_raw_clear.
- (camel_imap_folder_changed): Use camel_message_info_free.
-
-2000-09-21 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-store.c (get_folder_name): INBOX is
- case-insensitive.
- (get_root_folder_name): Make the root folder "" rather than "/".
- (get_folder): Update for root folder name change.
- (camel_imap_store_get_toplevel_dir): Removed. (Unused, unneeded.)
- (camel_imap_store_folder_path): New function to turn a Camel
- folder name into the corresponding namespaced IMAP path.
- (imap_folder_exists): Make this take a store and a path rather
- than a folder.
- (imap_create): Likewise
- (get_folder): Update for camel_imap_store_folder_path and other
- changes.
- (check_current_folder): Likewise.
-
- * providers/imap/camel-imap-folder.c: Change a bunch of CamelStore
- variables to CamelImapStore (and add a few more) to prevent excess
- gratuitous casting. Use camel_imap_store_folder_path where
- appropriate.
- (camel_imap_folder_new): Update for root folder name change.
-
-2000-09-19 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.c (smtp_data): Use the
- linewrap filter to achieve full RFC0821 compliance.
-
- * camel-mime-filter-linewrap.[c,h]: New mime-filter to word-wrap.
-
-2000-09-19 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-internet-address.c (internet_encode): When encoding the
- internet address, quote the name as the name may have commas or
- any other token which may later confuse our address parser.
-
-2000-09-19 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-folder.c
- (imap_get_subfolder_info_internal): Fix the case where INBOX
- isn't returned in the folder listing.
-
-2000-09-19 Dan Winship <danw@helixcode.com>
-
- * camel-folder.c: (init): Removed
- (camel_folder_init, camel_folder_construct): New object init
- function and public object constructor to replace the old init
- method in a more Gtk-like fashion.
-
- (get_parent_folder, camel_folder_get_parent_folder): Removed. No
- CamelFolder subclass was ever setting the parent_folder member, no
- code has ever needed to look at it, and fixing it would actually
- be pretty hard.
-
- (get_subfolder_info, camel_folder_get_subfolder_info): Renamed
- from ..._names. Deals in CamelFolderInfo now.
- (free_subfolder_info, camel_folder_free_subfolder_info): Likewise.
-
- (get_subfolder, camel_folder_get_subfolder): Removed.
- CamelFolderInfo contains the subfolder's full name, so this is
- unnecessary now, and removing it lets us get rid of the
- CamelFolder separator member, which is needed for the default
- implementation of this function, but not otherwise needed for most
- providers.
-
- Also, lots of code style fixes.
-
- * providers/*: Update CamelFolder subclasses for changes, although
- none of them fill in the message counts in the CamelFolderInfo
- yet.
-
-2000-09-18 Christopher James Lahey <clahey@helixcode.com>
-
- * camel-folder-search.c, camel-folder-search.h,
- camel-remote-store.c, providers/imap/camel-imap-folder.c,
- providers/imap/camel-imap-store.c: Fixed the #include lines to
- deal properly with gal.
-
-2000-09-17 Dan Winship <danw@helixcode.com>
-
- * camel-folder-summary.h: update CamelFolderInfo
- * camel-folder-summary.c (camel_folder_info_free): New function to
- free the contents of a CamelFolderInfo
-
-2000-09-15 Dan Winship <danw@helixcode.com>
-
- * camel.c (camel_init): Set camel_verbose_debug to TRUE if
- CAMEL_VERBOSE_DEBUG is set in the environment.
-
- * camel-remote-store.c (remote_send_line, remote_recv_line): only
- log if camel_verbose_debug is TRUE.
-
-2000-09-14 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (get_folder): Don't use
- dir_sep as top-level directory, use "/".
-
- * providers/imap/camel-imap-folder.c (imap_expunge): Get rid of
- unused variable.
-
-2000-09-13 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_expunge): Don't look at
- the response of the command. camel_imap_command_extended()
- processes EXPUNGE responses itself, so if we do it here too we
- remove twice as many summary items as we should.
-
-2000-09-13 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (imap_folder_exists): Rewrote
- to take a third argument (gboolean *selectable) so that we can
- find out if the folder is selectable or not as we look to see if
- it exists. Also, don't use EXAMINE because that will not work on
- non-selectable folders, so use LIST instead.
- (get_folder): Check to see if the folder exists even vefore
- calling imap_create as this will save time. If the folder does
- exist, find out if it's selectable. Moved the call to refresh_info
- here.
-
- * providers/imap/camel-imap-folder.c (imap_get_uids): Check for a
- NULL summary.
- (camel_imap_folder_new): Don't call refresh_info here - call it in
- get_folder() because we don't know if this folder even exists on
- the server yet! And even if it does, we don't know if it can hold
- messages or not yet.
-
-2000-09-12 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-parser.c (folder_scan_step): Make sure *datalength is
- > 0 before calling camel_mime_filter_filter otherwise we will get
- a segfault if the filter calls iconv().
-
-2000-09-08 Christopher James Lahey <clahey@helixcode.com>
-
- * providers/nntp/camel-nntp-auth.c,
- providers/nntp/camel-nntp-auth.h: Fixed a warning.
-
-2000-09-07 Dan Winship <danw@helixcode.com>
-
- * camel-session.c (camel_session_get_storage_path): Make this not
- leak.
-
-2000-09-07 Dan Winship <danw@helixcode.com>
-
- * camel-session.c (camel_session_new): Make this take a path to a
- directory that Camel can use for its own nefarious purposes.
- (camel_session_get_storage_path): New function to return a path
- that a service can use for its own nefarious sub-purposes.
-
- * camel-service.c (camel_service_get_path): New method (and
- useful default implementation) to get a (relative) pathname
- corresponding to the service.
-
-2000-09-06 Dan Winship <danw@helixcode.com>
-
- * providers/pop3/camel-pop3-store.c (connect_to_server): Make KPOP
- work again.
-
-2000-09-06 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-message.c (camel_mime_message_get_received_date):
- Implemented (someone added these to camel-mime-message.h but never
- implemented them!!) - though it may not be right.
- (camel_mime_message_get_sent_date): Same.
-
-2000-09-05 Dan Winship <danw@helixcode.com>
-
- * camel-mime-part.c (camel_mime_part_get_filename): If a MIME part
- has no Content-Disposition, but does have a "name" on the
- Content-Type, return that as the filename.
- (process_header): strstrip the Content-Description
-
-2000-09-05 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-utils.c (get_OVER_headers): care about
- response code.
- (get_HEAD_headers): same.
- (camel_nntp_get_headers): same.
-
- * providers/nntp/camel-nntp-store.h: get rid of
- CAMEL_NNTP_OK/ERR/FAIL.
-
- * providers/nntp/camel-nntp-store.c
- (camel_nntp_store_get_extensions): take CamelException arg and
- pass along to camel_nntp_command.
- (camel_nntp_store_get_overview_fmt): same.
- (nntp_store_connect): convert to using constants in
- camel-nntp-resp-codes.h
- (nntp_store_get_folder): make use of camel_nntp_folder_new.
- (camel_nntp_command_send_recv): new function to deal with auth
- challenge.
- (camel_nntp_command): split out most of this function into
- camel_nntp_command_send_recv. also, return the actual response
- code instead of CAMEL_NNTP_OK/ERR/FAIL.
-
- * providers/nntp/camel-nntp-resp-codes.h: new file.
-
- * providers/nntp/camel-nntp-folder.h: prototype for
- camel_nntp_folder_new.
-
- * providers/nntp/camel-nntp-folder.c (camel_nntp_folder_new): new
- convenience function.
- (nntp_folder_get_message): care more about the actual response
- code.
-
- * providers/nntp/Makefile.am (libcamelnntp_la_SOURCES): add
- camel-nntp-auth.c.
- (libcamelnntpinclude_HEADERS): add camel-nntp-auth.h.
-
- * providers/nntp/camel-nntp-auth.h: new file.
-
- * providers/nntp/camel-nntp-auth.c: new file.
-
-2000-09-05 Peter Williams <peterw@helixcode.com>
-
- * providers/imap/camel-imap-store.c (imap_folder_exists): Don't free the
- result on error; the exception will have the relevant info.
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Check for
- exceptions here.
-
- * providers/imap/camel-imap-store.c (imap_connect): Check the exception
- on the refresh_folders call.
-
- * providers/imap/camel-imap-store.h: Clean up some now-unused fields.
-
- * camel.c (camel_init): Call unicode_init again, now that libunicode
- will not initialize itself twice.
-
-2000-09-02 Lauris Kaplinski <lauris@helixcode.com>
-
- * camel-folder-search (search_header_contains): Use e_utf8_strstrcase
-
-2000-09-01 Christopher James Lahey <clahey@helixcode.com>
-
- * providers/imap/camel-imap-utils.c: Removed some unused
- functions.
-
-2000-09-01 Peter Williams <peterw@helixcode.com>
-
- * providers/nntp/camel-nntp-store.c (camel_nntp_command): Initialize
- the statically-allocated CamelException so that it doesn't contain
- junk data that camel_exception_set() may try to free.
- (camel_nntp_store_get_extensions): Same.
- (camel_nntp_store_get_overview_fmt): Same.
-
- * providers/pop3/camel-pop3-store.c (camel_pop3_command): Typo
- fix (if (*ret) -> if (ret)).
-
- * providers/pop3/camel-pop3-store.c (pop3_connect): Set the
- port # back to what was specified ASAP, so that the hash of
- the URL doesn't change (which causes a failure in
- service_cache_remove that leads to a segfault).
-
- * providers/imap/camel-imap-store.c (imap_connect): Clear the
- exception after a failed LOGIN so that it doesn't pass through
- to the upper level and make mail think that the login failed.
-
- * providers/pop3/camel-pop3-store.c (pop3_connect): As above.
-
-2000-08-31 Peter Williams <peterw@helixcode.com>
-
- * providers/pop3/camel-pop3-store.c (camel_pop3_store_get_type):
- Implement POP3 with the CamelRemoteStore now.
- (connect_to_server): Hack this a bit to get KPOP to work. Obey
- the new connection semantics of the remote store (implicitly).
- (query_auth_types_connected): Clear exceptions after attempts
- to connect; the code at the bottom will catch hard errors.
- Use camel_service_connect.
- (camel_pop3_command): Take a CamelException; now, when an error
- occurs, ret is set to NULL and the exception passes back the
- appropriate information.
- (pop3_get_response): Same as above.
- (pop3_try_authenticate): Give camel_pop3_command its exception
- and handle it properly.
- (pop3_connect): Call the parent classfuncs. Don't disconnect
- on error (done for us).
-
- * providers/pop3/camel-pop3-folder.c: Obey the camel_pop3_command
- semantics.
-
- * camel-remote-store.c (remote_query_auth_types_connected): Don't
- warn; just return NULL.
- (remote_query_auth_types_generic): Same.
- (remote_send_string): Filter out passwords in debugging output.
-
- * providers/pop3/camel-pop3-store.c (camel_pop3_store_init): Also
- set the ALLOW_AUTH flag.
-
- * providers/imap/camel-imap-store.c (camel_imap_store_init): Same.
-
-2000-08-31 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-store.c (camel_nntp_store_class_init):
- remove get_folder_name.
- (nntp_store_get_folder_name): remove.
-
-2000-08-31 Lauris Kaplinski <lauris@helixcode.com>
-
- * camel-mime-part.c (write_to-stream): Use filter only if we have one
-
-2000-08-31 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-utils.c (get_OVER_headers): use
- camel_remote_store_recv_line.
-
- * providers/nntp/camel-nntp-folder.c (nntp_folder_get_message):
- use camel_remote_store_recv_line to build message. also, free our
- buffer so we don't leak like mad.
-
- * providers/nntp/camel-nntp-store.c:
- (camel_nntp_store_get_additional_data) remove.
- (camel_nntp_store_get_extensions): use
- camel_remote_store_recv_line.
- (camel_nntp_store_get_overview_fmt): same. also, don't rely on
- _get_additional_data anymore since it's easier to parse without.
- (camel_nntp_command): use camel_remote_store_send_string and
- camel_remote_store_recv_line.
-
- * providers/nntp/camel-nntp-store.h: CamelRemoteStore is the
- parent class now. remove istream/ostream since CamelRemoteStore
- takes care of that for us. also remove the prototype for
- camel_nntp_store_get_additional_data.
-
- * providers/nntp/camel-nntp-newsrc.c (camel_nntp_newsrc_write):
- make sure to clear dirty bit.
- (camel_nntp_newsrc_read_for_server): don't worry about continually
- trying to open the file - if it fails we just return an
- unpopulated .newsrc file.
-
-2000-08-31 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-newsrc.c
- (camel_nntp_newsrc_read_for_server): make this a bit more robust.
- try to create an empty .newsrc file for the server if we can't
- open it for reading. also, don't allocate everything until we've
- opened the file.
-
- * providers/nntp/camel-nntp-utils.c (get_OVER_headers): make use
- of our overview field indices.
- (camel_nntp_get_headers): only call get_OVER_headers if the
- extension is present. warn if it's not - since get_HEAD_headers
- needs work before it works.
-
- * providers/nntp/camel-nntp-store.c
- (camel_nntp_store_get_extensions): new function - query the server
- for it's extensions.
- (camel_nntp_store_get_overview_fmt): new function - query the
- server for the overview format and build our table of the indices
- we care about. support the "full" suffix on fields.
- (nntp_store_connect): call camel_nntp_store_get_extensions and
- camel_nntp_store_get_overview_fmt.
-
- * providers/nntp/camel-nntp-store.h: add codes for extensions
- found on news.mozilla.org. only one that we care about is OVER.
- also, add CamelNNTPOverField and an enum of the overview fields
- that we care about.
-
-2000-08-31 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-utils.c (imap_translate_sexp):
- Reimplemented. It should now work correctly for most possible
- VFolder rules.
-
-2000-08-31 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (camel_imap_command_extended):
- Don't save any exceptions caused by camel_imap_folder_changed
- (camel_imap_fetch_command): Same.
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_changed):
- Using a new way of calculating the first recent message that seems
- more accurate. Also added code to make sure we don't accidently
- add a duplicate summary.
-
-2000-08-31 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-part.c (write_to_stream): Use the proper type
- checking function to check for text types.
- (write_to_stream): If we have a charset on a text type that
- isn't us-ascii or utf-8, then we need to reencode it, so add a
- filter to do that too.
- (write_to_stream): Fix some warnings/use the right constructor,
- oops.
- (write_to_stream): Rearrange the logic so it always does charset
- conversion, and not just if we have a qp/base64 block.
-
- * camel-mime-utils.c (append_latin1): New function - even though
- its broken, we'll assume mailers send latin1 headers instead of
- us-ascii. We just have to encode high chars into utf-8.
- (header_decode_text): Call append_latin1 for appending unencoded
- text segments.
- (append_latin1): Do an additional mask for account for c's
- undefined behaviour for sign extension whilst shifting right.
-
-2000-08-30 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (camel_imap_fetch_command):
- Rewrote to ignore strings that look like server responses until it
- is sure that it has finished reading the literal string response.
-
-2000-08-30 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-remote-store.c (remote_send_string): Don't wrap printed
- strings in quotes, makes things messy
-
- * providers/imap/camel-imap-folder.c (imap_get_message): Updated
- to use the camel_imap_fetch_command
-
- * providers/imap/camel-imap-stream.c (stream_read): Updated to use
- camel_imap_fetch_command
-
- * providers/imap/camel-imap-store.c (camel_imap_command_extended):
- No longer handles FETCH requests so no longer needs to be
- concerned with checking to make sure that server responses are
- valid (they have to be).
- (camel_imap_fetch_command): New convenience function that handles
- all FETCH requests
-
-2000-08-30 Peter Williams <peterw@helixcode.com>
-
- * camel-remote-store.c (remote_connect): Unify with remote_post_connect.
- (remote_disconnect): Unify with remote_pre_disconnect.
- (camel_remote_store_class_init): Don't use the post_connect and
- pre_disconnect classfuncs anymore ; they weren't especially useful.
-
- * providers/imap/camel-imap-store.c (imap_connect): Use this again
- instead of implementing post_connect.
- (imap_disconnect): Analogous to above.
-
- * camel-session.c (camel_session_get_service_connected): New function.
- Like camel_session_get_service() but also connects to the service
- if needed. camel_session_get_{store,transport} (defined in the header)
- used this now, preventing annoying when-to-connect problems.
-
- * camel-service.c (camel_service_new): Revert to the old behavior
- of not connecting until told to do so. Otherwise doing auth
- testing correctly is really hard.
- (camel_service_connect): Fix behavior here (set the connected
- flag).
- (camel_service_disconnect): Unset the connected flag.
-
-2000-08-30 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c: General cleanup / moving
- stuff around to make things easier to follow.
-
-2000-08-30 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-remote-store.c: Prevent exceptions from being overwritten
-
- * providers/imap/camel-imap-folder.c (imap_expunge): Beautified
- (imap_get_subfolder_names_internal): Removed old code as the
- replacement code has now been tested and proven to work
-
-2000-08-29 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-utils.c: Removed old code that will
- never be needed again
-
- * providers/imap/camel-imap-store.c: Removed old code for
- try_connect - will never need this code
- (slurp_response): Update to make sure we aren't falsely detecting
- EXPUNGE flags
-
-2000-08-29 Peter Williams <peterw@helixcode.com>
-
- * camel-service.c (camel_service_connect): Uncomment this.
- (camel_service_disconnect): Same.
-
- * camel-remote-store.[ch]: New files. Abstract remote storages
- (IMAP, POP3, NNTP) and hides the lower-level networky stuff.
-
- * camel-service.c (camel_service_new): Take an extra argument, the
- provider that created us, cause it's useful.
- (camel_service_finalize): Unref our new provider member.
-
- * camel-session.c (camel_session_get_service): Pass the proper number of
- arguments to camel_service_new().
-
- * camel-imap-store.c: Massive update: 1) use the CamelRemoteService to
- make our life Very Easy (TM). 2) Change the semantics of all
- camel_imap_command* functions to take exceptions, centralize tons of
- duplicate code, and use the handy RemoteStore utility functions
-
- * camel-imap-folder.c: Use the new semantics of camel_imap_command*
-
- * camel-imap-stream.c: Same.
-
-2000-08-29 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (camel_imap_command_extended):
- Updated to check for EXPUNGE notifications
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_changed):
- Updated to account for messages which have been expunged (now
- takes a new arg, a GPtrArray of message id's that have been
- expunged)
- (imap_expunge): Updated (we may want to just use the code in
- folder_changed now instead of doing our own summary
- expunging...but that can be fixed later)
- (imap_append_message): Updated.
- (imap_copy_message_to): Updated.
- (imap_move_message_to): Updated.
-
-2000-08-28 Peter Williams <peterw@helixcode.com>
-
- * camel-folder.c (camel_folder_refresh_info): New member function,
- refresh_info, used for rereading folder state after its state has
- somehow become unknown. Tries to preserve last-known status of
- messages.
-
- * providers/mbox/camel-mbox-folder.c (mbox_refresh_info): Implement
- ::refresh_info (split up ::init)
-
- * providers/mbox/camel-mbox-store.c (get_folder): Call ::refresh_info.
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Call
- ::refresh_info once initialized.
- (imap_refresh_info): New member function; reads the summary from
- the server (used to be in camel_imap_folder_new; split out).
-
- * providers/imap/camel-imap-store.c (imap_connect): Set
- CamelService::connected a little early so that
- camel_imap_command won't try to connect while already
- connnecting.
- (camel_imap_command*): Try to connect if not connected already.
-
- * providers/pop3/camel-pop3-folder.c (pop3_refresh_info): Same as above.
-
- * providers/pop3/camel-pop3-folder.c (camel_pop3_folder_new): Same
- as above.
-
- * providers/pop3/camel-pop3-store.c (pop3_connect): Set
- CamelService::connected a little early so that
- camel_pop3_command won't try to connect while already
- connecting
- (connect_to_server): Same.
-
- * providers/nntp/camel-nntp-folder.c (nntp_folder_refresh_info): Same
- as above.
-
-2000-08-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_message): Fixed the
- hack around quoted string responses - should now handle them
- according to the specifications in the RFC
-
- * providers/imap/camel-imap-stream.c (stream_read): Updated to
- match the code currently used in camel-imap-folder.c
-
-2000-08-28 Ettore Perazzoli <ettore@helixcode.com>
-
- * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_sync):
- Never ever free `tmpname' as it comes from `alloca()'!
-
-2000-08-26 Ettore Perazzoli <ettore@helixcode.com>
-
- * camel-mime-utils.c (header_decode_text): Use `g_free()', not
- `free()', to free `decword'.
-
-2000-08-25 Peter Williams <peterw@helixcode.com>
-
- * camel.c (camel_init): Don't call unicode_init; code in e-util
- will do it, and if unicode_init is called twice, you get an
- infinite loop when looking up nonexistant encodings (patch
- has been submitted to libunicode's maintainer).
-
- * camel-provider.h: Add a new field, default_ports, which
- helps the configuration code guess about how to make CamelURL's
- from providers.
-
- * providers/*/camel-*-provider.c: Specify default ports.
-
-2000-08-25 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c
- (imap_get_subfolder_names_internal): If the url path is "/" and
- the folder path is "/", just LIST "" "*" (this should fix some
- cyrus imapd problems). Also, INBOX is case insensitive so use
- g_strcasecmp
-
-2000-08-24 Lauris Kaplinski <lauris@helixcode.com>
-
- * camel-folder-summary.c (summary_build_content_info):
- Use UTF-8 as default
- * camel-mime-part-utils.c (simple_data_wrapper_construct_from_parser):
- Use UTF-8 as default
- * camel-mime-utils.c (rfc2047_decode_word): Use UTF-8
-
-2000-08-17 Not Zed <NotZed@HelixCode.com>
-
- * providers/mh/camel-mh-folder.c (mh_finalize): And here too.
-
- * providers/mbox/camel-mbox-folder.c (mbox_finalize): Close index
- on exit.
-
-2000-08-23 Dan Winship <danw@helixcode.com>
-
- * camel-mime-utils.c (header_address_list_format_append): put
- commas between addresses.
-
-2000-08-22 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-folder.c
- (imap_protocol_get_summary_specifier): use BODY.PEEK, not BODY, so
- we don't set the message \Seen.
-
-2000-08-22 Christopher James Lahey <clahey@helixcode.com>
-
- * providers/pop3/camel-pop3-store.c: Fixed a small warning.
-
-2000-08-22 Peter Williams <peterw@helixcode.com>
-
- * camel-service.c (camel_service_new): Connect automatically if the
- URL is not empty.
- (finalize): Disconnect automatically if connected.
- (camel_service_query_auth_types): Split into two functions; one to
- be called if we're connected to an actual server (_connected), one
- to be called if we're just gauging the general authtypes supported
- (_generic).
- (is_connected): Remove.
-
- * camel-store.c (camel_store_get_folder): Don't connect explicitly to
- the service.
-
- * providers/nntp/camel-nntp-store.c (query_auth_types_generic): Split
- the query_auth_types function. Hook it up in _new.
- (finalize): Don't try to disconnect here.
-
- * providers/pop3/camel-pop3-store.c (query_auth_types_generic): Same.
- (finalize): Don't try to disconnect here.
-
- * providers/imap/camel-imap-store.c (query_auth_types_generic): Same.
- (finalize): Don't try to disconnect here.
-
- * providers/smtp/camel-smtp-transport.c (query_auth_types_generic): Split
- the query_auth_types (dummy, in this case) function. Hook it up in _new.
- (finalize): Don't try to disconnect here.
-
-2000-08-21 JP Rosevear <jpr@helixcode.com>
-
- * providers/nntp/camel-nntp-folder.c (nntp_folder_get_subfolder_names):
- Make sure newsrc is not null
- (nntp_folder_get_subfolder_names): ditto
-
- * providers/nntp/camel-nntp-newsrc.c
- (camel_nntp_newsrc_get_subscribed_group_names): Programming check
- for newsrc == NULL
- (camel_nntp_newsrc_get_all_group_names): ditto
- (camel_nntp_newsrc_write_to_file): ditto
- (camel_nntp_newsrc_write): ditto
-
-2000-08-21 JP Rosevear <jpr@helixcode.com>
-
- * providers/nntp/camel-nntp-store.c (camel_nntp_command):
- Make sure respbuffer is not null before manipulating it.
- If it is null, return CAMEL_NNTP_FAIL and a decent error
- message.
-
-2000-08-18 Peter Williams <peterw@helixcode.com>
-
- * camel-internet-address.c (internet_encode): If the name is "" we
- weren't outputting anything; output the address at least.
-
-2000-08-16 Peter Williams <peterw@helixcode.com>
-
- * camel-internet-address.c (internet_encode): Fix a leak when
- name = "". It's a single-byte leak, but it's the little things
- that count.
-
- * camel-object.c (camel_type_lock_up): Don't leave the type
- system locked when a bad unlock happens.
-
- * providers/mbox/camel-mbox-store.c (get_folder): Fix a leak.
-
-2000-08-15 Peter Williams <peterw@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_copy_message_to): Typo fix.
-
-2000-08-14 Peter Williams <peterw@helixcode.com>
-
- * camel-folder-search.c (search_get_sent_date): New search function;
- returns the time_t when the message was sent.
- (search_get_receive_date): Same for when it was received.
- (search_get_current_date): Gets the current time for use with the
- above two. Is this in the right place?
-
- * camel-folder-search.h: Add the new functions above to the class.
-
-2000-08-13 Dan Winship <danw@helixcode.com>
-
- * providers/nntp/Makefile.am (libcamelnntpinclude_HEADERS): Add
- camel-nntp-utils.h
-
- * providers/imap/camel-imap-folder.c
- (imap_get_subfolder_names_internal): do a strcasecmp rather than
- just a strcmp when checking if a folder is "INBOX", since it is
- a case-insensitive name.
-
-2000-08-12 Dan Winship <danw@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_summary_internal):
- Don't assume the FETCH results will come back in the order they
- were requested.
- (imap_get_subfolder_names_internal): Add "INBOX" to the list as
- g_malloc'ed memory, not a static string.
-
-2000-08-12 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c
- (camel_imap_command_continuation): Now takes a char * parameter
- rather than a stream
- (camel_imap_command_continuation_with_stream): Same function as
- above but takes a stream parameter instead
-
- * providers/imap/camel-imap-folder.c (imap_append_message): Use
- camel_imap_command_continuation_with_stream
-
-2000-08-12 Dan Winship <danw@helixcode.com>
-
- * providers/pop3/camel-pop3-store.c (pop3_try_authenticate): New
- function to do one round of attempted authentication.
- (pop3_connect): Move a bunch of code out into
- pop3_try_authenticate and fix some bugs in the edge cases.
-
-2000-08-12 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (query_auth_types): No longer
- calls try_connect() to get authtypes
-
-2000-08-11 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c
- (camel_imap_command_continuation): Changed param order a bit and
- fixed some logic
-
- * providers/imap/camel-imap-folder.c (imap_append_message): Use
- the new multi-transactional convenience functions
-
-2000-08-11 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c
- (camel_imap_command_preliminary): New convenience function for
- multi-transactional commands (opening request)
- (camel_imap_command_continuation): New convenience function for
- multi-transactional commands (followup data)
-
-2000-08-11 Christopher James Lahey <clahey@helixcode.com>
-
- * providers/mh/camel-mh-folder.c: Fixed a warning.
-
-2000-08-11 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-folder.c
- (camel_nntp_folder_class_init): remove get_name and get_full_name
- assignments, since the camel-folder.c implementation does what we
- need.
-
-2000-08-11 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-store.c
- (camel_nntp_store_get_toplevel_dir): use g_get_home_dir, since
- evolution_dir isn't available in the providers.
-
-2000-08-11 Peter Williams <peterw@helixcode.com>
-
- * camel-folder.c (thaw): Fix a bug where the message_changed
- signal wasn't being emitted.
-
-2000-08-11 Not Zed <NotZed@HelixCode.com>
-
- * providers/mh/camel-mh-folder.c (mh_set_message_user_tag):
- Implement.
- (mh_get_message_user_tag): Implement.
-
- * providers/mbox/camel-mbox-folder.c (mbox_get_message_user_tag):
- (mbox_set_message_user_tag): Implement.
-
- * camel-folder.c (move_message_to): Yay so lets fix an already
- fixed fix, again.
- (copy_message_to): and here too ... update for api change to append().
- And removed another warning.
- (camel_folder_set_message_user_tag): Routine to set message tags.
- (camel_folder_get_message_user_tag): And accessor.
-
-2000-08-10 Christopher James Lahey <clahey@helixcode.com>
-
- * camel-folder-search.c, camel-folder-summary.c, camel-medium.c,
- camel-mime-filter-charset.c, camel-mime-filter.c,
- camel-mime-filter.h, camel-mime-message.c, camel-mime-parser.c,
- camel-mime-part-utils.c, camel-mime-part.c, camel-mime-utils.c,
- camel-movemail.c, camel-multipart.c, camel-object.c,
- camel-stream-mem.c, providers/mbox/camel-mbox-folder.c,
- providers/mbox/camel-mbox-summary.c,
- providers/mh/camel-mh-folder.c,
- providers/smtp/camel-smtp-transport.c: Fixed some warnings.
-
-2000-08-11 Not Zed <NotZed@HelixCode.com>
-
- * providers/vee/camel-vee-folder.c (vee_folder_build_folder): Free
- the search properly.
- (vee_folder_build): And here too.
-
-2000-08-10 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_changed):
- If we go over the max number of messages, don't keep requesting
- new message summaries, just break.
-
-2000-08-11 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-parser.c (folder_scan_header): A better way to
- compress leading whitespace. The code is probably invalid anyway,
- I dont think it will work across buffer boundaries.
-
- * providers/mbox/camel-mbox-folder.c (mbox_append_message): And
- write out proper format From lines here too.
-
- * providers/mbox/camel-mbox-summary.c
- (camel_mbox_summary_build_from): New function to build a more
- compatible mbox "From " line.
- (camel_mbox_summary_sync): Write From lines in the proper format.
-
-2000-08-10 Not Zed <NotZed@HelixCode.com>
-
- * providers/mh/camel-mh-store.c (get_folder): Remove warnin g.
-
- * providers/mbox/camel-mbox-store.c (xrename): Kill some warnings
- with constification.
-
- * providers/imap/camel-imap-folder.c (imap_append_message): Fixed
- for append api change. Eek this routine seriously wastes memory.
-
- * providers/mh/camel-mh-folder.c (mh_search_free): Impelemnt.
- (mh_append_message): Fix for api change, and include user flags
- and tags in new message.
-
- * providers/vee/camel-vee-folder.c (vee_search_by_expression): Fix
- for search api change.
-
- * camel-folder.c (camel_folder_search_free): New function for
- freeing search results.
- (search_free): Changed my mind, implement a default that actually
- does something. Free as to the old interface.
- (camel_folder_append_message): Changed to accept a
- camelmessageinfo rather than flags, which just doesn't have enough
- info in it.
- (copy_message_to): Change for append_message api change.
- (move_message_to): Likewise.
-
- * providers/mbox/camel-mbox-folder.c (mbox_search_free):
- Implement.
- (mbox_append_message): Fix for api change, and also copy user
- flags/tags across to new summary.
-
- * camel-folder-search.c (search_user_tag): A search expression
- that returns the current use flag by name.
- (camel_folder_search_free_result): New function to free the result
- of a search.
-
- * camel-folder-summary.c: Bump summary version.
- (message_info_new):
- (message_info_load):
- (message_info_save):
- (camel_message_info_dup_to):
- (camel_message_info_free): Added support for arbitrary tag/value
- pairs (CamelTag's).
- (camel_tag_get):
- (camel_tag_set):
- (camel_tag_list_size):
- (camel_tag_list_free): Operations for working with CamelTags.
-
-2000-08-09 Peter Williams <peterw@helixcode.com>
-
- * camel-store.c (camel_store_get_folder): Connect beforehand, if
- necessary.
-
- * providers/imap/camel-imap-store.c (camel_imap_store_init): Default
- the dir_sep to "/" so that certain functions can safely assume that
- dir_sep is valid (at least, nonnull).
-
-2000-08-09 Ettore Perazzoli <ettore@helixcode.com>
-
- * providers/nntp/camel-nntp-folder.c
- (nntp_folder_set_message_flags): Get rid of an unused variable.
-
- * providers/nntp/Makefile.am (INCLUDES): Fix includes so that we
- don't use installed headers anymore. [I copied this over from the
- IMAP provider, that does not seem to have this problem.]
-
-2000-08-09 Not Zed <NotZed@HelixCode.com>
-
- * camel-folder-search.c (camel_folder_search_execute_expression):
- Reorder search result in summary order if we searched with a
- summary.
-
-2000-08-08 Dan Winship <danw@helixcode.com>
-
- * camel-uid-cache.c: New code to keep an on-disk cache of what
- UIDs have been seen in a folder.
-
- * camel-provider.h: Add new flags CAMEL_PROVIDER_IS_SOURCE (mail
- can arrive in it by non-Camel means) and CAMEL_PROVIDER_IS_STORAGE
- (you can work with mail directly without needing to copy it local).
-
- * providers/*/camel-*-provider.c: Add flags as needed: imap and
- mbox are SOURCE and STORAGE. mh and nntp are just STORAGE, pop3 is
- just SOURCE.
-
- * camel-mime-message.c (process_header): Add another subject
- g_strstrip that fejj's earlier commit missed.
-
-2000-08-08 Peter Williams <peterw@helixcode.com>
-
- * camel-provider.h: Remove some GTK stuff that I missed.
-
- * providers/imap/camel-imap-store.c (imap_noop): Turn this
- back on with the new timeout interface in CamelSession.
-
- * camel-session.[ch] (camel_session_register_timeout): New
- interface for Camel to register timeouts. Basically the
- GTK timeout interface is copied. We do this because Camel isn't
- allowed to use GTK anymore.
-
-2000-08-07 Not Zed <NotZed@HelixCode.com>
-
- * providers/mh/camel-mh-folder.c (mh_append_message): Only retry
- another uid if we had a name clash, otherwise fail.
-
-2000-08-07 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c
- (imap_get_subfolder_names_internal): If we are trying to get a
- subfolder listing of the root folder, always make sure INBOX is
- there...
-
- * providers/imap/camel-imap-utils.c (imap_parse_list_response):
- Check for NIL as a directory separator.
-
-2000-08-07 Peter Williams <peterw@helixcode.com>
-
- * providers/nntp/Makefile.am: Reorder the INCLUDES to pull
- in the camel headers from the local source tree before
- the ones in $(includedir). This was causing compile problems
- because the installed, Gtk-based camel-object.h was included
- before the uninstall Camel-based one.
-
-2000-08-07 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-utils.c (imap_translate_sexp): Strip
- all \n's from the expression
-
- * string-utils.c (strip): New convenience function to strip
- occurences of a single char from a string
-
- * camel-mime-message.c (camel_mime_message_set_subject): Do a
- g_strstrip on the subject so we can stop getting those annoying
- leading spaces
-
-2000-08-07 Dan Winship <danw@helixcode.com>
-
- * camel-folder.c (camel_folder_free_deep): Fix this to not require
- NULL-termination of the array.
-
-2000-08-04 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (imap_connect): If we fail to
- get a dir_sep, then supply the default of "/".
- (get_folder): Undo changes by Peter
-
-2000-08-04 Peter Williams <peterw@helixcode.com>
-
- * providers/imap/camel-imap-store.c (get_folder): Prevent a coredump
- when get_folder()ing from a store with dir_sep = NULL.
-
-2000-08-04 Peter Williams <peterw@helixcode.com>
-
- * camel-store.h: Include camel-object.h. Ettore said this wasn't
- compiling.
-
-2000-08-04 Not Zed <NotZed@HelixCode.com>
-
- * camel-url.c (camel_url_set_protocol):
- (camel_url_set_host):
- (camel_url_set_path):
- (camel_url_set_port): Url editing functions.
-
-2000-08-04 Dan Winship <danw@helixcode.com>
-
- * providers/pop3/camel-pop3-folder.c (pop3_set_message_flags):
- (pop3_sync): Indexes into the flags array are message_number minus
- 1, not just message_number.
-
- * providers/pop3/camel-pop3-store.c: add a debugging macro for
- doing protocol tracing.
-
-2000-08-03 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Only
- call imap_get_summary_internal if the folder can hold messages
-
- * providers/nntp/camel-nntp-provider.c (camel_provider_module_init):
- Initialize the service_cache for the news/nntp providers
-
-2000-08-03 Peter Williams <peterw@helixcode.com>
-
- * providers/nntp/Makefile.am (INCLUDES): Add -I$(top_srcdir) to
- pull in libibex/ibex.h
-
-2000-08-02 Not Zed <NotZed@HelixCode.com>
-
- * providers/mh/camel-mh-summary.c (camel_mh_summary_sync): Expunge
- from the end, so the index isn't messed up when you remove a
- message.
-
- * providers/mh/camel-mh-folder.c (mh_append_message): Fix a bug
- where it would never open an output file/uid.
-
- * providers/mbox/camel-mbox-store.c (rename_folder):
- Implementation for mbox as well.
-
- * camel-store.c (camel_store_rename_folder): New method to rename folders.
- (rename_folder): Default implementation.
-
- * providers/mh/camel-mh-store.c (delete_folder): Implement this.
- (rename_folder): Implement a rename operation.
-
-2000-08-02 Dan Winship <danw@helixcode.com>
-
- * providers/MH: Kill this. It doesn't have any code to do anything
- the new mh provider doesn't do better.
-
- * providers/Makefile.am: Remove reference to MH subdir, and
- promote nntp to fully-supported status, since it does compile and
- all.
-
- * camel-mime-message.c (camel_mime_message_set_subject): Trim
- trailing space from the subject. I've now seen replies from two
- different people that tricked the threading code by (a) not having
- References/In-Reply-To, and (b) adding an extra space to the end
- of the subject line so the subject-based threading fails too. Who
- writes these broken mailers anyway?
-
-2000-08-01 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.c (smtp_helo): When forced
- to use the IP, place it in square brackets.
-
- * providers/imap/camel-imap-utils.c (imap_translate_sexp): New and
- improved sexp parser. An honest try at using e-sexp is wrapped in
- a #ifdef at the bottom of the file but is currently not used
-
- * providers/imap/camel-imap-folder.c (imap_search_by_expression):
- We want to do a UID SEARCH so we get UIDs back instead of sequence
- numbers
-
-2000-08-01 Not Zed <NotZed@HelixCode.com>
-
- * providers/mh: New mh provider implementation.
-
- * providers/Makefile.am (SUBDIRS): Added mh provider.
-
-2000-07-31 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_message_info_internal):
- Some IMAP servers don't wrap the UID in ()'s so don't depend on that
- (imap_get_summary_internal): Same
-
- * providers/imap/camel-imap-utils.c (free_sexp_node): Oops, forgot to
- free node->function - not good.
-
-2000-07-31 Peter Williams <peterw@helixcode.com>
-
- * providers/vee/camel-vee-folder.c (vee_search_by_expression): Add
- a NULL to the matches pointer array so that g_strfreev knows where
- the end is.
-
-2000-07-31 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-utils.c (imap_translate_sexp): New
- convenience function to translate a Camel sexp into the equivalent
- IMAP sexp.
-
- * providers/imap/camel-imap-store.c: More places now use
- imap_next_word
-
- * providers/imap/camel-imap-folder.c (imap_search_by_expression):
- Implemented initial version (this may or may not work quite right)
-
-2000-07-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_expunge): Make sure
- the third word/token (whatever) is "EXPUNGE" and not something
- else like "EXISTS" or "RECENT". When removing the message from
- the summary also make sure to free that data to avoid leakage.
- Also make sure to subtract 1 from the 'id' since IMAP starts
- at 1 and our summary starts at 0 :-)
-
-2000-07-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (camel_imap_status): Cleaned
- up a bit, now uses imap_next_word()
- (camel_imap_command_extended): Now uses imap_next_word(). When
- checking for RECENT, allow the first digit of the recent-count
- be between 0 and 9 inclusive instead of exclusive.
-
- * providers/imap/camel-imap-folder.c (imap_expunge): Optimized.
- No longer will it need to reload the summary as it now instead
- removes the appropriate message summaries from the cache.
- (camel_imap_folder_changed): If recent == 0 then return. If
- recent < 0 then just emit the folder_changed signal, don't reload
- summaries.
-
-2000-07-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c
- (imap_get_message_count_internal): Get message count when STATUS
- is not available.
- (imap_init): folder->has_search_capability is required for IMAP so
- should always be set to TRUE (is currently being set to FALSE as
- I've not yet implemented SEARCH support).
- (camel_imap_folder_changed): Seem to have fixed my optimization
- hack
-
-2000-07-28 Jon K Hellan <hellan@acm.org>
-
- * providers/imap/camel-imap-store.h (CamelImapServerLevel): New
- enum.
- (CamelImapStore): Added server_level and has_status_capability
- members.
-
- * providers/imap/camel-imap-store.c (imap_connect): Detect
- IMAP4REV1, IMAP4 and STATUS in capability response.
-
- * providers/imap/camel-imap-folder.c
- (imap_get_message_count_internal): Use STATUS only if server
- supports it. TODO: Get message count when STATUS not supported.
- (imap_get_message, imap_get_summary_internal,
- imap_get_message_info_internal): Handle IMAP4 as well.
- (imap_protocol_get_summary_specifier): New function: Make a data
- item specifier for the header lines we need, appropriate to the
- server level.
-
-2000-07-27 Peter Williams <peterw@helixcode.com>
-
- * camel-mime-utils.c (header_decode_lwsp): More
- checks for end of string.
-
- * providers/imap/camel-imap-store.c:
- (imap_command_extended): Free the elements of our
- array (huge mem leak)
-
- * providers/imap/camel-imap-folder.c:
- (summary_get_internal): Same as above.
-
-
-2000-07-27 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_changed):
- Fixed my routine to only fetch new headers, my IDs were off by 1
- on the high end, so when it would fetch the last newly arrived
- message it would fail and end up fetching all of the summaries
- because of the corruption.
-
-2000-07-27 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-url.c (camel_url_to_string): If the path doesn't begin
- with a / and there is a host, prepend a / to the path.
-
-2000-07-27 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/Makefile.am: Added camel-imap-utils.[c,h]
-
- * providers/imap/camel-imap-utils.[c,h]: Utilities for parsing
- server responses for use in both camel-imap-store.c and
- camel-imap-folder.c
-
- * providers/imap/camel-imap-folder.c (imap_get_summary_internal):
- Free all the pointers in the headers array.
- (imap_get_subfolder_names_internal): Updated to use
- imap_parse_list_response
- (imap_parse_subfolder_list): Removed in favor of
- imap_parse_list_response
-
- * providers/imap/camel-imap-store.c (camel_imap_command_extended):
- Free all the pointers in the data array.
- (imap_connect): Updated to use imap_parse_list_response and fixed
- a leak
- (folder_is_selectable): Updated.
-
-2000-07-27 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_message_info): Now
- uses a hash table for looking up message info rather than a linear
- search :)
-
-2000-07-27 Peter Williams <peterw@helixcode.com>
-
- * providers/*/Makefile.am: Don't specify SUBDIRS =
- [nothing]. Messes up distcheck.
-
-2000-07-26 Peter Williams <peterw@helixcode.com>
-
- * camel-mime-parser.c (folder_scan_init): Initialize
- outbuf to be "" -- it's not guaranteed to be zeroed.
-
- * camel-mime-utils.c (header_references_decode): Return
- if the header is NULL -> or "" <-. Don't do our stupid
- mailer trick if we point to \0.
- (header_decode_quoted_string): Don't rip past end of
- string!
-
-2000-07-26 Dan Winship <danw@helixcode.com>
-
- * camel-movemail.c (movemail_external): routine to call an
- external movemail program.
- (camel_movemail): Nuke return value, use movemail_external when
- available and useful, and don't delete "dest" on errors, since
- it might have started non-empty.
-
-2000-07-26 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-url.c (camel_url_to_string): Should now always prepend a '/'
- before the path if it doesn't already exist.
-
- * providers/imap/camel-imap-folder.c: Fixed a few compiler warnings
-
-2000-07-25 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_summary_free): Fixed the
- real problem that Peter was running into.
-
-2000-07-25 Dan Winship <danw@helixcode.com>
-
- * camel-mime-message.c (write_to_stream): Don't add a Mime-Version
- header to a message that already has one.
-
- * camel-internet-address.c (internet_encode): Don't put <>s around
- addresses with no name part.
-
-2000-07-25 Peter Williams <peterw@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_expunge): Set
- imap_folder->summary to NULL after calling imap_summary_free,
- so we don't get stuck with a junk summary pointer. Should
- we free it at all?
-
-2000-07-25 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_changed):
- Optimized to try and get the new message headers without reloading
- the entire summary from scratch.
- (imap_get_summary_internal): Will now sync() before attempting to
- reload the summary so that flags are set in the reloaded summary
- as well.
-
-2000-07-24 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (get_folder): Updated to give
- special attention to the root folder.
-
- * providers/imap/camel-imap-folder.c
- (imap_get_subfolder_names_internal): Updated to handle the root
- folder
- (imap_get_message_count_internal): return 0 if folder can't hold
- messages
- (camel_imap_folder_new): Change so that root folder gets special
- attention and always gets can_hold_messages set to FALSE
-
-2000-07-24 Dan Winship <danw@helixcode.com>
-
- * camel-folder.c: Remove exceptions from a number of methods that
- work on what ought to be static data: get_parent_folder,
- get_parent_store, get_message_count, get_unread_message_count,
- get_permanent_flags, get_message_flags, set_message_flags,
- get_message_user_flag, set_message_user_flag, get_uids,
- get_summary, get_subfolder_names. Turn camel_folder_delete_message
- into a macro. (Mostly a pull-up from the camel-async branch.)
-
- * providers/{imap,mbox,nntp,pop3,vee}: Update for CamelFolder
- changes
-
-2000-07-24 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_message_info): Updated
- to port easily to the new Camel API
- (imap_init): Don't SELECT INBOX, we don't need to do that
-
-2000-07-24 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_new):
- Initialize the summary and subfolder listing.
- (imap_summary_free): Now takes a GPtrArray arg rather than a
- CamelImapFolder as it increases it's usefullness for free()'ing
- temporary summaries.
- (imap_get_message_count_internal): A new convenience function for
- getting the actual message count on a server to be used by
- imap_get_summary_internal)
- (imap_get_message_count): Since the Camel API is on the move again,
- the future version of this function will not be able to make a
- call to the store, it must only access previously fetched data (thus
- the creation of the _internal function)
- (imap_get_subfolder_names_internal): Again, because the future version
- of imap_get_subfolder_names will not take an exception, we must rename
- this function which will be called by camel_imap_folder_new()
- (imap_get_subfolder_names): We now return the previously collected
- subfolder listing that the _internal function fetched previously
- (imap_get_summary_internal): Again, same idea as the previous _internal
- functions...
- (imap_get_summary): Again... now returns a previously aquired summary
-
- * providers/imap/camel-imap-store.c (imap_noop): This will hopefully
- prevent the imap store from disconnecting.
- (imap_connect): Modified to add a gtk timeout event that will call
- imap_noop() every 10 minutes (we may want to change this time value)
- (imap_disconnect): Modified to remove the NOOP timeout event from the
- store.
- (camel_imap_command_extended): Commented out the code that would try
- and detect if the store was disconnected and then reconnect if it was
- needed.
-
-2000-07-24 Dan Winship <danw@helixcode.com>
-
- * camel-folder.[ch]: Remove camel_folder_get_message_uid, which
- was not used, and not implemented by any provider.
-
- * providers/nntp/camel-nntp-folder.c: Remove get_message_uid
- non-implementation.
-
- * camel-folder-pt-proxy.[ch], camel-arg-collector.c,
- camel-marshal-utils.[ch]: Bye bye bye.
-
- * Makefile.am: remove reference to camel-arg-collector.c
-
-2000-07-23 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (imap_disconnect): Made it a
- little more forgiving. Also set current_folder to NULL as there is
- no selected folder after a disconnect.
- (stream_is_alive): Detects whether or not a socket is "alive"
- (camel_imap_command_extended): Use stream_is_alive() to aid in the
- detection of a disconnected state.
-
-2000-07-22 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (get_folder): Clear
- CamelExceptions when appropriate (eg when folder is marked as
- \NoSelect). Still needs some cleanup and perhaps Dan will have a
- better way of doing this as this seems like a messy way of
- handling this.
-
- * providers/imap/camel-imap-folder.c (imap_get_uids): Took out
- some debug statements as they are no longer needed.
-
-2000-07-21 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_subfolder_names):
- Updated to not strip out subfolders that are marked as \NoSelect
- because this will be correctly handled in store->get_folder from
- now on.
-
- * providers/imap/camel-imap-store.c (folder_is_selectable): New
- convenience function for use in get_folder().
- (parse_list_response): Now takes a char **flags argument which is
- needed by folder_is_selectable().
- (imap_connect): Updated to reflect changes to
- parse_list_response().
-
-2000-07-21 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-stream.c (stream_read): Updated with
- some of the same fixes I've made to camel-imap-folder.c like
- recalculating message part lengths.
-
- * providers/imap/camel-imap-store.c (camel_imap_command_extended):
- Rewrote the code to check for "* %d RECENT". Still needs to be
- modified, but should no longer cause an infinite loop by detecting
- mis-detecting RECENT messages.
-
-2000-07-20 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_summary):
- (imap_get_message_info): Oops. Fix UID parser to allow 0 and 9 to
- be in the range of valid UID chars.
-
-2000-07-20 Peter Williams <peterw@helixcode.com>
-
- * camel-object.c (camel_object_unref): Add a new global mutex
- 'refcount' held when refcounting operations occur.
-
-2000-07-19 Peter Williams <peterw@helixcode.com>
-
- * camel-object.c (camel_type_lock_up): Correct the recursiveness;
- the locklevel is stored as a private, so each thread has its own
- idea of the locklevel. Thus one thread can relock, but a different
- one will think that it's a level 0 and try to lock the type_system
- mutex.
-
-2000-07-19 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c: General cleanup working
- towards getting Actions->Expunge working correctly.
-
- * providers/imap/camel-imap-store.c
- (cammel_imap_command_extended): Added code to look for "* %d
- RECENT" and to emit the folder_changed signal if there are any
- recent messages. Note: this is a hack and needs to be rewritten
- badly.
-
-2000-07-19 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_summary): If the
- folder's message count is not the same as the number of summaries,
- free the old summary and create a new summary.
-
-2000-07-18 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c
- (camel_imap_folder_class_init): Added in
- imap_[g,s]et_message_user_flag() methods
- (imap_get_message_info): Rewrote to use the more efficient way of
- downloading summary information and also added a UID comparison so
- that if the UID requested doesn't match the UID received, it
- returns NULL. FIXME: When the mailer gets NULL when it requested
- message info, it seems that it displays a row for that message and
- when you try and select the blank row, it segfaults.
-
- * providers/imap/camel-imap-store.c (get_folder): Oops, this
- should not be checking against "/", it should be checking against
- dir_sep.
-
- * providers/imap/camel-imap-folder.c (imap_parse_subfolder_line):
- Updated to trim out the leading namespace.
- (imap_get_subfolder_names): Let the subfolder parser trim the
- namespace off the folder name.
-
-2000-07-17 Peter Williams <peterw@helixcode.com>
-
- * camel-object.c (camel_type_lock_up): New function; the
- Camel type_system lock is now fakey-recursive, being controlled
- by a semaphore that goes up and down and is protected by another
- lock. Theoretically all we need is the lock on the semaphore,
- but this we catch exceptions "better" (by deadlocking).
- (camel_type_lock_down): Corresponding to above.
- (all functions): s,G_LOCK,camel_type_lock_up, etc.
-
-2000-07-17 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (imap_disconnect): Send a
- "LOGOUT" command.
-
- * providers/imap/camel-imap-folder.c (imap_get_message): Hacks to
- get IMAP code to work with CommunigatePro and MS Exchange (and any
- other servers that send back a UID at the end of each FETCH inside
- of the main body of the message part).
- (imap_sync): Un-#if 0 the code that sets the flags on the IMAP
- server for messages that have changed. Oops, don't mask with
- DELETED to find out if the message has been answered ;-)
- (imap_expunge): sync before expunging.
-
-2000-07-16 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c: All SELECT calls now pass
- a NULL folder argument to camel_imap_command_extended() since it's
- not needed.
- (imap_connect): Moved service_class->connect() to the point right
- after a connection is established with the server rather than
- waiting until the end of the function.
- (camel_imap_command): Updated the documentation comment
- (camel_imap_command_extended): Before sending a command, first
- check to make sure we are connected; if we aren't, then reconnect.
- Don't strncmp() command with "SELECT" as it's redundant.
-
- * providers/imap/camel-imap-folder.c: All SELECT calls now pass
- a NULL folder argument to camel_imap_command_extended() since it's
- not needed. Also s/camel_imap_command/camel_imap_command_extended as
- I will probably be doing away with camel_imap_command() or at least
- only using it for LOGIN and similar commands where the server won't
- notify us of any recent messages.
-
-2000-07-15 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_new):
- One last fix to get rid of hard-coded "/" directory separators
-
-2000-07-14 Peter Williams <peterw@helixcode.com>
-
- * camel-object.c : Implement 'events', which are suspiciously
- like signals except without all the marshalling baggage, and
- with quasi-thread-safety.
- (camel_object_class_declare_event): New func.
- (camel_object_hook_event): Ditto.
- (camel_object_trigger_event): Ditto.
- (obj_class_init): Declare the "finalize" event.
- (obj_class_finalize): Free the hashtable of events->preps
- (obj_finalize): Free the hashtable of events->hooklists
- (camel_object_unref): Trigger the finalize event (ourselves,
- to prevent massively unpleasant looping things.)
-
-2000-07-14 Peter Williams <peterw@helixcode.com>
-
- * camel-object.c (make_global_classfuncs): Change to return
- a CamelObjectClass. Change parents to a GSList and free it
- when done.
- (camel_object_new): Don't allocate a classfuncs for every object;
- merely give it a reference to the global_classfuncs. Convert
- parents to a GSList and free it when done.
- (camel_object_unref): Don't free the classfuncs. Free the parents
- list, which is changed to a GSList.
-
-2000-07-14 Jeffrey Stedfast <fejj@helixcode.com>
-
- * string-utils.c (string_unquote): New convenience function
- to unquote a string if it's encapsulated by "'s
-
- * providers/imap/camel-imap-folder.c:
- * providers/imap/camel-imap-store.c: Made the necessary changes
- to stop using hard coded directory separators.
-
-2000-07-13 Dan Winship <danw@helixcode.com>
-
- * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_load):
- If the summary is for a smaller mbox, and rebuilding from the
- last-known end position fails, try rebuilding from the beginning.
- Deals with the case where the user edits the mbox and makes it
- bigger, without adding new messages.
-
-2000-07-13 Peter Williams <peterw@helixcode.com>
-
- * camel-object.c: Rewritten to not be based on GtkObject,
- but a tiny threadsafe ripoff thereof. Objects still cannot
- be shared across threads, but ref/unref/destroy/new/etc
- will work. Signals are not implemented because doing it
- robustly would be a major pain in the butt, but class
- functions are. There's a small demonstration that it doesn't
- crash in ./temp-test.c: build it with ./make-test.sh.
- * camel-stream.c, camel-seekable-stream.c, camel-stream-mem.c:
- moved over to CamelObject. Proof of concept: two levels of
- subclass and class functions, all working without coredumps.
- To port to CamelObject:
- - s,GTK_,CAMEL_,g in the cast checks
- - s,gtk_type_new,camel_object_new,g
- - s,GtkType,CamelType,g
- - Change get_type function over to camel_type_declare
- - instead of hooking to finalize function, it goes into the
- type declaration.
- - remove signals.
- - instead of GTK_OBJECT(so)->klass, CAMEL_OBJECT_GET_CLASS(so)
- - s,gtk_type_class,camel_type_get_global_classfuncs,g
- - don't chain finalize handlers; it will be done for you
-
-2000-07-13 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c:
- * providers/imap/camel-imap-store.c: If a SELECT fails, set
- imap_store->current_folder to NULL so a SELECT is forced before
- any message/folder operations are requested. Also, because some
- users don't use a namespace, make sure that if the url->path is
- "/" we don't use it when creating the folder_path.
- (camel_imap_command[_extended]): Since we allow the passing of
- a NULL folder which we can use to bypass a forced SELECT, no need
- to check for the individual commands that don't require a folder
- to be selected.
-
-2000-07-13 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c:
- * providers/imap/camel-imap-store.c: Updated to use CAMEL_IMAP_OK,
- CAMEL_IMAP_NO, CAMEL_IMAP_BAD, and CAMEL_IMAP_FAIL rather than the
- ones copied from the POP3 provider.
-
-2000-07-13 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_summary): Oops.
- If the number of messages in the folder is 0, don't fetch
- summaries 1 thru 0, just return an empty summary.
- (imap_copy_message_to): Fixed to use message UID and also send
- the source folder as an arg to camel_imap_command rather than NULL.
- (imap_move_message_to): Same.
- (imap_init): If SELECT is successful, we need to set the current
- folder to the one selected, this was causing problems with move/copy
-
-2000-07-13 Dan Winship <danw@helixcode.com>
-
- * camel-service.h: define a set of CAMEL_SERVICE_URL_ALLOW_* flags
- parallel to the _NEED_* flags, and make the _NEED_* flags imply
- the _ALLOW_* ones.
-
- * providers/imap/camel-imap-store.c (camel_imap_store_init): imap
- urls ALLOW_PATH
-
-2000-07-13 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_summary): New
- and improved approach to fetching an entire folder summary
- that should be much much faster than the old way as it gets
- the entire folder summary in 1 shot rather than requesting
- message by message. As with the last update, this version
- also only fetches the minimum number of header fields.
- (imap_get_summary): Oops, forgot to free the temp
- GPtrArray *headers
-
-2000-07-13 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_summary): Don't
- fetch the entire RFC822 header, just fetch the fields we want.
- (imap_get_message_info): Same.
-
-2000-07-13 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-filter-basic.c (camel_mime_filter_basic_new_type):
- Reset filter on setup.
- (reset): When resetting qp encoding, set the state to -1, instead
- of 0.
-
- * camel-mime-utils.c (quoted_encode_step): Actually count the
- characters output sofar (it never counted any). Bunch of other
- fixes.
- (quoted_encode_close): Also flush out final character, if there's
- one.
-
-2000-07-12 Jeffrey Stedfast <fejj@helixcode.com>
-
- Chris forgot to add #include <e-util/e-util.h> to the source files
-
- * providers/imap/camel-imap-store.c (imap_connect): Fixed Peter's
- fix, we don't want to send a string to a %d.
-
-2000-07-12 Christopher James Lahey <clahey@helixcode.com>
-
- * camel-folder-search.c, providers/imap/camel-imap-store.c:
- Changed from strstrcase to e_strstrcase.
-
- * string-utils.c, string-utils.h: Removed strstrcase (in favor of
- e_strstrcase in e-util/e-util.c.)
-
-2000-07-12 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/camel-nntp-folder.c
- (nntp_folder_set_message_flags): get the article num out of our
- uid and mark it read in the newsrc.
- (nntp_folder_get_message): get the message id out of the uid to
- fetch the article.
-
- * providers/nntp/camel-nntp-utils.c (get_XOVER_headers): the uid
- is now <article-num>,<messageid>
- (get_HEAD_headers): same.
-
- * camel-mime-parser.c (folder_scan_step): go to HSCAN_MESSAGE
- state when ct->subtype is "news" as well as "rfc822". this makes
- attachments of type "message/news" display properly.
-
-2000-07-12 Dan Winship <danw@helixcode.com>
-
- * camel-folder.c (camel_folder_free_deep,
- camel_folder_free_shallow, camel_folder_free_nop): Useful default
- implementations for free_{uids,subfolder_names,summary}.
- (free_subfolder_names, free_uids): Make these g_warning-ing
- default implementations.
-
- * providers/*/camel-*-folder.c: Use the new functions where
- appropriate, remove duplicated code.
-
-2000-07-12 Peter Williams <peterw@helixcode.com>
-
- * providers/imap/camel-imap-store.c (query_auth_types): Check for
- NULL parameters when setting the exception so as to not crash on
- Solaris (can't handle a %s passed NULL).
- (imap_connect): Same.
-
-2000-07-12 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/mbox/camel-mbox-folder.c (mbox_delete_message): Use
- mbox_set_message_flags () instead of setting the flags by hand. This
- fixes the problem of the "message_changed" signal not being emitted
- at the correct time.
-
- * providers/imap/camel-imap-folder.c: "folder_changed" signals should
- pass a third argument (which is ignored).
-
- * camel-folder.c: Undo gtk signal emits done in set_flags and
- expunge.
- (move_message_to):
- (copy_message_to): Create info as a const CamelMessageInfo
-
-2000-07-12 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/Makefile.am: don't add test-newsrc to the build
- since it needs libcamel (which isn't built at the time test-newsrc
- needs linking.)
-
- * providers/nntp/camel-nntp-utils.c (get_HEAD_headers): fill in
- MessageInfo->message_id.
- (get_XOVER_headers): same.
-
- * providers/nntp/camel-nntp-folder.c (nntp_folder_init): move
- summary loading here.
- (nntp_folder_sync): summary/newsrc changes should be stored here.
- put a comment to that effect.
- (nntp_folder_set_message_flags): don't save the newsrc here.
- (nntp_folder_get_uids): use g_ptr_array_index instead of the
- cast/addition.
- (nntp_folder_get_summary): no need to check if we should generate
- the summary here. already done.
- (nntp_folder_get_message_info): implement.
-
- * providers/nntp/camel-nntp-store.c
- (camel_nntp_store_get_toplevel_dir): use evolution_dir instead of
- computing it ourselves.
- (nntp_store_disconnect): call camel_nntp_newsrc_write.
- (ensure_news_dir_exists): new function to create the news/<news
- server> subdir.
- (camel_nntp_store_class_init): hook up connect/disconnect and
- finalize.
- (nntp_store_connect): if ensure_news_dir_exists fails throw an
- exception.
-
-2000-07-12 Peter Williams <peterw@helixcode.com>
-
- * camel-folder.c (camel_folder_set_message_flags): Emit a message_changed
- signal once the flags are set on the message.
- (camel_folder_set_user_flag): Ditto.
- (camel_folder_expunge): Emit a folder_changed if no exception.
-
-2000-07-12 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-stream.c: Use size_t and ssize_t for read/write methods
-
- * providers/imap/camel-imap-folder.c (imap_set_message_flags):
- Updated to emit the message_changed signal.
- (imap_delete_message): Updated to use imap_set_message_flags ().
- (imap_move_message_to): Updated to use imap_set_message_flags ()
- and to emit the folder_changed signal on the destination folder.
- (imap_copy_message_to): Updated to emit the folder_changed signal
- on the destination folder.
- (imap_append_message): Updated to emit the folder_changed signal
- on the destination folder.
-
-2000-07-11 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-folder.c (camel_folder_append_message): Now takes a
- flags argument to specify the flags to be set on the message
- since we might not necessarily want the flags to be wiped clean.
- (move_message_to):
- (copy_message_to): Updated to send a flags argument to
- append_message (); currently sends the original message's flags.
-
- * providers/mbox/camel-mbox-folder.c (mbox_append_message):
- * providers/imap/camel-imap-folder.c (imap_append_message):
- Updated.
-
-2000-07-11 Dan Winship <danw@helixcode.com>
-
- * camel-folder.c: Remove exceptions from a number of methods
- that work on what ought to be static data: get_parent_folder,
- get_parent_store, get_message_count, get_unread_message_count,
- get_permanent_flags, get_message_flags, set_message_flags,
- get_message_user_flag, set_message_user_flag, get_message_uid,
- get_uids, get_summary, get_subfolder_names. Turn
- camel_folder_delete_message into a macro.
-
- * providers/{mbox,pop3,vee}: Update for CamelFolder changes
-
- * providers/Makefile.am: Disable imap and nntp for now
-
-2000-07-11 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_search_by_expression):
- This shouldn't return NULL, it should return g_ptr_array_new ()
- so the mailer gets what it expects.
-
-2000-07-10 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-folder-summary.c (camel_folder_summary_decode_string):
- Oops, an unsigned integer can never be < 0
-
-2000-07-10 Dan Winship <danw@helixcode.com>
-
- * providers/vee/camel-vee-folder.c (vee_search_by_expression):
- Initialize a variable to make this not crash again. And fix a bug
- so it actually does something.
-
-2000-07-10 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-folder-summary.c: Cleaned up a bunch of compile warnings
-
-2000-07-10 Dan Winship <danw@helixcode.com>
-
- * providers/vee: kill more debugging messages
-
-2000-07-10 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/mbox/camel-mbox-folder.c (mbox_get_unread_message_count):
- * providers/vee/camel-vee-folder.c (vee_get_unread_message_count):
- * providers/imap/camel-imap-folder.c (imap_get_unread_message_count):
- Implemented.
-
- * camel-folder.c (camel_folder_get_unread_message_count): New
- convenience function to allow the mailer to query the number
- of unread messages in a folder (for displaying message stats
- in a folder tree?).
-
-2000-07-09 Dan Winship <danw@helixcode.com>
-
- * camel-mime-utils.c (header_references_dup): New function to copy
- a header_references structure.
-
- * camel-folder-summary.c (camel_message_info_dup_to): New function
- to (deep) copy the data from one CamelMessageInfo into another.
- (camel_message_info_free): And free the data.
-
- * providers/vee/camel-vee-folder.c (vee_sync): Implement. (empty).
- (vee_search_by_expression): belatedly update for
- camel_folder_search change.
- (vee_folder_build): belatedly update for camel_folder_search
- change. Use camel_message_info_dup_to and camel_message_info_free
- (in particular, so that we get message_id and references info so
- vfolders can be threaded).
- (vee_folder_build_folder): Ditto.
-
-2000-07-08 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/nntp/camel-nntp-folder.c:
- * providers/nntp/camel-nntp-utils.c:
- * providers/nntp/camel-nntp-store.c: Update to reflect past changes
- in the Camel API. Use gtk macro casts wherever possible and use glib's
- memory functions instead of standard c's (since they are not
- compatable)
-
- * providers/smtp/camel-smtp-transport.c:
- * providers/imap/camel-imap-store.c: Wrap debug print statements
- in a macro
-
- * providers/imap/camel-imap-stream.c (stream_read): Make sure
- that we get up to and including the last \n of the mime part.
-
- * providers/imap/camel-imap-folder.c (imap_get_message): Make sure
- that we get up to and including the last \n of the mime part.
- Wrap debug print statements in a macro.
-
- * providers/imap/camel-imap-stream.c (stream_read): Only cache
- the important data (aka the mime part requested and no extra
- server response stuff)
-
-2000-07-07 Dan Winship <danw@helixcode.com>
-
- * camel-mime-utils.c (header_references_decode): Work around
- In-Reply-To's with unquoted punctuation. So many broken mailers.
-
- * camel-folder.c (camel_folder_search_by_expression): Make this
- return a GPtrArray rather than a GList.
-
- * camel-folder-search.c (camel_folder_search_execute_expression):
- * providers/imap/camel-imap-folder.c (imap_search_by_expression):
- * providers/mbox/camel-mbox-folder.c (mbox_search_by_expression):
- * providers/nntp/camel-nntp-folder.c (nntp_search_by_expression):
- Update to return a GPtrArray rather than a GList.
-
-2000-07-07 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.c (esmtp_get_authtypes):
- Fixed the parser to actually work
-
-2000-07-06 Dan Winship <danw@helixcode.com>
-
- * camel-mime-utils.c (header_references_decode): Make this deal
- with the full RFC822 References/In-Reply-To format rather than
- just the more-nicely-behaved RFC1036 version. (Needed to parse
- In-Reply-To headers with extra junk in them.)
-
-2000-07-06 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_summary): Parse for
- more header information to allow message threading in IMAP.
- (imap_get_message_info): Same.
-
- * camel-folder-summary.c: Renamed summary_format_* to
- camel_summary_format_* and moved them into public scope.
-
- * providers/smtp/camel-smtp-transport.c (smtp_connect): Oops. Don't
- pass port # as a string in the error code (if it fails to connect).
-
- * providers/imap/camel-imap-folder.c (imap_append_message): Changed
- over to camel_imap_command_extended as that was the source of the
- problems - apparently appending replies with more than just 1 line.
-
-2000-07-05 Dan Winship <danw@helixcode.com>
-
- * camel-folder-search.c (search_header_contains): make header
- matching case-insensitive
-
- * camel-folder-summary.c:
- * camel-session.c:
- * providers/mbox/camel-mbox-folder.c:
- * providers/mbox/camel-mbox-summary.c: Remove some non-error case
- debugging-type messages.
-
-2000-07-05 Ettore Perazzoli <ettore@helixcode.com>
-
- * providers/mbox/camel-mbox-summary.c (d): Define to empty so that
- we get rid of a ton of debugging messages.
-
-2000-07-05 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-utils.h: Added prototype for uudecode_step
-
- * camel-mime-utils.c (uudecode_step): Cleaned up some junk that
- should have been cleaned up when debugging printf's were taken out.
-
-2000-07-05 Ettore Perazzoli <ettore@helixcode.com>
-
- * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_sync):
- Update the X-Evolution: header even if the in-memory UID and the
- saved UID are not the same. Otherwise mboxes with clashing UIDs
- can never be fixed.
-
- * camel-folder-summary.c
- (camel_folder_summary_add_from_parser): Add the message to the
- summary before doing any ibex stuff. In fact, this might also
- have the side effect of reassigning the UID so it needs to be done
- before we start using the UID.
-
- * providers/mbox/camel-mbox-folder.c (mbox_append_message): Add
- debugging message to keep track of the UIDs we add.
-
-2000-07-05 Dan Winship <danw@helixcode.com>
-
- * camel-folder-summary.c: Add "Cc" to summary and bump summary
- version number.
-
- * camel-folder-search.c (search_header_contains): make "Cc" a
- searchable header.
-
-2000-07-03 Ettore Perazzoli <ettore@helixcode.com>
-
- * camel-folder-summary.c (camel_folder_summary_next_uid_string):
- New.
- (camel_folder_summary_add): Use
- `camel_folder_summary_next_uid_string()' instead of recomputing
- the UID manually here.
- (camel_folder_summary_add_from_parser): Likewise.
-
-2000-07-03 Ettore Perazzoli <ettore@helixcode.com>
-
- * camel-folder-summary.c (camel_folder_summary_set_uid): Removed.
-
-2000-07-03 Dan Winship <danw@helixcode.com>
-
- * camel-folder-summary.c (message_info_new): Parse In-Reply-To
- with header_references_decode, not header_msgid_decode.
-
- * camel-mime-message.c (camel_mime_message_class_init): message
- headers are case-insensitive.
-
- * providers/pop3/camel-pop3-store.c (camel_pop3_command): Fix a
- bug in error-setting code.
- (pop3_connect): Don't re-prompt for password in the KPOP case.
- (pop3_get_response): New function, split out from
- camel_pop3_command.
- (connect_to_server): Use pop3_get_response to parse the greeting
- message, and error out appropriately if it's -ERR.
-
-2000-07-02 Dan Winship <danw@helixcode.com>
-
- * camel-folder.c (camel_folder_freeze, camel_folder_thaw): New
- functions to freeze and thaw a folder (to prevent message/folder
- changed signals in the middle of a long series of operations).
- (camel_folder_class_init): Change signals to GTK_RUN_FIRST.
- (message_changed, folder_changed): Add default implementations
- that stop the emission and record info for later if the folder is
- frozen.
-
- * providers/mbox/camel-mbox-folder.c (mbox_sync): leftover fixes
- from the close->sync change: don't destroy the ibex, summary, and
- search when syncing.
- (append_message): emit "folder_changed" on a successful append.
-
-2000-07-02 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-utils.c (uudecode_step): A rather complex uudecoder
- written in the spirit of Zucchi-ness, is it up to par? Only the
- Z-man can tell us :-)
-
-2000-07-01 Dan Winship <danw@helixcode.com>
-
- * camel-service.c (camel_service_get_name): New method, to return
- an end-user-friendly name corresponding to a service. (eg, "POP
- service for danw on trna.helixcode.com").
-
- * providers/imap/camel-imap-store.c,
- providers/mbox/camel-mbox-store.c,
- providers/nntp/camel-nntp-store.c,
- providers/pop3/camel-pop3-store.c,
- providers/sendmail/camel-sendmail-transport.c,
- providers/smtp/camel-smtp-transport.c: Implement.
-
- * providers/imap/Makefile.am: remove unneeded
- libcamelimap_la_LDADD.
-
- * providers/pop3/camel-pop3-store.c (connect_to_server): fix the
- CAPA-parsing code to not get into an infinite loop.
-
-2000-07-01 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_message): Fixed
- the bug that would sometimes leave part of the server response
- tacked on to the end of the message.
-
- * camel-folder.c: Renamed _by_uid methods. Since we no longer
- have get-by-number methods, no need to have the _by_uid
- extensions.
- (get_message_by_uid): Renamed to get_message
- (delete_message_by_uid): Renamed to delete_message
- (summary_get_by_uid): Renamed to get_message_info
-
- * providers/mbox/camel-mbox-folder.c:
- * providers/pop3/camel-pop3-folder.c:
- * providers/imap/camel-imap-folder.c:
- * providers/vee/camel-vee-folder.c: Updated to reflect
- camel-folder changes.
-
-2000-06-30 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-folder.c (camel_folder_copy_message_to): New function, to
- copy a message from one folder to another. The default
- implementation just uses append_message, but providers can
- implement more efficient versions for use when both folders are on
- the same store.
-
- * broken-date-parser.[c,h]: Utilities for parsing broken
- date strings.
-
- * providers/imap/camel-imap-folder.c (imap_move_message_to):
- (imap_copy_message_to): Implemented.
-
- * camel-mime-utils.c (header_decode_date): Wrote some code to try
- and un-mangle broken date formats and then parse that new string
- instead.
-
-2000-06-30 Dan Winship <danw@helixcode.com>
-
- * camel-folder.c (camel_folder_move_message_to): New function, to
- move a message from one folder to another. The default
- implementation just uses append_message and delete_message, but
- providers can implement more efficient versions for use when both
- folders are on the same store.
-
-2000-06-29 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_expunge): Should now
- print a meaningful error message when it doesn't succeed
-
-2000-06-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (imap_connect): Changed to
- keep prompting user for a valid password until it either
- authenticates or until Canceled by the user.
- (camel_imap_command_extended): Improved speed (replaced the
- g_strjoinv call with a faster implementation)
-
- * providers/pop3/camel-pop3-store.c
- (camel_pop3_command_get_additional_data): Fixed.
- (pop3_connect): Changed to keep prompting the user for a
- password until it either works or until Canceled by the user.
-
- * providers/mbox/camel-mbox-summary.c: General cleanup
- (camel_mbox_summary_sync): Fixed a memory leak and added
- CamelException handling.
-
- * providers/mbox/camel-mbox-store.c (delete_folder): Fixed a
- memory leak
-
- * providers/mbox/camel-mbox-folder.c (mbox_append_message):
- Default 'off_t seek' to -1 so as to make sure it's initialized
- before it's used in the case of a bad stat() call.
- (mbox_sync): Updated
- (mbox_expunge): Updated
-
-2000-06-27 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (imap_connect): Move the
- CAPABILITY command here so we don't have to keep checking
- each time we open a folder.
- (camel_imap_command_extended): If we are doing an EXAMINE,
- don't bother doing a SELECT first.
-
- * providers/imap/camel-imap-folder.c (imap_init): Update so
- folder->has_search_capability depends on the parent IMAP store
- (since this is really dependant on the IMAP implementation and
- not the folder)
-
-2000-06-27 Christopher James Lahey <clahey@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.c: Don't close the filter
- stream when done with it (this causes the source stream to close);
- Instead, just flush it when done.
-
-2000-06-27 Michael Zucchi <zucchi@zedzone.mmc.com.au>
-
- * camel-folder-search.c (search_header_contains): Make header
- search 'to' match 'to', and not 'from', small typo, fixes #317.
-
-2000-06-26 Christopher James Lahey <clahey@helixcode.com>
-
- * providers/mbox/camel-mbox-summary.c: Added debugging
- information.
-
-2000-06-23 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c:
- * providers/imap/camel-imap-folder.c: Improved folder parsing.
- Not specifying a namespace should no longer list the entire
- filesystem.
-
-2000-06-22 Chris Toshok <toshok@helixcode.com>
-
- * providers/nntp/.cvsignore: ignore test-newsrc
-
- * providers/nntp/camel-nntp-store.c,
- providers/nntp/camel-nntp-store.h,
- providers/nntp/camel-nntp-folder.c,
- providers/nntp/camel-nntp-folder.h,
- providers/nntp/camel-nntp-utils.c: Bring the nntp provider up to a
- state where it builds and is usable with the current camel. there
- are still warts (semi-broken .newsrc file handling, and a lack of
- a subscribe ui -- in fact no way to add a new server, really), but
- it'll display news messages.
-
- * providers/nntp/Makefile.am (libcamelnntp_la_SOURCES): add
- camel-nntp-newsrc.c
- (libcamelnntpinclude_HEADERS): add camel-nntp-newsrc.h
- also, add test-newsrc stuff.
-
- * providers/nntp/test-newsrc.c: new file that tests the newsrc
- stuff by parsing and regurgitating a .newsrc file for a particular
- server.
-
- * providers/nntp/camel-nntp-newsrc.c,
- providers/nntp/camel-nntp-newsrc.h: new files, initial support for .newsrc files.
-
-2000-06-22 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_message_count):
- Oops. Now appends the namespace to the folder before querying
- for the number of messages.
-
- * providers/imap/camel-imap-store.c (imap_folder_exists): New
- convenience function for use by imap_create().
- (get_folder): If folder is specified as "/", we really want
- "INBOX".
-
- * providers/sendmail/camel-sendmail-provider.c:
- * providers/vee/camel-vee-provider.c:
- * providers/smtp/camel-smtp-provider.c:
- * providers/mbox/camel-mbox-provider.c:
- * providers/pop3/camel-pop3-provider.c:
- * providers/imap/camel-imap-provider.c: Updated
-
- * camel-session.c: Moved service_cache hash table into the
- providers.
- (service_cache_remove): Updated.
- (camel_session_get_service): Updated.
-
- * camel-url.c (camel_url_hash): Took out the hashing of
- url->passwd. We don't want this anymore.
-
- * providers/imap/camel-imap-folder.c (imap_init): Took out
- references to 'namespace'
- (camel_imap_folder_init): Same
-
- * providers/imap/camel-imap-folder.h: No more namespace. We are
- instead going to use url->path as the namespace.
-
-2000-06-21 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (imap_create): Modified to
- use the "namespace" (url->path) if it exists.
-
- * providers/imap/camel-imap-folder.c (imap_delete_message_by_uid):
- Now just sets the deleted flag on the summary rather than speaking
- directly to the IMAP server. This is both faster and cleaner.
-
-2000-06-21 Dan Winship <danw@helixcode.com>
-
- * providers/pop3/camel-pop3-store.c (query_auth_types): Fix dumb
- bug.
-
-2000-06-21 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_message_by_uid):
- We are getting mail in IMAP now!! whoo-hoo!. Stripped out the
- filtering so messages may have some dot-stuffing, but the
- filtering can always be added back in later when we know it
- works and isn't the problem.
-
-2000-06-21 Peter Williams <peterw@curious-george.helixcode.com>
-
- * providers/mbox/camel-mbox-folder.c (mbox_init): Use the basename
- of the mailbox so we don't get pathnames like ~/evolution/inbox///movemail.ibex
-
-2000-06-21 Dan Winship <danw@helixcode.com>
-
- * camel-folder-summary.c (message_info_new): Set date_received
- based on the first (most recent) "Received" header.
-
-2000-06-20 Dan Winship <danw@helixcode.com>
-
- * camel-mime-part.c (write_to_stream): flush the filter stream
- before unreffing it, so it will camel_mime_filter_complete.
-
- * camel-stream-filter.c (camel_stream_filter_class_init): Fix a
- braino so camel_stream_flush works here.
-
- * camel-stream-mem.c (stream_seek): Fix a bug that resulted in
- large attachments being silently dropped.
-
- * providers/pop3/camel-pop3-store.c
- (camel_pop3_command_get_additional_data): Don't use g_strjoinv
- here, since it is O(n^2) on the length of the output string, and
- we can do O(n).
-
- * camel-mime-part-utils.c
- (simple_data_wrapper_construct_from_parser): add a CRLF decoder
- after the QP/B64 decoder if it's text.
-
-2000-06-20 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_summary): Only
- fetch the summary if the folder summary doesn't already exist.
- When the summary *does* exist, start fetching from 1, not 0.
- (imap_free_summary): Don't do anything here.
- (imap_finalize): Free the summary here instead of in
- imap_free_summary().
- (imap_set_message_flags): Implemented
- (imap_sync): Added code to set flags on messages that have had
- their flags changed (however I #if'd it out until we are more
- confidant in the IMAP code :)
- (imap_summary_get_by_uid): Now parese flags correctly.
- (imap_get_summary): Now parese flags correctly. Also correctly
- parses the UID correctly.
-
- * camel-url.c (check_equal): No need to check s1 if s2 is NULL
- (camel_url_equal): Don't check the passwd component of the url.
-
-2000-06-20 Dan Winship <danw@helixcode.com>
-
- * camel-folder-summary.c (camel_folder_summary_add): mark the
- message info with CAMEL_MESSAGE_FOLDER_FLAGGED if we change the
- uid, so the folder will know that it's dirty.
-
-2000-06-20 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (camel_imap_command_extended):
- Now returns the last line of data that the server sends back as
- well. This is needed for commands like SELECT (like Peter pointed
- out).
- (camel_imap_command): No longer checks for SELECT (no need)
-
- * providers/imap/camel-imap-folder.c: Added namespace stuff
- which we will need later on...
- (imap_parse_subfolder_line): Convenience function for use in
- get_subfolder_names()
- (imap_get_subfolder_names): Updated. Also changed it to use LIST
- instead of LSUB (temporary change).
-
-2000-06-19 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_init): Set
- summary equal to NULL.
- (imap_get_summary): Store the summary in the ImapFolder
- (imap_summary_get_by_uid): If we have a summary cache in the
- ImapFolder, first check to see if that message info is in the
- cached summary first, if not fetch it directly from the IMAP
- server and append it to the summary cache.
- (imap_get_message_flags): Don't free the message info that we get
- back from summary_get_by_uid as we don't want to be corrupting our
- cached summary.
-
-2000-06-19 Peter Williams <peterw@curious-george.helixcode.com>
-
- * providers/imap/camel-imap-store.c (camel_imap_command{,_extended}): When
- SELECT'ing a folder for an IMAP command, use _extended to grab the entire
- response (before we just used camel_imap_command and missed the OK codes)
-
-2000-06-18 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_summary_get_by_uid):
- Now gets the message flags as it should.
- (imap_get_summary): Same as imap_summary_get_by_uid
- (imap_get_permanent_flags): Return the permanent flags stored
- on the folder.
- (imap_get_message_flags): Return message flags associated with
- given uid. Note: we may want to somehow cache summary info so
- that we don't have to keep querying the IMAP provider in
- imap_summary_get_by_uid().
-
-2000-06-17 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_free_summary): We were
- leaking memory - but not anymore!
- (imap_get_summary): We now get the UIDs and the beginnings of the
- code to get the message flags as well.
-
-2000-06-17 Dan Winship <danw@helixcode.com>
-
- * camel-mime-parser.c (folder_scan_header): Don't copy newlines
- into the parsed header text, and turn any number of tabs and
- spaces after a newline into a single space.
-
-2000-06-17 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_init): Should now
- correctly do CAPABILITY.
-
-2000-06-17 Dan Winship <danw@helixcode.com>
-
- * providers/mbox/camel-mbox-summary.c: Add some debugging printfs
- when rebulding summary to help figure out why people's summaries
- are always being rebuilt.
-
-2000-06-17 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_search_by_expression):
- Began to implement, need to get information on how to
- deconstruct @expression into an IMAP search expression and
- parse the results.
- (imap_init): Now queries the IMAP provider for CAPABILITY to
- determine if SEARCH is implemented or not.
-
- * providers/imap/imap.c: Removed - no longer a need to have
- this as an example for anyone interesting to help mecode IMAP
- support.
-
-2000-06-16 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_sync): Added code
- to expunge if called for (still need to finish coding this).
- (imap_get_uids): Implemented.
- (imap_get_summary): Found a way to get the date
- (imap_summary_get_by_uid): Same.
- (imap_free_summary): Implemented.
-
- * string-utils.c (strstrcase): Fixed a compile warning
-
- * providers/imap/camel-imap-summary.c: Removed - we don't
- need a CamelImapSummary structure.
-
-2000-06-16 Dan Winship <danw@helixcode.com>
-
- Move flag handling from CamelMimeMessage to CamelFolder. This
- simplifies several flag-handling pieces of code in the mailer, and
- lets you change a message's flags without having to fetch the
- message body. It also means that fully-constructed
- CamelMimeMessages are now essentially constant, which will help
- simplify locking issues later since it means two threads
- interested in the same message can just work with separate copies
- of it.
-
- * camel-mime-message.h (struct _CamelMimeMessage): Removed flags
- and user_flags (moved to summary). Removed expunged and
- message_number which were unused. Removed message_uid and folder
- which are no longer needed in the new scheme.
- (struct CamelMimeMessageClass): Removed message_changed signal and
- get/set_message_number methods.
-
- * camel-mime-message.c: Updates for CamelMimeMessage changes.
- (camel_mime_message_get/set_flags,
- camel_mime_message_get/set_user_flag): Replaced with methods in
- CamelFolder.
- (camel_flag_get, camel_flag_set, camel_flag_list_size,
- camel_flag_list_free): Moved verbatim to camel-folder-summary.c
-
- * camel-folder.c (camel_folder_get/set_message_flags,
- camel_folder_get/set_message_user_flag): New methods (and
- corresponding useless default implementations)
- (camel_folder_class_init): add a message_changed signal
-
- * camel-folder-summary.c (camel_flag_get, camel_flag_set,
- camel_flag_list_size, camel_flag_list_free): Moved here from
- camel-mime-message.c
-
- * providers/mbox/camel-mbox-folder.c (message_changed): Removed.
- (mbox_get_message_flags, mbox_set_message_flags,
- mbox_get_message_user_flag, mbox_set_message_user_flag): Tweak
- summary bits as appropriate. (Functionality moved here from
- message_changed.)
- (mbox_get_message_by_uid): Update for CamelMimeMessage changes
- (less stuff to initialize).
-
- * providers/imap/camel-imap-folder.c (message_changed): Remove
- this. It was just copied from the mbox provider and doesn't deal
- with the real IMAP flag stuff anyway. (So there's currently no
- flag support in the IMAP provider.)
- (imap_get_message_by_uid): Update for CamelMimeMessage changes.
-
- * providers/vee/camel-vee-folder.c: (message_changed): Remove old
- one. Add a new one to listen for message_changed on each folder
- and re-emit message_changed signals that correspond to messages in
- the vfolder.
- (vee_get/set_message_flags, vee_get/set_message_user_flag): Proxy
- flag setting to the underlying real messages.
- (vee_append_message): Removed for now; there's no way to translate
- this into the new CamelMimeMessage/CamelFolder scheme, but (a)
- there's also no code which would ever call it and (b) we're
- probably going want a better interface than append_message for
- message drag and drop to work anyway. To be revisited.
-
-2000-06-16 Dan Winship <danw@helixcode.com>
-
- * camel-mime-utils.c (rfc2047_decode_word):
- * camel-mime-part-utils.c (simple_data_wrapper_construct_from_parser):
- * camel-folder-summary.c (summary_build_content_info):
- KLUDGE! Since neither ETable nor GtkHTML supports UTF-8 yet,
- output ISO-8859-1 instead, so Ettore can read his Italian mail. :)
- This will be reverted later.
-
-2000-06-15 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_summary): Started to
- implement - may want to use ENVELOPE instead of BODY.PEEK[HEADER]
- (imap_summary_get_by_uid): Started to code, I've got to find a way to
- get the date in time_t format and also get the flags
-
- * string-utils.c (strstrcase): Added this convenience function - I
- know about strcasestr() but it's not portable.
-
-2000-06-15 Dan Winship <danw@helixcode.com>
-
- * camel-service.c: Remove camel_service_connect_with_url. (URLs
- must be specified when the service is requested from the session,
- so that there can only ever be one service for any URL.)
-
- * camel-folder.c: (camel_folder_open, camel_folder_is_open,
- camel_folder_get_mode): Kill. Folders are now always open, and
- handle "closing" sorts of operations at sync or finalize time.
- (camel_folder_sync): renamed from camel_folder_close. Syncs state
- to the store but doesn't necessarily close/disconnect.
-
- * providers/*/camel-*-folder.c: Merge "open" methods into "init"
- methods. Rename close to sync and update appropriately.
-
- * providers/imap/camel-imap-store.c: Remove camel_imap_store_open
- and camel_imap_store_close, which should not have been copied from
- the POP provider (where the exist to work around limitations of
- the POP protocol).
-
- * providers/mbox/camel-mbox-summary.c: fix a bug. (don't expunge
- deleted messages if called with expunge == FALSE)
-
- * providers/pop3/camel-pop3-store.c (connect_to_server): Check
- server for various interesting extensions.
-
- * providers/pop3/camel-pop3-folder.c (get_uids): If the server
- supports UIDL, use real UIDs rather than fake ones.
- (etc): Map uids back to numbers appropriately
-
- * providers/mbox/camel-mbox-folder.c (mbox_append_message): Fix to
- previous change: make sure the "seek" variable ends up with the
- value it should.
-
- * providers/mbox/camel-mbox-summary.c (summary_rebuild): Update
- summary mtime as well as size.
-
-2000-06-14 Dan Winship <danw@helixcode.com>
-
- * providers/mbox/camel-mbox-folder.c (mbox_append_message): if the
- mbox doesn't end with a '\n', write one before appending the new
- message.
-
-2000-06-14 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-filter-crlf.c (filter): Updated the encoder to allocate
- more memory (since we are also now adding dots). Also updated the
- decoder as we have found that it sometimes passes the end of the
- buffer.
-
- * providers/pop3/camel-pop3-folder.c (get_message_by_uid): Took out the
- filter code (we already filter in
- camel_pop3_command_get_additional_data)
-
- * camel-folder.c (init): Updated: a separator is now a char* rather
- than a single char because IMAP can have a string for a directory
- separator. Also, since IMAP does not begin with a directory separator,
- there is a new argument (path_begins_with_sep) which decides if a
- directory should begin with a directory separator.
-
- * providers/imap/camel-imap-store.c (imap_create): Since, on connect,
- Camel tries to create INBOX (which already exists on every IMAP
- provider) we can return TRUE when the folder name is "INBOX".
-
- * providers/vee/camel-vee-folder.c (vee_init): Updated.
-
- * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Updated.
-
- * providers/mbox/camel-mbox-store.c (get_folder): Updated.
-
- * providers/mbox/camel-mbox-folder.c (mbox_init): Updated.
-
- * providers/pop3/camel-pop3-folder.c (camel_pop3_folder_new): Updated.
-
-2000-06-14 Dan Winship <danw@helixcode.com>
-
- * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_sync):
- Renamed from camel_mbox_summary_expunge. Takes a gboolean saying
- whether to expunge or just sync the mbox file. Change some
- g_errors to g_warning so we don't abort. Make the quick
- X-Evolution updating code lseek around correctly. Update the
- mbox mtime in the summary file even in the quick case.
-
- * providers/mbox/camel-mbox-summary.h: make
- CAMEL_MESSAGE_FOLDER_NOXEV not conflict with
- CAMEL_MESSAGE_FOLDER_FLAGGED defined in camel-mime-message.h
-
- * providers/mbox/camel-mbox-folder.c (mbox_close): call
- camel_mbox_summary_sync to save flag state if not expunging.
- (mbox_expunge): Update for camel_mbox_summary_expunge rename.
-
-2000-06-13 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (camel_imap_store_open):
- (camel_imap_store_close): Added.
- (camel_imap_command_extended): Fixed a segfault and updated
- to use camel_imap_status()
- (camel_imap_command): Updated to use camel_imap_status()
- (camel_imap_status): New convenience function for parsing
- the return status of an IMAP command
-
-2000-06-12 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c (imap_get_message_by_uid):
- Works like the POP fetch code, should work temporarily until
- we get around to coding it the way it "Should Be".
-
- * providers/pop3/camel-pop3-folder.c (get_message_by_uid): Now uses
- the camel-mime-filter-crlf decoder when retrieving messages.
-
- * camel-mime-filter-smtp.c: Deprecated.
-
- * providers/smtp/camel-smtp-transport.c (smtp_data): Updated to use
- camel-mime-filter-crlf with my 'dot' extension in place of
- camel-mime-filter-smtp
-
- * camel-mime-part.c (write_to_stream): Updated to reflect changes
- made to camel-mime-filter-crlf.c
-
- * camel-mime-filter-crlf.c (filter): Modified to be able to
- encode/decode dots ("\n.\n"<->"\n..\n"). Also fixed the decoder
- so that it should no longer get caught in an infinite loop.
-
-2000-06-12 Dan Winship <danw@helixcode.com>
-
- * providers/*/Makefile.am: don't pass a second (incorrect) -rpath
- in addition to the (correct) one automatically provided by
- automake.
-
- * camel-mime-filter-crlf.c: New filter to do CRLF<->LF conversion.
- (Currently only tested in the LF->CRLF direction.)
-
- * camel-mime-part.c (write_to_stream): if content-type is text,
- and it's QP or B64 encoded, pass through the CRLF filter before
- the other filter to satisfy the "canonical encoding" rules in the
- MIME spec.
-
-2000-06-09 Dan Winship <danw@helixcode.com>
-
- * camel-session.c (camel_session_query_authenticator): Add another
- argument, "mode", which can be CAMEL_AUTHENTICATOR_ASK or
- CAMEL_AUTHENTICATOR_TELL, so callers can get the app to un-cache
- bad info.
-
- * providers/pop3/camel-pop3-store.c (pop3_connect): uncache the
- password if it doesn't work.
-
-2000-06-09 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-stream.c (stream_read): Updated to reflect
- changes made in camel-imap-store.c
-
- * providers/imap/camel-imap-store.c (imap_create): No longer checks to
- make sure a folder doesn't already exists (as this is no longer needed)
- (camel_imap_command): Now takes a CamelFolder argument so it can detect
- whether or not it needs to SELECT a folder or not
- (camel_imap_command_extended): Same.
-
- * providers/smtp/camel-smtp-transport.c (smtp_connect): Will now always
- send EHLO first, if that fails it will fall back on HELO.
- (esmtp_get_authtypes): Should now correctly parse authtypes.
-
-2000-06-07 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-summary.c: Now builds (not that it's worth
- much yet).
-
- * providers/imap/camel-imap-folder.c (imap_get_uids): Now uses the
- correct cast to a CamelImapMessageInfo structure (should get rid of
- compile warnings).
-
- * providers/imap/Makefile.am: Added rules to build
- camel-imap-stream
-
- * providers/imap/camel-imap-store.c (get_folder): Update.
- Moved imap_create here.
-
- * providers/imap/camel-imap-folder.c (delete_messages): Remove.
- (imap_create): Removed.
- (imap_delete): Removed.
- (imap_exists): Removed.
-
- * providers/imap/camel-imap-stream.h: Added typedef's for the stream
-
- * providers/imap/camel-imap-stream.c: Modified to build cleanly
-
-2000-06-07 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-utils.c (header_msgid_decode_internal): Properly
- dereference warning/debug messages.
- (header_references_decode): Check we actually have msgid stuff
- before trying to decode it ...
-
-2000-06-06 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-imap-stream.[c,h]: Removed
-
- * providers/imap/camel-imap-stream.[c,h]: Relocated to this
- location
-
- * providers/imap/camel-imap-summary.c: Added
-
-2000-06-06 Dan Winship <danw@helixcode.com>
-
- * camel-folder.c: Remove exists, create, delete. A CamelFolder
- now always references an existing folder. Remove delete_messages
- too since it wasn't being used. Add a "create" flag to
- get_subfolder saying whether or not to create the subfolder if it
- doesn't yet exist.
-
- * camel-store.c (camel_store_get_folder): Add a "create" flag to
- say whether or not to create the folder if it doesn't yet exist.
- (camel_store_delete_folder): New method, moved from CamelFolder.
- (cache_folder, uncache_folder): Fix up a bit.
- (get_folder_name): Explain what this is for.
-
- * providers/mbox/camel-mbox-folder.c:
- * providers/mbox/camel-mbox-store.c: Update. Remove support for
- hierarchical folders to simplify this for now, since we're not
- using it, and it's not completely clear how they should work in an
- ELocalStorage world. Needs to be revisited.
-
- * providers/pop3/camel-pop3-folder.c (delete_messages): Remove.
- * providers/pop3/camel-pop3-store.c (get_folder): Update.
-
- * providers/vee/camel-vee-folder.c (exists): Remove.
- * providers/vee/camel-vee-store.c (vee_get_folder): Update.
-
-2000-06-06 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-*.[c,h]: Started on getting
- imap to build cleanly (tho some work has not been completed
- so it still won't build until camel-imap-summary is finished
- along with a few methods in camel-imap-folder)
-
- * camel-stream.[c,h]: Changed the read and write method prototypes
- to return an ssize_t type rather than an int and also changed
- the 'number of bytes' to read or write to a size_t type
-
- * camel-stream-fs.c: same as above
-
- * camel-stream-mem.c: again, same as above
-
- * camel-stream-buffer.c: same
-
- * camel-imap-stream.[c,h]: Added this new stream, cache's previously
- read data so each successive call will instead read from the cache
-
-2000-06-05 Dan Winship <danw@helixcode.com>
-
- * camel-mime-part.c (camel_mime_part_set_disposition): fix
- typo/braino (set "Content-Disposition", not "Content-Description")
- (camel_mime_part_set_filename): const poison
-
-2000-06-02 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-utils.c (base64_encode_step): Ick, damn signs! Fix a
- bug with sign extended bytes.
-
- * camel-mime-filter-smtp.c (filter): Changed layout/logic slightly
- (to match From filter)
-
-2000-06-02 Jeffrey Stedfast <fejj@helixcode.com>
-
- * camel-mime-filter-smtp.c (filter): Fixed the filter so that it
- wouldn't insert garbage under certain conditions.
-
-2000-06-02 Christopher James Lahey <clahey@helixcode.com>
-
- * camel-session.c: Don't ref the services in the cache.
-
-2000-06-02 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.c: Rearanged where debug
- fprintf statements we placed so that any data the server sends
- back is printed out before an exception is set and the function
- returns.
-
-2000-06-02 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-utils.c (header_decode_date): If we get a funny
- result, just throw it out. Basically a fix for the one true
- broken TradeClient.
-
-2000-06-01 Not Zed <NotZed@HelixCode.com>
-
- * camel-folder-summary.c (message_info_free): Free
- references/messsage id.
- (message_info_save): Save them.
- (message_info_load): Load them.
- (message_info_new): And get them from the new message.
- (CAMEL_FOLDER_SUMMARY_VERSION): Bumped for new changes.
-
- * camel-folder-summary.h: Added references and messageid to
- summary.
-
-2000-06-02 Christopher James Lahey <clahey@helixcode.com>
-
- * camel-session.c: Ref and unref objects in the service cache
- properly.
-
- * camel-store.c: Ref the folder when returning it using
- lookup_folder. Used the folder's full name for the key for the
- folder cache since that's used to uncache it.
-
-2000-06-02 Dan Winship <danw@helixcode.com>
-
- Fun with purify.
-
- * providers/pop3/camel-pop3-store.c (pop3_connect): free msg on
- success as well as failure.
- (camel_pop3_command_get_additional_data): free buf after reading
- the last line (".").
-
- * providers/pop3/camel-pop3-folder.c (get_message_by_uid): free
- body data after creating the memstream from it (which will copy
- the data).
-
- * providers/mbox/camel-mbox-folder.c (mbox_finalize): free summary
- and index paths.
-
- * camel-data-wrapper.c (finalize): unref the stream, if it exists.
-
-2000-06-01 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-part.c (construct_from_parser): For a message part,
- set the default content-type to message/rfc822. Maybe needs to be
- done for multiparts too?
-
-2000-05-31 Not Zed <NotZed@HelixCode.com>
-
- * camel-mime-message.c (construct_from_parser): Typo in assersion.
-
- * camel-mime-parser.c (folder_scan_step): Use a default type of
- message/rfc822 for multipart/digest. Bug Z192.
- (folder_scan_drop_step): Remove warning.
-
-2000-05-30 Not Zed <NotZed@HelixCode.com>
-
- * providers/mbox/camel-mbox-folder.c (mbox_append_message): Init
- filter_from to NULL, for exception case.
- (mbox_get_message_by_uid): Cast off_t to long int for diagnostics.
-
- * camel-url.c (camel_url_hash): Hash funciton for using camel
- url's as hash keys.
- (camel_url_equal): equal function for same.
-
- * camel-session.c (camel_session_finalise): Free cached services.
- (camel_session_init): Init service cache.
- (service_cache_remove): destroy callback to remove a service from
- the cache.
-
- * camel-store.c (get_folder_internal): Remove the extra ref of the
- folder. That seems the right behaviour ...?
- (camel_store_get_type): Doh, actually call store init, so the
- cache works.
- (cache_folder): strdup the folder name! no wonder it never found
- it again.
-
-2000-05-30 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-folder.c: Implemented a few more
- methods like imap_append and 1 or 2 others
-
-2000-05-29 Not Zed <NotZed@HelixCode.com>
-
- * camel-store.c (camel_store_init): Move it to here. If this
- level is going to maintain it, it should set it up. Lets see what
- caching folders breaks :(
-
- * providers/pop3/camel-pop3-store.c (camel_pop3_store_init): Dont
- init folder cache here.
-
- * providers/mbox/camel-mbox-summary.c
- (camel_mbox_summary_expunge): Make sure we copy messages which are
- still intact to the new folder.
- (camel_mbox_summary_expunge): Update the frompos as well when
- moving the content.
- (camel_mbox_summary_expunge): Remove some debug, and dont offset
- frompos?
-
- * providers/vee/camel-vee-folder.c (vee_folder_build): Check the
- searched folder is open before trying to search it.
- (message_changed): Track changes to the source message in the
- summary.
- (folder_changed): Track folder changes, re-query the folder that
- changed, and cascade the changed event as well.
- (camel_vee_folder_finalise): Free subfolder and subfolder summary.
-
-2000-05-29 Dan Winship <danw@helixcode.com>
-
- * camel-service.c (camel_service_new): Fix up some glib
- precondition stuff. Try to set the URL in camel_service_new before
- checking whether or not it's "empty" so that you can successfully
- set "sendmail:" as a URL.
-
-2000-05-28 Dan Winship <danw@helixcode.com>
-
- * camel-provider.h: Add a domain field to CamelProvider, to say
- what kind of data it provides.
-
- * providers/imap/camel-imap-provider.c:
- * providers/mbox/camel-mbox-provider.c:
- * providers/pop3/camel-pop3-provider.c:
- * providers/sendmail/camel-sendmail-provider.c:
- * providers/smtp/camel-smtp-provider.c: Set domain to "mail".
-
- * providers/nntp/camel-nntp-provider.c: Set domain to "news".
-
- * providers/vee/camel-vee-provider.c: Set domain to "vfolder". (So
- it doesn't end up being listed as a potential mail source in the
- mail config wizard.)
-
- * providers/pop3/camel-pop3-store.c: Split apart password and APOP
- auth, since some servers seem to do both, but don't really.
- (connect_to_server): Renamed from try_connect. Now actually does
- the connection up to the point of checking the greeting for APOP
- support.
- (query_auth_types): Return APOP, if appropriate. Call
- pop3_disconnect after connect_to_server since we don't really want
- to be connected.
- (pop3_connect): Use connect_to_server rather than duplicating
- code. Fix a one-byte buffer overrun in the APOP code.
- (pop3_disconnect): Make this able to clean up after a partial
- connect.
- (connect_to_server): Remove port number from error message since
- it's not terribly useful and we were getting it from the wrong
- place anyway.
-
- * camel-mime-utils.c (header_address_list_format_append): Use
- `foo@bar' rather than `"" <foo@bar>' for email addresses with no
- name component.
-
-2000-05-27 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c: Removed
- camel_imap_command_get_additional_data() as it was
- completely useless, replaced with
- camel_imap_command_extended() which may eventually replace
- camel_imap_command() as well.
-
- * providers/imap/camel-imap-store.h: Modified to reflect
- changes made to camel-imap-store.c
-
- * providers/imap/camel-imap-folder.c: Wrote the first of many
- methods: camel_imap_init(), imap_open(), imap_expunge(),
- imap_get_message_count(), and imap_get_subfolder_names()
-
-2000-05-26 Dan Winship <danw@helixcode.com>
-
- * camel-multipart.c (camel_multipart_init): Don't set a default
- boundary. Require the caller to do that.
- (set_boundary): if boundary is NULL, generate a "random" boundary.
-
- * camel-mime-part-utils.c
- (camel_mime_part_construct_content_from_parser): Add a call to
- camel_multipart_set_boundary after creating a new multipart.
-
-2000-05-25 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap/camel-imap-store.c (try_connect): Removed
- Exception code - Pop doesn't seem to set exceptions
-
- * providers/imap/camel-imap-folder.c: Initial code, mostly
- just a template for future code
-
- * providers/imap/imap.[c,h]: Source code from my personal
- mailer - for reference only!
-
-2000-05-25 NotZed <NotZed@HelixCode.com>
-
- * camel-mime-part-utils.c
- (camel_mime_part_construct_content_from_parser): Replace simple
- data wrapper here too, oops.
-
- * Makefile.am (libcamel_la_SOURCES): Removed
- camel-simple-data-wrapper again. Less code to maintain == better
- code.
-
- * camel-data-wrapper.c (construct_from_stream): Fixes for bug
- where text attachments dont work. Made data-wrapper concrete for
- the second time.
-
-2000-05-23 NotZed <NotZed@HelixCode.com>
-
- * providers/vee/camel-vee-folder.c (vee_folder_build_folder):
- Update the vfolder details for a single folder.
-
-2000-05-25 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.c (_send_to): Took out code
- that had been there to reconnect to the server if it was not
- already connected - Mailer code was fixed so that this should not
- be needed.
-
- * providers/imap/camel-imap-store.[c,h]: Initial code.
-
-2000-05-24 Dan Winship <danw@helixcode.com>
-
- * camel.h: Re-add camel-simple-data-wrapper.h, which was removed
- for some reason.
-
-2000-05-24 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.[c,h]: Moved global
- variables into struct CamelSmtpTransport to make SMTP
- thread-safe
-
- * providers/imap/camel-imap-*.h: Stolen from Mbox. Rough structure
- for Imap.
-
-2000-05-23 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/imap: Added some initial code to the camel tree
- for IMAPv4
-
- * providers/imap/.cvsignore: Added to repository
-
- * providers/smtp/camel-smtp-transport.c: Added debug fprintf's
- so that testers can provide more information. Tested with simple
- messages and a reply to the hello@helixcode.com default message
- but should really be tested more.
- (smtp_data): Fixed to use data_wrapper_write_to_stream.
-
- * camel-mime-filter-smtp.c (filter): Modified to escape all lines
- beginning with a '.' and to place a \r before each \n if one did
- not previously exist. Removed code to escape "From " as it was
- found to not be needed for SMTP.
-
-2000-05-22 Jeffrey Stedfast <fejj@helixcode.com>
-
- * providers/smtp/camel-smtp-transport.c (smtp_data): Fixed the
- filtered stream. Fixes for stream changes, updated to use
- camel-mime-filter-smtp.
-
- * Makefile.am: Added camel-mime-filter-smtp.c
-
- * camel-mime-filter-smtp.[c,h]: Added to camel tree
- Smtp filter used to change \n into \r\n, escape lone dots,
- and escape "From "'s.
-
-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): Reimplement.
- (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 adf5662dd4..0000000000
--- a/camel/Makefile.am
+++ /dev/null
@@ -1,173 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS = providers tests
-
-libcamelincludedir = $(includedir)/camel
-providerdir = $(libdir)/evolution/camel-providers/$(VERSION)
-
-lib_LTLIBRARIES = libcamel.la
-
-INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \
- -I$(top_srcdir)/intl \
- -I$(top_srcdir)/e-util \
- $(GLIB_CFLAGS) \
- $(UNICODE_CFLAGS) \
- $(KRB4_CFLAGS) \
- -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" \
- -DG_LOG_DOMAIN=\"camel\"
-
-libcamel_la_SOURCES = \
- broken-date-parser.c \
- camel-address.c \
- camel-data-wrapper.c \
- camel-exception.c \
- camel-filter-driver.c \
- camel-filter-search.c \
- camel-folder-search.c \
- camel-folder-summary.c \
- camel-folder-thread.c \
- camel-folder.c \
- camel-internet-address.c \
- camel-lock.c \
- camel-medium.c \
- camel-mime-filter-bestenc.c \
- camel-mime-filter-basic.c \
- camel-mime-filter-charset.c \
- camel-mime-filter-crlf.c \
- camel-mime-filter-from.c \
- camel-mime-filter-index.c \
- camel-mime-filter-linewrap.c \
- camel-mime-filter-save.c \
- camel-mime-filter.c \
- camel-mime-message.c \
- camel-mime-parser.c \
- camel-mime-part-utils.c \
- camel-mime-part.c \
- camel-mime-utils.c \
- camel-movemail.c \
- camel-multipart.c \
- camel-object.c \
- camel-operation.c \
- camel-provider.c \
- camel-remote-store.c \
- camel-sasl.c \
- camel-sasl-anonymous.c \
- camel-sasl-cram-md5.c \
- camel-sasl-kerberos4.c \
- camel-sasl-plain.c \
- camel-search-private.c \
- camel-seekable-stream.c \
- camel-seekable-substream.c \
- camel-service.c \
- camel-session.c \
- camel-store.c \
- camel-stream-buffer.c \
- camel-stream-filter.c \
- camel-stream-fs.c \
- camel-stream-mem.c \
- camel-stream-null.c \
- camel-stream.c \
- camel-transport.c \
- camel-uid-cache.c \
- camel-url.c \
- camel-vee-folder.c \
- camel-vee-store.c \
- camel-charset-map.c \
- camel.c \
- gstring-util.c \
- hash-table-utils.c \
- string-utils.c
-
-libcamelinclude_HEADERS = \
- broken-date-parser.h \
- camel-address.h \
- camel-charset-map.h \
- camel-data-wrapper.h \
- camel-exception-list.def \
- camel-exception.h \
- camel-filter-driver.h \
- camel-filter-search.h \
- camel-folder-search.h \
- camel-folder-summary.h \
- camel-folder-thread.h \
- camel-folder.h \
- camel-internet-address.h \
- camel-lock.h \
- camel-medium.h \
- camel-mime-filter-bestenc.h \
- camel-mime-filter-basic.h \
- camel-mime-filter-charset.h \
- camel-mime-filter-crlf.h \
- camel-mime-filter-from.h \
- camel-mime-filter-index.h \
- camel-mime-filter-linewrap.h \
- camel-mime-filter-save.h \
- camel-mime-filter.h \
- camel-mime-message.h \
- camel-mime-parser.h \
- camel-mime-part-utils.h \
- camel-mime-part.h \
- camel-mime-utils.h \
- camel-movemail.h \
- camel-multipart.h \
- camel-object.h \
- camel-operation.h \
- camel-provider.h \
- camel-remote-store.h \
- camel-sasl.h \
- camel-sasl-anonymous.h \
- camel-sasl-cram-md5.h \
- camel-sasl-kerberos4.h \
- camel-sasl-plain.h \
- camel-seekable-stream.h \
- camel-seekable-substream.h \
- camel-service.h \
- camel-session.h \
- camel-store.h \
- camel-stream-buffer.h \
- camel-stream-filter.h \
- camel-stream-fs.h \
- camel-stream-mem.h \
- camel-stream-null.h \
- camel-stream.h \
- camel-transport.h \
- camel-types.h \
- camel-uid-cache.h \
- camel-url.h \
- camel-vee-folder.h \
- camel-vee-store.h \
- camel.h \
- gstring-util.h \
- hash-table-utils.h \
- string-utils.h
-
-libcamel_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-libcamel_la_LIBADD = $(top_builddir)/e-util/libeutil.la \
- $(UNICODE_LIBS) \
- $(KRB4_LDFLAGS)
-
-
-noinst_HEADERS = \
- camel-charset-map-private.h \
- camel-private.h \
- camel-search-private.h
-
-EXTRA_DIST = \
- 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/README.mt b/camel/README.mt
deleted file mode 100644
index aeece1b0bb..0000000000
--- a/camel/README.mt
+++ /dev/null
@@ -1,171 +0,0 @@
-
-This version of camel is working towards being multi-thread safe
-(MT-SAFE). At least, for the important api's.
-
-This code has now been merged into the main head, but this file
-will remain here as a log of how it was done, incase any issues
-arise. The ChangeLog of course has a much more detailed list
-of changes.
-
-Intended method
-===============
-
-I intend working on it in several stages:
-
-1. Making the api multi-threadable. Basically removing some const-returns,
-and copying some data where it wasn't before. The api should
-still continue to work if not being used in a multithreaded
-application. There is not a significant amount of work here since
-this was more or less the intention all along.
-
-Some functions where references to objects are returned may have to be
-changed slightly, so that refcounts are incremented before return.
-This doesn't affect much though.
-
-camel_folder::get_message_info done
-camel_folder_summary::uid done
-camel_folder_summary::index done
-camel_folder::get_summary
- Needs to ref each summary item it points to. done
-camel_folder::free_summary
- Needs to unref each summary item it points to. done
-camel_folder_get_message_tag
- needs to copy the tag return
-camel_maildir_summary filename string
- should not be able to modify the string
- array contents after it has been added to
- the summary.
-camel_folder done
- Make every camel-folder use a camel-folder-summary.
- This just reduces some of the code duplication,
- since everything but vee-folder does this already.
-
-2. Adding high level locks for proof of concept. The locks will
-be stored in private or global data, so the api should remain the same for
-non-threaded applications.
-
-A per-folder lock which governs access to the folder
- summary, the folder file or
- communications socket, etc. done
-Locking for exceptions. done
-Per store locks for internal stuff. done
-Per-service locks for various internal lists and
- caches done
-
-3. Further fine-grained locking where it can be done/is worthwhile.
-
-A per-index lock for libibex done
-Locking for the search object half done
-Internal lock for the folder_summary itself
- So that searching can be detatched from other
- folder operations, etc. done
-Possibly a lock for access to parts of a mime-part
- or message
-
-4. A method to cancel operations.
-
-Individual outstanding operations must be cancellable, and not just
-'all current operations'. This will probably not use pthread_cancel
-type of cancelling.
-
-This will however, probably use a method for starting a new thread,
-through camel, that can then be cancelled, and/or some method of
-registering that a thread can be cancelled. Blocking states within
-camel, within that thread, will then act as checkpoints for if the
-operation, and if it is cancelled, the operation will abort
-(i.e. fail, with an appropriate exception code).
-
-Operation cancelling should also function when the application is not
-multi-threaded. Not sure of the api for this yet, probably a callback
-system. Hopefully the api for both scenarios can be made the same.
-
-Other thoughts
-==============
-
-Basically much of the code in camel that does the actual work does NOT
-need to be thread safe to make it safely usable in an mt context.
-
-camel-folder, camel-summary, camel-imap-search, and the camel-service
-classes (at least) are the important ones to be made multithreaded.
-
-For other things, they are either resources that are created
-one-off (for example, camel-mime-message, and its associated
-parts, like camel-internet-address), or multithreadedness
-doesn't make a lot of sense - e.g. camel-stream, or camel-mime-parser.
-
-So basically the approach is a low-risk one. Adding the minimum
-number of locks to start with, and providing further fine-grained
-locks as required. The locks should not need to be particularly
-fine-grained in order to get reasonable results.
-
-Log of changes
-==============
-
-Changed CamelFolder:get_message_info() to return a ref'd copy, requiring
-all get_message_info()'s to have a matching free_message_info().
-
-Moved the CamelFolder frozen changelog data to a private structure.
-
-Added a mutex for CamelFolder frozen changelog stuff (it was just easy
-to do, although it isn't needed yet).
-
-Added a single mutex around all other CamelFolder functions that need
-it, this is just the first cut at mt'edness.
-
-Fixed all camel-folder implementations that call any other
-camel-folder functions to call via virtual methods, to bypass the locks.
-
-Added camel-store private data.
-
-Added a single mutex lock for camel-store's folder functions.
-
-Added camel-service private data.
-
-Added a single mutex lock for camel-service's connect stuff.
-
-Added a mutex for remote-store stream io stuff.
-
-Added a mutex for imap, so it can bracket a compound command
-exclusively. Pop doesn't need this since you can only have a single
-folder per store, and the folder interface is already forced
-single-threaded.
-
-Added mutex for camel-session, most operations.
-
-Running the tests finds at least 1 deadlock so far. Need to
-work on that.
-
-Fixed get_summary to ref/unref its items.
-
-Removed the global folder lock from the toplevel
-camel_folder_search(), each implementation must now handle locking.
-
-Fixed the local-folder implementation of searching. imap-folder
-searching should already be mt-safe through the command lock.
-
-Fixed imap summary to ref/unref too.
-
-Built some test cases, and expanded the test framework library to
-handle multiple threads. It works!
-
-Next, added a recursive mutex class, so that locking inside imap had
-any chance of working. Got imap working.
-
-Moved the camel folder summary into the base folder class, and fixed
-everything to use it that way.
-
-Made the vfolder use a real camel-folder-summary rather than a
-hashtable + array that it was using, and probably fixed some problems
-which caused evolution-mail not to always catch flag updates. Oh, and
-made it sync/expunge all its subfolders when sync/expungeing.
-
-Made the camel-folder summary completely mt-safe.
-
-Removed all of the locks on the folder functions dealing directly with
-the summary, so now for example all summary lookups will not be
-interupted by long operations.
-
-Made the nntp newsrc thing mt-safe, because of some unfortunate
-sideeffect of it being called from the summary interaction code in
-nntp-folder.
-
diff --git a/camel/broken-date-parser.c b/camel/broken-date-parser.c
deleted file mode 100644
index 544dc04e28..0000000000
--- a/camel/broken-date-parser.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- *
- * Copyright 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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "broken-date-parser.h"
-
-/* prototypes for functions dealing with broken date formats */
-static GList *datetok (const gchar *date);
-static gint get_days_in_month (gint mon, gint year);
-static gint get_weekday (gchar *str);
-static gint get_month (gchar *str);
-
-static char *tz_months [] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-
-/*****************************************************************************
- * The following functions are here in the case of badly broken date formats *
- * *
- * -- fejj@helixcode.com *
- *****************************************************************************/
-
-typedef struct {
- gchar dow[6]; /* day of week (should only need 4 chars) */
- gint day;
- gint mon; /* 1->12 or 0 if invalid */
- gint year;
- gint hour;
- gint min;
- gint sec;
- gchar zone[6]; /* time zone */
-} date_t;
-
-static
-GList *datetok (const gchar *date)
-{
- GList *tokens = NULL;
- gchar *token, *start, *end;
-
- start = (gchar *) date;
- while (*start) {
- /* find the end of this token */
- for (end = start; *end && *end != ' '; end++);
-
- token = g_strndup (start, (end - start));
-
- if (token && *token)
- tokens = g_list_append (tokens, token);
- else
- g_free (token);
-
- if (*end)
- start = end + 1;
- else
- break;
- }
-
- return tokens;
-}
-
-static gint
-get_days_in_month (gint mon, gint year)
-{
- switch (mon) {
- case 1: case 3: case 5: case 7: case 8: case 10: case 12:
- return 31;
- case 4: case 6: case 9: case 11:
- return 30;
- case 2:
- if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
- return 29;
- return 28;
- default:
- return 30;
- }
-}
-
-static gint
-get_weekday (gchar *str)
-{
- g_return_val_if_fail ((str != NULL), 0);
-
- if (strncmp (str, "Mon", 3) == 0) {
- return 1;
- } else if (strncmp (str, "Tue", 3) == 0) {
- return 2;
- } else if (strncmp (str, "Wed", 3) == 0) {
- return 3;
- } else if (strncmp (str, "Thu", 3) == 0) {
- return 4;
- } else if (strncmp (str, "Fri", 3) == 0) {
- return 5;
- } else if (strncmp (str, "Sat", 3) == 0) {
- return 6;
- } else if (strncmp (str, "Sun", 3) == 0) {
- return 7;
- }
-
- return 0; /* unknown week day */
-}
-
-static gint
-get_month (gchar *str)
-{
- g_return_val_if_fail (str != NULL, 0);
-
- if (strncmp (str, "Jan", 3) == 0) {
- return 1;
- } else if (strncmp (str, "Feb", 3) == 0) {
- return 2;
- } else if (strncmp (str, "Mar", 3) == 0) {
- return 3;
- } else if (strncmp (str, "Apr", 3) == 0) {
- return 4;
- } else if (strncmp (str, "May", 3) == 0) {
- return 5;
- } else if (strncmp (str, "Jun", 3) == 0) {
- return 6;
- } else if (strncmp (str, "Jul", 3) == 0) {
- return 7;
- } else if (strncmp (str, "Aug", 3) == 0) {
- return 8;
- } else if (strncmp (str, "Sep", 3) == 0) {
- return 9;
- } else if (strncmp (str, "Oct", 3) == 0) {
- return 10;
- } else if (strncmp (str, "Nov", 3) == 0) {
- return 11;
- } else if (strncmp (str, "Dec", 3) == 0) {
- return 12;
- }
-
- return 0; /* unknown month */
-}
-
-gchar *
-parse_broken_date (const gchar *datestr)
-{
- GList *tokens;
- date_t date;
- gchar *token, *ptr, *newdatestr;
- guint len, i, retval;
- gdouble tz = 0.0;
-
- memset ((void*)&date, 0, sizeof (date_t));
- g_return_val_if_fail (datestr != NULL, NULL);
-
- tokens = datetok (datestr);
- len = g_list_length (tokens);
- for (i = 0; i < len; i++) {
- token = g_list_nth_data (tokens, i);
-
- if ((retval = get_weekday (token))) {
- strncpy (date.dow, datestr, 4);
- } else if ((retval = get_month (token))) {
- date.mon = retval;
- } else if (strlen (token) <= 2) {
- /* this could be a 1 or 2 digit day of the month */
- for (retval = 1, ptr = token; *ptr; ptr++)
- if (*ptr < '0' || *ptr > '9')
- retval = 0;
-
- if (retval && atoi (token) <= 31 && !date.day) /* probably should find a better way */
- date.day = atoi (token);
- else /* fubar'd client using a 2-digit year */
- date.year = atoi (token) < 69 ? 2000 + atoi (token) : 1900 + atoi (token);
- } else if (strlen (token) == 4) {
- /* this could be the year... */
- for (retval = 1, ptr = token; *ptr; ptr++)
- if (*ptr < '0' || *ptr > '9')
- retval = 0;
-
- if (retval)
- date.year = atoi (token);
- } else if (strchr (token, ':')) {
- /* this must be the time: hh:mm:ss */
- sscanf (token, "%d:%d:%d", &date.hour, &date.min, &date.sec);
- } else if (*token == '-' || *token == '+') {
- tz = atoi (token) / 100.0;
- }
- }
-
- g_list_free (tokens);
-
- /* adjust times based on time zones */
-
- if (tz != 0) {
- /* check for time-zone shift */
- if (tz > 0) {
- /* correct for positive hours off of UCT */
- date.hour -= (tz / 100);
- tz = (gint)tz % 100;
-
- if (tz > 0) /* correct for positive minutes off of UCT */
- date.min -= (gint)(((gdouble) tz / 100.0) * 60.0);
- } else {
- if (tz < 0) {
- /* correct for negative hours off of UCT */
- tz = -tz;
- date.hour += (tz / 100);
- tz = -((gint)tz % 100);
-
- if (tz < 0)
- date.min -= (gint)(((gdouble) tz / 100.0) * 60.0);
- }
- }
-
- /* adjust seconds to proper range */
- if (date.sec > 59) {
- date.min += (date.sec / 60);
- date.sec = (date.sec % 60);
- }
-
- /* adjust minutes to proper range */
- if (date.min > 59) {
- date.hour += (date.min / 60);
- date.min = (date.min % 60);
- } else {
- if (date.min < 0) {
- date.min = -date.min;
- date.hour -= (date.min / 60) - 1;
- date.min = 60 - (date.min % 60);
- }
- }
-
- /* adjust hours to the proper randge */
- if (date.hour > 23) {
- date.day += (date.hour / 24);
- date.hour -= (date.hour % 24);
- } else {
- if (date.hour < 0) {
- date.hour = -date.hour;
- date.day -= (date.hour / 24) - 1;
- date.hour = 24 - (date.hour % 60);
- }
- }
-
- /* adjust days to the proper range */
- while (date.day > get_days_in_month (date.mon, date.year)) {
- date.day -= get_days_in_month (date.mon, date.year);
- date.mon++;
- if (date.mon > 12) {
- date.year += (date.mon / 12);
- date.mon = (date.mon % 12);
- if (date.mon == 0) {
- /* month sanity check */
- date.mon = 12;
- date.year -= 1;
- }
- }
- }
-
- while (date.day < 1) {
- date.day += get_days_in_month (date.mon, date.year);
- date.mon--;
- if (date.mon < 1) {
- date.mon = -date.mon;
- date.year -= (date.mon / 12) - 1;
- date.mon = 12 - (date.mon % 12);
- }
- }
-
- /* adjust months to the proper range */
- if (date.mon > 12) {
- date.year += (date.mon / 12);
- date.mon = (date.mon % 12);
- if (date.mon == 0) {
- /* month sanity check */
- date.mon = 12;
- date.year -= 1;
- }
- } else {
- if (date.mon < 1) {
- date.mon = -date.mon;
- date.year -= (date.mon / 12) - 1;
- date.mon = 12 - (date.mon % 12);
- }
- }
- }
-
- /* now lets print this date into a string with the correct format */
- newdatestr = g_strdup_printf ("%s, %d %s %d %s%d:%s%d:%s%d -0000",
- date.dow, date.day, tz_months[date.mon-1],
- date.year,
- date.hour > 10 ? "" : "0", date.hour,
- date.min > 10 ? "" : "0", date.min,
- date.sec > 10 ? "" : "0", date.sec);
-
- return newdatestr;
-}
-
-/*****************************************************************************
- * This ends the code for the broken date parser... *
- * *
- * -- fejj@helixcode.com *
- *****************************************************************************/
diff --git a/camel/broken-date-parser.h b/camel/broken-date-parser.h
deleted file mode 100644
index 17000b3299..0000000000
--- a/camel/broken-date-parser.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- *
- * Copyright 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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-#include <time.h>
-
-#include <ctype.h>
-
-/* prototypes for functions dealing with broken date formats */
-
-gchar *parse_broken_date (const gchar *datestr);
-
-
-
-
-
diff --git a/camel/camel-address.c b/camel/camel-address.c
deleted file mode 100644
index a1c0990dec..0000000000
--- a/camel/camel-address.c
+++ /dev/null
@@ -1,240 +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_finalize (CamelObject *obj);
-
-static CamelObjectClass *camel_address_parent;
-
-static void
-camel_address_class_init (CamelAddressClass *klass)
-{
- camel_address_parent = camel_type_get_global_classfuncs (camel_object_get_type ());
-}
-
-static void
-camel_address_init (CamelAddress *obj)
-{
- obj->addresses = g_ptr_array_new();
-}
-
-static void
-camel_address_finalize (CamelObject *obj)
-{
- camel_address_remove((CamelAddress *)obj, -1);
- g_ptr_array_free(((CamelAddress *)obj)->addresses, TRUE);
-}
-
-CamelType
-camel_address_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_object_get_type (), "CamelAddress",
- sizeof (CamelAddress),
- sizeof (CamelAddressClass),
- (CamelObjectClassInitFunc) camel_address_class_init,
- NULL,
- (CamelObjectInitFunc) camel_address_init,
- (CamelObjectFinalizeFunc) camel_address_finalize);
- }
-
- return type;
-}
-
-/**
- * camel_address_new:
- *
- * Create a new CamelAddress object.
- *
- * Return value: A new CamelAddress widget.
- **/
-CamelAddress *
-camel_address_new (void)
-{
- CamelAddress *new = CAMEL_ADDRESS(camel_object_new(camel_address_get_type()));
- return new;
-}
-
-/**
- * camel_address_new_clone:
- * @in:
- *
- * Clone an existing address type.
- *
- * Return value:
- **/
-CamelAddress *
-camel_address_new_clone(const CamelAddress *in)
-{
- CamelAddress *new = CAMEL_ADDRESS(camel_object_new(CAMEL_OBJECT_GET_TYPE(in)));
-
- camel_address_cat(new, in);
- return new;
-}
-
-/**
- * camel_address_length:
- * @a:
- *
- * Return the number of addresses stored in the address @a.
- *
- * Return value:
- **/
-int
-camel_address_length(CamelAddress *a)
-{
- return a->addresses->len;
-}
-
-/**
- * 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(CAMEL_IS_ADDRESS(a), -1);
-
- return CAMEL_ADDRESS_CLASS (CAMEL_OBJECT_GET_CLASS (a))->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(CAMEL_IS_ADDRESS(a), NULL);
-
- return CAMEL_ADDRESS_CLASS (CAMEL_OBJECT_GET_CLASS (a))->encode(a);
-}
-
-/**
- * camel_address_unformat:
- * @a:
- * @raw:
- *
- * Attempt to convert a previously formatted and/or edited
- * address back into internal form.
- *
- * Return value: -1 if it could not be parsed, or the number
- * of valid addresses found.
- **/
-int
-camel_address_unformat(CamelAddress *a, const char *raw)
-{
- g_return_val_if_fail(CAMEL_IS_ADDRESS(a), -1);
-
- return CAMEL_ADDRESS_CLASS (CAMEL_OBJECT_GET_CLASS (a))->unformat(a, raw);
-}
-
-/**
- * camel_address_format:
- * @a:
- *
- * Format an address in a format suitable for display.
- *
- * Return value: The formatted address.
- **/
-char *
-camel_address_format (CamelAddress *a)
-{
- if (a == NULL)
- return NULL;
-
- g_return_val_if_fail(CAMEL_IS_ADDRESS(a), NULL);
-
- return CAMEL_ADDRESS_CLASS (CAMEL_OBJECT_GET_CLASS (a))->format(a);
-}
-
-/**
- * camel_address_cat:
- * @dest:
- * @source:
- *
- * Concatenate one address onto another. The addresses must
- * be of the same type.
- *
- * Return value:
- **/
-int
-camel_address_cat (CamelAddress *dest, const CamelAddress *source)
-{
- g_return_val_if_fail(CAMEL_IS_ADDRESS(dest), -1);
- g_return_val_if_fail(CAMEL_IS_ADDRESS(source), -1);
-
- return CAMEL_ADDRESS_CLASS(CAMEL_OBJECT_GET_CLASS(dest))->cat(dest, source);
-}
-
-/**
- * camel_address_copy:
- * @dest:
- * @source:
- *
- * Copy an address contents.
- *
- * Return value:
- **/
-int
-camel_address_copy (CamelAddress *dest, const CamelAddress *source)
-{
- g_return_val_if_fail(CAMEL_IS_ADDRESS(dest), -1);
- g_return_val_if_fail(CAMEL_IS_ADDRESS(source), -1);
-
- camel_address_remove(dest, -1);
- return camel_address_cat(dest, source);
-}
-
-/**
- * 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(CAMEL_IS_ADDRESS(a));
-
- if (index == -1) {
- for (index=a->addresses->len; index>-1; index--)
- CAMEL_ADDRESS_CLASS (CAMEL_OBJECT_GET_CLASS (a))->remove(a, index);
- } else {
- CAMEL_ADDRESS_CLASS (CAMEL_OBJECT_GET_CLASS (a))->remove(a, index);
- }
-}
diff --git a/camel/camel-address.h b/camel/camel-address.h
deleted file mode 100644
index 3af3bd3572..0000000000
--- a/camel/camel-address.h
+++ /dev/null
@@ -1,69 +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) CAMEL_CHECK_CAST (obj, camel_address_get_type (), CamelAddress)
-#define CAMEL_ADDRESS_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_address_get_type (), CamelAddressClass)
-#define CAMEL_IS_ADDRESS(obj) CAMEL_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 *);
-
- int (*unformat) (CamelAddress *, const char *raw);
- char *(*format) (CamelAddress *);
-
- int (*cat) (CamelAddress *, const CamelAddress *);
-
- void (*remove) (CamelAddress *, int index);
-};
-
-guint camel_address_get_type (void);
-CamelAddress *camel_address_new (void);
-CamelAddress *camel_address_new_clone (const CamelAddress *);
-int camel_address_length (CamelAddress *);
-
-int camel_address_decode (CamelAddress *, const char *);
-char *camel_address_encode (CamelAddress *);
-int camel_address_unformat (CamelAddress *, const char *);
-char *camel_address_format (CamelAddress *);
-
-int camel_address_cat (CamelAddress *, const CamelAddress *);
-int camel_address_copy (CamelAddress *, const CamelAddress *);
-
-void camel_address_remove (CamelAddress *, int index);
-
-#endif /* ! _CAMEL_ADDRESS_H */
diff --git a/camel/camel-charset-map-private.h b/camel/camel-charset-map-private.h
deleted file mode 100644
index 18b603148a..0000000000
--- a/camel/camel-charset-map-private.h
+++ /dev/null
@@ -1,4345 +0,0 @@
-/* This file is automatically generated: DO NOT EDIT */
-
-static unsigned char m000[256] = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xd0, 0xd0, 0xf2, 0xf7, 0xf2, 0xf0, 0xff,
- 0xf7, 0xf0, 0xb0, 0xf0, 0xe0, 0xff, 0xf2, 0x94,
- 0xf7, 0xf0, 0xf2, 0xf2, 0xd7, 0xd2, 0xd0, 0xf2,
- 0xd7, 0xd0, 0x90, 0xe0, 0xd0, 0xf2, 0xd2, 0xc0,
- 0xd2, 0xc7, 0xc7, 0xc6, 0xc7, 0xc4, 0xc4, 0xc3,
- 0xc2, 0xc7, 0xc2, 0xc7, 0xc2, 0xc7, 0xc7, 0xc2,
- 0x42, 0xc2, 0xe2, 0xc3, 0xc7, 0xc4, 0xc7, 0xc7,
- 0xc4, 0xc2, 0xc7, 0xd6, 0xd7, 0x51, 0x50, 0x97,
- 0x82, 0x87, 0x87, 0x86, 0x87, 0x84, 0x84, 0x83,
- 0x82, 0x87, 0x82, 0x87, 0x82, 0x87, 0x87, 0x82,
- 0x02, 0x82, 0x82, 0x93, 0x97, 0x94, 0x97, 0xd7,
- 0x94, 0x92, 0x97, 0xd6, 0xd7, 0x51, 0x50, 0xf0,
-};
-
-static unsigned char m001[256] = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0x0f, 0x2f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
- 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x2f, 0x0f, 0x2f,
- 0x2f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
- 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x2f, 0x0f, 0x0f,
- 0xff, 0x28, 0x6a, 0x6e, 0x72, 0x28, 0x72, 0x7f,
- 0x70, 0xfe, 0x28, 0x7a, 0x7a, 0x7f, 0x7e, 0x68,
- 0xfb, 0x7a, 0xea, 0x6a, 0x70, 0x7a, 0x7e, 0xfb,
- 0x70, 0x6a, 0x28, 0x7a, 0x62, 0x62, 0x62, 0x28,
- 0x2c, 0x3d, 0x3d, 0x2d, 0x7f, 0x6f, 0x6f, 0x3c,
- 0x2c, 0x7f, 0x2c, 0x3d, 0x2c, 0x3d, 0x3d, 0x2d,
- 0x29, 0x2c, 0x2c, 0x7f, 0x3d, 0x6f, 0x7f, 0x7a,
- 0x6f, 0x2c, 0x3d, 0x2d, 0x7f, 0x3d, 0x29, 0x7f,
- 0x2c, 0x3d, 0x3d, 0x2d, 0x7f, 0x6f, 0x6f, 0x3c,
- 0x2c, 0x7f, 0x2c, 0x3d, 0x2c, 0x3d, 0x3d, 0x2d,
- 0x29, 0x2c, 0x2c, 0x7f, 0x3d, 0x6f, 0x7f, 0xfa,
- 0x6f, 0x2c, 0x3d, 0x2d, 0x7f, 0x3d, 0x29, 0x2c,
-};
-
-static unsigned char m002[256] = {
- 0x1f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
- 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
- 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
- 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
- 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
- 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
- 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
- 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
- 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
- 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
- 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
- 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
- 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
- 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
- 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
- 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x3f, 0x3f,
- 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
- 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
- 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
- 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
- 0x1f, 0x18, 0x58, 0x58, 0x18, 0x58, 0x18, 0x7c,
- 0x78, 0x19, 0x18, 0x1c, 0x58, 0x18, 0x18, 0x18,
- 0x79, 0x78, 0x19, 0x18, 0x78, 0x18, 0x78, 0x19,
- 0x18, 0x18, 0x18, 0x1c, 0x18, 0x18, 0x18, 0x18,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x02, 0x02, 0x1a, 0x1a, 0x18,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x79,
- 0x18, 0x18, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a,
-};
-
-static unsigned char m010[256] = {
- 0x04, 0x04, 0x01, 0x01, 0x05, 0x05, 0x01, 0x01,
- 0x02, 0x02, 0x02, 0x02, 0x05, 0x05, 0x01, 0x01,
- 0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x04, 0x04,
- 0x05, 0x05, 0x01, 0x01, 0x02, 0x02, 0x82, 0x82,
- 0x02, 0x02, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02,
- 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x04, 0x04,
- 0x82, 0x82, 0x00, 0x00, 0x02, 0x02, 0x04, 0x04,
- 0x04, 0x01, 0x01, 0x04, 0x04, 0x01, 0x01, 0x00,
- 0x00, 0x01, 0x01, 0x01, 0x01, 0x04, 0x04, 0x01,
- 0x01, 0x00, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
- 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x04, 0x04,
- 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x83, 0x83,
- 0x05, 0x05, 0x01, 0x01, 0x01, 0x01, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01,
- 0x01, 0x01, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x01, 0x03, 0x03, 0x05, 0x05, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m011[256] = {
- 0x43, 0x43, 0x10, 0x10, 0x53, 0x53, 0x52, 0x52,
- 0x00, 0x00, 0x04, 0x04, 0x53, 0x53, 0x10, 0x10,
- 0x11, 0x11, 0x43, 0x43, 0x00, 0x00, 0x43, 0x43,
- 0x53, 0x53, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x04, 0x43, 0x43, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x01, 0x43, 0x43, 0x00, 0x00, 0x43, 0x43,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x43,
- 0x01, 0x10, 0x10, 0x43, 0x43, 0x10, 0x10, 0x00,
- 0x00, 0x52, 0x52, 0x52, 0x52, 0x43, 0x43, 0x10,
- 0x10, 0x00, 0x01, 0x01, 0x43, 0x43, 0x00, 0x00,
- 0x10, 0x10, 0x28, 0x28, 0x10, 0x10, 0x42, 0x42,
- 0x10, 0x10, 0x52, 0x52, 0x00, 0x00, 0x10, 0x10,
- 0x7b, 0x7b, 0x10, 0x10, 0x10, 0x10, 0x01, 0x01,
- 0x01, 0x01, 0x43, 0x43, 0x00, 0x00, 0x10, 0x10,
- 0x10, 0x10, 0x43, 0x43, 0x04, 0x04, 0x04, 0x04,
- 0x2c, 0x52, 0x52, 0x52, 0x52, 0x7b, 0x7b, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m020[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x03, 0x07, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m021[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x50,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x50, 0x00, 0x50, 0x20, 0x10, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m022[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m030[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x00,
- 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m032[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m040[256] = {
- 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m041[256] = {
- 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m042[256] = {
- 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61,
- 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61,
- 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61,
- 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61,
- 0x61, 0x61, 0x61, 0x61, 0x61, 0x60, 0x61, 0x61,
- 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61,
- 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61,
- 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61,
- 0x00, 0x61, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m050[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
- 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
- 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
- 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m052[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x00,
- 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m060[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10,
- 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m0e2[256] = {
- 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m102[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m1e1[256] = {
- 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m200[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m201[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x70, 0x71, 0x00, 0x00, 0x00,
- 0x70, 0x72, 0x70, 0x00, 0x72, 0x72, 0x72, 0x00,
- 0x70, 0x70, 0xf0, 0x00, 0x00, 0x00, 0x70, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m202[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x64, 0x00, 0x00, 0x00, 0x04, 0x60, 0x40, 0x00,
- 0x78, 0x78, 0x00, 0x00, 0x60, 0x60, 0x18, 0x18,
- 0x60, 0x60, 0x01, 0x00, 0x00, 0x60, 0x64, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x40, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m210[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m211[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m212[256] = {
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m221[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m222[256] = {
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x61, 0x00, 0x00, 0x60, 0x60, 0x20,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x01, 0x01, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m231[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m232[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m242[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m251[256] = {
- 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
- 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
- 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
- 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
- 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m252[256] = {
- 0x61, 0x60, 0x61, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x60,
- 0x61, 0x00, 0x00, 0x60, 0x61, 0x00, 0x00, 0x60,
- 0x61, 0x00, 0x00, 0x60, 0x61, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x61, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x61, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x61, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x61, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x61, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m262[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m302[256] = {
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
-};
-
-static unsigned char m322[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m332[256] = {
- 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20,
- 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00,
- 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x00,
- 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m4e2[256] = {
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x20, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x20, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x20, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m4f2[256] = {
- 0x20, 0x60, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x20, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x20, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x20, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x20, 0x00, 0x20, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x20, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x60, 0x00, 0x00, 0x20, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x20,
-};
-
-static unsigned char m502[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x20, 0x60,
- 0x00, 0x60, 0x20, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x20, 0x60, 0x00, 0x00, 0x20, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x20, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m512[256] = {
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x20, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x20, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x20, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
-};
-
-static unsigned char m522[256] = {
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x20, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x20, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x20, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x20,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x20, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x20, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
-};
-
-static unsigned char m532[256] = {
- 0x20, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x20,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x20, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x20, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x20, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m542[256] = {
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x20, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x20, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x20,
-};
-
-static unsigned char m552[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x20, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
-};
-
-static unsigned char m562[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
-};
-
-static unsigned char m572[256] = {
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x20, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x20,
- 0x20, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m582[256] = {
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x20, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x20, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
-};
-
-static unsigned char m592[256] = {
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x20, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x20, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x20, 0x00, 0x20, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x20, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x20, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x20, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
-};
-
-static unsigned char m5a2[256] = {
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m5b2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x20, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x20, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x20, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
-};
-
-static unsigned char m5c2[256] = {
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x20, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
-};
-
-static unsigned char m5d2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x20,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x20, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x20, 0x20, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x20, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
-};
-
-static unsigned char m5e2[256] = {
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60,
-};
-
-static unsigned char m5f2[256] = {
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x20, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x20, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x20,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x20,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x20, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
-};
-
-static unsigned char m602[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x20, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x20, 0x00, 0x00,
- 0x00, 0x60, 0x20, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x20, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x20, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x20, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m612[256] = {
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x20, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x20, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60,
-};
-
-static unsigned char m622[256] = {
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x20, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
-};
-
-static unsigned char m632[256] = {
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m642[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x20, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
-};
-
-static unsigned char m652[256] = {
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m662[256] = {
- 0x20, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x20, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x20, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x20, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x20, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x60,
- 0x00, 0x20, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x20,
- 0x00, 0x20, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x20, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x20, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x20, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x20, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x20,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x20, 0x20, 0x60, 0x60, 0x60, 0x60,
-};
-
-static unsigned char m672[256] = {
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x20, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x20, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x20, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
-};
-
-static unsigned char m682[256] = {
- 0x00, 0x20, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x20, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x20, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x20, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x20,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m692[256] = {
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
-};
-
-static unsigned char m6a2[256] = {
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x20, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m6b2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x20, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m6c2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x20, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x20,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x20, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x20, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m6d2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x20,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x20, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x20,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x20, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x20, 0x60, 0x60, 0x60, 0x20, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m6e2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x20,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x20, 0x60, 0x00, 0x20, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x20, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x20,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
-};
-
-static unsigned char m6f2[256] = {
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x20, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x20, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
-};
-
-static unsigned char m702[256] = {
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
-};
-
-static unsigned char m712[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x20, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x20, 0x60,
-};
-
-static unsigned char m722[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x20, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
-};
-
-static unsigned char m732[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x20,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x20, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x20, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x20, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
-};
-
-static unsigned char m742[256] = {
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x20,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x20, 0x00,
- 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x20, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m752[256] = {
- 0x00, 0x20, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x20,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x20,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60,
-};
-
-static unsigned char m762[256] = {
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x20, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x20, 0x20, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
-};
-
-static unsigned char m772[256] = {
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m782[256] = {
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x20, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x20, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
-};
-
-static unsigned char m792[256] = {
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m7a2[256] = {
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x20, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x20,
- 0x00, 0x00, 0x60, 0x20, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
-};
-
-static unsigned char m7b2[256] = {
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x20, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m7c2[256] = {
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
-};
-
-static unsigned char m7d2[256] = {
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x20, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x20, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x20, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x20,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x20, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m7e2[256] = {
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x20, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x20, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m7f2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x20, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m802[256] = {
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
-};
-
-static unsigned char m812[256] = {
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00,
-};
-
-static unsigned char m822[256] = {
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m832[256] = {
- 0x00, 0x20, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x20,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x20, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
-};
-
-static unsigned char m842[256] = {
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x20, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
-};
-
-static unsigned char m852[256] = {
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x20, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x20, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
-};
-
-static unsigned char m862[256] = {
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
-};
-
-static unsigned char m872[256] = {
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
-};
-
-static unsigned char m882[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x20, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
-};
-
-static unsigned char m892[256] = {
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m8a2[256] = {
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x20, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x20,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x20,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x20, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x20,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x20, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
-};
-
-static unsigned char m8b2[256] = {
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x20,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m8c2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
-};
-
-static unsigned char m8d2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x20, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x20, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
-};
-
-static unsigned char m8e2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x20,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
-};
-
-static unsigned char m8f2[256] = {
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
-};
-
-static unsigned char m902[256] = {
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x20,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x20, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
-};
-
-static unsigned char m912[256] = {
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x20, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20,
- 0x60, 0x00, 0x20, 0x60, 0x60, 0x60, 0x20, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x20, 0x20, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
-};
-
-static unsigned char m922[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x20, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, 0x60,
- 0x20, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x20, 0x00,
- 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x20, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x20, 0x00, 0x60, 0x20, 0x00, 0x20, 0x00, 0x20,
- 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x20,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x20, 0x60, 0x20, 0x60, 0x00, 0x00, 0x20,
-};
-
-static unsigned char m932[256] = {
- 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x20, 0x20, 0x00,
- 0x60, 0x20, 0x60, 0x60, 0x00, 0x20, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x20,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x20, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m942[256] = {
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x20, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m952[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x20, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m962[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x20, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x20,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m972[256] = {
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x20, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x20, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20,
- 0x00, 0x20, 0x60, 0x00, 0x00, 0x20, 0x60, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
-};
-
-static unsigned char m982[256] = {
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x20,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
-};
-
-static unsigned char m992[256] = {
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x20,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
-};
-
-static unsigned char m9a2[256] = {
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x20, 0x00, 0x00, 0x20, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m9b2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x20, 0x00, 0x60, 0x20, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x20, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m9c2[256] = {
- 0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m9d2[256] = {
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x60, 0x00, 0x00, 0x60,
- 0x20, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
-};
-
-static unsigned char m9e2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
- 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x20, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x60, 0x60, 0x00, 0x00,
-};
-
-static unsigned char m9f2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char mf02[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char mf92[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char mfa2[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char mff2[256] = {
- 0x00, 0x60, 0x20, 0x60, 0x60, 0x60, 0x60, 0x20,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x20, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x20, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x20, 0x00,
- 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x20, 0x20, 0x20, 0x60, 0x20, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-struct {
- unsigned char *bits0;
- unsigned char *bits1;
- unsigned char *bits2;
-} camel_charmap[256] = {
- { m000, m001, m002, }, { m010, m011, 0, }, { m020, m021, m022, }, { m030, 0, m032, }, { m040, m041, m042, }, { m050, 0, m052, }, { m060, 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, m0e2, }, { 0, 0, 0, },
- { 0, 0, m102, }, { 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, m1e1, 0, }, { 0, 0, 0, },
- { m200, m201, m202, }, { m210, m211, m212, }, { 0, m221, m222, }, { 0, m231, m232, }, { 0, 0, m242, }, { 0, m251, m252, }, { 0, 0, m262, }, { 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, m302, }, { 0, 0, 0, }, { 0, 0, m322, }, { 0, 0, m332, }, { 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, m4e2, }, { 0, 0, m4f2, },
- { 0, 0, m502, }, { 0, 0, m512, }, { 0, 0, m522, }, { 0, 0, m532, }, { 0, 0, m542, }, { 0, 0, m552, }, { 0, 0, m562, }, { 0, 0, m572, },
- { 0, 0, m582, }, { 0, 0, m592, }, { 0, 0, m5a2, }, { 0, 0, m5b2, }, { 0, 0, m5c2, }, { 0, 0, m5d2, }, { 0, 0, m5e2, }, { 0, 0, m5f2, },
- { 0, 0, m602, }, { 0, 0, m612, }, { 0, 0, m622, }, { 0, 0, m632, }, { 0, 0, m642, }, { 0, 0, m652, }, { 0, 0, m662, }, { 0, 0, m672, },
- { 0, 0, m682, }, { 0, 0, m692, }, { 0, 0, m6a2, }, { 0, 0, m6b2, }, { 0, 0, m6c2, }, { 0, 0, m6d2, }, { 0, 0, m6e2, }, { 0, 0, m6f2, },
- { 0, 0, m702, }, { 0, 0, m712, }, { 0, 0, m722, }, { 0, 0, m732, }, { 0, 0, m742, }, { 0, 0, m752, }, { 0, 0, m762, }, { 0, 0, m772, },
- { 0, 0, m782, }, { 0, 0, m792, }, { 0, 0, m7a2, }, { 0, 0, m7b2, }, { 0, 0, m7c2, }, { 0, 0, m7d2, }, { 0, 0, m7e2, }, { 0, 0, m7f2, },
- { 0, 0, m802, }, { 0, 0, m812, }, { 0, 0, m822, }, { 0, 0, m832, }, { 0, 0, m842, }, { 0, 0, m852, }, { 0, 0, m862, }, { 0, 0, m872, },
- { 0, 0, m882, }, { 0, 0, m892, }, { 0, 0, m8a2, }, { 0, 0, m8b2, }, { 0, 0, m8c2, }, { 0, 0, m8d2, }, { 0, 0, m8e2, }, { 0, 0, m8f2, },
- { 0, 0, m902, }, { 0, 0, m912, }, { 0, 0, m922, }, { 0, 0, m932, }, { 0, 0, m942, }, { 0, 0, m952, }, { 0, 0, m962, }, { 0, 0, m972, },
- { 0, 0, m982, }, { 0, 0, m992, }, { 0, 0, m9a2, }, { 0, 0, m9b2, }, { 0, 0, m9c2, }, { 0, 0, m9d2, }, { 0, 0, m9e2, }, { 0, 0, m9f2, },
- { 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, 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, mf02, }, { 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, mf92, }, { 0, 0, mfa2, }, { 0, 0, 0, }, { 0, 0, 0, }, { 0, 0, 0, }, { 0, 0, 0, }, { 0, 0, mff2, },
-};
-
-struct {
- const char *name;
- unsigned int bit;
-} camel_charinfo[] = {
- { "iso-8859-2", 0x0001 },
- { "iso-8859-3", 0x0002 },
- { "iso-8859-4", 0x0004 },
- { "iso-8859-5", 0x0008 },
- { "iso-8859-6", 0x0010 },
- { "iso-8859-7", 0x0020 },
- { "iso-8859-8", 0x0040 },
- { "iso-8859-9", 0x0080 },
- { "iso-8859-10", 0x0100 },
- { "iso-8859-13", 0x0200 },
- { "iso-8859-14", 0x0400 },
- { "iso-8859-15", 0x0800 },
- { "windows-1250", 0x1000 },
- { "windows-1252", 0x2000 },
- { "windows-1257", 0x4000 },
- { "koi8-r", 0x8000 },
- { "koi8-u", 0x10000 },
- { "tis620.2533-1", 0x20000 },
- { "armscii-8", 0x40000 },
- { "georgian-academy", 0x80000 },
- { "georgian-ps", 0x100000 },
- { "CP932", 0x200000 },
- { "Shift-JIS", 0x400000 },
-};
-
-#define charset_mask(x) \
- (camel_charmap[(x)>>8].bits0?camel_charmap[(x)>>8].bits0[(x)&0xff]<<0:0) \
- | (camel_charmap[(x)>>8].bits1?camel_charmap[(x)>>8].bits1[(x)&0xff]<<8:0) \
- | (camel_charmap[(x)>>8].bits2?camel_charmap[(x)>>8].bits2[(x)&0xff]<<16:0)
-
diff --git a/camel/camel-charset-map.c b/camel/camel-charset-map.c
deleted file mode 100644
index c8974af936..0000000000
--- a/camel/camel-charset-map.c
+++ /dev/null
@@ -1,287 +0,0 @@
-
-#include <stdio.h>
-
-/*
- if you want to build the charset map, add the root directory of
- libunicode to the include path and define BUILD_MAP,
- then run it as
- ./a.out > camel-charset-map-private.h
-
- The tables genereated work like this:
-
- An indirect array for each page of unicode character
- Each array element has an indirect pointer to one of the bytes of
- the generated bitmask.
-*/
-
-#ifdef BUILD_MAP
-#include "iso/iso8859-2.h"
-#include "iso/iso8859-3.h"
-#include "iso/iso8859-4.h"
-#include "iso/iso8859-5.h"
-#include "iso/iso8859-6.h"
-#include "iso/iso8859-7.h"
-#include "iso/iso8859-8.h"
-#include "iso/iso8859-9.h"
-#include "iso/iso8859-10.h"
-#include "iso/iso8859-13.h"
-#include "iso/iso8859-14.h"
-#include "iso/iso8859-15.h"
-#include "iso/windows-1250.h"
-#include "iso/windows-1252.h"
-#include "iso/windows-1257.h"
-#include "iso/koi8-r.h"
-#include "iso/koi8-u.h"
-#include "iso/tis620.2533-1.h"
-#include "iso/armscii-8.h"
-#include "iso/georgian-academy.h"
-#include "iso/georgian-ps.h"
-#include "msft/cp932.h"
-#include "jis/shiftjis.h"
-
-static struct {
- unsigned short *table;
- char *name;
- int type; /* type of table */
- unsigned int bit; /* assigned bit */
-} tables[] = {
- { iso8859_2_table, "iso-8859-2", 0, 0} ,
- { iso8859_3_table, "iso-8859-3", 0, 0} ,
- { iso8859_4_table, "iso-8859-4", 0, 0},
- { iso8859_5_table, "iso-8859-5", 0, 0},
-/* apparently -6 has special digits? */
- { iso8859_6_table, "iso-8859-6", 0, 0},
- { iso8859_7_table, "iso-8859-7", 0, 0},
- { iso8859_8_table, "iso-8859-8", 0, 0},
- { iso8859_9_table, "iso-8859-9", 0, 0},
- { iso8859_10_table, "iso-8859-10", 0, 0},
- { iso8859_13_table, "iso-8859-13", 0, 0},
- { iso8859_14_table, "iso-8859-14", 0, 0},
- { iso8859_15_table, "iso-8859-15", 0, 0},
- { windows_1250_table, "windows-1250", 0, 0},
- { windows_1252_table, "windows-1252", 0, 0},
- { windows_1257_table, "windows-1257", 0, 0},
- { koi8_r_table, "koi8-r", 0, 0},
- { koi8_u_table, "koi8-u", 0, 0},
- { tis_620_table, "tis620.2533-1", 0, 0},
- { armscii_8_table, "armscii-8", 0, 0},
- { georgian_academy_table, "georgian-academy", 0, 0},
- { georgian_ps_table, "georgian-ps", 0, 0},
- { cp932_table, "CP932", 1, 0},
- { sjis_table, "Shift-JIS", 1, 0},
- { 0, 0}
-};
-
-unsigned int encoding_map[256 * 256];
-
-static void
-add_bigmap(unsigned short **table, int bit)
-{
- int i;
- int j;
-
- for (i=0;i<256;i++) {
- unsigned short *tab = table[i];
- if (tab) {
- for (j=0;j<256;j++) {
- if (tab[j])
- encoding_map[tab[j]] |= bit;
- }
- }
- }
-}
-
-void main(void)
-{
- int i, j;
- unsigned short *tab;
- int max, min;
- int bit = 0x01;
- int k;
- int bytes;
-
-#if 0
- /* iso-latin-1 (not needed-detected in code) */
- for (i=0;i<256;i++) {
- encoding_map[i] |= bit;
- }
- bit <<= 1;
-#endif
-
- /* dont count the terminator */
- bytes = ((sizeof(tables)/sizeof(tables[0]))+7-1)/8;
-
- /* the other latin charsets */
- for (j=0;tables[j].table;j++) {
- switch (tables[j].type) {
- case 0: /* table from 128-256 */
- tab = tables[j].table;
- for (i=0;i<128;i++) {
- /* 0-127 is the common */
- encoding_map[i] |= bit;
- encoding_map[tab[i]] |= bit;
- }
- break;
- case 1: /* sparse table */
- add_bigmap(tables[j].table, bit);
- break;
- }
- tables[j].bit = bit;
- bit <<= 1;
- }
-
- printf("/* This file is automatically generated: DO NOT EDIT */\n\n");
-
- for (i=0;i<256;i++) {
- /* first, do we need this block? */
- for (k=0;k<bytes;k++) {
- for (j=0;j<256;j++) {
- if ((encoding_map[i*256 + j] & (0xff << (k*8))) != 0)
- break;
- }
- if (j < 256) {
- /* yes, dump it */
- printf("static unsigned char m%02x%x[256] = {\n\t", i, k);
- for (j=0;j<256;j++) {
- printf("0x%02x, ", (encoding_map[i*256+j] >> (k*8)) & 0xff );
- if (((j+1)&7) == 0 && j<255)
- printf("\n\t");
- }
- printf("\n};\n\n");
- }
- }
- }
-
- printf("struct {\n");
- for (k=0;k<bytes;k++) {
- printf("\tunsigned char *bits%d;\n", k);
- }
- printf("} camel_charmap[256] = {\n\t");
- for (i=0;i<256;i++) {
- /* first, do we need this block? */
- printf("{ ");
- for (k=0;k<bytes;k++) {
- for (j=0;j<256;j++) {
- if ((encoding_map[i*256 + j] & (0xff << (k*8))) != 0)
- break;
- }
- if (j < 256) {
- printf("m%02x%x, ", i, k);
- } else {
- printf("0, ");
- }
- }
- printf("}, ");
- if (((i+1)&7) == 0 && i<255)
- printf("\n\t");
- }
- printf("\n};\n\n");
-
- printf("struct {\n\tconst char *name;\n\tunsigned int bit;\n} camel_charinfo[] = {\n");
- for (j=0;tables[j].table;j++) {
- printf("\t{ \"%s\", 0x%04x },\n", tables[j].name, tables[j].bit);
- }
- printf("};\n\n");
-
- printf("#define charset_mask(x) \\\n");
- for (k=0;k<bytes;k++) {
- if (k!=0)
- printf("\t| ");
- else
- printf("\t");
- printf("(camel_charmap[(x)>>8].bits%d?camel_charmap[(x)>>8].bits%d[(x)&0xff]<<%d:0)", k, k, k*8);
- if (k<bytes-1)
- printf("\t\\\n");
- }
- printf("\n\n");
-
-}
-
-#else
-
-#include "camel-charset-map.h"
-#include "camel-charset-map-private.h"
-#include <unicode.h>
-#include <glib.h>
-
-void camel_charset_init(CamelCharset *c)
-{
- c->mask = ~0;
- c->level = 0;
-}
-
-void
-camel_charset_step(CamelCharset *c, const char *in, int len)
-{
- register unsigned int mask;
- register int level;
- const char *inptr = in, *inend = in+len;
-
- mask = c->mask;
- level = c->level;
-
- /* check what charset a given string will fit in */
- while (inptr < inend) {
- unicode_char_t c;
- const char *newinptr;
- newinptr = unicode_get_utf8(inptr, &c);
- if (newinptr == NULL) {
- inptr++;
- continue;
- }
- inptr = newinptr;
- if (c<=0xffff) {
- mask &= charset_mask(c);
-
- if (c>=128 && c<256)
- level = MAX(level, 1);
- else if (c>=256)
- level = MAX(level, 2);
- } else {
- mask = 0;
- level = MAX(level, 2);
- }
- }
-
- c->mask = mask;
- c->level = level;
-}
-
-/* gets the best charset from the mask of chars in it */
-static const char *
-camel_charset_best_mask(unsigned int mask)
-{
- int i;
-
- for (i=0;i<sizeof(camel_charinfo)/sizeof(camel_charinfo[0]);i++) {
- if (camel_charinfo[i].bit & mask)
- return camel_charinfo[i].name;
- }
- return "UTF-8";
-}
-
-const char *camel_charset_best_name(CamelCharset *charset)
-{
- if (charset->level == 1)
- return "ISO-8859-1";
- else if (charset->level == 2)
- return camel_charset_best_mask(charset->mask);
- else
- return NULL;
-
-}
-
-/* finds the minimum charset for this string NULL means US-ASCII */
-const char *
-camel_charset_best(const char *in, int len)
-{
- CamelCharset charset;
-
- camel_charset_init(&charset);
- camel_charset_step(&charset, in, len);
- return camel_charset_best_name(&charset);
-}
-
-
-#endif /* !BUILD_MAP */
-
diff --git a/camel/camel-charset-map.h b/camel/camel-charset-map.h
deleted file mode 100644
index 53ba4af9d9..0000000000
--- a/camel/camel-charset-map.h
+++ /dev/null
@@ -1,38 +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_CHARSET_MAP_H
-#define _CAMEL_CHARSET_MAP_H
-
-typedef struct _CamelCharset CamelCharset;
-
-struct _CamelCharset {
- unsigned int mask;
- int level;
-};
-
-void camel_charset_init(CamelCharset *);
-void camel_charset_step(CamelCharset *, const char *in, int len);
-const char *camel_charset_best_name(CamelCharset *);
-
-/* helper function */
-const char *camel_charset_best(const char *in, int len);
-
-#endif /* ! _CAMEL_CHARSET_MAP_H */
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
deleted file mode 100644
index 277c4025bb..0000000000
--- a/camel/camel-data-wrapper.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; -*- */
-/* 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-mime-utils.h"
-#include "camel-stream.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 (CAMEL_OBJECT_GET_CLASS(so))
-
-
-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 CamelContentType *get_mime_type_field (CamelDataWrapper *data_wrapper);
-static void set_mime_type_field (CamelDataWrapper *data_wrapper, CamelContentType *mime_type);
-
-static void
-camel_data_wrapper_class_init (CamelDataWrapperClass *camel_data_wrapper_class)
-{
- parent_class = camel_type_get_global_classfuncs (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;
-}
-
-static void
-camel_data_wrapper_init (gpointer object, gpointer klass)
-{
- CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object);
-
- camel_data_wrapper->mime_type = header_content_type_new ("application", "octet-stream");
- camel_data_wrapper->offline = FALSE;
-}
-
-static void
-camel_data_wrapper_finalize (CamelObject *object)
-{
- CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object);
-
- if (camel_data_wrapper->mime_type)
- header_content_type_unref (camel_data_wrapper->mime_type);
-
- if (camel_data_wrapper->stream)
- camel_object_unref (CAMEL_OBJECT (camel_data_wrapper->stream));
-}
-
-CamelType
-camel_data_wrapper_get_type (void)
-{
- static CamelType camel_data_wrapper_type = CAMEL_INVALID_TYPE;
-
- if (camel_data_wrapper_type == CAMEL_INVALID_TYPE) {
- camel_data_wrapper_type = camel_type_register (CAMEL_OBJECT_TYPE, "CamelDataWrapper",
- sizeof (CamelDataWrapper),
- sizeof (CamelDataWrapperClass),
- (CamelObjectClassInitFunc) camel_data_wrapper_class_init,
- NULL,
- (CamelObjectInitFunc) camel_data_wrapper_init,
- (CamelObjectFinalizeFunc) camel_data_wrapper_finalize);
- }
-
- return camel_data_wrapper_type;
-}
-
-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 *)camel_object_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)
-{
- if (data_wrapper->stream)
- camel_object_unref((CamelObject *)data_wrapper->stream);
-
- data_wrapper->stream = stream;
- camel_object_ref (CAMEL_OBJECT (stream));
- return 0;
-}
-
-/**
- * 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)
-{
- if (data_wrapper->mime_type)
- header_content_type_unref (data_wrapper->mime_type);
- data_wrapper->mime_type = header_content_type_decode (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 header_content_type_simple (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,
- * which the caller must free.
- **/
-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 CamelContentType *
-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
- **/
-CamelContentType *
-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,
- CamelContentType *mime_type)
-{
- g_return_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper));
- g_return_if_fail (mime_type != NULL);
-
- if (data_wrapper->mime_type)
- header_content_type_unref (data_wrapper->mime_type);
- data_wrapper->mime_type = mime_type;
- if (mime_type)
- header_content_type_ref (data_wrapper->mime_type);
-}
-
-void
-camel_data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper,
- CamelContentType *mime_type)
-{
- CDW_CLASS (data_wrapper)->set_mime_type_field (data_wrapper, mime_type);
-}
-
-
-/**
- * camel_data_wrapper_is_offline:
- * @data_wrapper: a data wrapper
- *
- * Return value: whether @data_wrapper is "offline" (data stored
- * remotely) or not. Some optional code paths may choose to not
- * operate on offline data.
- **/
-gboolean
-camel_data_wrapper_is_offline (CamelDataWrapper *data_wrapper)
-{
- return data_wrapper->offline;
-}
diff --git a/camel/camel-data-wrapper.h b/camel/camel-data-wrapper.h
deleted file mode 100644
index 67cce7ed50..0000000000
--- a/camel/camel-data-wrapper.h
+++ /dev/null
@@ -1,93 +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>
-
-#define CAMEL_DATA_WRAPPER_TYPE (camel_data_wrapper_get_type ())
-#define CAMEL_DATA_WRAPPER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_DATA_WRAPPER_TYPE, CamelDataWrapper))
-#define CAMEL_DATA_WRAPPER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_DATA_WRAPPER_TYPE, CamelDataWrapperClass))
-#define CAMEL_IS_DATA_WRAPPER(o) (CAMEL_CHECK_TYPE((o), CAMEL_DATA_WRAPPER_TYPE))
-
-struct _CamelDataWrapper
-{
- CamelObject parent_object;
-
- CamelContentType *mime_type;
- CamelStream *stream;
- gboolean offline;
-};
-
-typedef struct {
- CamelObjectClass parent_class;
-
- /* Virtual methods */
- void (*set_mime_type) (CamelDataWrapper *data_wrapper,
- const gchar * mime_type);
- gchar * (*get_mime_type) (CamelDataWrapper *data_wrapper);
- CamelContentType * (*get_mime_type_field) (CamelDataWrapper *data_wrapper);
- void (*set_mime_type_field) (CamelDataWrapper *data_wrapper,
- CamelContentType *mime_type_field);
-
- int (*write_to_stream) (CamelDataWrapper *data_wrapper,
- CamelStream *stream);
-
- int (*construct_from_stream) (CamelDataWrapper *data_wrapper,
- CamelStream *);
-} CamelDataWrapperClass;
-
-/* Standard Camel function */
-CamelType 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);
-CamelContentType * camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper);
-void camel_data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper,
- CamelContentType *mime_type);
-
-int camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-
-gboolean camel_data_wrapper_is_offline (CamelDataWrapper *data_wrapper);
-
-#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 8fe1e268cf..0000000000
--- a/camel/camel-exception-list.def
+++ /dev/null
@@ -1,37 +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,
-CAMEL_EXCEPTION_STORE_NO_FOLDER,
-
-/* CamelServiceException */
-CAMEL_EXCEPTION_SERVICE_NULL = 300,
-CAMEL_EXCEPTION_SERVICE_INVALID,
-CAMEL_EXCEPTION_SERVICE_URL_INVALID,
-CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
-CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED
diff --git a/camel/camel-exception.c b/camel/camel-exception.c
deleted file mode 100644
index 6f07183f2b..0000000000
--- a/camel/camel-exception.c
+++ /dev/null
@@ -1,277 +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"
-
-/* i dont know why gthread_mutex stuff even exists, this is easier */
-
-/* also, i'm not convinced mutexes are needed here. But it
- doesn't really hurt either */
-#ifdef ENABLE_THREADS
-#include <pthread.h>
-
-static pthread_mutex_t exception_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-#define CAMEL_EXCEPTION_LOCK(e) (pthread_mutex_lock(&exception_mutex))
-#define CAMEL_EXCEPTION_UNLOCK(e) (pthread_mutex_unlock(&exception_mutex))
-#else
-#define CAMEL_EXCEPTION_LOCK(e)
-#define CAMEL_EXCEPTION_UNLOCK(e)
-#endif
-
-/**
- * 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;
-
- CAMEL_EXCEPTION_LOCK(exception);
-
- if (exception->desc)
- g_free (exception->desc);
- exception->desc = NULL;
- exception->id = CAMEL_EXCEPTION_NONE;
-
- CAMEL_EXCEPTION_UNLOCK(exception);
-}
-
-/**
- * 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;
-
- if (exception->desc)
- g_free (exception->desc);
- 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 (!ex)
- return;
-
- CAMEL_EXCEPTION_LOCK(exception);
-
- ex->id = id;
-
- if (ex->desc)
- g_free(ex->desc);
- ex->desc = g_strdup(desc);
-
- CAMEL_EXCEPTION_UNLOCK(exception);
-}
-
-/**
- * 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;
-
- if (!ex)
- return;
-
- CAMEL_EXCEPTION_LOCK(exception);
-
- if (ex->desc)
- g_free (ex->desc);
-
- va_start(args, format);
- ex->desc = g_strdup_vprintf (format, args);
- va_end (args);
-
- ex->id = id;
-
- CAMEL_EXCEPTION_UNLOCK(exception);
-}
-
-/**
- * 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)
-{
- CAMEL_EXCEPTION_LOCK(exception);
-
- 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_UNLOCK(exception);
-}
-
-/**
- * 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)
-{
- char *ret = NULL;
-
- if (ex)
- ret = ex->desc;
-
- return ret;
-}
diff --git a/camel/camel-exception.h b/camel/camel-exception.h
deleted file mode 100644
index bb8df1a6fc..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 char * 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-filter-driver.c b/camel/camel-filter-driver.c
deleted file mode 100644
index 20c93d3d61..0000000000
--- a/camel/camel-filter-driver.c
+++ /dev/null
@@ -1,826 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2000 Helix Code Inc.
- * Copyright (C) 2001 Ximian Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- * Jeffrey Stedfast <fejj@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-filter-driver.h"
-#include "camel-filter-search.h"
-
-#include "camel-exception.h"
-#include "camel-service.h"
-#include "camel-mime-message.h"
-
-#include <glib.h>
-
-#include <time.h>
-
-#include "e-util/e-sexp.h"
-#include "e-util/e-memory.h"
-#include "e-util/e-msgport.h" /* for edlist */
-
-#define d(x)
-
-/* type of status for a log report */
-enum filter_log_t {
- FILTER_LOG_NONE,
- FILTER_LOG_START, /* start of new log entry */
- FILTER_LOG_ACTION, /* an action performed */
- FILTER_LOG_END, /* end of log */
-};
-
-/* list of rule nodes */
-struct _filter_rule {
- struct _filter_rule *next;
- struct _filter_rule *prev;
-
- char *match;
- char *action;
- char *name;
-};
-
-struct _CamelFilterDriverPrivate {
- GHashTable *globals; /* global variables */
-
- CamelFolder *defaultfolder; /* defualt folder */
-
- CamelFilterStatusFunc *statusfunc; /* status callback */
- void *statusdata; /* status callback data */
-
- /* for callback */
- CamelFilterGetFolderFunc get_folder;
- void *data;
-
- /* run-time data */
- GHashTable *folders; /* folders that message has been copied to */
- int closed; /* close count */
- GHashTable *forwards; /* addresses that have been forwarded the message */
-
- gboolean terminated; /* message processing was terminated */
- gboolean deleted; /* message was marked for deletion */
- gboolean copied; /* message was copied to some folder or another */
-
- CamelMimeMessage *message; /* input message */
- CamelMessageInfo *info; /* message summary info */
- const char *uid; /* message uid */
- CamelFolder *source; /* message source folder */
-
- FILE *logfile; /* log file */
-
- EDList rules; /* list of _filter_rule structs */
-
- CamelException *ex;
-
- /* evaluator */
- ESExp *eval;
-};
-
-#define _PRIVATE(o) (((CamelFilterDriver *)(o))->priv)
-
-static void camel_filter_driver_class_init (CamelFilterDriverClass *klass);
-static void camel_filter_driver_init (CamelFilterDriver *obj);
-static void camel_filter_driver_finalise (CamelObject *obj);
-
-static void camel_filter_driver_log (CamelFilterDriver *driver, enum filter_log_t status, const char *desc, ...);
-
-static CamelFolder *open_folder (CamelFilterDriver *d, const char *folder_url);
-static int close_folders (CamelFilterDriver *d);
-
-static ESExpResult *do_delete (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *);
-static ESExpResult *mark_forward (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *);
-static ESExpResult *do_copy (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *);
-static ESExpResult *do_move (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *);
-static ESExpResult *do_stop (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *);
-static ESExpResult *do_colour (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *);
-static ESExpResult *do_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *);
-static ESExpResult *do_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *);
-
-/* these are our filter actions - each must have a callback */
-static struct {
- char *name;
- ESExpFunc *func;
- int type; /* set to 1 if a function can perform shortcut evaluation, or
- doesn't execute everything, 0 otherwise */
-} symbols[] = {
- { "delete", (ESExpFunc *) do_delete, 0 },
- { "forward-to", (ESExpFunc *) mark_forward, 0 },
- { "copy-to", (ESExpFunc *) do_copy, 0 },
- { "move-to", (ESExpFunc *) do_move, 0 },
- { "stop", (ESExpFunc *) do_stop, 0 },
- { "set-colour", (ESExpFunc *) do_colour, 0 },
- { "set-score", (ESExpFunc *) do_score, 0 },
- { "set-system-flag", (ESExpFunc *) do_flag, 0 }
-};
-
-static CamelObjectClass *camel_filter_driver_parent;
-
-guint
-camel_filter_driver_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register(CAMEL_OBJECT_TYPE, "CamelFilterDriver",
- sizeof(CamelFilterDriver),
- sizeof(CamelFilterDriverClass),
- (CamelObjectClassInitFunc)camel_filter_driver_class_init,
- NULL,
- (CamelObjectInitFunc)camel_filter_driver_init,
- (CamelObjectFinalizeFunc)camel_filter_driver_finalise);
- }
-
- return type;
-}
-
-static void
-camel_filter_driver_class_init (CamelFilterDriverClass *klass)
-{
- /*CamelObjectClass *object_class = (CamelObjectClass *) klass;*/
-
- camel_filter_driver_parent = camel_type_get_global_classfuncs(camel_object_get_type());
-}
-
-static void
-camel_filter_driver_init (CamelFilterDriver *obj)
-{
- struct _CamelFilterDriverPrivate *p;
- int i;
-
- p = _PRIVATE (obj) = g_malloc0 (sizeof (*p));
-
- e_dlist_init(&p->rules);
-
- p->eval = e_sexp_new ();
- /* Load in builtin symbols */
- for (i = 0; i < sizeof (symbols) / sizeof (symbols[0]); i++) {
- if (symbols[i].type == 1) {
- e_sexp_add_ifunction (p->eval, 0, symbols[i].name, (ESExpIFunc *)symbols[i].func, obj);
- } else {
- e_sexp_add_function (p->eval, 0, symbols[i].name, symbols[i].func, obj);
- }
- }
-
- p->globals = g_hash_table_new (g_str_hash, g_str_equal);
-
- p->folders = g_hash_table_new (g_str_hash, g_str_equal);
-}
-
-static void
-free_hash_strings (void *key, void *value, void *data)
-{
- g_free (key);
- g_free (value);
-}
-
-static void
-camel_filter_driver_finalise (CamelObject *obj)
-{
- CamelFilterDriver *driver = (CamelFilterDriver *) obj;
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
- struct _filter_rule *node;
-
- /* close all folders that were opened for appending */
- close_folders (driver);
- g_hash_table_destroy (p->folders);
-
- g_hash_table_foreach (p->globals, free_hash_strings, driver);
- g_hash_table_destroy (p->globals);
-
- e_sexp_unref(p->eval);
-
- if (p->defaultfolder) {
- camel_folder_thaw (p->defaultfolder);
- camel_object_unref (CAMEL_OBJECT (p->defaultfolder));
- }
-
- while ((node = (struct _filter_rule *)e_dlist_remhead(&p->rules))) {
- g_free(node->match);
- g_free(node->action);
- g_free(node->name);
- g_free(node);
- }
-
- g_free (p);
-}
-
-/**
- * camel_filter_driver_new:
- * @system: path to system rules
- * @user: path to user rules
- * @get_folder: function to call to fetch folders
- *
- * Create a new CamelFilterDriver object.
- *
- * Return value: A new CamelFilterDriver widget.
- **/
-CamelFilterDriver *
-camel_filter_driver_new (CamelFilterGetFolderFunc get_folder, void *data)
-{
- CamelFilterDriver *new;
- struct _CamelFilterDriverPrivate *p;
-
- new = CAMEL_FILTER_DRIVER (camel_object_new(camel_filter_driver_get_type ()));
- p = _PRIVATE (new);
-
- p->get_folder = get_folder;
- p->data = data;
-
- return new;
-}
-
-void
-camel_filter_driver_set_logfile (CamelFilterDriver *d, FILE *logfile)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (d);
-
- p->logfile = logfile;
-}
-
-void
-camel_filter_driver_set_status_func (CamelFilterDriver *d, CamelFilterStatusFunc *func, void *data)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (d);
-
- p->statusfunc = func;
- p->statusdata = data;
-}
-
-void
-camel_filter_driver_set_default_folder (CamelFilterDriver *d, CamelFolder *def)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (d);
-
- if (p->defaultfolder) {
- camel_folder_thaw (p->defaultfolder);
- camel_object_unref (CAMEL_OBJECT (p->defaultfolder));
- }
-
- p->defaultfolder = def;
-
- if (p->defaultfolder) {
- camel_folder_freeze (p->defaultfolder);
- camel_object_ref (CAMEL_OBJECT (p->defaultfolder));
- }
-}
-
-void
-camel_filter_driver_add_rule(CamelFilterDriver *d, const char *name, const char *match, const char *action)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (d);
- struct _filter_rule *node;
-
- node = g_malloc(sizeof(*node));
- node->match = g_strdup(match);
- node->action = g_strdup(action);
- node->name = g_strdup(name);
- e_dlist_addtail(&p->rules, (EDListNode *)node);
-}
-
-static void
-report_status (CamelFilterDriver *driver, enum camel_filter_status_t status, int pc, const char *desc, ...)
-{
- /* call user-defined status report function */
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
- va_list ap;
- char *str;
-
- if (p->statusfunc) {
- va_start (ap, desc);
- str = g_strdup_vprintf (desc, ap);
- p->statusfunc (driver, status, pc, str, p->statusdata);
- g_free (str);
- }
-}
-
-
-#if 0
-void
-camel_filter_driver_set_global (CamelFilterDriver *d, const char *name, const char *value)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (d);
- char *oldkey, *oldvalue;
-
- if (g_hash_table_lookup_extended (p->globals, name, (void *)&oldkey, (void *)&oldvalue)) {
- g_free (oldvalue);
- g_hash_table_insert (p->globals, oldkey, g_strdup (value));
- } else {
- g_hash_table_insert (p->globals, g_strdup (name), g_strdup (value));
- }
-}
-#endif
-
-static ESExpResult *
-do_delete (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *driver)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
-
- d(fprintf (stderr, "doing delete\n"));
- p->deleted = TRUE;
- camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Delete");
-
- return NULL;
-}
-
-static ESExpResult *
-mark_forward (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *driver)
-{
- /*struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);*/
-
- d(fprintf (stderr, "marking message for forwarding\n"));
- /* FIXME: do stuff here */
- camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Forward");
-
- return NULL;
-}
-
-static ESExpResult *
-do_copy (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *driver)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
- int i;
-
- d(fprintf (stderr, "copying message...\n"));
-
- for (i = 0; i < argc; i++) {
- if (argv[i]->type == ESEXP_RES_STRING) {
- /* open folders we intent to copy to */
- char *folder = argv[i]->value.string;
- char *service_url;
- CamelFolder *outbox;
-
- outbox = open_folder (driver, folder);
- if (!outbox)
- break;
-
- p->copied = TRUE;
- if (p->uid && p->source)
- camel_folder_copy_message_to (p->source, p->uid, outbox, p->ex);
- else
- camel_folder_append_message (outbox, p->message, p->info, p->ex);
-
- service_url = camel_service_get_url (CAMEL_SERVICE (camel_folder_get_parent_store (outbox)));
- camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to folder %s",
- service_url);
- g_free (service_url);
- }
- }
-
- return NULL;
-}
-
-static ESExpResult *
-do_move (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *driver)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
- int i;
-
- d(fprintf (stderr, "moving message...\n"));
-
- for (i = 0; i < argc; i++) {
- if (argv[i]->type == ESEXP_RES_STRING) {
- /* open folders we intent to move to */
- char *folder = argv[i]->value.string;
- char *service_url;
- CamelFolder *outbox;
-
- outbox = open_folder (driver, folder);
- if (!outbox)
- break;
-
- p->copied = TRUE;
- p->deleted = TRUE; /* a 'move' is a copy & delete */
-
- if (p->uid && p->source)
- camel_folder_copy_message_to (p->source, p->uid, outbox, p->ex);
- else
- camel_folder_append_message (outbox, p->message, p->info, p->ex);
-
- service_url = camel_service_get_url (CAMEL_SERVICE (camel_folder_get_parent_store (outbox)));
- camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Move to folder %s",
- service_url);
- g_free (service_url);
- }
- }
-
- return NULL;
-}
-
-static ESExpResult *
-do_stop (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *driver)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
-
- camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Stopped processing");
- d(fprintf (stderr, "terminating message processing\n"));
- p->terminated = TRUE;
-
- return NULL;
-}
-
-static ESExpResult *
-do_colour (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *driver)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
-
- d(fprintf (stderr, "setting colour tag\n"));
- if (argc > 0 && argv[0]->type == ESEXP_RES_STRING) {
- camel_tag_set (&p->info->user_tags, "colour", argv[0]->value.string);
- camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Set colour to %s", argv[0]->value.string);
- }
-
- return NULL;
-}
-
-static ESExpResult *
-do_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *driver)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
-
- d(fprintf (stderr, "setting score tag\n"));
- if (argc > 0 && argv[0]->type == ESEXP_RES_INT) {
- char *value;
-
- value = g_strdup_printf ("%d", argv[0]->value.number);
- camel_tag_set (&p->info->user_tags, "score", value);
- camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Set score to %d", argv[0]->value.number);
- g_free (value);
- }
-
- return NULL;
-}
-
-static ESExpResult *
-do_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriver *driver)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
-
- d(fprintf (stderr, "setting flag\n"));
- if (argc == 1 && argv[0]->type == ESEXP_RES_STRING) {
- p->info->flags |= camel_system_flag (argv[0]->value.string) | CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Set %s flag", argv[0]->value.string);
- }
-
- return NULL;
-}
-
-static CamelFolder *
-open_folder (CamelFilterDriver *driver, const char *folder_url)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
- CamelFolder *camelfolder;
-
- /* we have a lookup table of currently open folders */
- camelfolder = g_hash_table_lookup (p->folders, folder_url);
- if (camelfolder)
- return camelfolder;
-
- camelfolder = p->get_folder (driver, folder_url, p->data, p->ex);
-
- if (camelfolder) {
- g_hash_table_insert (p->folders, g_strdup (folder_url), camelfolder);
- camel_folder_freeze (camelfolder);
- }
-
- return camelfolder;
-}
-
-static void
-close_folder (void *key, void *value, void *data)
-{
- CamelFolder *folder = value;
- CamelFilterDriver *driver = data;
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
-
- p->closed++;
-
- g_free (key);
- camel_folder_sync (folder, FALSE, p->ex);
- camel_folder_thaw (folder);
- camel_object_unref (CAMEL_OBJECT (folder));
-
- report_status(driver, CAMEL_FILTER_STATUS_PROGRESS, g_hash_table_size(p->folders)* 100 / p->closed, "Syncing folders");
-}
-
-/* flush/close all folders */
-static int
-close_folders (CamelFilterDriver *driver)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
-
- report_status(driver, CAMEL_FILTER_STATUS_PROGRESS, 0, "Syncing folders");
-
- p->closed = 0;
- g_hash_table_foreach (p->folders, close_folder, driver);
- g_hash_table_destroy (p->folders);
- p->folders = g_hash_table_new (g_str_hash, g_str_equal);
-
- /* FIXME: status from driver */
- return 0;
-}
-
-#if 0
-static void
-free_key (gpointer key, gpointer value, gpointer user_data)
-{
- g_free (key);
-}
-#endif
-
-
-static void
-camel_filter_driver_log (CamelFilterDriver *driver, enum filter_log_t status, const char *desc, ...)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
-
- if (p->logfile) {
- char *str = NULL;
-
- if (desc) {
- va_list ap;
-
- va_start (ap, desc);
- str = g_strdup_vprintf (desc, ap);
- }
-
- switch (status) {
- case FILTER_LOG_START: {
- /* write log header */
- const char *subject = NULL;
- char *fromstr;
- const CamelInternetAddress *from;
- char date[50];
- time_t t;
-
- /* FIXME: does this need locking? Probably */
-
- from = camel_mime_message_get_from (p->message);
- fromstr = camel_address_format((CamelAddress *)from);
- subject = camel_mime_message_get_subject (p->message);
-
- time (&t);
- strftime (date, 49, "%a, %d %b %Y %H:%M:%S", localtime (&t));
- fprintf (p->logfile, "Applied filter \"%s\" to message from %s - \"%s\" at %s\n",
- str, fromstr ? fromstr : "unknown", subject ? subject : "", date);
- g_free(fromstr);
- break;
- }
- case FILTER_LOG_ACTION:
- fprintf (p->logfile, "Action: %s\n", str);
- break;
- case FILTER_LOG_END:
- fprintf (p->logfile, "\n");
- break;
- default:
- /* nothing else is loggable */
- break;
- }
-
- g_free (str);
- }
-}
-
-
-/* will filter only an mbox - is more efficient as it doesn't need to open the folder through camel directly */
-void
-camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox, CamelException *ex)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
- CamelMimeParser *mp = NULL;
- char *source_url = NULL;
- int fd = -1;
- int i = 0;
- struct stat st;
-
- fd = open (mbox, O_RDONLY);
- if (fd == -1) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, "Unable to open spool folder");
- goto fail;
- }
- /* to get the filesize */
- fstat (fd, &st);
-
- mp = camel_mime_parser_new ();
- camel_mime_parser_scan_from (mp, TRUE);
- if (camel_mime_parser_init_with_fd (mp, fd) == -1) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, "Unable to process spool folder");
- goto fail;
- }
- fd = -1;
-
- source_url = g_strdup_printf ("file://%s", mbox);
-
- while (camel_mime_parser_step (mp, 0, 0) == HSCAN_FROM) {
- CamelMimeMessage *msg;
- int pc = 0;
-
- if (st.st_size > 0)
- pc = (int)(100.0 * ((double)camel_mime_parser_tell (mp) / (double)st.st_size));
-
- report_status (driver, CAMEL_FILTER_STATUS_START, pc, "Getting message %d (%d%%)", i, pc);
-
- msg = camel_mime_message_new ();
- if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (msg), mp) == -1) {
- report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed message %d", i);
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, "Cannot open message");
- camel_object_unref (CAMEL_OBJECT (msg));
- goto fail;
- }
-
- camel_filter_driver_filter_message (driver, msg, NULL, NULL, NULL, source_url, ex);
- camel_object_unref (CAMEL_OBJECT (msg));
- if (camel_exception_is_set (ex)) {
- report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed message %d", i);
- goto fail;
- }
-
- i++;
-
- /* skip over the FROM_END state */
- camel_mime_parser_step (mp, 0, 0);
- }
-
- if (p->defaultfolder) {
- report_status(driver, CAMEL_FILTER_STATUS_PROGRESS, 100, "Syncing folder");
- camel_folder_sync(p->defaultfolder, FALSE, ex);
- }
-
- report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Complete");
-
-fail:
- g_free (source_url);
- if (fd != -1)
- close (fd);
- if (mp)
- camel_object_unref (CAMEL_OBJECT (mp));
-}
-
-/* will filter a folder */
-void
-camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folder,
- GPtrArray *uids, gboolean remove, CamelException *ex)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
- int i;
- int freeuids = FALSE;
- CamelMimeMessage *message;
- CamelMessageInfo *info;
- char *source_url, *service_url;
-
- service_url = camel_service_get_url (CAMEL_SERVICE (camel_folder_get_parent_store (folder)));
- source_url = g_strdup_printf ("%s%s", service_url, camel_folder_get_full_name (folder));
- g_free (service_url);
-
- if (uids == NULL) {
- uids = camel_folder_get_uids (folder);
- freeuids = TRUE;
- }
-
- for (i = 0; i < uids->len; i++) {
- int pc = (100 * i)/uids->len;
-
- report_status (driver, CAMEL_FILTER_STATUS_START, pc, "Getting message %d of %d", i+1,
- uids->len);
-
- message = camel_folder_get_message (folder, uids->pdata[i], ex);
- if (!message || camel_exception_is_set (ex)) {
- report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed at message %d of %d",
- i+1, uids->len);
- break;
- }
-
- if (camel_folder_has_summary_capability (folder))
- info = camel_folder_get_message_info (folder, uids->pdata[i]);
- else
- info = NULL;
-
- camel_filter_driver_filter_message (driver, message, info, uids->pdata[i],
- folder, source_url, ex);
-
- if (camel_folder_has_summary_capability (folder))
- camel_folder_free_message_info (folder, info);
-
- if (camel_exception_is_set (ex)) {
- report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed at message %d of %d",
- i+1, uids->len);
- break;
- }
-
- if (remove)
- camel_folder_set_message_flags (folder, uids->pdata[i],
- CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED);
-
- camel_object_unref (CAMEL_OBJECT (message));
- }
-
- if (freeuids)
- camel_folder_free_uids (folder, uids);
-
- if (p->defaultfolder) {
- report_status(driver, CAMEL_FILTER_STATUS_PROGRESS, 100, "Syncing folder");
- camel_folder_sync (p->defaultfolder, FALSE, ex);
- }
-
- if (i == uids->len)
- report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Complete");
-
-
- g_free (source_url);
-}
-
-void
-camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage *message,
- CamelMessageInfo *info, const char *uid,
- CamelFolder *source, const char *source_url,
- CamelException *ex)
-{
- struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
- ESExpResult *r;
- struct _filter_rule *node;
- gboolean freeinfo = FALSE;
- gboolean filtered = FALSE;
-
- if (info == NULL) {
- struct _header_raw *h = CAMEL_MIME_PART (message)->headers;
-
- info = camel_message_info_new_from_header (h);
- freeinfo = TRUE;
- } else {
- if (info->flags & CAMEL_MESSAGE_DELETED)
- return;
- }
-
- p->ex = ex;
- p->terminated = FALSE;
- p->deleted = FALSE;
- p->copied = FALSE;
- p->message = message;
- p->info = info;
- p->uid = uid;
- p->source = source;
-
- node = (struct _filter_rule *)p->rules.head;
- while (node->next) {
- d(fprintf (stderr, "applying rule %s\n action %s\n", node->match, node->action));
-
- if (camel_filter_search_match(p->message, p->info, source_url, node->match, p->ex)) {
- filtered = TRUE;
- camel_filter_driver_log (driver, FILTER_LOG_START, node->name);
-
- /* perform necessary filtering actions */
- e_sexp_input_text (p->eval, node->action, strlen (node->action));
- if (e_sexp_parse (p->eval) == -1) {
- camel_exception_setv(ex, 1, _("Error parsing filter: %s: %s"), e_sexp_error(p->eval), node->action);
- goto error;
- }
- r = e_sexp_eval (p->eval);
- if (r == NULL) {
- camel_exception_setv(ex, 1, _("Error executing filter: %s: %s"), e_sexp_error(p->eval), node->action);
- goto error;
- }
- e_sexp_result_free (p->eval, r);
- if (p->terminated)
- break;
- }
- node = node->next;
- }
-
- /* *Now* we can set the DELETED flag... */
- if (p->deleted)
- info->flags = info->flags | CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_FOLDER_FLAGGED;
-
- /* Logic: if !Moved and there exists a default folder... */
- if (!(p->copied && p->deleted) && p->defaultfolder) {
- /* copy it to the default inbox */
- filtered = TRUE;
- camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to default folder");
- if (p->uid && p->source)
- camel_folder_copy_message_to (p->source, p->uid, p->defaultfolder, p->ex);
- else
- camel_folder_append_message (p->defaultfolder, p->message, p->info, p->ex);
- }
-
-error:
- if (filtered)
- camel_filter_driver_log (driver, FILTER_LOG_END, NULL);
-
- if (freeinfo)
- camel_message_info_free (info);
-}
diff --git a/camel/camel-filter-driver.h b/camel/camel-filter-driver.h
deleted file mode 100644
index 113eec28ed..0000000000
--- a/camel/camel-filter-driver.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- * Jeffrey Stedfast <fejj@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_FILTER_DRIVER_H
-#define _CAMEL_FILTER_DRIVER_H
-
-#include <camel/camel-object.h>
-#include <camel/camel-session.h>
-#include <camel/camel-folder.h>
-
-#define CAMEL_FILTER_DRIVER_TYPE (camel_filter_driver_get_type())
-#define CAMEL_FILTER_DRIVER(obj) CAMEL_CHECK_CAST (obj, camel_filter_driver_get_type (), CamelFilterDriver)
-#define CAMEL_FILTER_DRIVER_CLASS(klass) CAMEL__CHECK_CLASS_CAST (klass, camel_filter_driver_get_type (), CamelFilterDriverClass)
-#define CAMEL_IS_FILTER_DRIVER(obj) CAMEL_CHECK_TYPE (obj, camel_filter_driver_get_type ())
-
-typedef struct _CamelFilterDriver CamelFilterDriver;
-typedef struct _CamelFilterDriverClass CamelFilterDriverClass;
-
-struct _CamelFilterDriver {
- CamelObject parent;
-
- struct _CamelFilterDriverPrivate *priv;
-};
-
-struct _CamelFilterDriverClass {
- CamelObjectClass parent_class;
-};
-
-/* FIXME: this maybe should change... */
-/* type of status for a status report */
-enum camel_filter_status_t {
- CAMEL_FILTER_STATUS_NONE,
- CAMEL_FILTER_STATUS_START, /* start of new message processed */
- CAMEL_FILTER_STATUS_ACTION, /* an action performed */
- CAMEL_FILTER_STATUS_PROGRESS, /* (an) extra update(s), if its taking longer to process */
- CAMEL_FILTER_STATUS_END, /* end of message */
-};
-
-typedef CamelFolder * (*CamelFilterGetFolderFunc) (CamelFilterDriver *, const char *uri, void *data, CamelException *ex);
-/* report status */
-typedef void (CamelFilterStatusFunc)(CamelFilterDriver *driver, enum camel_filter_status_t status, int pc, const char *desc, void *data);
-
-guint camel_filter_driver_get_type (void);
-CamelFilterDriver *camel_filter_driver_new (CamelFilterGetFolderFunc fetcher, void *data);
-
-/* modifiers */
-void camel_filter_driver_set_logfile (CamelFilterDriver *d, FILE *logfile);
-void camel_filter_driver_set_status_func (CamelFilterDriver *d, CamelFilterStatusFunc *func,
- void *data);
-void camel_filter_driver_set_default_folder (CamelFilterDriver *d, CamelFolder *def);
-void camel_filter_driver_add_rule (CamelFilterDriver *d, const char *name, const char *match,
- const char *action);
-
-/*void camel_filter_driver_set_global(CamelFilterDriver *, const char *name, const char *value);*/
-
-void camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage *message,
- CamelMessageInfo *info, const char *uri,
- CamelFolder *source, const char *source_url,
- CamelException *ex);
-void camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox,
- CamelException *ex);
-void camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folder,
- GPtrArray *uids, gboolean remove, CamelException *ex);
-
-#if 0
-/* generate the search query/action string for a filter option */
-void camel_filter_driver_expand_option (CamelFilterDriver *d, GString *s, GString *action, struct filter_option *op);
-
-/* get info about rules (options) */
-int camel_filter_driver_rule_count (CamelFilterDriver *d);
-struct filter_option *camel_filter_driver_rule_get (CamelFilterDriver *d, int n);
-#endif
-
-#endif /* ! _CAMEL_FILTER_DRIVER_H */
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c
deleted file mode 100644
index a680c26146..0000000000
--- a/camel/camel-filter-search.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- * Michael Zucchi <NotZed@Ximian.com>
- *
- * Copyright 2000 Helix Code, Inc. (www.helixcode.com)
- * Copyright 2001 Ximian Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-/* (from glibc headers:
- POSIX says that <sys/types.h> must be included (by the caller) before <regex.h>. */
-#include <sys/types.h>
-#include <regex.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "e-util/e-sexp.h"
-
-#include "camel-mime-message.h"
-#include "camel-filter-search.h"
-#include "camel-exception.h"
-#include "camel-multipart.h"
-#include "camel-stream-mem.h"
-#include "camel-search-private.h"
-
-#define d(x)
-
-typedef struct {
- CamelMimeMessage *message;
- CamelMessageInfo *info;
- const char *source;
- CamelException *ex;
-} FilterMessageSearch;
-
-/* ESExp callbacks */
-static ESExpResult *header_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_matches (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_starts_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_ends_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_exists (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_soundex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_full_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *match_all (struct _ESExp *f, int argc, struct _ESExpTerm **argv, FilterMessageSearch *fms);
-static ESExpResult *body_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *body_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *user_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *user_tag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *system_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *get_sent_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *get_received_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *get_current_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *get_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *get_source (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-
-/* builtin functions */
-static struct {
- char *name;
- ESExpFunc *func;
- int type; /* set to 1 if a function can perform shortcut evaluation, or
- doesn't execute everything, 0 otherwise */
-} symbols[] = {
- { "match-all", (ESExpFunc *) match_all, 1 },
- { "body-contains", (ESExpFunc *) body_contains, 0 },
- { "body-regex", (ESExpFunc *) body_regex, 0 },
- { "header-contains", (ESExpFunc *) header_contains, 0 },
- { "header-matches", (ESExpFunc *) header_matches, 0 },
- { "header-starts-with", (ESExpFunc *) header_starts_with, 0 },
- { "header-ends-with", (ESExpFunc *) header_ends_with, 0 },
- { "header-exists", (ESExpFunc *) header_exists, 0 },
- { "header-soundex", (ESExpFunc *) header_soundex, 0 },
- { "header-regex", (ESExpFunc *) header_regex, 0 },
- { "header-full-regex", (ESExpFunc *) header_full_regex, 0 },
- { "user-tag", (ESExpFunc *) user_tag, 0 },
- { "user-flag", (ESExpFunc *) user_flag, 0 },
- { "system-flag", (ESExpFunc *) system_flag, 0 },
- { "get-sent-date", (ESExpFunc *) get_sent_date, 0 },
- { "get-received-date", (ESExpFunc *) get_received_date, 0 },
- { "get-current-date", (ESExpFunc *) get_current_date, 0 },
- { "get-score", (ESExpFunc *) get_score, 0 },
- { "get-source", (ESExpFunc *) get_source, 0 },
-};
-
-static ESExpResult *
-check_header(struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms, camel_search_match_t how)
-{
- gboolean matched = FALSE;
- ESExpResult *r;
- int i;
-
- if (argc > 1 && argv[0]->type == ESEXP_RES_STRING) {
- char *name = argv[0]->value.string;
- const char *header;
-
- if (strcasecmp(name, "x-camel-mlist") == 0)
- header = camel_message_info_mlist(fms->info);
- else
- header = camel_medium_get_header (CAMEL_MEDIUM (fms->message), argv[0]->value.string);
-
- if (header) {
- for (i=1;i<argc && !matched;i++) {
- if (argv[i]->type == ESEXP_RES_STRING
- && camel_search_header_match(header, argv[i]->value.string, how)) {
- matched = TRUE;
- break;
- }
- }
- }
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = matched;
-
- return r;
-}
-
-static ESExpResult *
-header_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- return check_header(f, argc, argv, fms, CAMEL_SEARCH_MATCH_CONTAINS);
-}
-
-
-static ESExpResult *
-header_matches (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- return check_header(f, argc, argv, fms, CAMEL_SEARCH_MATCH_EXACT);
-}
-
-static ESExpResult *
-header_starts_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- return check_header(f, argc, argv, fms, CAMEL_SEARCH_MATCH_STARTS);
-}
-
-static ESExpResult *
-header_ends_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- return check_header(f, argc, argv, fms, CAMEL_SEARCH_MATCH_ENDS);
-}
-
-static ESExpResult *
-header_soundex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- return check_header(f, argc, argv, fms, CAMEL_SEARCH_MATCH_SOUNDEX);
-}
-
-static ESExpResult *
-header_exists (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- gboolean matched = FALSE;
- ESExpResult *r;
- int i;
-
- for (i=0;i<argc && !matched;i++) {
- if (argv[i]->type == ESEXP_RES_STRING)
- matched = camel_medium_get_header (CAMEL_MEDIUM (fms->message), argv[i]->value.string) != NULL;
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = matched;
-
- return r;
-}
-
-static ESExpResult *
-header_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- regex_t pattern;
- const char *contents;
-
- if (argc>1
- && argv[0]->type == ESEXP_RES_STRING
- && (contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), argv[0]->value.string))
- && camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_ICASE, argc-1, argv+1, fms->ex) == 0) {
- r->value.bool = regexec(&pattern, contents, 0, NULL, 0) == 0;
- regfree(&pattern);
- } else
- r->value.bool = FALSE;
-
- return r;
-}
-
-static gchar *
-get_full_header (CamelMimeMessage *message)
-{
- CamelMimePart *mp = CAMEL_MIME_PART (message);
- GString *str = g_string_new ("");
- char *ret;
- struct _header_raw *h;
-
- for (h = mp->headers; h; h = h->next) {
- if (h->value != NULL) {
- g_string_append(str, h->name);
- if (isspace(h->value[0]))
- g_string_append(str, ":");
- else
- g_string_append(str, ": ");
- g_string_append(str, h->value);
- }
- }
-
- ret = str->str;
- g_string_free (str, FALSE);
-
- return ret;
-}
-
-static ESExpResult *
-header_full_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- regex_t pattern;
- char *contents;
-
- if (camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_ICASE, argc-1, argv+1, fms->ex) == 0) {
- contents = get_full_header (fms->message);
- r->value.bool = regexec(&pattern, contents, 0, NULL, 0) == 0;
- g_free(contents);
- regfree(&pattern);
- } else
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-match_all (struct _ESExp *f, int argc, struct _ESExpTerm **argv, FilterMessageSearch *fms)
-{
- /* match-all: when dealing with single messages is a no-op */
- ESExpResult *r;
-
- if (argc > 0)
- return e_sexp_term_eval(f, argv[0]);
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-body_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- regex_t pattern;
-
- if (camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_ICASE, argc, argv, fms->ex) == 0) {
- r->value.bool = camel_search_message_body_contains((CamelDataWrapper *)fms->message, &pattern);
- regfree(&pattern);
- } else
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-body_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- regex_t pattern;
-
- if (camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_ICASE|CAMEL_SEARCH_MATCH_REGEX, argc, argv, fms->ex) == 0) {
- r->value.bool = camel_search_message_body_contains((CamelDataWrapper *)fms->message, &pattern);
- regfree(&pattern);
- } else
- r->value.bool = FALSE;
-
- return r;
-}
-
-static ESExpResult *
-user_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
- gboolean truth = FALSE;
- int i;
-
- /* performs an OR of all words */
- for (i = 0; i < argc && !truth; i++) {
- if (argv[i]->type == ESEXP_RES_STRING
- && camel_flag_get (&fms->info->user_flags, argv[i]->value.string)) {
- truth = TRUE;
- break;
- }
- }
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = truth;
-
- return r;
-}
-
-static ESExpResult *
-system_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
- gboolean truth = FALSE;
-
- if (argc == 1)
- truth = camel_system_flag_get (fms->info->flags, argv[0]->value.string);
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = truth;
-
- return r;
-}
-
-static ESExpResult *
-user_tag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
- const char *tag;
-
- tag = camel_tag_get (&fms->info->user_tags, argv[0]->value.string);
-
- r = e_sexp_result_new(f, ESEXP_RES_STRING);
- r->value.string = g_strdup (tag ? tag : "");
-
- return r;
-}
-
-static ESExpResult *
-get_sent_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
-
- r = e_sexp_result_new(f, ESEXP_RES_INT);
- r->value.number = camel_mime_message_get_date(fms->message, NULL);
-
- return r;
-}
-
-static ESExpResult *
-get_received_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
-
- r = e_sexp_result_new(f, ESEXP_RES_INT);
- r->value.number = camel_mime_message_get_date_received(fms->message, NULL);
-
- return r;
-}
-
-static ESExpResult *
-get_current_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
-
- r = e_sexp_result_new(f, ESEXP_RES_INT);
- r->value.number = time (NULL);
-
- return r;
-}
-
-static ESExpResult *
-get_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
- const char *tag;
-
- tag = camel_tag_get (&fms->info->user_tags, "score");
-
- r = e_sexp_result_new(f, ESEXP_RES_INT);
- if (tag)
- r->value.number = atoi (tag);
- else
- r->value.number = 0;
-
- return r;
-}
-
-static ESExpResult *
-get_source (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
-
- r = e_sexp_result_new(f, ESEXP_RES_STRING);
- r->value.string = g_strdup (fms->source);
-
- return r;
-}
-
-gboolean camel_filter_search_match(CamelMimeMessage *message, CamelMessageInfo *info,
- const char *source, const char *expression, CamelException *ex)
-{
- FilterMessageSearch fms;
- ESExp *sexp;
- ESExpResult *result;
- gboolean retval;
- int i;
-
- fms.message = message;
- fms.info = info;
- fms.source = source;
- fms.ex = ex;
-
- sexp = e_sexp_new ();
-
- for (i = 0; i < sizeof (symbols) / sizeof (symbols[0]); i++) {
- if (symbols[i].type == 1)
- e_sexp_add_ifunction (sexp, 0, symbols[i].name, (ESExpIFunc *)symbols[i].func, &fms);
- else
- e_sexp_add_function (sexp, 0, symbols[i].name, symbols[i].func, &fms);
- }
-
- e_sexp_input_text (sexp, expression, strlen (expression));
- if (e_sexp_parse (sexp) == -1) {
- if (!camel_exception_is_set(ex))
- camel_exception_setv(ex, 1, _("Error executing filter search: %s: %s"), e_sexp_error(sexp), expression);
- goto error;
- }
- result = e_sexp_eval (sexp);
- if (result == NULL) {
- if (!camel_exception_is_set(ex))
- camel_exception_setv(ex, 1, _("Error executing filter search: %s: %s"), e_sexp_error(sexp), expression);
- goto error;
- }
-
- if (result->type == ESEXP_RES_BOOL)
- retval = result->value.bool;
- else
- retval = FALSE;
-
- e_sexp_result_free (sexp, result);
- e_sexp_unref(sexp);
-
- return retval;
-
-error:
- e_sexp_unref(sexp);
- return FALSE;
-}
diff --git a/camel/camel-filter-search.h b/camel/camel-filter-search.h
deleted file mode 100644
index 0dba92eb2d..0000000000
--- a/camel/camel-filter-search.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- * Michael Zucchi <NotZed@Ximian.com>
- *
- * Copyright 2000 Helix Code, Inc. (www.helixcode.com)
- * Copyright 2001 Ximian Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef CAMEL_FILTER_SEARCH_H
-#define CAMEL_FILTER_SEARCH_H
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#include <glib.h>
-#include <camel/camel-mime-message.h>
-#include <camel/camel-folder-summary.h>
-
-gboolean camel_filter_search_match(CamelMimeMessage *message, CamelMessageInfo *info,
- const char *source, const char *expression, CamelException *ex);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* ! CAMEL_FILTER_SEARCH_H */
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
deleted file mode 100644
index aec5627875..0000000000
--- a/camel/camel-folder-search.c
+++ /dev/null
@@ -1,853 +0,0 @@
-/*
- * Copyright (C) 2000,2001 Ximian 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 <ctype.h>
-#include <glib.h>
-#include <sys/types.h>
-#include <regex.h>
-
-#include "camel-folder-search.h"
-#include "string-utils.h"
-
-#include "camel-exception.h"
-#include "camel-medium.h"
-#include "camel-multipart.h"
-#include "camel-mime-message.h"
-#include "camel-stream-mem.h"
-#include "e-util/e-memory.h"
-#include "camel-search-private.h"
-
-#define d(x)
-#define r(x)
-
-struct _CamelFolderSearchPrivate {
- GHashTable *mempool_hash;
- CamelException *ex;
-};
-
-#define _PRIVATE(o) (((CamelFolderSearch *)(o))->priv)
-
-static ESExpResult *search_header_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search);
-static ESExpResult *search_header_matches(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search);
-static ESExpResult *search_header_starts_with(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search);
-static ESExpResult *search_header_ends_with(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search);
-static ESExpResult *search_header_exists(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_user_tag(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-static ESExpResult *search_system_flag(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-static ESExpResult *search_get_sent_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-static ESExpResult *search_get_received_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-static ESExpResult *search_get_current_date(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_finalize (CamelObject *obj);
-
-static CamelObjectClass *camel_folder_search_parent;
-
-static void
-camel_folder_search_class_init (CamelFolderSearchClass *klass)
-{
- camel_folder_search_parent = camel_type_get_global_classfuncs (camel_object_get_type ());
-
- klass->match_all = search_match_all;
- klass->body_contains = search_body_contains;
- klass->header_contains = search_header_contains;
- klass->header_matches = search_header_matches;
- klass->header_starts_with = search_header_starts_with;
- klass->header_ends_with = search_header_ends_with;
- klass->header_exists = search_header_exists;
- klass->user_tag = search_user_tag;
- klass->user_flag = search_user_flag;
- klass->system_flag = search_system_flag;
- klass->get_sent_date = search_get_sent_date;
- klass->get_received_date = search_get_received_date;
- klass->get_current_date = search_get_current_date;
-}
-
-static void
-camel_folder_search_init (CamelFolderSearch *obj)
-{
- struct _CamelFolderSearchPrivate *p;
-
- p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
-
- obj->sexp = e_sexp_new();
-
- /* use a hash of mempools to associate the returned uid lists with
- the backing mempool. yes pretty weird, but i didn't want to change
- the api just yet */
-
- p->mempool_hash = g_hash_table_new(0, 0);
-}
-
-static void
-free_mempool(void *key, void *value, void *data)
-{
- GPtrArray *uids = key;
- EMemPool *pool = value;
-
- g_warning("Search closed with outstanding result unfreed: %p", uids);
-
- g_ptr_array_free(uids, TRUE);
- e_mempool_destroy(pool);
-}
-
-static void
-camel_folder_search_finalize (CamelObject *obj)
-{
- CamelFolderSearch *search = (CamelFolderSearch *)obj;
- struct _CamelFolderSearchPrivate *p = _PRIVATE(obj);
-
- if (search->sexp)
- e_sexp_unref(search->sexp);
-
- g_free(search->last_search);
- g_hash_table_foreach(p->mempool_hash, free_mempool, obj);
- g_hash_table_destroy(p->mempool_hash);
- g_free(p);
-}
-
-CamelType
-camel_folder_search_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_object_get_type (), "CamelFolderSearch",
- sizeof (CamelFolderSearch),
- sizeof (CamelFolderSearchClass),
- (CamelObjectClassInitFunc) camel_folder_search_class_init,
- NULL,
- (CamelObjectInitFunc) camel_folder_search_init,
- (CamelObjectFinalizeFunc) camel_folder_search_finalize);
- }
-
- return type;
-}
-
-#ifdef offsetof
-#define CAMEL_STRUCT_OFFSET(type, field) ((gint) offsetof (type, field))
-#else
-#define CAMEL_STRUCT_OFFSET(type, field) ((gint) ((gchar*) &((type *) 0)->field))
-#endif
-
-struct {
- char *name;
- int offset;
- int flags; /* 0x02 = immediate, 0x01 = always enter */
-} builtins[] = {
- /* these have default implementations in e-sexp */
- { "and", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, and), 2 },
- { "or", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, or), 2 },
- { "not", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, not), 2 },
- { "<", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, lt), 2 },
- { ">", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, gt), 2 },
- { "=", CAMEL_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", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, match_all), 3 },
- { "body-contains", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, body_contains), 1 },
- { "header-contains", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, header_contains), 1 },
- { "header-matches", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, header_matches), 1 },
- { "header-starts-with", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, header_starts_with), 1 },
- { "header-ends-with", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, header_ends_with), 1 },
- { "header-exists", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, header_exists), 1 },
- { "user-tag", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, user_tag), 1 },
- { "user-flag", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, user_flag), 1 },
- { "system-flag", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, system_flag), 1 },
- { "get-sent-date", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, get_sent_date), 1 },
- { "get-received-date", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, get_received_date), 1 },
- { "get-current-date", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, get_current_date), 1 },
-};
-
-void
-camel_folder_search_construct (CamelFolderSearch *search)
-{
- int i;
- CamelFolderSearchClass *klass = (CamelFolderSearchClass *)CAMEL_OBJECT_GET_CLASS(search);
-
- 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, camel_type_to_name(CAMEL_OBJECT_GET_CLASS(search)->s.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 ( camel_object_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 an array of
- * all matches as a GPtrArray 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 summary items instead
- * (since they are much more useful to any client).
- *
- * Return value: A GPtrArray of strings of all matching messages.
- * This must only be freed by camel_folder_search_free_result.
- **/
-GPtrArray *
-camel_folder_search_execute_expression(CamelFolderSearch *search, const char *expr, CamelException *ex)
-{
- ESExpResult *r;
- GPtrArray *matches;
- int i;
- GHashTable *results;
- EMemPool *pool;
- struct _CamelFolderSearchPrivate *p = _PRIVATE(search);
-
- p->ex = ex;
-
- /* 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));
- if (e_sexp_parse(search->sexp) == -1) {
- camel_exception_setv(ex, 1, _("Cannot parse search expression: %s:\n%s"), e_sexp_error(search->sexp), expr);
- return NULL;
- }
-
- g_free(search->last_search);
- search->last_search = g_strdup(expr);
- }
- r = e_sexp_eval(search->sexp);
- if (r == NULL) {
- if (!camel_exception_is_set(ex))
- camel_exception_setv(ex, 1, _("Error executing search expression: %s:\n%s"), e_sexp_error(search->sexp), expr);
- return NULL;
- }
-
- matches = g_ptr_array_new();
-
- /* now create a folder summary to return?? */
- if (r
- && r->type == ESEXP_RES_ARRAY_PTR) {
- d(printf("got result ...\n"));
- /* we use a mempool to store the strings, packed in tight as possible, and freed together */
- /* because the strings are often short (like <8 bytes long), we would be wasting appx 50%
- of memory just storing the size tag that malloc assigns us and alignment padding, so this
- gets around that (and is faster to allocate and free as a bonus) */
- pool = e_mempool_new(512, 256, E_MEMPOOL_ALIGN_BYTE);
- if (search->summary) {
- /* reorder result in summary order */
- results = g_hash_table_new(g_str_hash, g_str_equal);
- for (i=0;i<r->value.ptrarray->len;i++) {
- d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i)));
- g_hash_table_insert(results, g_ptr_array_index(r->value.ptrarray, i), (void *)1);
- }
- for (i=0;i<search->summary->len;i++) {
- CamelMessageInfo *info = g_ptr_array_index(search->summary, i);
- char *uid = (char *)camel_message_info_uid(info);
- if (g_hash_table_lookup(results, uid)) {
- g_ptr_array_add(matches, e_mempool_strdup(pool, uid));
- }
- }
- g_hash_table_destroy(results);
- } else {
- for (i=0;i<r->value.ptrarray->len;i++) {
- d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i)));
- g_ptr_array_add(matches, e_mempool_strdup(pool, g_ptr_array_index(r->value.ptrarray, i)));
- }
- }
- e_sexp_result_free(search->sexp, r);
- /* instead of putting the mempool_hash in the structure, we keep the api clean by
- putting a reference to it in a hashtable. Lets us do some debugging and catch
- unfree'd results as well. */
- g_hash_table_insert(p->mempool_hash, matches, pool);
- } else {
- printf("no result!\n");
- }
-
- search->folder = NULL;
- search->summary = NULL;
- search->current = NULL;
- search->body_index = NULL;
-
- return matches;
-}
-
-/**
- * camel_folder_search_match_expression:
- * @search:
- * @expr:
- * @info:
- * @ex:
- *
- * Returns #TRUE if the expression matches the specific message info @info.
- * Note that the folder and index may need to be set for body searches to
- * operate as well.
- *
- * Return value:
- **/
-gboolean
-camel_folder_search_match_expression(CamelFolderSearch *search, const char *expr, const CamelMessageInfo *info, CamelException *ex)
-{
- GPtrArray *uids;
- int ret = FALSE;
-
- search->match1 = (CamelMessageInfo *)info;
-
- uids = camel_folder_search_execute_expression(search, expr, ex);
- if (uids) {
- if (uids->len == 1)
- ret = TRUE;
- camel_folder_search_free_result(search, uids);
- }
- search->match1 = NULL;
-
- return ret;
-}
-
-void camel_folder_search_free_result(CamelFolderSearch *search, GPtrArray *result)
-{
- int i;
- struct _CamelFolderSearchPrivate *p = _PRIVATE(search);
- EMemPool *pool;
-
- pool = g_hash_table_lookup(p->mempool_hash, result);
- if (pool) {
- e_mempool_destroy(pool);
- g_hash_table_remove(p->mempool_hash, result);
- } else {
- for (i=0;i<result->len;i++)
- g_free(g_ptr_array_index(result, i));
- }
- g_ptr_array_free(result, TRUE);
-}
-
-
-
-
-/* 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(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
- } else {
- r = e_sexp_result_new(f, 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(f, ESEXP_RES_ARRAY_PTR);
- r->value.ptrarray = g_ptr_array_new();
-
- /* we are only matching a single message? */
- if (search->match1) {
- search->current = search->match1;
-
- d(printf("matching against 1 message: %s\n", camel_message_info_subject(search->current)));
-
- 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, (char *)camel_message_info_uid(search->current));
- } else {
- g_warning("invalid syntax, matches require a single bool result");
- e_sexp_fatal_error(f, _("(match-all) requires a single bool result"));
- }
- e_sexp_result_free(f, r1);
- } else {
- g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(search->current));
- }
- search->current = NULL;
-
- return r;
- }
-
- 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");
- g_assert(0);
- 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, (char *)camel_message_info_uid(search->current));
- } else {
- g_warning("invalid syntax, matches require a single bool result");
- e_sexp_fatal_error(f, _("(match-all) requires a single bool result"));
- }
- e_sexp_result_free(f, r1);
- } else {
- g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(search->current));
- }
- }
- search->current = NULL;
-
- return r;
-}
-
-static ESExpResult *
-check_header(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search, camel_search_match_t how)
-{
- ESExpResult *r;
- int truth = FALSE;
-
- r(printf("executing check-header %d\n", how));
-
- /* are we inside a match-all? */
- if (search->current && argc>1
- && argv[0]->type == ESEXP_RES_STRING) {
- char *headername;
- const char *header = NULL;
- char strbuf[32];
- int i;
-
- /* only a subset of headers are supported .. */
- headername = argv[0]->value.string;
- if (!strcasecmp(headername, "subject")) {
- header = camel_message_info_subject(search->current);
- } 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 = camel_message_info_from(search->current);
- } else if (!strcasecmp(headername, "to")) {
- header = camel_message_info_to(search->current);
- } else if (!strcasecmp(headername, "cc")) {
- header = camel_message_info_cc(search->current);
- } else if (!strcasecmp(headername, "x-camel-mlist")) {
- header = camel_message_info_mlist(search->current);
- } else {
- e_sexp_resultv_free(f, argc, argv);
- e_sexp_fatal_error(f, _("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
- && camel_search_header_match(header, argv[i]->value.string, how)) {
- truth = TRUE;
- }
- }
- }
- }
- /* TODO: else, find all matches */
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = truth;
-
- return r;
-}
-
-static ESExpResult *
-search_header_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
-{
- return check_header(f, argc, argv, search, CAMEL_SEARCH_MATCH_CONTAINS);
-}
-
-static ESExpResult *
-search_header_matches(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
-{
- return check_header(f, argc, argv, search, CAMEL_SEARCH_MATCH_EXACT);
-}
-
-static ESExpResult *
-search_header_starts_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
-{
- return check_header(f, argc, argv, search, CAMEL_SEARCH_MATCH_STARTS);
-}
-
-static ESExpResult *
-search_header_ends_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
-{
- return check_header(f, argc, argv, search, CAMEL_SEARCH_MATCH_ENDS);
-}
-
-static ESExpResult *
-search_header_exists (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
-{
- ESExpResult *r;
-
- r(printf ("executing header-exists\n"));
-
- if (search->current) {
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- if (argc == 1 && argv[0]->type == ESEXP_RES_STRING)
- r->value.bool = camel_medium_get_header(CAMEL_MEDIUM(search->current), argv[0]->value.string) != NULL;
-
- } else {
- r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR);
- r->value.ptrarray = g_ptr_array_new();
- }
-
- 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 int
-match_message(CamelFolder *folder, const char *uid, regex_t *pattern, CamelException *ex)
-{
- CamelMimeMessage *msg;
- int truth = FALSE;
-
- msg = camel_folder_get_message(folder, uid, ex);
- if (!camel_exception_is_set(ex) && msg!=NULL) {
- truth = camel_search_message_body_contains((CamelDataWrapper *)msg, pattern);
- camel_object_unref((CamelObject *)msg);
- }
- return truth;
-}
-
-static ESExpResult *
-search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
-{
- ESExpResult *r;
- int i, j;
- regex_t pattern;
-
- if (search->current) {
- int truth = FALSE;
-
- 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, (char *)camel_message_info_uid(search->current),
- argv[i]->value.string);
- } else {
- e_sexp_resultv_free(f, argc, argv);
- e_sexp_fatal_error(f, _("Invalid type in body-contains, expecting string"));
- }
- }
- } else if (search->folder) {
- /* we do a 'slow' direct search */
- if (camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_ICASE, argc, argv, search->priv->ex) == 0) {
- truth = match_message(search->folder, camel_message_info_uid(search->current), &pattern, search->priv->ex);
- regfree(&pattern);
- }
- } else {
- g_warning("Cannot perform indexed body query with no index or folder set");
- }
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = truth;
- } else {
- r = e_sexp_result_new(f, 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 {
- e_sexp_result_free(f, r);
- e_sexp_resultv_free(f, argc, argv);
- e_sexp_fatal_error(f, _("Invalid type in body-contains, expecting string"));
- }
- }
- 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 if (search->folder) {
- /* do a slow search */
- r->value.ptrarray = g_ptr_array_new();
- if (camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_ICASE, argc, argv, search->priv->ex) == 0) {
- if (search->summary) {
- for (i=0;i<search->summary->len;i++) {
- CamelMessageInfo *info = g_ptr_array_index(search->summary, i);
-
- if (match_message(search->folder, camel_message_info_uid(info), &pattern, search->priv->ex))
- g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(info));
- }
- } /* else? we could always get the summary from the folder, but then
- we need to free it later somehow */
- regfree(&pattern);
- }
- } else {
- g_warning("Cannot perform indexed body query with no index or folder set");
- 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(f, ESEXP_RES_BOOL);
- r->value.bool = truth;
- } else {
- r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR);
- r->value.ptrarray = g_ptr_array_new();
- }
-
- return r;
-}
-
-static ESExpResult *
-search_system_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
-{
- ESExpResult *r;
-
- r(printf ("executing system-flag\n"));
-
- if (search->current) {
- gboolean truth = FALSE;
-
- if (argc == 1)
- truth = camel_system_flag_get (search->current->flags, argv[0]->value.string);
-
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = truth;
- } else {
- r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR);
- r->value.ptrarray = g_ptr_array_new ();
- }
-
- return r;
-}
-
-static ESExpResult *search_user_tag(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
-{
- ESExpResult *r;
-
- r(printf("executing user-tag\n"));
-
- /* are we inside a match-all? */
- if (search->current) {
- const char *value = NULL;
- if (argc == 1) {
- value = camel_tag_get(&search->current->user_tags, argv[0]->value.string);
- }
- r = e_sexp_result_new(f, ESEXP_RES_STRING);
- r->value.string = g_strdup(value?value:"");
- } else {
- r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR);
- r->value.ptrarray = g_ptr_array_new();
- }
-
- return r;
-}
-
-static ESExpResult *
-search_get_sent_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s)
-{
- ESExpResult *r;
-
- r(printf("executing get-sent-date\n"));
-
- /* are we inside a match-all? */
- if (s->current) {
- r = e_sexp_result_new(f, ESEXP_RES_INT);
-
- r->value.number = s->current->date_sent;
- } else {
- r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR);
- r->value.ptrarray = g_ptr_array_new ();
- }
-
- return r;
-}
-
-static ESExpResult *
-search_get_received_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s)
-{
- ESExpResult *r;
-
- r(printf("executing get-received-date\n"));
-
- /* are we inside a match-all? */
- if (s->current) {
- r = e_sexp_result_new(f, ESEXP_RES_INT);
-
- r->value.number = s->current->date_received;
- } else {
- r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR);
- r->value.ptrarray = g_ptr_array_new ();
- }
-
- return r;
-}
-
-static ESExpResult *
-search_get_current_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s)
-{
- ESExpResult *r;
-
- r(printf("executing get-current-date\n"));
-
- r = e_sexp_result_new(f, ESEXP_RES_INT);
- r->value.number = time (NULL);
- return r;
-}
diff --git a/camel/camel-folder-search.h b/camel/camel-folder-search.h
deleted file mode 100644
index e085ddf188..0000000000
--- a/camel/camel-folder-search.h
+++ /dev/null
@@ -1,122 +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 <gal/util/e-util.h>
-#include <libibex/ibex.h>
-#include <camel/camel-folder.h>
-
-#define CAMEL_FOLDER_SEARCH_TYPE (camel_folder_search_get_type ())
-#define CAMEL_FOLDER_SEARCH(obj) CAMEL_CHECK_CAST (obj, camel_folder_search_get_type (), CamelFolderSearch)
-#define CAMEL_FOLDER_SEARCH_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_folder_search_get_type (), CamelFolderSearchClass)
-#define CAMEL_IS_FOLDER_SEARCH(obj) CAMEL_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 */
- CamelMessageInfo *match1; /* message info, when searching a single message only */
- CamelMimeMessage *current_message; /* cache of current message, if required */
- 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);
-
- /* (header-matches "headername" "string") */
- ESExpResult * (*header_matches)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-
- /* (header-starts-with "headername" "string") */
- ESExpResult * (*header_starts_with)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-
- /* (header-ends-with "headername" "string") */
- ESExpResult * (*header_ends_with)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-
- /* (header-exists "headername") */
- ESExpResult * (*header_exists)(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);
-
- /* (user-tag "flagname") Returns the value of a user tag. Can only be used in match-all */
- ESExpResult * (*user_tag)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-
- /* (system-flag "flagname") Returns the value of a system flag. Can only be used in match-all */
- ESExpResult * (*system_flag)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-
- /* (get-sent-date) Retrieve the date that the message was sent on as a time_t */
- ESExpResult * (*get_sent_date)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-
- /* (get-received-date) Retrieve the date that the message was received on as a time_t */
- ESExpResult * (*get_received_date)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-
- /* (get-current-date) Retrieve 'now' as a time_t */
- ESExpResult * (*get_current_date)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
-
- /* (mlist-matches "mlist" ...) True if one of the mailing list matches */
- ESExpResult * (*mlist_matches)(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);
-GPtrArray *camel_folder_search_execute_expression(CamelFolderSearch *search, const char *expr, CamelException *ex);
-gboolean camel_folder_search_match_expression(CamelFolderSearch *search, const char *expr,
- const CamelMessageInfo *info, CamelException *ex);
-void camel_folder_search_free_result(CamelFolderSearch *search, GPtrArray *);
-
-#endif /* ! _CAMEL_FOLDER_SEARCH_H */
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
deleted file mode 100644
index 4e9e9e9d1b..0000000000
--- a/camel/camel-folder-summary.c
+++ /dev/null
@@ -1,2815 +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-multipart.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 <camel/camel-stream-mem.h>
-
-#include "hash-table-utils.h"
-#include "e-util/md5-utils.h"
-#include "e-util/e-memory.h"
-
-#include "camel-private.h"
-
-#ifdef ENABLE_THREADS
-#include <pthread.h>
-
-static pthread_mutex_t info_lock = PTHREAD_MUTEX_INITIALIZER;
-
-/* this lock is ONLY for the standalone messageinfo stuff */
-#define GLOBAL_INFO_LOCK(i) pthread_mutex_lock(&info_lock)
-#define GLOBAL_INFO_UNLOCK(i) pthread_mutex_unlock(&info_lock)
-#else
-#define GLOBAL_INFO_LOCK(i)
-#define GLOBAL_INFO_UNLOCK(i)
-#endif
-
-/* 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 (12)
-
-#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_new_from_message(CamelFolderSummary *s, CamelMimeMessage *msg);
-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_new_from_message(CamelFolderSummary *s, CamelMimePart *mp);
-static CamelMessageContentInfo * content_info_load(CamelFolderSummary *, FILE *);
-static int content_info_save(CamelFolderSummary *, FILE *, CamelMessageContentInfo *);
-static void content_info_free(CamelFolderSummary *, CamelMessageContentInfo *);
-
-static char *next_uid_string(CamelFolderSummary *s);
-
-static CamelMessageContentInfo * summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, CamelMimeParser *mp);
-static CamelMessageContentInfo * summary_build_content_info_message(CamelFolderSummary *s, CamelMessageInfo *msginfo, CamelMimePart *object);
-
-static void camel_folder_summary_class_init (CamelFolderSummaryClass *klass);
-static void camel_folder_summary_init (CamelFolderSummary *obj);
-static void camel_folder_summary_finalize (CamelObject *obj);
-
-static CamelObjectClass *camel_folder_summary_parent;
-
-static void
-camel_folder_summary_class_init (CamelFolderSummaryClass *klass)
-{
- camel_folder_summary_parent = camel_type_get_global_classfuncs (camel_object_get_type ());
-
- 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_new_from_message = message_info_new_from_message;
- 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_new_from_message = content_info_new_from_message;
- klass->content_info_load = content_info_load;
- klass->content_info_save = content_info_save;
- klass->content_info_free = content_info_free;
-
- klass->next_uid_string = next_uid_string;
-}
-
-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->message_info_chunks = NULL;
- s->content_info_chunks = NULL;
-
-#ifdef DOESTRV
- s->message_info_strings = CAMEL_MESSAGE_INFO_LAST;
-#endif
-
- 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);
-
-#ifdef ENABLE_THREADS
- p->summary_lock = g_mutex_new();
- p->io_lock = g_mutex_new();
- p->filter_lock = g_mutex_new();
- p->alloc_lock = g_mutex_new();
- p->ref_lock = g_mutex_new();
-#endif
-}
-
-static void free_o_name(void *key, void *value, void *data)
-{
- camel_object_unref((CamelObject *)value);
- g_free(key);
-}
-
-static void
-camel_folder_summary_finalize (CamelObject *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 (s->message_info_chunks)
- e_memchunk_destroy(s->message_info_chunks);
- if (s->content_info_chunks)
- e_memchunk_destroy(s->content_info_chunks);
-
- if (p->filter_index)
- camel_object_unref ((CamelObject *)p->filter_index);
- if (p->filter_64)
- camel_object_unref ((CamelObject *)p->filter_64);
- if (p->filter_qp)
- camel_object_unref ((CamelObject *)p->filter_qp);
- if (p->filter_save)
- camel_object_unref ((CamelObject *)p->filter_save);
-
-#ifdef ENABLE_THREADS
- g_mutex_free(p->summary_lock);
- g_mutex_free(p->io_lock);
- g_mutex_free(p->filter_lock);
- g_mutex_free(p->alloc_lock);
- g_mutex_free(p->ref_lock);
-#endif
-
- g_free(p);
-}
-
-CamelType
-camel_folder_summary_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_object_get_type (), "CamelFolderSummary",
- sizeof (CamelFolderSummary),
- sizeof (CamelFolderSummaryClass),
- (CamelObjectClassInitFunc) camel_folder_summary_class_init,
- NULL,
- (CamelObjectInitFunc) camel_folder_summary_init,
- (CamelObjectFinalizeFunc) camel_folder_summary_finalize);
- }
-
- return type;
-}
-
-/**
- * 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 ( camel_object_new (camel_folder_summary_get_type ())); return new;
-}
-
-
-/**
- * camel_folder_summary_set_filename:
- * @s:
- * @name:
- *
- * Set the filename where the summary will be loaded to/saved from.
- **/
-void camel_folder_summary_set_filename(CamelFolderSummary *s, const char *name)
-{
- CAMEL_SUMMARY_LOCK(s, summary_lock);
-
- g_free(s->summary_path);
- s->summary_path = g_strdup(name);
-
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-}
-
-/**
- * camel_folder_summary_set_index:
- * @s:
- * @index:
- *
- * Set the index used to index body content. If the index is NULL, or
- * not set (the default), no indexing of body content will take place.
- *
- * Unlike earlier behaviour, build_content need not be set to perform indexing.
- **/
-void camel_folder_summary_set_index(CamelFolderSummary *s, ibex *index)
-{
- struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
-
- p->index = index;
-}
-
-/**
- * camel_folder_summary_set_build_content:
- * @s:
- * @state:
- *
- * Set a flag to tell the summary to build the content info summary
- * (CamelMessageInfo.content). The default is not to build content info
- * summaries.
- **/
-void camel_folder_summary_set_build_content(CamelFolderSummary *s, gboolean state)
-{
- s->build_content = state;
-}
-
-/**
- * camel_folder_summary_count:
- * @s:
- *
- * Get the number of summary items stored in this summary.
- *
- * Return value: The number of items int he summary.
- **/
-int
-camel_folder_summary_count(CamelFolderSummary *s)
-{
- return s->messages->len;
-}
-
-/**
- * camel_folder_summary_index:
- * @s:
- * @i:
- *
- * Retrieve a summary item by index number.
- *
- * A referenced to the summary item is returned, which may be
- * ref'd or free'd as appropriate.
- *
- * Return value: The summary item, or NULL if the index @i is out
- * of range.
- * It must be freed using camel_folder_summary_info_free().
- **/
-CamelMessageInfo *
-camel_folder_summary_index(CamelFolderSummary *s, int i)
-{
- CamelMessageInfo *info = NULL;
-
- CAMEL_SUMMARY_LOCK(s, ref_lock);
- CAMEL_SUMMARY_LOCK(s, summary_lock);
-
- if (i<s->messages->len)
- info = g_ptr_array_index(s->messages, i);
-
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-
- if (info)
- info->refcount++;
-
- CAMEL_SUMMARY_UNLOCK(s, ref_lock);
-
- return info;
-}
-
-/**
- * camel_folder_summary_index:
- * @s:
- * @i:
- *
- * Obtain a copy of the summary array. This is done atomically,
- * so cannot contain empty entries.
- *
- * It must be freed using camel_folder_summary_array_free().
- **/
-GPtrArray *
-camel_folder_summary_array(CamelFolderSummary *s)
-{
- CamelMessageInfo *info;
- GPtrArray *res = g_ptr_array_new();
- int i;
-
- CAMEL_SUMMARY_LOCK(s, ref_lock);
- CAMEL_SUMMARY_LOCK(s, summary_lock);
-
- g_ptr_array_set_size(res, s->messages->len);
- for (i=0;i<s->messages->len;i++) {
- info = res->pdata[i] = g_ptr_array_index(s->messages, i);
- info->refcount++;
- }
-
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
- CAMEL_SUMMARY_UNLOCK(s, ref_lock);
-
- return res;
-}
-
-/**
- * camel_folder_summary_array_free:
- * @s:
- * @array:
- *
- * Free the folder summary array.
- **/
-void
-camel_folder_summary_array_free(CamelFolderSummary *s, GPtrArray *array)
-{
- int i;
-
- for (i=0;i<array->len;i++)
- camel_folder_summary_info_free(s, array->pdata[i]);
-
- g_ptr_array_free(array, TRUE);
-}
-
-/**
- * camel_folder_summary_uid:
- * @s:
- * @uid:
- *
- * Retrieve a summary item by uid.
- *
- * A referenced to the summary item is returned, which may be
- * ref'd or free'd as appropriate.
- *
- * Return value: The summary item, or NULL if the uid @uid
- * is not available.
- * It must be freed using camel_folder_summary_info_free().
- **/
-CamelMessageInfo *
-camel_folder_summary_uid(CamelFolderSummary *s, const char *uid)
-{
- CamelMessageInfo *info;
-
- CAMEL_SUMMARY_LOCK(s, ref_lock);
- CAMEL_SUMMARY_LOCK(s, summary_lock);
-
- info = g_hash_table_lookup(s->messages_uid, uid);
-
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-
- if (info)
- info->refcount++;
-
- CAMEL_SUMMARY_UNLOCK(s, ref_lock);
-
- return info;
-}
-
-/**
- * camel_folder_summary_next_uid:
- * @s:
- *
- * Generate a new unique uid value as an integer. This
- * may be used to create a unique sequence of numbers.
- *
- * Return value: The next unique uid value.
- **/
-guint32 camel_folder_summary_next_uid(CamelFolderSummary *s)
-{
- guint32 uid;
-
-
- CAMEL_SUMMARY_LOCK(s, summary_lock);
-
- uid = s->nextuid++;
-
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-
- /* FIXME: sync this to disk */
-/* summary_header_save(s);*/
- return uid;
-}
-
-/**
- * camel_folder_summary_set_uid:
- * @s:
- * @uid: The next minimum uid to assign. To avoid clashing
- * uid's, set this to the uid of a given messages + 1.
- *
- * Set the next minimum uid available. This can be used to
- * ensure new uid's do not clash with existing uid's.
- **/
-void camel_folder_summary_set_uid(CamelFolderSummary *s, guint32 uid)
-{
- /* TODO: sync to disk? */
- CAMEL_SUMMARY_LOCK(s, summary_lock);
-
- s->nextuid = MAX(s->nextuid, uid);
-
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-}
-
-/**
- * camel_folder_summary_next_uid_string:
- * @s:
- *
- * Retrieve the next uid, but as a formatted string.
- *
- * Return value: The next uid as an unsigned integer string.
- * This string must be freed by the caller.
- **/
-char *
-camel_folder_summary_next_uid_string(CamelFolderSummary *s)
-{
- return ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->next_uid_string(s);
-}
-
-/* loads the content descriptions, recursively */
-static CamelMessageContentInfo *
-perform_content_info_load(CamelFolderSummary *s, FILE *in)
-{
- int i;
- guint32 count;
- CamelMessageContentInfo *ci, *part;
-
- ci = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->content_info_load(s, in);
- if (ci == NULL)
- return NULL;
-
- if (camel_folder_summary_decode_uint32(in, &count) == -1 || count > 500) {
- camel_folder_summary_content_info_free(s, ci);
- return NULL;
- }
-
- 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?");
- camel_folder_summary_content_info_free(s, ci);
- return NULL;
- }
- }
- return ci;
-}
-
-int
-camel_folder_summary_load(CamelFolderSummary *s)
-{
- FILE *in;
- int i;
- CamelMessageInfo *mi;
-
- g_assert(s->summary_path);
-
- in = fopen(s->summary_path, "r");
- if (in == NULL)
- return -1;
-
- CAMEL_SUMMARY_LOCK(s, io_lock);
- if ( ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->summary_header_load(s, in) == -1)
- goto error;
-
- /* now read in each message ... */
- for (i=0;i<s->saved_count;i++) {
- mi = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_load(s, in);
-
- if (mi == NULL)
- goto error;
-
- if (s->build_content) {
- mi->content = perform_content_info_load(s, in);
- if (mi->content == NULL) {
- camel_folder_summary_info_free(s, mi);
- goto error;
- }
- }
-
- camel_folder_summary_add(s, mi);
- }
-
- CAMEL_SUMMARY_UNLOCK(s, io_lock);
-
- if (fclose(in) == -1)
- return -1;
-
- s->flags &= ~CAMEL_SUMMARY_DIRTY;
-
- return 0;
-
-error:
- g_warning("Cannot load summary file: %s", strerror(ferror(in)));
- CAMEL_SUMMARY_UNLOCK(s, io_lock);
- fclose(in);
- s->flags |= ~CAMEL_SUMMARY_DIRTY;
-
- return -1;
-}
-
-/* saves the content descriptions, recursively */
-static int
-perform_content_info_save(CamelFolderSummary *s, FILE *out, CamelMessageContentInfo *ci)
-{
- CamelMessageContentInfo *part;
-
- ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->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;
-}
-
-/**
- * camel_folder_summary_save:
- * @s:
- *
- * Writes the summary to disk. The summary is only written if changes
- * have occured.
- *
- * Return value: Returns -1 on error.
- **/
-int
-camel_folder_summary_save(CamelFolderSummary *s)
-{
- FILE *out;
- int fd;
- int i;
- guint32 count;
- CamelMessageInfo *mi;
-
- g_assert(s->summary_path);
-
- if ((s->flags & CAMEL_SUMMARY_DIRTY) == 0)
- return 0;
-
- 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"));
-
- CAMEL_SUMMARY_LOCK(s, io_lock);
-
- if ( ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->summary_header_save(s, out) == -1) {
- fclose(out);
- CAMEL_SUMMARY_UNLOCK(s, io_lock);
- return -1;
- }
-
- /* now write out each message ... */
- /* FIXME: check returns */
-
- count = s->messages->len;
- for (i=0;i<count;i++) {
- mi = s->messages->pdata[i];
- ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_save(s, out, mi);
-
- if (s->build_content) {
- perform_content_info_save(s, out, mi->content);
- }
- }
-
- CAMEL_SUMMARY_UNLOCK(s, io_lock);
-
- if (fclose(out) == -1)
- return -1;
-
- s->flags &= ~CAMEL_SUMMARY_DIRTY;
- return 0;
-}
-
-static void
-summary_assign_uid(CamelFolderSummary *s, CamelMessageInfo *info)
-{
- const char *uid;
-
- uid = camel_message_info_uid(info);
- if (uid == NULL || uid[0] == 0) {
- camel_message_info_set_uid(info, camel_folder_summary_next_uid_string(s));
- uid = camel_message_info_uid(info);
- }
-
- CAMEL_SUMMARY_LOCK(s, summary_lock);
-
- while (g_hash_table_lookup(s->messages_uid, uid)) {
- g_warning("Trying to insert message with clashing uid (%s). new uid re-assigned", camel_message_info_uid(info));
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
- camel_message_info_set_uid(info, camel_folder_summary_next_uid_string(s));
- uid = camel_message_info_uid(info);
- info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
- CAMEL_SUMMARY_LOCK(s, summary_lock);
- }
-
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-}
-
-/**
- * camel_folder_summary_add:
- * @s:
- * @info:
- *
- * Adds a new @info record to the summary. If @info->uid is NULL, then a new
- * uid is automatically re-assigned by calling :next_uid_string().
- *
- * The @info record should have been generated by calling one of the
- * info_new_*() functions, as it will be free'd based on the summary
- * class. And MUST NOT be allocated directly using malloc.
- **/
-void camel_folder_summary_add(CamelFolderSummary *s, CamelMessageInfo *info)
-{
- if (info == NULL)
- return;
-
- summary_assign_uid(s, info);
-
- CAMEL_SUMMARY_LOCK(s, summary_lock);
-
-#ifdef DOESTRV
- /* this is vitally important, and also if this is ever modified, then
- the hash table needs to be resynced */
- info->strings = e_strv_pack(info->strings);
-#endif
-
- g_ptr_array_add(s->messages, info);
- g_hash_table_insert(s->messages_uid, (char *)camel_message_info_uid(info), info);
- s->flags |= CAMEL_SUMMARY_DIRTY;
-
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-}
-
-/**
- * camel_folder_summary_add_from_header:
- * @s:
- * @h:
- *
- * Build a new info record based on a set of headers, and add it to the
- * summary.
- *
- * Note that this function should not be used if build_content_info has
- * been specified for this summary.
- *
- * Return value: The newly added record.
- **/
-CamelMessageInfo *camel_folder_summary_add_from_header(CamelFolderSummary *s, struct _header_raw *h)
-{
- CamelMessageInfo *info = camel_folder_summary_info_new_from_header(s, h);
-
- camel_folder_summary_add(s, info);
-
- return info;
-}
-
-/**
- * camel_folder_summary_add_from_parser:
- * @s:
- * @mp:
- *
- * Build a new info record based on the current position of a CamelMimeParser.
- *
- * The parser should be positioned before the start of the message to summarise.
- * This function may be used if build_contnet_info or an index has been
- * specified for the summary.
- *
- * Return value: The newly added record.
- **/
-CamelMessageInfo *camel_folder_summary_add_from_parser(CamelFolderSummary *s, CamelMimeParser *mp)
-{
- CamelMessageInfo *info = camel_folder_summary_info_new_from_parser(s, mp);
-
- camel_folder_summary_add(s, info);
-
- return info;
-}
-
-/**
- * camel_folder_summary_add_from_message:
- * @s:
- * @msg:
- *
- * Add a summary item from an existing message.
- *
- * Return value:
- **/
-CamelMessageInfo *camel_folder_summary_add_from_message(CamelFolderSummary *s, CamelMimeMessage *msg)
-{
- CamelMessageInfo *info = camel_folder_summary_info_new_from_message(s, msg);
-
- camel_folder_summary_add(s, info);
-
- return info;
-}
-
-/**
- * camel_folder_summary_info_new_from_header:
- * @s:
- * @h:
- *
- * Create a new info record from a header.
- *
- * Return value: Guess? This info record MUST be freed using
- * camel_folder_summary_info_free(), camel_message_info_free() will not work.
- **/
-CamelMessageInfo *camel_folder_summary_info_new_from_header(CamelFolderSummary *s, struct _header_raw *h)
-{
- return ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s))) -> message_info_new(s, h);
-}
-
-/**
- * camel_folder_summary_info_new_from_parser:
- * @s:
- * @mp:
- *
- * Create a new info record from a parser. If the parser cannot
- * determine a uid, then a new one is automatically assigned.
- *
- * If indexing is enabled, then the content will be indexed based
- * on this new uid. In this case, the message info MUST be
- * added using :add().
- *
- * Once complete, the parser will be positioned at the end of
- * the message.
- *
- * Return value: Guess? This info record MUST be freed using
- * camel_folder_summary_info_free(), camel_message_info_free() will not work.
- **/
-CamelMessageInfo *camel_folder_summary_info_new_from_parser(CamelFolderSummary *s, CamelMimeParser *mp)
-{
- CamelMessageInfo *info = NULL;
- char *buffer;
- int len;
- struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
- off_t start;
-
- /* should this check the parser is in the right state, or assume it is?? */
-
- start = camel_mime_parser_tell(mp);
- if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_EOF) {
- info = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_new_from_parser(s, mp);
-
- camel_mime_parser_unstep(mp);
-
- /* assign a unique uid, this is slightly 'wrong' as we do not really
- * know if we are going to store this in the summary, but no matter */
- summary_assign_uid(s, info);
-
- CAMEL_SUMMARY_LOCK(s, filter_lock);
-
- 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, (char *)camel_message_info_uid(info));
- ibex_unindex(p->index, (char *)camel_message_info_uid(info));
- }
-
- /* always scan the content info, even if we dont save it */
- info->content = summary_build_content_info(s, info, mp);
-
- CAMEL_SUMMARY_UNLOCK(s, filter_lock);
-
- info->size = camel_mime_parser_tell(mp) - start;
- }
- return info;
-}
-
-/**
- * camel_folder_summary_info_new_from_message:
- * @:
- * @:
- *
- * Create a summary item from a message.
- *
- * Return value:
- **/
-CamelMessageInfo *camel_folder_summary_info_new_from_message(CamelFolderSummary *s, CamelMimeMessage *msg)
-{
- CamelMessageInfo *info;
- struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
-
- info = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_new_from_message(s, msg);
-
- /* assign a unique uid, this is slightly 'wrong' as we do not really
- * know if we are going to store this in the summary, but no matter */
- summary_assign_uid(s, info);
-
- if (p->index)
- ibex_unindex(p->index, (char *)camel_message_info_uid(info));
-
- info->content = summary_build_content_info_message(s, info, (CamelMimePart *)msg);
- /* FIXME: calculate the size as part of build_content_info_message */
- /* info->size = ... */
-
- return info;
-}
-
-/**
- * camel_folder_summary_content_info_free:
- * @s:
- * @ci:
- *
- * Free the content info @ci, and all associated memory.
- **/
-void
-camel_folder_summary_content_info_free(CamelFolderSummary *s, CamelMessageContentInfo *ci)
-{
- CamelMessageContentInfo *pw, *pn;
-
- pw = ci->childs;
- ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->content_info_free(s, ci);
- while (pw) {
- pn = pw->next;
- camel_folder_summary_content_info_free(s, pw);
- pw = pn;
- }
-}
-
-/**
- * camel_folder_summary_info_free:
- * @s:
- * @mi:
- *
- * Unref and potentially free the message info @mi, and all associated memory.
- **/
-void camel_folder_summary_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
-{
- CamelMessageContentInfo *ci;
-
- g_assert(mi);
- g_assert(s);
-
- CAMEL_SUMMARY_LOCK(s, ref_lock);
-
- g_assert(mi->refcount >= 1);
-
- mi->refcount--;
- if (mi->refcount > 0) {
- CAMEL_SUMMARY_UNLOCK(s, ref_lock);
- return;
- }
-
- CAMEL_SUMMARY_UNLOCK(s, ref_lock);
-
- ci = mi->content;
-
- ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_free(s, mi);
- if (s->build_content && ci) {
- camel_folder_summary_content_info_free(s, ci);
- }
-}
-
-/**
- * camel_folder_summary_info_ref:
- * @s:
- * @mi:
- *
- * Add an extra reference to @mi.
- **/
-void camel_folder_summary_info_ref(CamelFolderSummary *s, CamelMessageInfo *mi)
-{
- g_assert(mi);
- g_assert(s);
-
- CAMEL_SUMMARY_LOCK(s, ref_lock);
- g_assert(mi->refcount >= 1);
- mi->refcount++;
- CAMEL_SUMMARY_UNLOCK(s, ref_lock);
-}
-
-/**
- * camel_folder_summary_touch:
- * @s:
- *
- * Mark the summary as changed, so that a save will save it.
- **/
-void
-camel_folder_summary_touch(CamelFolderSummary *s)
-{
- CAMEL_SUMMARY_LOCK(s, summary_lock);
- s->flags |= CAMEL_SUMMARY_DIRTY;
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-}
-
-/**
- * camel_folder_summary_clear:
- * @s:
- *
- * Empty the summary contents.
- **/
-void
-camel_folder_summary_clear(CamelFolderSummary *s)
-{
- int i;
-
- CAMEL_SUMMARY_LOCK(s, summary_lock);
- if (camel_folder_summary_count(s) == 0) {
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
- return;
- }
-
- for (i=0;i<s->messages->len;i++)
- camel_folder_summary_info_free(s, s->messages->pdata[i]);
-
- 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;
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-}
-
-/**
- * camel_folder_summary_remove:
- * @s:
- * @info:
- *
- * Remove a specific @info record from the summary.
- **/
-void camel_folder_summary_remove(CamelFolderSummary *s, CamelMessageInfo *info)
-{
- CAMEL_SUMMARY_LOCK(s, summary_lock);
- g_hash_table_remove(s->messages_uid, camel_message_info_uid(info));
- g_ptr_array_remove(s->messages, info);
- s->flags |= CAMEL_SUMMARY_DIRTY;
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-
- camel_folder_summary_info_free(s, info);
-}
-
-/**
- * camel_folder_summary_remove_uid:
- * @s:
- * @uid:
- *
- * Remove a specific info record from the summary, by @uid.
- **/
-void camel_folder_summary_remove_uid(CamelFolderSummary *s, const char *uid)
-{
- CamelMessageInfo *oldinfo;
- char *olduid;
-
- CAMEL_SUMMARY_LOCK(s, ref_lock);
- CAMEL_SUMMARY_LOCK(s, summary_lock);
- if (g_hash_table_lookup_extended(s->messages_uid, uid, (void *)&olduid, (void *)&oldinfo)) {
- /* make sure it doesn't vanish while we're removing it */
- oldinfo->refcount++;
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
- CAMEL_SUMMARY_UNLOCK(s, ref_lock);
- camel_folder_summary_remove(s, oldinfo);
- camel_folder_summary_info_free(s, oldinfo);
- } else {
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
- CAMEL_SUMMARY_UNLOCK(s, ref_lock);
- }
-}
-
-/**
- * camel_folder_summary_remove_index:
- * @s:
- * @index:
- *
- * Remove a specific info record from the summary, by index.
- **/
-void camel_folder_summary_remove_index(CamelFolderSummary *s, int index)
-{
- CAMEL_SUMMARY_LOCK(s, ref_lock);
- CAMEL_SUMMARY_LOCK(s, summary_lock);
- if (index < s->messages->len) {
- CamelMessageInfo *info = s->messages->pdata[index];
- /* make sure it doesn't vanish while we're not looking */
- info->refcount++;
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
- CAMEL_SUMMARY_UNLOCK(s, ref_lock);
- camel_folder_summary_remove(s, info);
- camel_folder_summary_info_free(s, info);
- } else {
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
- CAMEL_SUMMARY_UNLOCK(s, ref_lock);
- }
-}
-
-/**
- * camel_folder_summary_encode_uint32:
- * @out:
- * @value:
- *
- * Utility function to save an uint32 to a file.
- *
- * Return value: -1 on error.
- **/
-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);
-}
-
-/**
- * camel_folder_summary_decode_uint32:
- * @in:
- * @dest:
- *
- * Retrieve an encoded uint32 from a file.
- *
- * Return value: -1 on error. @*dest will contain the
- * decoded value.
- **/
-int
-camel_folder_summary_decode_uint32(FILE *in, guint32 *dest)
-{
- guint32 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 -1;
- }
- *dest = value | (v&0x7f);
-
- io(printf("Decoding int %u\n", *dest));
-
- return 0;
-}
-
-/**
- * camel_folder_summary_encode_fixed_int32:
- * @out:
- * @value:
- *
- * Encode a gint32, performing no compression, but converting
- * to network order.
- *
- * Return value: -1 on error.
- **/
-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;
-}
-
-/**
- * camel_folder_summary_decode_fixed_int32:
- * @in:
- * @dest:
- *
- * Retrieve a gint32.
- *
- * Return value: -1 on error.
- **/
-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;
- }
-}
-
-/**
- * camel_folder_summary_encode_time_t:
- * @out:
- * @value:
- *
- * Encode a time_t value to the file.
- *
- * Return value: -1 on error.
- **/
-int
-camel_folder_summary_encode_time_t(FILE *out, time_t value)
-{
- int i;
-
- for (i=sizeof(time_t)-1;i>=0;i--) {
- if (fputc((value >> (i*8)) & 0xff, out) == -1)
- return -1;
- }
- return 0;
-}
-
-/**
- * camel_folder_summary_decode_time_t:
- * @in:
- * @dest:
- *
- * Decode a time_t value.
- *
- * Return value: -1 on error.
- **/
-int
-camel_folder_summary_decode_time_t(FILE *in, time_t *dest)
-{
- time_t save = 0;
- unsigned int v;
- int i = sizeof(time_t) - 1;
-
- while ( i>=0 && (v = fgetc(in)) != EOF) {
- save |= v << (i*8);
- i--;
- }
- *dest = save;
- if (v == EOF)
- return -1;
- return 0;
-}
-
-/**
- * camel_folder_summary_encode_off_t:
- * @out:
- * @value:
- *
- * Encode an off_t type.
- *
- * Return value:
- **/
-int
-camel_folder_summary_encode_off_t(FILE *out, off_t value)
-{
- int i;
-
- for (i=sizeof(off_t)-1;i>=0;i--) {
- if (fputc((value >> (i*8)) & 0xff, out) == -1)
- return -1;
- }
- return 0;
-}
-
-/**
- * camel_folder_summary_decode_off_t:
- * @in:
- * @dest:
- *
- * Decode an off_t type.
- *
- * Return value:
- **/
-int
-camel_folder_summary_decode_off_t(FILE *in, off_t *dest)
-{
- off_t save = 0;
- unsigned int v;
- int i = sizeof(off_t) - 1;
-
- while ( i>=0 && (v = fgetc(in)) != EOF) {
- save |= v << (i*8);
- i--;
- }
- *dest = save;
- if (v == EOF)
- return -1;
- return 0;
-}
-
-/* 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
-
-/**
- * camel_folder_summary_encode_token:
- * @out:
- * @str:
- *
- * Encode a string value, but use tokenisation and compression
- * to reduce the size taken for common mailer words. This
- * can still be used to encode normal strings as well.
- *
- * Return value: -1 on error.
- **/
-int
-camel_folder_summary_encode_token(FILE *out, const 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 (*)(const void *, const 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;
-}
-
-/**
- * camel_folder_summary_decode_token:
- * @in:
- * @str:
- *
- * Decode a token value.
- *
- * Return value: -1 on error.
- **/
-int
-camel_folder_summary_decode_token(FILE *in, char **str)
-{
- char *ret;
- guint32 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;
-}
-
-/**
- * camel_folder_summary_encode_string:
- * @out:
- * @str:
- *
- * Encode a normal string and save it in the output file.
- *
- * Return value: -1 on error.
- **/
-int
-camel_folder_summary_encode_string(FILE *out, const 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;
-}
-
-
-/**
- * camel_folder_summary_decode_string:
- * @in:
- * @str:
- *
- * Decode a normal string from the input file.
- *
- * Return value: -1 on error.
- **/
-int
-camel_folder_summary_decode_string(FILE *in, char **str)
-{
- guint32 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 > 65536) {
- *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;
-}
-
-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)
-{
- gint32 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_time_t(in, &time) == -1
- || 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_time_t(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 *)(CAMEL_OBJECT_GET_CLASS(s)))->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 *)(CAMEL_OBJECT_GET_CLASS(s)))->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 CamelMessageInfo * message_info_new_from_message(CamelFolderSummary *s, CamelMimeMessage *msg)
-{
- CamelMessageInfo *mi;
-
- mi = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_new(s, ((CamelMimePart *)msg)->headers);
-
- return mi;
-}
-
-static CamelMessageContentInfo * content_info_new_from_message(CamelFolderSummary *s, CamelMimePart *mp)
-{
- CamelMessageContentInfo *ci;
-
- ci = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->content_info_new(s, mp->headers);
-
- return ci;
-}
-
-#ifndef NO_WARNINGS
-#warning "These should be made private again, easy to fix (used in filter-driver)"
-#endif
-char *
-camel_folder_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;
-}
-
-char *
-camel_folder_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;
- }
-}
-
-/**
- * camel_folder_summary_info_new:
- * @s:
- *
- * Allocate a new camel message info, suitable for adding
- * to this summary.
- *
- * Return value:
- **/
-CamelMessageInfo *
-camel_folder_summary_info_new(CamelFolderSummary *s)
-{
- CamelMessageInfo *mi;
-
- CAMEL_SUMMARY_LOCK(s, alloc_lock);
- if (s->message_info_chunks == NULL)
- s->message_info_chunks = e_memchunk_new(32, s->message_info_size);
- mi = e_memchunk_alloc(s->message_info_chunks);
- CAMEL_SUMMARY_UNLOCK(s, alloc_lock);
-
- memset(mi, 0, s->message_info_size);
-#ifdef DOESTRV
- mi->strings = e_strv_new(s->message_info_strings);
-#endif
- mi->refcount = 1;
- return mi;
-}
-
-/**
- * camel_folder_summary_content_info_new:
- * @s:
- *
- * Allocate a new camel message content info, suitable for adding
- * to this summary.
- *
- * Return value:
- **/
-CamelMessageContentInfo *
-camel_folder_summary_content_info_new(CamelFolderSummary *s)
-{
- CamelMessageContentInfo *ci;
-
- CAMEL_SUMMARY_LOCK(s, alloc_lock);
- if (s->content_info_chunks == NULL)
- s->content_info_chunks = e_memchunk_new(32, s->content_info_size);
- ci = e_memchunk_alloc(s->content_info_chunks);
- CAMEL_SUMMARY_UNLOCK(s, alloc_lock);
-
- memset(ci, 0, s->content_info_size);
- return ci;
-}
-
-static CamelMessageInfo *
-message_info_new(CamelFolderSummary *s, struct _header_raw *h)
-{
- CamelMessageInfo *mi;
- const char *received;
- guchar digest[16];
- struct _header_references *refs, *scan;
- char *msgid;
- int count;
-
- mi = camel_folder_summary_info_new(s);
-
-#ifdef DOESTRV
- msgid = camel_folder_summary_format_string(h, "subject");
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_SUBJECT, msgid);
- msgid = camel_folder_summary_format_address(h, "from");
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_FROM, msgid);
- msgid = camel_folder_summary_format_address(h, "to");
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_TO, msgid);
- msgid = camel_folder_summary_format_address(h, "cc");
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_CC, msgid);
- msgid = header_raw_check_mailing_list(&h);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_MLIST, msgid);
-#else
- mi->subject = camel_folder_summary_format_string(h, "subject");
- mi->from = camel_folder_summary_format_address(h, "from");
- mi->to = camel_folder_summary_format_address(h, "to");
- mi->cc = camel_folder_summary_format_address(h, "cc");
- mi->mlist = header_raw_check_mailing_list(&h);
-#endif
- mi->user_flags = NULL;
- mi->user_tags = NULL;
- mi->date_sent = header_decode_date(header_raw_find(&h, "date", NULL), NULL);
- received = header_raw_find(&h, "received", NULL);
- if (received)
- received = strrchr(received, ';');
- if (received)
- mi->date_received = header_decode_date(received + 1, NULL);
- else
- mi->date_received = 0;
-
- msgid = header_msgid_decode(header_raw_find(&h, "message-id", NULL));
- if (msgid) {
- md5_get_digest(msgid, strlen(msgid), digest);
- memcpy(mi->message_id.id.hash, digest, sizeof(mi->message_id.id.hash));
- g_free(msgid);
- }
- /* if we have a references, use that, otherwise, see if we have an in-reply-to
- header, with parsable content, otherwise *shrug* */
- if ((refs = header_references_decode(header_raw_find(&h, "references", NULL))) != NULL
- || (refs = header_references_decode(header_raw_find(&h, "in-reply-to", NULL))) != NULL) {
- count = header_references_list_size(&refs);
- mi->references = g_malloc(sizeof(*mi->references) + ((count-1) * sizeof(mi->references->references[0])));
- count = 0;
- scan = refs;
- while (scan) {
- /* FIXME: the id might be NULL because of a small bug in camel-mime-utils */
- if (scan->id) {
- md5_get_digest(scan->id, strlen(scan->id), digest);
- memcpy(mi->references->references[count].id.hash, digest, sizeof(mi->message_id.id.hash));
- count++;
- }
- scan = scan->next;
- }
- mi->references->size = count;
- header_references_list_clear(&refs);
- }
-
- return mi;
-}
-
-
-static CamelMessageInfo *
-message_info_load(CamelFolderSummary *s, FILE *in)
-{
- CamelMessageInfo *mi;
- guint count;
- int i;
-#ifdef DOESTRV
- char *tmp;
-#endif
-
- mi = camel_folder_summary_info_new(s);
-
- io(printf("Loading message info\n"));
-#ifdef DOESTRV
- camel_folder_summary_decode_string(in, &tmp);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_UID, tmp);
- camel_folder_summary_decode_uint32(in, &mi->flags);
- camel_folder_summary_decode_uint32(in, &mi->size);
- camel_folder_summary_decode_time_t(in, &mi->date_sent);
- camel_folder_summary_decode_time_t(in, &mi->date_received);
- camel_folder_summary_decode_string(in, &tmp);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_SUBJECT, tmp);
- camel_folder_summary_decode_string(in, &tmp);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_FROM, tmp);
- camel_folder_summary_decode_string(in, &tmp);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_TO, tmp);
- camel_folder_summary_decode_string(in, &tmp);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_CC, tmp);
- camel_folder_summary_decode_string(in, &tmp);
- e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_MLIST, tmp);
-#else
- camel_folder_summary_decode_string(in, &mi->uid);
- camel_folder_summary_decode_uint32(in, &mi->flags);
- camel_folder_summary_decode_uint32(in, &mi->size);
- camel_folder_summary_decode_time_t(in, &mi->date_sent);
- camel_folder_summary_decode_time_t(in, &mi->date_received);
- camel_folder_summary_decode_string(in, &mi->subject);
- camel_folder_summary_decode_string(in, &mi->from);
- camel_folder_summary_decode_string(in, &mi->to);
- camel_folder_summary_decode_string(in, &mi->cc);
- camel_folder_summary_decode_string(in, &mi->mlist);
-#endif
- mi->content = NULL;
-
- camel_folder_summary_decode_fixed_int32(in, &mi->message_id.id.part.hi);
- camel_folder_summary_decode_fixed_int32(in, &mi->message_id.id.part.lo);
-
- if (camel_folder_summary_decode_uint32(in, &count) == -1 || count > 500)
- goto error;
-
- if (count > 0) {
- mi->references = g_malloc(sizeof(*mi->references) + ((count-1) * sizeof(mi->references->references[0])));
- mi->references->size = count;
- for (i=0;i<count;i++) {
- camel_folder_summary_decode_fixed_int32(in, &mi->references->references[i].id.part.hi);
- camel_folder_summary_decode_fixed_int32(in, &mi->references->references[i].id.part.lo);
- }
- }
-
- if (camel_folder_summary_decode_uint32(in, &count) == -1 || count > 500)
- goto error;
-
- 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);
- }
-
- if (camel_folder_summary_decode_uint32(in, &count) == -1 || count > 500)
- goto error;
-
- for (i=0;i<count;i++) {
- char *name, *value;
- camel_folder_summary_decode_string(in, &name);
- camel_folder_summary_decode_string(in, &value);
- camel_tag_set(&mi->user_tags, name, value);
- g_free(name);
- g_free(value);
- }
-
- if (!ferror(in))
- return mi;
-
-error:
- camel_folder_summary_info_free(s, mi);
-
- return NULL;
-}
-
-static int
-message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
-{
- guint32 count;
- CamelFlag *flag;
- CamelTag *tag;
- int i;
-
- io(printf("Saving message info\n"));
-
- camel_folder_summary_encode_string(out, camel_message_info_uid(mi));
- camel_folder_summary_encode_uint32(out, mi->flags);
- camel_folder_summary_encode_uint32(out, mi->size);
- camel_folder_summary_encode_time_t(out, mi->date_sent);
- camel_folder_summary_encode_time_t(out, mi->date_received);
- camel_folder_summary_encode_string(out, camel_message_info_subject(mi));
- camel_folder_summary_encode_string(out, camel_message_info_from(mi));
- camel_folder_summary_encode_string(out, camel_message_info_to(mi));
- camel_folder_summary_encode_string(out, camel_message_info_cc(mi));
- camel_folder_summary_encode_string(out, camel_message_info_mlist(mi));
-
- camel_folder_summary_encode_fixed_int32(out, mi->message_id.id.part.hi);
- camel_folder_summary_encode_fixed_int32(out, mi->message_id.id.part.lo);
-
- if (mi->references) {
- camel_folder_summary_encode_uint32(out, mi->references->size);
- for (i=0;i<mi->references->size;i++) {
- camel_folder_summary_encode_fixed_int32(out, mi->references->references[i].id.part.hi);
- camel_folder_summary_encode_fixed_int32(out, mi->references->references[i].id.part.lo);
- }
- } else {
- camel_folder_summary_encode_uint32(out, 0);
- }
-
- 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;
- }
-
- count = camel_tag_list_size(&mi->user_tags);
- camel_folder_summary_encode_uint32(out, count);
- tag = mi->user_tags;
- while (tag) {
- camel_folder_summary_encode_string(out, tag->name);
- camel_folder_summary_encode_string(out, tag->value);
- tag = tag->next;
- }
-
- return ferror(out);
-}
-
-static void
-message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
-{
-#ifdef DOESTRV
- e_strv_destroy(mi->strings);
-#else
- g_free(mi->uid);
- g_free(mi->subject);
- g_free(mi->from);
- g_free(mi->to);
- g_free(mi->cc);
- g_free(mi->mlist);
-#endif
- g_free(mi->references);
- camel_flag_list_free(&mi->user_flags);
- camel_tag_list_free(&mi->user_tags);
- e_memchunk_free(s->message_info_chunks, mi);
-}
-
-static CamelMessageContentInfo *
-content_info_new(CamelFolderSummary *s, struct _header_raw *h)
-{
- CamelMessageContentInfo *ci;
-
- ci = camel_folder_summary_content_info_new(s);
-
- 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));
-
- 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 = camel_folder_summary_content_info_new(s);
-
- 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);
- if (camel_folder_summary_decode_uint32(in, &count) == -1 || count > 500)
- goto error;
-
- 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);
-
- camel_folder_summary_decode_uint32(in, &ci->size);
-
- ci->childs = NULL;
-
- if (!ferror(in))
- return ci;
-
-error:
- camel_folder_summary_content_info_free(s, ci);
- return NULL;
-}
-
-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"));
-
- 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);
- camel_folder_summary_encode_token(out, ci->encoding);
- return camel_folder_summary_encode_uint32(out, ci->size);
-}
-
-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);
- e_memchunk_free(s->content_info_chunks, ci);
-}
-
-static char *
-next_uid_string(CamelFolderSummary *s)
-{
- return g_strdup_printf("%u", camel_folder_summary_next_uid(s));
-}
-
-/*
- OK
- Now this is where all the "smarts" happen, where the content info is built,
- and any indexing and what not is performed
-*/
-
-/* must have filter_lock before calling this function */
-static CamelMessageContentInfo *
-summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, 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);
-
- if (s->build_content)
- info = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->content_info_new_from_parser(s, mp);
-
- switch(state) {
- case HSCAN_HEADER:
- /* check content type for indexing, then read body */
- ct = camel_mime_parser_content_type(mp);
- /* update attachments flag as we go */
- if (!header_content_type_is(ct, "text", "*"))
- msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS;
-
- 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"));
- /* update attachments flag as we go */
- ct = camel_mime_parser_content_type(mp);
- if (header_content_type_is(ct, "multipart", "mixed"))
- msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS;
-
- while (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_MULTIPART_END) {
- camel_mime_parser_unstep(mp);
- part = summary_build_content_info(s, msginfo, mp);
- if (part) {
- part->parent = info;
- my_list_append((struct _node **)&info->childs, (struct _node *)part);
- }
- }
- break;
- case HSCAN_MESSAGE:
- d(printf("Summarising message\n"));
- /* update attachments flag as we go */
- msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS;
-
- part = summary_build_content_info(s, msginfo, mp);
- if (part) {
- part->parent = info;
- my_list_append((struct _node **)&info->childs, (struct _node *)part);
- }
- 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;
- }
-
- d(printf("finished building content info\n"));
-
- return info;
-}
-
-/* build the content-info, from a message */
-/* this needs no lock, as we copy all data, and ibex is threadsafe */
-static CamelMessageContentInfo *
-summary_build_content_info_message(CamelFolderSummary *s, CamelMessageInfo *msginfo, CamelMimePart *object)
-{
- CamelDataWrapper *containee;
- int parts, i;
- struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
- CamelMessageContentInfo *info = NULL, *child;
-
- if (s->build_content)
- info = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->content_info_new_from_message(s, object);
-
- containee = camel_medium_get_content_object(CAMEL_MEDIUM(object));
-
- if (containee == NULL)
- return info;
-
- /* TODO: I find it odd that get_part and get_content_object do not
- add a reference, probably need fixing for multithreading */
-
- /* check for attachments */
- if (header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "multipart", "*")) {
- if (header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "multipart", "mixed"))
- msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS;
- } else if (!header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*"))
- msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS;
-
- /* using the object types is more accurate than using the mime/types */
- if (CAMEL_IS_MULTIPART(containee)) {
- parts = camel_multipart_get_number(CAMEL_MULTIPART(containee));
- for (i=0;i<parts;i++) {
- CamelMimePart *part = camel_multipart_get_part(CAMEL_MULTIPART(containee), i);
- g_assert(part);
- child = summary_build_content_info_message(s, msginfo, part);
- if (child) {
- child->parent = info;
- my_list_append((struct _node **)&info->childs, (struct _node *)child);
- }
- }
- } else if (CAMEL_IS_MIME_MESSAGE(containee)) {
- /* for messages we only look at its contents */
- child = summary_build_content_info_message(s, msginfo, (CamelMimePart *)containee);
- if (child) {
- child->parent = info;
- my_list_append((struct _node **)&info->childs, (struct _node *)child);
- }
- } else if (p->index
- && header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*")) {
- /* index all text parts if we're indexing */
- CamelStreamMem *mem = (CamelStreamMem *)camel_stream_mem_new();
-
- camel_data_wrapper_write_to_stream(containee, (CamelStream *)mem);
- ibex_index_buffer(p->index, (char *)camel_message_info_uid(msginfo), mem->buffer->data, mem->buffer->len, NULL);
- camel_object_unref((CamelObject *)mem);
- }
-
- return info;
-}
-
-/**
- * camel_flag_get:
- * @list:
- * @name:
- *
- * Find the state of the flag @name in @list.
- *
- * Return value: The state of the flag (TRUE or FALSE).
- **/
-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;
-}
-
-/**
- * camel_flag_set:
- * @list:
- * @name:
- * @value:
- *
- * Set the state of a flag @name in the list @list to @value.
- *
- * Return value: Whether or not it changed.
- **/
-gboolean
-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 !value;
- }
- flag = tmp;
- }
-
- if (value) {
- tmp = g_malloc(sizeof(*tmp) + strlen(name));
- strcpy(tmp->name, name);
- tmp->next = 0;
- flag->next = tmp;
- }
- return value;
-}
-
-/**
- * camel_flag_list_size:
- * @list:
- *
- * Get the length of the flag list.
- *
- * Return value: The number of TRUE flags in the list.
- **/
-int
-camel_flag_list_size(CamelFlag **list)
-{
- int count=0;
- CamelFlag *flag;
-
- flag = *list;
- while (flag) {
- count++;
- flag = flag->next;
- }
- return count;
-}
-
-/**
- * camel_flag_list_free:
- * @list:
- *
- * Free the memory associated with the flag list @list.
- **/
-void
-camel_flag_list_free(CamelFlag **list)
-{
- CamelFlag *flag, *tmp;
- flag = *list;
- while (flag) {
- tmp = flag->next;
- g_free(flag);
- flag = tmp;
- }
- *list = NULL;
-}
-
-const char
-*camel_tag_get(CamelTag **list, const char *name)
-{
- CamelTag *tag;
-
- tag = *list;
- while (tag) {
- if (!strcmp(tag->name, name))
- return (const char *)tag->value;
- tag = tag->next;
- }
- return NULL;
-}
-
-/**
- * camel_tag_set:
- * @list:
- * @name:
- * @value:
- *
- * Set the tag @name in the tag list @list to @value.
- *
- * Return value: whether or not it changed
- **/
-gboolean
-camel_tag_set(CamelTag **list, const char *name, const char *value)
-{
- CamelTag *tag, *tmp;
-
- /* this 'trick' works because tag->next is the first element */
- tag = (CamelTag *)list;
- while (tag->next) {
- tmp = tag->next;
- if (!strcmp(tmp->name, name)) {
- if (value == NULL) { /* clear it? */
- tag->next = tmp->next;
- g_free(tmp->value);
- g_free(tmp);
- return TRUE;
- } else if (strcmp(tmp->value, value)) { /* has it changed? */
- g_free(tmp->value);
- tmp->value = g_strdup(value);
- return TRUE;
- }
- return FALSE;
- }
- tag = tmp;
- }
-
- if (value) {
- tmp = g_malloc(sizeof(*tmp)+strlen(name));
- strcpy(tmp->name, name);
- tmp->value = g_strdup(value);
- tmp->next = 0;
- tag->next = tmp;
- return TRUE;
- }
- return FALSE;
-}
-
-/**
- * camel_tag_list_size:
- * @list:
- *
- * Get the number of tags present in the tag list @list.
- *
- * Return value: The number of tags.
- **/
-int camel_tag_list_size(CamelTag **list)
-{
- int count=0;
- CamelTag *tag;
-
- tag = *list;
- while (tag) {
- count++;
- tag = tag->next;
- }
- return count;
-}
-
-/**
- * camel_tag_list_free:
- * @list:
- *
- * Free the tag list @list.
- **/
-void camel_tag_list_free(CamelTag **list)
-{
- CamelTag *tag, *tmp;
- tag = *list;
- while (tag) {
- tmp = tag->next;
- g_free(tag->value);
- g_free(tag);
- tag = tmp;
- }
- *list = NULL;
-}
-
-struct flag_names_t {
- char *name;
- guint32 value;
-} flag_names[] = {
- { "answered", CAMEL_MESSAGE_ANSWERED },
- { "deleted", CAMEL_MESSAGE_DELETED },
- { "draft", CAMEL_MESSAGE_DELETED },
- { "flagged", CAMEL_MESSAGE_FLAGGED },
- { "seen", CAMEL_MESSAGE_SEEN },
- { "attachments", CAMEL_MESSAGE_ATTACHMENTS },
- { NULL, 0 }
-};
-
-/**
- * camel_system_flag:
- * @name:
- *
- * Returns the integer value of the flag string.
- **/
-guint32
-camel_system_flag (const char *name)
-{
- struct flag_names_t *flag;
-
- g_return_val_if_fail (name != NULL, 0);
-
- for (flag = flag_names; *flag->name; flag++)
- if (!g_strcasecmp (name, flag->name))
- return flag->value;
-
- return 0;
-}
-
-/**
- * camel_system_flag_get:
- * @flags:
- * @name:
- *
- * Find the state of the flag @name in @flags.
- *
- * Return value: The state of the flag (TRUE or FALSE).
- **/
-gboolean
-camel_system_flag_get (guint32 flags, const char *name)
-{
- g_return_val_if_fail (name != NULL, FALSE);
-
- return flags & camel_system_flag (name);
-}
-
-
-/**
- * camel_message_info_new:
- *
- * Returns a new CamelMessageInfo structure.
- **/
-CamelMessageInfo *
-camel_message_info_new (void)
-{
- CamelMessageInfo *info;
-
- info = g_malloc0(sizeof(*info));
-#ifdef DOESTRV
- info->strings = e_strv_new (CAMEL_MESSAGE_INFO_LAST);
-#endif
- info->refcount = 1;
-
- return info;
-}
-
-/**
- * camel_message_info_ref:
- * @info:
- *
- * Reference an info.
- *
- * NOTE: This interface is not MT-SAFE, like the others.
- **/
-void camel_message_info_ref(CamelMessageInfo *info)
-{
- GLOBAL_INFO_LOCK(info);
- info->refcount++;
- GLOBAL_INFO_UNLOCK(info);
-}
-
-/**
- * camel_message_info_new_from_header:
- * @header: raw header
- *
- * Returns a new CamelMessageInfo structure populated by the header.
- **/
-CamelMessageInfo *
-camel_message_info_new_from_header (struct _header_raw *header)
-{
- CamelMessageInfo *info;
- char *subject, *from, *to, *cc, *mlist;
-
- subject = camel_folder_summary_format_string(header, "subject");
- from = camel_folder_summary_format_address(header, "from");
- to = camel_folder_summary_format_address(header, "to");
- cc = camel_folder_summary_format_address(header, "cc");
- mlist = header_raw_check_mailing_list(&header);
-
- info = camel_message_info_new();
-
- camel_message_info_set_subject(info, subject);
- camel_message_info_set_from(info, from);
- camel_message_info_set_to(info, to);
- camel_message_info_set_cc(info, cc);
- camel_message_info_set_mlist(info, mlist);
-
- return info;
-}
-
-/**
- * camel_message_info_dup_to:
- * @from: source message info
- * @to: destination message info
- *
- * Duplicates the contents of one CamelMessageInfo structure into another.
- * (The destination is assumed to be empty: its contents are not freed.)
- * The slightly odd interface is to allow this to be used to initialize
- * "subclasses" of CamelMessageInfo.
- **/
-void
-camel_message_info_dup_to(const CamelMessageInfo *from, CamelMessageInfo *to)
-{
- CamelFlag *flag;
- CamelTag *tag;
-
- /* Copy numbers */
- to->flags = from->flags;
- to->size = from->size;
- to->date_sent = from->date_sent;
- to->date_received = from->date_received;
- to->refcount = 1;
-
- /* Copy strings */
-#ifdef DOESTRV
- to->strings = e_strv_new(CAMEL_MESSAGE_INFO_LAST);
- e_strv_set(to->strings, CAMEL_MESSAGE_INFO_SUBJECT, camel_message_info_subject(from));
- e_strv_set(to->strings, CAMEL_MESSAGE_INFO_FROM, camel_message_info_from(from));
- e_strv_set(to->strings, CAMEL_MESSAGE_INFO_TO, camel_message_info_to(from));
- e_strv_set(to->strings, CAMEL_MESSAGE_INFO_CC, camel_message_info_cc(from));
- e_strv_set(to->strings, CAMEL_MESSAGE_INFO_UID, camel_message_info_uid(from));
- e_strv_set(to->strings, CAMEL_MESSAGE_INFO_UID, camel_message_info_mlist(from));
-#else
- to->subject = g_strdup(from->subject);
- to->from = g_strdup(from->from);
- to->to = g_strdup(from->to);
- to->cc = g_strdup(from->cc);
- to->uid = g_strdup(from->uid);
- to->mlist = g_strdup(from->mlist);
-#endif
- memcpy(&to->message_id, &from->message_id, sizeof(from->message_id));
-
- /* Copy structures */
- if (from->references) {
- int len = sizeof(*from->references) + ((from->references->size-1) * sizeof(from->references->references[0]));
-
- to->references = g_malloc(len);
- memcpy(to->references, from->references, len);
- } else {
- to->references = NULL;
- }
-
- flag = from->user_flags;
- while (flag) {
- camel_flag_set(&to->user_flags, flag->name, TRUE);
- flag = flag->next;
- }
-
- tag = from->user_tags;
- while (tag) {
- camel_tag_set(&to->user_tags, tag->name, tag->value);
- tag = tag->next;
- }
-
- /* No, this is impossible without knowing the class of summary we came from */
- /* FIXME some day */
- to->content = NULL;
-}
-
-/**
- * camel_message_info_free:
- * @mi: the message info
- *
- * Unref's and potentially frees a CamelMessageInfo and its contents.
- *
- * Can only be used to free CamelMessageInfo's created with
- * camel_message_info_dup_to.
- *
- * NOTE: This interface is not MT-SAFE, like the others.
- *
- **/
-void
-camel_message_info_free(CamelMessageInfo *mi)
-{
- g_return_if_fail(mi != NULL);
-
- GLOBAL_INFO_LOCK(info);
- mi->refcount--;
- if (mi->refcount > 0) {
- GLOBAL_INFO_UNLOCK(info);
- return;
- }
- GLOBAL_INFO_UNLOCK(info);
-
-#ifdef DOESTRV
- e_strv_destroy(mi->strings);
-#else
- g_free(mi->uid);
- g_free(mi->subject);
- g_free(mi->from);
- g_free(mi->to);
- g_free(mi->cc);
- g_free(mi->mlist);
-#endif
- g_free(mi->references);
- camel_flag_list_free(&mi->user_flags);
- camel_tag_list_free(&mi->user_tags);
- /* FIXME: content info? */
- g_free(mi);
-}
-
-#ifdef DOESTRV
-const char *camel_message_info_string(const CamelMessageInfo *mi, int type)
-{
- if (mi->strings == NULL)
- return "";
- return e_strv_get(mi->strings, type);
-}
-
-void camel_message_info_set_string(CamelMessageInfo *mi, int type, char *str)
-{
- g_assert(mi->strings != NULL);
-
- mi->strings = e_strv_set_ref_free(mi->strings, type, str);
-}
-#endif
-
-#if 0
-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("%scontent-type: %s/%s\n", p, ci->type->type, ci->type->subtype);
- printf("%scontent-transfer-encoding: %s\n", p, ci->encoding);
- printf("%scontent-description: %s\n", p, ci->description);
- printf("%ssize: %lu\n", p, (unsigned long)ci->size);
- ci = ci->childs;
- while (ci) {
- content_info_dump(ci, depth+1);
- ci = ci->next;
- }
-}
-
-void
-message_info_dump(CamelMessageInfo *mi)
-{
- if (mi == NULL) {
- printf("No message?\n");
- return;
- }
-
- printf("Subject: %s\n", camel_message_info_subject(mi));
- printf("To: %s\n", camel_message_info_to(mi));
- printf("Cc: %s\n", camel_message_info_cc(mi));
- printf("mailing list: %s\n", camel_message_info_mlist(mi));
- printf("From: %s\n", camel_message_info_from(mi));
- printf("UID: %s\n", camel_message_info_uid(mi));
- printf("Flags: %04x\n", mi->flags & 0xffff);
- content_info_dump(mi->content, 0);
-}
-
-int main(int argc, char **argv)
-{
- CamelMimeParser *mp;
- int fd;
- CamelFolderSummary *s;
- char *buffer;
- int len;
- int i;
- ibex *index;
-
- /*g_tk_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++) {
- CamelMessageInfo *info = camel_folder_summary_index(s, i);
- message_info_dump(info);
- camel_folder_summary_info_free(info);
- }
-
- 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++) {
- CamelMessageInfo *info = camel_folder_summary_index(s, i);
- message_info_dump(info);
- camel_folder_summary_info_free(info);
- }
- camel_object_unref(n);
- }
-
-
- camel_object_unref(mp);
- camel_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 48a9ea4688..0000000000
--- a/camel/camel-folder-summary.h
+++ /dev/null
@@ -1,334 +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) CAMEL_CHECK_CAST (obj, camel_folder_summary_get_type (), CamelFolderSummary)
-#define CAMEL_FOLDER_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_folder_summary_get_type (), CamelFolderSummaryClass)
-#define CAMEL_IS_FOLDER_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_folder_summary_get_type ())
-
-/*typedef struct _CamelFolderSummary CamelFolderSummary;*/
-typedef struct _CamelFolderSummaryClass CamelFolderSummaryClass;
-
-/* A tree of message content info structures
- describe the content structure of the message (if it has any) */
-struct _CamelMessageContentInfo {
- struct _CamelMessageContentInfo *next;
-
- struct _CamelMessageContentInfo *childs;
- struct _CamelMessageContentInfo *parent;
-
- struct _header_content_type *type;
- char *id;
- char *description;
- char *encoding;
- guint32 size;
-};
-
-/* 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,
- CAMEL_MESSAGE_ATTACHMENTS = 1<<5,
-
- /* 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]; /* name allocated as part of the structure */
-} CamelFlag;
-
-typedef struct _CamelTag {
- struct _CamelTag *next;
- char *value;
- char name[1]; /* name allocated as part of the structure */
-} CamelTag;
-
-/* a summary messageid is a 64 bit identifier (partial md5 hash) */
-typedef struct _CamelSummaryMessageID {
- union {
- guint64 id;
- unsigned char hash[8];
- struct {
- guint32 hi;
- guint32 lo;
- } part;
- } id;
-} CamelSummaryMessageID;
-
-/* summary references is a fixed size array of references */
-typedef struct _CamelSummaryReferences {
- int size;
- CamelSummaryMessageID references[1];
-} CamelSummaryReferences;
-
-#define DOESTRV
-
-#ifdef DOESTRV
-/* string array indices */
-enum {
- CAMEL_MESSAGE_INFO_UID,
- CAMEL_MESSAGE_INFO_SUBJECT,
- CAMEL_MESSAGE_INFO_FROM,
- CAMEL_MESSAGE_INFO_TO,
- CAMEL_MESSAGE_INFO_CC,
- CAMEL_MESSAGE_INFO_MLIST,
- CAMEL_MESSAGE_INFO_LAST,
-};
-#endif
-
-/* information about a given object */
-struct _CamelMessageInfo {
- /* public fields */
-#ifdef DOESTRV
- struct _EStrv *strings; /* all strings packed into a single compact array */
-#else
- char *subject;
- char *from;
- char *to;
- char *cc;
- char *mlist;
-
- char *uid;
-#endif
- guint32 flags;
- guint32 size;
- guint32 refcount;
-
- time_t date_sent;
- time_t date_received;
-
- CamelSummaryMessageID message_id;/* for this message */
- CamelSummaryReferences *references;/* from parent to root */
-
- struct _CamelFlag *user_flags;
- struct _CamelTag *user_tags;
-
- /* tree of content description - NULL if it is not available */
- CamelMessageContentInfo *content;
-};
-
-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;
-
-#ifdef DOESTRV
- guint32 message_info_strings;
-#endif
- /* memory allocators (setup automatically) */
- struct _EMemChunk *message_info_chunks;
- struct _EMemChunk *content_info_chunks;
-
- 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_new_from_message)(CamelFolderSummary *, CamelMimeMessage *);
- 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_new_from_message)(CamelFolderSummary *, CamelMimePart *);
- CamelMessageContentInfo * (*content_info_load)(CamelFolderSummary *, FILE *);
- int (*content_info_save)(CamelFolderSummary *, FILE *, CamelMessageContentInfo *);
- void (*content_info_free)(CamelFolderSummary *, CamelMessageContentInfo *);
-
- /* get the next uid */
- char *(*next_uid_string)(CamelFolderSummary *);
-};
-
-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_build_content(CamelFolderSummary *, gboolean state);
-
-guint32 camel_folder_summary_next_uid (CamelFolderSummary *s);
-char *camel_folder_summary_next_uid_string (CamelFolderSummary *s);
-void camel_folder_summary_set_uid (CamelFolderSummary *s, guint32 uid);
-
-/* 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 *);
-CamelMessageInfo *camel_folder_summary_add_from_message(CamelFolderSummary *, CamelMimeMessage *);
-
-/* Just build raw summary items */
-CamelMessageInfo *camel_folder_summary_info_new(CamelFolderSummary *s);
-CamelMessageInfo *camel_folder_summary_info_new_from_header(CamelFolderSummary *, struct _header_raw *);
-CamelMessageInfo *camel_folder_summary_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
-CamelMessageInfo *camel_folder_summary_info_new_from_message(CamelFolderSummary *, CamelMimeMessage *);
-
-void camel_folder_summary_info_ref(CamelFolderSummary *, CamelMessageInfo *);
-void camel_folder_summary_info_free(CamelFolderSummary *, CamelMessageInfo *);
-
-CamelMessageContentInfo *camel_folder_summary_content_info_new(CamelFolderSummary *s);
-void camel_folder_summary_content_info_free(CamelFolderSummary *s, CamelMessageContentInfo *ci);
-
-/* 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);
-void camel_folder_summary_remove_index(CamelFolderSummary *s, int);
-/* 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);
-GPtrArray *camel_folder_summary_array(CamelFolderSummary *s);
-void camel_folder_summary_array_free(CamelFolderSummary *s, GPtrArray *array);
-
-/* summary formatting utils */
-char *camel_folder_summary_format_address(struct _header_raw *h, const char *name);
-char *camel_folder_summary_format_string(struct _header_raw *h, const char *name);
-
-/* 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_time_t(FILE *out, time_t value);
-int camel_folder_summary_decode_time_t(FILE *in, time_t *dest);
-int camel_folder_summary_encode_off_t(FILE *out, off_t value);
-int camel_folder_summary_decode_off_t(FILE *in, off_t *dest);
-int camel_folder_summary_encode_string(FILE *out, const char *str);
-int camel_folder_summary_decode_string(FILE *in, char **);
-
-/* basically like strings, but certain keywords can be compressed and de-cased */
-int camel_folder_summary_encode_token(FILE *, const char *);
-int camel_folder_summary_decode_token(FILE *, char **);
-
-/* message flag operations */
-gboolean camel_flag_get(CamelFlag **list, const char *name);
-gboolean camel_flag_set(CamelFlag **list, const char *name, gboolean state);
-int camel_flag_list_size(CamelFlag **list);
-void camel_flag_list_free(CamelFlag **list);
-
-guint32 camel_system_flag (const char *name);
-gboolean camel_system_flag_get (guint32 flags, const char *name);
-
-/* message tag operations */
-const char *camel_tag_get(CamelTag **list, const char *name);
-gboolean camel_tag_set(CamelTag **list, const char *name, const char *value);
-int camel_tag_list_size(CamelTag **list);
-void camel_tag_list_free(CamelTag **list);
-
-/* message info utils for working with pseudo-messageinfo structures
- NOTE: These cannot be added to a real summary object, but suffice for all
- other external interfaces that use message info's */
-CamelMessageInfo *camel_message_info_new(void);
-void camel_message_info_ref(CamelMessageInfo *info);
-CamelMessageInfo *camel_message_info_new_from_header(struct _header_raw *header);
-void camel_message_info_dup_to(const CamelMessageInfo *from, CamelMessageInfo *to);
-void camel_message_info_free(CamelMessageInfo *mi);
-
-/* accessors */
-#ifdef DOESTRV
-const char *camel_message_info_string(const CamelMessageInfo *mi, int type);
-#define camel_message_info_subject(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MESSAGE_INFO_SUBJECT)
-#define camel_message_info_from(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MESSAGE_INFO_FROM)
-#define camel_message_info_to(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MESSAGE_INFO_TO)
-#define camel_message_info_cc(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MESSAGE_INFO_CC)
-#define camel_message_info_uid(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MESSAGE_INFO_UID)
-#define camel_message_info_mlist(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MESSAGE_INFO_MLIST)
-
-void camel_message_info_set_string(CamelMessageInfo *mi, int type, char *str);
-#define camel_message_info_set_subject(x, s) camel_message_info_set_string(x, CAMEL_MESSAGE_INFO_SUBJECT, s)
-#define camel_message_info_set_from(x, s) camel_message_info_set_string(x, CAMEL_MESSAGE_INFO_FROM, s)
-#define camel_message_info_set_to(x, s) camel_message_info_set_string(x, CAMEL_MESSAGE_INFO_TO, s)
-#define camel_message_info_set_cc(x, s) camel_message_info_set_string(x, CAMEL_MESSAGE_INFO_CC, s)
-#define camel_message_info_set_uid(x, s) camel_message_info_set_string(x, CAMEL_MESSAGE_INFO_UID, s)
-#define camel_message_info_set_mlist(x, s) camel_message_info_set_string(x, CAMEL_MESSAGE_INFO_MLIST, s)
-
-#else
-
-#define camel_message_info_subject(x) (((CamelMessageInfo *)(x))->subject?((CamelMessageInfo *)(x))->subject:"")
-#define camel_message_info_from(x) (((CamelMessageInfo *)(x))->from?((CamelMessageInfo *)(x))->from:"")
-#define camel_message_info_to(x) (((CamelMessageInfo *)(x))->to?((CamelMessageInfo *)(x))->to:"")
-#define camel_message_info_cc(x) (((CamelMessageInfo *)(x))->cc?((CamelMessageInfo *)(x))->cc:"")
-#define camel_message_info_uid(x) (((CamelMessageInfo *)(x))->uid?((CamelMessageInfo *)(x))->uid:"")
-#define camel_message_info_mlist(x) (((CamelMessageInfo *)(x))->mlist?((CamelMessageInfo *)(x))->mlist:"")
-
-#define camel_message_info_set_subject(x, s) (g_free(((CamelMessageInfo *)(x))->subject),((CamelMessageInfo *)(x))->subject = (s))
-#define camel_message_info_set_from(x, s) (g_free(((CamelMessageInfo *)(x))->from),((CamelMessageInfo *)(x))->from = (s))
-#define camel_message_info_set_to(x, s) (g_free(((CamelMessageInfo *)(x))->to),((CamelMessageInfo *)(x))->to = (s))
-#define camel_message_info_set_cc(x, s) (g_free(((CamelMessageInfo *)(x))->cc),((CamelMessageInfo *)(x))->cc = (s))
-#define camel_message_info_set_uid(x, s) (g_free(((CamelMessageInfo *)(x))->uid),((CamelMessageInfo *)(x))->uid = (s))
-#define camel_message_info_set_mlist(x, s) (g_free(((CamelMessageInfo *)(x))->mlist),((CamelMessageInfo *)(x))->mlist = (s))
-#endif
-
-#endif /* ! _CAMEL_FOLDER_SUMMARY_H */
diff --git a/camel/camel-folder-thread.c b/camel/camel-folder-thread.c
deleted file mode 100644
index 3a1c4addde..0000000000
--- a/camel/camel-folder-thread.c
+++ /dev/null
@@ -1,626 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * 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
- */
-
-/* TODO: This could probably be made a camel object, but it isn't really required */
-
-#include <config.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <glib.h>
-#include <ctype.h>
-
-#include "camel-folder-thread.h"
-#include "e-util/e-memory.h"
-
-#define d(x)
-
-#define TIMEIT
-
-#ifdef TIMEIT
-#include <sys/time.h>
-#include <unistd.h>
-#endif
-
-static void
-container_add_child(CamelFolderThreadNode *node, CamelFolderThreadNode *child)
-{
- d(printf("\nAdding child %p to parent %p \n", child, node));
- child->next = node->child;
- node->child = child;
- child->parent = node;
-}
-
-static void
-container_parent_child(CamelFolderThreadNode *parent, CamelFolderThreadNode *child)
-{
- CamelFolderThreadNode *c, *node;
-
- /* are we already the right parent? */
- if (child->parent == parent)
- return;
-
- /* would this create a loop? */
- node = parent->parent;
- while (node) {
- if (node == child)
- return;
- node = node->parent;
- }
-
- /* are we unparented? */
- if (child->parent == NULL) {
- container_add_child(parent, child);
- return;
- }
-
- /* else remove child from its existing parent, and reparent */
- node = child->parent;
- c = (CamelFolderThreadNode *)&node->child;
- d(printf("scanning children:\n"));
- while (c->next) {
- d(printf(" %p\n", c));
- if (c->next==child) {
- d(printf("found node %p\n", child));
- c->next = c->next->next;
- child->parent = NULL;
- container_add_child(parent, child);
- return;
- }
- c = c->next;
- }
-
- printf("DAMN, we shouldn't be here!\n");
-}
-
-static void
-prune_empty(CamelFolderThread *thread, CamelFolderThreadNode **cp)
-{
- CamelFolderThreadNode *child, *next, *c, *lastc;
-
- /* yes, this is intentional */
- lastc = (CamelFolderThreadNode *)cp;
- while (lastc->next) {
- c = lastc->next;
-
- d(printf("checking message %p %p (%08x%08x)\n", c,
- c->message, c->message?c->message->message_id.id.part.hi:0,
- c->message?c->message->message_id.id.part.lo:0));
- if (c->message == NULL) {
- if (c->child == NULL) {
- d(printf("removing empty node\n"));
- lastc->next = c->next;
- e_memchunk_free(thread->node_chunks, c);
- continue;
- }
- if (c->parent || c->child->next==0) {
- d(printf("promoting child\n"));
- lastc->next = c->next; /* remove us */
- child = c->child;
- while (child) {
- next = child->next;
-
- child->parent = c->parent;
- child->next = lastc->next;
- lastc->next = child;
-
- child = next;
- }
- continue;
- }
- }
- prune_empty(thread, &c->child);
- lastc = c;
- }
-}
-
-static void
-hashloop(void *key, void *value, void *data)
-{
- CamelFolderThreadNode *c = value;
- CamelFolderThreadNode *tail = data;
-
- if (c->parent == NULL) {
- c->next = tail->next;
- tail->next = c;
- }
-}
-
-static char *
-get_root_subject(CamelFolderThreadNode *c, int *re)
-{
- char *s, *p;
- CamelFolderThreadNode *scan;
-
- s = NULL;
- *re = FALSE;
- if (c->message)
- s = (char *)camel_message_info_subject(c->message);
- else {
- /* one of the children will always have a message */
- scan = c->child;
- while (scan) {
- if (scan->message) {
- s = (char *)camel_message_info_subject(scan->message);
- break;
- }
- scan = scan->next;
- }
- }
- if (s != NULL) {
- while (*s) {
- while (isspace(*s))
- s++;
- if (s[0] == 0)
- break;
- if ((s[0] == 'r' || s[0]=='R')
- && (s[1] == 'e' || s[1]=='E')) {
- p = s+2;
- while (isdigit(*p) || (ispunct(*p) && (*p != ':')))
- p++;
- if (*p==':') {
- *re = TRUE;
- s = p+1;
- } else
- break;
- } else
- break;
- }
- if (*s)
- return s;
- }
- return NULL;
-}
-
-/* this can be pretty slow, but not used often */
-/* clast cannot be null */
-static void
-remove_node(CamelFolderThreadNode **list, CamelFolderThreadNode *node, CamelFolderThreadNode **clast)
-{
- CamelFolderThreadNode *c;
-
- /* this is intentional, even if it looks funny */
- /* if we have a parent, then we should remove it from the parent list,
- otherwise we remove it from the root list */
- if (node->parent) {
- c = (CamelFolderThreadNode *)&node->parent->child;
- } else {
- c = (CamelFolderThreadNode *)list;
- }
- while (c->next) {
- if (c->next == node) {
- if (*clast == c->next)
- *clast = c;
- c->next = c->next->next;
- return;
- }
- c = c->next;
- }
-
- printf("ERROR: removing node %p failed\n", node);
-}
-
-static void
-group_root_set(CamelFolderThread *thread, CamelFolderThreadNode **cp)
-{
- GHashTable *subject_table = g_hash_table_new(g_str_hash, g_str_equal);
- CamelFolderThreadNode *c, *clast, *scan, *container;
-
- /* gather subject lines */
- d(printf("gathering subject lines\n"));
- clast = (CamelFolderThreadNode *)cp;
- c = clast->next;
- while (c) {
- c->root_subject = get_root_subject(c, &c->re);
- if (c->root_subject) {
- container = g_hash_table_lookup(subject_table, c->root_subject);
- if (container == NULL
- || (container->message == NULL && c->message)
- || (container->re == TRUE && !c->re)) {
- g_hash_table_insert(subject_table, c->root_subject, c);
- }
- }
- c = c->next;
- }
-
- /* merge common subjects? */
- clast = (CamelFolderThreadNode *)cp;
- while (clast->next) {
- c = clast->next;
- d(printf("checking %p %s\n", c, c->root_subject));
- if (c->root_subject
- && (container = g_hash_table_lookup(subject_table, c->root_subject))
- && (container != c)) {
- d(printf(" matching %p %s\n", container, container->root_subject));
- if (c->message == NULL && container->message == NULL) {
- d(printf("merge containers children\n"));
- /* steal the children from c onto container, and unlink c */
- scan = (CamelFolderThreadNode *)&container->child;
- while (scan->next)
- scan = scan->next;
- scan->next = c->child;
- clast->next = c->next;
- e_memchunk_free(thread->node_chunks, c);
- continue;
- } if (c->message == NULL && container->message != NULL) {
- d(printf("container is non-empty parent\n"));
- remove_node(cp, container, &clast);
- container_add_child(c, container);
- } else if (c->message != NULL && container->message == NULL) {
- d(printf("container is empty child\n"));
- clast->next = c->next;
- container_add_child(container, c);
- continue;
- } else if (c->re && !container->re) {
- d(printf("container is re\n"));
- clast->next = c->next;
- container_add_child(container, c);
- continue;
- } else if (!c->re && container->re) {
- d(printf("container is not re\n"));
- remove_node(cp, container, &clast);
- container_add_child(c, container);
- } else if (c->re && container->re) {
- d(printf("subjects are common %p and %p\n", c, container));
-
- /* build a phantom node */
- remove_node(cp, container, &clast);
- remove_node(cp, c, &clast);
-
- scan = e_memchunk_alloc0(thread->node_chunks);
-
- scan->root_subject = c->root_subject;
- scan->re = c->re && container->re;
- scan->next = c->next;
- clast->next = scan;
- container_add_child(scan, c);
- container_add_child(scan, container);
- clast = scan;
- g_hash_table_insert(subject_table, scan->root_subject, scan);
- continue;
- }
- }
- clast = c;
- }
- g_hash_table_destroy(subject_table);
-}
-
-struct _tree_info {
- GHashTable *visited;
-};
-
-static int
-dump_tree_rec(struct _tree_info *info, CamelFolderThreadNode *c, int depth)
-{
- char *p;
- int count=0;
-
- p = alloca(depth*2+1);
- memset(p, ' ', depth*2);
- p[depth*2] = 0;
-
- while (c) {
- if (g_hash_table_lookup(info->visited, c)) {
- printf("WARNING: NODE REVISITED: %p\n", c);
- } else {
- g_hash_table_insert(info->visited, c, c);
- }
- if (c->message) {
- printf("%s %p Subject: %s <%.8s>\n", p, c, camel_message_info_subject(c->message), c->message->message_id.id.hash);
- count += 1;
- } else {
- printf("%s %p <empty>\n", p, c);
- }
- if (c->child)
- count += dump_tree_rec(info, c->child, depth+1);
- c = c->next;
- }
- return count;
-}
-
-int
-camel_folder_threaded_messages_dump(CamelFolderThreadNode *c)
-{
- int count;
- struct _tree_info info;
-
- info.visited = g_hash_table_new(g_direct_hash, g_direct_equal);
- count = dump_tree_rec(&info, c, 0);
- g_hash_table_destroy(info.visited);
- return count;
-}
-
-static int
-sort_node(const void *a, const void *b)
-{
- const CamelFolderThreadNode *a1 = ((CamelFolderThreadNode **)a)[0];
- const CamelFolderThreadNode *b1 = ((CamelFolderThreadNode **)b)[0];
-
- /* if we have no message, it must be a dummy node, which
- also means it must have a child, just use that as the
- sort data (close enough?) */
- if (a1->message == NULL)
- a1 = a1->child;
- if (b1->message == NULL)
- b1 = b1->child;
- if (a1->order == b1->order)
- return 0;
- if (a1->order < b1->order)
- return -1;
- else
- return 1;
-}
-
-static void
-sort_thread(CamelFolderThreadNode **cp)
-{
- CamelFolderThreadNode *c, *head, **carray;
- int size=0;
-
- c = *cp;
- while (c) {
- /* sort the children while we're at it */
- if (c->child)
- sort_thread(&c->child);
- size++;
- c = c->next;
- }
- if (size<2)
- return;
- carray = alloca(size*sizeof(CamelFolderThreadNode *));
- c = *cp;
- size=0;
- while (c) {
- carray[size] = c;
- c = c->next;
- size++;
- }
- qsort(carray, size, sizeof(CamelFolderThreadNode *), sort_node);
- size--;
- head = carray[size];
- head->next = NULL;
- size--;
- do {
- c = carray[size];
- c->next = head;
- head = c;
- size--;
- } while (size>=0);
- *cp = head;
-}
-
-static guint id_hash(void *key)
-{
- CamelSummaryMessageID *id = (CamelSummaryMessageID *)key;
-
- return id->id.part.lo;
-}
-
-static gint id_equal(void *a, void *b)
-{
- return ((CamelSummaryMessageID *)a)->id.id == ((CamelSummaryMessageID *)b)->id.id;
-}
-
-/**
- * camel_folder_thread_messages_new:
- * @folder:
- * @uids: The subset of uid's to thread. If NULL. then thread all
- * uid's in @folder.
- *
- * Thread a (subset) of the messages in a folder. And sort the result
- * in summary order.
- *
- * Return value: A CamelFolderThread contianing a tree of CamelFolderThreadNode's
- * which represent the threaded structure of the messages.
- **/
-CamelFolderThread *
-camel_folder_thread_messages_new(CamelFolder *folder, GPtrArray *uids)
-{
- GHashTable *id_table, *no_id_table;
- int i;
- CamelFolderThreadNode *c, *child, *head;
- CamelFolderThread *thread;
- GHashTable *wanted = NULL;
- GPtrArray *summary;
-
-#ifdef TIMEIT
- struct timeval start, end;
- unsigned long diff;
-
- gettimeofday(&start, NULL);
-#endif
-
- thread = g_malloc(sizeof(*thread));
- thread->tree = NULL;
- thread->node_chunks = e_memchunk_new(32, sizeof(CamelFolderThreadNode));
- thread->folder = folder;
- camel_object_ref((CamelObject *)folder);
-
- /* wanted is the list of what we want, we put it in a hash for quick lookup */
- if (uids) {
- wanted = g_hash_table_new(g_str_hash, g_str_equal);
- for (i=0;i<uids->len;i++)
- g_hash_table_insert(wanted, uids->pdata[i], uids->pdata[i]);
- }
-
- thread->summary = summary = camel_folder_get_summary(folder);
-
- id_table = g_hash_table_new((GHashFunc)id_hash, (GCompareFunc)id_equal);
- no_id_table = g_hash_table_new(NULL, NULL);
- for (i=0;i<summary->len;i++) {
- CamelMessageInfo *mi = summary->pdata[i];
- const char *uid = camel_message_info_uid(mi);
-
- if (wanted && g_hash_table_lookup(wanted, uid) == 0)
- continue;
-
- if (mi->message_id.id.id) {
- c = g_hash_table_lookup(id_table, &mi->message_id);
- /* check for duplicate messages */
- if (c) {
- /* if duplicate, just make out it is a no-id message, but try and insert it
- into the right spot in the tree */
- d(printf("doing: (duplicate message id)\n"));
- c = e_memchunk_alloc0(thread->node_chunks);
- g_hash_table_insert(no_id_table, (void *)mi, c);
- } else {
- d(printf("doing : %08x%08x (%s)\n", mi->message_id.id.part.hi, mi->message_id.id.part.lo, camel_message_info_subject(mi)));
- c = e_memchunk_alloc0(thread->node_chunks);
- g_hash_table_insert(id_table, (void *)&mi->message_id, c);
- }
- } else {
- d(printf("doing : (no message id)\n"));
- c = e_memchunk_alloc0(thread->node_chunks);
- g_hash_table_insert(no_id_table, (void *)mi, c);
- }
-
- c->message = mi;
- c->order = i;
- child = c;
- if (mi->references) {
- int j;
-
- d(printf("references:\n"));
- for (j=0;j<mi->references->size;j++) {
- /* should never be empty, but just incase */
- if (mi->references->references[j].id.id == 0)
- continue;
-
- c = g_hash_table_lookup(id_table, &mi->references->references[j]);
- if (c == NULL) {
- d(printf("not found\n"));
- c = e_memchunk_alloc0(thread->node_chunks);
- g_hash_table_insert(id_table, &mi->references->references[j], c);
- }
- if (c!=child)
- container_parent_child(c, child);
- child = c;
- }
- }
- }
-
- d(printf("\n\n"));
- /* build a list of root messages (no parent) */
- head = NULL;
- g_hash_table_foreach(id_table, hashloop, &head);
- g_hash_table_foreach(no_id_table, hashloop, &head);
-
- g_hash_table_destroy(id_table);
- g_hash_table_destroy(no_id_table);
-
- /* remove empty parent nodes */
- prune_empty(thread, &head);
-
- /* find any siblings which missed out */
- group_root_set(thread, &head);
-
-#if 0
- printf("finished\n");
- i = camel_folder_thread_messages_dump(head);
- printf("%d count, %d items in tree\n", uids->len, i);
-#endif
-
- sort_thread(&head);
-
- /* remove any phantom nodes, this could possibly be put in group_root_set()? */
- c = (CamelFolderThreadNode *)&head;
- while (c && c->next) {
- CamelFolderThreadNode *scan, *newtop;
-
- child = c->next;
- if (child->message == NULL) {
- newtop = child->child;
- /* unlink pseudo node */
- c->next = newtop;
-
- /* link its siblings onto the end of its children */
- scan = (CamelFolderThreadNode *)&newtop->child;
- while (scan->next)
- scan = scan->next;
- scan->next = newtop->next;
- /* and link the now 'real' node into the list */
- newtop->next = child->next;
- c = newtop;
- e_memchunk_free(thread->node_chunks, child);
- } else {
- c = child;
- }
- }
-
- /* this is only debug assertion stuff */
- c = (CamelFolderThreadNode *)&head;
- while (c->next) {
- c = c->next;
- if (c->message == NULL)
- g_warning("threading missed removing a pseudo node: %s\n", c->root_subject);
- }
-
- thread->tree = head;
-
-#ifdef TIMEIT
- gettimeofday(&end, NULL);
- diff = end.tv_sec * 1000 + end.tv_usec/1000;
- diff -= start.tv_sec * 1000 + start.tv_usec/1000;
- printf("Message threading %d messages took %ld.%03ld seconds\n",
- uids->len, diff / 1000, diff % 1000);
-#endif
-
- return thread;
-}
-
-/**
- * camel_folder_thread_messages_destroy:
- * @thread:
- *
- * Free all memory associated with the thread descriptor @thread.
- **/
-void
-camel_folder_thread_messages_destroy(CamelFolderThread *thread)
-{
- camel_folder_free_summary(thread->folder, thread->summary);
- camel_object_unref((CamelObject *)thread->folder);
- e_memchunk_destroy(thread->node_chunks);
- g_free(thread);
-}
-
-#if 0
-/* intended for incremental update. Not implemented yet as, well, its probbaly
- not worth it (memory overhead vs speed, may as well just rethread the whole
- lot?)
-
- But it might be implemented at a later date.
-*/
-void
-camel_folder_thread_messages_add(CamelFolderThread *thread, CamelFolder *folder, GPtrArray *uids)
-{
-
-}
-
-void
-thread_messages_remove(CamelFolderThread *thread, CamelFolder *folder, GPtrArray *uids)
-{
-
-}
-#endif
diff --git a/camel/camel-folder-thread.h b/camel/camel-folder-thread.h
deleted file mode 100644
index 843ade0b56..0000000000
--- a/camel/camel-folder-thread.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 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_THREAD_H
-#define _CAMEL_FOLDER_THREAD_H
-
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-folder.h>
-
-typedef struct _CamelFolderThreadNode {
- struct _CamelFolderThreadNode *next,
- *parent,
- *child;
- const CamelMessageInfo *message;
- char *root_subject; /* cached root equivalent subject */
- int re; /* re version of subject? */
- int order;
-} CamelFolderThreadNode;
-
-typedef struct CamelFolderThread {
- struct _CamelFolderThreadNode *tree;
- struct _EMemChunk *node_chunks;
- CamelFolder *folder;
- GPtrArray *summary;
-} CamelFolderThread;
-
-CamelFolderThread *camel_folder_thread_messages_new(CamelFolder *folder, GPtrArray *uids);
-/*
-void camel_folder_thread_messages_add(CamelFolderThread *threads, CamelFolder *folder, GPtrArray *uids);
-void camel_folder_thread_messages_remove(CamelFolderThread *threads, CamelFolder *folder, GPtrArray *uids);
-*/
-void camel_folder_thread_messages_destroy(CamelFolderThread *threads);
-
-/* debugging function only */
-int camel_folder_threaded_messages_dump(CamelFolderThreadNode *c);
-
-#endif /* !_CAMEL_FOLDER_THREAD_H */
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
deleted file mode 100644
index faff5f7556..0000000000
--- a/camel/camel-folder.c
+++ /dev/null
@@ -1,1675 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* 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"
-#include "e-util/e-memory.h"
-
-#include "camel-private.h"
-
-static CamelObjectClass *parent_class = NULL;
-
-/* Returns the class for a CamelFolder */
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static void camel_folder_finalize (CamelObject *object);
-
-static void refresh_info (CamelFolder *folder, CamelException *ex);
-
-static void folder_sync (CamelFolder *folder, gboolean expunge,
- CamelException *ex);
-
-static const gchar *get_name (CamelFolder *folder);
-static const gchar *get_full_name (CamelFolder *folder);
-static CamelStore *get_parent_store (CamelFolder *folder);
-
-static guint32 get_permanent_flags (CamelFolder *folder);
-static guint32 get_message_flags (CamelFolder *folder, const char *uid);
-static void set_message_flags (CamelFolder *folder, const char *uid,
- guint32 flags, guint32 set);
-static gboolean get_message_user_flag (CamelFolder *folder, const char *uid, const char *name);
-static void set_message_user_flag (CamelFolder *folder, const char *uid,
- const char *name, gboolean value);
-static const char *get_message_user_tag(CamelFolder *folder, const char *uid, const char *name);
-static void set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value);
-
-static gint get_message_count (CamelFolder *folder);
-static gint get_unread_message_count (CamelFolder *folder);
-
-static void expunge (CamelFolder *folder,
- CamelException *ex);
-
-
-static void append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex);
-
-
-static GPtrArray *get_uids (CamelFolder *folder);
-static void free_uids (CamelFolder *folder,
- GPtrArray *array);
-static GPtrArray *get_summary (CamelFolder *folder);
-static void free_summary (CamelFolder *folder,
- GPtrArray *array);
-
-static CamelMimeMessage *get_message (CamelFolder *folder,
- const gchar *uid,
- CamelException *ex);
-
-static CamelMessageInfo *get_message_info (CamelFolder *folder, const char *uid);
-static void free_message_info (CamelFolder *folder, CamelMessageInfo *info);
-
-static GPtrArray *search_by_expression (CamelFolder *folder,
- const char *exp,
- CamelException *ex);
-static void search_free (CamelFolder * folder,
- GPtrArray * result);
-
-static void copy_message_to (CamelFolder *source,
- const char *uid,
- CamelFolder *dest,
- CamelException *ex);
-
-static void move_message_to (CamelFolder *source,
- const char *uid,
- CamelFolder *dest,
- CamelException *ex);
-
-static void freeze (CamelFolder *folder);
-static void thaw (CamelFolder *folder);
-
-static gboolean folder_changed (CamelObject *object,
- gpointer event_data);
-static gboolean message_changed (CamelObject *object,
- /*const char *uid*/gpointer event_data);
-
-static void
-camel_folder_class_init (CamelFolderClass *camel_folder_class)
-{
- CamelObjectClass *camel_object_class =
- CAMEL_OBJECT_CLASS (camel_folder_class);
-
- parent_class = camel_type_get_global_classfuncs (camel_object_get_type ());
-
- /* virtual method definition */
- camel_folder_class->sync = folder_sync;
- camel_folder_class->refresh_info = refresh_info;
- camel_folder_class->get_name = get_name;
- camel_folder_class->get_full_name = get_full_name;
- camel_folder_class->get_parent_store = get_parent_store;
- camel_folder_class->expunge = expunge;
- camel_folder_class->get_message_count = get_message_count;
- camel_folder_class->get_unread_message_count = get_unread_message_count;
- camel_folder_class->append_message = append_message;
- camel_folder_class->get_permanent_flags = get_permanent_flags;
- camel_folder_class->get_message_flags = get_message_flags;
- camel_folder_class->set_message_flags = set_message_flags;
- camel_folder_class->get_message_user_flag = get_message_user_flag;
- camel_folder_class->set_message_user_flag = set_message_user_flag;
- camel_folder_class->get_message_user_tag = get_message_user_tag;
- camel_folder_class->set_message_user_tag = set_message_user_tag;
- camel_folder_class->get_message = get_message;
- 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->search_free = search_free;
- camel_folder_class->get_message_info = get_message_info;
- camel_folder_class->free_message_info = free_message_info;
- camel_folder_class->copy_message_to = copy_message_to;
- camel_folder_class->move_message_to = move_message_to;
- camel_folder_class->freeze = freeze;
- camel_folder_class->thaw = thaw;
-
- /* virtual method overload */
- camel_object_class_declare_event (camel_object_class,
- "folder_changed", folder_changed);
- camel_object_class_declare_event (camel_object_class,
- "message_changed", message_changed);
-}
-
-static void
-camel_folder_init (gpointer object, gpointer klass)
-{
- CamelFolder *folder = object;
-
- folder->priv = g_malloc0(sizeof(*folder->priv));
- folder->priv->frozen = 0;
- folder->priv->changed_frozen = camel_folder_change_info_new();
-#ifdef ENABLE_THREADS
- folder->priv->lock = g_mutex_new();
- folder->priv->change_lock = g_mutex_new();
-#endif
-}
-
-static void
-camel_folder_finalize (CamelObject *object)
-{
- CamelFolder *camel_folder = CAMEL_FOLDER (object);
-
- g_free (camel_folder->name);
- g_free (camel_folder->full_name);
-
- if (camel_folder->parent_store)
- camel_object_unref (CAMEL_OBJECT (camel_folder->parent_store));
-
- if (camel_folder->summary)
- camel_object_unref((CamelObject *)camel_folder->summary);
-
- camel_folder_change_info_free(camel_folder->priv->changed_frozen);
-#ifdef ENABLE_THREADS
- g_mutex_free(camel_folder->priv->lock);
- g_mutex_free(camel_folder->priv->change_lock);
-#endif
- g_free(camel_folder->priv);
-}
-
-CamelType
-camel_folder_get_type (void)
-{
- static CamelType camel_folder_type = CAMEL_INVALID_TYPE;
-
- if (camel_folder_type == CAMEL_INVALID_TYPE) {
- camel_folder_type = camel_type_register (CAMEL_OBJECT_TYPE, "CamelFolder",
- sizeof (CamelFolder),
- sizeof (CamelFolderClass),
- (CamelObjectClassInitFunc) camel_folder_class_init,
- NULL,
- (CamelObjectInitFunc) camel_folder_init,
- (CamelObjectFinalizeFunc) camel_folder_finalize );
- }
-
- return camel_folder_type;
-}
-
-
-/**
- * camel_folder_construct:
- * @folder: folder object to construct
- * @parent_store: parent store object of the folder
- * @full_name: full name of the folder
- * @name: short name of the folder
- *
- * Initalizes the folder by setting the parent store and name.
- **/
-void
-camel_folder_construct (CamelFolder *folder, CamelStore *parent_store,
- const char *full_name, const char *name)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (CAMEL_IS_STORE (parent_store));
- g_return_if_fail (folder->parent_store == NULL);
- g_return_if_fail (folder->name == NULL);
-
- folder->parent_store = parent_store;
- camel_object_ref (CAMEL_OBJECT (parent_store));
-
- folder->name = g_strdup (name);
- folder->full_name = g_strdup (full_name);
-}
-
-
-static void
-folder_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- g_warning ("CamelFolder::sync not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (folder)));
-}
-
-/**
- * camel_folder_sync:
- * @folder: The folder object
- * @expunge: whether or not to expunge deleted messages
- * @ex: exception object
- *
- * Sync changes made to a folder to its backing store, possibly expunging
- * deleted messages as well.
- **/
-void
-camel_folder_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
-
- CAMEL_FOLDER_LOCK(folder, lock);
-
- CF_CLASS (folder)->sync (folder, expunge, ex);
-
- CAMEL_FOLDER_UNLOCK(folder, lock);
-}
-
-
-static void
-refresh_info (CamelFolder *folder, CamelException *ex)
-{
- /* No op */
-}
-
-/**
- * camel_folder_refresh_info:
- * @folder: The folder object
- * @ex: exception object
- *
- * Updates a folder's summary to be in sync with its backing store.
- **/
-void
-camel_folder_refresh_info (CamelFolder *folder, CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
-
- CAMEL_FOLDER_LOCK(folder, lock);
-
- CF_CLASS (folder)->refresh_info (folder, ex);
-
- CAMEL_FOLDER_UNLOCK(folder, lock);
-}
-
-
-static const char *
-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 char *
-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 char *
-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 char *
-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 CamelStore *
-get_parent_store (CamelFolder * folder)
-{
- return folder->parent_store;
-}
-
-/**
- * camel_folder_get_parent_store:
- * @folder: folder to get the parent of
- *
- * Return value: the parent store of the folder.
- **/
-CamelStore *
-camel_folder_get_parent_store (CamelFolder *folder)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
-
- return CF_CLASS (folder)->get_parent_store (folder);
-}
-
-
-static void
-expunge (CamelFolder *folder, CamelException *ex)
-{
- g_warning ("CamelFolder::expunge not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_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));
-
- CAMEL_FOLDER_LOCK(folder, lock);
-
- CF_CLASS (folder)->expunge (folder, ex);
-
- CAMEL_FOLDER_UNLOCK(folder, lock);
-}
-
-static int
-get_message_count (CamelFolder *folder)
-{
- g_return_val_if_fail(folder->summary != NULL, -1);
-
- return camel_folder_summary_count(folder->summary);
-}
-
-/**
- * camel_folder_get_message_count:
- * @folder: A CamelFolder object
- *
- * Return value: the number of messages in the folder, or -1 if unknown.
- **/
-int
-camel_folder_get_message_count (CamelFolder *folder)
-{
- int ret;
-
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), -1);
-
- ret = CF_CLASS (folder)->get_message_count (folder);
-
- return ret;
-}
-
-static int
-get_unread_message_count(CamelFolder *folder)
-{
- int i, count, unread=0;
-
- g_return_val_if_fail(folder->summary != NULL, -1);
-
- count = camel_folder_summary_count(folder->summary);
- for (i=0; i<count; i++) {
- CamelMessageInfo *info = camel_folder_summary_index(folder->summary, i);
-
- if (info && !(info->flags & CAMEL_MESSAGE_SEEN))
- unread++;
-
- camel_folder_summary_info_free(folder->summary, info);
- }
-
- return unread;
-}
-
-/**
- * camel_folder_unread_get_message_count:
- * @folder: A CamelFolder object
- *
- * Return value: the number of unread messages in the folder, or -1 if unknown.
- **/
-int
-camel_folder_get_unread_message_count (CamelFolder *folder)
-{
- int ret;
-
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), -1);
-
- ret = CF_CLASS (folder)->get_unread_message_count (folder);
-
- return ret;
-}
-
-static void
-append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex)
-{
- g_warning ("CamelFolder::append_message not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (folder)));
- return;
-
-}
-
-/**
- * camel_folder_append_message: add a message to a folder
- * @folder: folder object to add the message to
- * @message: message object
- * @info: message info with additional flags/etc to set on
- * new message, or %NULL
- * @ex: exception object
- *
- * Add a message to a folder. Only the flag and tag data from @info
- * is used. If @info is %NULL, no flags or tags will be set.
- **/
-void
-camel_folder_append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
-
- CAMEL_FOLDER_LOCK(folder, lock);
-
- CF_CLASS (folder)->append_message (folder, message, info, ex);
-
- CAMEL_FOLDER_UNLOCK(folder, lock);
-}
-
-
-static guint32
-get_permanent_flags (CamelFolder *folder)
-{
- return folder->permanent_flags;
-}
-
-/**
- * camel_folder_get_permanent_flags:
- * @folder: a CamelFolder
- *
- * Return value: the set of CamelMessageFlags that can be permanently
- * stored on a message between sessions. If it includes %CAMEL_FLAG_USER,
- * then user-defined flags will be remembered.
- **/
-guint32
-camel_folder_get_permanent_flags (CamelFolder *folder)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), 0);
-
- return CF_CLASS (folder)->get_permanent_flags (folder);
-}
-
-static guint32
-get_message_flags(CamelFolder *folder, const char *uid)
-{
- CamelMessageInfo *info;
- guint32 flags;
-
- g_return_val_if_fail(folder->summary != NULL, 0);
-
- info = camel_folder_summary_uid(folder->summary, uid);
- g_return_val_if_fail(info != NULL, 0);
-
- flags = info->flags;
- camel_folder_summary_info_free(folder->summary, info);
-
- return flags;
-}
-
-/**
- * camel_folder_get_message_flags:
- * @folder: a CamelFolder
- * @uid: the UID of a message in @folder
- *
- * Return value: the CamelMessageFlags that are set on the indicated
- * message.
- **/
-guint32
-camel_folder_get_message_flags (CamelFolder *folder, const char *uid)
-{
- guint32 ret;
-
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), 0);
-
- ret = CF_CLASS (folder)->get_message_flags (folder, uid);
-
- return ret;
-}
-
-static void
-set_message_flags(CamelFolder *folder, const char *uid, guint32 flags, guint32 set)
-{
- CamelMessageInfo *info;
- guint32 new;
-
- g_return_if_fail(folder->summary != NULL);
-
- info = camel_folder_summary_uid(folder->summary, uid);
- g_return_if_fail(info != NULL);
-
- new = (info->flags & ~flags) | (set & flags);
- if (new == info->flags) {
- camel_folder_summary_info_free(folder->summary, info);
- return;
- }
-
- info->flags = new | CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_folder_summary_touch(folder->summary);
- camel_folder_summary_info_free(folder->summary, info);
-
- camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid);
-}
-
-/**
- * camel_folder_set_message_flags:
- * @folder: a CamelFolder
- * @uid: the UID of a message in @folder
- * @flags: a set of CamelMessageFlag values to set
- * @set: the mask of values in @flags to use.
- *
- * Sets those flags specified by @set to the values specified by @flags
- * on the indicated message. (This may or may not persist after the
- * folder or store is closed. See camel_folder_get_permanent_flags().)
- **/
-void
-camel_folder_set_message_flags (CamelFolder *folder, const char *uid,
- guint32 flags, guint32 set)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
-
- CF_CLASS (folder)->set_message_flags (folder, uid, flags, set);
-}
-
-
-static gboolean
-get_message_user_flag(CamelFolder *folder, const char *uid, const char *name)
-{
- CamelMessageInfo *info;
- gboolean ret;
-
- g_return_val_if_fail(folder->summary != NULL, FALSE);
-
- info = camel_folder_summary_uid(folder->summary, uid);
- g_return_val_if_fail(info != NULL, FALSE);
-
- ret = camel_flag_get(&info->user_flags, name);
- camel_folder_summary_info_free(folder->summary, info);
-
- return ret;
-}
-
-/**
- * camel_folder_get_message_user_flag:
- * @folder: a CamelFolder
- * @uid: the UID of a message in @folder
- * @name: the name of a user flag
- *
- * Return value: whether or not the given user flag is set on the message.
- **/
-gboolean
-camel_folder_get_message_user_flag (CamelFolder *folder, const char *uid,
- const char *name)
-{
- gboolean ret;
-
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), 0);
-
- ret = CF_CLASS (folder)->get_message_user_flag (folder, uid, name);
-
- return ret;
-}
-
-static void
-set_message_user_flag(CamelFolder *folder, const char *uid, const char *name, gboolean value)
-{
- CamelMessageInfo *info;
-
- g_return_if_fail(folder->summary != NULL);
-
- info = camel_folder_summary_uid(folder->summary, uid);
- g_return_if_fail(info != NULL);
-
- if (camel_flag_set(&info->user_flags, name, value)) {
- info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_folder_summary_touch(folder->summary);
- camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid);
- }
- camel_folder_summary_info_free(folder->summary, info);
-}
-
-/**
- * camel_folder_set_message_user_flag:
- * @folder: a CamelFolder
- * @uid: the UID of a message in @folder
- * @name: the name of the user flag to set
- * @value: the value to set it to
- *
- * Sets the user flag specified by @name to the value specified by @value
- * on the indicated message. (This may or may not persist after the
- * folder or store is closed. See camel_folder_get_permanent_flags().)
- **/
-void
-camel_folder_set_message_user_flag (CamelFolder *folder, const char *uid,
- const char *name, gboolean value)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
-
- CF_CLASS (folder)->set_message_user_flag (folder, uid, name, value);
-}
-
-static const char *
-get_message_user_tag(CamelFolder *folder, const char *uid, const char *name)
-{
- CamelMessageInfo *info;
- const char *ret;
-
- g_return_val_if_fail(folder->summary != NULL, NULL);
-
- info = camel_folder_summary_uid(folder->summary, uid);
- g_return_val_if_fail(info != NULL, FALSE);
-
-#warning "Need to duplicate tag string"
-
- ret = camel_tag_get(&info->user_tags, name);
- camel_folder_summary_info_free(folder->summary, info);
-
- return ret;
-}
-
-/**
- * camel_folder_get_message_user_tag:
- * @folder: a CamelFolder
- * @uid: the UID of a message in @folder
- * @name: the name of a user tag
- *
- * Return value: Returns the value of the user tag.
- **/
-const char *
-camel_folder_get_message_user_tag (CamelFolder *folder, const char *uid, const char *name)
-{
- const char *ret;
-
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), 0);
-
-#warning "get_message_user_tag() needs to copy the tag contents"
- ret = CF_CLASS (folder)->get_message_user_tag (folder, uid, name);
-
- return ret;
-}
-
-static void
-set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value)
-{
- CamelMessageInfo *info;
-
- g_return_if_fail(folder->summary != NULL);
-
- info = camel_folder_summary_uid(folder->summary, uid);
- g_return_if_fail(info != NULL);
-
- if (camel_tag_set(&info->user_tags, name, value)) {
- info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_folder_summary_touch(folder->summary);
- camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid);
- }
- camel_folder_summary_info_free(folder->summary, info);
-}
-
-/**
- * camel_folder_set_message_user_tag:
- * @folder: a CamelFolder
- * @uid: the UID of a message in @folder
- * @name: the name of the user tag to set
- * @value: the value to set it to
- *
- * Sets the user tag specified by @name to the value specified by @value
- * on the indicated message. (This may or may not persist after the
- * folder or store is closed. See camel_folder_get_permanent_flags().)
- **/
-void
-camel_folder_set_message_user_tag (CamelFolder *folder, const char *uid, const char *name, const char *value)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
-
- CF_CLASS (folder)->set_message_user_tag (folder, uid, name, value);
-}
-
-static CamelMessageInfo *
-get_message_info (CamelFolder *folder, const char *uid)
-{
- g_return_val_if_fail(folder->summary != NULL, NULL);
-
- return camel_folder_summary_uid(folder->summary, uid);
-}
-
-/**
- * camel_folder_get_message_info:
- * @folder: a CamelFolder
- * @uid: the uid of a message
- *
- * Retrieve the CamelMessageInfo for the specified @uid. This return
- * must be freed using free_message_info().
- *
- * Return value: the summary information for the indicated message, or NULL
- * if the uid does not exist.
- **/
-CamelMessageInfo *
-camel_folder_get_message_info (CamelFolder *folder, const char *uid)
-{
- CamelMessageInfo *ret;
-
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_return_val_if_fail (uid != NULL, NULL);
-
- ret = CF_CLASS (folder)->get_message_info (folder, uid);
-
- return ret;
-}
-
-static void
-free_message_info (CamelFolder *folder, CamelMessageInfo *info)
-{
- g_return_if_fail(folder->summary != NULL);
-
- camel_folder_summary_info_free(folder->summary, info);
-}
-
-/**
- * camel_folder_free_message_info:
- * @folder:
- * @info:
- *
- * Free (unref) a CamelMessageInfo, previously obtained with get_message_info().
- **/
-void
-camel_folder_free_message_info(CamelFolder *folder, CamelMessageInfo *info)
-{
- g_return_if_fail(CAMEL_IS_FOLDER (folder));
- g_return_if_fail(info != NULL);
-
- CF_CLASS (folder)->free_message_info(folder, info);
-}
-
-/* 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 CamelMimeMessage *
-get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- g_warning ("CamelFolder::get_message not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (folder)));
- return NULL;
-}
-
-/**
- * camel_folder_get_message:
- * @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 (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelMimeMessage *ret;
-
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
-
- CAMEL_FOLDER_LOCK(folder, lock);
-
- ret = CF_CLASS (folder)->get_message (folder, uid, ex);
-
- CAMEL_FOLDER_UNLOCK(folder, lock);
-
- return ret;
-}
-
-static GPtrArray *
-get_uids(CamelFolder *folder)
-{
- GPtrArray *array;
- int i, count;
-
- array = g_ptr_array_new();
-
- g_return_val_if_fail(folder->summary != NULL, array);
-
- count = camel_folder_summary_count(folder->summary);
- g_ptr_array_set_size(array, count);
- for (i=0; i<count; i++) {
- CamelMessageInfo *info = camel_folder_summary_index(folder->summary, i);
-
- if (info) {
- array->pdata[i] = g_strdup(camel_message_info_uid(info));
- camel_folder_summary_info_free(folder->summary, info);
- } else {
- array->pdata[i] = g_strdup("xx unknown uid xx");
- }
- }
-
- return array;
-}
-
-/**
- * camel_folder_get_uids:
- * @folder: folder object
- *
- * 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)
-{
- GPtrArray *ret;
-
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
-
- ret = CF_CLASS (folder)->get_uids (folder);
-
- return ret;
-}
-
-static void
-free_uids (CamelFolder *folder, GPtrArray *array)
-{
- int i;
-
- 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));
-
- CF_CLASS (folder)->free_uids (folder, array);
-}
-
-static GPtrArray *
-get_summary(CamelFolder *folder)
-{
- g_assert(folder->summary != NULL);
-
- return camel_folder_summary_array(folder->summary);
-}
-
-/**
- * camel_folder_get_summary:
- * @folder: a folder object
- *
- * 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)
-{
- GPtrArray *ret;
-
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
-
- ret = CF_CLASS (folder)->get_summary (folder);
-
- return ret;
-}
-
-static void
-free_summary(CamelFolder *folder, GPtrArray *summary)
-{
- g_assert(folder->summary != NULL);
-
- camel_folder_summary_array_free(folder->summary, summary);
-}
-
-/**
- * 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));
-
- 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 GPtrArray *
-search_by_expression (CamelFolder *folder, const char *expression,
- CamelException *ex)
-{
- g_warning ("CamelFolder::search_by_expression not implemented for "
- "`%s'", camel_type_to_name (CAMEL_OBJECT_GET_TYPE (folder)));
- return NULL;
-}
-
-/**
- * camel_folder_search_by_expression:
- * @folder: Folder object
- * @expression: a search expression
- * @ex: a CamelException
- *
- * Searches the folder for messages matching the given search expression.
- *
- * Return value: a list of uids of matching messages. The caller must
- * free the list and each of the elements when it is done.
- **/
-GPtrArray *
-camel_folder_search_by_expression (CamelFolder *folder, const char *expression,
- CamelException *ex)
-{
- GPtrArray *ret;
-
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_return_val_if_fail (folder->has_search_capability, NULL);
-
- /* NOTE: that it is upto the callee to lock */
-
- ret = CF_CLASS (folder)->search_by_expression (folder, expression, ex);
-
- return ret;
-}
-
-static void
-search_free (CamelFolder *folder, GPtrArray *result)
-{
- int i;
-
- for (i = 0; i < result->len; i++)
- g_free (g_ptr_array_index (result, i));
- g_ptr_array_free (result, TRUE);
-}
-
-/**
- * camel_folder_search_free:
- * @folder:
- * @result:
- *
- * Free the result of a search.
- **/
-void
-camel_folder_search_free (CamelFolder *folder, GPtrArray *result)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (folder->has_search_capability);
-
- /* NOTE: upto the callee to lock */
- CF_CLASS (folder)->search_free (folder, result);
-}
-
-
-static void
-copy_message_to (CamelFolder *source, const char *uid, CamelFolder *dest, CamelException *ex)
-{
- CamelMimeMessage *msg;
- CamelMessageInfo *info = NULL;
-
- /* Default implementation. */
-
- /* we alredy have the lock, dont deadlock */
- msg = CF_CLASS(source)->get_message(source, uid, ex);
- if (!msg)
- return;
- if (source->has_summary_capability)
- info = CF_CLASS(source)->get_message_info (source, uid);
- else
- info = camel_message_info_new_from_header(((CamelMimePart *)msg)->headers);
- camel_folder_append_message (dest, msg, info, ex);
- camel_object_unref (CAMEL_OBJECT (msg));
- if (info) {
- if (source->has_summary_capability)
- CF_CLASS(source)->free_message_info(source, info);
- else
- camel_message_info_free(info);
- }
-}
-
-/**
- * camel_folder_copy_message_to:
- * @source: source folder
- * @uid: UID of message in @source
- * @dest: destination folder
- * @ex: a CamelException
- *
- * This copies a message from one folder to another. If the @source and
- * @dest folders have the same parent_store, this may be more efficient
- * than a camel_folder_append_message().
- *
- * This function is still depcreated, it is not the same as move_message_to.
- **/
-void
-camel_folder_copy_message_to (CamelFolder *source, const char *uid,
- CamelFolder *dest, CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (source));
- g_return_if_fail (CAMEL_IS_FOLDER (dest));
- g_return_if_fail (uid != NULL);
-
- CAMEL_FOLDER_LOCK(source, lock);
-
- if (source->parent_store == dest->parent_store)
- CF_CLASS (source)->copy_message_to (source, uid, dest, ex);
- else
- copy_message_to (source, uid, dest, ex);
-
- CAMEL_FOLDER_UNLOCK(source, lock);
-}
-
-
-static void
-move_message_to (CamelFolder *source, const char *uid,
- CamelFolder *dest, CamelException *ex)
-{
- CamelMimeMessage *msg;
- CamelMessageInfo *info = NULL;
-
- /* Default implementation. */
-
- msg = CF_CLASS(source)->get_message (source, uid, ex);
- if (!msg)
- return;
- if (source->has_summary_capability)
- info = CF_CLASS(source)->get_message_info (source, uid);
- else
- info = camel_message_info_new_from_header(((CamelMimePart *)msg)->headers);
- camel_folder_append_message (dest, msg, info, ex);
- camel_object_unref (CAMEL_OBJECT (msg));
- if (!camel_exception_is_set(ex))
- CF_CLASS(source)->set_message_flags(source, uid, CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED);
- if (info) {
- if (source->has_summary_capability)
- CF_CLASS(source)->free_message_info(source, info);
- else
- camel_message_info_free(info);
- }
-}
-
-/**
- * camel_folder_move_message_to:
- * @source: source folder
- * @uid: UID of message in @source
- * @dest: destination folder
- * @ex: a CamelException
- *
- * This moves a message from one folder to another. If the @source and
- * @dest folders have the same parent_store, this may be more efficient
- * than a camel_folder_append_message() followed by
- * camel_folder_delete_message().
- **/
-void
-camel_folder_move_message_to (CamelFolder *source, const char *uid,
- CamelFolder *dest, CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (source));
- g_return_if_fail (CAMEL_IS_FOLDER (dest));
- g_return_if_fail (uid != NULL);
-
- CAMEL_FOLDER_LOCK(source, lock);
-
- if (source->parent_store == dest->parent_store)
- CF_CLASS (source)->move_message_to (source, uid, dest, ex);
- else
- move_message_to (source, uid, dest, ex);
-
- CAMEL_FOLDER_UNLOCK(source, lock);
-}
-
-static void
-freeze (CamelFolder *folder)
-{
- CAMEL_FOLDER_LOCK(folder, change_lock);
-
- folder->priv->frozen++;
-
- printf("freeze(%p) = %d\n", folder, folder->priv->frozen);
- CAMEL_FOLDER_UNLOCK(folder, change_lock);
-}
-
-/**
- * camel_folder_freeze:
- * @folder: a folder
- *
- * Freezes the folder so that a series of operation can be performed
- * without "message_changed" and "folder_changed" signals being emitted.
- * When the folder is later thawed with camel_folder_thaw(), the
- * suppressed signals will be emitted.
- **/
-void
-camel_folder_freeze (CamelFolder * folder)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
-
- CF_CLASS (folder)->freeze (folder);
-}
-
-static void
-thaw (CamelFolder * folder)
-{
- int i;
- CamelFolderChangeInfo *info;
-
- CAMEL_FOLDER_LOCK(folder, change_lock);
-
- folder->priv->frozen--;
-
- printf("thaw(%p) = %d\n", folder, folder->priv->frozen);
-
- if (folder->priv->frozen == 0) {
- /* If we have more or less messages, do a folder changed, otherwise just
- do a message changed for each one.
- TODO: message_changed is now probably irrelevant and not required */
- info = folder->priv->changed_frozen;
- if (info->uid_added->len > 0 || info->uid_removed->len > 0 || info->uid_changed->len > 10) {
- camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", info);
- } else if (info->uid_changed->len > 0) {
- for (i=0;i<info->uid_changed->len;i++) {
- camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", info->uid_changed->pdata[i]);
- }
- }
- camel_folder_change_info_clear(info);
- }
-
- CAMEL_FOLDER_UNLOCK(folder, change_lock);
-}
-
-/**
- * camel_folder_thaw:
- * @folder: a folder
- *
- * Thaws the folder and emits any pending folder_changed or
- * message_changed signals.
- **/
-void
-camel_folder_thaw (CamelFolder *folder)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (folder->priv->frozen != 0);
-
- CF_CLASS (folder)->thaw (folder);
-}
-
-
-/* Event hooks that block emission when frozen */
-static gboolean
-folder_changed (CamelObject *obj, gpointer event_data)
-{
- CamelFolder *folder = CAMEL_FOLDER (obj);
- CamelFolderChangeInfo *changed = event_data;
- gboolean ret = TRUE;
-
- printf("folder_changed(%p, %p), frozen=%d\n", obj, event_data, folder->priv->frozen);
-
- if (folder->priv->frozen) {
- CAMEL_FOLDER_LOCK(folder, change_lock);
-
- if (changed != NULL)
- camel_folder_change_info_cat(folder->priv->changed_frozen, changed);
- else
- g_warning("Class %s is passing NULL to folder_changed event",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (folder)));
- ret = FALSE;
-
- CAMEL_FOLDER_UNLOCK(folder, change_lock);
- }
-
- return ret;
-}
-
-static gboolean
-message_changed (CamelObject *obj, /*const char *uid*/gpointer event_data)
-{
- CamelFolder *folder = CAMEL_FOLDER (obj);
- gboolean ret = TRUE;
-
- printf("message_changed(%p, %p), frozen=%d\n", folder, event_data, folder->priv->frozen);
-
- if (folder->priv->frozen) {
- CAMEL_FOLDER_LOCK(folder, change_lock);
-
- camel_folder_change_info_change_uid(folder->priv->changed_frozen, (char *)event_data);
- ret = FALSE;
-
- CAMEL_FOLDER_UNLOCK(folder, change_lock);
- }
-
- return ret;
-}
-
-
-/**
- * camel_folder_free_nop:
- * @folder: a folder
- * @array: an array of uids or CamelMessageInfo
- *
- * "Frees" the provided array by doing nothing. Used by CamelFolder
- * subclasses as an implementation for free_uids, or free_summary when
- * the returned array is "static" information and should not be freed.
- **/
-void
-camel_folder_free_nop (CamelFolder *folder, GPtrArray *array)
-{
- ;
-}
-
-/**
- * camel_folder_free_shallow:
- * @folder: a folder
- * @array: an array of uids or CamelMessageInfo
- *
- * Frees the provided array but not its contents. Used by CamelFolder
- * subclasses as an implementation for free_uids or free_summary when
- * the returned array needs to be freed but its contents come from
- * "static" information.
- **/
-void
-camel_folder_free_shallow (CamelFolder *folder, GPtrArray *array)
-{
- g_ptr_array_free (array, TRUE);
-}
-
-/**
- * camel_folder_free_deep:
- * @folder: a folder
- * @array: an array of uids
- *
- * Frees the provided array and its contents. Used by CamelFolder
- * subclasses as an implementation for free_uids when the provided
- * information was created explicitly by the corresponding get_ call.
- **/
-void
-camel_folder_free_deep (CamelFolder *folder, GPtrArray *array)
-{
- int i;
-
- for (i = 0; i < array->len; i++)
- g_free (array->pdata[i]);
- g_ptr_array_free (array, TRUE);
-}
-
-struct _CamelFolderChangeInfoPrivate {
- GHashTable *uid_stored; /* what we have stored, which array they're in */
- GHashTable *uid_source; /* used to create unique lists */
- struct _EMemPool *uid_pool; /* pool used to store copies of uid strings */
-};
-
-/**
- * camel_folder_change_info_new:
- * @void:
- *
- * Create a new folder change info structure.
- *
- * Change info structures are not MT-SAFE and must be
- * locked for exclusive access externally.
- *
- * Return value:
- **/
-CamelFolderChangeInfo *
-camel_folder_change_info_new(void)
-{
- CamelFolderChangeInfo *info;
-
- info = g_malloc(sizeof(*info));
- info->uid_added = g_ptr_array_new();
- info->uid_removed = g_ptr_array_new();
- info->uid_changed = g_ptr_array_new();
- info->priv = g_malloc0(sizeof(*info->priv));
- info->priv->uid_stored = g_hash_table_new(g_str_hash, g_str_equal);
- info->priv->uid_source = NULL;
- info->priv->uid_pool = e_mempool_new(512, 256, E_MEMPOOL_ALIGN_BYTE);
-
- return info;
-}
-
-/**
- * camel_folder_change_info_add_source:
- * @info:
- * @uid:
- *
- * Add a source uid for generating a changeset.
- **/
-void
-camel_folder_change_info_add_source(CamelFolderChangeInfo *info, const char *uid)
-{
- struct _CamelFolderChangeInfoPrivate *p = info->priv;
-
- if (p->uid_source == NULL)
- p->uid_source = g_hash_table_new(g_str_hash, g_str_equal);
-
- if (g_hash_table_lookup(p->uid_source, uid) == NULL)
- g_hash_table_insert(p->uid_source, e_mempool_strdup(p->uid_pool, uid), (void *)1);
-}
-
-/**
- * camel_folder_change_info_add_source_list:
- * @info:
- * @list:
- *
- * Add a list of source uid's for generating a changeset.
- **/
-void
-camel_folder_change_info_add_source_list(CamelFolderChangeInfo *info, const GPtrArray *list)
-{
- int i;
- struct _CamelFolderChangeInfoPrivate *p = info->priv;
-
- if (p->uid_source == NULL)
- p->uid_source = g_hash_table_new(g_str_hash, g_str_equal);
-
- for (i=0;i<list->len;i++) {
- char *uid = list->pdata[i];
-
- if (g_hash_table_lookup(p->uid_source, uid) == NULL)
- g_hash_table_insert(p->uid_source, e_mempool_strdup(p->uid_pool, uid), (void *)1);
- }
-}
-
-/**
- * camel_folder_change_info_add_update:
- * @info:
- * @uid:
- *
- * Add a uid from the updated list, used to generate a changeset diff.
- **/
-void
-camel_folder_change_info_add_update(CamelFolderChangeInfo *info, const char *uid)
-{
- char *key;
- int value;
- struct _CamelFolderChangeInfoPrivate *p = info->priv;
-
- if (p->uid_source == NULL) {
- camel_folder_change_info_add_uid(info, uid);
- return;
- }
-
- if (g_hash_table_lookup_extended(p->uid_source, uid, (void **)&key, (void **)&value)) {
- g_hash_table_remove(p->uid_source, key);
- } else {
- camel_folder_change_info_add_uid(info, uid);
- }
-}
-
-/**
- * camel_folder_change_info_add_update_list:
- * @info:
- * @list:
- *
- * Add a list of uid's from the updated list.
- **/
-void
-camel_folder_change_info_add_update_list(CamelFolderChangeInfo *info, const GPtrArray *list)
-{
- int i;
-
- for (i=0;i<list->len;i++)
- camel_folder_change_info_add_update(info, list->pdata[i]);
-}
-
-static void
-change_info_remove(char *key, void *value, CamelFolderChangeInfo *info)
-{
- struct _CamelFolderChangeInfoPrivate *p = info->priv;
- GPtrArray *olduids;
- char *olduid;
-
- if (g_hash_table_lookup_extended(p->uid_stored, key, (void **)&olduid, (void **)&olduids)) {
- /* if it was added/changed them removed, then remove it */
- if (olduids != info->uid_removed) {
- g_ptr_array_remove_fast(olduids, olduid);
- g_ptr_array_add(info->uid_removed, olduid);
- g_hash_table_insert(p->uid_stored, olduid, info->uid_removed);
- }
- return;
- }
-
-
- /* we dont need to copy this, as they've already been copied into our pool */
- g_ptr_array_add(info->uid_removed, key);
- g_hash_table_insert(p->uid_stored, key, info->uid_removed);
-}
-
-/**
- * camel_folder_change_info_build_diff:
- * @info:
- *
- * Compare the source uid set to the updated uid set and generate the differences
- * into the added and removed lists.
- **/
-void
-camel_folder_change_info_build_diff(CamelFolderChangeInfo *info)
-{
- struct _CamelFolderChangeInfoPrivate *p = info->priv;
-
- if (p->uid_source) {
- g_hash_table_foreach(p->uid_source, (GHFunc)change_info_remove, info);
- g_hash_table_destroy(p->uid_source);
- p->uid_source = NULL;
- }
-}
-
-static void
-change_info_cat(CamelFolderChangeInfo *info, GPtrArray *source, void (*add)(CamelFolderChangeInfo *info, const char *uid))
-{
- int i;
-
- for (i=0;i<source->len;i++)
- add(info, source->pdata[i]);
-}
-
-/**
- * camel_folder_change_info_cat:
- * @info:
- * @source:
- *
- * Concatenate one change info onto antoher. Can be used to copy
- * them too.
- **/
-void
-camel_folder_change_info_cat(CamelFolderChangeInfo *info, CamelFolderChangeInfo *source)
-{
- change_info_cat(info, source->uid_added, camel_folder_change_info_add_uid);
- change_info_cat(info, source->uid_removed, camel_folder_change_info_remove_uid);
- change_info_cat(info, source->uid_changed, camel_folder_change_info_change_uid);
-}
-
-/**
- * camel_folder_change_info_add_uid:
- * @info:
- * @uid:
- *
- * Add a new uid to the changeinfo.
- **/
-void
-camel_folder_change_info_add_uid(CamelFolderChangeInfo *info, const char *uid)
-{
- struct _CamelFolderChangeInfoPrivate *p = info->priv;
- GPtrArray *olduids;
- char *olduid;
-
- if (g_hash_table_lookup_extended(p->uid_stored, uid, (void **)&olduid, (void **)&olduids)) {
- /* if it was removed then added, promote it to a changed */
- /* if it was changed then added, leave as changed */
- if (olduids == info->uid_removed) {
- g_ptr_array_remove_fast(olduids, olduid);
- g_ptr_array_add(info->uid_changed, olduid);
- g_hash_table_insert(p->uid_stored, olduid, info->uid_changed);
- }
- return;
- }
-
- olduid = e_mempool_strdup(p->uid_pool, uid);
- g_ptr_array_add(info->uid_added, olduid);
- g_hash_table_insert(p->uid_stored, olduid, info->uid_added);
-}
-
-/**
- * camel_folder_change_info_remove_uid:
- * @info:
- * @uid:
- *
- * Add a uid to the removed uid list.
- **/
-void
-camel_folder_change_info_remove_uid(CamelFolderChangeInfo *info, const char *uid)
-{
- struct _CamelFolderChangeInfoPrivate *p = info->priv;
- GPtrArray *olduids;
- char *olduid;
-
- if (g_hash_table_lookup_extended(p->uid_stored, uid, (void **)&olduid, (void **)&olduids)) {
- /* if it was added/changed them removed, then remove it */
- if (olduids != info->uid_removed) {
- g_ptr_array_remove_fast(olduids, olduid);
- g_ptr_array_add(info->uid_removed, olduid);
- g_hash_table_insert(p->uid_stored, olduid, info->uid_removed);
- }
- return;
- }
-
- olduid = e_mempool_strdup(p->uid_pool, uid);
- g_ptr_array_add(info->uid_removed, olduid);
- g_hash_table_insert(p->uid_stored, olduid, info->uid_removed);
-}
-
-/**
- * camel_folder_change_info_change_uid:
- * @info:
- * @uid:
- *
- * Add a uid to the changed uid list.
- **/
-void
-camel_folder_change_info_change_uid(CamelFolderChangeInfo *info, const char *uid)
-{
- struct _CamelFolderChangeInfoPrivate *p = info->priv;
- GPtrArray *olduids;
- char *olduid;
-
- if (g_hash_table_lookup_extended(p->uid_stored, uid, (void **)&olduid, (void **)&olduids)) {
- /* if we have it already, leave it as that */
- return;
- }
-
- olduid = e_mempool_strdup(p->uid_pool, uid);
- g_ptr_array_add(info->uid_changed, olduid);
- g_hash_table_insert(p->uid_stored, olduid, info->uid_changed);
-}
-
-/**
- * camel_folder_change_info_changed:
- * @info:
- *
- * Return true if the changeset contains any changes.
- *
- * Return Value:
- **/
-gboolean
-camel_folder_change_info_changed(CamelFolderChangeInfo *info)
-{
- return (info->uid_added->len || info->uid_removed->len || info->uid_changed->len);
-}
-
-/**
- * camel_folder_change_info_clear:
- * @info:
- *
- * Empty out the change info; called after changes have been processed.
- **/
-void
-camel_folder_change_info_clear(CamelFolderChangeInfo *info)
-{
- struct _CamelFolderChangeInfoPrivate *p = info->priv;
-
- g_ptr_array_set_size(info->uid_added, 0);
- g_ptr_array_set_size(info->uid_removed, 0);
- g_ptr_array_set_size(info->uid_changed, 0);
- if (p->uid_source) {
- g_hash_table_destroy(p->uid_source);
- p->uid_source = NULL;
- }
- g_hash_table_destroy(p->uid_stored);
- p->uid_stored = g_hash_table_new(g_str_hash, g_str_equal);
- e_mempool_flush(p->uid_pool, TRUE);
-}
-
-/**
- * camel_folder_change_info_free:
- * @info:
- *
- * Free memory associated with the folder change info lists.
- **/
-void
-camel_folder_change_info_free(CamelFolderChangeInfo *info)
-{
- struct _CamelFolderChangeInfoPrivate *p = info->priv;
-
- if (p->uid_source)
- g_hash_table_destroy(p->uid_source);
-
- g_hash_table_destroy(p->uid_stored);
- e_mempool_destroy(p->uid_pool);
- g_free(p);
-
- g_ptr_array_free(info->uid_added, TRUE);
- g_ptr_array_free(info->uid_removed, TRUE);
- g_ptr_array_free(info->uid_changed, TRUE);
- g_free(info);
-}
-
-
-
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
deleted file mode 100644
index 53fa626e85..0000000000
--- a/camel/camel-folder.h
+++ /dev/null
@@ -1,305 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * camel-folder.h: Abstract class for an email folder
- *
- * 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_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) (CAMEL_CHECK_CAST((obj), CAMEL_FOLDER_TYPE, CamelFolder))
-#define CAMEL_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_FOLDER_TYPE, CamelFolderClass))
-#define CAMEL_IS_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_FOLDER_TYPE))
-
-typedef struct _CamelFolderChangeInfo CamelFolderChangeInfo;
-
-struct _CamelFolderChangeInfo {
- GPtrArray *uid_added;
- GPtrArray *uid_removed;
- GPtrArray *uid_changed;
-
- struct _CamelFolderChangeInfoPrivate *priv;
-};
-
-struct _CamelFolder
-{
- CamelObject parent_object;
-
- struct _CamelFolderPrivate *priv;
-
- char *name;
- char *full_name;
- CamelStore *parent_store;
- CamelFolderSummary *summary;
-
- guint32 permanent_flags;
- gboolean has_summary_capability:1;
- gboolean has_search_capability:1;
-
-};
-
-typedef struct {
- CamelObjectClass parent_class;
-
- /* Virtual methods */
- void (*refresh_info) (CamelFolder *folder, CamelException *ex);
-
- void (*sync) (CamelFolder *folder, gboolean expunge,
- CamelException *ex);
-
- const char * (*get_name) (CamelFolder *folder);
- const char * (*get_full_name) (CamelFolder *folder);
-
- CamelStore * (*get_parent_store) (CamelFolder *folder);
-
- void (*expunge) (CamelFolder *folder,
- CamelException *ex);
-
- int (*get_message_count) (CamelFolder *folder);
-
- int (*get_unread_message_count) (CamelFolder *folder);
-
- void (*append_message) (CamelFolder *folder,
- CamelMimeMessage *message,
- const CamelMessageInfo *info,
- CamelException *ex);
-
- guint32 (*get_permanent_flags) (CamelFolder *folder);
- guint32 (*get_message_flags) (CamelFolder *folder,
- const char *uid);
- void (*set_message_flags) (CamelFolder *folder,
- const char *uid,
- guint32 flags, guint32 set);
-
- gboolean (*get_message_user_flag) (CamelFolder *folder,
- const char *uid,
- const char *name);
- void (*set_message_user_flag) (CamelFolder *folder,
- const char *uid,
- const char *name,
- gboolean value);
-
- const char * (*get_message_user_tag) (CamelFolder *folder,
- const char *uid,
- const char *name);
- void (*set_message_user_tag) (CamelFolder *folder,
- const char *uid,
- const char *name,
- const char *value);
-
- CamelMimeMessage * (*get_message) (CamelFolder *folder,
- const char *uid,
- CamelException *ex);
-
- GPtrArray * (*get_uids) (CamelFolder *folder);
- void (*free_uids) (CamelFolder *folder,
- GPtrArray *array);
-
- GPtrArray * (*get_summary) (CamelFolder *folder);
- void (*free_summary) (CamelFolder *folder,
- GPtrArray *summary);
-
- gboolean (*has_search_capability) (CamelFolder *folder);
-
- GPtrArray * (*search_by_expression) (CamelFolder *folder,
- const char *expression,
- CamelException *ex);
-
- void (*search_free) (CamelFolder *folder, GPtrArray *result);
-
- CamelMessageInfo * (*get_message_info) (CamelFolder *, const char *uid);
- void (*free_message_info) (CamelFolder *, CamelMessageInfo *);
-
- void (*copy_message_to) (CamelFolder *source,
- const char *uid,
- CamelFolder *destination,
- CamelException *ex);
-
- void (*move_message_to) (CamelFolder *source,
- const char *uid,
- CamelFolder *destination,
- CamelException *ex);
-
- void (*freeze) (CamelFolder *folder);
- void (*thaw) (CamelFolder *folder);
-} CamelFolderClass;
-
-/* Standard Camel function */
-CamelType camel_folder_get_type (void);
-
-
-/* public methods */
-void camel_folder_construct (CamelFolder *folder,
- CamelStore *parent_store,
- const char *full_name,
- const char *name);
-
-void camel_folder_refresh_info (CamelFolder * folder,
- CamelException * ex);
-void camel_folder_sync (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex);
-
-CamelStore * camel_folder_get_parent_store (CamelFolder *folder);
-
-
-/* delete operations */
-void camel_folder_expunge (CamelFolder *folder,
- CamelException *ex);
-
-
-/* folder name operations */
-const char * camel_folder_get_name (CamelFolder *folder);
-const char * camel_folder_get_full_name (CamelFolder *folder);
-
-
-/* various properties accessors */
-guint32 camel_folder_get_permanent_flags (CamelFolder *folder);
-
-guint32 camel_folder_get_message_flags (CamelFolder *folder,
- const char *uid);
-
-void camel_folder_set_message_flags (CamelFolder *folder,
- const char *uid,
- guint32 flags,
- guint32 set);
-
-gboolean camel_folder_get_message_user_flag (CamelFolder *folder,
- const char *uid,
- const char *name);
-
-void camel_folder_set_message_user_flag (CamelFolder *folder,
- const char *uid,
- const char *name,
- gboolean value);
-const char * camel_folder_get_message_user_tag (CamelFolder *folder,
- const char *uid,
- const char *name);
-
-void camel_folder_set_message_user_tag (CamelFolder *folder,
- const char *uid,
- const char *name,
- const char *value);
-
-
-
-/* message manipulation */
-void camel_folder_append_message (CamelFolder *folder,
- CamelMimeMessage *message,
- const CamelMessageInfo *info,
- CamelException *ex);
-
-
-/* summary related operations */
-gboolean camel_folder_has_summary_capability (CamelFolder *folder);
-
-
-int camel_folder_get_message_count (CamelFolder *folder);
-
-int camel_folder_get_unread_message_count (CamelFolder *folder);
-
-GPtrArray * camel_folder_get_summary (CamelFolder *folder);
-void camel_folder_free_summary (CamelFolder *folder,
- GPtrArray *array);
-
-/* uid based access operations */
-CamelMimeMessage * camel_folder_get_message (CamelFolder *folder,
- const char *uid,
- CamelException *ex);
-#define camel_folder_delete_message(folder, uid) \
- camel_folder_set_message_flags (folder, uid, CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED)
-
-GPtrArray * camel_folder_get_uids (CamelFolder *folder);
-void camel_folder_free_uids (CamelFolder *folder,
- GPtrArray *array);
-
-/* search api */
-gboolean camel_folder_has_search_capability (CamelFolder *folder);
-GPtrArray * camel_folder_search_by_expression (CamelFolder *folder,
- const char *expression,
- CamelException *ex);
-void camel_folder_search_free (CamelFolder *folder, GPtrArray *);
-
-/* summary info */
-CamelMessageInfo *camel_folder_get_message_info (CamelFolder *folder, const char *uid);
-void camel_folder_free_message_info (CamelFolder *folder, CamelMessageInfo *info);
-
-void camel_folder_copy_message_to (CamelFolder *source,
- const char *uid,
- CamelFolder *dest,
- CamelException *ex);
-
-void camel_folder_move_message_to (CamelFolder *source,
- const char *uid,
- CamelFolder *dest,
- CamelException *ex);
-
-/* stop/restart getting events */
-void camel_folder_freeze (CamelFolder *folder);
-void camel_folder_thaw (CamelFolder *folder);
-
-#if 0
-/* lock/unlock at the thread level, NOTE: only used internally */
-void camel_folder_lock (CamelFolder *folder);
-void camel_folder_unlock (CamelFolder *folder);
-#endif
-
-/* For use by subclasses (for free_{uids,summary,subfolder_names}) */
-void camel_folder_free_nop (CamelFolder *folder, GPtrArray *array);
-void camel_folder_free_shallow (CamelFolder *folder, GPtrArray *array);
-void camel_folder_free_deep (CamelFolder *folder, GPtrArray *array);
-
-/* update functions for change info */
-CamelFolderChangeInfo * camel_folder_change_info_new (void);
-void camel_folder_change_info_clear (CamelFolderChangeInfo *info);
-void camel_folder_change_info_free (CamelFolderChangeInfo *info);
-gboolean camel_folder_change_info_changed (CamelFolderChangeInfo *info);
-
-/* for building diff's automatically */
-void camel_folder_change_info_add_source (CamelFolderChangeInfo *info, const char *uid);
-void camel_folder_change_info_add_source_list(CamelFolderChangeInfo *info, const GPtrArray *list);
-void camel_folder_change_info_add_update (CamelFolderChangeInfo *info, const char *uid);
-void camel_folder_change_info_add_update_list(CamelFolderChangeInfo *info, const GPtrArray *list);
-void camel_folder_change_info_build_diff (CamelFolderChangeInfo *info);
-
-/* for manipulating diff's directly */
-void camel_folder_change_info_cat (CamelFolderChangeInfo *info, CamelFolderChangeInfo *s);
-void camel_folder_change_info_add_uid (CamelFolderChangeInfo *info, const char *uid);
-void camel_folder_change_info_remove_uid (CamelFolderChangeInfo *info, const char *uid);
-void camel_folder_change_info_change_uid (CamelFolderChangeInfo *info, 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 e97e9029eb..0000000000
--- a/camel/camel-internet-address.c
+++ /dev/null
@@ -1,509 +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"
-
-#include <stdio.h>
-#include <string.h>
-
-#define d(x)
-
-static int internet_decode (CamelAddress *, const char *raw);
-static char * internet_encode (CamelAddress *);
-static int internet_unformat (CamelAddress *, const char *raw);
-static char * internet_format (CamelAddress *);
-static int internet_cat (CamelAddress *dest, const CamelAddress *source);
-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;
-};
-
-static void
-camel_internet_address_class_init(CamelInternetAddressClass *klass)
-{
- CamelAddressClass *address = (CamelAddressClass *) klass;
-
- camel_internet_address_parent = CAMEL_ADDRESS_CLASS(camel_type_get_global_classfuncs(camel_address_get_type()));
-
- address->decode = internet_decode;
- address->encode = internet_encode;
- address->unformat = internet_unformat;
- address->format = internet_format;
- address->remove = internet_remove;
- address->cat = internet_cat;
-}
-
-static void
-camel_internet_address_init(CamelInternetAddress *obj)
-{
-}
-
-CamelType
-camel_internet_address_get_type(void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register(camel_address_get_type(), "CamelInternetAddress",
- sizeof (CamelInternetAddress),
- sizeof (CamelInternetAddressClass),
- (CamelObjectClassInitFunc) camel_internet_address_class_init,
- NULL,
- (CamelObjectInitFunc) camel_internet_address_init,
- NULL);
- }
-
- return type;
-}
-
-static int
-internet_decode (CamelAddress *a, const char *raw)
-{
- struct _header_address *ha, *n;
- int count = a->addresses->len;
-
- /* 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, it's an error, infact */
- g = g->next;
- }
- }
- n = n->next;
- }
- header_address_list_clear(&ha);
- }
-
- return a->addresses->len - count;
-}
-
-static char *
-internet_encode (CamelAddress *a)
-{
- int i;
- GString *out;
- char *ret;
- int len = 6; /* "From: ", assume longer of the address headers */
-
- 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 *enc;
-
- if (i != 0)
- g_string_append(out, ", ");
-
- enc = camel_internet_address_encode_address(&len, addr->name, addr->address);
- g_string_sprintfa(out, "%s", enc);
- g_free(enc);
- }
-
- ret = out->str;
- g_string_free(out, FALSE);
-
- return ret;
-}
-
-static int
-internet_unformat(CamelAddress *a, const char *raw)
-{
- char *buffer, *p, *name, *addr;
- int c;
- int count = a->addresses->len;
-
- if (raw == NULL)
- return 0;
-
- d(printf("unformatting address: %s\n", raw));
-
- /* we copy, so we can modify as we go */
- buffer = g_strdup(raw);
-
- /* this can be simpler than decode, since there are much fewer rules */
- p = buffer;
- name = NULL;
- addr = p;
- do {
- c = (unsigned char)*p++;
- switch (c) {
- /* removes quotes, they should only be around the total name anyway */
- case '"':
- p[-1] = ' ';
- while (*p)
- if (*p == '"') {
- *p++ = ' ';
- break;
- } else {
- p++;
- }
- break;
- case '<':
- if (name == NULL)
- name = addr;
- addr = p;
- addr[-1] = 0;
- while (*p && *p != '>')
- p++;
- if (*p == 0)
- break;
- p++;
- /* falls through */
- case ',':
- p[-1] = 0;
- /* falls through */
- case 0:
- if (name)
- name = g_strstrip(name);
- addr = g_strstrip(addr);
- if (addr[0]) {
- d(printf("found address: '%s' <%s>\n", name, addr));
- camel_internet_address_add((CamelInternetAddress *)a, name, addr);
- }
- name = NULL;
- addr = p;
- break;
- }
- } while (c);
-
- g_free(buffer);
-
- return a->addresses->len - count;
-}
-
-static char *
-internet_format (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 *enc;
-
- if (i != 0)
- g_string_append(out, ", ");
-
- enc = camel_internet_address_format_address(addr->name, addr->address);
- g_string_sprintfa(out, "%s", enc);
- g_free(enc);
- }
-
- ret = out->str;
- g_string_free(out, FALSE);
-
- return ret;
-}
-
-static int internet_cat (CamelAddress *dest, const CamelAddress *source)
-{
- int i;
-
- g_assert(CAMEL_IS_INTERNET_ADDRESS(source));
-
- for (i=0;i<source->addresses->len;i++) {
- struct _address *addr = g_ptr_array_index(source->addresses, i);
- camel_internet_address_add((CamelInternetAddress *)dest, addr->name, addr->address);
- }
-
- return i;
-}
-
-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(camel_object_new(camel_internet_address_get_type()));
- return new;
-}
-
-/**
- * camel_internet_address_add:
- * @a: internet address object
- * @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_assert(CAMEL_IS_INTERNET_ADDRESS(a));
-
- 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: internet address object
- * @index: address's array 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_assert(CAMEL_IS_INTERNET_ADDRESS(a));
-
- if (index < 0 || 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_assert(CAMEL_IS_INTERNET_ADDRESS(a));
-
- 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_assert(CAMEL_IS_INTERNET_ADDRESS(a));
-
- 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;
-}
-
-/**
- * camel_internet_address_encode_address:
- * @len: The encoded length so far, of this line
- * @name:
- * @addr:
- *
- * Encode a single address ready for internet usage. Header folding
- * as per rfc 822 is also performed, based on the length in len.
- *
- * Return value: The encoded address.
- **/
-char *
-camel_internet_address_encode_address(int *inlen, const char *real, const char *addr)
-{
- char *name = header_encode_phrase(real);
- char *ret = NULL, *addra = NULL;
- int len = *inlen;
- GString *out = g_string_new("");
-
- g_assert(addr);
-
- if (name && name[0]) {
- if (strlen(name) + len > CAMEL_FOLD_SIZE) {
- char *folded = header_fold(name, len);
- char *last;
- g_string_append(out, folded);
- g_free(folded);
- last = strrchr(out->str, '\n');
- if (last)
- len = last-(out->str+out->len);
- else
- len = out->len;
- } else {
- g_string_append(out, name);
- len += strlen(name);
- }
- addr = addra = g_strdup_printf("<%s>", addr);
- }
-
- /* NOTE: Strictly speaking, we could and should split the
- * internal address up if we need to, on atom or specials
- * boundaries - however, to aid interoperability with mailers
- * that will probably not handle this case, we will just move
- * the whole address to its own line */
- if (strlen(addr) + len > CAMEL_FOLD_SIZE) {
- g_string_append(out, "\n\t");
- g_string_append(out, addr);
- len = strlen(addr)+1;
- } else {
- g_string_append(out, addr);
- len += strlen(addr);
- }
-
- *inlen = len;
-#if 0
- if (name && name[0])
- ret = g_strdup_printf("%s <%s>", name, addr);
- else
- ret = g_strdup_printf("%s", addr);
-#endif
- g_free(name);
- g_free(addra);
-
- ret = out->str;
- g_string_free(out, FALSE);
-
- return ret;
-}
-
-/**
- * camel_internet_address_format_address:
- * @name: A name, quotes may be stripped from it.
- * @addr: Assumes a valid rfc822 email address.
- *
- * Function to format a single address, suitable for display.
- *
- * Return value:
- **/
-char *
-camel_internet_address_format_address(const char *name, const char *addr)
-{
- char *ret = NULL;
-
- g_assert(addr);
-
- if (name && name[0]) {
- const char *p = name;
- char *o, c;
-
- while ((c = *p++)) {
- if (c == '\"' || c == ',') {
- o = ret = g_malloc(strlen(name)+3+strlen(addr)+3 + 1);
- p = name;
- *o++ = '\"';
- while ((c = *p++))
- if (c != '\"')
- *o++ = c;
- *o++ = '\"';
- sprintf(o, " <%s>", addr);
- d(printf("encoded '%s' => '%s'\n", name, ret));
- return ret;
- }
- }
- ret = g_strdup_printf("%s <%s>", name, addr);
- } else
- ret = g_strdup(addr);
-
- return ret;
-}
diff --git a/camel/camel-internet-address.h b/camel/camel-internet-address.h
deleted file mode 100644
index 7afd74fad9..0000000000
--- a/camel/camel-internet-address.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_INTERNET_ADDRESS_H
-#define _CAMEL_INTERNET_ADDRESS_H
-
-#include <camel/camel-address.h>
-
-#define CAMEL_INTERNET_ADDRESS(obj) CAMEL_CHECK_CAST (obj, camel_internet_address_get_type (), CamelInternetAddress)
-#define CAMEL_INTERNET_ADDRESS_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_internet_address_get_type (), CamelInternetAddressClass)
-#define CAMEL_IS_INTERNET_ADDRESS(obj) CAMEL_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 **);
-
-/* utility functions, for network/display formatting */
-char * camel_internet_address_encode_address(int *len, const char *name, const char *addr);
-char * camel_internet_address_format_address(const char *real, const char *addr);
-
-#endif /* ! _CAMEL_INTERNET_ADDRESS_H */
diff --git a/camel/camel-lock.c b/camel/camel-lock.c
deleted file mode 100644
index f1a43a3543..0000000000
--- a/camel/camel-lock.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Author: Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code (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 <stdlib.h>
-#include <string.h>
-
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#include <time.h>
-
-#ifdef USE_DOT
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#endif
-
-#ifdef USE_FCNTL
-#include <unistd.h>
-#include <fcntl.h>
-#endif
-
-#ifdef USE_FLOCK
-#include <sys/file.h>
-#endif
-
-#include "camel-lock.h"
-
-/* dunno where this fucking thing is got from */
-#define _(x) (x)
-
-#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
-
-/**
- * camel_lock_dot:
- * @path:
- * @ex:
- *
- * Create an exclusive lock using .lock semantics.
- * All locks are equivalent to write locks (exclusive).
- *
- * Return value: -1 on error, sets @ex appropriately.
- **/
-int
-camel_lock_dot(const char *path, CamelException *ex)
-{
-#ifdef USE_DOT
- char *locktmp, *lock;
- int retry = 0;
- int fdtmp;
- struct stat st;
-
- /* TODO: Is there a reliable way to refresh the lock, if we're still busy with it?
- Does it matter? We will normally also use fcntl too ... */
-
- /* use alloca, save cleaning up afterwards */
- lock = alloca(strlen(path) + strlen(".lock") + 1);
- sprintf(lock, "%s.lock", path);
- locktmp = alloca(strlen(path) + strlen("XXXXXX") + 1);
-
-#ifndef HAVE_MKSTEMP
- sprintf(locktmp, "%sXXXXXX", path);
- if (mktemp(locktmp) == NULL) {
- /* well, this is really only a programatic error */
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create lock file for %s: %s"), path, strerror(errno));
- return -1;
- }
-#endif
-
- while (retry < CAMEL_LOCK_DOT_RETRY) {
-
- d(printf("trying to lock '%s', attempt %d\n", lock, retry));
-
- if (retry > 0)
- sleep(CAMEL_LOCK_DOT_DELAY);
-
-#ifdef HAVE_MKSTEMP
- sprintf(locktmp, "%sXXXXXX", path);
- fdtmp = mkstemp(locktmp);
-#else
- fdtmp = open(locktmp, O_RDWR|O_CREAT|O_EXCL, 0600);
-#endif
- if (fdtmp == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create lock file for %s: %s"), path, strerror(errno));
- return -1;
- }
- close(fdtmp);
-
- /* apparently return code from link can be unreliable for nfs (see link(2)), so we ignore it */
- link(locktmp, lock);
-
- /* but we check stat instead (again, see link(2)) */
- if (stat(locktmp, &st) == -1) {
- d(printf("Out lock file %s vanished!?\n", locktmp));
-
- /* well that was unexpected, try cleanup/retry */
- unlink(locktmp);
- unlink(lock);
- } else {
- d(printf("tmp lock created, link count is %d\n", st.st_nlink));
-
- unlink(locktmp);
-
- /* if we had 2 links, we have created the .lock, return ok, otherwise we need to keep trying */
- if (st.st_nlink == 2)
- return 0;
- }
-
- /* check for stale lock, kill it */
- if (stat(lock, &st) == 0) {
- time_t now = time(0);
- (printf("There is an existing lock %ld seconds old\n", now-st.st_ctime));
- if (st.st_ctime < now - CAMEL_LOCK_DOT_STALE) {
- d(printf("Removing it now\n"));
- unlink(lock);
- }
- }
-
- retry++;
- }
-
- d(printf("failed to get lock after %d retries\n", retry));
-
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Timed out trying to get lock file on %s. Try again later."), path);
- return -1;
-#else /* ! USE_DOT */
- return 0;
-#endif
-}
-
-/**
- * camel_unlock_dot:
- * @path:
- *
- * Attempt to unlock a .lock lock.
- **/
-void
-camel_unlock_dot(const char *path)
-{
-#ifdef USE_DOT
- char *lock;
-
- lock = alloca(strlen(path) + strlen(".lock") + 1);
- sprintf(lock, "%s.lock", path);
- d(printf("unlocking %s\n", lock));
- (void)unlink(lock);
-#endif
-}
-
-/**
- * camel_lock_fcntl:
- * @fd:
- * @type:
- * @ex:
- *
- * Create a lock using fcntl(2).
- *
- * @type is CAMEL_LOCK_WRITE or CAMEL_LOCK_READ,
- * to create exclusive or shared read locks
- *
- * Return value: -1 on error.
- **/
-int
-camel_lock_fcntl(int fd, CamelLockType type, CamelException *ex)
-{
-#ifdef USE_FCNTL
- struct flock lock;
-
- d(printf("fcntl locking %d\n", fd));
-
- memset(&lock, 0, sizeof(lock));
- lock.l_type = type==CAMEL_LOCK_READ?F_RDLCK:F_WRLCK;
- if (fcntl(fd, F_SETLK, &lock) == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to get lock using fcntl(2): %s"), strerror(errno));
- return -1;
- }
-#endif
- return 0;
-}
-
-/**
- * camel_unlock_fcntl:
- * @fd:
- *
- * Unlock an fcntl lock.
- **/
-void
-camel_unlock_fcntl(int fd)
-{
-#ifdef USE_FCNTL
- struct flock lock;
-
- d(printf("fcntl unlocking %d\n", fd));
-
- memset(&lock, 0, sizeof(lock));
- lock.l_type = F_UNLCK;
- fcntl(fd, F_SETLK, &lock);
-#endif
-}
-
-/**
- * camel_lock_flock:
- * @fd:
- * @type:
- * @ex:
- *
- * Create a lock using flock(2).
- *
- * @type is CAMEL_LOCK_WRITE or CAMEL_LOCK_READ,
- * to create exclusive or shared read locks
- *
- * Return value: -1 on error.
- **/
-int
-camel_lock_flock(int fd, CamelLockType type, CamelException *ex)
-{
-#ifdef USE_FLOCK
- int op;
-
- d(printf("flock locking %d\n", fd));
-
- if (type == CAMEL_LOCK_READ)
- op = LOCK_SH|LOCK_NB;
- else
- op = LOCK_EX|LOCK_NB;
-
- if (flock(fd, op) == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to get lock using flock(2): %s"), strerror(errno));
- return -1;
- }
-#endif
- return 0;
-}
-
-/**
- * camel_unlock_flock:
- * @fd:
- *
- * Unlock an flock lock.
- **/
-void
-camel_unlock_flock(int fd)
-{
-#ifdef USE_FLOCK
- d(printf("flock unlocking %d\n", fd));
-
- (void)flock(fd, LOCK_UN);
-#endif
-}
-
-/**
- * camel_lock_folder:
- * @path: Path to the file to lock (used for .locking only).
- * @fd: Open file descriptor of the right type to lock.
- * @type: Type of lock, CAMEL_LOCK_READ or CAMEL_LOCK_WRITE.
- * @ex:
- *
- * Attempt to lock a folder, multiple attempts will be made using all
- * locking strategies available.
- *
- * Return value: -1 on error, @ex will describe the locking system that failed.
- **/
-int
-camel_lock_folder(const char *path, int fd, CamelLockType type, CamelException *ex)
-{
- int retry = 0;
-
- while (retry < CAMEL_LOCK_RETRY) {
- if (retry > 0)
- sleep(CAMEL_LOCK_DELAY);
-
- camel_exception_clear(ex);
-
- if (camel_lock_fcntl(fd, type, ex) == 0) {
- if (camel_lock_flock(fd, type, ex) == 0) {
- if (camel_lock_dot(path, ex) == 0)
- return 0;
- camel_unlock_flock(fd);
- }
- camel_unlock_fcntl(fd);
- }
- retry++;
- }
-
- return -1;
-}
-
-/**
- * camel_unlock_folder:
- * @path: Filename of folder.
- * @fd: Open descrptor on which locks were placed.
- *
- * Free a lock on a folder.
- **/
-void
-camel_unlock_folder(const char *path, int fd)
-{
- camel_unlock_dot(path);
- camel_unlock_flock(fd);
- camel_unlock_fcntl(fd);
-}
-
-#if 0
-int main(int argc, char **argv)
-{
- CamelException *ex;
- int fd1, fd2;
-
- ex = camel_exception_new();
-
-#if 0
- if (camel_lock_dot("mylock", ex) == 0) {
- if (camel_lock_dot("mylock", ex) == 0) {
- printf("Got lock twice?\n");
- } else {
- printf("failed to get lock 2: %s\n", camel_exception_get_description(ex));
- }
- camel_unlock_dot("mylock");
- } else {
- printf("failed to get lock 1: %s\n", camel_exception_get_description(ex));
- }
-
- camel_exception_clear(ex);
-#endif
-
- fd1 = open("mylock", O_RDWR);
- fd2 = open("mylock", O_RDWR);
-
- if (camel_lock_fcntl(fd1, CAMEL_LOCK_WRITE, ex) == 0) {
- printf("got fcntl write lock once\n");
- sleep(5);
- if (camel_lock_fcntl(fd2, CAMEL_LOCK_WRITE, ex) == 0) {
- printf("got fcntl write lock twice!\n");
- } else {
- printf("failed to get write lock: %s\n", camel_exception_get_description(ex));
- }
-
- camel_exception_clear(ex);
-
- if (camel_lock_fcntl(fd2, CAMEL_LOCK_READ, ex) == 0) {
- printf("got fcntl read lock as well?\n");
- camel_unlock_fcntl(fd2);
- } else {
- printf("failed to get read lock: %s\n", camel_exception_get_description(ex));
- }
-
- camel_exception_clear(ex);
- camel_unlock_fcntl(fd1);
- } else {
- printf("failed to get write lock at all: %s\n", camel_exception_get_description(ex));
- }
-
- if (camel_lock_fcntl(fd1, CAMEL_LOCK_READ, ex) == 0) {
- printf("got fcntl read lock once\n");
- sleep(5);
- if (camel_lock_fcntl(fd2, CAMEL_LOCK_WRITE, ex) == 0) {
- printf("got fcntl write lock too?!\n");
- } else {
- printf("failed to get write lock: %s\n", camel_exception_get_description(ex));
- }
-
- camel_exception_clear(ex);
-
- if (camel_lock_fcntl(fd2, CAMEL_LOCK_READ, ex) == 0) {
- printf("got fcntl read lock twice\n");
- camel_unlock_fcntl(fd2);
- } else {
- printf("failed to get read lock: %s\n", camel_exception_get_description(ex));
- }
-
- camel_exception_clear(ex);
- camel_unlock_fcntl(fd1);
- }
-
- close(fd1);
- close(fd2);
-
- return 0;
-}
-#endif
diff --git a/camel/camel-lock.h b/camel/camel-lock.h
deleted file mode 100644
index 37da6ea135..0000000000
--- a/camel/camel-lock.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Author: Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code (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_LOCK_H
-#define _CAMEL_LOCK_H
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-exception.h>
-
-/* for .lock locking, retry, delay and stale counts */
-#define CAMEL_LOCK_DOT_RETRY (5) /* number of times to retry lock */
-#define CAMEL_LOCK_DOT_DELAY (2) /* delay between locking retries */
-#define CAMEL_LOCK_DOT_STALE (60) /* seconds before a lock becomes stale */
-
-/* for locking folders, retry/interretry delay */
-#define CAMEL_LOCK_RETRY (5) /* number of times to retry lock */
-#define CAMEL_LOCK_DELAY (2) /* delay between locking retries */
-
-typedef enum {
- CAMEL_LOCK_READ,
- CAMEL_LOCK_WRITE,
-} CamelLockType;
-
-/* specific locking strategies */
-int camel_lock_dot(const char *path, CamelException *ex);
-int camel_lock_fcntl(int fd, CamelLockType type, CamelException *ex);
-int camel_lock_flock(int fd, CamelLockType type, CamelException *ex);
-
-void camel_unlock_dot(const char *path);
-void camel_unlock_fcntl(int fd);
-void camel_unlock_flock(int fd);
-
-/* lock a folder in a standard way */
-int camel_lock_folder(const char *path, int fd, CamelLockType type, CamelException *ex);
-void camel_unlock_folder(const char *path, int fd);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* !_CAMEL_LOCK_H */
diff --git a/camel/camel-medium.c b/camel/camel-medium.c
deleted file mode 100644
index 1854cf1891..0000000000
--- a/camel/camel-medium.c
+++ /dev/null
@@ -1,267 +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 "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 (CAMEL_OBJECT_GET_CLASS(so))
-
-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
-camel_medium_class_init (CamelMediumClass *camel_medium_class)
-{
- /*
- * CamelDataWrapperClass *camel_data_wrapper_class =
- * CAMEL_DATA_WRAPPER_CLASS (camel_medium_class);
- */
-
- parent_class = CAMEL_DATA_WRAPPER_CLASS (camel_type_get_global_classfuncs (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;
-}
-
-static void
-camel_medium_init (gpointer object, gpointer klass)
-{
- CamelMedium *camel_medium = CAMEL_MEDIUM (object);
-
- camel_medium->content = NULL;
-}
-
-static void
-camel_medium_finalize (CamelObject *object)
-{
- CamelMedium *medium = CAMEL_MEDIUM (object);
-
- if (medium->content)
- camel_object_unref (CAMEL_OBJECT (medium->content));
-}
-
-
-CamelType
-camel_medium_get_type (void)
-{
- static CamelType camel_medium_type = CAMEL_INVALID_TYPE;
-
- if (camel_medium_type == CAMEL_INVALID_TYPE) {
- camel_medium_type = camel_type_register (CAMEL_DATA_WRAPPER_TYPE, "medium",
- sizeof (CamelMedium),
- sizeof (CamelMediumClass),
- (CamelObjectClassInitFunc) camel_medium_class_init,
- NULL,
- (CamelObjectInitFunc) camel_medium_init,
- (CamelObjectFinalizeFunc) camel_medium_finalize);
- }
-
- return camel_medium_type;
-}
-
-static void
-add_header (CamelMedium *medium, const gchar *header_name,
- const void *header_value)
-{
- g_warning("No %s::add_header implemented, adding %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), 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 char *header_name, const void *header_value)
-{
- g_warning("No %s::set_header implemented, setting %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), 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. Setting a %NULL header can be used to remove
- * the header also.
- **/
-void
-camel_medium_set_header (CamelMedium *medium, const char *header_name, const void *header_value)
-{
- g_return_if_fail (CAMEL_IS_MEDIUM (medium));
- g_return_if_fail (header_name != NULL);
-
- if (header_value == NULL)
- CM_CLASS(medium)->remove_header(medium, header_name);
- else
- CM_CLASS(medium)->set_header(medium, header_name, header_value);
-}
-
-static void
-remove_header(CamelMedium *medium, const char *header_name)
-{
- g_warning("No %s::remove_header implemented, removing %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), 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 char *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 char *header_name)
-{
- g_warning("No %s::get_header implemented, getting %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), 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 char *header_name)
-{
- g_return_val_if_fail (CAMEL_IS_MEDIUM (medium), NULL);
- g_return_val_if_fail (header_name != NULL, NULL);
-
-#ifndef NO_WARNINGS
-#warning No way to get multi-valued headers?
-#endif
-
- 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)
- camel_object_unref (CAMEL_OBJECT (medium->content));
- camel_object_ref (CAMEL_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 9ce548ba1d..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) (CAMEL_CHECK_CAST((obj), CAMEL_MEDIUM_TYPE, CamelMedium))
-#define CAMEL_MEDIUM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MEDIUM_TYPE, CamelMediumClass))
-#define CAMEL_IS_MEDIUM(o) (CAMEL_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 Camel function */
-CamelType 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 17e667c5ae..0000000000
--- a/camel/camel-mime-filter-basic.c
+++ /dev/null
@@ -1,222 +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 reset(CamelMimeFilter *mf);
-static void complete(CamelMimeFilter *mf, char *in, size_t len,
- size_t prespace, char **out,
- size_t *outlen, size_t *outprespace);
-static void filter(CamelMimeFilter *mf, char *in, size_t len,
- size_t prespace, char **out,
- size_t *outlen, size_t *outprespace);
-
-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;
-
-static void
-camel_mime_filter_basic_class_init (CamelMimeFilterBasicClass *klass)
-{
- CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass;
-
- camel_mime_filter_basic_parent = CAMEL_MIME_FILTER_CLASS(camel_type_get_global_classfuncs (camel_mime_filter_get_type ()));
-
- filter_class->reset = reset;
- filter_class->filter = filter;
- filter_class->complete = complete;
-}
-
-static void
-camel_mime_filter_basic_init (CamelMimeFilterBasic *obj)
-{
- obj->state = 0;
- obj->save = 0;
-}
-
-
-CamelType
-camel_mime_filter_basic_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_mime_filter_get_type (), "CamelMimeFilterBasic",
- sizeof (CamelMimeFilterBasic),
- sizeof (CamelMimeFilterBasicClass),
- (CamelObjectClassInitFunc) camel_mime_filter_basic_class_init,
- NULL,
- (CamelObjectInitFunc) camel_mime_filter_basic_init,
- NULL);
- }
-
- return type;
-}
-
-/* should this 'flush' outstanding state/data bytes? */
-static void
-reset(CamelMimeFilter *mf)
-{
- CamelMimeFilterBasic *f = (CamelMimeFilterBasic *)mf;
-
- switch(f->type) {
- case CAMEL_MIME_FILTER_BASIC_QP_ENC:
- f->state = -1;
- break;
- default:
- 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+6, FALSE);
- newlen = base64_encode_close(in, len, TRUE, mf->outbuf, &f->state, &f->save);
- g_assert(newlen <= len*2+6);
- break;
- case CAMEL_MIME_FILTER_BASIC_QP_ENC:
- /* *4 is definetly more than needed ... */
- camel_mime_filter_set_size(mf, len*4+4, FALSE);
- newlen = quoted_encode_close(in, len, mf->outbuf, &f->state, &f->save);
- g_assert(newlen <= len*4+4);
- 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);
- g_assert(newlen <= len);
- 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);
- g_assert(newlen <= len);
- 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+6, FALSE);
- newlen = base64_encode_step(in, len, TRUE, mf->outbuf, &f->state, &f->save);
- g_assert(newlen <= len*2+6);
- break;
- case CAMEL_MIME_FILTER_BASIC_QP_ENC:
- /* *4 is overly conservative, but will do */
- camel_mime_filter_set_size(mf, len*4+4, FALSE);
- newlen = quoted_encode_step(in, len, mf->outbuf, &f->state, &f->save);
- g_assert(newlen <= len*4+4);
- 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);
- g_assert(newlen <= len);
- 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);
- g_assert(newlen <= len);
- 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;
-}
-
-/**
- * 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 ( camel_object_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;
- }
- camel_mime_filter_reset((CamelMimeFilter *)new);
- return new;
-}
-
diff --git a/camel/camel-mime-filter-basic.h b/camel/camel-mime-filter-basic.h
deleted file mode 100644
index f11b7da479..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) CAMEL_CHECK_CAST (obj, camel_mime_filter_basic_get_type (), CamelMimeFilterBasic)
-#define CAMEL_MIME_FILTER_BASIC_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mime_filter_basic_get_type (), CamelMimeFilterBasicClass)
-#define CAMEL_IS_MIME_FILTER_BASIC(obj) CAMEL_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-bestenc.c b/camel/camel-mime-filter-bestenc.c
deleted file mode 100644
index 18ee7039f0..0000000000
--- a/camel/camel-mime-filter-bestenc.c
+++ /dev/null
@@ -1,289 +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-bestenc.h"
-
-#include <string.h>
-
-static void camel_mime_filter_bestenc_class_init (CamelMimeFilterBestencClass *klass);
-static void camel_mime_filter_bestenc_init (CamelMimeFilter *obj);
-
-static CamelMimeFilterClass *camel_mime_filter_bestenc_parent;
-
-CamelType
-camel_mime_filter_bestenc_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_mime_filter_get_type (), "CamelMimeFilterBestenc",
- sizeof (CamelMimeFilterBestenc),
- sizeof (CamelMimeFilterBestencClass),
- (CamelObjectClassInitFunc) camel_mime_filter_bestenc_class_init,
- NULL,
- (CamelObjectInitFunc) camel_mime_filter_bestenc_init,
- NULL);
- }
-
- return type;
-}
-
-static void
-reset(CamelMimeFilter *mf)
-{
- CamelMimeFilterBestenc *f = (CamelMimeFilterBestenc *)mf;
-
- f->count0 = 0;
- f->count8 = 0;
- f->countline = 0;
- f->total = 0;
- f->lastc = ~0;
- f->crlfnoorder = FALSE;
- f->fromcount = 0;
- f->hadfrom = FALSE;
- f->startofline = TRUE;
-
- camel_charset_init(&f->charset);
-}
-
-static void
-filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlen, size_t *outprespace)
-{
- CamelMimeFilterBestenc *f = (CamelMimeFilterBestenc *)mf;
- register unsigned char *p, *pend;
-
- if (len == 0)
- goto donothing;
-
- if (f->flags & CAMEL_BESTENC_GET_ENCODING) {
- register unsigned int /* hopefully reg's are assinged in the order they appear? */
- c,
- lastc=f->lastc,
- countline=f->countline,
- count0=f->count0,
- count8 = f->count8;
-
- /* Check ^From lines first call, or have the start of a new line waiting? */
- if ((f->flags & CAMEL_BESTENC_NO_FROM) && !f->hadfrom
- && (f->fromcount > 0 || f->startofline)) {
- if (f->fromcount + len >=5) {
- memcpy(&f->fromsave[f->fromcount], in, 5-f->fromcount);
- f->hadfrom = strncmp(f->fromsave, "From ", 5) == 0;
- f->fromcount = 0;
- } else {
- memcpy(&f->fromsave[f->fromcount], in, len);
- f->fromcount += len;
- }
- }
-
- f->startofline = FALSE;
-
- /* See rfc2045 section 2 for definitions of 7bit/8bit/binary */
- p = in;
- pend = p + len;
- while (p<pend) {
- c = *p++;
- /* check for 8 bit characters */
- if (c & 0x80)
- count8++;
-
- /* check for nul's */
- if (c == 0)
- count0++;
-
- /* check for wild '\r's in a unix format stream */
- if (c == '\r' && (f->flags & CAMEL_BESTENC_LF_IS_CRLF)) {
- f->crlfnoorder = TRUE;
- }
-
- /* check for end of line */
- if (c == '\n') {
- /* check for wild '\n's in canonical format stream */
- if (lastc == '\r' || (f->flags & CAMEL_BESTENC_LF_IS_CRLF)) {
- if (countline > f->maxline)
- f->maxline = countline;
- countline = 0;
-
- /* Check for "^From " lines */
- if ((f->flags & CAMEL_BESTENC_NO_FROM) && !f->hadfrom) {
- if (pend-p >= 5) {
- f->hadfrom = strncmp(p, "From ", 5) == 0;
- } else if (pend-p == 0) {
- f->startofline = TRUE;
- } else {
- f->fromcount = pend-p;
- memcpy(f->fromsave, p, pend-p);
- }
- }
- } else {
- f->crlfnoorder = TRUE;
- }
- } else {
- countline++;
- }
- lastc = c;
- }
- f->count8 = count8;
- f->count0 = count0;
- f->countline = countline;
- f->lastc = lastc;
- }
-
- f->total += len;
-
- if (f->flags & CAMEL_BESTENC_GET_CHARSET)
- camel_charset_step(&f->charset, in, len);
-
-donothing:
- *out = in;
- *outlen = len;
- *outprespace = prespace;
-}
-
-static void
-complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlen, size_t *outprespace)
-{
- CamelMimeFilterBestenc *f = (CamelMimeFilterBestenc *)mf;
-
- filter(mf, in, len, prespace, out, outlen, outprespace);
-
- if (f->countline > f->maxline)
- f->maxline = f->countline;
- f->countline = 0;
-}
-
-static void
-camel_mime_filter_bestenc_class_init (CamelMimeFilterBestencClass *klass)
-{
- CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass;
-
- camel_mime_filter_bestenc_parent = (CamelMimeFilterClass *)(camel_type_get_global_classfuncs (camel_mime_filter_get_type ()));
-
- filter_class->reset = reset;
- filter_class->filter = filter;
- filter_class->complete = complete;
-}
-
-static void
-camel_mime_filter_bestenc_init (CamelMimeFilter *f)
-{
- reset(f);
-}
-
-/**
- * camel_mime_filter_bestenc_new:
- * @flags: A bitmask of data required.
- *
- * Create a new CamelMimeFilterBestenc object.
- *
- * Return value:
- **/
-CamelMimeFilterBestenc *
-camel_mime_filter_bestenc_new (unsigned int flags)
-{
- CamelMimeFilterBestenc *new = (CamelMimeFilterBestenc *)camel_object_new(camel_mime_filter_bestenc_get_type());
- new->flags = flags;
- return new;
-}
-
-/**
- * camel_mime_filter_bestenc_get_best_encoding:
- * @f:
- * @required: maximum level of output encoding allowed.
- *
- * Return the best encoding, given specific constraints, that can be used to
- * encode a stream of bytes.
- *
- * Return value:
- **/
-CamelMimePartEncodingType
-camel_mime_filter_bestenc_get_best_encoding(CamelMimeFilterBestenc *f, CamelBestencEncoding required)
-{
- CamelMimePartEncodingType bestenc;
-
-#if 0
- printf("count0 = %d, count8 = %d, total = %d\n", f->count0, f->count8, f->total);
- printf("maxline = %d, crlfnoorder = %s\n", f->maxline, f->crlfnoorder?"TRUE":"FALSE");
- printf(" %d%% require encoding?\n", (f->count0+f->count8)*100 / f->total);
-#endif
-
- /* if we're not allowed to have From lines and we had one, use an encoding
- that will never let it show. Unfortunately only base64 can at present,
- although qp could be modified to allow it too */
- if ((f->flags & CAMEL_BESTENC_NO_FROM) && f->hadfrom)
- return CAMEL_MIME_PART_ENCODING_BASE64;
-
- /* if we need to encode, see how we do it */
- if (required == CAMEL_BESTENC_BINARY)
- bestenc = CAMEL_MIME_PART_ENCODING_BINARY;
- else if (f->count8 + f->count0 >= (f->total*17/100))
- bestenc = CAMEL_MIME_PART_ENCODING_BASE64;
- else
- bestenc = CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE;
-
- /* if we have nocrlf order, or long lines, we need to encode always */
- if (f->crlfnoorder || f->maxline >= 998)
- return bestenc;
-
- /* if we have no 8 bit chars or nul's, we can just use 7 bit */
- if (f->count8 + f->count0 == 0)
- return CAMEL_MIME_PART_ENCODING_7BIT;
-
- /* otherwise, we see if we can use 8 bit, or not */
- switch(required) {
- case CAMEL_BESTENC_7BIT:
- return bestenc;
- case CAMEL_BESTENC_8BIT:
- case CAMEL_BESTENC_BINARY:
- if (f->count0 == 0)
- return CAMEL_MIME_PART_ENCODING_8BIT;
- else
- return bestenc;
- }
-
- return CAMEL_MIME_PART_ENCODING_DEFAULT;
-}
-
-/**
- * camel_mime_filter_bestenc_get_best_charset:
- * @f:
- *
- * Gets the best charset that can be used to contain this content.
- *
- * Return value:
- **/
-const char *
-camel_mime_filter_bestenc_get_best_charset(CamelMimeFilterBestenc *f)
-{
- return camel_charset_best_name(&f->charset);
-}
-
-/**
- * camel_mime_filter_bestenc_set_flags:
- * @f:
- * @flags:
- *
- * Set the flags for subsequent operations.
- **/
-void
-camel_mime_filter_bestenc_set_flags(CamelMimeFilterBestenc *f, unsigned int flags)
-{
- f->flags = flags;
-}
diff --git a/camel/camel-mime-filter-bestenc.h b/camel/camel-mime-filter-bestenc.h
deleted file mode 100644
index de8caec191..0000000000
--- a/camel/camel-mime-filter-bestenc.h
+++ /dev/null
@@ -1,88 +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_BESTENC_H
-#define _CAMEL_MIME_FILTER_BESTENC_H
-
-#include <camel/camel-mime-filter.h>
-#include <camel/camel-mime-part.h>
-#include <camel/camel-charset-map.h>
-
-#define CAMEL_MIME_FILTER_BESTENC(obj) CAMEL_CHECK_CAST (obj, camel_mime_filter_bestenc_get_type (), CamelMimeFilterBestenc)
-#define CAMEL_MIME_FILTER_BESTENC_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mime_filter_bestenc_get_type (), CamelMimeFilterBestencClass)
-#define CAMEL_IS_MIME_FILTER_BESTENC(obj) CAMEL_CHECK_TYPE (obj, camel_mime_filter_bestenc_get_type ())
-
-typedef struct _CamelMimeFilterBestencClass CamelMimeFilterBestencClass;
-
-enum _CamelBestencRequired {
- CAMEL_BESTENC_GET_ENCODING = 1<<0,
- CAMEL_BESTENC_GET_CHARSET = 1<<1,
-
- /* do we treat 'lf' as if it were crlf? */
- CAMEL_BESTENC_LF_IS_CRLF = 1<<8,
- /* do we not allow "From " to appear at the start of a line in any part? */
- CAMEL_BESTENC_NO_FROM = 1<<9,
-};
-typedef enum _CamelBestencRequired CamelBestencRequired;
-
-enum _CamelBestencEncoding {
- CAMEL_BESTENC_7BIT,
- CAMEL_BESTENC_8BIT,
- CAMEL_BESTENC_BINARY,
-};
-typedef enum _CamelBestencEncoding CamelBestencEncoding;
-
-struct _CamelMimeFilterBestenc {
- CamelMimeFilter parent;
-
- unsigned int flags; /* our creation flags, see above */
-
- unsigned int count0; /* count of NUL characters */
- unsigned int count8; /* count of 8 bit characters */
- unsigned int total; /* total characters read */
-
- unsigned int lastc; /* the last character read */
- int crlfnoorder; /* if crlf's occured where they shouldn't have */
-
- int startofline; /* are we at the start of a new line? */
-
- int fromcount;
- char fromsave[6]; /* save a few characters if we found an \nF near the end of the buffer */
- int hadfrom; /* did we encounter a "\nFrom " in the data? */
-
- unsigned int countline; /* current count of characters on a given line */
- unsigned int maxline; /* max length of any line */
-
- CamelCharset charset; /* used to determine the best charset to use */
-};
-
-struct _CamelMimeFilterBestencClass {
- CamelMimeFilterClass parent_class;
-};
-
-guint camel_mime_filter_bestenc_get_type (void);
-CamelMimeFilterBestenc *camel_mime_filter_bestenc_new (unsigned int flags);
-
-
-CamelMimePartEncodingType camel_mime_filter_bestenc_get_best_encoding(CamelMimeFilterBestenc *f, CamelBestencEncoding required);
-const char * camel_mime_filter_bestenc_get_best_charset(CamelMimeFilterBestenc *f);
-void camel_mime_filter_bestenc_set_flags(CamelMimeFilterBestenc *f, unsigned int flags);
-
-#endif /* ! _CAMEL_MIME_FILTER_BESTENC_H */
diff --git a/camel/camel-mime-filter-charset.c b/camel/camel-mime-filter-charset.c
deleted file mode 100644
index a45a318367..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 <iconv.h>
-
-#include <string.h>
-#include <errno.h>
-
-#include "camel-mime-filter-charset.h"
-
-#define d(x)
-
-static void camel_mime_filter_charset_class_init (CamelMimeFilterCharsetClass *klass);
-static void camel_mime_filter_charset_init (CamelMimeFilterCharset *obj);
-static void camel_mime_filter_charset_finalize (CamelObject *o);
-
-static CamelMimeFilterClass *camel_mime_filter_charset_parent;
-
-CamelType
-camel_mime_filter_charset_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_mime_filter_get_type (), "CamelMimeFilterCharset",
- sizeof (CamelMimeFilterCharset),
- sizeof (CamelMimeFilterCharsetClass),
- (CamelObjectClassInitFunc) camel_mime_filter_charset_class_init,
- NULL,
- (CamelObjectInitFunc) camel_mime_filter_charset_init,
- (CamelObjectFinalizeFunc) camel_mime_filter_charset_finalize);
- }
-
- return type;
-}
-
-static void
-camel_mime_filter_charset_finalize(CamelObject *o)
-{
- CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)o;
-
- g_free(f->from);
- g_free(f->to);
- if (f->ic != (iconv_t)-1) {
- iconv_close(f->ic);
- f->ic = (iconv_t) -1;
- }
-}
-
-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 != (iconv_t) -1) {
- buffer = buf;
- 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;
- char *outbuf;
- int inlen, outlen;
-
- if (f->ic == (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+16, FALSE);
- inbuf = in;
- inlen = len;
- outbuf = mf->outbuf;
- outlen = mf->outsize;
-
- /* temporary fix to find another bug somewhere */
- d(memset(outbuf, 0, outlen));
-
- if (inlen>0) {
- converted = 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 = iconv(f->ic, NULL, 0, &outbuf, &outlen);
- if (converted == -1) {
- g_warning("Conversion failed to complete: %s", strerror(errno));
- }
-
- /* debugging assertion - check for NUL's in output */
- d({
- int i;
-
- for (i=0;i<(mf->outsize - outlen);i++) {
- g_assert(mf->outbuf[i]);
- }
- });
-
- *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;
- char *outbuf;
- int inlen, outlen;
-
- if (f->ic == (iconv_t) -1) {
- goto donothing;
- }
-
- /* FIXME: there's probably a safer way to size this ...? */
- camel_mime_filter_set_size(mf, len*5+16, FALSE);
- inbuf = in;
- inlen = len;
- outbuf = mf->outbuf;
- outlen = mf->outsize;
- converted = 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)
-{
- CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass;
-
- camel_mime_filter_charset_parent = CAMEL_MIME_FILTER_CLASS (camel_type_get_global_classfuncs (camel_mime_filter_get_type ()));
-
- filter_class->reset = reset;
- filter_class->filter = filter;
- filter_class->complete = complete;
-}
-
-static void
-camel_mime_filter_charset_init (CamelMimeFilterCharset *obj)
-{
- obj->ic = (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 ( camel_object_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 ( camel_object_new (camel_mime_filter_charset_get_type ()));
-
- new->ic = iconv_open(to_charset, from_charset);
- if (new->ic == (iconv_t) -1) {
- g_warning("Cannot create charset conversion from %s to %s: %s", from_charset, to_charset, strerror(errno));
- camel_object_unref((CamelObject *)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 ba1586ca7a..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) CAMEL_CHECK_CAST (obj, camel_mime_filter_charset_get_type (), CamelMimeFilterCharset)
-#define CAMEL_MIME_FILTER_CHARSET_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mime_filter_charset_get_type (), CamelMimeFilterCharsetClass)
-#define CAMEL_IS_MIME_FILTER_CHARSET(obj) CAMEL_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-crlf.c b/camel/camel-mime-filter-crlf.c
deleted file mode 100644
index 71a3e8bace..0000000000
--- a/camel/camel-mime-filter-crlf.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * Authors: Dan Winship <danw@helixcode.com>
- * Jeffrey Stedfast <fejj@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-crlf.h"
-
-static void filter (CamelMimeFilter *f, char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace);
-static void complete (CamelMimeFilter *f, char *in, size_t len,
- size_t prespace, char **out, size_t *outlen,
- size_t *outprespace);
-static void reset (CamelMimeFilter *f);
-
-
-static void
-camel_mime_filter_crlf_class_init (CamelMimeFilterCRLFClass *klass)
-{
- CamelMimeFilterClass *mime_filter_class =
- (CamelMimeFilterClass *) klass;
-
- mime_filter_class->filter = filter;
- mime_filter_class->complete = complete;
- mime_filter_class->reset = reset;
-}
-
-CamelType
-camel_mime_filter_crlf_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_mime_filter_get_type(), "CamelMimeFilterCRLF",
- sizeof (CamelMimeFilterCRLF),
- sizeof (CamelMimeFilterCRLFClass),
- (CamelObjectClassInitFunc) camel_mime_filter_crlf_class_init,
- NULL,
- NULL,
- NULL);
- }
-
- return type;
-}
-
-static void
-filter (CamelMimeFilter *f, char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace)
-{
- CamelMimeFilterCRLF *crlf = (CamelMimeFilterCRLF *)f;
- gboolean do_dots;
- char *p, *q;
-
- do_dots = crlf->mode == CAMEL_MIME_FILTER_CRLF_MODE_CRLF_DOTS;
-
- if (crlf->direction == CAMEL_MIME_FILTER_CRLF_ENCODE) {
- camel_mime_filter_set_size (f, 3 * len, FALSE);
-
- p = in;
- q = f->outbuf;
- while (p < in + len) {
- if (*p == '\n')
- *q++ = '\r';
- else
- if (do_dots && *(p - 1) == '\n' && *p == '.')
- *q++ = '.';
- *q++ = *p++;
- }
- } else {
- camel_mime_filter_set_size (f, len, FALSE);
-
- p = in;
- q = f->outbuf;
- while (p < in + len) {
- if (*p == '\r') {
- crlf->saw_cr = TRUE;
- } else {
- if (crlf->saw_cr) {
- if (*p != '\n')
- *q++ = '\r';
- crlf->saw_cr = FALSE;
- }
- *q++ = *p;
- }
-
- if (do_dots) {
- if (*p == '.' && *(p - 1) == '\n') {
- crlf->saw_dot = TRUE;
- } else {
- if (crlf->saw_dot) {
- if (*p == '.')
- p++;
- crlf->saw_dot = FALSE;
- }
- *q++ = *p;
- }
- }
-
- p++;
- }
- }
-
- *out = f->outbuf;
- *outlen = q - f->outbuf;
- *outprespace = f->outpre;
-}
-
-static void
-complete (CamelMimeFilter *f, char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace)
-{
- if (len)
- filter (f, in, len, prespace, out, outlen, outprespace);
-}
-
-static void
-reset (CamelMimeFilter *f)
-{
- CamelMimeFilterCRLF *crlf = (CamelMimeFilterCRLF *)f;
-
- crlf->saw_cr = FALSE;
-}
-
-CamelMimeFilter *
-camel_mime_filter_crlf_new (CamelMimeFilterCRLFDirection direction, CamelMimeFilterCRLFMode mode)
-{
- CamelMimeFilterCRLF *crlf = CAMEL_MIME_FILTER_CRLF(camel_object_new (CAMEL_MIME_FILTER_CRLF_TYPE));
-
- crlf->direction = direction;
- crlf->mode = mode;
- crlf->saw_cr = FALSE;
-
- return (CamelMimeFilter *)crlf;
-}
diff --git a/camel/camel-mime-filter-crlf.h b/camel/camel-mime-filter-crlf.h
deleted file mode 100644
index 6ba109d154..0000000000
--- a/camel/camel-mime-filter-crlf.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Dan Winship <danw@helixcode.com>
- * Jeffrey Stedfast <fejj@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_CRLF_H
-#define _CAMEL_MIME_FILTER_CRLF_H
-
-#include <camel/camel-mime-filter.h>
-
-#define CAMEL_MIME_FILTER_CRLF_TYPE (camel_mime_filter_crlf_get_type ())
-#define CAMEL_MIME_FILTER_CRLF(obj) CAMEL_CHECK_CAST (obj, CAMEL_MIME_FILTER_CRLF_TYPE, CamelMimeFilterCRLF)
-#define CAMEL_MIME_FILTER_CRLF_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, CAMEL_MIME_FILTER_CRLF_TYPE, CamelMimeFilterCRLFClass)
-#define CAMEL_IS_MIME_FILTER_CRLF(obj) CAMEL_CHECK_TYPE (obj, CAMEL_MIME_FILTER_CRLF_TYPE)
-
-typedef struct _CamelMimeFilterCRLFClass CamelMimeFilterCRLFClass;
-
-typedef enum {
- CAMEL_MIME_FILTER_CRLF_ENCODE,
- CAMEL_MIME_FILTER_CRLF_DECODE
-} CamelMimeFilterCRLFDirection;
-
-typedef enum {
- CAMEL_MIME_FILTER_CRLF_MODE_CRLF_DOTS,
- CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY,
-} CamelMimeFilterCRLFMode;
-
-struct _CamelMimeFilterCRLF {
- CamelMimeFilter parent;
-
- CamelMimeFilterCRLFDirection direction;
- CamelMimeFilterCRLFMode mode;
- gboolean saw_cr;
- gboolean saw_dot;
-};
-
-struct _CamelMimeFilterCRLFClass {
- CamelMimeFilterClass parent_class;
-};
-
-CamelType camel_mime_filter_crlf_get_type (void);
-
-CamelMimeFilter *camel_mime_filter_crlf_new (CamelMimeFilterCRLFDirection direction, CamelMimeFilterCRLFMode mode);
-
-#endif /* ! _CAMEL_MIME_FILTER_CRLF_H */
diff --git a/camel/camel-mime-filter-from.c b/camel/camel-mime-filter-from.c
deleted file mode 100644
index 017a256471..0000000000
--- a/camel/camel-mime-filter-from.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * 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 CamelMimeFilterClass *camel_mime_filter_from_parent;
-
-CamelType
-camel_mime_filter_from_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_mime_filter_get_type (), "CamelMimeFilterFrom",
- sizeof (CamelMimeFilterFrom),
- sizeof (CamelMimeFilterFromClass),
- (CamelObjectClassInitFunc) camel_mime_filter_from_class_init,
- NULL,
- (CamelObjectInitFunc) camel_mime_filter_from_init,
- NULL);
- }
-
- 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)
-{
- CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass;
-
- camel_mime_filter_from_parent = CAMEL_MIME_FILTER_CLASS (camel_type_get_global_classfuncs (camel_mime_filter_get_type ()));
-
- filter_class->filter = filter;
- filter_class->complete = complete;
-}
-
-static void
-camel_mime_filter_from_init (CamelMimeFilterFrom *obj)
-{
- struct _CamelMimeFilterFromPrivate *p;
-
- p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
- obj->midline = FALSE;
-}
-
-/**
- * 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 ( camel_object_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;
-
- g_tk_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 730f92f5e4..0000000000
--- a/camel/camel-mime-filter-from.h
+++ /dev/null
@@ -1,49 +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 <camel/camel-mime-filter.h>
-
-#define CAMEL_MIME_FILTER_FROM(obj) CAMEL_CHECK_CAST (obj, camel_mime_filter_from_get_type (), CamelMimeFilterFrom)
-#define CAMEL_MIME_FILTER_FROM_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mime_filter_from_get_type (), CamelMimeFilterFromClass)
-#define CAMEL_IS_MIME_FILTER_FROM(obj) CAMEL_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 46e0f3f5e8..0000000000
--- a/camel/camel-mime-filter-index.c
+++ /dev/null
@@ -1,156 +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_finalize (CamelObject *o);
-
-static CamelMimeFilterClass *camel_mime_filter_index_parent;
-
-CamelType
-camel_mime_filter_index_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_mime_filter_get_type (), "CamelMimeFilterIndex",
- sizeof (CamelMimeFilterIndex),
- sizeof (CamelMimeFilterIndexClass),
- (CamelObjectClassInitFunc) camel_mime_filter_index_class_init,
- NULL,
- NULL,
- (CamelObjectFinalizeFunc) camel_mime_filter_index_finalize);
- }
-
- return type;
-}
-
-static void
-camel_mime_filter_index_finalize(CamelObject *o)
-{
- CamelMimeFilterIndex *f = (CamelMimeFilterIndex *)o;
-
- g_free(f->name);
- f->index = NULL; /* ibex's need refcounting? */
-}
-
-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)
-{
- CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass;
-
- camel_mime_filter_index_parent = CAMEL_MIME_FILTER_CLASS (camel_type_get_global_classfuncs (camel_mime_filter_get_type ()));
-
- /*filter_class->reset = reset;*/
- filter_class->filter = filter;
- filter_class->complete = complete;
-}
-
-/**
- * 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 ( camel_object_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 e7733bd4ca..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) CAMEL_CHECK_CAST (obj, camel_mime_filter_index_get_type (), CamelMimeFilterIndex)
-#define CAMEL_MIME_FILTER_INDEX_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mime_filter_index_get_type (), CamelMimeFilterIndexClass)
-#define CAMEL_IS_MIME_FILTER_INDEX(obj) CAMEL_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-linewrap.c b/camel/camel-mime-filter-linewrap.c
deleted file mode 100644
index dee6c19abb..0000000000
--- a/camel/camel-mime-filter-linewrap.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * Authors: Jeffrey Stedfast <fejj@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-linewrap.h"
-#include <ctype.h>
-
-static void filter (CamelMimeFilter *f, char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace);
-static void complete (CamelMimeFilter *f, char *in, size_t len,
- size_t prespace, char **out, size_t *outlen,
- size_t *outprespace);
-static void reset (CamelMimeFilter *f);
-
-
-static void
-camel_mime_filter_linewrap_class_init (CamelMimeFilterLinewrapClass *klass)
-{
- CamelMimeFilterClass *mime_filter_class =
- (CamelMimeFilterClass *) klass;
-
- mime_filter_class->filter = filter;
- mime_filter_class->complete = complete;
- mime_filter_class->reset = reset;
-}
-
-CamelType
-camel_mime_filter_linewrap_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_mime_filter_get_type(), "CamelMimeFilterLinewrap",
- sizeof (CamelMimeFilterLinewrap),
- sizeof (CamelMimeFilterLinewrapClass),
- (CamelObjectClassInitFunc) camel_mime_filter_linewrap_class_init,
- NULL,
- NULL,
- NULL);
- }
-
- return type;
-}
-
-static void
-filter (CamelMimeFilter *f, char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace)
-{
- CamelMimeFilterLinewrap *linewrap = (CamelMimeFilterLinewrap *)f;
- char *inend, *last, *p, *q;
- int nchars = linewrap->nchars;
-
- /* we'll be adding chars here so we need a bigger buffer */
- camel_mime_filter_set_size (f, 3 * len, FALSE);
-
- p = in;
- q = f->outbuf;
- inend = in + len;
-
- while (p < inend) {
- if (*p == '\n') {
- last = q;
- *q++ = *p++;
- nchars = 0;
- } else if (isspace (*p)) {
- last = q;
-
- if (nchars >= linewrap->wrap_len) {
- *q++ = '\n';
- p++;
- nchars = 0;
- } else {
- *q++ = *p++;
- }
- } else {
- *q++ = *p++;
- nchars++;
- }
-
- /* line is getting way too long, we must force a wrap here */
- if (nchars >= (linewrap->max_len - 1) && *p != '\n') {
- *q++ = '\n';
- *q++ = linewrap->indent;
- nchars = 0;
- }
- }
-
- linewrap->nchars = nchars;
-
- *out = f->outbuf;
- *outlen = q - f->outbuf;
- *outprespace = f->outpre;
-}
-
-static void
-complete (CamelMimeFilter *f, char *in, size_t len, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace)
-{
- if (len)
- filter (f, in, len, prespace, out, outlen, outprespace);
-}
-
-static void
-reset (CamelMimeFilter *f)
-{
- CamelMimeFilterLinewrap *linewrap = (CamelMimeFilterLinewrap *)f;
-
- linewrap->nchars = 0;
-}
-
-CamelMimeFilter *
-camel_mime_filter_linewrap_new (guint preferred_len, guint max_len, char indent_char)
-{
- CamelMimeFilterLinewrap *linewrap =
- CAMEL_MIME_FILTER_LINEWRAP (camel_object_new (CAMEL_MIME_FILTER_LINEWRAP_TYPE));
-
- linewrap->indent = indent_char;
- linewrap->wrap_len = preferred_len;
- linewrap->max_len = max_len;
- linewrap->nchars = 0;
-
- return (CamelMimeFilter *) linewrap;
-}
diff --git a/camel/camel-mime-filter-linewrap.h b/camel/camel-mime-filter-linewrap.h
deleted file mode 100644
index 189b80d014..0000000000
--- a/camel/camel-mime-filter-linewrap.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Jeffrey Stedfast <fejj@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_LINEWRAP_H
-#define _CAMEL_MIME_FILTER_LINEWRAP_H
-
-#include <camel/camel-mime-filter.h>
-
-#define CAMEL_MIME_FILTER_LINEWRAP_TYPE (camel_mime_filter_linewrap_get_type ())
-#define CAMEL_MIME_FILTER_LINEWRAP(obj) CAMEL_CHECK_CAST (obj, CAMEL_MIME_FILTER_LINEWRAP_TYPE, CamelMimeFilterLinewrap)
-#define CAMEL_MIME_FILTER_LINEWRAP_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, CAMEL_MIME_FILTER_LINEWRAP_TYPE, CamelMimeFilterLinewrapClass)
-#define CAMEL_IS_MIME_FILTER_LINEWRAP(obj) CAMEL_CHECK_TYPE (obj, CAMEL_MIME_FILTER_LINEWRAP_TYPE)
-
-typedef struct _CamelMimeFilterLinewrapClass CamelMimeFilterLinewrapClass;
-
-struct _CamelMimeFilterLinewrap {
- CamelMimeFilter parent;
-
- guint wrap_len;
- guint max_len;
- char indent;
- int nchars;
-};
-
-struct _CamelMimeFilterLinewrapClass {
- CamelMimeFilterClass parent_class;
-};
-
-CamelType camel_mime_filter_linewrap_get_type (void);
-
-CamelMimeFilter *camel_mime_filter_linewrap_new (guint preferred_len, guint max_len, char indent_char);
-
-#endif /* ! _CAMEL_MIME_FILTER_LINEWRAP_H */
diff --git a/camel/camel-mime-filter-save.c b/camel/camel-mime-filter-save.c
deleted file mode 100644
index e1761994ed..0000000000
--- a/camel/camel-mime-filter-save.c
+++ /dev/null
@@ -1,144 +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 void camel_mime_filter_save_finalize (CamelObject *o);
-
-static CamelMimeFilterClass *camel_mime_filter_save_parent;
-
-CamelType
-camel_mime_filter_save_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_mime_filter_get_type (), "CamelMimeFilterSave",
- sizeof (CamelMimeFilterSave),
- sizeof (CamelMimeFilterSaveClass),
- (CamelObjectClassInitFunc) camel_mime_filter_save_class_init,
- NULL,
- (CamelObjectInitFunc) camel_mime_filter_save_init,
- (CamelObjectFinalizeFunc) camel_mime_filter_save_finalize);
- }
-
- return type;
-}
-
-static void
-camel_mime_filter_save_finalize(CamelObject *o)
-{
- CamelMimeFilterSave *f = (CamelMimeFilterSave *)o;
-
- g_free(f->filename);
- if (f->fd != -1) {
- /* FIXME: what do we do with failed writes???? */
- close(f->fd);
- }
-}
-
-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)
-{
- CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass;
-
- camel_mime_filter_save_parent = CAMEL_MIME_FILTER_CLASS (camel_type_get_global_classfuncs (camel_mime_filter_get_type ()));
-
- filter_class->reset = reset;
- filter_class->filter = filter;
-}
-
-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 ( camel_object_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 {
- camel_object_unref((CamelObject *)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 1cc05aed14..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) CAMEL_CHECK_CAST (obj, camel_mime_filter_save_get_type (), CamelMimeFilterSave)
-#define CAMEL_MIME_FILTER_SAVE_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mime_filter_save_get_type (), CamelMimeFilterSaveClass)
-#define CAMEL_IS_MIME_FILTER_SAVE(obj) CAMEL_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 9a81dfb452..0000000000
--- a/camel/camel-mime-filter.c
+++ /dev/null
@@ -1,255 +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"
-
-/*#define MALLOC_CHECK */ /* for some malloc checking, requires mcheck enabled */
-
-/* only suitable for glibc */
-#ifdef MALLOC_CHECK
-#include <mcheck.h>
-#endif
-
-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 *)(CAMEL_OBJECT_GET_CLASS(o)))
-
-static CamelObjectClass *camel_mime_filter_parent;
-
-static void complete (CamelMimeFilter *mf, char *in, size_t len,
- size_t prespace, char **out, size_t *outlen,
- size_t *outprespace);
-
-static void
-camel_mime_filter_class_init (CamelMimeFilterClass *klass)
-{
- camel_mime_filter_parent = camel_type_get_global_classfuncs (camel_object_get_type ());
-
- klass->complete = complete;
-}
-
-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));
-}
-
-static void
-camel_mime_filter_finalize(CamelObject *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);
-}
-
-CamelType
-camel_mime_filter_get_type (void)
-{
- static CamelType camel_mime_filter_type = CAMEL_INVALID_TYPE;
-
- if (camel_mime_filter_type == CAMEL_INVALID_TYPE) {
- camel_mime_filter_type = camel_type_register (CAMEL_OBJECT_TYPE, "CamelMimeFilter",
- sizeof (CamelMimeFilter),
- sizeof (CamelMimeFilterClass),
- (CamelObjectClassInitFunc) camel_mime_filter_class_init,
- NULL,
- (CamelObjectInitFunc) camel_mime_filter_init,
- (CamelObjectFinalizeFunc) camel_mime_filter_finalize);
- }
-
- return camel_mime_filter_type;
-}
-
-static void
-complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlen, size_t *outprespace)
-{
- /* default - do nothing */
-}
-
-/**
- * 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 ( camel_object_new (camel_mime_filter_get_type ()));
- return new;
-}
-
-#ifdef MALLOC_CHECK
-static void
-checkmem(void *p)
-{
- if (p) {
- int status = mprobe(p);
-
- switch (status) {
- case MCHECK_HEAD:
- printf("Memory underrun at %p\n", p);
- abort();
- case MCHECK_TAIL:
- printf("Memory overrun at %p\n", p);
- abort();
- case MCHECK_FREE:
- printf("Double free %p\n", p);
- abort();
- }
- }
-}
-#endif
-
-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;
-
-#ifdef MALLOC_CHECK
- checkmem(f->outreal);
- checkmem(f->backbuf);
-#endif
- /*
- 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;
- }
-
-#ifdef MALLOC_CHECK
- checkmem(f->outreal);
- checkmem(f->backbuf);
-#endif
-
- /* 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);
-
-#ifdef MALLOC_CHECK
- checkmem(f->outreal);
- checkmem(f->backbuf);
-#endif
-
-}
-
-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, const 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 1a05b36794..0000000000
--- a/camel/camel-mime-filter.h
+++ /dev/null
@@ -1,84 +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_TYPE (camel_mime_filter_get_type ())
-#define CAMEL_MIME_FILTER(obj) CAMEL_CHECK_CAST (obj, camel_mime_filter_get_type (), CamelMimeFilter)
-#define CAMEL_MIME_FILTER_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mime_filter_get_type (), CamelMimeFilterClass)
-#define CAMEL_IS_MIME_FILTER(obj) CAMEL_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);
-};
-
-CamelType 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, const 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 9e0fb7de11..0000000000
--- a/camel/camel-mime-message.c
+++ /dev/null
@@ -1,802 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
-/* camel-mime-message.c : class for a mime_message */
-
-/*
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@helixcode.com>
- * Jeffrey Stedfast <fejj@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 "camel-multipart.h"
-#include "camel-stream-mem.h"
-#include "string-utils.h"
-#include "hash-table-utils.h"
-
-#include "camel-stream-filter.h"
-#include "camel-stream-null.h"
-#include "camel-mime-filter-charset.h"
-#include "camel-mime-filter-bestenc.h"
-
-#include <stdio.h>
-#include <string.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,
- HEADER_MESSAGE_ID
-} CamelHeaderType;
-
-static char *header_names[] = {
- /* dont include HEADER_UNKNOWN string */
- "From", "Reply-To", "Subject", "To", "Cc", "Bcc", "Date", "Message-Id", NULL
-};
-
-static GHashTable *header_name_table;
-
-static CamelMimePartClass *parent_class=NULL;
-
-static char *recipient_names[] = {
- "To", "Cc", "Bcc", NULL
-};
-
-static int write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-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 *);
-static void unref_recipient (gpointer key, gpointer value, gpointer user_data);
-
-/* Returns the class for a CamelMimeMessage */
-#define CMM_CLASS(so) CAMEL_MIME_MESSAGE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CMD_CLASS(so) CAMEL_MEDIUM_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-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);
- CamelMediumClass *camel_medium_class = CAMEL_MEDIUM_CLASS (camel_mime_message_class);
- int i;
-
- parent_class = CAMEL_MIME_PART_CLASS(camel_type_get_global_classfuncs (camel_mime_part_get_type ()));
-
- header_name_table = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- for (i=0;header_names[i];i++)
- g_hash_table_insert (header_name_table, header_names[i], (gpointer)i+1);
-
- /* 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;
-}
-
-
-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->subject = NULL;
- mime_message->reply_to = NULL;
- mime_message->from = NULL;
- mime_message->date = CAMEL_MESSAGE_DATE_CURRENT;
- mime_message->date_offset = 0;
- mime_message->date_received = CAMEL_MESSAGE_DATE_CURRENT;
- mime_message->date_received_offset = 0;
- mime_message->message_id = NULL;
-}
-
-static void
-camel_mime_message_finalize (CamelObject *object)
-{
- CamelMimeMessage *message = CAMEL_MIME_MESSAGE (object);
-
- g_free(message->subject);
-
- g_free(message->message_id);
-
- if (message->reply_to)
- camel_object_unref((CamelObject *)message->reply_to);
-
- if (message->from)
- camel_object_unref((CamelObject *)message->from);
-
- g_hash_table_foreach(message->recipients, unref_recipient, NULL);
- g_hash_table_destroy(message->recipients);
-}
-
-
-CamelType
-camel_mime_message_get_type (void)
-{
- static CamelType camel_mime_message_type = CAMEL_INVALID_TYPE;
-
- if (camel_mime_message_type == CAMEL_INVALID_TYPE) {
- camel_mime_message_type = camel_type_register (camel_mime_part_get_type(), "CamelMimeMessage",
- sizeof (CamelMimeMessage),
- sizeof (CamelMimeMessageClass),
- (CamelObjectClassInitFunc) camel_mime_message_class_init,
- NULL,
- (CamelObjectInitFunc) camel_mime_message_init,
- (CamelObjectFinalizeFunc) camel_mime_message_finalize);
- }
-
- return camel_mime_message_type;
-}
-
-static void unref_recipient (gpointer key, gpointer value, gpointer user_data)
-{
- camel_object_unref (CAMEL_OBJECT (value));
-}
-
-CamelMimeMessage *
-camel_mime_message_new (void)
-{
- CamelMimeMessage *mime_message;
- mime_message = CAMEL_MIME_MESSAGE(camel_object_new (CAMEL_MIME_MESSAGE_TYPE));
-
- return mime_message;
-}
-
-/* **** Date: */
-
-void
-camel_mime_message_set_date(CamelMimeMessage *message, time_t date, int offset)
-{
- char *datestr;
-
- g_assert(message);
- if (date == CAMEL_MESSAGE_DATE_CURRENT) {
- struct tm *local;
- int tz;
-
- date = time(0);
- local = localtime(&date);
-#if defined(HAVE_TIMEZONE)
- tz = timezone;
-#elif defined(HAVE_TM_GMTOFF)
- tz = local->tm_gmtoff;
-#endif
- offset = -(((tz/60/60) * 100) + (tz/60 % 60));
- if (local->tm_isdst>0)
- offset += 100;
- }
- message->date = date;
- message->date_offset = offset;
-
- datestr = header_format_date(date, offset);
- CAMEL_MEDIUM_CLASS(parent_class)->set_header((CamelMedium *)message, "Date", datestr);
- g_free(datestr);
-}
-
-time_t
-camel_mime_message_get_date(CamelMimeMessage *msg, int *offset)
-{
- if (offset)
- *offset = msg->date_offset;
-
- return msg->date;
-}
-
-time_t
-camel_mime_message_get_date_received(CamelMimeMessage *msg, int *offset)
-{
- if (msg->date_received == CAMEL_MESSAGE_DATE_CURRENT) {
- const char *received;
-
- received = camel_medium_get_header((CamelMedium *)msg, "received");
- if (received)
- received = strrchr(received, ';');
- if (received)
- msg->date_received = header_decode_date(received + 1, &msg->date_received_offset);
- }
-
- if (offset)
- *offset = msg->date_received_offset;
-
- return msg->date_received;
-}
-
-/* **** Message-Id: */
-
-void
-camel_mime_message_set_message_id (CamelMimeMessage *mime_message, const char *message_id)
-{
- char *id;
-
- g_assert (mime_message);
-
- g_free (mime_message->message_id);
-
- if (message_id) {
- id = g_strstrip (g_strdup (message_id));
- } else {
- id = header_msgid_generate ();
- }
-
- mime_message->message_id = id;
- id = g_strdup_printf ("<%s>", mime_message->message_id);
- CAMEL_MEDIUM_CLASS (parent_class)->set_header (CAMEL_MEDIUM (mime_message), "Message-Id", id);
- g_free (id);
-}
-
-const char *
-camel_mime_message_get_message_id (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
-
- return mime_message->message_id;
-}
-
-/* **** Reply-To: */
-
-void
-camel_mime_message_set_reply_to (CamelMimeMessage *msg, const CamelInternetAddress *reply_to)
-{
- char *addr;
-
- g_assert(msg);
-
- if (msg->reply_to) {
- camel_object_unref((CamelObject *)msg->reply_to);
- msg->reply_to = NULL;
- }
-
- if (reply_to == NULL) {
- CAMEL_MEDIUM_CLASS(parent_class)->remove_header(CAMEL_MEDIUM(msg), "Reply-To");
- return;
- }
-
- msg->reply_to = (CamelInternetAddress *)camel_address_new_clone((CamelAddress *)reply_to);
- addr = camel_address_encode((CamelAddress *)msg->reply_to);
- CAMEL_MEDIUM_CLASS(parent_class)->set_header(CAMEL_MEDIUM(msg), "Reply-To", addr);
- g_free(addr);
-}
-
-const CamelInternetAddress *
-camel_mime_message_get_reply_to(CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
-
- /* TODO: ref for threading? */
-
- return mime_message->reply_to;
-}
-
-/* **** Subject: */
-
-void
-camel_mime_message_set_subject(CamelMimeMessage *mime_message, const char *subject)
-{
- char *text;
-
- g_assert(mime_message);
-
- g_free(mime_message->subject);
- mime_message->subject = g_strstrip (g_strdup (subject));
- text = header_encode_string((unsigned char *)mime_message->subject);
- CAMEL_MEDIUM_CLASS(parent_class)->set_header(CAMEL_MEDIUM (mime_message), "Subject", text);
- g_free (text);
-}
-
-const char *
-camel_mime_message_get_subject(CamelMimeMessage *mime_message)
-{
- g_assert(mime_message);
-
- return mime_message->subject;
-}
-
-/* *** From: */
-
-/* Thought: Since get_from/set_from are so rarely called, it is probably not useful
- to cache the from (and reply_to) addresses as InternetAddresses internally, we
- could just get it from the headers and reprocess every time. */
-void
-camel_mime_message_set_from(CamelMimeMessage *msg, const CamelInternetAddress *from)
-{
- char *addr;
-
- g_assert(msg);
-
- if (msg->from) {
- camel_object_unref((CamelObject *)msg->from);
- msg->from = NULL;
- }
-
- if (from == NULL || camel_address_length((CamelAddress *)from) == 0) {
- CAMEL_MEDIUM_CLASS(parent_class)->remove_header(CAMEL_MEDIUM(msg), "From");
- return;
- }
-
- msg->from = (CamelInternetAddress *)camel_address_new_clone((CamelAddress *)from);
- addr = camel_address_encode((CamelAddress *)msg->from);
- CAMEL_MEDIUM_CLASS (parent_class)->set_header(CAMEL_MEDIUM(msg), "From", addr);
- g_free(addr);
-}
-
-const CamelInternetAddress *
-camel_mime_message_get_from(CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
-
- /* TODO: we should really ref this for multi-threading to work */
-
- return mime_message->from;
-}
-
-/* **** To: Cc: Bcc: */
-
-void
-camel_mime_message_set_recipients(CamelMimeMessage *mime_message, const char *type, const CamelInternetAddress *r)
-{
- char *text;
- CamelInternetAddress *addr;
-
- g_assert(mime_message);
-
- addr = g_hash_table_lookup(mime_message->recipients, type);
- if (addr == NULL) {
- g_warning("trying to set a non-valid receipient type: %s", type);
- return;
- }
-
- if (r == NULL || camel_address_length((CamelAddress *)r) == 0) {
- camel_address_remove((CamelAddress *)addr, -1);
- CAMEL_MEDIUM_CLASS(parent_class)->remove_header(CAMEL_MEDIUM(mime_message), type);
- return;
- }
-
- /* note this does copy, and not append (cat) */
- camel_address_copy((CamelAddress *)addr, (const CamelAddress *)r);
-
- /* and sync our headers */
- text = camel_address_encode(CAMEL_ADDRESS(addr));
- CAMEL_MEDIUM_CLASS(parent_class)->set_header(CAMEL_MEDIUM(mime_message), type, text);
- g_free(text);
-}
-
-const CamelInternetAddress *
-camel_mime_message_get_recipients(CamelMimeMessage *mime_message, const char *type)
-{
- g_assert(mime_message);
-
- return g_hash_table_lookup(mime_message->recipients, type);
-}
-
-/* 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: /* these 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 EOM, got: %d", camel_mime_parser_state(mp));
- camel_mime_parser_unstep(mp);
- return -1;
- }
-
- d(printf("mime_message::construct_from_parser() leaving\n"));
-#ifndef NO_WARNINGS
-#warning "return a real error code"
-#endif
- 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) {
- /* FIXME: should we just abort? Should we make one up? */
- g_warning("No from set for message");
- camel_medium_set_header((CamelMedium *)mm, "From", "");
- }
- if (!camel_medium_get_header((CamelMedium *)mm, "Date")) {
- 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");
- }
- if (mm->message_id == NULL) {
- g_warning ("Application did not set message-id, creating one");
- camel_mime_message_set_message_id (mm, NULL);
- }
-
- /* FIXME: "To" header needs to be set explicitly as well ... */
-
- if (!camel_medium_get_header ((CamelMedium *)mm, "Mime-Version"))
- camel_medium_set_header((CamelMedium *)mm, "Mime-Version", "1.0");
-
- return CAMEL_DATA_WRAPPER_CLASS (parent_class)->write_to_stream (data_wrapper, stream);
-}
-
-/* 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:
- if (message->from)
- camel_object_unref((CamelObject *)message->from);
- message->from = camel_internet_address_new();
- camel_address_decode((CamelAddress *)message->from, header_value);
- break;
- case HEADER_REPLY_TO:
- if (message->reply_to)
- camel_object_unref((CamelObject *)message->reply_to);
- message->reply_to = camel_internet_address_new();
- camel_address_decode((CamelAddress *)message->reply_to, header_value);
- break;
- case HEADER_SUBJECT:
- g_free(message->subject);
- message->subject = g_strstrip(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(CAMEL_ADDRESS (addr), header_value);
- else
- camel_address_remove(CAMEL_ADDRESS (addr), -1);
- break;
- case HEADER_DATE:
- if (header_value) {
- message->date = header_decode_date(header_value, &message->date_offset);
- } else {
- message->date = CAMEL_MESSAGE_DATE_CURRENT;
- message->date_offset = 0;
- }
- break;
- case HEADER_MESSAGE_ID:
- g_free (message->message_id);
- if (header_value)
- message->message_id = header_msgid_decode (header_value);
- else
- message->message_id = NULL;
- 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);
-}
-
-typedef gboolean (*CamelPartFunc)(CamelMimeMessage *, CamelMimePart *, void *data);
-
-static gboolean
-message_foreach_part_rec(CamelMimeMessage *msg, CamelMimePart *part, CamelPartFunc callback, void *data)
-{
- CamelDataWrapper *containee;
- int parts, i;
- int go = TRUE;
-
- if (callback(msg, part, data) == FALSE)
- return FALSE;
-
- containee = camel_medium_get_content_object(CAMEL_MEDIUM(part));
-
- if (containee == NULL)
- return go;
-
- /* using the object types is more accurate than using the mime/types */
- if (CAMEL_IS_MULTIPART(containee)) {
- parts = camel_multipart_get_number(CAMEL_MULTIPART(containee));
- for (i=0;go && i<parts;i++) {
- CamelMimePart *part = camel_multipart_get_part(CAMEL_MULTIPART(containee), i);
-
- go = message_foreach_part_rec(msg, part, callback, data);
- }
- } else if (CAMEL_IS_MIME_MESSAGE(containee)) {
- go = message_foreach_part_rec(msg, (CamelMimePart *)containee, callback, data);
- }
-
- return go;
-}
-
-/* dont make this public yet, it might need some more thinking ... */
-/* MPZ */
-static void
-camel_mime_message_foreach_part(CamelMimeMessage *msg, CamelPartFunc callback, void *data)
-{
- message_foreach_part_rec(msg, (CamelMimePart *)msg, callback, data);
-}
-
-static gboolean
-check_8bit(CamelMimeMessage *msg, CamelMimePart *part, void *data)
-{
- int *has8bit = data;
-
- /* check this part, and stop as soon as we are done */
- *has8bit = camel_mime_part_get_encoding(part) == CAMEL_MIME_PART_ENCODING_8BIT;
- return !(*has8bit);
-}
-
-gboolean
-camel_mime_message_has_8bit_parts(CamelMimeMessage *msg)
-{
- int has8bit = FALSE;
-
- camel_mime_message_foreach_part(msg, check_8bit, &has8bit);
-
- return has8bit;
-}
-
-/* finds the best charset and transfer encoding for a given part */
-static CamelMimePartEncodingType
-find_best_encoding(CamelMimePart *part, CamelBestencRequired required, CamelBestencEncoding enctype, char **charsetp)
-{
- const char *charsetin = NULL;
- char *charset = NULL;
- CamelStream *null;
- CamelStreamFilter *filter;
- CamelMimeFilterCharset *charenc = NULL;
- CamelMimeFilterBestenc *bestenc;
- int idb, idc = -1;
- gboolean istext;
- unsigned int flags, callerflags;
- CamelMimePartEncodingType encoding;
- CamelDataWrapper *content;
-
- /* we use all these weird stream things so we can do it with streams, and
- not have to read the whole lot into memory - although i have a feeling
- it would make things a fair bit simpler to do so ... */
-
- d(printf("starting to check part\n"));
-
- content = camel_medium_get_content_object((CamelMedium *)part);
- if (content == NULL) {
- /* charset might not be right here, but it'll get the right stuff
- if it is ever set */
- *charsetp = NULL;
- return CAMEL_MIME_PART_ENCODING_DEFAULT;
- }
-
- istext = header_content_type_is(part->content_type, "text", "*");
- if (istext) {
- flags = CAMEL_BESTENC_GET_CHARSET|CAMEL_BESTENC_GET_ENCODING;
- } else {
- flags = CAMEL_BESTENC_GET_ENCODING;
- }
-
- /* when building the message, any encoded parts are translated already */
- flags |= CAMEL_BESTENC_LF_IS_CRLF;
- /* and get any flags the caller passed in */
- callerflags = (required & CAMEL_BESTENC_NO_FROM);
- flags |= callerflags;
-
- /* first a null stream, so any filtering is thrown away; we only want the sideeffects */
- null = (CamelStream *)camel_stream_null_new();
- filter = camel_stream_filter_new_with_stream(null);
-
- /* if we're not looking for the best charset, then use the one we have */
- if (istext && (required & CAMEL_BESTENC_GET_CHARSET) == 0
- && (charsetin = header_content_type_param(part->content_type, "charset"))) {
- /* if libunicode doesn't support it, we dont really have utf8 anyway, so
- we dont need a converter */
- charenc = camel_mime_filter_charset_new_convert("UTF-8", charsetin);
- if (charenc != NULL)
- idc = camel_stream_filter_add(filter, (CamelMimeFilter *)charenc);
- charsetin = NULL;
- }
-
- bestenc = camel_mime_filter_bestenc_new(flags);
- idb = camel_stream_filter_add(filter, (CamelMimeFilter *)bestenc);
- d(printf("writing to checking stream\n"));
- camel_data_wrapper_write_to_stream(content, (CamelStream *)filter);
- camel_stream_filter_remove(filter, idb);
- if (idc != -1) {
- camel_stream_filter_remove(filter, idc);
- camel_object_unref((CamelObject *)charenc);
- charenc = NULL;
- }
-
- if (istext)
- charsetin = camel_mime_filter_bestenc_get_best_charset(bestenc);
-
- d(printf("charsetin = %s\n", charsetin));
-
- /* if we have US-ASCII, or we're not doing text, we dont need to bother with the rest */
- if (charsetin != NULL && (required & CAMEL_BESTENC_GET_CHARSET) != 0) {
- charset = g_strdup(charsetin);
-
- d(printf("have charset, trying conversion/etc\n"));
-
- /* now the 'bestenc' can has told us what the best encoding is, we can use that to create
- a charset conversion filter as well, and then re-add the bestenc to filter the
- result to find the best encoding to use as well */
-
- charenc = camel_mime_filter_charset_new_convert("UTF-8", charset);
-
- /* eek, libunicode doesn't undertand this charset anyway, then the 'utf8' we
- thought we had is really the native format, in which case, we just treat
- it as binary data (and take the result we have so far) */
-
- if (charenc != NULL) {
-
- /* otherwise, try another pass, converting to the real charset */
-
- camel_mime_filter_reset((CamelMimeFilter *)bestenc);
- camel_mime_filter_bestenc_set_flags(bestenc, CAMEL_BESTENC_GET_ENCODING|CAMEL_BESTENC_LF_IS_CRLF|callerflags);
-
- camel_stream_filter_add(filter, (CamelMimeFilter *)charenc);
- camel_stream_filter_add(filter, (CamelMimeFilter *)bestenc);
-
- /* and write it to the new stream */
- camel_data_wrapper_write_to_stream(content, (CamelStream *)filter);
-
- camel_object_unref((CamelObject *)charenc);
- }
- }
-
- encoding = camel_mime_filter_bestenc_get_best_encoding(bestenc, enctype);
-
- camel_object_unref((CamelObject *)filter);
- camel_object_unref((CamelObject *)bestenc);
- camel_object_unref((CamelObject *)null);
-
- d(printf("done, best encoding = %d\n", encoding));
-
- if (charsetp)
- *charsetp = charset;
- else
- g_free(charset);
-
- return encoding;
-}
-
-struct _enc_data {
- CamelBestencRequired required;
- CamelBestencEncoding enctype;
-};
-
-static gboolean
-best_encoding(CamelMimeMessage *msg, CamelMimePart *part, void *datap)
-{
- struct _enc_data *data = datap;
- char *charset;
- CamelMimePartEncodingType encoding;
-
- /* we only care about actual content objects */
- if (!CAMEL_IS_MULTIPART(part) && !CAMEL_IS_MIME_MESSAGE(part)) {
-
- encoding = find_best_encoding(part, data->required, data->enctype, &charset);
- /* we always set the encoding, if we got this far. GET_CHARSET implies
- also GET_ENCODING */
- camel_mime_part_set_encoding(part, encoding);
-
- if ((data->required & CAMEL_BESTENC_GET_CHARSET) != 0) {
- if (header_content_type_is(part->content_type, "text", "*")) {
- char *newct;
-
- /* FIXME: ick, the part content_type interface needs fixing bigtime */
- header_content_type_set_param(part->content_type, "charset", charset?charset:"us-ascii");
- newct = header_content_type_format(part->content_type);
- if (newct) {
- d(printf("Setting content-type to %s\n", newct));
-
- camel_mime_part_set_content_type(part, newct);
- g_free(newct);
- }
- }
- }
- }
-
- return TRUE;
-}
-
-void
-camel_mime_message_set_best_encoding(CamelMimeMessage *msg, CamelBestencRequired required, CamelBestencEncoding enctype)
-{
- struct _enc_data data;
-
- if ((required & (CAMEL_BESTENC_GET_ENCODING|CAMEL_BESTENC_GET_CHARSET)) == 0)
- return;
-
- data.required = required;
- data.enctype = enctype;
-
- camel_mime_message_foreach_part(msg, best_encoding, &data);
-}
-
-void
-camel_mime_message_encode_8bit_parts (CamelMimeMessage *mime_message)
-{
- camel_mime_message_set_best_encoding(mime_message, CAMEL_BESTENC_GET_ENCODING, CAMEL_BESTENC_7BIT);
-}
-
diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h
deleted file mode 100644
index 0ab406c27e..0000000000
--- a/camel/camel-mime-message.h
+++ /dev/null
@@ -1,129 +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>
-#include <camel/camel-mime-filter-bestenc.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) (CAMEL_CHECK_CAST((obj), CAMEL_MIME_MESSAGE_TYPE, CamelMimeMessage))
-#define CAMEL_MIME_MESSAGE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MIME_MESSAGE_TYPE, CamelMimeMessageClass))
-#define CAMEL_IS_MIME_MESSAGE(o) (CAMEL_CHECK_TYPE((o), CAMEL_MIME_MESSAGE_TYPE))
-
-
-/* specify local time */
-#define CAMEL_MESSAGE_DATE_CURRENT (~0)
-
-struct _CamelMimeMessage
-{
- CamelMimePart parent_object;
-
- /* header fields */
- time_t date;
- int date_offset; /* GMT offset */
-
- /* cached internal copy */
- time_t date_received;
- int date_received_offset; /* GMT offset */
-
- char *subject;
-
- char *message_id;
-
- CamelInternetAddress *reply_to;
- CamelInternetAddress *from;
-
- GHashTable *recipients; /* hash table of CamelInternetAddress's */
-};
-
-typedef struct {
- CamelMimePartClass parent_class;
-
- /* Virtual methods */
-
-} CamelMimeMessageClass;
-
-
-
-/* Standard Camel function */
-CamelType 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);
-time_t camel_mime_message_get_date (CamelMimeMessage *mime_message,
- int *offset);
-time_t camel_mime_message_get_date_received (CamelMimeMessage *mime_message,
- int *offset);
-void camel_mime_message_set_message_id (CamelMimeMessage *mime_message,
- const char *message_id);
-const char *camel_mime_message_get_message_id (CamelMimeMessage *mime_message);
-void camel_mime_message_set_reply_to (CamelMimeMessage *mime_message,
- const CamelInternetAddress *reply_to);
-const CamelInternetAddress *camel_mime_message_get_reply_to (CamelMimeMessage *mime_message);
-
-void camel_mime_message_set_subject (CamelMimeMessage *mime_message,
- const char *subject);
-const char *camel_mime_message_get_subject (CamelMimeMessage *mime_message);
-void camel_mime_message_set_from (CamelMimeMessage *mime_message,
- const CamelInternetAddress *from);
-const CamelInternetAddress *camel_mime_message_get_from (CamelMimeMessage *mime_message);
-
-const CamelInternetAddress *camel_mime_message_get_recipients (CamelMimeMessage *mime_message,
- const char *type);
-void camel_mime_message_set_recipients (CamelMimeMessage *mime_message,
- const char *type,
- const CamelInternetAddress *r);
-
-/* utility functions */
-gboolean camel_mime_message_has_8bit_parts (CamelMimeMessage *mime_message);
-void camel_mime_message_set_best_encoding (CamelMimeMessage *msg,
- CamelBestencRequired required,
- CamelBestencEncoding enctype);
-void camel_mime_message_encode_8bit_parts (CamelMimeMessage *mime_message);
-
-#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 b9fc3d2ebb..0000000000
--- a/camel/camel-mime-parser.c
+++ /dev/null
@@ -1,1956 +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 */
-
-/* Do not change this code without asking me (Michael Zucchi) first
-
- There is almost always a reason something was done a certain way.
- */
-
-#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) */
-
- unsigned int midline:1; /* are we mid-line interrupted? */
- unsigned int scan_from:1; /* do we care about From lines? */
- unsigned int scan_pre_from:1; /* do we return pre-from data? */
-
- 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 */
-
- /* 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;
-
- /* I dont use GString's casue you can't efficiently append a buffer to them */
- GByteArray *pretext; /* for multipart types, save the pre-boundary data here */
- GByteArray *posttext; /* for multipart types, save the post-boundary data here */
- int prestage; /* used to determine if it is a pre-boundary or post-boundary data segment */
-
- GByteArray *from_line; /* the from line */
-
- char *boundary; /* for multipart/ * boundaries, including leading -- and trailing -- for the final part */
- int boundarylen; /* actual length of boundary, including leading -- if there is one */
- int boundarylenfinal; /* length of boundary, including trailing -- if there is one */
- int atleast; /* the biggest boundary from here to the parent */
-};
-
-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, GByteArray *save);
-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);
-static int folder_read(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);
-
-#if d(!)0
-static char *states[] = {
- "HSCAN_INITIAL",
- "HSCAN_PRE_FROM", /* pre-from data */
- "HSCAN_FROM", /* got 'From' line */
- "HSCAN_HEADER", /* toplevel header */
- "HSCAN_BODY", /* scanning body of message */
- "HSCAN_MULTIPART", /* got multipart header */
- "HSCAN_MESSAGE", /* rfc822/news message */
-
- "HSCAN_PART", /* part of a multipart */
-
- "HSCAN_EOF", /* end of file */
- "HSCAN_PRE_FROM_END",
- "HSCAN_FROM_END",
- "HSCAN_HEAER_END",
- "HSCAN_BODY_END",
- "HSCAN_MULTIPART_END",
- "HSCAN_MESSAGE_END",
-};
-#endif
-
-static CamelObjectClass *camel_mime_parser_parent;
-
-static void
-camel_mime_parser_class_init (CamelMimeParserClass *klass)
-{
- camel_mime_parser_parent = camel_type_get_global_classfuncs (camel_object_get_type ());
-}
-
-static void
-camel_mime_parser_init (CamelMimeParser *obj)
-{
- struct _header_scan_state *s;
-
- s = folder_scan_init();
- _PRIVATE(obj) = s;
-}
-
-static void
-camel_mime_parser_finalise(CamelObject *o)
-{
- struct _header_scan_state *s = _PRIVATE(o);
-#ifdef PURIFY
- purify_watch_remove_all();
-#endif
- folder_scan_close(s);
-}
-
-CamelType
-camel_mime_parser_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_object_get_type (), "CamelMimeParser",
- sizeof (CamelMimeParser),
- sizeof (CamelMimeParserClass),
- (CamelObjectClassInitFunc) camel_mime_parser_class_init,
- NULL,
- (CamelObjectInitFunc) camel_mime_parser_init,
- (CamelObjectFinalizeFunc) camel_mime_parser_finalise);
- }
-
- return type;
-}
-
-/**
- * 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 ( camel_object_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;
- camel_object_ref((CamelObject *)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) {
- camel_object_unref((CamelObject *)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;
-}
-
-static const char *
-byte_array_to_string(GByteArray *array)
-{
- if (array == NULL)
- return NULL;
-
- if (array->len == 0 || array->data[array->len-1] != '\0')
- g_byte_array_append(array, "", 1);
-
- return array->data;
-}
-
-/**
- * camel_mime_parser_preface:
- * @m:
- *
- * Retrieve the preface text for the current multipart.
- * Can only be used when the state is HSCAN_MULTIPART_END.
- *
- * Return value: The preface text, or NULL if there wasn't any.
- **/
-const char *
-camel_mime_parser_preface(CamelMimeParser *m)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- if (s->parts)
- return byte_array_to_string(s->parts->pretext);
-
- return NULL;
-}
-
-/**
- * camel_mime_parser_postface:
- * @m:
- *
- * Retrieve the postface text for the current multipart.
- * Only returns valid data when the current state if
- * HSCAN_MULTIPART_END.
- *
- * Return value: The postface text, or NULL if there wasn't any.
- **/
-const char *
-camel_mime_parser_postface(CamelMimeParser *m)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- if (s->parts)
- return byte_array_to_string(s->parts->posttext);
-
- return NULL;
-}
-
-/**
- * camel_mime_parser_from_line:
- * @m:
- *
- * Get the last scanned "From " line, from a recently scanned from.
- * This should only be called in the HSCAN_FROM state. The
- * from line will include the closing \n found (if there was one).
- *
- * The return value will remain valid while in the HSCAN_FROM
- * state, or any deeper state.
- *
- * Return value: The From line, or NULL if called out of context.
- **/
-const char *
-camel_mime_parser_from_line(CamelMimeParser *m)
-{
- struct _header_scan_state *s = _PRIVATE(m);
-
- if (s->parts)
- return byte_array_to_string(s->parts->from_line);
-
- 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.
- *
- * This may also be preceeded by an optional
- * HSCAN_PRE_FROM state which contains the scanned data
- * found before the From line is encountered. See also
- * scan_pre_from().
- **/
-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_scan_pre_from:
- * @:
- * @scan_pre_from: #TRUE if we want to get pre-from data.
- *
- * Tell the scanner whether we want to know abou the pre-from
- * data during a scan. If we do, then we may get an additional
- * state HSCAN_PRE_FROM which returns the specified data.
- **/
-void
-camel_mime_parser_scan_pre_from(CamelMimeParser *m, int scan_pre_from)
-{
- struct _header_scan_state *s = _PRIVATE(m);
- s->scan_pre_from = scan_pre_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 it's 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_read:
- * @m:
- * @databuffer:
- * @len:
- *
- * Read at most @len bytes from the internal mime parser buffer.
- *
- * Returns the address of the internal buffer in @databuffer,
- * and the length of useful data.
- *
- * @len may be specified as INT_MAX, in which case you will
- * get the full remainder of the buffer at each call.
- *
- * Note that no parsing of the data read through this function
- * occurs, so no state changes occur, but the seek position
- * is updated appropriately.
- *
- * Return value: The number of bytes available, or -1 on error.
- **/
-int
-camel_mime_parser_read(CamelMimeParser *m, const char **databuffer, int len)
-{
- struct _header_scan_state *s = _PRIVATE(m);
- int there;
-
- if (len == 0)
- return 0;
-
- d(printf("parser::read() reading %d bytes\n", len));
-
- there = MIN(s->inend - s->inptr, len);
- d(printf("parser::read() there = %d bytes\n", there));
- if (there > 0) {
- *databuffer = s->inptr;
- s->inptr += there;
- return there;
- }
-
- if (folder_read(s) == -1)
- return -1;
-
- there = MIN(s->inend - s->inptr, len);
- d(printf("parser::read() had to re-read, now there = %d bytes\n", there));
-
- *databuffer = s->inptr;
- s->inptr += there;
-
- return there;
-}
-
-/**
- * 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)
-{
- if (s->parts && s->parts->atleast > h->boundarylenfinal)
- h->atleast = s->parts->atleast;
- else
- h->atleast = MAX(h->boundarylenfinal, 1);
-
- 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);
- if (h->pretext)
- g_byte_array_free(h->pretext, TRUE);
- if (h->posttext)
- g_byte_array_free(h->posttext, TRUE);
- if (h->from_line)
- g_byte_array_free(h->from_line, TRUE);
- g_free(h);
- } else {
- g_warning("Header stack underflow!\n");
- }
-}
-
-static int
-folder_scan_skip_line(struct _header_scan_state *s, GByteArray *save)
-{
- 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')
- ;
-
- if (save)
- g_byte_array_append(save, s->inptr, inptr-s->inptr);
-
- 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; /* 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", s->atleast, 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->boundarylenfinal <= len) {
- int extra = part->boundarylenfinal - part->boundarylen;
-
- /* check the extra stuff on an final boundary, normally -- for mime parts */
- if (extra>0) {
- *lastone = memcmp(&boundary[part->boundarylen],
- &part->boundary[part->boundarylen],
- extra) == 0;
- } else {
- *lastone = TRUE;
- }
- h(printf("checking lastone = %s\n", *lastone?"TRUE":"FALSE"));
- } 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;
-
- 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
- remove trailing \r chars (\n's assumed already removed)
- 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 > 0) { \
- 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; \
- } \
- if (start[headerlen-1] == '\r') \
- headerlen--; \
- 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, newatleast;
- char *start = NULL;
- int len;
- 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
-
- if (s->parts)
- newatleast = s->parts->atleast;
- else
- newatleast = 1;
- *lastone = FALSE;
-
- do {
- s->atleast = newatleast;
-
- h(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+1;
-
- while (inptr<inend) {
- if (!s->midline) {
- if (folder_boundary_check(s, inptr, lastone)) {
- if ((s->outptr>s->outbuf))
- goto header_truncated; /* may not actually be truncated */
-
- goto header_done;
- }
- }
-
- start = inptr;
-
- /* goto next line/sentinal */
- while ((*inptr++)!='\n')
- ;
-
- g_assert(inptr<=s->inend+1);
-
- /* check for sentinal or real end of line */
- if (inptr > inend) {
- h(printf("not at end of line yet, going further\n"));
- /* didn't find end of line within our allowed area */
- inptr = inend;
- s->midline = TRUE;
- header_append(s, start, inptr);
- } else {
- h(printf("got line part: '%.*s'\n", inptr-1-start, start));
- /* got a line, strip and add it, process it */
- s->midline = FALSE;
- header_append(s, start, inptr-1);
-
- /* check for end of headers */
- if (s->outbuf == s->outptr)
- goto header_done;
-
- /* check for continuation/compress headers, we have atleast 1 char here to work with */
- if (inptr[0] == ' ' || inptr[0] == '\t') {
- h(printf("continuation\n"));
- /* TODO: this wont catch multiple space continuation across a read boundary, but
- that is assumed rare, and not fatal anyway */
- do
- inptr++;
- while (*inptr == ' ' || *inptr == '\t');
- inptr--;
- *inptr = ' ';
- } else {
- /* otherwise, complete header, add it */
- s->outptr[0] = 0;
-
- h(printf("header '%.20s' at %d\n", s->outbuf, s->header_start));
-
- header_raw_append_parse(&h->headers, s->outbuf, s->header_start);
- s->outptr = s->outbuf;
- s->header_start = -1;
- }
- }
- }
- s->inptr = inptr;
- }
- h(printf("end of file? read %d bytes\n", len));
- newatleast = 1;
- } while (s->atleast > 1);
-
- if ((s->outptr > s->outbuf) || s->inend > s->inptr) {
- start = s->inptr;
- inptr = s->inend;
- if (inptr > start) {
- if (inptr[-1] == '\n')
- inptr--;
- }
- goto header_truncated;
- }
-
- s->atleast = atleast;
-
- return h;
-
-header_truncated:
- header_append(s, start, inptr);
-
- s->outptr[0] = 0;
- if (s->outbuf == s->outptr)
- goto header_done;
-
- header_raw_append_parse(&h->headers, s->outbuf, s->header_start);
-
- s->outptr = s->outbuf;
-header_done:
- 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, newatleast;
- register char *inptr;
- char *inend;
- char *start;
- int len;
- struct _header_scan_stack *part;
- int onboundary = FALSE;
-
- c(printf("scanning content\n"));
-
- part = s->parts;
- if (part)
- newatleast = part->atleast;
- else
- newatleast = 1;
- *lastone = FALSE;
-
- c(printf("atleast = %d\n", s->atleast));
-
- do {
- s->atleast = newatleast;
-
- 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+1;
- start = inptr;
-
- c(printf("inptr = %p, inend = %p\n", inptr, inend));
-
- while (inptr<inend) {
- if (!s->midline
- && (part = folder_boundary_check(s, inptr, lastone))) {
- onboundary = TRUE;
-
- /* since we truncate the boundary data, we need at least 1 char here spare,
- to remain in the same state */
- if ( (inptr-start) > 1)
- goto content;
-
- /* otherwise, jump to the state of the boundary we actually found */
- goto normal_exit;
- }
-
- /* goto the next line */
- while ((*inptr++)!='\n')
- ;
-
- /* check the sentinal, if we went past the atleast limit, and reset it to there */
- if (inptr > inend) {
- s->midline = TRUE;
- inptr = inend;
- } else {
- s->midline = FALSE;
- }
- }
-
- c(printf("ran out of input, dumping what i have (%d) bytes midline = %s\n",
- inptr-start, s->midline?"TRUE":"FALSE"));
- goto content;
- }
- newatleast = 1;
- } while (s->atleast > 1);
-
- c(printf("length read = %d\n", len));
-
- if (s->inend > s->inptr) {
- start = s->inptr;
- inptr = s->inend;
- goto content;
- }
-
- *length = 0;
- s->atleast = atleast;
- return NULL;
-
-content:
- part = s->parts;
-normal_exit:
- s->atleast = atleast;
- s->inptr = inptr;
-
- *data = start;
- /* if we hit a boundary, we should not include the closing \n */
- if (onboundary && (inptr-start)>0)
- *length = inptr-start-1;
- else
- *length = inptr-start;
-
- /*printf("got %scontent: '%.*s'\n", 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) {
- camel_object_unref((CamelObject *)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->scan_pre_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) {
- camel_object_unref((CamelObject *)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)
- camel_object_unref((CamelObject *)s->stream);
- s->stream = stream;
- camel_object_ref((CamelObject *)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 ", states[hb->savestate], hb->boundary);
- if (hb->content_type) {
- printf("(%s/%s)", hb->content_type->type, hb->content_type->subtype);
- } else {
- printf("(default)");
- }
- printf("\n");
- hb = hb->parent;
- }
- printf("\n");
- });
-
- switch (s->state) {
-
-#ifdef USE_FROM
- case HSCAN_INITIAL:
- if (s->scan_from) {
- h = g_malloc0(sizeof(*h));
- h->boundary = g_strdup("From ");
- h->boundarylen = strlen(h->boundary);
- h->boundarylenfinal = h->boundarylen;
- h->from_line = g_byte_array_new();
- folder_push_part(s, h);
- s->state = HSCAN_PRE_FROM;
- } else {
- s->start_of_from = -1;
- goto scan_header;
- }
-
- case HSCAN_PRE_FROM:
-
- h = s->parts;
- do {
- hb = folder_scan_content(s, &state, databuffer, datalength);
- if (s->scan_pre_from && *datalength > 0) {
- d(printf("got pre-from content %d bytes\n", *datalength));
- return;
- }
- } 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->from_line);
- h->savestate = HSCAN_INITIAL;
- s->state = HSCAN_FROM;
- } else {
- folder_pull_part(s);
- s->state = HSCAN_EOF;
- }
- return;
-#else
- case HSCAN_INITIAL:
- case HSCAN_PRE_FROM:
-#endif /* !USE_FROM */
-
- scan_header:
- 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->boundarylenfinal = h->boundarylen+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, "news")
- /*|| !strcasecmp(ct->subtype, "partial")*/) {
- type = HSCAN_MESSAGE;
- }
- }
- } else {
- /* make the default type for multipart/digest be message/rfc822 */
- if ((s->parts
- && header_content_type_is(s->parts->content_type, "multipart", "digest"))) {
- ct = header_content_type_decode("message/rfc822");
- type = HSCAN_MESSAGE;
- d(printf("parent was multipart/digest, autoupgrading to message/rfc822?\n"));
- /* maybe we should do this too?
- header_raw_append_parse(&h->headers, "Content-Type: message/rfc822", -1);*/
- }
- }
- 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);
-
- d(printf ("\n\nOriginal content: '"));
- d(fwrite(*databuffer, sizeof(char), *datalength, stdout));
- d(printf("'\n"));
-
- if (*datalength > 0) {
- while (f) {
- camel_mime_filter_filter(f->filter, *databuffer, *datalength, presize,
- databuffer, datalength, &presize);
- d(printf ("Filtered content (%s): '",
- camel_type_to_name(((CamelObject *)f->filter)->s.type)));
- d(fwrite(*databuffer, sizeof(char), *datalength, stdout));
- d(printf("'\n"));
- f = f->next;
- }
- return;
- }
- } while (hb == h && *datalength > 0);
-
- /* check for any filter completion data */
- if (*datalength > 0) {
- while (f) {
- camel_mime_filter_complete(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) {
- /* instead of a new state, we'll just store it locally and provide
- an accessor function */
- d(printf("Multipart %s Content %p: '%.*s'\n",
- h->prestage>0?"post":"pre", h, *datalength, *databuffer));
- if (h->prestage > 0) {
- if (h->posttext == NULL)
- h->posttext = g_byte_array_new();
- g_byte_array_append(h->posttext, *databuffer, *datalength);
- } else {
- if (h->pretext == NULL)
- h->pretext = g_byte_array_new();
- g_byte_array_append(h->pretext, *databuffer, *datalength);
- }
- }
- } while (hb==h && *datalength>0);
- h->prestage++;
- if (*datalength==0 && hb==h) {
- d(printf("got boundary: %s\n", hb->boundary));
- folder_scan_skip_line(s, NULL);
- 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:
- case HSCAN_PRE_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;
- default:
- /* FIXME: not sure if this is entirely right */
- }
-}
-
-#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();
- folder_scan_init_with_fd(s, 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")) {
-#if 0
- folder_push_filter_charset(s, "UTF-8", charset);
-#endif
- } else {
- charset = NULL;
- }
- } else {
- charset = NULL;
- }
-
- encoding = header_raw_find(&s->parts->headers, "Content-transfer-encoding", 0);
- 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++);
-#if 0
- folder_push_filter_save(s, attachname);
-#endif
- g_free(attachname);
-#if 0
- folder_push_filter_mime(s, 0);
-#endif
- }
- if (encoding && !strncasecmp(encoding, " quoted-printable", 17)) {
- printf("adding quoted-printable filter\n");
- attachname = g_strdup_printf("attach.%d.%d", i, attach++);
-#if 0
- folder_push_filter_save(s, attachname);
-#endif
- g_free(attachname);
-#if 0
- folder_push_filter_mime(s, 1);
-#endif
- }
-
- break;
- case HSCAN_BODY:
- printf("got body %d '%.*s'\n", len, len, data);
- break;
- case HSCAN_BODY_END:
- printf("end body %d '%.*s'\n", len, len, data);
- if (encoding && !strncasecmp(encoding, " base64", 7)) {
- printf("removing filters\n");
-#if 0
- folder_filter_pull(s);
- folder_filter_pull(s);
-#endif
- }
- if (encoding && !strncasecmp(encoding, " quoted-printable", 17)) {
- printf("removing filters\n");
-#if 0
- folder_filter_pull(s);
- folder_filter_pull(s);
-#endif
- }
- if (charset) {
-#if 0
- folder_filter_pull(s);
-#endif
- 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 cef51696df..0000000000
--- a/camel/camel-mime-parser.h
+++ /dev/null
@@ -1,133 +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) CAMEL_CHECK_CAST (obj, camel_mime_parser_get_type (), CamelMimeParser)
-#define CAMEL_MIME_PARSER_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mime_parser_get_type (), CamelMimeParserClass)
-#define CAMEL_IS_MIME_PARSER(obj) CAMEL_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_PRE_FROM, /* data before a 'From' line */
- 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_PRE_FROM_END, /* pre from end */
- 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);
-/* Do we want to know about the pre-from data? */
-void camel_mime_parser_scan_pre_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 *);
-
-/* read through the parser */
-int camel_mime_parser_read(CamelMimeParser *m, const char **databuffer, int len);
-
-/* 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 *);
-
-/* get multipart pre/postface */
-const char *camel_mime_parser_preface(CamelMimeParser *m);
-const char *camel_mime_parser_postface(CamelMimeParser *m);
-
-/* return the from line content */
-const char *camel_mime_parser_from_line(CamelMimeParser *m);
-
-/* 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 6d9f7e1804..0000000000
--- a/camel/camel-mime-part-utils.c
+++ /dev/null
@@ -1,243 +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 "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"
-#include "camel-mime-filter-crlf.h"
-
-#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(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 = 0, end;
- CamelMimeFilter *fdec = NULL, *fcrlf = NULL, *fch = NULL;
- struct _header_content_type *ct;
- int decid=-1, crlfid=-1, chrid=-1;
- CamelStream *source;
- CamelSeekableStream *seekable_source = NULL;
- 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) {
- camel_object_ref((CamelObject *)source);
- if (CAMEL_IS_SEEKABLE_STREAM (source)) {
- seekable_source = CAMEL_SEEKABLE_STREAM (source);
- }
- }
-
- /* 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, we also need to do CRLF->LF and may 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 (fdec) {
- d(printf("Adding CRLF conversion filter\n"));
- fcrlf = (CamelMimeFilter *)camel_mime_filter_crlf_new(CAMEL_MIME_FILTER_CRLF_DECODE,
- CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
- crlfid = camel_mime_parser_filter_add(mp, fcrlf);
- }
-
- 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 (seekable_source /* !cache */) {
- start = camel_mime_parser_tell(mp) + seekable_source->bound_start;
- }
- while ( camel_mime_parser_step(mp, &buf, &len) != HSCAN_BODY_END ) {
- d(printf("appending o/p data: %d: %.*s\n", len, len, buf));
- if (buffer) {
- if (buffer->len > 20480 && seekable_source) {
- /* 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);
- camel_object_unref ((CamelObject *)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 (fcrlf) {
- camel_mime_filter_reset(fcrlf);
- camel_stream_filter_add(filter, fcrlf);
- }
- if (fch) {
- camel_mime_filter_reset(fch);
- camel_stream_filter_add(filter, fch);
- }
- camel_data_wrapper_construct_from_stream (dw, (CamelStream *)filter);
- camel_object_unref ((CamelObject *)filter);
- } else {
- camel_data_wrapper_construct_from_stream (dw, sub);
- }
- camel_object_unref ((CamelObject *)sub);
- }
-
- camel_mime_parser_filter_remove(mp, decid);
- camel_mime_parser_filter_remove(mp, crlfid);
- camel_mime_parser_filter_remove(mp, chrid);
-
- if (fdec)
- camel_object_unref((CamelObject *)fdec);
- if (fcrlf)
- camel_object_unref((CamelObject *)fcrlf);
- if (fch)
- camel_object_unref((CamelObject *)fch);
- if (source)
- camel_object_unref((CamelObject *)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_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;
-
-#ifndef NO_WARNINGS
-#warning This should use a camel-mime-multipart
-#endif
- d(printf("Creating multi-part\n"));
- content = (CamelDataWrapper *)camel_multipart_new();
-
- /* FIXME: use the real boundary? */
- camel_multipart_set_boundary((CamelMultipart *)content, NULL);
- 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);
- camel_object_unref ((CamelObject *)bodypart);
- }
-
- /* these are only return valid data in the MULTIPART_END state */
- camel_multipart_set_preface((CamelMultipart *)content, camel_mime_parser_preface(mp));
- camel_multipart_set_postface((CamelMultipart *)content, camel_mime_parser_postface(mp));
-
- d(printf("Created multi-part\n"));
- break; }
- default:
- g_warning("Invalid state encountered???: %d", camel_mime_parser_state(mp));
- }
- if (content) {
-#ifndef NO_WARNINGS
-#warning there just has got to be a better way ... to transfer the mime-type to the datawrapper
-#endif
- /* 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);
- camel_object_unref ((CamelObject *)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 4409ee5f72..0000000000
--- a/camel/camel-mime-part.c
+++ /dev/null
@@ -1,745 +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 "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-mime-filter-crlf.h"
-#include "camel-mime-filter-charset.h"
-#include "camel-exception.h"
-
-#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(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 GHashTable *header_formatted_table;
-
-static CamelMediumClass *parent_class=NULL;
-
-/* Returns the class for a CamelMimePart */
-#define CMP_CLASS(so) CAMEL_MIME_PART_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CMD_CLASS(so) CAMEL_MEDIUM_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-/* 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);
-
- header_formatted_table = g_hash_table_new(g_strcase_hash, g_strcase_equal);
- g_hash_table_insert(header_formatted_table, "Content-Type", (void *)1);
- g_hash_table_insert(header_formatted_table, "Content-Disposition", (void *)1);
- g_hash_table_insert(header_formatted_table, "To", (void *)1);
- g_hash_table_insert(header_formatted_table, "From", (void *)1);
- g_hash_table_insert(header_formatted_table, "Cc", (void *)1);
- g_hash_table_insert(header_formatted_table, "Bcc", (void *)1);
- g_hash_table_insert(header_formatted_table, "Message-ID", (void *)1);
-}
-
-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);
-
- parent_class = CAMEL_MEDIUM_CLASS (camel_type_get_global_classfuncs (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;
-}
-
-static void
-camel_mime_part_init (gpointer object, gpointer klass)
-{
- CamelMimePart *camel_mime_part = CAMEL_MIME_PART (object);
-
- camel_mime_part->content_type = header_content_type_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;
-}
-
-
-static void
-camel_mime_part_finalize (CamelObject *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)
- header_content_type_unref (mime_part->content_type);
-
- header_raw_clear(&mime_part->headers);
-}
-
-
-
-CamelType
-camel_mime_part_get_type (void)
-{
- static CamelType camel_mime_part_type = CAMEL_INVALID_TYPE;
-
- if (camel_mime_part_type == CAMEL_INVALID_TYPE) {
- camel_mime_part_type = camel_type_register (CAMEL_MEDIUM_TYPE, "CamelMimePart",
- sizeof (CamelMimePart),
- sizeof (CamelMimePartClass),
- (CamelObjectClassInitFunc) camel_mime_part_class_init,
- NULL,
- (CamelObjectInitFunc) camel_mime_part_init,
- (CamelObjectFinalizeFunc) camel_mime_part_finalize);
- }
-
- return camel_mime_part_type;
-}
-
-
-/* **** */
-
-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 */
-
- 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 = g_strstrip (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:
- if (mime_part->content_type)
- header_content_type_unref (mime_part->content_type);
- mime_part->content_type = header_content_type_decode (header_value);
- break;
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-static void
-set_header (CamelMedium *medium, const char *header_name, const void *header_value)
-{
- CamelMimePart *part = CAMEL_MIME_PART (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 = CAMEL_MIME_PART (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 */
-
- /* 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)
-{
- char *text = header_encode_string (description);
-
- camel_medium_set_header (CAMEL_MEDIUM (mime_part),
- "Content-Description", text);
- g_free (text);
-}
-
-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-Disposition", 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, const 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) {
- const gchar *name = header_param (mime_part->disposition->params, "filename");
- if (name)
- return name;
- }
-
- return header_content_type_param (mime_part->content_type, "name");
-}
-
-
-/* **** 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);
-}
-
-CamelContentType *
-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);
- CamelContentType *object_content_type;
-
- parent_class->set_content_object (medium, content);
-
- object_content_type = camel_data_wrapper_get_mime_type_field (content);
- if (mime_part->content_type != object_content_type) {
- char *txt;
-
- txt = header_content_type_format (object_content_type);
- camel_medium_set_header (CAMEL_MEDIUM (mime_part), "Content-Type", txt);
- g_free(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 */
-#ifndef NO_WARNINGS
-#warning content-languages should be stored as a header
-#endif
-
- if (mp->headers) {
- struct _header_raw *h = mp->headers;
- char *val;
-
- /* fold/write the headers. But dont fold headers that are already formatted
- (e.g. ones with parameter-lists, that we know about, and have created) */
- while (h) {
- val = h->value;
- if (val == NULL) {
- g_warning("h->value is NULL here for %s", h->name);
- count = 0;
- } else if (g_hash_table_lookup(header_formatted_table, h->name) == NULL) {
- val = header_fold(val, strlen(h->name));
- count = camel_stream_printf(stream, "%s%s%s\n", h->name, isspace(val[0]) ? ":" : ": ", val);
- g_free(val);
- } else {
- count = camel_stream_printf(stream, "%s%s%s\n", h->name, isspace(val[0]) ? ":" : ": ", val);
- }
- 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;
- CamelMimeFilter *charenc = NULL;
- const char *charset;
-
- 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 (header_content_type_is(mp->content_type, "text", "*")) {
- charset = header_content_type_param(mp->content_type, "charset");
- if (!(charset == NULL || !strcasecmp(charset, "us-ascii") || !strcasecmp(charset, "utf-8"))) {
- charenc = (CamelMimeFilter *)camel_mime_filter_charset_new_convert("utf-8", charset);
- }
- }
-
- if (filter || charenc) {
- filter_stream = camel_stream_filter_new_with_stream(stream);
-
- /* if we have a character encoder, add that always */
- if (charenc) {
- camel_stream_filter_add(filter_stream, charenc);
- camel_object_unref((CamelObject *)charenc);
- }
-
- /* we only re-do crlf on encoded blocks */
- if (filter && header_content_type_is(mp->content_type, "text", "*")) {
- CamelMimeFilter *crlf = camel_mime_filter_crlf_new(CAMEL_MIME_FILTER_CRLF_ENCODE,
- CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
-
- camel_stream_filter_add(filter_stream, crlf);
- camel_object_unref((CamelObject *)crlf);
-
- }
-
- if (filter) {
- camel_stream_filter_add(filter_stream, filter);
- camel_object_unref((CamelObject *)filter);
- }
-
- stream = (CamelStream *)filter_stream;
- }
-
-#endif
- count = camel_data_wrapper_write_to_stream(content, stream);
- if (filter_stream) {
- camel_stream_flush((CamelStream *)filter_stream);
- camel_object_unref((CamelObject *)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_MESSAGE:
- /* set the default type of a message always */
- if (dw->content_type)
- header_content_type_unref (dw->content_type);
- dw->content_type = header_content_type_decode ("message/rfc822");
- case HSCAN_HEADER:
- 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"));
-#ifndef NO_WARNINGS
-#warning "Need to work out how to detect a (fatally) bad parse in the parser"
-#endif
- 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);
- }
- camel_object_unref((CamelObject *)mp);
- return ret;
-}
-
-/* this must be kept in sync with the header */
-static const char *encodings[] = {
- "",
- "7bit",
- "8bit",
- "base64",
- "quoted-printable",
- "binary"
-};
-
-const char *
-camel_mime_part_encoding_to_string (CamelMimePartEncodingType encoding)
-{
- if (encoding >= sizeof(encodings)/sizeof(encodings[0]))
- encoding = 0;
-
- return encodings[encoding];
-}
-
-/* FIXME I am not sure this is the correct way to do this. */
-CamelMimePartEncodingType
-camel_mime_part_encoding_from_string (const gchar *string)
-{
- int i;
-
- if (string != NULL) {
- for (i=0;i<sizeof(encodings)/sizeof(encodings[0]);i++)
- if (!strcasecmp(string, encodings[i]))
- return i;
- }
-
- 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 *)camel_object_new (CAMEL_MIME_PART_TYPE);
-}
-
-/**
- * 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);
- camel_object_unref (CAMEL_OBJECT (stream));
- camel_medium_set_content_object (medium, dw);
- camel_object_unref (CAMEL_OBJECT (dw));
- } else {
- if (medium->content)
- camel_object_unref (CAMEL_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 75f7bff6db..0000000000
--- a/camel/camel-mime-part.h
+++ /dev/null
@@ -1,130 +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) (CAMEL_CHECK_CAST((obj), CAMEL_MIME_PART_TYPE, CamelMimePart))
-#define CAMEL_MIME_PART_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MIME_PART_TYPE, CamelMimePartClass))
-#define CAMEL_IS_MIME_PART(o) (CAMEL_CHECK_TYPE((o), CAMEL_MIME_PART_TYPE))
-
-/* note, if you change this, make sure you change the 'encodings' array in camel-mime-part.c */
-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_ENCODING_BINARY,
- 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;
-
- CamelContentType *content_type;
-
- struct _header_raw *headers; /* mime headers */
-};
-
-typedef struct _CamelMimePartClass {
- CamelMediumClass parent_class;
-
- /* Virtual methods */
- int (*construct_from_parser) (CamelMimePart *, CamelMimeParser *);
-} CamelMimePartClass;
-
-/* Standard Camel function */
-CamelType 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, const 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);
-CamelContentType *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 ad2a200708..0000000000
--- a/camel/camel-mime-utils.c
+++ /dev/null
@@ -1,3401 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- * Jeffrey Stedfast <fejj@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.
- */
-
-/* dont touch this file without my permission - Michael */
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/param.h> /* for MAXHOSTNAMELEN */
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 1024
-#endif
-
-#include <unicode.h>
-#include <iconv.h>
-
-#include <glib.h>
-#include <time.h>
-
-#include <ctype.h>
-#include <errno.h>
-
-#include <regex.h>
-
-#include "camel-mime-utils.h"
-#include "camel-charset-map.h"
-
-#ifdef ENABLE_THREADS
-#include <pthread.h>
-#endif
-
-#ifndef CLEAN_DATE
-#include "broken-date-parser.h"
-#endif
-
-#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)
-
-#define CAMEL_UUDECODE_CHAR(c) (((c) - ' ') & 077)
-
-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 short camel_mime_special_table[256] = {
- 5, 5, 5, 5, 5, 5, 5, 5, 5,231, 7, 5, 5, 39, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 242,448, 76,192,192,192,192,192, 76, 76,448,448, 76,448, 72,324,
- 448,448,448,448,448,448,448,448,448,448, 76, 76, 76, 4, 76, 68,
- 76,448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,
- 448,448,448,448,448,448,448,448,448,448,448,108,236,108,192, 64,
- 192,448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,
- 448,448,448,448,448,448,448,448,448,448,448,192,192,192,192, 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 -DCLEAN_DATE -o buildtable -I.. `glib-config --cflags --libs` -lunicode -DBUILD_TABLE camel-mime-utils.c camel-charset-map.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_QPSAFE = 1<<6,
- IS_ESAFE = 1<<7, /* encoded word safe */
- IS_PSAFE = 1<<8, /* encoded word in phrase safe */
-};
-
-#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)) == 0)
-#define is_qpsafe(x) ((camel_mime_special_table[(unsigned char)(x)] & IS_QPSAFE) != 0)
-#define is_especial(x) ((camel_mime_special_table[(unsigned char)(x)] & IS_ESPECIAL) != 0)
-#define is_psafe(x) ((camel_mime_special_table[(unsigned char)(x)] & IS_PSAFE) != 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 */
-#define CHARS_ESPECIAL "()<>@,;:\"/[]?.=_" /* list of characters that must be encoded.
- encoded word in text specials: rfc 2047 5(1)*/
-#define CHARS_PSPECIAL "!*+-/" /* list of additional characters that can be left unencoded.
- encoded word in phrase specials: rfc 2047 5(3) */
-
-static void
-header_remove_bits(unsigned short bit, unsigned char *vals)
-{
- int i;
-
- for (i=0;vals[i];i++)
- camel_mime_special_table[vals[i]] &= ~ bit;
-}
-
-static void
-header_init_bits(unsigned short bit, unsigned short bitcopy, int remove, unsigned char *vals)
-{
- int i;
- int len = strlen(vals);
-
- 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;
- if (i<32)
- camel_mime_special_table[i] |= IS_CTRL;
- if ((i>=33 && i<=60) || (i>=62 && i<=126) || i==32 || i==9)
- camel_mime_special_table[i] |= (IS_QPSAFE|IS_ESAFE);
- if ((i>='0' && i<='9') || (i>='a' && i<='z') || (i>='A' && i<= 'Z'))
- camel_mime_special_table[i] |= IS_PSAFE;
- }
- camel_mime_special_table[127] |= IS_CTRL;
- camel_mime_special_table[' '] |= IS_SPACE;
- header_init_bits(IS_LWSP, 0, 0, CHARS_LWSP);
- header_init_bits(IS_TSPECIAL, IS_CTRL, 0, CHARS_TSPECIAL);
- header_init_bits(IS_SPECIAL, 0, 0, CHARS_SPECIAL);
- header_init_bits(IS_DSPECIAL, 0, FALSE, CHARS_DSPECIAL);
- header_remove_bits(IS_ESAFE, CHARS_ESPECIAL);
- header_init_bits(IS_PSAFE, 0, 0, CHARS_PSPECIAL);
-}
-
-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 short 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, gboolean break_lines, unsigned char *out, int *state, int *save)
-{
- int c1, c2;
- unsigned char *outptr = out;
-
- if (inlen>0)
- outptr += base64_encode_step(in, inlen, break_lines, outptr, state, save);
-
- c1 = ((unsigned char *)save)[1];
- c2 = ((unsigned char *)save)[2];
-
- d(printf("mode = %d\nc1 = %c\nc2 = %c\n",
- (int)((char *)save)[0],
- (int)((char *)save)[1],
- (int)((char *)save)[2]));
-
- switch (((char *)save)[0]) {
- case 2:
- outptr[2] = base64_alphabet[ ( (c2 &0x0f) << 2 ) ];
- g_assert(outptr[2] != 0);
- 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;
- }
- if (break_lines)
- *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, gboolean break_lines, 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 = ((unsigned char *)save)[1]; goto skip1;
- case 2: c1 = ((unsigned char *)save)[1];
- c2 = ((unsigned char *)save)[2]; goto skip2;
- }
-
- /* yes, we jump into the loop, no i'm not going to change it, it's 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 (break_lines && (++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;
-}
-
-
-/**
- * base64_decode_step: decode a chunk of base64 encoded data
- * @in: input stream
- * @len: max length of data to decode
- * @out: output stream
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been decoded
- *
- * Decodes a chunk of base64 encoded data
- **/
-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;
-}
-
-char *
-base64_encode_simple (const char *data, int len)
-{
- unsigned char *out;
- int state = 0, outlen;
- unsigned int save = 0;
-
- out = g_malloc (len * 4 / 3 + 5);
- outlen = base64_encode_close ((unsigned char *)data, len, FALSE,
- out, &state, &save);
- out[outlen] = '\0';
- return (char *)out;
-}
-
-int
-base64_decode_simple (char *data, int len)
-{
- int state = 0;
- unsigned int save = 0;
-
- return base64_decode_step ((unsigned char *)data, len,
- (unsigned char *)data, &state, &save);
-}
-
-
-/**
- * uudecode_step: uudecode a chunk of data
- * @in: input stream
- * @len: max length of data to decode ( normally strlen(in) ??)
- * @out: output stream
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been decoded
- * @uulen: holds the value of the length-char which is used to calculate
- * how many more chars need to be decoded for that 'line'
- *
- * uudecodes a chunk of data. Assumes the "begin <mode> <file name>" line
- * has been stripped off.
- **/
-int
-uudecode_step (unsigned char *in, int len, unsigned char *out, int *state, guint32 *save, char *uulen)
-{
- register unsigned char *inptr, *outptr;
- unsigned char *inend, ch;
- register guint32 saved;
- gboolean last_was_eoln;
- int i;
-
- if (*uulen <= 0)
- last_was_eoln = TRUE;
- else
- last_was_eoln = FALSE;
-
- inend = in + len;
- outptr = out;
- saved = *save;
- i = *state;
- inptr = in;
- while (inptr < inend && *inptr) {
- if (*inptr == '\n' || last_was_eoln) {
- if (last_was_eoln) {
- *uulen = CAMEL_UUDECODE_CHAR (*inptr);
- last_was_eoln = FALSE;
- } else {
- last_was_eoln = TRUE;
- }
-
- inptr++;
- continue;
- }
-
- ch = *inptr++;
-
- if (*uulen > 0) {
- /* save the byte */
- saved = (saved << 8) | ch;
- i++;
- if (i == 4) {
- /* convert 4 uuencoded bytes to 3 normal bytes */
- unsigned char b0, b1, b2, b3;
-
- b0 = saved >> 24;
- b1 = saved >> 16 & 0xff;
- b2 = saved >> 8 & 0xff;
- b3 = saved & 0xff;
-
- if (*uulen >= 3) {
- *outptr++ = CAMEL_UUDECODE_CHAR (b0) << 2 | CAMEL_UUDECODE_CHAR (b1) >> 4;
- *outptr++ = CAMEL_UUDECODE_CHAR (b1) << 4 | CAMEL_UUDECODE_CHAR (b2) >> 2;
- *outptr++ = CAMEL_UUDECODE_CHAR (b2) << 6 | CAMEL_UUDECODE_CHAR (b3);
- } else {
- if (*uulen >= 1) {
- *outptr++ = CAMEL_UUDECODE_CHAR (b0) << 2 | CAMEL_UUDECODE_CHAR (b1) >> 4;
- }
- if (*uulen >= 2) {
- *outptr++ = CAMEL_UUDECODE_CHAR (b1) << 4 | CAMEL_UUDECODE_CHAR (b2) >> 2;
- }
- }
-
- i = 0;
- saved = 0;
- *uulen -= 3;
- }
- } else {
- break;
- }
- }
-
- *save = saved;
- *state = i;
-
- return outptr - out;
-}
-
-/* complete qp encoding */
-int
-quoted_encode_close(unsigned char *in, int len, unsigned char *out, int *state, int *save)
-{
- register unsigned char *outptr = out;
- int last;
-
- if (len>0)
- outptr += quoted_encode_step(in, len, outptr, state, save);
-
- last = *state;
- if (last != -1) {
- /* space/tab must be encoded if it's the last character on
- the line */
- if (is_qpsafe(last) && last!=' ' && last!=9) {
- *outptr++ = last;
- } else {
- *outptr++ = '=';
- *outptr++ = tohex[(last>>4) & 0xf];
- *outptr++ = tohex[last & 0xf];
- }
- }
-
- *save = 0;
- *state = -1;
-
- return outptr-out;
-}
-
-/* perform qp encoding, initialise state to -1 and save to 0 on first invocation */
-int
-quoted_encode_step (unsigned char *in, int len, unsigned char *out, int *statep, int *save)
-{
- register guchar *inptr, *outptr, *inend;
- guchar c;
- register int sofar = *save; /* keeps track of how many chars on a line */
- register int last = *statep; /* keeps track if last char to end was a space cr etc */
-
- inptr = in;
- inend = in + len;
- outptr = out;
- while (inptr < inend) {
- c = *inptr++;
- if (c == '\r') {
- if (last != -1) {
- *outptr++ = '=';
- *outptr++ = tohex[(last >> 4) & 0xf];
- *outptr++ = tohex[last & 0xf];
- sofar += 3;
- }
- last = c;
- } else if (c == '\n') {
- if (last != -1 && last != '\r') {
- *outptr++ = '=';
- *outptr++ = tohex[(last >> 4) & 0xf];
- *outptr++ = tohex[last & 0xf];
- }
- *outptr++ = '\n';
- sofar = 0;
- last = -1;
- } else {
- if (last != -1) {
- if (is_qpsafe(last)) {
- *outptr++ = last;
- sofar++;
- } else {
- *outptr++ = '=';
- *outptr++ = tohex[(last >> 4) & 0xf];
- *outptr++ = tohex[last & 0xf];
- sofar += 3;
- }
- }
-
- if (is_qpsafe(c)) {
- if (sofar > 74) {
- *outptr++ = '=';
- *outptr++ = '\n';
- sofar = 0;
- }
-
- /* delay output of space char */
- if (c==' ' || c=='\t') {
- last = c;
- } else {
- *outptr++ = c;
- sofar++;
- last = -1;
- }
- } else {
- if (sofar > 72) {
- *outptr++ = '=';
- *outptr++ = '\n';
- sofar = 3;
- } else
- sofar += 3;
-
- *outptr++ = '=';
- *outptr++ = tohex[(c >> 4) & 0xf];
- *outptr++ = tohex[c & 0xf];
- last = -1;
- }
- }
- }
- *save = sofar;
- *statep = last;
-
- 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++;
- 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 (mainly by allowing 0x20 <> _)
-*/
-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 */
-/* safemask is the mask to apply to the camel_mime_special_table to determine what
- characters can safely be included without encoding */
-static int
-quoted_encode(const unsigned char *in, int len, unsigned char *out, unsigned short safemask)
-{
- 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 (c==' ') {
- *outptr++ = '_';
- } else if (camel_mime_special_table[c] & safemask) {
- *outptr++ = c;
- } else {
- *outptr++ = '=';
- *outptr++ = tohex[(c >> 4) & 0xf];
- *outptr++ = tohex[c & 0xf];
- }
- }
-
- d(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 =='(' && *inptr != '\0')) {
- while (is_lwsp(*inptr) && inptr != '\0') {
- d2(printf("(%c)", *inptr));
- inptr++;
- }
- d2(printf("\n"));
-
- /* check for comments */
- if (*inptr == '(') {
- int depth = 1;
- inptr++;
- while (depth && (c=*inptr) && *inptr != '\0') {
- 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;
- const char *inbuf;
- char *encname;
- int tmplen;
- int ret;
- char *decword = NULL;
- char *decoded = NULL;
- char *outbase = NULL;
- char *outbuf;
- int inlen, outlen;
- iconv_t ic;
-
- d(printf("rfc2047: 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+16;
- outbase = alloca(outlen);
- outbuf = outbase;
-
- /* TODO: Should this cache iconv converters? */
- ic = iconv_open("UTF-8", encname);
- if (ic != (iconv_t)-1) {
- ret = iconv(ic, &inbuf, &inlen, &outbuf, &outlen);
- if (ret>=0) {
- iconv(ic, NULL, 0, &outbuf, &outlen);
- *outbuf = 0;
- decoded = g_strdup(outbase);
- }
- iconv_close(ic);
- } 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);
-}
-
-/* ok, a lot of mailers are BROKEN, and send iso-latin1 encoded
- headers, when they should just be sticking to US-ASCII
- according to the rfc's. Anyway, since the conversion to utf-8
- is trivial, just do it here without iconv */
-static GString *
-append_latin1(GString *out, const char *in, int len)
-{
- unsigned int c;
-
- while (len) {
- c = (unsigned int)*in++;
- len--;
- if (c & 0x80) {
- out = g_string_append_c(out, 0xc0 | ((c>>6) & 0x3)); /* 110000xx */
- out = g_string_append_c(out, 0x80 | (c&0x3f)); /* 10xxxxxx */
- } else {
- out = g_string_append_c(out, c);
- }
- }
- return out;
-}
-
-/* decodes a simple text, rfc822 */
-static char *
-header_decode_text (const char *in, int inlen)
-{
- GString *out;
- char *inptr, *inend, *start;
- char *decoded;
- unsigned char lastc = 0;
- int wasdword = FALSE;
-
- out = g_string_new ("");
- start = inptr = (char *) in;
- inend = inptr + inlen;
-
- while (inptr && inptr < inend) {
- unsigned char c = *inptr++;
-
- if (is_lwsp(c)) {
- char *word, *dword;
- guint len;
-
- len = inptr - start - 1;
- word = start;
-
- dword = rfc2047_decode_word (word, len);
-
- if (dword) {
- if (!wasdword && lastc)
- g_string_append_c(out, lastc);
-
- g_string_append (out, dword);
- g_free (dword);
- lastc = c;
- wasdword = TRUE;
- } else {
- if (lastc)
- g_string_append_c(out, lastc);
- out = append_latin1 (out, word, len);
- lastc = c;
- wasdword = FALSE;
- }
-
- start = inptr;
- }
- }
-
- if (inptr - start) {
- char *word, *dword;
- guint len;
-
- len = inptr - start;
- word = start;
-
- dword = rfc2047_decode_word (word, len);
-
- if (dword) {
- if (!wasdword && lastc)
- g_string_append_c(out, lastc);
- g_string_append (out, dword);
- g_free (dword);
- } else {
- if (lastc)
- g_string_append_c(out, lastc);
- out = g_string_append_len (out, word, len);
- }
- }
-
- decoded = out->str;
- g_string_free (out, FALSE);
-
- return decoded;
-}
-
-#if 0 /* This is broken */
-
-/* so in what way is it broken? */
-
-/* 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));
- g_free (decword);
- } else {
- out = append_latin1(out, inptr, encend-inptr+2);
- }
- inptr = encend+2;
- }
- out = append_latin1(out, inptr, inend-inptr);
-
- encstart = out->str;
- g_string_free(out, FALSE);
-
- return encstart;
-}
-#endif
-
-char *
-header_decode_string(const char *in)
-{
- if (in == NULL)
- return NULL;
- return header_decode_text(in, strlen(in));
-}
-
-/* how long a sequence of pre-encoded words should be less than, to attempt to
- fit into a properly folded word. Only a guide. */
-#define CAMEL_FOLD_PREENCODED (24)
-
-/* FIXME: needs a way to cache iconv opens for different charsets? */
-static void
-rfc2047_encode_word(GString *outstring, const char *in, int len, const char *type, unsigned short safemask)
-{
- iconv_t ic = (iconv_t *)-1;
- char *buffer, *out, *ascii;
- size_t inlen, outlen, enclen, bufflen;
- const char *inptr, *p;
- int first = 1;
-
- d(printf("Converting [%d] '%.*s' to %s\n", len, len, in, type));
-
- /* convert utf8->encoding */
- bufflen = len*6+16;
- buffer = alloca(bufflen);
- inlen = len;
- inptr = (char *) in;
-
- ascii = alloca(bufflen);
-
- if (strcasecmp(type, "UTF-8") != 0)
- ic = iconv_open(type, "UTF-8");
-
- while (inlen) {
- int convlen, i, proclen;
-
- /* break up words into smaller bits, what we really want is encoded + overhead < 75,
- but we'll just guess what that means in terms of input chars, and assume its good enough */
-
- out = buffer;
- outlen = bufflen;
-
- if (ic == (iconv_t) -1) {
- /* native encoding case, the easy one (?) */
- /* we work out how much we can convert, and still be in length */
- /* proclen will be the result of input characters that we can convert, to the nearest
- (approximated) valid utf8 char */
- convlen = 0;
- proclen = 0;
- p = inptr;
- i = 0;
- while (p < (in+len) && convlen < (75 - strlen("=?utf-8?q??="))) {
- unsigned char c = *p++;
-
- if (c >= 0xc0)
- proclen = i;
- i++;
- if (c < 0x80)
- proclen = i;
- if (camel_mime_special_table[c] & safemask)
- convlen += 1;
- else
- convlen += 3;
- }
- /* well, we probably have broken utf8, just copy it anyway what the heck */
- if (proclen == 0) {
- w(g_warning("Appear to have truncated utf8 sequence"));
- proclen = inlen;
- }
- memcpy(out, inptr, proclen);
- inptr += proclen;
- inlen -= proclen;
- out += proclen;
- } else {
- /* well we could do similar, but we can't (without undue effort), we'll just break it up into
- hopefully-small-enough chunks, and leave it at that */
- convlen = MIN(inlen, CAMEL_FOLD_PREENCODED);
- p = inptr;
- if (iconv(ic, &inptr, &convlen, &out, &outlen) == -1) {
- w(g_warning("Conversion problem: conversion truncated: %s", strerror(errno)));
- /* blah, we include it anyway, better than infinite loop ... */
- inptr = p + convlen;
- } else {
- /* make sure we flush out any shift state */
- iconv(ic, NULL, 0, &out, &outlen);
- }
- inlen -= (inptr - p);
- }
-
- enclen = out-buffer;
-
- /* create token */
- out = ascii;
- if (first)
- first = 0;
- else
- *out++ = ' ';
- out += sprintf(out, "=?%s?Q?", type);
- out += quoted_encode(buffer, enclen, out, safemask);
- sprintf(out, "?=");
-
- d(printf("converted part = %s\n", ascii));
-
- g_string_append(outstring, ascii);
- }
-
- if (ic == (iconv_t) -1) {
- iconv_close(ic);
- }
-}
-
-
-/* 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 */
- 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)) {
- /* we've reached the end of a 'word' */
- switch (encoding) {
- case 0:
- out = g_string_append_len(out, start, inptr-start);
- break;
- case 1:
- rfc2047_encode_word(out, start, inptr-start-1, "ISO-8859-1", IS_ESAFE);
- out = g_string_append_c (out, c);
- break;
- case 2:
- rfc2047_encode_word(out, start, inptr-start-1,
- camel_charset_best(start, inptr-start-1), IS_ESAFE);
- out = g_string_append_c(out, c);
- break;
- }
- 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) {
- switch (encoding) {
- case 0:
- out = g_string_append_len(out, start, inptr-start);
- break;
- case 1:
- rfc2047_encode_word(out, start, inptr-start, "ISO-8859-1", IS_ESAFE);
- break;
- case 2:
- rfc2047_encode_word(out, start, inptr-start,
- camel_charset_best(start, inptr-start-1), IS_ESAFE);
- break;
- }
- }
- outstr = out->str;
- g_string_free(out, FALSE);
- return outstr;
-}
-
-/* apply quoted-string rules to a string */
-static void
-quote_word(GString *out, gboolean do_quotes, const char *start, int len)
-{
- int i, c;
-
- /* TODO: What about folding on long lines? */
- if (do_quotes)
- g_string_append_c(out, '"');
- for (i=0;i<len;i++) {
- c = *start++;
- if (c == '\"' || c=='\\' || c=='\r')
- g_string_append_c(out, '\\');
- g_string_append_c(out, c);
- }
- if (do_quotes)
- g_string_append_c(out, '"');
-}
-
-/* incrementing possibility for the word type */
-enum _phrase_word_t {
- WORD_ATOM,
- WORD_QSTRING,
- WORD_2047
-};
-
-struct _phrase_word {
- const unsigned char *start, *end;
- enum _phrase_word_t type;
- int encoding;
-};
-
-/* split the input into words
- with info about each word
- merge common word types
- clean up
-*/
-/* encodes a phrase sequence (different quoting/encoding rules to strings) */
-char *
-header_encode_phrase(const unsigned char *in)
-{
- GString *out;
- const unsigned char *inptr = in, *start, *last;
- int encoding;
- char *outstr;
- struct _phrase_word *word, *next;
- enum _phrase_word_t type;
- GList *words = NULL, *wordl, *nextl;
- int count;
-
- if (in == NULL)
- return NULL;
-
- out = g_string_new("");
-
-#if 0
- {
- int i;
-
- printf("encoding phrase: %s\n", in);
- for (i=0;in[i];i++) {
- printf(" %02x", in[i]);
- if (((i) & 15) == 15)
- printf("\n");
- }
- printf("\n");
- }
-#endif
-
- /* break the input into words */
- type = WORD_ATOM;
- count = 0;
- last = inptr;
- start = inptr;
- encoding = 0;
- 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;
- /* save this word out, multiple whitespace is not explicitly counted (?) */
- if (unicode_isspace(c)) {
- if (count > 0) {
- word = g_malloc0(sizeof(*word));
- word->start = start;
- word->end = last;
- word->type = type;
- word->encoding = encoding;
- words = g_list_append(words, word);
- count = 0;
- }
- start = inptr;
- type = WORD_ATOM;
- encoding = 0;
- } else {
- count++;
- if (c<128) {
- if (!is_atom(c))
- type = MAX(type, WORD_QSTRING);
- } else if (c>127 && c < 256) {
- type = WORD_2047;
- encoding = MAX(encoding, 1);
- } else if (c >=256) {
- type = WORD_2047;
- encoding = MAX(encoding, 2);
- }
- }
- last = inptr;
- }
- if (count > 0) {
- word = g_malloc0(sizeof(*word));
- word->start = start;
- word->end = last;
- word->type = type;
- word->encoding = encoding;
- words = g_list_append(words, word);
- }
-
- /* now scan the list, checking for words of similar types that can be merged */
- wordl = words;
- while (wordl) {
- word = wordl->data;
- /* leave atoms as atoms (unless they're surrounded by quoted words??) */
- if (word->type != WORD_ATOM) {
- nextl = g_list_next(wordl);
- while (nextl) {
- next = nextl->data;
- /* merge nodes of the same type AND we are not creating too long a string */
- if (word->type == next->type) {
- if (next->end - word->start < CAMEL_FOLD_PREENCODED) {
- word->end = next->end;
- words = g_list_remove_link(words, nextl);
- g_free(next);
- nextl = g_list_next(wordl);
- } else {
- /* if it is going to be too long, make sure we include the separating whitespace */
- word->end = next->start;
- break;
- }
- } else {
- break;
- }
- }
- }
- wordl = g_list_next(wordl);
- }
-
- /* output words now with spaces between them */
- wordl = words;
- while (wordl) {
- word = wordl->data;
- switch (word->type) {
- case WORD_ATOM:
- out = g_string_append_len(out, word->start, word->end-word->start);
- break;
- case WORD_QSTRING:
- quote_word(out, TRUE, word->start, word->end-word->start);
- break;
- case WORD_2047:
- if (word->encoding == 1)
- rfc2047_encode_word(out, word->start, word->end-word->start, "ISO-8859-1", IS_PSAFE);
- else
- rfc2047_encode_word(out, word->start, word->end-word->start,
- camel_charset_best(word->start, word->end-word->start), IS_PSAFE);
- break;
- }
-
- /* copy across the right number of spaces between words */
- nextl = g_list_next(wordl);
- if (nextl) {
- int i;
- next = nextl->data;
- /* if they are adjacent, it means we already had the spaces encoded internally,
- so now we just need to output 1 space */
- i=next->start-word->end;
- if (i==0)
- i=1;
- for (;i>0;i--)
- out = g_string_append_c(out, ' ');
- }
-
- g_free(word);
- wordl = g_list_next(wordl);
- }
- /* and we no longer need the list */
- g_list_free(words);
-
- 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 || (ct->type == NULL && ct->subtype == 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;
- const char *comment = 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, *last;
-
- /* perform internationalised decoding, and append */
- text = header_decode_string(pre);
- name = g_string_append(name, text);
- last = pre;
- g_free(text);
-
- pre = header_decode_word(&inptr);
- if (pre) {
- int l = strlen(last);
- int p = strlen(pre);
- /* dont append ' ' between sucsessive encoded words */
- if ((l>6 && last[l-2] == '?' && last[l-1] == '=')
- && (p>6 && pre[0] == '=' && pre[1] == '?')) {
- /* dont append ' ' */
- } else {
- name = g_string_append_c(name, ' ');
- }
- }
- g_free(last);
- }
- 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);
- }
- comment = inptr;
- header_decode_lwsp(&inptr);
- }
- g_free(pre);
-
- /* now at '@' domain part */
- if (*inptr == '@') {
- char *dom;
-
- inptr++;
- addr = g_string_append_c(addr, '@');
- comment = inptr;
- 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 && comment != NULL && inptr>comment) { /* check for comment after address */
- char *text, *tmp;
- const char *comstart, *comend;
-
- /* this is a bit messy, we go from the last known position, because
- decode_domain/etc skip over any comments on the way */
- /* FIXME: This wont detect comments inside the domain itself,
- but nobody seems to use that feature anyway ... */
-
- d(printf("checking for comment from '%s'\n", comment));
-
- comstart = strchr(comment, '(');
- if (comstart) {
- comstart++;
- header_decode_lwsp(&inptr);
- comend = inptr-1;
- while (comend > comstart && comend[0] != ')')
- comend--;
-
- if (comend > comstart) {
- d(printf(" looking at subset '%.*s'\n", comend-comstart, comstart));
- tmp = g_strndup(comstart, comend-comstart);
- 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;
-}
-
-static char *
-header_msgid_decode_internal(const char **in)
-{
- const char *inptr = *in;
- char *msgid = NULL;
-
- d(printf("decoding Message-ID: '%s'\n", *in));
-
- 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));
- }
- *in = inptr;
-
- return msgid;
-}
-
-char *
-header_msgid_decode(const char *in)
-{
- if (in == NULL)
- return NULL;
-
- return header_msgid_decode_internal(&in);
-}
-
-void
-header_references_list_append_asis(struct _header_references **list, char *ref)
-{
- struct _header_references *w = (struct _header_references *)list, *n;
- while (w->next)
- w = w->next;
- n = g_malloc(sizeof(*n));
- n->id = ref;
- n->next = 0;
- w->next = n;
-}
-
-int
-header_references_list_size(struct _header_references **list)
-{
- int count = 0;
- struct _header_references *w = *list;
- while (w) {
- count++;
- w = w->next;
- }
- return count;
-}
-
-void
-header_references_list_clear(struct _header_references **list)
-{
- struct _header_references *w = *list, *n;
- while (w) {
- n = w->next;
- g_free(w->id);
- g_free(w);
- w = n;
- }
- *list = NULL;
-}
-
-/* generate a list of references, from most recent up */
-struct _header_references *
-header_references_decode(const char *in)
-{
- const char *inptr = in;
- struct _header_references *head = NULL, *node;
- char *id, *word;
-
- if (in == NULL || in[0] == '\0')
- return NULL;
-
- while (*inptr) {
- header_decode_lwsp(&inptr);
- if (*inptr == '<') {
- id = header_msgid_decode_internal(&inptr);
- if (id) {
- node = g_malloc(sizeof(*node));
- node->next = head;
- head = node;
- node->id = id;
- }
- } else {
- word = header_decode_word(&inptr);
- if (word)
- g_free (word);
- else if (*inptr != '\0')
- inptr++; /* Stupid mailer tricks */
- }
- }
-
- return head;
-}
-
-struct _header_references *
-header_references_dup(const struct _header_references *list)
-{
- struct _header_references *new = NULL, *tmp;
-
- while (list) {
- tmp = g_new(struct _header_references, 1);
- tmp->next = new;
- tmp->id = g_strdup(list->id);
- new = tmp;
- list = list->next;
- }
- return new;
-}
-
-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));
-
- 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_decode_param_list(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;
-}
-
-struct _header_param *
-header_param_list_decode(const char *in)
-{
- if (in == NULL)
- return NULL;
-
- return header_decode_param_list(&in);
-}
-
-void
-header_param_list_format_append(GString *out, struct _header_param *p)
-{
- int len = out->len;
- char *ch;
-
- while (p) {
- int here = out->len;
- if (len+strlen(p->name)+strlen(p->value)>60) {
- out = g_string_append(out, ";\n\t");
- len = 0;
- } else
- out = g_string_append (out, "; ");
-
- g_string_sprintfa(out, "%s=", p->name);
-
- for (ch = p->value; *ch; ch++) {
- if (is_tspecial(*ch))
- break;
- }
- if (!*ch)
- g_string_append(out, p->value);
- else
- quote_word(out, TRUE, p->value, strlen(p->value));
-
- len += (out->len - here);
- p = p->next;
- }
-}
-
-char *
-header_param_list_format(struct _header_param *p)
-{
- GString *out = g_string_new("");
- char *ret;
-
- header_param_list_format_append(out, p);
- ret = out->str;
- g_string_free(out, FALSE);
- return ret;
-}
-
-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_decode_param_list(&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_type_simple(struct _header_content_type *ct)
-{
- return g_strdup_printf("%s/%s", ct->type, ct->subtype);
-}
-
-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_decode_param_list(&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, it's only for display */
- if (day) {
- d(printf ("got day: %s\n", day));
- g_free (day);
- header_decode_lwsp (&inptr);
- if (*inptr == ',') {
- inptr++;
- } else {
-#ifndef CLEAN_DATE
- char *newdate;
-
- w(g_warning("day not followed by ',' it's probably a broken mail client, so we'll ignore its date entirely"));
- w(printf ("Giving it one last chance...\n"));
- newdate = parse_broken_date (in);
- if (newdate) {
- w(printf ("Got: %s\n", newdate));
- t = header_decode_date (newdate, saveoffset);
- g_free (newdate);
- return t;
- }
-#endif
- if (saveoffset)
- *saveoffset = 0;
- return 0;
- }
- }
- }
- 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 < 69 || (year >= 100 && year < 1900)) {
- tm.tm_year = 100 + year;
- } else 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==':')
- in++;
- fieldlen = in-header-1;
- while (is_lwsp(*in))
- in++;
- if (fieldlen == 0 || header[fieldlen] != ':') {
- printf("Invalid header line: '%s'\n", header);
- return;
- }
- 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;
-}
-
-char *
-header_msgid_generate (void)
-{
- char host[MAXHOSTNAMELEN], domain[MAXHOSTNAMELEN];
-#ifdef ENABLE_THREADS
- static pthread_mutex_t count_lock = PTHREAD_MUTEX_INITIALIZER;
-#define COUNT_LOCK() pthread_mutex_lock (&count_lock)
-#define COUNT_UNLOCK() pthread_mutex_unlock (&count_lock)
-#else
-#define COUNT_LOCK()
-#define COUNT_UNLOCK()
-#endif /* ENABLE_THREADS */
- static gint count = 0;
- gint hrv, drv;
- char *ret;
-
- hrv = gethostname (host, sizeof (host));
- drv = getdomainname (domain, sizeof (domain));
-
- COUNT_LOCK ();
- ret = g_strdup_printf ("%d.%d.%d.camel@%s.%s", (gint) time (NULL), getpid (), count++,
- (hrv == 0 && host && *host) ? host : "unknown.host",
- (drv && domain && *domain) ? domain : "unknown.domain");
- COUNT_UNLOCK ();
-
- return ret;
-}
-
-
-static struct {
- char *name;
- char *pattern;
-} mail_list_magic[] = {
- { "Sender", " *owner-([^@]+)" },
- { "X-BeenThere", " *([^@]+)" },
- { "Delivered-To", " *mailing list ([^@]+)" },
- { "X-Mailing-List", " *([^@]+)" },
- { "X-Loop", " *([^@]+)" },
- { "List-Id", " *([^<]+)" },
-};
-
-char *
-header_raw_check_mailing_list(struct _header_raw **list)
-{
- const char *v;
- regex_t pattern;
- regmatch_t match[2];
- int i;
-
- for (i=0;i<sizeof(mail_list_magic)/sizeof(mail_list_magic[0]);i++) {
- if (regcomp(&pattern, mail_list_magic[i].pattern, REG_EXTENDED|REG_ICASE) == -1) {
- g_warning("Internal error, compiling regex failed: %s: %s", mail_list_magic[i].pattern, strerror(errno));
- continue;
- }
-
- v = header_raw_find(list, mail_list_magic[i].name, NULL);
- if (v != NULL && regexec(&pattern, v, 2, match, 0) == 0 && match[1].rm_so != -1) {
- regfree(&pattern);
- return g_strndup(v+match[1].rm_so, match[1].rm_eo-match[1].rm_so);
- }
- regfree(&pattern);
- }
-
- return 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;
-}
-
-/* if encode is true, then the result is suitable for mailing, otherwise
- the result is suitable for display only (and may not even be re-parsable) */
-static void
-header_address_list_encode_append(GString *out, int encode, struct _header_address *a)
-{
- char *text;
-
- while (a) {
- switch (a->type) {
- case HEADER_ADDRESS_NAME:
- if (encode)
- text = header_encode_phrase (a->name);
- else
- text = a->name;
- if (text && *text)
- g_string_sprintfa(out, "%s <%s>", text, a->v.addr);
- else
- g_string_append(out, a->v.addr);
- if (encode)
- g_free(text);
- break;
- case HEADER_ADDRESS_GROUP:
- if (encode)
- text = header_encode_phrase(a->name);
- else
- text = a->name;
- g_string_sprintfa(out, "%s: ", text);
- header_address_list_encode_append(out, encode, a->v.members);
- g_string_sprintfa(out, ";");
- if (encode)
- g_free(text);
- break;
- default:
- g_warning("Invalid address type");
- break;
- }
- a = a->next;
- if (a)
- g_string_append(out, ", ");
- }
-}
-
-char *
-header_address_list_encode(struct _header_address *a)
-{
- GString *out;
- char *ret;
-
- if (a == NULL)
- return NULL;
-
- out = g_string_new("");
-
- header_address_list_encode_append(out, TRUE, a);
- ret = out->str;
- g_string_free(out, FALSE);
- return ret;
-}
-
-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_encode_append(out, FALSE, a);
- ret = out->str;
- g_string_free(out, FALSE);
- return ret;
-}
-
-/* simple header folding */
-/* will work even if the header is already folded */
-char *
-header_fold(const char *in, int headerlen)
-{
- int len, outlen, i;
- const char *inptr = in, *space, *p, *n;
- GString *out;
- char *ret;
- int needunfold = FALSE;
-
- if (in == NULL)
- return NULL;
-
- /* first, check to see if we even need to fold */
- len = headerlen + 2;
- p = in;
- while (*p) {
- n = strchr(p, '\n');
- if (n == NULL) {
- n = p+strlen(p);
- } else {
- needunfold = TRUE;
- }
- len += n-p;
-
- if (len >= CAMEL_FOLD_SIZE)
- break;
- len = 0;
- p = n + 1;
- }
- if (len < CAMEL_FOLD_SIZE)
- return g_strdup(in);
-
- /* we need to fold, so first unfold (if we need to), then process */
- if (needunfold)
- inptr = in = header_unfold(in);
-
- out = g_string_new("");
- outlen = headerlen+2;
- while (*inptr) {
- space = strchr(inptr, ' ');
- if (space) {
- len = space-inptr+1;
- } else {
- len = strlen(inptr);
- }
- d(printf("next word '%.*s'\n", len, inptr));
- if (outlen + len > CAMEL_FOLD_SIZE) {
- d(printf("outlen = %d wordlen = %d\n", outlen, len));
- /* strip trailing space */
- if (out->len > 0 && out->str[out->len-1] == ' ')
- g_string_truncate(out, out->len-1);
- g_string_append(out, "\n\t");
- outlen = 1;
- /* check for very long words, just cut them up */
- while (outlen+len > CAMEL_FOLD_SIZE) {
- for (i=0;i<CAMEL_FOLD_SIZE-outlen;i++)
- g_string_append_c(out, inptr[i]);
- inptr += CAMEL_FOLD_SIZE-outlen;
- len -= CAMEL_FOLD_SIZE-outlen;
- g_string_append(out, "\n\t");
- outlen = 1;
- }
- }
- outlen += len;
- for (i=0;i<len;i++) {
- g_string_append_c(out, inptr[i]);
- }
- inptr += len;
- }
- ret = out->str;
- g_string_free(out, FALSE);
-
- if (needunfold)
- g_free((char *)in);
-
- return ret;
-}
-
-char *
-header_unfold(const char *in)
-{
- char *out = g_malloc(strlen(in)+1);
- const char *inptr = in;
- char c, *o = out;
-
- o = out;
- while ((c = *inptr++)) {
- if (c == '\n') {
- if (is_lwsp(*inptr)) {
- do {
- inptr++;
- } while (is_lwsp(*inptr));
- *o++ = ' ';
- } else {
- *o++ = c;
- }
- } else {
- *o++ = c;
- }
- }
- *o = 0;
-
- return out;
-}
-
-#ifdef BUILD_TABLE
-
-/* for debugging tests */
-/* should also have some regression tests somewhere */
-
-void test_phrase(const char *in)
-{
- printf("'%s' -> '%s'\n", in, header_encode_phrase(in));
-}
-
-void test_fold(const char *in)
-{
- printf("'%s'\n ->\n '%s'\n", in, header_fold(in));
-}
-
-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>";
-
-#if 0
- header_to_decode(to);
-
- header_mime_decode("1.0", 0, 0);
- header_mime_decode("1.3 (produced by metasend V1.0)", 0, 0);
- header_mime_decode("(produced by metasend V1.0) 5.2", 0, 0);
- header_mime_decode("7(produced by metasend 1.0) . (produced by helix/send/1.0) 9 . 5", 0, 0);
- header_mime_decode("3.", 0, 0);
- header_mime_decode(".", 0, 0);
- header_mime_decode(".5", 0, 0);
- header_mime_decode("c.d", 0, 0);
- header_mime_decode("", 0, 0);
-
- header_msgid_decode(" <\"L3x2i1.0.Nm5.Xd-Wu\"@lists.redhat.com>");
- header_msgid_decode("<200001180446.PAA02065@beaker.htb.com.au>");
-#endif
-
- test_fold("Header: This is a long header that should be folded properly at the right place, or so i hope. I should probably set the fold value to something lower for testing");
- test_fold("Header: nowletstryfoldingsomethingthatistoolongtofold,iwonderwhatitshoulddointsteadtofoldit?hmm,iguessicanjusttruncateitatsomepointortrytorefoldthepreviousstuff(yuck)tofit");
- test_phrase("Michael Zucchi (NotZed)");
- test_phrase("Zucchi, ( \\ NotZed \\ ) Michael");
- {
- int ic;
- char *outbuf, *inbuf, buffer[256];
- int inlen, outlen;
-
- outlen = 256;
- inbuf = "Dra¾en Kaèar";
- inlen = strlen(inbuf);
- outbuf = buffer;
- ic = iconv_open("UTF-8", "ISO-8859-1");
- iconv(ic, &inbuf, &inlen, &outbuf, &outlen);
- test_phrase(buffer);
-
- outlen = 256;
- inbuf = "This is an encoded phrase Tomasz K³oczko";
- inlen = strlen(inbuf);
- outbuf = buffer;
- ic = iconv_open("UTF-8", "ISO-8859-2");
- iconv(ic, &inbuf, &inlen, &outbuf, &outlen);
- test_phrase(buffer);
-
- }
-
- {
- char *str = "Blah blah\n\t = ? =? ?= This is a TEST For quoted-printable-encoding-encoding-of
- long lines, and lines that end in spaces
- and line sthat end in tabs
- And lines that just end.";
-
- char encoded[256];
- int state=-1,save=0;
- int len;
-
- len = quoted_encode_step(str, strlen(str), encoded, &state, &save);
- len += quoted_encode_close("", 0, encoded+len, &state, &save);
- printf("encoded = '%.*s'\n", len, encoded);
- }
-}
-
-#endif /* BUILD_TABLE */
diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h
deleted file mode 100644
index 691653d43b..0000000000
--- a/camel/camel-mime-utils.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- * Jeffrey Stedfast <fejj@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 <glib.h>
-#include <time.h>
-
-/* maximum size of a line from header_fold() */
-#define CAMEL_FOLD_SIZE (77)
-
-/* a list of references for this message */
-struct _header_references {
- struct _header_references *next;
- char *id;
-};
-
-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);
-/* for mailing */
-char *header_address_list_encode(struct _header_address *a);
-/* for display */
-char *header_address_list_format(struct _header_address *a);
-
-/* structured header prameters */
-struct _header_param *header_param_list_decode(const char *in);
-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_format_append(GString *out, struct _header_param *p);
-char *header_param_list_format(struct _header_param *p);
-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);
-char *header_content_type_simple(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_fold(struct _header_raw **list);
-void header_raw_clear(struct _header_raw **list);
-
-char *header_raw_check_mailing_list(struct _header_raw **list);
-
-/* fold a header */
-char *header_fold(const char *in, int headerlen);
-char *header_unfold(const char *in);
-
-/* 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);
-
-/* encode a phrase, like the real name of an address */
-char *header_encode_phrase(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);
-
-/* generate msg id */
-char *header_msgid_generate (void);
-
-/* decode a References header */
-struct _header_references *header_references_decode(const char *in);
-void header_references_list_clear(struct _header_references **list);
-void header_references_list_append_asis(struct _header_references **list, char *ref);
-int header_references_list_size(struct _header_references **list);
-struct _header_references *header_references_dup(const struct _header_references *list);
-
-/* 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, gboolean break_lines, unsigned char *out, int *state, int *save);
-int base64_encode_close(unsigned char *in, int inlen, gboolean break_lines, unsigned char *out, int *state, int *save);
-
-int uudecode_step (unsigned char *in, int len, unsigned char *out, int *state, guint32 *save, char *uulen);
-
-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);
-
-char *base64_encode_simple (const char *data, int len);
-int base64_decode_simple (char *data, int len);
-
-#endif /* ! _CAMEL_MIME_UTILS_H */
diff --git a/camel/camel-movemail.c b/camel/camel-movemail.c
deleted file mode 100644
index a0873b25ad..0000000000
--- a/camel/camel-movemail.c
+++ /dev/null
@@ -1,596 +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 <signal.h>
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#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)
-
-#ifdef MOVEMAIL_PATH
-#include <sys/wait.h>
-
-static void movemail_external (const char *source, const char *dest,
- CamelException *ex);
-#endif
-
-/* these could probably be exposed as a utility? (but only mbox needs it) */
-#if 0
-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);
-#endif
-
-/**
- * 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).
- **/
-void
-camel_movemail (const char *source, const char *dest, CamelException *ex)
-{
- gboolean locked;
- 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) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not check mail file "
- "%s: %s"), source,
- g_strerror (errno));
- }
- return;
- }
- if (st.st_size == 0)
- return;
-
- /* 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) {
- g_free (locktmpfile);
-#ifdef MOVEMAIL_PATH
- if (errno == EACCES) {
- /* movemail_external will fail if the dest file
- * already exists, so if it does, return now,
- * let the fetch code process the mail that's
- * already there, and then the user can try again.
- */
- if (stat (dest, &st) == 0)
- return;
-
- movemail_external (source, dest, ex);
- return;
- }
-#endif
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create lock file "
- "for %s: %s"), source,
- g_strerror (errno));
- return;
- }
- close (tmpfd);
-
- 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));
- unlink (locktmpfile);
- g_free (locktmpfile);
- return;
- }
-
- 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);
- unlink (locktmpfile);
- g_free (locktmpfile);
- return;
- }
-
- 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);
- return;
- }
-
- /* OK. We have the file locked now. */
-
- /* FIXME: Set a timer to keep the file locked. */
-
- 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));
- 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));
- 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 (!camel_exception_is_set (ex)) {
- 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));
- }
- } else
- close (dfd);
- close (sfd);
-
- /* Clean up lock files. */
- unlink (lockfile);
- g_free (lockfile);
- unlink (locktmpfile);
- g_free (locktmpfile);
-}
-
-#ifdef MOVEMAIL_PATH
-static void
-movemail_external (const char *source, const char *dest, CamelException *ex)
-{
- sigset_t mask, omask;
- pid_t pid;
- int fd[2], len = 0, nread, status;
- char buf[BUFSIZ], *output = NULL;
-
- /* Block SIGCHLD so the app can't mess us up. */
- sigemptyset (&mask);
- sigaddset (&mask, SIGCHLD);
- sigprocmask (SIG_BLOCK, &mask, &omask);
-
- if (pipe (fd) == -1) {
- sigprocmask (SIG_SETMASK, &omask, NULL);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create pipe: %s"),
- g_strerror (errno));
- return;
- }
-
- pid = fork ();
- switch (pid) {
- case -1:
- close (fd[0]);
- close (fd[1]);
- sigprocmask (SIG_SETMASK, &omask, NULL);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not fork: %s"),
- g_strerror (errno));
- return;
-
- case 0:
- /* Child */
- close (fd[0]);
- close (STDIN_FILENO);
- dup2 (fd[1], STDOUT_FILENO);
- dup2 (fd[1], STDERR_FILENO);
-
- execl (MOVEMAIL_PATH, MOVEMAIL_PATH, source, dest, NULL);
- _exit (255);
- break;
-
- default:
- break;
- }
-
- /* Parent */
- close (fd[1]);
-
- /* Read movemail's output. */
- while ((nread = read (fd[0], buf, sizeof (buf))) > 0) {
- output = g_realloc (output, len + nread + 1);
- memcpy (output + len, buf, nread);
- len += nread;
- output[len] = '\0';
- }
- close (fd[0]);
-
- /* Now get the exit status. */
- while (waitpid (pid, &status, 0) == -1 && errno == EINTR)
- ;
- sigprocmask (SIG_SETMASK, &omask, NULL);
-
- if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Movemail program failed: %s"),
- output ? output : _("(Unknown error)"));
- }
- g_free (output);
-}
-#endif
-
-
-#if 0
-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;
-}
-#endif
-
-#define PRE_SIZE (32)
-
-#if 0
-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));
- }
- }
-
- camel_object_unref((CamelObject *)mp);
- camel_object_unref((CamelObject *)ffrom);
-
- return ret;
-
-fail:
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Error copying "
- "mail temp file: %s",
- g_strerror (errno));
-
-
- camel_object_unref((CamelObject *)mp);
- camel_object_unref((CamelObject *)ffrom);
-
- return -1;
-}
-#endif
-
diff --git a/camel/camel-movemail.h b/camel/camel-movemail.h
deleted file mode 100644
index 8b73435a43..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>
-
-void 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 898bd7ace6..0000000000
--- a/camel/camel-multipart.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-multipart.c : Abstract class for a multipart */
-
-#ifndef NO_WARNINGS
-#warning This should be a mostly abstract class, but it is not!
-#endif
-
-/*
- *
- * 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-mem.h"
-#include "camel-multipart.h"
-#include "camel-mime-part.h"
-#include "camel-exception.h"
-#include "md5-utils.h"
-
-#include <unistd.h> /* for getpid */
-#include <time.h> /* for time */
-
-#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 unref_part (gpointer data, gpointer user_data);
-
-static CamelDataWrapperClass *parent_class = NULL;
-
-
-
-/* Returns the class for a CamelMultipart */
-#define CMP_CLASS(so) CAMEL_MULTIPART_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-/* Returns the class for a CamelDataWrapper */
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-
-static void
-camel_multipart_class_init (CamelMultipartClass *camel_multipart_class)
-{
- CamelDataWrapperClass *camel_data_wrapper_class =
- CAMEL_DATA_WRAPPER_CLASS (camel_multipart_class);
-
- parent_class = CAMEL_DATA_WRAPPER_CLASS (camel_type_get_global_classfuncs (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;
-}
-
-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");
- multipart->preface = NULL;
- multipart->postface = NULL;
-}
-
-static void
-camel_multipart_finalize (CamelObject *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);
-}
-
-
-CamelType
-camel_multipart_get_type (void)
-{
- static CamelType camel_multipart_type = CAMEL_INVALID_TYPE;
-
- if (camel_multipart_type == CAMEL_INVALID_TYPE) {
- camel_multipart_type = camel_type_register (camel_data_wrapper_get_type (), "CamelMultipart",
- sizeof (CamelMultipart),
- sizeof (CamelMultipartClass),
- (CamelObjectClassInitFunc) camel_multipart_class_init,
- NULL,
- (CamelObjectInitFunc) camel_multipart_init,
- (CamelObjectFinalizeFunc) camel_multipart_finalize);
- }
-
- return camel_multipart_type;
-}
-
-static void
-unref_part (gpointer data, gpointer user_data)
-{
- CamelObject *part = CAMEL_OBJECT (data);
-
- camel_object_unref (part);
-}
-
-/**
- * camel_multipart_new:
- *
- * Create a new CamelMultipart object.
- *
- * Return value: a new CamelMultipart
- **/
-CamelMultipart *
-camel_multipart_new (void)
-{
- CamelMultipart *multipart;
-
- multipart = (CamelMultipart *)camel_object_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);
- camel_object_ref (CAMEL_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);
- camel_object_ref (CAMEL_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);
- camel_object_unref (CAMEL_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)
- camel_object_unref (CAMEL_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 camel_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);
- char *bgen, digest[16], bbuf[27], *p;
- int state, save;
-
- g_return_if_fail (cdw->mime_type != NULL);
-
- if (!boundary) {
- /* Generate a fairly random boundary string. */
- bgen = g_strdup_printf ("%p:%lu:%lu", multipart,
- (unsigned long) getpid(),
- (unsigned long) time(0));
- md5_get_digest (bgen, strlen (bgen), digest);
- g_free (bgen);
- strcpy (bbuf, "=-");
- p = bbuf + 2;
- state = save = 0;
- p += base64_encode_step (digest, 16, FALSE, p, &state, &save);
- *p = '\0';
-
- boundary = bbuf;
- }
-
- header_content_type_set_param (cdw->mime_type, "boundary", boundary);
-}
-
-/**
- * camel_multipart_set_boundary:
- * @multipart: a CamelMultipart
- * @boundary: the message boundary, or %NULL
- *
- * Sets the message boundary for @multipart to @boundary. This should
- * be a string which does not occur anywhere in any of @multipart's
- * subparts. If @boundary is %NULL, a randomly-generated boundary will
- * be used.
- **/
-void
-camel_multipart_set_boundary (CamelMultipart *multipart, gchar *boundary)
-{
- g_return_if_fail (CAMEL_IS_MULTIPART (multipart));
-
- 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 header_content_type_param (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;
-}
-
-/**
- * camel_multipart_set_preface:
- * @multipart:
- * @preface:
- *
- * Set the preface text for this multipart. Will be written out infront
- * of the multipart. This text should only include US-ASCII strings, and
- * be relatively short, and will be ignored by any MIME mail client.
- **/
-void
-camel_multipart_set_preface(CamelMultipart *multipart, const char *preface)
-{
- if (multipart->preface != preface) {
- g_free(multipart->preface);
- if (preface)
- multipart->preface = g_strdup(preface);
- else
- multipart->preface = NULL;
- }
-}
-
-/**
- * camel_multipart_set_postface:
- * @multipart:
- * @postface:
- *
- * Set the postfix text for this multipart. Will be written out after
- * the last boundary of the multipart, and ignored by any MIME mail
- * client.
- *
- * Generally postface texts should not be sent with multipart messages.
- **/
-void
-camel_multipart_set_postface(CamelMultipart *multipart, const char *postface)
-{
- if (multipart->postface != postface) {
- g_free(multipart->postface);
- if (postface)
- multipart->postface = g_strdup(postface);
- else
- multipart->postface = NULL;
- }
-}
diff --git a/camel/camel-multipart.h b/camel/camel-multipart.h
deleted file mode 100644
index 3058b8f2e0..0000000000
--- a/camel/camel-multipart.h
+++ /dev/null
@@ -1,105 +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) (CAMEL_CHECK_CAST((obj), CAMEL_MULTIPART_TYPE, CamelMultipart))
-#define CAMEL_MULTIPART_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MULTIPART_TYPE, CamelMultipartClass))
-#define CAMEL_IS_MULTIPART(o) (CAMEL_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 Camel function */
-CamelType 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);
-
-void camel_multipart_set_preface (CamelMultipart *multipart, const char *preface);
-void camel_multipart_set_postface (CamelMultipart *multipart, const char *postface);
-
-#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 ebd35b80c7..0000000000
--- a/camel/camel-news-address.c
+++ /dev/null
@@ -1,65 +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 CamelAddressClass *camel_news_address_parent;
-
-static void
-camel_news_address_class_init (CamelNewsAddressClass *klass)
-{
- camel_news_address_parent = CAMEL_ADDRESS_CLASS (camel_type_get_global_classfuncs (camel_address_get_type ()));
-}
-
-
-CamelType
-camel_news_address_get_type (void)
-{
- static guint type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_address_get_type (), "CamelNewsAddress",
- sizeof (CamelNewsAddress),
- sizeof (CamelNewsAddressClass),
- (CamelObjectClassInitFunc) camel_news_address_class_init,
- NULL,
- NULL,
- NULL);
- }
-
- return type;
-}
-
-/**
- * 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 ( camel_object_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 b1c7856675..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) CAMEL_CHECK_CAST (obj, camel_news_address_get_type (), CamelNewsAddress)
-#define CAMEL_NEWS_ADDRESS_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_news_address_get_type (), CamelNewsAddressClass)
-#define CAMEL_IS_NEWS_ADDRESS(obj) CAMEL_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 75c14b8978..0000000000
--- a/camel/camel-object.c
+++ /dev/null
@@ -1,973 +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"
-
-/* I just mashed the keyboard for these... */
-#define CAMEL_OBJECT_MAGIC_VALUE 0x77A344EF
-#define CAMEL_OBJECT_CLASS_MAGIC_VALUE 0xEE26A990
-#define CAMEL_OBJECT_FINALIZED_VALUE 0x84AC3656
-#define CAMEL_OBJECT_CLASS_FINALIZED_VALUE 0x7621ABCD
-
-#define DEFAULT_PREALLOCS 8
-
-#define BAST_CASTARD 1 /* Define to return NULL when casts fail */
-
-#define NULL_PREP_VALUE ((gpointer)make_global_classfuncs) /* See camel_object_class_declare_event */
-
-/* ** Quickie type system ************************************************* */
-
-typedef struct _CamelTypeInfo
-{
- CamelType self;
- CamelType parent;
- const gchar *name;
-
- size_t instance_size;
- GMemChunk *instance_chunk;
- CamelObjectInitFunc instance_init;
- CamelObjectFinalizeFunc instance_finalize;
- GList *free_instances;
-
- size_t classfuncs_size;
- CamelObjectClassInitFunc class_init;
- CamelObjectClassFinalizeFunc class_finalize;
- CamelObjectClass *global_classfuncs;
-}
-CamelTypeInfo;
-
-typedef struct _CamelHookPair
-{
- CamelObjectEventHookFunc func;
- gpointer user_data;
-}
-CamelHookPair;
-
-/* ************************************************************************ */
-
-static void camel_type_lock_up (void);
-static void camel_type_lock_down (void);
-
-static void obj_init (CamelObject * obj);
-static void obj_finalize (CamelObject * obj);
-static void obj_class_init (CamelObjectClass * class);
-static void obj_class_finalize (CamelObjectClass * class);
-
-static gboolean shared_is_of_type (CamelObjectShared * sh, CamelType ctype,
- gboolean is_obj);
-static void make_global_classfuncs (CamelTypeInfo * type_info);
-
-/* ************************************************************************ */
-
-G_LOCK_DEFINE_STATIC (type_system);
-G_LOCK_DEFINE_STATIC (type_system_level);
-static GPrivate *type_system_locklevel = NULL;
-
-G_LOCK_DEFINE_STATIC (refcount);
-
-static gboolean type_system_initialized = FALSE;
-static GHashTable *ctype_to_typeinfo = NULL;
-static const CamelType camel_object_type = 1;
-static CamelType cur_max_type = CAMEL_INVALID_TYPE;
-
-/* ************************************************************************ */
-
-#define LOCK_VAL (GPOINTER_TO_INT (g_private_get (type_system_locklevel)))
-#define LOCK_SET( val ) g_private_set (type_system_locklevel, GINT_TO_POINTER (val))
-
-static void
-camel_type_lock_up (void)
-{
- G_LOCK (type_system_level);
-
- if (type_system_locklevel == NULL)
- type_system_locklevel = g_private_new (GINT_TO_POINTER (0));
-
- if (LOCK_VAL == 0) {
- G_UNLOCK (type_system_level);
- G_LOCK (type_system);
- G_LOCK (type_system_level);
- }
-
- LOCK_SET (LOCK_VAL + 1);
-
- G_UNLOCK (type_system_level);
-}
-
-static void
-camel_type_lock_down (void)
-{
- G_LOCK (type_system_level);
-
- if (type_system_locklevel == NULL) {
- g_warning
- ("camel_type_lock_down: lock down before a lock up?");
- type_system_locklevel = g_private_new (GINT_TO_POINTER (0));
- G_UNLOCK (type_system_level);
- return;
- }
-
- LOCK_SET (LOCK_VAL - 1);
-
- if (LOCK_VAL == 0)
- G_UNLOCK (type_system);
-
- G_UNLOCK (type_system_level);
-}
-
-void
-camel_type_init (void)
-{
- CamelTypeInfo *obj_info;
-
- camel_type_lock_up ();
-
- if (type_system_initialized) {
- g_warning
- ("camel_type_init: type system already initialized.");
- camel_type_lock_down ();
- return;
- }
-
- type_system_initialized = TRUE;
- ctype_to_typeinfo = g_hash_table_new (g_direct_hash, g_direct_equal);
-
- obj_info = g_new (CamelTypeInfo, 1);
- obj_info->self = camel_object_type;
- obj_info->parent = CAMEL_INVALID_TYPE;
- obj_info->name = "CamelObject";
-
- obj_info->instance_size = sizeof (CamelObject);
- obj_info->instance_chunk =
- g_mem_chunk_create (CamelObject, DEFAULT_PREALLOCS,
- G_ALLOC_ONLY);
- obj_info->instance_init = obj_init;
- obj_info->instance_finalize = obj_finalize;
- obj_info->free_instances = NULL;
-
- obj_info->classfuncs_size = sizeof (CamelObjectClass);
- obj_info->class_init = obj_class_init;
- obj_info->class_finalize = obj_class_finalize;
-
- g_hash_table_insert (ctype_to_typeinfo,
- GINT_TO_POINTER (CAMEL_INVALID_TYPE), NULL);
- g_hash_table_insert (ctype_to_typeinfo,
- GINT_TO_POINTER (camel_object_type), obj_info);
-
- /* Sigh. Ugly */
- make_global_classfuncs (obj_info);
-
- cur_max_type = camel_object_type;
-
- camel_type_lock_down ();
-}
-
-CamelType
-camel_type_register (CamelType parent, const gchar * name,
- size_t instance_size, size_t classfuncs_size,
- CamelObjectClassInitFunc class_init,
- CamelObjectClassFinalizeFunc class_finalize,
- CamelObjectInitFunc instance_init,
- CamelObjectFinalizeFunc instance_finalize)
-{
- CamelTypeInfo *parent_info;
- CamelTypeInfo *obj_info;
- gchar *chunkname;
-
- g_return_val_if_fail (parent != CAMEL_INVALID_TYPE,
- CAMEL_INVALID_TYPE);
- g_return_val_if_fail (name, CAMEL_INVALID_TYPE);
- g_return_val_if_fail (instance_size, CAMEL_INVALID_TYPE);
- g_return_val_if_fail (classfuncs_size, CAMEL_INVALID_TYPE);
-
- camel_type_lock_up ();
-
- if (type_system_initialized == FALSE) {
- G_UNLOCK (type_system);
- camel_type_init ();
- G_LOCK (type_system);
- }
-
- parent_info =
- g_hash_table_lookup (ctype_to_typeinfo,
- GINT_TO_POINTER (parent));
-
- if (parent_info == NULL) {
- g_warning
- ("camel_type_register: no such parent type %d of class `%s'",
- parent, name);
- camel_type_lock_down ();
- return CAMEL_INVALID_TYPE;
- }
-
- if (parent_info->instance_size > instance_size) {
- g_warning
- ("camel_type_register: instance of class `%s' would be smaller than parent `%s'",
- name, parent_info->name);
- camel_type_lock_down ();
- return CAMEL_INVALID_TYPE;
- }
-
- if (parent_info->classfuncs_size > classfuncs_size) {
- g_warning
- ("camel_type_register: classfuncs of class `%s' would be smaller than parent `%s'",
- name, parent_info->name);
- camel_type_lock_down ();
- return CAMEL_INVALID_TYPE;
- }
-
- cur_max_type++;
-
- obj_info = g_new (CamelTypeInfo, 1);
- obj_info->self = cur_max_type;
- obj_info->parent = parent;
- obj_info->name = name;
-
- obj_info->instance_size = instance_size;
- chunkname =
- g_strdup_printf ("chunk for instances of Camel type `%s'",
- name);
- obj_info->instance_chunk =
- g_mem_chunk_new (chunkname, instance_size,
- instance_size * DEFAULT_PREALLOCS,
- G_ALLOC_ONLY);
- g_free (chunkname);
- obj_info->instance_init = instance_init;
- obj_info->instance_finalize = instance_finalize;
- obj_info->free_instances = NULL;
-
- obj_info->classfuncs_size = classfuncs_size;
- obj_info->class_init = class_init;
- obj_info->class_finalize = class_finalize;
-
- g_hash_table_insert (ctype_to_typeinfo,
- GINT_TO_POINTER (obj_info->self), obj_info);
-
- /* Sigh. Ugly. */
- make_global_classfuncs (obj_info);
-
- camel_type_lock_down ();
- return obj_info->self;
-}
-
-CamelObjectClass *
-camel_type_get_global_classfuncs (CamelType type)
-{
- CamelTypeInfo *type_info;
-
- g_return_val_if_fail (type != CAMEL_INVALID_TYPE, NULL);
-
- camel_type_lock_up ();
- type_info =
- g_hash_table_lookup (ctype_to_typeinfo,
- GINT_TO_POINTER (type));
- camel_type_lock_down ();
-
- g_return_val_if_fail (type_info != NULL, NULL);
-
- return type_info->global_classfuncs;
-}
-
-const gchar *
-camel_type_to_name (CamelType type)
-{
- CamelTypeInfo *type_info;
-
- g_return_val_if_fail (type != CAMEL_INVALID_TYPE,
- "(the invalid type)");
-
- camel_type_lock_up ();
- type_info =
- g_hash_table_lookup (ctype_to_typeinfo,
- GINT_TO_POINTER (type));
- camel_type_lock_down ();
-
- g_return_val_if_fail (type_info != NULL,
- "(a bad type parameter was specified)");
-
- return type_info->name;
-}
-
-/* ** The CamelObject ***************************************************** */
-
-static void
-obj_init (CamelObject * obj)
-{
- obj->s.magic = CAMEL_OBJECT_MAGIC_VALUE;
- obj->ref_count = 1;
- obj->event_to_hooklist = NULL;
- obj->in_event = 0;
-}
-
-static void
-obj_finalize (CamelObject * obj)
-{
- g_return_if_fail (obj->s.magic == CAMEL_OBJECT_MAGIC_VALUE);
- g_return_if_fail (obj->ref_count == 0);
- g_return_if_fail (obj->in_event == 0);
-
- obj->s.magic = CAMEL_OBJECT_FINALIZED_VALUE;
-
- if (obj->event_to_hooklist) {
- g_hash_table_foreach (obj->event_to_hooklist, (GHFunc) g_free,
- NULL);
- g_hash_table_destroy (obj->event_to_hooklist);
- obj->event_to_hooklist = NULL;
- }
-}
-
-static void
-obj_class_init (CamelObjectClass * class)
-{
- class->s.magic = CAMEL_OBJECT_CLASS_MAGIC_VALUE;
-
- camel_object_class_declare_event (class, "finalize", NULL);
-}
-
-static void
-obj_class_finalize (CamelObjectClass * class)
-{
- g_return_if_fail (class->s.magic == CAMEL_OBJECT_CLASS_MAGIC_VALUE);
-
- class->s.magic = CAMEL_OBJECT_CLASS_FINALIZED_VALUE;
-
- if (class->event_to_preplist) {
- g_hash_table_foreach (class->event_to_preplist,
- (GHFunc) g_free, NULL);
- g_hash_table_destroy (class->event_to_preplist);
- class->event_to_preplist = NULL;
- }
-}
-
-CamelType
-camel_object_get_type (void)
-{
- if (type_system_initialized == FALSE)
- camel_type_init ();
-
- return camel_object_type;
-}
-
-CamelObject *
-camel_object_new (CamelType type)
-{
- CamelTypeInfo *type_info;
- GSList *parents = NULL;
- GSList *head = NULL;
- CamelObject *instance;
-
- g_return_val_if_fail (type != CAMEL_INVALID_TYPE, NULL);
-
- /* Look up the type */
-
- camel_type_lock_up ();
-
- type_info =
- g_hash_table_lookup (ctype_to_typeinfo,
- GINT_TO_POINTER (type));
-
- if (type_info == NULL) {
- g_warning
- ("camel_object_new: trying to create object of invalid type %d",
- type);
- camel_type_lock_down ();
- return NULL;
- }
-
- /* Grab an instance out of the freed ones if possible, alloc otherwise */
-
- if (type_info->free_instances) {
- GList *first;
-
- first = g_list_first (type_info->free_instances);
- instance = first->data;
- type_info->free_instances =
- g_list_remove_link (type_info->free_instances, first);
- g_list_free_1 (first);
- } else {
- instance = g_mem_chunk_alloc0 (type_info->instance_chunk);
- }
-
- /* Init the instance and classfuncs a bit */
-
- instance->s.type = type;
- instance->classfuncs = type_info->global_classfuncs;
-
- /* Loop through the parents in simplest -> most complex order, initing the class and instance.
-
- * When parent = CAMEL_INVALID_TYPE and we're at the end of the line, _lookup returns NULL
- * because we inserted it as corresponding to CAMEL_INVALID_TYPE. Clever, eh?
- */
-
- while (type_info) {
- parents = g_slist_prepend (parents, type_info);
- type_info =
- g_hash_table_lookup (ctype_to_typeinfo,
- GINT_TO_POINTER (type_info->
- parent));
- }
-
- head = parents;
-
- for (; parents && parents->data; parents = parents->next) {
- CamelTypeInfo *thisinfo;
-
- thisinfo = parents->data;
- if (thisinfo->instance_init)
- (thisinfo->instance_init) (instance);
- }
-
- g_slist_free (head);
-
- camel_type_lock_down ();
- return instance;
-}
-
-void
-camel_object_ref (CamelObject * obj)
-{
- g_return_if_fail (CAMEL_IS_OBJECT (obj));
-
- G_LOCK (refcount);
- obj->ref_count++;
- G_UNLOCK (refcount);
-}
-
-void
-camel_object_unref (CamelObject * obj)
-{
- CamelTypeInfo *type_info;
- CamelTypeInfo *iter;
- GSList *parents = NULL;
- GSList *head = NULL;
-
- g_return_if_fail (CAMEL_IS_OBJECT (obj));
-
- G_LOCK (refcount);
- obj->ref_count--;
-
- if (obj->ref_count > 0) {
- G_UNLOCK (refcount);
- return;
- }
-
- G_UNLOCK (refcount);
-
- /* Oh no! We want to emit a "finalized" event, but that function refs the object
- * because it's not supposed to get finalized in an event, but it is being finalized
- * right now, and AAUGH AAUGH AUGH AUGH!
- *
- * So we don't call camel_object_trigger_event. We do it ourselves. We even know
- * that CamelObject doesn't provide a prep for the finalized event, so we plunge
- * right in and call our hooks.
- *
- * And there was much rejoicing.
- */
-
-#define hooklist parents /*cough */
-
- if (obj->event_to_hooklist) {
- CamelHookPair *pair;
-
- hooklist =
- g_hash_table_lookup (obj->event_to_hooklist,
- "finalize");
-
- while (hooklist && hooklist->data) {
- pair = hooklist->data;
- (pair->func) (obj, NULL, pair->user_data);
- hooklist = hooklist->next;
- }
- }
-
- hooklist = NULL; /* Don't mess with this line */
-
-#undef hooklist
-
- /* Destroy it! hahaha! */
-
- camel_type_lock_up ();
-
- type_info =
- g_hash_table_lookup (ctype_to_typeinfo,
- GINT_TO_POINTER (obj->s.type));
-
- if (type_info == NULL) {
- g_warning
- ("camel_object_unref: seemingly valid object has a bad type %d",
- obj->s.type);
- camel_type_lock_down ();
- return;
- }
-
- /* Loop through the parents in most complex -> simplest order, finalizing the class
- * and instance.
- *
- * When parent = CAMEL_INVALID_TYPE and we're at the end of the line, _lookup returns NULL
- * because we inserted it as corresponding to CAMEL_INVALID_TYPE. Clever, eh?
- *
- * Use iter to preserve type_info for free_{instance,classfunc}s
- */
-
- iter = type_info;
-
- while (iter) {
- parents = g_slist_prepend (parents, iter);
- iter =
- g_hash_table_lookup (ctype_to_typeinfo,
- GINT_TO_POINTER (iter->parent));
- }
-
- parents = g_slist_reverse (parents);
- head = parents;
-
- for (; parents && parents->data; parents = parents->next) {
- CamelTypeInfo *thisinfo;
-
- thisinfo = parents->data;
- if (thisinfo->instance_finalize)
- (thisinfo->instance_finalize) (obj);
- }
-
- g_slist_free (head);
-
- /* A little bit of cleaning up.
-
- * Don't erase the type, so we can peek at it if a finalized object
- * is check_cast'ed somewhere.
- */
-
- memset (obj, 0, type_info->instance_size);
- obj->s.type = type_info->self;
- obj->s.magic = CAMEL_OBJECT_FINALIZED_VALUE;
-
- /* Tuck away the pointer for use in a new object */
-
- type_info->free_instances =
- g_list_prepend (type_info->free_instances, obj);
-
- camel_type_lock_down ();
-}
-
-gboolean
-camel_object_is_of_type (CamelObject * obj, CamelType ctype)
-{
- return shared_is_of_type ((CamelObjectShared *) obj, ctype, TRUE);
-}
-
-gboolean
-camel_object_class_is_of_type (CamelObjectClass * class, CamelType ctype)
-{
- return shared_is_of_type ((CamelObjectShared *) class, ctype, FALSE);
-}
-
-#ifdef BAST_CASTARD
-#define ERRVAL NULL
-#else
-#define ERRVAL obj
-#endif
-
-CamelObject *
-camel_object_check_cast (CamelObject * obj, CamelType ctype)
-{
- if (shared_is_of_type ((CamelObjectShared *) obj, ctype, TRUE))
- return obj;
- return ERRVAL;
-}
-
-CamelObjectClass *
-camel_object_class_check_cast (CamelObjectClass * class, CamelType ctype)
-{
- if (shared_is_of_type ((CamelObjectShared *) class, ctype, FALSE))
- return class;
- return ERRVAL;
-}
-
-#undef ERRVAL
-
-gchar *
-camel_object_describe (CamelObject * obj)
-{
- if (obj == NULL)
- return g_strdup ("a NULL pointer");
-
- if (obj->s.magic == CAMEL_OBJECT_MAGIC_VALUE) {
- return g_strdup_printf ("an instance of `%s' at %p",
- camel_type_to_name (obj->s.type),
- obj);
- } else if (obj->s.magic == CAMEL_OBJECT_FINALIZED_VALUE) {
- return g_strdup_printf ("a finalized instance of `%s' at %p",
- camel_type_to_name (obj->s.type),
- obj);
- } else if (obj->s.magic == CAMEL_OBJECT_CLASS_MAGIC_VALUE) {
- return g_strdup_printf ("the classfuncs of `%s' at %p",
- camel_type_to_name (obj->s.type),
- obj);
- } else if (obj->s.magic == CAMEL_OBJECT_CLASS_FINALIZED_VALUE) {
- return
- g_strdup_printf
- ("the finalized classfuncs of `%s' at %p",
- camel_type_to_name (obj->s.type), obj);
- }
-
- return g_strdup ("not a CamelObject");
-}
-
-/* This is likely to be called in the class_init callback,
- * and the type will likely be somewhat uninitialized.
- * Is this a problem? We'll see....
- */
-void
-camel_object_class_declare_event (CamelObjectClass * class,
- const gchar * name,
- CamelObjectEventPrepFunc prep)
-{
- g_return_if_fail (CAMEL_IS_OBJECT_CLASS (class));
- g_return_if_fail (name);
-
- if (class->event_to_preplist == NULL)
- class->event_to_preplist =
- g_hash_table_new (g_str_hash, g_str_equal);
- else if (g_hash_table_lookup (class->event_to_preplist, name) != NULL) {
- g_warning
- ("camel_object_class_declare_event: event `%s' already declared for `%s'",
- name, camel_type_to_name (class->s.type));
- return;
- }
-
- /* AIEEEEEEEEEEEEEEEEEEEEEE
-
- * I feel so naughty. Since it's valid to declare an event and not
- * provide a hook, it should be valid to insert a NULL value into
- * the table. However, then our lookup in trigger_event would be
- * ambiguous, not telling us whether the event is undefined or whether
- * it merely has no hook.
- *
- * So we create an 'NULL prep' value that != NULL... specifically, it
- * equals the address of one of our static functions , because that
- * can't possibly be your hook.
- *
- * Just don't forget to check for the 'evil value' and it'll work,
- * I promise.
- */
-
- if (prep == NULL)
- prep = NULL_PREP_VALUE;
-
- g_hash_table_insert (class->event_to_preplist, g_strdup (name), prep);
-}
-
-void
-camel_object_hook_event (CamelObject * obj, const gchar * name,
- CamelObjectEventHookFunc hook, gpointer user_data)
-{
- GSList *hooklist;
- CamelHookPair *pair;
-
- g_return_if_fail (CAMEL_IS_OBJECT (obj));
- g_return_if_fail (name);
- g_return_if_fail (hook);
-
- if (obj->event_to_hooklist == NULL)
- obj->event_to_hooklist =
- g_hash_table_new (g_str_hash, g_str_equal);
-
- pair = g_new (CamelHookPair, 1);
- pair->func = hook;
- pair->user_data = user_data;
-
- hooklist = g_hash_table_lookup (obj->event_to_hooklist, name);
- hooklist = g_slist_prepend (hooklist, pair);
- g_hash_table_insert (obj->event_to_hooklist, g_strdup (name),
- hooklist);
-}
-
-void
-camel_object_unhook_event (CamelObject * obj, const gchar * name,
- CamelObjectEventHookFunc hook, gpointer user_data)
-{
- GSList *hooklist;
- GSList *head;
-
- g_return_if_fail (CAMEL_IS_OBJECT (obj));
- g_return_if_fail (name);
- g_return_if_fail (hook);
-
- if (obj->event_to_hooklist == NULL) {
- g_warning
- ("camel_object_unhook_event: trying to unhook `%s' from an instance "
- "of `%s' with no hooks attached", name,
- camel_type_to_name (obj->s.type));
- return;
- }
-
- hooklist = g_hash_table_lookup (obj->event_to_hooklist, name);
-
- if (hooklist == NULL) {
- g_warning
- ("camel_object_unhook_event: trying to unhook `%s' from an instance "
- "of `%s' with no hooks attached to that event.",
- name, camel_type_to_name (obj->s.type));
- return;
- }
-
- head = hooklist;
-
- while (hooklist) {
- CamelHookPair *pair = (CamelHookPair *) hooklist->data;
-
- if (pair->func == hook && pair->user_data == user_data) {
- g_free (hooklist->data);
- head = g_slist_remove_link (head, hooklist);
- g_slist_free_1 (hooklist);
- g_hash_table_insert (obj->event_to_hooklist, (char *) name,
- head);
- return;
- }
-
- hooklist = hooklist->next;
- }
-
- g_warning
- ("camel_object_unhook_event: cannot find hook/data pair %p/%p in an "
- "instance of `%s' attached to `%s'", hook, user_data,
- camel_type_to_name (obj->s.type), name);
-}
-
-void
-camel_object_trigger_event (CamelObject * obj, const gchar * name,
- gpointer event_data)
-{
- GSList *hooklist;
- CamelHookPair *pair;
- CamelObjectEventPrepFunc prep;
-
- g_return_if_fail (CAMEL_IS_OBJECT (obj));
- g_return_if_fail (name);
-
- if (obj->in_event) {
- g_warning
- ("camel_object_trigger_event: trying to trigger `%s' in class "
- "`%s' while already triggering another event", name,
- camel_type_to_name (obj->s.type));
- return;
- }
-
- if (obj->classfuncs->event_to_preplist == NULL) {
- g_warning
- ("camel_object_trigger_event: trying to trigger `%s' in class "
- "`%s' with no defined events.", name,
- camel_type_to_name (obj->s.type));
- return;
- }
-
- prep = g_hash_table_lookup (obj->classfuncs->event_to_preplist, name);
-
- if (prep == NULL) {
- g_warning
- ("camel_object_trigger_event: trying to trigger undefined "
- "event `%s' in class `%s'.", name,
- camel_type_to_name (obj->s.type));
- return;
- }
-
- /* Ref so that it can't get destroyed in the event, which would
- * be Bad. And it's a valid ref anyway...
- */
-
- camel_object_ref (obj);
- obj->in_event = 1;
-
- if ((prep != NULL_PREP_VALUE && !prep (obj, event_data))
- || obj->event_to_hooklist == NULL) {
- obj->in_event = 0;
- camel_object_unref (obj);
- return;
- }
-
- hooklist = g_hash_table_lookup (obj->event_to_hooklist, name);
-
- while (hooklist && hooklist->data) {
- pair = hooklist->data;
- (pair->func) (obj, event_data, pair->user_data);
- hooklist = hooklist->next;
- }
-
- obj->in_event = 0;
- camel_object_unref (obj);
-}
-
-/* ** Static helpers ****************************************************** */
-
-static gboolean
-shared_is_of_type (CamelObjectShared * sh, CamelType ctype, gboolean is_obj)
-{
- CamelTypeInfo *type_info;
- gchar *targtype;
-
- if (is_obj)
- targtype = "instance";
- else
- targtype = "classdata";
-
- if (ctype == CAMEL_INVALID_TYPE) {
- g_warning
- ("shared_is_of_type: trying to cast to CAMEL_INVALID_TYPE");
- return FALSE;
- }
-
- if (sh == NULL) {
- g_warning
- ("shared_is_of_type: trying to cast NULL to %s of `%s'",
- targtype, camel_type_to_name (ctype));
- return FALSE;
- }
-
- if (sh->magic == CAMEL_OBJECT_FINALIZED_VALUE) {
- g_warning
- ("shared_is_of_type: trying to cast finalized instance "
- "of `%s' into %s of `%s'",
- camel_type_to_name (sh->type), targtype,
- camel_type_to_name (ctype));
- return FALSE;
- }
-
- if (sh->magic == CAMEL_OBJECT_CLASS_FINALIZED_VALUE) {
- g_warning
- ("shared_is_of_type: trying to cast finalized classdata "
- "of `%s' into %s of `%s'",
- camel_type_to_name (sh->type), targtype,
- camel_type_to_name (ctype));
- return FALSE;
- }
-
- if (is_obj) {
- if (sh->magic == CAMEL_OBJECT_CLASS_MAGIC_VALUE) {
- g_warning
- ("shared_is_of_type: trying to cast classdata "
- "of `%s' into instance of `%s'",
- camel_type_to_name (sh->type),
- camel_type_to_name (ctype));
- return FALSE;
- }
-
- if (sh->magic != CAMEL_OBJECT_MAGIC_VALUE) {
- g_warning
- ("shared_is_of_type: trying to cast junk data "
- "into instance of `%s'",
- camel_type_to_name (ctype));
- return FALSE;
- }
- } else {
- if (sh->magic == CAMEL_OBJECT_MAGIC_VALUE) {
- g_warning
- ("shared_is_of_type: trying to cast instance "
- "of `%s' into classdata of `%s'",
- camel_type_to_name (sh->type),
- camel_type_to_name (ctype));
- return FALSE;
- }
-
- if (sh->magic != CAMEL_OBJECT_CLASS_MAGIC_VALUE) {
- g_warning
- ("shared_is_of_type: trying to cast junk data "
- "into classdata of `%s'",
- camel_type_to_name (ctype));
- return FALSE;
- }
- }
-
- camel_type_lock_up ();
-
- type_info =
- g_hash_table_lookup (ctype_to_typeinfo,
- GINT_TO_POINTER (sh->type));
-
- if (type_info == NULL) {
- g_warning ("shared_is_of_type: seemingly valid %s has "
- "bad type %d.", targtype, sh->type);
- camel_type_lock_down ();
- return FALSE;
- }
-
- while (type_info) {
- if (type_info->self == ctype) {
- camel_type_lock_down ();
- return TRUE;
- }
-
- type_info =
- g_hash_table_lookup (ctype_to_typeinfo,
- GINT_TO_POINTER (type_info->
- parent));
- }
-
- /* this isn't an error, e.g. CAMEL_IS_FOLDER(folder), its upto the
- caller to handle the false case */
- /*g_warning
- ("shared_is_of_type: %s of `%s' (@%p) is not also %s of `%s'",
- targtype, camel_type_to_name (sh->type), sh, targtype,
- camel_type_to_name (ctype));*/
-
- camel_type_lock_down ();
- return FALSE;
-}
-
-static void
-make_global_classfuncs (CamelTypeInfo * type_info)
-{
- CamelObjectClass *funcs;
- GSList *parents;
- GSList *head;
-
- g_assert (type_info);
-
- funcs = g_malloc0 (type_info->classfuncs_size);
- funcs->s.type = type_info->self;
-
- type_info->global_classfuncs = funcs;
-
- parents = NULL;
- while (type_info) {
- parents = g_slist_prepend (parents, type_info);
- type_info =
- g_hash_table_lookup (ctype_to_typeinfo,
- GINT_TO_POINTER (type_info->
- parent));
- }
-
- head = parents;
-
- for (; parents && parents->data; parents = parents->next) {
- CamelTypeInfo *thisinfo;
-
- thisinfo = parents->data;
- if (thisinfo->class_init)
- (thisinfo->class_init) (funcs);
- }
-
- g_slist_free (head);
-}
diff --git a/camel/camel-object.h b/camel/camel-object.h
deleted file mode 100644
index 1d27807d24..0000000000
--- a/camel/camel-object.h
+++ /dev/null
@@ -1,146 +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 <stdlib.h> /* size_t */
-#include <camel/camel-types.h>
-#include <glib.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-
-#ifdef G_DISABLE_CHECKS
-#define CAMEL_CHECK_CAST( obj, ctype, ptype ) ((ptype *) obj)
-#define CAMEL_CHECK_CLASS_CAST( class, ctype, ptype ) ((ptype *) class)
-#define CAMEL_CHECK_TYPE( obj, ctype ) (TRUE)
-#define CAMEL_CHECK_CLASS_TYPE( class, ctype ) (TRUE)
-#else
-#define CAMEL_CHECK_CAST( obj, ctype, ptype ) ((ptype *) camel_object_check_cast( (CamelObject *)(obj), (CamelType)(ctype) ))
-#define CAMEL_CHECK_CLASS_CAST( class, ctype, ptype ) ((ptype *) camel_object_class_check_cast( (CamelObjectClass *)(class), (CamelType)(ctype) ))
-#define CAMEL_CHECK_TYPE( obj, ctype ) (camel_object_is_of_type( (CamelObject *)(obj), (CamelType)(ctype) ))
-#define CAMEL_CHECK_CLASS_TYPE( class, ctype ) (camel_object_class_is_of_type( (CamelObjectClass *)(class), (CamelType)(ctype) ))
-#endif
-
-#define CAMEL_INVALID_TYPE ((CamelType)0)
-
-#define CAMEL_OBJECT_TYPE (camel_object_get_type ())
-
-#define CAMEL_OBJECT(obj) (CAMEL_CHECK_CAST((obj), CAMEL_OBJECT_TYPE, CamelObject))
-#define CAMEL_OBJECT_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_OBJECT_TYPE, CamelObjectClass))
-#define CAMEL_IS_OBJECT(o) (CAMEL_CHECK_TYPE((o), CAMEL_OBJECT_TYPE))
-#define CAMEL_IS_OBJECT_CLASS(k) (CAMEL_CHECK_CLASS_TYPE((k), CAMEL_OBJECT_TYPE))
-
-#define CAMEL_OBJECT_GET_CLASS(o) ((CamelObjectClass *)(CAMEL_OBJECT(o))->classfuncs)
-#define CAMEL_OBJECT_GET_TYPE(o) ((CamelType)(CAMEL_OBJECT(o))->s.type)
-
-typedef guint32 CamelType;
-
-typedef struct _CamelObjectShared
-{
- guint32 magic;
- CamelType type;
-}
-CamelObjectShared;
-
-typedef struct _CamelObjectClass
-{
- CamelObjectShared s;
-
- GHashTable *event_to_preplist;
-}
-CamelObjectClass;
-
-typedef struct _CamelObject
-{
- CamelObjectShared s;
- guint32 ref_count:31;
- guint32 in_event:1;
- CamelObjectClass *classfuncs;
- GHashTable *event_to_hooklist;
-}
-CamelObject;
-
-typedef void (*CamelObjectClassInitFunc) (CamelObjectClass *);
-typedef void (*CamelObjectClassFinalizeFunc) (CamelObjectClass *);
-typedef void (*CamelObjectInitFunc) (CamelObject *);
-typedef void (*CamelObjectFinalizeFunc) (CamelObject *);
-
-typedef gboolean (*CamelObjectEventPrepFunc) (CamelObject *,
- gpointer);
-typedef void (*CamelObjectEventHookFunc) (CamelObject *, gpointer,
- gpointer);
-
-/* The type system .... it's pretty simple..... */
-
-void camel_type_init (void);
-CamelType camel_type_register (CamelType parent, const gchar * name,
- size_t instance_size,
- size_t classfuncs_size,
- CamelObjectClassInitFunc class_init,
- CamelObjectClassFinalizeFunc
- class_finalize,
- CamelObjectInitFunc instance_init,
- CamelObjectFinalizeFunc
- instance_finalize);
-CamelObjectClass *camel_type_get_global_classfuncs (CamelType type);
-const gchar *camel_type_to_name (CamelType type);
-
-CamelType camel_object_get_type (void);
-CamelObject *camel_object_new (CamelType type);
-void camel_object_ref (CamelObject * obj);
-void camel_object_unref (CamelObject * obj);
-CamelObject *camel_object_check_cast (CamelObject * obj,
- CamelType ctype);
-CamelObjectClass *camel_object_class_check_cast (CamelObjectClass *
- class,
- CamelType ctype);
-gboolean camel_object_is_of_type (CamelObject * obj, CamelType ctype);
-gboolean camel_object_class_is_of_type (CamelObjectClass * class,
- CamelType ctype);
-gchar *camel_object_describe (CamelObject * obj);
-void camel_object_class_declare_event (CamelObjectClass * class,
- const gchar * name,
- CamelObjectEventPrepFunc prep);
-void camel_object_hook_event (CamelObject * obj, const gchar * name,
- CamelObjectEventHookFunc hook,
- gpointer user_data);
-void camel_object_unhook_event (CamelObject * obj, const gchar * name,
- CamelObjectEventHookFunc hook,
- gpointer user_data);
-void camel_object_trigger_event (CamelObject * obj,
- const gchar * name,
- gpointer event_data);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_OBJECT_H */
diff --git a/camel/camel-operation.c b/camel/camel-operation.c
deleted file mode 100644
index 9d631fca7b..0000000000
--- a/camel/camel-operation.c
+++ /dev/null
@@ -1,540 +0,0 @@
-
-#include "config.h"
-
-#include <stdio.h>
-#ifdef ENABLE_THREADS
-#include <pthread.h>
-#endif
-
-#include <glib.h>
-#include "camel-operation.h"
-#include "e-util/e-msgport.h"
-
-#define d(x)
-
-/* ********************************************************************** */
-
-struct _CamelOperation {
- pthread_t id; /* id of running thread */
- guint32 flags; /* cancelled ? */
- int blocked; /* cancellation blocked depth */
- int refcount;
-
- CamelOperationStatusFunc status;
- void *status_data;
- time_t status_update;
-
- /* stack of status messages (char *) */
- GSList *status_stack;
-
-#ifdef ENABLE_THREADS
- EMsgPort *cancel_port;
- int cancel_fd;
- pthread_mutex_t lock;
-#endif
-};
-
-#define CAMEL_OPERATION_CANCELLED (1<<0)
-
-#ifdef ENABLE_THREADS
-#define CAMEL_OPERATION_LOCK(cc) pthread_mutex_lock(&cc->lock)
-#define CAMEL_OPERATION_UNLOCK(cc) pthread_mutex_unlock(&cc->lock)
-#define CAMEL_ACTIVE_LOCK() pthread_mutex_lock(&operation_active_lock)
-#define CAMEL_ACTIVE_UNLOCK() pthread_mutex_unlock(&operation_active_lock)
-static pthread_mutex_t operation_active_lock = PTHREAD_MUTEX_INITIALIZER;
-#else
-#define CAMEL_OPERATION_LOCK(cc)
-#define CAMEL_OPERATION_UNLOCK(cc)
-#define CAMEL_ACTIVE_LOCK()
-#define CAMEL_ACTIVE_UNLOCK()
-#endif
-
-static GHashTable *operation_active;
-
-typedef struct _CamelOperationMsg {
- EMsg msg;
-} CamelOperationMsg ;
-
-/**
- * camel_operation_new:
- * @status: Callback for receiving status messages.
- * @status_data: User data.
- *
- * Create a new camel operation handle. Camel operation handles can
- * be used in a multithreaded application (or a single operation
- * handle can be used in a non threaded appliation) to cancel running
- * operations and to obtain notification messages of the internal
- * status of messages.
- *
- * Return value: A new operation handle.
- **/
-CamelOperation *camel_operation_new(CamelOperationStatusFunc status, void *status_data)
-{
- CamelOperation *cc;
-
- cc = g_malloc0(sizeof(*cc));
-
- cc->flags = 0;
- cc->blocked = 0;
- cc->refcount = 1;
- cc->status = status;
- cc->status_data = status_data;
-#ifdef ENABLE_THREADS
- cc->id = ~0;
- cc->cancel_port = e_msgport_new();
- cc->cancel_fd = e_msgport_fd(cc->cancel_port);
- pthread_mutex_init(&cc->lock, NULL);
-#endif
-
- return cc;
-}
-
-/**
- * camel_operation_reset:
- * @cc:
- *
- * Resets an operation cancel state and message.
- **/
-void camel_operation_reset(CamelOperation *cc)
-{
- GSList *n;
-
-#ifdef ENABLE_THREADS
- CamelOperationMsg *msg;
-
- while ((msg = (CamelOperationMsg *)e_msgport_get(cc->cancel_port)))
- g_free(msg);
-#endif
-
- n = cc->status_stack;
- while (n) {
- g_free(n->data);
- n = n->next;
- }
- g_slist_free(cc->status_stack);
- cc->status_stack = NULL;
-
- cc->flags = 0;
- cc->blocked = 0;
-}
-
-/**
- * camel_operation_ref:
- * @cc:
- *
- * Add a reference to the CamelOperation @cc.
- **/
-void camel_operation_ref(CamelOperation *cc)
-{
- CAMEL_OPERATION_LOCK(cc);
- cc->refcount++;
- CAMEL_OPERATION_UNLOCK(cc);
-}
-
-/**
- * camel_operation_unref:
- * @cc:
- *
- * Unref and potentially free @cc.
- **/
-void camel_operation_unref(CamelOperation *cc)
-{
- GSList *n;
-#ifdef ENABLE_THREADS
- CamelOperationMsg *msg;
-
- if (cc->refcount == 1) {
- while ((msg = (CamelOperationMsg *)e_msgport_get(cc->cancel_port)))
- g_free(msg);
-
- e_msgport_destroy(cc->cancel_port);
-#endif
- n = cc->status_stack;
- while (n) {
- g_warning("Camel operation status stack non empty: %s", (char *)n->data);
- g_free(n->data);
- n = n->next;
- }
- g_slist_free(cc->status_stack);
-
- g_free(cc);
- } else {
- CAMEL_OPERATION_LOCK(cc);
- cc->refcount--;
- CAMEL_OPERATION_UNLOCK(cc);
- }
-}
-
-/**
- * camel_operation_cancel_block:
- * @cc:
- *
- * Block cancellation for this operation. If @cc is NULL, then the
- * current thread is blocked.
- **/
-void camel_operation_cancel_block(CamelOperation *cc)
-{
- CAMEL_ACTIVE_LOCK();
- if (operation_active == NULL)
- operation_active = g_hash_table_new(NULL, NULL);
-
- if (cc == NULL)
- cc = g_hash_table_lookup(operation_active, (void *)pthread_self());
- CAMEL_ACTIVE_UNLOCK();
-
- if (cc) {
- CAMEL_OPERATION_LOCK(cc);
- cc->blocked++;
- CAMEL_OPERATION_UNLOCK(cc);
- }
-}
-
-/**
- * camel_operation_cancel_unblock:
- * @cc:
- *
- * Unblock cancellation, when the unblock count reaches the block
- * count, then this operation can be cancelled. If @cc is NULL, then
- * the current thread is unblocked.
- **/
-void camel_operation_cancel_unblock(CamelOperation *cc)
-{
- CAMEL_ACTIVE_LOCK();
- if (operation_active == NULL)
- operation_active = g_hash_table_new(NULL, NULL);
-
- if (cc == NULL)
- cc = g_hash_table_lookup(operation_active, (void *)pthread_self());
- CAMEL_ACTIVE_UNLOCK();
-
- if (cc) {
- CAMEL_OPERATION_LOCK(cc);
- cc->blocked--;
- CAMEL_OPERATION_UNLOCK(cc);
- }
-}
-
-static void
-cancel_thread(void *key, CamelOperation *cc, void *data)
-{
- if (cc)
- camel_operation_cancel(cc);
-}
-
-/**
- * camel_operation_cancel:
- * @cc:
- *
- * Cancel a given operation. If @cc is NULL then all outstanding
- * operations are cancelled.
- **/
-void camel_operation_cancel(CamelOperation *cc)
-{
- CamelOperationMsg *msg;
-
- if (cc == NULL) {
- if (operation_active) {
- CAMEL_ACTIVE_LOCK();
- g_hash_table_foreach(operation_active, (GHFunc)cancel_thread, NULL);
- CAMEL_ACTIVE_UNLOCK();
- }
- } else if ((cc->flags & CAMEL_OPERATION_CANCELLED) == 0) {
- d(printf("cancelling thread %d\n", cc->id));
-
- CAMEL_OPERATION_LOCK(cc);
- msg = g_malloc0(sizeof(*msg));
- e_msgport_put(cc->cancel_port, (EMsg *)msg);
- cc->flags |= CAMEL_OPERATION_CANCELLED;
- CAMEL_OPERATION_UNLOCK(cc);
- }
-}
-
-/**
- * camel_operation_register:
- * @cc:
- *
- * Register a thread or the main thread for cancellation through @cc.
- * If @cc is NULL, then a new cancellation is created for this thread,
- * but may only be cancelled from the same thread.
- *
- * All calls to operation_register() should be matched with calls to
- * operation_unregister(), or resources will be lost.
- **/
-void camel_operation_register(CamelOperation *cc)
-{
- pthread_t id = pthread_self();
-
- CAMEL_ACTIVE_LOCK();
-
- if (operation_active == NULL)
- operation_active = g_hash_table_new(NULL, NULL);
-
- if (cc == NULL) {
- cc = g_hash_table_lookup(operation_active, (void *)id);
- if (cc == NULL) {
- cc = camel_operation_new(NULL, NULL);
- }
- }
-
- cc->id = id;
- g_hash_table_insert(operation_active, (void *)id, cc);
-
- d(printf("registering thread %ld for cancellation\n", id));
-
- CAMEL_ACTIVE_UNLOCK();
-
- camel_operation_ref(cc);
-}
-
-/**
- * camel_operation_unregister:
- * @cc:
- *
- * Unregister a given operation from being cancelled. If @cc is NULL,
- * then the current thread is used.
- **/
-void camel_operation_unregister(CamelOperation *cc)
-{
- CAMEL_ACTIVE_LOCK();
-
- if (operation_active == NULL)
- operation_active = g_hash_table_new(NULL, NULL);
-
- if (cc == NULL) {
- cc = g_hash_table_lookup(operation_active, (void *)pthread_self());
- if (cc == NULL) {
- g_warning("Trying to unregister a thread that was never registered for cancellation");
- }
- }
-
- if (cc)
- g_hash_table_remove(operation_active, (void *)cc->id);
-
- CAMEL_ACTIVE_UNLOCK();
-
- d({if (cc) printf("unregistering thread %d for cancellation\n", cc->id);});
-
- if (cc)
- camel_operation_unref(cc);
-}
-
-/**
- * camel_operation_cancel_check:
- * @cc:
- *
- * Check if cancellation has been applied to @cc. If @cc is NULL,
- * then the CamelOperation registered for the current thread is used.
- *
- * Return value: TRUE if the operation has been cancelled.
- **/
-gboolean camel_operation_cancel_check(CamelOperation *cc)
-{
- CamelOperationMsg *msg;
-
- d(printf("checking for cancel in thread %d\n", pthread_self()));
-
- if (cc == NULL) {
- if (operation_active) {
- CAMEL_ACTIVE_LOCK();
- cc = g_hash_table_lookup(operation_active, (void *)pthread_self());
- CAMEL_ACTIVE_UNLOCK();
- }
- if (cc == NULL)
- return FALSE;
- }
-
- if (cc->blocked > 0) {
- d(printf("ahah! cancellation is blocked\n"));
- return FALSE;
- }
-
- if (cc->flags & CAMEL_OPERATION_CANCELLED) {
- d(printf("previously cancelled\n"));
- return TRUE;
- }
-
- msg = (CamelOperationMsg *)e_msgport_get(cc->cancel_port);
- if (msg) {
- d(printf("Got cancellation message\n"));
- CAMEL_OPERATION_LOCK(cc);
- cc->flags |= CAMEL_OPERATION_CANCELLED;
- CAMEL_OPERATION_UNLOCK(cc);
- return TRUE;
- }
- return FALSE;
-}
-
-/**
- * camel_operation_cancel_fd:
- * @cc:
- *
- * Retrieve a file descriptor that can be waited on (select, or poll)
- * for read, to asynchronously detect cancellation.
- *
- * Return value: The fd, or -1 if cancellation is not available
- * (blocked, or has not been registered for this thread).
- **/
-int camel_operation_cancel_fd(CamelOperation *cc)
-{
- if (cc == NULL) {
- if (operation_active) {
- CAMEL_ACTIVE_LOCK();
- cc = g_hash_table_lookup(operation_active, (void *)pthread_self());
- CAMEL_ACTIVE_UNLOCK();
- }
- if (cc == NULL)
- return -1;
- }
- if (cc->blocked)
- return -1;
-
- return cc->cancel_fd;
-}
-
-/**
- * camel_operation_start:
- * @cc:
- * @what:
- * @:
- *
- * Report the start of an operation. All start operations should have
- * similar end operations.
- **/
-void camel_operation_start(CamelOperation *cc, char *what, ...)
-{
- va_list ap;
- char *msg;
-
- if (operation_active == NULL)
- return;
-
- if (cc == NULL) {
- CAMEL_ACTIVE_LOCK();
- cc = g_hash_table_lookup(operation_active, (void *)pthread_self());
- CAMEL_ACTIVE_UNLOCK();
- if (cc == NULL)
- return;
- }
-
- if (cc->status == NULL)
- return;
-
- va_start(ap, what);
- msg = g_strdup_vprintf(what, ap);
- va_end(ap);
- cc->status(cc, msg, CAMEL_OPERATION_START, cc->status_data);
- cc->status_update = 0;
- cc->status_stack = g_slist_prepend(cc->status_stack, msg);
- d(printf("start '%s'\n", msg, pc));
-}
-
-/**
- * camel_operation_progress:
- * @cc: Operation to report to.
- * @pc: Percent complete, 0 to 100.
- *
- * Report progress on the current operation. If @cc is NULL, then the
- * currently registered operation is used. @pc reports the current
- * percentage of completion, which should be in the range of 0 to 100.
- *
- * If the total percentage is not know, then use
- * camel_operation_progress_count().
- **/
-void camel_operation_progress(CamelOperation *cc, int pc)
-{
- char *msg;
- time_t now;
-
- if (operation_active == NULL)
- return;
-
- if (cc == NULL) {
- CAMEL_ACTIVE_LOCK();
- cc = g_hash_table_lookup(operation_active, (void *)pthread_self());
- CAMEL_ACTIVE_UNLOCK();
- if (cc == NULL)
- return;
- }
-
- if (cc->status == NULL)
- return;
-
- if (cc->status_stack == NULL)
- return;
-
- now = time(0);
- if (cc->status_update != now) {
- msg =cc->status_stack->data;
- cc->status(cc, msg, pc, cc->status_data);
- d(printf("progress '%s' %d %%\n", msg, pc));
- cc->status_update = now;
- }
-}
-
-void camel_operation_progress_count(CamelOperation *cc, int sofar)
-{
- char *msg;
- time_t now;
-
- if (operation_active == NULL)
- return;
-
- if (cc == NULL) {
- CAMEL_ACTIVE_LOCK();
- cc = g_hash_table_lookup(operation_active, (void *)pthread_self());
- CAMEL_ACTIVE_UNLOCK();
- if (cc == NULL)
- return;
- }
-
- if (cc->status == NULL)
- return;
-
- if (cc->status_stack == NULL)
- return;
-
- /* FIXME: generate some meaningful pc value */
- now = time(0);
- if (cc->status_update != now) {
- msg =cc->status_stack->data;
- cc->status(cc, msg, sofar, cc->status_data);
- d(printf("progress '%s' %d done\n", msg, sofar));
- cc->status_update = now;
- }
-}
-
-/**
- * camel_operation_end:
- * @cc:
- * @what: Format string.
- * @:
- *
- * Report the end of an operation. If @cc is NULL, then the currently
- * registered operation is notified.
- **/
-void camel_operation_end(CamelOperation *cc)
-{
- char *msg;
-
- if (operation_active == NULL)
- return;
-
- if (cc == NULL) {
- CAMEL_ACTIVE_LOCK();
- cc = g_hash_table_lookup(operation_active, (void *)pthread_self());
- CAMEL_ACTIVE_UNLOCK();
- if (cc == NULL)
- return;
- }
-
- if (cc->status == NULL)
- return;
-
- if (cc->status_stack == NULL)
- return;
-
- msg = cc->status_stack->data;
- cc->status(cc, msg, CAMEL_OPERATION_END, cc->status_data);
- g_free(msg);
- cc->status_stack = g_slist_remove_link(cc->status_stack, cc->status_stack);
-}
diff --git a/camel/camel-operation.h b/camel/camel-operation.h
deleted file mode 100644
index 4a61b40dfc..0000000000
--- a/camel/camel-operation.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Authors: Michael Zucchi <NotZed@Ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (http://www.ximian.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_OPERATION_H
-#define CAMEL_OPERATION_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-/* cancellation helper stuff, not yet finalised */
-
-typedef struct _CamelOperation CamelOperation;
-
-typedef void (*CamelOperationStatusFunc)(struct _CamelOperation *op, const char *what, int pc, void *data);
-
-enum _camel_operation_status_t {
- CAMEL_OPERATION_START = -1,
- CAMEL_OPERATION_END = -2,
-};
-
-/* main thread functions */
-CamelOperation *camel_operation_new(CamelOperationStatusFunc status, void *status_data);
-void camel_operation_ref(CamelOperation *cc);
-void camel_operation_unref(CamelOperation *cc);
-void camel_operation_reset(CamelOperation *cc);
-void camel_operation_cancel(CamelOperation *cc);
-/* subthread functions */
-void camel_operation_register(CamelOperation *cc);
-void camel_operation_unregister(CamelOperation *cc);
-/* called internally by camel, for the current thread */
-void camel_operation_cancel_block(CamelOperation *cc);
-void camel_operation_cancel_unblock(CamelOperation *cc);
-int camel_operation_cancel_check(CamelOperation *cc);
-int camel_operation_cancel_fd(CamelOperation *cc);
-
-void camel_operation_start(CamelOperation *cc, char *what, ...);
-void camel_operation_progress(CamelOperation *cc, int pc);
-void camel_operation_progress_count(CamelOperation *cc, int sofar);
-void camel_operation_end(CamelOperation *cc);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_OPERATION_H */
diff --git a/camel/camel-private.h b/camel/camel-private.h
deleted file mode 100644
index 9be3a24209..0000000000
--- a/camel/camel-private.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- * camel-private.h: Private info for class implementers.
- *
- * 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
- */
-
-#ifndef CAMEL_PRIVATE_H
-#define CAMEL_PRIVATE_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-/* need a way to configure and save this data, if this header is to
- be installed. For now, dont install it */
-
-#include "config.h"
-
-#ifdef ENABLE_THREADS
-#include <pthread.h>
-#include "e-util/e-msgport.h"
-#endif
-
-struct _CamelFolderPrivate {
-#ifdef ENABLE_THREADS
- GMutex *lock;
- GMutex *change_lock;
-#endif
-
- /* must require the 'change_lock' to access this */
- int frozen;
- struct _CamelFolderChangeInfo *changed_frozen; /* queues changed events */
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_FOLDER_LOCK(f, l) (g_mutex_lock(((CamelFolder *)f)->priv->l))
-#define CAMEL_FOLDER_UNLOCK(f, l) (g_mutex_unlock(((CamelFolder *)f)->priv->l))
-#else
-#define CAMEL_FOLDER_LOCK(f, l)
-#define CAMEL_FOLDER_UNLOCK(f, l)
-#endif
-
-struct _CamelStorePrivate {
-#ifdef ENABLE_THREADS
- GMutex *folder_lock; /* for locking folder operations */
- GMutex *cache_lock; /* for locking access to the cache */
-#endif
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_STORE_LOCK(f, l) (g_mutex_lock(((CamelStore *)f)->priv->l))
-#define CAMEL_STORE_UNLOCK(f, l) (g_mutex_unlock(((CamelStore *)f)->priv->l))
-#else
-#define CAMEL_STORE_LOCK(f, l)
-#define CAMEL_STORE_UNLOCK(f, l)
-#endif
-
-struct _CamelServicePrivate {
-#ifdef ENABLE_THREADS
- EMutex *connect_lock; /* for locking connection operations */
-#endif
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_SERVICE_LOCK(f, l) (e_mutex_lock(((CamelService *)f)->priv->l))
-#define CAMEL_SERVICE_UNLOCK(f, l) (e_mutex_unlock(((CamelService *)f)->priv->l))
-#else
-#define CAMEL_SERVICE_LOCK(f, l)
-#define CAMEL_SERVICE_UNLOCK(f, l)
-#endif
-
-struct _CamelSessionPrivate {
-#ifdef ENABLE_THREADS
- GMutex *lock; /* for locking everything basically */
-#endif
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_SESSION_LOCK(f, l) (g_mutex_lock(((CamelSession *)f)->priv->l))
-#define CAMEL_SESSION_UNLOCK(f, l) (g_mutex_unlock(((CamelSession *)f)->priv->l))
-#else
-#define CAMEL_SESSION_LOCK(f, l)
-#define CAMEL_SESSION_UNLOCK(f, l)
-#endif
-
-
-struct _CamelRemoteStorePrivate {
-#ifdef ENABLE_THREADS
- EMutex *stream_lock; /* for locking stream operations */
-#endif
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_REMOTE_STORE_LOCK(f, l) (e_mutex_lock(((CamelRemoteStore *)f)->priv->l))
-#define CAMEL_REMOTE_STORE_UNLOCK(f, l) (e_mutex_unlock(((CamelRemoteStore *)f)->priv->l))
-#else
-#define CAMEL_REMOTE_STORE_LOCK(f, l)
-#define CAMEL_REMOTE_STORE_UNLOCK(f, l)
-#endif
-
-/* most of this stuff really is private, but the lock can be used by subordinate classes */
-struct _CamelFolderSummaryPrivate {
- GHashTable *filter_charset; /* CamelMimeFilterCharset's indexed by source charset */
-
- CamelMimeFilterIndex *filter_index;
- CamelMimeFilterBasic *filter_64;
- CamelMimeFilterBasic *filter_qp;
- CamelMimeFilterSave *filter_save;
-
- struct ibex *index;
-
-#ifdef ENABLE_THREADS
- GMutex *summary_lock; /* for the summary hashtable/array */
- GMutex *io_lock; /* load/save lock, for access to saved_count, etc */
- GMutex *filter_lock; /* for accessing any of the filtering/indexing stuff, since we share them */
- GMutex *alloc_lock; /* for setting up and using allocators */
- GMutex *ref_lock; /* for reffing/unreffing messageinfo's ALWAYS obtain before summary_lock */
-#endif
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_SUMMARY_LOCK(f, l) (g_mutex_lock(((CamelFolderSummary *)f)->priv->l))
-#define CAMEL_SUMMARY_UNLOCK(f, l) (g_mutex_unlock(((CamelFolderSummary *)f)->priv->l))
-#else
-#define CAMEL_SUMMARY_LOCK(f, l)
-#define CAMEL_SUMMARY_UNLOCK(f, l)
-#endif
-
-struct _CamelVeeStorePrivate {
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_VEE_STORE_LOCK(f, l) (e_mutex_lock(((CamelVeeStore *)f)->priv->l))
-#define CAMEL_VEE_STORE_UNLOCK(f, l) (e_mutex_unlock(((CamelVeeStore *)f)->priv->l))
-#else
-#define CAMEL_VEE_STORE_LOCK(f, l)
-#define CAMEL_VEE_STORE_UNLOCK(f, l)
-#endif
-
-struct _CamelVeeFolderPrivate {
- GList *folders; /* lock using subfolder_lock before changing/accessing */
-
-#ifdef ENABLE_THREADS
- GMutex *summary_lock; /* for locking vfolder summary */
- GMutex *subfolder_lock; /* for locking the subfolder list */
-#endif
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_VEE_FOLDER_LOCK(f, l) (g_mutex_lock(((CamelVeeFolder *)f)->priv->l))
-#define CAMEL_VEE_FOLDER_UNLOCK(f, l) (g_mutex_unlock(((CamelVeeFolder *)f)->priv->l))
-#else
-#define CAMEL_VEE_FOLDER_LOCK(f, l)
-#define CAMEL_VEE_FOLDER_UNLOCK(f, l)
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_H */
-
diff --git a/camel/camel-provider.c b/camel/camel-provider.c
deleted file mode 100644
index 03be7cdf1e..0000000000
--- a/camel/camel-provider.c
+++ /dev/null
@@ -1,148 +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>
- * Jeffrey Stedfast <fejj@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>
-
-/**
- * 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 "
- "code 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 07d62106ea..0000000000
--- a/camel/camel-provider.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-provider.h : provider definition */
-
-/*
- *
- * Authors:
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- * Jeffrey Stedfast <fejj@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 <camel/camel-types.h>
-#include <camel/camel-object.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];
-
-/* _IS_SOURCE means the user can get mail from there.
- * _IS_STORAGE means the user can read mail from there.
- */
-#define CAMEL_PROVIDER_IS_REMOTE (1 << 0)
-#define CAMEL_PROVIDER_IS_SOURCE (1 << 1)
-#define CAMEL_PROVIDER_IS_STORAGE (1 << 2)
-
-
-/* Flags for url_flags. "ALLOW" means the config dialog will let
- * the user configure it. "NEED" implies "ALLOW" but means the user
- * must configure it. Service code can assume that any url part
- * for which it has set the NEED flag will be set when the service
- * is created.
- */
-#define CAMEL_URL_ALLOW_USER (1 << 0)
-#define CAMEL_URL_ALLOW_AUTH (1 << 1)
-#define CAMEL_URL_ALLOW_PASSWORD (1 << 2)
-#define CAMEL_URL_ALLOW_HOST (1 << 3)
-#define CAMEL_URL_ALLOW_PORT (1 << 4)
-#define CAMEL_URL_ALLOW_PATH (1 << 5)
-
-#define CAMEL_URL_NEED_USER (1 << 6 | 1 << 0)
-#define CAMEL_URL_NEED_AUTH (1 << 7 | 1 << 1)
-#define CAMEL_URL_NEED_PASSWORD (1 << 8 | 1 << 2)
-#define CAMEL_URL_NEED_HOST (1 << 9 | 1 << 3)
-#define CAMEL_URL_NEED_PORT (1 << 10 | 1 << 4)
-#define CAMEL_URL_NEED_PATH (1 << 11 | 1 << 5)
-
-#define CAMEL_URL_PATH_IS_ABSOLUTE (1 << 12)
-
-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;
-
- /* The category of message that this provider works with.
- * (evolution-mail will only list a provider in the store/transport
- * config dialogs if its domain is "mail".)
- */
- char *domain;
-
- int flags, url_flags;
-
- CamelType object_types [CAMEL_NUM_PROVIDER_TYPES];
-
- GHashTable *service_cache;
-
-} 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-remote-store.c b/camel/camel-remote-store.c
deleted file mode 100644
index 41e16a27fc..0000000000
--- a/camel/camel-remote-store.c
+++ /dev/null
@@ -1,643 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-remote-store.c : class for an remote store */
-
-/*
- * Authors: Peter Williams <peterw@helixcode.com>
- * based on camel-imap-provider.c
- *
- * Copyright 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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include <config.h>
-
-#include <sys/time.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-remote-store.h"
-#include "camel-folder.h"
-#include "camel-exception.h"
-#include "camel-session.h"
-#include "camel-stream.h"
-#include "camel-stream-buffer.h"
-#include "camel-stream-fs.h"
-#include "camel-url.h"
-#include "string-utils.h"
-
-#include "camel-private.h"
-#include "camel-operation.h"
-
-#define d(x) x
-#if d(!)0
-extern gboolean camel_verbose_debug;
-#endif
-
-#define CSRVC(obj) (CAMEL_SERVICE_CLASS (CAMEL_OBJECT_GET_CLASS (obj)))
-#define CSTRC(obj) (CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS (obj)))
-#define CRSC(obj) (CAMEL_REMOTE_STORE_CLASS (CAMEL_OBJECT_GET_CLASS (obj)))
-
-static CamelStoreClass *store_class = NULL;
-
-static gboolean remote_connect (CamelService *service, CamelException *ex);
-static gboolean remote_disconnect (CamelService *service, gboolean clean, CamelException *ex);
-static GList *remote_query_auth_types(CamelService *service, gboolean connect, CamelException *ex);
-static void remote_free_auth_types (CamelService *service, GList *authtypes);
-static char *remote_get_name (CamelService *service, gboolean brief);
-static gint remote_send_string (CamelRemoteStore *store, CamelException *ex,
- char *fmt, va_list ap);
-static gint remote_send_stream (CamelRemoteStore *store, CamelStream *stream,
- CamelException *ex);
-static gint remote_recv_line (CamelRemoteStore *store, char **dest,
- CamelException *ex);
-
-static void
-camel_remote_store_class_init (CamelRemoteStoreClass *camel_remote_store_class)
-{
- /* virtual method overload */
- CamelServiceClass *camel_service_class =
- CAMEL_SERVICE_CLASS (camel_remote_store_class);
-
- store_class = CAMEL_STORE_CLASS (camel_type_get_global_classfuncs (camel_store_get_type ()));
-
- /* virtual method overload */
- camel_service_class->connect = remote_connect;
- camel_service_class->disconnect = remote_disconnect;
- camel_service_class->query_auth_types = remote_query_auth_types;
- camel_service_class->free_auth_types = remote_free_auth_types;
- camel_service_class->get_name = remote_get_name;
-
- camel_remote_store_class->send_string = remote_send_string;
- camel_remote_store_class->send_stream = remote_send_stream;
- camel_remote_store_class->recv_line = remote_recv_line;
- camel_remote_store_class->keepalive = NULL;
-}
-
-static void
-camel_remote_store_init (CamelObject *object)
-{
- CamelStore *store = CAMEL_STORE (object);
- CamelRemoteStore *remote_store = CAMEL_REMOTE_STORE (object);
-
- store->folders = g_hash_table_new (g_str_hash, g_str_equal);
-
- remote_store->istream = NULL;
- remote_store->ostream = NULL;
- remote_store->timeout_id = 0;
-
- remote_store->priv = g_malloc0(sizeof(*remote_store->priv));
-#ifdef ENABLE_THREADS
- remote_store->priv->stream_lock = e_mutex_new(E_MUTEX_REC);
-#endif
-}
-
-static void
-camel_remote_store_finalise(CamelObject *object)
-{
- CamelRemoteStore *remote_store = CAMEL_REMOTE_STORE (object);
-
-#ifdef ENABLE_THREADS
- e_mutex_destroy(remote_store->priv->stream_lock);
-#endif
- g_free(remote_store->priv);
-}
-
-
-CamelType
-camel_remote_store_get_type (void)
-{
- static CamelType camel_remote_store_type = CAMEL_INVALID_TYPE;
-
- if (camel_remote_store_type == CAMEL_INVALID_TYPE) {
- camel_remote_store_type =
- camel_type_register (CAMEL_STORE_TYPE, "CamelRemoteStore",
- sizeof (CamelRemoteStore),
- sizeof (CamelRemoteStoreClass),
- (CamelObjectClassInitFunc) camel_remote_store_class_init,
- NULL,
- (CamelObjectInitFunc) camel_remote_store_init,
- (CamelObjectFinalizeFunc) camel_remote_store_finalise);
- }
-
- return camel_remote_store_type;
-}
-
-/* Auth stuff */
-
-/*
-static CamelServiceAuthType password_authtype = {
- N_("SSH Tunneling"),
-
- N_("This option will connect to the server using a "
- "SSH tunnel."),
-
- "",
- TRUE
-};
-*/
-
-static GList *
-remote_query_auth_types (CamelService *service, gboolean connect, CamelException *ex)
-{
- return NULL;
-}
-
-static void
-remote_free_auth_types (CamelService *service, GList *authtypes)
-{
- g_list_free (authtypes);
-}
-
-static char *
-remote_get_name (CamelService *service, gboolean brief)
-{
- if (brief)
- return g_strdup_printf (_("%s server %s"),
- service->provider->name,
- service->url->host);
- else {
- return g_strdup_printf (_("%s service for %s on %s"),
- service->provider->name,
- service->url->user,
- service->url->host);
- }
-}
-
-static gboolean
-timeout_cb (gpointer data)
-{
- CamelRemoteStore *store = CAMEL_REMOTE_STORE(data);
-
- CRSC (data)->keepalive(store);
-
- return TRUE;
-}
-
-/* this is a 'cancellable' connect, cancellable from camel_operation_cancel etc */
-/* returns -1 & errno == EINTR if the connection was cancelled */
-static int socket_connect(struct hostent *h, int port)
-{
- struct sockaddr_in sin;
- int fd;
- int ret;
- socklen_t len;
- struct timeval tv;
- int cancel_fd;
-
- /* see if we're cancelled yet */
- if (camel_operation_cancel_check(NULL)) {
- errno = EINTR;
- return -1;
- }
-
- /* setup connect, we do it using a nonblocking socket so we can poll it */
- sin.sin_port = htons(port);
- sin.sin_family = h->h_addrtype;
- memcpy (&sin.sin_addr, h->h_addr, sizeof (sin.sin_addr));
-
- fd = socket (h->h_addrtype, SOCK_STREAM, 0);
-
- cancel_fd = camel_operation_cancel_fd(NULL);
- if (cancel_fd == -1) {
- ret = connect(fd, (struct sockaddr *)&sin, sizeof (sin));
- if (ret == -1) {
- close(fd);
- return -1;
- }
- return fd;
- } else {
- fd_set rdset, wrset;
- int flags, fdmax;
-
- flags = fcntl(fd, F_GETFL);
- fcntl(fd, F_SETFL, flags | O_NONBLOCK);
-
- ret = connect(fd, (struct sockaddr *)&sin, sizeof (sin));
- if (ret == 0) {
- fcntl(fd, F_SETFL, flags);
- return fd;
- }
-
- if (errno != EINPROGRESS) {
- close(fd);
- return -1;
- }
-
- FD_ZERO(&rdset);
- FD_ZERO(&wrset);
- FD_SET(fd, &wrset);
- FD_SET(cancel_fd, &rdset);
- fdmax = MAX(fd, cancel_fd)+1;
- tv.tv_usec = 0;
- tv.tv_sec = 60*4;
- if (select(fdmax, &rdset, &wrset, 0, &tv) == 0) {
- close(fd);
- errno = ETIMEDOUT;
- return -1;
- }
- if (cancel_fd != -1 && FD_ISSET(cancel_fd, &rdset)) {
- close(fd);
- errno = EINTR;
- return -1;
- } else {
- len = sizeof(int);
- if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &ret, &len) == -1) {
- close(fd);
- return -1;
- }
- if (ret != 0) {
- close(fd);
- errno = ret;
- return -1;
- }
- }
- fcntl(fd, F_SETFL, flags);
- }
-
- return fd;
-}
-
-static gboolean
-remote_connect (CamelService *service, CamelException *ex)
-{
- CamelRemoteStore *store = CAMEL_REMOTE_STORE (service);
- struct hostent *h;
- struct sockaddr_in sin;
- gint fd;
- gint port;
-
- h = camel_service_gethost (service, ex);
- if (!h)
- return FALSE;
-
- /* connect to the server */
- sin.sin_family = h->h_addrtype;
-
- if (service->url->port)
- port = service->url->port;
- else
- port = store->default_port;
-
-#if 1
- fd = socket_connect(h, port);
- if (fd == -1) {
- if (errno == EINTR)
- camel_exception_set(ex, CAMEL_EXCEPTION_USER_CANCEL, _("Connection cancelled"));
- else
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Could not connect to %s (port %d): %s"),
- service->url->host ? service->url->host : _("(unknown host)"),
- port, strerror (errno));
- return FALSE;
- }
-#else
- sin.sin_port = htons (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 %d): %s"),
- service->url->host ? service->url->host : _("(unknown host)"),
- port, g_strerror (errno));
- if (fd > -1)
- close (fd);
-
- return FALSE;
- }
-#endif
-
- /* parent class connect initialization */
- if (CAMEL_SERVICE_CLASS (store_class)->connect (service, ex) == FALSE)
- return FALSE;
-
- store->ostream = camel_stream_fs_new_with_fd (fd);
- store->istream = camel_stream_buffer_new (store->ostream, CAMEL_STREAM_BUFFER_READ);
-
- /* Okay, good enough for us */
- CAMEL_SERVICE (store)->connected = TRUE;
-
- /* Add a timeout so that we can hopefully prevent getting disconnected */
- /* (Only if the implementation supports it) */
- if (CRSC (store)->keepalive) {
- CamelSession *session = camel_service_get_session (CAMEL_SERVICE (store));
-
- store->timeout_id = camel_session_register_timeout (session, 10 * 60 * 1000,
- timeout_cb,
- store);
- }
-
- return TRUE;
-}
-
-static gboolean
-remote_disconnect (CamelService *service, gboolean clean, CamelException *ex)
-{
- CamelRemoteStore *store = CAMEL_REMOTE_STORE (service);
-
- if (store->timeout_id) {
- camel_session_remove_timeout (camel_service_get_session (CAMEL_SERVICE (store)),
- store->timeout_id);
- store->timeout_id = 0;
- }
-
- if (!CAMEL_SERVICE_CLASS (store_class)->disconnect (service, clean, ex))
- return FALSE;
-
- if (store->istream) {
- camel_object_unref (CAMEL_OBJECT (store->istream));
- store->istream = NULL;
- }
-
- if (store->ostream) {
- camel_object_unref (CAMEL_OBJECT (store->ostream));
- store->ostream = NULL;
- }
-
- return TRUE;
-}
-
-static gint
-remote_send_string (CamelRemoteStore *store, CamelException *ex, char *fmt, va_list ap)
-{
- gchar *cmdbuf;
-
- /* Check for connectedness. Failed (or cancelled) operations will
- * close the connection. */
- if (!camel_remote_store_connected (store, ex))
- return -1;
-
- /* create the command */
- cmdbuf = g_strdup_vprintf (fmt, ap);
-
-#if d(!)0
- if (camel_verbose_debug) {
- if (strncmp (cmdbuf, "PASS ", 5) == 0)
- fprintf (stderr, "sending : PASS xxxx\n");
- else if (strstr (cmdbuf, "LOGIN \""))
- fprintf (stderr, "sending : ---- LOGIN \"xxxx\" \"xxxx\"\n");
- else
- fprintf (stderr, "sending : %s", cmdbuf);
- }
-#endif
-
- if (camel_stream_printf (store->ostream, "%s", cmdbuf) == -1) {
- if (errno == EINTR)
- camel_exception_set(ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled"));
- else
- camel_exception_set(ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, strerror(errno));
- g_free (cmdbuf);
-
- camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
- return -1;
- }
- g_free (cmdbuf);
-
- return 0;
-}
-
-/* FIXME: All of these functions need an api overhaul, they're not like
- any other functions, anywhere in the world ... */
-
-/**
- * camel_remote_store_send_string: Writes a string to the server
- * @store: a CamelRemoteStore
- * @ex: a CamelException
- * @fmt: the printf-style format to use for creating the string to send
- * @...: the arguments to the printf string @fmt
- * Return value: 0 on success, nonzero on error
- *
- * Formats the string and sends it to the server.
- **/
-
-gint
-camel_remote_store_send_string (CamelRemoteStore *store, CamelException *ex,
- char *fmt, ...)
-{
- va_list ap;
- gint ret;
-
- g_return_val_if_fail (CAMEL_IS_REMOTE_STORE (store), -1);
- g_return_val_if_fail (fmt, -1);
-
- va_start (ap, fmt);
- CAMEL_REMOTE_STORE_LOCK(store, stream_lock);
- ret = CRSC (store)->send_string (store, ex, fmt, ap);
- CAMEL_REMOTE_STORE_UNLOCK(store, stream_lock);
- va_end (ap);
-
- return ret;
-}
-
-static gint
-remote_send_stream (CamelRemoteStore *store, CamelStream *stream, CamelException *ex)
-{
- int ret;
-
- /* Check for connectedness. Failed (or cancelled) operations will
- * close the connection. */
-
- if (!camel_remote_store_connected (store, ex))
- return -1;
-
- d(fprintf (stderr, "(sending stream)\n"));
-
- ret = camel_stream_write_to_stream (stream, store->ostream);
- if (ret == -1) {
- if (errno == EINTR)
- camel_exception_set(ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled"));
- else
- camel_exception_set(ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, strerror(errno));
-
- camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
- }
-
- return ret;
-}
-
-/**
- * camel_remote_store_send_stream: Writes a CamelStream to the server
- * @store: a CamelRemoteStore
- * @stream: the stream to write
- * @ex: a CamelException
- * Return value: 0 on success, nonzero on error
- *
- * Sends the stream to the server.
- **/
-
-gint
-camel_remote_store_send_stream (CamelRemoteStore *store, CamelStream *stream, CamelException *ex)
-{
- int ret;
-
- g_return_val_if_fail (CAMEL_IS_REMOTE_STORE (store), -1);
- g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
-
- CAMEL_REMOTE_STORE_LOCK(store, stream_lock);
-
- ret = CRSC (store)->send_stream (store, stream, ex);
-
- CAMEL_REMOTE_STORE_UNLOCK(store, stream_lock);
-
- return ret;
-}
-
-static int
-remote_recv_line (CamelRemoteStore *store, char **dest, CamelException *ex)
-{
- CamelStreamBuffer *stream = CAMEL_STREAM_BUFFER (store->istream);
- GByteArray *bytes;
- gchar buf[1024], *ret;
- gint nread;
-
- *dest = NULL;
-
- /* Check for connectedness. Failed (or cancelled) operations will
- * close the connection. We can't expect a read to have any
- * meaning if we reconnect, so always set an exception.
- */
-
- if (!camel_remote_store_connected (store, ex)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED,
- g_strerror (errno));
- return -1;
- }
-
- bytes = g_byte_array_new ();
-
- do {
- nread = camel_stream_buffer_gets (stream, buf, sizeof (buf));
- if (nread > 0)
- g_byte_array_append (bytes, buf, nread);
- } while (nread == sizeof (buf) - 1);
-
- if (nread == -1) {
- if (errno == EINTR)
- camel_exception_set(ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled"));
- else
- camel_exception_set(ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, strerror(errno));
- } else if (bytes->len == 0) {
- camel_exception_set(ex, CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED,
- _("Server unexpectedly disconnected"));
- }
- if (camel_exception_is_set (ex)) {
- g_byte_array_free(bytes, TRUE);
- camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
- return -1;
- }
-
- g_byte_array_append (bytes, "", 1);
- ret = bytes->data;
- nread = bytes->len - 1;
- g_byte_array_free (bytes, FALSE);
-
- /* strip off the CRLF sequence */
- while (nread > 0 && ret[nread] != '\r')
- ret[nread--] = '\0';
- ret[nread] = '\0';
-
- *dest = ret;
-
-#if d(!)0
- if (camel_verbose_debug)
- fprintf (stderr, "received: %s\n", *dest);
-#endif
-
- return nread;
-}
-
-/**
- * camel_remote_store_recv_line: Reads a line from the server
- * @store: a CamelRemoteStore
- * @dest: a pointer that will be set to the location of a buffer
- * holding the server's response
- * @ex: a CamelException
- * Return value: -1 on error, otherwise the length read.
- *
- * Reads a line from the server (terminated by \n or \r\n).
- **/
-
-gint
-camel_remote_store_recv_line (CamelRemoteStore *store, char **dest,
- CamelException *ex)
-{
- int ret;
-
- g_return_val_if_fail (CAMEL_IS_REMOTE_STORE (store), -1);
- g_return_val_if_fail (dest, -1);
-
- CAMEL_REMOTE_STORE_LOCK(store, stream_lock);
-
- ret = CRSC (store)->recv_line (store, dest, ex);
-
- CAMEL_REMOTE_STORE_UNLOCK(store, stream_lock);
-
- return ret;
-}
-
-static void
-refresh_folder_info (gpointer key, gpointer value, gpointer data)
-{
- CamelFolder *folder = CAMEL_FOLDER (value);
-
- camel_folder_refresh_info (folder, (CamelException *) data);
-}
-
-/**
- * camel_remote_store_refresh_folders: Refresh the folders that I
- * contain
- * @store: a CamelRemoteStore
- * @ex: a CamelException
- *
- * Refreshes the folders listed in the folders hashtable.
- **/
-void
-camel_remote_store_refresh_folders (CamelRemoteStore *store, CamelException *ex)
-{
- CAMEL_STORE_LOCK(store, cache_lock);
-
- g_hash_table_foreach (CAMEL_STORE (store)->folders, refresh_folder_info, ex);
-
- CAMEL_STORE_UNLOCK(store, cache_lock);
-}
-
-/**
- * camel_remote_store_connected:
- * @store: a CamelRemoteStore
- * @ex: a CamelException
- *
- * Ensure that the remote store is connected.
- *
- * Return value: Whether or not it is connected
- **/
-gboolean
-camel_remote_store_connected (CamelRemoteStore *store, CamelException *ex)
-{
- if (store->istream == NULL) {
- camel_service_connect (CAMEL_SERVICE (store), ex);
- return !camel_exception_is_set (ex);
- }
- return TRUE;
-}
diff --git a/camel/camel-remote-store.h b/camel/camel-remote-store.h
deleted file mode 100644
index 51322b6886..0000000000
--- a/camel/camel-remote-store.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-remote-store.h : class for a remote store */
-
-/*
- * Authors: Peter Williams <peterw@helixcode.com>
- *
- * Copyright (C) 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
- */
-
-#ifndef CAMEL_REMOTE_STORE_H
-#define CAMEL_REMOTE_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-store.h"
-
-#define CAMEL_REMOTE_STORE_TYPE (camel_remote_store_get_type ())
-#define CAMEL_REMOTE_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_REMOTE_STORE_TYPE, CamelRemoteStore))
-#define CAMEL_REMOTE_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_REMOTE_STORE_TYPE, CamelRemoteStoreClass))
-#define CAMEL_IS_REMOTE_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_REMOTE_STORE_TYPE))
-
-typedef struct {
- CamelStore parent_object;
- struct _CamelRemoteStorePrivate *priv;
-
- CamelStream *istream, *ostream;
- guint timeout_id, default_port;
-} CamelRemoteStore;
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
- gint (*send_string) (CamelRemoteStore *store, CamelException *ex,
- char *fmt, va_list ap);
- gint (*send_stream) (CamelRemoteStore *store, CamelStream *stream,
- CamelException *ex);
- gint (*recv_line) (CamelRemoteStore *store, char **dest,
- CamelException *ex);
- void (*keepalive) (CamelRemoteStore *store);
-} CamelRemoteStoreClass;
-
-
-/* Standard Camel function */
-CamelType camel_remote_store_get_type (void);
-
-/* FIXME: All of these i/o functions need an api overhaul, they're not like
- any other functions, anywhere in the world ... */
-
-/* Extra public functions */
-gint camel_remote_store_send_string (CamelRemoteStore *store, CamelException *ex,
- char *fmt, ...);
-gint camel_remote_store_send_stream (CamelRemoteStore *store, CamelStream *stream,
- CamelException *ex);
-gint camel_remote_store_recv_line (CamelRemoteStore *store, char **dest,
- CamelException *ex);
-void camel_remote_store_refresh_folders (CamelRemoteStore *store,
- CamelException *ex);
-gboolean camel_remote_store_connected (CamelRemoteStore *store, CamelException *ex);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_REMOTE_STORE_H */
diff --git a/camel/camel-sasl-anonymous.c b/camel/camel-sasl-anonymous.c
deleted file mode 100644
index f6d7d4ec24..0000000000
--- a/camel/camel-sasl-anonymous.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include <config.h>
-#include "camel-sasl-anonymous.h"
-#include "camel-internet-address.h"
-#include <string.h>
-
-static CamelSaslClass *parent_class = NULL;
-
-/* Returns the class for a CamelSaslAnonymous */
-#define CSA_CLASS(so) CAMEL_SASL_ANONYMOUS_CLASS (CAMEL_OBJECT_GET_CLASS (so))
-
-static GByteArray *anon_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex);
-
-static void
-camel_sasl_anonymous_class_init (CamelSaslAnonymousClass *camel_sasl_anonymous_class)
-{
- CamelSaslClass *camel_sasl_class = CAMEL_SASL_CLASS (camel_sasl_anonymous_class);
-
- parent_class = CAMEL_SASL_CLASS (camel_type_get_global_classfuncs (camel_sasl_get_type ()));
-
- /* virtual method overload */
- camel_sasl_class->challenge = anon_challenge;
-}
-
-static void
-camel_sasl_anonymous_finalize (CamelObject *object)
-{
- CamelSaslAnonymous *sasl = CAMEL_SASL_ANONYMOUS (object);
-
- g_free (sasl->trace_info);
-}
-
-
-CamelType
-camel_sasl_anonymous_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_sasl_get_type (),
- "CamelSaslAnonymous",
- sizeof (CamelSaslAnonymous),
- sizeof (CamelSaslAnonymousClass),
- (CamelObjectClassInitFunc) camel_sasl_anonymous_class_init,
- NULL,
- NULL,
- (CamelObjectFinalizeFunc) camel_sasl_anonymous_finalize);
- }
-
- return type;
-}
-
-CamelSasl *
-camel_sasl_anonymous_new (CamelSaslAnonTraceType type, const char *trace_info)
-{
- CamelSaslAnonymous *sasl_anon;
-
- if (!trace_info && type != CAMEL_SASL_ANON_TRACE_EMPTY) return NULL;
-
- sasl_anon = CAMEL_SASL_ANONYMOUS (camel_object_new (camel_sasl_anonymous_get_type ()));
- sasl_anon->trace_info = g_strdup (trace_info);
- sasl_anon->type = type;
-
- return CAMEL_SASL (sasl_anon);
-}
-
-static GByteArray *
-anon_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
-{
- CamelSaslAnonymous *sasl_anon = CAMEL_SASL_ANONYMOUS (sasl);
- CamelInternetAddress *cia;
- GByteArray *ret = NULL;
-
- if (token) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Authentication failed."));
- return NULL;
- }
-
- switch (sasl_anon->type) {
- case CAMEL_SASL_ANON_TRACE_EMAIL:
- cia = camel_internet_address_new ();
- if (camel_internet_address_add (cia, NULL, sasl_anon->trace_info) != 1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Invalid email address trace information:\n%s"),
- sasl_anon->trace_info);
- camel_object_unref (CAMEL_OBJECT (cia));
- return NULL;
- }
- camel_object_unref (CAMEL_OBJECT (cia));
- ret = g_byte_array_new ();
- g_byte_array_append (ret, sasl_anon->trace_info, strlen (sasl_anon->trace_info));
- break;
- case CAMEL_SASL_ANON_TRACE_OPAQUE:
- if (strchr (sasl_anon->trace_info, '@')) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Invalid opaque trace information:\n%s"),
- sasl_anon->trace_info);
- return NULL;
- }
- ret = g_byte_array_new ();
- g_byte_array_append (ret, sasl_anon->trace_info, strlen (sasl_anon->trace_info));
- break;
- case CAMEL_SASL_ANON_TRACE_EMPTY:
- ret = g_byte_array_new ();
- break;
- default:
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Invalid trace information:\n%s"),
- sasl_anon->trace_info);
- return NULL;
- }
-
- sasl->authenticated = TRUE;
- return ret;
-}
diff --git a/camel/camel-sasl-anonymous.h b/camel/camel-sasl-anonymous.h
deleted file mode 100644
index 3b27aeb183..0000000000
--- a/camel/camel-sasl-anonymous.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef CAMEL_SASL_ANONYMOUS_H
-#define CAMEL_SASL_ANONYMOUS_H
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-sasl.h>
-
-#define CAMEL_SASL_ANONYMOUS_TYPE (camel_sasl_anonymous_get_type ())
-#define CAMEL_SASL_ANONYMOUS(obj) (CAMEL_CHECK_CAST((obj), CAMEL_SASL_ANONYMOUS_TYPE, CamelSaslAnonymous))
-#define CAMEL_SASL_ANONYMOUS_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SASL_ANONYMOUS_TYPE, CamelSaslAnonymousClass))
-#define CAMEL_IS_SASL_ANONYMOUS(o) (CAMEL_CHECK_TYPE((o), CAMEL_SASL_ANONYMOUS_TYPE))
-
-typedef enum {
- CAMEL_SASL_ANON_TRACE_EMAIL,
- CAMEL_SASL_ANON_TRACE_OPAQUE,
- CAMEL_SASL_ANON_TRACE_EMPTY
-} CamelSaslAnonTraceType;
-
-typedef struct _CamelSaslAnonymous {
- CamelSasl parent_object;
-
- char *trace_info;
- CamelSaslAnonTraceType type;
-} CamelSaslAnonymous;
-
-
-typedef struct _CamelSaslAnonymousClass {
- CamelSaslClass parent_class;
-
-} CamelSaslAnonymousClass;
-
-
-/* Standard Camel function */
-CamelType camel_sasl_anonymous_get_type (void);
-
-/* public methods */
-CamelSasl * camel_sasl_anonymous_new (CamelSaslAnonTraceType type, const char *trace_info);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SASL_ANONYMOUS_H */
diff --git a/camel/camel-sasl-cram-md5.c b/camel/camel-sasl-cram-md5.c
deleted file mode 100644
index 458517c5d5..0000000000
--- a/camel/camel-sasl-cram-md5.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include <config.h>
-#include "camel-sasl-cram-md5.h"
-#include "camel-mime-utils.h"
-#include "camel-service.h"
-#include <e-util/md5-utils.h>
-#include <stdio.h>
-#include <string.h>
-
-CamelServiceAuthType camel_sasl_cram_md5_authtype = {
- N_("CRAM-MD5"),
-
- N_("This option will connect to the server using a "
- "secure CRAM-MD5 password, if the server supports it."),
-
- "CRAM-MD5",
- TRUE
-};
-
-static CamelSaslClass *parent_class = NULL;
-
-/* Returns the class for a CamelSaslCramMd5 */
-#define CSCM_CLASS(so) CAMEL_SASL_CRAM_MD5_CLASS (CAMEL_OBJECT_GET_CLASS (so))
-
-static GByteArray *cram_md5_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex);
-
-static void
-camel_sasl_cram_md5_class_init (CamelSaslCramMd5Class *camel_sasl_cram_md5_class)
-{
- CamelSaslClass *camel_sasl_class = CAMEL_SASL_CLASS (camel_sasl_cram_md5_class);
-
- parent_class = CAMEL_SASL_CLASS (camel_type_get_global_classfuncs (camel_sasl_get_type ()));
-
- /* virtual method overload */
- camel_sasl_class->challenge = cram_md5_challenge;
-}
-
-CamelType
-camel_sasl_cram_md5_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_sasl_get_type (),
- "CamelSaslCramMd5",
- sizeof (CamelSaslCramMd5),
- sizeof (CamelSaslCramMd5Class),
- (CamelObjectClassInitFunc) camel_sasl_cram_md5_class_init,
- NULL,
- NULL,
- NULL);
- }
-
- return type;
-}
-
-/* CRAM-MD5 algorithm:
- * MD5 ((passwd XOR opad), MD5 ((passwd XOR ipad), timestamp))
- */
-
-static GByteArray *
-cram_md5_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
-{
- char *passwd;
- guchar digest[16], md5asc[33], *s, *p;
- GByteArray *ret = NULL;
- guchar ipad[64];
- guchar opad[64];
- MD5Context ctx;
- int i, pw_len;
-
- /* Need to wait for the server */
- if (!token)
- return NULL;
-
- g_return_val_if_fail (sasl->service->url->passwd != NULL, NULL);
-
- memset (ipad, 0, sizeof (ipad));
- memset (opad, 0, sizeof (opad));
-
- passwd = sasl->service->url->passwd;
- pw_len = strlen (passwd);
- if (pw_len <= 64) {
- memcpy (ipad, passwd, pw_len);
- memcpy (opad, passwd, pw_len);
- } else {
- md5_get_digest (passwd, pw_len, ipad);
- memcpy (opad, ipad, 16);
- }
-
- for (i = 0; i < 64; i++) {
- ipad[i] ^= 0x36;
- opad[i] ^= 0x5c;
- }
-
- md5_init (&ctx);
- md5_update (&ctx, ipad, 64);
- md5_update (&ctx, token->data, token->len);
- md5_final (&ctx, digest);
-
- md5_init (&ctx);
- md5_update (&ctx, opad, 64);
- md5_update (&ctx, digest, 16);
- md5_final (&ctx, digest);
-
- /* lowercase hexify that bad-boy... */
- for (s = digest, p = md5asc; p < md5asc + 32; s++, p += 2)
- sprintf (p, "%.2x", *s);
-
- ret = g_byte_array_new ();
- g_byte_array_append (ret, sasl->service->url->user, strlen (sasl->service->url->user));
- g_byte_array_append (ret, " ", 1);
- g_byte_array_append (ret, md5asc, 32);
-
- sasl->authenticated = TRUE;
-
- return ret;
-}
diff --git a/camel/camel-sasl-cram-md5.h b/camel/camel-sasl-cram-md5.h
deleted file mode 100644
index 801dc4a4bb..0000000000
--- a/camel/camel-sasl-cram-md5.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef CAMEL_SASL_CRAM_MD5_H
-#define CAMEL_SASL_CRAM_MD5_H
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-sasl.h>
-
-#define CAMEL_SASL_CRAM_MD5_TYPE (camel_sasl_cram_md5_get_type ())
-#define CAMEL_SASL_CRAM_MD5(obj) (CAMEL_CHECK_CAST((obj), CAMEL_SASL_CRAM_MD5_TYPE, CamelSaslCramMd5))
-#define CAMEL_SASL_CRAM_MD5_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SASL_CRAM_MD5_TYPE, CamelSaslCramMd5Class))
-#define CAMEL_IS_SASL_CRAM_MD5(o) (CAMEL_CHECK_TYPE((o), CAMEL_SASL_CRAM_MD5_TYPE))
-
-typedef struct _CamelSaslCramMd5 {
- CamelSasl parent_object;
-
-} CamelSaslCramMd5;
-
-
-typedef struct _CamelSaslCramMd5Class {
- CamelSaslClass parent_class;
-
-} CamelSaslCramMd5Class;
-
-
-/* Standard Camel function */
-CamelType camel_sasl_cram_md5_get_type (void);
-
-extern CamelServiceAuthType camel_sasl_cram_md5_authtype;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SASL_CRAM_MD5_H */
diff --git a/camel/camel-sasl-kerberos4.c b/camel/camel-sasl-kerberos4.c
deleted file mode 100644
index 0079a88b25..0000000000
--- a/camel/camel-sasl-kerberos4.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include <config.h>
-
-#ifdef HAVE_KRB4
-
-#include <krb.h>
-/* MIT krb4 des.h #defines _. Sigh. We don't need it. #undef it here
- * so we get the gettexty _ definition later.
- */
-#undef _
-
-#include "camel-sasl-kerberos4.h"
-#include "camel-service.h"
-#include <string.h>
-
-CamelServiceAuthType camel_sasl_kerberos4_authtype = {
- N_("Kerberos 4"),
-
- N_("This option will connect to the server using "
- "Kerberos 4 authentication."),
-
- "KERBEROS_V4",
- FALSE
-};
-
-#define KERBEROS_V4_PROTECTION_NONE 1
-#define KERBEROS_V4_PROTECTION_INTEGRITY 2
-#define KERBEROS_V4_PROTECTION_PRIVACY 4
-
-static CamelSaslClass *parent_class = NULL;
-
-/* Returns the class for a CamelSaslKerberos4 */
-#define CSK4_CLASS(so) CAMEL_SASL_KERBEROS4_CLASS (CAMEL_OBJECT_GET_CLASS (so))
-
-static GByteArray *krb4_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex);
-
-struct _CamelSaslKerberos4Private {
- int state;
-
- guint32 nonce_n;
- guint32 nonce_h;
-
- des_cblock session;
- des_key_schedule schedule;
-};
-
-static void
-camel_sasl_kerberos4_class_init (CamelSaslKerberos4Class *camel_sasl_kerberos4_class)
-{
- CamelSaslClass *camel_sasl_class = CAMEL_SASL_CLASS (camel_sasl_kerberos4_class);
-
- parent_class = CAMEL_SASL_CLASS (camel_type_get_global_classfuncs (camel_sasl_get_type ()));
-
- /* virtual method overload */
- camel_sasl_class->challenge = krb4_challenge;
-}
-
-static void
-camel_sasl_kerberos4_init (gpointer object, gpointer klass)
-{
- CamelSaslKerberos4 *sasl_krb4 = CAMEL_SASL_KERBEROS4 (object);
-
- sasl_krb4->priv = g_new0 (struct _CamelSaslKerberos4Private, 1);
-}
-
-static void
-camel_sasl_kerberos4_finalize (CamelObject *object)
-{
- CamelSaslKerberos4 *sasl = CAMEL_SASL_KERBEROS4 (object);
-
- if (sasl->priv) {
- memset (sasl->priv, 0, sizeof (sasl->priv));
- g_free (sasl->priv);
- }
-}
-
-
-CamelType
-camel_sasl_kerberos4_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_sasl_get_type (),
- "CamelSaslKerberos4",
- sizeof (CamelSaslKerberos4),
- sizeof (CamelSaslKerberos4Class),
- (CamelObjectClassInitFunc) camel_sasl_kerberos4_class_init,
- NULL,
- (CamelObjectInitFunc) camel_sasl_kerberos4_init,
- (CamelObjectFinalizeFunc) camel_sasl_kerberos4_finalize);
- }
-
- return type;
-}
-
-static GByteArray *
-krb4_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
-{
- struct _CamelSaslKerberos4Private *priv = CAMEL_SASL_KERBEROS4 (sasl)->priv;
- GByteArray *ret = NULL;
- char *inst, *realm, *username;
- struct hostent *h;
- int status, len;
- KTEXT_ST authenticator;
- CREDENTIALS credentials;
- guint32 plus1;
-
- /* Need to wait for the server */
- if (!token)
- return NULL;
-
- switch (priv->state) {
- case 0:
- if (token->len != 4)
- goto lose;
-
- memcpy (&priv->nonce_n, token->data, 4);
- priv->nonce_h = ntohl (priv->nonce_n);
-
- /* Our response is an authenticator including that number. */
- h = camel_service_gethost (sasl->service, ex);
- inst = g_strndup (h->h_name, strcspn (h->h_name, "."));
- g_strdown (inst);
- realm = g_strdup (krb_realmofhost (h->h_name));
- status = krb_mk_req (&authenticator, sasl->service_name, inst, realm, priv->nonce_h);
- if (status == KSUCCESS) {
- status = krb_get_cred (sasl->service_name, inst, realm, &credentials);
- memcpy (priv->session, credentials.session, sizeof (priv->session));
- memset (&credentials, 0, sizeof (credentials));
- }
- g_free (inst);
- g_free (realm);
-
- if (status != KSUCCESS) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Could not get Kerberos ticket:\n%s"),
- krb_err_txt[status]);
- goto lose;
- }
- des_key_sched (&priv->session, priv->schedule);
-
- ret = g_byte_array_new ();
- g_byte_array_append (ret, (const guint8 *)authenticator.dat, authenticator.length);
- break;
-
- case 1:
- if (token->len != 8)
- goto lose;
-
- /* This one is encrypted. */
- des_ecb_encrypt ((des_cblock *)token->data, (des_cblock *)token->data, priv->schedule, 0);
-
- /* Check that the returned value is the original nonce plus one. */
- memcpy (&plus1, token->data, 4);
- if (ntohl (plus1) != priv->nonce_h + 1)
- goto lose;
-
- /* "the fifth octet contain[s] a bit-mask specifying the
- * protection mechanisms supported by the server"
- */
- if (!(token->data[4] & KERBEROS_V4_PROTECTION_NONE)) {
- g_warning ("Server does not support `no protection' :-(");
- goto lose;
- }
-
- username = sasl->service->url->user;
- len = strlen (username) + 9;
- len += 8 - len % 8;
- ret = g_byte_array_new ();
- g_byte_array_set_size (ret, len);
- memset (ret->data, 0, len);
- memcpy (ret->data, &priv->nonce_n, 4);
- ret->data[4] = KERBEROS_V4_PROTECTION_NONE;
- ret->data[5] = ret->data[6] = ret->data[7] = 0;
- strcpy (ret->data + 8, username);
-
- des_pcbc_encrypt ((void *)ret->data, (void *)ret->data, len,
- priv->schedule, &priv->session, 1);
- memset (&priv->session, 0, sizeof (priv->session));
-
- sasl->authenticated = TRUE;
- break;
- }
-
- priv->state++;
- return ret;
-
- lose:
- memset (&priv->session, 0, sizeof (priv->session));
-
- if (!camel_exception_is_set (ex)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Bad authentication response from server."));
- }
- return NULL;
-}
-
-#endif /* HAVE_KRB4 */
diff --git a/camel/camel-sasl-kerberos4.h b/camel/camel-sasl-kerberos4.h
deleted file mode 100644
index 38ac9d7e4a..0000000000
--- a/camel/camel-sasl-kerberos4.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef CAMEL_SASL_KERBEROS4_H
-#define CAMEL_SASL_KERBEROS4_H
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-sasl.h>
-#include <sys/types.h>
-#include <netdb.h>
-
-#define CAMEL_SASL_KERBEROS4_TYPE (camel_sasl_kerberos4_get_type ())
-#define CAMEL_SASL_KERBEROS4(obj) (CAMEL_CHECK_CAST((obj), CAMEL_SASL_KERBEROS4_TYPE, CamelSaslKerberos4))
-#define CAMEL_SASL_KERBEROS4_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SASL_KERBEROS4_TYPE, CamelSaslKerberos4Class))
-#define CAMEL_IS_SASL_KERBEROS4(o) (CAMEL_CHECK_TYPE((o), CAMEL_SASL_KERBEROS4_TYPE))
-
-typedef struct _CamelSaslKerberos4 {
- CamelSasl parent_object;
- struct _CamelSaslKerberos4Private *priv;
-
-} CamelSaslKerberos4;
-
-
-typedef struct _CamelSaslKerberos4Class {
- CamelSaslClass parent_class;
-
-} CamelSaslKerberos4Class;
-
-
-/* Standard Camel function */
-CamelType camel_sasl_kerberos4_get_type (void);
-
-extern CamelServiceAuthType camel_sasl_kerberos4_authtype;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SASL_KERBEROS4_H */
diff --git a/camel/camel-sasl-plain.c b/camel/camel-sasl-plain.c
deleted file mode 100644
index e4e4612dc8..0000000000
--- a/camel/camel-sasl-plain.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include <config.h>
-#include "camel-sasl-plain.h"
-#include "camel-service.h"
-#include <string.h>
-
-static CamelSaslClass *parent_class = NULL;
-
-/* Returns the class for a CamelSaslPlain */
-#define CSP_CLASS(so) CAMEL_SASL_PLAIN_CLASS (CAMEL_OBJECT_GET_CLASS (so))
-
-static GByteArray *plain_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex);
-
-static void
-camel_sasl_plain_class_init (CamelSaslPlainClass *camel_sasl_plain_class)
-{
- CamelSaslClass *camel_sasl_class = CAMEL_SASL_CLASS (camel_sasl_plain_class);
-
- parent_class = CAMEL_SASL_CLASS (camel_type_get_global_classfuncs (camel_sasl_get_type ()));
-
- /* virtual method overload */
- camel_sasl_class->challenge = plain_challenge;
-}
-
-CamelType
-camel_sasl_plain_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_sasl_get_type (),
- "CamelSaslPlain",
- sizeof (CamelSaslPlain),
- sizeof (CamelSaslPlainClass),
- (CamelObjectClassInitFunc) camel_sasl_plain_class_init,
- NULL,
- NULL,
- NULL);
- }
-
- return type;
-}
-
-static GByteArray *
-plain_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
-{
- GByteArray *buf = NULL;
- CamelURL *url = sasl->service->url;
-
- if (token) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Authentication failed."));
- return NULL;
- }
-
- g_return_val_if_fail (url->passwd != NULL, NULL);
-
- /* FIXME: make sure these are "UTF8-SAFE" */
- buf = g_byte_array_new ();
- g_byte_array_append (buf, "", 1);
- g_byte_array_append (buf, url->user, strlen (url->user));
- g_byte_array_append (buf, "", 1);
- g_byte_array_append (buf, url->passwd, strlen (url->passwd));
-
- sasl->authenticated = TRUE;
-
- return buf;
-}
diff --git a/camel/camel-sasl-plain.h b/camel/camel-sasl-plain.h
deleted file mode 100644
index 94efb317f9..0000000000
--- a/camel/camel-sasl-plain.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef CAMEL_SASL_PLAIN_H
-#define CAMEL_SASL_PLAIN_H
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-sasl.h>
-
-#define CAMEL_SASL_PLAIN_TYPE (camel_sasl_plain_get_type ())
-#define CAMEL_SASL_PLAIN(obj) (CAMEL_CHECK_CAST((obj), CAMEL_SASL_PLAIN_TYPE, CamelSaslPlain))
-#define CAMEL_SASL_PLAIN_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SASL_PLAIN_TYPE, CamelSaslPlainClass))
-#define CAMEL_IS_SASL_PLAIN(o) (CAMEL_CHECK_TYPE((o), CAMEL_SASL_PLAIN_TYPE))
-
-typedef struct _CamelSaslPlain {
- CamelSasl parent_object;
-
-} CamelSaslPlain;
-
-
-typedef struct _CamelSaslPlainClass {
- CamelSaslClass parent_class;
-
-} CamelSaslPlainClass;
-
-
-/* Standard Camel function */
-CamelType camel_sasl_plain_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SASL_PLAIN_H */
diff --git a/camel/camel-sasl.c b/camel/camel-sasl.c
deleted file mode 100644
index 1e7fc9108c..0000000000
--- a/camel/camel-sasl.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include <config.h>
-#include "camel-sasl.h"
-#include "camel-mime-utils.h"
-#include "camel-service.h"
-
-#include "camel-sasl-cram-md5.h"
-#include "camel-sasl-kerberos4.h"
-#include "camel-sasl-plain.h"
-
-static CamelObjectClass *parent_class = NULL;
-
-/* Returns the class for a CamelSasl */
-#define CS_CLASS(so) CAMEL_SASL_CLASS (CAMEL_OBJECT_GET_CLASS (so))
-
-static GByteArray *sasl_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex);
-
-static void
-camel_sasl_class_init (CamelSaslClass *camel_sasl_class)
-{
- parent_class = camel_type_get_global_classfuncs (CAMEL_OBJECT_TYPE);
-
- /* virtual method definition */
- camel_sasl_class->challenge = sasl_challenge;
-}
-
-static void
-camel_sasl_finalize (CamelSasl *sasl)
-{
- g_free (sasl->service_name);
- camel_object_unref (CAMEL_OBJECT (sasl->service));
-}
-
-CamelType
-camel_sasl_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (CAMEL_OBJECT_TYPE,
- "CamelSasl",
- sizeof (CamelSasl),
- sizeof (CamelSaslClass),
- (CamelObjectClassInitFunc) camel_sasl_class_init,
- NULL,
- NULL,
- (CamelObjectFinalizeFunc) camel_sasl_finalize);
- }
-
- return type;
-}
-
-
-static GByteArray *
-sasl_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
-{
- g_warning ("sasl_challenge: Using default implementation!");
- return NULL;
-}
-
-/**
- * camel_sasl_challenge:
- * @sasl: a SASL object
- * @token: a token, or %NULL
- * @ex: exception
- *
- * If @token is %NULL, generate the initial SASL message to send to
- * the server. (This will be %NULL if the client doesn't initiate the
- * exchange.) Otherwise, @token is a challenge from the server, and
- * the return value is the response.
- *
- * Return value: The SASL response or %NULL. If an error occurred, @ex
- * will also be set.
- **/
-GByteArray *
-camel_sasl_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_SASL (sasl), NULL);
-
- return CS_CLASS (sasl)->challenge (sasl, token, ex);
-}
-
-/**
- * camel_sasl_challenge_base64:
- * @sasl: a SASL object
- * @token: a base64-encoded token
- * @ex: exception
- *
- * As with camel_sasl_challenge(), but the challenge @token and the
- * response are both base64-encoded.
- *
- * Return value: As with camel_sasl_challenge(), but base64-encoded.
- **/
-char *
-camel_sasl_challenge_base64 (CamelSasl *sasl, const char *token, CamelException *ex)
-{
- GByteArray *token_binary, *ret_binary;
- char *ret;
- int len;
-
- g_return_val_if_fail (CAMEL_IS_SASL (sasl), NULL);
-
- if (token) {
- token_binary = g_byte_array_new ();
- len = strlen (token);
- g_byte_array_append (token_binary, token, len);
- token_binary->len = base64_decode_simple (token_binary->data, len);
- } else
- token_binary = NULL;
-
- ret_binary = camel_sasl_challenge (sasl, token_binary, ex);
- if (token_binary)
- g_byte_array_free (token_binary, TRUE);
- if (!ret_binary)
- return NULL;
-
- ret = base64_encode_simple (ret_binary->data, ret_binary->len);
- g_byte_array_free (ret_binary, TRUE);
-
- return ret;
-}
-
-/**
- * camel_sasl_authenticated:
- * @sasl: a SASL object
- *
- * Return value: whether or not @sasl has successfully authenticated
- * the user. This will be %TRUE after it returns the last needed response.
- * The caller must still pass that information on to the server and verify
- * that it has accepted it.
- **/
-gboolean
-camel_sasl_authenticated (CamelSasl *sasl)
-{
- return sasl->authenticated;
-}
-
-
-/**
- * camel_sasl_new:
- * @service_name: the SASL service name
- * @mechanism: the SASL mechanism
- * @service: the CamelService that will be using this SASL
- *
- * Return value: a new CamelSasl for the given @service_name,
- * @mechanism, and @service, or %NULL if the mechanism is not
- * supported.
- **/
-CamelSasl *
-camel_sasl_new (const char *service_name, const char *mechanism, CamelService *service)
-{
- CamelSasl *sasl;
-
- g_return_val_if_fail (service_name != NULL, NULL);
- g_return_val_if_fail (mechanism != NULL, NULL);
- g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL);
-
- /* We don't do ANONYMOUS here, because it's a little bit weird. */
-
- if (!strcmp (mechanism, "CRAM-MD5"))
- sasl = (CamelSasl *)camel_object_new (CAMEL_SASL_CRAM_MD5_TYPE);
-#ifdef HAVE_KRB4
- else if (!strcmp (mechanism, "KERBEROS_V4"))
- sasl = (CamelSasl *)camel_object_new (CAMEL_SASL_KERBEROS4_TYPE);
-#endif
- else if (!strcmp (mechanism, "PLAIN"))
- sasl = (CamelSasl *)camel_object_new (CAMEL_SASL_PLAIN_TYPE);
- else
- return NULL;
-
- sasl->service_name = g_strdup (service_name);
- sasl->service = service;
- camel_object_ref (CAMEL_OBJECT (service));
-
- return sasl;
-}
-
-/**
- * camel_sasl_authtype_list:
- *
- * Return value: a GList of SASL-supported authtypes. The caller must
- * free the list, but not the contents.
- **/
-GList *
-camel_sasl_authtype_list (void)
-{
- GList *types = NULL;
-
- /* We don't do PLAIN here, because it's considered to be
- * normal password authentication, just behind SSL.
- */
-
- types = g_list_prepend (types, &camel_sasl_cram_md5_authtype);
-#ifdef HAVE_KRB4
- types = g_list_prepend (types, &camel_sasl_kerberos4_authtype);
-#endif
-
- return types;
-}
-
-/**
- * camel_sasl_authtype:
- * @mechanism: the SASL mechanism to get an authtype for
- *
- * Return value: a CamelServiceAuthType for the given mechanism, if
- * it is supported.
- **/
-CamelServiceAuthType *
-camel_sasl_authtype (const char *mechanism)
-{
- if (!strcmp (mechanism, "CRAM-MD5"))
- return &camel_sasl_cram_md5_authtype;
-#ifdef HAVE_KRB4
- else if (!strcmp (mechanism, "KERBEROS_V4"))
- return &camel_sasl_kerberos4_authtype;
-#endif
- else
- return NULL;
-}
diff --git a/camel/camel-sasl.h b/camel/camel-sasl.h
deleted file mode 100644
index 02f05eb8cf..0000000000
--- a/camel/camel-sasl.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef CAMEL_SASL_H
-#define CAMEL_SASL_H
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include <camel/camel-object.h>
-#include <camel/camel-exception.h>
-#include <camel/camel-service.h>
-
-#define CAMEL_SASL_TYPE (camel_sasl_get_type ())
-#define CAMEL_SASL(obj) (CAMEL_CHECK_CAST((obj), CAMEL_SASL_TYPE, CamelSasl))
-#define CAMEL_SASL_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SASL_TYPE, CamelSaslClass))
-#define CAMEL_IS_SASL(o) (CAMEL_CHECK_TYPE((o), CAMEL_SASL_TYPE))
-
-typedef struct _CamelSasl {
- CamelObject parent_object;
-
- char *service_name;
- CamelService *service;
- gboolean authenticated;
-} CamelSasl;
-
-
-typedef struct _CamelSaslClass {
- CamelObjectClass parent_class;
-
- GByteArray * (*challenge) (CamelSasl *sasl, GByteArray *token, CamelException *ex);
-
-} CamelSaslClass;
-
-
-/* Standard Camel function */
-CamelType camel_sasl_get_type (void);
-
-/* public methods */
-GByteArray *camel_sasl_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex);
-char *camel_sasl_challenge_base64 (CamelSasl *sasl, const char *token, CamelException *ex);
-
-gboolean camel_sasl_authenticated (CamelSasl *sasl);
-
-/* utility functions */
-CamelSasl *camel_sasl_new (const char *service_name, const char *mechanism, CamelService *service);
-
-GList *camel_sasl_authtype_list (void);
-CamelServiceAuthType *camel_sasl_authtype (const char *mechanism);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SASL_H */
diff --git a/camel/camel-search-private.c b/camel/camel-search-private.c
deleted file mode 100644
index a6a87c0728..0000000000
--- a/camel/camel-search-private.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- * Michael Zucchi <NotZed@Ximian.com>
- *
- * Copyright 2000 Helix Code, Inc. (www.helixcode.com)
- * Copyright 2001 Ximian Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-/* (from glibc headers:
- POSIX says that <sys/types.h> must be included (by the caller) before <regex.h>. */
-#include <sys/types.h>
-#include <regex.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-
-#include "camel-exception.h"
-#include "camel-mime-message.h"
-#include "camel-multipart.h"
-#include "camel-stream-mem.h"
-#include "e-util/e-sexp.h"
-#include <unicode.h>
-
-#include "camel-search-private.h"
-
-#define d(x)
-
-/* builds the regex into pattern */
-/* taken from camel-folder-search, with added isregex & exception parameter */
-/* Basically, we build a new regex, either based on subset regex's, or substrings,
- that can be executed once over the whoel body, to match anything suitable.
- This is more efficient than multiple searches, and probably most (naive) strstr
- implementations, over long content.
-
- A small issue is that case-insenstivity wont work entirely correct for utf8 strings. */
-int
-camel_search_build_match_regex (regex_t *pattern, camel_search_flags_t type, int argc,
- struct _ESExpResult **argv, CamelException *ex)
-{
- GString *match = g_string_new("");
- int c, i, count=0, err;
- char *word;
- int flags;
-
- /* build a regex pattern we can use to match the words, we OR them together */
- if (argc>1)
- g_string_append_c(match, '(');
- for (i=0;i<argc;i++) {
- if (argv[i]->type == ESEXP_RES_STRING) {
- if (count > 0)
- g_string_append_c(match, '|');
-
- word = argv[i]->value.string;
- if (type & CAMEL_SEARCH_MATCH_REGEX) {
- /* no need to escape because this should already be a valid regex */
- g_string_append(match, word);
- } else {
- /* escape any special chars (not sure if this list is complete) */
- if (type & CAMEL_SEARCH_MATCH_START)
- g_string_append_c(match, '^');
- while ((c = *word++)) {
- if (strchr("*\\.()[]^$+", c) != NULL) {
- g_string_append_c(match, '\\');
- }
- g_string_append_c(match, c);
- }
- if (type & CAMEL_SEARCH_MATCH_END)
- g_string_append_c(match, '^');
- }
- count++;
- } else {
- g_warning("Invalid type passed to body-contains match function");
- }
- }
- if (argc>1)
- g_string_append_c(match, ')');
- flags = REG_EXTENDED|REG_NOSUB;
- if (type & CAMEL_SEARCH_MATCH_ICASE)
- flags |= REG_ICASE;
- err = regcomp(pattern, match->str, flags);
- if (err != 0) {
- /* regerror gets called twice to get the full error string
- length to do proper posix error reporting */
- int len = regerror(err, pattern, 0, 0);
- char *buffer = g_malloc0(len + 1);
-
- regerror(err, pattern, buffer, len);
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Regular expression compilation failed: %s: %s"),
- match->str, buffer);
-
- regfree(pattern);
- }
- d(printf("Built regex: '%s'\n", match->str));
- g_string_free(match, TRUE);
- return err;
-}
-
-static unsigned char soundex_table[256] = {
- 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, 49, 50, 51, 0, 49, 50, 0, 0, 50, 50, 52, 53, 53, 0,
- 49, 50, 54, 50, 51, 0, 49, 0, 50, 0, 50, 0, 0, 0, 0, 0,
- 0, 0, 49, 50, 51, 0, 49, 50, 0, 0, 50, 50, 52, 53, 53, 0,
- 49, 50, 54, 50, 51, 0, 49, 0, 50, 0, 50, 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, 0, 0, 0, 0, 0,
-};
-
-static void
-soundexify (const gchar *sound, gchar code[5])
-{
- guchar *c, last = '\0';
- gint n;
-
- for (c = (guchar *) sound; *c && !isalpha (*c); c++);
- code[0] = toupper (*c);
- memset (code + 1, '0', 3);
- for (n = 1; *c && n < 5; c++) {
- guchar ch = soundex_table[*c];
-
- if (ch && ch != last) {
- code[n++] = ch;
- last = ch;
- }
- }
- code[4] = '\0';
-}
-
-static gboolean
-header_soundex(const char *header, const char *match)
-{
- char mcode[5], hcode[5];
- const char *p;
- char c;
- GString *word;
- int truth = FALSE;
-
- soundexify(match, mcode);
-
- /* split the header into words, and soundexify and compare each one */
- /* FIXME: Should this convert to utf8, and split based on that, and what not?
- soundex only makes sense for us-ascii though ... */
-
- word = g_string_new("");
- p = header;
- do {
- c = *p++;
- if (c == 0 || isspace(c)) {
- if (word->len > 0) {
- soundexify(word->str, hcode);
- if (strcmp(hcode, mcode) == 0)
- truth = TRUE;
- }
- g_string_truncate(word, 0);
- } else if (isalpha(c))
- g_string_append_c(word, c);
- } while (c && !truth);
- g_string_free(word, TRUE);
-
- return truth;
-}
-
-#if 0
-/* Why do it this way when the unicode lib already has a function to do this? */
-static unicode_char_t
-utf8_get (const char **inp)
-{
- guint32 c, v = 0, s, shift;
- const unsigned char *p = *inp;
-
- if (p == NULL)
- return 0;
-
- s = *p++;
- if ((s & 0x80) == 0) { /* 7 bit char */
- v = s;
- } else if (s>0xf7) { /* invalid char, we can only have upto 4 bits encoded */
- p = NULL;
- } else if (s>=0xc0) { /* valid start char */
- shift = 0;
- do {
- c = *p++;
- if ((c & 0xc0) == 0x80) {
- v = (v<<6) | (c&0x3f);
- shift += 5;
- } else {
- *inp = NULL;
- return 0;
- }
- s <<= 1;
- } while ((s & 0x80) != 0);
- v |= s << shift;
- } else { /* invalid start char, internal char */
- p = NULL;
- }
-
- *inp = p;
- return v;
-}
-#endif
-
-static unicode_char_t
-utf8_get (const char **inp)
-{
- const unsigned char *p = *inp;
- unicode_char_t c;
-
- g_return_val_if_fail (p != NULL, 0);
-
- p = unicode_get_utf8 (p, &c);
- *inp = p;
-
- return c;
-}
-
-static const char *
-camel_ustrstrcase (const char *haystack, const char *needle)
-{
- unicode_char_t *nuni, *puni;
- unicode_char_t u;
- const char *p;
-
- g_return_val_if_fail (haystack != NULL, NULL);
- g_return_val_if_fail (needle != NULL, NULL);
-
- if (strlen(needle) == 0)
- return haystack;
- if (strlen(haystack) == 0)
- return NULL;
-
- puni = nuni = alloca (sizeof (unicode_char_t) * strlen (needle));
-
- p = needle;
- while ((u = utf8_get (&p)))
- *puni++ = unicode_tolower (u);
-
- /* NULL means there was illegal utf-8 sequence */
- if (!p)
- return NULL;
-
- p = haystack;
- while ((u = utf8_get (&p))) {
- unicode_char_t c;
-
- c = unicode_tolower (u);
- /* We have valid stripped char */
- if (c == nuni[0]) {
- const gchar *q = p;
- gint npos = 1;
-
- while (nuni + npos < puni) {
- u = utf8_get (&q);
- if (!q || !u)
- return NULL;
-
- c = unicode_tolower (u);
- if (c != nuni[npos])
- break;
-
- npos++;
- }
-
- if (nuni + npos == puni)
- return p;
- }
- }
-
- return NULL;
-}
-
-#define CAMEL_SEARCH_COMPARE(x, y, z) G_STMT_START { \
- if ((x) == (z)) { \
- if ((y) == (z)) \
- return 0; \
- else \
- return -1; \
- } else if ((y) == (z)) \
- return 1; \
-} G_STMT_END
-
-static int
-camel_ustrcasecmp (const char *s1, const char *s2)
-{
- unicode_char_t u1, u2 = 0;
-
- CAMEL_SEARCH_COMPARE (s1, s2, NULL);
-
- u1 = utf8_get (&s1);
- u2 = utf8_get (&s2);
- while (u1 && u2) {
- u1 = unicode_tolower (u1);
- u2 = unicode_tolower (u2);
- if (u1 < u2)
- return -1;
- else if (u1 > u2)
- return 1;
-
- u1 = utf8_get (&s1);
- u2 = utf8_get (&s2);
- }
-
- /* end of one of the strings ? */
- CAMEL_SEARCH_COMPARE (u1, u2, 0);
-
- /* if we have invalid utf8 sequence ? */
- CAMEL_SEARCH_COMPARE (s1, s2, NULL);
-
- return 0;
-}
-
-static int
-camel_ustrncasecmp (const char *s1, const char *s2, size_t len)
-{
- unicode_char_t u1, u2 = 0;
-
- CAMEL_SEARCH_COMPARE (s1, s2, NULL);
-
- u1 = utf8_get (&s1);
- u2 = utf8_get (&s2);
- while (len > 0 && u1 && u2) {
- u1 = unicode_tolower (u1);
- u2 = unicode_tolower (u2);
- if (u1 < u2)
- return -1;
- else if (u1 > u2)
- return 1;
-
- len--;
- u1 = utf8_get (&s1);
- u2 = utf8_get (&s2);
- }
-
- if (len == 0)
- return 0;
-
- /* end of one of the strings ? */
- CAMEL_SEARCH_COMPARE (u1, u2, 0);
-
- /* if we have invalid utf8 sequence ? */
- CAMEL_SEARCH_COMPARE (s1, s2, NULL);
-
- return 0;
-}
-
-
-/* searhces for match inside value, if match is mixed case, hten use case-sensitive,
- else insensitive */
-gboolean
-camel_search_header_match (const char *value, const char *match, camel_search_match_t how)
-{
- const char *p;
- int vlen, mlen;
-
- while (*value && isspace (*value))
- value++;
-
- if (how == CAMEL_SEARCH_MATCH_SOUNDEX)
- return header_soundex (value, match);
-
- vlen = strlen (value);
- mlen = strlen (match);
- if (vlen < mlen)
- return FALSE;
-
- /* from dan the man, if we have mixed case, perform a case-sensitive match,
- otherwise not */
- p = match;
- while (*p) {
- if (isupper(*p)) {
- switch(how) {
- case CAMEL_SEARCH_MATCH_EXACT:
- return strcmp(value, match) == 0;
- case CAMEL_SEARCH_MATCH_CONTAINS:
- return strstr(value, match) != NULL;
- case CAMEL_SEARCH_MATCH_STARTS:
- return strncmp (value, match, mlen) == 0;
- case CAMEL_SEARCH_MATCH_ENDS:
- return strcmp (value + vlen - mlen, match) == 0;
- default:
- break;
- }
- return FALSE;
- }
- p++;
- }
- switch(how) {
- case CAMEL_SEARCH_MATCH_EXACT:
- return camel_ustrcasecmp(value, match) == 0;
- case CAMEL_SEARCH_MATCH_CONTAINS:
- return camel_ustrstrcase(value, match) != NULL;
- case CAMEL_SEARCH_MATCH_STARTS:
- return camel_ustrncasecmp (value, match, mlen) == 0;
- case CAMEL_SEARCH_MATCH_ENDS:
- return camel_ustrcasecmp (value + vlen - mlen, match) == 0;
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* performs a 'slow' content-based match */
-/* there is also an identical copy of this in camel-filter-search.c */
-gboolean
-camel_search_message_body_contains(CamelDataWrapper *object, regex_t *pattern)
-{
- CamelDataWrapper *containee;
- int truth = FALSE;
- int parts, i;
-
- containee = camel_medium_get_content_object(CAMEL_MEDIUM(object));
-
- if (containee == NULL)
- return FALSE;
-
- /* TODO: I find it odd that get_part and get_content_object do not
- add a reference, probably need fixing for multithreading */
-
- /* using the object types is more accurate than using the mime/types */
- if (CAMEL_IS_MULTIPART(containee)) {
- parts = camel_multipart_get_number(CAMEL_MULTIPART(containee));
- for (i=0;i<parts && truth==FALSE;i++) {
- CamelDataWrapper *part = (CamelDataWrapper *)camel_multipart_get_part(CAMEL_MULTIPART(containee), i);
- if (part)
- truth = camel_search_message_body_contains(part, pattern);
- }
- } else if (CAMEL_IS_MIME_MESSAGE(containee)) {
- /* for messages we only look at its contents */
- truth = camel_search_message_body_contains((CamelDataWrapper *)containee, pattern);
- } else if (header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*")) {
- /* for all other text parts, we look inside, otherwise we dont care */
- CamelStreamMem *mem = (CamelStreamMem *)camel_stream_mem_new();
-
- camel_data_wrapper_write_to_stream(containee, (CamelStream *)mem);
- camel_stream_write((CamelStream *)mem, "", 1);
- truth = regexec(pattern, mem->buffer->data, 0, NULL, 0) == 0;
- camel_object_unref((CamelObject *)mem);
- }
- return truth;
-}
-
diff --git a/camel/camel-search-private.h b/camel/camel-search-private.h
deleted file mode 100644
index aff881f32f..0000000000
--- a/camel/camel-search-private.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2001 Ximian 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_SEARCH_PRIVATE_H
-#define _CAMEL_SEARCH_PRIVATE_H
-
-typedef enum {
- CAMEL_SEARCH_MATCH_START = 1<<0,
- CAMEL_SEARCH_MATCH_END = 1<<1,
- CAMEL_SEARCH_MATCH_REGEX = 1<<2, /* disables the first 2 */
- CAMEL_SEARCH_MATCH_ICASE = 1<<3,
-} camel_search_flags_t;
-
-typedef enum {
- CAMEL_SEARCH_MATCH_EXACT,
- CAMEL_SEARCH_MATCH_CONTAINS,
- CAMEL_SEARCH_MATCH_STARTS,
- CAMEL_SEARCH_MATCH_ENDS,
- CAMEL_SEARCH_MATCH_SOUNDEX,
-} camel_search_match_t;
-
-/* builds a regex that represents a string search */
-int camel_search_build_match_regex(regex_t *pattern, camel_search_flags_t type, int argc, struct _ESExpResult **argv, CamelException *ex);
-gboolean camel_search_message_body_contains(CamelDataWrapper *object, regex_t *pattern);
-
-gboolean camel_search_header_match(const char *value, const char *match, camel_search_match_t how);
-gboolean camel_search_header_soundex(const char *header, const char *match);
-
-#endif /* ! _CAMEL_SEARCH_PRIVATE_H */
diff --git a/camel/camel-seekable-stream.c b/camel/camel-seekable-stream.c
deleted file mode 100644
index c4ca950baa..0000000000
--- a/camel/camel-seekable-stream.c
+++ /dev/null
@@ -1,201 +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 (CAMEL_OBJECT_GET_CLASS(so))
-
-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 = CAMEL_STREAM_CLASS( camel_type_get_global_classfuncs( CAMEL_STREAM_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;
-}
-
-CamelType
-camel_seekable_stream_get_type (void)
-{
- static CamelType camel_seekable_stream_type = CAMEL_INVALID_TYPE;
-
- if (camel_seekable_stream_type == CAMEL_INVALID_TYPE) {
- camel_seekable_stream_type = camel_type_register( CAMEL_STREAM_TYPE,
- "CamelSeekableStream",
- sizeof( CamelSeekableStream ),
- sizeof( CamelSeekableStreamClass ),
- (CamelObjectClassInitFunc) camel_seekable_stream_class_init,
- NULL,
- (CamelObjectInitFunc) camel_seekable_stream_init,
- NULL );
- }
-
- 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 0fc67d59f8..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) (CAMEL_CHECK_CAST((obj), CAMEL_SEEKABLE_STREAM_TYPE, CamelSeekableStream))
-#define CAMEL_SEEKABLE_STREAM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SEEKABLE_STREAM_TYPE, CamelSeekableStreamClass))
-#define CAMEL_IS_SEEKABLE_STREAM(o) (CAMEL_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 Camel function */
-CamelType 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 294526ada3..0000000000
--- a/camel/camel-seekable-substream.c
+++ /dev/null
@@ -1,300 +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 (CAMEL_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
-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);
-
- parent_class = CAMEL_SEEKABLE_STREAM_CLASS (camel_type_get_global_classfuncs (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;
-
-}
-
-static void
-camel_seekable_substream_finalize (CamelObject *object)
-{
- CamelSeekableSubstream *seekable_substream =
- CAMEL_SEEKABLE_SUBSTREAM (object);
-
- if (seekable_substream->parent_stream)
- camel_object_unref (CAMEL_OBJECT (seekable_substream->parent_stream));
-}
-
-
-CamelType
-camel_seekable_substream_get_type (void)
-{
- static CamelType camel_seekable_substream_type = CAMEL_INVALID_TYPE;
-
- if (camel_seekable_substream_type == CAMEL_INVALID_TYPE) {
- camel_seekable_substream_type = camel_type_register (camel_seekable_stream_get_type (), "CamelSeekableSubstream",
- sizeof (CamelSeekableSubstream),
- sizeof (CamelSeekableSubstreamClass),
- (CamelObjectClassInitFunc) camel_seekable_substream_class_init,
- NULL,
- NULL,
- (CamelObjectFinalizeFunc) camel_seekable_substream_finalize);
- }
-
- return camel_seekable_substream_type;
-}
-
-/**
- * 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 = CAMEL_SEEKABLE_SUBSTREAM (camel_object_new (camel_seekable_substream_get_type ()));
-
- /* Initialize it. */
- seekable_substream->parent_stream = parent_stream;
- camel_object_ref (CAMEL_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 - it's 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)
-{
- 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 written. */
- 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_write((CamelStream *)parent, buffer, n);
-
- /* ignore <0 - it's an error, let the caller deal */
- if (v > 0)
- seekable_stream->position += v;
-
- return v;
-
-}
-
-static int
-stream_flush (CamelStream *stream)
-{
- CamelSeekableSubstream *sus = (CamelSeekableSubstream *)stream;
-
- return camel_stream_flush(CAMEL_STREAM(sus->parent_stream));
-}
-
-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:
- if (seekable_stream->bound_end == CAMEL_STREAM_UNBOUND) {
- real_offset = camel_seekable_stream_seek(seekable_substream->parent_stream,
- offset,
- CAMEL_STREAM_END);
- if (real_offset != -1) {
- if (real_offset<seekable_stream->bound_start)
- real_offset = seekable_stream->bound_start;
- seekable_stream->position = real_offset;
- }
- return real_offset;
- }
- real_offset = seekable_stream->bound_end + offset;
- 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 6ac5588a42..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) (CAMEL_CHECK_CAST((obj), CAMEL_SEEKABLE_SUBSTREAM_TYPE, CamelSeekableSubstream))
-#define CAMEL_SEEKABLE_SUBSTREAM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SEEKABLE_SUBSTREAM_TYPE, CamelSeekableSubstreamClass))
-#define CAMEL_IS_SEEKABLE_SUBSTREAM(o) (CAMEL_CHECK_TYPE((o), CAMEL_SEEKABLE_SUBSTREAM_TYPE))
-
-struct _CamelSeekableSubstream
-{
- CamelSeekableStream parent_object;
-
- /* --**-- Private fields --**-- */
- CamelSeekableStream *parent_stream;
-};
-
-typedef struct {
- CamelSeekableStreamClass parent_class;
-
-} CamelSeekableSubstreamClass;
-
-/* Standard Camel function */
-CamelType 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 bdaa807572..0000000000
--- a/camel/camel-service.c
+++ /dev/null
@@ -1,522 +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-session.h"
-#include "camel-exception.h"
-
-#include <ctype.h>
-#include <stdlib.h>
-
-#include "camel-private.h"
-
-static CamelObjectClass *parent_class = NULL;
-
-/* Returns the class for a CamelService */
-#define CSERV_CLASS(so) CAMEL_SERVICE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static void construct (CamelService *service, CamelSession *session,
- CamelProvider *provider, CamelURL *url,
- CamelException *ex);
-static gboolean service_connect(CamelService *service, CamelException *ex);
-static gboolean service_disconnect(CamelService *service, gboolean clean,
- CamelException *ex);
-/*static gboolean is_connected (CamelService *service);*/
-static GList * query_auth_types (CamelService *service, gboolean connect, CamelException *ex);
-static void free_auth_types (CamelService *service, GList *authtypes);
-static char * get_name (CamelService *service, gboolean brief);
-static char * get_path (CamelService *service);
-
-
-static void
-camel_service_class_init (CamelServiceClass *camel_service_class)
-{
- parent_class = camel_type_get_global_classfuncs (CAMEL_OBJECT_TYPE);
-
- /* virtual method definition */
- camel_service_class->construct = construct;
- camel_service_class->connect = service_connect;
- camel_service_class->disconnect = service_disconnect;
- camel_service_class->query_auth_types = query_auth_types;
- camel_service_class->free_auth_types = free_auth_types;
- camel_service_class->get_name = get_name;
- camel_service_class->get_path = get_path;
-}
-
-static void
-camel_service_init (void *o, void *k)
-{
- CamelService *service = o;
-
- service->priv = g_malloc0(sizeof(*service->priv));
-#ifdef ENABLE_THREADS
- service->priv->connect_lock = e_mutex_new(E_MUTEX_REC);
-#endif
-}
-
-static void
-camel_service_finalize (CamelObject *object)
-{
- CamelService *camel_service = CAMEL_SERVICE (object);
-
- if (camel_service->connected) {
- CamelException ex;
-
- /*g_warning ("camel_service_finalize: finalizing while still connected!");*/
- camel_exception_init (&ex);
- CSERV_CLASS (camel_service)->disconnect (camel_service, FALSE, &ex);
- if (camel_exception_is_set (&ex)) {
- g_warning ("camel_service_finalize: silent disconnect failure: %s",
- camel_exception_get_description(&ex));
- }
- camel_exception_clear (&ex);
- }
-
- if (camel_service->url)
- camel_url_free (camel_service->url);
- if (camel_service->session)
- camel_object_unref (CAMEL_OBJECT (camel_service->session));
-
-#ifdef ENABLE_THREADS
- e_mutex_destroy(camel_service->priv->connect_lock);
-#endif
- g_free(camel_service->priv);
-}
-
-
-
-CamelType
-camel_service_get_type (void)
-{
- static CamelType camel_service_type = CAMEL_INVALID_TYPE;
-
- if (camel_service_type == CAMEL_INVALID_TYPE) {
- camel_service_type =
- camel_type_register (CAMEL_OBJECT_TYPE, "CamelService",
- sizeof (CamelService),
- sizeof (CamelServiceClass),
- (CamelObjectClassInitFunc) camel_service_class_init,
- NULL,
- (CamelObjectInitFunc) camel_service_init,
- camel_service_finalize );
- }
-
- return camel_service_type;
-}
-
-
-static void
-construct (CamelService *service, CamelSession *session,
- CamelProvider *provider, CamelURL *url, CamelException *ex)
-{
- char *url_string;
-
- if (((provider->url_flags & CAMEL_URL_NEED_USER)
- == CAMEL_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;
- } else if (((provider->url_flags & CAMEL_URL_NEED_HOST)
- == CAMEL_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;
- } else if (((provider->url_flags & CAMEL_URL_NEED_PATH)
- == CAMEL_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;
- }
-
- service->provider = provider;
- service->url = url;
- service->session = session;
- camel_object_ref (CAMEL_OBJECT (session));
-
- service->connected = FALSE;
-}
-
-/**
- * camel_service_construct:
- * @service: the CamelService
- * @session: the session for the service
- * @provider: the service's provider
- * @url: the default URL for the service (may be NULL)
- * @ex: a CamelException
- *
- * Constructs a CamelService initialized with the given parameters.
- **/
-void
-camel_service_construct (CamelService *service, CamelSession *session,
- CamelProvider *provider, CamelURL *url,
- CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_SERVICE (service));
- g_return_if_fail (CAMEL_IS_SESSION (session));
-
- CSERV_CLASS (service)->construct (service, session, provider, url, ex);
-}
-
-
-static gboolean
-service_connect (CamelService *service, CamelException *ex)
-{
- /* Things like the CamelMboxStore can validly
- * not define a connect function.
- */
- return TRUE;
-}
-
-/**
- * camel_service_connect:
- * @service: CamelService object
- * @ex: a CamelException
- *
- * Connect to the service using the parameters it was initialized
- * with.
- *
- * Return value: whether or not the connection succeeded
- **/
-
-gboolean
-camel_service_connect (CamelService *service, CamelException *ex)
-{
- gboolean ret = FALSE;
-
- g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE);
- g_return_val_if_fail (service->session != NULL, FALSE);
- g_return_val_if_fail (service->url != NULL, FALSE);
-
- CAMEL_SERVICE_LOCK(service, connect_lock);
-
- if (service->connected) {
- /* But we're still connected, so no exception
- * and return true.
- */
- g_warning ("camel_service_connect: trying to connect to an already connected service");
- ret = TRUE;
- } else if (CSERV_CLASS (service)->connect (service, ex)) {
- service->connected = TRUE;
- ret = TRUE;
- }
-
- CAMEL_SERVICE_UNLOCK(service, connect_lock);
-
- return ret;
-}
-
-static gboolean
-service_disconnect (CamelService *service, gboolean clean, CamelException *ex)
-{
- /*service->connect_level--;*/
-
- /* We let people get away with not having a disconnect
- * function -- CamelMboxStore, for example.
- */
-
- return TRUE;
-}
-
-/**
- * camel_service_disconnect:
- * @service: CamelService object
- * @clean: whether or not to try to disconnect cleanly.
- * @ex: a CamelException
- *
- * Disconnect from the service. If @clean is %FALSE, it should not
- * try to do any synchronizing or other cleanup of the connection.
- *
- * Return value: whether or not the disconnection succeeded without
- * errors. (Consult @ex if %FALSE.)
- **/
-gboolean
-camel_service_disconnect (CamelService *service, gboolean clean,
- CamelException *ex)
-{
- gboolean res = TRUE;
-
- CAMEL_SERVICE_LOCK(service, connect_lock);
-
- if (service->connected) {
- res = CSERV_CLASS (service)->disconnect (service, clean, ex);
- service->connected = FALSE;
- }
-
- CAMEL_SERVICE_UNLOCK(service, connect_lock);
-
- return res;
-}
-
-/**
- * camel_service_get_url:
- * @service: a 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);
-}
-
-
-static char *
-get_name (CamelService *service, gboolean brief)
-{
- g_warning ("CamelService::get_name not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (service)));
- return g_strdup ("???");
-}
-
-/**
- * camel_service_get_name:
- * @service: the service
- * @brief: whether or not to use a briefer form
- *
- * This gets the name of the service in a "friendly" (suitable for
- * humans) form. If @brief is %TRUE, this should be a brief description
- * such as for use in the folder tree. If @brief is %FALSE, it should
- * be a more complete and mostly unambiguous description.
- *
- * Return value: the description, which the caller must free.
- **/
-char *
-camel_service_get_name (CamelService *service, gboolean brief)
-{
- g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL);
- g_return_val_if_fail (service->url, NULL);
-
- return CSERV_CLASS (service)->get_name (service, brief);
-}
-
-
-static char *
-get_path (CamelService *service)
-{
- GString *gpath;
- char *path;
- CamelURL *url = service->url;
- int flags = service->provider->url_flags;
-
- /* A sort of ad-hoc default implementation that works for our
- * current set of services.
- */
-
- gpath = g_string_new (service->provider->protocol);
- if (flags & CAMEL_URL_ALLOW_USER) {
- if (flags & CAMEL_URL_ALLOW_HOST) {
- g_string_sprintfa (gpath, "/%s@%s",
- url->user ? url->user : "",
- url->host ? url->host : "");
- } else {
- g_string_sprintfa (gpath, "/%s%s",
- url->user ? url->user : "",
- ((flags & CAMEL_URL_NEED_USER) == CAMEL_URL_NEED_USER) ? "" : "@");
- }
- } else if (flags & CAMEL_URL_ALLOW_HOST) {
- g_string_sprintfa (gpath, "/%s%s",
- ((flags & CAMEL_URL_NEED_HOST) == CAMEL_URL_NEED_HOST) ? "" : "@",
- url->host ? url->host : "");
- }
- if ((flags & CAMEL_URL_NEED_PATH) == CAMEL_URL_NEED_PATH) {
- g_string_sprintfa (gpath, "%s%s",
- *url->path == '/' ? "" : "/",
- url->path);
- }
-
- path = gpath->str;
- g_string_free (gpath, FALSE);
- return path;
-}
-
-/**
- * camel_service_get_path:
- * @service: the service
- *
- * This gets a valid UNIX relative path describing the service, which
- * is guaranteed to be different from the path returned for any
- * different service. This path MUST start with the name of the
- * provider, followed by a "/", but after that, it is up to the
- * provider.
- *
- * Return value: the path, which the caller must free.
- **/
-char *
-camel_service_get_path (CamelService *service)
-{
- g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL);
- g_return_val_if_fail (service->url, NULL);
-
- return CSERV_CLASS (service)->get_path (service);
-}
-
-
-/**
- * camel_service_get_session:
- * @service: a service
- *
- * Returns the CamelSession associated with the service.
- *
- * Return value: the session
- **/
-CamelSession *
-camel_service_get_session (CamelService *service)
-{
- return service->session;
-}
-
-/**
- * camel_service_get_provider:
- * @service: a service
- *
- * Returns the CamelProvider associated with the service.
- *
- * Return value: the provider
- **/
-CamelProvider *
-camel_service_get_provider (CamelService *service)
-{
- return service->provider;
-}
-
-static GList *
-query_auth_types (CamelService *service, gboolean connect, CamelException *ex)
-{
- return NULL;
-}
-
-/**
- * camel_service_query_auth_types:
- * @service: a CamelService
- * @connect: specifies whether or not to connect
- * @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 only if
- * @connect is TRUE. 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, gboolean connect, CamelException *ex)
-{
- GList *ret;
-
- /* note that we get the connect lock here, which means the callee
- must not call the connect functions itself */
- CAMEL_SERVICE_LOCK(service, connect_lock);
- ret = CSERV_CLASS (service)->query_auth_types (service, connect, ex);
- CAMEL_SERVICE_UNLOCK(service, connect_lock);
-
- return ret;
-}
-
-static void
-free_auth_types (CamelService *service, GList *authtypes)
-{
- ;
-}
-
-/**
- * camel_service_free_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:
- * @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;
-
-#warning "This needs to use gethostbyname_r()"
-
- 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 aeb71c933d..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 <camel/camel-provider.h>
-#include <netdb.h>
-
-#define CAMEL_SERVICE_TYPE (camel_service_get_type ())
-#define CAMEL_SERVICE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_SERVICE_TYPE, CamelService))
-#define CAMEL_SERVICE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SERVICE_TYPE, CamelServiceClass))
-#define CAMEL_IS_SERVICE(o) (CAMEL_CHECK_TYPE((o), CAMEL_SERVICE_TYPE))
-
-
-struct _CamelService {
- CamelObject parent_object;
- struct _CamelServicePrivate *priv;
-
- CamelSession *session;
- CamelProvider *provider;
- gboolean connected;
- CamelURL *url;
-};
-
-
-typedef struct {
- CamelObjectClass parent_class;
-
- void (*construct) (CamelService *service,
- CamelSession *session,
- CamelProvider *provider,
- CamelURL *url,
- CamelException *ex);
-
- gboolean (*connect) (CamelService *service,
- CamelException *ex);
- gboolean (*disconnect) (CamelService *service,
- gboolean clean,
- CamelException *ex);
-
- GList * (*query_auth_types) (CamelService *service,
- gboolean connect,
- CamelException *ex);
- void (*free_auth_types) (CamelService *service,
- GList *authtypes);
-
- char * (*get_name) (CamelService *service,
- gboolean brief);
- char * (*get_path) (CamelService *service);
-
-} CamelServiceClass;
-
-
-/* query_auth_types returns a GList of these */
-typedef struct {
- char *name, *description, *authproto;
- gboolean need_password;
-} CamelServiceAuthType;
-
-
-/* public methods */
-void camel_service_construct (CamelService *service,
- CamelSession *session,
- CamelProvider *provider,
- CamelURL *url,
- CamelException *ex);
-gboolean camel_service_connect (CamelService *service,
- CamelException *ex);
-gboolean camel_service_disconnect (CamelService *service,
- gboolean clean,
- CamelException *ex);
-char * camel_service_get_url (CamelService *service);
-char * camel_service_get_name (CamelService *service,
- gboolean brief);
-char * camel_service_get_path (CamelService *service);
-CamelSession * camel_service_get_session (CamelService *service);
-CamelProvider * camel_service_get_provider (CamelService *service);
-GList * camel_service_query_auth_types (CamelService *service,
- gboolean connect,
- CamelException *ex);
-void camel_service_free_auth_types (CamelService *service,
- GList *authtypes);
-
-/* convenience functions */
-struct hostent * camel_service_gethost (CamelService *service,
- CamelException *ex);
-
-
-/* Standard Camel function */
-CamelType 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 f8e27c382b..0000000000
--- a/camel/camel-session.c
+++ /dev/null
@@ -1,539 +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>
- * Jeffrey Stedfast <fejj@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 <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.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"
-#include <gal/util/e-util.h>
-#include "camel-vee-store.h"
-
-#include "camel-private.h"
-
-#define d(x)
-
-static CamelObjectClass *parent_class;
-
-/* The vfolder provider is always avilable */
-static CamelProvider vee_provider = {
- "vfolder",
- N_("Virtual folder email provider"),
-
- N_("For reading mail as a query of another set of folders"),
-
- "vfolder",
-
- 0,
-
- 0,
-
- { 0, 0 },
-
- NULL
-};
-
-static void
-camel_session_init (CamelSession *session)
-{
- session->modules = camel_provider_init ();
- session->providers = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- session->priv = g_malloc0(sizeof(*session->priv));
-#ifdef ENABLE_THREADS
- session->priv->lock = g_mutex_new();
-#endif
-}
-
-static gboolean
-camel_session_destroy_provider (gpointer key, gpointer value, gpointer user_data)
-{
- CamelProvider *prov = (CamelProvider *)value;
-
- g_hash_table_destroy (prov->service_cache);
-
- return TRUE;
-}
-
-static void
-camel_session_finalise (CamelObject *o)
-{
- CamelSession *session = (CamelSession *)o;
-
- g_free(session->storage_path);
- g_hash_table_foreach_remove (session->providers,
- camel_session_destroy_provider, NULL);
- g_hash_table_destroy (session->providers);
-
-#ifdef ENABLE_THREADS
- g_mutex_free(session->priv->lock);
-#endif
-
- g_free(session->priv);
-}
-
-static void
-camel_session_class_init (CamelSessionClass *camel_session_class)
-{
- parent_class = camel_type_get_global_classfuncs (camel_object_get_type ());
-}
-
-CamelType
-camel_session_get_type (void)
-{
- static CamelType camel_session_type = CAMEL_INVALID_TYPE;
-
- if (camel_session_type == CAMEL_INVALID_TYPE) {
- camel_session_type = camel_type_register (camel_object_get_type (), "CamelSession",
- sizeof (CamelSession),
- sizeof (CamelSessionClass),
- (CamelObjectClassInitFunc) camel_session_class_init,
- NULL,
- (CamelObjectInitFunc) camel_session_init,
- (CamelObjectFinalizeFunc) camel_session_finalise);
- }
-
- return camel_session_type;
-}
-
-/**
- * camel_session_new:
- * @storage_path: Path to a directory Camel can use for persistent storage.
- * (This directory must already exist.)
- * @authenticator: A callback for discussing authentication information
- * @registrar: A callback for registering timeout callbacks
- * @remove: A callback for removing timeout callbacks
- *
- * This creates a new CamelSession object, which represents global state
- * for the Camel library, and contains callbacks that can be used to
- * interact with the main application.
- *
- * Return value: the new CamelSession
- **/
-CamelSession *
-camel_session_new (const char *storage_path,
- CamelAuthCallback authenticator,
- CamelTimeoutRegisterCallback registrar,
- CamelTimeoutRemoveCallback remover)
-{
- CamelSession *session = CAMEL_SESSION (camel_object_new (CAMEL_SESSION_TYPE));
-
- session->storage_path = g_strdup (storage_path);
- session->authenticator = authenticator;
- session->registrar = registrar;
- session->remover = remover;
-
- vee_provider.object_types[CAMEL_PROVIDER_STORE] = camel_vee_store_get_type();
- vee_provider.service_cache = g_hash_table_new(camel_url_hash, camel_url_equal);
- camel_session_register_provider(session, &vee_provider);
-
- 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.
- *
- * Assumes the session lock has already been obtained,
- * which is the case for automatically loaded provider modules.
- **/
-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);
-
- CAMEL_SESSION_LOCK(session, lock);
-
- if (load)
- g_hash_table_foreach (session->modules, ensure_loaded, session);
-
- list = NULL;
- g_hash_table_foreach (session->providers, add_to_list, &list);
-
- CAMEL_SESSION_UNLOCK(session, lock);
-
- return list;
-}
-
-static void
-service_cache_remove (CamelService *service, gpointer event_data, gpointer user_data)
-{
- CamelProvider *provider;
- CamelSession *session = CAMEL_SESSION (user_data);
-
- g_return_if_fail (CAMEL_IS_SESSION (session));
- g_return_if_fail (service != NULL);
- g_return_if_fail (service->url != NULL);
-
- CAMEL_SESSION_LOCK(session, lock);
-
- provider = g_hash_table_lookup (session->providers, service->url->protocol);
- g_hash_table_remove (provider->service_cache, service->url);
-
- CAMEL_SESSION_UNLOCK(session, lock);
-}
-
-/**
- * camel_session_get_service:
- * @session: the CamelSession
- * @url_string: a Camel URL describing the service to get
- * @type: the provider type (%CAMEL_PROVIDER_STORE or
- * %CAMEL_PROVIDER_TRANSPORT) to get, since some URLs may be able
- * to specify either type.
- * @ex: a CamelException
- *
- * This resolves a CamelURL into a CamelService, including loading the
- * provider library for that service if it has not already been loaded.
- *
- * Services are cached, and asking for "the same" @url_string multiple
- * times will return the same CamelService (with its reference count
- * incremented by one each time). What constitutes "the same" URL
- * depends in part on the provider.
- *
- * Return value: the requested CamelService, or %NULL
- **/
-CamelService *
-camel_session_get_service (CamelSession *session, const char *url_string,
- CamelProviderType type, CamelException *ex)
-{
- CamelURL *url;
- CamelProvider *provider;
- CamelService *service;
-
- url = camel_url_new (url_string, ex);
- if (!url)
- return NULL;
-
- /* We need to look up the provider so we can then lookup
- the service in the provider's cache */
- CAMEL_SESSION_LOCK(session, lock);
- 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);
- CAMEL_SESSION_UNLOCK(session, lock);
- 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 provider available for protocol `%s'"),
- url->protocol);
- camel_url_free (url);
- CAMEL_SESSION_UNLOCK(session, lock);
- return NULL;
- }
-
- /* Now look up the service in the provider's cache */
- service = g_hash_table_lookup (provider->service_cache, url);
- if (service != NULL) {
- camel_url_free (url);
- camel_object_ref (CAMEL_OBJECT (service));
- CAMEL_SESSION_UNLOCK(session, lock);
- return service;
- }
-
- service = (CamelService *)camel_object_new (provider->object_types[type]);
- camel_service_construct (service, session, provider, url, ex);
- if (camel_exception_is_set (ex)) {
- camel_object_unref (CAMEL_OBJECT (service));
- service = NULL;
- } else {
- g_hash_table_insert (provider->service_cache, url, service);
- camel_object_hook_event (CAMEL_OBJECT (service), "finalize", (CamelObjectEventHookFunc) service_cache_remove, session);
- }
- CAMEL_SESSION_UNLOCK(session, lock);
-
- return service;
-}
-
-/**
- * camel_session_get_service_connected:
- * @session: the CamelSession
- * @url_string: a Camel URL describing the service to get
- * @type: the provider type
- * @ex: a CamelException
- *
- * This works like camel_session_get_service(), but also ensures that
- * the returned service will have been successfully connected (via
- * camel_service_connect().)
- *
- * Return value: the requested CamelService, or %NULL
- **/
-CamelService *
-camel_session_get_service_connected (CamelSession *session,
- const char *url_string,
- CamelProviderType type,
- CamelException *ex)
-{
- CamelService *svc;
-
- svc = camel_session_get_service (session, url_string, type, ex);
- if (svc == NULL)
- return NULL;
-
- if (svc->connected == FALSE) {
- if (camel_service_connect (svc, ex) == FALSE) {
- camel_object_unref (CAMEL_OBJECT (svc));
- return NULL;
- }
- }
-
- return svc;
-}
-
-/**
- * camel_session_get_storage_path:
- * @session: session object
- * @service: a CamelService
- * @ex: a CamelException
- *
- * This returns the path to a directory which the service can use for
- * its own purposes. Data stored there will remain between Evolution
- * sessions. No code outside of that service should ever touch the
- * files in this directory. If the directory does not exist, it will
- * be created.
- *
- * Return value: the path (which the caller must free), or %NULL if
- * an error occurs.
- **/
-char *
-camel_session_get_storage_path (CamelSession *session, CamelService *service,
- CamelException *ex)
-{
- char *path, *p;
-
- p = camel_service_get_path (service);
- path = g_strdup_printf ("%s/%s", session->storage_path, p);
- g_free (p);
-
- if (access (path, F_OK) == 0)
- return path;
-
- if (e_mkdir_hier (path, S_IRWXU) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create directory %s:\n%s"),
- path, g_strerror (errno));
- g_free (path);
- return NULL;
- }
-
- return path;
-}
-
-/**
- * camel_session_query_authenticator: query the session authenticator
- * @session: session object
- * @mode: %CAMEL_AUTHENTICATOR_ASK or %CAMEL_AUTHENTICATOR_TELL
- * @data: prompt to query user with, or data to cache
- * @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 discuss authentication
- * information with the application.
- *
- * @service and @item together uniquely identify the piece of data the
- * caller is concerned with.
- *
- * If @mode is %CAMEL_AUTHENTICATOR_ASK, then @data is a question to
- * ask the user (if the application doesn't already have the answer
- * cached). 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 returned when
- * it is done with it.
- *
- * If @mode is %CAMEL_AUTHENTICATOR_TELL, then @data is information
- * that the application should cache, or %NULL if it should stop
- * caching anything about that datum (eg, because the data is a
- * password that turned out to be incorrect).
- *
- * Return value: the authentication information or %NULL.
- **/
-char *
-camel_session_query_authenticator (CamelSession *session,
- CamelAuthCallbackMode mode,
- char *prompt, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex)
-{
- return session->authenticator (mode, prompt, secret,
- service, item, ex);
-}
-
-#ifdef U_CANT_TOUCH_THIS
-/**
- * camel_session_query_cert_authenticator:
- * @session: session object
- * @prompt: prompt to query user with
- *
- * This function is used by SSL to discuss certificate authentication
- * information with the application and/or user. Allows the user to
- * override the SSL certificate authenticator, which, at this point,
- * must have failed to authenticate the server.
- *
- * UI should be a Yes/No prompt probably defaulting to No.
- *
- * Return value: TRUE if the user decides that the SSL connection
- * should continue with the untrusted server or FALSE otherwise.
- **/
-gboolean
-camel_session_query_cert_authenticator (CamelSession *session,
- char *prompt)
-{
- return session->cert_authenticator (prompt);
-}
-#endif /* U_CANT_TOUCH_THIS */
-
-
-/**
- * camel_session_register_timeout: Register a timeout to be called
- * periodically.
- *
- * @session: the CamelSession
- * @interval: the number of milliseconds interval between calls
- * @callback: the function to call
- * @user_data: extra data to be passed to the callback
- *
- * This function will use the registrar callback provided upon
- * camel_session_new to register the timeout. The callback will
- * be called every @interval milliseconds until it returns @FALSE.
- * It will be passed one argument, @user_data.
- *
- * Returns a nonzero handle that can be used with
- * camel_session_remove_timeout on success, and 0 on failure to
- * register the timeout.
- **/
-guint
-camel_session_register_timeout (CamelSession *session,
- guint32 interval,
- CamelTimeoutCallback callback,
- gpointer user_data)
-{
- g_return_val_if_fail (CAMEL_IS_SESSION (session), FALSE);
-
- return session->registrar (interval, callback, user_data);
-}
-
-/**
- * camel_session_remove_timeout: Remove a previously registered
- * timeout.
- *
- * @session: the CamelSession
- * @handle: a value returned from camel_session_register_timeout
- *
- * This function will use the remover callback provided upon
- * camel_session_new to remove the timeout.
- *
- * Returns TRUE on success and FALSE on failure.
- **/
-gboolean
-camel_session_remove_timeout (CamelSession *session, guint handle)
-{
- return session->remover (handle);
-}
diff --git a/camel/camel-session.h b/camel/camel-session.h
deleted file mode 100644
index c530c6ffe6..0000000000
--- a/camel/camel-session.h
+++ /dev/null
@@ -1,147 +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) (CAMEL_CHECK_CAST((obj), CAMEL_SESSION_TYPE, CamelSession))
-#define CAMEL_SESSION_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SESSION_TYPE, CamelSessionClass))
-#define CAMEL_IS_SESSION(o) (CAMEL_CHECK_TYPE((o), CAMEL_SESSION_TYPE))
-
-
-typedef enum {
- CAMEL_AUTHENTICATOR_ASK, CAMEL_AUTHENTICATOR_TELL
-} CamelAuthCallbackMode;
-
-typedef char *(*CamelAuthCallback) (CamelAuthCallbackMode mode,
- char *data, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex);
-
-#ifdef U_CANT_TOUCH_THIS
-/* this is just a guess as to what we'll actually need */
-typedef gboolean (*CamelBadCertCallback) (char *data);
-#endif
-
-typedef gboolean (*CamelTimeoutCallback) (gpointer data);
-typedef guint (*CamelTimeoutRegisterCallback) (guint32 interval,
- CamelTimeoutCallback cb,
- gpointer camel_data);
-typedef gboolean (*CamelTimeoutRemoveCallback) (guint id);
-
-struct _CamelSession
-{
- CamelObject parent_object;
- struct _CamelSessionPrivate *priv;
-
- char *storage_path;
- CamelAuthCallback authenticator;
-#ifdef U_CANT_TOUCH_THIS
- CamelBadCertCallback cert_authenticator;
-#endif
- CamelTimeoutRegisterCallback registrar;
- CamelTimeoutRemoveCallback remover;
-
- GHashTable *providers, *modules;
-};
-
-typedef struct {
- CamelObjectClass parent_class;
-
-} CamelSessionClass;
-
-
-/* public methods */
-
-/* Standard Camel function */
-CamelType camel_session_get_type (void);
-
-
-CamelSession * camel_session_new (const char *storage_path,
- CamelAuthCallback authenticator,
- CamelTimeoutRegisterCallback registrar,
- CamelTimeoutRemoveCallback remover);
-
-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);
-CamelService * camel_session_get_service_connected (CamelSession *session,
- const char *url_string,
- CamelProviderType type,
- CamelException *ex);
-
-#define camel_session_get_store(session, url_string, ex) \
- ((CamelStore *) camel_session_get_service_connected (session, url_string, CAMEL_PROVIDER_STORE, ex))
-#define camel_session_get_transport(session, url_string, ex) \
- ((CamelTransport *) camel_session_get_service_connected (session, url_string, CAMEL_PROVIDER_TRANSPORT, ex))
-
-char * camel_session_get_storage_path (CamelSession *session,
- CamelService *service,
- CamelException *ex);
-
-char * camel_session_query_authenticator (CamelSession *session,
- CamelAuthCallbackMode mode,
- char *prompt,
- gboolean secret,
- CamelService *service,
- char *item,
- CamelException *ex);
-
-#ifdef U_CANT_TOUCH_THIS
-gboolean camel_session_query_cert_authenticator (CamelSession *session,
- char *prompt);
-#endif
-
-guint camel_session_register_timeout (CamelSession *session,
- guint32 interval,
- CamelTimeoutCallback callback,
- gpointer user_data);
-
-gboolean camel_session_remove_timeout (CamelSession *session,
- guint handle);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SESSION_H */
diff --git a/camel/camel-store.c b/camel/camel-store.c
deleted file mode 100644
index 19d4a53d5e..0000000000
--- a/camel/camel-store.c
+++ /dev/null
@@ -1,770 +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 <string.h>
-
-#include "camel-session.h"
-
-#include "camel-store.h"
-#include "camel-folder.h"
-#include "camel-vee-store.h"
-#include "camel-vee-folder.h"
-#include "camel-exception.h"
-
-#include "camel-private.h"
-
-static CamelServiceClass *parent_class = NULL;
-
-/* Returns the class for a CamelStore */
-#define CS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static void construct (CamelService *service, CamelSession *session,
- CamelProvider *provider, CamelURL *url,
- CamelException *ex);
-
-static CamelFolder *get_folder (CamelStore *store, const char *folder_name,
- guint32 flags, CamelException *ex);
-static CamelFolder *get_inbox (CamelStore *store, CamelException *ex);
-
-static void init_trash (CamelStore *store);
-static CamelFolder *get_trash (CamelStore *store, CamelException *ex);
-
-static CamelFolderInfo *create_folder (CamelStore *store,
- const char *parent_name,
- const char *folder_name,
- CamelException *ex);
-static void delete_folder (CamelStore *store, const char *folder_name,
- CamelException *ex);
-static void rename_folder (CamelStore *store, const char *old_name,
- const char *new_name, CamelException *ex);
-
-static void store_sync (CamelStore *store, CamelException *ex);
-static CamelFolderInfo *get_folder_info (CamelStore *store, const char *top,
- gboolean fast, gboolean recursive,
- gboolean subscribed_only,
- CamelException *ex);
-static void free_folder_info (CamelStore *store, CamelFolderInfo *tree);
-
-static gboolean folder_subscribed (CamelStore *store, const char *folder_name);
-static void subscribe_folder (CamelStore *store, const char *folder_name, CamelException *ex);
-static void unsubscribe_folder (CamelStore *store, const char *folder_name, CamelException *ex);
-
-static void
-camel_store_class_init (CamelStoreClass *camel_store_class)
-{
- CamelObjectClass *camel_object_class =
- CAMEL_OBJECT_CLASS (camel_store_class);
- CamelServiceClass *camel_service_class =
- CAMEL_SERVICE_CLASS (camel_store_class);
-
- parent_class = CAMEL_SERVICE_CLASS (camel_type_get_global_classfuncs (camel_service_get_type ()));
-
- /* virtual method definition */
- camel_service_class->construct = construct;
-
- camel_store_class->hash_folder_name = g_str_hash;
- camel_store_class->compare_folder_name = g_str_equal;
- camel_store_class->get_folder = get_folder;
- camel_store_class->get_inbox = get_inbox;
- camel_store_class->init_trash = init_trash;
- camel_store_class->get_trash = get_trash;
- camel_store_class->create_folder = create_folder;
- camel_store_class->delete_folder = delete_folder;
- camel_store_class->rename_folder = rename_folder;
- camel_store_class->sync = store_sync;
- camel_store_class->get_folder_info = get_folder_info;
- camel_store_class->free_folder_info = free_folder_info;
- camel_store_class->folder_subscribed = folder_subscribed;
- camel_store_class->subscribe_folder = subscribe_folder;
- camel_store_class->unsubscribe_folder = unsubscribe_folder;
-
- /* virtual method overload */
- camel_object_class_declare_event (camel_object_class,
- "folder_created", NULL);
- camel_object_class_declare_event (camel_object_class,
- "folder_deleted", NULL);
-}
-
-static void
-camel_store_init (void *o)
-{
- CamelStore *store = o;
- CamelStoreClass *store_class = (CamelStoreClass *)CAMEL_OBJECT_GET_CLASS (o);
-
- if (store_class->hash_folder_name) {
- store->folders = g_hash_table_new (store_class->hash_folder_name,
- store_class->compare_folder_name);
- } else
- store->folders = NULL;
-
- store->flags = 0;
-
- store->priv = g_malloc0 (sizeof (*store->priv));
-#ifdef ENABLE_THREADS
- store->priv->folder_lock = g_mutex_new();
- store->priv->cache_lock = g_mutex_new();
-#endif
-}
-
-static void
-construct (CamelService *service, CamelSession *session, CamelProvider *provider,
- CamelURL *url, CamelException *ex)
-{
- CamelStoreClass *store_class;
-
- parent_class->construct (service, session, provider, url, ex);
-
- /* initialize the vTrash folder */
- store_class = (CamelStoreClass *) CAMEL_OBJECT_GET_CLASS (service);
- store_class->init_trash (CAMEL_STORE (service));
-}
-
-static void
-camel_store_finalize (CamelObject *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);
- }
-
- if (store->vtrash)
- camel_object_unref (CAMEL_OBJECT (store->vtrash));
-
-#ifdef ENABLE_THREADS
- g_mutex_free (store->priv->folder_lock);
- g_mutex_free (store->priv->cache_lock);
-#endif
- g_free (store->priv);
-}
-
-
-CamelType
-camel_store_get_type (void)
-{
- static CamelType camel_store_type = CAMEL_INVALID_TYPE;
-
- if (camel_store_type == CAMEL_INVALID_TYPE) {
- camel_store_type = camel_type_register (CAMEL_SERVICE_TYPE, "CamelStore",
- sizeof (CamelStore),
- sizeof (CamelStoreClass),
- (CamelObjectClassInitFunc) camel_store_class_init,
- NULL,
- (CamelObjectInitFunc) camel_store_init,
- (CamelObjectFinalizeFunc) camel_store_finalize );
- }
-
- return camel_store_type;
-}
-
-
-static gboolean
-folder_matches (gpointer key, gpointer value, gpointer user_data)
-{
- if (value == user_data) {
- g_free (key);
- return TRUE;
- } else
- return FALSE;
-}
-
-static void
-folder_finalize (CamelObject *folder, gpointer event_data, gpointer user_data)
-{
- CamelStore *store = CAMEL_STORE (user_data);
-
- if (store->folders) {
- CAMEL_STORE_LOCK(store, cache_lock);
- g_hash_table_foreach_remove (store->folders, folder_matches, folder);
- CAMEL_STORE_UNLOCK(store, cache_lock);
- }
-}
-
-static CamelFolder *
-get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex)
-{
- g_warning ("CamelStore::get_folder not implemented for `%s'",
- camel_type_to_name(CAMEL_OBJECT_GET_TYPE(store)));
- return NULL;
-}
-
-/**
- * camel_store_get_folder: Return the folder corresponding to a path.
- * @store: a CamelStore
- * @folder_name: name of the folder to get
- * @flags: folder flags (create, save body index, etc)
- * @ex: a CamelException
- *
- * Return value: the folder corresponding to the path @folder_name.
- **/
-CamelFolder *
-camel_store_get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex)
-{
- CamelFolder *folder = NULL;
-
- CAMEL_STORE_LOCK(store, folder_lock);
-
- if (store->folders) {
- /* Try cache first. */
- CAMEL_STORE_LOCK(store, cache_lock);
- folder = g_hash_table_lookup (store->folders, folder_name);
- if (folder)
- camel_object_ref (CAMEL_OBJECT (folder));
- CAMEL_STORE_UNLOCK(store, cache_lock);
- }
-
- if (!folder) {
- folder = CS_CLASS (store)->get_folder (store, folder_name, flags, ex);
- if (folder && store->folders) {
- CAMEL_STORE_LOCK(store, cache_lock);
-
- g_hash_table_insert (store->folders, g_strdup (folder_name), folder);
-
- /* Add the folder to the vTrash folder if this store implements it */
- if (store->vtrash)
- camel_vee_folder_add_folder (CAMEL_VEE_FOLDER (store->vtrash), folder);
-
- camel_object_hook_event (CAMEL_OBJECT (folder), "finalize", folder_finalize, store);
- CAMEL_STORE_UNLOCK(store, cache_lock);
- }
- }
-
- CAMEL_STORE_UNLOCK(store, folder_lock);
- return folder;
-}
-
-
-static CamelFolderInfo *
-create_folder (CamelStore *store, const char *parent_name,
- const char *folder_name, CamelException *ex)
-{
- g_warning ("CamelStore::create_folder not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (store)));
- return NULL;
-}
-
-/**
- * camel_store_create_folder:
- * @store: a CamelStore
- * @parent_name: name of the new folder's parent, or %NULL
- * @folder_name: name of the folder to create
- * @ex: a CamelException
- *
- * Creates a new folder as a child of an existing folder.
- * @parent_name can be %NULL to create a new top-level folder.
- *
- * Return value: info about the created folder, which the caller must
- * free with camel_store_free_folder_info().
- **/
-CamelFolderInfo *
-camel_store_create_folder (CamelStore *store, const char *parent_name,
- const char *folder_name, CamelException *ex)
-{
- CamelFolderInfo *fi;
-
- CAMEL_STORE_LOCK(store, folder_lock);
- fi = CS_CLASS (store)->create_folder (store, parent_name, folder_name, ex);
- CAMEL_STORE_UNLOCK(store, folder_lock);
-
- return fi;
-}
-
-
-static void
-delete_folder (CamelStore *store, const char *folder_name, CamelException *ex)
-{
- g_warning ("CamelStore::delete_folder not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (store)));
-}
-
-/**
- * camel_store_delete_folder: Delete the folder corresponding to a path.
- * @store: a CamelStore
- * @folder_name: name of the folder to delete
- * @ex: a CamelException
- *
- * Deletes the named folder. The folder must be empty.
- **/
-void
-camel_store_delete_folder (CamelStore *store, const char *folder_name, CamelException *ex)
-{
- CAMEL_STORE_LOCK(store, folder_lock);
- CS_CLASS (store)->delete_folder (store, folder_name, ex);
- CAMEL_STORE_UNLOCK(store, folder_lock);
-}
-
-
-static void
-rename_folder (CamelStore *store, const char *old_name,
- const char *new_name, CamelException *ex)
-{
- g_warning ("CamelStore::rename_folder not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (store)));
-}
-
-/**
- * camel_store_rename_folder:
- * @store: a CamelStore
- * @old_name: the current name of the folder
- * @new_name: the new name of the folder
- * @ex: a CamelException
- *
- * Rename a named folder to a new name.
- **/
-void
-camel_store_rename_folder (CamelStore *store, const char *old_name, const char *new_name, CamelException *ex)
-{
- CAMEL_STORE_LOCK(store, folder_lock);
- CS_CLASS (store)->rename_folder (store, old_name, new_name, ex);
- CAMEL_STORE_UNLOCK(store, folder_lock);
-}
-
-
-static CamelFolder *
-get_inbox (CamelStore *store, CamelException *ex)
-{
- /* Default: assume the inbox's name is "inbox"
- * and open with default flags.
- */
- return CS_CLASS (store)->get_folder (store, "inbox", 0, ex);
-}
-
-/**
- * camel_store_get_inbox:
- * @store: a CamelStore
- * @ex: a CamelException
- *
- * Return value: the folder in the store into which new mail is
- * delivered, or %NULL if no such folder exists.
- **/
-CamelFolder *
-camel_store_get_inbox (CamelStore *store, CamelException *ex)
-{
- CamelFolder *folder;
-
- CAMEL_STORE_LOCK(store, folder_lock);
- folder = CS_CLASS (store)->get_inbox (store, ex);
- CAMEL_STORE_UNLOCK(store, folder_lock);
-
- return folder;
-}
-
-
-static void
-init_trash (CamelStore *store)
-{
- char *name;
-
- name = g_strdup_printf ("%s?(match-all (system-flag \"Deleted\"))", "vTrash");
-
- store->vtrash = camel_vee_folder_new (store, name, CAMEL_STORE_FOLDER_CREATE |
- CAMEL_STORE_VEE_FOLDER_AUTO, NULL);
-
- g_free (name);
-}
-
-
-static CamelFolder *
-get_trash (CamelStore *store, CamelException *ex)
-{
- if (store->vtrash) {
- camel_object_ref (CAMEL_OBJECT (store->vtrash));
- return store->vtrash;
- } else {
- g_warning ("This store does not support vTrash.");
- return NULL;
- }
-}
-
-/**
- * camel_store_get_trash:
- * @store: a CamelStore
- * @ex: a CamelException
- *
- * Return value: the folder in the store into which trash is
- * delivered, or %NULL if no such folder exists.
- **/
-CamelFolder *
-camel_store_get_trash (CamelStore *store, CamelException *ex)
-{
- CamelFolder *folder;
-
- CAMEL_STORE_LOCK(store, folder_lock);
- folder = CS_CLASS (store)->get_trash (store, ex);
- CAMEL_STORE_UNLOCK(store, folder_lock);
-
- return folder;
-}
-
-
-static void
-sync_folder (gpointer key, gpointer folder, gpointer ex)
-{
- if (!camel_exception_is_set (ex))
- camel_folder_sync (folder, FALSE, ex);
-}
-
-static void
-store_sync (CamelStore *store, CamelException *ex)
-{
- if (store->folders) {
- CAMEL_STORE_LOCK(store, cache_lock);
- g_hash_table_foreach (store->folders, sync_folder, ex);
- CAMEL_STORE_UNLOCK(store, cache_lock);
- }
-}
-
-/**
- * camel_store_sync:
- * @store: a CamelStore
- * @ex: a CamelException
- *
- * Syncs any changes that have been made to the store object and its
- * folders with the real store.
- **/
-void
-camel_store_sync (CamelStore *store, CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_STORE (store));
-
- CS_CLASS (store)->sync (store, ex);
-}
-
-
-static CamelFolderInfo *
-get_folder_info (CamelStore *store, const char *top,
- gboolean fast, gboolean recursive,
- gboolean subscribed_only,
- CamelException *ex)
-{
- g_warning ("CamelStore::get_folder_info not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (store)));
- return NULL;
-}
-
-/**
- * camel_store_get_folder_info:
- * @store: a CamelStore
- * @top: the name of the folder to start from
- * @fast: whether or not to do a "fast" scan.
- * @recursive: whether to include information for subfolders
- * @ex: a CamelException
- *
- * This fetches information about the folder structure of @store,
- * starting with @top, and returns a tree of CamelFolderInfo
- * structures. If @fast is %TRUE, the message_count or
- * unread_message_count fields of some or all of the structures may be
- * set to -1, if the store cannot determine that information quickly.
- * If @recursive is %TRUE, the returned tree will include all levels of
- * hierarchy below @top. If it is %FALSE, it will only include the
- * immediate subfolders of @top.
- *
- * Return value: a CamelFolderInfo tree, which must be freed with
- * camel_store_free_folder_info.
- **/
-CamelFolderInfo *
-camel_store_get_folder_info (CamelStore *store, const char *top,
- gboolean fast, gboolean recursive,
- gboolean subscribed_only,
- CamelException *ex)
-{
- CamelFolderInfo *ret;
-
- g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
-
- CAMEL_STORE_LOCK(store, folder_lock);
-
- ret = CS_CLASS (store)->get_folder_info (store, top, fast, recursive, subscribed_only, ex);
-
- CAMEL_STORE_UNLOCK(store, folder_lock);
-
- return ret;
-}
-
-
-static void
-free_folder_info (CamelStore *store, CamelFolderInfo *fi)
-{
- g_warning ("CamelStore::free_folder_info not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (store)));
-}
-
-/**
- * camel_store_free_folder_info:
- * @store: a CamelStore
- * @tree: the tree returned by camel_store_get_folder_info()
- *
- * Frees the data returned by camel_store_get_folder_info().
- **/
-void
-camel_store_free_folder_info (CamelStore *store, CamelFolderInfo *fi)
-{
- g_return_if_fail (CAMEL_IS_STORE (store));
-
- CS_CLASS (store)->free_folder_info (store, fi);
-}
-
-/**
- * camel_store_free_folder_info_full:
- * @store: a CamelStore
- * @tree: the tree returned by camel_store_get_folder_info()
- *
- * An implementation for CamelStore::free_folder_info. Frees all
- * of the data.
- **/
-void
-camel_store_free_folder_info_full (CamelStore *store, CamelFolderInfo *fi)
-{
- camel_folder_info_free (fi);
-}
-
-/**
- * camel_store_free_folder_info_nop:
- * @store: a CamelStore
- * @tree: the tree returned by camel_store_get_folder_info()
- *
- * An implementation for CamelStore::free_folder_info. Does nothing.
- **/
-void
-camel_store_free_folder_info_nop (CamelStore *store, CamelFolderInfo *fi)
-{
- ;
-}
-
-
-/**
- * camel_folder_info_free:
- * @fi: the CamelFolderInfo
- *
- * Frees @fi.
- **/
-void
-camel_folder_info_free (CamelFolderInfo *fi)
-{
- if (fi) {
- camel_folder_info_free (fi->sibling);
- camel_folder_info_free (fi->child);
- g_free (fi->name);
- g_free (fi->full_name);
- g_free (fi->url);
- g_free (fi);
- }
-}
-
-
-/**
- * camel_folder_info_build:
- * @folders: an array of CamelFolderInfo
- * @namespace: an ignorable prefix on the folder names
- * @separator: the hieararchy separator character
- * @short_names: %TRUE if the (short) name of a folder is the part after
- * the last @separator in the full name. %FALSE if it is the full name.
- *
- * This takes an array of folders and attaches them together according
- * to the hierarchy described by their full_names and @separator. If
- * @namespace is non-%NULL, then it will be ignored as a full_name
- * prefix, for purposes of comparison. If necessary,
- * camel_folder_info_build will create additional CamelFolderInfo with
- * %NULL urls to fill in gaps in the tree. The value of @short_names
- * is used in constructing the names of these intermediate folders.
- *
- * Return value: the top level of the tree of linked folder info.
- **/
-CamelFolderInfo *
-camel_folder_info_build (GPtrArray *folders, const char *namespace,
- char separator, gboolean short_names)
-{
- CamelFolderInfo *fi, *pfi, *top = NULL;
- GHashTable *hash;
- char *name, *p, *pname;
- int i, nlen;
-
- if (!namespace)
- namespace = "";
- nlen = strlen (namespace);
-
- /* Hash the folders. */
- hash = g_hash_table_new (g_str_hash, g_str_equal);
- for (i = 0; i < folders->len; i++) {
- fi = folders->pdata[i];
- if (!strncmp (namespace, fi->full_name, nlen))
- name = fi->full_name + nlen;
- else
- name = fi->full_name;
- if (*name == separator)
- name++;
- g_hash_table_insert (hash, name, fi);
- }
-
- /* Now find parents. */
- for (i = 0; i < folders->len; i++) {
- fi = folders->pdata[i];
- if (!strncmp (namespace, fi->full_name, nlen))
- name = fi->full_name + nlen;
- else
- name = fi->full_name;
- if (*name == separator)
- name++;
- p = strrchr (name, separator);
- if (p) {
- pname = g_strndup (name, p - name);
- pfi = g_hash_table_lookup (hash, pname);
- if (pfi) {
- g_free (pname);
- } else {
- pfi = g_new0 (CamelFolderInfo, 1);
- pfi->full_name = pname;
- if (short_names) {
- pfi->name = strrchr (pname, separator);
- if (pfi->name)
- pfi->name = g_strdup (pfi->name + 1);
- else
- pfi->name = g_strdup (pname);
- } else
- pfi->name = g_strdup (pname);
- g_hash_table_insert (hash, pname, pfi);
- g_ptr_array_add (folders, pfi);
- }
- fi->sibling = pfi->child;
- fi->parent = pfi;
- pfi->child = fi;
- } else if (!top)
- top = fi;
- }
- g_hash_table_destroy (hash);
-
- /* Link together the top-level folders */
- for (i = 0; i < folders->len; i++) {
- fi = folders->pdata[i];
- if (fi->parent || fi == top)
- continue;
- if (top)
- fi->sibling = top;
- top = fi;
- }
-
- return top;
-}
-
-gboolean
-camel_store_supports_subscriptions (CamelStore *store)
-{
- return (store->flags & CAMEL_STORE_SUBSCRIPTIONS);
-}
-
-
-static gboolean
-folder_subscribed (CamelStore *store, const char *folder_name)
-{
- g_warning ("CamelStore::folder_subscribed not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (store)));
- return FALSE;
-}
-
-/**
- * camel_store_folder_subscribed: Tell whether or not a folder has been subscribed to.
- * @store: a CamelStore
- * @folder_name: the folder on which we're querying subscribed status.
- * Return value: TRUE if folder is subscribed, FALSE if not.
- **/
-gboolean
-camel_store_folder_subscribed (CamelStore *store,
- const char *folder_name)
-{
- gboolean ret;
-
- g_return_val_if_fail (CAMEL_IS_STORE (store), FALSE);
- g_return_val_if_fail (store->flags & CAMEL_STORE_SUBSCRIPTIONS, FALSE);
-
- CAMEL_STORE_LOCK(store, folder_lock);
-
- ret = CS_CLASS (store)->folder_subscribed (store, folder_name);
-
- CAMEL_STORE_UNLOCK(store, folder_lock);
-
- return ret;
-}
-
-static void
-subscribe_folder (CamelStore *store, const char *folder_name, CamelException *ex)
-{
- g_warning ("CamelStore::subscribe_folder not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (store)));
-}
-
-/**
- * camel_store_subscribe_folder: marks a folder as subscribed.
- * @store: a CamelStore
- * @folder_name: the folder to subscribe to.
- **/
-void
-camel_store_subscribe_folder (CamelStore *store,
- const char *folder_name,
- CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_STORE (store));
- g_return_if_fail (store->flags & CAMEL_STORE_SUBSCRIPTIONS);
-
- CAMEL_STORE_LOCK(store, folder_lock);
-
- CS_CLASS (store)->subscribe_folder (store, folder_name, ex);
-
- CAMEL_STORE_UNLOCK(store, folder_lock);
-}
-
-static void
-unsubscribe_folder (CamelStore *store, const char *folder_name, CamelException *ex)
-{
- g_warning ("CamelStore::unsubscribe_folder not implemented for `%s'",
- camel_type_to_name (CAMEL_OBJECT_GET_TYPE (store)));
-}
-
-
-/**
- * camel_store_unsubscribe_folder: marks a folder as unsubscribed.
- * @store: a CamelStore
- * @folder_name: the folder to unsubscribe from.
- **/
-void
-camel_store_unsubscribe_folder (CamelStore *store,
- const char *folder_name,
- CamelException *ex)
-{
- g_return_if_fail (CAMEL_IS_STORE (store));
- g_return_if_fail (store->flags & CAMEL_STORE_SUBSCRIPTIONS);
-
- CAMEL_STORE_LOCK(store, folder_lock);
-
- CS_CLASS (store)->unsubscribe_folder (store, folder_name, ex);
-
- CAMEL_STORE_UNLOCK(store, folder_lock);
-}
diff --git a/camel/camel-store.h b/camel/camel-store.h
deleted file mode 100644
index 6ea20b4d2c..0000000000
--- a/camel/camel-store.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-store.h : Abstract class for an email store */
-
-/*
- *
- * 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
- */
-
-
-#ifndef CAMEL_STORE_H
-#define CAMEL_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-object.h>
-#include <camel/camel-service.h>
-
-
-typedef struct _CamelFolderInfo {
- struct _CamelFolderInfo *parent, *sibling, *child;
- char *url, *full_name, *name;
- int unread_message_count;
-} CamelFolderInfo;
-
-
-#define CAMEL_STORE_TYPE (camel_store_get_type ())
-#define CAMEL_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_STORE_TYPE, CamelStore))
-#define CAMEL_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_STORE_TYPE, CamelStoreClass))
-#define CAMEL_IS_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_STORE_TYPE))
-
-
-/* Flags for store flags */
-#define CAMEL_STORE_SUBSCRIPTIONS (1 << 0)
-
-struct _CamelStore
-{
- CamelService parent_object;
- struct _CamelStorePrivate *priv;
-
- CamelFolder *vtrash;
-
- /* should have cache_lock when accessing this (priv->cache_lock) */
- GHashTable *folders;
-
- int flags;
-};
-
-
-/* open mode for folder */
-#define CAMEL_STORE_FOLDER_CREATE (1<<0)
-#define CAMEL_STORE_FOLDER_BODY_INDEX (1<<1)
-
-typedef struct {
- CamelServiceClass parent_class;
-
- GHashFunc hash_folder_name;
- GCompareFunc compare_folder_name;
-
- CamelFolder * (*get_folder) (CamelStore *store,
- const char *folder_name,
- guint32 flags,
- CamelException *ex);
- CamelFolder * (*get_inbox) (CamelStore *store,
- CamelException *ex);
-
- void (*init_trash) (CamelStore *store);
- CamelFolder * (*get_trash) (CamelStore *store,
- CamelException *ex);
-
- CamelFolderInfo *(*create_folder) (CamelStore *store,
- const char *parent_name,
- const char *folder_name,
- CamelException *ex);
- void (*delete_folder) (CamelStore *store,
- const char *folder_name,
- CamelException *ex);
- void (*rename_folder) (CamelStore *store,
- const char *old_name,
- const char *new_name,
- CamelException *ex);
-
- void (*sync) (CamelStore *store,
- CamelException *ex);
-
- /* this should take flags instead, so its more futureproof */
- CamelFolderInfo *(*get_folder_info) (CamelStore *store,
- const char *top,
- gboolean fast,
- gboolean recursive,
- gboolean subscribed_only,
- CamelException *ex);
- void (*free_folder_info) (CamelStore *store,
- CamelFolderInfo *fi);
-
- gboolean (*folder_subscribed) (CamelStore *store,
- const char *folder_name);
- void (*subscribe_folder) (CamelStore *store,
- const char *folder_name,
- CamelException *ex);
- void (*unsubscribe_folder) (CamelStore *store,
- const char *folder_name,
- CamelException *ex);
-} CamelStoreClass;
-
-
-/* Standard Camel function */
-CamelType camel_store_get_type (void);
-
-/* public methods */
-CamelFolder * camel_store_get_folder (CamelStore *store,
- const char *folder_name,
- guint32 flags,
- CamelException *ex);
-CamelFolder * camel_store_get_inbox (CamelStore *store,
- CamelException *ex);
-CamelFolder * camel_store_get_trash (CamelStore *store,
- CamelException *ex);
-
-CamelFolderInfo *camel_store_create_folder (CamelStore *store,
- const char *parent_name,
- const char *folder_name,
- CamelException *ex);
-void camel_store_delete_folder (CamelStore *store,
- const char *folder_name,
- CamelException *ex);
-void camel_store_rename_folder (CamelStore *store,
- const char *old_name,
- const char *new_name,
- CamelException *ex);
-
-void camel_store_sync (CamelStore *store,
- CamelException *ex);
-
-CamelFolderInfo *camel_store_get_folder_info (CamelStore *store,
- const char *top,
- gboolean fast,
- gboolean recursive,
- gboolean subscribed_only,
- CamelException *ex);
-void camel_store_free_folder_info (CamelStore *store,
- CamelFolderInfo *fi);
-
-void camel_store_free_folder_info_full (CamelStore *store,
- CamelFolderInfo *fi);
-void camel_store_free_folder_info_nop (CamelStore *store,
- CamelFolderInfo *fi);
-
-void camel_folder_info_free (CamelFolderInfo *fi);
-CamelFolderInfo *camel_folder_info_build (GPtrArray *folders,
- const char *namespace,
- char separator,
- gboolean short_names);
-
-gboolean camel_store_supports_subscriptions (CamelStore *store);
-
-gboolean camel_store_folder_subscribed (CamelStore *store,
- const char *folder_name);
-void camel_store_subscribe_folder (CamelStore *store,
- const char *folder_name,
- CamelException *ex);
-void camel_store_unsubscribe_folder (CamelStore *store,
- const char *folder_name,
- 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 7df9fa30ee..0000000000
--- a/camel/camel-stream-buffer.c
+++ /dev/null
@@ -1,453 +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 CamelStreamClass *parent_class = NULL;
-
-enum {
- BUF_USER = 1<<0, /* user-supplied buffer, do not free */
-};
-
-#define BUF_SIZE 1024
-
-static ssize_t stream_read (CamelStream *stream, char *buffer, size_t n);
-static ssize_t stream_write (CamelStream *stream, const char *buffer, size_t n);
-static int stream_flush (CamelStream *stream);
-static int stream_close (CamelStream *stream);
-static gboolean stream_eos (CamelStream *stream);
-
-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);
-
- parent_class = CAMEL_STREAM_CLASS (camel_type_get_global_classfuncs (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;
-}
-
-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);
-}
-
-static void
-camel_stream_buffer_finalize (CamelObject *object)
-{
- CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (object);
-
- if (!(sbf->flags & BUF_USER)) {
- g_free(sbf->buf);
- }
- if (sbf->stream)
- camel_object_unref(CAMEL_OBJECT(sbf->stream));
-
- g_free(sbf->linebuf);
-}
-
-
-CamelType
-camel_stream_buffer_get_type (void)
-{
- static CamelType camel_stream_buffer_type = CAMEL_INVALID_TYPE;
-
- if (camel_stream_buffer_type == CAMEL_INVALID_TYPE) {
- camel_stream_buffer_type = camel_type_register (camel_stream_get_type (), "CamelStreamBuffer",
- sizeof (CamelStreamBuffer),
- sizeof (CamelStreamBufferClass),
- (CamelObjectClassInitFunc) camel_stream_buffer_class_init,
- NULL,
- (CamelObjectInitFunc) camel_stream_buffer_init,
- (CamelObjectFinalizeFunc) camel_stream_buffer_finalize);
- }
-
- return camel_stream_buffer_type;
-}
-
-
-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)
- camel_object_unref(CAMEL_OBJECT(sbf->stream));
- sbf->stream = s;
- camel_object_ref(CAMEL_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 = CAMEL_STREAM_BUFFER (camel_object_new (camel_stream_buffer_get_type ()));
- CAMEL_STREAM_BUFFER_CLASS (CAMEL_OBJECT_GET_CLASS(sbf))->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 = CAMEL_STREAM_BUFFER (camel_object_new (camel_stream_buffer_get_type ()));
- CAMEL_STREAM_BUFFER_CLASS (CAMEL_OBJECT_GET_CLASS(sbf))->init_vbuf (sbf, stream, mode, buf, size);
-
- return CAMEL_STREAM (sbf);
-}
-
-static ssize_t
-stream_read (CamelStream *stream, char *buffer, size_t n)
-{
- CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
- ssize_t bytes_read = 1;
- ssize_t 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) {
- size_t bytes_used = bytes_read > n ? n : bytes_read;
- sbf->ptr = sbf->buf;
- sbf->end = sbf->buf+bytes_read;
- memcpy(bptr, sbf->ptr, bytes_used);
- sbf->ptr += bytes_used;
- bptr += bytes_used;
- n -= bytes_used;
- }
- }
- } else {
- memcpy(bptr, sbf->ptr, n);
- sbf->ptr += n;
- bptr += n;
- n = 0;
- }
- }
-
- return (ssize_t)(bptr - buffer);
-}
-
-static ssize_t
-stream_write (CamelStream *stream, const char *buffer, size_t n)
-{
- CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
- const char *bptr = buffer;
- ssize_t bytes_written = 1;
- ssize_t bytes_left;
- ssize_t 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-1 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;
- *outptr = 0;
-
- return (int)(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 5c9037595a..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) (CAMEL_CHECK_CAST((obj), CAMEL_STREAM_BUFFER_TYPE, CamelStreamBuffer))
-#define CAMEL_STREAM_BUFFER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_STREAM_BUFFER_TYPE, CamelStreamBufferClass))
-#define CAMEL_IS_STREAM_BUFFER(o) (CAMEL_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 Camel function */
-CamelType 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 866c8d2416..0000000000
--- a/camel/camel-stream-filter.c
+++ /dev/null
@@ -1,381 +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"
-
-#define d(x)
-/*#include <stdio.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 ssize_t do_read (CamelStream *stream, char *buffer, size_t n);
-static ssize_t do_write (CamelStream *stream, const char *buffer, size_t 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;
-
-static void
-camel_stream_filter_class_init (CamelStreamFilterClass *klass)
-{
- CamelStreamClass *camel_stream_class = (CamelStreamClass *) klass;
-
- camel_stream_filter_parent = CAMEL_STREAM_CLASS (camel_type_get_global_classfuncs (camel_stream_get_type ()));
-
- camel_stream_class->read = do_read;
- camel_stream_class->write = do_write;
- camel_stream_class->flush = do_flush;
- camel_stream_class->close = do_close;
- camel_stream_class->eos = do_eos;
- camel_stream_class->reset = do_reset;
-
-}
-
-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;
-}
-
-static void
-camel_stream_filter_finalize(CamelObject *o)
-{
- CamelStreamFilter *filter = (CamelStreamFilter *)o;
- struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
- struct _filter *fn, *f;
-
- f = p->filters;
- while (f) {
- fn = f->next;
- camel_object_unref((CamelObject *)f->filter);
- g_free(f);
- f = fn;
- }
- g_free(p->realbuffer);
- g_free(p);
- camel_object_unref((CamelObject *)filter->source);
-}
-
-CamelType
-camel_stream_filter_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (CAMEL_STREAM_TYPE, "CamelStreamFilter",
- sizeof (CamelStreamFilter),
- sizeof (CamelStreamFilterClass),
- (CamelObjectClassInitFunc) camel_stream_filter_class_init,
- NULL,
- (CamelObjectInitFunc) camel_stream_filter_init,
- (CamelObjectFinalizeFunc) camel_stream_filter_finalize);
- }
-
- return type;
-}
-
-/**
- * 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 ( camel_object_new (camel_stream_filter_get_type ()));
-
- new->source = stream;
- camel_object_ref ((CamelObject *)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;
- camel_object_ref((CamelObject *)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;
- camel_object_unref((CamelObject *)fn->filter);
- g_free(fn);
- }
- f = f->next;
- }
-}
-
-static ssize_t
-do_read (CamelStream *stream, char *buffer, size_t n)
-{
- CamelStreamFilter *filter = (CamelStreamFilter *)stream;
- struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
- ssize_t 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;
-
- d(printf ("\n\nOriginal content: '"));
- d(fwrite(p->filtered, sizeof(char), p->filteredlen, stdout));
- d(printf("'\n"));
-
- while (f) {
- camel_mime_filter_filter(f->filter, p->filtered, p->filteredlen, presize,
- &p->filtered, &p->filteredlen, &presize);
-
- d(printf ("Filtered content (%s): '",
- camel_type_to_name(((CamelObject *)f->filter)->s.type)));
- d(fwrite(p->filtered, sizeof(char), p->filteredlen, stdout));
- d(printf("'\n"));
-
- f = f->next;
- }
- }
- }
-
- size = MIN(n, p->filteredlen);
- memcpy(buffer, p->filtered, size);
- p->filteredlen -= size;
- p->filtered += size;
-
- return size;
-}
-
-/* Note: Since the caller expects to write out as much as they asked us to
- write (for 'success'), we return what they asked us to write (for 'success')
- rather than the true number of written bytes */
-static ssize_t
-do_write (CamelStream *stream, const char *buf, size_t n)
-{
- CamelStreamFilter *filter = (CamelStreamFilter *)stream;
- struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
- struct _filter *f;
- int presize;
- char *buffer = (char *)buf;
- size_t len = n;
-
- p->last_was_read = FALSE;
-
- d(printf ("\n\nWriting: Original content: '"));
- d(fwrite(buffer, sizeof(char), len, stdout));
- d(printf("'\n"));
-
- f = p->filters;
- presize = 0;
- while (f) {
- camel_mime_filter_filter(f->filter, buffer, len, presize, &buffer, &len, &presize);
-
- d(printf ("Filtered content (%s): '",
- camel_type_to_name(((CamelObject *)f->filter)->s.type)));
- d(fwrite(buffer, sizeof(char), len, stdout));
- d(printf("'\n"));
-
- f = f->next;
- }
-
- if (camel_stream_write(filter->source, buffer, len) != len)
- return -1;
-
- return 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;
-
- d(printf ("\n\nFlushing: Original content: '"));
- d(fwrite(buffer, sizeof(char), len, stdout));
- d(printf("'\n"));
-
- while (f) {
- camel_mime_filter_complete(f->filter, buffer, len, presize, &buffer, &len, &presize);
-
- d(printf ("Filtered content (%s): '",
- camel_type_to_name(((CamelObject *)f->filter)->s.type)));
- d(fwrite(buffer, sizeof(char), len, stdout));
- d(printf("'\n"));
-
- 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 b3906eef31..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) CAMEL_CHECK_CAST (obj, camel_stream_filter_get_type (), CamelStreamFilter)
-#define CAMEL_STREAM_FILTER_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_stream_filter_get_type (), CamelStreamFilterClass)
-#define CAMEL_IS_STREAM_FILTER(obj) CAMEL_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 d19000b37e..0000000000
--- a/camel/camel-stream-fs.c
+++ /dev/null
@@ -1,371 +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 "camel-session.h"
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-#include "camel-operation.h"
-
-static CamelSeekableStreamClass *parent_class = NULL;
-
-/* Returns the class for a CamelStreamFS */
-#define CSFS_CLASS(so) CAMEL_STREAM_FS_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static ssize_t stream_read (CamelStream *stream, char *buffer, size_t n);
-static ssize_t stream_write (CamelStream *stream, const char *buffer, size_t 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
-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);
-
- parent_class = CAMEL_SEEKABLE_STREAM_CLASS (camel_type_get_global_classfuncs (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;
-}
-
-static void
-camel_stream_fs_init (gpointer object, gpointer klass)
-{
- CamelStreamFs *stream = CAMEL_STREAM_FS (object);
-
- stream->fd = -1;
- ((CamelSeekableStream *)stream)->bound_end = CAMEL_STREAM_UNBOUND;
-}
-
-static void
-camel_stream_fs_finalize (CamelObject *object)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (object);
-
- if (stream_fs->fd != -1)
- close (stream_fs->fd);
-}
-
-
-CamelType
-camel_stream_fs_get_type (void)
-{
- static CamelType camel_stream_fs_type = CAMEL_INVALID_TYPE;
-
- if (camel_stream_fs_type == CAMEL_INVALID_TYPE) {
- camel_stream_fs_type = camel_type_register (camel_seekable_stream_get_type (), "CamelStreamFs",
- sizeof (CamelStreamFs),
- sizeof (CamelStreamFsClass),
- (CamelObjectClassInitFunc) camel_stream_fs_class_init,
- NULL,
- (CamelObjectInitFunc) camel_stream_fs_init,
- (CamelObjectFinalizeFunc) camel_stream_fs_finalize);
- }
-
- return camel_stream_fs_type;
-}
-
-/**
- * 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;
-
- if (fd == -1)
- return NULL;
-
- stream_fs = CAMEL_STREAM_FS (camel_object_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 ssize_t
-stream_read (CamelStream *stream, char *buffer, size_t n)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream);
- CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
- ssize_t nread;
- int cancel_fd;
-
- if (camel_operation_cancel_check(NULL)) {
- errno = EINTR;
- return -1;
- }
-
- if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
- n = MIN (seekable->bound_end - seekable->position, n);
-
- cancel_fd = camel_operation_cancel_fd(NULL);
- if (cancel_fd == -1) {
- do {
- nread = read (stream_fs->fd, buffer, n);
- } while (nread == -1 && errno == EINTR);
- } else {
- fd_set rdset;
- int flags, fdmax;
-
- flags = fcntl(stream_fs->fd, F_GETFL);
- fcntl(stream_fs->fd, F_SETFL, flags | O_NONBLOCK);
- FD_ZERO(&rdset);
- FD_SET(stream_fs->fd, &rdset);
- FD_SET(cancel_fd, &rdset);
- fdmax = MAX(stream_fs->fd, cancel_fd)+1;
- select(fdmax, &rdset, 0, 0, NULL);
- if (FD_ISSET(cancel_fd, &rdset)) {
- fcntl(stream_fs->fd, F_SETFL, flags);
- errno = EINTR;
- return -1;
- }
- nread = read(stream_fs->fd, buffer, n);
- fcntl(stream_fs->fd, F_SETFL, flags);
- }
-
- if (nread > 0)
- seekable->position += nread;
- else if (nread == 0)
- stream->eos = TRUE;
-
- return nread;
-}
-
-static ssize_t
-stream_write (CamelStream *stream, const char *buffer, size_t n)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream);
- CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
- ssize_t v, written = 0;
- int cancel_fd;
-
- if (camel_operation_cancel_check(NULL)) {
- errno = EINTR;
- return -1;
- }
-
- if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
- n = MIN (seekable->bound_end - seekable->position, n);
-
- cancel_fd = camel_operation_cancel_fd(NULL);
- if (cancel_fd == -1) {
- do {
- v = write (stream_fs->fd, buffer+written, n-written);
- if (v > 0)
- written += v;
- } while (v == -1 && errno == EINTR);
- } else {
- fd_set rdset, wrset;
- int flags, fdmax;
-
- flags = fcntl(stream_fs->fd, F_GETFL);
- fcntl(stream_fs->fd, F_SETFL, flags | O_NONBLOCK);
- fdmax = MAX(stream_fs->fd, cancel_fd)+1;
- do {
- FD_ZERO(&rdset);
- FD_ZERO(&wrset);
- FD_SET(stream_fs->fd, &wrset);
- FD_SET(cancel_fd, &rdset);
- select(fdmax, &rdset, &wrset, 0, NULL);
- if (FD_ISSET(cancel_fd, &rdset)) {
- fcntl(stream_fs->fd, F_SETFL, flags);
- errno = EINTR;
- return -1;
- }
- v = write(stream_fs->fd, buffer+written, n-written);
- if (v>0)
- written += v;
- } while (v != -1 && written < n);
- fcntl(stream_fs->fd, F_SETFL, flags);
- }
-
- 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)
-{
- if (close (((CamelStreamFs *)stream)->fd) == -1)
- return -1;
-
- ((CamelStreamFs *)stream)->fd = -1;
- return 0;
-}
-
-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) {
- if (real<stream->bound_start)
- real = stream->bound_start;
- 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 ea403f584f..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) (CAMEL_CHECK_CAST((obj), CAMEL_STREAM_FS_TYPE, CamelStreamFs))
-#define CAMEL_STREAM_FS_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_STREAM_FS_TYPE, CamelStreamFsClass))
-#define CAMEL_IS_STREAM_FS(o) (CAMEL_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 Camel function */
-CamelType 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 b9012bcccb..0000000000
--- a/camel/camel-stream-mem.c
+++ /dev/null
@@ -1,246 +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 CamelSeekableStreamClass *parent_class = NULL;
-
-/* Returns the class for a CamelStreamMem */
-#define CSM_CLASS(so) CAMEL_STREAM_MEM_CLASS(CAMEL_OBJECT_GET_CLASS(so))
-
-static ssize_t stream_read (CamelStream *stream, char *buffer, size_t n);
-static ssize_t stream_write (CamelStream *stream, const char *buffer, size_t n);
-static gboolean stream_eos (CamelStream *stream);
-static off_t stream_seek (CamelSeekableStream *stream, off_t offset,
- CamelStreamSeekPolicy policy);
-
-static void camel_stream_mem_finalize (CamelObject *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);
-
- parent_class = CAMEL_SEEKABLE_STREAM_CLASS( camel_type_get_global_classfuncs( CAMEL_SEEKABLE_STREAM_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;
-}
-
-static void
-camel_stream_mem_init (CamelObject *object)
-{
- CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (object);
-
- stream_mem->owner = FALSE;
- stream_mem->buffer = 0;
-}
-
-CamelType
-camel_stream_mem_get_type (void)
-{
- static CamelType camel_stream_mem_type = CAMEL_INVALID_TYPE;
-
- if (camel_stream_mem_type == CAMEL_INVALID_TYPE) {
- camel_stream_mem_type = camel_type_register( CAMEL_SEEKABLE_STREAM_TYPE,
- "CamelStreamMem",
- sizeof( CamelStreamMem ),
- sizeof( CamelStreamMemClass ),
- (CamelObjectClassInitFunc) camel_stream_mem_class_init,
- NULL,
- (CamelObjectInitFunc) camel_stream_mem_init,
- (CamelObjectFinalizeFunc) camel_stream_mem_finalize );
- }
-
- 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 = CAMEL_STREAM_MEM( camel_object_new (CAMEL_STREAM_MEM_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);
- s->owner = TRUE;
-}
-
-static void
-camel_stream_mem_finalize (CamelObject *object)
-{
- CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (object);
-
- if (stream_mem->buffer && stream_mem->owner)
- g_byte_array_free (stream_mem->buffer, TRUE);
-
- /* Will be called automagically in the Camel Type System!
- * Wheeee!
- * G_TK_OBJECT_CLASS (parent_class)->finalize (object);
- */
-}
-
-static ssize_t
-stream_read (CamelStream *stream, char *buffer, size_t n)
-{
- CamelStreamMem *camel_stream_mem = CAMEL_STREAM_MEM (stream);
- CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
- ssize_t nread;
-
- if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
- n = MIN(seekable->bound_end - seekable->position, n);
-
- nread = MIN (n, camel_stream_mem->buffer->len - seekable->position);
- if (nread > 0) {
- memcpy (buffer, camel_stream_mem->buffer->data + seekable->position, nread);
- seekable->position += nread;
- } else
- nread = 0;
-
- return nread;
-}
-
-static ssize_t
-stream_write (CamelStream *stream, const char *buffer, size_t n)
-{
- CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (stream);
- CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
- ssize_t nwrite = n;
-
- if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
- nwrite = MIN(seekable->bound_end - seekable->position, n);
-
-#ifndef NO_WARNINGS
-#warning "g_byte_arrays use g_malloc and so are totally unsuitable for this object"
-#endif
- if (seekable->position == stream_mem->buffer->len) {
- g_byte_array_append(stream_mem->buffer, (const guint8 *)buffer, nwrite);
- } else {
- g_byte_array_set_size(stream_mem->buffer, nwrite + stream_mem->buffer->len);
- memcpy(stream_mem->buffer->data + seekable->position, buffer, nwrite);
- }
- seekable->position += nwrite;
-
- return nwrite;
-}
-
-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;
- default:
- position = 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 422d05426c..0000000000
--- a/camel/camel-stream-mem.h
+++ /dev/null
@@ -1,75 +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) (CAMEL_CHECK_CAST((obj), CAMEL_STREAM_MEM_TYPE, CamelStreamMem))
-#define CAMEL_STREAM_MEM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_STREAM_MEM_TYPE, CamelStreamMemClass))
-#define CAMEL_IS_STREAM_MEM(o) (CAMEL_CHECK_TYPE((o), CAMEL_STREAM_MEM_TYPE))
-
-typedef struct _CamelStreamMemClass CamelStreamMemClass;
-
-struct _CamelStreamMem {
- CamelSeekableStream parent_object;
-
- gboolean owner; /* do we own the buffer? */
- GByteArray *buffer;
-};
-
-struct _CamelStreamMemClass {
- CamelSeekableStreamClass parent_class;
-
- /* Virtual methods */
-};
-
-/* Standard Camel function */
-CamelType 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-null.c b/camel/camel-stream-null.c
deleted file mode 100644
index 34cc67ec7c..0000000000
--- a/camel/camel-stream-null.c
+++ /dev/null
@@ -1,90 +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:
- * 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-null.h"
-
-static CamelObjectClass *parent_class = NULL;
-
-/* Returns the class for a CamelStream */
-#define CS_CLASS(so) CAMEL_STREAM_NULL_CLASS(CAMEL_OBJECT_GET_CLASS(so))
-
-/* dummy implementations, for a NULL stream */
-static ssize_t stream_read (CamelStream *stream, char *buffer, size_t n) { return 0; }
-static ssize_t stream_write (CamelStream *stream, const char *buffer, size_t n) { return n; }
-static int stream_close (CamelStream *stream) { return 0; }
-static int stream_flush (CamelStream *stream) { return 0; }
-static gboolean stream_eos (CamelStream *stream) { return TRUE; }
-static int stream_reset (CamelStream *stream) { return 0; }
-
-static void
-camel_stream_null_class_init (CamelStreamClass *camel_stream_null_class)
-{
- CamelStreamClass *camel_stream_class = (CamelStreamClass *)camel_stream_null_class;
-
- parent_class = camel_type_get_global_classfuncs( CAMEL_OBJECT_TYPE );
-
- /* virtual method definition */
- camel_stream_class->read = stream_read;
- camel_stream_class->write = stream_write;
- camel_stream_class->close = stream_close;
- camel_stream_class->flush = stream_flush;
- camel_stream_class->eos = stream_eos;
- camel_stream_class->reset = stream_reset;
-}
-
-CamelType
-camel_stream_null_get_type (void)
-{
- static CamelType camel_stream_null_type = CAMEL_INVALID_TYPE;
-
- if (camel_stream_null_type == CAMEL_INVALID_TYPE) {
- camel_stream_null_type = camel_type_register( camel_stream_get_type(),
- "CamelStreamNull",
- sizeof( CamelStreamNull ),
- sizeof( CamelStreamNullClass ),
- (CamelObjectClassInitFunc) camel_stream_null_class_init,
- NULL,
- NULL,
- NULL );
- }
-
- return camel_stream_null_type;
-}
-
-/**
- * camel_stream_fs_new_with_fd:
- * @fd: a file descriptor
- *
- * Returns a NULL stream. A null stream is always at eof, and
- * always returns success for all reads and writes.
- *
- * Return value: the stream
- **/
-CamelStreamNull *
-camel_stream_null_new(void)
-{
- return (CamelStreamNull *)camel_object_new(camel_stream_null_get_type ());
-}
diff --git a/camel/camel-stream-null.h b/camel/camel-stream-null.h
deleted file mode 100644
index 70978c5d61..0000000000
--- a/camel/camel-stream-null.h
+++ /dev/null
@@ -1,44 +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_NULL_H
-#define _CAMEL_STREAM_NULL_H
-
-#include <camel/camel-stream.h>
-
-#define CAMEL_STREAM_NULL(obj) CAMEL_CHECK_CAST (obj, camel_stream_null_get_type (), CamelStreamNull)
-#define CAMEL_STREAM_NULL_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_stream_null_get_type (), CamelStreamNullClass)
-#define CAMEL_IS_STREAM_NULL(obj) CAMEL_CHECK_TYPE (obj, camel_stream_null_get_type ())
-
-typedef struct _CamelStreamNullClass CamelStreamNullClass;
-
-struct _CamelStreamNull {
- CamelStream parent;
-};
-
-struct _CamelStreamNullClass {
- CamelStreamClass parent_class;
-};
-
-guint camel_stream_null_get_type (void);
-
-CamelStreamNull *camel_stream_null_new (void);
-
-#endif /* ! _CAMEL_STREAM_NULL_H */
diff --git a/camel/camel-stream-ssl.c b/camel/camel-stream-ssl.c
deleted file mode 100644
index 9e328e47fe..0000000000
--- a/camel/camel-stream-ssl.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#include <config.h>
-#include "camel-stream-ssl.h"
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-static CamelStreamClass *parent_class = NULL;
-
-/* Returns the class for a CamelStreamSSL */
-#define CSSSL_CLASS(so) CAMEL_STREAM_SSL_CLASS (CAMEL_OBJECT_GET_CLASS (so))
-
-static SSL *open_ssl_connection (int sockfd);
-static int close_ssl_connection (SSL *ssl);
-
-static ssize_t stream_read (CamelStream *stream, char *buffer, size_t n);
-static ssize_t stream_write (CamelStream *stream, const char *buffer, size_t n);
-static int stream_flush (CamelStream *stream);
-static int stream_close (CamelStream *stream);
-
-static void
-camel_stream_ssl_class_init (CamelStreamSSLClass *camel_stream_ssl_class)
-{
- CamelStreamClass *camel_stream_class =
- CAMEL_STREAM_CLASS (camel_stream_ssl_class);
-
- parent_class = CAMEL_STREAM_CLASS (camel_type_get_global_classfuncs (camel_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;
-}
-
-static void
-camel_stream_ssl_init (gpointer object, gpointer klass)
-{
- CamelStreamSSL *stream = CAMEL_STREAM_SSL (object);
-
- stream->fd = -1;
- stream->ssl = NULL;
-}
-
-static void
-camel_stream_ssl_finalize (CamelObject *object)
-{
- CamelStreamSSL *stream = CAMEL_STREAM_SSL (object);
-
- if (stream->ssl) {
- SSL_shutdown (stream->ssl);
-
- if (stream->ssl->ctx)
- SSL_CTX_free (stream->ssl->ctx);
-
- SSL_free (stream->ssl);
- }
-
- if (stream->fd != -1)
- close (stream->fd);
-}
-
-
-CamelType
-camel_stream_ssl_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_stream_get_type (),
- "CamelStreamSSL",
- sizeof (CamelStreamSSL),
- sizeof (CamelStreamSSLClass),
- (CamelObjectClassInitFunc) camel_stream_ssl_class_init,
- NULL,
- (CamelObjectInitFunc) camel_stream_ssl_init,
- (CamelObjectFinalizeFunc) camel_stream_ssl_finalize);
- }
-
- return type;
-}
-
-static int
-verify_callback (int ok, X509_STORE_CTX *ctx)
-{
- char *str, buf[256];
- X509 *cert;
- int err;
-
- cert = X509_STORE_CTX_get_current_cert (ctx);
- err = X509_STORE_CTX_get_error (ctx);
-
- str = X509_NAME_oneline (X509_get_subject_name (cert), buf, 256);
- if (str) {
- if (ok)
- d(fprintf (stderr, "CamelStreamSSL: depth=%d %s\n", ctx->error_depth, buf));
- else
- d(fprintf (stderr, "CamelStreamSSL: depth=%d error=%d %s\n",
- ctx->error_depth, err, buf));
- }
-
- if (!ok) {
- switch (err) {
- case X509_V_ERR_CERT_NOT_YET_VALID:
- case X509_V_ERR_CERT_HAS_EXPIRED:
- case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
- ok = 1;
- }
- }
-
- return ok;
-}
-
-static SSL *
-open_ssl_connection (int sockfd)
-{
- SSL_CTX *ssl_ctx = NULL;
- SSL *ssl = NULL;
- int n;
-
- /* SSLv23_client_method will negotiate with SSL v2, v3, or TLS v1 */
- ssl_ctx = SSL_CTX_new (SSLv23_client_method ());
- SSL_CTX_set_verify (ssl_ctx, SSL_VERIFY_PEER, &verify_cb);
- ssl = SSL_new (ssl_ctx);
- SSL_set_fd (ssl, sockfd);
-
- n = SSL_connect (ssl);
- if (n != 1) {
- SSL_shutdown (ssl);
-
- if (ssl->ctx)
- SSL_CTX_free (ssl->ctx);
-
- SSL_free (ssl);
- ssl = NULL;
- }
-
- return ssl;
-}
-
-static int
-close_ssl_connection (SSL *ssl)
-{
- if (ssl) {
- SSL_shutdown (ssl);
-
- if (ssl->ctx)
- SSL_CTX_free (ssl->ctx);
-
- SSL_free (ssl);
- }
-
- return 0;
-}
-
-
-/**
- * camel_stream_ssl_new:
- * @sockfd: a socket 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_ssl_new (int sockfd)
-{
- CamelStreamSSL *stream_ssl;
- SSL *ssl;
-
- if (sockfd == -1)
- return NULL;
-
- ssl = open_ssl_connection (sockfd);
- if (!ssl)
- return NULL;
-
- stream_ssl = CAMEL_STREAM_SSL (camel_object_new (camel_stream_ssl_get_type ()));
- stream_ssl->sockfd = sockfd;
- stream_ssl->ssl = ssl;
-
- return CAMEL_STREAM (stream_ssl);
-}
-
-static ssize_t
-stream_read (CamelStream *stream, char *buffer, size_t n)
-{
- CamelStreamSSL *stream_ssl = CAMEL_STREAM_SSL (stream);
- ssize_t nread;
-
- do {
- nread = SSL_read (stream_ssl->ssl, buffer, n);
- } while (nread == -1 && errno == EINTR);
-
- return nread;
-}
-
-static ssize_t
-stream_write (CamelStream *stream, const char *buffer, size_t n)
-{
- CamelStreamSSL *stream_ssl = CAMEL_STREAM_SSL (stream);
- ssize_t v, written = 0;
-
- do {
- v = SSL_write (stream_ssl->ssl, buffer, n);
- if (v > 0)
- written += v;
- } while (v == -1 && errno == EINTR);
-
- if (v == -1)
- return -1;
- else
- return written;
-}
-
-static int
-stream_flush (CamelStream *stream)
-{
- return fsync (((CamelStreamSSL *)stream)->fd);
-}
-
-static int
-stream_close (CamelStream *stream)
-{
- close_ssl_connection (((CamelStreamSSL *)stream)->ssl);
-
- return close (((CamelStreamSSL *)stream)->fd);
-}
diff --git a/camel/camel-stream-ssl.h b/camel/camel-stream-ssl.h
deleted file mode 100644
index 9bed6fbffc..0000000000
--- a/camel/camel-stream-ssl.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#ifndef CAMEL_STREAM_SSL_H
-#define CAMEL_STREAM_SSL_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#include <camel/camel-stream.h>
-#include <openssl/ssl.h>
-
-#define CAMEL_STREAM_SSL_TYPE (camel_stream_ssl_get_type ())
-#define CAMEL_STREAM_SSL(obj) (CAMEL_CHECK_CAST((obj), CAMEL_STREAM_SSL_TYPE, CamelStreamSSL))
-#define CAMEL_STREAM_SSL_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_STREAM_SSL_TYPE, CamelStreamSSLClass))
-#define CAMEL_IS_STREAM_SSL(o) (CAMEL_CHECK_TYPE((o), CAMEL_STREAM_SSL_TYPE))
-
-struct _CamelStreamSSL {
- CamelStream parent_object;
-
- int sockfd; /* file descriptor on the underlying socket */
- SSL *ssl; /* SSL structure */
-};
-
-typedef struct {
- CamelStreamClass parent_class;
-} CamelStreamSSLClass;
-
-/* Standard Camel function */
-CamelType camel_stream_ssl_get_type (void);
-
-/* public methods */
-CamelStream *camel_stream_ssl_new (int sockfd);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_SSL_H */
diff --git a/camel/camel-stream.c b/camel/camel-stream.c
deleted file mode 100644
index 2c8924ee7c..0000000000
--- a/camel/camel-stream.c
+++ /dev/null
@@ -1,271 +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(CAMEL_OBJECT_GET_CLASS(so))
-
-/* default implementations, do very little */
-static ssize_t stream_read (CamelStream *stream, char *buffer, size_t n) { return 0; }
-static ssize_t stream_write (CamelStream *stream, const char *buffer, size_t n) { return n; }
-static int stream_close (CamelStream *stream) { return 0; }
-static int stream_flush (CamelStream *stream) { return 0; }
-static gboolean stream_eos (CamelStream *stream) { return stream->eos; }
-static int stream_reset (CamelStream *stream) { return 0; }
-
-static void
-camel_stream_class_init (CamelStreamClass *camel_stream_class)
-{
- parent_class = camel_type_get_global_classfuncs( CAMEL_OBJECT_TYPE );
-
- /* virtual method definition */
- camel_stream_class->read = stream_read;
- camel_stream_class->write = stream_write;
- camel_stream_class->close = stream_close;
- camel_stream_class->flush = stream_flush;
- camel_stream_class->eos = stream_eos;
- camel_stream_class->reset = stream_reset;
-}
-
-CamelType
-camel_stream_get_type (void)
-{
- static CamelType camel_stream_type = CAMEL_INVALID_TYPE;
-
- if (camel_stream_type == CAMEL_INVALID_TYPE) {
- camel_stream_type = camel_type_register( CAMEL_OBJECT_TYPE,
- "CamelStream",
- sizeof( CamelStream ),
- sizeof( CamelStreamClass ),
- (CamelObjectClassInitFunc) camel_stream_class_init,
- NULL,
- NULL,
- NULL );
- }
-
- 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.
- **/
-ssize_t
-camel_stream_read (CamelStream *stream, char *buffer, size_t 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.
- **/
-ssize_t
-camel_stream_write (CamelStream *stream, const char *buffer, size_t 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);
-}
-
-/**
- * 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);
-}
-
-/**
- * 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);
-}
-
-/**
- * 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.
- **/
-ssize_t
-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.
- **/
-ssize_t
-camel_stream_printf (CamelStream *stream, const char *fmt, ... )
-{
- va_list args;
- char *string;
- ssize_t 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.
- **/
-ssize_t
-camel_stream_write_to_stream (CamelStream *stream, CamelStream *output_stream)
-{
- char tmp_buf[4096];
- ssize_t total = 0;
- ssize_t nb_read;
- ssize_t 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) {
- ssize_t 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 dec4e638e1..0000000000
--- a/camel/camel-stream.h
+++ /dev/null
@@ -1,91 +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>
-#include <unistd.h>
-
-#define CAMEL_STREAM_TYPE (camel_stream_get_type ())
-#define CAMEL_STREAM(obj) (CAMEL_CHECK_CAST((obj), CAMEL_STREAM_TYPE, CamelStream))
-#define CAMEL_STREAM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_STREAM_TYPE, CamelStreamClass))
-#define CAMEL_IS_STREAM(o) (CAMEL_CHECK_TYPE((o), CAMEL_STREAM_TYPE))
-
-struct _CamelStream
-{
- CamelObject parent_object;
-
- gboolean eos;
-};
-
-typedef struct {
- CamelObjectClass parent_class;
-
- /* Virtual methods */
-
- ssize_t (*read) (CamelStream *stream, char *buffer, size_t n);
- ssize_t (*write) (CamelStream *stream, const char *buffer, size_t n);
- int (*close) (CamelStream *stream);
- int (*flush) (CamelStream *stream);
- gboolean (*eos) (CamelStream *stream);
- int (*reset) (CamelStream *stream);
-
-} CamelStreamClass;
-
-/* Standard Camel function */
-CamelType camel_stream_get_type (void);
-
-/* public methods */
-ssize_t camel_stream_read (CamelStream *stream, char *buffer, size_t n);
-ssize_t camel_stream_write (CamelStream *stream, const char *buffer, size_t 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 */
-ssize_t camel_stream_write_string (CamelStream *stream, const char *string);
-ssize_t camel_stream_printf (CamelStream *stream, const char *fmt, ... ) G_GNUC_PRINTF (2, 3);
-ssize_t 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.
- */
-ssize_t camel_stream_write_to_stream (CamelStream *stream, CamelStream *output_stream);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_H */
diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c
deleted file mode 100644
index 6467eed5da..0000000000
--- a/camel/camel-tcp-stream-raw.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#include <config.h>
-#include "camel-tcp-stream-raw.h"
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-static CamelTcpStreamClass *parent_class = NULL;
-
-/* Returns the class for a CamelTcpStreamRaw */
-#define CTSR_CLASS(so) CAMEL_TCP_STREAM_RAW_CLASS (CAMEL_OBJECT_GET_CLASS (so))
-
-static ssize_t stream_read (CamelStream *stream, char *buffer, size_t n);
-static ssize_t stream_write (CamelStream *stream, const char *buffer, size_t n);
-static int stream_flush (CamelStream *stream);
-static int stream_close (CamelStream *stream);
-
-static int stream_connect (CamelTcpStream *stream, struct hostent *host, int port);
-static int stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data);
-static int stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data);
-
-static void
-camel_tcp_stream_raw_class_init (CamelTcpStreamRawClass *camel_tcp_stream_raw_class)
-{
- CamelTcpStreamClass *camel_tcp_stream_class =
- CAMEL_TCP_STREAM_CLASS (camel_tcp_stream_raw_class);
- CamelStreamClass *camel_stream_class =
- CAMEL_STREAM_CLASS (camel_tcp_stream_raw_class);
-
- parent_class = CAMEL_STREAM_CLASS (camel_type_get_global_classfuncs (camel_tcp_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_tcp_stream_class->connect = stream_connect;
- camel_tcp_stream_class->getsockopt = stream_getsockopt;
- camel_tcp_stream_class->setsockopt = stream_setsockopt;
-}
-
-static void
-camel_tcp_stream_raw_init (gpointer object, gpointer klass)
-{
- CamelTcpStreamRaw *stream = CAMEL_TCP_STREAM_RAW (object);
-
- stream->sockfd = -1;
-}
-
-static void
-camel_tcp_stream_raw_finalize (CamelObject *object)
-{
- CamelTcpStreamRaw *stream = CAMEL_TCP_STREAM_RAW (object);
-
- if (stream->sockfd != -1)
- close (stream->sockfd);
-}
-
-
-CamelType
-camel_tcp_stream_raw_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_stream_get_type (),
- "CamelTcpStreamRaw",
- sizeof (CamelTcpStreamRaw),
- sizeof (CamelTcpStreamRawClass),
- (CamelObjectClassInitFunc) camel_tcp_stream_raw_class_init,
- NULL,
- (CamelObjectInitFunc) camel_tcp_stream_raw_init,
- (CamelObjectFinalizeFunc) camel_tcp_stream_raw_finalize);
- }
-
- return type;
-}
-
-
-/**
- * camel_tcp_stream_raw_new:
- *
- * Return value: a tcp stream
- **/
-CamelStream *
-camel_tcp_stream_raw_new ()
-{
- CamelTcpStreamRaw *stream;
-
- stream = CAMEL_TCP_STREAM_RAW (camel_object_new (camel_tcp_stream_raw_get_type ()));
-
- return CAMEL_STREAM (stream);
-}
-
-static ssize_t
-stream_read (CamelStream *stream, char *buffer, size_t n)
-{
- CamelTcpStreamRaw *tcp_stream_raw = CAMEL_TCP_STREAM_RAW (stream);
- ssize_t nread;
-
- do {
- nread = read (tcp_stream_raw->sockfd, buffer, n);
- } while (nread == -1 && errno == EINTR);
-
- return nread;
-}
-
-static ssize_t
-stream_write (CamelStream *stream, const char *buffer, size_t n)
-{
- CamelTcpStreamRaw *tcp_stream_raw = CAMEL_TCP_STREAM_RAW (stream);
- ssize_t v, written = 0;
-
- do {
- v = write (tcp_stream_raw->sockfd, buffer, n);
- if (v > 0)
- written += v;
- } while (v == -1 && errno == EINTR);
-
- if (v == -1)
- return -1;
- else
- return written;
-}
-
-static int
-stream_flush (CamelStream *stream)
-{
- return fsync (((CamelTcpStreamRaw *)stream)->sockfd);
-}
-
-static int
-stream_close (CamelStream *stream)
-{
- if (close (((CamelTcpStreamRaw *)stream)->sockfd) == -1)
- return -1;
-
- ((CamelTcpStreamRaw *)stream)->sockfd = -1;
- return 0;
-}
-
-
-static int
-stream_connect (CamelTcpStream *stream, struct hostent *host, int port)
-{
- CamelTcpStreamRaw *raw = CAMEL_TCP_STREAM_RAW (stream);
- struct sockaddr_in sin;
- int fd;
-
- g_return_val_if_fail (host != NULL, -1);
-
- sin.sin_family = host->h_addrtype;
- sin.sin_port = htons (port);
-
- memcpy (&sin.sin_addr, host->h_addr, sizeof (sin.sin_addr));
-
- fd = socket (host->h_addrtype, SOCK_STREAM, 0);
-
- if (fd == -1 || connect (fd, (struct sockaddr *)&sin, sizeof (sin)) == -1) {
- if (fd > -1)
- close (fd);
-
- return -1;
- }
-
- raw->sockfd = fd;
-
- return 0;
-}
-
-
-static int
-get_sockopt_level (const CamelSockOptData *data)
-{
- switch (data->option) {
- case CAMEL_SOCKOPT_MAXSEGMENT:
- case CAMEL_SOCKOPT_NODELAY:
- return IPPROTO_TCP;
- default:
- return SOL_SOCKET;
- }
-}
-
-static int
-get_sockopt_optname (const CamelSockOptData *data)
-{
- switch (data->option) {
- case CAMEL_SOCKOPT_MAXSEGMENT:
- return TCP_MAXSEG;
- case CAMEL_SOCKOPT_NODELAY:
- return TCP_NODELAY;
- case CAMEL_SOCKOPT_BROADCAST:
- return SO_BROADCAST;
- case CAMEL_SOCKOPT_KEEPALIVE:
- return SO_KEEPALIVE;
- case CAMEL_SOCKOPT_LINGER:
- return SO_LINGER;
- case CAMEL_SOCKOPT_RECVBUFFERSIZE:
- return SO_RCVBUF;
- case CAMEL_SOCKOPT_SENDBUFFERSIZE:
- return SO_SNDBUF;
- case CAMEL_SOCKOPT_REUSEADDR:
- return SO_REUSEADDR;
- case CAMEL_SOCKOPT_IPTYPEOFSERVICE:
- return SO_TYPE;
- default:
- return -1;
- }
-}
-
-static int
-stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
-{
- int optname, optlen;
-
- if ((optname = get_sockopt_optname (data)) == -1)
- return -1;
-
- if (data->option == CAMEL_SOCKOPT_NONBLOCKING) {
- int flags;
-
- flags = fcntl (((CamelTcpStreamRaw *)stream)->sockfd, F_GETFL);
- if (flags == -1)
- return -1;
-
- data->value.non_blocking = flags & O_NONBLOCK;
-
- return 0;
- }
-
- return getsockopt (((CamelTcpStreamRaw *)stream)->sockfd,
- get_sockopt_level (data),
- optname,
- (void *) &data->value,
- &optlen);
-}
-
-static int
-stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data)
-{
- int optname;
-
- if ((optname = get_sockopt_optname (data)) == -1)
- return -1;
-
- if (data->option == CAMEL_SOCKOPT_NONBLOCKING) {
- int flags, set;
-
- fcntl (((CamelTcpStreamRaw *)stream)->sockfd, F_GETFL);
- if (flags == -1)
- return -1;
-
- set = data->value.non_blocking ? 1 : 0;
- flags = (flags & ~O_NONBLOCK) | (set & O_NONBLOCK);
-
- if (fcntl (((CamelTcpStreamRaw *)stream)->sockfd, F_SETFL, flags) == -1)
- return -1;
-
- return 0;
- }
-
- return setsockopt (((CamelTcpStreamRaw *)stream)->sockfd,
- get_sockopt_level (data),
- optname,
- (void *) &data->value,
- sizeof (data->value));
-}
diff --git a/camel/camel-tcp-stream-raw.h b/camel/camel-tcp-stream-raw.h
deleted file mode 100644
index 41304efde7..0000000000
--- a/camel/camel-tcp-stream-raw.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#ifndef CAMEL_TCP_STREAM_RAW_H
-#define CAMEL_TCP_STREAM_RAW_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#include <camel/camel-tcp-stream.h>
-
-#define CAMEL_TCP_STREAM_RAW_TYPE (camel_tcp_stream_raw_get_type ())
-#define CAMEL_TCP_STREAM_RAW(obj) (CAMEL_CHECK_CAST((obj), CAMEL_TCP_STREAM_RAW_TYPE, CamelTcpStreamRaw))
-#define CAMEL_TCP_STREAM_RAW_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_TCP_STREAM_RAW_TYPE, CamelTcpStreamRawClass))
-#define CAMEL_IS_TCP_STREAM_RAW(o) (CAMEL_CHECK_TYPE((o), CAMEL_TCP_STREAM_RAW_TYPE))
-
-struct _CamelTcpStreamRaw
-{
- CamelTcpStream parent_object;
-
- int sockfd;
-};
-
-typedef struct {
- CamelTcpStreamClass parent_class;
-
- /* virtual functions */
-
-} CamelTcpStreamRawClass;
-
-/* Standard Camel function */
-CamelType camel_tcp_stream_raw_get_type (void);
-
-/* public methods */
-CamelStream *camel_tcp_stream_raw_new (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_TCP_STREAM_RAW_H */
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
deleted file mode 100644
index 4249e2ea70..0000000000
--- a/camel/camel-tcp-stream-ssl.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#include <config.h>
-#include "camel-tcp-stream-ssl.h"
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-static CamelTcpStreamClass *parent_class = NULL;
-
-/* Returns the class for a CamelTcpStreamSSL */
-#define CTSS_CLASS(so) CAMEL_TCP_STREAM_SSL_CLASS (CAMEL_OBJECT_GET_CLASS (so))
-
-static ssize_t stream_read (CamelStream *stream, char *buffer, size_t n);
-static ssize_t stream_write (CamelStream *stream, const char *buffer, size_t n);
-static int stream_flush (CamelStream *stream);
-static int stream_close (CamelStream *stream);
-
-static int stream_connect (CamelTcpStream *stream, struct hostent *host, int port);
-static int stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data);
-static int stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data);
-
-/* callbacks */
-
-static SECStatus ssl_bad_cert (void *data, PRFileDesc *fd);
-static SECStatus ssl_auth_cert (void *data, PRFileDesc *fd, PRBool checksig, PRBool is_server);
-
-
-static void
-camel_tcp_stream_ssl_class_init (CamelTcpStreamSSLClass *camel_tcp_stream_ssl_class)
-{
- CamelTcpStreamClass *camel_tcp_stream_class =
- CAMEL_TCP_STREAM_CLASS (camel_tcp_stream_ssl_class);
- CamelStreamClass *camel_stream_class =
- CAMEL_STREAM_CLASS (camel_tcp_stream_ssl_class);
-
- parent_class = CAMEL_STREAM_CLASS (camel_type_get_global_classfuncs (camel_tcp_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_tcp_stream_class->connect = stream_connect;
- camel_tcp_stream_class->getsockopt = stream_getsockopt;
- camel_tcp_stream_class->setsockopt = stream_setsockopt;
-}
-
-static void
-camel_tcp_stream_ssl_init (gpointer object, gpointer klass)
-{
- CamelTcpStreamSSL *stream = CAMEL_TCP_STREAM_SSL (object);
-
- stream->sockfd = NULL;
- stream->session = NULL;
- stream->expected_host = NULL;
-}
-
-static void
-camel_tcp_stream_ssl_finalize (CamelObject *object)
-{
- CamelTcpStreamSSL *stream = CAMEL_TCP_STREAM_SSL (object);
-
- if (stream->sockfd != NULL)
- PR_Close (stream->sockfd);
-
- camel_object_unref (CAMEL_OBJECT (stream->session));
- g_free (stream->expected_host);
-}
-
-
-CamelType
-camel_tcp_stream_ssl_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_stream_get_type (),
- "CamelTcpStreamSSL",
- sizeof (CamelTcpStreamSSL),
- sizeof (CamelTcpStreamSSLClass),
- (CamelObjectClassInitFunc) camel_tcp_stream_ssl_class_init,
- NULL,
- (CamelObjectInitFunc) camel_tcp_stream_ssl_init,
- (CamelObjectFinalizeFunc) camel_tcp_stream_ssl_finalize);
- }
-
- return type;
-}
-
-
-/**
- * camel_tcp_stream_ssl_new:
- * @session: camel session
- * @expected_host: host that the stream is expected to connect with.
- *
- * Since the SSL certificate authenticator may need to prompt the
- * user, a CamelSession is needed. #expected_host is needed as a
- * protection against an MITM attack.
- *
- * Return value: a tcp stream
- **/
-CamelStream *
-camel_tcp_stream_ssl_new (CamelSession *session, const char *expected_host)
-{
- CamelTcpStreamSSL *stream;
-
- stream = CAMEL_TCP_STREAM_SSL (camel_object_new (camel_tcp_stream_ssl_get_type ()));
-
- camel_object_ref (CAMEL_OBJECT (session));
- stream->session = session;
- stream->expected_host = g_strdup (expected_host);
-
- return CAMEL_STREAM (stream);
-}
-
-static ssize_t
-stream_read (CamelStream *stream, char *buffer, size_t n)
-{
- CamelTcpStreamSSL *tcp_stream_ssl = CAMEL_TCP_STREAM_SSL (stream);
- ssize_t nread;
-
- do {
- nread = PR_Read (tcp_stream_ssl->sockfd, buffer, n);
- } while (nread == -1 && errno == EINTR);
-
- return nread;
-}
-
-static ssize_t
-stream_write (CamelStream *stream, const char *buffer, size_t n)
-{
- CamelTcpStreamSSL *tcp_stream_ssl = CAMEL_TCP_STREAM_SSL (stream);
- ssize_t v, written = 0;
-
- do {
- v = PR_Write (tcp_stream_ssl->sockfd, buffer, n);
- if (v > 0)
- written += v;
- } while (v == -1 && errno == EINTR);
-
- if (v == -1)
- return -1;
- else
- return written;
-}
-
-static int
-stream_flush (CamelStream *stream)
-{
- return PR_Fsync (((CamelTcpStreamSSL *)stream)->sockfd);
-}
-
-static int
-stream_close (CamelStream *stream)
-{
- if (PR_Close (((CamelTcpStreamSSL *)stream)->sockfd) == PR_Failure)
- return -1;
-
- ((CamelTcpStreamSSL *)stream)->sockfd = NULL;
-
- return 0;
-}
-
-
-static SECStatus
-ssl_auth_cert (void *data, PRFileDesc *fd, PRBool checksig, PRBool is_server)
-{
- return SSL_AuthCertificate (NULL, fd, TRUE, FALSE);
-}
-
-static SECStatus
-ssl_bad_cert (void *data, PRFileDesc *fd)
-{
- CamelSession *session;
- char *string;
- PRInt32 len;
-
- g_return_val_if_fail (data != NULL, SECFailure);
- g_return_val_if_fail (CAMEL_IS_SESSION (data), SECFailure);
-
- /* FIXME: International issues here?? */
- len = PR_GetErrorTextLen (PR_GetError ());
- string = g_malloc0 (len);
- PR_GetErrorText (string);
-
- session = CAMEL_SESSION (data);
- if (camel_session_query_cert_authenticator (session, string))
- return SECSuccess;
-
- return SECFailure;
-}
-
-static int
-stream_connect (CamelTcpStream *stream, struct hostent *host, int port)
-{
- CamelTcpStreamSSL *ssl = CAMEL_TCP_STREAM_SSL (stream);
- PRIntervalTime timeout;
- PRNetAddr netaddr;
- PRFileDesc *fd, *ssl_fd;
-
- g_return_val_if_fail (host != NULL, -1);
-
- memset ((void *) &netaddr, 0, sizeof (PRNetAddr));
- memcpy (&netaddr.inet.ip, host->h_addr, sizeof (netaddr.inet.ip));
-
- if (PR_InitializeNetAddr (PR_IpAddrNull, port, &netaddr) == PR_FAILUE)
- return -1;
-
- fd = PR_OpenTCPSocket (host->h_addrtype);
- ssl_fd = SSL_ImportFD (NULL, fd);
-
- SSL_SetUrl (ssl_fd, ssl->expected_host);
-
- if (ssl_fd == NULL || PR_Connect (ssl_fd, &netaddr, timeout) == PR_FAILURE) {
- if (ssl_fd != NULL)
- PR_Close (ssl_fd);
-
- return -1;
- }
-
- SSL_AuthCertificateHook (ssl_fd, ssl_auth_cert, NULL);
- SSL_BadCertHook (ssl_fd, ssl_bad_cert, ssl->session);
-
- ssl->sockfd = ssl_fd;
-
- return 0;
-}
-
-
-static int
-stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
-{
- PRSocketOptionData sodata;
-
- memset ((void *) &sodata, 0, sizeof (sodata));
- memcpy ((void *) &sodata, (void *) data, sizeof (CamelSockOptData));
-
- if (PR_GetSocketOption (((CamelTcpStreamSSL *)stream)->sockfd, &sodata) == PR_FAILURE)
- return -1;
-
- memcpy ((void *) data, (void *) &sodata, sizeof (CamelSockOptData));
-
- return 0;
-}
-
-static int
-stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data)
-{
- PRSocketOptionData sodata;
-
- memset ((void *) &sodata, 0, sizeof (sodata));
- memcpy ((void *) &sodata, (void *) data, sizeof (CamelSockOptData));
-
- if (PR_SetSocketOption (((CamelTcpStreamRaw *)stream)->sockfd, &sodata) == PR_FAILURE)
- return -1;
-
- return 0;
-}
diff --git a/camel/camel-tcp-stream-ssl.h b/camel/camel-tcp-stream-ssl.h
deleted file mode 100644
index de6eb1a8bc..0000000000
--- a/camel/camel-tcp-stream-ssl.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#ifndef CAMEL_TCP_STREAM_SSL_H
-#define CAMEL_TCP_STREAM_SSL_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#include <camel/camel-tcp-stream.h>
-#include <camel/camel-session.h>
-#include <nspr.h>
-
-#define CAMEL_TCP_STREAM_SSL_TYPE (camel_tcp_stream_ssl_get_type ())
-#define CAMEL_TCP_STREAM_SSL(obj) (CAMEL_CHECK_CAST((obj), CAMEL_TCP_STREAM_SSL_TYPE, CamelTcpStreamSSL))
-#define CAMEL_TCP_STREAM_SSL_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_TCP_STREAM_SSL_TYPE, CamelTcpStreamSSLClass))
-#define CAMEL_IS_TCP_STREAM_SSL(o) (CAMEL_CHECK_TYPE((o), CAMEL_TCP_STREAM_SSL_TYPE))
-
-struct _CamelTcpStreamSSL
-{
- CamelTcpStream parent_object;
-
- PRFileDesc *sockfd;
-
- CamelSession *session;
- char *expected_host;
-};
-
-typedef struct {
- CamelTcpStreamClass parent_class;
-
- /* virtual functions */
-
-} CamelTcpStreamSSLClass;
-
-/* Standard Camel function */
-CamelType camel_tcp_stream_ssl_get_type (void);
-
-/* public methods */
-CamelStream *camel_tcp_stream_ssl_new (CamelSession *session, const char *expected_host);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_TCP_STREAM_SSL_H */
diff --git a/camel/camel-tcp-stream.c b/camel/camel-tcp-stream.c
deleted file mode 100644
index 6edd545a1f..0000000000
--- a/camel/camel-tcp-stream.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#include <config.h>
-
-#include "camel-tcp-stream.h"
-
-static CamelStreamClass *parent_class = NULL;
-
-/* Returns the class for a CamelTcpStream */
-#define CTS_CLASS(so) CAMEL_TCP_STREAM_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static int tcp_connect (CamelTcpStream *stream, struct hostent *host, int port);
-static int tcp_getsockopt (CamelTcpStream *stream, CamelSockOptData *data);
-static int tcp_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data);
-
-static void
-camel_tcp_stream_class_init (CamelTcpStreamClass *camel_tcp_stream_class)
-{
- CamelStreamClass *camel_stream_class =
- CAMEL_STREAM_CLASS (camel_tcp_stream_class);
-
- parent_class = CAMEL_STREAM_CLASS( camel_type_get_global_classfuncs( CAMEL_STREAM_TYPE ) );
-
- /* tcp stream methods */
- camel_tcp_stream_class->connect = tcp_connect;
- camel_tcp_stream_class->getsockopt = tcp_getsockopt;
- camel_tcp_stream_class->setsockopt = tcp_setsockopt;
-}
-
-static void
-camel_tcp_stream_init (void *o)
-{
- ;
-}
-
-CamelType
-camel_tcp_stream_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (CAMEL_STREAM_TYPE,
- "CamelTcpStream",
- sizeof (CamelTcpStream),
- sizeof (CamelTcpStreamClass),
- (CamelObjectClassInitFunc) camel_tcp_stream_class_init,
- NULL,
- (CamelObjectInitFunc) camel_tcp_stream_init,
- NULL);
- }
-
- return type;
-}
-
-
-static int
-tcp_connect (CamelTcpStream *stream, struct hostent *host, int port)
-{
- g_warning ("CamelTcpStream::connect called on default implementation\n");
- return -1;
-}
-
-/**
- * camel_tcp_stream_connect:
- * @stream: a CamelTcpStream object.
- * @host: a hostent value
- * @port: port
- *
- * Create a socket and connect based upon the data provided.
- *
- * Return value: zero on success or -1 on fail.
- **/
-int
-camel_tcp_stream_connect (CamelTcpStream *stream, struct hostent *host, int port)
-{
- g_return_val_if_fail (CAMEL_IS_TCP_STREAM (stream), -1);
-
- return CTS_CLASS (stream)->connect (stream, host, port);
-}
-
-
-static int
-tcp_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
-{
- g_warning ("CamelTcpStream::getsockopt called on default implementation\n");
- return -1;
-}
-
-
-/**
- * camel_tcp_stream_getsockopt:
- * @stream: tcp stream object
- * @data: socket option data
- *
- * Get the socket options set on the stream and populate #data.
- *
- * Return value: zero on success or -1 on fail.
- **/
-int
-camel_tcp_stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
-{
- g_return_val_if_fail (CAMEL_IS_TCP_STREAM (stream), -1);
-
- return CTS_CLASS (stream)->getsockopt (stream, data);
-}
-
-
-static int
-tcp_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data)
-{
- g_warning ("CamelTcpStream::setsockopt called on default implementation\n");
- return -1;
-}
-
-
-/**
- * camel_tcp_stream_setsockopt:
- * @stream: tcp stream object
- * @data: socket option data
- *
- * Set the socket options contained in #data on the stream.
- *
- * Return value: zero on success or -1 on fail.
- **/
-int
-camel_tcp_stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data)
-{
- g_return_val_if_fail (CAMEL_IS_TCP_STREAM (stream), -1);
-
- return CTS_CLASS (stream)->setsockopt (stream, data);
-}
diff --git a/camel/camel-tcp-stream.h b/camel/camel-tcp-stream.h
deleted file mode 100644
index 56afa7a1fd..0000000000
--- a/camel/camel-tcp-stream.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#ifndef CAMEL_TCP_STREAM_H
-#define CAMEL_TCP_STREAM_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-stream.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <unistd.h>
-
-#define CAMEL_TCP_STREAM_TYPE (camel_tcp_stream_get_type ())
-#define CAMEL_TCP_STREAM(obj) (CAMEL_CHECK_CAST((obj), CAMEL_TCP_STREAM_TYPE, CamelTcpStream))
-#define CAMEL_TCP_STREAM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_TCP_STREAM_TYPE, CamelTcpStreamClass))
-#define CAMEL_IS_TCP_STREAM(o) (CAMEL_CHECK_TYPE((o), CAMEL_TCP_STREAM_TYPE))
-
-typedef enum {
- CAMEL_SOCKOPT_NONBLOCKING, /* nonblocking io */
- CAMEL_SOCKOPT_LINGER, /* linger on close if data present */
- CAMEL_SOCKOPT_REUSEADDR, /* allow local address reuse */
- CAMEL_SOCKOPT_KEEPALIVE, /* keep connections alive */
- CAMEL_SOCKOPT_RECVBUFFERSIZE, /* receive buffer size */
- CAMEL_SOCKOPT_SENDBUFFERSIZE, /* send buffer size */
-
- CAMEL_SOCKOPT_IPTIMETOLIVE, /* time to live */
- CAMEL_SOCKOPT_IPTYPEOFSERVICE, /* type of service and precedence */
-
- CAMEL_SOCKOPT_ADDMEMBER, /* add an IP group membership */
- CAMEL_SOCKOPT_DROPMEMBER, /* drop an IP group membership */
- CAMEL_SOCKOPT_MCASTINTERFACE, /* multicast interface address */
- CAMEL_SOCKOPT_MCASTTIMETOLIVE, /* multicast timetolive */
- CAMEL_SOCKOPT_MCASTLOOPBACK, /* multicast loopback */
-
- CAMEL_SOCKOPT_NODELAY, /* don't delay send to coalesce packets */
- CAMEL_SOCKOPT_MAXSEGMENT, /* maximum segment size */
- CAMEL_SOCKOPT_BROADCAST, /* enable broadcast */
- CAMEL_SOCKOPT_LAST
-} CamelSockOpt;
-
-typedef struct linger CamelLinger;
-
-typedef struct _CamelSockOptData {
- CamelSockOpt option;
- union {
- guint ip_ttl; /* IP time to live */
- guint mcast_ttl; /* IP multicast time to live */
- guint tos; /* IP type of service and precedence */
- gboolean non_blocking; /* Non-blocking (network) I/O */
- gboolean reuse_addr; /* Allow local address reuse */
- gboolean keep_alive; /* Keep connections alive */
- gboolean mcast_loopback; /* IP multicast loopback */
- gboolean no_delay; /* Don't delay send to coalesce packets */
- gboolean broadcast; /* Enable broadcast */
- size_t max_segment; /* Maximum segment size */
- size_t recv_buffer_size; /* Receive buffer size */
- size_t send_buffer_size; /* Send buffer size */
- CamelLinger linger; /* Time to linger on close if data present */
- } value;
-} CamelSockOptData;
-
-struct _CamelTcpStream
-{
- CamelStream parent_object;
-
-};
-
-typedef struct {
- CamelStreamClass parent_class;
-
- /* Virtual methods */
- int (*connect) (CamelTcpStream *stream, struct hostent *host, int port);
- int (*getsockopt) (CamelTcpStream *stream, CamelSockOptData *data);
- int (*setsockopt) (CamelTcpStream *stream, const CamelSockOptData *data);
-
-} CamelTcpStreamClass;
-
-/* Standard Camel function */
-CamelType camel_tcp_stream_get_type (void);
-
-/* public methods */
-int camel_tcp_stream_connect (CamelTcpStream *stream, struct hostent *host, int port);
-int camel_tcp_stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data);
-int camel_tcp_stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_TCP_STREAM_H */
diff --git a/camel/camel-transport.c b/camel/camel-transport.c
deleted file mode 100644
index ff07728f5f..0000000000
--- a/camel/camel-transport.c
+++ /dev/null
@@ -1,104 +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 (CAMEL_OBJECT_GET_CLASS(so))
-
-CamelType
-camel_transport_get_type (void)
-{
- static CamelType camel_transport_type = CAMEL_INVALID_TYPE;
-
- if (camel_transport_type == CAMEL_INVALID_TYPE) {
- camel_transport_type = camel_type_register (CAMEL_SERVICE_TYPE, "CamelTransport",
- sizeof (CamelTransport),
- sizeof (CamelTransportClass),
- NULL,
- NULL,
- NULL,
- NULL);
- }
-
- 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 87d3628264..0000000000
--- a/camel/camel-transport.h
+++ /dev/null
@@ -1,87 +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) (CAMEL_CHECK_CAST((obj), CAMEL_TRANSPORT_TYPE, CamelTransport))
-#define CAMEL_TRANSPORT_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_TRANSPORT_TYPE, CamelTransportClass))
-#define CAMEL_IS_TRANSPORT(o) (CAMEL_CHECK_TYPE((o), CAMEL_TRANSPORT_TYPE))
-
-
-struct _CamelTransport
-{
- CamelService parent_object;
-
- gboolean supports_8bit;
-};
-
-
-
-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);
-
-/* FIXME: This should use a camel-address */
-gboolean camel_transport_send_to (CamelTransport *transport,
- CamelMedium *message,
- GList *recipients,
- CamelException *ex);
-
-/* Standard Camel function */
-CamelType 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 8cf64d17ff..0000000000
--- a/camel/camel-types.h
+++ /dev/null
@@ -1,73 +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 _header_content_type CamelContentType;
-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 _CamelMessageContentInfo CamelMessageContentInfo;
-typedef struct _CamelMessageInfo CamelMessageInfo;
-typedef struct _CamelMimeFilter CamelMimeFilter;
-typedef struct _CamelMimeFilterBasic CamelMimeFilterBasic;
-typedef struct _CamelMimeFilterBestenc CamelMimeFilterBestenc;
-typedef struct _CamelMimeFilterCharset CamelMimeFilterCharset;
-typedef struct _CamelMimeFilterIndex CamelMimeFilterIndex;
-typedef struct _CamelMimeFilterLinewrap CamelMimeFilterLinewrap;
-typedef struct _CamelMimeFilterSave CamelMimeFilterSave;
-typedef struct _CamelMimeFilterCRLF CamelMimeFilterCRLF;
-typedef struct _CamelMimeMessage CamelMimeMessage;
-typedef struct _CamelMimeParser CamelMimeParser;
-typedef struct _CamelMimePart CamelMimePart;
-typedef struct _CamelMultipart CamelMultipart;
-typedef struct _CamelNewsAddress CamelNewsAddress;
-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 _CamelStreamNull CamelStreamNull;
-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-uid-cache.c b/camel/camel-uid-cache.c
deleted file mode 100644
index 2b5faddb91..0000000000
--- a/camel/camel-uid-cache.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-uid-cache.c: UID caching code. */
-
-/*
- * Authors:
- * 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-uid-cache.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-static void free_uid (gpointer key, gpointer value, gpointer data);
-static void maybe_write_uid (gpointer key, gpointer value, gpointer data);
-
-/**
- * camel_uid_cache_new:
- * @filename: path to load the cache from
- *
- * Creates a new UID cache, initialized from @filename. If @filename
- * doesn't already exist, the UID cache will be empty. Otherwise, if
- * it does exist but can't be read, the function will return %NULL.
- *
- * Return value: a new UID cache, or %NULL
- **/
-CamelUIDCache *
-camel_uid_cache_new (const char *filename)
-{
- CamelUIDCache *cache;
- struct stat st;
- char *buf, **uids;
- int fd, i;
-
- fd = open (filename, O_RDWR | O_CREAT, 0700);
- if (fd == -1)
- return NULL;
-
- if (fstat (fd, &st) != 0) {
- close (fd);
- return NULL;
- }
- buf = g_malloc (st.st_size + 1);
-
- if (read (fd, buf, st.st_size) == -1) {
- close (fd);
- g_free (buf);
- return NULL;
- }
- buf[st.st_size] = '\0';
-
- cache = g_new (CamelUIDCache, 1);
- cache->fd = fd;
- cache->level = 1;
- cache->uids = g_hash_table_new (g_str_hash, g_str_equal);
-
- uids = g_strsplit (buf, "\n", 0);
- g_free (buf);
- for (i = 0; uids[i]; i++) {
- g_hash_table_insert (cache->uids, uids[i],
- GINT_TO_POINTER (cache->level));
- }
- g_free (uids);
-
- return cache;
-}
-
-/**
- * camel_uid_cache_save:
- * @cache: a CamelUIDCache
- *
- * Attempts to save @cache back to disk.
- *
- * Return value: success or failure
- **/
-gboolean
-camel_uid_cache_save (CamelUIDCache *cache)
-{
- if (lseek (cache->fd, 0, SEEK_SET) != 0)
- return FALSE;
- g_hash_table_foreach (cache->uids, maybe_write_uid, cache);
- return ftruncate (cache->fd, lseek (cache->fd, 0, SEEK_CUR)) == 0;
-}
-
-static void
-maybe_write_uid (gpointer key, gpointer value, gpointer data)
-{
- CamelUIDCache *cache = data;
-
- if (GPOINTER_TO_INT (value) == cache->level) {
- write (cache->fd, key, strlen (key));
- write (cache->fd, "\n", 1);
- }
-}
-
-/**
- * camel_uid_cache_destroy:
- * @cache: a CamelUIDCache
- *
- * Destroys @cache and frees its data.
- **/
-void
-camel_uid_cache_destroy (CamelUIDCache *cache)
-{
- g_hash_table_foreach (cache->uids, free_uid, NULL);
- g_hash_table_destroy (cache->uids);
- close (cache->fd);
- g_free (cache);
-}
-
-static void
-free_uid (gpointer key, gpointer value, gpointer data)
-{
- g_free (key);
-}
-
-/**
- * camel_uid_cache_get_new_uids:
- * @cache: a CamelUIDCache
- * @uids: an array of UIDs
- *
- * Returns an array of UIDs from @uids that are not in @cache, and
- * removes UIDs from @cache that aren't in @uids.
- *
- * Return value: an array of new UIDs, which must be freed with
- * camel_uid_cache_free_uids().
- **/
-GPtrArray *
-camel_uid_cache_get_new_uids (CamelUIDCache *cache, GPtrArray *uids)
-{
- GPtrArray *new_uids;
- char *uid;
- int i;
-
- new_uids = g_ptr_array_new ();
- cache->level++;
-
- for (i = 0; i < uids->len; i++) {
- uid = uids->pdata[i];
- if (g_hash_table_lookup (cache->uids, uid))
- g_hash_table_remove (cache->uids, uid);
- else
- g_ptr_array_add (new_uids, g_strdup (uid));
- g_hash_table_insert (cache->uids, g_strdup (uid),
- GINT_TO_POINTER (cache->level));
- }
-
- return new_uids;
-}
-
-/**
- * camel_uid_cache_free_uids:
- * @uids: an array returned from camel_uid_cache_get_new_uids()
- *
- * Frees the array of UIDs.
- **/
-void
-camel_uid_cache_free_uids (GPtrArray *uids)
-{
- int i;
-
- for (i = 0; i < uids->len; i++)
- g_free (uids->pdata[i]);
- g_ptr_array_free (uids, TRUE);
-}
diff --git a/camel/camel-uid-cache.h b/camel/camel-uid-cache.h
deleted file mode 100644
index 92226a3afd..0000000000
--- a/camel/camel-uid-cache.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-uid-cache.h: UID caching code. */
-
-/*
- * Authors:
- * Bertrand Guiheneuf <bertrand@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_UID_CACHE_H
-#define CAMEL_UID_CACHE_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#include <glib.h>
-#include <stdio.h>
-
-typedef struct {
- int fd, level;
- GHashTable *uids;
-} CamelUIDCache;
-
-CamelUIDCache *camel_uid_cache_new (const char *filename);
-gboolean camel_uid_cache_save (CamelUIDCache *cache);
-void camel_uid_cache_destroy (CamelUIDCache *cache);
-
-GPtrArray *camel_uid_cache_get_new_uids (CamelUIDCache *cache,
- GPtrArray *uids);
-void camel_uid_cache_free_uids (GPtrArray *uids);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* CAMEL_UID_CACHE_H */
diff --git a/camel/camel-url.c b/camel/camel-url.c
deleted file mode 100644
index 9de03dba1e..0000000000
--- a/camel/camel-url.c
+++ /dev/null
@@ -1,373 +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>
- * Jeffrey Stedfast <fejj@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 <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "camel-url.h"
-#include "camel-mime-utils.h"
-#include "camel-exception.h"
-#include "camel-object.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.
- *
- * 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;
-
- g_assert (url_string);
-
- /* 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);
- }
- 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 && *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%s",
- url->protocol,
- host ? "//" : "",
- user ? user : "",
- authmech ? ";auth=" : "",
- authmech ? authmech : "",
- passwd ? ":" : "",
- passwd ? passwd : "",
- user ? "@" : "",
- host ? host : "",
- *port ? ":" : "",
- port,
- path && host && *path != '/' ? "/" : "",
- 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);
-}
-
-void camel_url_set_protocol(CamelURL *url, const char *p)
-{
- g_free(url->protocol);
- url->protocol = g_strdup(p);
-}
-
-void camel_url_set_host(CamelURL *url, const char *h)
-{
- g_free(url->host);
- url->host = g_strdup(h);
-}
-
-void camel_url_set_port(CamelURL *url, int port)
-{
- url->port = port;
-}
-void camel_url_set_path(CamelURL *url, const char *p)
-{
- g_free(url->path);
- url->path = g_strdup(p);
-}
-
-
-/**
- * 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';
-}
-
-static void
-add_hash (guint *hash, char *s)
-{
- if (s)
- *hash ^= g_str_hash(s);
-}
-
-guint camel_url_hash (const void *v)
-{
- const CamelURL *u = v;
- guint hash = 0;
-
- add_hash (&hash, u->protocol);
- add_hash (&hash, u->user);
- add_hash (&hash, u->authmech);
- add_hash (&hash, u->host);
- add_hash (&hash, u->path);
- hash ^= u->port;
-
- return hash;
-}
-
-static int
-check_equal (char *s1, char *s2)
-{
- if (s1 == NULL) {
- if (s2 == NULL)
- return TRUE;
- else
- return FALSE;
- }
-
- if (s2 == NULL)
- return FALSE;
-
- return strcmp (s1, s2) == 0;
-}
-
-int camel_url_equal(const void *v, const void *v2)
-{
- const CamelURL *u1 = v, *u2 = v2;
-
- return check_equal(u1->protocol, u2->protocol)
- && check_equal(u1->user, u2->user)
- && check_equal(u1->authmech, u2->authmech)
- && check_equal(u1->host, u2->host)
- && check_equal(u1->path, u2->path)
- && u1->port == u2->port;
-}
diff --git a/camel/camel-url.h b/camel/camel-url.h
deleted file mode 100644
index 996c4b4e74..0000000000
--- a/camel/camel-url.h
+++ /dev/null
@@ -1,71 +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;
-} 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);
-
-/* for editing url's */
-void camel_url_set_protocol(CamelURL *url, const char *);
-void camel_url_set_host(CamelURL *url, const char *);
-void camel_url_set_port(CamelURL *url, int port);
-void camel_url_set_path(CamelURL *url, const char *);
-
-/* for putting url's into hash tables */
-guint camel_url_hash (const void *v);
-int camel_url_equal(const void *v, const void *v2);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* URL_UTIL_H */
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
deleted file mode 100644
index 9db4294bc7..0000000000
--- a/camel/camel-vee-folder.c
+++ /dev/null
@@ -1,942 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- * Jeffrey Stedfast <fejj@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-store.h"
-#include "camel-folder-summary.h"
-#include "camel-mime-message.h"
-#include "camel-folder-search.h"
-
-#include "camel-vee-store.h" /* for open flags */
-#include "camel-private.h"
-
-#ifdef DOESTRV
-#include "e-util/e-memory.h"
-#endif
-
-#include <string.h>
-
-#define d(x)
-
-/* our message info includes the parent folder */
-typedef struct _CamelVeeMessageInfo {
- CamelMessageInfo info;
- CamelFolder *folder;
-} CamelVeeMessageInfo;
-
-#define _PRIVATE(o) (((CamelVeeFolder *)(o))->priv)
-
-static void vee_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
-static void vee_expunge (CamelFolder *folder, CamelException *ex);
-
-static CamelMimeMessage *vee_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex);
-static void vee_move_message_to(CamelFolder *source, const char *uid, CamelFolder *dest, CamelException *ex);
-
-static GPtrArray *vee_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
-
-static void vee_set_message_flags (CamelFolder *folder, const char *uid, guint32 flags, guint32 set);
-static void vee_set_message_user_flag (CamelFolder *folder, const char *uid, const char *name, gboolean value);
-
-static void camel_vee_folder_class_init (CamelVeeFolderClass *klass);
-static void camel_vee_folder_init (CamelVeeFolder *obj);
-static void camel_vee_folder_finalise (CamelObject *obj);
-
-static void unmatched_finalise(CamelFolder *sub, gpointer type, CamelVeeFolder *vf);
-
-static void folder_changed(CamelFolder *sub, gpointer type, CamelVeeFolder *vf);
-static void message_changed(CamelFolder *f, const char *uid, CamelVeeFolder *vf);
-
-static void vee_folder_build_folder(CamelVeeFolder *vf, CamelFolder *source, CamelException *ex);
-
-static CamelFolderClass *camel_vee_folder_parent;
-
-/* a vfolder for unmatched messages */
-static CamelVeeFolder *folder_unmatched;
-static GHashTable *unmatched_uids;
-#ifdef ENABLE_THREADS
-#include <pthread.h>
-static pthread_mutex_t unmatched_lock = PTHREAD_MUTEX_INITIALIZER;
-#define UNMATCHED_LOCK() pthread_mutex_lock(&unmatched_lock)
-#define UNMATCHED_UNLOCK() pthread_mutex_unlock(&unmatched_lock)
-#else
-#define UNMATCHED_LOCK()
-#define UNMATCHED_UNLOCK()
-#endif
-
-CamelType
-camel_vee_folder_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_folder_get_type (), "CamelVeeFolder",
- sizeof (CamelVeeFolder),
- sizeof (CamelVeeFolderClass),
- (CamelObjectClassInitFunc) camel_vee_folder_class_init,
- NULL,
- (CamelObjectInitFunc) camel_vee_folder_init,
- (CamelObjectFinalizeFunc) camel_vee_folder_finalise);
- }
-
- return type;
-}
-
-static void
-camel_vee_folder_class_init (CamelVeeFolderClass *klass)
-{
- CamelFolderClass *folder_class = (CamelFolderClass *) klass;
-
- camel_vee_folder_parent = CAMEL_FOLDER_CLASS(camel_type_get_global_classfuncs (camel_folder_get_type ()));
-
- folder_class->sync = vee_sync;
- folder_class->expunge = vee_expunge;
-
- folder_class->get_message = vee_get_message;
- folder_class->move_message_to = vee_move_message_to;
-
- folder_class->search_by_expression = vee_search_by_expression;
-
- folder_class->set_message_flags = vee_set_message_flags;
- folder_class->set_message_user_flag = vee_set_message_user_flag;
-}
-
-static void
-camel_vee_folder_init (CamelVeeFolder *obj)
-{
- struct _CamelVeeFolderPrivate *p;
- CamelFolder *folder = (CamelFolder *)obj;
-
- p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
-
- 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;
-
- obj->changes = camel_folder_change_info_new();
- obj->search = camel_folder_search_new();
-
-#ifdef ENABLE_THREADS
- p->summary_lock = g_mutex_new();
- p->subfolder_lock = g_mutex_new();
-#endif
-
-}
-
-static void
-camel_vee_folder_finalise (CamelObject *obj)
-{
- CamelVeeFolder *vf = (CamelVeeFolder *)obj;
- struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
- GList *node;
-
- /* FIXME: some leaks here, summary etc */
-
- node = p->folders;
- while (node) {
- CamelFolder *f = node->data;
- camel_object_unhook_event ((CamelObject *)f, "folder_changed", (CamelObjectEventHookFunc) folder_changed, vf);
- camel_object_unhook_event ((CamelObject *)f, "message_changed", (CamelObjectEventHookFunc) message_changed, vf);
- camel_object_unref((CamelObject *)f);
- node = g_list_next(node);
- }
-
- g_free(vf->expression);
- g_free(vf->vname);
-
- camel_folder_change_info_free(vf->changes);
- camel_object_unref((CamelObject *)vf->search);
-
-#ifdef ENABLE_THREADS
- g_mutex_free(p->summary_lock);
- g_mutex_free(p->subfolder_lock);
-#endif
- g_free(p);
-}
-
-/**
- * camel_vee_folder_new:
- * @parent_store: the parent CamelVeeStore
- * @name: the vfolder name
- * @ex: a CamelException
- *
- * Create a new CamelVeeFolder object.
- *
- * Return value: A new CamelVeeFolder widget.
- **/
-CamelFolder *
-camel_vee_folder_new(CamelStore *parent_store, const char *name, guint32 flags, CamelException *ex)
-{
- CamelFolderInfo *fi;
- CamelFolder *folder;
- CamelVeeFolder *vf;
- 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;
- }
-
- UNMATCHED_LOCK();
-
- if (folder_unmatched == NULL) {
- printf("setting up unmatched folder\n");
- unmatched_uids = g_hash_table_new(g_str_hash, g_str_equal);
-
- folder = (CamelFolder *)camel_object_new(camel_vee_folder_get_type());
- folder_unmatched = vf = (CamelVeeFolder *)folder;
- camel_folder_construct(folder, parent_store, "UNMATCHED", "UNMATCHED");
- folder->summary = camel_folder_summary_new();
- folder->summary->message_info_size = sizeof(CamelVeeMessageInfo);
-
- vf->expression = g_strdup("(header-contains \"subject\" \"--= in =-=-=+ valid , ., .l\")");
- vf->vname = g_strdup("UNMATCHED");
- }
-
- UNMATCHED_UNLOCK();
-
- printf("opening vee folder %s\n", name);
- if (strcmp(namepart, "UNMATCHED") == 0) {
- camel_object_ref((CamelObject *)folder_unmatched);
- g_free(namepart);
- printf("opened UNMATCHED folder %p %s with %d messages\n", folder_unmatched, name, camel_folder_get_message_count((CamelFolder *)folder_unmatched));
- return (CamelFolder *)folder_unmatched;
- }
-
-
- folder = CAMEL_FOLDER (camel_object_new (camel_vee_folder_get_type()));
- vf = (CamelVeeFolder *)folder;
- vf->flags = flags;
-
- /* remove folders as they vanish */
- camel_object_hook_event((CamelObject *)vf, "finalize", (CamelObjectEventHookFunc)unmatched_finalise, folder_unmatched);
-
- camel_folder_construct (folder, parent_store, namepart, namepart);
-
- folder->summary = camel_folder_summary_new();
- folder->summary->message_info_size = sizeof(CamelVeeMessageInfo);
-
- vf->expression = g_strdup(searchpart);
- vf->vname = namepart;
-
- printf("opened normal folder folder %p %s with %d messages\n", folder, name, camel_folder_get_message_count(folder));
-
- /* FIXME: should be moved to store */
- fi = g_new0(CamelFolderInfo, 1);
- fi->full_name = g_strdup(name);
- fi->name = g_strdup(name);
- fi->url = g_strdup_printf("vfolder:%s?%s", vf->vname, vf->expression);
- fi->unread_message_count = -1;
-
- camel_object_trigger_event(CAMEL_OBJECT(parent_store), "folder_created", fi);
- camel_folder_info_free (fi);
-
- return folder;
-}
-
-static CamelVeeMessageInfo * vee_folder_add_uid(CamelVeeFolder *vf, CamelFolder *f, const char *inuid);
-
-/* must be called with summary_lock held */
-static void
-unmatched_uid_remove(const char *uidin, CamelFolder *source)
-{
- char *oldkey, *uid;
- int n;
-
- uid = g_strdup_printf("%p:%s", source, uidin);
-
- /*printf("checking unmatched uid (remove from source) %s\n", uid);*/
-
- UNMATCHED_LOCK();
-
- if (g_hash_table_lookup_extended(unmatched_uids, uid, (void **)&oldkey, (void **)&n)) {
- if (n == 1) {
- /*printf("lost all matches, adding uid to unmatched\n");*/
- if (vee_folder_add_uid(folder_unmatched, source, oldkey))
- camel_folder_change_info_add_uid(folder_unmatched->changes, uid);
- g_hash_table_remove(unmatched_uids, oldkey);
- g_free(oldkey);
- } else
- g_hash_table_insert(unmatched_uids, oldkey, (void *)n-1);
- } else {
- /*printf("unknown uid, adding to unmatched\n");*/
- /* FIXME: lookup to see if we already have it first, to save doing it later */
- if (vee_folder_add_uid(folder_unmatched, source, uidin))
- camel_folder_change_info_add_uid(folder_unmatched->changes, uid);
- }
-
- UNMATCHED_UNLOCK();
-
- g_free(uid);
-}
-
-/* add a uid to the unmatched folder if it is unmatched everywhere else */
-static void
-unmatched_uid_check(const char *uidin, CamelFolder *source)
-{
- char *oldkey, *uid;
- int n;
-
- uid = g_strdup_printf("%p:%s", source, uidin);
-
- /*printf("checking unmatched uid (remove from source) %s\n", uid);*/
-
- UNMATCHED_LOCK();
-
- if (!g_hash_table_lookup_extended(unmatched_uids, uid, (void **)&oldkey, (void **)&n)) {
- /*printf("unknown uid, adding to unmatched\n");*/
- /* FIXME: lookup to see if we already have it first, to save doing it later */
- if (vee_folder_add_uid(folder_unmatched, source, uidin))
- camel_folder_change_info_add_uid(folder_unmatched->changes, uid);
- }
-
- UNMATCHED_UNLOCK();
-
- g_free(uid);
-}
-
-/* must be called with summary_lock held */
-static void
-unmatched_uid_add(const char *uidin, CamelFolder *source)
-{
- char *oldkey, *uid;
- int n;
- CamelMessageInfo *info;
-
- uid = g_strdup_printf("%p:%s", source, uidin);
-
- /*printf("checking unmatched uid (added to source) %s\n", uid);*/
-
- UNMATCHED_LOCK();
-
- info = camel_folder_summary_uid(((CamelFolder *)folder_unmatched)->summary, uid);
- if (info) {
- /*printf("we have it, lets remove it\n");*/
- camel_folder_summary_remove_uid(((CamelFolder *)folder_unmatched)->summary, uid);
- camel_folder_change_info_remove_uid(folder_unmatched->changes, uid);
- camel_folder_summary_info_free(((CamelFolder *)folder_unmatched)->summary, info);
- }
-
- if (g_hash_table_lookup_extended(unmatched_uids, uid, (void **)&oldkey, (void **)&n)) {
- g_hash_table_insert(unmatched_uids, oldkey, (void **)n+1);
- g_free(uid);
- } else
- g_hash_table_insert(unmatched_uids, uid, (void **)1);
-
- UNMATCHED_UNLOCK();
-}
-
-/* must be called with summary_lock held */
-static CamelVeeMessageInfo *
-vee_folder_add(CamelVeeFolder *vf, CamelFolder *f, CamelMessageInfo *info)
-{
- CamelVeeMessageInfo *mi;
- char *uid;
- CamelFolder *folder = (CamelFolder *)vf;
- CamelMessageInfo *dinfo;
-
- uid = g_strdup_printf("%p:%s", f, camel_message_info_uid(info));
- /* FIXME: Has races */
- dinfo = camel_folder_summary_uid(folder->summary, uid);
- if (dinfo) {
- g_free(uid);
- camel_folder_summary_info_free(folder->summary, dinfo);
- return NULL;
- }
-
- mi = (CamelVeeMessageInfo *)camel_folder_summary_info_new(folder->summary);
- camel_message_info_dup_to(info, (CamelMessageInfo *)mi);
-#ifdef DOESTRV
- mi->info.strings = e_strv_set_ref_free(mi->info.strings, CAMEL_MESSAGE_INFO_UID, uid);
- mi->info.strings = e_strv_pack(mi->info.strings);
-#else
- g_free(mi->info.uid);
- mi->info.uid = uid;
-#endif
- mi->folder = f;
- camel_folder_summary_add(folder->summary, (CamelMessageInfo *)mi);
-
- return mi;
-}
-
-/* must be called with summary_lock held */
-static CamelVeeMessageInfo *
-vee_folder_add_uid(CamelVeeFolder *vf, CamelFolder *f, const char *inuid)
-{
- CamelMessageInfo *info;
- CamelVeeMessageInfo *mi = NULL;
-
- info = camel_folder_get_message_info(f, inuid);
- if (info) {
- if ((mi = vee_folder_add(vf, f, info)))
- if (vf != folder_unmatched)
- unmatched_uid_add(inuid, f);
-
- camel_folder_free_message_info(f, info);
- }
- return mi;
-}
-
-/* must be called with summary_lock held */
-static void
-vfolder_remove_match(CamelVeeFolder *vf, CamelVeeMessageInfo *vinfo)
-{
- const char *uid = camel_message_info_uid(vinfo);
-
- printf("removing match %s\n", uid);
-
- unmatched_uid_remove(strchr(uid, ':'), vinfo->folder);
-
- camel_folder_change_info_remove_uid(vf->changes, uid);
- camel_folder_summary_remove(((CamelFolder *)vf)->summary, (CamelMessageInfo *)vinfo);
-}
-
-/* must be called with summary_lock held */
-static CamelVeeMessageInfo *
-vee_folder_add_change(CamelVeeFolder *vf, CamelFolder *f, CamelMessageInfo *info)
-{
- CamelVeeMessageInfo *mi = NULL;
-
- mi = vee_folder_add(vf, f, info);
- if (mi) {
- unmatched_uid_add(camel_message_info_uid(info), f);
-
- camel_folder_change_info_add_uid(vf->changes, camel_message_info_uid(mi));
- }
-
- return mi;
-}
-
-/* must be called with summary_lock held */
-static void
-vfolder_change_match(CamelVeeFolder *vf, CamelVeeMessageInfo *vinfo, const CamelMessageInfo *info)
-{
- CamelFlag *flag;
- CamelTag *tag;
-
- d(printf("changing match %s\n", camel_message_info_uid(vinfo)));
-
- vinfo->info.flags = info->flags;
- camel_flag_list_free(&vinfo->info.user_flags);
- flag = info->user_flags;
- while (flag) {
- camel_flag_set(&vinfo->info.user_flags, flag->name, TRUE);
- flag = flag->next;
- }
- camel_tag_list_free(&vinfo->info.user_tags);
- tag = info->user_tags;
- while (tag) {
- camel_tag_set(&vinfo->info.user_tags, tag->name, tag->value);
- tag = tag->next;
- }
- camel_folder_change_info_change_uid(vf->changes, camel_message_info_uid(vinfo));
-}
-
-/* track changes to the unmatched folders */
-static void
-unmatched_finalise(CamelFolder *sub, gpointer type, CamelVeeFolder *vf)
-{
- int count, i;
-
- CAMEL_VEE_FOLDER_LOCK(vf, summary_lock);
- UNMATCHED_LOCK();
-
- count = camel_folder_summary_count(((CamelFolder *)folder_unmatched)->summary);
- for (i=0;i<count;i++) {
- CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)camel_folder_summary_index(((CamelFolder *)folder_unmatched)->summary, i);
- const char *uid;
- char *oldkey;
- int n;
-
- if (mi) {
- uid = camel_message_info_uid(mi);
- if (mi->folder == sub) {
- if (g_hash_table_lookup_extended(unmatched_uids, uid, (void **)&oldkey, (void **)&n)) {
- if (n == 1)
- g_hash_table_remove(unmatched_uids, oldkey);
- else
- camel_folder_change_info_remove_uid(folder_unmatched->changes, uid);
- }
- camel_folder_summary_remove(((CamelFolder *)folder_unmatched)->summary, (CamelMessageInfo *)mi);
- i--;
- }
- camel_folder_summary_info_free(((CamelFolder *)folder_unmatched)->summary, (CamelMessageInfo *)mi);
- }
- }
-
- if (camel_folder_change_info_changed(folder_unmatched->changes)) {
- camel_object_trigger_event((CamelObject *)folder_unmatched, "folder_changed", folder_unmatched->changes);
- camel_folder_change_info_clear(folder_unmatched->changes);
- }
-
- UNMATCHED_UNLOCK();
- CAMEL_VEE_FOLDER_UNLOCK(vf, summary_lock);
-}
-
-/* FIXME: This code is a big race, as it is never called locked ... */
-
-static void
-folder_changed(CamelFolder *sub, gpointer type, CamelVeeFolder *vf)
-{
- CamelFolderChangeInfo *changes = type;
- CamelFolder *folder = (CamelFolder *)vf;
- char *vuid;
- CamelVeeMessageInfo *vinfo;
- int i;
- CamelMessageInfo *info;
-
- printf("folder_changed(%p, %p) (for %s)\n", sub, vf, vf->expression);
-
- /* if not auto-updating, only propagate changed events, not added/removed items */
- if ((vf->flags & CAMEL_STORE_VEE_FOLDER_AUTO) == 0) {
- CAMEL_VEE_FOLDER_LOCK(vf, summary_lock);
-
- for (i=0;i<changes->uid_changed->len;i++) {
- info = camel_folder_get_message_info(sub, changes->uid_changed->pdata[i]);
- vuid = g_strdup_printf("%p:%s", sub, (char *)changes->uid_changed->pdata[i]);
- vinfo = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, vuid);
- if (vinfo && info)
- vfolder_change_match(vf, vinfo, info);
-
- g_free(vuid);
-
- if (info)
- camel_folder_free_message_info(sub, info);
- if (vinfo)
- camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)vinfo);
- }
-
- if (camel_folder_change_info_changed(vf->changes)) {
- camel_object_trigger_event((CamelObject *)vf, "folder_changed", vf->changes);
- camel_folder_change_info_clear(vf->changes);
- }
-
- CAMEL_VEE_FOLDER_UNLOCK(vf, summary_lock);
-
- return;
- }
-
- /* if we are autoupdating, then do the magic */
-
- /* assume its faster to search a long list in whole, than by part */
- if (changes && (changes->uid_added->len + changes->uid_changed->len) < 500) {
- gboolean match;
-
- /* FIXME: We dont search body contents with this search, so, it isn't as
- useful as it might be.
- We shold probably just perform a whole search if we need to, i.e. there
- are added items. Changed items we are unlikely to want to remove immediately
- anyway, although I guess it might be useful.
- Removed items can always just be removed.
- */
-
- /* see if added ones now match us */
- for (i=0;i<changes->uid_added->len;i++) {
- printf("checking new uid: %s\n", (char *)changes->uid_added->pdata[i]);
- info = camel_folder_get_message_info(sub, changes->uid_added->pdata[i]);
- if (info) {
- printf("uid ok, subject: %s\n", camel_message_info_subject(info));
- camel_folder_search_set_folder(vf->search, sub);
- match = camel_folder_search_match_expression(vf->search, vf->expression, info, NULL);
- if (match)
- vinfo = vee_folder_add_change(vf, sub, info);
- camel_folder_free_message_info(sub, info);
- }
- }
-
- /* check if changed ones still match */
- for (i=0;i<changes->uid_changed->len;i++) {
- info = camel_folder_get_message_info(sub, changes->uid_changed->pdata[i]);
- vuid = g_strdup_printf("%p:%s", sub, (char *)changes->uid_changed->pdata[i]);
- vinfo = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, vuid);
- if (info) {
- camel_folder_search_set_folder(vf->search, sub);
- match = camel_folder_search_match_expression(vf->search, vf->expression, info, NULL);
- if (vinfo) {
- if (!match)
- vfolder_remove_match(vf, vinfo);
- else
- vfolder_change_match(vf, vinfo, info);
- } else if (match)
- vee_folder_add_change(vf, sub, info);
- camel_folder_free_message_info(sub, info);
- } else if (vinfo)
- vfolder_remove_match(vf, vinfo);
-
- if (vinfo)
- camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)vinfo);
-
- g_free(vuid);
- }
-
- /* mirror removes directly, if they used to match */
- for (i=0;i<changes->uid_removed->len;i++) {
- vuid = g_strdup_printf("%p:%s", sub, (char *)changes->uid_removed->pdata[i]);
- vinfo = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, vuid);
- if (vinfo) {
- vfolder_remove_match(vf, vinfo);
- camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)vinfo);
- }
- g_free(vuid);
- }
- } else {
- vee_folder_build_folder(vf, sub, NULL);
- }
-
- /* cascade up, if we need to */
- if (camel_folder_change_info_changed(vf->changes)) {
- printf("got folder changes\n");
- camel_object_trigger_event( CAMEL_OBJECT(vf), "folder_changed", vf->changes);
- camel_folder_change_info_clear(vf->changes);
- } else
- printf("no, we didn't really get any changes\n");
-
- CAMEL_VEE_FOLDER_UNLOCK(vf, summary_lock);
-
- UNMATCHED_LOCK();
-
- if (camel_folder_change_info_changed(folder_unmatched->changes)) {
- camel_object_trigger_event((CamelObject *)folder_unmatched, "folder_changed", folder_unmatched->changes);
- camel_folder_change_info_clear(folder_unmatched->changes);
- }
-
- UNMATCHED_UNLOCK();
-}
-
-/* FIXME: This code is a race, as it is never called locked */
-
-/* track flag changes in the summary */
-static void
-message_changed(CamelFolder *f, const char *uid, CamelVeeFolder *vf)
-{
- CamelMessageInfo *info;
- CamelVeeMessageInfo *vinfo;
- char *vuid;
- CamelFolder *folder = (CamelFolder *)vf;
- gboolean match;
-
- CAMEL_VEE_FOLDER_LOCK(vf, summary_lock);
-
- info = camel_folder_get_message_info(f, uid);
- vuid = g_strdup_printf("%p:%s", f, uid);
- vinfo = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, vuid);
-
- /* see if this message now matches/doesn't match anymore */
-
- /* Hmm, this might not work if the folder uses some weird search thing,
- and/or can be slow since it wont use any index index, hmmm. */
-
- if (vf->flags & CAMEL_STORE_VEE_FOLDER_AUTO) {
- camel_folder_search_set_folder(vf->search, f);
-
- match = camel_folder_search_match_expression(vf->search, vf->expression, info, NULL);
-
- if (info) {
- if (vinfo) {
- if (!match)
- vfolder_remove_match(vf, vinfo);
- else
- vfolder_change_match(vf, vinfo, info);
- }
- else if (match)
- vee_folder_add_change(vf, f, info);
- } else if (vinfo)
- vfolder_remove_match(vf, vinfo);
- } else {
- if (info && vinfo)
- vfolder_change_match(vf, vinfo, info);
- }
-
- if (info)
- camel_folder_free_message_info(f, info);
- if (vinfo)
- camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)vinfo);
-
- /* cascade up, if required. This could probably be delayed,
- but doesn't matter really, that is what freeze is for. */
- if (camel_folder_change_info_changed(vf->changes)) {
- camel_object_trigger_event( CAMEL_OBJECT(vf), "folder_changed", vf->changes);
- camel_folder_change_info_clear(vf->changes);
- }
-
- CAMEL_VEE_FOLDER_UNLOCK(vf, summary_lock);
-
- UNMATCHED_LOCK();
-
- if (camel_folder_change_info_changed(folder_unmatched->changes)) {
- camel_object_trigger_event((CamelObject *)folder_unmatched, "folder_changed", folder_unmatched->changes);
- camel_folder_change_info_clear(folder_unmatched->changes);
- }
-
- UNMATCHED_UNLOCK();
-
- g_free(vuid);
-}
-
-void
-camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub)
-{
- struct _CamelVeeFolderPrivate *p = _PRIVATE(vf), *up = _PRIVATE(folder_unmatched);
-
- camel_object_ref((CamelObject *)sub);
-
- CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
-
- /* the reference is shared with both the real vfolder and the unmatched vfolder */
- p->folders = g_list_append(p->folders, sub);
- up->folders = g_list_append(up->folders, sub);
-
- CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
-
- printf("camel_vee_folder_add_folde(%p, %p)\n", vf, sub);
-
- camel_object_hook_event((CamelObject *)sub, "folder_changed", (CamelObjectEventHookFunc)folder_changed, vf);
- camel_object_hook_event((CamelObject *)sub, "message_changed", (CamelObjectEventHookFunc)message_changed, vf);
-
- CAMEL_VEE_FOLDER_LOCK(vf, summary_lock);
-
- vee_folder_build_folder(vf, sub, NULL);
-
- /* we'll assume the caller is going to update the whole list after they do this
- this may or may not be the right thing to do, but it should be close enough */
- camel_folder_change_info_clear(vf->changes);
-
- CAMEL_VEE_FOLDER_UNLOCK(vf, summary_lock);
-}
-
-static void
-vee_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- CamelVeeFolder *vf = (CamelVeeFolder *)folder;
- struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
- GList *node;
-
- CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
-
- node = p->folders;
- while (node) {
- CamelFolder *f = node->data;
-
- camel_folder_sync(f, expunge, ex);
- if (camel_exception_is_set(ex))
- break;
-
- node = node->next;
- }
-
- CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
-}
-
-static void
-vee_expunge (CamelFolder *folder, CamelException *ex)
-{
- CamelVeeFolder *vf = (CamelVeeFolder *)folder;
- struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
- GList *node;
-
- CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
-
- node = p->folders;
- while (node) {
- CamelFolder *f = node->data;
-
- camel_folder_expunge(f, ex);
- if (camel_exception_is_set(ex))
- break;
- vee_folder_build_folder(vf, f, ex);
- if (camel_exception_is_set(ex))
- break;
-
- node = node->next;
- }
-
- CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
-}
-
-static CamelMimeMessage *vee_get_message(CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelVeeMessageInfo *mi;
- CamelMimeMessage *msg = NULL;
-
- mi = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, uid);
- if (mi) {
- msg = camel_folder_get_message(mi->folder, strchr(camel_message_info_uid(mi), ':') + 1, ex);
- camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)mi);
- } else {
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- "No such message %s in %s", uid,
- folder->name);
- }
-
- return msg;
-}
-
-static GPtrArray *
-vee_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex)
-{
- GList *node;
- GPtrArray *matches, *result = g_ptr_array_new ();
- char *expr;
- CamelVeeFolder *vf = (CamelVeeFolder *)folder;
- struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
-
- CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
-
- expr = g_strdup_printf("(and %s %s)", vf->expression, expression);
- node = p->folders;
- while (node) {
- CamelFolder *f = node->data;
- int i;
-
- matches = camel_folder_search_by_expression(f, expression, ex);
- for (i = 0; i < matches->len; i++) {
- char *uid = matches->pdata[i];
- g_ptr_array_add(result, g_strdup_printf("%p:%s", f, uid));
- }
- camel_folder_search_free(f, matches);
- node = g_list_next(node);
- }
-
- CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
-
- return result;
-}
-
-static void
-vee_set_message_flags(CamelFolder *folder, const char *uid, guint32 flags, guint32 set)
-{
- CamelVeeMessageInfo *mi;
-
- mi = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, uid);
- if (mi) {
- ((CamelFolderClass *)camel_vee_folder_parent)->set_message_flags(folder, uid, flags, set);
- camel_folder_set_message_flags(mi->folder, strchr(camel_message_info_uid(mi), ':') + 1, flags, set);
- camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)mi);
- }
-}
-
-static void
-vee_set_message_user_flag(CamelFolder *folder, const char *uid, const char *name, gboolean value)
-{
- CamelVeeMessageInfo *mi;
-
- mi = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, uid);
- if (mi) {
- ((CamelFolderClass *)camel_vee_folder_parent)->set_message_user_flag(folder, uid, name, value);
- camel_folder_set_message_user_flag(mi->folder, strchr(camel_message_info_uid(mi), ':') + 1, name, value);
- camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)mi);
- }
-}
-
-static void
-vee_move_message_to(CamelFolder *folder, const char *uid, CamelFolder *dest, CamelException *ex)
-{
- CamelVeeMessageInfo *mi;
-
- mi = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, uid);
- if (mi) {
- /* noop if it we're moving from the same vfolder (uh, which should't happen but who knows) */
- if (folder != mi->folder) {
- camel_folder_move_message_to(mi->folder, strchr(camel_message_info_uid(mi), ':')+1, dest, ex);
- }
- camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)mi);
- } else {
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("No such message: %s"), uid);
- }
-}
-
-static void
-removed_uid(void *key, void *value, void *data)
-{
- unmatched_uid_check(key, data);
-}
-
-/* build query contents for a single folder */
-/* must have summary_lock held when calling */
-static void
-vee_folder_build_folder(CamelVeeFolder *vf, CamelFolder *source, CamelException *ex)
-{
- GPtrArray *matches, *all;
- GHashTable *left;
- CamelFolder *f = source;
- CamelVeeMessageInfo *mi;
- CamelFolder *folder = (CamelFolder *)vf;
- int i;
- int count;
-
- left = g_hash_table_new(g_str_hash, g_str_equal);
- all = camel_folder_get_uids(f);
- for (i=0;i<all->len;i++)
- g_hash_table_insert(left, all->pdata[i], (void *)1);
-
- count = camel_folder_summary_count(folder->summary);
- for (i=0;i<count;i++) {
- CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)camel_folder_summary_index(folder->summary, i);
- if (mi) {
- if (mi->folder == source) {
- camel_folder_change_info_add_source(vf->changes, camel_message_info_uid(mi));
- camel_folder_summary_remove(folder->summary, (CamelMessageInfo *)mi);
- unmatched_uid_remove(camel_message_info_uid(mi), source);
- i--;
- }
- camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)mi);
- }
- }
-
- matches = camel_folder_search_by_expression(f, vf->expression, ex);
- for (i = 0; i < matches->len; i++) {
- g_hash_table_remove(left, matches->pdata[i]);
- mi = vee_folder_add_uid(vf, f, matches->pdata[i]);
- if (mi)
- camel_folder_change_info_add_update(vf->changes, camel_message_info_uid(mi));
- }
-
- /* check if we have a match for these in another vfolder, else add them to the UNMATCHED folder */
- g_hash_table_foreach(left, removed_uid, source);
- g_hash_table_destroy(left);
- camel_folder_search_free(f, matches);
- camel_folder_free_uids(f, all);
-
- camel_folder_change_info_build_diff(vf->changes);
- camel_folder_change_info_build_diff(folder_unmatched->changes);
-
- if (camel_folder_change_info_changed(folder_unmatched->changes)) {
- camel_object_trigger_event((CamelObject *)folder_unmatched, "folder_changed", folder_unmatched->changes);
- camel_folder_change_info_clear(folder_unmatched->changes);
- }
-}
-
-/*
-
- (match-folder "folder1" "folder2")
-
- */
diff --git a/camel/camel-vee-folder.h b/camel/camel-vee-folder.h
deleted file mode 100644
index 6ae685a8fe..0000000000
--- a/camel/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 <camel/camel-folder.h>
-
-#define CAMEL_VEE_FOLDER(obj) CAMEL_CHECK_CAST (obj, camel_vee_folder_get_type (), CamelVeeFolder)
-#define CAMEL_VEE_FOLDER_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_vee_folder_get_type (), CamelVeeFolderClass)
-#define CAMEL_IS_VEE_FOLDER(obj) CAMEL_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 */
-
- guint32 flags; /* folder open flags */
-
- CamelFolderChangeInfo *changes;
- CamelFolderSearch *search;
-};
-
-struct _CamelVeeFolderClass {
- CamelFolderClass parent_class;
-};
-
-guint camel_vee_folder_get_type (void);
-CamelFolder *camel_vee_folder_new (CamelStore *parent_store, const char *name, guint32 flags, CamelException *ex);
-
-void camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub);
-
-#endif /* ! _CAMEL_VEE_FOLDER_H */
diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c
deleted file mode 100644
index 38d535dbee..0000000000
--- a/camel/camel-vee-store.c
+++ /dev/null
@@ -1,110 +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, guint32 flags, CamelException *ex);
-static void vee_init_trash (CamelStore *store);
-static CamelFolder *vee_get_trash (CamelStore *store, 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 CamelStoreClass *camel_vee_store_parent;
-
-CamelType
-camel_vee_store_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register (camel_store_get_type (), "CamelVeeStore",
- sizeof (CamelVeeStore),
- sizeof (CamelVeeStoreClass),
- (CamelObjectClassInitFunc) camel_vee_store_class_init,
- NULL,
- (CamelObjectInitFunc) camel_vee_store_init,
- NULL);
- }
-
- return type;
-}
-
-static void
-
-camel_vee_store_class_init (CamelVeeStoreClass *klass)
-{
- CamelStoreClass *store_class = (CamelStoreClass *) klass;
-
- camel_vee_store_parent = CAMEL_STORE_CLASS(camel_type_get_global_classfuncs (camel_store_get_type ()));
-
- /* virtual method overload */
- store_class->get_folder = vee_get_folder;
- store_class->init_trash = vee_init_trash;
- store_class->get_trash = vee_get_trash;
-}
-
-static void
-camel_vee_store_init (CamelVeeStore *obj)
-{
- struct _CamelVeeStorePrivate *p;
-
- p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
-}
-
-/**
- * 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 ( camel_object_new (camel_vee_store_get_type ()));
- return new;
-}
-
-static CamelFolder *
-vee_get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex)
-{
- return camel_vee_folder_new(store, folder_name, flags, ex);
-}
-
-static void
-vee_init_trash (CamelStore *store)
-{
- /* no-op */
- ;
-}
-
-static CamelFolder *
-vee_get_trash (CamelStore *store, CamelException *ex)
-{
- return NULL;
-}
diff --git a/camel/camel-vee-store.h b/camel/camel-vee-store.h
deleted file mode 100644
index ff3d548180..0000000000
--- a/camel/camel-vee-store.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_VEE_STORE_H
-#define _CAMEL_VEE_STORE_H
-
-#include <camel/camel-store.h>
-
-#define CAMEL_VEE_STORE(obj) CAMEL_CHECK_CAST (obj, camel_vee_store_get_type (), CamelVeeStore)
-#define CAMEL_VEE_STORE_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_vee_store_get_type (), CamelVeeStoreClass)
-#define CAMEL_IS_VEE_STORE(obj) CAMEL_CHECK_TYPE (obj, camel_vee_store_get_type ())
-
-typedef struct _CamelVeeStore CamelVeeStore;
-typedef struct _CamelVeeStoreClass CamelVeeStoreClass;
-
-/* open mode for folder, vee folder auto-update */
-#define CAMEL_STORE_VEE_FOLDER_AUTO (1<<16)
-
-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/camel.c b/camel/camel.c
deleted file mode 100644
index 5383c4d32a..0000000000
--- a/camel/camel.c
+++ /dev/null
@@ -1,88 +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>
-
-gboolean camel_verbose_debug = FALSE;
-
-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 */
-
- if (getenv ("CAMEL_VERBOSE_DEBUG"))
- camel_verbose_debug = TRUE;
-
- unicode_init ();
-
- return 0;
-}
-
-#ifdef U_CANT_TOUCH_THIS
-#include <ssl.h>
-#include <nss.h>
-
-gint
-camel_ssl_init (char *configdir, gboolean nss_init)
-{
-#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 */
-
- if (getenv ("CAMEL_VERBOSE_DEBUG"))
- camel_verbose_debug = TRUE;
-
- unicode_init ();
-
- if (nss_init) {
- PR_init ();
-
- if (NSS_init (configdir) == SECFailure)
- return -1;
-
- /* FIXME: Erm, use appropriate policy? */
- NSS_SetDomesticPolicy ();
- }
-
- SSL_OptionSetDefault (SSL_ENABLE_SSL2, PR_TRUE);
- SSL_OptionSetDefault (SSL_ENABLE_SSL3, PR_TRUE);
- SSL_OptionSetDefault (SSL_ENABLE_TLS, PR_TRUE);
- SSL_OptionSetDefault (SSL_V2_COMPATIBLE_HELLO, PR_TRUE /* maybe? */);
-
- return 0;
-}
-#endif
diff --git a/camel/camel.h b/camel/camel.h
deleted file mode 100644
index 6de1ae6462..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-crlf.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-uid-cache.h>
-#include <camel/camel-url.h>
-#include <camel/gstring-util.h>
-#include <camel/hash-table-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_data_wrapper.dia b/camel/devel-docs/camel_data_wrapper.dia
deleted file mode 100644
index 301563d1ee..0000000000
--- a/camel/devel-docs/camel_data_wrapper.dia
+++ /dev/null
Binary files differ
diff --git a/camel/devel-docs/camel_parser_states.dia b/camel/devel-docs/camel_parser_states.dia
deleted file mode 100644
index 556a5b1c49..0000000000
--- a/camel/devel-docs/camel_parser_states.dia
+++ /dev/null
Binary files differ
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/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/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/Makefile.am b/camel/providers/Makefile.am
deleted file mode 100644
index 5fd7c83e50..0000000000
--- a/camel/providers/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-if ENABLE_NNTP
-NNTP_DIR=nntp
-endif
-
-# SUBDIRS = mbox pop3 sendmail smtp vee
-SUBDIRS = pop3 sendmail smtp imap $(NNTP_DIR) local
-
-# these ones are deprecated, and will no longer be maintained
-# mbox mh maildir vee \ No newline at end of file
diff --git a/camel/providers/cache/.cvsignore b/camel/providers/cache/.cvsignore
deleted file mode 100644
index 3fa8afaa38..0000000000
--- a/camel/providers/cache/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
-*.bb
-*.bbg
-*.da
-*.gcov
diff --git a/camel/providers/cache/Makefile.am b/camel/providers/cache/Makefile.am
deleted file mode 100644
index 7f9f6a9df5..0000000000
--- a/camel/providers/cache/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelcacheincludedir = $(includedir)/camel
-
-providerdir = $(pkglibdir)/camel-providers/$(VERSION)
-
-provider_LTLIBRARIES = libcamelcache.la
-provider_DATA = libcamelcache.urls
-
-INCLUDES = \
- -I.. \
- -I$(srcdir)/.. \
- -I$(srcdir)/../../.. \
- -I$(includedir) \
- -I$(top_srcdir)/intl \
- $(GTK_INCLUDEDIR) \
- -I$(top_srcdir)/camel \
- -DG_LOG_DOMAIN=\"camel-cache-provider\"
-
-libcamelcache_la_SOURCES = \
- camel-cache-folder.c \
- camel-cache-provider.c \
- camel-cache-store.c \
- camel-cache-map.c
-
-libcamelcacheinclude_HEADERS = \
- camel-cache-folder.h \
- camel-cache-store.h
-
-
-libcamelcache_la_LDFLAGS = -version-info 0:0:0
-
-EXTRA_DIST = libcamelcache.urls
diff --git a/camel/providers/cache/camel-cache-folder.c b/camel/providers/cache/camel-cache-folder.c
deleted file mode 100644
index c4379f8135..0000000000
--- a/camel/providers/cache/camel-cache-folder.c
+++ /dev/null
@@ -1,810 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-cache-folder.c : class for a cache 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
- */
-
-
-/*
- * Notes on the cache provider:
- *
- * We require that the remote folder have persistent UIDs, and nothing
- * else. We require that the local store folder have persistent UIDs
- * and summary capability.
- *
- * If the remote folder does not have summary capability, we will need
- * to sync any new messages over to the local folder when the folder
- * is opened or when it changes. If the remote folder does have
- * summary capability, we can be more relaxed about doing this.
- *
- * If the remote folder has search capability, we will use it, at
- * least when the folder isn't synced. Otherwise if the local folder
- * has search capability, we will use that (but it will require
- * syncing the remote folder locally to use). Otherwise the cache
- * folder won't have search capability.
- *
- * CamelCacheFolder UIDs are remote UIDs, because we need to be able
- * to return a complete list of them at get_uids time, and the
- * messages might not all be present in the local folder, and we can't
- * predict what UIDs will be assigned to them when they are cached
- * there. We keep hash tables mapping remote to local UIDs and vice
- * versa, and a map file to cache this information between sessions.
- * The maps must always be 100% accurate.
- *
- * The messages in the local folder may not be in the same order as
- * the messages in the remote folder.
- *
- *
- * Many operations on the local folder are done with a NULL
- * CamelException, because having them fail only results in efficiency
- * problems, not actual permanent failures. (Eg, get_message will
- * try to append the message to the local folder, but doesn't check
- * for failure, because it already has the message to pass back to the
- * user.)
- */
-
-#include "camel-cache-folder.h"
-#include "camel-cache-store.h"
-#include <camel/camel-exception.h>
-#include <camel/camel-medium.h>
-
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-static CamelFolderClass *folder_class = NULL;
-
-static void init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar *separator, gboolean path_begins_with_sep,
- CamelException *ex);
-
-static void refresh_info (CamelFolder *folder, CamelException *ex);
-
-static void cache_sync (CamelFolder *folder, gboolean expunge,
- CamelException *ex);
-
-static void expunge (CamelFolder *folder, CamelException *ex);
-
-static gint get_message_count (CamelFolder *folder);
-
-static void append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex);
-
-static guint32 get_message_flags (CamelFolder *folder, const char *uid);
-static void set_message_flags (CamelFolder *folder, const char *uid,
- guint32 flags, guint32 set);
-static gboolean get_message_user_flag (CamelFolder *folder, const char *uid,
- const char *name);
-static void set_message_user_flag (CamelFolder *folder, const char *uid,
- const char *name, gboolean value);
-static const char *get_message_user_tag (CamelFolder *folder, const char *uid,
- const char *name);
-static void set_message_user_tag (CamelFolder *folder, const char *uid,
- const char *name, const char *value);
-
-static CamelMimeMessage *get_message (CamelFolder *folder,
- const gchar *uid,
- CamelException *ex);
-
-static GPtrArray *get_uids (CamelFolder *folder);
-static GPtrArray *get_summary (CamelFolder *folder);
-static GPtrArray *get_subfolder_names (CamelFolder *folder);
-static void free_subfolder_names (CamelFolder *folder, GPtrArray *subfolders);
-
-static GPtrArray *search_by_expression (CamelFolder *folder,
- const char *expression,
- CamelException *ex);
-
-static const CamelMessageInfo *get_message_info (CamelFolder *folder,
- const char *uid);
-
-static void copy_message_to (CamelFolder *source, const char *uid,
- CamelFolder *destination, CamelException *ex);
-
-static void move_message_to (CamelFolder *source, const char *uid,
- CamelFolder *destination, CamelException *ex);
-
-static void finalize (CamelObject *object);
-
-static void
-camel_cache_folder_class_init (CamelCacheFolderClass *camel_cache_folder_class)
-{
- CamelFolderClass *camel_folder_class =
- CAMEL_FOLDER_CLASS (camel_cache_folder_class);
-
- folder_class = CAMEL_FOLDER_CLASS (camel_type_get_global_classfuncs (camel_folder_get_type ()));
-
- /* virtual method overload */
- camel_folder_class->init = init;
- camel_folder_class->refresh_info = refresh_info;
- camel_folder_class->sync = cache_sync;
- 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_message_flags = get_message_flags;
- camel_folder_class->set_message_flags = set_message_flags;
- camel_folder_class->get_message_user_flag = get_message_user_flag;
- camel_folder_class->set_message_user_flag = set_message_user_flag;
- camel_folder_class->get_message_user_tag = get_message_user_tag;
- camel_folder_class->set_message_user_tag = set_message_user_tag;
- camel_folder_class->get_message = get_message;
- camel_folder_class->get_uids = get_uids;
- camel_folder_class->free_uids = camel_folder_free_nop;
- camel_folder_class->get_summary = get_summary;
- camel_folder_class->free_summary = camel_folder_free_nop;
- camel_folder_class->get_subfolder_names = get_subfolder_names;
- camel_folder_class->free_subfolder_names = free_subfolder_names;
- camel_folder_class->search_by_expression = search_by_expression;
- camel_folder_class->get_message_info = get_message_info;
- camel_folder_class->copy_message_to = copy_message_to;
- camel_folder_class->move_message_to = move_message_to;
-}
-
-CamelType
-camel_cache_folder_get_type (void)
-{
- static CamelType camel_cache_folder_type = CAMEL_INVALID_TYPE;
-
- if (camel_cache_folder_type == CAMEL_INVALID_TYPE) {
- camel_cache_folder_type = camel_type_register (
- CAMEL_FOLDER_TYPE, "CamelCacheFolder",
- sizeof (CamelCacheFolder),
- sizeof (CamelCacheFolderClass),
- (CamelObjectClassInitFunc) camel_cache_folder_class_init,
- NULL,
- NULL,
- (CamelObjectFinalizeFunc) finalize);
- }
-
- return camel_cache_folder_type;
-}
-
-
-static void
-cache_free_summary (CamelCacheFolder *cache_folder)
-{
- if (cache_folder->remote_summary) {
- camel_folder_free_summary (cache_folder->remote,
- cache_folder->summary);
- } else {
- int i;
-
- for (i = 0; i < cache_folder->summary->len; i++) {
- camel_message_info_free (
- cache_folder->summary->pdata[i]);
- }
- g_ptr_array_free (cache_folder->summary, TRUE);
- g_hash_table_destroy (cache_folder->summary_uids);
- }
-}
-
-static void
-finalize (CamelObject *object)
-{
- CamelCacheFolder *cache_folder = CAMEL_CACHE_FOLDER (object);
-
- if (cache_folder->uids) {
- camel_folder_free_uids (cache_folder->remote,
- cache_folder->uids);
- }
- if (cache_folder->summary)
- cache_free_summary (cache_folder);
-
- if (cache_folder->uidmap)
- camel_cache_map_destroy (cache_folder->uidmap);
-
- camel_object_unref (CAMEL_OBJECT (cache_folder->local));
- camel_object_unref (CAMEL_OBJECT (cache_folder->remote));
-
- g_free (cache_folder->mapfile);
-}
-
-
-static void
-update (CamelCacheFolder *cache_folder, CamelException *ex)
-{
- if (cache_folder->uids) {
- camel_folder_free_uids (cache_folder->remote,
- cache_folder->uids);
- }
- cache_folder->uids = camel_folder_get_uids (cache_folder->remote);
-
- if (cache_folder->summary)
- cache_free_summary (cache_folder);
-
- if (cache_folder->remote_summary) {
- cache_folder->summary =
- camel_folder_get_summary (cache_folder->remote);
- } else {
- CamelMessageInfo *mi;
- GPtrArray *lsummary;
- const char *ruid;
- int i;
-
- if (!cache_folder->is_synced) {
- camel_cache_folder_sync (cache_folder, ex);
- if (camel_exception_is_set (ex))
- return;
- }
-
- cache_folder->summary = g_ptr_array_new ();
- cache_folder->summary_uids = g_hash_table_new (g_str_hash,
- g_str_equal);
-
- lsummary = camel_folder_get_summary (cache_folder->local);
-
- /* For each local message, duplicate its info, replace
- * the uid with the remote one, and add it to the
- * uid->info cache.
- */
- for (i = 0; i < lsummary->len; i++) {
- mi = lsummary->pdata[i];
- ruid = camel_cache_map_get_remote (cache_folder->uidmap, mi->uid);
- if (!ruid) {
- /* Stale message. Delete it from cache. */
- camel_folder_delete_message (
- cache_folder->local, mi->uid);
- continue;
- }
-
- mi = g_new (CamelMessageInfo, 1);
- camel_message_info_dup_to (lsummary->pdata[i], mi);
- g_free (mi->uid);
- mi->uid = g_strdup (ruid);
- g_hash_table_insert (cache_folder->summary_uids,
- mi->uid, mi);
- }
- camel_folder_free_summary (cache_folder->local, lsummary);
-
- /* Now build the summary array in remote UID order. */
- for (i = 0; i < cache_folder->uids->len; i++) {
- mi = g_hash_table_lookup (cache_folder->summary_uids,
- cache_folder->uids->pdata[i]);
- g_ptr_array_add (cache_folder->summary, mi);
- }
- }
-
-}
-
-static void
-init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name, gchar *separator,
- gboolean path_begins_with_sep, CamelException *ex)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
- char *path;
-
- CF_CLASS (folder)->init (folder, parent_store, parent_folder,
- name, separator, path_begins_with_sep, ex);
- if (camel_exception_is_set (ex))
- return;
-
- folder->permanent_flags =
- camel_folder_get_permanent_flags (cache_folder->local);
- folder->can_hold_folders = cache_folder->remote->can_hold_folders;
- folder->can_hold_messages = cache_folder->remote->can_hold_messages;
- folder->has_summary_capability = TRUE;
- folder->has_search_capability =
- camel_folder_has_search_capability (cache_folder->local) ||
- camel_folder_has_search_capability (cache_folder->remote);
-
- cache_folder->remote_summary =
- camel_folder_has_summary_capability (cache_folder->remote);
-
- /* Load UIDs, summary, etc. */
- path = CAMEL_SERVICE (cache_folder->local->parent_store)->url->path;
- cache_folder->mapfile = g_strdup_printf ("%s/%s.map", path, name);
- cache_folder->uidmap = camel_cache_map_new ();
- camel_cache_map_read (cache_folder->uidmap, cache_folder->mapfile, ex);
- if (camel_exception_is_set (ex))
- return;
- update (cache_folder, ex);
-
- return;
-}
-
-/* If the remote folder changes, cache the new messages if necessary,
- * update the summary, and propagate the signal.
- */
-static void
-remote_folder_changed (CamelObject *remote_folder, gpointer type,
- gpointer user_data)
-{
- CamelCacheFolder *cache_folder = user_data;
-
- update (cache_folder, NULL);
- camel_object_trigger_event (CAMEL_OBJECT (cache_folder),
- "folder_changed", type);
-}
-
-/* If the local folder changes, it's because we just cached a message
- * or expunged messages. Look for new messages and update the UID maps.
- */
-static void
-local_folder_changed (CamelObject *local, gpointer type, gpointer data)
-{
- CamelFolder *local_folder = CAMEL_FOLDER (local);
- CamelCacheFolder *cache_folder = data;
- CamelMimeMessage *msg;
- GPtrArray *new_luids;
- char *luid;
- const char *ruid;
- int i;
-
- /* Get the updated list of local UIDs. For any that we didn't
- * already know about, figure out the corresponding remote
- * UID.
- */
- new_luids = camel_folder_get_uids (local_folder);
- for (i = 0; i < new_luids->len; i++) {
- luid = new_luids->pdata[i];
- if (!camel_cache_map_get_remote (cache_folder->uidmap, luid)) {
- msg = camel_folder_get_message (local_folder,
- luid, NULL);
- if (!msg)
- continue; /* Hrmph. */
- ruid = camel_medium_get_header (CAMEL_MEDIUM (msg),
- "X-Evolution-Remote-UID");
- if (!ruid) {
- /* How'd that get here? */
- camel_folder_delete_message (local_folder,
- luid);
- continue;
- }
-
- camel_cache_map_update (cache_folder->uidmap,
- luid, ruid);
- }
- }
- camel_folder_free_uids (local_folder, new_luids);
-
- /* FIXME: the uidmaps contain bad data now. */
-}
-
-/* DONE */
-static void
-refresh_info (CamelFolder *folder, CamelException *ex)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
-
- camel_folder_refresh_info (cache_folder->remote, ex);
-}
-
-/* DONE */
-static void
-cache_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
-
- camel_folder_sync (cache_folder->remote, expunge, ex);
- if (!camel_exception_is_set (ex)) {
- camel_folder_sync (cache_folder->local, expunge, NULL);
- camel_cache_map_write (cache_folder->uidmap,
- cache_folder->mapfile, ex);
- }
-}
-
-/* DONE */
-static void
-expunge (CamelFolder *folder, CamelException *ex)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
-
- camel_folder_expunge (cache_folder->remote, ex);
- if (!camel_exception_is_set (ex))
- camel_folder_expunge (cache_folder->local, NULL);
-}
-
-/* DONE */
-static gint
-get_message_count (CamelFolder *folder)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
-
- return cache_folder->summary->len;
-}
-
-/* DONE */
-static void
-append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
-
- /* We'd like to cache this locally as well, but we have no
- * 100% reliable way to determine the UID assigned to the
- * remote message, so we can't.
- */
- camel_folder_append_message (cache_folder->remote, message, info, ex);
-}
-
-/* DONE */
-static guint32
-get_message_flags (CamelFolder *folder, const char *uid)
-{
- const CamelMessageInfo *mi;
-
- mi = get_message_info (folder, uid);
- g_return_val_if_fail (mi != NULL, 0);
- return mi->flags;
-}
-
-/* DONE */
-static void
-set_message_flags (CamelFolder *folder, const char *uid,
- guint32 flags, guint32 set)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
- const char *luid;
-
- luid = camel_cache_map_get_local (cache_folder->uidmap, uid);
- if (luid) {
- camel_folder_set_message_flags (cache_folder->local, luid,
- flags, set);
- }
- camel_folder_set_message_flags (cache_folder->remote, uid, flags, set);
-}
-
-/* DONE */
-static gboolean
-get_message_user_flag (CamelFolder *folder, const char *uid, const char *name)
-{
- const CamelMessageInfo *mi;
-
- mi = get_message_info (folder, uid);
- g_return_val_if_fail (mi != NULL, 0);
- return camel_flag_get ((CamelFlag **)&mi->user_flags, name);
-}
-
-/* DONE */
-static void
-set_message_user_flag (CamelFolder *folder, const char *uid,
- const char *name, gboolean value)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
- const char *luid;
-
- luid = camel_cache_map_get_local (cache_folder->uidmap, uid);
- if (luid) {
- camel_folder_set_message_user_flag (cache_folder->local, luid,
- name, value);
- }
- camel_folder_set_message_user_flag (cache_folder->remote, uid,
- name, value);
-}
-
-
-/* DONE */
-static const char *
-get_message_user_tag (CamelFolder *folder, const char *uid, const char *name)
-{
- const CamelMessageInfo *mi;
-
- mi = get_message_info (folder, uid);
- g_return_val_if_fail (mi != NULL, NULL);
- return camel_tag_get ((CamelTag **)&mi->user_tags, name);
-}
-
-/* DONE */
-static void
-set_message_user_tag (CamelFolder *folder, const char *uid,
- const char *name, const char *value)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
- const char *luid;
-
- luid = camel_cache_map_get_local (cache_folder->uidmap, uid);
- if (luid) {
- camel_folder_set_message_user_tag (cache_folder->local, luid,
- name, value);
- }
- camel_folder_set_message_user_tag (cache_folder->remote, uid,
- name, value);
-}
-
-
-/* DONE */
-static CamelMimeMessage *
-get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
- CamelMimeMessage *msg;
- const CamelMessageInfo *info;
- const char *luid;
-
- /* Check if we have it cached first. */
- luid = camel_cache_map_get_local (cache_folder->uidmap, uid);
- if (luid) {
- msg = camel_folder_get_message (cache_folder->local,
- luid, NULL);
- if (msg)
- return msg;
-
- /* Hm... Oh well. Update the map and try for real. */
- camel_cache_map_remove (cache_folder->uidmap, NULL, uid);
- }
-
- /* OK. It's not cached. Get the remote message. */
- msg = camel_folder_get_message (cache_folder->remote, uid, ex);
- if (!msg)
- return NULL;
- info = camel_folder_get_message_info (cache_folder->remote, uid);
-
- /* Add a header giving the remote UID and append it to the
- * local folder. (This should eventually invoke
- * local_folder_changed(), which will take care of updating
- * the uidmaps.)
- */
- camel_medium_add_header (CAMEL_MEDIUM (msg), "X-Evolution-Remote-UID",
- uid);
- camel_folder_append_message (cache_folder->local, msg, info, NULL);
-
- return msg;
-}
-
-/* DONE */
-static GPtrArray *
-get_uids (CamelFolder *folder)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
-
- return cache_folder->uids;
-}
-
-/* DONE */
-static GPtrArray *
-get_summary (CamelFolder *folder)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
-
- return cache_folder->summary;
-}
-
-/* DONE */
-static GPtrArray *
-get_subfolder_names (CamelFolder *folder)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
-
- return camel_folder_get_subfolder_names (cache_folder->remote);
-}
-
-/* DONE */
-static void
-free_subfolder_names (CamelFolder *folder, GPtrArray *subfolders)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
-
- camel_folder_free_subfolder_names (cache_folder->remote, subfolders);
-}
-
-/* DONE */
-static GPtrArray *
-search_by_expression (CamelFolder *folder, const char *expression,
- CamelException *ex)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
-
- /* Search on the remote folder if we're not synced. */
- if (!cache_folder->is_synced &&
- camel_folder_has_search_capability (cache_folder->remote)) {
- return camel_folder_search_by_expression (cache_folder->remote,
- expression, ex);
- } else {
- GPtrArray *matches;
- const char *ruid;
- int i;
-
- if (!cache_folder->is_synced)
- camel_cache_folder_sync (cache_folder, ex);
- if (camel_exception_is_set (ex))
- return NULL;
- matches = search_by_expression (cache_folder->local,
- expression, ex);
- if (camel_exception_is_set (ex))
- return NULL;
-
- /* Convert local uids to remote. */
- for (i = 0; i < matches->len; i++) {
- ruid = camel_cache_map_get_remote (cache_folder->uidmap,
- matches->pdata[i]);
- g_free (matches->pdata[i]);
- matches->pdata[i] = g_strdup (ruid);
- }
-
- return matches;
- }
-}
-
-/* DONE */
-static const CamelMessageInfo *
-get_message_info (CamelFolder *folder, const char *uid)
-{
- CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
-
- if (cache_folder->remote_summary) {
- return camel_folder_get_message_info (cache_folder->remote,
- uid);
- } else
- return g_hash_table_lookup (cache_folder->summary_uids, uid);
-}
-
-/* DONE */
-static void
-copy_message_to (CamelFolder *source, const char *uid,
- CamelFolder *destination, CamelException *ex)
-{
- CamelCacheFolder *source_cache_folder = (CamelCacheFolder *)source;
- CamelCacheFolder *dest_cache_folder = (CamelCacheFolder *)destination;
-
- /* If we are here, we know that the folders have the same parent
- * store, which implies their remote and local folders have the
- * same parent store as well.
- */
-
- if (CF_CLASS (source_cache_folder->remote)->copy_message_to !=
- folder_class->copy_message_to) {
- /* The remote store has a non-default copy method, so
- * use it to avoid unnecessary network traffic.
- */
- CF_CLASS (source_cache_folder->remote)->copy_message_to (
- source_cache_folder->remote, uid,
- dest_cache_folder->remote, ex);
- } else {
- /* The remote store uses the default copy method,
- * meaning if we proxy the copy_message_to over to it,
- * it will suck the message over the network. We may
- * already have a local copy, and if we don't, we want
- * to, and if we're going to have the message in
- * memory, then we should get it into the destination
- * cache too. So do this by hand.
- */
- CamelMimeMessage *msg;
- const CamelMessageInfo *info;
-
- msg = get_message (source, uid, ex);
- if (camel_exception_is_set (ex))
- return;
- info = camel_folder_get_message_info (source, uid);
-
- camel_medium_remove_header (CAMEL_MEDIUM (msg),
- "X-Evolution-Remote-UID");
- append_message (destination, msg, info, ex);
- }
-}
-
-/* DONE */
-static void
-move_message_to (CamelFolder *source, const char *uid,
- CamelFolder *destination, CamelException *ex)
-{
- CamelCacheFolder *source_cache_folder = (CamelCacheFolder *)source;
- CamelCacheFolder *dest_cache_folder = (CamelCacheFolder *)destination;
-
- /* See comments in copy_message_to. */
-
- if (CF_CLASS (source_cache_folder)->move_message_to !=
- folder_class->move_message_to) {
- CF_CLASS (source_cache_folder)->move_message_to (
- source_cache_folder->remote, uid,
- dest_cache_folder->remote, ex);
- } else {
- CamelMimeMessage *msg;
- const CamelMessageInfo *info;
-
- msg = get_message (source, uid, ex);
- if (camel_exception_is_set (ex))
- return;
- info = camel_folder_get_message_info (source, uid);
-
- camel_medium_remove_header (CAMEL_MEDIUM (msg),
- "X-Evolution-Remote-UID");
- append_message (destination, msg, info, ex);
- if (!camel_exception_is_set (ex))
- camel_folder_delete_message (source, uid);
- }
-}
-
-
-CamelFolder *
-camel_cache_folder_new (CamelStore *store, CamelFolder *parent,
- CamelFolder *remote, CamelFolder *local,
- CamelException *ex)
-{
- CamelCacheFolder *cache_folder;
- CamelFolder *folder;
-
- cache_folder = CAMEL_CACHE_FOLDER (camel_object_new (CAMEL_CACHE_FOLDER_TYPE));
- folder = (CamelFolder *)cache_folder;
-
- cache_folder->local = local;
- camel_object_ref (CAMEL_OBJECT (local));
- camel_object_hook_event (CAMEL_OBJECT (local), "folder_changed",
- local_folder_changed, cache_folder);
-
- cache_folder->remote = remote;
- camel_object_ref (CAMEL_OBJECT (remote));
- camel_object_hook_event (CAMEL_OBJECT (remote), "folder_changed",
- remote_folder_changed, cache_folder);
-
- /* XXX */
-
- return folder;
-}
-
-void
-camel_cache_folder_sync (CamelCacheFolder *cache_folder, CamelException *ex)
-{
- CamelMimeMessage *msg;
- const char *ruid, *luid;
- int lsize, i;
- const CamelMessageInfo *info;
-
- lsize = camel_folder_get_message_count (cache_folder->local);
-
- camel_folder_freeze (cache_folder->local);
- for (i = 0; i < cache_folder->uids->len; i++) {
- ruid = cache_folder->uids->pdata[i];
- luid = camel_cache_map_get_local (cache_folder->uidmap, ruid);
-
- /* Don't re-copy messages we already have. */
- if (luid &&
- camel_folder_get_message_info (cache_folder->local, luid))
- continue;
-
- msg = camel_folder_get_message (cache_folder->remote,
- ruid, ex);
- if (camel_exception_is_set (ex))
- return;
- info = camel_folder_get_message_info (cache_folder->remote,
- ruid);
-
- camel_medium_add_header (CAMEL_MEDIUM (msg),
- "X-Evolution-Remote-UID", ruid);
- camel_folder_append_message (cache_folder->local, msg,
- info, ex);
- if (camel_exception_is_set (ex))
- return;
- }
- camel_folder_thaw (cache_folder->local);
-}
-
-static void
-get_mappings (CamelCacheFolder *cache_folder, int first, CamelException *ex)
-{
- GPtrArray *uids;
- CamelMimeMessage *msg;
- const char *ruid;
- int i;
-
- uids = camel_folder_get_uids (cache_folder->local);
- for (i = first; i < uids->len; i++) {
- msg = camel_folder_get_message (cache_folder->local,
- uids->pdata[i], ex);
- if (!msg)
- break;
- ruid = camel_medium_get_header (CAMEL_MEDIUM (msg),
- "X-Evolution-Remote-UID");
-
- camel_cache_map_add (cache_folder->uidmap,
- uids->pdata[i], ruid);
- }
- camel_folder_free_uids (cache_folder->local, uids);
-}
diff --git a/camel/providers/cache/camel-cache-folder.h b/camel/providers/cache/camel-cache-folder.h
deleted file mode 100644
index 2495f133b3..0000000000
--- a/camel/providers/cache/camel-cache-folder.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-cache-folder.h: Class for a cache 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_CACHE_FOLDER_H
-#define CAMEL_CACHE_FOLDER_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-folder.h>
-#include "camel-cache-map.h"
-
-#define CAMEL_CACHE_FOLDER_TYPE (camel_cache_folder_get_type ())
-#define CAMEL_CACHE_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_CACHE_FOLDER_TYPE, CamelCacheFolder))
-#define CAMEL_CACHE_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_CACHE_FOLDER_TYPE, CamelCacheFolderClass))
-#define CAMEL_IS_CACHE_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_CACHE_FOLDER_TYPE))
-
-
-typedef struct {
- CamelFolder parent_object;
-
- /* Remote and local folders */
- CamelFolder *remote, *local;
-
- /* Remote UIDs, in order, summary, and uid->info map if
- * summary is from local info.
- */
- GPtrArray *uids, *summary;
- GHashTable *summary_uids;
-
- /* UID map */
- CamelCacheMap *uidmap;
- char *mapfile;
-
- /* Is the summary remote? Is the folder known to be synced? */
- gboolean remote_summary, is_synced;
-
-} CamelCacheFolder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelCacheFolderClass;
-
-
-CamelFolder *camel_cache_folder_new (CamelStore *store, CamelFolder *parent,
- CamelFolder *remote, CamelFolder *local,
- CamelException *ex);
-
-void camel_cache_folder_sync (CamelCacheFolder *cache_folder,
- CamelException *ex);
-
-/* Standard Camel function */
-CamelType camel_cache_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_CACHE_FOLDER_H */
diff --git a/camel/providers/cache/camel-cache-map.c b/camel/providers/cache/camel-cache-map.c
deleted file mode 100644
index d3cece6f60..0000000000
--- a/camel/providers/cache/camel-cache-map.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-cache-map.c : functions for a local<->remote uid map */
-
-/*
- * 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-cache-map.h"
-#include <camel/camel-exception.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-/**
- * camel_cache_map_new:
- *
- * Return value: a new CamelCacheMap
- **/
-CamelCacheMap *
-camel_cache_map_new (void)
-{
- CamelCacheMap *map = g_new (CamelCacheMap, 1);
-
- map->l2r = g_hash_table_new (g_str_hash, g_str_equal);
- map->r2l = g_hash_table_new (g_str_hash, g_str_equal);
-
- return map;
-}
-
-static void
-free_mapping (gpointer key, gpointer value, gpointer data)
-{
- g_free (key);
- g_free (data);
-}
-
-/**
- * camel_cache_map_destroy:
- * @map: a CamelCacheMap
- *
- * Frees @map and all of the data stored in it.
- **/
-void
-camel_cache_map_destroy (CamelCacheMap *map)
-{
- g_hash_table_foreach (map->l2r, free_mapping, NULL);
- g_hash_table_destroy (map->l2r);
- g_hash_table_destroy (map->r2l);
- g_free (map);
-}
-
-/**
- * camel_cache_map_add:
- * @map: a CamelCacheMap
- * @luid: the local uid
- * @ruid: the remote uid
- *
- * Adds a mapping between @luid and @ruid. If either already exists
- * in the map, this may leak memory and result in incorrect map entries.
- * Use camel_cache_map_update() in that case instead.
- **/
-void
-camel_cache_map_add (CamelCacheMap *map, const char *luid, const char *ruid)
-{
- char *map_luid = g_strdup (luid);
- char *map_ruid = g_strdup (ruid);
-
- g_hash_table_insert (map->l2r, map_luid, map_ruid);
- g_hash_table_insert (map->r2l, map_ruid, map_luid);
-}
-
-/**
- * camel_cache_map_remove:
- * @map: a CamelCacheMap
- * @luid: the local uid
- * @ruid: the remote uid
- *
- * Removes the mapping between @luid and @ruid. Either (but not both)
- * of the uids can be %NULL if they are not both known.
- **/
-void
-camel_cache_map_remove (CamelCacheMap *map, const char *luid, const char *ruid)
-{
- gpointer map_luid, map_ruid;
-
- if ((luid && g_hash_table_lookup_extended (map->l2r, luid,
- &map_luid, &map_ruid)) ||
- (ruid && g_hash_table_lookup_extended (map->r2l, ruid,
- &map_luid, &map_ruid))) {
- g_hash_table_remove (map->l2r, map_luid);
- g_hash_table_remove (map->r2l, map_ruid);
- g_free (map_luid);
- g_free (map_ruid);
- }
-}
-
-/**
- * camel_cache_map_update:
- * @map: a CamelCacheMap
- * @luid: the local uid
- * @ruid: the remote uid
- *
- * Updates the mappings to associate @luid with @ruid, clearing any
- * previous mappings for both of them.
- **/
-void
-camel_cache_map_update (CamelCacheMap *map, const char *luid, const char *ruid)
-{
- camel_cache_map_remove (map, luid, ruid);
- camel_cache_map_add (map, luid, ruid);
-}
-
-/**
- * camel_cache_map_get_local
- * @map: a CamelCacheMap
- * @ruid: the remote uid
- *
- * Return value: the corresponding local uid, or %NULL
- **/
-const char *
-camel_cache_map_get_local (CamelCacheMap *map, const char *ruid)
-{
- return g_hash_table_lookup (map->r2l, ruid);
-}
-
-/**
- * camel_cache_map_get_remote
- * @map: a CamelCacheMap
- * @luid: the local uid
- *
- * Return value: the corresponding remote uid, or %NULL
- **/
-const char *
-camel_cache_map_get_remote (CamelCacheMap *map, const char *luid)
-{
- return g_hash_table_lookup (map->l2r, luid);
-}
-
-
-
-static void
-write_mapping (gpointer key, gpointer value, gpointer user_data)
-{
- int fd = *(int *)user_data;
-
- /* FIXME: We assume the local UID has no ':'s in it. */
- write (fd, key, strlen (key));
- write (fd, ":", 1);
- write (fd, value, strlen (value));
- write (fd, "\n", 1);
-}
-
-/**
- * camel_cache_map_write:
- * @map: a CamelCacheMap
- * @file: the filename to write the map to
- * @ex: a CamelException
- *
- * Writes @map out to @file, setting @ex if something goes wrong.
- **/
-void
-camel_cache_map_write (CamelCacheMap *map, const char *file,
- CamelException *ex)
-{
- int fd;
- char *tmpfile;
-
- tmpfile = g_strdup_printf ("%s~", file);
- fd = open (tmpfile, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
- if (fd == -1) {
- g_free (tmpfile);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not create cache map file: %s",
- g_strerror (errno));
- return;
- }
-
- g_hash_table_foreach (map->l2r, write_mapping, &fd);
-
- if (close (fd) == -1 ||
- rename (tmpfile, file) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not save cache map file: %s",
- g_strerror (errno));
- unlink (tmpfile);
- }
- g_free (tmpfile);
-}
-
-/**
- * camel_cache_map_read:
- * @map: a CamelCacheMap
- * @file: the filename to read the map from
- * @ex: a CamelException
- *
- * Reads @map from @file, setting @ex if something goes wrong. @map
- * should be a freshly-created CamelCacheMap.
- **/
-void
-camel_cache_map_read (CamelCacheMap *map, const char *file, CamelException *ex)
-{
- FILE *f;
- char buf[1024], *p, *q;
-
- /* FIXME: lazy implementation. We could make this work with
- * lines longer than 1024 chars. :)
- */
-
- f = fopen (file, "r");
- if (!f) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not open cache map file: %s",
- g_strerror (errno));
- return;
- }
-
- while (fgets (buf, sizeof (buf), f)) {
- p = strchr (buf, ':');
- if (p)
- q = strchr (buf, '\n');
- if (!p || !q) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
- "Bad cache file.");
- return;
- }
- *p++ = *q = '\0';
-
- /* Local uid at buf, remote at p. */
- camel_cache_map_add (map, buf, p);
- }
-
- fclose (f);
-}
diff --git a/camel/providers/cache/camel-cache-map.h b/camel/providers/cache/camel-cache-map.h
deleted file mode 100644
index a15c9afe1a..0000000000
--- a/camel/providers/cache/camel-cache-map.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-cache-map.h: functions for dealing with UID maps */
-
-/*
- * 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_CACHE_MAP_H
-#define CAMEL_CACHE_MAP_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include <camel/camel-types.h>
-
-typedef struct {
- GHashTable *l2r, *r2l;
-} CamelCacheMap;
-
-CamelCacheMap *camel_cache_map_new (void);
-void camel_cache_map_destroy (CamelCacheMap *map);
-
-void camel_cache_map_add (CamelCacheMap *map, const char *luid,
- const char *ruid);
-void camel_cache_map_remove (CamelCacheMap *map, const char *luid,
- const char *ruid);
-void camel_cache_map_update (CamelCacheMap *map, const char *luid,
- const char *ruid);
-
-const char *camel_cache_map_get_local (CamelCacheMap *map, const char *ruid);
-const char *camel_cache_map_get_remote (CamelCacheMap *map, const char *luid);
-
-void camel_cache_map_write (CamelCacheMap *map, const char *file,
- CamelException *ex);
-void camel_cache_map_read (CamelCacheMap *map, const char *file,
- CamelException *ex);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_CACHE_MAP_H */
diff --git a/camel/providers/cache/camel-cache-provider.c b/camel/providers/cache/camel-cache-provider.c
deleted file mode 100644
index 217f06816a..0000000000
--- a/camel/providers/cache/camel-cache-provider.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-cache-provider.c: cache 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-cache-store.h"
-#include "camel-provider.h"
-#include "camel-session.h"
-
-static CamelProvider cache_provider = {
- "cache",
- "Cache",
-
- "For caching remote mail into a local store.",
-
- "cache",
-
- 0,
-
- { 0, 0 }
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- cache_provider.object_types[CAMEL_PROVIDER_STORE] =
- camel_cache_store_get_type();
-
- camel_session_register_provider (session, &cache_provider);
-}
diff --git a/camel/providers/cache/camel-cache-store.c b/camel/providers/cache/camel-cache-store.c
deleted file mode 100644
index 544cca69a1..0000000000
--- a/camel/providers/cache/camel-cache-store.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-cache-store.c : class for a cache 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-cache-store.h"
-#include "camel-cache-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"
-
-static CamelServiceClass *service_class = NULL;
-#define CS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static void finalize (CamelObject *object);
-
-static gboolean cache_connect (CamelService *service, CamelException *ex);
-static gboolean cache_disconnect (CamelService *service, CamelException *ex);
-static char *get_path (CamelService *service);
-static char *get_name (CamelService *service, gboolean brief);
-
-static CamelFolder *get_folder (CamelStore *store, const char *folder_name,
- gboolean create, CamelException *ex);
-static void delete_folder (CamelStore *store, const char *folder_name,
- CamelException *ex);
-static void rename_folder (CamelStore *store, const char *old_name,
- const char *new_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 void
-camel_cache_store_class_init (CamelCacheStoreClass *camel_cache_store_class)
-{
- CamelServiceClass *camel_service_class =
- CAMEL_SERVICE_CLASS (camel_cache_store_class);
- CamelStoreClass *camel_store_class =
- CAMEL_STORE_CLASS (camel_cache_store_class);
-
- service_class = CAMEL_SERVICE_CLASS (camel_type_get_global_classfuncs (camel_service_get_type ()));
-
- /* virtual method overload */
- camel_service_class->connect = cache_connect;
- camel_service_class->disconnect = cache_disconnect;
- camel_service_class->get_path = get_path;
- camel_service_class->get_name = get_name;
-
- camel_store_class->get_folder = get_folder;
- camel_store_class->delete_folder = delete_folder;
- camel_store_class->rename_folder = rename_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;
-}
-
-
-CamelType
-camel_cache_store_get_type (void)
-{
- static CamelType camel_cache_store_type = CAMEL_INVALID_TYPE;
-
- if (camel_cache_store_type == CAMEL_INVALID_TYPE) {
- camel_cache_store_type = camel_type_register (
- CAMEL_STORE_TYPE, "CamelCacheStore",
- sizeof (CamelCacheStore),
- sizeof (CamelCacheStoreClass),
- (CamelObjectClassInitFunc) camel_cache_store_class_init,
- NULL,
- NULL,
- (CamelObjectFinalizeFunc) finalize);
- }
-
- return camel_cache_store_type;
-}
-
-static void
-finalize (CamelObject *object)
-{
- CamelCacheStore *cache_store = CAMEL_CACHE_STORE (object);
-
- camel_object_unref (CAMEL_OBJECT (cache_store->local));
- camel_object_unref (CAMEL_OBJECT (cache_store->remote));
- g_free (cache_store->local_base);
-}
-
-
-static gboolean
-cache_connect (CamelService *service, CamelException *ex)
-{
- CamelCacheStore *cache_store = CAMEL_CACHE_STORE (service);
-
- return camel_service_connect (CAMEL_SERVICE (cache_store->remote), ex) &&
- camel_service_connect (CAMEL_SERVICE (cache_store->local), ex);
-}
-
-static gboolean
-cache_disconnect (CamelService *service, CamelException *ex)
-{
- CamelCacheStore *cache_store = CAMEL_CACHE_STORE (service);
-
- return camel_service_disconnect (CAMEL_SERVICE (cache_store->local), ex) &&
- camel_service_disconnect (CAMEL_SERVICE (cache_store->remote), ex);
-}
-
-static char *
-get_path (CamelService *service)
-{
- CamelCacheStore *cache_store = CAMEL_CACHE_STORE (service);
- char *path, *subpath;
-
- subpath = camel_service_get_path (CAMEL_SERVICE (cache_store->remote));
- path = g_strdup_printf ("cache/%s", subpath);
- g_free (subpath);
- return path;
-}
-
-static char *
-get_name (CamelService *service, gboolean brief)
-{
- CamelCacheStore *cache_store = CAMEL_CACHE_STORE (service);
-
- return camel_service_get_name (CAMEL_SERVICE (cache_store->remote),
- brief);
-}
-
-static CamelFolder *
-get_folder (CamelStore *store, const char *folder_name,
- gboolean create, CamelException *ex)
-{
- CamelCacheStore *cache_store = CAMEL_CACHE_STORE (store);
- CamelFolder *parent, *rf, *lf;
-
- rf = camel_store_get_folder (cache_store->remote, folder_name,
- create, ex);
- if (!rf)
- return NULL;
-
- lf = camel_store_get_folder (cache_store->local, folder_name,
- TRUE, ex);
- if (!lf) {
- camel_object_unref (CAMEL_OBJECT (rf));
- camel_exception_setv (ex, camel_exception_get_id (ex),
- "Could not create cache folder:\n%s",
- camel_exception_get_description (ex));
- return NULL;
- }
-
- return camel_cache_folder_new (store, parent, rf, lf, ex);
-}
-
-/* XXX these two need to be better about failure recovery. */
-static void
-delete_folder (CamelStore *store, const char *folder_name,
- CamelException *ex)
-{
- CamelCacheStore *cache_store = CAMEL_CACHE_STORE (store);
-
- camel_store_delete_folder (cache_store->remote, folder_name, ex);
- if (camel_exception_is_set (ex))
- return;
- camel_store_delete_folder (cache_store->local, folder_name, NULL);
-}
-
-static void
-rename_folder (CamelStore *store, const char *old_name,
- const char *new_name, CamelException *ex)
-{
- CamelCacheStore *cache_store = CAMEL_CACHE_STORE (store);
-
- camel_store_rename_folder (cache_store->remote, old_name,
- new_name, ex);
- if (camel_exception_is_set (ex))
- return;
- camel_store_rename_folder (cache_store->local, old_name,
- new_name, NULL);
-}
-
-static char *
-get_folder_name (CamelStore *store, const char *folder_name,
- CamelException *ex)
-{
- CamelCacheStore *cache_store = CAMEL_CACHE_STORE (store);
-
- return CS_CLASS (cache_store->remote)->get_folder_name (
- cache_store->remote, folder_name, ex);
-}
-
-static char *
-get_root_folder_name (CamelStore *store, CamelException *ex)
-{
- CamelCacheStore *cache_store = CAMEL_CACHE_STORE (store);
-
- return CS_CLASS (cache_store->remote)->get_root_folder_name (
- cache_store->remote, ex);
-}
-
-static char *
-get_default_folder_name (CamelStore *store, CamelException *ex)
-{
- CamelCacheStore *cache_store = CAMEL_CACHE_STORE (store);
-
- return CS_CLASS (cache_store->remote)->get_default_folder_name (
- cache_store->remote, ex);
-}
-
-
-/**
- * camel_cache_store_new:
- * @remote: a remote store
- * @ex: a CamelException
- *
- * Return value: a CamelCacheStore for the given remote store.
- **/
-CamelStore *
-camel_cache_store_new (CamelStore *remote, CamelException *ex)
-{
- CamelCacheStore *cache_store;
- CamelService *remote_service = (CamelService *)remote;
- CamelSession *session;
- char *url_string;
- CamelURL *url;
-
- session = camel_service_get_session (remote_service);
-
- url_string = camel_service_get_url (remote_service);
- url = camel_url_new (url_string, ex);
- g_free (url_string);
-
- if (!url)
- return NULL;
-
- cache_store = (CamelCacheStore *)
- camel_service_new (CAMEL_CACHE_STORE_TYPE, session,
- camel_service_get_provider (remote_service),
- url, ex);
- if (camel_exception_is_set (ex)) {
- camel_url_free (url);
- return NULL;
- }
-
- cache_store->remote = remote;
- camel_object_ref (CAMEL_OBJECT (remote));
-
- cache_store->local_base = camel_session_get_storage_path (
- session, (CamelService *)cache_store, ex);
- if (camel_exception_is_set (ex)) {
- camel_object_unref (CAMEL_OBJECT (cache_store));
- return NULL;
- }
-
- url_string = g_strdup_printf ("mbox:%s", cache_store->local_base);
- cache_store->local = camel_session_get_store (session, url_string, ex);
- g_free (url_string);
- if (camel_exception_is_set (ex)) {
- camel_object_unref (CAMEL_OBJECT (cache_store));
- return NULL;
- }
-
- return (CamelStore *)cache_store;
-}
diff --git a/camel/providers/cache/camel-cache-store.h b/camel/providers/cache/camel-cache-store.h
deleted file mode 100644
index 97fae62a51..0000000000
--- a/camel/providers/cache/camel-cache-store.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-cache-store.h: class for a cache 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_CACHE_STORE_H
-#define CAMEL_CACHE_STORE_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-store.h>
-
-#define CAMEL_CACHE_STORE_TYPE (camel_cache_store_get_type ())
-#define CAMEL_CACHE_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_CACHE_STORE_TYPE, CamelCacheStore))
-#define CAMEL_CACHE_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_CACHE_STORE_TYPE, CamelCacheStoreClass))
-#define CAMEL_IS_CACHE_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_CACHE_STORE_TYPE))
-
-typedef struct {
- CamelStore parent_object;
-
- char *local_base;
- CamelStore *remote, *local;
-
-} CamelCacheStore;
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-} CamelCacheStoreClass;
-
-
-/* support functions */
-CamelStore *camel_cache_store_new (CamelStore *remote, CamelException *ex);
-
-/* Standard Camel function */
-CamelType camel_cache_store_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_CACHE_STORE_H */
-
-
diff --git a/camel/providers/cache/libcamelcache.urls b/camel/providers/cache/libcamelcache.urls
deleted file mode 100644
index 06cf65390f..0000000000
--- a/camel/providers/cache/libcamelcache.urls
+++ /dev/null
@@ -1 +0,0 @@
-cache
diff --git a/camel/providers/imap/.cvsignore b/camel/providers/imap/.cvsignore
deleted file mode 100644
index 3fa8afaa38..0000000000
--- a/camel/providers/imap/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
-*.bb
-*.bbg
-*.da
-*.gcov
diff --git a/camel/providers/imap/Makefile.am b/camel/providers/imap/Makefile.am
deleted file mode 100644
index 39e160c879..0000000000
--- a/camel/providers/imap/Makefile.am
+++ /dev/null
@@ -1,52 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-libcamelimapincludedir = $(includedir)/camel
-
-
-providerdir = $(pkglibdir)/camel-providers/$(VERSION)
-
-provider_LTLIBRARIES = libcamelimap.la
-provider_DATA = libcamelimap.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-imap-provider\"
-
-libcamelimap_la_SOURCES = \
- camel-imap-command.c \
- camel-imap-folder.c \
- camel-imap-provider.c \
- camel-imap-search.c \
- camel-imap-store.c \
- camel-imap-summary.c \
- camel-imap-utils.c \
- camel-imap-wrapper.c
-
-libcamelimapinclude_HEADERS = \
- camel-imap-command.h \
- camel-imap-folder.h \
- camel-imap-search.h \
- camel-imap-store.h \
- camel-imap-summary.h \
- camel-imap-types.h \
- camel-imap-utils.h \
- camel-imap-wrapper.h
-
-libcamelimap_la_LDFLAGS = -version-info 0:0:0
-
-noinst_HEADERS = \
- camel-imap-private.h
-
-EXTRA_DIST = libcamelimap.urls
-
-
-
-
-
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
deleted file mode 100644
index 8a713cde8b..0000000000
--- a/camel/providers/imap/camel-imap-command.c
+++ /dev/null
@@ -1,578 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-imap-command.c: IMAP command sending/parsing routines */
-
-/*
- * Authors:
- * Dan Winship <danw@helixcode.com>
- * Jeffrey Stedfast <fejj@helixcode.com>
- *
- * Copyright 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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#include <config.h>
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#include "camel-imap-command.h"
-#include "camel-imap-utils.h"
-#include "camel-imap-folder.h"
-#include "camel-imap-store.h"
-#include <camel/camel-exception.h>
-
-static char *imap_read_untagged (CamelImapStore *store, char *line,
- CamelException *ex);
-static CamelImapResponse *imap_read_response (CamelImapStore *store,
- CamelException *ex);
-static char *imap_command_strdup_vprintf (CamelImapStore *store,
- const char *fmt, va_list ap);
-
-/**
- * camel_imap_command: Send a command to a IMAP server and get a response
- * @store: the IMAP store
- * @folder: The folder to perform the operation in (or %NULL if not
- * relevant).
- * @ex: a CamelException
- * @fmt: an sort of printf-style format string, followed by arguments
- *
- * This function makes sure that @folder (if non-%NULL) is the
- * currently-selected folder on @store and then sends the IMAP command
- * specified by @fmt and the following arguments. It then reads the
- * server's response(s) and parses the final result.
- *
- * As a special case, if @fmt is %NULL, it will just select @folder
- * and return the response from doing so.
- *
- * @fmt can include the following %-escapes ONLY:
- * %s, %d, %%: as with printf
- * %S: an IMAP "string" (quoted string or literal)
- *
- * %S strings will be passed as literals if the server supports LITERAL+
- * and quoted strings otherwise. (%S does not support strings that
- * contain newlines.)
- *
- * This function assumes you have an exclusive lock on the command
- * channel/stream.
- *
- * Return value: %NULL if an error occurred (in which case @ex will
- * be set). Otherwise, a CamelImapResponse describing the server's
- * response, which the caller must free with camel_imap_response_free().
- **/
-CamelImapResponse *
-camel_imap_command (CamelImapStore *store, CamelFolder *folder,
- CamelException *ex, const char *fmt, ...)
-{
- gchar *cmdbuf;
- va_list ap;
-
- /* Check for current folder */
- if (folder && (!fmt || folder != store->current_folder)) {
- CamelImapResponse *response;
-
- store->current_folder = NULL;
- response = camel_imap_command (store, NULL, ex, "SELECT %S",
- folder->full_name);
- if (!response)
- return NULL;
- store->current_folder = folder;
-
- if (!fmt)
- return response;
-
- camel_imap_folder_selected (folder, response, ex);
- camel_imap_response_free (response);
- }
-
- /* Send the command */
- va_start (ap, fmt);
- cmdbuf = imap_command_strdup_vprintf (store, fmt, ap);
- va_end (ap);
-
- camel_remote_store_send_string (CAMEL_REMOTE_STORE (store), ex,
- "A%.5d %s\r\n", store->command++,
- cmdbuf);
- g_free (cmdbuf);
- if (camel_exception_is_set (ex))
- return NULL;
-
- /* Read the response. */
- return imap_read_response (store, ex);
-}
-
-/**
- * camel_imap_command_continuation: Send more command data to the IMAP server
- * @store: the IMAP store
- * @ex: a CamelException
- * @cmdbuf: buffer containing the response/request data
- *
- * This method is for sending continuing responses to the IMAP server
- * after camel_imap_command returns a CAMEL_IMAP_PLUS response.
- *
- * This function assumes you have an exclusive lock on the remote stream.
- *
- * Return value: as for camel_imap_command()
- **/
-CamelImapResponse *
-camel_imap_command_continuation (CamelImapStore *store, CamelException *ex,
- const char *cmdbuf)
-{
- if (camel_remote_store_send_string (CAMEL_REMOTE_STORE (store), ex,
- "%s\r\n", cmdbuf) < 0)
- return NULL;
-
- return imap_read_response (store, ex);
-}
-
-/* Read the response to an IMAP command. */
-static CamelImapResponse *
-imap_read_response (CamelImapStore *store, CamelException *ex)
-{
- CamelImapResponse *response;
- int number, exists = 0;
- GArray *expunged = NULL;
- char *respbuf, *retcode, *word, *p;
-
- /* Read first line */
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store),
- &respbuf, ex) < 0)
- return NULL;
-
- response = g_new0 (CamelImapResponse, 1);
- response->untagged = g_ptr_array_new ();
-
- /* Check for untagged data */
- while (!strncmp (respbuf, "* ", 2)) {
- /* Read the rest of the response if it is multi-line. */
- respbuf = imap_read_untagged (store, respbuf, ex);
- if (camel_exception_is_set (ex))
- break;
-
- /* If it starts with a number, we might deal with
- * it ourselves.
- */
- word = imap_next_word (respbuf);
- number = strtoul (word, &p, 10);
- if (p != word && store->current_folder) {
- word = imap_next_word (p);
- if (!g_strcasecmp (word, "EXISTS")) {
- exists = number;
- g_free (respbuf);
- goto next;
- } else if (!g_strcasecmp (word, "EXPUNGE")) {
- if (!expunged) {
- expunged = g_array_new (FALSE, FALSE,
- sizeof (int));
- }
- g_array_append_val (expunged, number);
- g_free (respbuf);
- goto next;
- }
- } else {
- if (!g_strncasecmp (word, "BYE", 3)) {
- /* connection was lost, no more data to fetch */
- store->connected = FALSE;
- g_free (respbuf);
- respbuf = NULL;
- break;
- }
- }
-
- g_ptr_array_add (response->untagged, respbuf);
- next:
- if (camel_remote_store_recv_line (
- CAMEL_REMOTE_STORE (store), &respbuf, ex) < 0)
- break;
- }
-
- /* Update the summary */
- if (store->current_folder && (exists > 0 || expunged)) {
- camel_imap_folder_changed (store->current_folder, exists,
- expunged, NULL);
- }
- if (expunged)
- g_array_free (expunged, TRUE);
-
- if (!respbuf || camel_exception_is_set (ex)) {
- camel_imap_response_free (response);
- return NULL;
- }
-
- response->status = respbuf;
-
- /* Check for OK or continuation response. */
- if (!strncmp (respbuf, "+ ", 2))
- return response;
- retcode = imap_next_word (respbuf);
- if (!strncmp (retcode, "OK", 2))
- return response;
-
- /* We should never get BAD, or anything else but +, OK, or NO
- * for that matter.
- */
- if (strncmp (retcode, "NO", 2) != 0) {
- g_warning ("Unexpected response from IMAP server: %s",
- respbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Unexpected response from IMAP "
- "server: %s"), respbuf);
- camel_imap_response_free (response);
- return NULL;
- }
-
- retcode = imap_next_word (retcode);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("IMAP command failed: %s"),
- retcode ? retcode : _("Unknown error"));
- camel_imap_response_free (response);
- return NULL;
-}
-
-/* Given a line that is the start of an untagged response, read and
- * return the complete response, which may include an arbitrary number
- * of literals.
- */
-static char *
-imap_read_untagged (CamelImapStore *store, char *line, CamelException *ex)
-{
- int fulllen, length, ldigits, nread, i;
- GPtrArray *data;
- GString *str;
- char *end, *p, *s, *d;
-
- p = strrchr (line, '{');
- if (!p)
- return line;
-
- data = g_ptr_array_new ();
- fulllen = 0;
-
- while (1) {
- str = g_string_new (line);
- g_free (line);
- fulllen += str->len;
- g_ptr_array_add (data, str);
-
- p = strrchr (str->str, '{');
- if (!p)
- break;
-
- length = strtoul (p + 1, &end, 10);
- if (*end != '}' || *(end + 1) || end == p + 1)
- break;
- ldigits = end - (p + 1);
-
- /* Read the literal */
- str = g_string_sized_new (length + 2);
- str->str[0] = '\n';
- nread = camel_stream_read (CAMEL_REMOTE_STORE (store)->istream,
- str->str + 1, length);
- if (nread == -1) {
- if (errno == EINTR)
- camel_exception_set(ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled"));
- else
- camel_exception_set(ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, strerror(errno));
- camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
- goto lose;
- }
- if (nread < length) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Server response ended too soon."));
- camel_service_disconnect (CAMEL_SERVICE (store),
- FALSE, NULL);
- goto lose;
- }
- str->str[length + 1] = '\0';
-
- /* Fix up the literal, turning CRLFs into LF. Also, if
- * we find any embedded NULs, strip them. This is
- * dubious, but:
- * - The IMAP grammar says you can't have NULs here
- * anyway, so this will not affect our behavior
- * against any completely correct server.
- * - WU-imapd 12.264 (at least) will cheerily pass
- * NULs along if they are embedded in the message
- * - The only cause of embedded NULs we've seen is an
- * Evolution base64-encoder bug that sometimes
- * inserts a NUL into the last line when it
- * shouldn't.
- */
-
- s = d = str->str + 1;
- end = str->str + 1 + length;
- while (s < end) {
- while (s < end && *s == '\0') {
- s++;
- length--;
- }
- if (*s == '\r' && *(s + 1) == '\n') {
- s++;
- length--;
- }
- *d++ = *s++;
- }
- *d = '\0';
- str->len = length + 1;
-
- /* p points to the "{" in the line that starts the
- * literal. The length of the CR-less response must be
- * less than or equal to the length of the response
- * with CRs, therefore overwriting the old value with
- * the new value cannot cause an overrun. However, we
- * don't want it to be shorter either, because then the
- * GString's length would be off...
- */
- sprintf (p, "{%0*d}", ldigits, length);
-
- fulllen += str->len;
- g_ptr_array_add (data, str);
-
- /* Read the next line. */
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store),
- &line, ex) < 0)
- goto lose;
- }
-
- /* Now reassemble the data. */
- p = line = g_malloc (fulllen + 1);
- for (i = 0; i < data->len; i++) {
- str = data->pdata[i];
- memcpy (p, str->str, str->len);
- p += str->len;
- g_string_free (str, TRUE);
- }
- *p = '\0';
- g_ptr_array_free (data, TRUE);
- return line;
-
- lose:
- for (i = 0; i < data->len; i++)
- g_string_free (data->pdata[i], TRUE);
- g_ptr_array_free (data, TRUE);
- return NULL;
-}
-
-
-/**
- * camel_imap_response_free:
- * response: a CamelImapResponse:
- *
- * Frees all of the data in @response.
- **/
-void
-camel_imap_response_free (CamelImapResponse *response)
-{
- int i;
-
- if (!response)
- return;
- for (i = 0; i < response->untagged->len; i++)
- g_free (response->untagged->pdata[i]);
- g_ptr_array_free (response->untagged, TRUE);
- g_free (response->status);
- g_free (response);
-}
-
-/**
- * camel_imap_response_extract:
- * @response: the response data returned from camel_imap_command
- * @type: the response type to extract
- * @ex: a CamelException
- *
- * This checks that @response contains a single untagged response of
- * type @type and returns just that response data. If @response
- * doesn't contain the right information, the function will set @ex and
- * return %NULL. Either way, @response will be freed.
- *
- * Return value: the desired response string, which the caller must free.
- **/
-char *
-camel_imap_response_extract (CamelImapResponse *response, const char *type,
- CamelException *ex)
-{
- int len = strlen (type), i;
- char *resp;
-
- for (i = 0; i < response->untagged->len; i++) {
- resp = response->untagged->pdata[i];
- /* Skip "* ", and initial sequence number, if present */
- strtoul (resp + 2, &resp, 10);
- if (*resp == ' ')
- resp = imap_next_word (resp);
-
- if (!g_strncasecmp (resp, type, len))
- break;
-
- g_free (response->untagged->pdata[i]);
- }
-
- if (i < response->untagged->len) {
- resp = response->untagged->pdata[i];
- for (i++; i < response->untagged->len; i++)
- g_free (response->untagged->pdata[i]);
- } else {
- resp = NULL;
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("IMAP server response did not contain "
- "%s information"), type);
- }
-
- g_ptr_array_free (response->untagged, TRUE);
- g_free (response->status);
- g_free (response);
- return resp;
-}
-
-/**
- * camel_imap_response_extract_continuation:
- * @response: the response data returned from camel_imap_command
- * @ex: a CamelException
- *
- * This checks that @response contains a continuation response, and
- * returns just that data. If @response doesn't contain a continuation
- * response, the function will set @ex and return %NULL. Either way,
- * @response will be freed.
- *
- * Return value: the desired response string, which the caller must free.
- **/
-char *
-camel_imap_response_extract_continuation (CamelImapResponse *response,
- CamelException *ex)
-{
- char *status;
-
- if (response->status && !strncmp (response->status, "+ ", 2)) {
- status = response->status;
- response->status = NULL;
- camel_imap_response_free (response);
- return status;
- }
-
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Unexpected OK response from IMAP server: %s"),
- response->status);
- camel_imap_response_free (response);
- return NULL;
-}
-
-
-static char *
-imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt,
- va_list ap)
-{
- GPtrArray *args;
- const char *p, *start;
- char *out, *op, *string;
- int num, len, i;
-
- args = g_ptr_array_new ();
-
- /* Determine the length of the data */
- len = strlen (fmt);
- p = start = fmt;
- while (*p) {
- p = strchr (start, '%');
- if (!p)
- break;
-
- switch (*++p) {
- case 'd':
- num = va_arg (ap, int);
- g_ptr_array_add (args, GINT_TO_POINTER (num));
- start = p + 1;
- len += 10;
- break;
-
- case 's':
- string = va_arg (ap, char *);
- g_ptr_array_add (args, string);
- start = p + 1;
- len += strlen (string);
- break;
-
- case 'S':
- string = va_arg (ap, char *);
- g_ptr_array_add (args, string);
- if (store->capabilities & IMAP_CAPABILITY_LITERALPLUS)
- len += strlen (string) + 15;
- else
- len += strlen (string) * 2;
- start = p + 1;
- break;
-
- case '%':
- start = p;
- break;
-
- default:
- g_warning ("camel-imap-command is not printf. I don't "
- "know what '%%%c' means.", *p);
- start = *p ? p + 1 : p;
- break;
- }
- }
-
- /* Now write out the string */
- op = out = g_malloc (len + 1);
- p = start = fmt;
- i = 0;
- while (*p) {
- p = strchr (start, '%');
- if (!p) {
- strcpy (op, start);
- break;
- } else {
- strncpy (op, start, p - start);
- op += p - start;
- }
-
- switch (*++p) {
- case 'd':
- num = GPOINTER_TO_INT (args->pdata[i++]);
- op += sprintf (op, "%d", num);
- break;
-
- case 's':
- string = args->pdata[i++];
- op += sprintf (op, "%s", string);
- break;
-
- case 'S':
- string = args->pdata[i++];
- if (store->capabilities & IMAP_CAPABILITY_LITERALPLUS) {
- op += sprintf (op, "{%d+}\r\n%s",
- strlen (string), string);
- } else {
- char *quoted = imap_quote_string (string);
- op += sprintf (op, "%s", quoted);
- g_free (quoted);
- }
- break;
-
- default:
- *op++ = '%';
- *op++ = *p;
- }
-
- start = *p ? p + 1 : p;
- }
-
- return out;
-}
diff --git a/camel/providers/imap/camel-imap-command.h b/camel/providers/imap/camel-imap-command.h
deleted file mode 100644
index a7d3c3eae9..0000000000
--- a/camel/providers/imap/camel-imap-command.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-imap-command.h: IMAP command sending/parsing routines */
-
-/*
- * Authors:
- * Dan Winship <danw@helixcode.com>
- * Jeffrey Stedfast <fejj@helixcode.com>
- *
- * Copyright (C) 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
- */
-
-
-#ifndef CAMEL_IMAP_COMMAND_H
-#define CAMEL_IMAP_COMMAND_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-imap-types.h"
-#include <glib.h>
-
-struct _CamelImapResponse {
- GPtrArray *untagged;
- char *status;
-};
-
-CamelImapResponse *camel_imap_command (CamelImapStore *store,
- CamelFolder *folder,
- CamelException *ex,
- const char *fmt, ...);
-CamelImapResponse *camel_imap_command_continuation (CamelImapStore *store,
- CamelException *ex,
- const char *cmdbuf);
-
-void camel_imap_response_free (CamelImapResponse *response);
-char *camel_imap_response_extract (CamelImapResponse *response,
- const char *type,
- CamelException *ex);
-char *camel_imap_response_extract_continuation (CamelImapResponse *response,
- CamelException *ex);
-
-#endif /* CAMEL_IMAP_COMMAND_H */
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
deleted file mode 100644
index cf91bceb12..0000000000
--- a/camel/providers/imap/camel-imap-folder.c
+++ /dev/null
@@ -1,1152 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-imap-folder.c: class for an imap folder */
-
-/*
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- *
- * Copyright (C) 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 <ctype.h>
-
-#include <gal/util/e-util.h>
-
-#include "camel-imap-folder.h"
-#include "camel-imap-command.h"
-#include "camel-imap-search.h"
-#include "camel-imap-store.h"
-#include "camel-imap-summary.h"
-#include "camel-imap-utils.h"
-#include "camel-imap-wrapper.h"
-#include "string-utils.h"
-#include "camel-stream.h"
-#include "camel-stream-fs.h"
-#include "camel-stream-mem.h"
-#include "camel-stream-buffer.h"
-#include "camel-data-wrapper.h"
-#include "camel-mime-message.h"
-#include "camel-stream-filter.h"
-#include "camel-mime-filter-from.h"
-#include "camel-mime-filter-crlf.h"
-#include "camel-exception.h"
-#include "camel-mime-utils.h"
-#include "camel-imap-private.h"
-#include "camel-multipart.h"
-#include "camel-operation.h"
-
-#define d(x) x
-
-#define CF_CLASS(o) (CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(o)))
-
-static CamelFolderClass *parent_class = NULL;
-
-static void imap_finalize (CamelObject *object);
-static void imap_rescan (CamelFolder *folder, int exists, CamelException *ex);
-static void imap_refresh_info (CamelFolder *folder, CamelException *ex);
-static void imap_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
-static const char *imap_get_full_name (CamelFolder *folder);
-static void imap_expunge (CamelFolder *folder, CamelException *ex);
-
-/* message manipulation */
-static CamelMimeMessage *imap_get_message (CamelFolder *folder, const gchar *uid,
- CamelException *ex);
-static void imap_append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex);
-static void imap_copy_message_to (CamelFolder *source, const char *uid,
- CamelFolder *destination, CamelException *ex);
-static void imap_move_message_to (CamelFolder *source, const char *uid,
- CamelFolder *destination, CamelException *ex);
-
-/* summary info */
-static void imap_update_summary (CamelFolder *folder, int first, int last,
- CamelFolderChangeInfo *changes,
- CamelException *ex);
-
-/* searching */
-static GPtrArray *imap_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex);
-static void imap_search_free (CamelFolder *folder, GPtrArray *uids);
-
-static void
-camel_imap_folder_class_init (CamelImapFolderClass *camel_imap_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_imap_folder_class);
-
- parent_class = CAMEL_FOLDER_CLASS(camel_type_get_global_classfuncs (camel_folder_get_type ()));
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_folder_class->refresh_info = imap_refresh_info;
- camel_folder_class->sync = imap_sync;
- camel_folder_class->expunge = imap_expunge;
- camel_folder_class->get_full_name = imap_get_full_name;
-
- camel_folder_class->get_message = imap_get_message;
- camel_folder_class->append_message = imap_append_message;
- camel_folder_class->copy_message_to = imap_copy_message_to;
- camel_folder_class->move_message_to = imap_move_message_to;
-
- camel_folder_class->search_by_expression = imap_search_by_expression;
- camel_folder_class->search_free = imap_search_free;
-}
-
-static void
-camel_imap_folder_init (gpointer object, gpointer klass)
-{
- CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (object);
- CamelFolder *folder = CAMEL_FOLDER (object);
-
- folder->has_summary_capability = TRUE;
- folder->has_search_capability = TRUE;
-
- imap_folder->priv = g_malloc0(sizeof(*imap_folder->priv));
-#ifdef ENABLE_THREADS
- imap_folder->priv->search_lock = g_mutex_new();
-#endif
-}
-
-CamelType
-camel_imap_folder_get_type (void)
-{
- static CamelType camel_imap_folder_type = CAMEL_INVALID_TYPE;
-
- if (camel_imap_folder_type == CAMEL_INVALID_TYPE) {
- camel_imap_folder_type =
- camel_type_register (CAMEL_FOLDER_TYPE, "CamelImapFolder",
- sizeof (CamelImapFolder),
- sizeof (CamelImapFolderClass),
- (CamelObjectClassInitFunc) camel_imap_folder_class_init,
- NULL,
- (CamelObjectInitFunc) camel_imap_folder_init,
- (CamelObjectFinalizeFunc) imap_finalize);
- }
-
- return camel_imap_folder_type;
-}
-
-CamelFolder *
-camel_imap_folder_new (CamelStore *parent, const char *folder_name,
- const char *short_name, const char *summary_file,
- CamelException *ex)
-{
- CamelImapStore *imap_store = CAMEL_IMAP_STORE (parent);
- CamelFolder *folder = CAMEL_FOLDER (camel_object_new (camel_imap_folder_get_type ()));
- CamelImapResponse *response;
- char *resp;
- guint32 validity = 0;
- int i, exists = 0;
-
- camel_folder_construct (folder, parent, folder_name, short_name);
-
- CAMEL_IMAP_STORE_LOCK(imap_store, command_lock);
- response = camel_imap_command (imap_store, folder, ex, NULL);
- CAMEL_IMAP_STORE_UNLOCK(imap_store, command_lock);
-
- if (!response) {
- camel_object_unref ((CamelObject *)folder);
- return NULL;
- }
-
- for (i = 0; i < response->untagged->len; i++) {
- resp = response->untagged->pdata[i] + 2;
- if (!g_strncasecmp (resp, "FLAGS ", 6)) {
- resp += 6;
- folder->permanent_flags = imap_parse_flag_list (&resp);
- } else if (!g_strncasecmp (resp, "OK [PERMANENTFLAGS ", 19)) {
- resp += 19;
- folder->permanent_flags = imap_parse_flag_list (&resp);
- } else if (!g_strncasecmp (resp, "OK [UIDVALIDITY ", 16)) {
- validity = strtoul (resp + 16, NULL, 10);
- } else if (isdigit ((unsigned char)*resp)) {
- unsigned long num = strtoul (resp, &resp, 10);
-
- if (!g_strncasecmp (resp, " EXISTS", 7))
- exists = num;
- }
- }
- camel_imap_response_free (response);
-
- folder->summary = camel_imap_summary_new (summary_file, validity);
- if (!folder->summary) {
- camel_object_unref (CAMEL_OBJECT (folder));
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not load summary for %s"),
- folder_name);
- return NULL;
- }
-
- CAMEL_IMAP_STORE_LOCK(imap_store, command_lock);
- imap_rescan (folder, exists, ex);
- CAMEL_IMAP_STORE_UNLOCK(imap_store, command_lock);
- if (camel_exception_is_set (ex)) {
- camel_object_unref (CAMEL_OBJECT (folder));
- return NULL;
- }
-
- return folder;
-}
-
-/* Called with the store's command_lock locked */
-void
-camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
- CamelException *ex)
-{
- unsigned long exists = 0, val, uid;
- CamelMessageInfo *info;
- int i, count;
- char *resp;
-
- for (i = 0; i < response->untagged->len; i++) {
- resp = response->untagged->pdata[i] + 2;
-
- exists = strtoul (resp, &resp, 10);
- if (!g_strncasecmp (resp, " EXISTS", 7))
- break;
- }
- if (i == response->untagged->len) {
- g_warning ("Server response did not include EXISTS info");
- return;
- }
-
- count = camel_folder_summary_count (folder->summary);
-
- /* If we've lost messages, we have to rescan everything */
- if (exists < count) {
- imap_rescan (folder, exists, ex);
- return;
- }
-
- if (count != 0) {
- /* Similarly, if the UID of the highest message we
- * know about has changed, then that indicates that
- * messages have been both added and removed, so we
- * have to rescan to find the removed ones. (We pass
- * NULL for the folder since we know that this folder
- * is selected, and we don't want camel_imap_command
- * to worry about it.)
- */
- response = camel_imap_command (CAMEL_IMAP_STORE (folder->parent_store),
- NULL, ex, "FETCH %d UID", count);
- if (!response)
- return;
- uid = 0;
- for (i = 0; i < response->untagged->len; i++) {
- resp = response->untagged->pdata[i];
- val = strtoul (resp + 2, &resp, 10);
- if (val != count || g_strncasecmp (resp, " FETCH (", 8) != 0)
- continue;
- resp = e_strstrcase (resp, "UID ");
- if (!resp)
- continue;
- uid = strtoul (resp + 4, NULL, 10);
- break;
- }
- camel_imap_response_free (response);
-
- info = camel_folder_summary_index (folder->summary, count - 1);
- val = strtoul (camel_message_info_uid (info), NULL, 10);
- camel_folder_summary_info_free (folder->summary, info);
- if (uid == 0 || uid != val) {
- imap_rescan (folder, exists, ex);
- return;
- }
- }
-
- /* OK. So now we know that no messages have been expunged. Whew.
- * Now see if messages have been added.
- */
- if (exists > count)
- camel_imap_folder_changed (folder, exists, NULL, ex);
-
- /* And we're done. */
-}
-
-static void
-imap_finalize (CamelObject *object)
-{
- CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (object);
-
- if (imap_folder->search)
- camel_object_unref ((CamelObject *)imap_folder->search);
-
-#ifdef ENABLE_THREADS
- g_mutex_free(imap_folder->priv->search_lock);
-#endif
- g_free(imap_folder->priv);
-}
-
-static void
-imap_refresh_info (CamelFolder *folder, CamelException *ex)
-{
- CAMEL_IMAP_STORE_LOCK (folder->parent_store, command_lock);
- imap_rescan (folder, camel_folder_summary_count (folder->summary), ex);
- CAMEL_IMAP_STORE_UNLOCK (folder->parent_store, command_lock);
-}
-
-/* Called with the store's command_lock locked */
-static void
-imap_rescan (CamelFolder *folder, int exists, CamelException *ex)
-{
- CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
- CamelImapResponse *response;
- struct {
- char *uid;
- guint32 flags;
- } *new = NULL;
- char *resp, *p, *flags;
- const char *uid;
- int i, j, seq, summary_len;
- CamelMessageInfo *info;
- CamelImapMessageInfo *iinfo;
- GArray *removed;
-
- camel_operation_start(NULL, _("Scanning IMAP folder"));
-
- /* Get UIDs and flags of all messages. */
- if (exists > 0) {
- response = camel_imap_command (store, folder, ex,
- "FETCH 1:%d (UID FLAGS)",
- exists);
- if (!response)
- return;
-
- new = g_malloc0 (exists * sizeof (*new));
- for (i = 0; i < response->untagged->len; i++) {
- resp = response->untagged->pdata[i];
-
- seq = strtoul (resp + 2, &resp, 10);
- if (g_strncasecmp (resp, " FETCH ", 7) != 0)
- continue;
-
- uid = e_strstrcase (resp, "UID ");
- if (uid) {
- uid += 4;
- strtoul (uid, &p, 10);
- new[seq - 1].uid = g_strndup (uid, p - uid);
- }
-
- flags = e_strstrcase (resp, "FLAGS ");
- if (flags) {
- flags += 6;
- new[seq - 1].flags = imap_parse_flag_list (&flags);
- }
- }
- camel_imap_response_free (response);
- }
-
- /* If we find a UID in the summary that doesn't correspond to
- * the UID in the folder, that it means the message was
- * deleted on the server, so we remove it from the summary.
- */
- removed = g_array_new (FALSE, FALSE, sizeof (int));
- summary_len = camel_folder_summary_count (folder->summary);
- for (i = 0; i < summary_len && i < exists; i++) {
- int pc = (i*100)/MIN(summary_len, exists);
-
- camel_operation_progress(NULL, pc);
-
- /* Shouldn't happen, but... */
- if (!new[i].uid)
- continue;
-
- info = camel_folder_summary_index (folder->summary, i);
- iinfo = (CamelImapMessageInfo *)info;
-
- if (strcmp (camel_message_info_uid (info), new[i].uid) != 0) {
- seq = i + 1;
- g_array_append_val (removed, seq);
- i--;
- summary_len--;
- continue;
- }
-
- /* Update summary flags */
- if (new[i].flags != iinfo->server_flags) {
- guint32 server_set, server_cleared;
-
- server_set = new[i].flags & ~iinfo->server_flags;
- server_cleared = iinfo->server_flags & ~new[i].flags;
-
- info->flags = (info->flags | server_set) & ~server_cleared;
- iinfo->server_flags = new[i].flags;
-
- camel_object_trigger_event (CAMEL_OBJECT (folder),
- "message_changed",
- g_strdup (new[i].uid));
- }
-
- camel_folder_summary_info_free(folder->summary, info);
-
- g_free (new[i].uid);
- }
-
- /* Remove any leftover cached summary messages. */
- for (j = i + 1; j < summary_len; j++) {
- seq = j - removed->len;
- g_array_append_val (removed, seq);
- }
-
- /* Free remaining memory. */
- while (i < exists)
- g_free (new[i++].uid);
- g_free (new);
-
- /* And finally update the summary. */
- camel_imap_folder_changed (folder, exists, removed, ex);
- g_array_free (removed, TRUE);
-
- camel_operation_end(NULL);
-}
-
-/* Find all messages in @folder with flags matching @flags and @mask.
- * If no messages match, returns %NULL. Otherwise, returns an array of
- * CamelMessageInfo and sets *@set to a message set corresponding the
- * UIDs of the matched messages. The caller must free the infos, the
- * array, and the set string.
- */
-static GPtrArray *
-get_matching (CamelFolder *folder, guint32 flags, guint32 mask, char **set)
-{
- GPtrArray *matches;
- CamelMessageInfo *info;
- int i, max, range;
- GString *gset;
-
- matches = g_ptr_array_new ();
- gset = g_string_new ("");
- max = camel_folder_summary_count (folder->summary);
- range = -1;
- for (i = 0; i < max; i++) {
- info = camel_folder_summary_index (folder->summary, i);
- if (!info)
- continue;
- if ((info->flags & mask) != flags) {
- camel_folder_summary_info_free (folder->summary, info);
- if (range != -1) {
- if (range != i - 1) {
- info = matches->pdata[matches->len - 1];
- g_string_sprintfa (gset, ":%s", camel_message_info_uid (info));
- }
- range = -1;
- }
- continue;
- }
-
- g_ptr_array_add (matches, info);
- if (range != -1)
- continue;
- range = i;
- if (gset->len)
- g_string_append_c (gset, ',');
- g_string_sprintfa (gset, "%s", camel_message_info_uid (info));
- }
- if (range != -1 && range != max - 1) {
- info = matches->pdata[matches->len - 1];
- g_string_sprintfa (gset, ":%s", camel_message_info_uid (info));
- }
-
- if (matches->len) {
- *set = gset->str;
- g_string_free (gset, FALSE);
- return matches;
- } else {
- g_string_free (gset, TRUE);
- g_ptr_array_free (matches, TRUE);
- return NULL;
- }
-}
-
-static void
-imap_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
- CamelImapResponse *response;
- CamelMessageInfo *info;
- GPtrArray *matches;
- char *set, *flaglist;
- int i, j, max;
-
- max = camel_folder_summary_count (folder->summary);
-
- /* If we're expunging then we don't need to be precise about the
- * flags of deleted messages. Just add \Deleted to anything that
- * should have it.
- */
- if (expunge && (matches = get_matching (folder, CAMEL_MESSAGE_DELETED,
- CAMEL_MESSAGE_DELETED, &set))) {
- for (i = 0; i < matches->len; i++) {
- info = matches->pdata[i];
- info->flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_folder_summary_info_free (folder->summary, info);
- }
- g_ptr_array_free (matches, TRUE);
- camel_folder_summary_touch (folder->summary);
-
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
- response = camel_imap_command (store, folder, ex,
- "UID STORE %s +FLAGS.SILENT \\Deleted",
- set);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
- g_free (set);
- if (response)
- camel_imap_response_free (response);
- if (camel_exception_is_set (ex))
- return;
- }
-
- /* OK, now, find a message with changed flags, find all of the
- * other messages like it, sync them as a group, mark them as
- * updated, and continue.
- */
- for (i = 0; i < max; i++) {
- info = camel_folder_summary_index (folder->summary, i);
- if (!info)
- continue;
- if (!(info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED)) {
- camel_folder_summary_info_free (folder->summary, info);
- continue;
- }
-
- flaglist = imap_create_flag_list (info->flags);
- matches = get_matching (folder, info->flags & (CAMEL_IMAP_SERVER_FLAGS | CAMEL_MESSAGE_FOLDER_FLAGGED),
- CAMEL_IMAP_SERVER_FLAGS | CAMEL_MESSAGE_FOLDER_FLAGGED, &set);
- camel_folder_summary_info_free (folder->summary, info);
-
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
- response = camel_imap_command (store, folder, ex,
- "UID STORE %s FLAGS.SILENT %s",
- set, flaglist);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
- g_free (set);
- g_free (flaglist);
- if (response)
- camel_imap_response_free (response);
- if (!camel_exception_is_set (ex)) {
- for (j = 0; j < matches->len; j++) {
- info = matches->pdata[j];
- info->flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
- ((CamelImapMessageInfo*)info)->server_flags =
- info->flags & CAMEL_IMAP_SERVER_FLAGS;
- }
- camel_folder_summary_touch (folder->summary);
- }
- for (j = 0; j < matches->len; j++) {
- info = matches->pdata[j];
- camel_folder_summary_info_free (folder->summary, info);
- }
- g_ptr_array_free (matches, TRUE);
-
- if (camel_exception_is_set (ex))
- return;
- }
-
- if (expunge) {
- CAMEL_IMAP_STORE_LOCK(store, command_lock);
- response = camel_imap_command (store, folder, ex, "EXPUNGE");
- CAMEL_IMAP_STORE_UNLOCK(store, command_lock);
- camel_imap_response_free (response);
- }
-
- camel_folder_summary_save (folder->summary);
-
- camel_operation_end(NULL);
-}
-
-static void
-imap_expunge (CamelFolder *folder, CamelException *ex)
-{
- imap_sync (folder, TRUE, ex);
-}
-
-static const char *
-imap_get_full_name (CamelFolder *folder)
-{
- CamelURL *url = ((CamelService *)folder->parent_store)->url;
- int len;
-
- if (!url->path || !*url->path || !strcmp (url->path, "/"))
- return folder->full_name;
- len = strlen (url->path + 1);
- if (!strncmp (url->path + 1, folder->full_name, len) &&
- strlen (folder->full_name) > len + 1)
- return folder->full_name + len + 1;
- return folder->full_name;
-}
-
-static void
-imap_append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex)
-{
- CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
- CamelImapResponse *response;
- CamelStream *memstream;
- CamelMimeFilter *crlf_filter;
- CamelStreamFilter *streamfilter;
- GByteArray *ba;
- char *flagstr, *result;
-
- /* create flag string param */
- if (info && info->flags)
- flagstr = imap_create_flag_list (info->flags);
- else
- flagstr = NULL;
-
- /* FIXME: We could avoid this if we knew how big the message was. */
- memstream = camel_stream_mem_new ();
- ba = g_byte_array_new ();
- camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (memstream), ba);
-
- streamfilter = camel_stream_filter_new_with_stream (memstream);
- crlf_filter = camel_mime_filter_crlf_new (
- CAMEL_MIME_FILTER_CRLF_ENCODE,
- CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
- camel_stream_filter_add (streamfilter, crlf_filter);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message),
- CAMEL_STREAM (streamfilter));
- camel_object_unref (CAMEL_OBJECT (streamfilter));
- camel_object_unref (CAMEL_OBJECT (crlf_filter));
- camel_object_unref (CAMEL_OBJECT (memstream));
-
- CAMEL_IMAP_STORE_LOCK(store, command_lock);
- response = camel_imap_command (store, NULL, ex, "APPEND %S%s%s {%d}",
- folder->full_name, flagstr ? " " : "",
- flagstr ? flagstr : "", ba->len);
- g_free (flagstr);
-
- if (!response) {
- g_byte_array_free (ba, TRUE);
- CAMEL_IMAP_STORE_UNLOCK(store, command_lock);
- return;
- }
- result = camel_imap_response_extract_continuation (response, ex);
- if (!result) {
- g_byte_array_free (ba, TRUE);
- CAMEL_IMAP_STORE_UNLOCK(store, command_lock);
- return;
- }
- g_free (result);
-
- /* send the rest of our data - the mime message */
- g_byte_array_append (ba, "\0", 3);
- response = camel_imap_command_continuation (store, ex, ba->data);
- g_byte_array_free (ba, TRUE);
- CAMEL_IMAP_STORE_UNLOCK(store, command_lock);
- if (!response)
- return;
- camel_imap_response_free (response);
-}
-
-static void
-imap_copy_message_to (CamelFolder *source, const char *uid,
- CamelFolder *destination, CamelException *ex)
-{
- CamelImapStore *store = CAMEL_IMAP_STORE (source->parent_store);
- CamelImapResponse *response;
- CamelMessageInfo *mi;
-
- mi = camel_folder_summary_uid (source->summary, uid);
- g_return_if_fail (mi != NULL);
-
- /* Sync message flags if needed. */
- if (mi->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) {
- char *flaglist;
-
- flaglist = imap_create_flag_list (mi->flags);
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
- response = camel_imap_command (store, source, ex,
- "UID STORE %s FLAGS.SILENT %s",
- camel_message_info_uid (mi),
- flaglist);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
- g_free (flaglist);
- if (camel_exception_is_set (ex)) {
- camel_folder_summary_info_free (source->summary, mi);
- return;
- }
- camel_imap_response_free (response);
-
- mi->flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
- ((CamelImapMessageInfo *)mi)->server_flags =
- mi->flags & CAMEL_IMAP_SERVER_FLAGS;
- }
- camel_folder_summary_info_free (source->summary, mi);
-
- if (camel_exception_is_set (ex))
- return;
-
- /* Now copy it */
- CAMEL_IMAP_STORE_LOCK(store, command_lock);
- response = camel_imap_command (store, source, ex, "UID COPY %s %S",
- uid, destination->full_name);
- CAMEL_IMAP_STORE_UNLOCK(store, command_lock);
-
- if (camel_exception_is_set (ex))
- return;
-
- camel_imap_response_free (response);
-
- /* Force the destination folder to notice its new messages. */
- response = camel_imap_command (store, destination, NULL, "NOOP");
- camel_imap_response_free (response);
- }
-
-static void
-imap_move_message_to (CamelFolder *source, const char *uid,
- CamelFolder *destination, CamelException *ex)
-{
- imap_copy_message_to (source, uid, destination, ex);
- if (camel_exception_is_set (ex))
- return;
-
- camel_folder_delete_message (source, uid);
-}
-
-static GPtrArray *
-imap_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex)
-{
- CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
- GPtrArray *matches, *summary;
-
- /* we could get around this by creating a new search object each time,
- but i doubt its worth it since any long operation would lock the
- command channel too */
- CAMEL_IMAP_FOLDER_LOCK(folder, search_lock);
-
- if (!imap_folder->search)
- imap_folder->search = camel_imap_search_new ();
-
- camel_folder_search_set_folder (imap_folder->search, folder);
- summary = camel_folder_get_summary(folder);
- camel_folder_search_set_summary(imap_folder->search, summary);
- matches = camel_folder_search_execute_expression (imap_folder->search, expression, ex);
-
- CAMEL_IMAP_FOLDER_UNLOCK(folder, search_lock);
-
- camel_folder_free_summary(folder, summary);
-
- return matches;
-}
-
-static void
-imap_search_free (CamelFolder *folder, GPtrArray *uids)
-{
- CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
-
- g_return_if_fail (imap_folder->search);
-
- CAMEL_IMAP_FOLDER_LOCK(folder, search_lock);
-
- camel_folder_search_free_result (imap_folder->search, uids);
-
- CAMEL_IMAP_FOLDER_UNLOCK(folder, search_lock);
-}
-
-/* parse a header response (starting after the first ' ' after
- * *@headers_p) and construct a content-free CamelMedium from it.
- */
-static CamelMedium *
-parse_headers (char **headers_p, CamelType medium_type)
-{
- CamelMedium *medium;
- CamelStream *stream;
- char *headers;
- int len;
-
- *headers_p = strchr (*headers_p, ' ');
- if (!*headers_p)
- return FALSE;
- (*headers_p)++;
-
- headers = imap_parse_nstring (headers_p, &len);
- if (!headers)
- return FALSE;
- stream = camel_stream_mem_new_with_buffer (headers, len);
- g_free (headers);
-
- medium = CAMEL_MEDIUM (camel_object_new (medium_type));
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (medium), stream);
- camel_object_unref (CAMEL_OBJECT (stream));
-
- return medium;
-}
-
-static CamelMedium *
-fetch_medium (CamelFolder *folder, const char *uid, const char *section_text,
- CamelType type, CamelException *ex)
-{
- CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
- CamelImapResponse *response;
- CamelMedium *medium;
- char *result, *p;
-
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
- if (store->server_level < IMAP_LEVEL_IMAP4REV1 && !*section_text) {
- response = camel_imap_command (store, folder, ex,
- "UID FETCH %s RFC822.PEEK",
- uid);
- } else {
- response = camel_imap_command (store, folder, ex,
- "UID FETCH %s BODY.PEEK[%s]",
- uid, section_text);
- }
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
- if (!response)
- return NULL;
-
- /* FIXME: there could be multiple lines of FETCH response. */
- result = camel_imap_response_extract (response, "FETCH", ex);
- if (!result)
- return NULL;
-
-
- if (store->server_level < IMAP_LEVEL_IMAP4REV1 && !*section_text)
- p = e_strstrcase (result, "RFC822");
- else
- p = e_strstrcase (result, "BODY");
-
- if (p)
- medium = parse_headers (&p, type);
- else {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Could not find message body in FETCH "
- "response."));
- medium = NULL;
- }
- g_free (result);
-
- return medium;
-}
-
-static CamelMimeMessage *get_message (CamelFolder *folder, const char *uid,
- const char *part_specifier,
- CamelMessageContentInfo *ci,
- CamelException *ex);
-
-/* Fetch the contents of the MIME part indicated by @ci, which is part
- * of message @uid in @folder.
- */
-static CamelDataWrapper *
-get_content (CamelFolder *folder, const char *uid, const char *part_spec,
- CamelMimePart *part, CamelMessageContentInfo *ci,
- CamelException *ex)
-{
- char *child_spec;
-
- /* There are three cases: multipart, message/rfc822, and "other" */
-
- if (header_content_type_is (ci->type, "multipart", "*")) {
- CamelMultipart *body_mp;
- CamelDataWrapper *content;
- int speclen, num;
-
- body_mp = camel_multipart_new ();
- camel_data_wrapper_set_mime_type_field (
- CAMEL_DATA_WRAPPER (body_mp), ci->type);
- camel_multipart_set_boundary (body_mp, NULL);
-
- speclen = strlen (part_spec);
- child_spec = g_malloc (speclen + 15);
- memcpy (child_spec, part_spec, speclen);
- if (speclen > 0)
- child_spec[speclen++] = '.';
-
- ci = ci->childs;
- num = 1;
- while (ci) {
- sprintf (child_spec + speclen, "%d.MIME", num++);
- part = (CamelMimePart *)fetch_medium (folder, uid, child_spec, CAMEL_MIME_PART_TYPE, ex);
- *(strchr (child_spec + speclen, '.')) = '\0';
- if (part)
- content = get_content (folder, uid, child_spec, part, ci, ex);
- if (!part || !content) {
- g_free (child_spec);
- camel_object_unref (CAMEL_OBJECT (part));
- camel_object_unref (CAMEL_OBJECT (body_mp));
- return NULL;
- }
- camel_medium_set_content_object (CAMEL_MEDIUM (part),
- content);
- camel_object_unref (CAMEL_OBJECT (content));
- camel_multipart_add_part (body_mp, part);
- camel_object_unref (CAMEL_OBJECT (part));
-
- ci = ci->next;
- }
- g_free (child_spec);
-
- return (CamelDataWrapper *)body_mp;
- } else if (header_content_type_is (ci->type, "message", "rfc822")) {
- return (CamelDataWrapper *)
- get_message (folder, uid, part_spec, ci->childs, ex);
- } else {
- CamelDataWrapper *content;
-
- if (!ci->parent || header_content_type_is (ci->parent->type, "message", "rfc822"))
- child_spec = g_strdup_printf ("%s%s1", part_spec, *part_spec ? "." : "");
- else
- child_spec = g_strdup (part_spec);
- content = camel_imap_wrapper_new (folder, ci->type, uid, child_spec, part);
- g_free (child_spec);
- return content;
- }
-}
-
-static CamelMimeMessage *
-get_message (CamelFolder *folder, const char *uid, const char *part_spec,
- CamelMessageContentInfo *ci, CamelException *ex)
-{
- CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
- CamelDataWrapper *content;
- CamelMimeMessage *msg;
- char *section_text;
-
- section_text = g_strdup_printf ("%s%s%s", part_spec, *part_spec ? "." : "",
- store->server_level >= IMAP_LEVEL_IMAP4REV1 ? "HEADER" : "0");
- msg = (CamelMimeMessage *)fetch_medium (folder, uid, section_text, CAMEL_MIME_MESSAGE_TYPE, ex);
- g_free (section_text);
- if (!msg)
- return NULL;
-
- content = get_content (folder, uid, part_spec, CAMEL_MIME_PART (msg), ci, ex);
- if (!content) {
- camel_object_unref (CAMEL_OBJECT (msg));
- return NULL;
- }
-
- camel_medium_set_content_object (CAMEL_MEDIUM (msg), content);
- camel_object_unref (CAMEL_OBJECT (content));
-
- return msg;
-}
-
-/* FIXME: I pulled this number out of my butt. */
-#define IMAP_SMALL_BODY_SIZE 5120
-
-static CamelMimeMessage *
-imap_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
-{
- CamelMessageInfo *mi;
- CamelMimeMessage *msg;
-
- mi = camel_folder_summary_uid (folder->summary, uid);
- g_return_val_if_fail (mi != NULL, NULL);
-
- /* Fetch small messages directly. */
- if (mi->size < IMAP_SMALL_BODY_SIZE) {
- camel_folder_summary_info_free (folder->summary, mi);
- return (CamelMimeMessage *)fetch_medium (folder, uid, "", CAMEL_MIME_MESSAGE_TYPE, ex);
- }
-
- /* For larger messages, fetch the structure and build a message
- * with offline parts. (We check mi->content->type rather than
- * mi->content because camel_folder_summary_info_new always creates
- * an empty content struct.)
- */
- if (!mi->content->type) {
- CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
- CamelImapResponse *response;
- char *result, *p;
-
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
- response = camel_imap_command (store, folder, ex,
- "UID FETCH %s BODY", uid);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
- if (!response) {
- camel_folder_summary_info_free (folder->summary, mi);
- return NULL;
- }
- /* FIXME, wrong */
- result = camel_imap_response_extract (response, "FETCH", ex);
- if (!result) {
- camel_folder_summary_info_free (folder->summary, mi);
- return NULL;
- }
-
- p = e_strstrcase (result, "BODY ");
- if (p) {
- p += 5;
- imap_parse_body (&p, folder, mi->content);
- }
- g_free (result);
- if (!mi->content->type) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Could not find message body in FETCH response."));
- camel_folder_summary_info_free (folder->summary, mi);
- return NULL;
- }
- }
-
- msg = get_message (folder, uid, "", mi->content, ex);
- camel_folder_summary_info_free (folder->summary, mi);
-
- return msg;
-}
-
-static const char *
-imap_protocol_get_summary_specifier (CamelImapStore *store)
-{
- if (store->server_level >= IMAP_LEVEL_IMAP4REV1)
- return "UID FLAGS RFC822.SIZE BODY.PEEK[HEADER]";
- else
- return "UID FLAGS RFC822.SIZE RFC822.HEADER";
-}
-
-static void
-imap_update_summary (CamelFolder *folder, int first, int last,
- CamelFolderChangeInfo *changes, CamelException *ex)
-{
- CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
- CamelImapResponse *response;
- GPtrArray *headers, *messages;
- const char *summary_specifier;
- char *p, *uid;
- int i, seq, count;
- CamelMimeMessage *msg;
- CamelMessageInfo *mi;
- guint32 flags, size;
-
- summary_specifier = imap_protocol_get_summary_specifier (store);
- /* We already have the command lock */
- if (first == last) {
- response = camel_imap_command (store, folder, ex,
- "FETCH %d (%s)", first,
- summary_specifier);
- } else {
- response = camel_imap_command (store, folder, ex,
- "FETCH %d:%d (%s)", first,
- last, summary_specifier);
- }
-
- if (!response)
- return;
-
- count = camel_folder_summary_count (folder->summary);
- messages = g_ptr_array_new ();
- g_ptr_array_set_size (messages, last - first + 1);
- headers = response->untagged;
- for (i = 0; i < headers->len; i++) {
- p = headers->pdata[i];
- if (*p++ != '*' || *p++ != ' ')
- continue;
- seq = strtoul (p, &p, 10);
- if (!seq || seq < count)
- continue;
- if (g_strncasecmp (p, " FETCH (", 8) != 0)
- continue;
- p += 8;
-
- mi = messages->pdata[seq - first];
- flags = size = 0;
- uid = NULL;
- while (p && *p != ')') {
- if (*p == ' ')
- p++;
- if (!g_strncasecmp (p, "FLAGS ", 6)) {
- p += 6;
- /* FIXME user flags */
- flags = imap_parse_flag_list (&p);
- } else if (!g_strncasecmp (p, "RFC822.SIZE ", 12)) {
- size = strtoul (p + 12, &p, 10);
- } else if (!g_strncasecmp (p, "UID ", 4)) {
- uid = p + 4;
- strtoul (uid, &p, 10);
- uid = g_strndup (uid, p - uid);
- } else if (!g_strncasecmp (p, "BODY[HEADER", 11) ||
- !g_strncasecmp (p, "RFC822.HEADER", 13)) {
- msg = (CamelMimeMessage *) parse_headers (&p, CAMEL_MIME_MESSAGE_TYPE);
- mi = camel_folder_summary_info_new_from_message (folder->summary, msg);
- camel_object_unref (CAMEL_OBJECT (msg));
- } else {
- g_warning ("Waiter, I did not order this %.*s",
- (int)strcspn (p, " \n"), p);
- p = NULL;
- }
- }
-
- /* Ideally we got everything on one line, but if we
- * we didn't, and we didn't get the body yet, then we
- * have to postpone this line for later.
- */
- if (mi == NULL) {
- p = headers->pdata[i];
- g_ptr_array_remove_index (headers, i);
- g_ptr_array_add (headers, p);
- continue;
- }
-
- messages->pdata[seq - first] = mi;
- if (uid)
- camel_message_info_set_uid (mi, uid);
- if (flags)
- mi->flags = flags;
- if (size)
- mi->size = size;
- }
- camel_imap_response_free (response);
-
- for (i = 0; i < messages->len; i++) {
- mi = messages->pdata[i];
- camel_folder_summary_add (folder->summary, mi);
- camel_folder_change_info_add_uid (changes, camel_message_info_uid (mi));
- }
- g_ptr_array_free (messages, TRUE);
-}
-
-/* Called with the store's command_lock locked */
-void
-camel_imap_folder_changed (CamelFolder *folder, int exists,
- GArray *expunged, CamelException *ex)
-{
- CamelFolderChangeInfo *changes;
- CamelMessageInfo *info;
- int len;
-
- changes = camel_folder_change_info_new ();
- if (expunged) {
- int i, id;
-
- for (i = 0; i < expunged->len; i++) {
- id = g_array_index (expunged, int, i);
- info = camel_folder_summary_index (folder->summary, id - 1);
- camel_folder_change_info_remove_uid (changes, camel_message_info_uid (info));
- camel_folder_summary_remove (folder->summary, info);
- camel_folder_summary_info_free(folder->summary, info);
- }
- }
-
- len = camel_folder_summary_count (folder->summary);
- if (exists > len)
- imap_update_summary (folder, len + 1, exists, changes, ex);
-
- if (camel_folder_change_info_changed (changes)) {
- camel_object_trigger_event (CAMEL_OBJECT (folder),
- "folder_changed", changes);
- }
- camel_folder_change_info_free (changes);
-}
diff --git a/camel/providers/imap/camel-imap-folder.h b/camel/providers/imap/camel-imap-folder.h
deleted file mode 100644
index a943189f5a..0000000000
--- a/camel/providers/imap/camel-imap-folder.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-imap-folder.h : Abstract class for an imap folder */
-
-/*
- * Author:
- * Jeffrey Stedfast <fejj@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_IMAP_FOLDER_H
-#define CAMEL_IMAP_FOLDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-imap-types.h"
-#include "camel-folder.h"
-#include <camel/camel-folder-search.h>
-
-#define CAMEL_IMAP_FOLDER_TYPE (camel_imap_folder_get_type ())
-#define CAMEL_IMAP_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_IMAP_FOLDER_TYPE, CamelImapFolder))
-#define CAMEL_IMAP_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_IMAP_FOLDER_TYPE, CamelImapFolderClass))
-#define CAMEL_IS_IMAP_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_IMAP_FOLDER_TYPE))
-
-struct _CamelImapFolder {
- CamelFolder parent_object;
-
- struct _CamelImapFolderPrivate *priv;
-
- CamelFolderSearch *search;
-};
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelImapFolderClass;
-
-
-/* public methods */
-CamelFolder *camel_imap_folder_new (CamelStore *parent,
- const char *folder_name,
- const char *short_name,
- const char *summary_file,
- CamelException *ex);
-
-void camel_imap_folder_selected (CamelFolder *folder,
- CamelImapResponse *response,
- CamelException *ex);
-
-void camel_imap_folder_changed (CamelFolder *folder, int exists,
- GArray *expunged, CamelException *ex);
-
-/* Standard Camel function */
-CamelType camel_imap_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_IMAP_FOLDER_H */
diff --git a/camel/providers/imap/camel-imap-private.h b/camel/providers/imap/camel-imap-private.h
deleted file mode 100644
index c7af3ee5e6..0000000000
--- a/camel/providers/imap/camel-imap-private.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- * camel-imap-private.h: Private info for imap.
- *
- * 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
- */
-
-#ifndef CAMEL_IMAP_PRIVATE_H
-#define CAMEL_IMAP_PRIVATE_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-/* need a way to configure and save this data, if this header is to
- be installed. For now, dont install it */
-
-#include "config.h"
-
-#ifdef ENABLE_THREADS
-#include "e-util/e-msgport.h"
-#endif
-
-struct _CamelImapStorePrivate {
-#ifdef ENABLE_THREADS
- EMutex *command_lock; /* for locking the command stream for a complete operation */
-#endif
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_IMAP_STORE_LOCK(f, l) (e_mutex_lock(((CamelImapStore *)f)->priv->l))
-#define CAMEL_IMAP_STORE_UNLOCK(f, l) (e_mutex_unlock(((CamelImapStore *)f)->priv->l))
-#else
-#define CAMEL_IMAP_STORE_LOCK(f, l)
-#define CAMEL_IMAP_STORE_UNLOCK(f, l)
-#endif
-
-struct _CamelImapFolderPrivate {
-#ifdef ENABLE_THREADS
- GMutex *search_lock; /* for locking the search object */
-#endif
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_IMAP_FOLDER_LOCK(f, l) (g_mutex_lock(((CamelImapFolder *)f)->priv->l))
-#define CAMEL_IMAP_FOLDER_UNLOCK(f, l) (g_mutex_unlock(((CamelImapFolder *)f)->priv->l))
-#else
-#define CAMEL_IMAP_FOLDER_LOCK(f, l)
-#define CAMEL_IMAP_FOLDER_UNLOCK(f, l)
-#endif
-
-struct _CamelImapWrapperPrivate {
-#ifdef ENABLE_THREADS
- GMutex *lock;
-#endif
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_IMAP_WRAPPER_LOCK(f, l) (g_mutex_lock(((CamelImapWrapper *)f)->priv->l))
-#define CAMEL_IMAP_WRAPPER_UNLOCK(f, l) (g_mutex_unlock(((CamelImapWrapper *)f)->priv->l))
-#else
-#define CAMEL_IMAP_WRAPPER_LOCK(f, l)
-#define CAMEL_IMAP_WRAPPER_UNLOCK(f, l)
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_IMAP_PRIVATE_H */
-
diff --git a/camel/providers/imap/camel-imap-provider.c b/camel/providers/imap/camel-imap-provider.c
deleted file mode 100644
index 9b962df5f4..0000000000
--- a/camel/providers/imap/camel-imap-provider.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-imap-provider.c: imap provider registration code */
-
-/*
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- *
- * Copyright 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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#include "config.h"
-#include "camel-imap-store.h"
-#include "camel-provider.h"
-#include "camel-session.h"
-#include "camel-url.h"
-
-static void add_hash (guint *hash, char *s);
-static guint imap_url_hash (gconstpointer key);
-static gint check_equal (char *s1, char *s2);
-static gint imap_url_equal (gconstpointer a, gconstpointer b);
-
-static CamelProvider imap_provider = {
- "imap",
- N_("IMAPv4"),
-
- N_("For reading and storing mail on IMAP servers."),
-
- "mail",
-
- CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE |
- CAMEL_PROVIDER_IS_STORAGE,
-
- CAMEL_URL_NEED_USER | CAMEL_URL_NEED_HOST |
- CAMEL_URL_ALLOW_PATH | CAMEL_URL_ALLOW_AUTH,
-
- { 0, 0 },
-
- NULL
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- imap_provider.object_types[CAMEL_PROVIDER_STORE] =
- camel_imap_store_get_type();
-
- imap_provider.service_cache = g_hash_table_new (imap_url_hash, imap_url_equal);
-
- camel_session_register_provider (session, &imap_provider);
-}
-
-static void
-add_hash (guint *hash, char *s)
-{
- if (s)
- *hash ^= g_str_hash(s);
-}
-
-static guint
-imap_url_hash (gconstpointer key)
-{
- const CamelURL *u = (CamelURL *)key;
- guint hash = 0;
-
- add_hash (&hash, u->user);
- add_hash (&hash, u->authmech);
- add_hash (&hash, u->host);
- hash ^= u->port;
-
- return hash;
-}
-
-static gint
-check_equal (char *s1, char *s2)
-{
- if (s1 == NULL) {
- if (s2 == NULL)
- return TRUE;
- else
- return FALSE;
- }
-
- if (s2 == NULL)
- return FALSE;
-
- return strcmp (s1, s2) == 0;
-}
-
-static gint
-imap_url_equal (gconstpointer a, gconstpointer b)
-{
- const CamelURL *u1 = a, *u2 = b;
-
- return check_equal (u1->user, u2->user)
- && check_equal (u1->authmech, u2->authmech)
- && check_equal (u1->host, u2->host)
- && u1->port == u2->port;
-}
diff --git a/camel/providers/imap/camel-imap-search.c b/camel/providers/imap/camel-imap-search.c
deleted file mode 100644
index 06cf4a8d30..0000000000
--- a/camel/providers/imap/camel-imap-search.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-imap-search.c: IMAP folder search */
-
-/*
- * Authors:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#include <config.h>
-
-#include <string.h>
-
-#include "camel-imap-command.h"
-#include "camel-imap-folder.h"
-#include "camel-imap-store.h"
-#include "camel-imap-search.h"
-#include "camel-imap-private.h"
-
-static ESExpResult *
-imap_body_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv,
- CamelFolderSearch *s);
-
-static void
-camel_imap_search_class_init (CamelImapSearchClass *camel_imap_search_class)
-{
- /* virtual method overload */
- CamelFolderSearchClass *camel_folder_search_class =
- CAMEL_FOLDER_SEARCH_CLASS (camel_imap_search_class);
-
- /* virtual method overload */
- camel_folder_search_class->body_contains = imap_body_contains;
-}
-
-CamelType
-camel_imap_search_get_type (void)
-{
- static CamelType camel_imap_search_type = CAMEL_INVALID_TYPE;
-
- if (camel_imap_search_type == CAMEL_INVALID_TYPE) {
- camel_imap_search_type = camel_type_register (
- CAMEL_FOLDER_SEARCH_TYPE, "CamelImapSearch",
- sizeof (CamelImapSearch),
- sizeof (CamelImapSearchClass),
- (CamelObjectClassInitFunc) camel_imap_search_class_init,
- NULL, NULL, NULL);
- }
-
- return camel_imap_search_type;
-}
-
-static ESExpResult *
-imap_body_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv,
- CamelFolderSearch *s)
-{
- CamelImapStore *store = CAMEL_IMAP_STORE (s->folder->parent_store);
- char *value = argv[0]->value.string;
- CamelImapResponse *response;
- char *result, *p, *lasts = NULL, *real_uid;
- const char *uid = "";
- ESExpResult *r;
- CamelMessageInfo *info;
- GHashTable *uid_hash = NULL;
-
- CAMEL_IMAP_STORE_LOCK(store, command_lock);
-
- if (s->current) {
- uid = camel_message_info_uid (s->current);
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
- response = camel_imap_command (store, s->folder, NULL,
- "UID SEARCH UID %s BODY \"%s\"",
- uid, value);
- } else {
- r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR);
- r->value.ptrarray = g_ptr_array_new ();
- response = camel_imap_command (store, s->folder, NULL,
- "UID SEARCH BODY \"%s\"",
- value);
- }
-
- CAMEL_IMAP_STORE_UNLOCK(store, command_lock);
-
- if (!response)
- return r;
- result = camel_imap_response_extract (response, "SEARCH", NULL);
- if (!result)
- return r;
-
- p = result + sizeof ("* SEARCH");
- for (p = strtok_r (p, " ", &lasts); p; p = strtok_r (NULL, " ", &lasts)) {
- if (s->current) {
- if (!strcmp (uid, p)) {
- r->value.bool = TRUE;
- break;
- }
- } else {
- /* if we need to setup a hash of summary items, this way we get
- access to the summary memory which is locked for the duration of
- the search, and wont vanish on us */
- if (uid_hash == NULL) {
- int i;
-
- uid_hash = g_hash_table_new(g_str_hash, g_str_equal);
- for (i=0;i<s->summary->len;i++) {
- info = s->summary->pdata[i];
- g_hash_table_insert(uid_hash, (char *)camel_message_info_uid(info), info);
- }
- }
- if (g_hash_table_lookup_extended(uid_hash, p, (void *)&real_uid, (void *)&info))
- g_ptr_array_add (r->value.ptrarray, real_uid);
- }
- }
-
- /* we could probably cache this globally, but its probably not worth it */
- if (uid_hash)
- g_hash_table_destroy(uid_hash);
-
- return r;
-}
-
-/**
- * camel_imap_search_new:
- *
- * Return value: A new CamelImapSearch widget.
- **/
-CamelFolderSearch *
-camel_imap_search_new (void)
-{
- CamelFolderSearch *new = CAMEL_FOLDER_SEARCH (camel_object_new (camel_imap_search_get_type ()));
-
- camel_folder_search_construct (new);
- return new;
-}
diff --git a/camel/providers/imap/camel-imap-search.h b/camel/providers/imap/camel-imap-search.h
deleted file mode 100644
index 97fd6cd6c4..0000000000
--- a/camel/providers/imap/camel-imap-search.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-imap-search.h: IMAP folder search */
-
-/*
- * Authors:
- * Dan Winship <danw@helixcode.com>
- *
- * Copyright 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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef _CAMEL_IMAP_SEARCH_H
-#define _CAMEL_IMAP_SEARCH_H
-
-#include <camel/camel-folder-search.h>
-
-#define CAMEL_IMAP_SEARCH_TYPE (camel_imap_search_get_type ())
-#define CAMEL_IMAP_SEARCH(obj) CAMEL_CHECK_CAST (obj, camel_imap_search_get_type (), CamelImapSearch)
-#define CAMEL_IMAP_SEARCH_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_imap_search_get_type (), CamelImapSearchClass)
-#define CAMEL_IS_IMAP_SEARCH(obj) CAMEL_CHECK_TYPE (obj, camel_imap_search_get_type ())
-
-typedef struct _CamelImapSearchClass CamelImapSearchClass;
-
-struct _CamelImapSearch {
- CamelFolderSearch parent;
-
-};
-
-struct _CamelImapSearchClass {
- CamelFolderSearchClass parent_class;
-
-};
-
-guint camel_imap_search_get_type (void);
-CamelFolderSearch *camel_imap_search_new (void);
-
-#endif /* ! _CAMEL_IMAP_SEARCH_H */
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
deleted file mode 100644
index a924c4dab7..0000000000
--- a/camel/providers/imap/camel-imap-store.c
+++ /dev/null
@@ -1,1135 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-imap-store.c : class for an imap store */
-
-/*
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- *
- * Copyright 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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <gal/util/e-util.h>
-
-#include "camel-imap-store.h"
-#include "camel-imap-folder.h"
-#include "camel-imap-utils.h"
-#include "camel-imap-command.h"
-#include "camel-folder.h"
-#include "camel-exception.h"
-#include "camel-session.h"
-#include "camel-stream.h"
-#include "camel-stream-buffer.h"
-#include "camel-stream-fs.h"
-#include "camel-url.h"
-#include "camel-sasl.h"
-#include "string-utils.h"
-
-#include "camel-imap-private.h"
-#include "camel-private.h"
-
-#define d(x) x
-
-/* Specified in RFC 2060 */
-#define IMAP_PORT 143
-
-static CamelRemoteStoreClass *remote_store_class = NULL;
-
-static gboolean imap_connect (CamelService *service, CamelException *ex);
-static gboolean imap_disconnect (CamelService *service, gboolean clean, CamelException *ex);
-static GList *query_auth_types (CamelService *service, gboolean connect, CamelException *ex);
-static guint hash_folder_name (gconstpointer key);
-static gint compare_folder_name (gconstpointer a, gconstpointer b);
-static CamelFolder *get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex);
-static CamelFolderInfo *create_folder (CamelStore *store, const char *parent_name, const char *folder_name, CamelException *ex);
-static CamelFolderInfo *get_folder_info (CamelStore *store, const char *top,
- gboolean fast, gboolean recursive,
- gboolean subscribed_only,
- CamelException *ex);
-static gboolean folder_subscribed (CamelStore *store, const char *folder_name);
-static void subscribe_folder (CamelStore *store, const char *folder_name,
- CamelException *ex);
-static void unsubscribe_folder (CamelStore *store, const char *folder_name,
- CamelException *ex);
-static void imap_keepalive (CamelRemoteStore *store);
-
-static void
-camel_imap_store_class_init (CamelImapStoreClass *camel_imap_store_class)
-{
- /* virtual method overload */
- CamelServiceClass *camel_service_class =
- CAMEL_SERVICE_CLASS (camel_imap_store_class);
- CamelStoreClass *camel_store_class =
- CAMEL_STORE_CLASS (camel_imap_store_class);
- CamelRemoteStoreClass *camel_remote_store_class =
- CAMEL_REMOTE_STORE_CLASS (camel_imap_store_class);
-
- remote_store_class = CAMEL_REMOTE_STORE_CLASS(camel_type_get_global_classfuncs
- (camel_remote_store_get_type ()));
-
- /* virtual method overload */
- camel_service_class->query_auth_types = query_auth_types;
- camel_service_class->connect = imap_connect;
- camel_service_class->disconnect = imap_disconnect;
-
- camel_store_class->hash_folder_name = hash_folder_name;
- camel_store_class->compare_folder_name = compare_folder_name;
- camel_store_class->get_folder = get_folder;
- camel_store_class->create_folder = create_folder;
- camel_store_class->get_folder_info = get_folder_info;
- camel_store_class->free_folder_info = camel_store_free_folder_info_full;
-
- camel_store_class->folder_subscribed = folder_subscribed;
- camel_store_class->subscribe_folder = subscribe_folder;
- camel_store_class->unsubscribe_folder = unsubscribe_folder;
-
- camel_remote_store_class->keepalive = imap_keepalive;
-}
-
-static gboolean
-free_key (gpointer key, gpointer value, gpointer user_data)
-{
- g_free (key);
- return TRUE;
-}
-
-static void
-camel_imap_store_finalize (CamelObject *object)
-{
- CamelImapStore *imap_store = CAMEL_IMAP_STORE (object);
-
- if (imap_store->subscribed_folders) {
- g_hash_table_foreach_remove (imap_store->subscribed_folders,
- free_key, NULL);
- g_hash_table_destroy (imap_store->subscribed_folders);
- }
- if (imap_store->authtypes) {
- g_hash_table_foreach_remove (imap_store->authtypes,
- free_key, NULL);
- g_hash_table_destroy (imap_store->authtypes);
- }
- if (imap_store->namespace)
- g_free (imap_store->namespace);
-#ifdef ENABLE_THREADS
- e_mutex_destroy(imap_store->priv->command_lock);
-#endif
- g_free(imap_store->priv);
-}
-
-static void
-camel_imap_store_init (gpointer object, gpointer klass)
-{
- CamelRemoteStore *remote_store = CAMEL_REMOTE_STORE (object);
- CamelImapStore *imap_store = CAMEL_IMAP_STORE (object);
- CamelStore *store = CAMEL_STORE (object);
-
- remote_store->default_port = 143;
-
- imap_store->dir_sep = '\0';
- imap_store->current_folder = NULL;
-
- store->flags = CAMEL_STORE_SUBSCRIPTIONS;
-
- imap_store->connected = FALSE;
- imap_store->subscribed_folders = NULL;
-
- imap_store->priv = g_malloc0(sizeof(*imap_store->priv));
-#ifdef ENABLE_THREADS
- imap_store->priv->command_lock = e_mutex_new(E_MUTEX_REC);
-#endif
-}
-
-CamelType
-camel_imap_store_get_type (void)
-{
- static CamelType camel_imap_store_type = CAMEL_INVALID_TYPE;
-
- if (camel_imap_store_type == CAMEL_INVALID_TYPE) {
- camel_imap_store_type =
- camel_type_register (CAMEL_REMOTE_STORE_TYPE, "CamelImapStore",
- sizeof (CamelImapStore),
- sizeof (CamelImapStoreClass),
- (CamelObjectClassInitFunc) camel_imap_store_class_init,
- NULL,
- (CamelObjectInitFunc) camel_imap_store_init,
- (CamelObjectFinalizeFunc) camel_imap_store_finalize);
- }
-
- return camel_imap_store_type;
-}
-
-static struct {
- const char *name;
- guint32 flag;
-} capabilities[] = {
- { "IMAP4", IMAP_CAPABILITY_IMAP4 },
- { "IMAP4REV1", IMAP_CAPABILITY_IMAP4REV1 },
- { "STATUS", IMAP_CAPABILITY_STATUS },
- { "NAMESPACE", IMAP_CAPABILITY_NAMESPACE },
- { "UIDPLUS", IMAP_CAPABILITY_UIDPLUS },
- { "LITERAL+", IMAP_CAPABILITY_LITERALPLUS },
- { NULL, 0 }
-};
-
-/* we have remote-store:connect_lock by now */
-static gboolean
-connect_to_server (CamelService *service, CamelException *ex)
-{
- CamelImapStore *store = CAMEL_IMAP_STORE (service);
- CamelImapResponse *response;
- char *result, *buf, *capa, *lasts;
- int i;
-
- if (!CAMEL_SERVICE_CLASS (remote_store_class)->connect (service, ex))
- return FALSE;
-
- store->command = 0;
-
- /* Read the greeting, if any. FIXME: deal with PREAUTH */
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (service),
- &buf, ex) < 0) {
- return FALSE;
- }
- g_free (buf);
- store->connected = TRUE;
-
- /* Find out the IMAP capabilities */
- store->capabilities = 0;
- store->authtypes = g_hash_table_new (g_str_hash, g_str_equal);
- response = camel_imap_command (store, NULL, ex, "CAPABILITY");
- if (!response)
- return FALSE;
- result = camel_imap_response_extract (response, "CAPABILITY", ex);
- if (!result)
- return FALSE;
-
- /* Skip over "* CAPABILITY". */
- capa = imap_next_word (result + 2);
-
- for (capa = strtok_r (capa, " ", &lasts); capa;
- capa = strtok_r (NULL, " ", &lasts)) {
- if (!strncmp (capa, "AUTH=", 5)) {
- g_hash_table_insert (store->authtypes,
- g_strdup (capa + 5),
- GINT_TO_POINTER (1));
- continue;
- }
- for (i = 0; capabilities[i].name; i++) {
- if (g_strcasecmp (capa, capabilities[i].name) == 0) {
- store->capabilities |= capabilities[i].flag;
- break;
- }
- }
- }
- g_free (result);
-
- if (store->capabilities & IMAP_CAPABILITY_IMAP4REV1) {
- store->server_level = IMAP_LEVEL_IMAP4REV1;
- store->capabilities |= IMAP_CAPABILITY_STATUS;
- } else if (store->capabilities & IMAP_CAPABILITY_IMAP4)
- store->server_level = IMAP_LEVEL_IMAP4;
- else
- store->server_level = IMAP_LEVEL_UNKNOWN;
-
- return TRUE;
-}
-
-static CamelServiceAuthType password_authtype = {
- N_("Password"),
-
- N_("This option will connect to the IMAP server using a "
- "plaintext password."),
-
- "",
- TRUE
-};
-
-static GList *
-query_auth_types (CamelService *service, gboolean connect, CamelException *ex)
-{
- CamelImapStore *store = CAMEL_IMAP_STORE (service);
- CamelServiceAuthType *authtype;
- GList *types, *sasl_types, *t;
-
- if (connect && !connect_to_server (service, ex))
- return NULL;
-
- types = CAMEL_SERVICE_CLASS (remote_store_class)->query_auth_types (service, connect, ex);
-
- sasl_types = camel_sasl_authtype_list ();
- if (connect) {
- for (t = types; t; t = t->next) {
- authtype = t->data;
-
- if (!g_hash_table_lookup (store->authtypes, authtype->authproto)) {
- g_list_remove_link (types, t);
- g_list_free_1 (t);
- }
- }
- }
- types = g_list_concat (types, sasl_types);
-
- return g_list_prepend (types, &password_authtype);
-}
-
-/* call refresh folder directly, bypassing the folder lock */
-static void
-refresh_folder_info (gpointer key, gpointer value, gpointer data)
-{
- CamelFolder *folder = CAMEL_FOLDER (value);
-
- CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(folder))->refresh_info(folder, data);
-}
-
-/* This is a little 'hack' to avoid the deadlock conditions that would otherwise
- ensue when calling camel_folder_refresh_info from inside a lock */
-/* NB: on second thougts this is probably not entirely safe, but it'll do for now */
-/* the alternative is to:
- make the camel folder->lock recursive (which should probably be done)
- or remove it from camel_folder_refresh_info, and use another locking mechanism */
-static void
-imap_store_refresh_folders (CamelRemoteStore *store, CamelException *ex)
-{
- CAMEL_STORE_LOCK(store, cache_lock);
-
- g_hash_table_foreach (CAMEL_STORE (store)->folders, refresh_folder_info, ex);
-
- CAMEL_STORE_UNLOCK(store, cache_lock);
-}
-
-static gboolean
-try_auth (CamelImapStore *store, const char *mech, CamelException *ex)
-{
- CamelSasl *sasl;
- CamelImapResponse *response;
- char *resp;
- char *sasl_resp;
-
- sasl = camel_sasl_new ("imap", mech, CAMEL_SERVICE (store));
-
- sasl_resp = camel_sasl_challenge_base64 (sasl, NULL, ex);
-
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
- response = camel_imap_command (store, NULL, ex, "AUTHENTICATE %s%s%s",
- mech, sasl_resp ? " " : "",
- sasl_resp ? sasl_resp : "");
- if (!response)
- goto lose;
-
- while (!camel_sasl_authenticated (sasl)) {
- resp = camel_imap_response_extract_continuation (response, ex);
- if (!resp)
- goto lose;
-
- sasl_resp = camel_sasl_challenge_base64 (sasl, resp + 2, ex);
- g_free (resp);
- if (camel_exception_is_set (ex))
- goto break_and_lose;
-
- response = camel_imap_command_continuation (store, ex, sasl_resp);
- g_free (sasl_resp);
- if (!response)
- goto lose;
- }
-
- resp = camel_imap_response_extract_continuation (response, NULL);
- if (resp) {
- /* Oops. SASL claims we're done, but the IMAP server
- * doesn't think so...
- */
- g_free (resp);
- goto lose;
- }
-
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
- return TRUE;
-
- break_and_lose:
- /* Get the server out of "waiting for continuation data" mode. */
- response = camel_imap_command_continuation (store, NULL, "*");
- if (response)
- camel_imap_response_free (response);
-
- lose:
- if (!camel_exception_is_set (ex)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Bad authentication response from server."));
- }
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
- return FALSE;
-}
-
-static gboolean
-imap_connect (CamelService *service, CamelException *ex)
-{
- CamelImapStore *store = CAMEL_IMAP_STORE (service);
- CamelSession *session = camel_service_get_session (service);
- char *result, *errbuf = NULL, *name;
- CamelImapResponse *response;
- gboolean authenticated = FALSE;
- int len, i, flags;
- CamelServiceAuthType *authtype = NULL;
-
- if (connect_to_server (service, ex) == 0)
- return FALSE;
-
- if (service->url->authmech) {
- if (!g_hash_table_lookup (store->authtypes, service->url->authmech)) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- "IMAP server %s does not "
- "support requested "
- "authentication type %s",
- service->url->host,
- service->url->authmech);
- camel_service_disconnect (service, TRUE, NULL);
- return FALSE;
- }
-
- authtype = camel_sasl_authtype (service->url->authmech);
- if (!authtype) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- "No support for "
- "authentication type %s",
- service->url->authmech);
- camel_service_disconnect (service, TRUE, NULL);
- return FALSE;
- }
-
- if (!authtype->need_password) {
- authenticated = try_auth (store, authtype->authproto, ex);
- if (!authenticated) {
- camel_service_disconnect (service, TRUE, NULL);
- return FALSE;
- }
- }
- }
-
- while (!authenticated) {
- if (errbuf) {
- /* We need to un-cache the password before prompting again */
- camel_session_query_authenticator (
- session, CAMEL_AUTHENTICATOR_TELL, NULL,
- TRUE, service, "password", ex);
- g_free (service->url->passwd);
- service->url->passwd = NULL;
- }
-
- if (!service->url->passwd) {
- char *prompt;
-
- prompt = g_strdup_printf (_("%sPlease enter the IMAP "
- "password for %s@%s"),
- errbuf ? errbuf : "",
- service->url->user,
- service->url->host);
- service->url->passwd =
- camel_session_query_authenticator (
- session, CAMEL_AUTHENTICATOR_ASK,
- prompt, TRUE, service, "password", ex);
- g_free (prompt);
- g_free (errbuf);
- errbuf = NULL;
-
- if (!service->url->passwd) {
- camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
- "You didn\'t enter a password.");
- camel_service_disconnect (service, TRUE, NULL);
- return FALSE;
- }
- }
-
- if (authtype)
- authenticated = try_auth (store, authtype->authproto, ex);
- else {
- CAMEL_IMAP_STORE_LOCK(store, command_lock);
- response = camel_imap_command (store, NULL, ex,
- "LOGIN %S %S",
- service->url->user,
- service->url->passwd);
- CAMEL_IMAP_STORE_UNLOCK(store, command_lock);
- if (response) {
- camel_imap_response_free (response);
- authenticated = TRUE;
- }
- }
- if (!authenticated) {
- errbuf = g_strdup_printf (_("Unable to authenticate "
- "to IMAP server.\n%s\n\n"),
- camel_exception_get_description (ex));
- camel_exception_clear (ex);
- }
- }
-
- /* Get subscribed folders */
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
- response = camel_imap_command (store, NULL, ex, "LSUB \"\" \"*\"");
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
- if (!response)
- return FALSE;
- store->subscribed_folders = g_hash_table_new (g_str_hash, g_str_equal);
- for (i = 0; i < response->untagged->len; i++) {
- result = response->untagged->pdata[i];
- if (!imap_parse_list_response (result, &flags, NULL, &name))
- continue;
- if (flags & (IMAP_LIST_FLAG_MARKED | IMAP_LIST_FLAG_UNMARKED))
- store->useful_lsub = TRUE;
- if (flags & IMAP_LIST_FLAG_NOSELECT) {
- g_free (name);
- continue;
- }
- g_hash_table_insert (store->subscribed_folders, name,
- GINT_TO_POINTER (1));
- }
- camel_imap_response_free (response);
-
- /* Get namespace and hierarchy separator */
- if (service->url->path && strlen (service->url->path) > 1)
- store->namespace = g_strdup (service->url->path + 1);
- else if (store->capabilities & IMAP_CAPABILITY_NAMESPACE) {
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
- response = camel_imap_command (store, NULL, ex, "NAMESPACE");
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
- if (!response)
- return FALSE;
-
- result = camel_imap_response_extract (response, "NAMESPACE", ex);
- if (!result)
- return FALSE;
-
- name = e_strstrcase (result, "NAMESPACE ((");
- if (name) {
- char *sep;
-
- name += 12;
- store->namespace = imap_parse_string (&name, &len);
- if (name && *name++ == ' ') {
- sep = imap_parse_string (&name, &len);
- if (sep) {
- store->dir_sep = *sep;
- g_free (sep);
- }
- }
- }
- g_free (result);
- }
- if (!store->namespace)
- store->namespace = g_strdup ("");
-
- if (!store->dir_sep) {
- CAMEL_IMAP_STORE_LOCK(store, command_lock);
- if (store->server_level >= IMAP_LEVEL_IMAP4REV1) {
- /* This idiom means "tell me the hierarchy separator
- * for the given path, even if that path doesn't exist.
- */
- response = camel_imap_command (store, NULL, ex,
- "LIST %S \"\"",
- store->namespace);
- } else {
- /* Plain IMAP4 doesn't have that idiom, so we fall back
- * to "tell me about this folder", which will fail if
- * the folder doesn't exist (eg, if namespace is "").
- */
- response = camel_imap_command (store, NULL, ex,
- "LIST \"\" %S",
- store->namespace);
- }
- CAMEL_IMAP_STORE_UNLOCK(store, command_lock);
-
- if (!response)
- return FALSE;
-
- result = camel_imap_response_extract (response, "LIST", NULL);
- if (result) {
- imap_parse_list_response (result, NULL, &store->dir_sep, NULL);
- g_free (result);
- }
- if (!store->dir_sep)
- store->dir_sep = '/'; /* Guess */
- }
-
- /* Generate base URL */
- store->base_url = camel_url_to_string (service->url, FALSE);
- len = strlen (store->base_url);
- if (service->url->path)
- store->base_url[len - strlen (service->url->path) + 1] = '\0';
- else {
- store->base_url = g_realloc (store->base_url, len + 2);
- store->base_url[len] = '/';
- store->base_url[len + 1] = '\0';
- }
-
- /* Find our storage path. */
- if (!store->storage_path) {
- store->storage_path =
- camel_session_get_storage_path (session, service, ex);
- if (camel_exception_is_set (ex))
- return FALSE;
- }
-
- imap_store_refresh_folders (CAMEL_REMOTE_STORE (store), ex);
-
- return !camel_exception_is_set (ex);
-}
-
-static gboolean
-imap_disconnect (CamelService *service, gboolean clean, CamelException *ex)
-{
- CamelImapStore *store = CAMEL_IMAP_STORE (service);
- CamelImapResponse *response;
-
- if (store->connected && clean) {
- /* send the logout command */
-
- /* NB: this lock probably isn't required */
- CAMEL_IMAP_STORE_LOCK(store, command_lock);
- response = camel_imap_command (store, NULL, ex, "LOGOUT");
- CAMEL_IMAP_STORE_UNLOCK(store, command_lock);
- camel_imap_response_free (response);
- }
- store->connected = FALSE;
- store->current_folder = NULL;
-
- if (store->subscribed_folders) {
- g_hash_table_foreach_remove (store->subscribed_folders,
- free_key, NULL);
- g_hash_table_destroy (store->subscribed_folders);
- store->subscribed_folders = NULL;
- }
-
- if (store->namespace) {
- g_free (store->namespace);
- store->namespace = NULL;
- }
-
- return CAMEL_SERVICE_CLASS (remote_store_class)->disconnect (service, clean, ex);
-}
-
-/* NOTE: Must have imap_store::command_lock before calling this */
-static gboolean
-imap_folder_exists (CamelImapStore *store, const char *folder_name,
- gboolean *selectable, char **short_name,
- CamelException *ex)
-{
- CamelImapResponse *response;
- char *result, sep;
- int flags;
-
- if (!g_strcasecmp (folder_name, "INBOX")) {
- if (selectable)
- *selectable = TRUE;
- if (short_name)
- *short_name = g_strdup ("INBOX");
- return TRUE;
- }
-
- response = camel_imap_command (store, NULL, ex, "LIST \"\" %S",
- folder_name);
- if (!response)
- return FALSE;
- result = camel_imap_response_extract (response, "LIST", ex);
- if (!result)
- return FALSE;
-
- if (!imap_parse_list_response (result, &flags, &sep, NULL))
- return FALSE;
-
- if (selectable)
- *selectable = !(flags & IMAP_LIST_FLAG_NOSELECT);
- if (short_name) {
- *short_name = strrchr (folder_name, sep);
- if (*short_name)
- *short_name = g_strdup (*short_name + 1);
- else
- *short_name = g_strdup (folder_name);
- }
-
- return TRUE;
-}
-
-/* NOTE: Must have imap_store::command_lock before calling this */
-static gboolean
-imap_create (CamelImapStore *store, const char *folder_name,
- CamelException *ex)
-{
- CamelImapResponse *response;
-
- response = camel_imap_command (store, NULL, ex, "CREATE %S",
- folder_name);
- camel_imap_response_free (response);
-
- return !camel_exception_is_set (ex);
-}
-
-static guint
-hash_folder_name (gconstpointer key)
-{
- if (g_strcasecmp (key, "INBOX") == 0)
- return g_str_hash ("INBOX");
- else
- return g_str_hash (key);
-}
-
-static gint
-compare_folder_name (gconstpointer a, gconstpointer b)
-{
- gconstpointer aname = a, bname = b;
-
- if (g_strcasecmp (a, "INBOX") == 0)
- aname = "INBOX";
- if (g_strcasecmp (b, "INBOX") == 0)
- bname = "INBOX";
- return g_str_equal (aname, bname);
-}
-
-static CamelFolder *
-get_folder (CamelStore *store, const char *folder_name, guint32 flags,
- CamelException *ex)
-{
- CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
- CamelFolder *new_folder = NULL;
- char *short_name, *summary_file, *p;
- gboolean selectable;
-
- if (!camel_remote_store_connected (CAMEL_REMOTE_STORE (store), ex))
- return NULL;
-
- /* lock around the whole lot to check/create atomically */
- CAMEL_IMAP_STORE_LOCK(imap_store, command_lock);
- if (!imap_folder_exists (imap_store, folder_name,
- &selectable, &short_name, ex)) {
- if ((flags & CAMEL_STORE_FOLDER_CREATE) == 0
- || (!imap_create (imap_store, folder_name, ex))
- || (!imap_folder_exists (imap_store, folder_name,
- &selectable, &short_name, ex))) {
- CAMEL_IMAP_STORE_UNLOCK(imap_store, command_lock);
- return NULL;
- }
- }
- CAMEL_IMAP_STORE_UNLOCK(imap_store, command_lock);
-
- if (!selectable) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- "%s is not a selectable folder",
- folder_name);
- g_free (short_name);
- return NULL;
- }
-
- summary_file = g_strdup_printf ("%s/%s/#summary",
- imap_store->storage_path,
- folder_name);
- p = strrchr (summary_file, '/');
- *p = '\0';
- if (e_mkdir_hier (summary_file, S_IRWXU) == 0) {
- *p = '/';
- new_folder = camel_imap_folder_new (store, folder_name,
- short_name, summary_file,
- ex);
- } else {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create directory %s: %s"),
- summary_file, g_strerror (errno));
- }
- g_free (summary_file);
- g_free (short_name);
-
- if (camel_exception_is_set (ex))
- return NULL;
-
- return new_folder;
-}
-
-static char *
-imap_concat (CamelImapStore *imap_store, const char *prefix, const char *suffix)
-{
- int len;
-
- len = strlen (prefix);
- if (len > 0 && prefix[len - 1] == imap_store->dir_sep)
- return g_strdup_printf ("%s%s", prefix, suffix);
- else
- return g_strdup_printf ("%s%c%s", prefix, imap_store->dir_sep, suffix);
-}
-
-static CamelFolderInfo *
-create_folder (CamelStore *store, const char *parent_name,
- const char *folder_name, CamelException *ex)
-{
- CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
- CamelFolderInfo *fi;
- char *full_name;
-
- if (!parent_name)
- parent_name = imap_store->namespace;
- full_name = imap_concat (imap_store, parent_name, folder_name);
-
- imap_create (imap_store, full_name, ex);
- if (camel_exception_is_set (ex)) {
- g_free (full_name);
- return NULL;
- }
-
- fi = get_folder_info (store, full_name, FALSE, FALSE, FALSE, ex);
- g_free (full_name);
-
- return fi;
-}
-
-static CamelFolderInfo *
-parse_list_response_as_folder_info (CamelImapStore *imap_store,
- const char *response)
-{
- CamelFolderInfo *fi;
- int flags;
- char sep, *dir, *name = NULL;
-
- if (!imap_parse_list_response (response, &flags, &sep, &dir))
- return NULL;
-
- if (sep) {
- name = strrchr (dir, sep);
- if (name && !*++name) {
- g_free (dir);
- return NULL;
- }
- }
-
- fi = g_new0 (CamelFolderInfo, 1);
- fi->full_name = dir;
- if (sep && name)
- fi->name = g_strdup (name);
- else
- fi->name = g_strdup (dir);
- if (!(flags & IMAP_LIST_FLAG_NOSELECT))
- fi->url = g_strdup_printf ("%s%s", imap_store->base_url, dir);
- if (!(flags & IMAP_LIST_FLAG_UNMARKED))
- fi->unread_message_count = -1;
-
- return fi;
-}
-
-static void
-copy_folder_name (gpointer name, gpointer key, gpointer array)
-{
- g_ptr_array_add (array, name);
-}
-
-static void
-get_subscribed_folders_by_hand (CamelImapStore *imap_store, const char *top,
- GPtrArray *folders, CamelException *ex)
-{
- GPtrArray *names;
- CamelImapResponse *response;
- CamelFolderInfo *fi;
- char *result;
- int i, toplen = strlen (top);
-
- names = g_ptr_array_new ();
- g_hash_table_foreach (imap_store->subscribed_folders,
- copy_folder_name, names);
-
- for (i = 0; i < names->len; i++) {
- CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
- response = camel_imap_command (imap_store, NULL, ex,
- "LIST \"\" %S",
- names->pdata[i]);
- CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
-
- if (!response) {
- g_ptr_array_free (names, TRUE);
- return;
- }
- result = camel_imap_response_extract (response, "LIST", NULL);
- if (!result) {
- g_hash_table_remove (imap_store->subscribed_folders,
- names->pdata[i]);
- g_free (names->pdata[i]);
- g_ptr_array_remove_index_fast (names, i--);
- continue;
- }
-
- fi = parse_list_response_as_folder_info (imap_store, result);
- if (!fi)
- continue;
-
- if (strncmp (top, fi->full_name, toplen) != 0) {
- camel_folder_info_free (fi);
- continue;
- }
-
- g_ptr_array_add (folders, fi);
- }
- g_ptr_array_free (names, TRUE);
-}
-
-static void
-get_folders (CamelImapStore *imap_store, const char *pattern,
- GPtrArray *folders, gboolean lsub, CamelException *ex)
-{
- CamelImapResponse *response;
- CamelFolderInfo *fi;
- char *list;
- int i;
-
- CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
- response = camel_imap_command (imap_store, NULL, ex,
- "%s \"\" %S", lsub ? "LSUB" : "LIST",
- pattern);
- CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
- if (!response)
- return;
-
- for (i = 0; i < response->untagged->len; i++) {
- list = response->untagged->pdata[i];
- fi = parse_list_response_as_folder_info (imap_store, list);
- if (!fi)
- continue;
- g_ptr_array_add (folders, fi);
- }
- camel_imap_response_free (response);
-}
-
-static CamelFolderInfo *
-get_folder_info (CamelStore *store, const char *top, gboolean fast,
- gboolean recursive, gboolean subscribed_only,
- CamelException *ex)
-{
- CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
- gboolean need_inbox = FALSE;
- CamelImapResponse *response;
- GPtrArray *folders;
- const char *name, *p;
- char *pattern, *status;
- CamelFolderInfo *fi;
- int i;
-
- if (!camel_remote_store_connected (CAMEL_REMOTE_STORE (store), ex))
- return NULL;
-
- /* Sync flag changes to the server so it has the same ideas about
- * read/unread as we do.
- */
- camel_store_sync (store, ex);
- if (camel_exception_is_set (ex))
- return NULL;
-
- name = top;
- if (!name) {
- need_inbox = TRUE;
- name = imap_store->namespace;
- }
-
- folders = g_ptr_array_new ();
-
- get_folders (imap_store, name, folders, FALSE, ex);
- if (camel_exception_is_set (ex))
- return NULL;
- if (folders->len) {
- fi = folders->pdata[0];
- if (!fi->url)
- g_ptr_array_remove_index (folders, 0);
- }
-
- if (subscribed_only && !imap_store->useful_lsub)
- get_subscribed_folders_by_hand (imap_store, name, folders, ex);
- else {
- pattern = imap_concat (imap_store, name, recursive ? "*" : "%");
- get_folders (imap_store, pattern, folders, subscribed_only, ex);
- g_free (pattern);
- }
- if (camel_exception_is_set (ex)) {
- for (i = 0; i < folders->len; i++)
- camel_folder_info_free (folders->pdata[i]);
- g_ptr_array_free (folders, TRUE);
- return NULL;
- }
-
- /* Add INBOX, if necessary */
- if (need_inbox) {
- for (i = 0; i < folders->len; i++) {
- fi = folders->pdata[i];
- if (!g_strcasecmp (fi->full_name, "INBOX")) {
- need_inbox = FALSE;
- break;
- }
- }
- }
- if (need_inbox) {
- fi = g_new0 (CamelFolderInfo, 1);
- fi->full_name = g_strdup ("INBOX");
- fi->name = g_strdup ("INBOX");
- fi->url = g_strdup_printf ("%sINBOX", imap_store->base_url);
- fi->unread_message_count = -1;
-
- g_ptr_array_add (folders, fi);
- }
-
- if (!fast) {
- /* Get unread counts */
- for (i = 0; i < folders->len; i++) {
- fi = folders->pdata[i];
- if (!fi->url || fi->unread_message_count != -1)
- continue;
-
- /* UW will give cached data for the currently
- * selected folder. Grr. Well, I guess this
- * also potentially saves us one IMAP command.
- */
- if (imap_store->current_folder &&
- !strcmp (imap_store->current_folder->full_name,
- fi->full_name)) {
- fi->unread_message_count = camel_folder_get_unread_message_count (imap_store->current_folder);
- continue;
- }
-
- CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
- response = camel_imap_command (imap_store, NULL, NULL,
- "STATUS %S (UNSEEN)",
- fi->full_name);
- CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
- if (!response)
- continue;
- status = camel_imap_response_extract (response, "STATUS", NULL);
- if (!status)
- continue;
-
- p = e_strstrcase (status, "UNSEEN");
- if (p)
- fi->unread_message_count = strtoul (p + 6, NULL, 10);
- g_free (status);
- }
- }
-
- /* And assemble. */
- fi = camel_folder_info_build (folders, name, imap_store->dir_sep, TRUE);
- g_ptr_array_free (folders, TRUE);
- return fi;
-}
-
-static gboolean
-folder_subscribed (CamelStore *store, const char *folder_name)
-{
- CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
-
- g_return_val_if_fail (imap_store->subscribed_folders != NULL, FALSE);
-
- return g_hash_table_lookup (imap_store->subscribed_folders,
- folder_name) != NULL;
-}
-
-static void
-subscribe_folder (CamelStore *store, const char *folder_name,
- CamelException *ex)
-{
- CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
- CamelImapResponse *response;
-
- if (!camel_remote_store_connected (CAMEL_REMOTE_STORE (store), ex))
- return;
-
- CAMEL_IMAP_STORE_LOCK(imap_store, command_lock);
- response = camel_imap_command (imap_store, NULL, ex,
- "SUBSCRIBE %S", folder_name);
- CAMEL_IMAP_STORE_UNLOCK(imap_store, command_lock);
- if (response) {
- CamelFolderInfo *fi;
- char *name;
-
- g_hash_table_insert (imap_store->subscribed_folders,
- g_strdup (folder_name),
- GUINT_TO_POINTER (1));
-
- name = strrchr (folder_name, imap_store->dir_sep);
- if (name)
- name++;
-
- fi = g_new0 (CamelFolderInfo, 1);
- fi->full_name = g_strdup (folder_name);
- fi->name = g_strdup (name);
- fi->url = g_strdup_printf ("%s%s", imap_store->base_url, folder_name);
- fi->unread_message_count = -1;
-
- camel_object_trigger_event (CAMEL_OBJECT (store),
- "folder_created", fi);
-
- camel_folder_info_free (fi);
- }
- camel_imap_response_free (response);
-}
-
-static void
-unsubscribe_folder (CamelStore *store, const char *folder_name,
- CamelException *ex)
-{
- CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
- CamelImapResponse *response;
- gpointer key, value;
-
- if (!camel_remote_store_connected (CAMEL_REMOTE_STORE (store), ex))
- return;
-
- CAMEL_IMAP_STORE_LOCK(imap_store, command_lock);
- response = camel_imap_command (imap_store, NULL, ex,
- "UNSUBSCRIBE %S", folder_name);
- CAMEL_IMAP_STORE_UNLOCK(imap_store, command_lock);
- if (response) {
- CamelFolderInfo *fi;
- char *name;
-
- g_hash_table_lookup_extended (imap_store->subscribed_folders,
- folder_name, &key, &value);
- g_hash_table_remove (imap_store->subscribed_folders,
- folder_name);
- g_free (key);
-
- name = strrchr (folder_name, imap_store->dir_sep);
- if (name)
- name++;
-
- fi = g_new0 (CamelFolderInfo, 1);
- fi->full_name = g_strdup (folder_name);
- fi->name = g_strdup (name);
- fi->url = g_strdup_printf ("%s%s", imap_store->base_url, folder_name);
- fi->unread_message_count = -1;
-
- camel_object_trigger_event (CAMEL_OBJECT (store),
- "folder_deleted", fi);
-
- camel_folder_info_free (fi);
- }
- camel_imap_response_free (response);
-}
-
-static void
-imap_keepalive (CamelRemoteStore *store)
-{
- CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
- CamelImapResponse *response;
-
- CAMEL_IMAP_STORE_LOCK(imap_store, command_lock);
- response = camel_imap_command (imap_store, NULL, NULL, "NOOP");
- CAMEL_IMAP_STORE_UNLOCK(imap_store, command_lock);
- camel_imap_response_free (response);
-}
diff --git a/camel/providers/imap/camel-imap-store.h b/camel/providers/imap/camel-imap-store.h
deleted file mode 100644
index 3792e92872..0000000000
--- a/camel/providers/imap/camel-imap-store.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-imap-store.h : class for an imap store */
-
-/*
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- *
- * Copyright (C) 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
- */
-
-
-#ifndef CAMEL_IMAP_STORE_H
-#define CAMEL_IMAP_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-imap-types.h"
-#include "camel-remote-store.h"
-
-#define CAMEL_IMAP_STORE_TYPE (camel_imap_store_get_type ())
-#define CAMEL_IMAP_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_IMAP_STORE_TYPE, CamelImapStore))
-#define CAMEL_IMAP_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_IMAP_STORE_TYPE, CamelImapStoreClass))
-#define CAMEL_IS_IMAP_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_IMAP_STORE_TYPE))
-
-typedef enum {
- IMAP_LEVEL_UNKNOWN,
- IMAP_LEVEL_IMAP4,
- IMAP_LEVEL_IMAP4REV1
-} CamelImapServerLevel;
-
-#define IMAP_CAPABILITY_IMAP4 (1 << 0)
-#define IMAP_CAPABILITY_IMAP4REV1 (1 << 1)
-#define IMAP_CAPABILITY_STATUS (1 << 2)
-#define IMAP_CAPABILITY_NAMESPACE (1 << 3)
-#define IMAP_CAPABILITY_UIDPLUS (1 << 4)
-#define IMAP_CAPABILITY_LITERALPLUS (1 << 5)
-
-struct _CamelImapStore {
- CamelRemoteStore parent_object;
- struct _CamelImapStorePrivate *priv;
-
- CamelFolder *current_folder;
-
- guint32 command;
-
- CamelImapServerLevel server_level;
- guint32 capabilities;
- GHashTable *authtypes;
-
- char *namespace, dir_sep, *storage_path, *base_url;
-
- gboolean connected;
-
- GHashTable *subscribed_folders;
- gboolean useful_lsub;
-};
-
-
-typedef struct {
- CamelRemoteStoreClass parent_class;
-
-} CamelImapStoreClass;
-
-
-/* Standard Camel function */
-CamelType camel_imap_store_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_IMAP_STORE_H */
diff --git a/camel/providers/imap/camel-imap-summary.c b/camel/providers/imap/camel-imap-summary.c
deleted file mode 100644
index 66228649bc..0000000000
--- a/camel/providers/imap/camel-imap-summary.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors:
- * Michael Zucchi <notzed@helixcode.com>
- * Dan Winship <danw@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-imap-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 CAMEL_IMAP_SUMMARY_VERSION (0x300)
-
-static int summary_header_load (CamelFolderSummary *, FILE *);
-static int summary_header_save (CamelFolderSummary *, FILE *);
-
-static CamelMessageInfo *message_info_load (CamelFolderSummary *s, FILE *in);
-static int message_info_save (CamelFolderSummary *s, FILE *out,
- CamelMessageInfo *info);
-static CamelMessageContentInfo *content_info_load (CamelFolderSummary *s, FILE *in);
-static int content_info_save (CamelFolderSummary *s, FILE *out,
- CamelMessageContentInfo *info);
-
-static void camel_imap_summary_class_init (CamelImapSummaryClass *klass);
-static void camel_imap_summary_init (CamelImapSummary *obj);
-
-static CamelFolderSummaryClass *camel_imap_summary_parent;
-
-CamelType
-camel_imap_summary_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register(
- camel_folder_summary_get_type(), "CamelImapSummary",
- sizeof (CamelImapSummary),
- sizeof (CamelImapSummaryClass),
- (CamelObjectClassInitFunc) camel_imap_summary_class_init,
- NULL,
- (CamelObjectInitFunc) camel_imap_summary_init,
- NULL);
- }
-
- return type;
-}
-
-static void
-camel_imap_summary_class_init (CamelImapSummaryClass *klass)
-{
- CamelFolderSummaryClass *cfs_class = (CamelFolderSummaryClass *) klass;
-
- camel_imap_summary_parent = CAMEL_FOLDER_SUMMARY_CLASS (camel_type_get_global_classfuncs (camel_folder_summary_get_type()));
-
- cfs_class->summary_header_load = summary_header_load;
- cfs_class->summary_header_save = summary_header_save;
- cfs_class->message_info_load = message_info_load;
- cfs_class->message_info_save = message_info_save;
- cfs_class->content_info_load = content_info_load;
- cfs_class->content_info_save = content_info_save;
-}
-
-static void
-camel_imap_summary_init (CamelImapSummary *obj)
-{
- CamelFolderSummary *s = (CamelFolderSummary *)obj;
-
- /* subclasses need to set the right instance data sizes */
- s->message_info_size = sizeof(CamelImapMessageInfo);
- s->content_info_size = sizeof(CamelImapMessageContentInfo);
-
- /* and a unique file version */
- s->version += CAMEL_IMAP_SUMMARY_VERSION;
-}
-
-/**
- * camel_imap_summary_new:
- * @filename: the file to store the summary in.
- * @validity: the current UIDVALIDITY value of the folder
- *
- * This will create a new CamelImapSummary object and read in the
- * summary data from disk, if it exists and has the right UIDVALIDITY
- * value.
- *
- * Return value: A new CamelImapSummary object.
- **/
-CamelFolderSummary *
-camel_imap_summary_new (const char *filename, guint32 validity)
-{
- CamelFolderSummary *summary = CAMEL_FOLDER_SUMMARY (
- camel_object_new (camel_imap_summary_get_type ()));
- CamelImapSummary *imap_summary = (CamelImapSummary *)summary;
-
- camel_folder_summary_set_build_content (summary, TRUE);
- camel_folder_summary_set_filename (summary, filename);
-
- if (camel_folder_summary_load (summary) == -1) {
- if (errno == ENOENT) {
- imap_summary->validity = validity;
- return summary;
- } else {
- /* FIXME: are there error conditions where this won't work? */
- camel_folder_summary_clear (summary);
- camel_folder_summary_touch (summary);
-
- return summary;
- }
- }
-
- if (imap_summary->validity != validity) {
- camel_folder_summary_clear (summary);
- imap_summary->validity = validity;
- }
-
- return summary;
-}
-
-
-static int
-summary_header_load (CamelFolderSummary *s, FILE *in)
-{
- CamelImapSummary *ims = CAMEL_IMAP_SUMMARY (s);
-
- if (camel_imap_summary_parent->summary_header_load (s, in) == -1)
- return -1;
-
- return camel_folder_summary_decode_uint32 (in, &ims->validity);
-}
-
-static int
-summary_header_save (CamelFolderSummary *s, FILE *out)
-{
- CamelImapSummary *ims = CAMEL_IMAP_SUMMARY(s);
-
- if (camel_imap_summary_parent->summary_header_save (s, out) == -1)
- return -1;
-
- return camel_folder_summary_encode_uint32 (out, ims->validity);
-}
-
-
-static CamelMessageInfo *
-message_info_load (CamelFolderSummary *s, FILE *in)
-{
- CamelMessageInfo *info;
- CamelImapMessageInfo *iinfo;
-
- info = camel_imap_summary_parent->message_info_load (s, in);
- if (info) {
- iinfo = (CamelImapMessageInfo *)info;
-
- if (camel_folder_summary_decode_uint32 (in, &iinfo->server_flags) == -1)
- goto error;
- }
-
- return info;
-error:
- camel_folder_summary_info_free (s, info);
- return NULL;
-}
-
-static int
-message_info_save (CamelFolderSummary *s, FILE *out, CamelMessageInfo *info)
-{
- CamelImapMessageInfo *iinfo = (CamelImapMessageInfo *)info;
-
- if (camel_imap_summary_parent->message_info_save (s, out, info) == -1)
- return -1;
-
- return camel_folder_summary_encode_uint32 (out, iinfo->server_flags);
-}
-
-
-static CamelMessageContentInfo *
-content_info_load (CamelFolderSummary *s, FILE *in)
-{
- if (fgetc (in))
- return camel_imap_summary_parent->content_info_load (s, in);
- else
- return camel_folder_summary_content_info_new (s);
-}
-
-static int
-content_info_save (CamelFolderSummary *s, FILE *out,
- CamelMessageContentInfo *info)
-{
- if (info->type) {
- fputc (1, out);
- return camel_imap_summary_parent->content_info_save (s, out, info);
- } else
- return fputc (0, out);
-}
diff --git a/camel/providers/imap/camel-imap-summary.h b/camel/providers/imap/camel-imap-summary.h
deleted file mode 100644
index 7ad1e3f4e8..0000000000
--- a/camel/providers/imap/camel-imap-summary.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors:
- * Michael Zucchi <notzed@helixcode.com>
- * Dan Winship <danw@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_IMAP_SUMMARY_H
-#define _CAMEL_IMAP_SUMMARY_H
-
-#include "camel-imap-types.h"
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-exception.h>
-
-#define CAMEL_IMAP_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_imap_summary_get_type (), CamelImapSummary)
-#define CAMEL_IMAP_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_imap_summary_get_type (), CamelImapSummaryClass)
-#define CAMEL_IS_IMAP_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_imap_summary_get_type ())
-
-#define CAMEL_IMAP_SERVER_FLAGS (CAMEL_MESSAGE_ANSWERED | \
- CAMEL_MESSAGE_DELETED | \
- CAMEL_MESSAGE_DRAFT | \
- CAMEL_MESSAGE_FLAGGED | \
- CAMEL_MESSAGE_SEEN)
-
-typedef struct _CamelImapSummaryClass CamelImapSummaryClass;
-
-typedef struct _CamelImapMessageContentInfo {
- CamelMessageContentInfo info;
-
-} CamelImapMessageContentInfo;
-
-typedef struct _CamelImapMessageInfo {
- CamelMessageInfo info;
-
- guint32 server_flags;
-} CamelImapMessageInfo;
-
-struct _CamelImapSummary {
- CamelFolderSummary parent;
-
- guint32 validity;
-};
-
-struct _CamelImapSummaryClass {
- CamelFolderSummaryClass parent_class;
-
-};
-
-guint camel_imap_summary_get_type (void);
-CamelFolderSummary *camel_imap_summary_new (const char *filename,
- guint32 validity);
-
-#endif /* ! _CAMEL_IMAP_SUMMARY_H */
-
diff --git a/camel/providers/imap/camel-imap-types.h b/camel/providers/imap/camel-imap-types.h
deleted file mode 100644
index af5d8b8c77..0000000000
--- a/camel/providers/imap/camel-imap-types.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-imap-types.h: IMAP types */
-
-/*
- * Copyright (C) 2001 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
- */
-
-#ifndef CAMEL_IMAP_TYPES_H
-#define CAMEL_IMAP_TYPES_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-types.h"
-
-typedef struct _CamelImapResponse CamelImapResponse;
-typedef struct _CamelImapFolder CamelImapFolder;
-typedef struct _CamelImapSearch CamelImapSearch;
-typedef struct _CamelImapStore CamelImapStore;
-typedef struct _CamelImapSummary CamelImapSummary;
-
-#endif /* CAMEL_IMAP_TYPES_H */
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
deleted file mode 100644
index 8116f12386..0000000000
--- a/camel/providers/imap/camel-imap-utils.c
+++ /dev/null
@@ -1,568 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- *
- * Copyright 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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-
-#include "camel-imap-utils.h"
-#include "camel-imap-summary.h"
-#include "camel-folder.h"
-
-#define d(x) x
-
-char *
-imap_next_word (const char *buf)
-{
- char *word;
-
- /* skip over current word */
- for (word = (char *)buf; *word && *word != ' '; word++);
-
- /* skip over white space */
- for ( ; *word && *word == ' '; word++);
-
- return word;
-}
-
-/**
- * imap_parse_list_response:
- * @buf: the LIST or LSUB response
- * @flags: a pointer to a variable to store the flags in, or %NULL
- * @sep: a pointer to a variable to store the hierarchy separator in, or %NULL
- * @folder: a pointer to a variable to store the folder name in, or %NULL
- *
- * Parses a LIST or LSUB response and returns the desired parts of it.
- * If @folder is non-%NULL, its value must be freed by the caller.
- *
- * Return value: whether or not the response was successfully parsed.
- **/
-gboolean
-imap_parse_list_response (const char *buf, int *flags, char *sep, char **folder)
-{
- char *word;
- int len;
-
- if (*buf != '*')
- return FALSE;
-
- word = imap_next_word (buf);
- if (g_strncasecmp (word, "LIST", 4) && g_strncasecmp (word, "LSUB", 4))
- return FALSE;
-
- /* get the flags */
- word = imap_next_word (word);
- if (*word != '(')
- return FALSE;
-
- if (flags)
- *flags = 0;
-
- word++;
- while (*word != ')') {
- len = strcspn (word, " )");
- if (flags) {
- if (!g_strncasecmp (word, "\\Noinferiors", len))
- *flags |= IMAP_LIST_FLAG_NOINFERIORS;
- else if (!g_strncasecmp (word, "\\Noselect", len))
- *flags |= IMAP_LIST_FLAG_NOSELECT;
- else if (!g_strncasecmp (word, "\\Marked", len))
- *flags |= IMAP_LIST_FLAG_MARKED;
- else if (!g_strncasecmp (word, "\\Unmarked", len))
- *flags |= IMAP_LIST_FLAG_UNMARKED;
- }
-
- word += len;
- while (*word == ' ')
- word++;
- }
-
- /* get the directory separator */
- word = imap_next_word (word);
- if (!strncmp (word, "NIL", 3)) {
- if (sep)
- *sep = '\0';
- } else if (*word++ == '"') {
- if (*word == '\\')
- word++;
- if (sep)
- *sep = *word;
- word++;
- if (*word++ != '"')
- return FALSE;
- } else
- return FALSE;
-
- if (folder) {
- /* get the folder name */
- word = imap_next_word (word);
- *folder = imap_parse_astring (&word, &len);
- return *folder != NULL;
- }
-
- return TRUE;
-}
-
-char *
-imap_create_flag_list (guint32 flags)
-{
- GString *gstr;
- char *flag_list;
-
- gstr = g_string_new ("(");
-
- if (flags & CAMEL_MESSAGE_ANSWERED)
- g_string_append (gstr, "\\Answered ");
- if (flags & CAMEL_MESSAGE_DELETED)
- g_string_append (gstr, "\\Deleted ");
- if (flags & CAMEL_MESSAGE_DRAFT)
- g_string_append (gstr, "\\Draft ");
- if (flags & CAMEL_MESSAGE_FLAGGED)
- g_string_append (gstr, "\\Flagged ");
- if (flags & CAMEL_MESSAGE_SEEN)
- g_string_append (gstr, "\\Seen ");
-
- if (gstr->str[gstr->len - 1] == ' ')
- gstr->str[gstr->len - 1] = ')';
- else
- g_string_append_c (gstr, ')');
-
- flag_list = gstr->str;
- g_string_free (gstr, FALSE);
- return flag_list;
-}
-
-guint32
-imap_parse_flag_list (char **flag_list_p)
-{
- char *flag_list = *flag_list_p;
- guint32 flags = 0;
- int len;
-
- if (*flag_list++ != '(') {
- *flag_list_p = NULL;
- return 0;
- }
-
- while (*flag_list && *flag_list != ')') {
- len = strcspn (flag_list, " )");
- if (!g_strncasecmp (flag_list, "\\Answered", len))
- flags |= CAMEL_MESSAGE_ANSWERED;
- else if (!g_strncasecmp (flag_list, "\\Deleted", len))
- flags |= CAMEL_MESSAGE_DELETED;
- else if (!g_strncasecmp (flag_list, "\\Draft", len))
- flags |= CAMEL_MESSAGE_DRAFT;
- else if (!g_strncasecmp (flag_list, "\\Flagged", len))
- flags |= CAMEL_MESSAGE_FLAGGED;
- else if (!g_strncasecmp (flag_list, "\\Seen", len))
- flags |= CAMEL_MESSAGE_SEEN;
-
- flag_list += len;
- if (*flag_list == ' ')
- flag_list++;
- }
-
- if (*flag_list++ != ')') {
- *flag_list_p = NULL;
- return 0;
- }
-
- *flag_list_p = flag_list;
- return flags;
-}
-
-static char imap_atom_specials[128] = {
- 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,
- 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 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, 1, 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, 1, 0, 0, 0, 0,
-};
-#define imap_is_atom_char(ch) (isascii (ch) && !imap_atom_specials[ch])
-
-/**
- * imap_parse_string_generic:
- * @str_p: a pointer to a string
- * @len: a pointer to an int to return the length in
- * @type: type of string (#IMAP_STRING, #IMAP_ASTRING, or #IMAP_NSTRING)
- * to parse.
- *
- * This parses an IMAP "string" (quoted string or literal), "nstring"
- * (NIL or string), or "astring" (atom or string) starting at *@str_p.
- * On success, *@str_p will point to the first character after the end
- * of the string, and *@len will contain the length of the returned
- * string. On failure, *@str_p will be set to %NULL.
- *
- * This assumes that the string is in the form returned by
- * camel_imap_command(): that line breaks are indicated by LF rather
- * than CRLF.
- *
- * Return value: the parsed string, or %NULL if a NIL or no string
- * was parsed. (In the former case, *@str_p will be %NULL; in the
- * latter, it will point to the character after the NIL.)
- **/
-char *
-imap_parse_string_generic (char **str_p, int *len, int type)
-{
- char *str = *str_p;
- char *out;
-
- if (!str)
- return NULL;
- else if (*str == '"') {
- char *p;
- int size;
-
- str++;
- size = strcspn (str, "\"") + 1;
- p = out = g_malloc (size);
-
- while (*str && *str != '"') {
- if (*str == '\\')
- str++;
- *p++ = *str++;
- if (p - out == size) {
- out = g_realloc (out, size * 2);
- p = out + size;
- size *= 2;
- }
- }
- if (*str != '"') {
- *str_p = NULL;
- g_free (out);
- return NULL;
- }
- *p = '\0';
- *str_p = str + 1;
- *len = strlen (out);
- return out;
- } else if (*str == '{') {
- *len = strtoul (str + 1, (char **)&str, 10);
- if (*str++ != '}' || *str++ != '\n' || strlen (str) < *len) {
- *str_p = NULL;
- return NULL;
- }
-
- out = g_strndup (str, *len);
- *str_p = str + *len;
- return out;
- } else if (type == IMAP_NSTRING && !g_strncasecmp (str, "nil", 3)) {
- *str_p += 3;
- *len = 0;
- return NULL;
- } else if (type == IMAP_ASTRING &&
- imap_is_atom_char ((unsigned char)*str)) {
- while (imap_is_atom_char ((unsigned char)*str))
- str++;
-
- *len = str - *str_p;
- str = g_strndup (*str_p, *len);
- *str_p += *len;
- return str;
- } else {
- *str_p = NULL;
- return NULL;
- }
-}
-
-static inline void
-skip_char (char **str_p, char ch)
-{
- if (*str_p && **str_p == ch)
- *str_p = *str_p + 1;
- else
- *str_p = NULL;
-}
-
-/* Skip atom, string, or number */
-static void
-skip_asn (char **str_p)
-{
- char *str = *str_p;
-
- if (!str)
- return;
- else if (*str == '"') {
- while (*++str && *str != '"') {
- if (*str == '\\') {
- str++;
- if (!*str)
- break;
- }
- }
- if (*str == '"')
- *str_p = str + 1;
- else
- *str_p = NULL;
- } else if (*str == '{') {
- unsigned long len;
-
- len = strtoul (str + 1, &str, 10);
- if (*str != '}' || *(str + 1) != '\n' ||
- strlen (str + 2) < len) {
- *str_p = NULL;
- return;
- }
- *str_p = str + 2 + len;
- } else {
- /* We assume the string is well-formed and don't
- * bother making sure it's a valid atom.
- */
- while (*str && *str != ')' && *str != ' ')
- str++;
- *str_p = str;
- }
-}
-
-static void
-skip_list (char **str_p)
-{
- skip_char (str_p, '(');
- while (*str_p && **str_p != ')') {
- if (**str_p == '(')
- skip_list (str_p);
- else
- skip_asn (str_p);
- if (*str_p && **str_p == ' ')
- skip_char (str_p, ' ');
- }
- skip_char (str_p, ')');
-}
-
-static void
-parse_params (char **parms_p, CamelContentType *type)
-{
- char *parms = *parms_p, *name, *value;
- int len;
-
- if (!g_strncasecmp (parms, "nil", 3)) {
- *parms_p += 3;
- return;
- }
-
- if (*parms++ != '(') {
- *parms_p = NULL;
- return;
- }
-
- while (parms && *parms != ')') {
- name = imap_parse_nstring (&parms, &len);
- skip_char (&parms, ' ');
- value = imap_parse_nstring (&parms, &len);
-
- if (name && value)
- header_content_type_set_param (type, name, value);
- g_free (name);
- g_free (value);
-
- if (parms && *parms == ' ')
- parms++;
- }
-
- if (!parms || *parms++ != ')') {
- *parms_p = NULL;
- return;
- }
- *parms_p = parms;
-}
-
-/**
- * imap_parse_body:
- * @body_p: pointer to the start of an IMAP "body"
- * @folder: an imap folder
- * @ci: a CamelMessageContentInfo to fill in
- *
- * This filles in @ci with data from *@body_p. On success *@body_p
- * will point to the character after the body. On failure, it will be
- * set to %NULL and @ci will be unchanged.
- **/
-void
-imap_parse_body (char **body_p, CamelFolder *folder,
- CamelMessageContentInfo *ci)
-{
- char *body = *body_p;
- CamelMessageContentInfo *child;
- CamelContentType *type;
- int len;
-
- if (*body++ != '(') {
- *body_p = NULL;
- return;
- }
-
- if (*body == '(') {
- /* multipart */
- GPtrArray *children;
- char *subtype;
- int i;
-
- /* Parse the child body parts */
- children = g_ptr_array_new ();
- i = 0;
- while (body && *body == '(') {
- child = camel_folder_summary_content_info_new (folder->summary);
- g_ptr_array_add (children, child);
- imap_parse_body (&body, folder, child);
- if (!body)
- break;
- child->parent = ci;
- }
- skip_char (&body, ' ');
-
- /* Parse the multipart subtype */
- subtype = imap_parse_string (&body, &len);
-
- /* If there is a parse error, abort. */
- if (!body) {
- for (i = 0; i < children->len; i++) {
- child = children->pdata[i];
- camel_folder_summary_content_info_free (folder->summary, child);
- }
- g_ptr_array_free (children, TRUE);
- *body_p = NULL;
- return;
- }
-
- g_strdown (subtype);
- ci->type = header_content_type_new ("multipart", subtype);
- g_free (subtype);
-
- /* Chain the children. */
- ci->childs = children->pdata[0];
- ci->size = 0;
- for (i = 0; i < children->len - 1; i++) {
- child = children->pdata[i];
- child->next = children->pdata[i + 1];
- ci->size += child->size;
- }
- g_ptr_array_free (children, TRUE);
- } else {
- /* single part */
- char *main_type, *subtype;
- char *id, *description, *encoding;
- guint32 size;
-
- main_type = imap_parse_string (&body, &len);
- skip_char (&body, ' ');
- subtype = imap_parse_string (&body, &len);
- skip_char (&body, ' ');
- if (!body) {
- g_free (main_type);
- g_free (subtype);
- *body_p = NULL;
- return;
- }
- g_strdown (main_type);
- g_strdown (subtype);
- type = header_content_type_new (main_type, subtype);
- g_free (main_type);
- g_free (subtype);
- parse_params (&body, type);
- skip_char (&body, ' ');
-
- id = imap_parse_nstring (&body, &len);
- skip_char (&body, ' ');
- description = imap_parse_nstring (&body, &len);
- skip_char (&body, ' ');
- encoding = imap_parse_string (&body, &len);
- skip_char (&body, ' ');
- if (body)
- size = strtoul (body, &body, 10);
-
- child = NULL;
- if (header_content_type_is (type, "message", "rfc822")) {
- skip_char (&body, ' ');
- skip_list (&body); /* envelope */
- skip_char (&body, ' ');
- child = camel_folder_summary_content_info_new (folder->summary);
- imap_parse_body (&body, folder, child);
- if (!body)
- camel_folder_summary_content_info_free (folder->summary, child);
- skip_char (&body, ' ');
- if (body)
- strtoul (body, &body, 10);
- } else if (header_content_type_is (type, "text", "*")) {
- if (body)
- strtoul (body, &body, 10);
- }
-
- if (body) {
- ci->type = type;
- ci->id = id;
- ci->description = description;
- ci->encoding = encoding;
- ci->size = size;
- ci->childs = child;
- } else {
- header_content_type_unref (type);
- g_free (id);
- g_free (description);
- g_free (encoding);
- }
- }
-
- if (!body || *body++ != ')') {
- *body_p = NULL;
- return;
- }
-
- *body_p = body;
-}
-
-/**
- * imap_quote_string:
- * @str: the string to quote, which must not contain CR or LF
- *
- * Return value: an IMAP "quoted" corresponding to the string, which
- * the caller must free.
- **/
-char *
-imap_quote_string (const char *str)
-{
- const char *p;
- char *quoted, *q;
- int len;
-
- len = strlen (str);
- p = str;
- while ((p = strpbrk (p, "\"\\"))) {
- len++;
- p++;
- }
-
- quoted = q = g_malloc (len + 3);
- *q++ = '"';
- while ((p = strpbrk (str, "\"\\"))) {
- memcpy (q, str, p - str);
- q += p - str;
- *q++ = '\\';
- *q++ = *p++;
- str = p;
- }
- sprintf (q, "%s\"", str);
-
- return quoted;
-}
diff --git a/camel/providers/imap/camel-imap-utils.h b/camel/providers/imap/camel-imap-utils.h
deleted file mode 100644
index 985f177b3a..0000000000
--- a/camel/providers/imap/camel-imap-utils.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- *
- * Copyright 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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef CAMEL_IMAP_UTILS_H
-#define CAMEL_IMAP_UTILS_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-folder-summary.h"
-
-char *imap_next_word (const char *buf);
-
-#define IMAP_LIST_FLAG_NOINFERIORS (1 << 0)
-#define IMAP_LIST_FLAG_NOSELECT (1 << 1)
-#define IMAP_LIST_FLAG_MARKED (1 << 2)
-#define IMAP_LIST_FLAG_UNMARKED (1 << 3)
-gboolean imap_parse_list_response (const char *buf, int *flags, char *sep, char **folder);
-
-char *imap_create_flag_list (guint32 flags);
-guint32 imap_parse_flag_list (char **flag_list);
-
-enum { IMAP_STRING, IMAP_NSTRING, IMAP_ASTRING };
-char *imap_parse_string_generic (char **str_p, int *len, int type);
-#define imap_parse_string(str_p, len_p) \
- imap_parse_string_generic (str_p, len_p, IMAP_STRING)
-#define imap_parse_nstring(str_p, len_p) \
- imap_parse_string_generic (str_p, len_p, IMAP_NSTRING)
-#define imap_parse_astring(str_p, len_p) \
- imap_parse_string_generic (str_p, len_p, IMAP_ASTRING)
-
-void imap_parse_body (char **body_p, CamelFolder *folder,
- CamelMessageContentInfo *ci);
-
-char *imap_quote_string (const char *str);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_IMAP_UTILS_H */
diff --git a/camel/providers/imap/camel-imap-wrapper.c b/camel/providers/imap/camel-imap-wrapper.c
deleted file mode 100644
index e4d06a009b..0000000000
--- a/camel/providers/imap/camel-imap-wrapper.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; -*- */
-/* camel-imap-wrapper.c: data wrapper for offline IMAP data */
-
-/*
- * 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-imap-wrapper.h"
-#include "camel-imap-command.h"
-#include "camel-imap-store.h"
-#include "camel-imap-utils.h"
-#include "camel-imap-private.h"
-#include "camel-exception.h"
-#include "camel-folder.h"
-#include "camel-stream-mem.h"
-#include "camel-stream-filter.h"
-#include "camel-mime-filter-basic.h"
-#include "camel-mime-filter-crlf.h"
-#include "camel-mime-filter-charset.h"
-#include "camel-mime-part.h"
-
-#include <errno.h>
-#include <string.h>
-
-static CamelDataWrapperClass *parent_class = NULL;
-
-/* Returns the class for a CamelDataWrapper */
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static int write_to_stream (CamelDataWrapper *imap_wrapper, CamelStream *stream);
-
-static void
-camel_imap_wrapper_class_init (CamelImapWrapperClass *camel_imap_wrapper_class)
-{
- CamelDataWrapperClass *camel_data_wrapper_class =
- CAMEL_DATA_WRAPPER_CLASS (camel_imap_wrapper_class);
-
- parent_class = CAMEL_DATA_WRAPPER_CLASS (camel_type_get_global_classfuncs (camel_data_wrapper_get_type ()));
-
- /* virtual method override */
- camel_data_wrapper_class->write_to_stream = write_to_stream;
-}
-
-static void
-camel_imap_wrapper_finalize (CamelObject *object)
-{
- CamelImapWrapper *imap_wrapper = CAMEL_IMAP_WRAPPER (object);
-
- if (imap_wrapper->folder)
- camel_object_unref (CAMEL_OBJECT (imap_wrapper->folder));
- if (imap_wrapper->uid)
- g_free (imap_wrapper->uid);
- if (imap_wrapper->part)
- g_free (imap_wrapper->part_spec);
-
-#ifdef ENABLE_THREADS
- g_mutex_free (imap_wrapper->priv->lock);
-#endif
- g_free (imap_wrapper->priv);
-}
-
-static void
-camel_imap_wrapper_init (gpointer object, gpointer klass)
-{
- CamelImapWrapper *imap_wrapper = CAMEL_IMAP_WRAPPER (object);
-
- imap_wrapper->priv = g_new0 (struct _CamelImapWrapperPrivate, 1);
-#ifdef ENABLE_THREADS
- imap_wrapper->priv->lock = g_mutex_new ();
-#endif
-}
-
-CamelType
-camel_imap_wrapper_get_type (void)
-{
- static CamelType camel_imap_wrapper_type = CAMEL_INVALID_TYPE;
-
- if (camel_imap_wrapper_type == CAMEL_INVALID_TYPE) {
- camel_imap_wrapper_type = camel_type_register (
- CAMEL_DATA_WRAPPER_TYPE, "CamelImapWrapper",
- sizeof (CamelImapWrapper),
- sizeof (CamelImapWrapperClass),
- (CamelObjectClassInitFunc) camel_imap_wrapper_class_init,
- NULL,
- (CamelObjectInitFunc) camel_imap_wrapper_init,
- (CamelObjectFinalizeFunc) camel_imap_wrapper_finalize);
- }
-
- return camel_imap_wrapper_type;
-}
-
-
-static int
-write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelImapWrapper *imap_wrapper = CAMEL_IMAP_WRAPPER (data_wrapper);
- CamelImapStore *store;
- CamelImapResponse *response;
- CamelStream *memstream;
- CamelStreamFilter *filterstream;
- CamelMimeFilter *filter;
- CamelContentType *ct;
- char *result, *p, *body;
- int len;
-
- CAMEL_IMAP_WRAPPER_LOCK (imap_wrapper, lock);
- if (!data_wrapper->offline) {
- CAMEL_IMAP_WRAPPER_UNLOCK (imap_wrapper, lock);
- return parent_class->write_to_stream (data_wrapper, stream);
- }
-
- store = CAMEL_IMAP_STORE (imap_wrapper->folder->parent_store);
- CAMEL_IMAP_STORE_LOCK (store, command_lock);
- response = camel_imap_command (store, imap_wrapper->folder, NULL,
- "UID FETCH %s BODY.PEEK[%s]",
- imap_wrapper->uid,
- imap_wrapper->part_spec);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
- if (!response)
- goto lose;
-
- result = camel_imap_response_extract (response, "FETCH", NULL);
- if (!result)
- goto lose;
-
- p = strchr (result, ']');
- if (!p) {
- g_free (result);
- goto lose;
- }
- p += 2;
-
- body = imap_parse_nstring (&p, &len);
- g_free (result);
- if (!body)
- goto lose;
-
- memstream = camel_stream_mem_new_with_buffer (body, len);
- g_free (body);
- filterstream = camel_stream_filter_new_with_stream (memstream);
-
- if (camel_mime_part_get_encoding (imap_wrapper->part) ==
- CAMEL_MIME_PART_ENCODING_BASE64) {
- filter = (CamelMimeFilter *)camel_mime_filter_basic_new_type (CAMEL_MIME_FILTER_BASIC_BASE64_DEC);
- camel_stream_filter_add (filterstream, filter);
- } else if (camel_mime_part_get_encoding (imap_wrapper->part) ==
- CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE) {
- filter = (CamelMimeFilter *)camel_mime_filter_basic_new_type (CAMEL_MIME_FILTER_BASIC_QP_DEC);
- camel_stream_filter_add (filterstream, filter);
- } else
- filter = NULL;
-
- ct = camel_mime_part_get_content_type (imap_wrapper->part);
- if (header_content_type_is (ct, "text", "*")) {
- const char *charset;
-
- /* If we just did B64/QP, need to also do CRLF->LF */
- if (filter) {
- filter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_DECODE,
- CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
- camel_stream_filter_add (filterstream, filter);
- }
-
- charset = header_content_type_param (ct, "charset");
- if (charset && !(strcasecmp (charset, "us-ascii") == 0
- || strcasecmp (charset, "utf-8") == 0)) {
- filter = (CamelMimeFilter *)camel_mime_filter_charset_new_convert (charset, "UTF-8");
- if (filter)
- camel_stream_filter_add (filterstream, filter);
- }
- }
-
- data_wrapper->stream = CAMEL_STREAM (filterstream);
- data_wrapper->offline = FALSE;
-
- camel_object_unref (CAMEL_OBJECT (imap_wrapper->folder));
- imap_wrapper->folder = NULL;
- g_free (imap_wrapper->uid);
- imap_wrapper->uid = NULL;
- g_free (imap_wrapper->part_spec);
- imap_wrapper->part = NULL;
-
- CAMEL_IMAP_WRAPPER_UNLOCK (imap_wrapper, lock);
-
- return parent_class->write_to_stream (data_wrapper, stream);
-
- lose:
- CAMEL_IMAP_WRAPPER_UNLOCK (imap_wrapper, lock);
- errno = ENETUNREACH;
- return -1;
-}
-
-
-CamelDataWrapper *
-camel_imap_wrapper_new (CamelFolder *folder, CamelContentType *type,
- const char *uid, const char *part_spec,
- CamelMimePart *part)
-{
- CamelImapWrapper *imap_wrapper;
-
- imap_wrapper = (CamelImapWrapper *)camel_object_new(camel_imap_wrapper_get_type());
-
- camel_data_wrapper_set_mime_type_field (CAMEL_DATA_WRAPPER (imap_wrapper), type);
- ((CamelDataWrapper *)imap_wrapper)->offline = TRUE;
-
- imap_wrapper->folder = folder;
- camel_object_ref (CAMEL_OBJECT (folder));
- imap_wrapper->uid = g_strdup (uid);
- imap_wrapper->part_spec = g_strdup (part_spec);
-
- /* Don't ref this, it's our parent. */
- imap_wrapper->part = part;
-
- return (CamelDataWrapper *)imap_wrapper;
-}
diff --git a/camel/providers/imap/camel-imap-wrapper.h b/camel/providers/imap/camel-imap-wrapper.h
deleted file mode 100644
index 8eb9d0969a..0000000000
--- a/camel/providers/imap/camel-imap-wrapper.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-imap-wrapper.h: data wrapper for offline IMAP data */
-
-/*
- * 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_IMAP_WRAPPER_H
-#define CAMEL_IMAP_WRAPPER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-data-wrapper.h>
-
-#define CAMEL_IMAP_WRAPPER_TYPE (camel_imap_wrapper_get_type ())
-#define CAMEL_IMAP_WRAPPER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_IMAP_WRAPPER_TYPE, CamelImapWrapper))
-#define CAMEL_IMAP_WRAPPER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_IMAP_WRAPPER_TYPE, CamelImapWrapperClass))
-#define CAMEL_IS_IMAP_WRAPPER(o) (CAMEL_CHECK_TYPE((o), CAMEL_IMAP_WRAPPER_TYPE))
-
-typedef struct
-{
- CamelDataWrapper parent_object;
-
- struct _CamelImapWrapperPrivate *priv;
-
- CamelFolder *folder;
- char *uid, *part_spec;
- CamelMimePart *part;
-} CamelImapWrapper;
-
-typedef struct {
- CamelDataWrapperClass parent_class;
-
-} CamelImapWrapperClass;
-
-/* Standard Camel function */
-CamelType camel_imap_wrapper_get_type (void);
-
-/* Constructor */
-CamelDataWrapper *camel_imap_wrapper_new (CamelFolder *folder,
- CamelContentType *type,
- const char *uid,
- const char *part_spec,
- CamelMimePart *part);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_DATA_WRAPPER_H */
diff --git a/camel/providers/imap/libcamelimap.urls b/camel/providers/imap/libcamelimap.urls
deleted file mode 100644
index c301c0ffac..0000000000
--- a/camel/providers/imap/libcamelimap.urls
+++ /dev/null
@@ -1 +0,0 @@
-imap
diff --git a/camel/providers/local/.cvsignore b/camel/providers/local/.cvsignore
deleted file mode 100644
index 3fa8afaa38..0000000000
--- a/camel/providers/local/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
-*.bb
-*.bbg
-*.da
-*.gcov
diff --git a/camel/providers/local/Makefile.am b/camel/providers/local/Makefile.am
deleted file mode 100644
index 2e95021334..0000000000
--- a/camel/providers/local/Makefile.am
+++ /dev/null
@@ -1,57 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-libcamellocalincludedir = $(includedir)/camel
-
-providerdir = $(pkglibdir)/camel-providers/$(VERSION)
-
-provider_LTLIBRARIES = libcamellocal.la
-provider_DATA = libcamellocal.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-local-provider\"
-
-libcamellocal_la_SOURCES = \
- camel-local-folder.c \
- camel-local-store.c \
- camel-local-summary.c \
- camel-local-provider.c \
- camel-mh-folder.c \
- camel-mh-store.c \
- camel-mh-summary.c \
- camel-mbox-folder.c \
- camel-mbox-store.c \
- camel-mbox-summary.c \
- camel-maildir-folder.c \
- camel-maildir-store.c \
- camel-maildir-summary.c
-
-libcamellocalinclude_HEADERS = \
- camel-local-folder.h \
- camel-local-store.h \
- camel-local-summary.h \
- camel-mh-folder.h \
- camel-mh-store.h \
- camel-mh-summary.h \
- camel-mbox-folder.h \
- camel-mbox-store.h \
- camel-mbox-summary.h \
- camel-maildir-folder.h \
- camel-maildir-store.h \
- camel-maildir-summary.h
-
-noinst_HEADERS = \
- camel-local-private.h
-
-libcamellocal_la_LDFLAGS = -version-info 0:0:0
-
-libcamellocal_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS)
-
-EXTRA_DIST = libcamellocal.urls
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c
deleted file mode 100644
index ea2894aa2e..0000000000
--- a/camel/providers/local/camel-local-folder.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*-
- *
- * Authors: 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-local-folder.h"
-#include "camel-local-store.h"
-#include "string-utils.h"
-#include "camel-stream-fs.h"
-#include "camel-local-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"
-
-#include "camel-local-private.h"
-
-#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
-
-static CamelFolderClass *parent_class = NULL;
-
-/* Returns the class for a CamelLocalFolder */
-#define CLOCALF_CLASS(so) CAMEL_LOCAL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CLOCALS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static int local_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex);
-static void local_unlock(CamelLocalFolder *lf);
-
-static void local_sync(CamelFolder *folder, gboolean expunge, CamelException *ex);
-static void local_expunge(CamelFolder *folder, CamelException *ex);
-
-static GPtrArray *local_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
-static void local_search_free(CamelFolder *folder, GPtrArray * result);
-
-static void local_finalize(CamelObject * object);
-
-static void
-camel_local_folder_class_init(CamelLocalFolderClass * camel_local_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS(camel_local_folder_class);
-
- parent_class = CAMEL_FOLDER_CLASS(camel_type_get_global_classfuncs(camel_folder_get_type()));
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_folder_class->sync = local_sync;
- camel_folder_class->expunge = local_expunge;
-
- camel_folder_class->search_by_expression = local_search_by_expression;
- camel_folder_class->search_free = local_search_free;
-
- camel_local_folder_class->lock = local_lock;
- camel_local_folder_class->unlock = local_unlock;
-}
-
-static void
-local_init(gpointer object, gpointer klass)
-{
- CamelFolder *folder = object;
- CamelLocalFolder *local_folder = object;
-
- 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;
-
- folder->summary = NULL;
- local_folder->search = NULL;
-
- local_folder->priv = g_malloc0(sizeof(*local_folder->priv));
-#ifdef ENABLE_THREADS
- local_folder->priv->search_lock = g_mutex_new();
-#endif
-}
-
-static void
-local_finalize(CamelObject * object)
-{
- CamelLocalFolder *local_folder = CAMEL_LOCAL_FOLDER(object);
- CamelFolder *folder = (CamelFolder *)object;
-
- if (folder->summary) {
- camel_local_summary_sync((CamelLocalSummary *)folder->summary, FALSE, local_folder->changes, NULL);
- camel_object_unref((CamelObject *)folder->summary);
- folder->summary = NULL;
- }
-
- if (local_folder->search) {
- camel_object_unref((CamelObject *)local_folder->search);
- }
-
- /* must free index after summary, since it isn't refcounted */
- if (local_folder->index)
- ibex_close(local_folder->index);
-
- while (local_folder->locked> 0)
- camel_local_folder_unlock(local_folder);
-
- g_free(local_folder->base_path);
- g_free(local_folder->folder_path);
- g_free(local_folder->summary_path);
- g_free(local_folder->index_path);
-
- camel_folder_change_info_free(local_folder->changes);
-
-#ifdef ENABLE_THREADS
- g_mutex_free(local_folder->priv->search_lock);
-#endif
- g_free(local_folder->priv);
-}
-
-CamelType camel_local_folder_get_type(void)
-{
- static CamelType camel_local_folder_type = CAMEL_INVALID_TYPE;
-
- if (camel_local_folder_type == CAMEL_INVALID_TYPE) {
- camel_local_folder_type = camel_type_register(CAMEL_FOLDER_TYPE, "CamelLocalFolder",
- sizeof(CamelLocalFolder),
- sizeof(CamelLocalFolderClass),
- (CamelObjectClassInitFunc) camel_local_folder_class_init,
- NULL,
- (CamelObjectInitFunc) local_init,
- (CamelObjectFinalizeFunc) local_finalize);
- }
-
- return camel_local_folder_type;
-}
-
-CamelLocalFolder *
-camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, const char *full_name, guint32 flags, CamelException *ex)
-{
- CamelFolderInfo *fi;
- CamelFolder *folder;
- const char *root_dir_path, *name;
- struct stat st;
- int forceindex;
-
- folder = (CamelFolder *)lf;
-
- name = strrchr(full_name, '/');
- if (name)
- name++;
- else
- name = full_name;
-
- camel_folder_construct(folder, parent_store, full_name, name);
-
- root_dir_path = camel_local_store_get_toplevel_dir(CAMEL_LOCAL_STORE(folder->parent_store));
-
- lf->base_path = g_strdup(root_dir_path);
- lf->folder_path = g_strdup_printf("%s/%s", root_dir_path, full_name);
- lf->summary_path = g_strdup_printf("%s/%s.ev-summary", root_dir_path, full_name);
- lf->index_path = g_strdup_printf("%s/%s.ibex", root_dir_path, full_name);
-
- lf->changes = camel_folder_change_info_new();
-
- /* if we have no index file, force it */
- forceindex = stat(lf->index_path, &st) == -1;
- if (flags & CAMEL_STORE_FOLDER_BODY_INDEX) {
-
- lf->index = ibex_open(lf->index_path, O_CREAT | O_RDWR, 0600);
- if (lf->index == NULL) {
- /* yes, this isn't fatal at all */
- g_warning("Could not open/create index file: %s: indexing not performed", strerror(errno));
- forceindex = FALSE;
- /* record that we dont have an index afterall */
- flags &= ~CAMEL_STORE_FOLDER_BODY_INDEX;
- }
- } else {
- /* if we do have an index file, remove it */
- if (forceindex == FALSE) {
- unlink(lf->index_path);
- }
- forceindex = FALSE;
- }
-
- lf->flags = flags;
-
- folder->summary = (CamelFolderSummary *)CLOCALF_CLASS(lf)->create_summary(lf->summary_path, lf->folder_path, lf->index);
- if (camel_local_summary_load((CamelLocalSummary *)folder->summary, forceindex, ex) == -1) {
- camel_object_unref (CAMEL_OBJECT (folder));
- return NULL;
- }
-
- fi = g_new0 (CamelFolderInfo, 1);
- fi->full_name = g_strdup (full_name);
- fi->name = g_strdup (name);
- fi->url = g_strdup (lf->folder_path);
- fi->unread_message_count = -1;
-
- camel_object_trigger_event (CAMEL_OBJECT (parent_store),
- "folder_deleted", fi);
-
- camel_folder_info_free (fi);
-
- return lf;
-}
-
-/* lock the folder, may be called repeatedly (with matching unlock calls),
- with type the same or less than the first call */
-int camel_local_folder_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex)
-{
- if (lf->locked > 0) {
- /* lets be anal here - its important the code knows what its doing */
- g_assert(lf->locktype == type || lf->locktype == CAMEL_LOCK_WRITE);
- } else {
- if (CLOCALF_CLASS(lf)->lock(lf, type, ex) == -1)
- return -1;
- lf->locktype = type;
- }
-
- lf->locked++;
-
- return 0;
-}
-
-/* unlock folder */
-int camel_local_folder_unlock(CamelLocalFolder *lf)
-{
- g_assert(lf->locked>0);
- lf->locked--;
- if (lf->locked == 0)
- CLOCALF_CLASS(lf)->unlock(lf);
-
- return 0;
-}
-
-static int
-local_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex)
-{
- return 0;
-}
-
-static void
-local_unlock(CamelLocalFolder *lf)
-{
- /* nothing */
-}
-
-static void
-local_sync(CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- CamelLocalFolder *lf = CAMEL_LOCAL_FOLDER(folder);
-
- d(printf("local sync, expunge=%s\n", expunge?"true":"false"));
-
- if (camel_local_folder_lock(lf, CAMEL_LOCK_WRITE, ex) == -1)
- return;
-
- /* if sync fails, we'll pass it up on exit through ex */
- camel_local_summary_sync((CamelLocalSummary *)folder->summary, expunge, lf->changes, ex);
- camel_local_folder_unlock(lf);
-
- if (camel_folder_change_info_changed(lf->changes)) {
- camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", lf->changes);
- camel_folder_change_info_clear(lf->changes);
- }
-
- /* force save of metadata */
- if (lf->index)
- ibex_save(lf->index);
- if (folder->summary)
- camel_folder_summary_save(folder->summary);
-}
-
-static void
-local_expunge(CamelFolder *folder, CamelException *ex)
-{
- d(printf("expunge\n"));
-
- /* Just do a sync with expunge, serves the same purpose */
- /* call the callback directly, to avoid locking problems */
- CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(folder))->sync(folder, TRUE, ex);
-}
-
-static GPtrArray *
-local_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex)
-{
- CamelLocalFolder *local_folder = CAMEL_LOCAL_FOLDER(folder);
- GPtrArray *summary, *matches;
-
- /* NOTE: could get away without the search lock by creating a new
- search object each time */
-
- CAMEL_LOCAL_FOLDER_LOCK(folder, search_lock);
-
- if (local_folder->search == NULL)
- local_folder->search = camel_folder_search_new();
-
- camel_folder_search_set_folder(local_folder->search, folder);
- camel_folder_search_set_body_index(local_folder->search, local_folder->index);
- summary = camel_folder_get_summary(folder);
- camel_folder_search_set_summary(local_folder->search, summary);
-
- matches = camel_folder_search_execute_expression(local_folder->search, expression, ex);
-
- CAMEL_LOCAL_FOLDER_UNLOCK(folder, search_lock);
-
- camel_folder_free_summary(folder, summary);
-
- return matches;
-}
-
-static void
-local_search_free(CamelFolder *folder, GPtrArray * result)
-{
- CamelLocalFolder *local_folder = CAMEL_LOCAL_FOLDER(folder);
-
- /* we need to lock this free because of the way search_free_result works */
- /* FIXME: put the lock inside search_free_result */
- CAMEL_LOCAL_FOLDER_LOCK(folder, search_lock);
-
- camel_folder_search_free_result(local_folder->search, result);
-
- CAMEL_LOCAL_FOLDER_UNLOCK(folder, search_lock);
-}
diff --git a/camel/providers/local/camel-local-folder.h b/camel/providers/local/camel-local-folder.h
deleted file mode 100644
index 7c975c8f7a..0000000000
--- a/camel/providers/local/camel-local-folder.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Author: Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright (C) 1999 Helix Code (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_LOCAL_FOLDER_H
-#define CAMEL_LOCAL_FOLDER_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-search.h>
-#include <libibex/ibex.h>
-#include "camel-local-summary.h"
-#include "camel-lock.h"
-
-/* #include "camel-store.h" */
-
-#define CAMEL_LOCAL_FOLDER_TYPE (camel_local_folder_get_type ())
-#define CAMEL_LOCAL_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_LOCAL_FOLDER_TYPE, CamelLocalFolder))
-#define CAMEL_LOCAL_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_LOCAL_FOLDER_TYPE, CamelLocalFolderClass))
-#define CAMEL_IS_LOCAL_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_LOCAL_FOLDER_TYPE))
-
-typedef struct {
- CamelFolder parent_object;
- struct _CamelLocalFolderPrivate *priv;
-
- guint32 flags; /* open mode flags */
-
- int locked; /* lock counter */
- CamelLockType locktype; /* what type of lock we have */
-
- char *base_path; /* base path of the local folder */
- char *folder_path; /* the path to the folder itself */
- char *summary_path; /* where the summary lives */
- char *index_path; /* where the index file lives */
-
- ibex *index; /* index for this folder */
- CamelFolderSearch *search; /* used to run searches, we just use the real thing (tm) */
- CamelFolderChangeInfo *changes; /* used to store changes to the folder during processing */
-} CamelLocalFolder;
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
- /* summary factory, only used at init */
- CamelLocalSummary *(*create_summary)(const char *path, const char *folder, ibex *index);
-
- /* Lock the folder for my operations */
- int (*lock)(CamelLocalFolder *, CamelLockType type, CamelException *ex);
-
- /* Unlock the folder for my operations */
- void (*unlock)(CamelLocalFolder *);
-} CamelLocalFolderClass;
-
-
-/* public methods */
-/* flags are taken from CAMEL_STORE_FOLDER_* flags */
-CamelLocalFolder *camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store,
- const char *full_name, guint32 flags, CamelException *ex);
-
-/* Standard Camel function */
-CamelType camel_local_folder_get_type(void);
-
-/* Lock the folder for internal use. May be called repeatedly */
-/* UNIMPLEMENTED */
-int camel_local_folder_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex);
-int camel_local_folder_unlock(CamelLocalFolder *lf);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_LOCAL_FOLDER_H */
diff --git a/camel/providers/local/camel-local-private.h b/camel/providers/local/camel-local-private.h
deleted file mode 100644
index 1d1a89ea27..0000000000
--- a/camel/providers/local/camel-local-private.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- * camel-local-private.h: Private info for local provider.
- *
- * 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
- */
-
-#ifndef CAMEL_PRIVATE_H
-#define CAMEL_PRIVATE_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-/* need a way to configure and save this data, if this header is to
- be installed. For now, dont install it */
-
-#include "config.h"
-
-#ifdef ENABLE_THREADS
-#include <pthread.h>
-#endif
-
-struct _CamelLocalFolderPrivate {
-#ifdef ENABLE_THREADS
- GMutex *search_lock; /* for locking the search object */
-#endif
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_LOCAL_FOLDER_LOCK(f, l) (g_mutex_lock(((CamelLocalFolder *)f)->priv->l))
-#define CAMEL_LOCAL_FOLDER_UNLOCK(f, l) (g_mutex_unlock(((CamelLocalFolder *)f)->priv->l))
-#else
-#define CAMEL_LOCAL_FOLDER_LOCK(f, l)
-#define CAMEL_LOCAL_FOLDER_UNLOCK(f, l)
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_H */
-
diff --git a/camel/providers/local/camel-local-provider.c b/camel/providers/local/camel-local-provider.c
deleted file mode 100644
index 2d66d59503..0000000000
--- a/camel/providers/local/camel-local-provider.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Authors: Michael Zucchi <notzed@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 <stdio.h>
-
-#include "config.h"
-#include "camel-provider.h"
-#include "camel-session.h"
-#include "camel-url.h"
-
-#include "camel-mh-store.h"
-#include "camel-mbox-store.h"
-#include "camel-maildir-store.h"
-
-static CamelProvider mh_provider = {
- "mh",
- N_("MH-format mail directories"),
- N_("For storing local mail in MH-like mail directories"),
- "mail",
- CAMEL_PROVIDER_IS_STORAGE,
- CAMEL_URL_NEED_PATH | CAMEL_URL_PATH_IS_ABSOLUTE,
- {0, 0},
- NULL
-};
-
-static CamelProvider mbox_provider = {
- "mbox",
- N_("Standard Unix mailbox file"),
- N_("For storing local mail in standard mbox format"),
- "mail",
- CAMEL_PROVIDER_IS_SOURCE | CAMEL_PROVIDER_IS_STORAGE,
- CAMEL_URL_NEED_PATH | CAMEL_URL_PATH_IS_ABSOLUTE,
- { 0, 0 },
- NULL
-};
-
-static CamelProvider maildir_provider = {
- "maildir",
- N_("Qmail maildir-format mail files"),
- N_("For storing local mail in qmail maildir directories"),
- "mail",
- CAMEL_PROVIDER_IS_SOURCE | CAMEL_PROVIDER_IS_STORAGE,
- CAMEL_URL_NEED_PATH | CAMEL_URL_PATH_IS_ABSOLUTE,
- { 0, 0 },
- NULL
-};
-
-void camel_provider_module_init(CamelSession * session)
-{
- mh_provider.object_types[CAMEL_PROVIDER_STORE] = camel_mh_store_get_type();
- mh_provider.service_cache = g_hash_table_new(camel_url_hash, camel_url_equal);
- camel_session_register_provider(session, &mh_provider);
-
- mbox_provider.object_types[CAMEL_PROVIDER_STORE] = camel_mbox_store_get_type();
- mbox_provider.service_cache = g_hash_table_new(camel_url_hash, camel_url_equal);
- camel_session_register_provider(session, &mbox_provider);
-
- maildir_provider.object_types[CAMEL_PROVIDER_STORE] = camel_maildir_store_get_type();
- maildir_provider.service_cache = g_hash_table_new(camel_url_hash, camel_url_equal);
- camel_session_register_provider(session, &maildir_provider);
-}
diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c
deleted file mode 100644
index 34da035301..0000000000
--- a/camel/providers/local/camel-local-store.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright (C) 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 <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#include "camel-local-store.h"
-#include "camel-exception.h"
-#include "camel-url.h"
-
-#define d(x)
-
-/* Returns the class for a CamelLocalStore */
-#define CLOCALS_CLASS(so) CAMEL_LOCAL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static void construct (CamelService *service, CamelSession *session, CamelProvider *provider, CamelURL *url, CamelException *ex);
-static CamelFolder *get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelException * ex);
-static char *get_name(CamelService *service, gboolean brief);
-static CamelFolder *get_inbox (CamelStore *store, CamelException *ex);
-static void rename_folder(CamelStore *store, const char *old_name, const char *new_name, CamelException *ex);
-static CamelFolderInfo *get_folder_info (CamelStore *store, const char *top,
- gboolean fast, gboolean recursive,
- gboolean subscribed_only,
- CamelException *ex);
-static void delete_folder(CamelStore *store, const char *folder_name, CamelException *ex);
-static void rename_folder(CamelStore *store, const char *old, const char *new, CamelException *ex);
-
-static CamelStoreClass *parent_class = NULL;
-
-static void
-camel_local_store_class_init (CamelLocalStoreClass *camel_local_store_class)
-{
- CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_local_store_class);
- CamelServiceClass *camel_service_class = CAMEL_SERVICE_CLASS (camel_local_store_class);
-
- parent_class = CAMEL_STORE_CLASS (camel_type_get_global_classfuncs (camel_store_get_type ()));
-
- /* virtual method overload */
- camel_service_class->construct = construct;
- camel_service_class->get_name = get_name;
- camel_store_class->get_folder = get_folder;
- camel_store_class->get_inbox = get_inbox;
- camel_store_class->get_folder_info = get_folder_info;
- camel_store_class->free_folder_info = camel_store_free_folder_info_full;
-
- camel_store_class->delete_folder = delete_folder;
- camel_store_class->rename_folder = rename_folder;
-}
-
-CamelType
-camel_local_store_get_type (void)
-{
- static CamelType camel_local_store_type = CAMEL_INVALID_TYPE;
-
- if (camel_local_store_type == CAMEL_INVALID_TYPE) {
- camel_local_store_type = camel_type_register (CAMEL_STORE_TYPE, "CamelLocalStore",
- sizeof (CamelLocalStore),
- sizeof (CamelLocalStoreClass),
- (CamelObjectClassInitFunc) camel_local_store_class_init,
- NULL,
- NULL,
- NULL);
- }
-
- return camel_local_store_type;
-}
-
-static void
-construct (CamelService *service, CamelSession *session, CamelProvider *provider, CamelURL *url, CamelException *ex)
-{
- int len;
-
- CAMEL_SERVICE_CLASS (parent_class)->construct (service, session, provider, url, ex);
- if (camel_exception_is_set (ex))
- return;
-
- len = strlen (service->url->path);
- if (service->url->path[len - 1] != '/') {
- service->url->path = g_realloc (service->url->path, len + 2);
- strcpy (service->url->path + len, "/");
- }
-}
-
-const char *
-camel_local_store_get_toplevel_dir (CamelLocalStore *store)
-{
- CamelURL *url = CAMEL_SERVICE (store)->url;
-
- g_assert (url != NULL);
- return url->path;
-}
-
-static CamelFolder *
-get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelException * ex)
-{
- struct stat st;
- char *path = ((CamelService *)store)->url->path;
- char *sub, *slash;
-
- if (path[0] != '/') {
- camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("Store root %s is not an absolute path"), path);
- return NULL;
- }
-
- if (stat(path, &st) == 0) {
- if (!S_ISDIR(st.st_mode)) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("Store root %s is not a regular directory"), path);
- }
- return NULL;
- }
-
- if (errno != ENOENT
- || (flags & CAMEL_STORE_FOLDER_CREATE) == 0) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("Cannot get folder: %s: %s"), path, strerror(errno));
- return NULL;
- }
-
- /* need to create the dir heirarchy */
- sub = alloca(strlen(path)+1);
- strcpy(sub, path);
- slash = sub;
- do {
- slash = strchr(slash+1, '/');
- if (slash)
- *slash = 0;
- if (stat(sub, &st) == -1) {
- if (errno != ENOENT
- || mkdir(sub, 0700) == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("Cannot get folder: %s: %s"), path, strerror(errno));
- return NULL;
- }
- }
- if (slash)
- *slash = '/';
- } while (slash);
-
- return NULL;
-}
-
-static CamelFolder *
-get_inbox(CamelStore *store, CamelException *ex)
-{
- camel_exception_set(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("Local stores do not have an inbox"));
- return NULL;
-}
-
-static char *
-get_name (CamelService *service, gboolean brief)
-{
- if (brief)
- return g_strdup (service->url->path);
- else
- return g_strdup_printf (_("Local mail file %s"), service->url->path);
-}
-
-static CamelFolderInfo *
-get_folder_info (CamelStore *store, const char *top,
- gboolean fast, gboolean recursive,
- gboolean subscribed_only,
- CamelException *ex)
-{
- /* FIXME: This is broken, but it corresponds to what was
- * there before.
- */
- return NULL;
-}
-
-static int xrename(const char *oldp, const char *newp, const char *prefix, const char *suffix, int missingok, CamelException *ex)
-{
- struct stat st;
- char *old = g_strconcat(prefix, oldp, suffix, 0);
- char *new = g_strconcat(prefix, newp, suffix, 0);
- int ret = -1;
- int err = 0;
-
- d(printf("renaming %s%s to %s%s\n", oldp, suffix, newp, suffix));
-
- if (stat(old, &st) == -1) {
- if (missingok && errno == ENOENT) {
- ret = 0;
- } else {
- err = errno;
- ret = -1;
- }
- } else if (S_ISDIR(st.st_mode)) { /* use rename for dirs */
- if (rename(old, new) == 0
- || stat(new, &st) == 0) {
- ret = 0;
- } else {
- err = errno;
- ret = -1;
- }
- } else if (link(old, new) == 0 /* and link for files */
- || (stat(new, &st) == 0 && st.st_nlink == 2)) {
- if (unlink(old) == 0) {
- ret = 0;
- } else {
- err = errno;
- unlink(new);
- ret = -1;
- }
- } else {
- err = errno;
- ret = -1;
- }
-
- if (ret == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not rename folder %s to %s: %s"),
- old, new, strerror(err));
- }
-
- g_free(old);
- g_free(new);
- return ret;
-}
-
-/* default implementation, rename all */
-static void
-rename_folder(CamelStore *store, const char *old, const char *new, CamelException *ex)
-{
- char *path = CAMEL_SERVICE (store)->url->path;
-
- /* try to rollback failures, has obvious races */
- if (xrename(old, new, path, ".ibex", TRUE, ex)) {
- return;
- }
- if (xrename(old, new, path, ".ev-summary", TRUE, ex)) {
- xrename(new, old, path, ".ibex", TRUE, ex);
- return;
- }
- if (xrename(old, new, path, "", FALSE, ex)) {
- xrename(new, old, path, ".ev-summary", TRUE, ex);
- xrename(new, old, path, ".ibex", TRUE, ex);
- }
-}
-
-/* default implementation, only delete metadata */
-static void
-delete_folder(CamelStore *store, const char *folder_name, CamelException *ex)
-{
- CamelFolderInfo *fi;
- char *name;
- char *str;
-
- /* remove metadata only */
- name = g_strdup_printf("%s%s", CAMEL_SERVICE(store)->url->path, folder_name);
- str = g_strdup_printf("%s.ev-summary", name);
- if (unlink(str) == -1 && errno != ENOENT) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not delete folder summary file `%s': %s"),
- str, strerror(errno));
- g_free(str);
- g_free (name);
- return;
- }
- g_free(str);
- str = g_strdup_printf("%s.ibex", name);
- if (unlink(str) == -1 && errno != ENOENT) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not delete folder index file `%s': %s"),
- str, strerror(errno));
- g_free(str);
- g_free (name);
- return;
- }
- g_free(str);
- g_free(name);
-
- fi = g_new0 (CamelFolderInfo, 1);
- fi->full_name = g_strdup (folder_name);
- fi->name = g_strdup (g_basename (folder_name));
- fi->url = g_strdup_printf ("%s%s", CAMEL_SERVICE(store)->url->path, folder_name);
- fi->unread_message_count = -1;
-
- camel_object_trigger_event (CAMEL_OBJECT (store),
- "folder_deleted", fi);
-
- camel_folder_info_free (fi);
-}
diff --git a/camel/providers/local/camel-local-store.h b/camel/providers/local/camel-local-store.h
deleted file mode 100644
index 9335b73eaa..0000000000
--- a/camel/providers/local/camel-local-store.h
+++ /dev/null
@@ -1,68 +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_LOCAL_STORE_H
-#define CAMEL_LOCAL_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-store.h"
-
-#define CAMEL_LOCAL_STORE_TYPE (camel_local_store_get_type ())
-#define CAMEL_LOCAL_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_LOCAL_STORE_TYPE, CamelLocalStore))
-#define CAMEL_LOCAL_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_LOCAL_STORE_TYPE, CamelLocalStoreClass))
-#define CAMEL_IS_LOCAL_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_LOCAL_STORE_TYPE))
-
-
-typedef struct {
- CamelStore parent_object;
-
-} CamelLocalStore;
-
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-} CamelLocalStoreClass;
-
-
-/* public methods */
-
-/* Standard Camel function */
-CamelType camel_local_store_get_type (void);
-
-const gchar *camel_local_store_get_toplevel_dir (CamelLocalStore *store);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_LOCAL_STORE_H */
-
-
diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c
deleted file mode 100644
index 869b7c712a..0000000000
--- a/camel/providers/local/camel-local-summary.c
+++ /dev/null
@@ -1,557 +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 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-local-summary.h"
-#include <camel/camel-mime-message.h>
-
-#include <ctype.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) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
-
-#define CAMEL_LOCAL_SUMMARY_VERSION (0x200)
-
-struct _CamelLocalSummaryPrivate {
-};
-
-#define _PRIVATE(o) (((CamelLocalSummary *)(o))->priv)
-
-static CamelMessageInfo * message_info_new (CamelFolderSummary *, struct _header_raw *);
-
-static int local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *mi);
-static char *local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *mi);
-
-static int local_summary_load(CamelLocalSummary *cls, int forceindex, CamelException *ex);
-static int local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static int local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static CamelMessageInfo *local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
-
-static void camel_local_summary_class_init (CamelLocalSummaryClass *klass);
-static void camel_local_summary_init (CamelLocalSummary *obj);
-static void camel_local_summary_finalise (CamelObject *obj);
-static CamelFolderSummaryClass *camel_local_summary_parent;
-
-CamelType
-camel_local_summary_get_type(void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register(camel_folder_summary_get_type(), "CamelLocalSummary",
- sizeof (CamelLocalSummary),
- sizeof (CamelLocalSummaryClass),
- (CamelObjectClassInitFunc) camel_local_summary_class_init,
- NULL,
- (CamelObjectInitFunc) camel_local_summary_init,
- (CamelObjectFinalizeFunc) camel_local_summary_finalise);
- }
-
- return type;
-}
-
-static void
-camel_local_summary_class_init(CamelLocalSummaryClass *klass)
-{
- CamelFolderSummaryClass *sklass = (CamelFolderSummaryClass *) klass;
-
- camel_local_summary_parent = CAMEL_FOLDER_SUMMARY_CLASS(camel_type_get_global_classfuncs(camel_folder_summary_get_type()));
-
- sklass->message_info_new = message_info_new;
-
- klass->load = local_summary_load;
- klass->check = local_summary_check;
- klass->sync = local_summary_sync;
- klass->add = local_summary_add;
-
- klass->encode_x_evolution = local_summary_encode_x_evolution;
- klass->decode_x_evolution = local_summary_decode_x_evolution;
-}
-
-static void
-camel_local_summary_init(CamelLocalSummary *obj)
-{
- struct _CamelLocalSummaryPrivate *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(CamelMessageInfo);
- s->content_info_size = sizeof(CamelMessageContentInfo);
-
- /* and a unique file version */
- s->version += CAMEL_LOCAL_SUMMARY_VERSION;
-}
-
-static void
-camel_local_summary_finalise(CamelObject *obj)
-{
- CamelLocalSummary *mbs = CAMEL_LOCAL_SUMMARY(obj);
-
- g_free(mbs->folder_path);
-}
-
-void
-camel_local_summary_construct(CamelLocalSummary *new, const char *filename, const char *local_name, ibex *index)
-{
- camel_folder_summary_set_build_content(CAMEL_FOLDER_SUMMARY(new), FALSE);
- camel_folder_summary_set_filename(CAMEL_FOLDER_SUMMARY(new), filename);
- new->folder_path = g_strdup(local_name);
- new->index = index;
-}
-
-static int
-local_summary_load(CamelLocalSummary *cls, int forceindex, CamelException *ex)
-{
- return camel_folder_summary_load((CamelFolderSummary *)cls);
-}
-
-/* load/check the summary */
-int
-camel_local_summary_load(CamelLocalSummary *cls, int forceindex, CamelException *ex)
-{
- struct stat st;
- CamelFolderSummary *s = (CamelFolderSummary *)cls;
-
- d(printf("Loading summary ...\n"));
-
- if (forceindex
- || stat(s->summary_path, &st) == -1
- || ((CamelLocalSummaryClass *)(CAMEL_OBJECT_GET_CLASS(cls)))->load(cls, forceindex, ex) == -1) {
- camel_folder_summary_clear((CamelFolderSummary *)cls);
- }
-
- if (camel_local_summary_check(cls, NULL, ex) == 0) {
- if (camel_folder_summary_save(s) == -1)
- g_warning("Could not save summary for %s: %s", cls->folder_path, strerror(errno));
- if (cls->index && ibex_save(cls->index) == -1)
- g_warning("Could not sync index for %s: %s", cls->folder_path, strerror(errno));
-
- return 0;
- }
- return -1;
-}
-
-char *
-camel_local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *info)
-{
- return ((CamelLocalSummaryClass *)(CAMEL_OBJECT_GET_CLASS(cls)))->encode_x_evolution(cls, info);
-}
-
-int
-camel_local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *info)
-{
- return ((CamelLocalSummaryClass *)(CAMEL_OBJECT_GET_CLASS(cls)))->decode_x_evolution(cls, xev, info);
-}
-
-/*#define DOSTATS*/
-#ifdef DOSTATS
-struct _stat_info {
- int mitotal;
- int micount;
- int citotal;
- int cicount;
- int msgid;
- int msgcount;
-};
-
-static void
-do_stat_ci(CamelLocalSummary *cls, struct _stat_info *info, CamelMessageContentInfo *ci)
-{
- info->cicount++;
- info->citotal += ((CamelFolderSummary *)cls)->content_info_size /*+ 4 memchunks are 1/4 byte overhead per mi */;
- if (ci->id)
- info->citotal += strlen(ci->id) + 4;
- if (ci->description)
- info->citotal += strlen(ci->description) + 4;
- if (ci->encoding)
- info->citotal += strlen(ci->encoding) + 4;
- if (ci->type) {
- struct _header_content_type *ct = ci->type;
- struct _header_param *param;
-
- info->citotal += sizeof(*ct) + 4;
- if (ct->type)
- info->citotal += strlen(ct->type) + 4;
- if (ct->subtype)
- info->citotal += strlen(ct->subtype) + 4;
- param = ct->params;
- while (param) {
- info->citotal += sizeof(*param) + 4;
- if (param->name)
- info->citotal += strlen(param->name)+4;
- if (param->value)
- info->citotal += strlen(param->value)+4;
- param = param->next;
- }
- }
- ci = ci->childs;
- while (ci) {
- do_stat_ci(cls, info, ci);
- ci = ci->next;
- }
-}
-
-static void
-do_stat_mi(CamelLocalSummary *cls, struct _stat_info *info, CamelMessageInfo *mi)
-{
- info->micount++;
- info->mitotal += ((CamelFolderSummary *)cls)->content_info_size /*+ 4*/;
-
- if (mi->subject)
- info->mitotal += strlen(mi->subject) + 4;
- if (mi->to)
- info->mitotal += strlen(mi->to) + 4;
- if (mi->from)
- info->mitotal += strlen(mi->from) + 4;
- if (mi->cc)
- info->mitotal += strlen(mi->cc) + 4;
- if (mi->uid)
- info->mitotal += strlen(mi->uid) + 4;
-
- if (mi->references) {
- info->mitotal += (mi->references->size-1) * sizeof(CamelSummaryMessageID) + sizeof(CamelSummaryReferences) + 4;
- info->msgid += (mi->references->size) * sizeof(CamelSummaryMessageID);
- info->msgcount += mi->references->size;
- }
-
- /* dont have any user flags yet */
-
- if (mi->content) {
- do_stat_ci(cls, info, mi->content);
- }
-}
-
-#endif
-
-int
-camel_local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex)
-{
- int ret;
-
- ret = ((CamelLocalSummaryClass *)(CAMEL_OBJECT_GET_CLASS(cls)))->check(cls, changeinfo, ex);
-
-#ifdef DOSTATS
- if (ret != -1) {
- int i;
- CamelFolderSummary *s = (CamelFolderSummary *)cls;
- struct _stat_info stats = { 0 };
-
- for (i=0;i<camel_folder_summary_count(s);i++) {
- CamelMessageInfo *info = camel_folder_summary_index(s, i);
- do_stat_mi(cls, &stats, info);
- camel_folder_summary_info_free(s, info);
- }
-
- printf("\nMemory used by summary:\n\n");
- printf("Total of %d messages\n", camel_folder_summary_count(s));
- printf("Total: %d bytes (ave %f)\n", stats.citotal + stats.mitotal,
- (double)(stats.citotal+stats.mitotal)/(double)camel_folder_summary_count(s));
- printf("Message Info: %d (ave %f)\n", stats.mitotal, (double)stats.mitotal/(double)stats.micount);
- printf("Content Info; %d (ave %f) count %d\n", stats.citotal, (double)stats.citotal/(double)stats.cicount, stats.cicount);
- printf("message id's: %d (ave %f) count %d\n", stats.msgid, (double)stats.msgid/(double)stats.msgcount, stats.msgcount);
- }
-#endif
- return ret;
-}
-
-int
-camel_local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
-{
- return ((CamelLocalSummaryClass *)(CAMEL_OBJECT_GET_CLASS(cls)))->sync(cls, expunge, changeinfo, ex);
-}
-
-CamelMessageInfo *
-camel_local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *ci, CamelException *ex)
-{
- return ((CamelLocalSummaryClass *)(CAMEL_OBJECT_GET_CLASS(cls)))->add(cls, msg, info, ci, ex);
-}
-
-/**
- * camel_local_summary_write_headers:
- * @fd:
- * @header:
- * @xevline:
- *
- * Write a bunch of headers to the file @fd. IF xevline is non NULL, then
- * an X-Evolution header line is created at the end of all of the headers.
- * The headers written are termianted with a blank line.
- *
- * Return value: -1 on error, otherwise the number of bytes written.
- **/
-int
-camel_local_summary_write_headers(int fd, struct _header_raw *header, char *xevline)
-{
- int outlen = 0, len;
- int newfd;
- FILE *out;
-
- /* dum de dum, maybe the whole sync function should just use stdio for output */
- newfd = dup(fd);
- if (newfd == -1)
- return -1;
-
- out = fdopen(newfd, "w");
- if (out == NULL) {
- close(newfd);
- errno = EINVAL;
- return -1;
- }
-
- while (header) {
- if (strcmp(header->name, "X-Evolution")) {
- len = fprintf(out, "%s:%s\n", header->name, header->value);
- if (len == -1) {
- fclose(out);
- return -1;
- }
- outlen += len;
- }
- header = header->next;
- }
-
- if (xevline) {
- len = fprintf(out, "X-Evolution: %s\n\n", xevline);
- if (len == -1) {
- fclose(out);
- return -1;
- }
- outlen += len;
- }
-
- if (fclose(out) == -1)
- return -1;
-
- return outlen;
-}
-
-static int
-local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex)
-{
- /* FIXME: sync index here ? */
- return 0;
-}
-
-static int
-local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
-{
- return 0;
-}
-
-static CamelMessageInfo *
-local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *ci, CamelException *ex)
-{
- CamelMessageInfo *mi;
- char *xev;
-
- d(printf("Adding message to summary\n"));
-
- mi = camel_folder_summary_add_from_message((CamelFolderSummary *)cls, msg);
- if (mi) {
- d(printf("Added, uid = %s\n", mi->uid));
- if (info) {
- CamelTag *tag = info->user_tags;
- CamelFlag *flag = info->user_flags;
-
- while (flag) {
- camel_flag_set(&mi->user_flags, flag->name, TRUE);
- flag = flag->next;
- }
-
- while (tag) {
- camel_tag_set(&mi->user_tags, tag->name, tag->value);
- tag = tag->next;
- }
-
- mi->flags = mi->flags | (info->flags & 0xffff);
- }
- mi->flags &= ~(CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_FLAGGED);
- xev = camel_local_summary_encode_x_evolution(cls, mi);
- camel_medium_set_header((CamelMedium *)msg, "X-Evolution", xev);
- g_free(xev);
- camel_folder_change_info_add_uid(ci, camel_message_info_uid(mi));
- } else {
- d(printf("Failed!\n"));
- camel_exception_set(ex, 1, "Unable to add message to summary: unknown reason");
- }
- return mi;
-}
-
-static char *
-local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *mi)
-{
- GString *out = g_string_new("");
- struct _header_param *params = NULL;
- GString *val = g_string_new("");
- CamelFlag *flag = mi->user_flags;
- CamelTag *tag = mi->user_tags;
- char *ret;
- const char *p, *uidstr;
- guint32 uid;
-
- /* FIXME: work out what to do with uid's that aren't stored here? */
- /* FIXME: perhaps make that a mbox folder only issue?? */
- p = uidstr = camel_message_info_uid(mi);
- while (*p && isdigit(*p))
- p++;
- if (*p == 0 && sscanf(uidstr, "%u", &uid) == 1) {
- g_string_sprintf(out, "%08x-%04x", uid, mi->flags & 0xffff);
- } else {
- g_string_sprintf(out, "%s-%04x", uidstr, mi->flags & 0xffff);
- }
-
- if (flag || tag) {
- val = g_string_new("");
-
- if (flag) {
- while (flag) {
- g_string_append(val, flag->name);
- if (flag->next)
- g_string_append_c(val, ',');
- flag = flag->next;
- }
- header_set_param(&params, "flags", val->str);
- g_string_truncate(val, 0);
- }
- if (tag) {
- while (tag) {
- g_string_append(val, tag->name);
- g_string_append_c(val, '=');
- g_string_append(val, tag->value);
- if (tag->next)
- g_string_append_c(val, ',');
- tag = tag->next;
- }
- header_set_param(&params, "tags", val->str);
- }
- g_string_free(val, TRUE);
- header_param_list_format_append(out, params);
- header_param_list_free(params);
- }
- ret = out->str;
- g_string_free(out, FALSE);
- return ret;
-}
-
-static int
-local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *mi)
-{
- struct _header_param *params, *scan;
- guint32 uid, flags;
- char *header;
- int i;
-
- /* check for uid/flags */
- header = header_token_decode(xev);
- if (header && strlen(header) == strlen("00000000-0000")
- && sscanf(header, "%08x-%04x", &uid, &flags) == 2) {
- char uidstr[20];
- if (mi) {
- sprintf(uidstr, "%u", uid);
- camel_message_info_set_uid(mi, g_strdup(uidstr));
- mi->flags = flags;
- }
- } else {
- g_free(header);
- return -1;
- }
- g_free(header);
-
- if (mi == NULL)
- return 0;
-
- /* check for additional data */
- header = strchr(xev, ';');
- if (header) {
- params = header_param_list_decode(header+1);
- scan = params;
- while (scan) {
- if (!strcasecmp(scan->name, "flags")) {
- char **flagv = g_strsplit(scan->value, ",", 1000);
-
- for (i=0;flagv[i];i++) {
- camel_flag_set(&mi->user_flags, flagv[i], TRUE);
- }
- g_strfreev(flagv);
- } else if (!strcasecmp(scan->name, "tags")) {
- char **tagv = g_strsplit(scan->value, ",", 10000);
- char *val;
-
- for (i=0;tagv[i];i++) {
- val = strchr(tagv[i], '=');
- if (val) {
- *val++ = 0;
- camel_tag_set(&mi->user_tags, tagv[i], val);
- val[-1]='=';
- }
- }
- g_strfreev(tagv);
- }
- scan = scan->next;
- }
- header_param_list_free(params);
- }
- return 0;
-}
-
-static CamelMessageInfo *
-message_info_new(CamelFolderSummary *s, struct _header_raw *h)
-{
- CamelMessageInfo *mi;
- CamelLocalSummary *cls = (CamelLocalSummary *)s;
-
- mi = ((CamelFolderSummaryClass *)camel_local_summary_parent)->message_info_new(s, h);
- if (mi) {
- const char *xev;
- int doindex = FALSE;
-
- xev = header_raw_find(&h, "X-Evolution", NULL);
- if (xev==NULL || camel_local_summary_decode_x_evolution(cls, xev, mi) == -1) {
- /* to indicate it has no xev header */
- mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV;
- camel_message_info_set_uid(mi, camel_folder_summary_next_uid_string(s));
-
- /* shortcut, no need to look it up in the index library */
- doindex = TRUE;
- }
-
- if (cls->index
- && (doindex
- || cls->index_force
- || !ibex_contains_name(cls->index, (char *)camel_message_info_uid(mi)))) {
- d(printf("Am indexing message %s\n", camel_message_info_uid(mi)));
- camel_folder_summary_set_index(s, cls->index);
- } else {
- d(printf("Not indexing message %s\n", camel_message_info_uid(mi)));
- camel_folder_summary_set_index(s, NULL);
- }
- }
-
- return mi;
-}
diff --git a/camel/providers/local/camel-local-summary.h b/camel/providers/local/camel-local-summary.h
deleted file mode 100644
index 332175b451..0000000000
--- a/camel/providers/local/camel-local-summary.h
+++ /dev/null
@@ -1,86 +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_LOCAL_SUMMARY_H
-#define _CAMEL_LOCAL_SUMMARY_H
-
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-folder.h>
-#include <camel/camel-exception.h>
-#include <libibex/ibex.h>
-
-#define CAMEL_LOCAL_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_local_summary_get_type (), CamelLocalSummary)
-#define CAMEL_LOCAL_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_local_summary_get_type (), CamelLocalSummaryClass)
-#define CAMEL_IS_LOCAL_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_local_summary_get_type ())
-
-typedef struct _CamelLocalSummary CamelLocalSummary;
-typedef struct _CamelLocalSummaryClass CamelLocalSummaryClass;
-
-/* extra summary flags */
-enum {
- CAMEL_MESSAGE_FOLDER_NOXEV = 1<<17,
- CAMEL_MESSAGE_FOLDER_XEVCHANGE = 1<<18,
-};
-
-struct _CamelLocalSummary {
- CamelFolderSummary parent;
-
- struct _CamelLocalSummaryPrivate *priv;
-
- char *folder_path; /* name of matching folder */
-
- ibex *index;
- int index_force; /* do we force index during creation? */
-};
-
-struct _CamelLocalSummaryClass {
- CamelFolderSummaryClass parent_class;
-
- int (*load)(CamelLocalSummary *cls, int forceindex, CamelException *ex);
- int (*check)(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
- int (*sync)(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
- CamelMessageInfo *(*add)(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
-
- char *(*encode_x_evolution)(CamelLocalSummary *cls, const CamelMessageInfo *info);
- int (*decode_x_evolution)(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *info);
-};
-
-guint camel_local_summary_get_type (void);
-void camel_local_summary_construct (CamelLocalSummary *new, const char *filename, const char *local_name, ibex *index);
-
-/* load/check the summary */
-int camel_local_summary_load(CamelLocalSummary *cls, int forceindex, CamelException *ex);
-/* check for new/removed messages */
-int camel_local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *, CamelException *ex);
-/* perform a folder sync or expunge, if needed */
-int camel_local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *, CamelException *ex);
-/* add a new message to the summary */
-CamelMessageInfo *camel_local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
-
-/* generate an X-Evolution header line */
-char *camel_local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *info);
-int camel_local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *info);
-
-/* utility functions - write headers to a file with optional X-Evolution header */
-int camel_local_summary_write_headers(int fd, struct _header_raw *header, char *xevline);
-
-#endif /* ! _CAMEL_LOCAL_SUMMARY_H */
-
diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c
deleted file mode 100644
index c4d347d083..0000000000
--- a/camel/providers/local/camel-maildir-folder.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*-
- *
- * Authors: 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-maildir-folder.h"
-#include "camel-maildir-store.h"
-#include "string-utils.h"
-#include "camel-stream-fs.h"
-#include "camel-maildir-summary.h"
-#include "camel-data-wrapper.h"
-#include "camel-mime-message.h"
-#include "camel-exception.h"
-
-#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
-
-static CamelLocalFolderClass *parent_class = NULL;
-
-/* Returns the class for a CamelMaildirFolder */
-#define CMAILDIRF_CLASS(so) CAMEL_MAILDIR_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CMAILDIRS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static CamelLocalSummary *maildir_create_summary(const char *path, const char *folder, ibex *index);
-
-static void maildir_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, CamelException * ex);
-static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex);
-
-static void maildir_finalize(CamelObject * object);
-
-static void camel_maildir_folder_class_init(CamelObjectClass * camel_maildir_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS(camel_maildir_folder_class);
- CamelLocalFolderClass *lclass = (CamelLocalFolderClass *)camel_maildir_folder_class;
-
- parent_class = CAMEL_LOCAL_FOLDER_CLASS (camel_type_get_global_classfuncs(camel_local_folder_get_type()));
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_folder_class->append_message = maildir_append_message;
- camel_folder_class->get_message = maildir_get_message;
-
- lclass->create_summary = maildir_create_summary;
-}
-
-static void maildir_init(gpointer object, gpointer klass)
-{
- /*CamelFolder *folder = object;
- CamelMaildirFolder *maildir_folder = object;*/
-}
-
-static void maildir_finalize(CamelObject * object)
-{
- /*CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER(object);*/
-}
-
-CamelType camel_maildir_folder_get_type(void)
-{
- static CamelType camel_maildir_folder_type = CAMEL_INVALID_TYPE;
-
- if (camel_maildir_folder_type == CAMEL_INVALID_TYPE) {
- camel_maildir_folder_type = camel_type_register(CAMEL_LOCAL_FOLDER_TYPE, "CamelMaildirFolder",
- sizeof(CamelMaildirFolder),
- sizeof(CamelMaildirFolderClass),
- (CamelObjectClassInitFunc) camel_maildir_folder_class_init,
- NULL,
- (CamelObjectInitFunc) maildir_init,
- (CamelObjectFinalizeFunc) maildir_finalize);
- }
-
- return camel_maildir_folder_type;
-}
-
-CamelFolder *
-camel_maildir_folder_new(CamelStore *parent_store, const char *full_name, guint32 flags, CamelException *ex)
-{
- CamelFolder *folder;
-
- d(printf("Creating maildir folder: %s\n", full_name));
-
- folder = (CamelFolder *)camel_object_new(CAMEL_MAILDIR_FOLDER_TYPE);
- folder = (CamelFolder *)camel_local_folder_construct((CamelLocalFolder *)folder,
- parent_store, full_name, flags, ex);
-
- return folder;
-}
-
-static CamelLocalSummary *maildir_create_summary(const char *path, const char *folder, ibex *index)
-{
- return (CamelLocalSummary *)camel_maildir_summary_new(path, folder, index);
-}
-
-static void maildir_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, CamelException * ex)
-{
- CamelMaildirFolder *maildir_folder = (CamelMaildirFolder *)folder;
- CamelLocalFolder *lf = (CamelLocalFolder *)folder;
- CamelStream *output_stream;
- CamelMessageInfo *mi;
- CamelMaildirMessageInfo *mdi;
- char *name, *dest;
-
- d(printf("Appending message\n"));
-
- /* add it to the summary/assign the uid, etc */
- mi = camel_local_summary_add((CamelLocalSummary *)folder->summary, message, info, lf->changes, ex);
- if (camel_exception_is_set(ex)) {
- return;
- }
-
- mdi = (CamelMaildirMessageInfo *)mi;
-
- d(printf("Appending message: uid is %s filename is %s\n", camel_message_info_uid(mi), mdi->filename));
-
- /* write it out to tmp, use the uid we got from the summary */
- name = g_strdup_printf("%s/tmp/%s", lf->folder_path, camel_message_info_uid(mi));
- output_stream = camel_stream_fs_new_with_name(name, O_WRONLY|O_CREAT, 0600);
- if (output_stream == NULL) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot append message to maildir folder: %s: %s"), name, g_strerror(errno));
- g_free(name);
- return;
- }
-
- if (camel_data_wrapper_write_to_stream((CamelDataWrapper *)message, output_stream) == -1
- || camel_stream_close(output_stream) == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot append message to maildir folder: %s: %s"), name, g_strerror(errno));
- camel_object_unref((CamelObject *)output_stream);
- unlink(name);
- g_free(name);
- return;
- }
-
- /* now move from tmp to cur (bypass new, does it matter?) */
- dest = g_strdup_printf("%s/cur/%s", lf->folder_path, camel_maildir_info_filename(mdi));
- if (rename(name, dest) == 1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot append message to maildir folder: %s: %s"), name, g_strerror(errno));
- camel_object_unref((CamelObject *)output_stream);
- unlink(name);
- g_free(name);
- g_free(dest);
- return;
- }
-
- g_free(dest);
- g_free(name);
-
- camel_object_trigger_event((CamelObject *)folder, "folder_changed", ((CamelLocalFolder *)maildir_folder)->changes);
- camel_folder_change_info_clear(((CamelLocalFolder *)maildir_folder)->changes);
-}
-
-static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex)
-{
- CamelLocalFolder *lf = (CamelLocalFolder *)folder;
- CamelStream *message_stream = NULL;
- CamelMimeMessage *message = NULL;
- CamelMessageInfo *info;
- char *name;
- CamelMaildirMessageInfo *mdi;
-
- d(printf("getting message: %s\n", uid));
-
- /* get the message summary info */
- if ((info = camel_folder_summary_uid(folder->summary, uid)) == NULL) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("Cannot get message: %s\n %s"), uid, _("No such message"));
- return NULL;
- }
-
- mdi = (CamelMaildirMessageInfo *)info;
-
- /* what do we do if the message flags (and :info data) changes? filename mismatch - need to recheck I guess */
- name = g_strdup_printf("%s/cur/%s", lf->folder_path, camel_maildir_info_filename(mdi));
-
- camel_folder_summary_info_free(folder->summary, info);
-
- if ((message_stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0)) == NULL) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("Cannot get message: %s\n %s"),
- name, g_strerror(errno));
- g_free(name);
- return NULL;
- }
-
- message = camel_mime_message_new();
- if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, message_stream) == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("Cannot get message: %s\n %s"),
- name, _("Invalid message contents"));
- g_free(name);
- camel_object_unref((CamelObject *)message_stream);
- camel_object_unref((CamelObject *)message);
- return NULL;
-
- }
- camel_object_unref((CamelObject *)message_stream);
- g_free(name);
-
- return message;
-}
diff --git a/camel/providers/local/camel-maildir-folder.h b/camel/providers/local/camel-maildir-folder.h
deleted file mode 100644
index 5076e2f73c..0000000000
--- a/camel/providers/local/camel-maildir-folder.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Authors:
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright (C) 1999 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
- */
-
-#ifndef CAMEL_MAILDIR_FOLDER_H
-#define CAMEL_MAILDIR_FOLDER_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus } */
-#include "camel-local-folder.h"
-
-#define CAMEL_MAILDIR_FOLDER_TYPE (camel_maildir_folder_get_type ())
-#define CAMEL_MAILDIR_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_MAILDIR_FOLDER_TYPE, CamelMaildirFolder))
-#define CAMEL_MAILDIR_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MAILDIR_FOLDER_TYPE, CamelMaildirFolderClass))
-#define CAMEL_IS_MAILDIR_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_MAILDIR_FOLDER_TYPE))
-
-typedef struct {
- CamelLocalFolder parent_object;
-
-} CamelMaildirFolder;
-
-typedef struct {
- CamelLocalFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMaildirFolderClass;
-
-/* public methods */
-CamelFolder *camel_maildir_folder_new(CamelStore *parent_store, const char *full_name, guint32 flags, CamelException *ex);
-
-/* Standard Camel function */
-CamelType camel_maildir_folder_get_type(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* CAMEL_MAILDIR_FOLDER_H */
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
deleted file mode 100644
index d419095ea0..0000000000
--- a/camel/providers/local/camel-maildir-store.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * 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 <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <dirent.h>
-
-#include "camel-maildir-store.h"
-#include "camel-maildir-folder.h"
-#include "camel-exception.h"
-#include "camel-url.h"
-
-static CamelLocalStoreClass *parent_class = NULL;
-
-/* Returns the class for a CamelMaildirStore */
-#define CMAILDIRS_CLASS(so) CAMEL_MAILDIR_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CMAILDIRF_CLASS(so) CAMEL_MAILDIR_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static CamelFolder *get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelException * ex);
-static void delete_folder(CamelStore * store, const char *folder_name, CamelException * ex);
-
-static void camel_maildir_store_class_init(CamelObjectClass * camel_maildir_store_class)
-{
- CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS(camel_maildir_store_class);
- /*CamelServiceClass *camel_service_class = CAMEL_SERVICE_CLASS(camel_maildir_store_class);*/
-
- parent_class = (CamelLocalStoreClass *)camel_type_get_global_classfuncs(camel_local_store_get_type());
-
- /* virtual method overload, use defaults for most */
- camel_store_class->get_folder = get_folder;
- camel_store_class->delete_folder = delete_folder;
-}
-
-CamelType camel_maildir_store_get_type(void)
-{
- static CamelType camel_maildir_store_type = CAMEL_INVALID_TYPE;
-
- if (camel_maildir_store_type == CAMEL_INVALID_TYPE) {
- camel_maildir_store_type = camel_type_register(CAMEL_LOCAL_STORE_TYPE, "CamelMaildirStore",
- sizeof(CamelMaildirStore),
- sizeof(CamelMaildirStoreClass),
- (CamelObjectClassInitFunc) camel_maildir_store_class_init,
- NULL,
- NULL,
- NULL);
- }
-
- return camel_maildir_store_type;
-}
-
-static CamelFolder *get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelException * ex)
-{
- char *name, *tmp, *cur, *new;
- struct stat st;
- CamelFolder *folder = NULL;
-
- (void) ((CamelStoreClass *)parent_class)->get_folder(store, folder_name, flags, ex);
- if (camel_exception_is_set(ex))
- return NULL;
-
- name = g_strdup_printf("%s%s", CAMEL_SERVICE(store)->url->path, folder_name);
- tmp = g_strdup_printf("%s/tmp", name);
- cur = g_strdup_printf("%s/cur", name);
- new = g_strdup_printf("%s/new", name);
-
- if (stat(name, &st) == -1) {
- if (errno != ENOENT) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not open folder `%s':\n%s"),
- folder_name, strerror(errno));
- } else if ((flags & CAMEL_STORE_FOLDER_CREATE) == 0) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("Folder `%s' does not exist."), folder_name);
- } else {
- if (mkdir(name, 0700) != 0
- || mkdir(tmp, 0700) != 0
- || mkdir(cur, 0700) != 0
- || mkdir(new, 0700) != 0) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create folder `%s':\n%s"),
- folder_name, strerror(errno));
- rmdir(tmp);
- rmdir(cur);
- rmdir(new);
- rmdir(name);
- } else {
- folder = camel_maildir_folder_new(store, folder_name, flags, ex);
- }
- }
- } else if (!S_ISDIR(st.st_mode)
- || stat(tmp, &st) != 0 || !S_ISDIR(st.st_mode)
- || stat(cur, &st) != 0 || !S_ISDIR(st.st_mode)
- || stat(new, &st) != 0 || !S_ISDIR(st.st_mode)) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("`%s' is not a maildir directory."), name);
- } else {
- folder = camel_maildir_folder_new(store, folder_name, flags, ex);
- }
-
- g_free(name);
- g_free(tmp);
- g_free(cur);
- g_free(new);
-
- return folder;
-}
-
-static void delete_folder(CamelStore * store, const char *folder_name, CamelException * ex)
-{
- char *name, *tmp, *cur, *new;
- struct stat st;
-
- name = g_strdup_printf("%s%s", CAMEL_SERVICE(store)->url->path, folder_name);
-
- tmp = g_strdup_printf("%s/tmp", name);
- cur = g_strdup_printf("%s/cur", name);
- new = g_strdup_printf("%s/new", name);
-
- if (stat(name, &st) == -1 || !S_ISDIR(st.st_mode)
- || stat(tmp, &st) == -1 || !S_ISDIR(st.st_mode)
- || stat(cur, &st) == -1 || !S_ISDIR(st.st_mode)
- || stat(new, &st) == -1 || !S_ISDIR(st.st_mode)) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not delete folder `%s': %s"),
- folder_name, errno?strerror(errno):_("not a maildir directory"));
- } else {
- int err = 0;
-
- /* remove subdirs first - will fail if not empty */
- if (rmdir(cur) == -1 || rmdir(new) == -1) {
- err = errno;
- } else {
- DIR *dir;
- struct dirent *d;
-
- /* for tmp (only), its contents is irrelevant */
- dir = opendir(tmp);
- if (dir) {
- while ( (d=readdir(dir)) ) {
- char *name = d->d_name, *file;
-
- if (!strcmp(name, ".") || !strcmp(name, ".."))
- continue;
- file = g_strdup_printf("%s/%s", tmp, name);
- unlink(file);
- g_free(file);
- }
- closedir(dir);
- }
- if (rmdir(tmp) == -1 || rmdir(name) == -1)
- err = errno;
- }
-
- if (err != 0) {
- /* easier just to mkdir all (and let them fail), than remember what we got to */
- mkdir(name, 0700);
- mkdir(cur, 0700);
- mkdir(new, 0700);
- mkdir(tmp, 0700);
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not delete folder `%s': %s"),
- folder_name, strerror(err));
- } else {
- /* and remove metadata */
- ((CamelStoreClass *)parent_class)->delete_folder(store, folder_name, ex);
- }
- }
-
- g_free(name);
- g_free(tmp);
- g_free(cur);
- g_free(new);
-}
diff --git a/camel/providers/local/camel-maildir-store.h b/camel/providers/local/camel-maildir-store.h
deleted file mode 100644
index 27b6a6e590..0000000000
--- a/camel/providers/local/camel-maildir-store.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * 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_MAILDIR_STORE_H
-#define CAMEL_MAILDIR_STORE_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus } */
-
-#include "camel-local-store.h"
-
-#define CAMEL_MAILDIR_STORE_TYPE (camel_maildir_store_get_type ())
-#define CAMEL_MAILDIR_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_MAILDIR_STORE_TYPE, CamelMaildirStore))
-#define CAMEL_MAILDIR_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MAILDIR_STORE_TYPE, CamelMaildirStoreClass))
-#define CAMEL_IS_MAILDIR_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_MAILDIR_STORE_TYPE))
-
-typedef struct {
- CamelLocalStore parent_object;
-
-} CamelMaildirStore;
-
-typedef struct {
- CamelLocalStoreClass parent_class;
-
-} CamelMaildirStoreClass;
-
-/* public methods */
-
-/* Standard Camel function */
-CamelType camel_maildir_store_get_type(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* CAMEL_MAILDIR_STORE_H */
diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c
deleted file mode 100644
index a65adafc0f..0000000000
--- a/camel/providers/local/camel-maildir-summary.c
+++ /dev/null
@@ -1,751 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * 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-maildir-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>
-
-#include <sys/types.h>
-#include <dirent.h>
-
-#include <ctype.h>
-
-#include "camel-private.h"
-#include "e-util/e-memory.h"
-
-#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
-
-#define CAMEL_MAILDIR_SUMMARY_VERSION (0x2000)
-
-static CamelMessageInfo *message_info_load(CamelFolderSummary *s, FILE *in);
-static CamelMessageInfo *message_info_new(CamelFolderSummary *, struct _header_raw *);
-static void message_info_free(CamelFolderSummary *, CamelMessageInfo *mi);
-
-static int maildir_summary_load(CamelLocalSummary *cls, int forceindex, CamelException *ex);
-static int maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static int maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static CamelMessageInfo *maildir_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
-
-static char *maildir_summary_next_uid_string(CamelFolderSummary *s);
-static int maildir_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *mi);
-static char *maildir_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *mi);
-
-static void camel_maildir_summary_class_init (CamelMaildirSummaryClass *class);
-static void camel_maildir_summary_init (CamelMaildirSummary *gspaper);
-static void camel_maildir_summary_finalise (CamelObject *obj);
-
-#define _PRIVATE(x) (((CamelMaildirSummary *)(x))->priv)
-
-struct _CamelMaildirSummaryPrivate {
- char *current_file;
- char *hostname;
-
- GHashTable *load_map;
-};
-
-static CamelLocalSummaryClass *parent_class;
-
-CamelType
-camel_maildir_summary_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register(camel_local_summary_get_type (), "CamelMaildirSummary",
- sizeof(CamelMaildirSummary),
- sizeof(CamelMaildirSummaryClass),
- (CamelObjectClassInitFunc)camel_maildir_summary_class_init,
- NULL,
- (CamelObjectInitFunc)camel_maildir_summary_init,
- (CamelObjectFinalizeFunc)camel_maildir_summary_finalise);
- }
-
- return type;
-}
-
-static void
-camel_maildir_summary_class_init (CamelMaildirSummaryClass *class)
-{
- CamelFolderSummaryClass *sklass = (CamelFolderSummaryClass *) class;
- CamelLocalSummaryClass *lklass = (CamelLocalSummaryClass *)class;
-
- parent_class = (CamelLocalSummaryClass *)camel_type_get_global_classfuncs(camel_local_summary_get_type ());
-
- /* override methods */
- sklass->message_info_load = message_info_load;
- sklass->message_info_new = message_info_new;
- sklass->message_info_free = message_info_free;
- sklass->next_uid_string = maildir_summary_next_uid_string;
-
- lklass->load = maildir_summary_load;
- lklass->check = maildir_summary_check;
- lklass->sync = maildir_summary_sync;
- lklass->add = maildir_summary_add;
- lklass->encode_x_evolution = maildir_summary_encode_x_evolution;
- lklass->decode_x_evolution = maildir_summary_decode_x_evolution;
-}
-
-static void
-camel_maildir_summary_init (CamelMaildirSummary *o)
-{
- struct _CamelFolderSummary *s = (CamelFolderSummary *) o;
- char hostname[256];
-
- o->priv = g_malloc0(sizeof(*o->priv));
- /* set unique file version */
- s->version += CAMEL_MAILDIR_SUMMARY_VERSION;
-
- s->message_info_size = sizeof(CamelMaildirMessageInfo);
- s->content_info_size = sizeof(CamelMaildirMessageContentInfo);
-
-#ifdef DOESTRV
- s->message_info_strings = CAMEL_MAILDIR_INFO_LAST;
-#endif
-
- if (gethostname(hostname, 256) == 0) {
- o->priv->hostname = g_strdup(hostname);
- } else {
- o->priv->hostname = g_strdup("localhost");
- }
-}
-
-static void
-camel_maildir_summary_finalise(CamelObject *obj)
-{
- CamelMaildirSummary *o = (CamelMaildirSummary *)obj;
-
- g_free(o->priv->hostname);
- g_free(o->priv);
-}
-
-/**
- * camel_maildir_summary_new:
- *
- * Create a new CamelMaildirSummary object.
- *
- * Return value: A new #CamelMaildirSummary object.
- **/
-CamelMaildirSummary *camel_maildir_summary_new (const char *filename, const char *maildirdir, ibex *index)
-{
- CamelMaildirSummary *o = (CamelMaildirSummary *)camel_object_new(camel_maildir_summary_get_type ());
-
- camel_local_summary_construct((CamelLocalSummary *)o, filename, maildirdir, index);
- return o;
-}
-
-/* the 'standard' maildir flags. should be defined in sorted order. */
-static struct {
- char flag;
- guint32 flagbit;
-} flagbits[] = {
- { 'F', CAMEL_MESSAGE_FLAGGED },
- { 'R', CAMEL_MESSAGE_ANSWERED },
- { 'S', CAMEL_MESSAGE_SEEN },
- { 'T', CAMEL_MESSAGE_DELETED },
-};
-
-/* convert the uid + flags into a unique:info maildir format */
-char *camel_maildir_summary_info_to_name(const CamelMessageInfo *info)
-{
- char *p, *buf;
- int i;
- const char *uid;
-
- uid = camel_message_info_uid(info);
- buf = alloca(strlen(uid) + strlen(":2,") + (sizeof(flagbits)/sizeof(flagbits[0])) + 1);
- p = buf + sprintf(buf, "%s:2,", uid);
- for (i=0;i<sizeof(flagbits)/sizeof(flagbits[0]);i++) {
- if (info->flags & flagbits[i].flagbit)
- *p++ = flagbits[i].flag;
- }
- *p = 0;
-
- return g_strdup(buf);
-}
-
-/* returns 0 if the info matches (or there was none), otherwise we changed it */
-int camel_maildir_summary_name_to_info(CamelMessageInfo *info, const char *name)
-{
- char *p, c;
- guint32 set = 0; /* what we set */
- /*guint32 all = 0;*/ /* all flags */
- int i;
-
- p = strstr(name, ":2,");
- if (p) {
- p+=3;
- while ((c = *p++)) {
- /* we could assume that the flags are in order, but its just as easy not to require */
- for (i=0;i<sizeof(flagbits)/sizeof(flagbits[0]);i++) {
- if (flagbits[i].flag == c && (info->flags & flagbits[i].flagbit) == 0) {
- set |= flagbits[i].flagbit;
- }
- /*all |= flagbits[i].flagbit;*/
- }
- }
-
- /* changed? */
- /*if ((info->flags & all) != set) {*/
- if ((info->flags & set) != set) {
- /* ok, they did change, only add the new flags ('merge flags'?) */
- /*info->flags &= all; if we wanted to set only the new flags, which we probably dont */
- info->flags |= set;
- return 1;
- }
- }
-
- return 0;
-}
-
-/* for maildir, x-evolution isn't used, so dont try and get anything out of it */
-static int maildir_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *mi)
-{
- return -1;
-}
-
-static char *maildir_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *mi)
-{
- return NULL;
-}
-
-/* FIXME:
- both 'new' and 'add' will try and set the filename, this is not ideal ...
-*/
-static CamelMessageInfo *maildir_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *changes, CamelException *ex)
-{
- CamelMessageInfo *mi;
-
- mi = ((CamelLocalSummaryClass *) parent_class)->add(cls, msg, info, changes, ex);
- if (mi) {
- if (info) {
- camel_maildir_info_set_filename(mi, camel_maildir_summary_info_to_name(mi));
- d(printf("Setting filename to %s\n", camel_maildir_info_filename(mi)));
- }
- }
-
- return mi;
-}
-
-static CamelMessageInfo *message_info_new(CamelFolderSummary * s, struct _header_raw *h)
-{
- CamelMessageInfo *mi;
- CamelMaildirSummary *mds = (CamelMaildirSummary *)s;
- CamelMaildirMessageInfo *mdi;
- const char *uid;
-
- mi = ((CamelFolderSummaryClass *) parent_class)->message_info_new(s, h);
- /* assign the uid and new filename */
- if (mi) {
- mdi = (CamelMaildirMessageInfo *)mi;
-
- uid = camel_message_info_uid(mi);
- if (uid==NULL || uid[0] == 0)
- camel_message_info_set_uid(mi, camel_folder_summary_next_uid_string(s));
-
- /* with maildir we know the real received date, from the filename */
- mi->date_received = strtoul(camel_message_info_uid(mi), NULL, 10);
-
- if (mds->priv->current_file) {
-#if 0
- char *p1, *p2, *p3;
- unsigned long uid;
-#endif
- /* if setting from a file, grab the flags from it */
- camel_maildir_info_set_filename(mi, g_strdup(mds->priv->current_file));
- camel_maildir_summary_name_to_info(mi, mds->priv->current_file);
-
-#if 0
- /* Actually, I dont think all this effort is worth it at all ... */
-
- /* also, see if we can extract the next-id from tne name, and safe-if-fy ourselves against collisions */
- /* we check for something.something_number.something */
- p1 = strchr(mdi->filename, '.');
- if (p1) {
- p2 = strchr(p1+1, '.');
- p3 = strchr(p1+1, '_');
- if (p2 && p3 && p3<p2) {
- uid = strtoul(p3+1, &p1, 10);
- if (p1 == p2 && uid>0)
- camel_folder_summary_set_uid(s, uid);
- }
- }
-#endif
- } else {
- /* if creating a file, set its name from the flags we have */
- camel_maildir_info_set_filename(mdi, camel_maildir_summary_info_to_name(mi));
- d(printf("Setting filename to %s\n", camel_maildir_info_filename(mi)));
- }
- }
-
- return mi;
-}
-
-
-static void message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
-{
-#ifndef DOESTRV
- CamelMaildirMessageInfo *mdi = (CamelMaildirMessageInfo *)mi;
-
- g_free(mdi->filename);
-#endif
- ((CamelFolderSummaryClass *) parent_class)->message_info_free(s, mi);
-}
-
-
-static char *maildir_summary_next_uid_string(CamelFolderSummary *s)
-{
- CamelMaildirSummary *mds = (CamelMaildirSummary *)s;
-
- d(printf("next uid string called?\n"));
-
- /* if we have a current file, then use that to get the uid */
- if (mds->priv->current_file) {
- char *cln;
-
- cln = strchr(mds->priv->current_file, ':');
- if (cln)
- return g_strndup(mds->priv->current_file, cln-mds->priv->current_file);
- else
- return g_strdup(mds->priv->current_file);
- } else {
- /* the first would probably work, but just to be safe, check for collisions */
-#if 0
- return g_strdup_printf("%ld.%d_%u.%s", time(0), getpid(), camel_folder_summary_next_uid(s), mds->priv->hostname);
-#else
- CamelLocalSummary *cls = (CamelLocalSummary *)s;
- char *name = NULL, *uid = NULL;
- struct stat st;
- int retry = 0;
- guint32 nextuid = camel_folder_summary_next_uid(s);
-
- /* we use time.pid_count.hostname */
- do {
- if (retry > 0) {
- g_free(name);
- g_free(uid);
- sleep(2);
- }
- uid = g_strdup_printf("%ld.%d_%u.%s", time(0), getpid(), nextuid, mds->priv->hostname);
- name = g_strdup_printf("%s/tmp/%s", cls->folder_path, uid);
- retry++;
- } while (stat(name, &st) == 0 && retry<3);
-
- /* I dont know what we're supposed to do if it fails to find a unique name?? */
-
- g_free(name);
- return uid;
-#endif
- }
-}
-
-static CamelMessageInfo *
-message_info_load(CamelFolderSummary *s, FILE *in)
-{
- CamelMessageInfo *mi;
- CamelMaildirSummary *mds = (CamelMaildirSummary *)s;
-
- mi = ((CamelFolderSummaryClass *) parent_class)->message_info_load(s, in);
- if (mi) {
- char *name;
-
- if (mds->priv->load_map
- && (name = g_hash_table_lookup(mds->priv->load_map, camel_message_info_uid(mi)))) {
- d(printf("Setting filename of %s to %s\n", camel_message_info_uid(mi), name));
- camel_maildir_info_set_filename(mi, g_strdup(name));
- camel_maildir_summary_name_to_info(mi, name);
- }
- }
-
- return mi;
-}
-
-static int maildir_summary_load(CamelLocalSummary *cls, int forceindex, CamelException *ex)
-{
- char *cur;
- DIR *dir;
- struct dirent *d;
- CamelMaildirSummary *mds = (CamelMaildirSummary *)cls;
- char *uid;
- EMemPool *pool;
- int ret;
-
- cur = g_strdup_printf("%s/cur", cls->folder_path);
-
- d(printf("pre-loading uid <> filename map\n"));
-
- dir = opendir(cur);
- if (dir == NULL) {
- camel_exception_setv(ex, 1, "Cannot open maildir directory path: %s: %s", cls->folder_path, strerror(errno));
- g_free(cur);
- return -1;
- }
-
- mds->priv->load_map = g_hash_table_new(g_str_hash, g_str_equal);
- pool = e_mempool_new(1024, 512, E_MEMPOOL_ALIGN_BYTE);
-
- while ( (d = readdir(dir)) ) {
- if (d->d_name[0] == '.')
- continue;
-
- /* map the filename -> uid */
- uid = strchr(d->d_name, ':');
- if (uid) {
- int len = uid-d->d_name;
- uid = e_mempool_alloc(pool, len+1);
- memcpy(uid, d->d_name, len);
- uid[len] = 0;
- g_hash_table_insert(mds->priv->load_map, uid, e_mempool_strdup(pool, d->d_name));
- } else {
- uid = e_mempool_strdup(pool, d->d_name);
- g_hash_table_insert(mds->priv->load_map, uid, uid);
- }
- }
- closedir(dir);
- g_free(cur);
-
- ret = ((CamelLocalSummaryClass *) parent_class)->load(cls, forceindex, ex);
-
- g_hash_table_destroy(mds->priv->load_map);
- mds->priv->load_map = NULL;
- e_mempool_destroy(pool);
-
- return ret;
-}
-
-static int camel_maildir_summary_add(CamelLocalSummary *cls, const char *name, int forceindex)
-{
- CamelMaildirSummary *maildirs = (CamelMaildirSummary *)cls;
- char *filename = g_strdup_printf("%s/cur/%s", cls->folder_path, name);
- int fd;
- CamelMimeParser *mp;
-
- d(printf("summarising: %s\n", name));
-
- fd = open(filename, O_RDONLY);
- if (fd == -1) {
- g_warning("Cannot summarise/index: %s: %s", filename, strerror(errno));
- g_free(filename);
- return -1;
- }
- mp = camel_mime_parser_new();
- camel_mime_parser_scan_from(mp, FALSE);
- camel_mime_parser_init_with_fd(mp, fd);
- if (cls->index && (forceindex || !ibex_contains_name(cls->index, (char *)name))) {
- d(printf("forcing indexing of message content\n"));
- camel_folder_summary_set_index((CamelFolderSummary *)maildirs, cls->index);
- } else {
- camel_folder_summary_set_index((CamelFolderSummary *)maildirs, NULL);
- }
- maildirs->priv->current_file = (char *)name;
- camel_folder_summary_add_from_parser((CamelFolderSummary *)maildirs, mp);
- camel_object_unref((CamelObject *)mp);
- maildirs->priv->current_file = NULL;
- camel_folder_summary_set_index((CamelFolderSummary *)maildirs, NULL);
- g_free(filename);
- return 0;
-}
-
-static void
-remove_summary(char *key, CamelMessageInfo *info, CamelLocalSummary *cls)
-{
- d(printf("removing message %s from summary\n", key));
- if (cls->index)
- ibex_unindex(cls->index, (char *)camel_message_info_uid(info));
- camel_folder_summary_remove((CamelFolderSummary *)cls, info);
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
-}
-
-static int
-sort_receive_cmp(const void *ap, const void *bp)
-{
- const CamelMessageInfo
- *a = *((CamelMessageInfo **)ap),
- *b = *((CamelMessageInfo **)bp);
-
- if (a->date_received < b->date_received)
- return -1;
- else if (a->date_received > b->date_received)
- return 1;
-
- return 0;
-}
-
-static int
-maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, CamelException *ex)
-{
- DIR *dir;
- struct dirent *d;
- char *p;
- CamelMessageInfo *info;
- CamelMaildirMessageInfo *mdi;
- CamelFolderSummary *s = (CamelFolderSummary *)cls;
- GHashTable *left;
- int i, count;
- int forceindex;
- char *new, *cur;
- char *uid;
-
- new = g_strdup_printf("%s/new", cls->folder_path);
- cur = g_strdup_printf("%s/cur", cls->folder_path);
-
- /* FIXME: Handle changeinfo */
-
- d(printf("checking summary ...\n"));
-
- /* scan the directory, check for mail files not in the index, or index entries that
- no longer exist */
- dir = opendir(cur);
- if (dir == NULL) {
- camel_exception_setv(ex, 1, "Cannot open maildir directory path: %s: %s", cls->folder_path, strerror(errno));
- g_free(cur);
- g_free(new);
- return -1;
- }
-
- /* keeps track of all uid's that have not been processed */
- left = g_hash_table_new(g_str_hash, g_str_equal);
- count = camel_folder_summary_count((CamelFolderSummary *)cls);
- forceindex = count == 0;
- for (i=0;i<count;i++) {
- info = camel_folder_summary_index((CamelFolderSummary *)cls, i);
- if (info) {
- g_hash_table_insert(left, (char *)camel_message_info_uid(info), info);
- }
- }
-
- while ( (d = readdir(dir)) ) {
- /* FIXME: also run stat to check for regular file */
- p = d->d_name;
- if (p[0] == '.')
- continue;
-
- /* map the filename -> uid */
- uid = strchr(d->d_name, ':');
- if (uid)
- uid = g_strndup(d->d_name, uid-d->d_name);
- else
- uid = g_strdup(d->d_name);
-
- info = camel_folder_summary_uid((CamelFolderSummary *)cls, uid);
- if (info == NULL || (cls->index && (!ibex_contains_name(cls->index, uid)))) {
- /* need to add this file to the summary */
- if (info != NULL) {
- CamelMessageInfo *old = g_hash_table_lookup(left, camel_message_info_uid(info));
- if (old) {
- g_hash_table_remove(left, uid);
- camel_folder_summary_info_free((CamelFolderSummary *)cls, old);
- }
- camel_folder_summary_remove((CamelFolderSummary *)cls, info);
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
- }
- camel_maildir_summary_add(cls, d->d_name, forceindex);
- } else {
- const char *filename;
- CamelMessageInfo *old;
-
- old = g_hash_table_lookup(left, camel_message_info_uid(info));
- if (old) {
- camel_folder_summary_info_free((CamelFolderSummary *)cls, old);
- g_hash_table_remove(left, camel_message_info_uid(info));
- }
-
- mdi = (CamelMaildirMessageInfo *)info;
- filename = camel_maildir_info_filename(mdi);
- /* TODO: only store the extension in the mdi->filename struct, not the whole lot */
- if (filename == NULL || strcmp(filename, d->d_name) != 0) {
-#ifdef DOESTRV
-#warning "cannot modify the estrv after its been setup, for mt-safe code"
- d(printf("filename changed: %s to %s\n", filename, d->d_name));
-
- /* need to update the summary hash string reference since it might (will) change */
- CAMEL_SUMMARY_LOCK(s, summary_lock);
- g_hash_table_remove(s->messages_uid, uid);
- info->strings = e_strv_set_ref(info->strings, CAMEL_MAILDIR_INFO_FILENAME, d->d_name);
- /* we need to re-pack as well */
- info->strings = e_strv_pack(info->strings);
- g_hash_table_insert(s->messages_uid, (char *)camel_message_info_uid(info), info);
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-#else
- g_free(mdi->filename);
- mdi->filename = g_strdup(d->d_name);
-#endif
- }
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
- }
- g_free(uid);
- }
- closedir(dir);
- g_hash_table_foreach(left, (GHFunc)remove_summary, cls);
- g_hash_table_destroy(left);
-
- /* now, scan new for new messages, and copy them to cur, and so forth */
- dir = opendir(new);
- if (dir != NULL) {
- while ( (d = readdir(dir)) ) {
- char *name, *newname, *destname, *destfilename;
- char *src, *dest;
-
- name = d->d_name;
- if (name[0] == '.')
- continue;
-
- /* already in summary? shouldn't happen, but just incase ... */
- if ((info = camel_folder_summary_uid((CamelFolderSummary *)cls, name))) {
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
- newname = destname = camel_folder_summary_next_uid_string(s);
- } else {
- newname = NULL;
- destname = name;
- }
-
- /* copy this to the destination folder, use 'standard' semantics for maildir info field */
- src = g_strdup_printf("%s/%s", new, name);
- destfilename = g_strdup_printf("%s:2,", destname);
- dest = g_strdup_printf("%s/%s", cur, destfilename);
-
- /* FIXME: This should probably use link/unlink */
-
- if (rename(src, dest) == 0) {
- camel_maildir_summary_add(cls, destfilename, forceindex);
- if (changes)
- camel_folder_change_info_add_uid(changes, destname);
- } else {
- /* else? we should probably care about failures, but wont */
- g_warning("Failed to move new maildir message %s to cur %s", src, dest);
- }
-
- /* c strings are painful to work with ... */
- g_free(destfilename);
- g_free(newname);
- g_free(src);
- g_free(dest);
- }
- }
- closedir(dir);
-
- g_free(new);
- g_free(cur);
-
- /* sort the summary based on receive time, since the directory order is not useful */
- CAMEL_SUMMARY_LOCK(s, summary_lock);
- qsort(s->messages->pdata, s->messages->len, sizeof(CamelMessageInfo *), sort_receive_cmp);
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-
- /* FIXME: move this up a class? */
-
- /* force a save of the index, just to make sure */
- /* note this could be expensive so possibly shouldn't be here
- as such */
- if (cls->index) {
- ibex_save(cls->index);
- }
-
- return 0;
-}
-
-/* sync the summary with the ondisk files. */
-static int
-maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changes, CamelException *ex)
-{
- int count, i;
- CamelMessageInfo *info;
- CamelMaildirMessageInfo *mdi;
-#ifdef DOESTRV
- CamelFolderSummary *s = (CamelFolderSummary *)cls;
-#endif
- char *name;
- struct stat st;
-
- d(printf("summary_sync(expunge=%s)\n", expunge?"true":"false"));
-
- if (cls->index) {
- ibex_save(cls->index);
- }
-
- count = camel_folder_summary_count((CamelFolderSummary *)cls);
- for (i=count-1;i>=0;i--) {
- info = camel_folder_summary_index((CamelFolderSummary *)cls, i);
- mdi = (CamelMaildirMessageInfo *)info;
- if (info && (info->flags & CAMEL_MESSAGE_DELETED) && expunge) {
- name = g_strdup_printf("%s/cur/%s", cls->folder_path, camel_maildir_info_filename(mdi));
- d(printf("deleting %s\n", name));
- if (unlink(name) == 0 || errno==ENOENT) {
-
- /* FIXME: put this in folder_summary::remove()? */
- if (cls->index)
- ibex_unindex(cls->index, (char *)camel_message_info_uid(info));
-
- camel_folder_change_info_remove_uid(changes, camel_message_info_uid(info));
- camel_folder_summary_remove((CamelFolderSummary *)cls, info);
- }
- g_free(name);
- } else if (info && (info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED)) {
- char *newname = camel_maildir_summary_info_to_name(info);
- char *dest;
-
- /* do we care about additional metainfo stored inside the message? */
- /* probably should all go in the filename? */
-
- /* have our flags/ i.e. name changed? */
- if (strcmp(newname, camel_maildir_info_filename(mdi))) {
- name = g_strdup_printf("%s/cur/%s", cls->folder_path, camel_maildir_info_filename(mdi));
- dest = g_strdup_printf("%s/cur/%s", cls->folder_path, newname);
- rename(name, dest);
- if (stat(dest, &st) == -1) {
- /* we'll assume it didn't work, but dont change anything else */
- g_free(newname);
- } else {
- /* TODO: If this is made mt-safe, then this code could be a problem, since
- the estrv is being modified.
- Sigh, this may mean the maildir name has to be cached another way */
-#ifdef DOESTRV
-#warning "cannot modify the estrv after its been setup, for mt-safe code"
- CAMEL_SUMMARY_LOCK(s, summary_lock);
- /* need to update the summary hash ref */
- g_hash_table_remove(s->messages_uid, camel_message_info_uid(info));
- info->strings = e_strv_set_ref_free(info->strings, CAMEL_MAILDIR_INFO_FILENAME, newname);
- info->strings = e_strv_pack(info->strings);
- g_hash_table_insert(s->messages_uid, (char *)camel_message_info_uid(info), info);
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
-#else
- g_free(mdi->filename);
- mdi->filename = newname;
-#endif
- }
- g_free(name);
- g_free(dest);
- } else {
- g_free(newname);
- }
-
- /* strip FOLDER_MESSAGE_FLAGED, etc */
- info->flags &= 0xffff;
- }
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
- }
- return 0;
-}
-
diff --git a/camel/providers/local/camel-maildir-summary.h b/camel/providers/local/camel-maildir-summary.h
deleted file mode 100644
index 456492b5e5..0000000000
--- a/camel/providers/local/camel-maildir-summary.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * 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_MAILDIR_SUMMARY_H
-#define _CAMEL_MAILDIR_SUMMARY_H
-
-#include "camel-local-summary.h"
-#include <camel/camel-folder.h>
-#include <camel/camel-exception.h>
-#include <libibex/ibex.h>
-
-#define CAMEL_MAILDIR_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_maildir_summary_get_type (), CamelMaildirSummary)
-#define CAMEL_MAILDIR_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_maildir_summary_get_type (), CamelMaildirSummaryClass)
-#define CAMEL_IS_MAILDIR_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_maildir_summary_get_type ())
-
-typedef struct _CamelMaildirSummary CamelMaildirSummary;
-typedef struct _CamelMaildirSummaryClass CamelMaildirSummaryClass;
-
-typedef struct _CamelMaildirMessageContentInfo {
- CamelMessageContentInfo info;
-} CamelMaildirMessageContentInfo;
-
-#ifdef DOESTRV
-enum {
- CAMEL_MAILDIR_INFO_FILENAME = CAMEL_MESSAGE_INFO_LAST,
- CAMEL_MAILDIR_INFO_LAST,
-};
-#endif
-
-typedef struct _CamelMaildirMessageInfo {
- CamelMessageInfo info;
-
-#ifndef DOESTRV
- char *filename; /* maildir has this annoying status shit on the end of the filename, use this to get the real message id */
-#endif
-} CamelMaildirMessageInfo;
-
-struct _CamelMaildirSummary {
- CamelLocalSummary parent;
- struct _CamelMaildirSummaryPrivate *priv;
-};
-
-struct _CamelMaildirSummaryClass {
- CamelLocalSummaryClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-CamelType camel_maildir_summary_get_type (void);
-CamelMaildirSummary *camel_maildir_summary_new (const char *filename, const char *maildirdir, ibex *index);
-
-/* convert some info->flags to/from the messageinfo */
-char *camel_maildir_summary_info_to_name(const CamelMessageInfo *info);
-int camel_maildir_summary_name_to_info(CamelMessageInfo *info, const char *name);
-
-#ifdef DOESTRV
-#define camel_maildir_info_filename(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MAILDIR_INFO_FILENAME)
-#define camel_maildir_info_set_filename(x, s) camel_message_info_set_string((CamelMessageInfo *)(x), CAMEL_MAILDIR_INFO_FILENAME, s)
-#else
-#define camel_maildir_info_filename(x) (((CamelMaildirMessageInfo *)x)->filename)
-#define camel_maildir_info_set_filename(x, s) (g_free(((CamelMaildirMessageInfo *)x)->filename),((CamelMaildirMessageInfo *)x)->filename = s)
-#endif
-
-#endif /* ! _CAMEL_MAILDIR_SUMMARY_H */
-
diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c
deleted file mode 100644
index 14dca0049e..0000000000
--- a/camel/providers/local/camel-mbox-folder.c
+++ /dev/null
@@ -1,434 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*-
- *
- * Authors: 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) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
-
-static CamelLocalFolderClass *parent_class = NULL;
-
-/* Returns the class for a CamelMboxFolder */
-#define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CMBOXS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static int mbox_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex);
-static void mbox_unlock(CamelLocalFolder *lf);
-
-static void mbox_set_message_user_flag(CamelFolder *folder, const char *uid, const char *name, gboolean value);
-static void mbox_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value);
-
-static void mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info, CamelException *ex);
-static CamelMimeMessage *mbox_get_message(CamelFolder *folder, const gchar * uid, CamelException *ex);
-static CamelLocalSummary *mbox_create_summary(const char *path, const char *folder, ibex *index);
-
-static void mbox_finalise(CamelObject * object);
-
-static void
-camel_mbox_folder_class_init(CamelMboxFolderClass * camel_mbox_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS(camel_mbox_folder_class);
- CamelLocalFolderClass *lclass = (CamelLocalFolderClass *)camel_mbox_folder_class;
-
- parent_class = (CamelLocalFolderClass *)camel_type_get_global_classfuncs(camel_local_folder_get_type());
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_folder_class->append_message = mbox_append_message;
- camel_folder_class->get_message = mbox_get_message;
-
- camel_folder_class->set_message_user_flag = mbox_set_message_user_flag;
- camel_folder_class->set_message_user_tag = mbox_set_message_user_tag;
-
- lclass->create_summary = mbox_create_summary;
- lclass->lock = mbox_lock;
- lclass->unlock = mbox_unlock;
-}
-
-static void
-mbox_init(gpointer object, gpointer klass)
-{
- /*CamelFolder *folder = object;*/
- CamelMboxFolder *mbox_folder = object;
-
- mbox_folder->lockfd = -1;
-}
-
-static void
-mbox_finalise(CamelObject * object)
-{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)object;
-
- g_assert(mbox_folder->lockfd == -1);
-}
-
-CamelType camel_mbox_folder_get_type(void)
-{
- static CamelType camel_mbox_folder_type = CAMEL_INVALID_TYPE;
-
- if (camel_mbox_folder_type == CAMEL_INVALID_TYPE) {
- camel_mbox_folder_type = camel_type_register(CAMEL_LOCAL_FOLDER_TYPE, "CamelMboxFolder",
- sizeof(CamelMboxFolder),
- sizeof(CamelMboxFolderClass),
- (CamelObjectClassInitFunc) camel_mbox_folder_class_init,
- NULL,
- (CamelObjectInitFunc) mbox_init,
- (CamelObjectFinalizeFunc) mbox_finalise);
- }
-
- return camel_mbox_folder_type;
-}
-
-CamelFolder *
-camel_mbox_folder_new(CamelStore *parent_store, const char *full_name, guint32 flags, CamelException *ex)
-{
- CamelFolder *folder;
-
- d(printf("Creating mbox folder: %s in %s\n", full_name, camel_local_store_get_toplevel_dir((CamelLocalStore *)parent_store)));
-
- folder = (CamelFolder *)camel_object_new(CAMEL_MBOX_FOLDER_TYPE);
- folder = (CamelFolder *)camel_local_folder_construct((CamelLocalFolder *)folder,
- parent_store, full_name, flags, ex);
-
- return folder;
-}
-
-static CamelLocalSummary *mbox_create_summary(const char *path, const char *folder, ibex *index)
-{
- return (CamelLocalSummary *)camel_mbox_summary_new(path, folder, index);
-}
-
-static int mbox_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex)
-{
- CamelMboxFolder *mf = (CamelMboxFolder *)lf;
-
- /* make sure we have matching unlocks for locks, camel-local-folder class should enforce this */
- g_assert(mf->lockfd == -1);
-
- mf->lockfd = open(lf->folder_path, O_RDWR, 0);
- if (mf->lockfd == -1) {
- camel_exception_setv(ex, 1, "Cannot create folder lock on %s: %s", lf->folder_path, strerror(errno));
- return -1;
- }
-
- return camel_lock_folder(lf->folder_path, mf->lockfd, type, ex);
-}
-
-static void mbox_unlock(CamelLocalFolder *lf)
-{
- CamelMboxFolder *mf = (CamelMboxFolder *)lf;
-
- g_assert(mf->lockfd != -1);
- camel_unlock_folder(lf->folder_path, mf->lockfd);
- close(mf->lockfd);
- mf->lockfd = -1;
-}
-
-static void
-mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info, CamelException *ex)
-{
- CamelLocalFolder *lf = (CamelLocalFolder *)folder;
- CamelStream *output_stream = NULL, *filter_stream = NULL;
- CamelMimeFilter *filter_from = NULL;
- CamelMboxSummary *mbs = (CamelMboxSummary *)folder->summary;
- CamelMessageInfo *mi;
- char *fromline = NULL;
- int fd;
- struct stat st;
-#if 0
- char *xev;
-#endif
- /* If we can't lock, dont do anything */
- if (camel_local_folder_lock(lf, CAMEL_LOCK_WRITE, ex) == -1)
- return;
-
- d(printf("Appending message\n"));
-
- /* first, check the summary is correct (updates folder_size too) */
- camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex);
- if (camel_exception_is_set(ex))
- goto fail;
-
- /* add it to the summary/assign the uid, etc */
- mi = camel_local_summary_add((CamelLocalSummary *)folder->summary, message, info, lf->changes, ex);
- if (camel_exception_is_set(ex))
- goto fail;
-
- d(printf("Appending message: uid is %s\n", camel_message_info_uid(mi)));
-
- output_stream = camel_stream_fs_new_with_name(lf->folder_path, O_WRONLY|O_APPEND, 0600);
- if (output_stream == NULL) {
- camel_exception_setv(ex, 1, _("Cannot open mailbox: %s: %s\n"), lf->folder_path, strerror(errno));
- goto fail;
- }
-
- /* and we need to set the frompos/XEV explicitly */
- ((CamelMboxMessageInfo *)mi)->frompos = mbs->folder_size?mbs->folder_size+1:0;
-#if 0
- xev = camel_local_summary_encode_x_evolution((CamelLocalSummary *)folder->summary, mi);
- if (xev) {
- /* the x-ev header should match the 'current' flags, no problem, so store as much */
- camel_medium_set_header((CamelMedium *)message, "X-Evolution", xev);
- mi->flags &= ~ CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_FLAGGED;
- g_free(xev);
- }
-#endif
-
- /* we must write this to the non-filtered stream ... prepend a \n if not at the start of the file */
- fromline = camel_mbox_summary_build_from(((CamelMimePart *)message)->headers);
- if (camel_stream_printf(output_stream, mbs->folder_size==0?"%s":"\n%s", fromline) == -1)
- goto fail_write;
-
- /* 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((CamelDataWrapper *)message, filter_stream) == -1)
- goto fail_write;
-
- if (camel_stream_close(filter_stream) == -1)
- goto fail_write;
-
- /* unlock as soon as we can */
- camel_local_folder_unlock(lf);
-
- /* filter stream ref's the output stream itself, so we need to unref it too */
- camel_object_unref((CamelObject *)filter_from);
- camel_object_unref((CamelObject *)filter_stream);
- camel_object_unref((CamelObject *)output_stream);
- g_free(fromline);
-
- /* now we 'fudge' the summary to tell it its uptodate, because its idea of uptodate has just changed */
- /* the stat really shouldn't fail, we just wrote to it */
- if (stat(lf->folder_path, &st) == 0) {
- mbs->folder_size = st.st_size;
- ((CamelFolderSummary *)mbs)->time = st.st_mtime;
- }
-
- if (camel_folder_change_info_changed(lf->changes)) {
- camel_object_trigger_event((CamelObject *)folder, "folder_changed", lf->changes);
- camel_folder_change_info_clear(lf->changes);
- }
-
- return;
-
-fail_write:
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot append message to mbox file: %s: %s"), lf->folder_path, strerror(errno));
-
- if (filter_stream)
- camel_object_unref(CAMEL_OBJECT(filter_stream));
-
- if (output_stream)
- camel_object_unref(CAMEL_OBJECT(output_stream));
-
- if (filter_from)
- camel_object_unref(CAMEL_OBJECT(filter_from));
-
- g_free(fromline);
-
- /* reset the file to original size */
- fd = open(lf->folder_path, O_WRONLY, 0600);
-
- if (fd != -1) {
- ftruncate(fd, mbs->folder_size);
- close(fd);
- }
-
- /* and tell the summary its uptodate */
- if (stat(lf->folder_path, &st) == 0) {
- mbs->folder_size = st.st_size;
- ((CamelFolderSummary *)mbs)->time = st.st_mtime;
- }
-
-fail:
- /* make sure we unlock the folder - before we start triggering events into appland */
- camel_local_folder_unlock(lf);
-
- /* cascade the changes through, anyway, if there are any outstanding */
- if (camel_folder_change_info_changed(lf->changes)) {
- camel_object_trigger_event((CamelObject *)folder, "folder_changed", lf->changes);
- camel_folder_change_info_clear(lf->changes);
- }
-}
-
-static CamelMimeMessage *
-mbox_get_message(CamelFolder *folder, const gchar * uid, CamelException *ex)
-{
- CamelLocalFolder *lf = (CamelLocalFolder *)folder;
- CamelMimeMessage *message;
- CamelMboxMessageInfo *info;
- CamelMimeParser *parser;
- int fd;
- int retried = FALSE;
-
- d(printf("Getting message %s\n", uid));
-
- /* lock the folder first, burn if we can't */
- if (camel_local_folder_lock(lf, CAMEL_LOCK_READ, ex) == -1)
- return NULL;
-
-retry:
- /* get the message summary info */
- info = (CamelMboxMessageInfo *) camel_folder_summary_uid(folder->summary, uid);
-
- if (info == NULL) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- _("Cannot get message: %s\n %s"), uid, _("No such message"));
- camel_local_folder_unlock(lf);
- return NULL;
- }
-
- /* no frompos, its an error in the library (and we can't do anything with it */
- g_assert(info->frompos != -1);
-
- /* we use an fd instead of a normal stream here - the reason is subtle, camel_mime_part will cache
- the whole message in memory if the stream is non-seekable (which it is when built from a parser
- with no stream). This means we dont have to lock the mbox for the life of the message, but only
- while it is being created. */
-
- fd = open(lf->folder_path, O_RDONLY);
- if (fd == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- _("Cannot get message: %s from folder %s\n %s"), uid, lf->folder_path,
- strerror(errno));
- camel_local_folder_unlock(lf);
- camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)info);
- return NULL;
- }
-
- /* 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_fd(parser, fd);
- camel_mime_parser_scan_from(parser, TRUE);
-
- camel_mime_parser_seek(parser, info->frompos, SEEK_SET);
- if (camel_mime_parser_step(parser, NULL, NULL) != HSCAN_FROM
- || camel_mime_parser_tell_start_from(parser) != info->frompos) {
-
- g_warning("Summary doesn't match the folder contents! eek!\n"
- " expecting offset %ld got %ld, state = %d", (long int)info->frompos,
- (long int)camel_mime_parser_tell_start_from(parser),
- camel_mime_parser_state(parser));
-
- camel_object_unref((CamelObject *)parser);
- camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)info);
-
- if (!retried) {
- retried = TRUE;
- camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex);
- if (!camel_exception_is_set(ex))
- goto retry;
- }
-
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- _("Cannot get message: %s from folder %s\n %s"), uid, lf->folder_path,
- _("The folder appears to be irrecoverably corrupted."));
-
- camel_local_folder_unlock(lf);
- return NULL;
- }
-
- camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)info);
-
- message = camel_mime_message_new();
- if (camel_mime_part_construct_from_parser((CamelMimePart *)message, parser) == -1) {
- g_warning("Construction failed");
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- _("Cannot get message: %s from folder %s\n %s"), uid, lf->folder_path,
- _("Message construction failed: Corrupt mailbox?"));
- camel_object_unref((CamelObject *)parser);
- camel_object_unref((CamelObject *)message);
- camel_local_folder_unlock(lf);
- return NULL;
- }
-
- /* and unlock now we're finished with it */
- camel_local_folder_unlock(lf);
-
- camel_object_unref((CamelObject *)parser);
-
- /* use the opportunity to notify of changes (particularly if we had a rebuild) */
- if (camel_folder_change_info_changed(lf->changes)) {
- camel_object_trigger_event((CamelObject *)folder, "folder_changed", lf->changes);
- camel_folder_change_info_clear(lf->changes);
- }
-
- return message;
-}
-
-static void
-mbox_set_message_user_flag(CamelFolder *folder, const char *uid, const char *name, gboolean value)
-{
- CamelMessageInfo *info;
-
- g_return_if_fail(folder->summary != NULL);
-
- info = camel_folder_summary_uid(folder->summary, uid);
- g_return_if_fail(info != NULL);
-
- if (camel_flag_set(&info->user_flags, name, value)) {
- info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED|CAMEL_MESSAGE_FOLDER_XEVCHANGE;
- camel_folder_summary_touch(folder->summary);
- camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid);
- }
- camel_folder_summary_info_free(folder->summary, info);
-}
-
-static void
-mbox_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value)
-{
- CamelMessageInfo *info;
-
- g_return_if_fail(folder->summary != NULL);
-
- info = camel_folder_summary_uid(folder->summary, uid);
- g_return_if_fail(info != NULL);
-
- if (camel_tag_set(&info->user_tags, name, value)) {
- info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED|CAMEL_MESSAGE_FOLDER_XEVCHANGE;
- camel_folder_summary_touch(folder->summary);
- camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid);
- }
- camel_folder_summary_info_free(folder->summary, info);
-}
diff --git a/camel/providers/local/camel-mbox-folder.h b/camel/providers/local/camel-mbox-folder.h
deleted file mode 100644
index 688135ff76..0000000000
--- a/camel/providers/local/camel-mbox-folder.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Authors: Michael Zucchi <notzed@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 "camel-local-folder.h"
-#include "camel-mbox-summary.h"
-
-#define CAMEL_MBOX_FOLDER_TYPE (camel_mbox_folder_get_type ())
-#define CAMEL_MBOX_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_MBOX_FOLDER_TYPE, CamelMboxFolder))
-#define CAMEL_MBOX_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MBOX_FOLDER_TYPE, CamelMboxFolderClass))
-#define CAMEL_IS_MBOX_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_MBOX_FOLDER_TYPE))
-
-typedef struct {
- CamelLocalFolder parent_object;
-
- int lockfd; /* for when we have a lock on the folder */
-} CamelMboxFolder;
-
-typedef struct {
- CamelLocalFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMboxFolderClass;
-
-/* public methods */
-/* flags are taken from CAMEL_STORE_FOLDER_* flags */
-CamelFolder *camel_mbox_folder_new(CamelStore *parent_store, const char *full_name, guint32 flags, CamelException *ex);
-
-/* Standard Camel function */
-CamelType camel_mbox_folder_get_type(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MBOX_FOLDER_H */
diff --git a/camel/providers/local/camel-mbox-provider.c b/camel/providers/local/camel-mbox-provider.c
deleted file mode 100644
index bfce8b5ada..0000000000
--- a/camel/providers/local/camel-mbox-provider.c
+++ /dev/null
@@ -1,59 +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"
-#include "camel-url.h"
-
-static CamelProvider mbox_provider = {
- "mbox",
- N_("UNIX mbox-format mail files"),
-
- N_("For reading mail delivered by the local system, and for "
- "storing mail on local disk."),
-
- "mail",
-
- CAMEL_PROVIDER_IS_SOURCE | CAMEL_PROVIDER_IS_STORAGE,
-
- CAMEL_URL_NEED_PATH,
-
- { 0, 0 },
-
- NULL
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- mbox_provider.object_types[CAMEL_PROVIDER_STORE] =
- camel_mbox_store_get_type();
-
- mbox_provider.service_cache = g_hash_table_new (camel_url_hash, camel_url_equal);
-
- camel_session_register_provider (session, &mbox_provider);
-}
diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c
deleted file mode 100644
index c6ddc7ce0a..0000000000
--- a/camel/providers/local/camel-mbox-store.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright (C) 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 <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "camel-mbox-store.h"
-#include "camel-mbox-folder.h"
-#include "camel-exception.h"
-#include "camel-url.h"
-
-static CamelLocalStoreClass *parent_class = NULL;
-
-/* Returns the class for a CamelMboxStore */
-#define CMBOXS_CLASS(so) CAMEL_MBOX_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static CamelFolder *get_folder(CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex);
-static void delete_folder(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);
-
- parent_class = (CamelLocalStoreClass *)camel_type_get_global_classfuncs(camel_local_store_get_type());
-
- /* virtual method overload */
- camel_store_class->get_folder = get_folder;
- camel_store_class->delete_folder = delete_folder;
-}
-
-CamelType
-camel_mbox_store_get_type (void)
-{
- static CamelType camel_mbox_store_type = CAMEL_INVALID_TYPE;
-
- if (camel_mbox_store_type == CAMEL_INVALID_TYPE) {
- camel_mbox_store_type = camel_type_register (CAMEL_LOCAL_STORE_TYPE, "CamelMboxStore",
- sizeof (CamelMboxStore),
- sizeof (CamelMboxStoreClass),
- (CamelObjectClassInitFunc) camel_mbox_store_class_init,
- NULL,
- NULL,
- NULL);
- }
-
- return camel_mbox_store_type;
-}
-
-static CamelFolder *
-get_folder(CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex)
-{
- char *name;
- struct stat st;
-
- (void) ((CamelStoreClass *)parent_class)->get_folder(store, folder_name, flags, ex);
- if (camel_exception_is_set(ex))
- return NULL;
-
- name = g_strdup_printf("%s%s", CAMEL_SERVICE(store)->url->path, folder_name);
-
- if (stat(name, &st) == -1) {
- int fd;
-
- if (errno != ENOENT) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not open file `%s':\n%s"),
- name, g_strerror(errno));
- g_free(name);
- return NULL;
- }
- if ((flags & CAMEL_STORE_FOLDER_CREATE) == 0) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("Folder `%s' does not exist."),
- folder_name);
- g_free(name);
- return NULL;
- }
-
- fd = open(name, O_WRONLY | O_CREAT | O_APPEND, 0600);
- if (fd == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create file `%s':\n%s"),
- name, g_strerror(errno));
- g_free(name);
- return NULL;
- }
- g_free(name);
- close(fd);
- } else if (!S_ISREG(st.st_mode)) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("`%s' is not a regular file."),
- name);
- g_free(name);
- return NULL;
- } else
- g_free(name);
-
- return camel_mbox_folder_new(store, folder_name, flags, ex);
-}
-
-static void
-delete_folder (CamelStore *store, const char *folder_name, CamelException *ex)
-{
- char *name;
- struct stat st;
-
- name = g_strdup_printf ("%s%s", CAMEL_SERVICE (store)->url->path, folder_name);
- if (stat (name, &st) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not delete folder `%s':\n%s"),
- folder_name, g_strerror (errno));
- g_free (name);
- return;
- }
-
- if (!S_ISREG (st.st_mode)) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("`%s' is not a regular file."), name);
- g_free (name);
- return;
- }
-
- if (st.st_size != 0) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_NON_EMPTY,
- _("Folder `%s' is not empty. Not deleted."),
- folder_name);
- g_free (name);
- return;
- }
-
- if (unlink(name) == -1 && errno != ENOENT) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not delete folder `%s':\n%s"),
- name, g_strerror (errno));
- g_free(name);
- return;
- }
-
- g_free(name);
-
- /* and remove metadata */
- ((CamelStoreClass *)parent_class)->delete_folder(store, folder_name, ex);
-}
diff --git a/camel/providers/local/camel-mbox-store.h b/camel/providers/local/camel-mbox-store.h
deleted file mode 100644
index bc8d5149f5..0000000000
--- a/camel/providers/local/camel-mbox-store.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright (C) 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
- */
-
-#ifndef CAMEL_MBOX_STORE_H
-#define CAMEL_MBOX_STORE_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-local-store.h"
-
-#define CAMEL_MBOX_STORE_TYPE (camel_mbox_store_get_type ())
-#define CAMEL_MBOX_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_MBOX_STORE_TYPE, CamelMboxStore))
-#define CAMEL_MBOX_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MBOX_STORE_TYPE, CamelMboxStoreClass))
-#define CAMEL_IS_MBOX_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_MBOX_STORE_TYPE))
-
-typedef struct {
- CamelLocalStore parent_object;
-
-} CamelMboxStore;
-
-typedef struct {
- CamelLocalStoreClass parent_class;
-
-} CamelMboxStoreClass;
-
-/* public methods */
-
-/* Standard Camel function */
-CamelType camel_mbox_store_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MBOX_STORE_H */
-
-
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
deleted file mode 100644
index b8219b4c78..0000000000
--- a/camel/providers/local/camel-mbox-summary.c
+++ /dev/null
@@ -1,880 +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 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 "camel/camel-operation.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) /*(printf("%s(%d): ", __FILE__, __LINE__),(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 int mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static int mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-
-static void camel_mbox_summary_class_init (CamelMboxSummaryClass *klass);
-static void camel_mbox_summary_init (CamelMboxSummary *obj);
-static void camel_mbox_summary_finalise (CamelObject *obj);
-
-static CamelLocalSummaryClass *camel_mbox_summary_parent;
-
-CamelType
-camel_mbox_summary_get_type(void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register(camel_local_summary_get_type(), "CamelMboxSummary",
- sizeof (CamelMboxSummary),
- sizeof (CamelMboxSummaryClass),
- (CamelObjectClassInitFunc) camel_mbox_summary_class_init,
- NULL,
- (CamelObjectInitFunc) camel_mbox_summary_init,
- (CamelObjectFinalizeFunc) camel_mbox_summary_finalise);
- }
-
- return type;
-}
-
-static void
-camel_mbox_summary_class_init(CamelMboxSummaryClass *klass)
-{
- CamelFolderSummaryClass *sklass = (CamelFolderSummaryClass *)klass;
- CamelLocalSummaryClass *lklass = (CamelLocalSummaryClass *)klass;
-
- camel_mbox_summary_parent = (CamelLocalSummaryClass *)camel_type_get_global_classfuncs(camel_local_summary_get_type());
-
- 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;*/
-
- lklass->check = mbox_summary_check;
- lklass->sync = mbox_summary_sync;
-}
-
-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(CamelObject *obj)
-{
- /*CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY(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 = (CamelMboxSummary *)camel_object_new(camel_mbox_summary_get_type());
-
- camel_local_summary_construct((CamelLocalSummary *)new, filename, mbox_name, index);
- return new;
-}
-
-static int
-summary_header_load(CamelFolderSummary *s, FILE *in)
-{
- CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY(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 = CAMEL_MBOX_SUMMARY(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 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) {
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
-
- mbi->frompos = -1;
- }
-
- return mi;
-}
-
-static CamelMessageInfo *
-message_info_new_from_parser(CamelFolderSummary *s, CamelMimeParser *mp)
-{
- CamelMessageInfo *mi;
-
- 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);
- }
-
- 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;
-
- if (camel_folder_summary_decode_off_t(in, &mbi->frompos) == -1)
- goto error;
- }
-
- return mi;
-error:
- camel_folder_summary_info_free(s, mi);
- return NULL;
-}
-
-static int
-message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
-{
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
-
- io(printf("saving mbox message info\n"));
-
- if (((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_save(s, out, mi) == -1
- || camel_folder_summary_encode_off_t(out, mbi->frompos) == -1)
- return -1;
-
- return 0;
-}
-
-static int
-summary_rebuild(CamelMboxSummary *mbs, off_t offset, CamelException *ex)
-{
- CamelLocalSummary *cls = (CamelLocalSummary *)mbs;
- CamelFolderSummary *s = (CamelFolderSummary *)mbs;
- CamelMimeParser *mp;
- int fd;
- int ok = 0;
- struct stat st;
- off_t size = 0;
-
- /* FIXME: If there is a failure, it shouldn't clear the summary and restart,
- it should try and merge the summary info's. This is a bit tricky. */
-
- camel_operation_start(NULL, _("Summarising folder"));
-
- fd = open(cls->folder_path, O_RDONLY);
- if (fd == -1) {
- printf("%s failed to open: %s", cls->folder_path, strerror(errno));
- camel_exception_setv(ex, 1, _("Could not open folder: %s: summarising from position %ld: %s"),
- cls->folder_path, offset, strerror(errno));
- camel_operation_end(NULL);
- return -1;
- }
-
- if (fstat(fd, &st) == 0)
- size = st.st_size;
-
- 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, building summary from start");
- camel_mime_parser_drop_step(mp);
- offset = 0;
- camel_mime_parser_seek(mp, offset, SEEK_SET);
- camel_folder_summary_clear(s);
- } else {
- camel_mime_parser_unstep(mp);
- }
- } else {
- d(printf("mime parser state ran out? state is %d\n", camel_mime_parser_state(mp)));
- camel_object_unref(CAMEL_OBJECT(mp));
- /* end of file - no content? no error either */
- camel_operation_end(NULL);
- return 0;
- }
- }
-
- while (camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM) {
- CamelMessageInfo *info;
- int pc = (camel_mime_parser_tell(mp)+1) * 100/size;
-
- camel_operation_progress(NULL, pc);
-
- info = camel_folder_summary_add_from_parser(s, mp);
- if (info == NULL) {
- camel_exception_setv(ex, 1, _("Fatal mail parser error near position %ld in folder %s"),
- camel_mime_parser_tell(mp), cls->folder_path);
- ok = -1;
- break;
- }
-
- g_assert(camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM_END);
- }
-
- camel_object_unref(CAMEL_OBJECT (mp));
-
- /* update the file size/mtime in the summary */
- if (ok != -1) {
- if (stat(cls->folder_path, &st) == 0) {
- camel_folder_summary_touch(s);
- mbs->folder_size = st.st_size;
- s->time = st.st_mtime;
- }
- }
-
- camel_operation_end(NULL);
-
- return ok;
-}
-
-/* like summary_rebuild, but also do changeinfo stuff (if supplied) */
-static int
-summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *changeinfo, CamelException *ex)
-{
- int ret, i, count;
- CamelFolderSummary *s = (CamelFolderSummary *)cls;
- CamelMboxSummary *mbs = (CamelMboxSummary *)cls;
-
- d(printf("Calling summary update, from pos %d\n", (int)offset));
-
- if (changeinfo) {
- /* we use the diff function of the change_info to build the update list. */
- for (i = 0; i < camel_folder_summary_count(s); i++) {
- CamelMessageInfo *mi = camel_folder_summary_index(s, i);
-
- camel_folder_change_info_add_source(changeinfo, camel_message_info_uid(mi));
- camel_folder_summary_info_free(s, mi);
- }
- }
-
- /* do the actual work */
- cls->index_force = FALSE;
- ret = summary_rebuild(mbs, offset, ex);
-
- if (changeinfo) {
- count = camel_folder_summary_count(s);
- for (i = 0; i < count; i++) {
- CamelMessageInfo *mi = camel_folder_summary_index(s, i);
- camel_folder_change_info_add_update(changeinfo, camel_message_info_uid(mi));
- camel_folder_summary_info_free(s, mi);
- }
- camel_folder_change_info_build_diff(changeinfo);
- }
-
- return ret;
-}
-
-static int
-mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, CamelException *ex)
-{
- CamelMboxSummary *mbs = (CamelMboxSummary *)cls;
- CamelFolderSummary *s = (CamelFolderSummary *)cls;
- struct stat st;
- int ret = 0;
-
- d(printf("Checking summary\n"));
-
- /* check if the summary is up-to-date */
- if (stat(cls->folder_path, &st) == -1) {
- camel_folder_summary_clear(s);
- camel_exception_setv(ex, 1, _("Cannot summarise folder: %s: %s"), cls->folder_path, strerror(errno));
- return -1;
- }
-
- if (st.st_size == 0) {
- /* empty? No need to scan at all */
- d(printf("Empty mbox, clearing summary\n"));
- camel_folder_summary_clear(s);
- ret = 0;
- } else if (s->messages->len == 0) {
- /* if we are empty, then we rebuilt from scratch */
- d(printf("Empty summary, rebuilding from start\n"));
- ret = summary_update(cls, 0, changes, ex);
- } else {
- /* is the summary uptodate? */
- if (st.st_size != mbs->folder_size || st.st_mtime != s->time) {
- if (mbs->folder_size < st.st_size) {
- /* this will automatically rescan from 0 if there is a problem */
- d(printf("folder grew, attempting to rebuild from %d\n", mbs->folder_size));
- ret = summary_update(cls, mbs->folder_size, changes, ex);
- } else {
- d(printf("folder shrank! rebuilding from start\n"));
- camel_folder_summary_clear(s);
- ret = summary_update(cls, 0, changes, ex);
- }
- }
- }
-
- /* FIXME: move upstream? */
-
- if (ret != -1) {
- mbs->folder_size = st.st_size;
- s->time = st.st_mtime;
-#if 0
- /* this failing is not a fatal event */
- if (camel_folder_summary_save(s) == -1)
- g_warning("Could not save summary: %s", strerror(errno));
- if (cls->index)
- ibex_save(cls->index);
-#endif
- }
-
- return ret;
-}
-
-static char *tz_months[] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-
-static char *tz_days[] = {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-};
-
-/* tries to build a From line, based on message headers */
-char *
-camel_mbox_summary_build_from(struct _header_raw *header)
-{
- GString *out = g_string_new("From ");
- char *ret;
- const char *tmp;
- time_t thetime;
- int offset;
- struct tm tm;
-
- tmp = header_raw_find(&header, "Sender", NULL);
- if (tmp == NULL)
- tmp = header_raw_find(&header, "From", NULL);
- if (tmp != NULL) {
- struct _header_address *addr = header_address_decode(tmp);
-
- tmp = NULL;
- if (addr) {
- if (addr->type == HEADER_ADDRESS_NAME) {
- g_string_append(out, addr->v.addr);
- tmp = "";
- }
- header_address_unref(addr);
- }
- }
- if (tmp == NULL) {
- g_string_append(out, "unknown@nodomain.now.au");
- }
-
- /* try use the received header to get the date */
- tmp = header_raw_find(&header, "Received", NULL);
- if (tmp) {
- tmp = strrchr(tmp, ';');
- if (tmp)
- tmp++;
- }
-
- /* if there isn't one, try the Date field */
- if (tmp == NULL)
- tmp = header_raw_find(&header, "Date", NULL);
-
- thetime = header_decode_date(tmp, &offset);
-
- thetime += ((offset / 100) * (60 * 60)) + (offset % 100) * 60;
-
- /* a pseudo, but still bogus attempt at thread safing the function */
- /*memcpy(&tm, gmtime(&thetime), sizeof(tm));*/
- gmtime_r(&thetime, &tm);
-
- g_string_sprintfa(out, " %s %s %d %02d:%02d:%02d %4d\n",
- tz_days[tm.tm_wday],
- tz_months[tm.tm_mon], tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_year + 1900);
-
- ret = out->str;
- g_string_free(out, FALSE);
- return ret;
-}
-
-/* perform a full sync */
-static int
-mbox_summary_sync_full(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
-{
- CamelMboxSummary *mbs = (CamelMboxSummary *)cls;
- CamelFolderSummary *s = (CamelFolderSummary *)mbs;
- CamelMimeParser *mp = NULL;
- int i, count;
- CamelMboxMessageInfo *info = NULL;
- int fd = -1, fdout = -1;
- char *tmpname = NULL;
- char *buffer, *xevnew = NULL;
- int len;
- const char *fromline;
- int lastdel = FALSE;
-
- d(printf("performing full summary/sync\n"));
-
- camel_operation_start(NULL, _("Synchronising folder"));
-
- fd = open(cls->folder_path, O_RDONLY);
- if (fd == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not open folder to summarise: %s: %s"),
- cls->folder_path, strerror(errno));
- camel_operation_end(NULL);
- return -1;
- }
-
- mp = camel_mime_parser_new();
- camel_mime_parser_scan_from(mp, TRUE);
- camel_mime_parser_scan_pre_from(mp, TRUE);
- camel_mime_parser_init_with_fd(mp, fd);
-
- tmpname = alloca(strlen (cls->folder_path) + 5);
- sprintf(tmpname, "%s.tmp", cls->folder_path);
- d(printf("Writing tmp file to %s\n", tmpname));
- fdout = open(tmpname, O_WRONLY|O_CREAT|O_TRUNC, 0600);
- if (fdout == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot open temporary mailbox: %s"), strerror(errno));
- goto error;
- }
-
- count = camel_folder_summary_count(s);
- for (i = 0; i < count; i++) {
- int pc = (i+1)*100/count;
-
- camel_operation_progress(NULL, pc);
-
- info = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
-
- g_assert(info);
-
- d(printf("Looking at message %s\n", info->info.uid));
-
- /* only need to seek past deleted messages, otherwise we should be at the right spot/state already */
- if (lastdel) {
- d(printf("seeking to %d\n", (int)info->frompos));
- camel_mime_parser_seek(mp, info->frompos, SEEK_SET);
- }
-
- if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_FROM) {
- g_warning("Expected a From line here, didn't get it");
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Summary and folder mismatch, even after a sync"));
- goto error;
- }
-
- if (camel_mime_parser_tell_start_from(mp) != info->frompos) {
- g_warning("Didn't get the next message where I expected (%d) got %d instead",
- (int)info->frompos, (int)camel_mime_parser_tell_start_from(mp));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Summary and folder mismatch, even after a sync"));
- goto error;
- }
-
- lastdel = FALSE;
- if (expunge && info->info.flags & CAMEL_MESSAGE_DELETED) {
- const char *uid = camel_message_info_uid(info);
-
- d(printf("Deleting %s\n", uid));
-
- if (cls->index)
- ibex_unindex(cls->index, (char *)uid);
-
- /* remove it from the change list */
- camel_folder_change_info_remove_uid(changeinfo, uid);
- camel_folder_summary_remove(s, (CamelMessageInfo *)info);
- camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
- count--;
- i--;
- info = NULL;
- lastdel = TRUE;
- } else {
- /* otherwise, the message is staying, copy its From_ line across */
- if (i>0) {
- write(fdout, "\n", 1);
- }
- info->frompos = lseek(fdout, 0, SEEK_CUR);
- fromline = camel_mime_parser_from_line(mp);
- write(fdout, fromline, strlen(fromline));
- }
-
- if (info && info->info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV | CAMEL_MESSAGE_FOLDER_FLAGGED)) {
- d(printf("Updating header for %s flags = %08x\n", info->info.uid, info->info.flags));
-
- if (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_FROM_END) {
- g_warning("camel_mime_parser_step failed (2)");
- goto error;
- }
-
- xevnew = camel_local_summary_encode_x_evolution(cls, (CamelMessageInfo *)info);
- if (camel_local_summary_write_headers(fdout, camel_mime_parser_headers_raw(mp), xevnew) == -1) {
- d(printf("Error writing to tmp mailbox\n"));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Error writing to temp mailbox: %s"),
- strerror(errno));
- goto error;
- }
- info->info.flags &= 0xffff;
- g_free(xevnew);
- xevnew = NULL;
- camel_mime_parser_drop_step(mp);
- }
-
- camel_mime_parser_drop_step(mp);
- if (info) {
- d(printf("looking for message content to copy across from %d\n", (int)camel_mime_parser_tell(mp)));
- while (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_PRE_FROM) {
- d(printf("copying mbox contents to tmp: '%.*s'\n", len, buffer));
- if (write(fdout, buffer, len) != len) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Writing to tmp mailbox failed: %s: %s"),
- cls->folder_path, strerror(errno));
- goto error;
- }
- }
- d(printf("we are now at %d, from = %d\n", (int)camel_mime_parser_tell(mp),
- (int)camel_mime_parser_tell_start_from(mp)));
- camel_mime_parser_unstep(mp);
- camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
- info = NULL;
- }
- }
-
- d(printf("Closing folders\n"));
-
- if (close(fd) == -1) {
- g_warning("Cannot close source folder: %s", strerror(errno));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not close source folder %s: %s"),
- cls->folder_path, strerror(errno));
- fd = -1;
- goto error;
- }
-
- if (close(fdout) == -1) {
- g_warning("Cannot close tmp folder: %s", strerror(errno));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not close temp folder: %s"),
- strerror(errno));
- fdout = -1;
- goto error;
- }
-
- /* this should probably either use unlink/link/unlink, or recopy over
- the original mailbox, for various locking reasons/etc */
- if (rename(tmpname, cls->folder_path) == -1) {
- g_warning("Cannot rename folder: %s", strerror(errno));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not rename folder: %s"),
- strerror(errno));
- goto error;
- }
- tmpname = NULL;
-
- camel_object_unref((CamelObject *)mp);
- camel_operation_end(NULL);
-
- return 0;
- error:
- if (fd != -1)
- close(fd);
-
- if (fdout != -1)
- close(fdout);
-
- g_free(xevnew);
-
- if (tmpname)
- unlink(tmpname);
- if (mp)
- camel_object_unref((CamelObject *)mp);
- if (info)
- camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
-
- camel_operation_end(NULL);
-
- return -1;
-}
-
-/* perform a quick sync - only system flags have changed */
-static int
-mbox_summary_sync_quick(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
-{
- CamelMboxSummary *mbs = (CamelMboxSummary *)cls;
- CamelFolderSummary *s = (CamelFolderSummary *)mbs;
- CamelMimeParser *mp = NULL;
- int i, count;
- CamelMboxMessageInfo *info = NULL;
- int fd = -1;
- char *xevnew, *xevtmp;
- const char *xev;
- int len;
- off_t lastpos;
-
- d(printf("Performing quick summary sync\n"));
-
- camel_operation_start(NULL, _("Synchronising folder"));
-
- fd = open(cls->folder_path, O_RDWR);
- if (fd == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not open folder to summarise: %s: %s"),
- cls->folder_path, strerror(errno));
-
- camel_operation_end(NULL);
- return -1;
- }
-
- mp = camel_mime_parser_new();
- camel_mime_parser_scan_from(mp, TRUE);
- camel_mime_parser_scan_pre_from(mp, TRUE);
- camel_mime_parser_init_with_fd(mp, fd);
-
- count = camel_folder_summary_count(s);
- for (i = 0; i < count; i++) {
- int xevoffset;
- int pc = (i+1)*100/count;
-
- camel_operation_progress(NULL, pc);
-
- info = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
-
- g_assert(info);
-
- d(printf("Checking message %s %08x\n", info->info.uid, info->info.flags));
-
- if ((info->info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) == 0) {
- camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
- info = NULL;
- continue;
- }
-
- d(printf("Updating message %s\n", info->info.uid));
-
- camel_mime_parser_seek(mp, info->frompos, SEEK_SET);
-
- if (camel_mime_parser_step(mp, 0, 0) != HSCAN_FROM) {
- g_warning("Expected a From line here, didn't get it");
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Summary and folder mismatch, even after a sync"));
- goto error;
- }
-
- if (camel_mime_parser_tell_start_from(mp) != info->frompos) {
- g_warning("Didn't get the next message where I expected (%d) got %d instead",
- (int)info->frompos, (int)camel_mime_parser_tell_start_from(mp));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Summary and folder mismatch, even after a sync"));
- goto error;
- }
-
- if (camel_mime_parser_step(mp, 0, 0) == HSCAN_FROM_END) {
- g_warning("camel_mime_parser_step failed (2)");
- goto error;
- }
-
- xev = camel_mime_parser_header(mp, "X-Evolution", &xevoffset);
- if (xev == NULL || camel_local_summary_decode_x_evolution(cls, xev, NULL) == -1) {
- g_warning("We're supposed to have a valid x-ev header, but we dont");
- goto error;
- }
- xevnew = camel_local_summary_encode_x_evolution(cls, (CamelMessageInfo *)info);
- /* SIGH: encode_param_list is about the only function which folds headers by itself.
- This should be fixed somehow differently (either parser doesn't fold headers,
- or param_list doesn't, or something */
- xevtmp = header_unfold(xevnew);
- /* the raw header contains a leading ' ', so (dis)count that too */
- if (strlen(xev)-1 != strlen(xevtmp)) {
- g_free(xevnew);
- g_free(xevtmp);
- g_warning("Hmm, the xev headers shouldn't have changed size, but they did");
- goto error;
- }
- g_free(xevtmp);
-
- /* we write out the xevnew string, assuming its been folded identically to the original too! */
-
- lastpos = lseek(fd, 0, SEEK_CUR);
- lseek(fd, xevoffset+strlen("X-Evolution: "), SEEK_SET);
- do {
- len = write(fd, xevnew, strlen(xevnew));
- } while (len == -1 && errno == EINTR);
- lseek(fd, lastpos, SEEK_SET);
- g_free(xevnew);
-
- camel_mime_parser_drop_step(mp);
- camel_mime_parser_drop_step(mp);
-
- info->info.flags &= 0xffff;
- camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
- }
-
- d(printf("Closing folders\n"));
-
- if (close(fd) == -1) {
- g_warning("Cannot close source folder: %s", strerror(errno));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not close source folder %s: %s"),
- cls->folder_path, strerror(errno));
- fd = -1;
- goto error;
- }
-
- camel_object_unref((CamelObject *)mp);
-
- camel_operation_end(NULL);
-
- return 0;
- error:
- if (fd != -1)
- close(fd);
- if (mp)
- camel_object_unref((CamelObject *)mp);
- if (info)
- camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
-
- camel_operation_end(NULL);
-
- return -1;
-}
-
-static int
-mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
-{
- struct stat st;
- CamelMboxSummary *mbs = (CamelMboxSummary *)cls;
- CamelFolderSummary *s = (CamelFolderSummary *)cls;
- int i, count;
- int quick = TRUE, work=FALSE;
- int ret;
-
- /* first, sync ourselves up, just to make sure */
- summary_update(cls, mbs->folder_size, changeinfo, ex);
- if (camel_exception_is_set(ex))
- return -1;
-
- count = camel_folder_summary_count(s);
- if (count == 0)
- return 0;
-
- /* check what work we have to do, if any */
- for (i=0;quick && i<count; i++) {
- CamelMessageInfo *info = camel_folder_summary_index(s, i);
- g_assert(info);
- if ((expunge && (info->flags & CAMEL_MESSAGE_DELETED)) ||
- (info->flags & (CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_XEVCHANGE)))
- quick = FALSE;
- else
- work |= (info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0;
- camel_folder_summary_info_free(s, info);
- }
-
- /* yuck i hate this logic, but its to simplify the 'all ok, update summary' and failover cases */
- ret = -1;
- if (quick) {
- if (work) {
- ret = mbox_summary_sync_quick(cls, expunge, changeinfo, ex);
- if (ret == -1) {
- g_warning("failed a quick-sync, trying a full sync");
- camel_exception_clear(ex);
- }
- } else {
- ret = 0;
- }
- }
-
- if (ret == -1)
- ret = mbox_summary_sync_full(cls, expunge, changeinfo, ex);
- if (ret == -1)
- return -1;
-
- if (stat(cls->folder_path, &st) == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Unknown error: %s"), strerror(errno));
- return -1;
- }
-
- camel_folder_summary_touch(s);
- s->time = st.st_mtime;
- mbs->folder_size = st.st_size;
- camel_folder_summary_save(s);
-
- return 0;
-}
diff --git a/camel/providers/local/camel-mbox-summary.h b/camel/providers/local/camel-mbox-summary.h
deleted file mode 100644
index e24c2b4cdd..0000000000
--- a/camel/providers/local/camel-mbox-summary.h
+++ /dev/null
@@ -1,63 +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 "camel-local-summary.h"
-
-#define CAMEL_MBOX_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_mbox_summary_get_type (), CamelMboxSummary)
-#define CAMEL_MBOX_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mbox_summary_get_type (), CamelMboxSummaryClass)
-#define CAMEL_IS_MBOX_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_mbox_summary_get_type ())
-
-typedef struct _CamelMboxSummary CamelMboxSummary;
-typedef struct _CamelMboxSummaryClass CamelMboxSummaryClass;
-
-typedef struct _CamelMboxMessageContentInfo {
- CamelMessageContentInfo info;
-} CamelMboxMessageContentInfo;
-
-typedef struct _CamelMboxMessageInfo {
- CamelMessageInfo info;
-
- off_t frompos;
-} CamelMboxMessageInfo;
-
-struct _CamelMboxSummary {
- CamelLocalSummary parent;
-
- struct _CamelMboxSummaryPrivate *priv;
-
- size_t folder_size; /* size of the mbox file, last sync */
-};
-
-struct _CamelMboxSummaryClass {
- CamelLocalSummaryClass parent_class;
-};
-
-guint camel_mbox_summary_get_type (void);
-CamelMboxSummary *camel_mbox_summary_new (const char *filename, const char *mbox_name, ibex *index);
-
-/* generate a From line from headers */
-char *camel_mbox_summary_build_from(struct _header_raw *header);
-
-#endif /* ! _CAMEL_MBOX_SUMMARY_H */
-
diff --git a/camel/providers/local/camel-mh-folder.c b/camel/providers/local/camel-mh-folder.c
deleted file mode 100644
index fec620edea..0000000000
--- a/camel/providers/local/camel-mh-folder.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*-
- *
- * Authors: 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-mh-folder.h"
-#include "camel-mh-store.h"
-#include "string-utils.h"
-#include "camel-stream-fs.h"
-#include "camel-mh-summary.h"
-#include "camel-data-wrapper.h"
-#include "camel-mime-message.h"
-#include "camel-exception.h"
-
-#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
-
-static CamelLocalFolderClass *parent_class = NULL;
-
-/* Returns the class for a CamelMhFolder */
-#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CMHS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static CamelLocalSummary *mh_create_summary(const char *path, const char *folder, ibex *index);
-
-static void mh_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, CamelException * ex);
-static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex);
-
-static void mh_finalize(CamelObject * object);
-
-static void camel_mh_folder_class_init(CamelObjectClass * camel_mh_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS(camel_mh_folder_class);
- CamelLocalFolderClass *lclass = (CamelLocalFolderClass *)camel_mh_folder_class;
-
- parent_class = CAMEL_LOCAL_FOLDER_CLASS (camel_type_get_global_classfuncs(camel_local_folder_get_type()));
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_folder_class->append_message = mh_append_message;
- camel_folder_class->get_message = mh_get_message;
-
- lclass->create_summary = mh_create_summary;
-}
-
-static void mh_init(gpointer object, gpointer klass)
-{
- /*CamelFolder *folder = object;
- CamelMhFolder *mh_folder = object;*/
-}
-
-static void mh_finalize(CamelObject * object)
-{
- /*CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(object);*/
-}
-
-CamelType camel_mh_folder_get_type(void)
-{
- static CamelType camel_mh_folder_type = CAMEL_INVALID_TYPE;
-
- if (camel_mh_folder_type == CAMEL_INVALID_TYPE) {
- camel_mh_folder_type = camel_type_register(CAMEL_LOCAL_FOLDER_TYPE, "CamelMhFolder",
- sizeof(CamelMhFolder),
- sizeof(CamelMhFolderClass),
- (CamelObjectClassInitFunc) camel_mh_folder_class_init,
- NULL,
- (CamelObjectInitFunc) mh_init,
- (CamelObjectFinalizeFunc) mh_finalize);
- }
-
- return camel_mh_folder_type;
-}
-
-CamelFolder *
-camel_mh_folder_new(CamelStore *parent_store, const char *full_name, guint32 flags, CamelException *ex)
-{
- CamelFolder *folder;
-
- d(printf("Creating mh folder: %s\n", full_name));
-
- folder = (CamelFolder *)camel_object_new(CAMEL_MH_FOLDER_TYPE);
- folder = (CamelFolder *)camel_local_folder_construct((CamelLocalFolder *)folder,
- parent_store, full_name, flags, ex);
-
- return folder;
-}
-
-static CamelLocalSummary *mh_create_summary(const char *path, const char *folder, ibex *index)
-{
- return (CamelLocalSummary *)camel_mh_summary_new(path, folder, index);
-}
-
-static void mh_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, CamelException * ex)
-{
- CamelMhFolder *mh_folder = (CamelMhFolder *)folder;
- CamelLocalFolder *lf = (CamelLocalFolder *)folder;
- CamelStream *output_stream;
- CamelMessageInfo *mi;
- char *name;
-
- /* FIXME: probably needs additional locking (although mh doesn't appear do do it) */
-
- d(printf("Appending message\n"));
-
- /* add it to the summary/assign the uid, etc */
- mi = camel_local_summary_add((CamelLocalSummary *)folder->summary, message, info, lf->changes, ex);
- if (camel_exception_is_set(ex)) {
- return;
- }
-
- d(printf("Appending message: uid is %s\n", camel_message_info_uid(mi)));
-
- /* write it out, use the uid we got from the summary */
- name = g_strdup_printf("%s/%s", lf->folder_path, camel_message_info_uid(mi));
- output_stream = camel_stream_fs_new_with_name(name, O_WRONLY|O_CREAT, 0600);
- if (output_stream == NULL) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot append message to mh folder: %s: %s"), name, g_strerror(errno));
- g_free(name);
- return;
- }
-
- if (camel_data_wrapper_write_to_stream((CamelDataWrapper *)message, output_stream) == -1
- || camel_stream_close(output_stream) == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot append message to mh folder: %s: %s"), name, g_strerror(errno));
- camel_object_unref((CamelObject *)output_stream);
- unlink(name);
- g_free(name);
- return;
- }
-
- /* close this? */
- camel_object_unref((CamelObject *)output_stream);
-
- g_free(name);
-
- camel_object_trigger_event((CamelObject *)folder, "folder_changed", ((CamelLocalFolder *)mh_folder)->changes);
- camel_folder_change_info_clear(((CamelLocalFolder *)mh_folder)->changes);
-}
-
-static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex)
-{
- CamelLocalFolder *lf = (CamelLocalFolder *)folder;
- CamelStream *message_stream = NULL;
- CamelMimeMessage *message = NULL;
- CamelMessageInfo *info;
- char *name;
-
- d(printf("getting message: %s\n", uid));
-
- /* get the message summary info */
- if ((info = camel_folder_summary_uid(folder->summary, uid)) == NULL) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("Cannot get message: %s\n %s"), uid, _("No such message"));
- return NULL;
- }
-
- /* we only need it to check the message exists */
- camel_folder_summary_info_free(folder->summary, info);
-
- name = g_strdup_printf("%s/%s", lf->folder_path, uid);
- if ((message_stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0)) == NULL) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("Cannot get message: %s\n %s"),
- name, g_strerror(errno));
- g_free(name);
- return NULL;
- }
-
- message = camel_mime_message_new();
- if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, message_stream) == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("Cannot get message: %s\n %s"),
- name, _("Invalid message contents"));
- g_free(name);
- camel_object_unref((CamelObject *)message_stream);
- camel_object_unref((CamelObject *)message);
- return NULL;
-
- }
- camel_object_unref((CamelObject *)message_stream);
- g_free(name);
-
- return message;
-}
diff --git a/camel/providers/local/camel-mh-folder.h b/camel/providers/local/camel-mh-folder.h
deleted file mode 100644
index 175aef2946..0000000000
--- a/camel/providers/local/camel-mh-folder.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Authors:
- * Michael Zucchi <notzed@helixcode.com>
- *
- * Copyright (C) 1999 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
- */
-
-#ifndef CAMEL_MH_FOLDER_H
-#define CAMEL_MH_FOLDER_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus } */
-#include "camel-local-folder.h"
-
-#define CAMEL_MH_FOLDER_TYPE (camel_mh_folder_get_type ())
-#define CAMEL_MH_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_MH_FOLDER_TYPE, CamelMhFolder))
-#define CAMEL_MH_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MH_FOLDER_TYPE, CamelMhFolderClass))
-#define CAMEL_IS_MH_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_MH_FOLDER_TYPE))
-
-typedef struct {
- CamelLocalFolder parent_object;
-
-} CamelMhFolder;
-
-typedef struct {
- CamelLocalFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMhFolderClass;
-
-/* public methods */
-CamelFolder *camel_mh_folder_new(CamelStore *parent_store, const char *full_name, guint32 flags, CamelException *ex);
-
-/* Standard Camel function */
-CamelType camel_mh_folder_get_type(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* CAMEL_MH_FOLDER_H */
diff --git a/camel/providers/local/camel-mh-store.c b/camel/providers/local/camel-mh-store.c
deleted file mode 100644
index a488a71c12..0000000000
--- a/camel/providers/local/camel-mh-store.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * 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 <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "camel-mh-store.h"
-#include "camel-mh-folder.h"
-#include "camel-exception.h"
-#include "camel-url.h"
-
-static CamelLocalStoreClass *parent_class = NULL;
-
-/* Returns the class for a CamelMhStore */
-#define CMHS_CLASS(so) CAMEL_MH_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static CamelFolder *get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelException * ex);
-static void delete_folder(CamelStore * store, const char *folder_name, CamelException * ex);
-
-static void camel_mh_store_class_init(CamelObjectClass * camel_mh_store_class)
-{
- CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS(camel_mh_store_class);
- /*CamelServiceClass *camel_service_class = CAMEL_SERVICE_CLASS(camel_mh_store_class);*/
-
- parent_class = (CamelLocalStoreClass *)camel_type_get_global_classfuncs(camel_local_store_get_type());
-
- /* virtual method overload, use defaults for most */
- camel_store_class->get_folder = get_folder;
- camel_store_class->delete_folder = delete_folder;
-}
-
-CamelType camel_mh_store_get_type(void)
-{
- static CamelType camel_mh_store_type = CAMEL_INVALID_TYPE;
-
- if (camel_mh_store_type == CAMEL_INVALID_TYPE) {
- camel_mh_store_type = camel_type_register(CAMEL_LOCAL_STORE_TYPE, "CamelMhStore",
- sizeof(CamelMhStore),
- sizeof(CamelMhStoreClass),
- (CamelObjectClassInitFunc) camel_mh_store_class_init,
- NULL,
- NULL,
- NULL);
- }
-
- return camel_mh_store_type;
-}
-
-static CamelFolder *get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelException * ex)
-{
- char *name;
- struct stat st;
-
- (void) ((CamelStoreClass *)parent_class)->get_folder(store, folder_name, flags, ex);
- if (camel_exception_is_set(ex))
- return NULL;
-
- name = g_strdup_printf("%s%s", CAMEL_SERVICE(store)->url->path, folder_name);
-
- if (stat(name, &st) == -1) {
- if (errno != ENOENT) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not open folder `%s':\n%s"),
- folder_name, g_strerror(errno));
- g_free (name);
- return NULL;
- }
- if ((flags & CAMEL_STORE_FOLDER_CREATE) == 0) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("Folder `%s' does not exist."), folder_name);
- g_free (name);
- return NULL;
- }
- if (mkdir(name, 0700) != 0) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not create folder `%s':\n%s"),
- folder_name, g_strerror(errno));
- g_free (name);
- return NULL;
- }
- } else if (!S_ISDIR(st.st_mode)) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
- _("`%s' is not a directory."), name);
- g_free (name);
- return NULL;
- }
- g_free(name);
-
- return camel_mh_folder_new(store, folder_name, flags, ex);
-}
-
-static void delete_folder(CamelStore * store, const char *folder_name, CamelException * ex)
-{
- char *name;
-
- /* remove folder directory - will fail if not empty */
- name = g_strdup_printf("%s%s", CAMEL_SERVICE(store)->url->path, folder_name);
- if (rmdir(name) == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not delete folder `%s': %s"),
- folder_name, strerror(errno));
- g_free(name);
- return;
- }
- g_free(name);
-
- /* and remove metadata */
- ((CamelStoreClass *)parent_class)->delete_folder(store, folder_name, ex);
-}
diff --git a/camel/providers/local/camel-mh-store.h b/camel/providers/local/camel-mh-store.h
deleted file mode 100644
index f1f8eb9983..0000000000
--- a/camel/providers/local/camel-mh-store.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * 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_MH_STORE_H
-#define CAMEL_MH_STORE_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus } */
-
-#include "camel-local-store.h"
-
-#define CAMEL_MH_STORE_TYPE (camel_mh_store_get_type ())
-#define CAMEL_MH_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_MH_STORE_TYPE, CamelMhStore))
-#define CAMEL_MH_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MH_STORE_TYPE, CamelMhStoreClass))
-#define CAMEL_IS_MH_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_MH_STORE_TYPE))
-
-typedef struct {
- CamelLocalStore parent_object;
-
-} CamelMhStore;
-
-typedef struct {
- CamelLocalStoreClass parent_class;
-
-} CamelMhStoreClass;
-
-/* public methods */
-
-/* Standard Camel function */
-CamelType camel_mh_store_get_type(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* CAMEL_MH_STORE_H */
diff --git a/camel/providers/local/camel-mh-summary.c b/camel/providers/local/camel-mh-summary.c
deleted file mode 100644
index c933626653..0000000000
--- a/camel/providers/local/camel-mh-summary.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * 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-mh-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>
-
-#include <sys/types.h>
-#include <dirent.h>
-
-#include <ctype.h>
-
-#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
-
-#define CAMEL_MH_SUMMARY_VERSION (0x2000)
-
-static int mh_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static int mh_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-/*static int mh_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);*/
-
-static char *mh_summary_next_uid_string(CamelFolderSummary *s);
-
-static void camel_mh_summary_class_init (CamelMhSummaryClass *class);
-static void camel_mh_summary_init (CamelMhSummary *gspaper);
-static void camel_mh_summary_finalise (CamelObject *obj);
-
-#define _PRIVATE(x) (((CamelMhSummary *)(x))->priv)
-
-struct _CamelMhSummaryPrivate {
- char *current_uid;
-};
-
-static CamelLocalSummaryClass *parent_class;
-
-CamelType
-camel_mh_summary_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- type = camel_type_register(camel_local_summary_get_type (), "CamelMhSummary",
- sizeof(CamelMhSummary),
- sizeof(CamelMhSummaryClass),
- (CamelObjectClassInitFunc)camel_mh_summary_class_init,
- NULL,
- (CamelObjectInitFunc)camel_mh_summary_init,
- (CamelObjectFinalizeFunc)camel_mh_summary_finalise);
- }
-
- return type;
-}
-
-static void
-camel_mh_summary_class_init (CamelMhSummaryClass *class)
-{
- CamelFolderSummaryClass *sklass = (CamelFolderSummaryClass *) class;
- CamelLocalSummaryClass *lklass = (CamelLocalSummaryClass *)class;
-
- parent_class = (CamelLocalSummaryClass *)camel_type_get_global_classfuncs(camel_local_summary_get_type ());
-
- /* override methods */
- sklass->next_uid_string = mh_summary_next_uid_string;
-
- lklass->check = mh_summary_check;
- lklass->sync = mh_summary_sync;
- /*lklass->add = mh_summary_add;*/
-}
-
-static void
-camel_mh_summary_init (CamelMhSummary *o)
-{
- struct _CamelFolderSummary *s = (CamelFolderSummary *) o;
-
- o->priv = g_malloc0(sizeof(*o->priv));
- /* set unique file version */
- s->version += CAMEL_MH_SUMMARY_VERSION;
-}
-
-static void
-camel_mh_summary_finalise(CamelObject *obj)
-{
- CamelMhSummary *o = (CamelMhSummary *)obj;
-
- g_free(o->priv);
-}
-
-/**
- * camel_mh_summary_new:
- *
- * Create a new CamelMhSummary object.
- *
- * Return value: A new #CamelMhSummary object.
- **/
-CamelMhSummary *camel_mh_summary_new (const char *filename, const char *mhdir, ibex *index)
-{
- CamelMhSummary *o = (CamelMhSummary *)camel_object_new(camel_mh_summary_get_type ());
-
- camel_local_summary_construct((CamelLocalSummary *)o, filename, mhdir, index);
- return o;
-}
-
-static char *mh_summary_next_uid_string(CamelFolderSummary *s)
-{
- CamelMhSummary *mhs = (CamelMhSummary *)s;
- CamelLocalSummary *cls = (CamelLocalSummary *)s;
- int fd = -1;
- guint32 uid;
- char *name;
-
- /* if we are working to add an existing file, then use current_uid */
- if (mhs->priv->current_uid)
- return g_strdup(mhs->priv->current_uid);
-
- /* else scan for one - and create it too, to make sure */
- do {
- close(fd);
- uid = camel_folder_summary_next_uid(s);
- name = g_strdup_printf("%s/%u", cls->folder_path, uid);
- /* O_EXCL isn't guaranteed, sigh. Oh well, bad luck, mh has problems anyway */
- fd = open(name, O_WRONLY|O_CREAT|O_EXCL, 0600);
- g_free(name);
- } while (fd == -1 && errno == EEXIST);
-
- close(fd);
-
- return g_strdup_printf("%u", uid);
-}
-
-static int camel_mh_summary_add(CamelLocalSummary *cls, const char *name, int forceindex)
-{
- CamelMhSummary *mhs = (CamelMhSummary *)cls;
- char *filename = g_strdup_printf("%s/%s", cls->folder_path, name);
- int fd;
- CamelMimeParser *mp;
-
- d(printf("summarising: %s\n", name));
-
- fd = open(filename, O_RDONLY);
- if (fd == -1) {
- g_warning("Cannot summarise/index: %s: %s", filename, strerror(errno));
- g_free(filename);
- return -1;
- }
- mp = camel_mime_parser_new();
- camel_mime_parser_scan_from(mp, FALSE);
- camel_mime_parser_init_with_fd(mp, fd);
- if (cls->index && (forceindex || !ibex_contains_name(cls->index, (char *)name))) {
- d(printf("forcing indexing of message content\n"));
- camel_folder_summary_set_index((CamelFolderSummary *)mhs, cls->index);
- } else {
- camel_folder_summary_set_index((CamelFolderSummary *)mhs, NULL);
- }
- mhs->priv->current_uid = (char *)name;
- camel_folder_summary_add_from_parser((CamelFolderSummary *)mhs, mp);
- camel_object_unref((CamelObject *)mp);
- mhs->priv->current_uid = NULL;
- camel_folder_summary_set_index((CamelFolderSummary *)mhs, NULL);
- g_free(filename);
- return 0;
-}
-
-static void
-remove_summary(char *key, CamelMessageInfo *info, CamelLocalSummary *cls)
-{
- d(printf("removing message %s from summary\n", key));
- if (cls->index)
- ibex_unindex(cls->index, (char *)camel_message_info_uid(info));
- camel_folder_summary_remove((CamelFolderSummary *)cls, info);
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
-}
-
-static int
-mh_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex)
-{
- DIR *dir;
- struct dirent *d;
- char *p, c;
- CamelMessageInfo *info;
- GHashTable *left;
- int i, count;
- int forceindex;
-
- /* FIXME: Handle changeinfo */
-
- d(printf("checking summary ...\n"));
-
- /* scan the directory, check for mail files not in the index, or index entries that
- no longer exist */
- dir = opendir(cls->folder_path);
- if (dir == NULL) {
- camel_exception_setv(ex, 1, "Cannot open MH directory path: %s: %s", cls->folder_path, strerror(errno));
- return -1;
- }
-
- /* keeps track of all uid's that have not been processed */
- left = g_hash_table_new(g_str_hash, g_str_equal);
- count = camel_folder_summary_count((CamelFolderSummary *)cls);
- forceindex = count == 0;
- for (i=0;i<count;i++) {
- info = camel_folder_summary_index((CamelFolderSummary *)cls, i);
- if (info) {
- g_hash_table_insert(left, (char *)camel_message_info_uid(info), info);
- }
- }
-
- while ( (d = readdir(dir)) ) {
- /* FIXME: also run stat to check for regular file */
- p = d->d_name;
- while ( (c = *p++) ) {
- if (!isdigit(c))
- break;
- }
- if (c==0) {
- info = camel_folder_summary_uid((CamelFolderSummary *)cls, d->d_name);
- if (info == NULL || (cls->index && (!ibex_contains_name(cls->index, d->d_name)))) {
- /* need to add this file to the summary */
- if (info != NULL) {
- g_hash_table_remove(left, camel_message_info_uid(info));
- camel_folder_summary_remove((CamelFolderSummary *)cls, info);
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
- }
- camel_mh_summary_add(cls, d->d_name, forceindex);
- } else {
- const char *uid = camel_message_info_uid(info);
- CamelMessageInfo *old = g_hash_table_lookup(left, uid);
-
- if (old) {
- camel_folder_summary_info_free((CamelFolderSummary *)cls, old);
- g_hash_table_remove(left, uid);
- }
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
- }
- }
- }
- closedir(dir);
- g_hash_table_foreach(left, (GHFunc)remove_summary, cls);
- g_hash_table_destroy(left);
-
- /* FIXME: move this up a class */
-
- /* force a save of the index, just to make sure */
- /* note this could be expensive so possibly shouldn't be here
- as such */
- if (cls->index) {
- ibex_save(cls->index);
- }
-
- return 0;
-}
-
-static int
-mh_summary_sync_message(CamelLocalSummary *cls, CamelMessageInfo *info, CamelException *ex)
-{
- CamelMimeParser *mp;
- const char *xev, *buffer;
- int xevoffset;
- int fd, outfd, len, outlen, ret=0;
- char *name, *tmpname, *xevnew;
-
- name = g_strdup_printf("%s/%s", cls->folder_path, camel_message_info_uid(info));
- fd = open(name, O_RDWR);
- if (fd == -1)
- return -1;
-
- mp = camel_mime_parser_new();
- camel_mime_parser_init_with_fd(mp, fd);
- if (camel_mime_parser_step(mp, 0, 0) != HSCAN_EOF) {
- xev = camel_mime_parser_header(mp, "X-Evolution", &xevoffset);
- d(printf("xev = '%s'\n", xev));
- xevnew = camel_local_summary_encode_x_evolution(cls, info);
- if (xev == NULL
- || camel_local_summary_decode_x_evolution(cls, xev, NULL) == -1
- || strlen(xev)-1 != strlen(xevnew)) {
-
- d(printf("camel local summary_decode_xev = %d\n", camel_local_summary_decode_x_evolution(cls, xev, NULL)));
-
- /* need to write a new copy/unlink old */
- tmpname = g_strdup_printf("%s/.tmp.%d.%s", cls->folder_path, getpid(), camel_message_info_uid(info));
- d(printf("old xev was %d %s new xev is %d %s\n", strlen(xev), xev, strlen(xevnew), xevnew));
- d(printf("creating new message %s\n", tmpname));
- outfd = open(tmpname, O_CREAT|O_WRONLY|O_TRUNC, 0600);
- if (outfd != -1) {
- outlen = 0;
- len = camel_local_summary_write_headers(outfd, camel_mime_parser_headers_raw(mp), xevnew);
- if (len != -1) {
- while (outlen != -1 && (len = camel_mime_parser_read(mp, &buffer, 10240)) > 0) {
- d(printf("camel mime parser read, read %d bytes: %.*s\n", len, len, buffer));
- do {
- outlen = write(outfd, buffer, len);
- } while (outlen == -1 && errno == EINTR);
- }
- }
-
- d(printf("len = %d outlen = %d, renaming/finishing\n", len, outlen));
- if (close(outfd) == -1
- || len == -1
- || outlen == -1
- || rename(tmpname, name) == -1) {
- unlink(tmpname);
- ret = -1;
- }
- } else {
- g_warning("sync can't create tmp file: %s", strerror(errno));
- }
- g_free(tmpname);
- } else {
- d(printf("stamping in updated X-EV at %d\n", (int)xevoffset));
- /* else, we can just update the flags field */
- lseek(fd, xevoffset+strlen("X-Evolution: "), SEEK_SET);
- do {
- len = write(fd, xevnew, strlen(xevnew));
- } while (len == -1 && errno == EINTR);
- if (len == -1)
- ret = -1;
- }
-
- g_free(xevnew);
- }
-
- camel_object_unref((CamelObject *)mp);
- g_free(name);
- return ret;
-}
-
-/* sync the summary file with the ondisk files */
-static int
-mh_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changes, CamelException *ex)
-{
- int count, i;
- CamelMessageInfo *info;
- char *name;
- const char *uid;
-
- d(printf("summary_sync(expunge=%s)\n", expunge?"true":"false"));
-
- /* we could probably get away without this ... but why not use it, esp if we're going to
- be doing any significant io already */
- if (camel_local_summary_check(cls, changes, ex) == -1)
- return -1;
-
- count = camel_folder_summary_count((CamelFolderSummary *)cls);
- for (i=count-1;i>=0;i--) {
- info = camel_folder_summary_index((CamelFolderSummary *)cls, i);
- g_assert(info);
- if (expunge && (info->flags & CAMEL_MESSAGE_DELETED)) {
- uid = camel_message_info_uid(info);
- name = g_strdup_printf("%s/%s", cls->folder_path, uid);
- d(printf("deleting %s\n", name));
- if (unlink(name) == 0 || errno==ENOENT) {
-
- /* FIXME: put this in folder_summary::remove()? */
- if (cls->index)
- ibex_unindex(cls->index, (char *)uid);
-
- camel_folder_change_info_remove_uid(changes, uid);
- camel_folder_summary_remove((CamelFolderSummary *)cls, info);
- }
- g_free(name);
- } else if (info->flags & (CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_FLAGGED)) {
- if (mh_summary_sync_message(cls, info, ex) != -1) {
- info->flags &= 0xffff;
- } else {
- g_warning("Problem occured when trying to expunge, ignored");
- }
- }
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
- }
-
- return 0;
-}
diff --git a/camel/providers/local/camel-mh-summary.h b/camel/providers/local/camel-mh-summary.h
deleted file mode 100644
index 52cc496610..0000000000
--- a/camel/providers/local/camel-mh-summary.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * 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_MH_SUMMARY_H
-#define _CAMEL_MH_SUMMARY_H
-
-#include "camel-local-summary.h"
-#include <camel/camel-folder.h>
-#include <camel/camel-exception.h>
-#include <libibex/ibex.h>
-
-#define CAMEL_MH_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_mh_summary_get_type (), CamelMhSummary)
-#define CAMEL_MH_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mh_summary_get_type (), CamelMhSummaryClass)
-#define CAMEL_IS_MH_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_mh_summary_get_type ())
-
-typedef struct _CamelMhSummary CamelMhSummary;
-typedef struct _CamelMhSummaryClass CamelMhSummaryClass;
-
-struct _CamelMhSummary {
- CamelLocalSummary parent;
- struct _CamelMhSummaryPrivate *priv;
-};
-
-struct _CamelMhSummaryClass {
- CamelLocalSummaryClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-CamelType camel_mh_summary_get_type (void);
-CamelMhSummary *camel_mh_summary_new (const char *filename, const char *mhdir, ibex *index);
-
-#endif /* ! _CAMEL_MH_SUMMARY_H */
-
diff --git a/camel/providers/local/libcamellocal.urls b/camel/providers/local/libcamellocal.urls
deleted file mode 100644
index 35a7049145..0000000000
--- a/camel/providers/local/libcamellocal.urls
+++ /dev/null
@@ -1,3 +0,0 @@
-mh
-mbox
-maildir
diff --git a/camel/providers/nntp/.cvsignore b/camel/providers/nntp/.cvsignore
deleted file mode 100644
index 2fbeab8712..0000000000
--- a/camel/providers/nntp/.cvsignore
+++ /dev/null
@@ -1,12 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
-test-newsrc
-*.bb
-*.bbg
-*.da
-*.gcov
diff --git a/camel/providers/nntp/Makefile.am b/camel/providers/nntp/Makefile.am
deleted file mode 100644
index 4b686735e3..0000000000
--- a/camel/providers/nntp/Makefile.am
+++ /dev/null
@@ -1,53 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-libcamelnntpincludedir = $(includedir)/camel
-
-providerdir = $(pkglibdir)/camel-providers/$(VERSION)
-
-provider_LTLIBRARIES = libcamelnntp.la
-provider_DATA = libcamelnntp.urls
-
-INCLUDES = -I../.. \
- -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-nntp-provider\"
-
-libcamelnntp_la_SOURCES = \
- camel-nntp-auth.c \
- camel-nntp-folder.c \
- camel-nntp-grouplist.c \
- camel-nntp-newsrc.c \
- camel-nntp-provider.c \
- camel-nntp-store.c \
- camel-nntp-utils.c
-
-libcamelnntpinclude_HEADERS = \
- camel-nntp-auth.h \
- camel-nntp-folder.h \
- camel-nntp-grouplist.h \
- camel-nntp-newsrc.h \
- camel-nntp-resp-codes.h \
- camel-nntp-store.h \
- camel-nntp-types.h \
- camel-nntp-utils.h
-
-libcamelnntp_la_LDFLAGS = -version-info 0:0:0
-
-EXTRA_DIST = libcamelnntp.urls
-
-#noinst_PROGRAMS = test-newsrc
-
-#LDADD = \
- #$(top_builddir)/camel/libcamel.la \
- #$(top_builddir)/e-util/libeutil.la \
- #$(top_builddir)/libibex/libibex.la \
- #$(GNOME_LIBDIR) \
- #$(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
-# $(BONOBO_LIBS)
-
-#test_newsrc_LDADD = libcamelnntp.la $(LDADD)
diff --git a/camel/providers/nntp/camel-nntp-auth.c b/camel/providers/nntp/camel-nntp-auth.c
deleted file mode 100644
index 1f1e6ab2d8..0000000000
--- a/camel/providers/nntp/camel-nntp-auth.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-auth.c : authentication for nntp */
-
-/*
- *
- * 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 <camel-nntp-auth.h>
-#include <camel-nntp-store.h>
-#include <camel-nntp-resp-codes.h>
-#include <camel-exception.h>
-#include <camel-session.h>
-
-int
-camel_nntp_auth_authenticate (CamelNNTPStore *store, CamelException *ex)
-{
- CamelService *service = CAMEL_SERVICE (store);
- CamelSession *session = camel_service_get_session (service);
- int resp;
-
- if (!service->url->authmech && !service->url->passwd) {
- gchar *prompt;
-
- prompt = g_strdup_printf (_("Please enter the NNTP password for %s@%s"),
- service->url->user, service->url->host);
- service->url->passwd =
- camel_session_query_authenticator (session,
- CAMEL_AUTHENTICATOR_ASK, prompt,
- TRUE, service, "password", ex);
- g_free (prompt);
-
- if (!service->url->passwd) {
- camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
- "You didn\'t enter a password.");
- resp = 666;
- goto done;
- }
- }
-
- /* first send username */
- resp = camel_nntp_command (store, ex, NULL, "AUTHINFO USER %s", service->url->user);
-
- if (resp == NNTP_AUTH_REJECTED) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Server rejected username"));
- goto done;
-
- }
- else if (resp != NNTP_AUTH_CONTINUE) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Failed to send username to server"));
- goto done;
- }
-
- /* then send the username if the server asks for it */
- resp = camel_nntp_command (store, ex, NULL, "AUTHINFO PASS %s", service->url->passwd);
-
- if (resp == NNTP_AUTH_REJECTED) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Server rejected username/password"));
- goto done;
- }
-
- done:
-
- if (service->url->passwd) {
- /* let's be paranoid */
- memset (service->url->passwd, 0, strlen (service->url->passwd));
- g_free (service->url->passwd);
- service->url->passwd = NULL;
- }
- return resp;
-}
diff --git a/camel/providers/nntp/camel-nntp-auth.h b/camel/providers/nntp/camel-nntp-auth.h
deleted file mode 100644
index 2708d9d335..0000000000
--- a/camel/providers/nntp/camel-nntp-auth.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-auth.h : authentication for nntp */
-
-/*
- *
- * 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_AUTH_H
-#define CAMEL_NNTP_AUTH_H 1
-
-#include <camel-nntp-store.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-int camel_nntp_auth_authenticate (CamelNNTPStore *store, CamelException *ex);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_NNTP_AUTH_H */
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c
deleted file mode 100644
index 7edc4a98fd..0000000000
--- a/camel/providers/nntp/camel-nntp-folder.c
+++ /dev/null
@@ -1,265 +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-resp-codes.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-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 (CAMEL_OBJECT_GET_CLASS(so))
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CNNTPS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-
-static void
-nntp_folder_sync (CamelFolder *folder, gboolean expunge,
- CamelException *ex)
-{
- CamelNNTPStore *store;
-
- camel_folder_summary_save (folder->summary);
-
- store = CAMEL_NNTP_STORE (camel_folder_get_parent_store (folder));
-
- if (store->newsrc)
- camel_nntp_newsrc_write (store->newsrc);
-}
-
-static void
-nntp_folder_set_message_flags (CamelFolder *folder, const char *uid,
- guint32 flags, guint32 set)
-{
- ((CamelFolderClass *)parent_class)->set_message_flags(folder, uid, flags, set);
-
- if (flags & set & CAMEL_MESSAGE_SEEN) {
- int article_num;
- CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (camel_folder_get_parent_store (folder));
-
- sscanf (uid, "%d", &article_num);
-
- camel_nntp_newsrc_mark_article_read (nntp_store->newsrc,
- folder->name,
- article_num);
- }
-}
-
-static CamelMimeMessage *
-nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelStream *message_stream = NULL;
- CamelMimeMessage *message = NULL;
- CamelStore *parent_store;
- char *buf;
- int buf_len;
- int buf_alloc;
- int status;
- gboolean done;
- char *message_id;
-
- /* get the parent store */
- parent_store = camel_folder_get_parent_store (folder);
-
- message_id = strchr (uid, ',') + 1;
- status = camel_nntp_command (CAMEL_NNTP_STORE( parent_store ), ex, NULL, "ARTICLE %s", message_id);
-
- /* if the message_id was not found, raise an exception and return */
- if (status == NNTP_NO_SUCH_ARTICLE) {
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- _("Message %s not found."),
- message_id);
- return NULL;
- }
- else if (status != NNTP_ARTICLE_FOLLOWS) {
- /* XXX */
- g_warning ("weird nntp error %d\n", status);
- return NULL;
- }
-
- /* this could probably done fairly easily with an nntp stream that
- returns eof after '.' */
-
- /* 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 = g_malloc(buf_alloc);
- done = FALSE;
-
- buf[0] = 0;
-
- while (!done) {
- int line_length;
- char *line;
-
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (parent_store), &line, ex) < 0) {
- g_warning ("recv_line failed while building message\n");
- break;
- }
-
- /* 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 = g_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 ();
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER(message), message_stream);
-
- camel_object_unref (CAMEL_OBJECT (message_stream));
-
-#if 0
- gtk_signal_connect (CAMEL_OBJECT (message), "message_changed", message_changed, folder);
-#endif
-
- g_free (buf);
-
- return message;
-}
-
-static GPtrArray*
-nntp_folder_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex)
-{
- g_assert (0);
- return NULL;
-}
-
-static void
-nntp_folder_finalize (CamelObject *object)
-{
- CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (object);
-
- g_free (nntp_folder->summary_file_path);
-}
-
-static void
-camel_nntp_folder_class_init (CamelNNTPFolderClass *camel_nntp_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_nntp_folder_class);
-
- parent_class = CAMEL_FOLDER_CLASS (camel_type_get_global_classfuncs (camel_folder_get_type ()));
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_folder_class->sync = nntp_folder_sync;
- camel_folder_class->set_message_flags = nntp_folder_set_message_flags;
- camel_folder_class->get_message = nntp_folder_get_message;
- camel_folder_class->search_by_expression = nntp_folder_search_by_expression;
-}
-
-CamelType
-camel_nntp_folder_get_type (void)
-{
- static CamelType camel_nntp_folder_type = CAMEL_INVALID_TYPE;
-
- if (camel_nntp_folder_type == CAMEL_INVALID_TYPE) {
- camel_nntp_folder_type = camel_type_register (CAMEL_FOLDER_TYPE, "CamelNNTPFolder",
- sizeof (CamelNNTPFolder),
- sizeof (CamelNNTPFolderClass),
- (CamelObjectClassInitFunc) camel_nntp_folder_class_init,
- NULL,
- (CamelObjectInitFunc) NULL,
- (CamelObjectFinalizeFunc) nntp_folder_finalize);
- }
-
- return camel_nntp_folder_type;
-}
-
-CamelFolder *
-camel_nntp_folder_new (CamelStore *parent, const char *folder_name, CamelException *ex)
-{
- CamelFolder *folder = CAMEL_FOLDER (camel_object_new (CAMEL_NNTP_FOLDER_TYPE));
- CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder);
- const gchar *root_dir_path;
-
- camel_folder_construct (folder, parent, folder_name, folder_name);
- folder->has_summary_capability = TRUE;
-
- 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);
-
- folder->summary = camel_folder_summary_new ();
- camel_folder_summary_set_filename (folder->summary,
- nntp_folder->summary_file_path);
-
- if (-1 == camel_folder_summary_load (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)) {
- camel_object_unref (CAMEL_OBJECT (folder));
- return NULL;
- }
-
- /* XXX check return value */
- camel_folder_summary_save (folder->summary);
- }
-
- return folder;
-}
diff --git a/camel/providers/nntp/camel-nntp-folder.h b/camel/providers/nntp/camel-nntp-folder.h
deleted file mode 100644
index 190d0bf346..0000000000
--- a/camel/providers/nntp/camel-nntp-folder.h
+++ /dev/null
@@ -1,74 +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 "camel-folder.h"
-
-/* #include "camel-store.h" */
-
-#define CAMEL_NNTP_FOLDER_TYPE (camel_nntp_folder_get_type ())
-#define CAMEL_NNTP_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_NNTP_FOLDER_TYPE, CamelNNTPFolder))
-#define CAMEL_NNTP_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_NNTP_FOLDER_TYPE, CamelNNTPFolderClass))
-#define CAMEL_IS_NNTP_FOLDER(o) (CAMEL_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 Camel function */
-CamelType camel_nntp_folder_get_type (void);
-
-CamelFolder *camel_nntp_folder_new (CamelStore *parent, const char *folder_name, CamelException *ex);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_NNTP_FOLDER_H */
diff --git a/camel/providers/nntp/camel-nntp-grouplist.c b/camel/providers/nntp/camel-nntp-grouplist.c
deleted file mode 100644
index d7ee85d182..0000000000
--- a/camel/providers/nntp/camel-nntp-grouplist.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-grouplist.c : getting/updating the list of newsgroups on the server. */
-
-/*
- * 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 <errno.h>
-#include <string.h>
-
-#include "camel-exception.h"
-#include "camel-nntp-grouplist.h"
-#include "camel-nntp-resp-codes.h"
-
-static CamelNNTPGroupList *
-camel_nntp_get_grouplist_from_server (CamelNNTPStore *store, CamelException *ex)
-{
- int status;
- gboolean done = FALSE;
- CamelNNTPGroupList *list;
-
- status = camel_nntp_command (store, ex, NULL,
- "LIST");
-
- if (status != NNTP_LIST_FOLLOWS) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not get group list from server."));
- return NULL;
- }
-
- list = g_new0 (CamelNNTPGroupList, 1);
- list->time = time (NULL);
-
- while (!done) {
- char *line;
-
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store), &line, ex) < 0)
- return list;
-
- if (*line == '.') {
- done = TRUE;
- }
- else {
- CamelNNTPGroupListEntry *entry = g_new (CamelNNTPGroupListEntry, 1);
- char **split_line = g_strsplit (line, " ", 4);
-
- entry->group_name = g_strdup (split_line[0]);
- entry->high = atoi (split_line[1]);
- entry->low = atoi (split_line[2]);
-
- g_strfreev (split_line);
-
- list->group_list = g_list_append (list->group_list, entry);
- }
- }
-
- return list;
-}
-
-static CamelNNTPGroupList*
-camel_nntp_get_grouplist_from_file (CamelNNTPStore *store, CamelException *ex)
-{
- gchar *root_dir = camel_nntp_store_get_toplevel_dir(CAMEL_NNTP_STORE(store));
- gchar *grouplist_file = g_strdup_printf ("%s/grouplist", root_dir);
- CamelNNTPGroupList *list;
- FILE *fp;
- char buf[300];
- unsigned long time;
-
- g_free (root_dir);
- fp = fopen (grouplist_file, "r");
- g_free (grouplist_file);
-
- if (fp == NULL) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Unable to load grouplist file for %s: %s"),
- CAMEL_SERVICE(store)->url->host,
- strerror(errno));
- return NULL;
- }
-
- /* read the time */
- if (!fgets (buf, 300, fp)) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Unable to load grouplist file for %s: %s"),
- CAMEL_SERVICE(store)->url->host,
- strerror(errno));
- fclose (fp);
- return NULL;
- }
-
-
- list = g_new0 (CamelNNTPGroupList, 1);
- list->store = store;
- sscanf (buf, "%lu", &time);
- list->time = time;
-
- while (fgets (buf, 300, fp)) {
- CamelNNTPGroupListEntry *entry = g_new (CamelNNTPGroupListEntry, 1);
- char **split_line = g_strsplit (buf, " ", 4);
-
- entry->group_name = g_strdup (split_line[0]);
- entry->high = atoi (split_line[1]);
- entry->low = atoi (split_line[2]);
-
- g_strfreev (split_line);
-
- list->group_list = g_list_append (list->group_list, entry);
- }
-
- fclose (fp);
-
- return list;
-}
-
-static void
-save_entry (CamelNNTPGroupListEntry *entry, FILE *fp)
-{
- fprintf (fp, "%s %d %d\n", entry->group_name, entry->low, entry->high);
-}
-
-void
-camel_nntp_grouplist_save (CamelNNTPGroupList *group_list, CamelException *ex)
-{
- FILE *fp;
- gchar *root_dir = camel_nntp_store_get_toplevel_dir(CAMEL_NNTP_STORE(group_list->store));
- gchar *grouplist_file = g_strdup_printf ("%s/grouplist", root_dir);
-
- g_free (root_dir);
- fp = fopen (grouplist_file, "w");
- g_free (grouplist_file);
-
- if (fp == NULL) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Unable to save grouplist file for %s: %s"),
- CAMEL_SERVICE(group_list->store)->url->host,
- strerror(errno));
- return;
- }
-
- fprintf (fp, "%lu\n", (long)group_list->time);
-
- g_list_foreach (group_list->group_list, (GFunc)save_entry, fp);
-
- fclose (fp);
-}
-
-static void
-free_entry (CamelNNTPGroupListEntry *entry, void *data)
-{
- g_free (entry->group_name);
- g_free (entry);
-}
-
-void
-camel_nntp_grouplist_free (CamelNNTPGroupList *group_list)
-{
- g_return_if_fail (group_list);
-
- g_list_foreach (group_list->group_list, (GFunc)free_entry, NULL);
-
- g_free (group_list);
-}
-
-CamelNNTPGroupList*
-camel_nntp_grouplist_fetch (CamelNNTPStore *store, CamelException *ex)
-{
- CamelNNTPGroupList *list;
-
- list = camel_nntp_get_grouplist_from_file (store, ex);
-
- printf ("camel_nntp_get_grouplist_from_file returned %p\n", list);
-
- if (!list) {
- camel_exception_clear (ex);
-
- list = camel_nntp_get_grouplist_from_server (store, ex);
-
- if (!list) {
- camel_nntp_grouplist_free (list);
- }
- else {
- list->store = store;
- camel_nntp_grouplist_save (list, ex);
- return list;
- }
- }
-
- return list;
-}
-
-gint
-camel_nntp_grouplist_update (CamelNNTPGroupList *group_list, CamelException *ex)
-{
- return 0;
-}
diff --git a/camel/providers/nntp/camel-nntp-grouplist.h b/camel/providers/nntp/camel-nntp-grouplist.h
deleted file mode 100644
index 67c74d5dc2..0000000000
--- a/camel/providers/nntp/camel-nntp-grouplist.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-grouplist.h : getting/updating the list of newsgroups on the server. */
-
-/*
- * 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_GROUPLIST_H
-#define CAMEL_NNTP_GROUPLIST_H 1
-
-#include <time.h>
-#include "camel-nntp-store.h"
-
-struct CamelNNTPGroupListEntry {
- char *group_name;
- guint32 low;
- guint32 high;
- guint32 flags;
-};
-
-struct CamelNNTPGroupList {
- CamelNNTPStore *store;
- time_t time;
- GList *group_list;
-};
-
-CamelNNTPGroupList* camel_nntp_grouplist_fetch (CamelNNTPStore *store, CamelException *ex);
-gint camel_nntp_grouplist_update (CamelNNTPGroupList *group_list, CamelException *ex);
-void camel_nntp_grouplist_save (CamelNNTPGroupList *group_list, CamelException *ex);
-void camel_nntp_grouplist_free (CamelNNTPGroupList *group_list);
-
-#endif /* CAMEL_NNTP_GROUPLIST_H */
diff --git a/camel/providers/nntp/camel-nntp-newsrc.c b/camel/providers/nntp/camel-nntp-newsrc.c
deleted file mode 100644
index d0b56222cf..0000000000
--- a/camel/providers/nntp/camel-nntp-newsrc.c
+++ /dev/null
@@ -1,645 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-newsrc.c - .newsrc parsing/regurgitating code */
-/*
- *
- * 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 <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include "camel-nntp-newsrc.h"
-#include <camel/camel-folder-summary.h>
-
-#ifdef ENABLE_THREADS
-#include <pthread.h>
-
-#define NEWSRC_LOCK(f, l) (g_mutex_lock(((CamelNNTPNewsrc *)f)->l))
-#define NEWSRC_UNLOCK(f, l) (g_mutex_unlock(((CamelNNTPNewsrc *)f)->l))
-#else
-#define NEWSRC_LOCK(f, l)
-#define NEWSRC_UNLOCK(f, l)
-#endif
-
-typedef struct {
- guint low;
- guint high;
-} ArticleRange;
-
-typedef struct {
- char *name;
- GArray *ranges;
- gboolean subscribed;
-} NewsrcGroup;
-
-struct CamelNNTPNewsrc {
- gchar *filename;
- GHashTable *groups;
- gboolean dirty;
-#ifdef ENABLE_THREADS
- GMutex *lock;
-#endif
-} ;
-
-
-static NewsrcGroup *
-camel_nntp_newsrc_group_add (CamelNNTPNewsrc *newsrc, const char *group_name, gboolean subscribed)
-{
- NewsrcGroup *new_group = g_malloc(sizeof(NewsrcGroup));
-
- new_group->name = g_strdup(group_name);
- new_group->subscribed = subscribed;
- new_group->ranges = g_array_new (FALSE, FALSE, sizeof (ArticleRange));
-
- g_hash_table_insert (newsrc->groups, new_group->name, new_group);
-
- newsrc->dirty = TRUE;
-
- return new_group;
-}
-
-static int
-camel_nntp_newsrc_group_get_highest_article_read(CamelNNTPNewsrc *newsrc, NewsrcGroup *group)
-{
- if (!group || group->ranges->len == 0)
- return 0;
-
- return g_array_index(group->ranges, ArticleRange, group->ranges->len - 1).high;
-}
-
-static int
-camel_nntp_newsrc_group_get_num_articles_read(CamelNNTPNewsrc *newsrc, NewsrcGroup *group)
-{
- int i;
- int count = 0;
-
- if (group == NULL)
- return 0;
-
- for (i = 0; i < group->ranges->len; i ++)
- count += (g_array_index(group->ranges, ArticleRange, i).high -
- g_array_index(group->ranges, ArticleRange, i).low) + 1;
-
- return count;
-}
-
-
-static void
-camel_nntp_newsrc_group_mark_range_read(CamelNNTPNewsrc *newsrc, NewsrcGroup *group, long low, long high)
-{
- int i;
-
- if (group->ranges->len == 1
- && g_array_index (group->ranges, ArticleRange, 0).low == 0
- && g_array_index (group->ranges, ArticleRange, 0).high == 0) {
- g_array_index (group->ranges, ArticleRange, 0).low = low;
- g_array_index (group->ranges, ArticleRange, 0).high = high;
-
- newsrc->dirty = TRUE;
- }
- else {
- ArticleRange tmp_range;
-
- for (i = 0; i < group->ranges->len; i ++) {
- guint range_low = g_array_index (group->ranges, ArticleRange, i).low;
- guint range_high = g_array_index (group->ranges, ArticleRange, i).high;
-
- /* if it's already part of a range, return immediately. */
- if (low >= range_low &&
- low <= range_high &&
- high >= range_low &&
- high <= range_high) {
- return;
- }
- /* if we have a new lower bound for this range, set it. */
- else if (low <= range_low
- && high >= range_low
- && high <= range_high) {
- g_array_index (group->ranges, ArticleRange, i).low = low;
- newsrc->dirty = TRUE;
- return;
- }
- /* if we have a new upper bound for this range, set it. */
- else if (high >= range_high
- && low >= range_low
- && low <= range_high) {
- g_array_index (group->ranges, ArticleRange, i).high = high;
- newsrc->dirty = TRUE;
- return;
- }
- /* if we would be inserting another range that
- starts one index higher than an existing
- one, make the upper value of the existing
- range the upper value of the new one. */
- else if (low == range_high + 1) {
- g_array_index (group->ranges, ArticleRange, i).high = high;
- newsrc->dirty = TRUE;
- return;
- }
- /* if we would be inserting another range that
- ends one index lower than an existing one,
- group the existing range by setting its low
- to the new low */
- else if (high == range_low - 1) {
- g_array_index (group->ranges, ArticleRange, i).low = low;
- newsrc->dirty = TRUE;
- return;
- }
- /* if the range lies entirely outside another
- range, doesn't coincide with it's
- endpoints, and has lower values, insert it
- into the middle of the list. */
- else if (low < range_low
- && high < range_low) {
- tmp_range.low = low;
- tmp_range.high = high;
-
- group->ranges = g_array_insert_val (group->ranges, i, tmp_range);
- newsrc->dirty = TRUE;
-
- return;
- }
- }
-
- /* if we made it here, the range needs to go at the end */
- tmp_range.low = low;
- tmp_range.high = high;
- group->ranges = g_array_append_val (group->ranges, tmp_range);
- newsrc->dirty = TRUE;
- }
-}
-
-int
-camel_nntp_newsrc_get_highest_article_read (CamelNNTPNewsrc *newsrc, const char *group_name)
-{
- NewsrcGroup *group;
- int ret;
-
- NEWSRC_LOCK(newsrc, lock);
-
- group = g_hash_table_lookup (newsrc->groups, group_name);
- ret = camel_nntp_newsrc_group_get_highest_article_read (newsrc, group);
-
- NEWSRC_UNLOCK(newsrc, lock);
-
- return ret;
-}
-
-int
-camel_nntp_newsrc_get_num_articles_read (CamelNNTPNewsrc *newsrc, const char *group_name)
-{
- NewsrcGroup *group;
- int ret;
-
- NEWSRC_LOCK(newsrc, lock);
-
- group = g_hash_table_lookup (newsrc->groups, group_name);
- ret = camel_nntp_newsrc_group_get_num_articles_read (newsrc, group);
-
- NEWSRC_UNLOCK(newsrc, lock);
-
- return ret;
-}
-
-void
-camel_nntp_newsrc_mark_article_read (CamelNNTPNewsrc *newsrc, const char *group_name, int num)
-{
- NEWSRC_LOCK(newsrc, lock);
- camel_nntp_newsrc_mark_range_read (newsrc, group_name, num, num);
- NEWSRC_UNLOCK(newsrc, lock);
-}
-
-void
-camel_nntp_newsrc_mark_range_read(CamelNNTPNewsrc *newsrc, const char *group_name, long low, long high)
-{
- NewsrcGroup *group;
-
- /* swap them if they're in the wrong order. */
- if (low > high) {
- long tmp;
-
- tmp = high;
- high = low;
- low = tmp;
- }
-
- NEWSRC_LOCK(newsrc, lock);
- group = g_hash_table_lookup (newsrc->groups, group_name);
-
- camel_nntp_newsrc_group_mark_range_read (newsrc, group, low, high);
- NEWSRC_UNLOCK(newsrc, lock);
-}
-
-gboolean
-camel_nntp_newsrc_article_is_read (CamelNNTPNewsrc *newsrc, const char *group_name, long num)
-{
- int i;
- NewsrcGroup *group;
- int ret = FALSE;
-
- NEWSRC_LOCK(newsrc, lock);
- group = g_hash_table_lookup (newsrc->groups, group_name);
-
- for (i = 0; i < group->ranges->len; i++) {
- if (num >= g_array_index (group->ranges, ArticleRange, i).low &&
- num <= g_array_index (group->ranges, ArticleRange, i).high) {
- ret = TRUE;
- break;
- }
- }
-
- NEWSRC_UNLOCK(newsrc, lock);
-
- return FALSE;
-}
-
-gboolean
-camel_nntp_newsrc_group_is_subscribed (CamelNNTPNewsrc *newsrc, const char *group_name)
-{
- NewsrcGroup *group;
- int ret = FALSE;
-
- NEWSRC_LOCK(newsrc, lock);
-
- group = g_hash_table_lookup (newsrc->groups, group_name);
-
- if (group) {
- ret = group->subscribed;
- }
-
- NEWSRC_UNLOCK(newsrc, lock);
-
- return ret;
-}
-
-void
-camel_nntp_newsrc_subscribe_group (CamelNNTPNewsrc *newsrc, const char *group_name)
-{
- NewsrcGroup *group;
-
- NEWSRC_LOCK(newsrc, lock);
-
- group = g_hash_table_lookup (newsrc->groups, group_name);
-
- if (group) {
- if (!group->subscribed)
- newsrc->dirty = TRUE;
- group->subscribed = TRUE;
- }
- else {
- camel_nntp_newsrc_group_add (newsrc, group_name, TRUE);
- }
-
- NEWSRC_UNLOCK(newsrc, lock);
-}
-
-void
-camel_nntp_newsrc_unsubscribe_group (CamelNNTPNewsrc *newsrc, const char *group_name)
-{
- NewsrcGroup *group;
-
- NEWSRC_LOCK(newsrc, lock);
-
- group = g_hash_table_lookup (newsrc->groups, group_name);
- if (group) {
- if (group->subscribed)
- newsrc->dirty = TRUE;
- group->subscribed = FALSE;
- }
- else {
- camel_nntp_newsrc_group_add (newsrc, group_name, FALSE);
- }
-
- NEWSRC_UNLOCK(newsrc, lock);
-}
-
-struct newsrc_ptr_array {
- GPtrArray *ptr_array;
- gboolean subscribed_only;
-};
-
-/* this needs to strdup the grup_name, if the group array is likely to change */
-static void
-get_group_foreach (char *group_name, NewsrcGroup *group, struct newsrc_ptr_array *npa)
-{
- if (group->subscribed || !npa->subscribed_only) {
- g_ptr_array_add (npa->ptr_array, group_name);
- }
-}
-
-GPtrArray *
-camel_nntp_newsrc_get_subscribed_group_names (CamelNNTPNewsrc *newsrc)
-{
- struct newsrc_ptr_array npa;
-
- g_return_val_if_fail (newsrc, NULL);
-
- NEWSRC_LOCK(newsrc, lock);
-
- npa.ptr_array = g_ptr_array_new();
- npa.subscribed_only = TRUE;
-
- g_hash_table_foreach (newsrc->groups,
- (GHFunc)get_group_foreach, &npa);
-
- NEWSRC_UNLOCK(newsrc, lock);
-
- return npa.ptr_array;
-}
-
-GPtrArray *
-camel_nntp_newsrc_get_all_group_names (CamelNNTPNewsrc *newsrc)
-{
- struct newsrc_ptr_array npa;
-
- g_return_val_if_fail (newsrc, NULL);
-
- NEWSRC_LOCK(newsrc, lock);
-
- npa.ptr_array = g_ptr_array_new();
- npa.subscribed_only = FALSE;
-
- g_hash_table_foreach (newsrc->groups,
- (GHFunc)get_group_foreach, &npa);
-
- NEWSRC_UNLOCK(newsrc, lock);
-
- return npa.ptr_array;
-}
-
-void
-camel_nntp_newsrc_free_group_names (CamelNNTPNewsrc *newsrc, GPtrArray *group_names)
-{
- g_ptr_array_free (group_names, TRUE);
-}
-
-struct newsrc_fp {
- CamelNNTPNewsrc *newsrc;
- FILE *fp;
-};
-
-static void
-camel_nntp_newsrc_write_group_line(gpointer key, NewsrcGroup *group, struct newsrc_fp *newsrc_fp)
-{
- CamelNNTPNewsrc *newsrc;
- FILE *fp;
- int i;
-
- fp = newsrc_fp->fp;
- newsrc = newsrc_fp->newsrc;
-
- fprintf (fp, "%s%c", group->name, group->subscribed ? ':' : '!');
-
- if (group->ranges->len == 1
- && g_array_index (group->ranges, ArticleRange, 0).low == 0
- && g_array_index (group->ranges, ArticleRange, 0).high == 0) {
- fprintf (fp, "\n");
-
- return; /* special case since our parsing code will insert this
- bogus range if there were no read articles. The code
- to add a range is smart enough to remove this one if we
- ever mark an article read, but we still need to deal with
- it if that code doesn't get hit. */
- }
-
- fprintf (fp, " ");
-
- for (i = 0; i < group->ranges->len; i ++) {
- char range_buffer[100];
- guint low = g_array_index (group->ranges, ArticleRange, i).low;
- guint high = g_array_index (group->ranges, ArticleRange, i).high;
-
- if (low == high)
- sprintf(range_buffer, "%d", low);
- else if (low == high - 1)
- sprintf(range_buffer, "%d,%d", low, high);
- else
- sprintf(range_buffer, "%d-%d", low, high);
-
- if (i != group->ranges->len - 1)
- strcat(range_buffer, ",");
-
- fprintf (fp, range_buffer);
- }
-
- fprintf (fp, "\n");
-}
-
-void
-camel_nntp_newsrc_write_to_file(CamelNNTPNewsrc *newsrc, FILE *fp)
-{
- struct newsrc_fp newsrc_fp;
-
- g_return_if_fail (newsrc);
-
- newsrc_fp.newsrc = newsrc;
- newsrc_fp.fp = fp;
-
- NEWSRC_LOCK(newsrc, lock);
-
- g_hash_table_foreach (newsrc->groups,
- (GHFunc)camel_nntp_newsrc_write_group_line,
- &newsrc_fp);
-
- NEWSRC_UNLOCK(newsrc, lock);
-}
-
-void
-camel_nntp_newsrc_write(CamelNNTPNewsrc *newsrc)
-{
- FILE *fp;
-
- g_return_if_fail (newsrc);
-
- NEWSRC_LOCK(newsrc, lock);
-
- if (!newsrc->dirty)
- return;
-
- if ((fp = fopen(newsrc->filename, "w")) == NULL) {
- g_warning ("Couldn't open newsrc file '%s'.\n", newsrc->filename);
- NEWSRC_UNLOCK(newsrc, lock);
- return;
- }
-
- newsrc->dirty = FALSE;
- NEWSRC_UNLOCK(newsrc, lock);
-
- camel_nntp_newsrc_write_to_file(newsrc, fp);
-
- fclose(fp);
-}
-
-static void
-camel_nntp_newsrc_parse_line(CamelNNTPNewsrc *newsrc, char *line)
-{
- char *p, *comma, *dash;
- gboolean is_subscribed;
- NewsrcGroup *group;
-
- p = strchr(line, ':');
-
- if (p) {
- is_subscribed = TRUE;
- }
- else {
- p = strchr(line, '!');
- if (p)
- is_subscribed = FALSE;
- else
- return; /* bogus line. */
- }
-
- *p++ = '\0';
-
- group = camel_nntp_newsrc_group_add (newsrc, line, is_subscribed);
-
- do {
- guint high, low;
-
- comma = strchr(p, ',');
-
- if (comma)
- *comma = '\0';
-
- dash = strchr(p, '-');
-
- if (!dash) { /* there wasn't a dash. must be just one number */
- high = low = atol(p);
- }
- else { /* there was a dash. */
- *dash = '\0';
- low = atol(p);
- *dash = '-';
- p = dash + 1;
- high = atol(p);
- }
-
- camel_nntp_newsrc_group_mark_range_read (newsrc, group, low, high);
-
- if (comma) {
- *comma = ',';
- p = comma + 1;
- }
-
- } while(comma);
-}
-
-static char*
-get_line (char *buf, char **p)
-{
- char *l;
- char *line;
-
- g_assert (*p == NULL || **p == '\n' || **p == '\0');
-
- if (*p == NULL) {
- *p = buf;
-
- if (**p == '\0')
- return NULL;
- }
- else {
- if (**p == '\0')
- return NULL;
-
- (*p) ++;
-
- /* if we just incremented to the end of the buffer, return NULL */
- if (**p == '\0')
- return NULL;
- }
-
- l = strchr (*p, '\n');
- if (l) {
- *l = '\0';
- line = g_strdup (*p);
- *l = '\n';
- *p = l;
- }
- else {
- /* we're at the last line (which isn't terminated by a \n, btw) */
- line = g_strdup (*p);
- (*p) += strlen (*p);
- }
-
- return line;
-}
-
-CamelNNTPNewsrc *
-camel_nntp_newsrc_read_for_server (const char *server)
-{
- int fd;
- char buf[1024];
- char *file_contents, *line, *p;
- char *filename;
- CamelNNTPNewsrc *newsrc;
- int newsrc_len;
- int len_read = 0;
- struct stat sb;
-
- filename = g_strdup_printf ("%s/.newsrc-%s", g_get_home_dir(), server);
-
- newsrc = g_new0(CamelNNTPNewsrc, 1);
- newsrc->filename = filename;
- newsrc->groups = g_hash_table_new (g_str_hash, g_str_equal);
-#ifdef ENABLE_THREADS
- newsrc->lock = g_mutex_new();
-#endif
-
- if ((fd = open(filename, O_RDONLY)) == -1) {
- g_warning ("~/.newsrc-%s not present.\n", server);
- return newsrc;
- }
-
- if (fstat (fd, &sb) == -1) {
- g_warning ("failed fstat on ~/.newsrc-%s: %s\n", server, strerror(errno));
- return newsrc;
- }
- newsrc_len = sb.st_size;
-
- file_contents = g_malloc (newsrc_len + 1);
-
- while (len_read < newsrc_len) {
- int c = read (fd, buf, sizeof (buf));
-
- if (c == -1)
- break;
-
- memcpy (&file_contents[len_read], buf, c);
- len_read += c;
- }
- file_contents [len_read] = 0;
-
- p = NULL;
- while ((line = get_line (file_contents, &p))) {
- camel_nntp_newsrc_parse_line(newsrc, line);
- g_free (line);
- }
-
- close (fd);
- g_free (file_contents);
-
- return newsrc;
-}
diff --git a/camel/providers/nntp/camel-nntp-newsrc.h b/camel/providers/nntp/camel-nntp-newsrc.h
deleted file mode 100644
index 652e3edbce..0000000000
--- a/camel/providers/nntp/camel-nntp-newsrc.h
+++ /dev/null
@@ -1,34 +0,0 @@
-
-#ifndef _CAMEL_NNTP_NEWSRC_H_
-#define _CAMEL_NNTP_NEWSRC_H_
-
-#include <stdio.h>
-#include "glib.h"
-
-typedef struct CamelNNTPNewsrc CamelNNTPNewsrc;
-
-int camel_nntp_newsrc_get_highest_article_read (CamelNNTPNewsrc *newsrc, const char *group_name);
-int camel_nntp_newsrc_get_num_articles_read (CamelNNTPNewsrc *newsrc, const char *group_name);
-void camel_nntp_newsrc_mark_article_read (CamelNNTPNewsrc *newsrc,
- const char *group_name, int num);
-void camel_nntp_newsrc_mark_range_read (CamelNNTPNewsrc *newsrc,
- const char *group_name, long low, long high);
-
-gboolean camel_nntp_newsrc_article_is_read (CamelNNTPNewsrc *newsrc,
- const char *group_name, long num);
-
-gboolean camel_nntp_newsrc_group_is_subscribed (CamelNNTPNewsrc *newsrc, const char *group_name);
-void camel_nntp_newsrc_subscribe_group (CamelNNTPNewsrc *newsrc, const char *group_name);
-void camel_nntp_newsrc_unsubscribe_group (CamelNNTPNewsrc *newsrc, const char *group_name);
-
-GPtrArray* camel_nntp_newsrc_get_subscribed_group_names (CamelNNTPNewsrc *newsrc);
-GPtrArray* camel_nntp_newsrc_get_all_group_names (CamelNNTPNewsrc *newsrc);
-void camel_nntp_newsrc_free_group_names (CamelNNTPNewsrc *newsrc, GPtrArray *group_names);
-
-void camel_nntp_newsrc_write_to_file (CamelNNTPNewsrc *newsrc, FILE *fp);
-void camel_nntp_newsrc_write (CamelNNTPNewsrc *newsrc);
-CamelNNTPNewsrc *camel_nntp_newsrc_read_for_server (const char *server);
-
-#endif /* _CAMEL_NNTP_NEWSRC_H_ */
-
-
diff --git a/camel/providers/nntp/camel-nntp-provider.c b/camel/providers/nntp/camel-nntp-provider.c
deleted file mode 100644
index 76ac521ec6..0000000000
--- a/camel/providers/nntp/camel-nntp-provider.c
+++ /dev/null
@@ -1,110 +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 void add_hash (guint *hash, char *s);
-static guint nntp_url_hash (gconstpointer key);
-static gint check_equal (char *s1, char *s2);
-static gint nntp_url_equal (gconstpointer a, gconstpointer b);
-
-static CamelProvider news_provider = {
- "nntp",
- N_("USENET news"),
-
- N_("This is a provider for reading from and posting to"
- "USENET newsgroups."),
-
- "news",
-
- CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_STORAGE,
-
- CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_USER |
- CAMEL_URL_ALLOW_PASSWORD | CAMEL_URL_ALLOW_AUTH,
-
- { 0, 0 },
-
- NULL
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- news_provider.object_types[CAMEL_PROVIDER_STORE] =
- camel_nntp_store_get_type();
-
- news_provider.service_cache = g_hash_table_new (nntp_url_hash, nntp_url_equal);
-
- camel_session_register_provider (session, &news_provider);
-}
-
-static void
-add_hash (guint *hash, char *s)
-{
- if (s)
- *hash ^= g_str_hash(s);
-}
-
-static guint
-nntp_url_hash (gconstpointer key)
-{
- const CamelURL *u = (CamelURL *)key;
- guint hash = 0;
-
- add_hash (&hash, u->user);
- add_hash (&hash, u->host);
- hash ^= u->port;
-
- return hash;
-}
-
-static gint
-check_equal (char *s1, char *s2)
-{
- if (s1 == NULL) {
- if (s2 == NULL)
- return TRUE;
- else
- return FALSE;
- }
-
- if (s2 == NULL)
- return FALSE;
-
- return strcmp (s1, s2) == 0;
-}
-
-static gint
-nntp_url_equal (gconstpointer a, gconstpointer b)
-{
- const CamelURL *u1 = a, *u2 = b;
-
- return check_equal (u1->user, u2->user)
- && check_equal (u1->host, u2->host)
- && u1->port == u2->port;
-}
diff --git a/camel/providers/nntp/camel-nntp-resp-codes.h b/camel/providers/nntp/camel-nntp-resp-codes.h
deleted file mode 100644
index 8b9dc8ff6c..0000000000
--- a/camel/providers/nntp/camel-nntp-resp-codes.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-resp-codes.h : #defines for all the response codes we care about */
-
-/*
- *
- * 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_RESP_CODES_H
-#define CAMEL_NNTP_RESP_CODES_H 1
-
-#define CAMEL_NNTP_OK(x) ((x) < 400)
-#define CAMEL_NNTP_ERR(x) (!CAMEL_NNTP_OK(x) && (x) < 500)
-#define CAMEL_NNTP_FAIL(x) (!CAMEL_NNTP_OK(x) && !CAMEL_NNTP_ERR(x))
-
-#define NNTP_GREETING_POSTING_OK 200
-#define NNTP_GREETING_NO_POSTING 201
-
-#define NNTP_GROUP_SELECTED 211
-#define NNTP_LIST_FOLLOWS 215
-#define NNTP_ARTICLE_FOLLOWS 220
-#define NNTP_HEAD_FOLLOWS 221
-#define NNTP_DATA_FOLLOWS 224
-#define NNTP_NEW_ARTICLE_LIST_FOLLOWS 230
-#define NNTP_NEW_GROUP_LIST_FOLLOWS 231
-
-#define NNTP_NO_SUCH_GROUP 411
-#define NNTP_NO_SUCH_ARTICLE 430
-
-/* authentication */
-#define NNTP_AUTH_ACCEPTED 281
-#define NNTP_AUTH_CONTINUE 381
-#define NNTP_AUTH_REQUIRED 480
-#define NNTP_AUTH_REJECTED 482
-
-#define NNTP_PROTOCOL_ERROR 666
-
-#endif /* CAMEL_NNTP_RESP_CODES_H */
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
deleted file mode 100644
index c1e8fb81e8..0000000000
--- a/camel/providers/nntp/camel-nntp-store.c
+++ /dev/null
@@ -1,852 +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 <dirent.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "libgnome/libgnome.h"
-
-#include "camel-nntp-resp-codes.h"
-#include "camel-folder-summary.h"
-#include "camel-nntp-store.h"
-#include "camel-nntp-grouplist.h"
-#include "camel-nntp-folder.h"
-#include "camel-nntp-auth.h"
-#include "camel-exception.h"
-#include "camel-url.h"
-#include "string-utils.h"
-
-#include <gal/util/e-util.h>
-
-#define NNTP_PORT 119
-
-#define DUMP_EXTENSIONS
-
-/* define if you want the subscribe ui to show folders in tree form */
-/* #define INFO_AS_TREE */
-
-static CamelRemoteStoreClass *remote_store_class = NULL;
-
-static CamelServiceClass *service_class = NULL;
-
-/* Returns the class for a CamelNNTPStore */
-#define CNNTPS_CLASS(so) CAMEL_NNTP_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-#define CNNTPF_CLASS(so) CAMEL_NNTP_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-
-static gboolean ensure_news_dir_exists (CamelNNTPStore *store);
-
-static void
-camel_nntp_store_get_extensions (CamelNNTPStore *store, CamelException *ex)
-{
- store->extensions = 0;
-
- if (camel_nntp_command (store, ex, NULL, "LIST EXTENSIONS") == NNTP_LIST_FOLLOWS) {
- gboolean done = FALSE;
- CamelException ex;
-
- camel_exception_init (&ex);
-
- while (!done) {
- char *line;
-
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store), &line, &ex) < 0)
- break; /* XXX */
-
- if (*line == '.') {
- done = TRUE;
- }
- else {
-#define CHECK_EXT(name,val) if (!strcasecmp (line, (name))) store->extensions |= (val)
-
- CHECK_EXT ("SEARCH", CAMEL_NNTP_EXT_SEARCH);
- CHECK_EXT ("SETGET", CAMEL_NNTP_EXT_SETGET);
- CHECK_EXT ("OVER", CAMEL_NNTP_EXT_OVER);
- CHECK_EXT ("XPATTEXT", CAMEL_NNTP_EXT_XPATTEXT);
- CHECK_EXT ("XACTIVE", CAMEL_NNTP_EXT_XACTIVE);
- CHECK_EXT ("LISTMOTD", CAMEL_NNTP_EXT_LISTMOTD);
- CHECK_EXT ("LISTSUBSCR", CAMEL_NNTP_EXT_LISTSUBSCR);
- CHECK_EXT ("LISTPNAMES", CAMEL_NNTP_EXT_LISTPNAMES);
-
-#undef CHECK_EXT
- }
-
- g_free (line);
- }
- }
-
-#ifdef DUMP_EXTENSIONS
- g_print ("NNTP Extensions:");
-#define DUMP_EXT(name,val) if (store->extensions & (val)) g_print (" %s", name);
- DUMP_EXT ("SEARCH", CAMEL_NNTP_EXT_SEARCH);
- DUMP_EXT ("SETGET", CAMEL_NNTP_EXT_SETGET);
- DUMP_EXT ("OVER", CAMEL_NNTP_EXT_OVER);
- DUMP_EXT ("XPATTEXT", CAMEL_NNTP_EXT_XPATTEXT);
- DUMP_EXT ("XACTIVE", CAMEL_NNTP_EXT_XACTIVE);
- DUMP_EXT ("LISTMOTD", CAMEL_NNTP_EXT_LISTMOTD);
- DUMP_EXT ("LISTSUBSCR", CAMEL_NNTP_EXT_LISTSUBSCR);
- DUMP_EXT ("LISTPNAMES", CAMEL_NNTP_EXT_LISTPNAMES);
- g_print ("\n");
-#undef DUMP_EXT
-#endif
-}
-
-static void
-camel_nntp_store_get_overview_fmt (CamelNNTPStore *store, CamelException *ex)
-{
- int status;
- int i;
- gboolean done = FALSE;
-
- status = camel_nntp_command (store, ex, NULL,
- "LIST OVERVIEW.FMT");
-
- if (status != NNTP_LIST_FOLLOWS) {
- if (store->extensions & CAMEL_NNTP_EXT_OVER) {
- /* if we can't get the overview format, we should
- disable OVER support */
- g_warning ("server reported support of OVER but LIST OVERVIEW.FMT failed."
- " disabling OVER.\n");
- store->extensions &= ~CAMEL_NNTP_EXT_OVER;
- return;
- }
- }
- else {
- if (!(store->extensions & CAMEL_NNTP_EXT_OVER)) {
- g_warning ("server didn't report support of OVER but LIST OVERVIEW.FMT worked."
- " enabling OVER.\n");
- store->extensions |= CAMEL_NNTP_EXT_OVER;
- }
- }
-
- /* start at 1 because the article number is always first */
- store->num_overview_fields = 1;
-
- for (i = 0; i < CAMEL_NNTP_OVER_LAST; i ++) {
- store->overview_field [i].index = -1;
- }
-
- while (!done) {
- char *line;
-
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store), &line, ex) < 0)
- break; /* XXX */
-
- if (*line == '.') {
- done = TRUE;
- }
- else {
- CamelNNTPOverField *over_field = NULL;
- char *colon = NULL;;
-
- if (!strncasecmp (line, "From:", 5)) {
- over_field = &store->overview_field [ CAMEL_NNTP_OVER_FROM ];
- over_field->index = store->num_overview_fields;
- colon = line + 5;
- }
- else if (!strncasecmp (line, "Subject:", 7)) {
- over_field = &store->overview_field [ CAMEL_NNTP_OVER_SUBJECT ];
- over_field->index = store->num_overview_fields;
- colon = line + 7;
- }
- else if (!strncasecmp (line, "Date:", 5)) {
- over_field = &store->overview_field [ CAMEL_NNTP_OVER_DATE ];
- over_field->index = store->num_overview_fields;
- colon = line + 5;
- }
- else if (!strncasecmp (line, "Message-ID:", 11)) {
- over_field = &store->overview_field [ CAMEL_NNTP_OVER_MESSAGE_ID ];
- over_field->index = store->num_overview_fields;
- colon = line + 11;
- }
- else if (!strncasecmp (line, "References:", 11)) {
- over_field = &store->overview_field [ CAMEL_NNTP_OVER_REFERENCES ];
- over_field->index = store->num_overview_fields;
- colon = line + 11;
- }
- else if (!strncasecmp (line, "Bytes:", 6)) {
- over_field = &store->overview_field [ CAMEL_NNTP_OVER_BYTES ];
- over_field->index = store->num_overview_fields;
- colon = line + 11;
- }
-
- if (colon && !strncmp (colon + 1, "full", 4))
- over_field->full = TRUE;
-
- store->num_overview_fields ++;
- }
-
- g_free (line);
- }
-
- for (i = 0; i < CAMEL_NNTP_OVER_LAST; i ++) {
- if (store->overview_field [i].index == -1) {
- g_warning ("server's OVERVIEW.FMT doesn't support minimum set we require,"
- " disabling OVER support.\n");
- store->extensions &= ~CAMEL_NNTP_EXT_OVER;
- }
- }
-}
-
-static gboolean
-nntp_store_connect (CamelService *service, CamelException *ex)
-{
- char *buf;
- int resp_code;
- CamelNNTPStore *store = CAMEL_NNTP_STORE (service);
-
- if (!ensure_news_dir_exists(store)) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not open directory for news server: %s"),
- strerror (errno));
- return FALSE;
- }
-
- if (CAMEL_SERVICE_CLASS (remote_store_class)->connect (service, ex) == FALSE)
- return FALSE;
-
- /* Read the greeting */
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (service), &buf, ex) < 0) {
- return FALSE;
- }
-
- /* check if posting is allowed. */
- resp_code = atoi (buf);
- if (resp_code == NNTP_GREETING_POSTING_OK) {
- g_print ("posting allowed\n");
- store->posting_allowed = TRUE;
- }
- else if (resp_code == NNTP_GREETING_NO_POSTING) {
- g_print ("no posting allowed\n");
- store->posting_allowed = FALSE;
- }
- else {
- g_warning ("unexpected server greeting code %d, no posting allowed\n", resp_code);
- store->posting_allowed = FALSE;
- }
-
- g_free (buf);
-
- /* get a list of extensions that the server supports */
- camel_nntp_store_get_extensions (store, ex);
-
- /* try to get the overview.fmt */
- camel_nntp_store_get_overview_fmt (store, ex);
-
- return TRUE;
-}
-
-static gboolean
-nntp_store_disconnect (CamelService *service, gboolean clean, CamelException *ex)
-{
- CamelNNTPStore *store = CAMEL_NNTP_STORE (service);
-
- if (clean)
- camel_nntp_command (store, ex, NULL, "QUIT");
-
- if (store->newsrc)
- camel_nntp_newsrc_write (store->newsrc);
-
- if (!service_class->disconnect (service, clean, ex))
- return FALSE;
-
- return TRUE;
-}
-
-static char *
-nntp_store_get_name (CamelService *service, gboolean brief)
-{
- if (brief)
- return g_strdup_printf ("%s", service->url->host);
- else
- return g_strdup_printf (_("USENET News via %s"), service->url->host);
-
-}
-
-static CamelServiceAuthType password_authtype = {
- N_("Password"),
-
- N_("This option will authenticate with the NNTP server using a "
- "plaintext password."),
-
- "",
- TRUE
-};
-
-static GList *
-nntp_store_query_auth_types (CamelService *service, gboolean connect, CamelException *ex)
-{
- GList *prev;
-
- g_warning ("nntp::query_auth_types: not implemented. Defaulting.");
- prev = CAMEL_SERVICE_CLASS (remote_store_class)->query_auth_types (service, connect, ex);
- return g_list_prepend (prev, &password_authtype);
-}
-
-static CamelFolder *
-nntp_store_get_folder (CamelStore *store, const gchar *folder_name,
- guint32 flags, CamelException *ex)
-{
- CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (store);
-
- printf ("get_folder called on folder_name=%s\n", folder_name);
-
- /* if we haven't already read our .newsrc, read it now */
- if (!nntp_store->newsrc)
- nntp_store->newsrc =
- camel_nntp_newsrc_read_for_server (CAMEL_SERVICE(store)->url->host);
-
- if (!nntp_store->newsrc) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Unable to open or create .newsrc file for %s: %s"),
- CAMEL_SERVICE(store)->url->host,
- strerror(errno));
- return NULL;
- }
-
- return camel_nntp_folder_new (store, folder_name, ex);
-}
-
-#ifdef INFO_AS_TREE
-static void
-build_folder_info (CamelNNTPStore *nntp_store, CamelFolderInfo **root,
- CamelFolderInfo *parent, CamelNNTPGroupListEntry *entry,
- char *prefix, char *suffix,
- GHashTable *name_to_info)
-{
- CamelURL *url = CAMEL_SERVICE (nntp_store)->url;
- char *dot;
- if ((dot = strchr (suffix, '.'))) {
- /* it's an internal node, figure out the next node in
- the chain */
- CamelFolderInfo *node;
- char *node_name, *node_full_name;
-
- node_name = g_malloc0 (dot - suffix + 1);
- strncpy (node_name, suffix, dot - suffix);
- node_full_name = g_strdup_printf ("%s.%s", prefix, node_name);
-
- node = g_hash_table_lookup (name_to_info, node_full_name);
- if (!node) {
- /* we need to add one */
- node = g_new0 (CamelFolderInfo, 1);
- node->name = g_strdup (node_name);
- node->full_name = g_strdup (node_full_name);
- node->url = NULL;
- node->unread_message_count = -1;
-
- if (parent) {
- if (parent->child) {
- node->sibling = parent->child;
- parent->child = node;
- }
- else {
- parent->child = node;
- }
- }
- else {
- if (*root) {
- *root = node;
- }
- else {
- node->sibling = *root;
- *root = node;
- }
- }
-
- g_hash_table_insert (name_to_info, node_full_name, node);
- }
-
- build_folder_info (nntp_store, root, node, entry, node_full_name, dot + 1, name_to_info);
- }
- else {
- /* it's a leaf node, make the CamelFolderInfo and
- append it to @parent's list of children. */
- CamelFolderInfo *new_group;
-
- new_group = g_new0 (CamelFolderInfo, 1);
- new_group->name = g_strdup (entry->group_name);
- new_group->full_name = g_strdup (entry->group_name);
- new_group->url = g_strdup_printf ("nntp://%s%s%s/%s",
- url->user ? url->user : "",
- url->user ? "@" : "",
- url->host, (char *)entry->group_name);
-
- new_group->unread_message_count = (entry->high - entry->low -
- camel_nntp_newsrc_get_num_articles_read (nntp_store->newsrc, entry->group_name));
-
- if (parent) {
- if (parent->child) {
- new_group->sibling = parent->child;
- parent->child = new_group;
- }
- else {
- parent->child = new_group;
- }
- }
- else {
- if (*root) {
- *root = new_group;
- }
- else {
- new_group->sibling = *root;
- *root = new_group;
- }
- }
- }
-}
-#endif
-
-static CamelFolderInfo *
-build_folder_info_from_grouplist (CamelNNTPStore *nntp_store, const char *top)
-{
- GList *g;
- CamelFolderInfo *groups = NULL;
-#ifdef INFO_AS_TREE
- GHashTable *hash = g_hash_table_new (g_str_hash, g_str_equal);
-#else
- CamelFolderInfo *last = NULL, *fi;
- CamelURL *url = CAMEL_SERVICE (nntp_store)->url;
-#endif
-
- for (g = nntp_store->group_list->group_list; g; g = g_list_next (g)) {
- CamelNNTPGroupListEntry *entry = g->data;
-
- if (!top || !strncmp (top, entry->group_name, strlen (top))) {
-#ifdef INFO_AS_TREE
- build_folder_info (nntp_store, &groups, NULL, entry,
- "", entry->group_name, hash);
-#else
-
- fi = g_new0 (CamelFolderInfo, 1);
- fi->name = g_strdup (entry->group_name);
- fi->full_name = g_strdup (entry->group_name);
- fi->url = g_strdup_printf ("nntp://%s%s%s/%s",
- url->user ? url->user : "",
- url->user ? "@" : "",
- url->host, (char *)entry->group_name);
-
- fi->unread_message_count = (entry->high - entry->low -
- camel_nntp_newsrc_get_num_articles_read (
- nntp_store->newsrc, entry->group_name));
-
- if (last)
- last->sibling = fi;
- else
- groups = fi;
- last = fi;
-#endif
- }
- }
-
- return groups;
-}
-
-static CamelFolderInfo *
-nntp_store_get_folder_info (CamelStore *store, const char *top,
- gboolean fast, gboolean recursive,
- gboolean subscribed_only,
- CamelException *ex)
-{
- CamelURL *url = CAMEL_SERVICE (store)->url;
- CamelNNTPStore *nntp_store = (CamelNNTPStore *)store;
- GPtrArray *names;
- CamelFolderInfo *groups = NULL, *last = NULL, *fi;
- int i;
-
- /* if we haven't already read our .newsrc, read it now */
- if (!nntp_store->newsrc)
- nntp_store->newsrc =
- camel_nntp_newsrc_read_for_server (CAMEL_SERVICE(store)->url->host);
-
- if (!nntp_store->newsrc) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Unable to open or create .newsrc file for %s: %s"),
- CAMEL_SERVICE(store)->url->host,
- strerror(errno));
- return NULL;
- }
-
- if (!subscribed_only) {
- if (!nntp_store->group_list)
- nntp_store->group_list = camel_nntp_grouplist_fetch (nntp_store, ex);
- if (camel_exception_is_set (ex)) {
- return NULL;
- }
- else {
- fi = build_folder_info_from_grouplist (nntp_store, top);
- return fi;
- }
- }
-
- if (top == NULL) {
- /* return the list of groups */
- names = camel_nntp_newsrc_get_subscribed_group_names (nntp_store->newsrc);
- for (i = 0; i < names->len; i++) {
- fi = g_new0 (CamelFolderInfo, 1);
- fi->name = g_strdup (names->pdata[i]);
- fi->full_name = g_strdup (names->pdata[i]);
- fi->url = g_strdup_printf ("nntp://%s%s%s/%s",
- url->user ? url->user : "",
- url->user ? "@" : "",
- url->host, (char *)names->pdata[i]);
- /* FIXME */
- fi->unread_message_count = -1;
-
- if (last)
- last->sibling = fi;
- else
- groups = fi;
- last = fi;
- }
- camel_nntp_newsrc_free_group_names (nntp_store->newsrc, names);
-
- return groups;
- }
- else {
- /* getting a specific group */
-
- fi = g_new0 (CamelFolderInfo, 1);
- fi->name = g_strdup (top);
- fi->full_name = g_strdup (top);
- fi->url = g_strdup_printf ("nntp://%s/%s", url->host, top);
- /* FIXME */
- fi->unread_message_count = -1;
-
- return fi;
- }
-}
-
-static gboolean
-nntp_store_folder_subscribed (CamelStore *store, const char *folder_name)
-{
- CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (store);
-
- return camel_nntp_newsrc_group_is_subscribed (nntp_store->newsrc, folder_name);
-}
-
-static void
-nntp_store_subscribe_folder (CamelStore *store, const char *folder_name,
- CamelException *ex)
-{
- CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (store);
-
- camel_nntp_newsrc_subscribe_group (nntp_store->newsrc, folder_name);
-}
-
-static void
-nntp_store_unsubscribe_folder (CamelStore *store, const char *folder_name,
- CamelException *ex)
-{
- CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (store);
-
- camel_nntp_newsrc_unsubscribe_group (nntp_store->newsrc, folder_name);
-}
-
-static void
-finalize (CamelObject *object)
-{
- CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (object);
- if (nntp_store->newsrc)
- camel_nntp_newsrc_write (nntp_store->newsrc);
-}
-
-static void
-camel_nntp_store_class_init (CamelNNTPStoreClass *camel_nntp_store_class)
-{
- CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_nntp_store_class);
- CamelServiceClass *camel_service_class = CAMEL_SERVICE_CLASS (camel_nntp_store_class);
-
- remote_store_class = CAMEL_REMOTE_STORE_CLASS(camel_type_get_global_classfuncs
- (camel_remote_store_get_type ()));
-
- service_class = CAMEL_SERVICE_CLASS (camel_type_get_global_classfuncs (camel_service_get_type ()));
-
- /* virtual method overload */
- camel_service_class->connect = nntp_store_connect;
- camel_service_class->disconnect = nntp_store_disconnect;
- camel_service_class->query_auth_types = nntp_store_query_auth_types;
- camel_service_class->get_name = nntp_store_get_name;
-
- camel_store_class->get_folder = nntp_store_get_folder;
- camel_store_class->get_folder_info = nntp_store_get_folder_info;
- camel_store_class->free_folder_info = camel_store_free_folder_info_full;
-
- camel_store_class->folder_subscribed = nntp_store_folder_subscribed;
- camel_store_class->subscribe_folder = nntp_store_subscribe_folder;
- camel_store_class->unsubscribe_folder = nntp_store_unsubscribe_folder;
-}
-
-
-
-static void
-camel_nntp_store_init (gpointer object, gpointer klass)
-{
- CamelRemoteStore *remote_store = CAMEL_REMOTE_STORE (object);
- CamelStore *store = CAMEL_STORE (object);
-
- remote_store->default_port = NNTP_PORT;
-
- store->flags = CAMEL_STORE_SUBSCRIPTIONS;
-}
-
-CamelType
-camel_nntp_store_get_type (void)
-{
- static CamelType camel_nntp_store_type = CAMEL_INVALID_TYPE;
-
- if (camel_nntp_store_type == CAMEL_INVALID_TYPE) {
- camel_nntp_store_type = camel_type_register (CAMEL_REMOTE_STORE_TYPE, "CamelNNTPStore",
- sizeof (CamelNNTPStore),
- sizeof (CamelNNTPStoreClass),
- (CamelObjectClassInitFunc) camel_nntp_store_class_init,
- NULL,
- (CamelObjectInitFunc) camel_nntp_store_init,
- (CamelObjectFinalizeFunc) finalize);
- }
-
- return camel_nntp_store_type;
-}
-
-
-/**
- * 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: the response code of the nntp command.
- **/
-static int
-camel_nntp_command_send_recv (CamelNNTPStore *store, CamelException *ex, char **ret, char *cmd)
-{
- char *respbuf;
- int resp_code;
- gboolean again;
-
- do {
- again = FALSE;
-
- /* Send the command */
- if (camel_remote_store_send_string (CAMEL_REMOTE_STORE (store), ex, cmd) < 0) {
- return NNTP_PROTOCOL_ERROR;
- }
-
- /* Read the response */
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store), &respbuf, ex) < 0) {
- if (ret)
- *ret = g_strdup (g_strerror (errno));
- return NNTP_PROTOCOL_ERROR;
- }
-
- resp_code = atoi (respbuf);
-
- /* this is kind of a gross hack, but since an auth challenge
- can pop up at any time, and we want to shield this from our
- callers, we handle authentication here. */
- if (resp_code == NNTP_AUTH_REQUIRED) {
- resp_code = camel_nntp_auth_authenticate (store, ex);
- if (resp_code != NNTP_AUTH_ACCEPTED) {
- return resp_code;
- }
-
- /* need to resend our command here */
- again = TRUE;
- }
- } while (again);
-
- if (ret) {
- *ret = strchr (respbuf, ' ');
- if (*ret)
- *ret = g_strdup (*ret + 1);
- }
- g_free (respbuf);
-
- return resp_code;
-}
-
-int
-camel_nntp_command (CamelNNTPStore *store, CamelException *ex, char **ret, char *fmt, ...)
-{
- char *cmdbuf;
- va_list ap;
- int resp_code;
- char *real_fmt;
-
- real_fmt = g_strdup_printf ("%s\r\n", fmt);
-
- va_start (ap, fmt);
- cmdbuf = g_strdup_vprintf (real_fmt, ap);
- va_end (ap);
-
- g_free (real_fmt);
-
- resp_code = camel_nntp_command_send_recv (store, ex, ret, cmdbuf);
-
- g_free (cmdbuf);
-
- return resp_code;
-}
-
-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();
-
- if (camel_exception_get_id (ex)) {
- g_free (root_dir);
- camel_exception_free (ex);
- return;
- }
-
- if (camel_nntp_command ( CAMEL_NNTP_STORE (store),
- ex, &ret, "GROUP %s", group_name) == NNTP_GROUP_SELECTED) {
- /* 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 *top_dir;
-
- g_assert(url != NULL);
-
- top_dir = g_strdup_printf( "%s/evolution/news/%s",
- g_get_home_dir (),
- url->host );
-
- return top_dir;
-}
-
-static gboolean
-ensure_news_dir_exists (CamelNNTPStore *store)
-{
- gchar *dir = camel_nntp_store_get_toplevel_dir (store);
-
- if (access (dir, F_OK) == 0) {
- g_free (dir);
- return TRUE;
- }
-
- if (e_mkdir_hier (dir, S_IRWXU) == -1) {
- g_free (dir);
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/camel/providers/nntp/camel-nntp-store.h b/camel/providers/nntp/camel-nntp-store.h
deleted file mode 100644
index d7836f47ae..0000000000
--- a/camel/providers/nntp/camel-nntp-store.h
+++ /dev/null
@@ -1,113 +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 "camel-remote-store.h"
-#include "camel-nntp-newsrc.h"
-#include "camel-nntp-types.h"
-
-#define CAMEL_NNTP_STORE_TYPE (camel_nntp_store_get_type ())
-#define CAMEL_NNTP_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_NNTP_STORE_TYPE, CamelNNTPStore))
-#define CAMEL_NNTP_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_NNTP_STORE_TYPE, CamelNNTPStoreClass))
-#define CAMEL_IS_NNTP_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_NNTP_STORE_TYPE))
-
-
-enum {
- CAMEL_NNTP_OVER_FROM,
- CAMEL_NNTP_OVER_SUBJECT,
- CAMEL_NNTP_OVER_DATE,
- CAMEL_NNTP_OVER_MESSAGE_ID,
- CAMEL_NNTP_OVER_REFERENCES,
- CAMEL_NNTP_OVER_BYTES,
-
- CAMEL_NNTP_OVER_LAST
-};
-
-struct CamelNNTPOverField {
- int index;
- gboolean full; /* full in the OVER sense - the field name
- precedes the ':' in the XOVER list. */
-};
-
-struct CamelNNTPStore {
- CamelRemoteStore parent_object;
-
-#define CAMEL_NNTP_EXT_SEARCH (1<<0)
-#define CAMEL_NNTP_EXT_SETGET (1<<1)
-#define CAMEL_NNTP_EXT_OVER (1<<2)
-#define CAMEL_NNTP_EXT_XPATTEXT (1<<3)
-#define CAMEL_NNTP_EXT_XACTIVE (1<<4)
-#define CAMEL_NNTP_EXT_LISTMOTD (1<<5)
-#define CAMEL_NNTP_EXT_LISTSUBSCR (1<<6)
-#define CAMEL_NNTP_EXT_LISTPNAMES (1<<7)
- guint32 extensions;
-
- gboolean posting_allowed;
-
- int num_overview_fields;
- CamelNNTPOverField overview_field[ CAMEL_NNTP_OVER_LAST ];
-
- CamelNNTPNewsrc *newsrc;
- CamelNNTPGroupList *group_list;
-
-};
-
-struct CamelNNTPStoreClass {
- CamelRemoteStoreClass parent_class;
-
-};
-
-
-/* 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 */
-int camel_nntp_command (CamelNNTPStore *store, CamelException *ex, char **ret, char *fmt, ...);
-
-/* Standard Camel function */
-CamelType camel_nntp_store_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_NNTP_STORE_H */
-
-
diff --git a/camel/providers/nntp/camel-nntp-types.h b/camel/providers/nntp/camel-nntp-types.h
deleted file mode 100644
index b1d91779b1..0000000000
--- a/camel/providers/nntp/camel-nntp-types.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-nntp-grouplist.h : getting/updating the list of newsgroups on the server. */
-
-/*
- * 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_TYPES_H
-#define CAMEL_NNTP_TYPES_H 1
-
-typedef struct CamelNNTPGroupList CamelNNTPGroupList;
-typedef struct CamelNNTPGroupListEntry CamelNNTPGroupListEntry;
-typedef struct CamelNNTPOverField CamelNNTPOverField;
-typedef struct CamelNNTPStore CamelNNTPStore;
-typedef struct CamelNNTPStoreClass CamelNNTPStoreClass;
-
-#endif /* CAMEL_NNTP_TYPES_H */
diff --git a/camel/providers/nntp/camel-nntp-utils.c b/camel/providers/nntp/camel-nntp-utils.c
deleted file mode 100644
index 439626d977..0000000000
--- a/camel/providers/nntp/camel-nntp-utils.c
+++ /dev/null
@@ -1,256 +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-resp-codes.h"
-#include "camel-nntp-folder.h"
-#include "camel-nntp-store.h"
-#include "camel-nntp-utils.h"
-#include "camel-stream-mem.h"
-#include "camel-exception.h"
-
-#include "e-util/md5-utils.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);
- char digest[16];
-
- status = camel_nntp_command (nntp_store, ex, NULL,
- "XOVER %d-%d",
- first_message,
- last_message);
-
- if (status == NNTP_DATA_FOLLOWS) {
- gboolean done = FALSE;
-
- while (!done) {
- char *line;
-
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (nntp_store), &line, ex) < 0) {
- g_warning ("failed to recv_line while building OVER header list\n");
- break;
- }
-
- if (*line == '.') {
- done = TRUE;
- g_print ("done\n");
- }
- else {
- CamelMessageInfo *new_info = camel_folder_summary_info_new(nntp_folder->summary);
- char **split_line = g_strsplit (line, "\t", 7);
- char *subject, *from, *date, *message_id, *bytes;
- char *uid;
-
- subject = split_line [nntp_store->overview_field [CAMEL_NNTP_OVER_SUBJECT].index];
- from = split_line [nntp_store->overview_field [CAMEL_NNTP_OVER_FROM].index];
- date = split_line [nntp_store->overview_field [CAMEL_NNTP_OVER_DATE].index];
- message_id = split_line [nntp_store->overview_field [CAMEL_NNTP_OVER_MESSAGE_ID].index];
- bytes = split_line [nntp_store->overview_field [CAMEL_NNTP_OVER_BYTES].index];
-
- /* if the overview format flagged this
- field as "full", skip over the
- preceding field name and colon */
- if (nntp_store->overview_field [ CAMEL_NNTP_OVER_SUBJECT ].full)
- subject += strlen ("Subject:");
- if (nntp_store->overview_field [ CAMEL_NNTP_OVER_FROM ].full)
- from += strlen ("From:");
- if (nntp_store->overview_field [ CAMEL_NNTP_OVER_DATE ].full)
- date += strlen ("Date:");
- if (nntp_store->overview_field [ CAMEL_NNTP_OVER_MESSAGE_ID ].full)
- message_id += strlen ("Message-ID:");
- if (nntp_store->overview_field [ CAMEL_NNTP_OVER_BYTES ].full)
- bytes += strlen ("Bytes:");
-
- uid = g_strdup_printf ("%s,%s", split_line[0], message_id);
- camel_message_info_set_subject(new_info, g_strdup(subject));
- camel_message_info_set_from(new_info, g_strdup(from));
- camel_message_info_set_to(new_info, g_strdup(folder->name));
- camel_message_info_set_uid(new_info, uid);
-
- new_info->date_sent = header_decode_date(date, NULL);
-#if 0
- /* XXX do we need to fill in both dates? */
- new_info->headers.date_received = g_strdup(date);
-#endif
- new_info->size = atoi(bytes);
- md5_get_digest(message_id, strlen(message_id), digest);
- memcpy(new_info->message_id.id.hash, digest, sizeof(new_info->message_id.id.hash));
-
- if (camel_nntp_newsrc_article_is_read (nntp_store->newsrc,
- folder->name,
- atoi (split_line[0])))
- new_info->flags |= CAMEL_MESSAGE_SEEN;
-
- camel_folder_summary_add (nntp_folder->summary, new_info);
- g_strfreev (split_line);
- }
- g_free (line);
- }
- }
- else {
- /* XXX */
- g_warning ("weird nntp response for XOVER: %d\n", status);
- }
-}
-
-#if 0
-static GArray*
-get_HEAD_headers(CamelNNTPStore *nntp_store, CamelFolder *folder,
- int first_message, int last_message, CamelException *ex)
-{
- int i;
- int status;
-
- for (i = first_message; i < last_message; i ++) {
- status = camel_nntp_command (nntp_store, ex, NULL,
- "HEAD %d", i);
-
- if (status == NNTP_HEAD_FOLLOWS) {
- gboolean done = FALSE;
- char *buf;
- int buf_len;
- int buf_alloc;
- int h;
- CamelStream *header_stream;
- GArray *header_array;
- CamelStream *nntp_istream;
- CamelMessageInfo *new_info = g_new0(CamelMessageInfo, 1);
-
- buf_alloc = 2048;
- buf_len = 0;
- buf = g_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 = g_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"))
- new_info->from = g_strdup(header->value);
- else if (!g_strcasecmp(header->name, "To"))
- new_info->to = g_strdup(header->value);
- else if (!g_strcasecmp(header->name, "Subject"))
- new_info->subject = g_strdup(header->value);
- else if (!g_strcasecmp(header->name, "Message-ID")) {
- new_info->uid = g_strdup_printf("%d,%s", i, header->value);
- new_info->message_id = g_strdup(header->value);
- }
- else if (!g_strcasecmp(header->name, "Date")) {
- new_info->date_sent = header_decode_date (header->value);
-#if 0
- new_info->date_sent = g_strdup(header->value);
- new_info->date_received = g_strdup(header->value);
-#endif
- }
- }
-
- camel_folder_summary_add (nntp_folder->summary, new_info);
- }
- else if (status == CAMEL_NNTP_FAIL) {
- /* nasty things are afoot */
- g_warning ("failure doing HEAD\n");
- break;
- }
- }
-}
-#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, ex, &ret,
- "GROUP %s", folder->name);
-
- sscanf (ret, "%d %d %d", &nb_message, &first_message, &last_message);
- g_free (ret);
-
- if (status == NNTP_NO_SUCH_GROUP) {
- /* XXX throw invalid group exception */
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "group %s not found on server",
- folder->name);
- return;
- }
-
-
- if (nntp_store->extensions & CAMEL_NNTP_EXT_OVER) {
- get_XOVER_headers (nntp_store, folder, first_message, last_message, ex);
- }
- else {
- g_warning ("need to fix get_HEAD_headers\n");
-#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/nntp/test-newsrc.c b/camel/providers/nntp/test-newsrc.c
deleted file mode 100644
index c4b985e565..0000000000
--- a/camel/providers/nntp/test-newsrc.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdio.h>
-#include <glib.h>
-#include "camel-nntp-newsrc.h"
-
-int
-main(int argc, char *argv[])
-{
- CamelNNTPNewsrc *newsrc = camel_nntp_newsrc_read_for_server (argv[1]);
- camel_nntp_newsrc_write_to_file (newsrc, stdout);
-}
diff --git a/camel/providers/pop3/.cvsignore b/camel/providers/pop3/.cvsignore
deleted file mode 100644
index ddf4c8b28d..0000000000
--- a/camel/providers/pop3/.cvsignore
+++ /dev/null
@@ -1,10 +0,0 @@
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
-*.bb
-*.bbg
-*.da
-*.gcov
diff --git a/camel/providers/pop3/Makefile.am b/camel/providers/pop3/Makefile.am
deleted file mode 100644
index 608e640cd9..0000000000
--- a/camel/providers/pop3/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-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 \
- -I$(top_srcdir)/camel \
- -I$(top_srcdir)/e-util \
- $(KRB4_CFLAGS) \
- $(GTK_INCLUDEDIR) \
- -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
-
-libcamelpop3_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(UNICODE_LIBS)
-
-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 810faed846..0000000000
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ /dev/null
@@ -1,354 +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-stream-filter.h"
-#include "camel-mime-message.h"
-#include "camel-operation.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#define CF_CLASS(o) (CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(o)))
-static CamelFolderClass *parent_class;
-
-static void pop3_finalize (CamelObject *object);
-
-static void pop3_refresh_info (CamelFolder *folder, CamelException *ex);
-static void pop3_sync (CamelFolder *folder, gboolean expunge,
- CamelException *ex);
-
-static gint pop3_get_message_count (CamelFolder *folder);
-static GPtrArray *pop3_get_uids (CamelFolder *folder);
-static CamelMimeMessage *pop3_get_message (CamelFolder *folder,
- const char *uid,
- CamelException *ex);
-static void pop3_set_message_flags (CamelFolder *folder, const char *uid,
- guint32 flags, guint32 set);
-
-static GPtrArray *parse_listing (int count, char *data);
-
-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 = CAMEL_FOLDER_CLASS(camel_type_get_global_classfuncs (camel_folder_get_type ()));
-
- /* virtual method overload */
- camel_folder_class->refresh_info = pop3_refresh_info;
- camel_folder_class->sync = pop3_sync;
-
- camel_folder_class->get_message_count = pop3_get_message_count;
- camel_folder_class->get_uids = pop3_get_uids;
- camel_folder_class->free_uids = camel_folder_free_nop;
-
- camel_folder_class->get_message = pop3_get_message;
- camel_folder_class->set_message_flags = pop3_set_message_flags;
-}
-
-static void
-camel_pop3_folder_init (gpointer object)
-{
- CamelFolder *folder = CAMEL_FOLDER (object);
- CamelPop3Folder *pop3_folder = CAMEL_POP3_FOLDER (object);
-
- folder->has_summary_capability = FALSE;
- folder->has_search_capability = FALSE;
-
- pop3_folder->uids = NULL;
- pop3_folder->flags = NULL;
-}
-
-CamelType
-camel_pop3_folder_get_type (void)
-{
- static CamelType camel_pop3_folder_type = CAMEL_INVALID_TYPE;
-
- if (!camel_pop3_folder_type) {
- camel_pop3_folder_type = camel_type_register (CAMEL_FOLDER_TYPE, "CamelPop3Folder",
- sizeof (CamelPop3Folder),
- sizeof (CamelPop3FolderClass),
- (CamelObjectClassInitFunc) camel_pop3_folder_class_init,
- NULL,
- (CamelObjectInitFunc) camel_pop3_folder_init,
- (CamelObjectFinalizeFunc) pop3_finalize);
- }
-
- return camel_pop3_folder_type;
-}
-
-void
-pop3_finalize (CamelObject *object)
-{
- CamelPop3Folder *pop3_folder = CAMEL_POP3_FOLDER (object);
-
- if (pop3_folder->uids)
- camel_folder_free_deep (NULL, pop3_folder->uids);
- if (pop3_folder->flags)
- g_free (pop3_folder->flags);
-}
-
-CamelFolder *
-camel_pop3_folder_new (CamelStore *parent, CamelException *ex)
-{
- CamelFolder *folder;
-
- folder = CAMEL_FOLDER (camel_object_new (CAMEL_POP3_FOLDER_TYPE));
- camel_folder_construct (folder, parent, "inbox", "inbox");
-
- /* mt-ok, since we dont have the folder-lock for new() */
- camel_folder_refresh_info (folder, ex);/* mt-ok */
- if (camel_exception_is_set (ex)) {
- camel_object_unref (CAMEL_OBJECT (folder));
- folder = NULL;
- }
-
- return folder;
-}
-
-static void
-pop3_refresh_info (CamelFolder *folder, CamelException *ex)
-{
- GPtrArray *uids;
- int status, count;
- char *data;
- CamelPop3Folder *pop3_folder = (CamelPop3Folder *) folder;
- CamelPop3Store *pop3_store = CAMEL_POP3_STORE (folder->parent_store);
-
- camel_operation_start(NULL, _("Retrieving POP summary"));
-
- status = camel_pop3_command (pop3_store, &data, ex, "STAT");
- if (status != CAMEL_POP3_OK) {
- camel_operation_end(NULL);
- return;
- }
-
- count = atoi (data);
- g_free (data);
-
- if (pop3_store->supports_uidl != FALSE) {
- status = camel_pop3_command (pop3_store, NULL, ex, "UIDL");
- switch (status) {
- case CAMEL_POP3_ERR:
- pop3_store->supports_uidl = FALSE;
- break;
- case CAMEL_POP3_FAIL:
- camel_operation_end(NULL);
- return;
- }
- }
-
- if (pop3_store->supports_uidl == FALSE) {
- int i;
-
- uids = g_ptr_array_new ();
- g_ptr_array_set_size (uids, count);
-
- for (i = 0; i < count; i++)
- uids->pdata[i] = g_strdup_printf ("%d", i + 1);
- camel_operation_end(NULL);
- } else {
- data = camel_pop3_command_get_additional_data (pop3_store, 0, ex);
- camel_operation_end(NULL);
- if (camel_exception_is_set (ex))
- return;
-
- uids = parse_listing (count, data);
- g_free (data);
-
- if (!uids) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not open folder: "
- "message listing was "
- "incomplete."));
- return;
- }
- }
-
- pop3_folder->uids = uids;
- pop3_folder->flags = g_new0 (guint32, uids->len);
-}
-
-static void
-pop3_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- CamelPop3Folder *pop3_folder;
- CamelPop3Store *pop3_store;
- int i, status;
- char *resp;
-
- if (!expunge)
- return;
-
- pop3_folder = CAMEL_POP3_FOLDER (folder);
- pop3_store = CAMEL_POP3_STORE (folder->parent_store);
-
- for (i = 0; i < pop3_folder->uids->len; i++) {
- if (pop3_folder->flags[i] & CAMEL_MESSAGE_DELETED) {
- status = camel_pop3_command (pop3_store, &resp, ex,
- "DELE %d", i + 1);
- if (status != CAMEL_POP3_OK)
- return;
- }
- }
-
- camel_pop3_store_expunge (pop3_store, ex);
-}
-
-
-static GPtrArray *
-parse_listing (int count, char *data)
-{
- GPtrArray *ans;
- char *p;
- int index, len;
-
- ans = g_ptr_array_new ();
- g_ptr_array_set_size (ans, count);
-
- p = data;
- while (*p) {
- index = strtoul (p, &p, 10);
- len = strcspn (p, "\n");
- if (index <= count && *p == ' ')
- ans->pdata[index - 1] = g_strndup (p + 1, len - 1);
- p += len;
- if (*p == '\n')
- p++;
- }
-
- for (index = 0; index < count; index++) {
- if (ans->pdata[index] == NULL) {
- g_ptr_array_free (ans, TRUE);
- return NULL;
- }
- }
-
- return ans;
-}
-
-static int
-uid_to_number (CamelPop3Folder *pop3_folder, const char *uid)
-{
- int i;
-
- for (i = 0; i < pop3_folder->uids->len; i++) {
- if (!strcmp (uid, pop3_folder->uids->pdata[i]))
- return i + 1;
- }
-
- return -1;
-}
-
-
-static CamelMimeMessage *
-pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
-{
- int status, num, total;
- char *result, *body;
- CamelStream *msgstream;
- CamelMimeMessage *msg;
-
- num = uid_to_number (CAMEL_POP3_FOLDER (folder), uid);
- if (num == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- _("No message with uid %s"), uid);
- return NULL;
- }
-
- camel_operation_start(NULL, _("Retrieving POP message %d"), num);
-
- status = camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store),
- &result, ex, "RETR %d", num);
- if (status != CAMEL_POP3_OK) {
- camel_operation_end(NULL);
- return NULL;
- }
-
- /* this should be "nnn octets" ? */
- if (sscanf(result, "%d", &total) != 1)
- total = 0;
-
- g_free (result);
- body = camel_pop3_command_get_additional_data (CAMEL_POP3_STORE (folder->parent_store), total, 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));
- camel_operation_end(NULL);
- return NULL;
- }
-
- msgstream = camel_stream_mem_new_with_buffer (body, strlen (body));
- g_free (body);
-
- msg = camel_mime_message_new ();
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg),
- CAMEL_STREAM (msgstream));
-
- camel_object_unref (CAMEL_OBJECT (msgstream));
-
- camel_operation_end(NULL);
-
- return msg;
-}
-
-static void
-pop3_set_message_flags (CamelFolder *folder, const char *uid,
- guint32 flags, guint32 set)
-{
- CamelPop3Folder *pop3_folder = CAMEL_POP3_FOLDER (folder);
- int num;
-
- num = uid_to_number (pop3_folder, uid);
- if (num == -1)
- return;
-
- pop3_folder->flags[num - 1] =
- (pop3_folder->flags[num] & ~flags) | (set & flags);
-}
-
-static gint
-pop3_get_message_count (CamelFolder *folder)
-{
- CamelPop3Folder *pop3_folder = CAMEL_POP3_FOLDER (folder);
-
- return pop3_folder->uids->len;
-}
-
-static GPtrArray *
-pop3_get_uids (CamelFolder *folder)
-{
- CamelPop3Folder *pop3_folder = CAMEL_POP3_FOLDER (folder);
-
- return pop3_folder->uids;
-}
diff --git a/camel/providers/pop3/camel-pop3-folder.h b/camel/providers/pop3/camel-pop3-folder.h
deleted file mode 100644
index 278cd0e8e9..0000000000
--- a/camel/providers/pop3/camel-pop3-folder.h
+++ /dev/null
@@ -1,72 +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 "camel-folder.h"
-
-#define CAMEL_POP3_FOLDER_TYPE (camel_pop3_folder_get_type ())
-#define CAMEL_POP3_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_POP3_FOLDER_TYPE, CamelPop3Folder))
-#define CAMEL_POP3_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_POP3_FOLDER_TYPE, CamelPop3FolderClass))
-#define CAMEL_IS_POP3_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_POP3_FOLDER_TYPE))
-
-
-typedef struct {
- CamelFolder parent_object;
-
- GPtrArray *uids;
- guint32 *flags;
-
-} CamelPop3Folder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelPop3FolderClass;
-
-
-/* public methods */
-CamelFolder *camel_pop3_folder_new (CamelStore *parent, CamelException *ex);
-
-/* Standard Camel function */
-CamelType 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 5af0dad73c..0000000000
--- a/camel/providers/pop3/camel-pop3-provider.c
+++ /dev/null
@@ -1,60 +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"
-#include "camel-url.h"
-
-static CamelProvider pop3_provider = {
- "pop",
- N_("POP"),
-
- N_("For connecting to POP servers. The POP protocol can also "
- "be used to retrieve mail from certain web mail providers "
- "and proprietary email systems."),
-
- "mail",
-
- CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE,
-
- CAMEL_URL_NEED_USER | CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH,
-
- { 0, 0 },
-
- NULL
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- pop3_provider.object_types[CAMEL_PROVIDER_STORE] =
- camel_pop3_store_get_type();
-
- pop3_provider.service_cache = g_hash_table_new (camel_url_hash, camel_url_equal);
-
- 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 fac9cae931..0000000000
--- a/camel/providers/pop3/camel-pop3-store.c
+++ /dev/null
@@ -1,681 +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-operation.h"
-
-#ifdef HAVE_KRB4
-/* Specified nowhere */
-#define KPOP_PORT 1109
-
-#include <krb.h>
-/* MIT krb4 des.h #defines _. Sigh. We don't need it. */
-#undef _
-
-#ifdef NEED_KRB_SENDAUTH_PROTO
-extern int krb_sendauth(long options, int fd, KTEXT ticket, char *service,
- char *inst, char *realm, unsigned KRB4_32 checksum,
- MSG_DAT *msg_data, CREDENTIALS *cred,
- Key_schedule schedule, struct sockaddr_in *laddr,
- struct sockaddr_in *faddr, char *version);
-#endif
-#endif
-
-#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 "e-util/md5-utils.h"
-
-/* Specified in RFC 1939 */
-#define POP3_PORT 110
-
-static CamelRemoteStoreClass *parent_class = NULL;
-
-static void finalize (CamelObject *object);
-
-static gboolean pop3_connect (CamelService *service, CamelException *ex);
-static gboolean pop3_disconnect (CamelService *service, gboolean clean, CamelException *ex);
-static GList *query_auth_types (CamelService *service, gboolean connect, CamelException *ex);
-
-static CamelFolder *get_folder (CamelStore *store, const char *folder_name,
- guint32 flags, CamelException *ex);
-
-static int pop3_get_response (CamelPop3Store *store, char **ret, CamelException *ex);
-
-
-static void
-camel_pop3_store_class_init (CamelPop3StoreClass *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);
-
- parent_class = CAMEL_REMOTE_STORE_CLASS(camel_type_get_global_classfuncs
- (camel_remote_store_get_type ()));
-
- /* virtual method overload */
- camel_service_class->query_auth_types = query_auth_types;
- camel_service_class->connect = pop3_connect;
- camel_service_class->disconnect = pop3_disconnect;
-
- camel_store_class->get_folder = get_folder;
-}
-
-
-
-static void
-camel_pop3_store_init (gpointer object, gpointer klass)
-{
- CamelRemoteStore *remote_store = CAMEL_REMOTE_STORE (object);
-
- remote_store->default_port = 110;
-}
-
-CamelType
-camel_pop3_store_get_type (void)
-{
- static CamelType camel_pop3_store_type = CAMEL_INVALID_TYPE;
-
- if (!camel_pop3_store_type) {
- camel_pop3_store_type = camel_type_register (CAMEL_REMOTE_STORE_TYPE, "CamelPop3Store",
- sizeof (CamelPop3Store),
- sizeof (CamelPop3StoreClass),
- (CamelObjectClassInitFunc) camel_pop3_store_class_init,
- NULL,
- (CamelObjectInitFunc) camel_pop3_store_init,
- finalize);
- }
-
- return camel_pop3_store_type;
-}
-
-static void
-finalize (CamelObject *object)
-{
- CamelPop3Store *pop3_store = CAMEL_POP3_STORE (object);
-
- if (pop3_store->apop_timestamp)
- g_free (pop3_store->apop_timestamp);
-}
-
-static CamelServiceAuthType password_authtype = {
- N_("Password"),
-
- N_("This option will connect to the POP server using a plaintext "
- "password. This is the only option supported by many POP servers."),
-
- "",
- TRUE
-};
-
-static CamelServiceAuthType apop_authtype = {
- "APOP",
-
- N_("This option will connect to the POP server using an encrypted "
- "password via the APOP protocol. This may not work for all users "
- "even on servers that claim to support it."),
-
- "+APOP",
- TRUE
-};
-
-#ifdef HAVE_KRB4
-static CamelServiceAuthType kpop_authtype = {
- "Kerberos 4 (KPOP)",
-
- N_("This will connect to the POP server and use Kerberos 4 "
- "to authenticate to it."),
-
- "+KPOP",
- FALSE
-};
-#endif
-
-static gboolean
-connect_to_server (CamelService *service, /*gboolean real, */CamelException *ex)
-{
- CamelPop3Store *store = CAMEL_POP3_STORE (service);
- char *buf, *apoptime, *apopend;
- gint status;
-#ifdef HAVE_KRB4
- gboolean kpop = service->url->authmech &&
- !strcmp (service->url->authmech, "+KPOP");
-#endif
-
-#ifdef HAVE_KRB4
- if (kpop) {
- KTEXT_ST ticket_st;
- MSG_DAT msg_data;
- CREDENTIALS cred;
- Key_schedule schedule;
- char *hostname;
- struct hostent *h;
- int fd;
-
- /* Need to copy hostname, because krb_realmofhost will
- * call gethostbyname as well, and gethostbyname uses
- * static storage.
- */
- h = camel_service_gethost (service, ex);
- hostname = g_strdup (h->h_name);
-
- fd = CAMEL_STREAM_FS (CAMEL_REMOTE_STORE (service)->ostream)->fd;
-
- 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]);
- return FALSE;
- }
-
- if (!service->url->passwd)
- service->url->passwd = g_strdup (service->url->user);
- }
-#endif /* HAVE_KRB4 */
-
- /* Read the greeting, check status */
- status = pop3_get_response (store, &buf, ex);
- if (status != CAMEL_POP3_OK)
- return FALSE;
-
- if (buf) {
- apoptime = strchr (buf, '<');
- apopend = apoptime ? strchr (apoptime, '>') : NULL;
- if (apopend) {
- store->apop_timestamp =
- g_strndup (apoptime, apopend - apoptime + 1);
- memmove (apoptime, apopend + 1, strlen (apopend + 1));
- }
- store->implementation = buf;
- }
-
- /* Check extensions */
- store->login_delay = -1;
- store->supports_top = -1;
- store->supports_uidl = -1;
- store->expires = -1;
-
- status = camel_pop3_command (store, NULL, ex, "CAPA");
- if (status == CAMEL_POP3_OK) {
- char *p;
- int len;
-
- buf = camel_pop3_command_get_additional_data (store, 0, ex);
- if (camel_exception_is_set (ex))
- return FALSE;
-
- p = buf;
- while (*p) {
- len = strcspn (p, "\n");
- if (!strncmp (p, "IMPLEMENTATION ", 15)) {
- g_free (store->implementation);
- store->implementation =
- g_strndup (p + 15, len - 15);
- } else if (len == 3 && !strncmp (p, "TOP", 3))
- store->supports_top = TRUE;
- else if (len == 4 && !strncmp (p, "UIDL", 4))
- store->supports_uidl = TRUE;
- else if (!strncmp (p, "LOGIN-DELAY ", 12))
- store->login_delay = atoi (p + 12);
- else if (!strncmp (p, "EXPIRE NEVER", 12))
- store->expires = FALSE;
- else if (!strncmp (p, "EXPIRE ", 7))
- store->expires = TRUE;
-
- p += len;
- if (*p)
- p++;
- }
-
- g_free (buf);
- }
-
- return TRUE;
-}
-
-static GList *
-query_auth_types (CamelService *service, gboolean connect, CamelException *ex)
-{
- CamelPop3Store *store = CAMEL_POP3_STORE (service);
- GList *types = NULL;
- gboolean passwd = TRUE, apop = TRUE;
-#ifdef HAVE_KRB4
- gboolean kpop = TRUE;
- int saved_port;
-#endif
-
- types = CAMEL_SERVICE_CLASS (parent_class)->query_auth_types (service, connect, ex);
-
- if (connect) {
- passwd = camel_service_connect (service, ex);
- /*ignore the exception here; the server may just not support passwd */
-
- /* should we check apop too? */
- apop = store->apop_timestamp != NULL;
- if (passwd)
- camel_service_disconnect (service, TRUE, ex);
- camel_exception_clear (ex);
-
-#ifdef HAVE_KRB4
- saved_port = service->url->port;
- service->url->port = KPOP_PORT;
- kpop = camel_service_connect (service, ex);
- service->url->port = saved_port;
- /*ignore the exception here; the server may just not support kpop */
-
- if (kpop)
- camel_service_disconnect (service, TRUE, ex);
- camel_exception_clear (ex);
-#endif
-
- if (passwd)
- types = g_list_append (types, &password_authtype);
- if (apop)
- types = g_list_append (types, &apop_authtype);
-#ifdef HAVE_KRB4
- if (kpop)
- types = g_list_append (types, &kpop_authtype);
-#endif
-
- if (!types) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Could not connect to POP server on "
- "%s."), service->url->host);
- }
- } else {
- types = g_list_append (types, &password_authtype);
- types = g_list_append (types, &apop_authtype);
-#ifdef HAVE_KRB4
- types = g_list_append (types, &kpop_authtype);
-#endif
- }
-
- return types;
-}
-
-/**
- * camel_pop3_store_expunge:
- * @store: the store
- * @ex: a CamelException
- *
- * Expunge messages from the store. This will result in the connection
- * being closed, which may cause later commands to fail if they can't
- * reconnect.
- **/
-void
-camel_pop3_store_expunge (CamelPop3Store *store, CamelException *ex)
-{
- camel_pop3_command (store, NULL, ex, "QUIT");
- camel_service_disconnect (CAMEL_SERVICE (store), FALSE, ex);
-}
-
-
-static gboolean
-pop3_try_authenticate (CamelService *service, gboolean kpop,
- const char *errmsg, CamelException *ex)
-{
- CamelPop3Store *store = (CamelPop3Store *)service;
- int status;
- char *msg;
-
- /* The KPOP code will have set the password to be the username
- * in connect_to_server. Password and APOP are the only other
- * cases, and they both need a password. So if there's no
- * password stored, query for it.
- */
- if (!service->url->passwd) {
- char *prompt;
-
- prompt = g_strdup_printf (_("%sPlease enter the POP3 password "
- "for %s@%s"), errmsg ? errmsg : "",
- service->url->user,
- service->url->host);
- service->url->passwd = camel_session_query_authenticator (
- camel_service_get_session (service),
- CAMEL_AUTHENTICATOR_ASK, prompt, TRUE,
- service, "password", ex);
- g_free (prompt);
- if (!service->url->passwd)
- return FALSE;
- }
-
- if (!service->url->authmech || kpop) {
- status = camel_pop3_command (store, &msg, ex, "USER %s",
- service->url->user);
- switch (status) {
- case CAMEL_POP3_ERR:
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Unable to connect to POP "
- "server.\nError sending "
- "username: %s"),
- msg ? msg : _("(Unknown)"));
- g_free (msg);
- /*fallll*/
- case CAMEL_POP3_FAIL:
- return FALSE;
- }
- g_free (msg);
-
- status = camel_pop3_command (store, &msg, ex, "PASS %s",
- service->url->passwd);
- } else if (!strcmp (service->url->authmech, "+APOP")
- && store->apop_timestamp) {
- char *secret, md5asc[33], *d;
- unsigned char md5sum[16], *s;
-
- secret = g_strdup_printf ("%s%s", store->apop_timestamp,
- service->url->passwd);
- md5_get_digest (secret, strlen (secret), md5sum);
- g_free (secret);
-
- for (s = md5sum, d = md5asc; d < md5asc + 32; s++, d += 2)
- sprintf (d, "%.2x", *s);
-
- status = camel_pop3_command (store, &msg, ex, "APOP %s %s",
- service->url->user, md5asc);
- } else {
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Unable to connect to POP server.\n"
- "No support for requested "
- "authentication mechanism."));
- return FALSE;
- }
-
- if (status == CAMEL_POP3_ERR) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Unable to connect to POP server.\n"
- "Error sending password: %s"),
- msg ? msg : _("(Unknown)"));
- }
-
- g_free (msg);
- return status == CAMEL_POP3_ERR;
-}
-
-static gboolean
-pop3_connect (CamelService *service, CamelException *ex)
-{
- char *errbuf = NULL;
- gboolean tryagain, kpop = FALSE;
- gboolean res;
-
-#ifdef HAVE_KRB4
- gboolean set_port = FALSE;
-
- kpop = (service->url->authmech &&
- !strcmp (service->url->authmech, "+KPOP"));
-
- if (kpop && service->url->port == 0) {
- set_port = TRUE;
- service->url->port = KPOP_PORT;
- }
-#endif
-
- res = CAMEL_SERVICE_CLASS (parent_class)->connect (service, ex);
-
-#ifdef HAVE_KRB4
- /* This is veeery nasty. When we set the port, we're changing the
- * hash value of our URL. service_cache_remove() gets called when
- * we're done checking the mail, but the hash table lookup fails
- * because the url port has changed. Then, a finalized instance of
- * the CamelService is stuck in the hash table, and the next time
- * we try to look up the service, with a URL of port 0, we look
- * up the freed service and a segfault results.
- */
-
- if (kpop && set_port)
- service->url->port = 0;
-#endif
-
- if (res == FALSE)
- return FALSE;
-
- /*FIXME integrate these functions */
- if (!connect_to_server (service, ex))
- return FALSE;
-
- camel_exception_clear (ex);
- do {
- if (camel_exception_is_set (ex)) {
- errbuf = g_strdup_printf (
- "%s\n\n",
- camel_exception_get_description (ex));
- camel_exception_clear (ex);
-
- /* Uncache the password before prompting again. */
- camel_session_query_authenticator (
- camel_service_get_session (service),
- CAMEL_AUTHENTICATOR_TELL, NULL, TRUE, service,
- "password", ex);
- g_free (service->url->passwd);
- service->url->passwd = NULL;
- }
-
- tryagain = pop3_try_authenticate (service, kpop, errbuf, ex);
- g_free (errbuf);
- } while (tryagain);
-
- if (camel_exception_is_set (ex)) {
- camel_service_disconnect (service, TRUE, ex);
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-pop3_disconnect (CamelService *service, gboolean clean, CamelException *ex)
-{
- CamelPop3Store *store = CAMEL_POP3_STORE (service);
-
- if (clean)
- camel_pop3_command (store, NULL, ex, "QUIT");
-
- if (!CAMEL_SERVICE_CLASS (parent_class)->disconnect (service, clean, ex))
- return FALSE;
-
- return TRUE;
-}
-
-static CamelFolder *
-get_folder (CamelStore *store, const char *folder_name,
- guint32 flags, CamelException *ex)
-{
- if (g_strcasecmp (folder_name, "inbox") != 0) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID,
- _("No such folder `%s'."), folder_name);
- return NULL;
- }
- return camel_pop3_folder_new (store, ex);
-}
-
-
-/**
- * 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, CamelException *ex, char *fmt, ...)
-{
- char *cmdbuf;
- va_list ap;
-
- va_start (ap, fmt);
- cmdbuf = g_strdup_vprintf (fmt, ap);
- va_end (ap);
-
- /* Send the command */
- if (camel_remote_store_send_string (CAMEL_REMOTE_STORE (store), ex, "%s\r\n", cmdbuf) < 0) {
- g_free (cmdbuf);
- if (ret)
- *ret = NULL;
- return CAMEL_POP3_FAIL;
- }
- g_free (cmdbuf);
-
- return pop3_get_response (store, ret, ex);
-}
-
-static int
-pop3_get_response (CamelPop3Store *store, char **ret, CamelException *ex)
-{
- char *respbuf;
- int status;
-
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store), &respbuf, ex) < 0) {
- if (ret)
- *ret = NULL;
- 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
- * @total: Total bytes expected (for progress reporting), use 0 for 'unknown'.
- *
- * 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, int total, CamelException *ex)
-{
- GPtrArray *data;
- char *buf, *p;
- int i, len = 0, status = CAMEL_POP3_OK;
- int pc = 0;
-
- data = g_ptr_array_new ();
- while (1) {
- if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store), &buf, ex) < 0) {
- status = CAMEL_POP3_FAIL;
- break;
- }
-
- if (!strcmp (buf, "."))
- break;
-
- g_ptr_array_add (data, buf);
- len += strlen (buf) + 1;
-
- if (total) {
- pc = (len+1) * 100 / total;
- camel_operation_progress(NULL, pc);
- } else {
- camel_operation_progress_count(NULL, len);
- }
- }
-
- if (buf)
- g_free (buf);
-
- if (status == CAMEL_POP3_OK) {
- buf = g_malloc0 (len + 1);
-
- for (i = 0, p = buf; i < data->len; i++) {
- char *ptr, *datap;
-
- datap = (char *) data->pdata[i];
- ptr = (*datap == '.') ? datap + 1 : datap;
- len = strlen (ptr);
- memcpy (p, ptr, len);
- p += len;
- *p++ = '\n';
- }
- *p = '\0';
- } else
- buf = NULL;
-
- for (i = 0; i < data->len; 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 078a317a14..0000000000
--- a/camel/providers/pop3/camel-pop3-store.h
+++ /dev/null
@@ -1,79 +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 "camel-types.h"
-#include "camel-remote-store.h"
-
-#define CAMEL_POP3_STORE_TYPE (camel_pop3_store_get_type ())
-#define CAMEL_POP3_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_POP3_STORE_TYPE, CamelPop3Store))
-#define CAMEL_POP3_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_POP3_STORE_TYPE, CamelPop3StoreClass))
-#define CAMEL_IS_POP3_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_POP3_STORE_TYPE))
-
-
-typedef struct {
- CamelRemoteStore parent_object;
-
- char *apop_timestamp, *implementation;
- gboolean supports_top, supports_uidl, expires;
- int login_delay;
-
-} CamelPop3Store;
-
-
-
-typedef struct {
- CamelRemoteStoreClass parent_class;
-
-} CamelPop3StoreClass;
-
-
-/* public methods */
-void camel_pop3_store_expunge (CamelPop3Store *store, CamelException *ex);
-
-/* support functions */
-enum { CAMEL_POP3_OK, CAMEL_POP3_ERR, CAMEL_POP3_FAIL };
-int camel_pop3_command (CamelPop3Store *store, char **ret, CamelException *ex, char *fmt, ...);
-char *camel_pop3_command_get_additional_data (CamelPop3Store *store, int total, CamelException *ex);
-
-/* Standard Camel function */
-CamelType 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 097fdedafb..0000000000
--- a/camel/providers/sendmail/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-Makefile
-Makefile.in
-.deps
-.libs
-*.lo
-*.la
-*.o
-*.bb
-*.bbg
-*.da
-*.gcov
diff --git a/camel/providers/sendmail/Makefile.am b/camel/providers/sendmail/Makefile.am
deleted file mode 100644
index 965f56afb8..0000000000
--- a/camel/providers/sendmail/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-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
-
-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 d0e40b4cf8..0000000000
--- a/camel/providers/sendmail/camel-sendmail-provider.c
+++ /dev/null
@@ -1,62 +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"
-#include "camel-url.h"
-
-static CamelProvider sendmail_provider = {
- "sendmail",
- N_("Sendmail"),
-
- N_("For delivering mail by passing it to the \"sendmail\" program "
- "on the local system."),
-
- "mail",
-
- 0,
-
- 0,
-
- { 0, 0 },
-
- NULL
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- sendmail_provider.object_types[CAMEL_PROVIDER_TRANSPORT] =
- camel_sendmail_transport_get_type();
-
- sendmail_provider.service_cache = g_hash_table_new (camel_url_hash, camel_url_equal);
-
- 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 d76edfeca9..0000000000
--- a/camel/providers/sendmail/camel-sendmail-transport.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-sendmail-transport.c: Sendmail-based transport class. */
-
-/*
- *
- * Authors: 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 char *get_name (CamelService *service, gboolean brief);
-
-static gboolean sendmail_can_send (CamelTransport *transport, CamelMedium *message);
-static gboolean sendmail_send (CamelTransport *transport, CamelMedium *message,
- CamelException *ex);
-static gboolean sendmail_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);
- CamelServiceClass *camel_service_class =
- CAMEL_SERVICE_CLASS (camel_sendmail_transport_class);
-
- /* virtual method overload */
- camel_service_class->get_name = get_name;
-
- camel_transport_class->can_send = sendmail_can_send;
- camel_transport_class->send = sendmail_send;
- camel_transport_class->send_to = sendmail_send_to;
-}
-
-CamelType
-camel_sendmail_transport_get_type (void)
-{
- static CamelType camel_sendmail_transport_type = CAMEL_INVALID_TYPE;
-
- if (camel_sendmail_transport_type == CAMEL_INVALID_TYPE) {
- camel_sendmail_transport_type =
- camel_type_register (CAMEL_TRANSPORT_TYPE, "CamelSendmailTransport",
- sizeof (CamelSendmailTransport),
- sizeof (CamelSendmailTransportClass),
- (CamelObjectClassInitFunc) camel_sendmail_transport_class_init,
- NULL,
- (CamelObjectInitFunc) NULL,
- NULL);
- }
-
- return camel_sendmail_transport_type;
-}
-
-
-static gboolean
-sendmail_can_send (CamelTransport *transport, CamelMedium *message)
-{
- return CAMEL_IS_MIME_MESSAGE (message);
-}
-
-
-static gboolean
-sendmail_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) {
- camel_object_unref (CAMEL_OBJECT (out));
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not send message: %s"),
- strerror(errno));
- return FALSE;
- }
- camel_object_unref (CAMEL_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_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not execute %s: "
- "mail not sent."),
- SENDMAIL_PATH);
- } else {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("sendmail exited with status "
- "%d: mail not sent."),
- WEXITSTATUS (wstat));
- }
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-sendmail_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 = sendmail_send_internal (message, argv, ex);
- g_free (argv);
- return status;
-}
-
-static gboolean
-sendmail_send (CamelTransport *transport, CamelMedium *message,
- CamelException *ex)
-{
- char *argv[4] = { "sendmail", "-t", "-i", NULL };
-
- return sendmail_send_internal (message, argv, ex);
-}
-
-static char *
-get_name (CamelService *service, gboolean brief)
-{
- if (brief)
- return g_strdup (_("sendmail"));
- else
- return g_strdup (_("Mail delivery via the sendmail program"));
-}
diff --git a/camel/providers/sendmail/camel-sendmail-transport.h b/camel/providers/sendmail/camel-sendmail-transport.h
deleted file mode 100644
index bb5dca071b..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) (CAMEL_CHECK_CAST((obj), CAMEL_SENDMAIL_TRANSPORT_TYPE, CamelSendmailTransport))
-#define CAMEL_SENDMAIL_TRANSPORT_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SENDMAIL_TRANSPORT_TYPE, CamelSendmailTransportClass))
-#define CAMEL_IS_SENDMAIL_TRANSPORT(o) (CAMEL_CHECK_TYPE((o), CAMEL_SENDMAIL_TRANSPORT_TYPE))
-
-
-typedef struct {
- CamelTransport parent_object;
-
-} CamelSendmailTransport;
-
-
-typedef struct {
- CamelTransportClass parent_class;
-
-} CamelSendmailTransportClass;
-
-
-/* Standard Camel function */
-CamelType 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 b948585108..0000000000
--- a/camel/providers/smtp/.cvsignore
+++ /dev/null
@@ -1,10 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
-*.bb
-*.bbg
-*.da
-*.gcov
diff --git a/camel/providers/smtp/Makefile.am b/camel/providers/smtp/Makefile.am
deleted file mode 100644
index 734a4e5128..0000000000
--- a/camel/providers/smtp/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-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 \
- -I$(top_srcdir)/camel \
- -I$(top_srcdir)/e-util \
- $(GTK_INCLUDEDIR) \
- -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
-
-libcamelsmtp_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(UNICODE_LIBS)
-
-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 83fb54bc8e..0000000000
--- a/camel/providers/smtp/camel-smtp-provider.c
+++ /dev/null
@@ -1,62 +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"
-#include "camel-url.h"
-
-static CamelProvider smtp_provider = {
- "smtp",
- N_("SMTP"),
-
- N_("For delivering mail by connecting to a remote mailhub "
- "using SMTP.\n"),
-
- "mail",
-
- CAMEL_PROVIDER_IS_REMOTE,
-
- CAMEL_URL_NEED_HOST,
-
- { 0, 0 },
-
- NULL
-};
-
-void
-camel_provider_module_init (CamelSession *session)
-{
- smtp_provider.object_types[CAMEL_PROVIDER_TRANSPORT] =
- camel_smtp_transport_get_type();
-
- smtp_provider.service_cache = g_hash_table_new (camel_url_hash, camel_url_equal);
-
- 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 1d7b4e5622..0000000000
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ /dev/null
@@ -1,836 +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@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/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 <ctype.h>
-#include <unistd.h>
-#undef MIN
-#undef MAX
-#include "camel-mime-filter-crlf.h"
-#include "camel-mime-filter-linewrap.h"
-#include "camel-stream-filter.h"
-#include "camel-smtp-transport.h"
-#include "camel-mime-message.h"
-#include "camel-multipart.h"
-#include "camel-mime-part.h"
-#include "camel-stream-buffer.h"
-#include "camel-stream-fs.h"
-#include "camel-session.h"
-#include "camel-exception.h"
-#include <gal/util/e-util.h>
-
-#define d(x) x
-
-/* Specified in RFC 821 */
-#define SMTP_PORT 25
-
-/* camel smtp transport class prototypes */
-static gboolean smtp_can_send (CamelTransport *transport, CamelMedium *message);
-static gboolean smtp_send (CamelTransport *transport, CamelMedium *message, CamelException *ex);
-static gboolean smtp_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, gboolean clean, CamelException *ex);
-static GList *esmtp_get_authtypes (gchar *buffer);
-static GList *query_auth_types (CamelService *service, gboolean connect, CamelException *ex);
-static void free_auth_types (CamelService *service, GList *authtypes);
-static char *get_name (CamelService *service, gboolean brief);
-
-static gboolean smtp_helo (CamelSmtpTransport *transport, CamelException *ex);
-static gboolean smtp_mail (CamelSmtpTransport *transport, const char *sender,
- gboolean has_8bit_parts, CamelException *ex);
-static gboolean smtp_rcpt (CamelSmtpTransport *transport, const char *recipient, CamelException *ex);
-static gboolean smtp_data (CamelSmtpTransport *transport, CamelMedium *message,
- gboolean has_8bit_parts, 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 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 = CAMEL_SERVICE_CLASS (camel_type_get_global_classfuncs (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_service_class->get_name = get_name;
-
- camel_transport_class->can_send = smtp_can_send;
- camel_transport_class->send = smtp_send;
- camel_transport_class->send_to = smtp_send_to;
-}
-
-static void
-camel_smtp_transport_init (gpointer object)
-{
- CamelTransport *transport = CAMEL_TRANSPORT (object);
-
- transport->supports_8bit = FALSE;
-}
-
-CamelType
-camel_smtp_transport_get_type (void)
-{
- static CamelType camel_smtp_transport_type = CAMEL_INVALID_TYPE;
-
- if (camel_smtp_transport_type == CAMEL_INVALID_TYPE) {
- camel_smtp_transport_type =
- camel_type_register (CAMEL_TRANSPORT_TYPE, "CamelSmtpTransport",
- sizeof (CamelSmtpTransport),
- sizeof (CamelSmtpTransportClass),
- (CamelObjectClassInitFunc) camel_smtp_transport_class_init,
- NULL,
- (CamelObjectInitFunc) camel_smtp_transport_init,
- NULL);
- }
-
- return camel_smtp_transport_type;
-}
-
-static const char *
-get_smtp_error_string (int error)
-{
- /* SMTP error codes grabbed from rfc821 */
- switch (error) {
- case 0:
- /* looks like a read problem, check errno */
- return g_strerror (errno);
- case 500:
- return _("Syntax error, command unrecognized");
- case 501:
- return _("Syntax error in parameters or arguments");
- case 502:
- return _("Command not implemented");
- case 504:
- return _("Command parameter not implemented");
- case 211:
- return _("System status, or system help reply");
- case 214:
- return _("Help message");
- case 220:
- return _("Service ready");
- case 221:
- return _("Service closing transmission channel");
- case 421:
- return _("Service not available, closing transmission channel");
- case 250:
- return _("Requested mail action okay, completed");
- case 251:
- return _("User not local; will forward to <forward-path>");
- case 450:
- return _("Requested mail action not taken: mailbox unavailable");
- case 550:
- return _("Requested action not taken: mailbox unavailable");
- case 451:
- return _("Requested action aborted: error in processing");
- case 551:
- return _("User not local; please try <forward-path>");
- case 452:
- return _("Requested action not taken: insufficient system storage");
- case 552:
- return _("Requested mail action aborted: exceeded storage allocation");
- case 553:
- return _("Requested action not taken: mailbox name not allowed");
- case 354:
- return _("Start mail input; end with <CRLF>.<CRLF>");
- case 554:
- return _("Transaction failed");
- default:
- return _("Unknown");
- }
-}
-
-static gboolean
-smtp_connect (CamelService *service, CamelException *ex)
-{
- CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
- struct hostent *h;
- struct sockaddr_in sin;
- gint fd, num, i;
- guint32 addrlen;
- gchar *pass = NULL, *respbuf = NULL;
-
- if (!service_class->connect (service, ex))
- return FALSE;
-
- h = camel_service_gethost (service, ex);
- if (!h)
- return FALSE;
-
- /* set some smtp transport defaults */
- transport->is_esmtp = FALSE;
- transport->esmtp_supported_authtypes = NULL;
- CAMEL_TRANSPORT (transport)->supports_8bit = 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 %d): %s"),
- service->url->host,
- service->url->port ? service->url->port : SMTP_PORT,
- strerror (errno));
- if (fd > -1)
- close (fd);
- g_free (pass);
- return FALSE;
- }
-
- /* get the localaddr - needed later by smtp_helo */
- addrlen = sizeof (transport->localaddr);
- getsockname (fd, (struct sockaddr*)&transport->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 or not. */
- do {
- /* Check for "220" */
- g_free (respbuf);
- respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
- if (!respbuf || strncmp (respbuf, "220", 3)) {
- int error;
-
- error = respbuf ? atoi (respbuf) : 0;
- g_free (respbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Welcome response error: %s: possibly non-fatal"),
- get_smtp_error_string (error));
- return FALSE;
- }
- if (strstr (respbuf, "ESMTP"))
- transport->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) */
- if (!transport->is_esmtp) {
- /* If we did not auto-detect ESMTP, we should still send EHLO */
- transport->is_esmtp = TRUE;
- if (!smtp_helo (transport, NULL)) {
- /* Okay, apprently this server doesn't support ESMTP */
- transport->is_esmtp = FALSE;
- smtp_helo (transport, ex);
- }
- } else {
- /* send EHLO */
- smtp_helo (transport, ex);
- }
-
- /* check to see if AUTH is required, if so...then AUTH ourselves */
- if (transport->is_esmtp && transport->esmtp_supported_authtypes) {
- /* not really supported yet, but we can at least show what auth types are supported */
- d(fprintf (stderr, "camel-smtp-transport::connect(): %s requires AUTH\n", service->url->host));
- num = g_list_length (transport->esmtp_supported_authtypes);
-
- for (i = 0; i < num; i++)
- d(fprintf (stderr, "\nSupported AUTH: %s\n\n",
- (gchar *) g_list_nth_data (transport->esmtp_supported_authtypes, i)));
-
- g_list_free (transport->esmtp_supported_authtypes);
- transport->esmtp_supported_authtypes = NULL;
- } else {
- d(fprintf (stderr, "\ncamel-smtp-transport::connect(): provider does not use AUTH\n\n"));
- }
-
- return TRUE;
-}
-
-static gboolean
-smtp_disconnect (CamelService *service, gboolean clean, CamelException *ex)
-{
- CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
-
- /*if (!service->connected)
- * return TRUE;
- */
-
- if (clean) {
- /* send the QUIT command to the SMTP server */
- smtp_quit (transport, ex);
- }
-
- if (!service_class->disconnect (service, clean, ex))
- return FALSE;
-
- g_free (transport->esmtp_supported_authtypes);
- transport->esmtp_supported_authtypes = NULL;
- camel_object_unref (CAMEL_OBJECT (transport->ostream));
- camel_object_unref (CAMEL_OBJECT (transport->istream));
- transport->ostream = NULL;
- transport->istream = NULL;
-
- return TRUE;
-}
-
-static GList *
-esmtp_get_authtypes (gchar *buffer)
-{
- GList *ret = NULL;
- gchar *start, *end;
-
- /* advance to the first token */
- for (start = buffer; *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++);
- }
-
- return ret;
-}
-
-/* FIXME: use these? */
-#ifdef notyet
-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
-};
-#endif
-
-static GList *
-query_auth_types (CamelService *service, gboolean connect, 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 char *
-get_name (CamelService *service, gboolean brief)
-{
- if (brief)
- return g_strdup_printf (_("SMTP server %s"), service->url->host);
- else {
- return g_strdup_printf (_("SMTP mail delivery via %s"),
- service->url->host);
- }
-}
-
-static gboolean
-smtp_can_send (CamelTransport *transport, CamelMedium *message)
-{
- return CAMEL_IS_MIME_MESSAGE (message);
-}
-
-static gboolean
-smtp_send_to (CamelTransport *transport, CamelMedium *message,
- GList *recipients, CamelException *ex)
-{
- CamelSmtpTransport *smtp_transport = CAMEL_SMTP_TRANSPORT (transport);
- const CamelInternetAddress *cia;
- char *recipient;
- const char *addr;
- gboolean has_8bit_parts;
- GList *r;
-
- cia = camel_mime_message_get_from(CAMEL_MIME_MESSAGE (message));
- if (!cia) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot send message: "
- "sender address not defined."));
- return FALSE;
- }
-
- if (!camel_internet_address_get (cia, 0, NULL, &addr)) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot send message: "
- "sender address not valid."));
- return FALSE;
- }
-
- /* find out if the message has 8bit mime parts */
- has_8bit_parts = camel_mime_message_has_8bit_parts (CAMEL_MIME_MESSAGE (message));
-
- /* rfc1652 (8BITMIME) requires that you notify the ESMTP daemon that
- you'll be sending an 8bit mime message at "MAIL FROM:" time. */
- smtp_mail (smtp_transport, addr, has_8bit_parts, ex);
-
- if (!recipients) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot send message: "
- "no recipients defined."));
- return FALSE;
- }
-
- for (r = recipients; r; r = r->next) {
- recipient = (char *) r->data;
- if (!smtp_rcpt (smtp_transport, recipient, ex)) {
- g_free (recipient);
- return FALSE;
- }
- g_free (recipient);
- }
-
- /* passing in has_8bit_parts saves time as we don't have to
- recurse through the message all over again if the user is
- not sending 8bit mime parts */
- if (!smtp_data (smtp_transport, message, has_8bit_parts, ex))
- return FALSE;
-
- /* reset the service for our next transfer session */
- smtp_rset (smtp_transport, ex);
-
- return TRUE;
-}
-
-static gboolean
-smtp_send (CamelTransport *transport, CamelMedium *message, CamelException *ex)
-{
- const CamelInternetAddress *to, *cc, *bcc;
- GList *recipients = NULL;
- guint index, len;
-
- to = camel_mime_message_get_recipients (CAMEL_MIME_MESSAGE (message), CAMEL_RECIPIENT_TYPE_TO);
- cc = camel_mime_message_get_recipients (CAMEL_MIME_MESSAGE (message), CAMEL_RECIPIENT_TYPE_CC);
- bcc = camel_mime_message_get_recipients (CAMEL_MIME_MESSAGE (message), CAMEL_RECIPIENT_TYPE_BCC);
-
- /* get all of the To addresses into our recipient list */
- len = CAMEL_ADDRESS (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 = CAMEL_ADDRESS (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 = CAMEL_ADDRESS (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 smtp_send_to (transport, message, recipients, ex);
-}
-
-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 *)&transport->localaddr.sin_addr, sizeof (transport->localaddr.sin_addr), AF_INET);
-
- /* hiya server! how are you today? */
- if (transport->is_esmtp) {
- if (host && host->h_name)
- cmdbuf = g_strdup_printf ("EHLO %s\r\n", host->h_name);
- else
- cmdbuf = g_strdup_printf ("EHLO [%s]\r\n", inet_ntoa (transport->localaddr.sin_addr));
- } else {
- if (host && host->h_name)
- cmdbuf = g_strdup_printf ("HELO %s\r\n", host->h_name);
- else
- cmdbuf = g_strdup_printf ("HELO [%s]\r\n", inet_ntoa (transport->localaddr.sin_addr));
- }
-
- d(fprintf (stderr, "sending : %s", cmdbuf));
- if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -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));
-
- d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
-
- if (!respbuf || strncmp (respbuf, "250", 3)) {
- int error;
-
- error = respbuf ? atoi (respbuf) : 0;
- g_free (respbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("HELO response error: %s: non-fatal"),
- get_smtp_error_string (error));
- return FALSE;
- }
-
- if (e_strstrcase (respbuf, "8BITMIME")) {
- d(fprintf (stderr, "This server supports 8bit MIME\n"));
- CAMEL_TRANSPORT (transport)->supports_8bit = TRUE;
- }
-
- if (transport->is_esmtp && strstr (respbuf, "AUTH")) {
- /* parse for supported AUTH types */
- char *auths = strstr (respbuf, "AUTH") + 4;
-
- transport->esmtp_supported_authtypes = esmtp_get_authtypes (auths);
- }
- } while (*(respbuf+3) == '-'); /* if we got "250-" then loop again */
- g_free (respbuf);
-
- return TRUE;
-}
-
-static gboolean
-smtp_mail (CamelSmtpTransport *transport, const char *sender, gboolean has_8bit_parts, 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 */
- if (CAMEL_TRANSPORT (transport)->supports_8bit && has_8bit_parts)
- cmdbuf = g_strdup_printf ("MAIL FROM: <%s> BODY=8BITMIME\r\n", sender);
- else
- cmdbuf = g_strdup_printf ("MAIL FROM: <%s>\r\n", sender);
-
- d(fprintf (stderr, "sending : %s", cmdbuf));
-
- if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -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));
-
- d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
-
- if (!respbuf || strncmp (respbuf, "250", 3)) {
- int error;
-
- error = respbuf ? atoi (respbuf) : 0;
- g_free (respbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("MAIL FROM response error: %s: mail not sent"),
- get_smtp_error_string (error));
- return FALSE;
- }
- } while (*(respbuf+3) == '-'); /* if we got "250-" then loop again */
- g_free (respbuf);
-
- return TRUE;
-}
-
-static gboolean
-smtp_rcpt (CamelSmtpTransport *transport, const char *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);
-
- d(fprintf (stderr, "sending : %s", cmdbuf));
-
- if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -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));
-
- d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
-
- if (!respbuf || strncmp (respbuf, "250", 3)) {
- int error;
-
- error = respbuf ? atoi (respbuf) : 0;
- g_free (respbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("RCPT TO response error: %s: mail not sent"),
- get_smtp_error_string (error));
- 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, gboolean has_8bit_parts, CamelException *ex)
-{
- /* now we can actually send what's important :p */
- gchar *cmdbuf, *respbuf = NULL;
- CamelStreamFilter *filtered_stream;
- CamelMimeFilter *crlffilter;
-
- /* if the message contains 8bit mime parts and the server
- doesn't support it, encode 8bit parts to the best
- encoding. This will also enforce an encoding to keep the lines in limit */
- if (has_8bit_parts && !CAMEL_TRANSPORT (transport)->supports_8bit)
- camel_mime_message_encode_8bit_parts (CAMEL_MIME_MESSAGE (message));
-
- cmdbuf = g_strdup ("DATA\r\n");
-
- d(fprintf (stderr, "sending : %s", cmdbuf));
-
- if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -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));
-
- d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
-
- 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
- */
- int error;
-
- error = respbuf ? atoi (respbuf) : 0;
- g_free (respbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("DATA response error: %s: mail not sent"),
- get_smtp_error_string (error));
- return FALSE;
- }
-
- g_free (respbuf);
- respbuf = NULL;
-
- /* setup stream filtering */
- crlffilter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_ENCODE, CAMEL_MIME_FILTER_CRLF_MODE_CRLF_DOTS);
- filtered_stream = camel_stream_filter_new_with_stream (transport->ostream);
- camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (crlffilter));
-
- if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (filtered_stream)) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("DATA send timed out: message termination: "
- "%s: mail not sent"),
- g_strerror (errno));
-
- camel_object_unref (CAMEL_OBJECT (filtered_stream));
-
- return FALSE;
- }
-
- camel_stream_flush (CAMEL_STREAM (filtered_stream));
- camel_object_unref (CAMEL_OBJECT (filtered_stream));
-
- /* terminate the message body */
-
- d(fprintf (stderr, "sending : \\r\\n.\\r\\n\n"));
-
- if (camel_stream_write (transport->ostream, "\r\n.\r\n", 5) == -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));
-
- d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
-
- if (!respbuf || strncmp (respbuf, "250", 3)) {
- int error;
-
- error = respbuf ? atoi (respbuf) : 0;
- g_free (respbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("DATA response error: message termination: "
- "%s: mail not sent"),
- get_smtp_error_string (error));
- 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");
-
- d(fprintf (stderr, "sending : %s", cmdbuf));
-
- if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -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));
-
- d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
-
- if (!respbuf || strncmp (respbuf, "250", 3)) {
- int error;
-
- error = respbuf ? atoi (respbuf) : 0;
- g_free (respbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("RSET response error: %s"),
- get_smtp_error_string (error));
- 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");
-
- d(fprintf (stderr, "sending : %s", cmdbuf));
-
- if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -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));
-
- d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
-
- if (!respbuf || strncmp (respbuf, "221", 3)) {
- int error;
-
- error = respbuf ? atoi (respbuf) : 0;
- g_free (respbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("QUIT response error: %s: non-fatal"),
- get_smtp_error_string (error));
- 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 7d647e6544..0000000000
--- a/camel/providers/smtp/camel-smtp-transport.h
+++ /dev/null
@@ -1,81 +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 <sys/param.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include "camel-transport.h"
-
-#define CAMEL_SMTP_TRANSPORT_TYPE (camel_smtp_transport_get_type ())
-#define CAMEL_SMTP_TRANSPORT(obj) (CAMEL_CHECK_CAST((obj), CAMEL_SMTP_TRANSPORT_TYPE, CamelSmtpTransport))
-#define CAMEL_SMTP_TRANSPORT_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SMTP_TRANSPORT_TYPE, CamelSmtpTransportClass))
-#define CAMEL_IS_SMTP_TRANSPORT(o) (CAMEL_CHECK_TYPE((o), CAMEL_SMTP_TRANSPORT_TYPE))
-
-
-typedef struct {
- CamelTransport parent_object;
-
- CamelStream *istream, *ostream;
-
- gboolean is_esmtp;
-
- struct sockaddr_in localaddr;
-
- GList *esmtp_supported_authtypes;
-
-} CamelSmtpTransport;
-
-
-
-typedef struct {
- CamelTransportClass parent_class;
-
-} CamelSmtpTransportClass;
-
-
-/* Standard Camel function */
-CamelType 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/.cvsignore b/camel/providers/vee/.cvsignore
deleted file mode 100644
index 3fa8afaa38..0000000000
--- a/camel/providers/vee/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
-*.bb
-*.bbg
-*.da
-*.gcov
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 023aee16af..0000000000
--- a/camel/string-utils.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* string-util : utilities for gchar* strings */
-
-/*
- *
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Jeffrey Stedfast <fejj@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;
-}
-
-void
-string_unquote (gchar *string)
-{
- /* if the string is quoted, unquote it */
-
- g_return_if_fail (string != NULL);
-
- if (*string == '"' && *(string + strlen (string) - 1) == '"') {
- *(string + strlen (string) - 1) = '\0';
- if (*string)
- memmove (string, string+1, strlen (string));
- }
-}
-
-gchar *
-strip (gchar *string, gchar c)
-{
- /* strip all occurances of c from the string */
- gchar *src, *dst;
-
- g_return_val_if_fail (string != NULL, NULL);
-
- for (src = dst = string; *src; src++)
- if (*src != c)
- *dst++ = *src;
- *dst = '\0';
-
- return string;
-}
diff --git a/camel/string-utils.h b/camel/string-utils.h
deleted file mode 100644
index 1556faa1df..0000000000
--- a/camel/string-utils.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* string-util : utilities for normal gchar * strings */
-
-/*
- *
- * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Jeffrey Stedfast <fejj@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);
-
-void string_unquote (gchar *string);
-
-gchar *strip (gchar *string, gchar c);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* STRING_UTIL_H */
diff --git a/camel/tests/.cvsignore b/camel/tests/.cvsignore
deleted file mode 100644
index fd6b811c68..0000000000
--- a/camel/tests/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
diff --git a/camel/tests/Makefile.am b/camel/tests/Makefile.am
deleted file mode 100644
index f604cb81a1..0000000000
--- a/camel/tests/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-
-SUBDIRS = lib \
- message folder stream
-
diff --git a/camel/tests/README b/camel/tests/README
deleted file mode 100644
index 6815330102..0000000000
--- a/camel/tests/README
+++ /dev/null
@@ -1,44 +0,0 @@
-
-This directory is to contain regression tests that should be run
-before committing anything to camel.
-
-In each subdirectory of tests there is a README containing a
-one-line description of each test file. This README must be kept
-uptodate.
-
-To write a new test: copy an existing one and replace the contents.
-
-See camel-test.h for a number of functions and macros which setup and
-define the test environmet, and help provide meaningful messages when
-something actually fails.
-
-All tests have the following options:
- -v[vvvv]
- verbose. more v's more verbose. 2 v's will give you
- a simple test backtrace of any partially failed tests.
- No v's give you a simple backtrace of any failed tests.
- -q
- quiet. Dont print anything, unless there is a SEGV.
-
-See the other files in lib/* for utility functions that help to
-write the tests (object comparison, creation, etc functions).
-
-Tests may fail and be non-fatal. In this case, you will see "Partial
-success" on the result of each test line. To get more information
-about the test, run the test manually with a -v command line argument.
-The more v's you have the more detail you get (upto about -vvvvv),
-generally use -vv to find out which parts of a partially successful
-test failed, and where.
-
-Note that if writing tests, non-fatal tests (bracketed by a
-camel_test_nonfatal() and camel_test_fatal() pair) should only be
-defined where: 1. The test in question should ideally pass, and 2. The
-code has known limitations currently that stop it passing, but
-otherwise works for nominal input.
-
-To debug tests, set a breakpoint on camel_test_fail, which will be
-called for any failure, even a non-fatal one. Or set it to
-camel_test_break, which will only be called for fatal errors which are
-to print to the screen.
-
- Michael <notzed@helixcode.com>
diff --git a/camel/tests/data/gendoc.pl b/camel/tests/data/gendoc.pl
deleted file mode 100755
index 732f05a4ed..0000000000
--- a/camel/tests/data/gendoc.pl
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/perl
-
-# Generate 'documents' in different encodings, from po files
-
-if ($#ARGV < 0) {
- print "Usage: gendoc.pl pofile pofile ...\n";
- exit 1;
-}
-
-$fmt = "| fmt -u ";
-
-sub read_msgstr()
-{
- my $str = "";
- while (<IN>) {
- if (m/^msgstr \"(.*)\"/) {
- $str = $1;
- if ($str eq "") {
- while (<IN>) {
- if (m/\"(.*)\"/) {
- $str .= $1;
- } else {
- last;
- }
- }
- }
- return $str;
- }
- }
- return "";
-}
-
-$unknown = "x-unknown-1";
-
-foreach $name (@ARGV) {
- if ($name =~ m@([^/]*).po$@) {
- $poname = $1;
-
- open IN,"<$name";
-
- $header = read_msgstr;
- if ($header =~ /Content-Type:.*charset=([-a-zA-Z0-9]*)/i) {
- $charset = $1;
- } else {
- $charset = $unknown++;
- }
-
- print "Building $poname.$charset.txt from $name\n";
-
- open OUT,"$fmt > $poname.$charset.txt";
- while (!eof(IN)) {
- $msg = read_msgstr;
- # de-escape
- $msg =~ s/\\n/\n/gso;
- $msg =~ s/\\t/\t/gso;
- $msg =~ s/\\(.)/$1/gso;
- print OUT $msg." ";
- }
- close OUT;
- close IN;
- } else {
- printf("ignoring $name, probably not intended\n");
- }
-}
-
diff --git a/camel/tests/data/genline.pl b/camel/tests/data/genline.pl
deleted file mode 100755
index 99ff43c882..0000000000
--- a/camel/tests/data/genline.pl
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/perl
-
-# Generate 'documents' in different encodings, from po files
-
-if ($#ARGV < 0) {
- print "Usage: genline.pl pofile pofile ...\n";
- exit 1;
-}
-
-sub read_msgstr()
-{
- my $str = "";
- while (<IN>) {
- if (m/^msgstr \"(.*)\"/) {
- $str = $1;
- if ($str eq "") {
- while (<IN>) {
- if (m/\"(.*)\"/) {
- $str .= $1;
- } else {
- last;
- }
- }
- }
- return $str;
- }
- }
- return "";
-}
-
-$unknown = "x-unknown-1";
-open OUT, ">test-lines.h";
-
-print OUT <<END;
-struct _l {
- char *type;
- char *line;
-} test_lines[] = {
-END
-
-foreach $name (@ARGV) {
- if ($name =~ m@([^/]*).po$@) {
- $poname = $1;
-
- open IN,"<$name";
-
- $header = read_msgstr;
- if ($header =~ /Content-Type:.*charset=([-a-zA-Z0-9]*)/i) {
- $charset = $1;
- } else {
- $charset = $unknown++;
- }
-
- while (!eof(IN)) {
- $msg = read_msgstr;
- if (length($msg) > 60 && length($msg) < 160) {
- print OUT "\t{ \"$charset\", \"$msg\" },\n";
- last;
- }
-# $msg =~ s/\\n/\n/gso;
-# $msg =~ s/\\t/\t/gso;
-# $msg =~ s/\\(.)/$1/gso;
-# print OUT $msg." ";
- }
- close IN;
- } else {
- printf("ignoring $name, probably not intended\n");
- }
-}
-
-print OUT "};\n";
-close OUT;
diff --git a/camel/tests/data/getaddr.pl b/camel/tests/data/getaddr.pl
deleted file mode 100755
index 74a8a81f74..0000000000
--- a/camel/tests/data/getaddr.pl
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/perl
-
-# get addresses out of messages
-
-if ($#ARGV < 0) {
- print "Usage: $0 message(s) mbox(es)\n";
- exit 1;
-}
-
-foreach $name (@ARGV) {
- open IN,"<$name";
- while (<IN>) {
- if (/^From: (.*)/i
- || /^To: (.*)/i
- || /^Cc: (.*)/i) {
- $base = $1;
- while (<IN>) {
- if (/^\s+(.*)/) {
- $base .= " ".$1;
- } else {
- last;
- }
- }
- $uniq{$base} = 1;
- }
- }
- close IN;
-}
-
-foreach $key (sort keys %uniq) {
- print $key."\n";
-}
diff --git a/camel/tests/folder/.cvsignore b/camel/tests/folder/.cvsignore
deleted file mode 100644
index ba98331a6d..0000000000
--- a/camel/tests/folder/.cvsignore
+++ /dev/null
@@ -1,12 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
-temp-test
-*.bb
-*.bbg
-*.da
-*.gcov
diff --git a/camel/tests/folder/Makefile.am b/camel/tests/folder/Makefile.am
deleted file mode 100644
index f6dd852dd8..0000000000
--- a/camel/tests/folder/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-
-INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
- -I$(includedir) \
- -I$(top_srcdir)/camel/tests/lib \
- -DG_LOG_DOMAIN=\"evolution-tests\"
-
-LDADD = \
- $(top_builddir)/camel/libcamel.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/libibex/libibex.la \
- $(GNOME_LIBDIR) \
- $(top_builddir)/camel/tests/lib/libcameltest.a \
- $(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
-
-check_PROGRAMS = \
- test1 test4 test5 \
- test2 test6 test7 \
- test3 \
- test8 \
- test9
-
-TESTS = test1 test4 test5 \
- test2 test6 test7 \
- test3 \
- test8 \
- test9
-
-
-
diff --git a/camel/tests/folder/README b/camel/tests/folder/README
deleted file mode 100644
index 4fed421413..0000000000
--- a/camel/tests/folder/README
+++ /dev/null
@@ -1,11 +0,0 @@
-
-test1 camel store folder operations (local only)
-test2 basic folder operations, local
-test3 folder searching and indexing, local
-test4 camel store folder operations, IMAP
-test5 camel store folder operations, NNTP
-test6 basic folder operations, IMAP
-test7 basic folder operations, NNTP
-
-test8 multithreaded folder torture test, local
-test9 filtering
diff --git a/camel/tests/folder/test1.c b/camel/tests/folder/test1.c
deleted file mode 100644
index e7d1ac0604..0000000000
--- a/camel/tests/folder/test1.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* store testing */
-
-#include "camel-test.h"
-#include "folders.h"
-
-#include <camel/camel-exception.h>
-#include <camel/camel-service.h>
-#include <camel/camel-session.h>
-#include <camel/camel-store.h>
-
-/* god, who designed this horrid interface */
-static char *auth_callback(CamelAuthCallbackMode mode,
- char *data, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex)
-{
- return NULL;
-}
-
-#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
-
-static char *local_providers[] = {
- "mbox",
- "mh",
- "maildir"
-};
-
-int main(int argc, char **argv)
-{
- CamelSession *session;
- CamelException *ex;
- int i;
- char *path;
-
- camel_test_init(argc, argv);
-
- ex = camel_exception_new();
-
- /* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
-
- session = camel_session_new("/tmp/camel-test", auth_callback, NULL, NULL);
-
- /* todo: cross-check everything with folder_info checks as well */
- /* todo: subscriptions? */
- /* todo: work out how to do imap/pop/nntp tests */
- for (i=0;i<ARRAY_LEN(local_providers);i++) {
- path = g_strdup_printf("%s:///tmp/camel-test/%s", local_providers[i], local_providers[i]);
-
- test_folder_basic(session, path, TRUE);
-
- g_free(path);
- }
-
- camel_object_unref((CamelObject *)session);
- camel_exception_free(ex);
-
- return 0;
-}
diff --git a/camel/tests/folder/test2.c b/camel/tests/folder/test2.c
deleted file mode 100644
index 47e0f44feb..0000000000
--- a/camel/tests/folder/test2.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* folder testing */
-
-#include "camel-test.h"
-#include "messages.h"
-#include "folders.h"
-
-#include <camel/camel-exception.h>
-#include <camel/camel-service.h>
-#include <camel/camel-session.h>
-#include <camel/camel-store.h>
-
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-mime-message.h>
-
-/* god, who designed this horrid interface */
-static char *auth_callback(CamelAuthCallbackMode mode,
- char *data, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex)
-{
- return NULL;
-}
-
-
-#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
-
-static char *stores[] = {
- "mbox:///tmp/camel-test/mbox",
- "mh:///tmp/camel-test/mh",
- "maildir:///tmp/camel-test/maildir"
-};
-
-int main(int argc, char **argv)
-{
- CamelSession *session;
- CamelException *ex;
- int i;
-
- camel_test_init(argc, argv);
-
- /* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
-
- ex = camel_exception_new();
-
- session = camel_session_new("/tmp/camel-test", auth_callback, NULL, NULL);
-
- /* we iterate over all stores we want to test, with indexing or indexing turned on or off */
- for (i=0;i<ARRAY_LEN(stores);i++) {
- char *name = stores[i];
-
- test_folder_message_ops(session, name, TRUE);
- }
-
- check_unref(session, 1);
- camel_exception_free(ex);
-
- return 0;
-}
diff --git a/camel/tests/folder/test3.c b/camel/tests/folder/test3.c
deleted file mode 100644
index 99369e5317..0000000000
--- a/camel/tests/folder/test3.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/* folder/index testing */
-
-#include "camel-test.h"
-#include "messages.h"
-#include "folders.h"
-
-#include <camel/camel-exception.h>
-#include <camel/camel-service.h>
-#include <camel/camel-session.h>
-#include <camel/camel-store.h>
-
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-mime-message.h>
-
-#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
-
-
-/* god, who designed this horrid interface */
-static char *auth_callback(CamelAuthCallbackMode mode,
- char *data, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex)
-{
- return NULL;
-}
-
-
-static void
-test_folder_search_sub(CamelFolder *folder, const char *expr, int expected)
-{
- CamelException *ex = camel_exception_new();
- GPtrArray *uids;
- GHashTable *hash;
- int i;
-
- uids = camel_folder_search_by_expression(folder, expr, ex);
- check(uids != NULL);
- check_msg(uids->len == expected, "search %s expected %d got %d", expr, expected, uids->len);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-
- /* check the uid's are actually unique, too */
- hash = g_hash_table_new(g_str_hash, g_str_equal);
- for (i=0;i<uids->len;i++) {
- check(g_hash_table_lookup(hash, uids->pdata[i]) == NULL);
- g_hash_table_insert(hash, uids->pdata[i], uids->pdata[i]);
- }
- g_hash_table_destroy(hash);
-
- camel_folder_search_free(folder, uids);
-
- camel_exception_free(ex);
-}
-
-static void
-test_folder_search(CamelFolder *folder, const char *expr, int expected)
-{
- char *matchall;
-
-#if 0
- /* FIXME: ??? */
- camel_test_nonfatal("most searches require match-all construct");
- push("Testing search: %s", expr);
- test_folder_search_sub(folder, expr, expected);
- pull();
- camel_test_fatal();
-#endif
-
- matchall = g_strdup_printf("(match-all %s)", expr);
- push("Testing search: %s", matchall);
- test_folder_search_sub(folder, matchall, expected);
- test_free(matchall);
- pull();
-}
-
-static struct {
- int counts[3];
- char *expr;
-} searches[] = {
- { { 1, 1, 0 }, "(header-matches \"subject\" \"Test1 message99 subject\")" },
-
- { { 100, 50, 0 }, "(header-contains \"subject\" \"subject\")" },
- { { 0, 0, 0 }, "(header-contains \"subject\" \"Subject\")" },
-
- { { 100, 50, 0 }, "(body-contains \"content\")" },
- { { 100, 50, 0 }, "(body-contains \"Content\")" },
-
- { { 0, 0, 0 }, "(user-flag \"every7\")" },
- { { 100/13+1, 50/13+1, 0 }, "(user-flag \"every13\")" },
- { { 1, 1, 0 }, "(= \"7tag1\" (user-tag \"every7\"))" },
- { { 100/11+1, 50/11+1, 0 }, "(= \"11tag\" (user-tag \"every11\"))" },
-
- { { 100/13 + 100/17 + 1, 50/13 + 50/17 + 2, 0 }, "(user-flag \"every13\" \"every17\")" },
- { { 100/13 + 100/17 + 1, 50/13 + 50/17 + 2, 0 }, "(or (user-flag \"every13\") (user-flag \"every17\"))" },
- { { 1, 0, 0 }, "(and (user-flag \"every13\") (user-flag \"every17\"))" },
-
- { { 0, 0, 0 }, "(and (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"Test2\"))" },
- /* we get 11 here as the header-contains is a substring match */
- { { 11, 6, 0 }, "(and (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"subject\"))" },
- { { 1, 1, 0 }, "(and (header-contains \"subject\" \"Test19\") (header-contains \"subject\" \"subject\"))" },
- { { 0, 0, 0 }, "(and (header-contains \"subject\" \"Test191\") (header-contains \"subject\" \"subject\"))" },
- { { 1, 1, 0 }, "(and (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"message99\"))" },
-
- { { 22, 11, 0 }, "(or (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"Test2\"))" },
- { { 2, 1, 0 }, "(or (header-contains \"subject\" \"Test16\") (header-contains \"subject\" \"Test99\"))" },
- { { 1, 1, 0 }, "(or (header-contains \"subject\" \"Test123\") (header-contains \"subject\" \"Test99\"))" },
- { { 100, 50, 0 }, "(or (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"subject\"))" },
- { { 11, 6, 0 }, "(or (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"message99\"))" },
-
- /* 72000 is 24*60*100 == half the 'sent date' of the messages */
- { { 100/2, 50/2, 0 }, "(> 72000 (get-sent-date))" },
- { { 100/2-1, 50/2, 0 }, "(< 72000 (get-sent-date))" },
- { { 1, 0, 0 }, "(= 72000 (get-sent-date))" },
- { { 0, 0, 0 }, "(= 72001 (get-sent-date))" },
-
- { { (100/2-1)/17+1, (50/2-1)/17+1, 0 }, "(and (user-flag \"every17\") (< 72000 (get-sent-date)))" },
- { { (100/2-1)/17+1, (50/2-1)/17, 0 }, "(and (user-flag \"every17\") (> 72000 (get-sent-date)))" },
- { { (100/2-1)/13+1, (50/2-1)/13+1, 0 }, "(and (user-flag \"every13\") (< 72000 (get-sent-date)))" },
- { { (100/2-1)/13+1, (50/2-1)/13+1, 0 }, "(and (user-flag \"every13\") (> 72000 (get-sent-date)))" },
-
- { { 100/2+100/2/17, 50/2+50/2/17, 0 }, "(or (user-flag \"every17\") (< 72000 (get-sent-date)))" },
- { { 100/2+100/2/17+1, 50/2+50/2/17+1, 0 }, "(or (user-flag \"every17\") (> 72000 (get-sent-date)))" },
- { { 100/2+100/2/13, 50/2+50/2/13+1, 0 }, "(or (user-flag \"every13\") (< 72000 (get-sent-date)))" },
- { { 100/2+100/2/13+1, 50/2+50/2/13+1, 0 }, "(or (user-flag \"every13\") (> 72000 (get-sent-date)))" },
-};
-
-static void
-run_search(CamelFolder *folder, int m)
-{
- int i, j = 0;
-
- check(m == 50 || m == 100 || m == 0);
-
- /* *shrug* messy, but it'll do */
- if (m==50)
- j = 1;
- else if (m==0)
- j = 2;
-
- push("performing searches, expected %d", m);
- for (i=0;i<ARRAY_LEN(searches);i++) {
- push("running search %d: %s", i, searches[i].expr);
- test_folder_search(folder, searches[i].expr, searches[i].counts[j]);
- pull();
- }
- pull();
-}
-
-
-static char *stores[] = {
- "mbox:///tmp/camel-test/mbox",
- "mh:///tmp/camel-test/mh",
- "maildir:///tmp/camel-test/maildir"
-};
-
-int main(int argc, char **argv)
-{
- CamelSession *session;
- CamelStore *store;
- CamelException *ex;
- CamelFolder *folder;
- CamelMimeMessage *msg;
- int i, j;
- int indexed;
- GPtrArray *uids;
-
- gtk_init(&argc, &argv);
- camel_test_init(argc, argv);
-
- ex = camel_exception_new();
-
- /* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
-
- session = camel_session_new("/tmp/camel-test", auth_callback, NULL, NULL);
-
- /* todo: cross-check everything with folder_info checks as well */
- /* todo: work out how to do imap/pop/nntp tests */
-
- /* we iterate over all stores we want to test, with indexing or indexing turned on or off */
- for (i=0;i<ARRAY_LEN(stores);i++) {
- char *name = stores[i];
- for (indexed = 0;indexed<2;indexed++) {
- char *what = g_strdup_printf("folder search: %s (%sindexed)", name, indexed?"":"non-");
- int flags;
-
- camel_test_start(what);
- test_free(what);
-
- push("getting store");
- store = camel_session_get_store(session, stores[i], ex);
- check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex));
- check(store != NULL);
- pull();
-
- push("creating %sindexed folder", indexed?"":"non-");
- if (indexed)
- flags = CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX;
- else
- flags = CAMEL_STORE_FOLDER_CREATE;
- folder = camel_store_get_folder(store, "testbox", flags, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(folder != NULL);
-
- /* we need an empty folder for this to work */
- test_folder_counts(folder, 0, 0);
- pull();
-
- /* append a bunch of messages with specific content */
- push("appending 100 test messages");
- for (j=0;j<100;j++) {
- char *content, *subject;
-
- push("creating test message");
- msg = test_message_create_simple();
- content = g_strdup_printf("data%d content\n", j);
- test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain",
- content, strlen(content));
- test_free(content);
- subject = g_strdup_printf("Test%d message%d subject", j, 100-j);
- camel_mime_message_set_subject(msg, subject);
-
- camel_mime_message_set_date(msg, j*60*24, 0);
- pull();
-
- push("appending simple message %d", j);
- camel_folder_append_message(folder, msg, NULL, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- pull();
-
- test_free(subject);
-
- check_unref(msg, 1);
- }
- pull();
-
- push("Setting up some flags &c");
- uids = camel_folder_get_uids(folder);
- check(uids->len == 100);
- for (j=0;j<100;j++) {
- char *uid = uids->pdata[j];
-
- if ((j/13)*13 == j) {
- camel_folder_set_message_user_flag(folder, uid, "every13", TRUE);
- }
- if ((j/17)*17 == j) {
- camel_folder_set_message_user_flag(folder, uid, "every17", TRUE);
- }
- if ((j/7)*7 == j) {
- char *tag = g_strdup_printf("7tag%d", j/7);
- camel_folder_set_message_user_tag(folder, uid, "every7", tag);
- test_free(tag);
- }
- if ((j/11)*11 == j) {
- camel_folder_set_message_user_tag(folder, uid, "every11", "11tag");
- }
- }
- camel_folder_free_uids(folder, uids);
- pull();
-
- push("Search before sync");
- run_search(folder, 100);
- pull();
-
- push("syncing folder, searching");
- camel_folder_sync(folder, FALSE, ex);
- run_search(folder, 100);
- pull();
-
- push("syncing wiht expunge, search");
- camel_folder_sync(folder, TRUE, ex);
- run_search(folder, 100);
- pull();
-
- push("deleting every 2nd message");
- uids = camel_folder_get_uids(folder);
- check(uids->len == 100);
- for (j=0;j<uids->len;j+=2) {
- camel_folder_delete_message(folder, uids->pdata[j]);
- }
- camel_folder_free_uids(folder, uids);
- run_search(folder, 100);
-
- push("syncing");
- camel_folder_sync(folder, FALSE, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- run_search(folder, 100);
- pull();
-
- push("expunging");
- camel_folder_expunge(folder, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- run_search(folder, 50);
- pull();
-
- pull();
-
- push("closing and re-opening folder");
- check_unref(folder, 1);
- folder = camel_store_get_folder(store, "testbox", flags&~(CAMEL_STORE_FOLDER_CREATE), ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(folder != NULL);
-
- push("deleting remaining messages");
- uids = camel_folder_get_uids(folder);
- check(uids->len == 50);
- for (j=0;j<uids->len;j++) {
- camel_folder_delete_message(folder, uids->pdata[j]);
- }
- camel_folder_free_uids(folder, uids);
- run_search(folder, 50);
-
- push("syncing");
- camel_folder_sync(folder, FALSE, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- run_search(folder, 50);
- pull();
-
- push("expunging");
- camel_folder_expunge(folder, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- run_search(folder, 0);
- pull();
-
- pull();
-
- check_unref(folder, 1);
- pull();
-
- push("deleting test folder, with no messages in it");
- camel_store_delete_folder(store, "testbox", ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- pull();
-
- check_unref(store, 1);
- camel_test_end();
- }
- }
-
- check_unref(session, 1);
- camel_exception_free(ex);
-
- return 0;
-}
diff --git a/camel/tests/folder/test4.c b/camel/tests/folder/test4.c
deleted file mode 100644
index bae2b7bb0b..0000000000
--- a/camel/tests/folder/test4.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* store testing, for remote folders */
-
-#include "camel-test.h"
-#include "folders.h"
-
-#include <camel/camel-exception.h>
-#include <camel/camel-service.h>
-#include <camel/camel-session.h>
-#include <camel/camel-store.h>
-
-/* god, who designed this horrid interface */
-static char *auth_callback(CamelAuthCallbackMode mode,
- char *data, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex)
-{
- return NULL;
-}
-
-static int regtimeout()
-{
- return 1;
-}
-
-static int unregtimeout()
-{
- return 1;
-}
-
-
-#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
-
-static char *remote_providers[] = {
- "IMAP_TEST_URL",
-};
-
-int main(int argc, char **argv)
-{
- CamelSession *session;
- CamelException *ex;
- int i;
- char *path;
-
- camel_test_init(argc, argv);
-
- ex = camel_exception_new();
-
- /* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
-
- session = camel_session_new("/tmp/camel-test", auth_callback, regtimeout, unregtimeout);
-
- /* todo: cross-check everything with folder_info checks as well */
- /* todo: subscriptions? */
- for (i=0;i<ARRAY_LEN(remote_providers);i++) {
- path = getenv(remote_providers[i]);
-
- if (path == NULL) {
- printf("Aborted (ignored).\n");
- printf("Set '%s', to re-run test.\n", remote_providers[i]);
- /* tells make check to ignore us in the total count */
- _exit(77);
- }
- camel_test_nonfatal("The IMAP code is just rooted");
- test_folder_basic(session, path, FALSE);
- camel_test_fatal();
- }
-
- camel_object_unref((CamelObject *)session);
- camel_exception_free(ex);
-
- return 0;
-}
diff --git a/camel/tests/folder/test5.c b/camel/tests/folder/test5.c
deleted file mode 100644
index 9e2544d7e5..0000000000
--- a/camel/tests/folder/test5.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* store testing, for remote folders */
-
-#include "camel-test.h"
-#include "folders.h"
-
-#include <camel/camel-exception.h>
-#include <camel/camel-service.h>
-#include <camel/camel-session.h>
-#include <camel/camel-store.h>
-
-/* god, who designed this horrid interface */
-static char *auth_callback(CamelAuthCallbackMode mode,
- char *data, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex)
-{
- return NULL;
-}
-
-static int regtimeout()
-{
- return 1;
-}
-
-static int unregtimeout()
-{
- return 1;
-}
-
-
-#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
-
-static char *remote_providers[] = {
- "NNTP_TEST_URL",
-};
-
-int main(int argc, char **argv)
-{
- CamelSession *session;
- CamelException *ex;
- int i;
- char *path;
-
- camel_test_init(argc, argv);
-
- ex = camel_exception_new();
-
- /* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
-
- session = camel_session_new("/tmp/camel-test", auth_callback, regtimeout, unregtimeout);
-
- /* todo: cross-check everything with folder_info checks as well */
- /* todo: subscriptions? */
- for (i=0;i<ARRAY_LEN(remote_providers);i++) {
- path = getenv(remote_providers[i]);
-
- if (path == NULL) {
- printf("Aborted (ignored).\n");
- printf("Set '%s', to re-run test.\n", remote_providers[i]);
- /* tells make check to ignore us in the total count */
- _exit(77);
- }
- camel_test_nonfatal("Not sure how many tests apply to NNTP");
- test_folder_basic(session, path, FALSE);
- camel_test_fatal();
- }
-
- camel_object_unref((CamelObject *)session);
- camel_exception_free(ex);
-
- return 0;
-}
diff --git a/camel/tests/folder/test6.c b/camel/tests/folder/test6.c
deleted file mode 100644
index 6f4e387fca..0000000000
--- a/camel/tests/folder/test6.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* folder testing */
-
-#include "camel-test.h"
-#include "messages.h"
-
-#include <camel/camel-exception.h>
-#include <camel/camel-service.h>
-#include <camel/camel-session.h>
-#include <camel/camel-store.h>
-
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-mime-message.h>
-
-/* god, who designed this horrid interface */
-static char *auth_callback(CamelAuthCallbackMode mode,
- char *data, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex)
-{
- return NULL;
-}
-
-static int regtimeout()
-{
- return 1;
-}
-
-static int unregtimeout()
-{
- return 1;
-}
-
-#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
-
-static char *remote_providers[] = {
- "IMAP_TEST_URL",
-};
-
-int main(int argc, char **argv)
-{
- CamelSession *session;
- CamelException *ex;
- int i;
- char *path;
-
- camel_test_init(argc, argv);
-
- /* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
-
- ex = camel_exception_new();
-
- session = camel_session_new("/tmp/camel-test", auth_callback, regtimeout, unregtimeout);
-
- for (i=0;i<ARRAY_LEN(remote_providers);i++) {
- path = getenv(remote_providers[i]);
-
- if (path == NULL) {
- printf("Aborted (ignored).\n");
- printf("Set '%s', to re-run test.\n", remote_providers[i]);
- /* tells make check to ignore us in the total count */
- _exit(77);
- }
- /*camel_test_nonfatal("The IMAP code is just rooted");*/
- test_folder_message_ops(session, path, FALSE);
- /*camel_test_fatal();*/
- }
-
- check_unref(session, 1);
- camel_exception_free(ex);
-
- return 0;
-}
diff --git a/camel/tests/folder/test7.c b/camel/tests/folder/test7.c
deleted file mode 100644
index 7acacebbcd..0000000000
--- a/camel/tests/folder/test7.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* folder testing */
-
-#include "camel-test.h"
-#include "messages.h"
-
-#include <camel/camel-exception.h>
-#include <camel/camel-service.h>
-#include <camel/camel-session.h>
-#include <camel/camel-store.h>
-
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-mime-message.h>
-
-/* god, who designed this horrid interface */
-static char *auth_callback(CamelAuthCallbackMode mode,
- char *data, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex)
-{
- return NULL;
-}
-
-static int regtimeout()
-{
- return 1;
-}
-
-static int unregtimeout()
-{
- return 1;
-}
-
-#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
-
-static char *remote_providers[] = {
- "NNTP_TEST_URL",
-};
-
-int main(int argc, char **argv)
-{
- CamelSession *session;
- CamelException *ex;
- int i;
- char *path;
-
- camel_test_init(argc, argv);
-
- /* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
-
- ex = camel_exception_new();
-
- session = camel_session_new("/tmp/camel-test", auth_callback, regtimeout, unregtimeout);
-
- for (i=0;i<ARRAY_LEN(remote_providers);i++) {
- path = getenv(remote_providers[i]);
-
- if (path == NULL) {
- printf("Aborted (ignored).\n");
- printf("Set '%s', to re-run test.\n", remote_providers[i]);
- /* tells make check to ignore us in the total count */
- _exit(77);
- }
- camel_test_nonfatal("Dont know how many tests apply to NNTP");
- test_folder_message_ops(session, path, FALSE);
- camel_test_fatal();
- }
-
- check_unref(session, 1);
- camel_exception_free(ex);
-
- return 0;
-}
diff --git a/camel/tests/folder/test8.c b/camel/tests/folder/test8.c
deleted file mode 100644
index 5665f96f2a..0000000000
--- a/camel/tests/folder/test8.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* threaded folder testing */
-
-#include "camel-test.h"
-#include "folders.h"
-#include "messages.h"
-
-#include <camel/camel-exception.h>
-#include <camel/camel-service.h>
-#include <camel/camel-session.h>
-#include <camel/camel-store.h>
-
-#define MAX_MESSAGES (100)
-#define MAX_THREADS (10)
-
-#define d(x)
-
-#ifndef ENABLE_THREADS
-int main(int argc, char **argv)
-{
- printf("Test %s is only compiled with threads enabled\n", argv[0]);
- return 77;
-}
-#else
-
-#include <pthread.h>
-
-/* god, who designed this horrid interface */
-static char *auth_callback(CamelAuthCallbackMode mode,
- char *data, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex)
-{
- return NULL;
-}
-
-#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
-
-static char *local_providers[] = {
- "mbox",
- "mh",
- "maildir"
-};
-
-static void
-test_add_message(CamelFolder *folder, int j)
-{
- CamelMimeMessage *msg;
- char *content;
- char *subject;
- CamelException ex;
-
- camel_exception_init(&ex);
-
- push("creating message %d\n", j);
- msg = test_message_create_simple();
- content = g_strdup_printf("Test message %d contents\n\n", j);
- test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain",
- content, strlen(content));
- test_free(content);
- subject = g_strdup_printf("Test message %d subject", j);
- camel_mime_message_set_subject(msg, subject);
- pull();
-
- push("appending simple message %d", j);
- camel_folder_append_message(folder, msg, NULL, &ex);
- check_msg(!camel_exception_is_set(&ex), "%s", camel_exception_get_description(&ex));
- pull();
-
- check_unref(msg, 1);
-}
-
-struct _threadinfo {
- int id;
- CamelFolder *folder;
-};
-
-static void *
-worker(void *d)
-{
- struct _threadinfo *info = d;
- int i, j, id = info->id;
- char *sub, *content;
- GPtrArray *res;
- CamelException *ex = camel_exception_new();
- CamelMimeMessage *msg;
-
- /* we add a message, search for it, twiddle some flags, delete it */
- /* and flat out */
- for (i=0;i<MAX_MESSAGES;i++) {
- d(printf("Thread %ld message %i\n", pthread_self(), i));
- test_add_message(info->folder, id+i);
-
- sub = g_strdup_printf("(match-all (header-contains \"subject\" \"message %d subject\"))", id+i);
-
- push("searching for message %d\n\tusing: %s", id+i, sub);
- res = camel_folder_search_by_expression(info->folder, sub, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check_msg(res->len == 1, "res->len = %d", res->len);
- pull();
-
- push("getting message '%s'", res->pdata[0]);
- msg = camel_folder_get_message(info->folder, (char *)res->pdata[0], ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- pull();
-
- push("comparing content");
- content = g_strdup_printf("Test message %d contents\n\n", id+i);
- test_message_compare_content(camel_medium_get_content_object((CamelMedium *)msg), content, strlen(content));
- test_free(content);
- pull();
-
- push("deleting message, cleanup");
- j=(100.0*rand()/(RAND_MAX+1.0));
- if (j<=70) {
- camel_folder_delete_message(info->folder, res->pdata[0]);
- }
-
- camel_folder_search_free(info->folder, res);
- res = NULL;
- test_free(sub);
-
- check_unref(msg, 1);
- pull();
-
- /* about 1-in 100 calls will expunge */
- j=(200.0*rand()/(RAND_MAX+1.0));
- if (j<=2) {
- d(printf("Forcing an expuge\n"));
- push("expunging folder");
- camel_folder_expunge(info->folder, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- pull();
- }
- }
-
- camel_exception_free(ex);
-
- return info;
-}
-
-int main(int argc, char **argv)
-{
- CamelSession *session;
- CamelException *ex;
- int i, j, index;
- char *path;
- CamelStore *store;
- pthread_t threads[MAX_THREADS];
- struct _threadinfo *info;
- CamelFolder *folder;
- GPtrArray *uids;
-
- camel_test_init(argc, argv);
-
- ex = camel_exception_new();
-
- /* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
-
- session = camel_session_new("/tmp/camel-test", auth_callback, NULL, NULL);
-
- for (j=0;j<ARRAY_LEN(local_providers);j++) {
- for (index=0;index<2;index++) {
- path = g_strdup_printf("method %s %s", local_providers[j], index?"indexed":"nonindexed");
- camel_test_start(path);
- test_free(path);
-
- push("trying %s index %d", local_providers[j], index);
- path = g_strdup_printf("%s:///tmp/camel-test/%s", local_providers[j], local_providers[j]);
- store = camel_session_get_store(session, path, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- test_free(path);
-
- if (index == 0)
- folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex);
- else
- folder = camel_store_get_folder(store, "testbox",
- CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-
- for (i=0;i<MAX_THREADS;i++) {
- info = g_malloc(sizeof(*info));
- info->id = i*MAX_MESSAGES;
- info->folder = folder;
- pthread_create(&threads[i], 0, worker, info);
- }
-
- for (i=0;i<MAX_THREADS;i++) {
- pthread_join(threads[i], (void **)&info);
- g_free(info);
- }
- pull();
-
- push("deleting remaining messages");
- uids = camel_folder_get_uids(folder);
- for (i=0;i<uids->len;i++) {
- camel_folder_delete_message(folder, uids->pdata[i]);
- }
- camel_folder_free_uids(folder, uids);
-
- camel_folder_expunge(folder, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-
- check_unref(folder, 1);
-
- camel_store_delete_folder(store, "testbox", ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-
- check_unref(store, 1);
-
- pull();
-
- camel_test_end();
- }
- }
-
- camel_object_unref((CamelObject *)session);
- camel_exception_free(ex);
-
- return 0;
-}
-
-#endif /* ENABLE_THREADS */
diff --git a/camel/tests/folder/test9.c b/camel/tests/folder/test9.c
deleted file mode 100644
index 3b757815b0..0000000000
--- a/camel/tests/folder/test9.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* folder/index testing */
-
-#include "camel-test.h"
-#include "messages.h"
-#include "folders.h"
-
-#include "camel/camel-exception.h"
-#include "camel/camel-service.h"
-#include "camel/camel-session.h"
-#include "camel/camel-store.h"
-
-#include "camel/camel-folder.h"
-#include "camel/camel-folder-summary.h"
-#include "camel/camel-mime-message.h"
-#include "camel/camel-filter-driver.h"
-#include "camel/camel-stream-fs.h"
-
-#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
-
-
-/* god, who designed this horrid interface */
-static char *auth_callback(CamelAuthCallbackMode mode,
- char *data, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex)
-{
- return NULL;
-}
-
-struct {
- char *name;
- CamelFolder *folder;
-} mailboxes[] = {
- { "INBOX", NULL },
- { "folder1", NULL },
- { "folder2", NULL },
- { "folder3", NULL },
- { "folder4", NULL },
-};
-
-struct {
- char *name, *match, *action;
-} rules[] = {
- { "empty1", "(match-all (header-contains \"Frobnitz\"))", "(copy-to \"folder1\")" },
- { "empty2", "(header-contains \"Frobnitz\")", "(copy-to \"folder2\")" },
- { "count11", "(and (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"subject\"))", "(move-to \"folder3\")" },
- { "empty3", "(and (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"subject\"))", "(move-to \"folder4\")" },
- { "count1", "(body-contains \"data50\")", "(copy-to \"folder1\")" },
- { "stop", "(body-contains \"data2\")", "(stop)" },
- { "notreached1", "(body-contains \"data2\")", "(move-to \"folder2\")" },
- { "count1", "(body-contains \"data3\")", "(move-to \"folder2\")" },
- { "ustrcasecmp", "(header-matches \"Subject\" \"Test0 message100 subject\")", "(copy-to \"folder2\")" },
-};
-
-/* broken match rules */
-struct {
- char *name, *match, *action;
-} brokens[] = {
- { "count1", "(body-contains data50)", "(copy-to \"folder1\")" }, /* non string argument */
- { "count1", "(body-contains-stuff \"data3\")", "(move-to-folder \"folder2\")" }, /* invalid function */
- { "count1", "(or (body-contains \"data3\") (foo))", "(move-to-folder \"folder2\")" }, /* invalid function */
- { "count1", "(or (body-contains \"data3\") (foo)", "(move-to-folder \"folder2\")" }, /* missing ) */
- { "count1", "(and body-contains \"data3\") (foo)", "(move-to-folder \"folder2\")" }, /* missing ( */
- { "count1", "body-contains \"data3\")", "(move-to-folder \"folder2\")" }, /* missing ( */
- { "count1", "body-contains \"data3\"", "(move-to-folder \"folder2\")" }, /* missing ( ) */
- { "count1", "(body-contains \"data3\" ())", "(move-to-folder \"folder2\")" }, /* extra () */
- { "count1", "()", "(move-to-folder \"folder2\")" }, /* invalid () */
- { "count1", "", "(move-to-folder \"folder2\")" }, /* empty */
-};
-
-/* broken action rules */
-struct {
- char *name, *match, *action;
-} brokena[] = {
- { "a", "(body-contains \"data2\")", "(body-contains \"help\")" }, /* rule in action */
- { "a", "(body-contains \"data2\")", "(move-to-folder-name \"folder2\")" }, /* unknown function */
- { "a", "(body-contains \"data2\")", "(or (move-to-folder \"folder2\")" }, /* missing ) */
- { "a", "(body-contains \"data2\")", "(or move-to-folder \"folder2\"))" }, /* missing ( */
- { "a", "(body-contains \"data2\")", "move-to-folder \"folder2\")" }, /* missing ( */
- { "a", "(body-contains \"data2\")", "(move-to-folder \"folder2\" ())" }, /* invalid () */
- { "a", "(body-contains \"data2\")", "()" }, /* invalid () */
- { "a", "(body-contains \"data2\")", "" }, /* empty */
-};
-
-static CamelFolder *get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelException *ex)
-{
- int i;
-
- for (i=0;i<ARRAY_LEN(mailboxes);i++)
- if (!strcmp(mailboxes[i].name, uri)) {
- camel_object_ref((CamelObject *)mailboxes[i].folder);
- return mailboxes[i].folder;
- }
- return NULL;
-}
-
-int main(int argc, char **argv)
-{
- CamelSession *session;
- CamelStore *store;
- CamelException *ex;
- CamelFolder *folder;
- CamelMimeMessage *msg;
- int i, j;
- CamelStream *mbox;
- CamelFilterDriver *driver;
-
- /*gtk_init(&argc, &argv);*/
-
- camel_test_init(argc, argv);
-
- ex = camel_exception_new();
-
- /* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
-
- camel_test_start("Simple filtering of mbox");
-
- session = camel_session_new("/tmp/camel-test", auth_callback, NULL, NULL);
-
- /* todo: cross-check everything with folder_info checks as well */
- /* todo: work out how to do imap/pop/nntp tests */
-
- push("getting store");
- store = camel_session_get_store(session, "mbox:///tmp/camel-test/mbox", ex);
- check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex));
- check(store != NULL);
- pull();
-
- push("Creating output folders");
- for (i=0;i<ARRAY_LEN(mailboxes);i++) {
- push("creating %s", mailboxes[i].name);
- mailboxes[i].folder = folder = camel_store_get_folder(store, mailboxes[i].name, CAMEL_STORE_FOLDER_CREATE, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(folder != NULL);
-
- /* we need an empty folder for this to work */
- test_folder_counts(folder, 0, 0);
- pull();
- }
- pull();
-
- /* append a bunch of messages with specific content */
- push("creating 100 test message mbox");
- mbox = camel_stream_fs_new_with_name("/tmp/camel-test/inbox", O_WRONLY|O_CREAT|O_EXCL, 0600);
- for (j=0;j<100;j++) {
- char *content, *subject;
-
- push("creating test message");
- msg = test_message_create_simple();
- content = g_strdup_printf("data%d content\n", j);
- test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain",
- content, strlen(content));
- test_free(content);
- subject = g_strdup_printf("Test%d message%d subject", j, 100-j);
- camel_mime_message_set_subject(msg, subject);
-
- camel_mime_message_set_date(msg, j*60*24, 0);
- pull();
-
- camel_stream_printf(mbox, "From \n");
- check(camel_data_wrapper_write_to_stream((CamelDataWrapper *)msg, mbox) != -1);
-#if 0
- push("appending simple message %d", j);
- camel_folder_append_message(folder, msg, NULL, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- pull();
-#endif
- test_free(subject);
-
- check_unref(msg, 1);
- }
- check(camel_stream_close(mbox) != -1);
- check_unref(mbox, 1);
- pull();
-
- push("Building filters");
- driver = camel_filter_driver_new(get_folder, NULL);
- for (i=0;i<ARRAY_LEN(rules);i++) {
- camel_filter_driver_add_rule(driver, rules[i].name, rules[i].match, rules[i].action);
- }
- pull();
-
- push("Executing filters");
- camel_filter_driver_set_default_folder(driver, mailboxes[0].folder);
- camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-
- /* now need to check the folder counts/etc */
-
- check_unref(driver, 1);
- pull();
-
- /* this tests that invalid rules are caught */
- push("Testing broken match rules");
- for (i=0;i<ARRAY_LEN(brokens);i++) {
- push("rule %s", brokens[i].match);
- driver = camel_filter_driver_new(get_folder, NULL);
- camel_filter_driver_add_rule(driver, brokens[i].name, brokens[i].match, brokens[i].action);
- camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", ex);
- check(camel_exception_is_set(ex));
- camel_exception_clear(ex);
- check_unref(driver, 1);
- pull();
- }
- pull();
-
- push("Testing broken action rules");
- for (i=0;i<ARRAY_LEN(brokena);i++) {
- push("rule %s", brokena[i].action);
- driver = camel_filter_driver_new(get_folder, NULL);
- camel_filter_driver_add_rule(driver, brokena[i].name, brokena[i].match, brokena[i].action);
- camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", ex);
- check(camel_exception_is_set(ex));
- camel_exception_clear(ex);
- check_unref(driver, 1);
- pull();
- }
- pull();
-
-
- for (i=0;i<ARRAY_LEN(mailboxes);i++) {
- check_unref(mailboxes[i].folder, 1);
- }
-
- check_unref(store, 1);
-
- check_unref(session, 1);
- camel_exception_free(ex);
-
- camel_test_end();
-
- return 0;
-}
diff --git a/camel/tests/lib/.cvsignore b/camel/tests/lib/.cvsignore
deleted file mode 100644
index ba98331a6d..0000000000
--- a/camel/tests/lib/.cvsignore
+++ /dev/null
@@ -1,12 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
-temp-test
-*.bb
-*.bbg
-*.da
-*.gcov
diff --git a/camel/tests/lib/Makefile.am b/camel/tests/lib/Makefile.am
deleted file mode 100644
index ea51a2c28a..0000000000
--- a/camel/tests/lib/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-
-INCLUDES = -I$(includedir)
-
-check_LIBRARIES = libcameltest.a
-
-libcameltest_a_SOURCES = \
- camel-test.c camel-test.h \
- messages.c messages.h \
- addresses.c addresses.h \
- folders.c folders.h \
- streams.c streams.h \
- address-data.h
-
diff --git a/camel/tests/lib/address-data.h b/camel/tests/lib/address-data.h
deleted file mode 100644
index acecac596a..0000000000
--- a/camel/tests/lib/address-data.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* BE WARY of editing this file with emacs.
- Otherwise it might be smart and try to re-encode everything, which
- you really do not want
-*/
-
-static struct _a {
- int count;
- char *addr;
- char *utf8; /* the utf8 in this table was generated by camel itself. As a result i'm making the assumption it
- was right when it was created. It also depends on the format of ::format(),. which is likely to
- change, to handle other bugs ! */
-} test_address[] = {
- { 1, "\"=?ISO-8859-1?Q?David_Guti=E9rrez_Magallanes?=\" <david@iiia.csic.es>", "David Gutiérrez Magallanes <david@iiia.csic.es>" },
- { 1, "\"=?iso-8859-1?Q?Jos=E9?= Antonio Milke G.\" <gerencia@ovoplus.com>", "José Antonio Milke G. <gerencia@ovoplus.com>" },
- { 1, "\"=?iso-8859-2?Q?Hi-Fi_Internert_market_=3D_1.Virtu=E1ln=ED_Internetov=E9_H?= =?iso-8859-2?Q?i-Fi_Studio?=\" <hifimarket@atlas.cz>", "Hi-Fi Internert market = 1.Virtuální Internetové Hi-Fi Studio <hifimarket@atlas.cz>" },
- { 3, "\"James M. Cape\" <jcape@jcinteractive.com>, =?iso-8859-1?Q?Joaqu=EDn_Cuenca_Abela?= <cuenca@ie2.u-psud.fr>, gnome-hackers@nuclecu.unam.mx", "James M. Cape <jcape@jcinteractive.com>, Joaquín Cuenca Abela <cuenca@ie2.u-psud.fr>, gnome-hackers@nuclecu.unam.mx" },
- { 1, "=?ISO-8859-1?Q?David_Guti=E9rrez_Magallanes?= <david@iiia.csic.es>", "David Gutiérrez Magallanes <david@iiia.csic.es>" },
- { 1, "=?ISO-8859-2?Q?Tomasz_K=B3oczko?= <kloczek@rudy.mif.pg.gda.pl>", "Tomasz KÅ‚oczko <kloczek@rudy.mif.pg.gda.pl>" },
- { 1, "=?ISO-8859-2?Q?Vladim=EDr_Solnick=FD?= <vs@utia.cas.cz>", "Vladimír Solnický <vs@utia.cas.cz>" },
- { 1, "=?iso-8859-1?Q?=22S=F6rensen=2C_Daniel=22?= <dasar@wmdata.com>", "\"Sörensen, Daniel\" <dasar@wmdata.com>" },
- { 1, "=?iso-8859-1?Q?=C1=C2=AAQ=A7=CA?= <dennys@iim.nctu.edu.tw>", "êQ§Ê <dennys@iim.nctu.edu.tw>" },
- { 1, "=?iso-8859-1?Q?=C1=C2=AAQ=A7=CA?= <dennys@news.iim.nctu.edu.tw>", "êQ§Ê <dennys@news.iim.nctu.edu.tw>" },
- { 1, "=?iso-8859-1?Q?=C1kos?= Valentinyi <A.Valentinyi@soton.ac.uk>", "Ãkos Valentinyi <A.Valentinyi@soton.ac.uk>" },
- { 1, "=?iso-8859-1?Q?Joaqu=EDn?= Cuenca Abela <cuenca@ie2.u-psud.fr>", "Joaquín Cuenca Abela <cuenca@ie2.u-psud.fr>" },
- { 2, "=?iso-8859-1?Q?Joaqu=EDn?= Cuenca Abela <cuenca@ie2.u-psud.fr>, gnome-hackers@nuclecu.unam.mx", "Joaquín Cuenca Abela <cuenca@ie2.u-psud.fr>, gnome-hackers@nuclecu.unam.mx" },
- { 1, "=?iso-8859-1?Q?Joaqu=EDn_Cuenca_Abela?= <cuenca@celium.net>", "Joaquín Cuenca Abela <cuenca@celium.net>" },
- { 1, "=?iso-8859-1?Q?Juantom=E1s=20Garc=EDa?= <juantomas@lared.es>", "Juantomás García <juantomas@lared.es>" },
- { 1, "=?iso-8859-1?Q?Kenneth_ll=E9phaane_Christiansen?= <kenneth@ripen.dk>", "Kenneth lléphaane Christiansen <kenneth@ripen.dk>" },
- { 1, "=?iso-8859-1?Q?Kjell_Tage_=D8hman?= <tage@ohman.no>", "Kjell Tage Øhman <tage@ohman.no>" },
- { 1, "=?iso-8859-1?Q?Martin_Norb=E4ck?= <d95mback@dtek.chalmers.se>", "Martin Norbäck <d95mback@dtek.chalmers.se>" },
- { 1, "=?iso-8859-1?Q?P=E5llen?= <pollen@astrakan.hig.se>", "PÃ¥llen <pollen@astrakan.hig.se>" },
- { 1, "=?iso-8859-1?Q?Ville_P=E4tsi?= <drc@gnu.org>", "Ville Pätsi <drc@gnu.org>" },
- { 1, "=?iso-8859-1?q?Joaqu=EDn?= Cuenca Abela <cuenca@celium.net>", "Joaquín Cuenca Abela <cuenca@celium.net>" },
- { 1, "=?iso-8859-2?Q?Dra=BEen_Ka=E8ar?= <dave@srce.hr>", "Dražen KaÄar <dave@srce.hr>" },
- /* yep this is right, this isn't valid so doesn't decode at all */
- { 1, "=?windows-1250?Q? \"Jaka Mo=E8nik\" ?= <jaka.mocnik@kiss.uni-lj.si>", "=?windows-1250?Q? Jaka Mo=E8nik ?= <jaka.mocnik@kiss.uni-lj.si>" },
- { 3, "George <jirka@5z.com>, Juantomas =?ISO-8859-1?Q?Garc=C3=83=C2=ADa?= <juantomas@lared.es>, gnome-hackers@gnome.org", "George <jirka@5z.com>, Juantomas García <juantomas@lared.es>, gnome-hackers@gnome.org" },
- { 7, "Jon Trowbridge <trow@emccta.com>, gnome-1.4-list@gnome.org, gnome-devel-list@gnome.org, gnome-hackers@gnome.org, Dom Lachowicz <cinamod@hotmail.com>, =?iso-8859-1?Q?Joaqu=EDn_Cuenca_Abela?= <cuenca@celium.net>, sam th <sam@uchicago.edu>", "Jon Trowbridge <trow@emccta.com>, gnome-1.4-list@gnome.org, gnome-devel-list@gnome.org, gnome-hackers@gnome.org, Dom Lachowicz <cinamod@hotmail.com>, Joaquín Cuenca Abela <cuenca@celium.net>, sam th <sam@uchicago.edu>" },
- { 6, "Jon Trowbridge <trow@emccta.com>, gnome-1.4-list@gnome.org, gnome-devel-list@gnome.org, gnome-hackers@gnome.org, Dom Lachowicz <cinamod@hotmail.com>, =?iso-8859-1?Q?Joaqu=EDn_Cuenca_Abela?= <cuenca@ie2.u-psud.fr>", "Jon Trowbridge <trow@emccta.com>, gnome-1.4-list@gnome.org, gnome-devel-list@gnome.org, gnome-hackers@gnome.org, Dom Lachowicz <cinamod@hotmail.com>, Joaquín Cuenca Abela <cuenca@ie2.u-psud.fr>" },
- { 1, "Kai =?iso-8859-1?Q?Gro=DFjohann?= <Kai.Grossjohann@CS.Uni-Dortmund.DE>", "Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>" },
- { 1, "Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai =?iso-8859-1?q?Gro=DFjohann?=)", "Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>" },
- { 1, "Rickard =?iso-8859-1?Q?Nordstr=F6m?= <rzi@ebox.tninet.se>", "Rickard Nordström <rzi@ebox.tninet.se>" },
- { 1, "Tomasz =?iso-8859-2?q?K=B3oczko?= <kloczek@rudy.mif.pg.gda.pl>", "Tomasz KÅ‚oczko <kloczek@rudy.mif.pg.gda.pl>" },
- { 1, "VALCKE =?iso-8859-1?Q?C=E9dric?= <cvalcke@freesurf.fr>", "VALCKE Cédric <cvalcke@freesurf.fr>" },
- { 1, "Ville =?iso-8859-1?q?P=E4tsi?= <drc@gnu.org>", "Ville Pätsi <drc@gnu.org>" },
- { 1, "david@iiia.csic.es (=?ISO-8859-1?Q?David_Guti=E9rrez_Magallanes?=)", "David Gutiérrez Magallanes <david@iiia.csic.es>" },
- { 1, "kloczek@rudy.mif.pg.gda.pl (=?ISO-8859-2?Q?Tomasz_K=B3oczko?=)", "Tomasz KÅ‚oczko <kloczek@rudy.mif.pg.gda.pl>" },
- { 1, "lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)", "Lasse Hillerøe Petersen <lassehp@imv.aau.dk>" },
- { 1, "ysato@etl.go.jp (Yutaka Sato =?ISO-2022-JP?B?GyRAOjRGI0stGyhK?=)", "Yutaka Sato ä½è—¤è±Š <ysato@etl.go.jp>" },
-};
-
-static struct _l {
- char *type;
- char *line;
-} test_lines[] = {
- /* commented out unsupported charsets - FIXME: camel should somehow handle this, although it can't really of course */
- /*{ "windows-1251", "Åäèí àïëåò íå îòãîâàðÿ íà çàÿâêà çà çàïèñ.\nÄà ãî ïðåìàõíà ëè èëè äà ïî÷àêàì?" },*/
- { "iso-8859-1", "Omple les miniatures de la finestra amb contingut de la pantalla" },
- { "ISO-8859-2", "Správce oken hýbe s okrajem okna\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" },
- { "ISO-8859-1", "Vindueshåndtering flytter dekorationsvindue istedet\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" },
- { "ISO-8859-1", "Vorschaubilder der Fenster mit dem Bildschirminhalt ausfüllen" },
- { "iso-8859-7", "ÅìöÜíéóç åñãáóéþí ðïõ äå öáßíïíôáé óôç ëßóôá ðáñáèýñùí (ÐÁÑÁÊÁÌØÇ-ËÉÓÔÁÐÁÑÁÈÕÑÙÍ)" },
- { "iso-8859-1", "You've chosen to disable the startup hint.\nTo re-enable it, choose \"Startup Hint\"\nin the GNOME Control Centre" },
- { "iso-8859-1", "El aplique de reloj muestra en su panel la fecha y la hora de forma simple \ny ligero " },
- { "iso-8859-1", "Applet ei vasta salvestuskäsule.\nKas peaks ta niisama sulgema, või veel ootama?" },
- { "iso-8859-1", "Lehio kudeatzaileak lehioaren dekorazaioa mugiarazten\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" },
- { "iso-8859-15", "Näytä sovellukset, joiden ikkunoista on näkyvillä vain otsikkopalkki" },
- { "ISO-8859-1", "Afficher les tâches qui ne sont pas dans la liste des fenêtres" },
- { "iso-8859-1", "Níl applet ag tabhair freagra ar iarratas sábháil.\nBain amach an applet nó lean ar fánacht?" },
- { "iso-8859-1", "Amosa-las tarefas agochadas da lista de fiestras (SKIP-WINLIST)" },
- { "iso-8859-2", "Az ablakkezelõ a dekorációt mozgassa az ablak helyett\n(AfterStep, Enlightenment, FVWM, IceWM, SawMill)" },
- { "iso-8859-1", "Riempi la finestra delle anteprime con il contenuto dello schermo" },
- { "euc-jp", "¥¦¥¤¥ó¥É¥¦¥Þ¥Í¡¼¥¸¥ã¤Ï¾þ¤ê¥¦¥¤¥ó¥É¥¦¤òÆ°¤«¤¹\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" },
- { "euc-kr", "â °ü¸®ÀÚ°¡ ²Ù¹Î â ´ë½Å À̵¿\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" },
- { "iso-8859-13", "Priedas neatsakinëja á praðymà iðsisaugoti.\nPaðalinti priedà ar laukti toliau?" },
- { "iso-8859-1", "Window manager verplaatst dekoratie\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" },
- { "iso-8859-1", "Vindushåndtereren flytter dekorasjonsvinduet i stedet\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" },
- { "iso-8859-2", "Przemieszczanie dekoracji zamiast okna\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" },
- { "iso-8859-1", "Este programa é responsável por executar outras aplicações, embeber pequenos applets, a paz no mundo e crashes aleatórios do X." },
- { "iso-8859-1", "Mostrar tarefas que se escondem da lista de janelas (SKIP-WINLIST)" },
- { "koi8-r", "÷ÙÓÏÔÁ ÒÁÂÏÞÅÇÏ ÓÔÏÌÁ × ÐÅÒÅËÌÀÞÁÔÅÌÅ ÓÏ×ÐÁÄÁÅÔ Ó ×ÙÓÏÔÏÊ ÐÁÎÅÌÉ" },
- { "iso-8859-2", "Správca okien presúva okraje okien\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" },
- { "iso-8859-2", "Ka¾i posle, ki se skrivajo pred upravljalnik oken (SKIP-WINLIST)" },
- { "iso-8859-5", "Window ÜÕÝÐÔ×ÕàØ ßÞÜÕàÐ ÔÕÚÞàÐæØÞÝØ ßàÞ×Þà ãÜÕáâÞ âÞÓa\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" },
- { "iso-8859-2", "Window menadzeri pomera dekoracioni prozor umesto toga\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" },
- { "iso-8859-1", "Fönsterhanteraren flyttar dekorationsfönstret istället\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" },
- /*{ "TSCII", "À½¢ì¸¼î-ºð¼¸ò¾¢ø À¡÷ì¸ ÓÊ¡¾ À½¢ì¸¼í¸¨Ç ¸¡Á¢ (À½¢ì¸¼î-ºð¼¸õ-¾Å¢÷)" },*/
- { "iso-8859-9", "Kaydetme isteðine bir uygulak cevap vermiyor .\nUygulaðý sileyim mi , yoksa bekleyeyim mi ?" },
- { "koi8-u", "ðÅÒÅͦÝÅÎÎÑ ÄÅËÏÒÁæ§ ÚÁͦÓÔØ ×¦ËÎÁ\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" },
- { "iso-8859-1", "Cwand on scriftôr est bodjî foû, li scriftôr èt totes\nles apliketes å dvins sont pierdowes. Bodjî ci scriftôr chal?" },
- { "gb2312", "ǨÒƵ½×°Êδ°¿Ú¹ÜÀí³ÌÐò(AfterStep, Enlightenment, FVWM, IceWM, SawMill)" },
- { "big5", "µøµ¡ºÞ²zªÌ¥u²¾°Ê¸Ë¹¢µøµ¡\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" },
-};
diff --git a/camel/tests/lib/addresses.c b/camel/tests/lib/addresses.c
deleted file mode 100644
index a97ac5e4f9..0000000000
--- a/camel/tests/lib/addresses.c
+++ /dev/null
@@ -1,51 +0,0 @@
-
-#include "addresses.h"
-#include "camel-test.h"
-
-void
-test_address_compare(CamelInternetAddress *addr, CamelInternetAddress *addr2)
-{
- const char *r1, *r2, *a1, *a2;
- char *e1, *e2, *f1, *f2;
- int j;
-
- check(camel_address_length(CAMEL_ADDRESS(addr)) == camel_address_length(CAMEL_ADDRESS(addr2)));
- for (j=0;j<camel_address_length(CAMEL_ADDRESS(addr));j++) {
-
- check(camel_internet_address_get(addr, j, &r1, &a1) == TRUE);
- check(camel_internet_address_get(addr2, j, &r2, &a2) == TRUE);
-
- check(string_equal(r1, r2));
- check(strcmp(a1, a2) == 0);
- }
- check(camel_internet_address_get(addr, j, &r1, &a1) == FALSE);
- check(camel_internet_address_get(addr2, j, &r2, &a2) == FALSE);
-
- e1 = camel_address_encode(CAMEL_ADDRESS(addr));
- e2 = camel_address_encode(CAMEL_ADDRESS(addr2));
-
- if (camel_address_length(CAMEL_ADDRESS(addr)) == 0)
- check(e1 == NULL && e2 == NULL);
- else
- check(e1 != NULL && e2 != NULL);
-
- if (e1 != NULL) {
- check_msg(string_equal(e1, e2), "e1 = '%s' e2 = '%s'", e1, e2);
- test_free(e1);
- test_free(e2);
- }
-
- f1 = camel_address_format(CAMEL_ADDRESS(addr));
- f2 = camel_address_format(CAMEL_ADDRESS(addr2));
-
- if (camel_address_length(CAMEL_ADDRESS(addr)) == 0)
- check(f1 == NULL && f2 == NULL);
- else
- check(f1 != NULL && f2 != NULL);
-
- if (f1 != NULL) {
- check_msg(string_equal(f1, f2), "f1 = '%s' f2 = '%s'", f1, f2);
- test_free(f1);
- test_free(f2);
- }
-}
diff --git a/camel/tests/lib/addresses.h b/camel/tests/lib/addresses.h
deleted file mode 100644
index dc35a19f05..0000000000
--- a/camel/tests/lib/addresses.h
+++ /dev/null
@@ -1,5 +0,0 @@
-
-#include <camel/camel-internet-address.h>
-
-/* addresses.c */
-void test_address_compare(CamelInternetAddress *addr, CamelInternetAddress *addr2);
diff --git a/camel/tests/lib/camel-test.c b/camel/tests/lib/camel-test.c
deleted file mode 100644
index a61f949f0a..0000000000
--- a/camel/tests/lib/camel-test.c
+++ /dev/null
@@ -1,350 +0,0 @@
-
-#include "camel-test.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <signal.h>
-
-#ifdef ENABLE_THREADS
-#include <pthread.h>
-#include <unistd.h>
-#endif
-
-#ifdef ENABLE_THREADS
-/* well i dunno, doesn't seem to be in the headers but hte manpage mentions it */
-/* a nonportable checking mutex for glibc, not really needed, just validates
- the test harness really */
-# ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
-static pthread_mutex_t lock = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-# else
-static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-# endif
-#define CAMEL_TEST_LOCK pthread_mutex_lock(&lock)
-#define CAMEL_TEST_UNLOCK pthread_mutex_unlock(&lock)
-#define CAMEL_TEST_ID (pthread_self())
-#else
-#define CAMEL_TEST_LOCK
-#define CAMEL_TEST_UNLOCK
-#define CAMEL_TEST_ID (0)
-#endif
-
-static int setup;
-static int ok;
-
-struct _stack {
- struct _stack *next;
- int fatal;
- char *what;
-};
-
-/* per-thread state */
-struct _state {
- char *test;
- int nonfatal;
- struct _stack *state;
-};
-
-static GHashTable *info_table;
-
-int camel_test_verbose;
-
-static void
-dump_action(int id, struct _state *s, void *d)
-{
- struct _stack *node;
-
-#ifdef ENABLE_THREADS
- printf("\nThread %d:\n", id);
-#endif
- node = s->state;
- if (node) {
- printf("Current action:\n");
- while (node) {
- printf("\t%s%s\n", node->fatal?"":"[nonfatal]", node->what);
- node = node->next;
- }
- }
- printf("\tTest: %s\n", s->test);
-}
-
-static void die(int sig)
-{
- static int indie = 0;
-
- if (!indie) {
- indie = 1;
- printf("\n\nReceived fatal signal %d\n", sig);
- g_hash_table_foreach(info_table, (GHFunc)dump_action, 0);
-
-#ifdef ENABLE_THREADS
- if (camel_test_verbose > 2) {
- printf("Attach debugger to pid %d to debug\n", getpid());
- sleep(1000);
- }
-#endif
- }
-
- _exit(1);
-}
-
-static struct _state *
-current_state(void)
-{
- struct _state *info;
-
- if (info_table == NULL)
- info_table = g_hash_table_new(0, 0);
-
- info = g_hash_table_lookup(info_table, (void *)CAMEL_TEST_ID);
- if (info == NULL) {
- info = g_malloc0(sizeof(*info));
- g_hash_table_insert(info_table, (void *)CAMEL_TEST_ID, info);
- }
- return info;
-}
-
-
-void camel_test_init(int argc, char **argv)
-{
- void camel_init(void);
- int i;
-
- setup = 1;
-
-#ifndef ENABLE_THREADS
- camel_init();
-#endif
-
- info_table = g_hash_table_new(0, 0);
-
- /* yeah, we do need ot thread init, even though camel isn't compiled with enable threads */
- g_thread_init(NULL);
-
- signal(SIGSEGV, die);
- signal(SIGABRT, die);
-
- /* default, just say what, how well we did, unless fail, then abort */
- camel_test_verbose = 1;
-
- for (i=0;i<argc;i++) {
- if (argv[i][0] == '-') {
- switch (argv[i][1]) {
- case 'v':
- camel_test_verbose = strlen(argv[i]);
- break;
- case 'q':
- camel_test_verbose = 0;
- break;
- }
- }
- }
-}
-
-void camel_test_start(const char *what)
-{
- struct _state *s;
-
- CAMEL_TEST_LOCK;
-
- s = current_state();
-
- if (!setup)
- camel_test_init(0, 0);
-
- ok = 1;
-
- s->test = g_strdup(what);
-
- if (camel_test_verbose > 0) {
- printf("Test: %s ... ", what);
- fflush(stdout);
- }
-
- CAMEL_TEST_UNLOCK;
-}
-
-void camel_test_push(const char *what, ...)
-{
- struct _stack *node;
- va_list ap;
- char *text;
- struct _state *s;
-
- CAMEL_TEST_LOCK;
-
- s = current_state();
-
- va_start(ap, what);
- text = g_strdup_vprintf(what, ap);
- va_end(ap);
-
- if (camel_test_verbose > 3)
- printf("Start step: %s\n", text);
-
- node = g_malloc(sizeof(*node));
- node->what = text;
- node->next = s->state;
- node->fatal = 1;
- s->state = node;
-
- CAMEL_TEST_UNLOCK;
-}
-
-void camel_test_pull(void)
-{
- struct _stack *node;
- struct _state *s;
-
- CAMEL_TEST_LOCK;
-
- s = current_state();
-
- g_assert(s->state);
-
- if (camel_test_verbose > 3)
- printf("Finish step: %s\n", s->state->what);
-
- node = s->state;
- s->state = node->next;
- if (!node->fatal)
- s->nonfatal--;
- g_free(node->what);
- g_free(node);
-
- CAMEL_TEST_UNLOCK;
-}
-
-/* where to set breakpoints */
-void camel_test_break(void);
-
-void camel_test_break(void)
-{
-}
-
-void camel_test_fail(const char *why, ...)
-{
- va_list ap;
-
- va_start(ap, why);
- camel_test_failv(why, ap);
- va_end(ap);
-}
-
-
-void camel_test_failv(const char *why, va_list ap)
-{
- char *text;
- struct _state *s;
-
- CAMEL_TEST_LOCK;
-
- s = current_state();
-
- text = g_strdup_vprintf(why, ap);
-
- if ((s->nonfatal == 0 && camel_test_verbose > 0)
- || (s->nonfatal && camel_test_verbose > 1)) {
- printf("Failed.\n%s\n", text);
- camel_test_break();
- }
-
- g_free(text);
-
- if ((s->nonfatal == 0 && camel_test_verbose > 0)
- || (s->nonfatal && camel_test_verbose > 2)) {
- g_hash_table_foreach(info_table, (GHFunc)dump_action, 0);
- }
-
- if (s->nonfatal == 0) {
- exit(1);
- } else {
- ok=0;
- if (camel_test_verbose > 1) {
- printf("Known problem (ignored):\n");
- dump_action(CAMEL_TEST_ID, s, 0);
- }
- }
-
- CAMEL_TEST_UNLOCK;
-}
-
-void camel_test_nonfatal(const char *what, ...)
-{
- struct _stack *node;
- va_list ap;
- char *text;
- struct _state *s;
-
- CAMEL_TEST_LOCK;
-
- s = current_state();
-
- va_start(ap, what);
- text = g_strdup_vprintf(what, ap);
- va_end(ap);
-
- if (camel_test_verbose > 3)
- printf("Start nonfatal: %s\n", text);
-
- node = g_malloc(sizeof(*node));
- node->what = text;
- node->next = s->state;
- node->fatal = 0;
- s->nonfatal++;
- s->state = node;
-
- CAMEL_TEST_UNLOCK;
-}
-
-void camel_test_fatal(void)
-{
- camel_test_pull();
-}
-
-void camel_test_end(void)
-{
- if (camel_test_verbose > 0) {
- if (ok)
- printf("Ok\n");
- else
- printf("Partial success\n");
- }
-
- fflush(stdout);
-}
-
-
-
-
-/* compare strings, ignore whitespace though */
-int string_equal(const char *a, const char *b)
-{
- const char *ap, *bp;
-
- ap = a;
- bp = b;
-
- while (*ap && *bp) {
- while (*ap == ' ' || *ap == '\n' || *ap == '\t')
- ap++;
- while (*bp == ' ' || *bp == '\n' || *bp == '\t')
- bp++;
-
- a = ap;
- b = bp;
-
- while (*ap && *ap != ' ' && *ap != '\n' && *ap != '\t')
- ap++;
- while (*bp && *bp != ' ' && *bp != '\n' && *bp != '\t')
- bp++;
-
- if (ap - a != bp - a
- && ap - 1 > 0
- && memcmp(a, b, ap-a) != 0) {
- return 0;
- }
- }
-
- return 1;
-}
-
diff --git a/camel/tests/lib/camel-test.h b/camel/tests/lib/camel-test.h
deleted file mode 100644
index 986a943fa3..0000000000
--- a/camel/tests/lib/camel-test.h
+++ /dev/null
@@ -1,68 +0,0 @@
-
-/* some utilities for testing */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <glib.h>
-
-void camel_test_failv(const char *why, va_list ap);
-
-/* perform a check assertion */
-#define check(x) do {if (!(x)) { camel_test_fail("%s:%d: %s", __FILE__, __LINE__, #x); } } while (0)
-/* check with message */
-#ifdef __GNUC__
-#define check_msg(x, y, z...) do {if (!(x)) { camel_test_fail("%s:%d: %s\n\t" #y, __FILE__, __LINE__, #x, ##z); } } while (0)
-#else
-static void check_msg(int truth, char *fmt, ...)
-{
- /* no gcc, we lose the condition that failed, nm */
- if (!truth) {
- va_list ap;
- va_start(ap, fmt);
- camel_test_failv(fmt, ap);
- va_end(ap);
- }
-}
-#endif
-
-#define check_count(object, expected) do { \
- if (CAMEL_OBJECT(object)->ref_count != expected) { \
- camel_test_fail("%s->ref_count != %s\n\tref_count = %d", #object, #expected, CAMEL_OBJECT(object)->ref_count); \
- } \
-} while (0)
-
-#define check_unref(object, expected) do { \
- check_count(object, expected); \
- camel_object_unref(CAMEL_OBJECT(object)); \
- if (expected == 1) { \
- object = NULL; \
- } \
-} while (0)
-
-#define test_free(mem) (g_free(mem), mem=NULL)
-
-#define push camel_test_push
-#define pull camel_test_pull
-
-void camel_test_init(int argc, char **argv);
-
-/* start/finish a new test */
-void camel_test_start(const char *what);
-void camel_test_end(void);
-
-/* start/finish a new test part */
-void camel_test_push(const char *what, ...);
-void camel_test_pull(void);
-
-/* fail a test, with a reason why */
-void camel_test_fail(const char *why, ...);
-void camel_test_failv(const char *why, va_list ap);
-
-/* Set whether a failed test quits. May be nested, but must be called in nonfatal/fatal pairs */
-void camel_test_nonfatal(const char *why, ...);
-void camel_test_fatal(void);
-
-/* utility functions */
-/* compare strings, ignore whitespace though */
-int string_equal(const char *a, const char *b);
diff --git a/camel/tests/lib/folders.c b/camel/tests/lib/folders.c
deleted file mode 100644
index ba02001bcc..0000000000
--- a/camel/tests/lib/folders.c
+++ /dev/null
@@ -1,526 +0,0 @@
-#include <string.h>
-
-#include "camel-test.h"
-#include "folders.h"
-#include "messages.h"
-
-#include "camel/camel-exception.h"
-
-/* check the total/unread is what we think it should be */
-void
-test_folder_counts(CamelFolder *folder, int total, int unread)
-{
- GPtrArray *s;
- int i, myunread;
- CamelMessageInfo *info;
-
- push("test folder counts %d total %d unread", total, unread);
-
- /* first, use the standard functions */
- check(camel_folder_get_message_count(folder) == total);
- check(camel_folder_get_unread_message_count(folder) == total);
-
- /* next, use the summary */
- s = camel_folder_get_summary(folder);
- check(s != NULL);
- check(s->len == total);
- myunread = s->len;
- for (i=0;i<s->len;i++) {
- info = s->pdata[i];
- if (info->flags & CAMEL_MESSAGE_SEEN)
- myunread--;
- }
- check(unread == myunread);
- camel_folder_free_summary(folder, s);
-
- /* last, use the uid list */
- s = camel_folder_get_uids(folder);
- check(s != NULL);
- check(s->len == total);
- myunread = s->len;
- for (i=0;i<s->len;i++) {
- info = camel_folder_get_message_info(folder, s->pdata[i]);
- if (info->flags & CAMEL_MESSAGE_SEEN)
- myunread--;
- camel_folder_free_message_info(folder, info);
- }
- check(unread == myunread);
- camel_folder_free_uids(folder, s);
-
- pull();
-}
-
-static int
-safe_strcmp(const char *a, const char *b)
-{
- if (a == NULL && b == NULL)
- return 0;
- if (a == NULL)
- return 1;
- if (b == NULL)
- return -1;
- return strcmp(a, b);
-}
-
-void
-test_message_info(CamelMimeMessage *msg, const CamelMessageInfo *info)
-{
- check_msg(safe_strcmp(camel_message_info_subject(info), camel_mime_message_get_subject(msg)) == 0,
- "info->subject = '%s', get_subject() = '%s'", camel_message_info_subject(info), camel_mime_message_get_subject(msg));
-
- /* FIXME: testing from/cc/to, etc is more tricky */
-
- check(info->date_sent == camel_mime_message_get_date(msg, NULL));
-
- /* date received isn't set for messages that haven't been sent anywhere ... */
- /*check(info->date_received == camel_mime_message_get_date_received(msg, NULL));*/
-
- /* so is messageid/references, etc */
-}
-
-/* check a message is present */
-void
-test_folder_message(CamelFolder *folder, const char *uid)
-{
- CamelMimeMessage *msg;
- CamelMessageInfo *info;
- GPtrArray *s;
- int i;
- CamelException *ex = camel_exception_new();
- int found;
-
- push("uid %s is in folder", uid);
-
- /* first try getting info */
- info = camel_folder_get_message_info(folder, uid);
- check(info != NULL);
- check(strcmp(camel_message_info_uid(info), uid) == 0);
- camel_folder_free_message_info(folder, info);
-
- /* then, getting message */
- msg = camel_folder_get_message(folder, uid, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(msg != NULL);
-
- /* cross check with info */
- test_message_info(msg, info);
-
- camel_object_unref((CamelObject *)msg);
-
- /* see if it is in the summary (only once) */
- s = camel_folder_get_summary(folder);
- check(s != NULL);
- found = 0;
- for (i=0;i<s->len;i++) {
- info = s->pdata[i];
- if (strcmp(camel_message_info_uid(info), uid) == 0)
- found++;
- }
- check(found == 1);
- camel_folder_free_summary(folder, s);
-
- /* check it is in the uid list */
- s = camel_folder_get_uids(folder);
- check(s != NULL);
- found = 0;
- for (i=0;i<s->len;i++) {
- if (strcmp(s->pdata[i], uid) == 0)
- found++;
- }
- check(found == 1);
- camel_folder_free_uids(folder, s);
-
- camel_exception_free(ex);
-
- pull();
-}
-
-/* check message not present */
-void
-test_folder_not_message(CamelFolder *folder, const char *uid)
-{
- CamelMimeMessage *msg;
- CamelMessageInfo *info;
- GPtrArray *s;
- int i;
- CamelException *ex = camel_exception_new();
- int found;
-
- push("uid %s is not in folder", uid);
-
- /* first try getting info */
- info = camel_folder_get_message_info(folder, uid);
- check(info == NULL);
-
- /* then, getting message */
- msg = camel_folder_get_message(folder, uid, ex);
- check(camel_exception_is_set(ex));
- check(msg == NULL);
- camel_exception_clear(ex);
-
- /* see if it is not in the summary (only once) */
- s = camel_folder_get_summary(folder);
- check(s != NULL);
- found = 0;
- for (i=0;i<s->len;i++) {
- info = s->pdata[i];
- if (strcmp(camel_message_info_uid(info), uid) == 0)
- found++;
- }
- check(found == 0);
- camel_folder_free_summary(folder, s);
-
- /* check it is not in the uid list */
- s = camel_folder_get_uids(folder);
- check(s != NULL);
- found = 0;
- for (i=0;i<s->len;i++) {
- if (strcmp(s->pdata[i], uid) == 0)
- found++;
- }
- check(found == 0);
- camel_folder_free_uids(folder, s);
-
- camel_exception_free(ex);
-
- pull();
-}
-
-/* test basic store operations on folders */
-/* TODO: Add subscription stuff */
-void
-test_folder_basic(CamelSession *session, const char *storename, int local)
-{
- CamelStore *store;
- CamelException *ex = camel_exception_new();
- CamelFolder *folder, *root;
- char *what = g_strdup_printf("testing store: %s", storename);
-
- camel_test_start(what);
- test_free(what);
-
- push("getting store");
- store = camel_session_get_store(session, storename, ex);
- check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex));
- check(store != NULL);
- pull();
-
- /* local providers == no root folder */
- push("getting root folder");
- root = camel_store_get_root_folder(store, ex);
- if (local) {
- check(camel_exception_is_set(ex));
- check(root == NULL);
- camel_exception_clear(ex);
- } else {
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(root != NULL);
- check_unref(root, 1);
- }
- pull();
-
- /* same for default folder */
- push("getting default folder");
- root = camel_store_get_root_folder(store, ex);
- if (local) {
- check(camel_exception_is_set(ex));
- check(root == NULL);
- camel_exception_clear(ex);
- } else {
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(root != NULL);
- check_unref(root, 1);
- }
- pull();
-
- push("getting a non-existant folder, no create");
- folder = camel_store_get_folder(store, "unknown", 0, ex);
- check(camel_exception_is_set(ex));
- check(folder == NULL);
- camel_exception_clear(ex);
- pull();
-
- push("getting a non-existant folder, with create");
- folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(folder != NULL);
- check_unref(folder, 1);
- pull();
-
- push("getting an existing folder");
- folder = camel_store_get_folder(store, "testbox", 0, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(folder != NULL);
- check_unref(folder, 1);
- pull();
-
- push("renaming a non-existant folder");
- camel_store_rename_folder(store, "unknown1", "unknown2", ex);
- check(camel_exception_is_set(ex));
- camel_exception_clear(ex);
- pull();
-
- push("renaming an existing folder");
- camel_store_rename_folder(store, "testbox", "testbox2", ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- pull();
-
- push("opening the old name of a renamed folder");
- folder = camel_store_get_folder(store, "testbox", 0, ex);
- check(camel_exception_is_set(ex));
- check(folder == NULL);
- camel_exception_clear(ex);
- pull();
-
- push("opening the new name of a renamed folder");
- folder = camel_store_get_folder(store, "testbox2", 0, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(folder != NULL);
- check_unref(folder, 1);
- pull();
-
- push("deleting a non-existant folder");
- camel_store_delete_folder(store, "unknown", ex);
- check(camel_exception_is_set(ex));
- camel_exception_clear(ex);
- pull();
-
- push("deleting an existing folder");
- camel_store_delete_folder(store, "testbox2", ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- pull();
-
- push("opening a folder that has been deleted");
- folder = camel_store_get_folder(store, "testbox2", 0, ex);
- check(camel_exception_is_set(ex));
- check(folder == NULL);
- camel_exception_clear(ex);
- pull();
-
- check_unref(store, 1);
-
- camel_test_end();
-
- camel_exception_free(ex);
-}
-
-
-/* todo: cross-check everything with folder_info checks as well */
-/* this should probably take a folder instead of a session ... */
-void
-test_folder_message_ops(CamelSession *session, const char *name, int local)
-{
- CamelStore *store;
- CamelException *ex = camel_exception_new();
- CamelFolder *folder;
- CamelMimeMessage *msg;
- int j;
- int indexed, max;
- GPtrArray *uids;
- CamelMessageInfo *info;
-
- max=local?2:1;
-
- for (indexed = 0;indexed<max;indexed++) {
- char *what = g_strdup_printf("folder ops: %s %s", name, local?(indexed?"indexed":"non-indexed"):"");
- int flags;
-
- camel_test_start(what);
- test_free(what);
-
- push("getting store");
- store = camel_session_get_store(session, name, ex);
- check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex));
- check(store != NULL);
- pull();
-
- push("creating %sindexed folder", indexed?"":"non-");
- if (indexed)
- flags = CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX;
- else
- flags = CAMEL_STORE_FOLDER_CREATE;
- folder = camel_store_get_folder(store, "testbox", flags, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(folder != NULL);
-
- /* verify empty/can't get nonexistant stuff */
- test_folder_counts(folder, 0, 0);
- test_folder_not_message(folder, "0");
- test_folder_not_message(folder, "");
-
- for (j=0;j<10;j++) {
- char *content, *subject;
-
- push("creating test message");
- msg = test_message_create_simple();
- content = g_strdup_printf("Test message %d contents\n\n", j);
- test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain",
- content, strlen(content));
- test_free(content);
- subject = g_strdup_printf("Test message %d", j);
- camel_mime_message_set_subject(msg, subject);
- pull();
-
- push("appending simple message %d", j);
- camel_folder_append_message(folder, msg, NULL, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-
- /* sigh, this shouldn't be required, but the imap code is too dumb to do it itself */
- if (!local) {
- push("forcing a refresh of folder updates");
- camel_folder_refresh_info(folder, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- pull();
- }
-
- if (!local)
- camel_test_nonfatal("unread counts dont seem right for imap");
-
- test_folder_counts(folder, j+1, j+1);
-
- if (!local)
- camel_test_fatal();
-
- push("checking it is in the right uid slot & exists");
- uids = camel_folder_get_uids(folder);
- check(uids != NULL);
- check(uids->len == j+1);
- test_folder_message(folder, uids->pdata[j]);
- pull();
-
- push("checking it is the right message (subject): %s", subject);
- info = camel_folder_get_message_info(folder, uids->pdata[j]);
- check_msg(strcmp(camel_message_info_subject(info), subject)==0,
- "info->subject %s", camel_message_info_subject(info));
- camel_folder_free_uids(folder, uids);
- camel_folder_free_message_info(folder, info);
- pull();
-
- test_free(subject);
-
- check_unref(msg, 1);
- pull();
- }
-
- check_unref(folder, 1);
- pull();
-
- push("deleting test folder, with messages in it");
- camel_store_delete_folder(store, "testbox", ex);
- check(camel_exception_is_set(ex));
- camel_exception_clear(ex);
- pull();
-
- push("re-opening folder");
- folder = camel_store_get_folder(store, "testbox", flags, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(folder != NULL);
-
- /* verify counts */
- test_folder_counts(folder, 10, 10);
-
- /* re-check uid's, after a reload */
- uids = camel_folder_get_uids(folder);
- check(uids != NULL);
- check(uids->len == 10);
- for (j=0;j<10;j++) {
- char *subject = g_strdup_printf("Test message %d", j);
-
- push("verify reload of %s", subject);
- test_folder_message(folder, uids->pdata[j]);
-
- info = camel_folder_get_message_info(folder, uids->pdata[j]);
- check_msg(strcmp(camel_message_info_subject(info), subject)==0,
- "info->subject %s", camel_message_info_subject(info));
- test_free(subject);
- camel_folder_free_message_info(folder, info);
- pull();
- }
-
- push("deleting first message & expunging");
- camel_folder_delete_message(folder, uids->pdata[0]);
- test_folder_counts(folder, 10, 10);
- camel_folder_expunge(folder, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- test_folder_not_message(folder, uids->pdata[0]);
- test_folder_counts(folder, 9, 9);
-
- camel_folder_free_uids(folder, uids);
-
- uids = camel_folder_get_uids(folder);
- check(uids != NULL);
- check(uids->len == 9);
- for (j=0;j<9;j++) {
- char *subject = g_strdup_printf("Test message %d", j+1);
-
- push("verify after expunge of %s", subject);
- test_folder_message(folder, uids->pdata[j]);
-
- info = camel_folder_get_message_info(folder, uids->pdata[j]);
- check_msg(strcmp(camel_message_info_subject(info), subject)==0,
- "info->subject %s", camel_message_info_subject(info));
- test_free(subject);
- camel_folder_free_message_info(folder, info);
- pull();
- }
- pull();
-
- push("deleting last message & expunging");
- camel_folder_delete_message(folder, uids->pdata[8]);
- /* sync? */
- test_folder_counts(folder, 9, 9);
- camel_folder_expunge(folder, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- test_folder_not_message(folder, uids->pdata[8]);
- test_folder_counts(folder, 8, 8);
-
- camel_folder_free_uids(folder, uids);
-
- uids = camel_folder_get_uids(folder);
- check(uids != NULL);
- check(uids->len == 8);
- for (j=0;j<8;j++) {
- char *subject = g_strdup_printf("Test message %d", j+1);
-
- push("verify after expunge of %s", subject);
- test_folder_message(folder, uids->pdata[j]);
-
- info = camel_folder_get_message_info(folder, uids->pdata[j]);
- check_msg(strcmp(camel_message_info_subject(info), subject)==0,
- "info->subject %s", camel_message_info_subject(info));
- test_free(subject);
- camel_folder_free_message_info(folder, info);
- pull();
- }
- pull();
-
- push("deleting all messages & expunging");
- for (j=0;j<8;j++) {
- camel_folder_delete_message(folder, uids->pdata[j]);
- }
- /* sync? */
- test_folder_counts(folder, 8, 8);
- camel_folder_expunge(folder, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- for (j=0;j<8;j++) {
- test_folder_not_message(folder, uids->pdata[j]);
- }
- test_folder_counts(folder, 0, 0);
-
- camel_folder_free_uids(folder, uids);
- pull();
-
- check_unref(folder, 1);
- pull(); /* re-opening folder */
-
- push("deleting test folder, with no messages in it");
- camel_store_delete_folder(store, "testbox", ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- pull();
-
- check_unref(store, 1);
- camel_test_end();
- }
-
- camel_exception_free(ex);
-}
diff --git a/camel/tests/lib/folders.h b/camel/tests/lib/folders.h
deleted file mode 100644
index 2cb2d97028..0000000000
--- a/camel/tests/lib/folders.h
+++ /dev/null
@@ -1,20 +0,0 @@
-
-#include "camel/camel-session.h"
-#include "camel/camel-store.h"
-
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-mime-message.h>
-
-/* check the total/unread is what we think it should be, everywhere it can be determined */
-void test_folder_counts(CamelFolder *folder, int total, int unread);
-/* cross-check info/msg */
-void test_message_info(CamelMimeMessage *msg, const CamelMessageInfo *info);
-/* check a message is present everywhere it should be */
-void test_folder_message(CamelFolder *folder, const char *uid);
-/* check message not present everywhere it shouldn't be */
-void test_folder_not_message(CamelFolder *folder, const char *uid);
-/* test basic folder ops on a store */
-void test_folder_basic(CamelSession *session, const char *storename, int local);
-/* test basic message operations on a folder */
-void test_folder_message_ops(CamelSession *session, const char *storename, int local);
diff --git a/camel/tests/lib/messages.c b/camel/tests/lib/messages.c
deleted file mode 100644
index a8c8b30465..0000000000
--- a/camel/tests/lib/messages.c
+++ /dev/null
@@ -1,153 +0,0 @@
-#include <string.h>
-
-#include "messages.h"
-#include "camel-test.h"
-
-#include <camel/camel-mime-message.h>
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-
-CamelMimeMessage *
-test_message_create_simple(void)
-{
- CamelMimeMessage *msg;
- CamelInternetAddress *addr;
-
- msg = camel_mime_message_new();
-
- addr = camel_internet_address_new();
- camel_internet_address_add(addr, "Michael Zucchi", "zed@nowhere.com");
- camel_mime_message_set_from(msg, addr);
- camel_address_remove((CamelAddress *)addr, -1);
- camel_internet_address_add(addr, "POSTMASTER", "POSTMASTER@somewhere.net");
- camel_mime_message_set_recipients(msg, CAMEL_RECIPIENT_TYPE_TO, addr);
- camel_address_remove((CamelAddress *)addr, -1);
- camel_internet_address_add(addr, "Michael Zucchi", "zed@nowhere.com");
- camel_mime_message_set_recipients(msg, CAMEL_RECIPIENT_TYPE_CC, addr);
-
- check_unref(addr, 1);
-
- camel_mime_message_set_subject(msg, "Simple message subject");
- camel_mime_message_set_date(msg, time(0), 930);
-
- return msg;
-}
-
-static void
-content_finalise(CamelObject *folder, void *crap, void *ba)
-{
- g_byte_array_free(ba, TRUE);
-}
-
-void
-test_message_set_content_simple(CamelMimePart *part, int how, const char *type, const char *text, int len)
-{
- CamelStreamMem *content = NULL;
- CamelDataWrapper *dw;
- static GByteArray *ba;
-
- switch (how) {
- case 0:
- camel_mime_part_set_content(part, text, len, type);
- break;
- case 1:
- content = (CamelStreamMem *)camel_stream_mem_new_with_buffer(text, len);
- break;
- case 2:
- content = (CamelStreamMem *)camel_stream_mem_new();
- camel_stream_mem_set_buffer(content, text, len);
- break;
- case 3:
- ba = g_byte_array_new();
- g_byte_array_append(ba, text, len);
-
- content = (CamelStreamMem *)camel_stream_mem_new_with_byte_array(ba);
- ba = NULL;
- break;
- case 4:
- ba = g_byte_array_new();
- g_byte_array_append(ba, text, len);
-
- content = (CamelStreamMem *)camel_stream_mem_new();
- camel_stream_mem_set_byte_array(content, ba);
-
- camel_object_hook_event((CamelObject *)content, "finalize", content_finalise, ba);
- break;
- }
-
- if (content != 0) {
- dw = camel_data_wrapper_new();
- camel_data_wrapper_set_mime_type (dw, type);
-
- camel_data_wrapper_construct_from_stream(dw, (CamelStream *)content);
- camel_medium_set_content_object((CamelMedium *)part, dw);
-
- check_unref(content, 2);
- check_unref(dw, 2);
- }
-}
-
-int
-test_message_write_file(CamelMimeMessage *msg, const char *name)
-{
- CamelStreamFs *file;
- int ret;
-
- file = (CamelStreamFs *)camel_stream_fs_new_with_name(name, O_CREAT|O_WRONLY, 0600);
- camel_data_wrapper_write_to_stream((CamelDataWrapper *)msg, (CamelStream *)file);
- ret = camel_stream_close((CamelStream *)file);
-
- check(((CamelObject *)file)->ref_count == 1);
- camel_object_unref((CamelObject *)file);
-
- return ret;
-}
-
-CamelMimeMessage *
-test_message_read_file(const char *name)
-{
- CamelStreamFs *file;
- CamelMimeMessage *msg2;
-
- file = (CamelStreamFs *)camel_stream_fs_new_with_name(name, O_RDONLY, 0);
- msg2 = camel_mime_message_new();
-
- camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg2, (CamelStream *)file);
- /* file's refcount may be > 1 if the message is real big */
- check(CAMEL_OBJECT(file)->ref_count >=1);
-
- return msg2;
-}
-
-int
-test_message_compare_content(CamelDataWrapper *dw, const char *text, int len)
-{
- CamelStreamMem *content;
-
- /* sigh, ok, so i len == 0, dw will probably be 0 too
- camel_mime_part_set_content is weird like that */
- if (dw == 0 && len == 0)
- return 0;
-
- content = (CamelStreamMem *)camel_stream_mem_new();
- camel_data_wrapper_write_to_stream(dw, (CamelStream *)content);
-
- check_msg(content->buffer->len == len, "buffer->len = %d, len = %d", content->buffer->len, len);
- check_msg(memcmp(content->buffer->data, text, content->buffer->len) == 0, "len = %d", len);
-
- check_unref(content, 1);
-
- return 0;
-}
-
-int
-test_message_compare_header(CamelMimeMessage *m1, CamelMimeMessage *m2)
-{
- return 0;
-}
-
-int
-test_message_compare_messages(CamelMimeMessage *m1, CamelMimeMessage *m2)
-{
- return 0;
-}
diff --git a/camel/tests/lib/messages.h b/camel/tests/lib/messages.h
deleted file mode 100644
index 9cb5758826..0000000000
--- a/camel/tests/lib/messages.h
+++ /dev/null
@@ -1,12 +0,0 @@
-
-#include <camel/camel-mime-message.h>
-
-/* how many ways to set the content contents */
-#define SET_CONTENT_WAYS (5)
-
-/* messages.c */
-CamelMimeMessage *test_message_create_simple(void);
-void test_message_set_content_simple(CamelMimePart *part, int how, const char *type, const char *text, int len);
-int test_message_write_file(CamelMimeMessage *msg, const char *name);
-CamelMimeMessage *test_message_read_file(const char *name);
-int test_message_compare_content(CamelDataWrapper *dw, const char *text, int len);
diff --git a/camel/tests/lib/streams.c b/camel/tests/lib/streams.c
deleted file mode 100644
index e4dc006363..0000000000
--- a/camel/tests/lib/streams.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- stream tests
-
- todo: do we need a seek test that seeks beyond the eos, writes,
- then reads and checks for 0's in the space?
-*/
-
-#include <string.h>
-
-#include "camel/camel-stream.h"
-#include "camel/camel-seekable-stream.h"
-#include "camel/camel-seekable-substream.h"
-
-#include "streams.h"
-
-#include "camel-test.h"
-
-static char teststring[] = "\xaa\x55\xc0\x0c\xff\x00";
-static char testbuf[10240];
-
-/* pass in an empty read/write stream */
-void
-test_stream_seekable_writepart(CamelSeekableStream *s)
-{
- off_t end;
- int i;
-
- push("seekable stream test, writing ");
-
- check(camel_seekable_stream_tell(s) == 0);
- check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_SET) == 0);
- check(camel_seekable_stream_tell(s) == 0);
-
- check(camel_stream_write(CAMEL_STREAM(s), "", 0) == 0);
- check(camel_seekable_stream_tell(s) == 0);
- check(camel_stream_write(CAMEL_STREAM(s), "\n", 1) == 1);
- check(camel_seekable_stream_tell(s) == 1);
-
- for (i=0;i<10240;i++) {
- check(camel_stream_write(CAMEL_STREAM(s), teststring, sizeof(teststring)) == sizeof(teststring));
- check(camel_seekable_stream_tell(s) == 1 + (i+1)*sizeof(teststring));
- }
- end = 10240*sizeof(teststring)+1;
-
- check_msg(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_END) == end, "seek =%d end = %d",
- camel_seekable_stream_seek(s, 0, CAMEL_STREAM_END), end);
-
- check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_END) == end);
- check(camel_seekable_stream_tell(s) == end);
- /* need to read 0 first to set eos */
- check(camel_stream_read(CAMEL_STREAM(s), testbuf, 10240) == 0);
- check(camel_stream_eos(CAMEL_STREAM(s)));
-
- pull();
-}
-
-void
-test_stream_seekable_readpart(CamelSeekableStream *s)
-{
- off_t off, new, end;
- int i, j;
-
- push("seekable stream test, re-reading");
-
- end = 10240*sizeof(teststring)+1;
-
- check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_SET) == 0);
- check(camel_seekable_stream_tell(s) == 0);
- check(!camel_stream_eos(CAMEL_STREAM(s)));
-
- off = 0;
- for (i=0;i<1024;i++) {
-
- new = i*3;
-
- /* exercise all seek methods */
- switch(i % 3) {
- case 0:
- check(camel_seekable_stream_seek(s, new, CAMEL_STREAM_SET) == new);
- break;
- case 1:
- check(camel_seekable_stream_seek(s, new-off, CAMEL_STREAM_CUR) == new);
- break;
- case 2:
- check(camel_seekable_stream_seek(s, new-end, CAMEL_STREAM_END) == new);
- break;
- }
- check(camel_seekable_stream_tell(s) == new);
-
- check(camel_stream_read(CAMEL_STREAM(s), testbuf, i*3) == i*3);
- for (j=0;j<i*3;j++) {
- int k = new + j;
-
- if (k==0) {
- check(testbuf[j] == '\n');
- } else {
- check(testbuf[j] == teststring[(k-1) % sizeof(teststring)]);
- }
- }
- off = new+i*3;
- }
-
- /* verify end-of-file behaviour */
- check(camel_seekable_stream_seek(s, -1, CAMEL_STREAM_END) == end-1);
- check(camel_seekable_stream_tell(s) == end-1);
-
- check(camel_stream_read(CAMEL_STREAM(s), testbuf, 10240) == 1);
- check(testbuf[0] == teststring[sizeof(teststring)-1]);
-
- check(camel_stream_read(CAMEL_STREAM(s), testbuf, 10240) == 0);
- check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_CUR) == end);
- check(camel_seekable_stream_tell(s) == end);
- check(camel_stream_eos(CAMEL_STREAM(s)));
-
- pull();
-}
-
-/*
- 0 = write to the substream
- 1 = write to the parent stream at the right spot
-*/
-void
-test_seekable_substream_writepart(CamelStream *s, int type)
-{
- CamelSeekableStream *ss = (CamelSeekableStream *)s;
- CamelSeekableSubstream *sus = (CamelSeekableSubstream *)s;
- CamelSeekableStream *sp = sus->parent_stream;
- int i, len;
- off_t end;
-
- push("writing substream, type %d", type);
-
- if (type == 1) {
- check(camel_seekable_stream_seek(sp, ss->bound_start, CAMEL_STREAM_SET) == ss->bound_start);
- s = (CamelStream *)sp;
- } else {
- check(camel_seekable_stream_tell(ss) == ss->bound_start);
- check(camel_seekable_stream_seek(ss, 0, CAMEL_STREAM_SET) == ss->bound_start);
- }
-
- check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_start);
-
- check(camel_stream_write(s, "", 0) == 0);
- check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_start);
-
- /* fill up the bounds with writes */
- if (ss->bound_end != CAMEL_STREAM_UNBOUND) {
- for (i=0;i<(ss->bound_end-ss->bound_start)/sizeof(teststring);i++) {
- check(camel_stream_write(s, teststring, sizeof(teststring)) == sizeof(teststring));
- check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_start + (i+1)*sizeof(teststring));
- }
- len = (ss->bound_end-ss->bound_start) % sizeof(teststring);
- check(camel_stream_write(s, teststring, len) == len);
- check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_end);
- if (type == 0) {
- check(camel_stream_write(s, teststring, sizeof(teststring)) == 0);
- check(camel_stream_eos(s));
- check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_end);
- }
- } else {
- /* just 10K */
- for (i=0;i<10240;i++) {
- check(camel_stream_write(CAMEL_STREAM(s), teststring, sizeof(teststring)) == sizeof(teststring));
- check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_start + (i+1)*sizeof(teststring));
- }
-
- /* we can't really verify any end length here */
- }
-
- pull();
-}
-
-void
-test_seekable_substream_readpart(CamelStream *s)
-{
- CamelSeekableStream *ss = (CamelSeekableStream *)s;
- CamelSeekableSubstream *sus = (CamelSeekableSubstream *)s;
- CamelSeekableStream *sp = sus->parent_stream;
- int i, len;
- off_t end;
-
- push("reading substream");
-
- check(camel_seekable_stream_seek(ss, 0, CAMEL_STREAM_SET) == ss->bound_start);
- check(camel_seekable_stream_tell(ss) == ss->bound_start);
-
- check(camel_seekable_stream_seek(sp, ss->bound_start, CAMEL_STREAM_SET) == ss->bound_start);
- check(camel_seekable_stream_tell(sp) == ss->bound_start);
-
- /* check writes, cross check with parent stream */
- if (ss->bound_end != CAMEL_STREAM_UNBOUND) {
- for (i=0;i<(ss->bound_end-ss->bound_start)/sizeof(teststring);i++) {
- check(camel_stream_read(s, testbuf, sizeof(teststring)) == sizeof(teststring));
- check(memcmp(testbuf, teststring, sizeof(teststring)) == 0);
- check(camel_seekable_stream_tell(ss) == ss->bound_start + (i+1)*sizeof(teststring));
-
- /* yeah great, the substreams affect the seek ... */
- check(camel_seekable_stream_seek(sp, ss->bound_start + (i)*sizeof(teststring), CAMEL_STREAM_SET) == ss->bound_start + i*sizeof(teststring));
- check(camel_stream_read(CAMEL_STREAM(sp), testbuf, sizeof(teststring)) == sizeof(teststring));
- check(memcmp(testbuf, teststring, sizeof(teststring)) == 0);
- check(camel_seekable_stream_tell(sp) == ss->bound_start + (i+1)*sizeof(teststring));
- }
- len = (ss->bound_end-ss->bound_start) % sizeof(teststring);
- check(camel_stream_read(s, testbuf, len) == len);
- check(memcmp(testbuf, teststring, len) == 0);
-
- check(camel_seekable_stream_seek(sp, ss->bound_end - len, CAMEL_STREAM_SET) == ss->bound_end - len);
- check(camel_stream_read(CAMEL_STREAM(sp), testbuf, len) == len);
- check(memcmp(testbuf, teststring, len) == 0);
-
- check(camel_stream_eos(s));
- check(camel_seekable_stream_tell(ss) == ss->bound_end);
- check(camel_seekable_stream_tell(sp) == ss->bound_end);
- check(camel_stream_read(s, testbuf, 1024) == 0);
- check(camel_seekable_stream_tell(ss) == ss->bound_end);
- check(camel_seekable_stream_tell(sp) == ss->bound_end);
- check(camel_stream_eos(s));
- } else {
- /* just 10K */
- for (i=0;i<10240;i++) {
- check(camel_stream_read(s, testbuf, sizeof(teststring)) == sizeof(teststring));
- check(memcmp(testbuf, teststring, sizeof(teststring)) == 0);
- check(camel_seekable_stream_tell(ss) == ss->bound_start + (i+1)*sizeof(teststring));
-
- check(camel_seekable_stream_seek(sp, ss->bound_start + (i)*sizeof(teststring), CAMEL_STREAM_SET) == ss->bound_start + i*sizeof(teststring));
- check(camel_stream_read(CAMEL_STREAM(sp), testbuf, sizeof(teststring)) == sizeof(teststring));
- check(memcmp(testbuf, teststring, sizeof(teststring)) == 0);
- check(camel_seekable_stream_tell(sp) == ss->bound_start + (i+1)*sizeof(teststring));
- }
-
- /* unbound - we dont know the real length */
-#if 0
- end = 10240*sizeof(teststring)+ss->bound_start;
-
- check(camel_seekable_stream_seek(ss, 0, CAMEL_STREAM_END) == end);
- check(camel_seekable_stream_tell(ss) == end);
- /* need to read 0 first to set eos */
- check(camel_stream_read(s, testbuf, 10240) == 0);
- check(camel_stream_eos(s));
-#endif
- }
-
- pull();
-}
diff --git a/camel/tests/lib/streams.h b/camel/tests/lib/streams.h
deleted file mode 100644
index df52e283d0..0000000000
--- a/camel/tests/lib/streams.h
+++ /dev/null
@@ -1,12 +0,0 @@
-
-#include "camel/camel-seekable-stream.h"
-
-/* call one, then the other on the same stream content */
-void test_stream_seekable_writepart(CamelSeekableStream *s);
-void test_stream_seekable_readpart(CamelSeekableStream *s);
-
-/* same, for substreams, multiple ways of writing */
-#define SEEKABLE_SUBSTREAM_WAYS (2)
-
-void test_seekable_substream_writepart(CamelStream *s, int type);
-void test_seekable_substream_readpart(CamelStream *s);
diff --git a/camel/tests/message/.cvsignore b/camel/tests/message/.cvsignore
deleted file mode 100644
index 4f58c83bd0..0000000000
--- a/camel/tests/message/.cvsignore
+++ /dev/null
@@ -1,15 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
-test1
-test2
-test3
-*.msg
-*.bb
-*.bbg
-*.da
-*.gcov
diff --git a/camel/tests/message/Makefile.am b/camel/tests/message/Makefile.am
deleted file mode 100644
index aa430fa409..0000000000
--- a/camel/tests/message/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-
-INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
- -I$(includedir) \
- -I$(top_srcdir)/camel/tests/lib \
- -DG_LOG_DOMAIN=\"evolution-tests\"
-
-LDADD = \
- $(top_builddir)/camel/libcamel.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/libibex/libibex.la \
- $(GNOME_LIBDIR) \
- $(top_builddir)/camel/tests/lib/libcameltest.a \
- $(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
-
-check_PROGRAMS = \
- test1 \
- test2 \
- test3
-
-TESTS = test1 test2 test3
-
-
-
diff --git a/camel/tests/message/README b/camel/tests/message/README
deleted file mode 100644
index 280344ce9b..0000000000
--- a/camel/tests/message/README
+++ /dev/null
@@ -1,5 +0,0 @@
-
-test1 creating, saving, loading simple messages
-test2 camelinternetaddress tests, internationalised addresses, etc.
-test3 multipart messages
-
diff --git a/camel/tests/message/test1.c b/camel/tests/message/test1.c
deleted file mode 100644
index 3294000550..0000000000
--- a/camel/tests/message/test1.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- test1.c
-
- Create a message, save it.
-
- Retrieve message, compare content.
-
-
- Operations:
- writing/loading from different types of streams
- reading/writing different content
- reading/writing different encodings
- reading/writing different charsets
-
- Just testing streams:
- different stream types
- different file ops
- seek, eof, etc.
-*/
-
-#include "camel-test.h"
-#include "messages.h"
-
-/* for stat */
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <camel/camel-mime-message.h>
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-
-struct _text {
- char *text;
- int len;
-};
-
-#define MAX_TEXTS (14)
-struct _text texts[MAX_TEXTS];
-
-static void
-setup(void)
-{
- int i, j;
- char *p;
-
- /* setup various edge and other general cases */
- texts[0].text = "";
- texts[0].len = 0;
- texts[1].text = "";
- texts[1].len = 1;
- texts[2].text = "\n";
- texts[2].len = 1;
- texts[3].text = "A";
- texts[3].len = 1;
- texts[4].text = "This is a test.\n.";
- texts[4].len = strlen(texts[4].text);
- texts[5].text = "This is a test.\n\n.\n";
- texts[5].len = strlen(texts[5].text);
- texts[6].text = g_malloc0(1024);
- texts[6].len = 1024;
- texts[7].text = g_malloc0(102400);
- texts[7].len = 102400;
- texts[8].text = g_malloc(1024);
- memset(texts[8].text, '\n', 1024);
- texts[8].len = 1024;
- texts[9].text = g_malloc(102400);
- memset(texts[9].text, '\n', 102400);
- texts[9].len = 102400;
- texts[10].text = g_malloc(1024);
- memset(texts[10].text, ' ', 1024);
- texts[10].len = 1024;
- texts[11].text = g_malloc(102400);
- memset(texts[11].text, ' ', 102400);
- texts[11].len = 102400;
-
- srand(42);
- p = texts[12].text = g_malloc(1024);
- for (i=0;i<1024;i++) {
- j = rand();
- if (j<RAND_MAX/120)
- *p++ = '\n';
- else
- *p++ = (j % 95) + 32;
- }
- texts[12].len = 1024;
- p = texts[13].text = g_malloc(102400);
- for (i=0;i<102400;i++) {
- j = rand();
- if (j<RAND_MAX/120)
- *p++ = '\n';
- else
- *p++ = (j % 95) + 32;
- }
- texts[13].len = 102400;
-}
-
-static void cleanup(void)
-{
- int i;
-
- for (i=6;i<14;i++) {
- g_free(texts[i].text);
- }
-}
-
-int main(int argc, char **argv)
-{
- CamelMimeMessage *msg, *msg2;
- int i, j;
- char *text;
- int len;
-
- camel_test_init(argc, argv);
-
- setup();
-
- camel_test_start("Simple memory-based content creation");
-
- /* test all ways of setting simple content for a message (i.e. memory based) */
- for (j=0;j<MAX_TEXTS;j++) {
- push("testing text number %d", j);
- text = texts[j].text;
- len = texts[j].len;
- for (i=0;i<SET_CONTENT_WAYS;i++) {
- push("create simple message %d", i);
- msg = test_message_create_simple();
-
- push("set simple content");
- test_message_set_content_simple((CamelMimePart *)msg, i, "text/plain", text, len);
- pull();
-
- push("compare original content");
- test_message_compare_content(camel_medium_get_content_object((CamelMedium *)msg), text, len);
- pull();
-
- push("save message to test1.msg");
- unlink("test1.msg");
- test_message_write_file(msg, "test1.msg");
- check_unref(msg, 1);
- pull();
-
- push("read from test1.msg");
- msg2 = test_message_read_file("test1.msg");
- pull();
-
- push("compare read with original content");
- test_message_compare_content(camel_medium_get_content_object((CamelMedium *)msg2), text, len);
- check_unref(msg2, 1);
- pull();
-
- unlink("test1.msg");
- pull();
- }
- pull();
- }
-
- camel_test_end();
-
- camel_test_start("Different encodings");
- for (j=0;j<MAX_TEXTS;j++) {
- push("testing text number %d", j);
- text = texts[j].text;
- len = texts[j].len;
- for (i=0;i<CAMEL_MIME_PART_NUM_ENCODINGS;i++) {
-
- push("test simple message, encoding %s", camel_mime_part_encoding_to_string(i));
- msg = test_message_create_simple();
-
- push("set simple content");
- test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain", text, len);
- pull();
-
- camel_mime_part_set_encoding((CamelMimePart *)msg, i);
-
- push("save message to test1.msg");
- unlink("test1.msg");
- test_message_write_file(msg, "test1.msg");
- check_unref(msg, 1);
- pull();
-
- push("read from test1.msg");
- msg2 = test_message_read_file("test1.msg");
- pull();
-
- push("compare read with original content");
- test_message_compare_content(camel_medium_get_content_object((CamelMedium *)msg2), text, len);
- check_unref(msg2, 1);
- pull();
-
- unlink("test1.msg");
- pull();
- }
- pull();
- }
- camel_test_end();
-
- cleanup();
-
- return 0;
-}
diff --git a/camel/tests/message/test2.c b/camel/tests/message/test2.c
deleted file mode 100644
index abeafa9524..0000000000
--- a/camel/tests/message/test2.c
+++ /dev/null
@@ -1,327 +0,0 @@
-#include "camel-test.h"
-#include "messages.h"
-#include "addresses.h"
-
-/* for stat */
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <unicode.h>
-
-#include <camel/camel-internet-address.h>
-#include <camel/camel-address.h>
-
-#include "address-data.h"
-
-static char *convert(const char *in, const char *from, const char *to)
-{
- unicode_iconv_t ic = unicode_iconv_open(to, from);
- char *out, *outp;
- const char *inp;
- int inlen, outlen;
-
- if (ic == (unicode_iconv_t)-1)
- return g_strdup(in);
-
- inlen = strlen(in);
- outlen = inlen*5 + 16;
-
- outp = out = g_malloc(outlen);
- inp = in;
-
- if (unicode_iconv(ic, &inp, &inlen, &outp, &outlen) == -1) {
- test_free(out);
- unicode_iconv_close(ic);
- return g_strdup(in);
- }
-
- if (unicode_iconv(ic, NULL, 0, &outp, &outlen) == -1) {
- test_free(out);
- unicode_iconv_close(ic);
- return g_strdup(in);
- }
-
- unicode_iconv_close(ic);
-
- *outp = 0;
-
-#if 0
- /* lets see if we can convert back again? */
- {
- char *nout, *noutp;
- unicode_iconv_t ic = unicode_iconv_open(from, to);
-
- inp = out;
- inlen = strlen(out);
- outlen = inlen*5 + 16;
- noutp = nout = g_malloc(outlen);
- if (unicode_iconv(ic, &inp, &inlen, &noutp, &outlen) == -1
- || unicode_iconv(ic, NULL, 0, &noutp, &outlen) == -1) {
- g_warning("Cannot convert '%s' \n from %s to %s: %s\n", in, to, from, strerror(errno));
- }
- unicode_iconv_close(ic);
- }
-
- /* and lets see what camel thinks out optimal charset is */
- {
- printf("Camel thinks the best encoding of '%s' is %s, although we converted from %s\n",
- in, camel_charset_best(out, strlen(out)), from);
- }
-#endif
-
- return out;
-}
-
-#define to_utf8(in, type) convert(in, type, "utf-8")
-#define from_utf8(in, type) convert(in, "utf-8", type)
-
-#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
-
-int main(int argc, char **argv)
-{
- int i;
- CamelInternetAddress *addr, *addr2;
- char *name;
- char *charset;
- const char *real, *where;
- char *enc, *enc2, *format, *format2;
-
- camel_test_init(argc, argv);
-
- camel_test_start("CamelInternetAddress, basics");
-
- addr = camel_internet_address_new();
-
- push("Test blank address");
- check(camel_address_length(CAMEL_ADDRESS(addr)) == 0);
- check(camel_internet_address_get(addr, 0, &real, &where) == FALSE);
- pull();
-
- push("Test blank clone");
- addr2 = CAMEL_INTERNET_ADDRESS(camel_address_new_clone(CAMEL_ADDRESS(addr)));
- test_address_compare(addr, addr2);
- check_unref(addr2, 1);
- pull();
-
- push("Test add 1");
- camel_internet_address_add(addr, "Zed", "nowhere@here.com.au");
- check(camel_address_length(CAMEL_ADDRESS(addr)) == 1);
- check(camel_internet_address_get(addr, 0, &real, &where) == TRUE);
- check_msg(string_equal("Zed", real), "real = '%s'", real);
- check(strcmp(where, "nowhere@here.com.au") == 0);
- pull();
-
- push("Test clone 1");
- addr2 = CAMEL_INTERNET_ADDRESS(camel_address_new_clone(CAMEL_ADDRESS(addr)));
- test_address_compare(addr, addr2);
- check_unref(addr2, 1);
- pull();
-
- push("Test add many");
- for (i=1;i<10;i++) {
- char name[16], a[32];
- sprintf(name, "Zed %d", i);
- sprintf(a, "nowhere@here-%d.com.au", i);
- camel_internet_address_add(addr, name, a);
- check(camel_address_length(CAMEL_ADDRESS(addr)) == i+1);
- check(camel_internet_address_get(addr, i, &real, &where) == TRUE);
- check_msg(string_equal(name, real), "name = '%s' real = '%s'", name, real);
- check(strcmp(where, a) == 0);
- }
- pull();
-
- /* put a few of these in to make it look like its doing something impressive ... :) */
- camel_test_end();
- camel_test_start("CamelInternetAddress, search");
-
- push("Test search");
- camel_test_nonfatal("Address comparisons should ignore whitespace??");
- check(camel_internet_address_find_name(addr, "Zed 1", &where) == 1);
- check(camel_internet_address_find_name(addr, "Zed 9", &where) == 9);
- check(camel_internet_address_find_name(addr, "Zed", &where) == 0);
- check(camel_internet_address_find_name(addr, " Zed", &where) == 0);
- check(camel_internet_address_find_name(addr, "Zed ", &where) == 0);
- check(camel_internet_address_find_name(addr, " Zed ", &where) == 0);
- check(camel_internet_address_find_name(addr, "Zed 20", &where) == -1);
- check(camel_internet_address_find_name(addr, "", &where) == -1);
- /* interface dont handle nulls :) */
- /*check(camel_internet_address_find_name(addr, NULL, &where) == -1);*/
-
- check(camel_internet_address_find_address(addr, "nowhere@here-1.com.au", &where) == 1);
- check(camel_internet_address_find_address(addr, "nowhere@here-1 . com.au", &where) == 1);
- check(camel_internet_address_find_address(addr, "nowhere@here-2 .com.au ", &where) == 2);
- check(camel_internet_address_find_address(addr, " nowhere @here-3.com.au", &where) == 3);
- check(camel_internet_address_find_address(addr, "nowhere@here-20.com.au ", &where) == -1);
- check(camel_internet_address_find_address(addr, "", &where) == -1);
- /*check(camel_internet_address_find_address(addr, NULL, &where) == -1);*/
- camel_test_fatal();
- pull();
-
- camel_test_end();
- camel_test_start("CamelInternetAddress, copy/cat/clone");
-
- push("Test clone many");
- addr2 = CAMEL_INTERNET_ADDRESS(camel_address_new_clone(CAMEL_ADDRESS(addr)));
- test_address_compare(addr, addr2);
- pull();
-
- push("Test remove items");
- camel_address_remove(CAMEL_ADDRESS(addr2), 0);
- check(camel_address_length(CAMEL_ADDRESS(addr2)) == 9);
- camel_address_remove(CAMEL_ADDRESS(addr2), 0);
- check(camel_address_length(CAMEL_ADDRESS(addr2)) == 8);
- camel_address_remove(CAMEL_ADDRESS(addr2), 5);
- check(camel_address_length(CAMEL_ADDRESS(addr2)) == 7);
- camel_address_remove(CAMEL_ADDRESS(addr2), 10);
- check(camel_address_length(CAMEL_ADDRESS(addr2)) == 7);
- camel_address_remove(CAMEL_ADDRESS(addr2), -1);
- check(camel_address_length(CAMEL_ADDRESS(addr2)) == 0);
- check_unref(addr2, 1);
- pull();
-
- push("Testing copy/cat");
- push("clone + cat");
- addr2 = CAMEL_INTERNET_ADDRESS(camel_address_new_clone(CAMEL_ADDRESS(addr)));
- camel_address_cat(CAMEL_ADDRESS(addr2), CAMEL_ADDRESS(addr));
- check(camel_address_length(CAMEL_ADDRESS(addr)) == 10);
- check(camel_address_length(CAMEL_ADDRESS(addr2)) == 20);
- check_unref(addr2, 1);
- pull();
-
- push("cat + cat + copy");
- addr2 = camel_internet_address_new();
- camel_address_cat(CAMEL_ADDRESS(addr2), CAMEL_ADDRESS(addr));
- test_address_compare(addr, addr2);
- camel_address_cat(CAMEL_ADDRESS(addr2), CAMEL_ADDRESS(addr));
- check(camel_address_length(CAMEL_ADDRESS(addr)) == 10);
- check(camel_address_length(CAMEL_ADDRESS(addr2)) == 20);
- camel_address_copy(CAMEL_ADDRESS(addr2), CAMEL_ADDRESS(addr));
- test_address_compare(addr, addr2);
- check_unref(addr2, 1);
- pull();
-
- push("copy");
- addr2 = camel_internet_address_new();
- camel_address_copy(CAMEL_ADDRESS(addr2), CAMEL_ADDRESS(addr));
- test_address_compare(addr, addr2);
- check_unref(addr2, 1);
- pull();
-
- pull();
-
- check_unref(addr, 1);
-
- camel_test_end();
-
- camel_test_start("CamelInternetAddress, I18N");
-
- for (i=0;i<ARRAY_LEN(test_lines);i++) {
- push("Testing text line %d (%s) '%s'", i, test_lines[i].type, test_lines[i].line);
-
- addr = camel_internet_address_new();
-
- /* first, convert to api format (utf-8) */
- charset = test_lines[i].type;
- name = to_utf8(test_lines[i].line, charset);
-
- push("Address setup");
- camel_internet_address_add(addr, name, "nobody@nowhere.com");
- check(camel_internet_address_get(addr, 0, &real, &where) == TRUE);
- check_msg(string_equal(name, real), "name = '%s' real = '%s'", name, real);
- check(strcmp(where, "nobody@nowhere.com") == 0);
- test_free(name);
-
- check(camel_internet_address_get(addr, 1, &real, &where) == FALSE);
- check(camel_address_length(CAMEL_ADDRESS(addr)) == 1);
- pull();
-
- push("Address encode/decode");
- enc = camel_address_encode(CAMEL_ADDRESS(addr));
-
- addr2 = camel_internet_address_new();
- check(camel_address_decode(CAMEL_ADDRESS(addr2), enc) == 1);
- check(camel_address_length(CAMEL_ADDRESS(addr2)) == 1);
-
- enc2 = camel_address_encode(CAMEL_ADDRESS(addr2));
- check_msg(string_equal(enc, enc2), "enc = '%s' enc2 = '%s'", enc, enc2);
- test_free(enc2);
-
- push("Compare addresses");
- test_address_compare(addr, addr2);
- pull();
- check_unref(addr2, 1);
- test_free(enc);
- pull();
-
- /* FIXME: format/unformat arne't guaranteed to be reversible, at least at the moment */
- camel_test_nonfatal("format/unformat not (yet) reversible for all cases");
-
- push("Address format/unformat");
- format = camel_address_format(CAMEL_ADDRESS(addr));
-
- addr2 = camel_internet_address_new();
- check(camel_address_unformat(CAMEL_ADDRESS(addr2), format) == 1);
- check(camel_address_length(CAMEL_ADDRESS(addr2)) == 1);
-
- format2 = camel_address_format(CAMEL_ADDRESS(addr2));
- check_msg(string_equal(format, format2), "format = '%s\n\tformat2 = '%s'", format, format2);
- test_free(format2);
-
- /* currently format/unformat doesn't handle ,'s and other special chars at all */
- if (camel_address_length(CAMEL_ADDRESS(addr2)) == 1) {
- push("Compare addresses");
- test_address_compare(addr, addr2);
- pull();
- }
-
- test_free(format);
- pull();
-
- camel_test_fatal();
-
- check_unref(addr2, 1);
-
- check_unref(addr, 1);
- pull();
-
- }
-
- camel_test_end();
-
- camel_test_start("CamelInternetAddress, I18N decode");
-
- for (i=0;i<ARRAY_LEN(test_address);i++) {
- push("Testing address line %d '%s'", i, test_address[i].addr);
-
- addr = camel_internet_address_new();
- push("checking decoded");
- check(camel_address_decode(CAMEL_ADDRESS(addr), test_address[i].addr) == test_address[i].count);
- format = camel_address_format(CAMEL_ADDRESS(addr));
- check(strcmp(format, test_address[i].utf8) == 0);
- test_free(format);
- pull();
-
- push("Comparing re-encoded output");
- addr2 = CAMEL_INTERNET_ADDRESS(camel_internet_address_new());
- enc = camel_address_encode(CAMEL_ADDRESS(addr));
- check_msg(camel_address_decode(CAMEL_ADDRESS(addr2), enc) == test_address[i].count, "enc = '%s'", enc);
- test_free(enc);
- test_address_compare(addr, addr2);
- check_unref(addr2, 1);
- pull();
-
- check_unref(addr, 1);
-
- pull();
- }
-
- camel_test_end();
-
- /* FIXME: Add test of decoding of broken addresses */
-
- return 0;
-}
-
-
diff --git a/camel/tests/message/test3.c b/camel/tests/message/test3.c
deleted file mode 100644
index 0a9683d146..0000000000
--- a/camel/tests/message/test3.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- Multipart.
-*/
-
-#include "camel-test.h"
-#include "messages.h"
-
-/* for stat */
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <camel/camel-mime-message.h>
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-#include "camel/camel-multipart.h"
-
-int main(int argc, char **argv)
-{
- CamelMimeMessage *msg, *msg2, *msg3;
- CamelMultipart *mp, *mp2;
- CamelMimePart *part, *part2, *part3;
-
- camel_test_init(argc, argv);
-
- camel_test_start("multipart message");
-
- push("building message");
- msg = test_message_create_simple();
- mp = camel_multipart_new();
-
- /* Hrm, this should be able to set its own boundary, no? */
- camel_multipart_set_boundary(mp, "_=,.XYZ_Kangaroo_Meat_is_!_ABADF00D");
- check(strcmp(camel_multipart_get_boundary(mp), "_=,.XYZ_Kangaroo_Meat_is_!_ABADF00D") == 0);
-
- camel_medium_set_content_object((CamelMedium *)msg, (CamelDataWrapper *)mp);
- check(camel_multipart_get_number(mp) == 0);
- check(camel_multipart_get_part(mp, 0) == NULL);
- check(camel_multipart_get_part(mp, 1) == NULL);
-
- push("adding/removing parts");
- part = camel_mime_part_new();
- test_message_set_content_simple(part, 0, "text/plain", "content part 1", strlen("content part 1"));
- camel_multipart_add_part(mp, part);
- check(CAMEL_OBJECT(part)->ref_count == 2);
- check(camel_multipart_get_number(mp) == 1);
- check(camel_multipart_get_part(mp, 0) == part);
- check(camel_multipart_get_part(mp, 1) == NULL);
-
- camel_multipart_remove_part(mp, part);
- check(CAMEL_OBJECT(part)->ref_count == 1);
- check(camel_multipart_get_number(mp) == 0);
- check(camel_multipart_get_part(mp, 0) == NULL);
- check(camel_multipart_get_part(mp, 1) == NULL);
-
- camel_multipart_add_part_at(mp, part, 0);
- check(CAMEL_OBJECT(part)->ref_count == 2);
- check(camel_multipart_get_number(mp) == 1);
- check(camel_multipart_get_part(mp, 0) == part);
- check(camel_multipart_get_part(mp, 1) == NULL);
-
- check(camel_multipart_remove_part_at(mp, 1) == NULL);
- check(CAMEL_OBJECT(part)->ref_count == 2);
- check(camel_multipart_get_number(mp) == 1);
- check(camel_multipart_get_part(mp, 0) == part);
- check(camel_multipart_get_part(mp, 1) == NULL);
-
- check(camel_multipart_remove_part_at(mp, 0) == part);
- check(CAMEL_OBJECT(part)->ref_count == 1);
- check(camel_multipart_get_number(mp) == 0);
- check(camel_multipart_get_part(mp, 0) == NULL);
- check(camel_multipart_get_part(mp, 1) == NULL);
-
- camel_multipart_add_part(mp, part);
- check(CAMEL_OBJECT(part)->ref_count == 2);
- check(camel_multipart_get_number(mp) == 1);
- check(camel_multipart_get_part(mp, 0) == part);
- check(camel_multipart_get_part(mp, 1) == NULL);
-
- part2 = camel_mime_part_new();
- test_message_set_content_simple(part2, 0, "text/plain", "content part 2", strlen("content part 2"));
- camel_multipart_add_part(mp, part2);
- check(CAMEL_OBJECT(part2)->ref_count == 2);
- check(camel_multipart_get_number(mp) == 2);
- check(camel_multipart_get_part(mp, 0) == part);
- check(camel_multipart_get_part(mp, 1) == part2);
-
- part3 = camel_mime_part_new();
- test_message_set_content_simple(part3, 0, "text/plain", "content part 3", strlen("content part 3"));
- camel_multipart_add_part_at(mp, part3, 1);
- check(CAMEL_OBJECT(part3)->ref_count == 2);
- check(camel_multipart_get_number(mp) == 3);
- check(camel_multipart_get_part(mp, 0) == part);
- check(camel_multipart_get_part(mp, 1) == part3);
- check(camel_multipart_get_part(mp, 2) == part2);
- pull();
-
- push("save message to test3.msg");
- unlink("test3.msg");
- test_message_write_file(msg, "test3.msg");
- pull();
-
- push("read from test3.msg");
- msg2 = test_message_read_file("test3.msg");
- pull();
-
- push("compre content of multipart");
- mp2 = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)msg2);
- check(mp2 != NULL);
- check(CAMEL_IS_MULTIPART(mp2));
- check(camel_multipart_get_number(mp2) == 3);
-
- check(strcmp(camel_multipart_get_boundary(mp2), "_=,.XYZ_Kangaroo_Meat_is_!_ABADF00D") == 0);
- check(mp2->preface == NULL || strlen(mp2->preface) == 0);
-
- /* FIXME */
- camel_test_nonfatal("postface may gain a single \\n?");
- check_msg(mp2->postface == NULL || strlen(mp2->postface) == 0, "postface: '%s'", mp2->postface);
- camel_test_fatal();
-
- test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 0))),
- "content part 1", strlen("content part 1"));
- test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 1))),
- "content part 3", strlen("content part 3"));
- test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 2))),
- "content part 2", strlen("content part 2"));
- pull();
-
- push("writing again, & re-reading");
- unlink("test3-2.msg");
- test_message_write_file(msg2, "test3-2.msg");
- msg3 = test_message_read_file("test3-2.msg");
-
- push("comparing again");
- mp2 = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)msg3);
- check(mp2 != NULL);
- check(CAMEL_IS_MULTIPART(mp2));
- check(camel_multipart_get_number(mp2) == 3);
-
- check(strcmp(camel_multipart_get_boundary(mp2), "_=,.XYZ_Kangaroo_Meat_is_!_ABADF00D") == 0);
- check(mp2->preface == NULL || strlen(mp2->preface) == 0);
-
- /* FIXME */
- camel_test_nonfatal("postface may gain a single \\n?");
- check_msg(mp2->postface == NULL || strlen(mp2->postface) == 0, "postface: '%s'", mp2->postface);
- camel_test_fatal();
-
- test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 0))),
- "content part 1", strlen("content part 1"));
- test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 1))),
- "content part 3", strlen("content part 3"));
- test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 2))),
- "content part 2", strlen("content part 2"));
- pull();
- pull();
-
- check_unref(msg2, 1);
- check_unref(msg3, 1);
-
- push("testing pre/post text");
- camel_multipart_set_preface(mp, "pre-text\nLines.");
- camel_multipart_set_postface(mp, "post-text, no lines.\nOne line.\n");
-
- check(strcmp(mp->preface, "pre-text\nLines.") == 0);
- check(strcmp(mp->postface, "post-text, no lines.\nOne line.\n") == 0);
-
- push("writing /re-reading");
- unlink("test3-3.msg");
- test_message_write_file(msg, "test3-3.msg");
- msg2 = test_message_read_file("test3-3.msg");
-
- mp2 = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)msg2);
- check(mp2 != NULL);
- check(CAMEL_IS_MULTIPART(mp2));
- check(camel_multipart_get_number(mp2) == 3);
-
- check(strcmp(camel_multipart_get_boundary(mp2), "_=,.XYZ_Kangaroo_Meat_is_!_ABADF00D") == 0);
- check(strcmp(mp2->preface, "pre-text\nLines.") == 0);
- check(strcmp(mp2->postface, "post-text, no lines.\nOne line.\n") == 0);
- test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 0))),
- "content part 1", strlen("content part 1"));
- test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 1))),
- "content part 3", strlen("content part 3"));
- test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 2))),
- "content part 2", strlen("content part 2"));
- pull();
- check_unref(msg2, 1);
- pull();
-
- check_unref(msg, 1);
- check_unref(mp, 1);
- check_unref(part, 1);
- check_unref(part2, 1);
- check_unref(part3, 1);
-
- camel_test_end();
-
- return 0;
-}
diff --git a/camel/tests/stream/.cvsignore b/camel/tests/stream/.cvsignore
deleted file mode 100644
index 3fa8afaa38..0000000000
--- a/camel/tests/stream/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
-*.bb
-*.bbg
-*.da
-*.gcov
diff --git a/camel/tests/stream/Makefile.am b/camel/tests/stream/Makefile.am
deleted file mode 100644
index d16f8aaa55..0000000000
--- a/camel/tests/stream/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-
-INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
- -I$(includedir) \
- -I$(top_srcdir)/camel/tests/lib \
- -DG_LOG_DOMAIN=\"evolution-tests\"
-
-LDADD = \
- $(top_builddir)/camel/libcamel.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/libibex/libibex.la \
- $(GNOME_LIBDIR) \
- $(top_builddir)/camel/tests/lib/libcameltest.a \
- $(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
-
-check_PROGRAMS = \
- test1 test2 test3
-
-TESTS = test1 test2 test3
-
-
-
diff --git a/camel/tests/stream/README b/camel/tests/stream/README
deleted file mode 100644
index 8ca6a9602d..0000000000
--- a/camel/tests/stream/README
+++ /dev/null
@@ -1,4 +0,0 @@
-
-test1 camelstreamfs, creating, read/write, eos, refcounting
-test2 camelstreammem, creating, read/write, eos, refcounting
-test3 camelseekablesubstream
diff --git a/camel/tests/stream/test1.c b/camel/tests/stream/test1.c
deleted file mode 100644
index 452d45274f..0000000000
--- a/camel/tests/stream/test1.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- test ... camelstreamfs */
-
-#include "camel-test.h"
-#include "streams.h"
-
-#include <errno.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "camel/camel-stream-fs.h"
-
-int main(int argc, char **argv)
-{
- CamelSeekableStream *ss = NULL;
- int i;
- int fd = -1;
- struct stat st;
- int size;
- char buffer[1024];
-
- camel_test_init(argc, argv);
-
- camel_test_start("CamelStream fs, open, seek, read, write, eos");
- for (i=0;i<2;i++) {
-
- (void)unlink("stream.txt");
-
- push("trying to open a nonexistant stream, method %d", i);
- switch(i) {
- case 0:
- ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR, 0);
- break;
- case 1:
- fd = open("stream.txt", O_RDWR, 0);
- ss = (CamelSeekableStream *)camel_stream_fs_new_with_fd(fd);
- break;
- }
- check(ss == NULL && errno == ENOENT);
- check(stat("stream.txt", &st) == -1 && errno == ENOENT);
- pull();
-
- push("Creating stream using method %d", i);
- switch(i) {
- case 0:
- ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_CREAT|O_RDWR|O_TRUNC, 0600);
- fd = ((CamelStreamFs *)ss)->fd;
- break;
- case 1:
- fd = open("stream.txt", O_CREAT|O_RDWR|O_TRUNC, 0600);
- ss = (CamelSeekableStream *)camel_stream_fs_new_with_fd(fd);
- break;
- }
- check(ss != NULL);
- check(stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == 0);
- pull();
-
- test_stream_seekable_writepart(ss);
- test_stream_seekable_readpart(ss);
-
- push("getting filesize");
- check(stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode));
- size = st.st_size;
- pull();
-
- push("checking close closes");
- check_unref(ss, 1);
- check(close(fd) == -1);
- pull();
-
- push("re-opening stream");
- switch(i) {
- case 0:
- ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR, 0);
- fd = ((CamelStreamFs *)ss)->fd;
- break;
- case 1:
- fd = open("stream.txt", O_RDWR, 0);
- ss = (CamelSeekableStream *)camel_stream_fs_new_with_fd(fd);
- break;
- }
- check(ss != NULL);
- check(stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == size);
-
- test_stream_seekable_readpart(ss);
-
- check_unref(ss, 1);
- check(close(fd) == -1);
- pull();
-
- push("re-opening stream with truncate");
- switch(i) {
- case 0:
- ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR|O_TRUNC, 0);
- fd = ((CamelStreamFs *)ss)->fd;
- break;
- case 1:
- fd = open("stream.txt", O_RDWR|O_TRUNC, 0);
- ss = (CamelSeekableStream *)camel_stream_fs_new_with_fd(fd);
- break;
- }
- check(ss != NULL);
- check(stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == 0);
-
- /* read has to return 0 before eos is set */
- check(camel_stream_read(CAMEL_STREAM(ss), buffer, 1) == 0);
- check(camel_stream_eos(CAMEL_STREAM(ss)));
-
- check_unref(ss, 1);
- check(close(fd) == -1);
- pull();
-
- (void)unlink("stream.txt");
- }
-
- camel_test_end();
-
- return 0;
-}
diff --git a/camel/tests/stream/test2.c b/camel/tests/stream/test2.c
deleted file mode 100644
index 02ad88e95c..0000000000
--- a/camel/tests/stream/test2.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- test ... camelstreammem */
-
-#include "camel-test.h"
-#include "streams.h"
-
-#include <errno.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "camel/camel-stream-mem.h"
-
-int main(int argc, char **argv)
-{
- CamelSeekableStream *ss = NULL;
- int i;
- int fd = -1;
- struct stat st;
- int size;
- char buffer[1024];
- GByteArray *ba;
-
- camel_test_init(argc, argv);
-
- camel_test_start("CamelStream mem, create, seek, read, write, eos");
- for (i=0;i<3;i++) {
-
- push("Creating stream using method %d", i);
- switch(i) {
- case 0:
- ss = (CamelSeekableStream *)camel_stream_mem_new();
- break;
- case 1:
- ba = g_byte_array_new();
- ss = (CamelSeekableStream *)camel_stream_mem_new_with_byte_array(ba);
- break;
- case 2:
- ss = (CamelSeekableStream *)camel_stream_mem_new_with_buffer("", 0);
- break;
- }
- check(ss != NULL);
-
- test_stream_seekable_writepart(ss);
- test_stream_seekable_readpart(ss);
-
- check_unref(ss, 1);
- pull();
- }
-
- camel_test_end();
-
- return 0;
-}
diff --git a/camel/tests/stream/test3.c b/camel/tests/stream/test3.c
deleted file mode 100644
index b870a7773e..0000000000
--- a/camel/tests/stream/test3.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- test ... camelseekablesubstream */
-
-#include "camel-test.h"
-#include "streams.h"
-
-#include <errno.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "camel/camel-stream-mem.h"
-#include "camel/camel-stream-fs.h"
-#include "camel/camel-seekable-substream.h"
-
-#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
-
-struct {
- off_t lower, upper;
-} ranges[] = {
- { 3, 10241 },
- { 0, 1024 },
- { 0, 0 },
- { 0, 1 },
- { 0, 2 },
- { 0, 3 },
- { 0, 7 },
- { 1, 8 },
- { 1, 9 },
- { 10245, 10300 },
- { 0, CAMEL_STREAM_UNBOUND },
-/* { 1, CAMEL_STREAM_UNBOUND },
- { 2, CAMEL_STREAM_UNBOUND },
- { 3, CAMEL_STREAM_UNBOUND }, these take too long to run
- { 7, CAMEL_STREAM_UNBOUND },*/
- { 10245, CAMEL_STREAM_UNBOUND },
-};
-
-int main(int argc, char **argv)
-{
- CamelSeekableStream *ss = NULL;
- int i, j;
- CamelSeekableSubstream *sus, *sus2;
-
- camel_test_init(argc, argv);
-
- camel_test_start("CamelSeekableSubstream, mem backing");
- for (j=0;j<SEEKABLE_SUBSTREAM_WAYS;j++) {
- push("testing writing method %d", j);
- ss = (CamelSeekableStream *)camel_stream_mem_new();
- check(ss != NULL);
- for (i=0;i<ARRAY_LEN(ranges);i++) {
- push("stream subrange %d-%d", ranges[i].lower, ranges[i].upper);
- sus = (CamelSeekableSubstream *)camel_seekable_substream_new_with_seekable_stream_and_bounds(ss, ranges[i].lower, ranges[i].upper);
- check(sus != NULL);
-
- test_seekable_substream_writepart((CamelStream *)sus, j);
- test_seekable_substream_readpart((CamelStream *)sus);
-
- sus2 = (CamelSeekableSubstream *)camel_seekable_substream_new_with_seekable_stream_and_bounds(ss, ranges[i].lower, ranges[i].upper);
- check(sus2 != NULL);
- test_seekable_substream_readpart((CamelStream *)sus2);
-
- check_unref(sus, 1);
- check_unref(sus2, 1);
- pull();
- }
- check_unref(ss, 1);
- pull();
- }
-
- camel_test_end();
-
- (void)unlink("stream.txt");
-
- camel_test_start("CamelSeekableSubstream, file backing");
- for (j=0;j<SEEKABLE_SUBSTREAM_WAYS;j++) {
- push("testing writing method %d", j);
- ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR|O_CREAT|O_TRUNC, 0600);
- check(ss != NULL);
- for (i=0;i<ARRAY_LEN(ranges);i++) {
- push("stream subrange %d-%d", ranges[i].lower, ranges[i].upper);
- sus = (CamelSeekableSubstream *)camel_seekable_substream_new_with_seekable_stream_and_bounds(ss, ranges[i].lower, ranges[i].upper);
- check(sus != NULL);
-
- test_seekable_substream_writepart((CamelStream *)sus, j);
- test_seekable_substream_readpart((CamelStream *)sus);
-
- sus2 = (CamelSeekableSubstream *)camel_seekable_substream_new_with_seekable_stream_and_bounds(ss, ranges[i].lower, ranges[i].upper);
- check(sus2 != NULL);
- test_seekable_substream_readpart((CamelStream *)sus2);
-
- check_unref(sus, 1);
- check_unref(sus2, 1);
- pull();
- }
- check_unref(ss, 1);
- (void)unlink("stream.txt");
- pull();
- }
-
- camel_test_end();
-
- return 0;
-}