merged notzed-camel-eds-branch
authorMichael Zucci <zucchi@src.gnome.org>
Thu, 2 Dec 2004 08:03:31 +0000 (08:03 +0000)
committerMichael Zucci <zucchi@src.gnome.org>
Thu, 2 Dec 2004 08:03:31 +0000 (08:03 +0000)
117 files changed:
camel/ChangeLog
camel/Makefile.am
camel/broken-date-parser.c
camel/camel-block-file.c
camel/camel-block-file.h
camel/camel-certdb.c
camel/camel-charset-map.c
camel/camel-cipher-context.h
camel/camel-exception.c
camel/camel-filter-driver.c
camel/camel-filter-search.c
camel/camel-folder-search.c
camel/camel-folder-search.h
camel/camel-folder-summary.c
camel/camel-folder-thread.c
camel/camel-folder.c
camel/camel-gpg-context.c
camel/camel-http-stream.c
camel/camel-iconv.c
camel/camel-index-control.c
camel/camel-mime-filter-charset.c
camel/camel-mime-message.c
camel/camel-mime-part-utils.c
camel/camel-mime-part.c
camel/camel-mime-utils.c
camel/camel-multipart-encrypted.c
camel/camel-multipart-encrypted.h
camel/camel-multipart-signed.c
camel/camel-multipart-signed.h
camel/camel-multipart.c
camel/camel-net-utils.c [new file with mode: 0644]
camel/camel-net-utils.h [new file with mode: 0644]
camel/camel-object.c
camel/camel-operation.c
camel/camel-partition-table.c
camel/camel-partition-table.h
camel/camel-private.h
camel/camel-provider.c
camel/camel-provider.pc.in [new file with mode: 0644]
camel/camel-sasl-cram-md5.c
camel/camel-sasl-digest-md5.c
camel/camel-search-private.c
camel/camel-service.c
camel/camel-service.h
camel/camel-session.h
camel/camel-store-summary.c
camel/camel-stream-fs.c
camel/camel-tcp-stream-ssl.c
camel/camel-text-index.c
camel/camel-url-scanner.c
camel/camel-vee-folder.c
camel/camel.c
camel/camel.h
camel/camel.pc.in [new file with mode: 0644]
camel/providers/Makefile.am
camel/providers/groupwise/Makefile.am
camel/providers/groupwise/camel-gw-listener.h
camel/providers/imap/Makefile.am
camel/providers/imap/camel-imap-folder.c
camel/providers/imap/camel-imap-private.h
camel/providers/imap/camel-imap-search.c
camel/providers/imap/camel-imap-search.h
camel/providers/imap/camel-imap-store-summary.c
camel/providers/imap/camel-imap-store.c
camel/providers/imap/camel-imap-store.h
camel/providers/imap/camel-imap-utils.c
camel/providers/imap/camel-imap-utils.h
camel/providers/imap4/Makefile.am
camel/providers/imap4/camel-imap4-command.h
camel/providers/imap4/camel-imap4-engine.h
camel/providers/imap4/camel-imap4-store.c
camel/providers/imap4/camel-imap4-summary.c
camel/providers/imap4/camel-imap4-utils.c
camel/providers/imapp/Makefile.am
camel/providers/imapp/camel-imapp-driver.h
camel/providers/imapp/camel-imapp-engine.h
camel/providers/imapp/camel-imapp-folder.c
camel/providers/imapp/camel-imapp-store-summary.c
camel/providers/imapp/camel-imapp-store.c
camel/providers/imapp/camel-imapp-store.h
camel/providers/imapp/camel-imapp-utils.c
camel/providers/local/Makefile.am
camel/providers/local/camel-maildir-summary.c
camel/providers/nntp/Makefile.am
camel/providers/nntp/camel-nntp-private.h
camel/providers/nntp/camel-nntp-store-summary.c
camel/providers/nntp/camel-nntp-store.c
camel/providers/nntp/camel-nntp-utils.c
camel/providers/pop3/Makefile.am
camel/providers/pop3/camel-pop3-engine.h
camel/providers/pop3/camel-pop3-folder.c
camel/providers/pop3/camel-pop3-store.c
camel/providers/sendmail/Makefile.am
camel/providers/smtp/Makefile.am
camel/providers/smtp/camel-smtp-transport.c
camel/tests/folder/Makefile.am
camel/tests/folder/test1.c
camel/tests/folder/test10.c
camel/tests/folder/test2.c
camel/tests/folder/test3.c
camel/tests/folder/test4.c
camel/tests/folder/test5.c
camel/tests/folder/test6.c
camel/tests/folder/test7.c
camel/tests/folder/test8.c
camel/tests/folder/test9.c
camel/tests/lib/Makefile.am
camel/tests/lib/folders.c
camel/tests/lib/messages.h
camel/tests/lib/streams.c
camel/tests/message/Makefile.am
camel/tests/mime-filter/Makefile.am
camel/tests/misc/Makefile.am
camel/tests/misc/split.c
camel/tests/smime/Makefile.am
camel/tests/smime/pgp.c
camel/tests/stream/Makefile.am

index 9c5ef6c..37d7c9b 100644 (file)
        Properly handle NILs for the namespace separator (somehow I missed
        this, silly me).
 
+2004-12-02  Not Zed  <NotZed@Ximian.com>
+
+       * Makefile.am: version all the libraries with the base version of the
+       package.  move libcamel-1.2 into libdir, etc.
+
+       * camel.pc.in: remove the provider stuff from here.
+
+       * camel-provider.pc.in: create a camel-provider pc file.
+
+2004-11-16  Not Zed  <NotZed@Ximian.com>
+
+       * tests/lib/folders.c (test_folder_message_ops): updated counts for
+       delete also marking unread.
+
+       * tests/lib/camel-test.c (camel_test_provider_init): new api for
+       initialising test system 'in-build'.
+
+       * camel-provider.c: remove the assertions, init if we need to,k
+       use pthread_once stuff to serialise it.
+
+       * tests/folder/test3.c (main): remove gtk stuff (???).
+
+       * tests/*: Fix all the makefiles.  Made make-check work 'in-build'.
+
+       * tests/lib/folders.c (test_folder_counts): update for api changes.
+       (test_message_info): similar.
+
+       * providers/Makefile.am: removed groupwise from the build, this
+       can't go in here anymore, not in its current state.
+
+       * camel-net-utils.c (camel_gethostbyaddr_r)
+       (camel_gethostbyname_r): the old e_gethost* calls from
+       e-host-utils.c.
+
+2004-11-15  Not Zed  <NotZed@Ximian.com>
+
+       * providers/imap/camel-imap-utils.c (imap_path_to_physical):
+       copied from e-path.c.
+       (imap_path_find_folders): copied from e-path.c.
+
+       * camel.h: remove the provider stuff from the header.
+
+       * camel-provider.c: globalise provider_init variable, and asserton
+       it in all functions that rely on it.
+
+       * camel-service.c: removed getaddrinfo/etc.
+
+       * camel-net-utils.[ch]: separate out camel_getaddrinfo etc.
+
+       * Makefile.am: split camel into 2 libraries, libcamel and
+       libcamel-store.
+
+       * camel-multipart-signed.c (camel_multipart_signed_sign)
+       (camel_multipart_signed_verify, prepare_sign): remove old
+       deprecated api.
+
+       * camel-multipart-encrypted.c (camel_multipart_encrypted_encrypt) 
+       (camel_multipart_encrypted_decrypt): remove old deprecated api.
+
 2004-11-12  Not Zed  <NotZed@Ximian.com>
 
         ** Merge in notzed-messageinfo-branch, fix some minor conflicts.
index f835bbf..c727715 100644 (file)
@@ -2,40 +2,35 @@
 
 SUBDIRS = . providers tests
 
+%-$(BASE_VERSION).pc: %.pc
+        cp $< $@
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = camel-$(BASE_VERSION).pc camel-provider-$(BASE_VERSION).pc
+
 libcamelincludedir = $(privincludedir)/camel
+libcamel_providerincludedir = $(privincludedir)/camel
 
-camellibexecdir = $(privlibexecdir)/camel
-camellibexec_PROGRAMS =        camel-lock-helper camel-index-control
+camellibexecdir = $(libexecdir)
+camellibexec_PROGRAMS =        camel-lock-helper-1.2 camel-index-control-1.2
 
-privlib_LTLIBRARIES = libcamel.la
+lib_LTLIBRARIES = libcamel-1.2.la libcamel-provider-1.2.la
 
 INCLUDES = -I.. -I$(srcdir)/..                                 \
        -I$(top_srcdir)/intl                            \
-       -I$(top_srcdir)/e-util                          \
        -DCAMEL_LIBEXECDIR=\""$(camellibexecdir)"\"     \
        -DCAMEL_PROVIDERDIR=\""$(camel_providerdir)"\"  \
        -DG_LOG_DOMAIN=\"camel\"                        \
        $(CAMEL_CFLAGS)
 
-libcamel_la_SOURCES =                          \
-       broken-date-parser.c                    \
-       camel-address.c                         \
-       camel-arg.c                             \
-       camel-block-file.c                      \
-       camel-certdb.c                          \
-       camel-charset-map.c                     \
+libcamel_provider_1_2_la_SOURCES =             \
        camel-cipher-context.c                  \
-       camel-data-cache.c                      \
-       camel-data-wrapper.c                    \
-       camel-debug.c                           \
        camel-digest-folder.c                   \
        camel-digest-store.c                    \
        camel-digest-summary.c                  \
        camel-disco-diary.c                     \
        camel-disco-folder.c                    \
        camel-disco-store.c                     \
-       camel-exception.c                       \
-       camel-file-utils.c                      \
        camel-filter-driver.c                   \
        camel-filter-search.c                   \
        camel-folder-search.c                   \
@@ -43,27 +38,119 @@ libcamel_la_SOURCES =                              \
        camel-folder-thread.c                   \
        camel-folder.c                          \
        camel-gpg-context.c                     \
-       camel-html-parser.c                     \
        camel-http-stream.c                     \
+       camel-movemail.c                        \
+       camel-provider.c                        \
+       camel-sasl-anonymous.c                  \
+       camel-sasl-cram-md5.c                   \
+       camel-sasl-digest-md5.c                 \
+       camel-sasl-gssapi.c                     \
+       camel-sasl-kerberos4.c                  \
+       camel-sasl-login.c                      \
+       camel-sasl-ntlm.c                       \
+       camel-sasl-plain.c                      \
+       camel-sasl-popb4smtp.c                  \
+       camel-sasl.c                            \
+       camel-search-private.c                  \
+       camel-service.c                         \
+       camel-session.c                         \
+       camel-smime-context.c                   \
+       camel-store-summary.c                   \
+       camel-store.c                           \
+       camel-tcp-stream-openssl.c              \
+       camel-tcp-stream-raw.c                  \
+       camel-tcp-stream-ssl.c                  \
+       camel-tcp-stream.c                      \
+       camel-transport.c                       \
+       camel-uid-cache.c                       \
+       camel-vee-folder.c                      \
+       camel-vee-store.c                       \
+       camel-vee-summary.c                     \
+       camel-vtrash-folder.c
+
+libcamel_providerinclude_HEADERS =                     \
+       camel-cipher-context.h                  \
+       camel-digest-folder.h                   \
+       camel-digest-store.h                    \
+       camel-digest-summary.h                  \
+       camel-disco-diary.h                     \
+       camel-disco-folder.h                    \
+       camel-disco-store.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-gpg-context.h                     \
+       camel-http-stream.h                     \
+       camel-movemail.h                        \
+       camel-provider.h                        \
+       camel-sasl-anonymous.h                  \
+       camel-sasl-cram-md5.h                   \
+       camel-sasl-digest-md5.h                 \
+       camel-sasl-gssapi.h                     \
+       camel-sasl-kerberos4.h                  \
+       camel-sasl-login.h                      \
+       camel-sasl-ntlm.h                       \
+       camel-sasl-plain.h                      \
+       camel-sasl-popb4smtp.h                  \
+       camel-sasl.h                            \
+       camel-service.h                         \
+       camel-session.h                         \
+       camel-smime-context.h                   \
+       camel-store-summary.h                   \
+       camel-store.h                           \
+       camel-tcp-stream-raw.h                  \
+       camel-tcp-stream-ssl.h                  \
+       camel-tcp-stream.h                      \
+       camel-transport.h                       \
+       camel-uid-cache.h                       \
+       camel-vee-folder.h                      \
+       camel-vee-store.h                       \
+       camel-vee-summary.h                     \
+       camel-vtrash-folder.h
+
+libcamel_provider_1_2_la_LDFLAGS = -version-info $(LIBCAMEL_CURRENT):$(LIBCAMEL_REVISION):$(LIBCAMEL_AGE)
+
+libcamel_provider_1_2_la_LIBADD =                      \
+       $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la        \
+       libcamel-1.2.la                         \
+       $(CAMEL_LIBS)
+
+libcamel_1_2_la_SOURCES =                              \
+       broken-date-parser.c                    \
+       camel-address.c                         \
+       camel-arg.c                             \
+       camel-block-file.c                      \
+       camel-certdb.c                          \
+       camel-charset-map.c                     \
+       camel-data-cache.c                      \
+       camel-data-wrapper.c                    \
+       camel-debug.c                           \
+       camel-exception.c                       \
+       camel-file-utils.c                      \
+       camel-html-parser.c                     \
        camel-index.c                           \
        camel-internet-address.c                \
        camel-junk-plugin.c                     \
-       camel-lock.c                            \
+       camel-list-utils.c                      \
        camel-lock-client.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-bestenc.c             \
        camel-mime-filter-canon.c               \
+       camel-mime-filter-charset.c             \
        camel-mime-filter-crlf.c                \
        camel-mime-filter-enriched.c            \
        camel-mime-filter-from.c                \
        camel-mime-filter-gzip.c                \
        camel-mime-filter-html.c                \
-       camel-mime-filter-tohtml.c              \
        camel-mime-filter-index.c               \
        camel-mime-filter-linewrap.c            \
        camel-mime-filter-save.c                \
+       camel-mime-filter-tohtml.c              \
        camel-mime-filter-windows.c             \
        camel-mime-filter-yenc.c                \
        camel-mime-filter.c                     \
@@ -72,33 +159,15 @@ libcamel_la_SOURCES =                              \
        camel-mime-part-utils.c                 \
        camel-mime-part.c                       \
        camel-mime-utils.c                      \
-       camel-movemail.c                        \
-       camel-multipart.c                       \
        camel-multipart-encrypted.c             \
        camel-multipart-signed.c                \
-       camel-list-utils.c                      \
+       camel-multipart.c                       \
+       camel-net-utils.c                       \
        camel-object.c                          \
        camel-operation.c                       \
        camel-partition-table.c                 \
-       camel-provider.c                        \
-       camel-sasl.c                            \
-       camel-sasl-anonymous.c                  \
-       camel-sasl-cram-md5.c                   \
-       camel-sasl-digest-md5.c                 \
-       camel-sasl-gssapi.c                     \
-       camel-sasl-kerberos4.c                  \
-       camel-sasl-login.c                      \
-       camel-sasl-ntlm.c                       \
-       camel-sasl-plain.c                      \
-       camel-sasl-popb4smtp.c                  \
-       camel-search-private.c                  \
        camel-seekable-stream.c                 \
        camel-seekable-substream.c              \
-       camel-service.c                         \
-       camel-session.c                         \
-       camel-smime-context.c                   \
-       camel-store.c                           \
-       camel-store-summary.c                   \
        camel-stream-buffer.c                   \
        camel-stream-filter.c                   \
        camel-stream-fs.c                       \
@@ -108,19 +177,9 @@ libcamel_la_SOURCES =                              \
        camel-stream.c                          \
        camel-string-utils.c                    \
        camel-text-index.c                      \
-       camel-tcp-stream-raw.c                  \
-       camel-tcp-stream-ssl.c                  \
-       camel-tcp-stream-openssl.c              \
-       camel-tcp-stream.c                      \
-       camel-transport.c                       \
-       camel-uid-cache.c                       \
-       camel-url.c                             \
        camel-url-scanner.c                     \
+       camel-url.c                             \
        camel-utf8.c                            \
-       camel-vee-folder.c                      \
-       camel-vee-store.c                       \
-       camel-vee-summary.c                     \
-       camel-vtrash-folder.c                   \
        camel.c
 
 libcamelinclude_HEADERS =                      \
@@ -130,47 +189,33 @@ libcamelinclude_HEADERS =                 \
        camel-block-file.h                      \
        camel-certdb.h                          \
        camel-charset-map.h                     \
-       camel-cipher-context.h                  \
        camel-data-cache.h                      \
        camel-data-wrapper.h                    \
        camel-debug.h                           \
-       camel-digest-folder.h                   \
-       camel-digest-store.h                    \
-       camel-digest-summary.h                  \
-       camel-disco-diary.h                     \
-       camel-disco-folder.h                    \
-       camel-disco-store.h                     \
        camel-exception-list.def                \
        camel-exception.h                       \
        camel-file-utils.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-gpg-context.h                     \
-       camel-http-stream.h                     \
+       camel-i18n.h                            \
        camel-index.h                           \
        camel-internet-address.h                \
-       camel-i18n.h                            \
        camel-junk-plugin.h                     \
-       camel-lock.h                            \
+       camel-list-utils.h                      \
        camel-lock-client.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-bestenc.h             \
        camel-mime-filter-canon.h               \
+       camel-mime-filter-charset.h             \
        camel-mime-filter-crlf.h                \
        camel-mime-filter-enriched.h            \
        camel-mime-filter-from.h                \
        camel-mime-filter-gzip.h                \
        camel-mime-filter-html.h                \
-       camel-mime-filter-tohtml.h              \
        camel-mime-filter-index.h               \
        camel-mime-filter-linewrap.h            \
        camel-mime-filter-save.h                \
+       camel-mime-filter-tohtml.h              \
        camel-mime-filter-windows.h             \
        camel-mime-filter-yenc.h                \
        camel-mime-filter.h                     \
@@ -179,32 +224,15 @@ libcamelinclude_HEADERS =                 \
        camel-mime-part-utils.h                 \
        camel-mime-part.h                       \
        camel-mime-utils.h                      \
-       camel-movemail.h                        \
-       camel-multipart.h                       \
        camel-multipart-encrypted.h             \
        camel-multipart-signed.h                \
-       camel-list-utils.h                      \
+       camel-multipart.h                       \
+       camel-net-utils.h                       \
        camel-object.h                          \
        camel-operation.h                       \
        camel-partition-table.h                 \
-       camel-provider.h                        \
-       camel-sasl.h                            \
-       camel-sasl-anonymous.h                  \
-       camel-sasl-cram-md5.h                   \
-       camel-sasl-digest-md5.h                 \
-       camel-sasl-gssapi.h                     \
-       camel-sasl-kerberos4.h                  \
-       camel-sasl-login.h                      \
-       camel-sasl-ntlm.h                       \
-       camel-sasl-plain.h                      \
-       camel-sasl-popb4smtp.h                  \
        camel-seekable-stream.h                 \
        camel-seekable-substream.h              \
-       camel-service.h                         \
-       camel-session.h                         \
-       camel-smime-context.h                   \
-       camel-store.h                           \
-       camel-store-summary.h                   \
        camel-stream-buffer.h                   \
        camel-stream-filter.h                   \
        camel-stream-fs.h                       \
@@ -214,50 +242,40 @@ libcamelinclude_HEADERS =                 \
        camel-stream.h                          \
        camel-string-utils.h                    \
        camel-text-index.h                      \
-       camel-tcp-stream-raw.h                  \
-       camel-tcp-stream-ssl.h                  \
-       camel-tcp-stream.h                      \
-       camel-transport.h                       \
        camel-types.h                           \
-       camel-uid-cache.h                       \
-       camel-url.h                             \
        camel-url-scanner.h                     \
+       camel-url.h                             \
        camel-utf8.h                            \
-       camel-vee-folder.h                      \
-       camel-vee-store.h                       \
-       camel-vee-summary.h                     \
-       camel-vtrash-folder.h                   \
        camel.h
 
-libcamel_la_LDFLAGS = -version-info 0:0:0
+libcamel_1_2_la_LDFLAGS = -version-info 0:0:0
 
-libcamel_la_LIBADD =                           \
-       $(top_builddir)/e-util/libeutil.la      \
+libcamel_1_2_la_LIBADD =                               \
+       $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la        \
        $(CAMEL_LIBS)
 
-camel_lock_helper_SOURCES =                    \
+camel_lock_helper_1_2_SOURCES =                \
        camel-lock-helper.c                     \
        camel-lock-helper.h
 
 # NOTE: This needs to be cleaned up, it shouldn't link with all this crap,
 # because it might be setuid.
-camel_lock_helper_LDADD =                      \
+camel_lock_helper_1_2_LDADD =                  \
        camel-lock.o                            \
-       $(libcamel_la_LIBADD)
+       $(libcamel_1_2_la_LIBADD)
 
-camel_index_control_SOURCES =                  \
+camel_index_control_1_2_SOURCES =              \
        camel-index-control.c
 
-camel_index_control_LDADD =                    \
-       $(libcamel_la_LIBADD)                   \
-       libcamel.la
-#      $(EVOLUTION_MAIL_LIBS)
+camel_index_control_1_2_LDADD =                        \
+       libcamel-1.2.la                         \
+       $(libcamel_1_2_la_LIBADD)
 
 install-exec-hook:
        @if test -n "$(CAMEL_LOCK_HELPER_USER)"; then \
            if test `whoami` = root ; then \
-               chown $(CAMEL_LOCK_HELPER_USER) $(DESTDIR)$(camellibexecdir)/camel-lock-helper ; \
-               chmod u+s $(DESTDIR)$(camellibexecdir)/camel-lock-helper ; \
+               chown $(CAMEL_LOCK_HELPER_USER) $(DESTDIR)$(camellibexecdir)/camel-lock-helper-$(BASE_VERSION) ; \
+               chmod u+s $(DESTDIR)$(camellibexecdir)/camel-lock-helper-$(BASE_VERSION) ; \
            else \
                echo '*** WARNING ***' ; \
                    echo "Camel will not be able to open mbox files until you perform the following steps:" ; \
@@ -271,14 +289,14 @@ install-exec-hook:
        fi
        @if test -n "$(CAMEL_LOCK_HELPER_GROUP)"; then \
            if test `whoami` = root ; then \
-               chgrp $(CAMEL_LOCK_HELPER_GROUP) $(DESTDIR)$(camellibexecdir)/camel-lock-helper ; \
-                   chmod g+s $(DESTDIR)$(camellibexecdir)/camel-lock-helper ; \
+               chgrp $(CAMEL_LOCK_HELPER_GROUP) $(DESTDIR)$(camellibexecdir)/camel-lock-helper-$(BASE_VERSION) ; \
+                   chmod g+s $(DESTDIR)$(camellibexecdir)/camel-lock-helper-$(BASE_VERSION) ; \
            else \
                echo '*** WARNING ***' ; \
                    echo "Camel will not be able to open mbox files until you perform the following steps:" ; \
                    echo "    1. Become root" ; \
-                   echo "    2. chgrp $(CAMEL_LOCK_HELPER_GROUP) $(DESTDIR)$(camellibexecdir)/camel-lock-helper" ; \
-                   echo "    3. chmod g+s $(DESTDIR)$(camellibexecdir)/camel-lock-helper" ; \
+                   echo "    2. chgrp $(CAMEL_LOCK_HELPER_GROUP) $(DESTDIR)$(camellibexecdir)/camel-lock-helper-$(BASE_VERSION)" ; \
+                   echo "    3. chmod g+s $(DESTDIR)$(camellibexecdir)/camel-lock-helper-$(BASE_VERSION)" ; \
                    echo '*** WARNING ***' ; \
            fi \
        else \
@@ -286,11 +304,13 @@ install-exec-hook:
        fi
 
 noinst_HEADERS =                               \
+       broken-date-parser.h                    \
        camel-charset-map-private.h             \
        camel-private.h                         \
        camel-search-private.h                  \
        camel-html-parser.h
 
 EXTRA_DIST =                                   \
+       $(pkgconfig_DATA:.pc=.pc.in)            \
        ChangeLog.pre-1-4                       \
        README
index 19fc0c2..3190cb8 100644 (file)
@@ -34,7 +34,7 @@
 #include <time.h>
 
 #include "broken-date-parser.h"
-#include "e-time-utils.h"
+#include "libedataserver/e-time-utils.h"
 
 #define d(x)
 
index 6800850..add2db1 100644 (file)
@@ -33,7 +33,7 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#include "e-util/e-msgport.h"
+#include "libedataserver/e-msgport.h"
 
 #include "camel-block-file.h"
 #include "camel-file-utils.h"
index eec0ee2..2afdcc3 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <camel/camel-object.h>
 #include <glib.h>
-#include <e-util/e-msgport.h>
+#include <libedataserver/e-msgport.h>
 #include <stdio.h>
 
 typedef guint32 camel_block_t; /* block offset, absolute, bottom BLOCK_SIZE_BITS always 0 */
index 8df6f2e..566b14f 100644 (file)
@@ -40,7 +40,7 @@
 
 #include <camel/camel-file-utils.h>
 
-#include <e-util/e-memory.h>
+#include <libedataserver/e-memory.h>
 
 
 #define CAMEL_CERTDB_GET_CLASS(db)  ((CamelCertDBClass *) CAMEL_OBJECT_GET_CLASS (db))
index 59f916c..74ab90b 100644 (file)
@@ -203,7 +203,7 @@ int main (void)
 #include "camel-charset-map.h"
 #include "camel-charset-map-private.h"
 
-#include <gal/util/e-iconv.h>
+#include <libedataserver/e-iconv.h>
 
 #include <glib.h>
 #include <locale.h>
index 4b5dbae..fbebae4 100644 (file)
@@ -27,7 +27,7 @@
 #include <camel/camel-exception.h>
 
 /* FIXME: camelise */
-#include "e-util/e-msgport.h"
+#include "libedataserver/e-msgport.h"
 
 struct _CamelStream;
 struct _CamelMimePart;
index fee7c54..ad3f0f2 100644 (file)
@@ -30,7 +30,7 @@
 #include <pthread.h>
 
 #include "camel-exception.h"
-#include "e-util/e-memory.h"
+#include "libedataserver/e-memory.h"
 
 #include "camel-debug.h"
 
index e8b499d..ddc787b 100644 (file)
@@ -47,9 +47,9 @@
 #include "camel-debug.h"
 #include "camel-i18n.h"
 
-#include "e-util/e-sexp.h"
-#include "e-util/e-memory.h"
-#include "e-util/e-msgport.h"  /* for edlist */
+#include "libedataserver/e-sexp.h"
+#include "libedataserver/e-memory.h"
+#include "libedataserver/e-msgport.h"  /* for edlist */
 
 #define d(x)
 
index 5f0255b..2e35cb5 100644 (file)
@@ -42,9 +42,8 @@
 #include <signal.h>
 #include <sys/wait.h>
 
-#include <e-util/e-sexp.h>
-
-#include <gal/util/e-iconv.h>
+#include <libedataserver/e-sexp.h>
+#include <libedataserver/e-iconv.h>
 
 #include "camel-mime-message.h"
 #include "camel-provider.h"
index 353f856..51597ee 100644 (file)
@@ -35,6 +35,8 @@
 
 #include <glib.h>
 
+#include "libedataserver/e-memory.h"
+
 #include "camel-folder-search.h"
 #include "camel-folder-thread.h"
 
@@ -43,7 +45,6 @@
 #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"
 #include "camel-i18n.h"
 
index a5239f2..0d43c56 100644 (file)
@@ -27,7 +27,7 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus */
 
-#include <e-util/e-sexp.h>
+#include <libedataserver/e-sexp.h>
 #include <camel/camel-folder.h>
 #include <camel/camel-object.h>
 #include <camel/camel-index.h>
index 2a165a7..d4d99b7 100644 (file)
@@ -33,7 +33,7 @@
 #include <errno.h>
 #include <ctype.h>
 
-#include <gal/util/e-iconv.h>
+#include <libedataserver/e-iconv.h>
 
 #include "camel-folder-summary.h"
 
@@ -55,8 +55,8 @@
 
 #include <camel/camel-string-utils.h>
 
-#include "e-util/md5-utils.h"
-#include "e-util/e-memory.h"
+#include "libedataserver/md5-utils.h"
+#include "libedataserver/e-memory.h"
 
 #include "camel-private.h"
 
index 234b3f1..0d2e9b2 100644 (file)
@@ -35,7 +35,7 @@
 #include <glib.h>
 
 #include "camel-folder-thread.h"
-#include "e-util/e-memory.h"
+#include "libedataserver/e-memory.h"
 
 #define d(x) 
 #define m(x) 
index 81884df..055c43a 100644 (file)
@@ -33,7 +33,7 @@
 #include "camel-store.h"
 #include "camel-mime-message.h"
 #include "camel-debug.h"
-#include "e-util/e-memory.h"
+#include "libedataserver/e-memory.h"
 #include "camel-operation.h"
 #include "camel-session.h"
 #include "camel-filter-driver.h"
index 31a3bd1..928b4ed 100644 (file)
@@ -46,7 +46,7 @@
 #include <errno.h>
 #include <ctype.h>
 
-#include "gal/util/e-iconv.h"
+#include "libedataserver/e-iconv.h"
 
 #include "camel-gpg-context.h"
 #include "camel-mime-filter-charset.h"
index 53c0241..e9bad5d 100644 (file)
@@ -30,6 +30,7 @@
 #include <ctype.h>
 #include <errno.h>
 
+#include "camel-net-utils.h"
 #include "camel-http-stream.h"
 
 #include "camel-mime-utils.h"
index 690ec52..0c4493b 100644 (file)
@@ -38,7 +38,7 @@
 #include <langinfo.h>
 #endif
 
-#include "e-util/e-memory.h"
+#include "libedataserver/e-memory.h"
 #include "camel-charset-map.h"
 #include "string-utils.h"
 #include "camel-iconv.h"
index f42819f..857d1b3 100644 (file)
@@ -17,8 +17,8 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#include "e-util/e-msgport.h"
-#include "e-util/e-memory.h"
+#include "libedataserver/e-msgport.h"
+#include "libedataserver/e-memory.h"
 
 #include "camel/camel-object.h"
 
index 012f189..0d109ce 100644 (file)
@@ -27,7 +27,7 @@
 #include <string.h>
 #include <errno.h>
 
-#include <gal/util/e-iconv.h>
+#include <libedataserver/e-iconv.h>
 
 #include "camel-mime-filter-charset.h"
 #include "camel-charset-map.h"
index 8807e02..3633806 100644 (file)
@@ -32,9 +32,8 @@
 #include <string.h>
 #include <errno.h>
 
-#include <gal/util/e-iconv.h>
-
-#include <e-util/e-time-utils.h>
+#include <libedataserver/e-iconv.h>
+#include <libedataserver/e-time-utils.h>
 
 #include "camel-mime-message.h"
 #include "camel-multipart.h"
index f063b3a..66aab01 100644 (file)
@@ -32,7 +32,7 @@
 #include <ctype.h>
 #include <errno.h>
 
-#include <gal/util/e-iconv.h>
+#include <libedataserver/e-iconv.h>
 
 #include "camel-charset-map.h"
 #include "camel-mime-part-utils.h"
index b87beca..a7aeb11 100644 (file)
@@ -33,7 +33,7 @@
 #include <ctype.h>
 #include <errno.h>
 
-#include <gal/util/e-iconv.h>
+#include <libedataserver/e-iconv.h>
 
 #include "camel-mime-parser.h"
 #include "camel-stream-mem.h"
index 8fe1cc2..510d07f 100644 (file)
 #endif
 
 #include <glib.h>
-#include <gal/util/e-iconv.h>
-#include <e-util/e-time-utils.h>
+#include <libedataserver/e-iconv.h>
+#include <libedataserver/e-time-utils.h>
 
 #include "camel-mime-utils.h"
 #include "camel-charset-map.h"
-#include "camel-service.h"  /* for camel_gethostbyname() */
+#include "camel-net-utils.h"
 #include "camel-utf8.h"
 
 #ifndef CLEAN_DATE
index 44ff8a0..edc6b02 100644 (file)
@@ -136,139 +136,3 @@ camel_multipart_encrypted_new (void)
        
        return multipart;
 }
-
-
-int
-camel_multipart_encrypted_encrypt (CamelMultipartEncrypted *mpe, CamelMimePart *content,
-                                  CamelCipherContext *cipher, const char *userid,
-                                  GPtrArray *recipients, CamelException *ex)
-{
-       abort();
-
-#if 0
-       CamelMimePart *version_part, *encrypted_part;
-       CamelContentType *mime_type;
-       CamelDataWrapper *wrapper;
-       CamelStream *stream;
-       
-       g_return_val_if_fail (CAMEL_IS_MULTIPART_ENCRYPTED (mpe), -1);
-       g_return_val_if_fail (CAMEL_IS_CIPHER_CONTEXT (cipher), -1);
-       g_return_val_if_fail (cipher->encrypt_protocol != NULL, -1);
-       g_return_val_if_fail (CAMEL_IS_MIME_PART (content), -1);
-       
-       /* encrypt the content stream */
-       encrypted_part = camel_mime_part_new();
-       if (camel_cipher_encrypt (cipher, userid, recipients, content, encrypted_part, ex) == -1) {
-               camel_object_unref(encrypted_part);
-               return -1;
-       }
-       
-       /* construct the version part */
-       stream = camel_stream_mem_new ();
-       camel_stream_write_string (stream, "Version: 1\n");
-       camel_stream_reset (stream);
-       
-       version_part = camel_mime_part_new ();
-       wrapper = camel_data_wrapper_new ();
-       camel_data_wrapper_set_mime_type (wrapper, cipher->encrypt_protocol);
-       camel_data_wrapper_construct_from_stream (wrapper, stream);
-       camel_object_unref (stream);
-       camel_medium_set_content_object ((CamelMedium *) version_part, wrapper);
-       camel_object_unref (wrapper);
-
-       /* save the version and encrypted parts */
-       /* FIXME: make sure there aren't any other parts?? */
-       camel_multipart_add_part (CAMEL_MULTIPART (mpe), version_part);
-       camel_object_unref (version_part);
-       camel_multipart_add_part (CAMEL_MULTIPART (mpe), encrypted_part);
-       camel_object_unref (encrypted_part);
-       
-       /* cache the decrypted content */
-       camel_object_ref (content);
-       mpe->decrypted = content;
-       
-       /* set the content-type params for this multipart/encrypted part */
-       mime_type = camel_content_type_new ("multipart", "encrypted");
-       camel_content_type_set_param (mime_type, "protocol", cipher->encrypt_protocol);
-       camel_data_wrapper_set_mime_type_field (CAMEL_DATA_WRAPPER (mpe), mime_type);
-       camel_content_type_unref (mime_type);
-       camel_multipart_set_boundary ((CamelMultipart *) mpe, NULL);
-#endif
-
-       return 0;
-}
-
-
-CamelMimePart *
-camel_multipart_encrypted_decrypt (CamelMultipartEncrypted *mpe,
-                                  CamelCipherContext *cipher,
-                                  CamelException *ex)
-{
-       CamelMimePart *version_part, *encrypted_part, *decrypted_part;
-       CamelContentType *mime_type;
-       CamelCipherValidity *valid;
-       CamelDataWrapper *wrapper;
-       const char *protocol;
-       char *content_type;
-       
-       g_return_val_if_fail (CAMEL_IS_MULTIPART_ENCRYPTED (mpe), NULL);
-       g_return_val_if_fail (CAMEL_IS_CIPHER_CONTEXT (cipher), NULL);
-       g_return_val_if_fail (cipher->encrypt_protocol != NULL, NULL);
-       
-       if (mpe->decrypted) {
-               /* we seem to have already decrypted the part */
-               camel_object_ref (mpe->decrypted);
-               return mpe->decrypted;
-       }
-       
-       protocol = mpe->protocol;
-       
-       if (protocol) {
-               /* make sure the protocol matches the cipher encrypt protocol */
-               if (g_ascii_strcasecmp (cipher->encrypt_protocol, protocol) != 0) {
-                       camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
-                                            _("Failed to decrypt MIME part: protocol error"));
-                       
-                       return NULL;
-               }
-       } else {
-               /* *shrug* - I guess just go on as if they match? */
-               protocol = cipher->encrypt_protocol;
-       }
-       
-       /* make sure the protocol matches the version part's content-type */
-       version_part = camel_multipart_get_part (CAMEL_MULTIPART (mpe), CAMEL_MULTIPART_ENCRYPTED_VERSION);
-       wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (version_part));
-       content_type = camel_data_wrapper_get_mime_type (wrapper);
-       if (g_ascii_strcasecmp (content_type, protocol) != 0) {
-               camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
-                                    _("Failed to decrypt MIME part: protocol error"));
-               
-               g_free (content_type);
-               
-               return NULL;
-       }
-       g_free (content_type);
-       
-       /* get the encrypted part (second part) */
-       encrypted_part = camel_multipart_get_part (CAMEL_MULTIPART (mpe), CAMEL_MULTIPART_ENCRYPTED_CONTENT);
-       mime_type = camel_mime_part_get_content_type (encrypted_part);
-       if (!camel_content_type_is (mime_type, "application", "octet-stream")) {
-               camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
-                                    _("Failed to decrypt MIME part: invalid structure"));
-               return NULL;
-       }
-
-       decrypted_part = camel_mime_part_new();
-       valid = camel_cipher_decrypt(cipher, encrypted_part, decrypted_part, ex);
-       if (valid) {
-               camel_object_ref(decrypted_part);
-               mpe->decrypted = decrypted_part;
-               camel_cipher_validity_free(valid);
-       } else {
-               camel_object_ref(decrypted_part);
-               decrypted_part = NULL;
-       }
-
-       return decrypted_part;
-}
index 94bcb79..1c3b9b4 100644 (file)
@@ -30,7 +30,6 @@ extern "C" {
 #endif /* __cplusplus */
 
 #include <camel/camel-multipart.h>
-#include <camel/camel-cipher-context.h>
 
 #define CAMEL_MULTIPART_ENCRYPTED_TYPE     (camel_multipart_encrypted_get_type ())
 #define CAMEL_MULTIPART_ENCRYPTED(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_MULTIPART_ENCRYPTED_TYPE, CamelMultipartEncrypted))
@@ -56,26 +55,15 @@ struct _CamelMultipartEncrypted {
        char *protocol;
 };
 
-
 struct _CamelMultipartEncryptedClass {
        CamelMultipartClass parent_class;
        
 };
 
-
 CamelType camel_multipart_encrypted_get_type (void);
 
-
 CamelMultipartEncrypted *camel_multipart_encrypted_new (void);
 
-int camel_multipart_encrypted_encrypt (CamelMultipartEncrypted *mpe, CamelMimePart *content,
-                                      CamelCipherContext *cipher, const char *userid,
-                                      GPtrArray *recipients, CamelException *ex);
-
-CamelMimePart *camel_multipart_encrypted_decrypt (CamelMultipartEncrypted *mpe,
-                                                 CamelCipherContext *cipher,
-                                                 CamelException *ex);
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 7599df6..ebd5d27 100644 (file)
@@ -43,7 +43,7 @@
 #include "camel-multipart-signed.h"
 #include "camel-mime-part.h"
 #include "camel-exception.h"
-#include "md5-utils.h"
+#include "libedataserver/md5-utils.h"
 
 #include "camel-stream-filter.h"
 #include "camel-seekable-substream.h"
@@ -541,124 +541,6 @@ write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
        return total;   
 }
 
-/* See rfc3156, section 2 and others */
-/* We do this simply: Anything not base64 must be qp
-   This is so that we can safely translate any occurance of "From "
-   into the quoted-printable escaped version safely. */
-static void
-prepare_sign(CamelMimePart *mime_part)
-{
-       CamelDataWrapper *wrapper;
-       CamelTransferEncoding encoding;
-       int parts, i;
-       
-       wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
-       if (!wrapper)
-               return;
-       
-       if (CAMEL_IS_MULTIPART (wrapper)) {
-               parts = camel_multipart_get_number((CamelMultipart *)wrapper);
-               for (i = 0; i < parts; i++)
-                       prepare_sign(camel_multipart_get_part((CamelMultipart *)wrapper, i));
-       } else if (CAMEL_IS_MIME_MESSAGE (wrapper)) {
-               prepare_sign((CamelMimePart *)wrapper);
-       } else {
-               encoding = camel_mime_part_get_encoding(mime_part);
-
-               if (encoding != CAMEL_TRANSFER_ENCODING_BASE64
-                   && encoding != CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE) {
-                       camel_mime_part_set_encoding(mime_part, CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE);
-               }
-       }
-}
-
-/**
- * camel_multipart_signed_sign:
- * @mps: 
- * @context: The CipherContext to use for signing.
- * @content: CamelMimePart content you wish to sign/transport.
- * @userid: The id of the signing key to use.
- * @hash: The algorithm to use.
- * @ex: 
- * 
- * Sign the part @content, and attach it as the first part
- * (CAMEL_MULTIPART_SIGNED_CONTENT) of the multipart @mps.  A
- * signature object will be created and setup as the second part
- * (CAMEL_MULTIPART_SIGNED_SIGNATURE) of the object.  Once a part has
- * been successfully signed the mutlipart is ready for transmission.
- *
- * This method should be used to create multipart/signed objects
- * which are properly canoncalised before signing, etc.
- * 
- * Return value: -1 on error, setting @ex appropriately.  On error
- * neither the content or signature parts will be setup.
- **/
-int
-camel_multipart_signed_sign(CamelMultipartSigned *mps, CamelCipherContext *context, CamelMimePart *content, const char *userid, CamelCipherHash hash, CamelException *ex)
-{
-       abort();
-#if 0
-       CamelMimeFilter *canon_filter;
-       CamelStream *mem;
-       CamelStreamFilter *filter;
-       CamelContentType *mime_type;
-       CamelMimePart *sigpart;
-
-       /* this needs to be set */
-       g_return_val_if_fail(context->sign_protocol != NULL, -1);
-
-       prepare_sign(content);
-
-       mem = camel_stream_mem_new();
-       filter = camel_stream_filter_new_with_stream(mem);
-       
-       /* Note: see rfc2015 or rfc3156, section 5 */
-       canon_filter = camel_mime_filter_canon_new(CAMEL_MIME_FILTER_CANON_STRIP|CAMEL_MIME_FILTER_CANON_CRLF|CAMEL_MIME_FILTER_CANON_FROM);
-       camel_stream_filter_add(filter, (CamelMimeFilter *)canon_filter);
-       camel_object_unref((CamelObject *)canon_filter);
-
-       camel_data_wrapper_write_to_stream((CamelDataWrapper *)content, (CamelStream *)filter);
-       camel_stream_flush((CamelStream *)filter);
-       camel_object_unref((CamelObject *)filter);
-       camel_stream_reset(mem);
-
-#if 0
-       printf("-- Signing:\n");
-       fwrite(((CamelStreamMem *)mem)->buffer->data, ((CamelStreamMem *)mem)->buffer->len, 1, stdout);
-       printf("-- end\n");
-#endif
-
-       sigpart = camel_mime_part_new();
-
-       if (camel_cipher_sign(context, userid, hash, mem, sigpart, ex) == -1) {
-               camel_object_unref(mem);
-               camel_object_unref(sigpart);
-               return -1;
-       }
-
-       /* setup our mime type and boundary */
-       mime_type = camel_content_type_new("multipart", "signed");
-       camel_content_type_set_param(mime_type, "micalg", camel_cipher_hash_to_id(context, hash));
-       camel_content_type_set_param(mime_type, "protocol", context->sign_protocol);
-       camel_data_wrapper_set_mime_type_field(CAMEL_DATA_WRAPPER (mps), mime_type);
-       camel_content_type_unref(mime_type);
-       camel_multipart_set_boundary((CamelMultipart *)mps, NULL);
-
-       /* just keep the whole raw content.  We dont *really* need to do this because
-          we know how we just proccessed it, but, well, better to be safe than sorry */
-       mps->signature = sigpart;
-       mps->contentraw = mem;
-       camel_stream_reset(mem);
-
-       /* clear the data-wrapper stream - tells write_to_stream to use the right object */
-       if (((CamelDataWrapper *)mps)->stream) {
-               camel_object_unref((CamelObject *) ((CamelDataWrapper *)mps)->stream);
-               ((CamelDataWrapper *)mps)->stream = NULL;
-       }
-#endif
-       return 0;
-}
-
 CamelStream *
 camel_multipart_signed_get_content_stream(CamelMultipartSigned *mps, CamelException *ex)
 {
@@ -691,77 +573,3 @@ camel_multipart_signed_get_content_stream(CamelMultipartSigned *mps, CamelExcept
 
        return constream;
 }
-
-/**
- * camel_multipart_signed_verify:
- * @mps: 
- * @context: 
- * @ex: 
- * 
- * Verify a signed object.  This may be used to verify newly signed
- * objects as well as those created from external streams or parsers.
- * 
- * Return value: A validity value, or NULL on error, setting @ex
- * appropriately.
- **/
-CamelCipherValidity *
-camel_multipart_signed_verify(CamelMultipartSigned *mps, CamelCipherContext *context, CamelException *ex)
-{
-       abort();
-
-       return NULL;
-#if 0
-       CamelCipherValidity *valid;
-       CamelMimePart *sigpart;
-       CamelStream *constream;
-
-       /* we need to be able to verify stuff we just signed as well as stuff we loaded from a stream/parser */
-
-       if (mps->contentraw) {
-               constream = mps->contentraw;
-               camel_object_ref((CamelObject *)constream);
-       } else {
-               CamelStream *sub;
-               CamelMimeFilter *canon_filter;
-
-               if (mps->start1 == -1 && parse_content(mps) == -1) {
-                       camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("parse error"));
-                       return NULL;
-               }
-
-               /* first, prepare our parts */
-               sub = camel_seekable_substream_new((CamelSeekableStream *)((CamelDataWrapper *)mps)->stream, mps->start1, mps->end1);
-               constream = (CamelStream *)camel_stream_filter_new_with_stream(sub);
-               camel_object_unref((CamelObject *)sub);
-               
-               /* Note: see rfc2015 or rfc3156, section 5 */
-               canon_filter = camel_mime_filter_canon_new (CAMEL_MIME_FILTER_CANON_CRLF);
-               camel_stream_filter_add((CamelStreamFilter *)constream, (CamelMimeFilter *)canon_filter);
-               camel_object_unref((CamelObject *)canon_filter);
-       }
-
-       /* we do this as a normal mime part so we can have it handle transfer encoding etc */
-       sigpart = camel_multipart_get_part((CamelMultipart *)mps, CAMEL_MULTIPART_SIGNED_SIGNATURE);
-
-       /* do the magic, the caller must supply the right context for this kind of object */
-       valid = camel_cipher_verify(context, camel_cipher_id_to_hash(context, mps->micalg), constream, sigpart, ex);
-
-#if 0
-       {
-               CamelStream *sout = camel_stream_fs_new_with_fd(dup(0));
-
-               camel_stream_printf(sout, "-- Verifying:\n");
-               camel_stream_reset(constream);
-               camel_stream_write_to_stream(constream, sout);
-               camel_stream_printf(sout, "-- end\n");
-               camel_object_unref((CamelObject *)sout);
-       }
-#endif
-
-       camel_object_unref(constream);
-
-       return valid;
-#endif
-}
-
-
index 2b0df64..42d0e19 100644 (file)
@@ -33,7 +33,6 @@ extern "C" {
 #endif /* __cplusplus }*/
 
 #include <camel/camel-multipart.h>
-#include <camel/camel-cipher-context.h>
 
 #define CAMEL_MULTIPART_SIGNED_TYPE     (camel_multipart_signed_get_type ())
 #define CAMEL_MULTIPART_SIGNED(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_MULTIPART_SIGNED_TYPE, CamelMultipartSigned))
@@ -93,12 +92,6 @@ CamelMultipartSigned *camel_multipart_signed_new           (void);
 
 CamelStream *camel_multipart_signed_get_content_stream(CamelMultipartSigned *mps, CamelException *ex);
 
-int                  camel_multipart_signed_sign          (CamelMultipartSigned *mps, CamelCipherContext *context,
-                                                           CamelMimePart *content, const char *uiserid,
-                                                           CamelCipherHash hash, CamelException *ex);
-CamelCipherValidity  *camel_multipart_signed_verify       (CamelMultipartSigned *mps, CamelCipherContext *context,
-                                                           CamelException *ex);
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 3ec6014..18666eb 100644 (file)
@@ -37,7 +37,7 @@
 #include "camel-multipart.h"
 #include "camel-mime-part.h"
 #include "camel-exception.h"
-#include "md5-utils.h"
+#include "libedataserver/md5-utils.h"
 
 #define d(x)
 
diff --git a/camel/camel-net-utils.c b/camel/camel-net-utils.c
new file mode 100644 (file)
index 0000000..a4d8159
--- /dev/null
@@ -0,0 +1,781 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Authors: Michael Zucchi <notzed@ximian.com>
+ *         Jeffrey Stedfast <fejj@ximian.com>
+ *         Chris Toshok <toshok@ximian.com>
+ *
+ * Copyright (C) 2004 Ximian Inc.
+ *
+ * This program is free software; you can redistribute it and/or 
+ * modify it under the terms of version 2 of the GNU General Public 
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <sys/poll.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <glib.h>
+
+#include "camel-i18n.h"
+#include "camel-operation.h"
+#include "camel-exception.h"
+#include "camel-net-utils.h"
+
+#include "libedataserver/e-msgport.h"
+
+#define d(x)
+
+/* gethostbyname emulation code for emulating getaddrinfo code ...
+
+This should probably go away */
+
+#ifdef NEED_ADDRINFO
+
+#if !defined (HAVE_GETHOSTBYNAME_R) || !defined (HAVE_GETHOSTBYADDR_R)
+G_LOCK_DEFINE_STATIC (gethost_mutex);
+#endif
+
+#define ALIGN(x) (((x) + (sizeof (char *) - 1)) & ~(sizeof (char *) - 1))
+
+#define GETHOST_PROCESS(h, host, buf, buflen, herr) G_STMT_START {     \
+       int num_aliases = 0, num_addrs = 0;                            \
+       int req_length;                                                \
+       char *p;                                                       \
+       int i;                                                         \
+                                                                      \
+       /* check to make sure we have enough room in our buffer */     \
+       req_length = 0;                                                \
+       if (h->h_aliases) {                                            \
+               for (i = 0; h->h_aliases[i]; i++)                      \
+                       req_length += strlen (h->h_aliases[i]) + 1;    \
+               num_aliases = i;                                       \
+       }                                                              \
+                                                                      \
+       if (h->h_addr_list) {                                          \
+               for (i = 0; h->h_addr_list[i]; i++)                    \
+                       req_length += h->h_length;                     \
+               num_addrs = i;                                         \
+       }                                                              \
+                                                                      \
+       req_length += sizeof (char *) * (num_aliases + 1);             \
+       req_length += sizeof (char *) * (num_addrs + 1);               \
+       req_length += strlen (h->h_name) + 1;                          \
+                                                                      \
+       if (buflen < req_length) {                                     \
+               *herr = ERANGE;                                        \
+               G_UNLOCK (gethost_mutex);                              \
+               return ERANGE;                                         \
+       }                                                              \
+                                                                      \
+       /* we store the alias/addr pointers in the buffer */           \
+        /* their addresses here. */                                    \
+       p = buf;                                                       \
+       if (num_aliases) {                                             \
+               host->h_aliases = (char **) p;                         \
+               p += sizeof (char *) * (num_aliases + 1);              \
+       } else                                                         \
+               host->h_aliases = NULL;                                \
+                                                                       \
+       if (num_addrs) {                                               \
+               host->h_addr_list = (char **) p;                       \
+               p += sizeof (char *) * (num_addrs + 1);                \
+       } else                                                         \
+               host->h_addr_list = NULL;                              \
+                                                                      \
+       /* copy the host name into the buffer */                       \
+       host->h_name = p;                                              \
+       strcpy (p, h->h_name);                                         \
+       p += strlen (h->h_name) + 1;                                   \
+       host->h_addrtype = h->h_addrtype;                              \
+       host->h_length = h->h_length;                                  \
+                                                                      \
+       /* copy the aliases/addresses into the buffer */               \
+        /* and assign pointers into the hostent */                     \
+       *p = 0;                                                        \
+       if (num_aliases) {                                             \
+               for (i = 0; i < num_aliases; i++) {                    \
+                       strcpy (p, h->h_aliases[i]);                   \
+                       host->h_aliases[i] = p;                        \
+                       p += strlen (h->h_aliases[i]);                 \
+               }                                                      \
+               host->h_aliases[num_aliases] = NULL;                   \
+       }                                                              \
+                                                                      \
+       if (num_addrs) {                                               \
+               for (i = 0; i < num_addrs; i++) {                      \
+                       memcpy (p, h->h_addr_list[i], h->h_length);    \
+                       host->h_addr_list[i] = p;                      \
+                       p += h->h_length;                              \
+               }                                                      \
+               host->h_addr_list[num_addrs] = NULL;                   \
+       }                                                              \
+} G_STMT_END
+
+
+#ifdef ENABLE_IPv6
+/* some helpful utils for IPv6 lookups */
+#define IPv6_BUFLEN_MIN  (sizeof (char *) * 3)
+
+static int
+ai_to_herr (int error)
+{
+       switch (error) {
+       case EAI_NONAME:
+       case EAI_FAIL:
+               return HOST_NOT_FOUND;
+               break;
+       case EAI_SERVICE:
+               return NO_DATA;
+               break;
+       case EAI_ADDRFAMILY:
+               return NO_ADDRESS;
+               break;
+       case EAI_NODATA:
+               return NO_DATA;
+               break;
+       case EAI_MEMORY:
+               return ENOMEM;
+               break;
+       case EAI_AGAIN:
+               return TRY_AGAIN;
+               break;
+       case EAI_SYSTEM:
+               return errno;
+               break;
+       default:
+               return NO_RECOVERY;
+               break;
+       }
+}
+
+#endif /* ENABLE_IPv6 */
+
+static int
+camel_gethostbyname_r (const char *name, struct hostent *host,
+                      char *buf, size_t buflen, int *herr)
+{
+#ifdef ENABLE_IPv6
+       struct addrinfo hints, *res;
+       int retval, len;
+       char *addr;
+       
+       memset (&hints, 0, sizeof (struct addrinfo));
+#ifdef HAVE_AI_ADDRCONFIG
+       hints.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
+#else
+       hints.ai_flags = AI_CANONNAME;
+#endif
+       hints.ai_family = PF_UNSPEC;
+       hints.ai_socktype = SOCK_STREAM;
+       hints.ai_protocol = IPPROTO_TCP;
+       
+       if ((retval = getaddrinfo (name, NULL, &hints, &res)) != 0) {
+               *herr = ai_to_herr (retval);
+               return -1;
+       }
+       
+       len = ALIGN (strlen (res->ai_canonname) + 1);
+       if (buflen < IPv6_BUFLEN_MIN + len + res->ai_addrlen + sizeof (char *))
+               return ERANGE;
+       
+       /* h_name */
+       strcpy (buf, res->ai_canonname);
+       host->h_name = buf;
+       buf += len;
+       
+       /* h_aliases */
+       ((char **) buf)[0] = NULL;
+       host->h_aliases = (char **) buf;
+       buf += sizeof (char *);
+       
+       /* h_addrtype and h_length */
+       host->h_length = res->ai_addrlen;
+       if (res->ai_family == PF_INET6) {
+               host->h_addrtype = AF_INET6;
+               
+               addr = (char *) &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr;
+       } else {
+               host->h_addrtype = AF_INET;
+               
+               addr = (char *) &((struct sockaddr_in *) res->ai_addr)->sin_addr;
+       }
+       
+       memcpy (buf, addr, host->h_length);
+       addr = buf;
+       buf += ALIGN (host->h_length);
+       
+       /* h_addr_list */
+       ((char **) buf)[0] = addr;
+       ((char **) buf)[1] = NULL;
+       host->h_addr_list = (char **) buf;
+       
+       freeaddrinfo (res);
+       
+       return 0;
+#else /* No support for IPv6 addresses */
+#ifdef HAVE_GETHOSTBYNAME_R
+#ifdef GETHOSTBYNAME_R_FIVE_ARGS
+       if (gethostbyname_r (name, host, buf, buflen, herr))
+               return 0;
+       else
+               return errno;
+#else
+       struct hostent *hp;
+       int retval;
+       
+       retval = gethostbyname_r (name, host, buf, buflen, &hp, herr);
+       if (hp != NULL) {
+               *herr = 0;
+       } else if (retval == 0) {
+               /* glibc 2.3.2 workaround - it seems that
+                * gethostbyname_r will sometimes return 0 on fail and
+                * not set the hostent values (hence the crash in bug
+                * #56337).  Hopefully we can depend on @hp being NULL
+                * in this error case like we do with
+                * gethostbyaddr_r().
+                */
+               retval = -1;
+       }
+       
+       return retval;
+#endif
+#else /* No support for gethostbyname_r */
+       struct hostent *h;
+       
+       G_LOCK (gethost_mutex);
+       
+       h = gethostbyname (name);
+       
+       if (!h) {
+               *herr = h_errno;
+               G_UNLOCK (gethost_mutex);
+               return -1;
+       }
+       
+       GETHOST_PROCESS (h, host, buf, buflen, herr);
+       
+       G_UNLOCK (gethost_mutex);
+       
+       return 0;
+#endif /* HAVE_GETHOSTBYNAME_R */
+#endif /* ENABLE_IPv6 */
+}
+
+static int
+camel_gethostbyaddr_r (const char *addr, int addrlen, int type, struct hostent *host,
+                      char *buf, size_t buflen, int *herr)
+{
+#ifdef ENABLE_IPv6
+       int retval, len;
+       
+       if ((retval = getnameinfo (addr, addrlen, buf, buflen, NULL, 0, NI_NAMEREQD)) != 0) {
+               *herr = ai_to_herr (retval);
+               return -1;
+       }
+       
+       len = ALIGN (strlen (buf) + 1);
+       if (buflen < IPv6_BUFLEN_MIN + len + addrlen + sizeof (char *))
+               return ERANGE;
+       
+       /* h_name */
+       host->h_name = buf;
+       buf += len;
+       
+       /* h_aliases */
+       ((char **) buf)[0] = NULL;
+       host->h_aliases = (char **) buf;
+       buf += sizeof (char *);
+       
+       /* h_addrtype and h_length */
+       host->h_length = addrlen;
+       host->h_addrtype = type;
+       
+       memcpy (buf, addr, host->h_length);
+       addr = buf;
+       buf += ALIGN (host->h_length);
+       
+       /* h_addr_list */
+       ((char **) buf)[0] = addr;
+       ((char **) buf)[1] = NULL;
+       host->h_addr_list = (char **) buf;
+       
+       return 0;
+#else /* No support for IPv6 addresses */
+#ifdef HAVE_GETHOSTBYADDR_R
+#ifdef GETHOSTBYADDR_R_SEVEN_ARGS
+       if (gethostbyaddr_r (addr, addrlen, type, host, buf, buflen, herr))
+               return 0;
+       else
+               return errno;
+#else
+       struct hostent *hp;
+       int retval;
+       
+       retval = gethostbyaddr_r (addr, addrlen, type, host, buf, buflen, &hp, herr);
+       if (hp != NULL) {
+               *herr = 0;
+               retval = 0;
+       } else if (retval == 0) {
+               /* glibc 2.3.2 workaround - it seems that
+                * gethostbyaddr_r will sometimes return 0 on fail and
+                * fill @host with garbage strings from /etc/hosts
+                * (failure to parse the file? who knows). Luckily, it
+                * seems that we can rely on @hp being NULL on
+                * fail.
+                */
+               retval = -1;
+       }
+       
+       return retval;
+#endif
+#else /* No support for gethostbyaddr_r */
+       struct hostent *h;
+       
+       G_LOCK (gethost_mutex);
+       
+       h = gethostbyaddr (addr, addrlen, type);
+       
+       if (!h) {
+               *herr = h_errno;
+               G_UNLOCK (gethost_mutex);
+               return -1;
+       }
+       
+       GETHOST_PROCESS (h, host, buf, buflen, herr);
+       
+       G_UNLOCK (gethost_mutex);
+       
+       return 0;
+#endif /* HAVE_GETHOSTBYADDR_R */
+#endif /* ENABLE_IPv6 */
+}
+#endif /* NEED_ADDRINFO */
+
+/* ********************************************************************** */
+struct _addrinfo_msg {
+       EMsg msg;
+       unsigned int cancelled:1;
+
+       /* for host lookup */
+       const char *name;
+       const char *service;
+       int result;
+       const struct addrinfo *hints;
+       struct addrinfo **res;
+
+       /* for host lookup emulation */
+#ifdef NEED_ADDRINFO
+       struct hostent hostbuf;
+       int hostbuflen;
+       char *hostbufmem;
+#endif
+
+       /* for name lookup */
+       const struct sockaddr *addr;
+       socklen_t addrlen;
+       char *host;
+       int hostlen;
+       char *serv;
+       int servlen;
+       int flags;
+};
+
+static void
+cs_freeinfo(struct _addrinfo_msg *msg)
+{
+       g_free(msg->host);
+       g_free(msg->serv);
+#ifdef NEED_ADDRINFO
+       g_free(msg->hostbufmem);
+#endif
+       g_free(msg);
+}
+
+/* returns -1 if cancelled */
+static int
+cs_waitinfo(void *(worker)(void *), struct _addrinfo_msg *msg, const char *error, CamelException *ex)
+{
+       EMsgPort *reply_port;
+       pthread_t id;
+       int err, cancel_fd, cancel = 0, fd;
+
+       cancel_fd = camel_operation_cancel_fd(NULL);
+       if (cancel_fd == -1) {
+               worker(msg);
+               return 0;
+       }
+       
+       reply_port = msg->msg.reply_port = e_msgport_new();
+       fd = e_msgport_fd(msg->msg.reply_port);
+       if ((err = pthread_create(&id, NULL, worker, msg)) == 0) {
+               struct pollfd polls[2];
+               int status;
+
+               polls[0].fd = fd;
+               polls[0].events = POLLIN;
+               polls[1].fd = cancel_fd;
+               polls[1].events = POLLIN;
+
+               d(printf("waiting for name return/cancellation in main process\n"));
+               do {
+                       polls[0].revents = 0;
+                       polls[1].revents = 0;
+                       status = poll(polls, 2, -1);
+               } while (status == -1 && errno == EINTR);
+
+               if (status == -1 || (polls[1].revents & POLLIN)) {
+                       if (status == -1)
+                               camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "%s: %s", error, g_strerror(errno));
+                       else
+                               camel_exception_setv(ex, CAMEL_EXCEPTION_USER_CANCEL, _("Cancelled"));
+                       
+                       /* We cancel so if the thread impl is decent it causes immediate exit.
+                          We detach so we dont need to wait for it to exit if it isn't.
+                          We check the reply port incase we had a reply in the mean time, which we free later */
+                       d(printf("Cancelling lookup thread and leaving it\n"));
+                       msg->cancelled = 1;
+                       pthread_detach(id);
+                       pthread_cancel(id);
+                       cancel = 1;
+               } else {
+                       struct _addrinfo_msg *reply = (struct _addrinfo_msg *)e_msgport_get(reply_port);
+
+                       g_assert(reply == msg);
+                       d(printf("waiting for child to exit\n"));
+                       pthread_join(id, NULL);
+                       d(printf("child done\n"));
+               }
+       } else {
+               camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "%s: %s: %s", error, _("cannot create thread"), g_strerror(err));
+       }
+       e_msgport_destroy(reply_port);
+
+       return cancel;
+}
+
+#ifdef NEED_ADDRINFO
+static void *
+cs_getaddrinfo(void *data)
+{
+       struct _addrinfo_msg *msg = data;
+       int herr;
+       struct hostent h;
+       struct addrinfo *res, *last = NULL;
+       struct sockaddr_in *sin;
+       in_port_t port = 0;
+       int i;
+
+       /* This is a pretty simplistic emulation of getaddrinfo */
+
+       while ((msg->result = camel_gethostbyname_r(msg->name, &h, msg->hostbufmem, msg->hostbuflen, &herr)) == ERANGE) {
+               pthread_testcancel();
+                msg->hostbuflen *= 2;
+                msg->hostbufmem = g_realloc(msg->hostbufmem, msg->hostbuflen);
+       }
+       
+       /* If we got cancelled, dont reply, just free it */
+       if (msg->cancelled)
+               goto cancel;
+
+       /* FIXME: map error numbers across */
+       if (msg->result != 0)
+               goto reply;
+
+       /* check hints matched */
+       if (msg->hints && msg->hints->ai_family && msg->hints->ai_family != h.h_addrtype) {
+               msg->result = EAI_FAMILY;
+               goto reply;
+       }
+
+       /* we only support ipv4 for this interface, even if it could supply ipv6 */
+       if (h.h_addrtype != AF_INET) {
+               msg->result = EAI_FAMILY;
+               goto reply;
+       }
+
+       /* check service mapping */
+       if (msg->service) {
+               const char *p = msg->service;
+
+               while (*p) {
+                       if (*p < '0' || *p > '9')
+                               break;
+                       p++;
+               }
+
+               if (*p) {
+                       const char *socktype = NULL;
+                       struct servent *serv;
+
+                       if (msg->hints && msg->hints->ai_socktype) {
+                               if (msg->hints->ai_socktype == SOCK_STREAM)
+                                       socktype = "tcp";
+                               else if (msg->hints->ai_socktype == SOCK_DGRAM)
+                                       socktype = "udp";
+                       }
+
+                       serv = getservbyname(msg->service, socktype);
+                       if (serv == NULL) {
+                               msg->result = EAI_NONAME;
+                               goto reply;
+                       }
+                       port = serv->s_port;
+               } else {
+                       port = htons(strtoul(msg->service, NULL, 10));
+               }
+       }
+
+       for (i=0;h.h_addr_list[i];i++) {
+               res = g_malloc0(sizeof(*res));
+               if (msg->hints) {
+                       res->ai_flags = msg->hints->ai_flags;
+                       if (msg->hints->ai_flags & AI_CANONNAME)
+                               res->ai_canonname = g_strdup(h.h_name);
+                       res->ai_socktype = msg->hints->ai_socktype;
+                       res->ai_protocol = msg->hints->ai_protocol;
+               } else {
+                       res->ai_flags = 0;
+                       res->ai_socktype = SOCK_STREAM; /* fudge */
+                       res->ai_protocol = 0;   /* fudge */
+               }
+               res->ai_family = AF_INET;
+               res->ai_addrlen = sizeof(*sin);
+               res->ai_addr = g_malloc(sizeof(*sin));
+               sin = (struct sockaddr_in *)res->ai_addr;
+               sin->sin_family = AF_INET;
+               sin->sin_port = port;
+               memcpy(&sin->sin_addr, h.h_addr_list[i], sizeof(sin->sin_addr));
+
+               if (last == NULL) {
+                       *msg->res = last = res;
+               } else {
+                       last->ai_next = res;
+                       last = res;
+               }
+       }
+reply:
+       e_msgport_reply((EMsg *)msg);
+       return NULL;
+cancel:
+       cs_freeinfo(msg);
+       return NULL;
+}
+#else
+static void *
+cs_getaddrinfo(void *data)
+{
+       struct _addrinfo_msg *info = data;
+
+       info->result = getaddrinfo(info->name, info->service, info->hints, info->res);
+       
+       if (info->cancelled) {
+               g_free(info);
+       } else {
+               e_msgport_reply((EMsg *)info);
+       }
+       
+       return NULL;
+}
+#endif /* NEED_ADDRINFO */
+
+struct addrinfo *
+camel_getaddrinfo(const char *name, const char *service, const struct addrinfo *hints, CamelException *ex)
+{
+       struct _addrinfo_msg *msg;
+       struct addrinfo *res = NULL;
+#ifndef ENABLE_IPv6
+       struct addrinfo myhints;
+#endif
+       g_return_val_if_fail(name != NULL, NULL);
+       
+       if (camel_operation_cancel_check(NULL)) {
+               camel_exception_set(ex, CAMEL_EXCEPTION_USER_CANCEL, _("Cancelled"));
+               return NULL;
+       }
+
+       camel_operation_start_transient(NULL, _("Resolving: %s"), name);
+
+       /* force ipv4 addresses only */
+#ifndef ENABLE_IPv6
+       if (hints == NULL)
+               memset(&myhints, 0, sizeof(myhints));
+       else
+               memcpy (&myhints, hints, sizeof (myhints));
+       
+       myhints.ai_family = AF_INET;
+       hints = &myhints;
+#endif
+
+       msg = g_malloc0(sizeof(*msg));
+       msg->name = name;
+       msg->service = service;
+       msg->hints = hints;
+       msg->res = &res;
+#ifdef NEED_ADDRINFO
+       msg->hostbuflen = 1024;
+       msg->hostbufmem = g_malloc(msg->hostbuflen);
+#endif 
+       if (cs_waitinfo(cs_getaddrinfo, msg, _("Host lookup failed"), ex) == 0) {
+               if (msg->result != 0)
+                       camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Host lookup failed: %s: %s"),
+                                             name, gai_strerror (msg->result));
+               
+               cs_freeinfo(msg);
+       } else
+               res = NULL;
+       
+       camel_operation_end(NULL);
+
+       return res;
+}
+
+void
+camel_freeaddrinfo(struct addrinfo *host)
+{
+#ifdef NEED_ADDRINFO
+       while (host) {
+               struct addrinfo *next = host->ai_next;
+
+               g_free(host->ai_canonname);
+               g_free(host->ai_addr);
+               g_free(host);
+               host = next;
+       }
+#else
+       freeaddrinfo(host);
+#endif
+}
+
+#ifdef NEED_ADDRINFO
+static void *
+cs_getnameinfo(void *data)
+{
+       struct _addrinfo_msg *msg = data;
+       int herr;
+       struct hostent h;
+       struct sockaddr_in *sin = (struct sockaddr_in *)msg->addr;
+
+       /* FIXME: error code */
+       if (msg->addr->sa_family != AF_INET) {
+               msg->result = -1;
+               return NULL;
+       }
+
+       /* FIXME: honour getnameinfo flags: do we care, not really */
+
+       while ((msg->result = camel_gethostbyaddr_r((const char *)&sin->sin_addr, sizeof(sin->sin_addr), AF_INET, &h,
+                                                   msg->hostbufmem, msg->hostbuflen, &herr)) == ERANGE) {
+               pthread_testcancel ();
+                msg->hostbuflen *= 2;
+                msg->hostbufmem = g_realloc(msg->hostbufmem, msg->hostbuflen);
+       }
+       
+       if (msg->cancelled)
+               goto cancel;
+
+       if (msg->host) {
+               g_free(msg->host);
+               if (msg->result == 0 && h.h_name && h.h_name[0]) {
+                       msg->host = g_strdup(h.h_name);
+               } else {
+                       unsigned char *in = (unsigned char *)&sin->sin_addr;
+                       
+                       /* sin_addr is always network order which is big-endian */
+                       msg->host = g_strdup_printf("%u.%u.%u.%u", in[0], in[1], in[2], in[3]);
+               }
+       }
+
+       /* we never actually use this anyway */
+       if (msg->serv)
+               sprintf(msg->serv, "%d", sin->sin_port);
+
+       e_msgport_reply((EMsg *)msg);
+       return NULL;
+cancel:
+       cs_freeinfo(msg);
+       return NULL;
+}
+#else
+static void *
+cs_getnameinfo(void *data)
+{
+       struct _addrinfo_msg *msg = data;
+
+       /* there doens't appear to be a return code which says host or serv buffers are too short, lengthen them */
+       msg->result = getnameinfo(msg->addr, msg->addrlen, msg->host, msg->hostlen, msg->serv, msg->servlen, msg->flags);
+       
+       if (msg->cancelled)
+               cs_freeinfo(msg);
+       else
+               e_msgport_reply((EMsg *)msg);
+
+       return NULL;
+}
+#endif
+
+int
+camel_getnameinfo(const struct sockaddr *sa, socklen_t salen, char **host, char **serv, int flags, CamelException *ex)
+{
+       struct _addrinfo_msg *msg;
+       int result;
+
+       if (camel_operation_cancel_check(NULL)) {
+               camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, _("Cancelled"));
+               return -1;
+       }
+
+       camel_operation_start_transient(NULL, _("Resolving address"));
+
+       msg = g_malloc0(sizeof(*msg));
+       msg->addr = sa;
+       msg->addrlen = salen;
+       if (host) {
+               msg->hostlen = NI_MAXHOST;
+               msg->host = g_malloc(msg->hostlen);
+               msg->host[0] = 0;
+       }
+       if (serv) {
+               msg->servlen = NI_MAXSERV;
+               msg->serv = g_malloc(msg->servlen);
+               msg->serv[0] = 0;
+       }
+       msg->flags = flags;
+#ifdef NEED_ADDRINFO
+       msg->hostbuflen = 1024;
+       msg->hostbufmem = g_malloc(msg->hostbuflen);
+#endif
+       cs_waitinfo(cs_getnameinfo, msg, _("Name lookup failed"), ex);
+
+       if ((result = msg->result) != 0)
+               camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Name lookup failed: %s"),
+                                     gai_strerror (result));
+
+       if (host)
+               *host = g_strdup(msg->host);
+       if (serv)
+               *serv = g_strdup(msg->serv);
+
+       g_free(msg->host);
+       g_free(msg->serv);
+       g_free(msg);
+
+       camel_operation_end(NULL);
+
+       return result;
+}
diff --git a/camel/camel-net-utils.h b/camel/camel-net-utils.h
new file mode 100644 (file)
index 0000000..908d42a
--- /dev/null
@@ -0,0 +1,94 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ * 
+ * Authors: Michael Zucchi <notzed@ximian.com>
+ *         Jeffrey Stedfast <fejj@ximian.com>
+ *
+ * Copyright (C) 2004 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or 
+ * modify it under the terms of version 2 of the GNU General Public 
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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_NET_UTILS_H
+#define CAMEL_NET_UTILS_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#include <netdb.h>
+
+struct _CamelException;
+
+#ifdef NEED_ADDRINFO
+/* Some of this is copied from GNU's netdb.h
+
+  Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc.
+  This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+*/
+struct addrinfo {
+       int ai_flags;
+       int ai_family;
+       int ai_socktype;
+       int ai_protocol;
+       size_t ai_addrlen;
+       struct sockaddr *ai_addr;
+       char *ai_canonname;
+       struct addrinfo *ai_next;
+};
+
+#define AI_CANONNAME   0x0002  /* Request for canonical name.  */
+#define AI_NUMERICHOST 0x0004  /* Don't use name resolution.  */
+
+/* Error values for `getaddrinfo' function.  */
+#define EAI_BADFLAGS     -1    /* Invalid value for `ai_flags' field.  */
+#define EAI_NONAME       -2    /* NAME or SERVICE is unknown.  */
+#define EAI_AGAIN        -3    /* Temporary failure in name resolution.  */
+#define EAI_FAIL         -4    /* Non-recoverable failure in name res.  */
+#define EAI_NODATA       -5    /* No address associated with NAME.  */
+#define EAI_FAMILY       -6    /* `ai_family' not supported.  */
+#define EAI_SOCKTYPE     -7    /* `ai_socktype' not supported.  */
+#define EAI_SERVICE      -8    /* SERVICE not supported for `ai_socktype'.  */
+#define EAI_ADDRFAMILY   -9    /* Address family for NAME not supported.  */
+#define EAI_MEMORY       -10   /* Memory allocation failure.  */
+#define EAI_SYSTEM       -11   /* System error returned in `errno'.  */
+#define EAI_OVERFLOW     -12   /* Argument buffer overflow.  */
+
+#define NI_MAXHOST      1025
+#define NI_MAXSERV      32
+
+#define NI_NUMERICHOST 1       /* Don't try to look up hostname.  */
+#define NI_NUMERICSERV 2       /* Don't convert port number to name.  */
+#define NI_NOFQDN      4       /* Only return nodename portion.  */
+#define NI_NAMEREQD    8       /* Don't return numeric addresses.  */
+#define NI_DGRAM       16      /* Look up UDP service rather than TCP.  */
+#endif
+
+struct addrinfo *camel_getaddrinfo(const char *name, const char *service,
+                                  const struct addrinfo *hints, struct _CamelException *ex);
+void camel_freeaddrinfo(struct addrinfo *host);
+int camel_getnameinfo(const struct sockaddr *sa, socklen_t salen, char **host, char **serv,
+                     int flags, struct _CamelException *ex);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* CAMEL_NET_UTILS_H */
index 3cdcd1b..7167852 100644 (file)
@@ -33,8 +33,8 @@
 #include "camel-object.h"
 #include "camel-file-utils.h"
 
-#include <e-util/e-memory.h>
-#include <e-util/e-msgport.h>
+#include <libedataserver/e-memory.h>
+#include <libedataserver/e-msgport.h>
 
 #define d(x)
 #define b(x)                   /* object bag */
index 406d576..1234163 100644 (file)
@@ -36,7 +36,7 @@
 #endif
 
 #include "camel-operation.h"
-#include "e-util/e-msgport.h"
+#include "libedataserver/e-msgport.h"
 
 #define d(x)
 
index e5b2639..79c5ba3 100644 (file)
@@ -33,7 +33,7 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#include "e-util/e-msgport.h"
+#include "libedataserver/e-msgport.h"
 
 #include "camel-block-file.h"
 #include "camel-partition-table.h"
index 3433da3..b3bf088 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <camel/camel-object.h>
 #include <glib.h>
-#include <e-util/e-msgport.h>
+#include <libedataserver/e-msgport.h>
 
 #include "camel-block-file.h"
 
index 9d7ae62..2dbddb7 100644 (file)
@@ -36,7 +36,7 @@ extern "C" {
 #endif
 
 #include <pthread.h>
-#include <e-util/e-msgport.h>
+#include <libedataserver/e-msgport.h>
 
 struct _CamelFolderPrivate {
        EMutex *lock;
index 889188f..c3a9546 100644 (file)
@@ -41,7 +41,7 @@
 #include "camel-exception.h"
 #include "camel-string-utils.h"
 #include "camel-vee-store.h"
-#include "e-util/e-msgport.h"
+#include "libedataserver/e-msgport.h"
 #include "camel-i18n.h"
 
 /* table of CamelProviderModule's */
@@ -68,6 +68,21 @@ static CamelProvider vee_provider = {
        /* ... */
 };
 
+static pthread_once_t setup_once = PTHREAD_ONCE_INIT;
+
+static void
+provider_setup(void)
+{
+       provider_lock = e_mutex_new(E_MUTEX_REC);
+       module_table = g_hash_table_new(camel_strcase_hash, camel_strcase_equal);
+       provider_table = g_hash_table_new(camel_strcase_hash, camel_strcase_equal);
+
+       vee_provider.object_types[CAMEL_PROVIDER_STORE] = camel_vee_store_get_type ();
+       vee_provider.url_hash = camel_url_hash;
+       vee_provider.url_equal = camel_url_equal;
+       camel_provider_register(&vee_provider);
+}
+
 /**
  * camel_provider_init:
  *
@@ -78,6 +93,9 @@ static CamelProvider vee_provider = {
  * 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.
+ *
+ * TODO: This should be pathed?
+ * TODO: This should be plugin-d?
  **/
 void
 camel_provider_init (void)
@@ -86,26 +104,19 @@ camel_provider_init (void)
        struct dirent *d;
        char *p, *name, buf[80];
        CamelProviderModule *m;
-       static int init = 0;
+       static int loaded = 0;
 
-       if (init)
-               return;
+       pthread_once(&setup_once, provider_setup);
 
-       init = 1;
-
-       provider_lock = e_mutex_new(E_MUTEX_REC);
-       module_table = g_hash_table_new(camel_strcase_hash, camel_strcase_equal);
-       provider_table = g_hash_table_new(camel_strcase_hash, camel_strcase_equal);
+       if (loaded)
+               return;
 
-       vee_provider.object_types[CAMEL_PROVIDER_STORE] = camel_vee_store_get_type ();
-       vee_provider.url_hash = camel_url_hash;
-       vee_provider.url_equal = camel_url_equal;
-       camel_provider_register(&vee_provider);
+       loaded = 1;
 
        dir = opendir (CAMEL_PROVIDERDIR);
        if (!dir) {
-               g_error ("Could not open camel provider directory (%s): %s",
-                        CAMEL_PROVIDERDIR, g_strerror (errno));
+               g_warning("Could not open camel provider directory (%s): %s",
+                         CAMEL_PROVIDERDIR, g_strerror (errno));
                return;
        }
        
@@ -167,6 +178,8 @@ camel_provider_load(const char *path, CamelException *ex)
        GModule *module;
        CamelProvider *(*camel_provider_module_init) (void);
 
+       pthread_once(&setup_once, provider_setup);
+
        if (!g_module_supported ()) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
                                      _("Could not load %s: Module loading "
@@ -210,6 +223,8 @@ camel_provider_register(CamelProvider *provider)
 
        g_return_if_fail (provider != NULL);
 
+       g_assert(provider_table);
+
        LOCK();
 
        if (g_hash_table_lookup(provider_table, provider->protocol) != NULL) {
@@ -284,6 +299,8 @@ camel_provider_list(gboolean load)
 {
        GList *list = NULL;
 
+       g_assert(provider_table);
+
        LOCK();
 
        if (load) {
@@ -329,6 +346,7 @@ camel_provider_get(const char *url_string, CamelException *ex)
        size_t len;
 
        g_return_val_if_fail(url_string != NULL, NULL);
+       g_assert(provider_table);
 
        len = strcspn(url_string, ":");
        protocol = g_alloca(len+1);
@@ -388,7 +406,7 @@ camel_provider_auto_detect (CamelProvider *provider, CamelURL *url,
                            GHashTable **auto_detected, CamelException *ex)
 {
        g_return_val_if_fail (provider != NULL, -1);
-       
+
        if (provider->auto_detect) {
                return provider->auto_detect (url, auto_detected, ex);
        } else {
diff --git a/camel/camel-provider.pc.in b/camel/camel-provider.pc.in
new file mode 100644 (file)
index 0000000..923a901
--- /dev/null
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+camel_providerdir=@camel_providerdir@
+privlibdir=@privlibdir@
+privincludedir=@privincludedir@
+
+Name: camel-provider
+Description: The Evolution mail access library
+Version: @VERSION@
+Libs: -L${libdir} -lcamel-1.2 -lcamel-provider-1.2 -ledataserver-1.2
+Cflags: -I${privincludedir}
index 611c541..54eb764 100644 (file)
@@ -29,7 +29,7 @@
 #include "camel-sasl-cram-md5.h"
 #include "camel-mime-utils.h"
 #include "camel-service.h"
-#include <e-util/md5-utils.h>
+#include <libedataserver/md5-utils.h>
 #include "camel-i18n.h"
 
 CamelServiceAuthType camel_sasl_cram_md5_authtype = {
index 8f44425..2a38858 100644 (file)
@@ -20,7 +20,6 @@
  *
  */
 
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 #include <ctype.h>
 #include <unistd.h>
 
-#include <e-util/md5-utils.h>
+#include <libedataserver/md5-utils.h>
 
-#include <gal/util/e-iconv.h>
+#include <libedataserver/e-iconv.h>
 
 #include "camel-charset-map.h"
 #include "camel-mime-utils.h"
 #include "camel-sasl-digest-md5.h"
 #include "camel-i18n.h"
+#include "camel-net-utils.h"
 
 #define d(x)
 
index d3805f6..0e517fb 100644 (file)
@@ -40,7 +40,7 @@
 #include "camel-mime-message.h"
 #include "camel-multipart.h"
 #include "camel-stream-mem.h"
-#include "e-util/e-sexp.h"
+#include "libedataserver/e-sexp.h"
 #include "camel-search-private.h"
 #include "camel-i18n.h"
 
index b916d5c..6e79a86 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <pthread.h>
-#include <netdb.h>
 #include <errno.h>
 
 #include <sys/poll.h>
 
-#include "e-util/e-msgport.h"
-#include "e-util/e-host-utils.h"
+#include "libedataserver/e-msgport.h"
 
 #include "camel-service.h"
 #include "camel-session.h"
@@ -644,417 +642,3 @@ camel_service_query_auth_types (CamelService *service, CamelException *ex)
        
        return ret;
 }
-
-/* ********************************************************************** */
-struct _addrinfo_msg {
-       EMsg msg;
-       unsigned int cancelled:1;
-
-       /* for host lookup */
-       const char *name;
-       const char *service;
-       int result;
-       const struct addrinfo *hints;
-       struct addrinfo **res;
-
-       /* for host lookup emulation */
-#ifdef NEED_ADDRINFO
-       struct hostent hostbuf;
-       int hostbuflen;
-       char *hostbufmem;
-#endif
-
-       /* for name lookup */
-       const struct sockaddr *addr;
-       socklen_t addrlen;
-       char *host;
-       int hostlen;
-       char *serv;
-       int servlen;
-       int flags;
-};
-
-static void
-cs_freeinfo(struct _addrinfo_msg *msg)
-{
-       g_free(msg->host);
-       g_free(msg->serv);
-#ifdef NEED_ADDRINFO
-       g_free(msg->hostbufmem);
-#endif
-       g_free(msg);
-}
-
-/* returns -1 if cancelled */
-static int
-cs_waitinfo(void *(worker)(void *), struct _addrinfo_msg *msg, const char *error, CamelException *ex)
-{
-       EMsgPort *reply_port;
-       pthread_t id;
-       int err, cancel_fd, cancel = 0, fd;
-
-       cancel_fd = camel_operation_cancel_fd(NULL);
-       if (cancel_fd == -1) {
-               worker(msg);
-               return 0;
-       }
-       
-       reply_port = msg->msg.reply_port = e_msgport_new();
-       fd = e_msgport_fd(msg->msg.reply_port);
-       if ((err = pthread_create(&id, NULL, worker, msg)) == 0) {
-               struct pollfd polls[2];
-               int status;
-
-               polls[0].fd = fd;
-               polls[0].events = POLLIN;
-               polls[1].fd = cancel_fd;
-               polls[1].events = POLLIN;
-
-               d(printf("waiting for name return/cancellation in main process\n"));
-               do {
-                       polls[0].revents = 0;
-                       polls[1].revents = 0;
-                       status = poll(polls, 2, -1);
-               } while (status == -1 && errno == EINTR);
-
-               if (status == -1 || (polls[1].revents & POLLIN)) {
-                       if (status == -1)
-                               camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "%s: %s", error, g_strerror(errno));
-                       else
-                               camel_exception_setv(ex, CAMEL_EXCEPTION_USER_CANCEL, _("Cancelled"));
-                       
-                       /* We cancel so if the thread impl is decent it causes immediate exit.
-                          We detach so we dont need to wait for it to exit if it isn't.
-                          We check the reply port incase we had a reply in the mean time, which we free later */
-                       d(printf("Cancelling lookup thread and leaving it\n"));
-                       msg->cancelled = 1;
-                       pthread_detach(id);
-                       pthread_cancel(id);
-                       cancel = 1;
-               } else {
-                       struct _addrinfo_msg *reply = (struct _addrinfo_msg *)e_msgport_get(reply_port);
-
-                       g_assert(reply == msg);
-                       d(printf("waiting for child to exit\n"));
-                       pthread_join(id, NULL);
-                       d(printf("child done\n"));
-               }
-       } else {
-               camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "%s: %s: %s", error, _("cannot create thread"), g_strerror(err));
-       }
-       e_msgport_destroy(reply_port);
-
-       return cancel;
-}
-
-#ifdef NEED_ADDRINFO
-static void *
-cs_getaddrinfo(void *data)
-{
-       struct _addrinfo_msg *msg = data;
-       int herr;
-       struct hostent h;
-       struct addrinfo *res, *last = NULL;
-       struct sockaddr_in *sin;
-       in_port_t port = 0;
-       int i;
-
-       /* This is a pretty simplistic emulation of getaddrinfo */
-
-       while ((msg->result = e_gethostbyname_r(msg->name, &h, msg->hostbufmem, msg->hostbuflen, &herr)) == ERANGE) {
-               pthread_testcancel();
-                msg->hostbuflen *= 2;
-                msg->hostbufmem = g_realloc(msg->hostbufmem, msg->hostbuflen);
-       }
-       
-       /* If we got cancelled, dont reply, just free it */
-       if (msg->cancelled)
-               goto cancel;
-
-       /* FIXME: map error numbers across */
-       if (msg->result != 0)
-               goto reply;
-
-       /* check hints matched */
-       if (msg->hints && msg->hints->ai_family && msg->hints->ai_family != h.h_addrtype) {
-               msg->result = EAI_FAMILY;
-               goto reply;
-       }
-
-       /* we only support ipv4 for this interface, even if it could supply ipv6 */
-       if (h.h_addrtype != AF_INET) {
-               msg->result = EAI_FAMILY;
-               goto reply;
-       }
-
-       /* check service mapping */
-       if (msg->service) {
-               const char *p = msg->service;
-
-               while (*p) {
-                       if (*p < '0' || *p > '9')
-                               break;
-                       p++;
-               }
-
-               if (*p) {
-                       const char *socktype = NULL;
-                       struct servent *serv;
-
-                       if (msg->hints && msg->hints->ai_socktype) {
-                               if (msg->hints->ai_socktype == SOCK_STREAM)
-                                       socktype = "tcp";
-                               else if (msg->hints->ai_socktype == SOCK_DGRAM)
-                                       socktype = "udp";
-                       }
-
-                       serv = getservbyname(msg->service, socktype);
-                       if (serv == NULL) {
-                               msg->result = EAI_NONAME;
-                               goto reply;
-                       }
-                       port = serv->s_port;
-               } else {
-                       port = htons(strtoul(msg->service, NULL, 10));
-               }
-       }
-
-       for (i=0;h.h_addr_list[i];i++) {
-               res = g_malloc0(sizeof(*res));
-               if (msg->hints) {
-                       res->ai_flags = msg->hints->ai_flags;
-                       if (msg->hints->ai_flags & AI_CANONNAME)
-                               res->ai_canonname = g_strdup(h.h_name);
-                       res->ai_socktype = msg->hints->ai_socktype;
-                       res->ai_protocol = msg->hints->ai_protocol;
-               } else {
-                       res->ai_flags = 0;
-                       res->ai_socktype = SOCK_STREAM; /* fudge */
-                       res->ai_protocol = 0;   /* fudge */
-               }
-               res->ai_family = AF_INET;
-               res->ai_addrlen = sizeof(*sin);
-               res->ai_addr = g_malloc(sizeof(*sin));
-               sin = (struct sockaddr_in *)res->ai_addr;
-               sin->sin_family = AF_INET;
-               sin->sin_port = port;
-               memcpy(&sin->sin_addr, h.h_addr_list[i], sizeof(sin->sin_addr));
-
-               if (last == NULL) {
-                       *msg->res = last = res;
-               } else {
-                       last->ai_next = res;
-                       last = res;
-               }
-       }
-reply:
-       e_msgport_reply((EMsg *)msg);
-       return NULL;
-cancel:
-       cs_freeinfo(msg);
-       return NULL;
-}
-#else
-static void *
-cs_getaddrinfo(void *data)
-{
-       struct _addrinfo_msg *info = data;
-
-       info->result = getaddrinfo(info->name, info->service, info->hints, info->res);
-       
-       if (info->cancelled) {
-               g_free(info);
-       } else {
-               e_msgport_reply((EMsg *)info);
-       }
-       
-       return NULL;
-}
-#endif /* NEED_ADDRINFO */
-
-struct addrinfo *
-camel_getaddrinfo(const char *name, const char *service, const struct addrinfo *hints, CamelException *ex)
-{
-       struct _addrinfo_msg *msg;
-       struct addrinfo *res = NULL;
-#ifndef ENABLE_IPv6
-       struct addrinfo myhints;
-#endif
-       g_return_val_if_fail(name != NULL, NULL);
-       
-       if (camel_operation_cancel_check(NULL)) {
-               camel_exception_set(ex, CAMEL_EXCEPTION_USER_CANCEL, _("Cancelled"));
-               return NULL;
-       }
-
-       camel_operation_start_transient(NULL, _("Resolving: %s"), name);
-
-       /* force ipv4 addresses only */
-#ifndef ENABLE_IPv6
-       if (hints == NULL)
-               memset(&myhints, 0, sizeof(myhints));
-       else
-               memcpy (&myhints, hints, sizeof (myhints));
-       
-       myhints.ai_family = AF_INET;
-       hints = &myhints;
-#endif
-
-       msg = g_malloc0(sizeof(*msg));
-       msg->name = name;
-       msg->service = service;
-       msg->hints = hints;
-       msg->res = &res;
-#ifdef NEED_ADDRINFO
-       msg->hostbuflen = 1024;
-       msg->hostbufmem = g_malloc(msg->hostbuflen);
-#endif 
-       if (cs_waitinfo(cs_getaddrinfo, msg, _("Host lookup failed"), ex) == 0) {
-               if (msg->result != 0)
-                       camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Host lookup failed: %s: %s"),
-                                             name, gai_strerror (msg->result));
-               
-               cs_freeinfo(msg);
-       } else
-               res = NULL;
-       
-       camel_operation_end(NULL);
-
-       return res;
-}
-
-void
-camel_freeaddrinfo(struct addrinfo *host)
-{
-#ifdef NEED_ADDRINFO
-       while (host) {
-               struct addrinfo *next = host->ai_next;
-
-               g_free(host->ai_canonname);
-               g_free(host->ai_addr);
-               g_free(host);
-               host = next;
-       }
-#else
-       freeaddrinfo(host);
-#endif
-}
-
-#ifdef NEED_ADDRINFO
-static void *
-cs_getnameinfo(void *data)
-{
-       struct _addrinfo_msg *msg = data;
-       int herr;
-       struct hostent h;
-       struct sockaddr_in *sin = (struct sockaddr_in *)msg->addr;
-
-       /* FIXME: error code */
-       if (msg->addr->sa_family != AF_INET) {
-               msg->result = -1;
-               return NULL;
-       }
-
-       /* FIXME: honour getnameinfo flags: do we care, not really */
-
-       while ((msg->result = e_gethostbyaddr_r((const char *)&sin->sin_addr, sizeof(sin->sin_addr), AF_INET, &h,
-                                               msg->hostbufmem, msg->hostbuflen, &herr)) == ERANGE) {
-               pthread_testcancel ();
-                msg->hostbuflen *= 2;
-                msg->hostbufmem = g_realloc(msg->hostbufmem, msg->hostbuflen);
-       }
-       
-       if (msg->cancelled)
-               goto cancel;
-
-       if (msg->host) {
-               g_free(msg->host);
-               if (msg->result == 0 && h.h_name && h.h_name[0]) {
-                       msg->host = g_strdup(h.h_name);
-               } else {
-                       unsigned char *in = (unsigned char *)&sin->sin_addr;
-                       
-                       /* sin_addr is always network order which is big-endian */
-                       msg->host = g_strdup_printf("%u.%u.%u.%u", in[0], in[1], in[2], in[3]);
-               }
-       }
-
-       /* we never actually use this anyway */
-       if (msg->serv)
-               sprintf(msg->serv, "%d", sin->sin_port);
-
-       e_msgport_reply((EMsg *)msg);
-       return NULL;
-cancel:
-       cs_freeinfo(msg);
-       return NULL;
-}
-#else
-static void *
-cs_getnameinfo(void *data)
-{
-       struct _addrinfo_msg *msg = data;
-
-       /* there doens't appear to be a return code which says host or serv buffers are too short, lengthen them */
-       msg->result = getnameinfo(msg->addr, msg->addrlen, msg->host, msg->hostlen, msg->serv, msg->servlen, msg->flags);
-       
-       if (msg->cancelled)
-               cs_freeinfo(msg);
-       else
-               e_msgport_reply((EMsg *)msg);
-
-       return NULL;
-}
-#endif
-
-int
-camel_getnameinfo(const struct sockaddr *sa, socklen_t salen, char **host, char **serv, int flags, CamelException *ex)
-{
-       struct _addrinfo_msg *msg;
-       int result;
-
-       if (camel_operation_cancel_check(NULL)) {
-               camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, _("Cancelled"));
-               return -1;
-       }
-
-       camel_operation_start_transient(NULL, _("Resolving address"));
-
-       msg = g_malloc0(sizeof(*msg));
-       msg->addr = sa;
-       msg->addrlen = salen;
-       if (host) {
-               msg->hostlen = NI_MAXHOST;
-               msg->host = g_malloc(msg->hostlen);
-               msg->host[0] = 0;
-       }
-       if (serv) {
-               msg->servlen = NI_MAXSERV;
-               msg->serv = g_malloc(msg->servlen);
-               msg->serv[0] = 0;
-       }
-       msg->flags = flags;
-#ifdef NEED_ADDRINFO
-       msg->hostbuflen = 1024;
-       msg->hostbufmem = g_malloc(msg->hostbuflen);
-#endif
-       cs_waitinfo(cs_getnameinfo, msg, _("Name lookup failed"), ex);
-
-       if ((result = msg->result) != 0)
-               camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Name lookup failed: %s"),
-                                     gai_strerror (result));
-
-       if (host)
-               *host = g_strdup(msg->host);
-       if (serv)
-               *serv = g_strdup(msg->serv);
-
-       g_free(msg->host);
-       g_free(msg->serv);
-       g_free(msg);
-
-       camel_operation_end(NULL);
-
-       return result;
-}
-
index f49472c..8180b2a 100644 (file)
@@ -1,10 +1,9 @@
 /* -*- 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>
+ * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
+ *          Michael Zucchi <notzed@ximian.com>
  *
  * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com)
  *
@@ -23,7 +22,6 @@
  * USA
  */
 
-
 #ifndef CAMEL_SERVICE_H
 #define CAMEL_SERVICE_H 1
 
@@ -33,7 +31,6 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <netdb.h>
 #include <camel/camel-object.h>
 #include <camel/camel-url.h>
 #include <camel/camel-provider.h>
@@ -77,7 +74,6 @@ struct _CamelService {
        CamelURL *url;
 };
 
-
 typedef struct {
        CamelObjectClass parent_class;
 
@@ -103,7 +99,6 @@ typedef struct {
 
 } CamelServiceClass;
 
-
 /* query_auth_types returns a GList of these */
 typedef struct {
        char *name;               /* user-friendly name */
@@ -113,7 +108,6 @@ typedef struct {
        gboolean need_password;   /* needs a password to authenticate */
 } CamelServiceAuthType;
 
-
 /* public methods */
 void                camel_service_construct          (CamelService *service,
                                                      CamelSession *session,
@@ -135,62 +129,6 @@ CamelProvider *     camel_service_get_provider       (CamelService *service);
 GList *             camel_service_query_auth_types   (CamelService *service,
                                                      CamelException *ex);
 
-#ifdef NEED_ADDRINFO
-/* Some of this is copied from GNU's netdb.h
-
-  Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc.
-  This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-*/
-struct addrinfo {
-       int ai_flags;
-       int ai_family;
-       int ai_socktype;
-       int ai_protocol;
-       size_t ai_addrlen;
-       struct sockaddr *ai_addr;
-       char *ai_canonname;
-       struct addrinfo *ai_next;
-};
-
-#define AI_CANONNAME   0x0002  /* Request for canonical name.  */
-#define AI_NUMERICHOST 0x0004  /* Don't use name resolution.  */
-
-/* Error values for `getaddrinfo' function.  */
-#define EAI_BADFLAGS     -1    /* Invalid value for `ai_flags' field.  */
-#define EAI_NONAME       -2    /* NAME or SERVICE is unknown.  */
-#define EAI_AGAIN        -3    /* Temporary failure in name resolution.  */
-#define EAI_FAIL         -4    /* Non-recoverable failure in name res.  */
-#define EAI_NODATA       -5    /* No address associated with NAME.  */
-#define EAI_FAMILY       -6    /* `ai_family' not supported.  */
-#define EAI_SOCKTYPE     -7    /* `ai_socktype' not supported.  */
-#define EAI_SERVICE      -8    /* SERVICE not supported for `ai_socktype'.  */
-#define EAI_ADDRFAMILY   -9    /* Address family for NAME not supported.  */
-#define EAI_MEMORY       -10   /* Memory allocation failure.  */
-#define EAI_SYSTEM       -11   /* System error returned in `errno'.  */
-#define EAI_OVERFLOW     -12   /* Argument buffer overflow.  */
-
-#define NI_MAXHOST      1025
-#define NI_MAXSERV      32
-
-#define NI_NUMERICHOST 1       /* Don't try to look up hostname.  */
-#define NI_NUMERICSERV 2       /* Don't convert port number to name.  */
-#define NI_NOFQDN      4       /* Only return nodename portion.  */
-#define NI_NAMEREQD    8       /* Don't return numeric addresses.  */
-#define NI_DGRAM       16      /* Look up UDP service rather than TCP.  */
-#endif
-
-/* new hostname interfaces */
-struct addrinfo *camel_getaddrinfo(const char *name, const char *service,
-                                  const struct addrinfo *hints, CamelException *ex);
-void camel_freeaddrinfo(struct addrinfo *host);
-int camel_getnameinfo(const struct sockaddr *sa, socklen_t salen, char **host, char **serv,
-                     int flags, CamelException *ex);
-
 /* Standard Camel function */
 CamelType camel_service_get_type (void);
 
index de4c15f..3c75a81 100644 (file)
@@ -37,7 +37,7 @@ extern "C" {
 #include <camel/camel-provider.h>
 #include <camel/camel-junk-plugin.h>
 
-#include <e-util/e-msgport.h>
+#include <libedataserver/e-msgport.h>
 
 #define CAMEL_SESSION_TYPE     (camel_session_get_type ())
 #define CAMEL_SESSION(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_SESSION_TYPE, CamelSession))
index 982d0ed..d8be2e0 100644 (file)
@@ -36,8 +36,8 @@
 
 #include "camel-file-utils.h"
 
-#include "e-util/md5-utils.h"
-#include "e-util/e-memory.h"
+#include "libedataserver/md5-utils.h"
+#include "libedataserver/e-memory.h"
 
 #include "camel-private.h"
 #include "camel-url.h"
index 6560512..4c8422c 100644 (file)
@@ -36,7 +36,6 @@
 #include "camel-file-utils.h"
 #include "camel-operation.h"
 #include "camel-stream-fs.h"
-#include "camel-session.h"
 
 static CamelSeekableStreamClass *parent_class = NULL;
 
index 19c534b..a818fbc 100644 (file)
@@ -54,7 +54,7 @@
 
 /* this is commented because otherwise we get an error about the
    redefinition of MD5Context...yay */
-/*#include <e-util/md5-utils.h>*/
+/*#include <libedataserver/md5-utils.h>*/
 
 #include "camel-tcp-stream-ssl.h"
 #include "camel-stream-fs.h"
index 4867bac..7ffa9ea 100644 (file)
@@ -34,8 +34,8 @@
 #include <fcntl.h>
 #include <ctype.h>
 
-#include "e-util/e-msgport.h"
-#include "e-util/e-memory.h"
+#include "libedataserver/e-msgport.h"
+#include "libedataserver/e-memory.h"
 
 #include "camel/camel-object.h"
 
index 1240731..e5e54fc 100644 (file)
@@ -29,7 +29,7 @@
 #include <string.h>
 #include <ctype.h>
 
-#include "e-util/e-trie.h"
+#include "libedataserver/e-trie.h"
 #include "camel-utf8.h"
 #include "camel-url-scanner.h"
 
index 7f8473e..47d0331 100644 (file)
 #include "camel-debug.h"
 #include "camel-i18n.h"
 
-#include "e-util/md5-utils.h"
+#include "libedataserver/md5-utils.h"
 
 #if defined (DOEPOOLV) || defined (DOESTRV)
-#include "e-util/e-memory.h"
+#include "libedataserver/e-memory.h"
 #endif
 
 #define d(x) 
index f370d89..6545be2 100644 (file)
@@ -87,7 +87,6 @@ camel_init (const char *configdir, gboolean nss_init)
 
        camel_mime_utils_init();
        camel_operation_init();
-       camel_provider_init();
 
 #ifdef HAVE_NSS
        if (nss_init) {
index 90511d6..c8a9f5d 100644 (file)
@@ -32,16 +32,8 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus */
 
-#include <camel/camel-cipher-context.h>
 #include <camel/camel-data-wrapper.h>
 #include <camel/camel-exception.h>
-#include <camel/camel-folder.h>
-#include <camel/camel-digest-folder.h>
-#include <camel/camel-digest-store.h>
-#include <camel/camel-disco-diary.h>
-#include <camel/camel-disco-folder.h>
-#include <camel/camel-disco-store.h>
-#include <camel/camel-vee-folder.h>
 #include <camel/camel-medium.h>
 #include <camel/camel-mime-filter.h>
 #include <camel/camel-mime-filter-basic.h>
@@ -63,30 +55,22 @@ extern "C" {
 #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-multipart-encrypted.h>
 #include <camel/camel-multipart-signed.h>
-#include <camel/camel-gpg-context.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-tcp-stream-raw.h>
-#include <camel/camel-tcp-stream-ssl.h>
-#include <camel/camel-tcp-stream.h>
 #include <camel/camel-transport.h>
-#include <camel/camel-uid-cache.h>
 #include <camel/camel-url.h>
 #include <camel/camel-string-utils.h>
 
+#include <glib.h>
+
 int camel_init (const char *certdb_dir, gboolean nss_init);
 
 #ifdef __cplusplus
diff --git a/camel/camel.pc.in b/camel/camel.pc.in
new file mode 100644 (file)
index 0000000..2da1189
--- /dev/null
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+privlibdir=@privlibdir@
+privincludedir=@privincludedir@
+
+Name: camel
+Description: the Evolution MIME message handling library
+Version: @VERSION@
+Libs: -L${libdir} -lcamel-1.2 -ledataserver-1.2
+Cflags: -I${privincludedir}
index 4ae70e9..0444da4 100644 (file)
@@ -12,6 +12,7 @@ if ENABLE_IMAP4
 IMAP4_DIR=imap4
 endif
 
-SUBDIRS = pop3 sendmail smtp imap $(NNTP_DIR) local $(IMAPP_DIR) $(IMAP4_DIR) groupwise
+SUBDIRS = pop3 sendmail smtp imap $(NNTP_DIR) local $(IMAPP_DIR) $(IMAP4_DIR)
+# groupwise
 
 
index b34f348..b152595 100644 (file)
@@ -5,19 +5,14 @@ libcamelimapincludedir = $(privincludedir)/camel
 camel_provider_LTLIBRARIES = libcamelgroupwise.la
 camel_provider_DATA = libcamelgroupwise.urls
 
-INCLUDES = -I.. \
-       -I$(srcdir)/..                                  \
+INCLUDES = \
        -I$(top_srcdir)/camel                           \
        -I$(top_srcdir)/intl                            \
-       -I$(top_srcdir)/e-util                          \
+       -I$(top_srcdir)/servers/groupwise               \
        -I$(top_srcdir)                                 \
        -I$(top_srcdir)/camel/providers/imap            \
        -I$(top_srcdir)/camel/providers/smtp            \
-       $(EVOLUTION_CALENDAR_CFLAGS)                  \
        $(CAMEL_GROUPWISE_CFLAGS)                       \
-       $(GNOME_INCLUDEDIR)                             \
-       $(E_UTIL_CFLAGS)                                \
-       $(GTK_INCLUDEDIR)                               \
        -DCAMEL_PROVIDERDIR=\"$(camel_providerdir)\"    \
        -DG_LOG_DOMAIN=\"camel-groupwise-provider\"
 
index 40e7c3d..c407972 100644 (file)
@@ -26,7 +26,7 @@
 #define CAMEL_GW_LISTENER_H
                                                                                                                              
 
-#include <e-util/e-account-list.h>
+#include <libedataserver/e-account-list.h>
 #include<libedataserver/e-source.h>
 #include<libedataserver/e-source-list.h>
 #include "camel-url.h"
index 1a2f46f..7c18acf 100644 (file)
@@ -1,7 +1,5 @@
 ## Process this file with automake to produce Makefile.in
 
-libcamelimapincludedir = $(privincludedir)/camel
-
 camel_provider_LTLIBRARIES = libcamelimap.la
 camel_provider_DATA = libcamelimap.urls
 
@@ -28,7 +26,7 @@ libcamelimap_la_SOURCES =                     \
        camel-imap-utils.c                      \
        camel-imap-wrapper.c
 
-libcamelimapinclude_HEADERS =                  \
+noinst_HEADERS =                       \
        camel-imap-command.h                    \
        camel-imap-folder.h                     \
        camel-imap-message-cache.h              \
@@ -38,11 +36,9 @@ libcamelimapinclude_HEADERS =                        \
        camel-imap-summary.h                    \
        camel-imap-types.h                      \
        camel-imap-utils.h                      \
-       camel-imap-wrapper.h
+       camel-imap-wrapper.h                    \
+       camel-imap-private.h
 
 libcamelimap_la_LDFLAGS = -avoid-version -module
 
-noinst_HEADERS =                               \
-       camel-imap-private.h
-
 EXTRA_DIST = libcamelimap.urls
index 229fbbb..6cdd96b 100644 (file)
@@ -37,8 +37,8 @@
 #include <fcntl.h>
 #include <ctype.h>
 
-#include "e-util/e-path.h"
-#include "e-util/e-time-utils.h"
+/*#include "libedataserver/e-path.h"*/
+#include "libedataserver/e-time-utils.h"
 
 #include "camel-imap-folder.h"
 #include "camel-imap-command.h"
@@ -470,7 +470,7 @@ imap_rename (CamelFolder *folder, const char *new)
        char *folders;
 
        folders = g_strconcat (imap_store->storage_path, "/folders", NULL);
-       folder_dir = e_path_to_physical (folders, new);
+       folder_dir = imap_path_to_physical (folders, new);
        g_free (folders);
        summary_path = g_strdup_printf("%s/summary", folder_dir);
 
index 0f80dbf..d073585 100644 (file)
@@ -36,7 +36,7 @@ extern "C" {
 #endif
 
 #ifdef ENABLE_THREADS
-#include "e-util/e-msgport.h"
+#include "libedataserver/e-msgport.h"
 #endif
 
 struct _CamelImapFolderPrivate {
index eacb839..2c0dcb0 100644 (file)
@@ -38,7 +38,7 @@
 #include "camel-imap-utils.h"
 #include "camel-imap-summary.h"
 
-#include "e-util/md5-utils.h"  /* md5 hash building */
+#include "libedataserver/md5-utils.h"  /* md5 hash building */
 #include "camel-mime-utils.h"  /* base64 encoding */
 
 #include "camel-seekable-stream.h"
index 7664c4c..3ad7f8d 100644 (file)
@@ -27,7 +27,7 @@
 #define _CAMEL_IMAP_SEARCH_H
 
 #include <camel/camel-folder-search.h>
-#include <e-util/e-msgport.h>
+#include <libedataserver/e-msgport.h>
 #include <camel/camel-data-cache.h>
 
 #define CAMEL_IMAP_SEARCH_TYPE         (camel_imap_search_get_type ())
index 32530d3..434f5b5 100644 (file)
@@ -33,8 +33,8 @@
 
 #include "camel-file-utils.h"
 
-#include "e-util/md5-utils.h"
-#include "e-util/e-memory.h"
+#include "libedataserver/md5-utils.h"
+#include "libedataserver/e-memory.h"
 
 #include "camel-private.h"
 #include "camel-utf8.h"
index 52e0dfb..5811b0f 100644 (file)
@@ -34,8 +34,6 @@
 #include <unistd.h>
 #include <errno.h>
 
-#include "e-util/e-path.h"
-
 #include "camel-imap-store.h"
 #include "camel-imap-store-summary.h"
 #include "camel-imap-folder.h"
@@ -62,6 +60,7 @@
 #include "camel-private.h"
 #include "camel-debug.h"
 #include "camel-i18n.h"
+#include "camel-net-utils.h"
 
 #define d(x) 
 
@@ -1042,7 +1041,7 @@ imap_forget_folder (CamelImapStore *imap_store, const char *folder_name, CamelEx
                name = folder_name;
        
        storage_path = g_strdup_printf ("%s/folders", imap_store->storage_path);
-       folder_dir = e_path_to_physical (storage_path, folder_name);
+       folder_dir = imap_path_to_physical (storage_path, folder_name);
        g_free (storage_path);
        if (access (folder_dir, F_OK) != 0) {
                g_free (folder_dir);
@@ -1983,7 +1982,7 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca
        }
 
        storage_path = g_strdup_printf("%s/folders", imap_store->storage_path);
-       folder_dir = e_path_to_physical (storage_path, folder_name);
+       folder_dir = imap_path_to_physical (storage_path, folder_name);
        g_free(storage_path);
        new_folder = camel_imap_folder_new (store, folder_name, folder_dir, ex);
        g_free (folder_dir);
@@ -2026,7 +2025,7 @@ get_folder_offline (CamelStore *store, const char *folder_name,
                folder_name = "INBOX";
        
        storage_path = g_strdup_printf("%s/folders", imap_store->storage_path);
-       folder_dir = e_path_to_physical (storage_path, folder_name);
+       folder_dir = imap_path_to_physical (storage_path, folder_name);
        g_free(storage_path);
        if (!folder_dir || access (folder_dir, F_OK) != 0) {
                g_free (folder_dir);
@@ -2196,8 +2195,8 @@ rename_folder (CamelStore *store, const char *old_name, const char *new_name_in,
                manage_subscriptions(store, new_name_in, TRUE);
 
        storage_path = g_strdup_printf("%s/folders", imap_store->storage_path);
-       oldpath = e_path_to_physical (storage_path, old_name);
-       newpath = e_path_to_physical (storage_path, new_name_in);
+       oldpath = imap_path_to_physical (storage_path, old_name);
+       newpath = imap_path_to_physical (storage_path, new_name_in);
        g_free(storage_path);
 
        /* So do we care if this didn't work?  Its just a cache? */
@@ -2632,7 +2631,7 @@ fill_fi(CamelStore *store, CamelFolderInfo *fi, guint32 flags)
 
                /* This is a lot of work for one path! */
                storage_path = g_strdup_printf("%s/folders", ((CamelImapStore *)store)->storage_path);
-               folder_dir = e_path_to_physical(storage_path, fi->full_name);
+               folder_dir = imap_path_to_physical(storage_path, fi->full_name);
                path = g_strdup_printf("%s/summary", folder_dir);
                s = (CamelFolderSummary *)camel_object_new(camel_imap_summary_get_type());
                camel_folder_summary_set_build_content(s, TRUE);
@@ -3038,7 +3037,7 @@ get_folder_info_offline (CamelStore *store, const char *top,
        /* A kludge to avoid having to pass a struct to the callback */
        g_ptr_array_add (folders, imap_store);
        storage_path = g_strdup_printf("%s/folders", imap_store->storage_path);
-       if (!e_path_find_folders (storage_path, get_one_folder_offline, folders)) {
+       if (!imap_path_find_folders (storage_path, get_one_folder_offline, folders)) {
                camel_disco_store_check_online (CAMEL_DISCO_STORE (imap_store), ex);
                fi = NULL;
        } else {
index b197cad..b1e3226 100644 (file)
@@ -35,7 +35,7 @@ extern "C" {
 #include <camel/camel-disco-store.h>
 
 #ifdef ENABLE_THREADS
-#include <e-util/e-msgport.h>
+#include <libedataserver/e-msgport.h>
 
 typedef struct _CamelImapMsg CamelImapMsg;
 
index a557f7f..06028ef 100644 (file)
 #include <string.h>
 #include <time.h>
 #include <errno.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 #include "camel-imap-utils.h"
 #include "camel-imap-summary.h"
@@ -40,6 +44,9 @@
 
 #define d(x)
 
+#define SUBFOLDER_DIR_NAME     "subfolders"
+#define SUBFOLDER_DIR_NAME_LEN 10
+
 const char *
 imap_next_word (const char *buf)
 {
@@ -1263,3 +1270,160 @@ imap_mailbox_decode (const unsigned char *in, size_t inlen)
        
        return camel_utf7_utf8 (buf);
 }
+
+char *
+imap_path_to_physical (const char *prefix, const char *vpath)
+{
+       const char *p, *newp;
+       char *dp;
+       char *ppath;
+       int ppath_len;
+       int prefix_len;
+
+       while (*vpath == '/')
+               vpath++;
+       if (!prefix)
+               prefix = "";
+
+       /* Calculate the length of the real path. */
+       ppath_len = strlen (vpath);
+       ppath_len++;    /* For the ending zero.  */
+
+       prefix_len = strlen (prefix);
+       ppath_len += prefix_len;
+       ppath_len++;    /* For the separating slash.  */
+
+       /* Take account of the fact that we need to translate every
+        * separator into `subfolders/'.
+        */
+       p = vpath;
+       while (1) {
+               newp = strchr (p, '/');
+               if (newp == NULL)
+                       break;
+
+               ppath_len += SUBFOLDER_DIR_NAME_LEN;
+               ppath_len++; /* For the separating slash.  */
+
+               /* Skip consecutive slashes.  */
+               while (*newp == '/')
+                       newp++;
+
+               p = newp;
+       };
+
+       ppath = g_malloc (ppath_len);
+       dp = ppath;
+
+       memcpy (dp, prefix, prefix_len);
+       dp += prefix_len;
+       *(dp++) = '/';
+
+       /* Copy the mangled path.  */
+       p = vpath;
+       while (1) {
+               newp = strchr (p, '/');
+               if (newp == NULL) {
+                       strcpy (dp, p);
+                       break;
+               }
+
+               memcpy (dp, p, newp - p + 1); /* `+ 1' to copy the slash too.  */
+               dp += newp - p + 1;
+
+               memcpy (dp, SUBFOLDER_DIR_NAME, SUBFOLDER_DIR_NAME_LEN);
+               dp += SUBFOLDER_DIR_NAME_LEN;
+
+               *(dp++) = '/';
+
+               /* Skip consecutive slashes.  */
+               while (*newp == '/')
+                       newp++;
+
+               p = newp;
+       }
+
+       return ppath;
+}
+
+static gboolean
+find_folders_recursive (const char *physical_path, const char *path,
+                       IMAPPathFindFoldersCallback callback, gpointer data)
+{
+       DIR *dir;
+       char *subfolder_directory_path;
+       gboolean ok;
+
+       if (*path) {
+               if (!callback (physical_path, path, data))
+                       return FALSE;
+
+               subfolder_directory_path = g_strdup_printf ("%s/%s", physical_path, SUBFOLDER_DIR_NAME);
+       } else {
+               /* On the top level, we have no folders and,
+                * consequently, no subfolder directory.
+                */
+
+               subfolder_directory_path = g_strdup (physical_path);
+       }
+
+       /* Now scan the subfolders and load them. */
+       dir = opendir (subfolder_directory_path);
+       if (dir == NULL) {
+               g_free (subfolder_directory_path);
+               return TRUE;
+       }
+
+       ok = TRUE;
+       while (ok) {
+               struct stat file_stat;
+               struct dirent *dirent;
+               char *file_path;
+               char *new_path;
+
+               dirent = readdir (dir);
+               if (dirent == NULL)
+                       break;
+
+               if (strcmp (dirent->d_name, ".") == 0 || strcmp (dirent->d_name, "..") == 0)
+                       continue;
+
+               file_path = g_strdup_printf ("%s/%s", subfolder_directory_path,
+                                            dirent->d_name);
+
+               if (stat (file_path, &file_stat) < 0 ||
+                   ! S_ISDIR (file_stat.st_mode)) {
+                       g_free (file_path);
+                       continue;
+               }
+
+               new_path = g_strdup_printf ("%s/%s", path, dirent->d_name);
+
+               ok = find_folders_recursive (file_path, new_path, callback, data);
+
+               g_free (file_path);
+               g_free (new_path);
+       }
+
+       closedir (dir);
+       g_free (subfolder_directory_path);
+
+       return ok;
+}
+
+/**
+ * imap_path_find_folders:
+ * @prefix: directory to start from
+ * @callback: Callback to invoke on each folder
+ * @data: Data for @callback
+ *
+ * Walks the folder tree starting at @prefix and calls @callback
+ * on each folder.
+ *
+ * Return value: %TRUE on success, %FALSE if an error occurs at any point
+ **/
+gboolean
+imap_path_find_folders (const char *prefix, IMAPPathFindFoldersCallback callback, gpointer data)
+{
+       return find_folders_recursive (prefix, "", callback, data);
+}
index e8f5701..7278843 100644 (file)
@@ -88,6 +88,11 @@ char *imap_namespace_concat (CamelImapStore *store, const char *name);
 char *imap_mailbox_encode (const unsigned char *in, size_t inlen);
 char *imap_mailbox_decode (const unsigned char *in, size_t inlen);
 
+typedef gboolean (*IMAPPathFindFoldersCallback) (const char *physical_path, const char *path, gpointer user_data);
+
+char *imap_path_to_physical (const char *prefix, const char *vpath);
+gboolean imap_path_find_folders (const char *prefix, IMAPPathFindFoldersCallback callback, gpointer data);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 259b71f..3cdf897 100644 (file)
@@ -1,7 +1,5 @@
 ## Process this file with automake to produce Makefile.in
 
-libcamelimap4includedir = $(privincludedir)/camel
-
 camel_provider_LTLIBRARIES = libcamelimap4.la
 camel_provider_DATA = libcamelimap4.urls
 
index 49487b1..112695a 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <glib.h>
 
-#include <e-util/e-msgport.h>
+#include <libedataserver/e-msgport.h>
 
 #include <camel/camel-stream.h>
 #include <camel/camel-exception.h>
index 6bc76f9..b4d8df2 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <glib.h>
 
-#include <e-util/e-msgport.h>
+#include <libedataserver/e-msgport.h>
 
 #include <camel/camel-stream.h>
 #include <camel/camel-folder.h>
index ec24c59..2e7308d 100644 (file)
@@ -35,6 +35,7 @@
 #include <camel/camel-private.h>
 
 #include <camel/camel-i18n.h>
+#include <camel/camel-net-utils.h>
 
 #include "camel-imap4-store.h"
 #include "camel-imap4-engine.h"
index 00bb8ce..e38928e 100644 (file)
@@ -33,7 +33,7 @@
 #include <ctype.h>
 #include <errno.h>
 
-#include <e-util/md5-utils.h>
+#include <libedataserver/md5-utils.h>
 
 #include <camel/camel-file-utils.h>
 #include <camel/camel-string-utils.h>
index 7cf4765..8a0e92f 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <camel/camel-store.h>
 #include <camel/camel-i18n.h>
+#include <camel/camel-net-utils.h>
 
 #include "camel-imap4-engine.h"
 #include "camel-imap4-stream.h"
index 7ce8c65..8260c58 100644 (file)
@@ -1,7 +1,5 @@
 ## Process this file with automake to produce Makefile.in
 
-libcamelimappincludedir = $(privincludedir)/camel
-
 camel_provider_LTLIBRARIES = libcamelimapp.la
 camel_provider_DATA = libcamelimapp.urls
 
@@ -27,7 +25,7 @@ libcamelimapp_la_SOURCES =                    \
        camel-imapp-driver.c                    \
        camel-imapp-summary.c
 
-libcamelimappinclude_HEADERS =                 \
+noinst_HEADERS =                       \
        camel-imapp-utils.h                     \
        camel-imapp-engine.h                    \
        camel-imapp-stream.h                    \
@@ -39,7 +37,4 @@ libcamelimappinclude_HEADERS =                        \
 
 libcamelimapp_la_LDFLAGS = -avoid-version -module
 
-#noinst_HEADERS =                              \
-#      camel-imap-private.h
-
 EXTRA_DIST = libcamelimapp.urls
index c336dd3..2ecdfe6 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <camel/camel-object.h>
 #include "camel-imapp-stream.h"
-#include <e-util/e-msgport.h>
+#include <libedataserver/e-msgport.h>
 
 #define CAMEL_IMAPP_DRIVER_TYPE     (camel_imapp_driver_get_type ())
 #define CAMEL_IMAPP_DRIVER(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_IMAPP_DRIVER_TYPE, CamelIMAPPDriver))
index 4064d99..2cc19cd 100644 (file)
@@ -5,7 +5,7 @@
 #include <camel/camel-object.h>
 
 #include "camel-imapp-stream.h"
-#include <e-util/e-msgport.h>
+#include <libedataserver/e-msgport.h>
 #include "camel-imapp-folder.h"
 
 #define CAMEL_IMAPP_ENGINE_TYPE     (camel_imapp_engine_get_type ())
index e85048d..a838e7c 100644 (file)
@@ -41,7 +41,7 @@
 #include "camel-imapp-summary.h"
 #include "camel-imapp-exception.h"
 
-#include <e-util/md5-utils.h>
+#include <libedataserver/md5-utils.h>
 
 #include <stdlib.h>
 #include <string.h>
index a3ad57f..0c8d617 100644 (file)
@@ -33,8 +33,8 @@
 #include "camel/camel-file-utils.h"
 
 #include "camel-string-utils.h"
-#include "e-util/md5-utils.h"
-#include "e-util/e-memory.h"
+#include "libedataserver/md5-utils.h"
+#include "libedataserver/e-memory.h"
 
 #include "camel-private.h"
 #include "camel-utf8.h"
index 60d2816..03f835d 100644 (file)
@@ -57,6 +57,7 @@
 #include "camel-imapp-exception.h"
 #include "camel-imapp-utils.h"
 #include "camel-imapp-driver.h"
+#include "camel-net-utils.h"
 
 /* Specified in RFC 2060 section 2.1 */
 #define IMAP_PORT 143
index ace5288..c26be59 100644 (file)
@@ -33,7 +33,7 @@ extern "C" {
 #include <camel/camel-types.h>
 #include <camel/camel-store.h>
 #include "camel-imapp-driver.h"
-#include "e-util/e-memory.h"
+#include "libedataserver/e-memory.h"
 
 #define CAMEL_IMAPP_STORE_TYPE     (camel_imapp_store_get_type ())
 #define CAMEL_IMAPP_STORE(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_IMAPP_STORE_TYPE, CamelIMAPPStore))
index 51e0fe1..1460157 100644 (file)
@@ -13,7 +13,7 @@
 #include "camel-imapp-utils.h"
 #include "camel-imapp-exception.h"
 #include "camel-imapp-engine.h"
-#include "e-util/e-memory.h"
+#include "libedataserver/e-memory.h"
 
 /* high-level parser state */
 #define p(x)
index ad07472..fbf3199 100644 (file)
@@ -1,19 +1,13 @@
 ## Process this file with automake to produce Makefile.in
 
-libcamellocalincludedir = $(privincludedir)/camel
-
 camel_provider_LTLIBRARIES = libcamellocal.la
 camel_provider_DATA = libcamellocal.urls
 
-INCLUDES = -I.. \
-       -I$(srcdir)/..                          \
+INCLUDES = \
        -I$(top_srcdir)/camel                   \
        -I$(top_srcdir)/intl                    \
-       -I$(top_srcdir)/e-util                  \
        -I$(top_srcdir)                         \
        $(CAMEL_CFLAGS)                         \
-       $(GNOME_INCLUDEDIR)                     \
-       $(GTK_INCLUDEDIR)                       \
        -DG_LOG_DOMAIN=\"camel-local-provider\"
 
 libcamellocal_la_SOURCES =                     \
@@ -34,7 +28,7 @@ libcamellocal_la_SOURCES =                    \
        camel-spool-store.c                     \
        camel-spool-summary.c
 
-libcamellocalinclude_HEADERS =                 \
+noinst_HEADERS =                               \
        camel-local-folder.h                    \
        camel-local-store.h                     \
        camel-local-summary.h                   \
@@ -49,13 +43,12 @@ libcamellocalinclude_HEADERS =                      \
        camel-maildir-summary.h                 \
        camel-spool-folder.h                    \
        camel-spool-store.h                     \
-       camel-spool-summary.h
-
-noinst_HEADERS =                               \
+       camel-spool-summary.h                   \
        camel-local-private.h
 
 libcamellocal_la_LDFLAGS = -avoid-version -module
 
-libcamellocal_la_LIBADD = $(top_builddir)/e-util/libeutil.la
+libcamellocal_la_LIBADD = \
+       $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la
 
 EXTRA_DIST = libcamellocal.urls
index 07183d2..95b8bdc 100644 (file)
@@ -41,7 +41,7 @@
 #include <camel/camel-operation.h>
 
 #include "camel-private.h"
-#include "e-util/e-memory.h"
+#include "libedataserver/e-memory.h"
 #include "camel-i18n.h"
 
 #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
index 99c3fe0..bc8b82c 100644 (file)
@@ -1,7 +1,5 @@
 ## Process this file with automake to produce Makefile.in
 
-libcamelnntpincludedir = $(privincludedir)/camel
-
 camel_provider_LTLIBRARIES = libcamelnntp.la
 camel_provider_DATA = libcamelnntp.urls
 
@@ -24,15 +22,13 @@ libcamelnntp_la_SOURCES =                   \
        camel-nntp-summary.c                    \
        camel-nntp-store-summary.c
 
-libcamelnntpinclude_HEADERS =                  \
+noinst_HEADERS =                       \
        camel-nntp-store.h                      \
        camel-nntp-folder.h                     \
        camel-nntp-resp-codes.h                 \
        camel-nntp-stream.h                     \
        camel-nntp-summary.h                    \
-       camel-nntp-store-summary.h
-
-noinst_HEADERS =                               \
+       camel-nntp-store-summary.h              \
        camel-nntp-private.h
 
 libcamelnntp_la_LDFLAGS = -avoid-version -module
index 253d4e2..520c9db 100644 (file)
@@ -35,7 +35,7 @@ extern "C" {
 #include <config.h>
 #endif
 
-#include "e-util/e-msgport.h"
+#include "libedataserver/e-msgport.h"
 
 struct _CamelNNTPStorePrivate {
        int dummy;
index 7dbcd89..4c7e3df 100644 (file)
@@ -33,8 +33,8 @@
 
 #include "camel-file-utils.h"
 
-#include "e-util/md5-utils.h"
-#include "e-util/e-memory.h"
+#include "libedataserver/md5-utils.h"
+#include "libedataserver/e-memory.h"
 
 #include "camel-private.h"
 #include "camel-utf8.h"
index 2427d95..f9daad8 100644 (file)
@@ -54,6 +54,7 @@
 #include "camel-nntp-private.h"
 #include "camel-nntp-resp-codes.h"
 #include "camel-i18n.h"
+#include "camel-net-utils.h"
 
 #define w(x)
 #define dd(x) (camel_debug("nntp")?(x):0)
index d8000a8..43cbb0e 100644 (file)
@@ -29,7 +29,7 @@
 #include "camel-stream-mem.h"
 #include "camel-exception.h"
 
-#include "e-util/md5-utils.h"
+#include "libedataserver/md5-utils.h"
 
 #include <stdlib.h>
 #include <string.h>
index 84f5477..49df41e 100644 (file)
@@ -1,20 +1,13 @@
 ## Process this file with automake to produce Makefile.in
 
-libcamelpop3includedir = $(privincludedir)/camel
-
 camel_provider_LTLIBRARIES = libcamelpop3.la
 camel_provider_DATA = libcamelpop3.urls
 
 INCLUDES =                                     \
-       -I..                                    \
-       -I$(srcdir)/..                          \
-       -I$(srcdir)/../../..                    \
+       -I$(top_srcdir)                         \
        -I$(top_srcdir)/intl                    \
        -I$(top_srcdir)/camel                   \
-       -I$(top_srcdir)/e-util                  \
        $(CAMEL_CFLAGS)                         \
-       $(GNOME_INCLUDEDIR)                     \
-       $(GTK_INCLUDEDIR)                       \
        -DG_LOG_DOMAIN=\"camel-pop3-provider\"
 
 libcamelpop3_la_SOURCES =                      \
@@ -24,15 +17,15 @@ libcamelpop3_la_SOURCES =                   \
        camel-pop3-stream.c                     \
        camel-pop3-store.c
 
-libcamelpop3include_HEADERS =                  \
+noinst_HEADERS =                       \
        camel-pop3-engine.h                     \
        camel-pop3-folder.h                     \
        camel-pop3-stream.h                     \
        camel-pop3-store.h
 
-
 libcamelpop3_la_LDFLAGS = -avoid-version -module
 
-libcamelpop3_la_LIBADD = $(top_builddir)/e-util/libeutil.la
+libcamelpop3_la_LIBADD = \
+       $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la
 
 EXTRA_DIST = libcamelpop3.urls
index 3114980..48938bb 100644 (file)
@@ -22,7 +22,7 @@
 #define _CAMEL_POP3_ENGINE_H
 
 #include <camel/camel-object.h>
-#include "e-util/e-msgport.h"
+#include "libedataserver/e-msgport.h"
 #include "camel-pop3-stream.h"
 
 #define CAMEL_POP3_ENGINE(obj)         CAMEL_CHECK_CAST (obj, camel_pop3_engine_get_type (), CamelPOP3Engine)
index 23a5bc7..e0d91f1 100644 (file)
@@ -39,7 +39,7 @@
 #include "camel-data-cache.h"
 #include "camel-i18n.h"
 
-#include <e-util/md5-utils.h>
+#include <libedataserver/md5-utils.h>
 
 #include <stdlib.h>
 #include <string.h>
index b9f07ec..46a1fd3 100644 (file)
@@ -45,7 +45,7 @@
 #include "camel-session.h"
 #include "camel-exception.h"
 #include "camel-url.h"
-#include "e-util/md5-utils.h"
+#include "libedataserver/md5-utils.h"
 #include "camel-pop3-engine.h"
 #include "camel-sasl.h"
 #include "camel-data-cache.h"
@@ -55,6 +55,7 @@
 #include "camel-tcp-stream-ssl.h"
 #endif
 #include "camel-i18n.h"
+#include "camel-net-utils.h"
 
 /* Specified in RFC 1939 */
 #define POP3_PORT "110"
index 8c75af2..46e3613 100644 (file)
@@ -1,7 +1,5 @@
 ## Process this file with automake to produce Makefile.in
 
-libcamelsendmailincludedir = $(privincludedir)/camel
-
 camel_provider_LTLIBRARIES = libcamelsendmail.la
 camel_provider_DATA = libcamelsendmail.urls
 
@@ -20,7 +18,7 @@ libcamelsendmail_la_SOURCES =                         \
        camel-sendmail-provider.c               \
        camel-sendmail-transport.c
 
-libcamelsendmailinclude_HEADERS =              \
+noinst_HEADERS =               \
        camel-sendmail-transport.h
 
 libcamelsendmail_la_LDFLAGS = -avoid-version -module
index b6bba76..29dc3dc 100644 (file)
@@ -1,35 +1,25 @@
 ## Process this file with automake to produce Makefile.in
 
-libcamelsmtpincludedir = $(privincludedir)/camel
-
 camel_provider_LTLIBRARIES = libcamelsmtp.la
 camel_provider_DATA = libcamelsmtp.urls
 
 INCLUDES =                                     \
-       -I..                                    \
-       -I$(srcdir)/..                          \
-       -I$(srcdir)/../../..                    \
+       -I$(top_srcdir)                         \
        -I$(top_srcdir)/intl                    \
        -I$(top_srcdir)/camel                   \
-       -I$(top_srcdir)/e-util                  \
        $(CAMEL_CFLAGS)                         \
-       $(GNOME_INCLUDEDIR)                     \
-       $(GTK_INCLUDEDIR)                       \
-       $(NSPR_CFLAGS)                          \
-       $(NSS_CFLAGS)                           \
-       $(OPENSSL_CFLAGS)                       \
        -DG_LOG_DOMAIN=\"camel-smtp-provider\"
 
 libcamelsmtp_la_SOURCES =                      \
        camel-smtp-provider.c                   \
        camel-smtp-transport.c
 
-libcamelsmtpinclude_HEADERS =                  \
+noinst_HEADERS =                       \
        camel-smtp-transport.h
 
-
 libcamelsmtp_la_LDFLAGS = -avoid-version -module
 
-libcamelsmtp_la_LIBADD = $(top_builddir)/e-util/libeutil.la
+libcamelsmtp_la_LIBADD = \
+       $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la
 
 EXTRA_DIST = libcamelsmtp.urls
index 542f8c6..065d79f 100644 (file)
@@ -56,6 +56,7 @@
 #include "camel-exception.h"
 #include "camel-sasl.h"
 #include "camel-i18n.h"
+#include "camel-net-utils.h"
 
 extern int camel_verbose_debug;
 #define d(x) (camel_verbose_debug ? (x) : 0)
index e49fd92..92089a7 100644 (file)
@@ -3,18 +3,18 @@ INCLUDES =                                            \
        -I$(includedir)                                 \
        -I$(top_srcdir)                                 \
        -I$(top_srcdir)/intl                            \
-       -I$(top_srcdir)/e-util                          \
        -I$(top_srcdir)/camel                           \
        -I$(top_srcdir)/camel/tests/lib                 \
        -DG_LOG_DOMAIN=\"evolution-tests\"              \
        $(CAMEL_CFLAGS)
 
 LDADD = \
-       $(top_builddir)/camel/libcamel.la               \
-       $(top_builddir)/e-util/libeutil.la              \
        $(top_builddir)/camel/tests/lib/libcameltest.a  \
-       $(INTLLIBS)                                     \
-       $(EVOLUTION_MAIL_LIBS)
+       $(top_builddir)/camel/tests/lib/libcameltest-provider.a \
+       $(top_builddir)/camel/libcamel.la               \
+       $(top_builddir)/camel/libcamel-provider.la      \
+       $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la \
+       $(INTLLIBS)
 
 check_PROGRAMS =       \
        test1   test2   test3   \
index c1d3809..1f2d33b 100644 (file)
@@ -1,6 +1,7 @@
 /* store testing */
 
 #include "camel-test.h"
+#include "camel-test-provider.h"
 #include "folders.h"
 #include "session.h"
 
 
 #define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
 
+static const char *local_drivers[] = {
+       "local"
+};
+
 static char *local_providers[] = {
        "mbox",
        "mh",
@@ -24,6 +29,7 @@ int main(int argc, char **argv)
        char *path;
 
        camel_test_init(argc, argv);
+       camel_test_provider_init(1, local_drivers);
 
        ex = camel_exception_new();
 
index f96c885..09454a9 100644 (file)
@@ -4,6 +4,7 @@
 #include <pthread.h>
 
 #include "camel-test.h"
+#include "camel-test-provider.h"
 #include "folders.h"
 #include "messages.h"
 #include "session.h"
@@ -19,6 +20,7 @@
 
 #define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
 
+static const char *local_drivers[] = { "local" };
 static char *local_providers[] = {
        "mbox",
        "mh",
@@ -63,6 +65,7 @@ int main(int argc, char **argv)
        pthread_t threads[MAX_THREADS];
 
        camel_test_init(argc, argv);
+       camel_test_provider_init(1, local_drivers);
 
        ex = camel_exception_new();
 
index 57a449f..78b755f 100644 (file)
@@ -5,6 +5,7 @@
 #include <fcntl.h>
 
 #include "camel-test.h"
+#include "camel-test-provider.h"
 #include "messages.h"
 #include "folders.h"
 #include "session.h"
@@ -19,6 +20,8 @@
 
 #define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
 
+static const char *local_drivers[] = { "local" };
+
 static char *stores[] = {
        "mbox:///tmp/camel-test/mbox",
        "mh:///tmp/camel-test/mh",
@@ -32,6 +35,7 @@ int main(int argc, char **argv)
        int i;
 
        camel_test_init(argc, argv);
+       camel_test_provider_init(1, local_drivers);
 
        /* clear out any camel-test data */
        system("/bin/rm -rf /tmp/camel-test");
index 1449821..f789482 100644 (file)
@@ -1,10 +1,9 @@
 /* folder/index testing */
 
-#include <gtk/gtk.h>
-
 #include <string.h>
 
 #include "camel-test.h"
+#include "camel-test-provider.h"
 #include "messages.h"
 #include "folders.h"
 #include "session.h"
@@ -139,6 +138,7 @@ run_search(CamelFolder *folder, int m)
        pull();
 }
 
+static const char *local_drivers[] = { "local" };
 
 static char *stores[] = {
        "mbox:///tmp/camel-test/mbox",
@@ -157,8 +157,8 @@ int main(int argc, char **argv)
        int indexed;
        GPtrArray *uids;
 
-       gtk_init(&argc, &argv);
        camel_test_init(argc, argv);
+       camel_test_provider_init(1, local_drivers);
 
        ex = camel_exception_new();
 
index e6c58e0..fa7955f 100644 (file)
@@ -1,6 +1,7 @@
 /* store testing, for remote folders */
 
 #include "camel-test.h"
+#include "camel-test-provider.h"
 #include "folders.h"
 #include "session.h"
 
@@ -10,6 +11,8 @@
 
 #define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
 
+static const char *imap_drivers[] = { "imap" };
+
 static char *remote_providers[] = {
        "IMAP_TEST_URL",
 };
@@ -22,6 +25,7 @@ int main(int argc, char **argv)
        char *path;
 
        camel_test_init(argc, argv);
+       camel_test_provider_init(1, imap_drivers);
 
        ex = camel_exception_new();
 
index ccdfb23..da09947 100644 (file)
@@ -1,6 +1,7 @@
 /* store testing, for remote folders */
 
 #include "camel-test.h"
+#include "camel-test-provider.h"
 #include "folders.h"
 #include "session.h"
 
@@ -10,6 +11,8 @@
 
 #define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
 
+static const char *nntp_drivers[] = { "nntp" };
+
 static char *remote_providers[] = {
        "NNTP_TEST_URL",
 };
@@ -22,6 +25,7 @@ int main(int argc, char **argv)
        char *path;
 
        camel_test_init(argc, argv);
+       camel_test_provider_init(1, nntp_drivers);
 
        ex = camel_exception_new();
 
index f0fd8a2..2674c28 100644 (file)
@@ -1,6 +1,7 @@
 /* folder testing */
 
 #include "camel-test.h"
+#include "camel-test-provider.h"
 #include "folders.h"
 #include "session.h"
 
@@ -14,6 +15,7 @@
 
 #define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
 
+static const char *imap_drivers[] = { "imap" };
 static char *remote_providers[] = {
        "IMAP_TEST_URL",
 };
@@ -26,6 +28,7 @@ int main(int argc, char **argv)
        char *path;
 
        camel_test_init(argc, argv);
+       camel_test_provider_init(1, imap_drivers);
 
        /* clear out any camel-test data */
        system("/bin/rm -rf /tmp/camel-test");
index 3dee129..a107715 100644 (file)
@@ -1,6 +1,7 @@
 /* folder testing */
 
 #include "camel-test.h"
+#include "camel-test-provider.h"
 #include "messages.h"
 #include "session.h"
 
@@ -14,6 +15,7 @@
 
 #define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
 
+static const char *nntp_drivers[] = { "nntp" };
 static char *remote_providers[] = {
        "NNTP_TEST_URL",
 };
@@ -26,6 +28,7 @@ int main(int argc, char **argv)
        char *path;
 
        camel_test_init(argc, argv);
+       camel_test_provider_init(1, nntp_drivers);
 
        /* clear out any camel-test data */
        system("/bin/rm -rf /tmp/camel-test");
index c035f62..eb7f5a6 100644 (file)
@@ -4,6 +4,7 @@
 #include <pthread.h>
 
 #include "camel-test.h"
+#include "camel-test-provider.h"
 #include "folders.h"
 #include "messages.h"
 #include "session.h"
@@ -19,6 +20,8 @@
 
 #define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
 
+static const char *local_drivers[] = { "local" };
+
 static char *local_providers[] = {
        "mbox",
        "mh",
@@ -135,6 +138,7 @@ int main(int argc, char **argv)
        GPtrArray *uids;
 
        camel_test_init(argc, argv);
+       camel_test_provider_init(1, local_drivers);
 
        ex = camel_exception_new();
 
index 79d34c7..4e4f417 100644 (file)
@@ -3,6 +3,7 @@
 #include <string.h>
 
 #include "camel-test.h"
+#include "camel-test-provider.h"
 #include "messages.h"
 #include "folders.h"
 #include "session.h"
@@ -19,6 +20,8 @@
 
 #define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0]))
 
+static const char *local_drivers[] = { "local" };
+
 struct {
        char *name;
        CamelFolder *folder;
@@ -97,9 +100,8 @@ int main(int argc, char **argv)
        CamelStream *mbox;
        CamelFilterDriver *driver;
 
-       /*gtk_init(&argc, &argv);*/
-
        camel_test_init(argc, argv);
+       camel_test_provider_init(1, local_drivers);
 
        ex = camel_exception_new();
 
index 93ec07a..4b9613e 100644 (file)
@@ -5,9 +5,10 @@ INCLUDES =                                             \
        -I$(top_srcdir)/intl                            \
        -I$(top_srcdir)/e-util                          \
        -I$(top_srcdir)/camel                           \
+       -DCAMEL_BUILD_DIR=\"$(top_builddir)/camel\"     \
        $(CAMEL_CFLAGS)
 
-check_LIBRARIES = libcameltest.a
+check_LIBRARIES = libcameltest.a libcameltest-provider.a
 
 libcameltest_a_SOURCES = \
        camel-test.c camel-test.h \
@@ -18,5 +19,14 @@ libcameltest_a_SOURCES = \
        streams.c streams.h \
        address-data.h
 
+libcameltest_provider_a_SOURCES = \
+       camel-test-provider.c camel-test-provider.h
+
 libcameltest_a_LIBADD =                                \
-       $(top_builddir)/e-util/libeutil.la
+       $(top_builddir)/camel/libcamel.la               \
+       $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la
+
+libcameltest_provider_a_LIBADD =                               \
+       $(top_builddir)/camel/libcamel-provider.la \
+       $(top_builddir)/camel/libcamel.la               \
+       $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la
index e93d8ca..5104da6 100644 (file)
@@ -12,13 +12,15 @@ test_folder_counts(CamelFolder *folder, int total, int unread)
 {
        GPtrArray *s;
        int i, myunread;
+       int gettotal, getunread;
        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);
+       camel_object_get(folder, NULL, CAMEL_FOLDER_TOTAL, &gettotal, CAMEL_FOLDER_UNREAD, &getunread, 0);
+       check(gettotal == total);
+       check(getunread == unread);
 
        /* next, use the summary */
        s = camel_folder_get_summary(folder);
@@ -27,7 +29,7 @@ test_folder_counts(CamelFolder *folder, int total, int unread)
        myunread = s->len;
        for (i=0;i<s->len;i++) {
                info = s->pdata[i];
-               if (info->flags & CAMEL_MESSAGE_SEEN)
+               if (camel_message_info_flags(info) & CAMEL_MESSAGE_SEEN)
                        myunread--;
        }
        check(unread == myunread);
@@ -40,7 +42,7 @@ test_folder_counts(CamelFolder *folder, int total, int unread)
        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)
+               if (camel_message_info_flags(info) & CAMEL_MESSAGE_SEEN)
                        myunread--;
                camel_folder_free_message_info(folder, info);
        }
@@ -70,7 +72,7 @@ test_message_info(CamelMimeMessage *msg, const CamelMessageInfo *info)
 
        /* FIXME: testing from/cc/to, etc is more tricky */
 
-       check(info->date_sent == camel_mime_message_get_date(msg, NULL));
+       check(camel_message_info_date_sent(info) == 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));*/
@@ -469,7 +471,7 @@ test_folder_message_ops(CamelSession *session, const char *name, int local, cons
 
                push("deleting first message & expunging");
                camel_folder_delete_message(folder, uids->pdata[0]);
-               test_folder_counts(folder, 10, 10);
+               test_folder_counts(folder, 10, 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[0]);
@@ -498,7 +500,7 @@ test_folder_message_ops(CamelSession *session, const char *name, int local, cons
                push("deleting last message & expunging");
                camel_folder_delete_message(folder, uids->pdata[8]);
                /* sync? */
-               test_folder_counts(folder, 9, 9);
+               test_folder_counts(folder, 9, 8);
                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]);
@@ -529,7 +531,7 @@ test_folder_message_ops(CamelSession *session, const char *name, int local, cons
                        camel_folder_delete_message(folder, uids->pdata[j]);
                }
                /* sync? */
-               test_folder_counts(folder, 8, 8);
+               test_folder_counts(folder, 8, 0);
                camel_folder_expunge(folder, ex);
                check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
                for (j=0;j<8;j++) {
index 1f892c3..24e0407 100644 (file)
@@ -13,3 +13,6 @@ int test_message_compare_content(CamelDataWrapper *dw, const char *text, int len
 int test_message_compare (CamelMimeMessage *msg);
 
 void test_message_dump_structure(CamelMimeMessage *m);
+
+int test_message_compare_header(CamelMimeMessage *m1, CamelMimeMessage *m2);
+int test_message_compare_messages(CamelMimeMessage *m1, CamelMimeMessage *m2);
index e4dc006..d62db50 100644 (file)
@@ -126,7 +126,6 @@ test_seekable_substream_writepart(CamelStream *s, int type)
        CamelSeekableSubstream *sus = (CamelSeekableSubstream *)s;
        CamelSeekableStream *sp = sus->parent_stream;
        int i, len;
-       off_t end;
 
        push("writing substream, type %d", type);
 
@@ -177,7 +176,6 @@ test_seekable_substream_readpart(CamelStream *s)
        CamelSeekableSubstream *sus = (CamelSeekableSubstream *)s;
        CamelSeekableStream *sp = sus->parent_stream;
        int i, len;
-       off_t end;
 
        push("reading substream");
 
index 32b4294..010fdc3 100644 (file)
@@ -3,7 +3,6 @@ INCLUDES =                                              \
        -I$(includedir)                                 \
        -I$(top_srcdir)                                 \
        -I$(top_srcdir)/intl                            \
-       -I$(top_srcdir)/e-util                          \
        -I$(top_srcdir)/camel                           \
        -I$(top_srcdir)/camel/tests/lib                 \
        -DG_LOG_DOMAIN=\"evolution-tests\"              \
@@ -11,10 +10,9 @@ INCLUDES =                                           \
 
 LDADD = \
        $(top_builddir)/camel/libcamel.la               \
-       $(top_builddir)/e-util/libeutil.la              \
+       $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la \
        $(top_builddir)/camel/tests/lib/libcameltest.a  \
-       $(INTLLIBS)                                     \
-       $(EVOLUTION_MAIL_LIBS)
+       $(INTLLIBS)
 
 check_PROGRAMS =       \
        test1           \
index 21635f8..9d5d882 100644 (file)
@@ -3,7 +3,6 @@ INCLUDES =                                              \
        -I$(includedir)                                 \
        -I$(top_srcdir)                                 \
        -I$(top_srcdir)/intl                            \
-       -I$(top_srcdir)/e-util                          \
        -I$(top_srcdir)/camel                           \
        -I$(top_srcdir)/camel/tests/lib                 \
        -DG_LOG_DOMAIN=\"evolution-tests\"              \
@@ -12,10 +11,9 @@ INCLUDES =                                           \
 
 LDADD = \
        $(top_builddir)/camel/libcamel.la               \
-       $(top_builddir)/e-util/libeutil.la              \
+       $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la \
        $(top_builddir)/camel/tests/lib/libcameltest.a  \
-       $(INTLLIBS)                                     \
-       $(EVOLUTION_MAIL_LIBS)
+       $(INTLLIBS)
 
 EXTRA_DIST =                           \
        crlf-1.in                       \
index 4cf6500..1be915e 100644 (file)
@@ -3,18 +3,17 @@ INCLUDES =                                            \
        -I$(includedir)                                 \
        -I$(top_srcdir)                                 \
        -I$(top_srcdir)/intl                            \
-       -I$(top_srcdir)/e-util                          \
        -I$(top_srcdir)/camel                           \
        -I$(top_srcdir)/camel/tests/lib                 \
        -DG_LOG_DOMAIN=\"evolution-tests\"              \
        $(CAMEL_CFLAGS)
 
 LDADD = \
+       $(top_builddir)/camel/libcamel-provider.la      \
        $(top_builddir)/camel/libcamel.la               \
-       $(top_builddir)/e-util/libeutil.la              \
+       $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la \
        $(top_builddir)/camel/tests/lib/libcameltest.a  \
-       $(INTLLIBS)                                     \
-       $(EVOLUTION_MAIL_LIBS)
+       $(INTLLIBS)
 
 check_PROGRAMS =       \
        url             \
index 254b919..4fa8d18 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <glib.h>
-#include <e-util/e-sexp.h>
+#include <libedataserver/e-sexp.h>
 #include <camel/camel-exception.h>
 #include <camel/camel-search-private.h>
 
index b14d804..edd4314 100644 (file)
@@ -3,18 +3,17 @@ INCLUDES =                                            \
        -I$(includedir)                                 \
        -I$(top_srcdir)                                 \
        -I$(top_srcdir)/intl                            \
-       -I$(top_srcdir)/e-util                          \
        -I$(top_srcdir)/camel                           \
        -I$(top_srcdir)/camel/tests/lib                 \
        -DG_LOG_DOMAIN=\"evolution-tests\"              \
        $(CAMEL_CFLAGS)
 
 LDADD = \
-       $(top_builddir)/camel/libcamel.la               \
-       $(top_builddir)/e-util/libeutil.la              \
+       $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la \
        $(top_builddir)/camel/tests/lib/libcameltest.a  \
-       $(INTLLIBS)                                     \
-       $(EVOLUTION_MAIL_LIBS)
+       $(top_builddir)/camel/libcamel-provider.la              \
+       $(top_builddir)/camel/libcamel.la               \
+       $(INTLLIBS)
 
 check_PROGRAMS =       \
        pgp
index 098e3de..851a9dc 100644 (file)
@@ -168,7 +168,11 @@ int main (int argc, char **argv)
 
        camel_test_push ("PGP signing");
        camel_cipher_sign (ctx, "no.user@no.domain", CAMEL_CIPHER_HASH_SHA1, conpart, sigpart, ex);
-       check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
+       if (camel_exception_is_set(ex)) {
+               printf("PGP signing failed assuming non-functional environment\n%s", camel_exception_get_description (ex));
+               camel_test_pull();
+               return 77;
+       }
        camel_test_pull ();
        
        camel_exception_clear (ex);
index 25bd84e..114e02e 100644 (file)
@@ -3,7 +3,6 @@ INCLUDES =                                              \
        -I$(includedir)                                 \
        -I$(top_srcdir)                                 \
        -I$(top_srcdir)/intl                            \
-       -I$(top_srcdir)/e-util                          \
        -I$(top_srcdir)/camel                           \
        -I$(top_srcdir)/camel/tests/lib                 \
        -DG_LOG_DOMAIN=\"evolution-tests\"              \
@@ -11,10 +10,9 @@ INCLUDES =                                           \
 
 LDADD = \
        $(top_builddir)/camel/libcamel.la               \
-       $(top_builddir)/e-util/libeutil.la              \
+       $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la \
        $(top_builddir)/camel/tests/lib/libcameltest.a  \
-       $(INTLLIBS)                                     \
-       $(EVOLUTION_MAIL_LIBS)
+       $(INTLLIBS)
 
 check_PROGRAMS =       \
        test1 test2 test3