Index: camel/camel-filter-search.c
===================================================================
--- camel/camel-filter-search.c	(revision 7789)
+++ camel/camel-filter-search.c	(working copy)
@@ -45,12 +45,12 @@
 #include <glib.h>
 #include <glib/gi18n-lib.h>
 
-#include <libedataserver/e-iconv.h>
 #include <libedataserver/e-sexp.h>
 
 #include "camel-debug.h"
 #include "camel-exception.h"
 #include "camel-filter-search.h"
+#include "camel-iconv.h"
 #include "camel-mime-message.h"
 #include "camel-multipart.h"
 #include "camel-provider.h"
@@ -177,7 +177,7 @@ check_header (struct _ESExp *f, int argc
 				ct = camel_mime_part_get_content_type (CAMEL_MIME_PART (message));
 				if (ct) {
 					charset = camel_content_type_param (ct, "charset");
-					charset = e_iconv_charset_name (charset);
+					charset = camel_iconv_charset_name (charset);
 				}
 			}
 
Index: camel/providers/nntp/camel-nntp-store-summary.c
===================================================================
--- camel/providers/nntp/camel-nntp-store-summary.c	(revision 7789)
+++ camel/providers/nntp/camel-nntp-store-summary.c	(working copy)
@@ -29,7 +29,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <libedataserver/md5-utils.h>
 #include <libedataserver/e-memory.h>
 
 #include "camel-file-utils.h"
Index: camel/providers/nntp/camel-nntp-utils.c
===================================================================
--- camel/providers/nntp/camel-nntp-utils.c	(revision 7789)
+++ camel/providers/nntp/camel-nntp-utils.c	(working copy)
@@ -24,9 +24,8 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <libedataserver/md5-utils.h>
-
 #include "camel-folder-summary.h"
+#include "camel-md5-utils.h"
 #include "camel-stream-mem.h"
 #include "camel-exception.h"
 
@@ -101,7 +100,7 @@ get_XOVER_headers(CamelNNTPStore *nntp_s
 				new_info->headers.date_received = g_strdup(date);
 #endif
 				new_info->size = atoi(bytes);
-				md5_get_digest(message_id, strlen(message_id), digest);
+				camel_md5_get_digest(message_id, strlen(message_id), digest);
 				memcpy(new_info->message_id.id.hash, digest, sizeof(new_info->message_id.id.hash));
 
 				if (camel_nntp_newsrc_article_is_read (nntp_store->newsrc,
Index: camel/providers/pop3/camel-pop3-folder.c
===================================================================
--- camel/providers/pop3/camel-pop3-folder.c	(revision 7789)
+++ camel/providers/pop3/camel-pop3-folder.c	(working copy)
@@ -33,10 +33,9 @@
 
 #include <glib/gi18n-lib.h>
 
-#include <libedataserver/md5-utils.h>
-
 #include "camel-data-cache.h"
 #include "camel-exception.h"
+#include "camel-md5-utils.h"
 #include "camel-mime-message.h"
 #include "camel-operation.h"
 #include "camel-pop3-folder.h"
@@ -144,7 +143,7 @@ static void
 cmd_builduid(CamelPOP3Engine *pe, CamelPOP3Stream *stream, void *data)
 {
 	CamelPOP3FolderInfo *fi = data;
-	MD5Context md5;
+	CamelMD5Context md5;
 	unsigned char digest[16];
 	struct _camel_header_raw *h;
 	CamelMimeParser *mp;
@@ -153,7 +152,7 @@ cmd_builduid(CamelPOP3Engine *pe, CamelP
 	   We need a pointer to the folder perhaps? */
 	camel_operation_progress_count(NULL, fi->id);
 
-	md5_init(&md5);
+	camel_md5_init(&md5);
 	mp = camel_mime_parser_new();
 	camel_mime_parser_init_with_stream(mp, (CamelStream *)stream);
 	switch (camel_mime_parser_step(mp, NULL, NULL)) {
@@ -164,8 +163,8 @@ cmd_builduid(CamelPOP3Engine *pe, CamelP
 		while (h) {
 			if (g_ascii_strcasecmp(h->name, "status") != 0
 			    && g_ascii_strcasecmp(h->name, "x-status") != 0) {
-				md5_update(&md5, h->name, strlen(h->name));
-				md5_update(&md5, h->value, strlen(h->value));
+				camel_md5_update(&md5, h->name, strlen(h->name));
+				camel_md5_update(&md5, h->value, strlen(h->value));
 			}
 			h = h->next;
 		}
@@ -173,7 +172,7 @@ cmd_builduid(CamelPOP3Engine *pe, CamelP
 		break;
 	}
 	camel_object_unref(mp);
-	md5_final(&md5, digest);
+	camel_md5_final(&md5, digest);
 	fi->uid = camel_base64_encode_simple(digest, 16);
 
 	d(printf("building uid for id '%d' = '%s'\n", fi->id, fi->uid));
Index: camel/providers/pop3/camel-pop3-store.c
===================================================================
--- camel/providers/pop3/camel-pop3-store.c	(revision 7789)
+++ camel/providers/pop3/camel-pop3-store.c	(working copy)
@@ -37,10 +37,9 @@
 
 #include <glib/gi18n-lib.h>
 
-#include <libedataserver/md5-utils.h>
-
 #include "camel-data-cache.h"
 #include "camel-exception.h"
+#include "camel-md5-utils.h"
 #include "camel-net-utils.h"
 #include "camel-operation.h"
 #include "camel-pop3-engine.h"
@@ -509,7 +508,7 @@ pop3_try_authenticate (CamelService *ser
 		
 		secret = g_alloca(strlen(store->engine->apop)+strlen(service->url->passwd)+1);
 		sprintf(secret, "%s%s",  store->engine->apop, service->url->passwd);
-		md5_get_digest(secret, strlen (secret), md5sum);
+		camel_md5_get_digest(secret, strlen (secret), md5sum);
 
 		for (s = md5sum, d = md5asc; d < md5asc + 32; s++, d += 2)
 			sprintf (d, "%.2x", *s);
Index: camel/providers/groupwise/camel-groupwise-store-summary.c
===================================================================
--- camel/providers/groupwise/camel-groupwise-store-summary.c	(revision 7789)
+++ camel/providers/groupwise/camel-groupwise-store-summary.c	(working copy)
@@ -33,7 +33,6 @@
 #include <unistd.h>
 
 #include <libedataserver/e-memory.h>
-#include <libedataserver/md5-utils.h>
 
 #include "camel-file-utils.h"
 #include "camel-private.h"
Index: camel/providers/imap/camel-imap-search.c
===================================================================
--- camel/providers/imap/camel-imap-search.c	(revision 7789)
+++ camel/providers/imap/camel-imap-search.c	(working copy)
@@ -30,8 +30,7 @@
 
 #include <string.h>
 
-#include <libedataserver/md5-utils.h>	/* md5 hash building */
-
+#include "camel-md5-utils.h"
 #include "camel-mime-utils.h"	/* base64 encoding */
 #include "camel-search-private.h"
 #include "camel-seekable-stream.h"
@@ -177,17 +176,17 @@ camel_imap_search_new (const char *cache
 static void
 hash_match(char hash[17], int argc, struct _ESExpResult **argv)
 {
-	MD5Context ctx;
+	CamelMD5Context ctx;
 	unsigned char digest[16];
 	unsigned int state = 0, save = 0;
 	int i;
 
-	md5_init(&ctx);
+	camel_md5_init(&ctx);
 	for (i=0;i<argc;i++) {
 		if (argv[i]->type == ESEXP_RES_STRING)
-			md5_update(&ctx, argv[i]->value.string, strlen(argv[i]->value.string));
+			camel_md5_update(&ctx, argv[i]->value.string, strlen(argv[i]->value.string));
 	}
-	md5_final(&ctx, digest);
+	camel_md5_final(&ctx, digest);
 
 	camel_base64_encode_close(digest, 12, FALSE, hash, &state, &save);
 
Index: camel/providers/imap/camel-imap-store-summary.c
===================================================================
--- camel/providers/imap/camel-imap-store-summary.c	(revision 7789)
+++ camel/providers/imap/camel-imap-store-summary.c	(working copy)
@@ -29,7 +29,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <libedataserver/md5-utils.h>
 #include <libedataserver/e-memory.h>
 
 #include "camel-file-utils.h"
Index: camel/providers/imapp/camel-imapp-folder.c
===================================================================
--- camel/providers/imapp/camel-imapp-folder.c	(revision 7789)
+++ camel/providers/imapp/camel-imapp-folder.c	(working copy)
@@ -29,7 +29,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <libedataserver/md5-utils.h>
 #include <libedataserver/e-data-server-util.h>
 
 #include "camel-data-cache.h"
Index: camel/providers/imapp/camel-imapp-store-summary.c
===================================================================
--- camel/providers/imapp/camel-imapp-store-summary.c	(revision 7789)
+++ camel/providers/imapp/camel-imapp-store-summary.c	(working copy)
@@ -28,7 +28,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <libedataserver/md5-utils.h>
 #include <libedataserver/e-memory.h>
 
 #include "camel-file-utils.h"
Index: camel/providers/imapp/camel-imapp-driver.c
===================================================================
--- camel/providers/imapp/camel-imapp-driver.c	(revision 7789)
+++ camel/providers/imapp/camel-imapp-driver.c	(working copy)
@@ -927,7 +927,7 @@ camel_imapp_driver_worker(CamelIMAPPDriv
 	int go = TRUE;
 
 	do {
-		/*m = (CamelIMAPPMsg *)e_msgport_get(id->queue);*/
+		/*m = (CamelIMAPPMsg *)camel_msgport_try_pop(id->queue);*/
 		switch (m->type) {
 		case CAMEL_IMAPP_MSG_FETCH:
 			/*e_dlist_addtail(&id->fetch_queue, (EDListNode *)m);*/
Index: camel/providers/imapp/camel-imapp-engine.c
===================================================================
--- camel/providers/imapp/camel-imapp-engine.c	(revision 7789)
+++ camel/providers/imapp/camel-imapp-engine.c	(working copy)
@@ -44,7 +44,7 @@ object_init(CamelIMAPPEngine *ie, CamelI
 	e_dlist_init(&ie->active);
 	e_dlist_init(&ie->done);
 
-	ie->port = e_msgport_new();
+	ie->port = camel_msgport_new();
 
 	ie->tagprefix = ieclass->tagprefix;
 	ieclass->tagprefix++;
@@ -688,7 +688,7 @@ camel_imapp_engine_command_queue(CamelIM
 	if (ic->mem)
 		imap_engine_command_complete(imap, ic);
 
-	e_msgport_put(imap->port, (EMsg *)ic);
+	camel_msgport_push(imap->port, (EMsg *)ic);
 }
 
 CamelIMAPPCommand *
Index: camel/providers/imap4/camel-imap4-summary.c
===================================================================
--- camel/providers/imap4/camel-imap4-summary.c	(revision 7789)
+++ camel/providers/imap4/camel-imap4-summary.c	(working copy)
@@ -35,9 +35,8 @@
 
 #include <glib/gi18n-lib.h>
 
-#include <libedataserver/md5-utils.h>
-
 #include "camel-file-utils.h"
+#include "camel-md5-utils.h"
 #include "camel-string-utils.h"
 #include "camel-offline-journal.h"
 
@@ -462,7 +461,7 @@ decode_references (const char *refstr, c
 	references->size = n;
 	
 	for (i = 0, r = refs; r != NULL; i++, r = r->next) {
-		md5_get_digest (r->id, strlen (r->id), md5sum);
+		camel_md5_get_digest (r->id, strlen (r->id), md5sum);
 		memcpy (references->references[i].id.hash, md5sum, sizeof (CamelSummaryMessageID));
 	}
 	
@@ -545,7 +544,7 @@ decode_envelope (CamelIMAP4Engine *engin
 	
 	if (nstring != NULL) {
 		if ((msgid = camel_header_msgid_decode (nstring))) {
-			md5_get_digest (msgid, strlen (msgid), md5sum);
+			camel_md5_get_digest (msgid, strlen (msgid), md5sum);
 			memcpy (iinfo->info.message_id.id.hash, md5sum, sizeof (CamelSummaryMessageID));
 			g_free (msgid);
 		}
Index: camel/camel-mime-utils.c
===================================================================
--- camel/camel-mime-utils.c	(revision 7789)
+++ camel/camel-mime-utils.c	(working copy)
@@ -46,10 +46,10 @@
 
 #include <glib.h>
 
-#include <libedataserver/e-iconv.h>
 #include <libedataserver/e-time-utils.h>
 
 #include "camel-charset-map.h"
+#include "camel-iconv.h"
 #include "camel-mime-utils.h"
 #include "camel-net-utils.h"
 #include "camel-utf8.h"
@@ -1068,7 +1068,7 @@ rfc2047_decode_word(const char *in, size
 			if (p)
 				*p = '\0';
 			
-			charset = e_iconv_charset_name (encname);
+			charset = camel_iconv_charset_name (encname);
 			
 			inbuf = decword;
 			
@@ -1077,21 +1077,21 @@ rfc2047_decode_word(const char *in, size
 			outbuf = outbase;
 			
 		retry:
-			ic = e_iconv_open ("UTF-8", charset);
+			ic = camel_iconv_open ("UTF-8", charset);
 			if (ic != (iconv_t) -1) {
-				ret = e_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
+				ret = camel_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
 				if (ret != (size_t) -1) {
-					e_iconv (ic, NULL, 0, &outbuf, &outlen);
+					camel_iconv (ic, NULL, 0, &outbuf, &outlen);
 					*outbuf = 0;
 					decoded = g_strdup (outbase);
 				}
-				e_iconv_close (ic);
+				camel_iconv_close (ic);
 			} else {
 				w(g_warning ("Cannot decode charset, header display may be corrupt: %s: %s",
 					     charset, strerror (errno)));
 				
 				if (!retried) {
-					charset = e_iconv_locale_charset ();
+					charset = camel_iconv_locale_charset ();
 					if (!charset)
 						charset = "iso-8859-1";
 					
@@ -1139,26 +1139,26 @@ append_8bit (GString *out, const char *i
 	size_t outlen;
 	iconv_t ic;
 	
-	ic = e_iconv_open ("UTF-8", charset);
+	ic = camel_iconv_open ("UTF-8", charset);
 	if (ic == (iconv_t) -1)
 		return FALSE;
 
 	outlen = inlen * 6 + 16;
 	outbuf = outbase = g_malloc(outlen);
 	
-	if (e_iconv (ic, &inbuf, &inlen, &outbuf, &outlen) == (size_t) -1) {
+	if (camel_iconv (ic, &inbuf, &inlen, &outbuf, &outlen) == (size_t) -1) {
 		w(g_warning("Conversion to '%s' failed: %s", charset, strerror (errno)));
 		g_free(outbase);
-		e_iconv_close (ic);
+		camel_iconv_close (ic);
 		return FALSE;
 	}
 	
-	e_iconv (ic, NULL, NULL, &outbuf, &outlen);
+	camel_iconv (ic, NULL, NULL, &outbuf, &outlen);
 	
 	*outbuf = 0;
 	g_string_append(out, outbase);
 	g_free(outbase);
-	e_iconv_close (ic);
+	camel_iconv_close (ic);
 
 	return TRUE;
 	
@@ -1192,7 +1192,7 @@ header_decode_text (const char *in, size
 	char *dword = NULL;
 	guint32 mask;
 	
-	locale_charset = e_iconv_locale_charset ();
+	locale_charset = camel_iconv_locale_charset ();
 	
 	if (ctext) {
 		mask = (CAMEL_MIME_IS_SPECIAL | CAMEL_MIME_IS_SPACE | CAMEL_MIME_IS_CTRL);
@@ -1311,7 +1311,7 @@ rfc2047_encode_word(GString *outstring, 
 	ascii = g_alloca (bufflen);
 	
 	if (g_ascii_strcasecmp (type, "UTF-8") != 0)
-		ic = e_iconv_open (type, "UTF-8");
+		ic = camel_iconv_open (type, "UTF-8");
 	
 	while (inlen) {
 		size_t convlen, proclen;
@@ -1361,13 +1361,13 @@ rfc2047_encode_word(GString *outstring, 
 			   hopefully-small-enough chunks, and leave it at that */
 			convlen = MIN(inlen, CAMEL_FOLD_PREENCODED);
 			p = inptr;
-			if (e_iconv (ic, &inptr, &convlen, &out, &outlen) == (size_t) -1 && errno != EINVAL) {
+			if (camel_iconv (ic, &inptr, &convlen, &out, &outlen) == (size_t) -1 && errno != EINVAL) {
 				w(g_warning("Conversion problem: conversion truncated: %s", strerror (errno)));
 				/* blah, we include it anyway, better than infinite loop ... */
 				inptr += convlen;
 			} else {
 				/* make sure we flush out any shift state */
-				e_iconv (ic, NULL, 0, &out, &outlen);
+				camel_iconv (ic, NULL, 0, &out, &outlen);
 			}
 			inlen -= (inptr - p);
 		}
@@ -1392,7 +1392,7 @@ rfc2047_encode_word(GString *outstring, 
 	}
 	
 	if (ic != (iconv_t) -1)
-		e_iconv_close (ic);
+		camel_iconv_close (ic);
 }
 
 
@@ -1990,20 +1990,20 @@ header_convert(const char *to, const cha
 	size_t outlen, ret;
 	char *outbuf, *outbase, *result = NULL;
 
-	ic = e_iconv_open(to, from);
+	ic = camel_iconv_open(to, from);
 	if (ic == (iconv_t) -1)
 		return NULL;
 
 	outlen = inlen * 6 + 16;
 	outbuf = outbase = g_malloc(outlen);
 			
-	ret = e_iconv(ic, &in, &inlen, &outbuf, &outlen);
+	ret = camel_iconv(ic, &in, &inlen, &outbuf, &outlen);
 	if (ret != (size_t) -1) {
-		e_iconv(ic, NULL, 0, &outbuf, &outlen);
+		camel_iconv(ic, NULL, 0, &outbuf, &outlen);
 		*outbuf = '\0';
 		result = g_strdup(outbase);
 	}
-	e_iconv_close(ic);
+	camel_iconv_close(ic);
 	g_free(outbase);
 
 	return result;
@@ -2028,7 +2028,7 @@ rfc2184_decode (const char *in, size_t l
 	encoding = g_alloca(inptr-in+1);
 	memcpy(encoding, in, inptr-in);
 	encoding[inptr-in] = 0;
-	charset = e_iconv_charset_name (encoding);
+	charset = camel_iconv_charset_name (encoding);
 	
 	inptr = memchr (inptr + 1, '\'', inend - inptr - 1);
 	if (!inptr)
@@ -2573,7 +2573,7 @@ header_decode_mailbox(const char **in, c
 			const char *locale_charset;
 			GString *out;
 			
-			locale_charset = e_iconv_locale_charset ();
+			locale_charset = camel_iconv_locale_charset ();
 			
 			out = g_string_new ("");
 			
@@ -3078,7 +3078,7 @@ header_append_param(struct _camel_header
 	    && (node->value = header_decode_text(value, strlen(value), FALSE, NULL))) {
 		g_free(value);
 	} else if (g_ascii_strcasecmp (name, "boundary") != 0 && !g_utf8_validate(value, -1, NULL)) {
-		const char *charset = e_iconv_locale_charset();
+		const char *charset = camel_iconv_locale_charset();
 		
 		if ((node->value = header_convert("UTF-8", charset?charset:"ISO-8859-1", value, strlen(value)))) {
 			g_free(value);
Index: camel/camel-net-utils.c
===================================================================
--- camel/camel-net-utils.c	(revision 7789)
+++ camel/camel-net-utils.c	(working copy)
@@ -36,9 +36,8 @@
 #include <glib.h>
 #include <glib/gi18n-lib.h>
 
-#include <libedataserver/e-msgport.h>
-
 #include "camel-exception.h"
+#include "camel-msgport.h"
 #include "camel-net-utils.h"
 #include "camel-operation.h"
 
@@ -399,7 +398,7 @@ camel_gethostbyaddr_r (const char *addr,
 
 /* ********************************************************************** */
 struct _addrinfo_msg {
-	EMsg msg;
+	CamelMsg msg;
 	unsigned int cancelled:1;
 
 	/* for host lookup */
@@ -441,7 +440,7 @@ cs_freeinfo(struct _addrinfo_msg *msg)
 static int
 cs_waitinfo(void *(worker)(void *), struct _addrinfo_msg *msg, const char *error, CamelException *ex)
 {
-	EMsgPort *reply_port;
+	CamelMsgPort *reply_port;
 	pthread_t id;
 	int err, cancel_fd, cancel = 0, fd;
 
@@ -451,8 +450,8 @@ cs_waitinfo(void *(worker)(void *), stru
 		return 0;
 	}
 	
-	reply_port = msg->msg.reply_port = e_msgport_new();
-	fd = e_msgport_fd(msg->msg.reply_port);
+	reply_port = msg->msg.reply_port = camel_msgport_new();
+	fd = camel_msgport_fd(msg->msg.reply_port);
 	if ((err = pthread_create(&id, NULL, worker, msg)) == 0) {
 		int status;
 #ifndef G_OS_WIN32
@@ -506,7 +505,7 @@ cs_waitinfo(void *(worker)(void *), stru
 			pthread_cancel(id);
 			cancel = 1;
 		} else {
-			struct _addrinfo_msg *reply = (struct _addrinfo_msg *)e_msgport_get(reply_port);
+			struct _addrinfo_msg *reply = (struct _addrinfo_msg *)camel_msgport_try_pop(reply_port);
 
 			g_assert(reply == msg);
 			d(printf("waiting for child to exit\n"));
@@ -516,7 +515,7 @@ cs_waitinfo(void *(worker)(void *), stru
 	} else {
 		camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "%s: %s: %s", error, _("cannot create thread"), g_strerror(err));
 	}
-	e_msgport_destroy(reply_port);
+	camel_msgport_destroy(reply_port);
 
 	return cancel;
 }
@@ -622,7 +621,7 @@ cs_getaddrinfo(void *data)
 		}
 	}
 reply:
-	e_msgport_reply((EMsg *)msg);
+	camel_msgport_reply((CamelMsg *)msg);
 	return NULL;
 cancel:
 	cs_freeinfo(msg);
@@ -639,7 +638,7 @@ cs_getaddrinfo(void *data)
 	if (info->cancelled) {
 		g_free(info);
 	} else {
-		e_msgport_reply((EMsg *)info);
+		camel_msgport_reply((CamelMsg *)info);
 	}
 	
 	return NULL;
@@ -757,7 +756,7 @@ cs_getnameinfo(void *data)
 	if (msg->serv)
 		sprintf(msg->serv, "%d", sin->sin_port);
 
-	e_msgport_reply((EMsg *)msg);
+	camel_msgport_reply((CamelMsg *)msg);
 	return NULL;
 cancel:
 	cs_freeinfo(msg);
@@ -775,7 +774,7 @@ cs_getnameinfo(void *data)
 	if (msg->cancelled)
 		cs_freeinfo(msg);
 	else
-		e_msgport_reply((EMsg *)msg);
+		camel_msgport_reply((CamelMsg *)msg);
 
 	return NULL;
 }
Index: camel/camel-operation.c
===================================================================
--- camel/camel-operation.c	(revision 7789)
+++ camel/camel-operation.c	(working copy)
@@ -35,9 +35,10 @@
 
 #include <glib.h>
 
-#include <libedataserver/e-msgport.h>
+#include <libedataserver/e-msgport.h>  /* for EDList */
 
 #include "camel-operation.h"
+#include "camel-msgport.h"
 
 #define d(x)
 
@@ -67,7 +68,7 @@ struct _CamelOperation {
 	GSList *status_stack;
 	struct _status_stack *lastreport;
 
-	EMsgPort *cancel_port;
+	CamelMsgPort *cancel_port;
 	int cancel_fd;
 #ifdef HAVE_NSS
 	PRFileDesc *cancel_prfd;
@@ -91,7 +92,7 @@ static pthread_key_t operation_key;
 static pthread_once_t operation_once = PTHREAD_ONCE_INIT;
 
 typedef struct _CamelOperationMsg {
-	EMsg msg;
+	CamelMsg msg;
 } CamelOperationMsg ;
 
 static void
@@ -134,7 +135,7 @@ camel_operation_new (CamelOperationStatu
 	cc->refcount = 1;
 	cc->status = status;
 	cc->status_data = status_data;
-	cc->cancel_port = e_msgport_new();
+	cc->cancel_port = camel_msgport_new();
 	cc->cancel_fd = -1;
 
 	LOCK();
@@ -211,10 +212,10 @@ camel_operation_unref (CamelOperation *c
 		
 		e_dlist_remove((EDListNode *)cc);
 
-		while ((msg = (CamelOperationMsg *)e_msgport_get(cc->cancel_port)))
+		while ((msg = (CamelOperationMsg *)camel_msgport_try_pop(cc->cancel_port)))
 			g_free(msg);
 
-		e_msgport_destroy(cc->cancel_port);
+		camel_msgport_destroy(cc->cancel_port);
 		
 		n = cc->status_stack;
 		while (n) {
@@ -294,7 +295,7 @@ camel_operation_cancel (CamelOperation *
 		while (cn) {
 			cc->flags |= CAMEL_OPERATION_CANCELLED;
 			msg = g_malloc0(sizeof(*msg));
-			e_msgport_put(cc->cancel_port, (EMsg *)msg);
+			camel_msgport_push(cc->cancel_port, (CamelMsg *)msg);
 			cc = cn;
 			cn = cn->next;
 		}
@@ -303,7 +304,7 @@ camel_operation_cancel (CamelOperation *
 
 		cc->flags |= CAMEL_OPERATION_CANCELLED;
 		msg = g_malloc0(sizeof(*msg));
-		e_msgport_put(cc->cancel_port, (EMsg *)msg);
+		camel_msgport_push(cc->cancel_port, (CamelMsg *)msg);
 	}
 
 	UNLOCK();
@@ -330,7 +331,7 @@ camel_operation_uncancel(CamelOperation 
 		CamelOperationMsg *msg;
 
 		LOCK();
-		while ((msg = (CamelOperationMsg *)e_msgport_get(cc->cancel_port)))
+		while ((msg = (CamelOperationMsg *)camel_msgport_try_pop(cc->cancel_port)))
 			g_free(msg);
 
 		cc->flags &= ~CAMEL_OPERATION_CANCELLED;
@@ -403,11 +404,11 @@ camel_operation_cancel_check (CamelOpera
 	} else if (cc->flags & CAMEL_OPERATION_CANCELLED) {
 		d(printf("previously cancelled\n"));
 		cancelled = TRUE;
-	} else if ((msg = (CamelOperationMsg *)e_msgport_get(cc->cancel_port))) {
+	} else if ((msg = (CamelOperationMsg *)camel_msgport_try_pop(cc->cancel_port))) {
 		d(printf("Got cancellation message\n"));
 		do {
 			g_free(msg);
-		} while ((msg = (CamelOperationMsg *)e_msgport_get(cc->cancel_port)));
+		} while ((msg = (CamelOperationMsg *)camel_msgport_try_pop(cc->cancel_port)));
 		cc->flags |= CAMEL_OPERATION_CANCELLED;
 		cancelled = TRUE;
 	} else
@@ -440,7 +441,7 @@ camel_operation_cancel_fd (CamelOperatio
 	LOCK();
 
 	if (cc->cancel_fd == -1)
-		cc->cancel_fd = e_msgport_fd(cc->cancel_port);
+		cc->cancel_fd = camel_msgport_fd(cc->cancel_port);
 
 	UNLOCK();
 
@@ -470,7 +471,7 @@ camel_operation_cancel_prfd (CamelOperat
 	LOCK();
 
 	if (cc->cancel_prfd == NULL)
-		cc->cancel_prfd = e_msgport_prfd(cc->cancel_port);
+		cc->cancel_prfd = camel_msgport_prfd(cc->cancel_port);
 
 	UNLOCK();
 
Index: camel/camel-multipart.c
===================================================================
--- camel/camel-multipart.c	(revision 7789)
+++ camel/camel-multipart.c	(working copy)
@@ -31,9 +31,8 @@
 #include <time.h>   /* for time */
 #include <unistd.h> /* for getpid */
 
-#include <libedataserver/md5-utils.h>
-
 #include "camel-exception.h"
+#include "camel-md5-utils.h"
 #include "camel-mime-part.h"
 #include "camel-multipart.h"
 #include "camel-stream-mem.h"
@@ -363,7 +362,7 @@ set_boundary (CamelMultipart *multipart,
 		bgen = g_strdup_printf ("%p:%lu:%lu", multipart,
 					(unsigned long) getpid(),
 					(unsigned long) time(0));
-		md5_get_digest (bgen, strlen (bgen), digest);
+		camel_md5_get_digest (bgen, strlen (bgen), digest);
 		g_free (bgen);
 		strcpy (bbuf, "=-");
 		p = bbuf + 2;
Index: camel/camel-vee-folder.c
===================================================================
--- camel/camel-vee-folder.c	(revision 7789)
+++ camel/camel-vee-folder.c	(working copy)
@@ -29,8 +29,6 @@
 #include <glib.h>
 #include <glib/gi18n-lib.h>
 
-#include <libedataserver/md5-utils.h>
-
 #if defined (DOEPOOLV) || defined (DOESTRV)
 #include <libedataserver/e-memory.h>
 #endif
@@ -38,6 +36,7 @@
 #include "camel-debug.h"
 #include "camel-exception.h"
 #include "camel-folder-search.h"
+#include "camel-md5-utils.h"
 #include "camel-mime-message.h"
 #include "camel-private.h"
 #include "camel-session.h"
@@ -377,18 +376,18 @@ camel_vee_folder_set_folders(CamelVeeFol
 void
 camel_vee_folder_hash_folder(CamelFolder *folder, char buffer[8])
 {
-	MD5Context ctx;
+	CamelMD5Context ctx;
 	unsigned char digest[16];
 	unsigned int state = 0, save = 0;
 	char *tmp;
 	int i;
 
-	md5_init(&ctx);
+	camel_md5_init(&ctx);
 	tmp = camel_service_get_url((CamelService *)folder->parent_store);
-	md5_update(&ctx, tmp, strlen(tmp));
+	camel_md5_update(&ctx, tmp, strlen(tmp));
 	g_free(tmp);
-	md5_update(&ctx, folder->full_name, strlen(folder->full_name));
-	md5_final(&ctx, digest);
+	camel_md5_update(&ctx, folder->full_name, strlen(folder->full_name));
+	camel_md5_final(&ctx, digest);
 	camel_base64_encode_close(digest, 6, FALSE, buffer, &state, &save);
 
 	for (i=0;i<8;i++) {
Index: camel/camel-mime-part-utils.c
===================================================================
--- camel/camel-mime-part-utils.c	(revision 7789)
+++ camel/camel-mime-part-utils.c	(working copy)
@@ -32,8 +32,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <libedataserver/e-iconv.h>
-
 #include "camel-charset-map.h"
 #include "camel-html-parser.h"
 #include "camel-mime-filter-basic.h"
Index: camel/camel-mime-part.c
===================================================================
--- camel/camel-mime-part.c	(revision 7789)
+++ camel/camel-mime-part.c	(working copy)
@@ -33,10 +33,9 @@
 #include <stdio.h>
 #include <string.h>
 
-#include <libedataserver/e-iconv.h>
-
 #include "camel-charset-map.h"
 #include "camel-exception.h"
+#include "camel-iconv.h"
 #include "camel-mime-filter-basic.h"
 #include "camel-mime-filter-charset.h"
 #include "camel-mime-filter-crlf.h"
@@ -227,7 +226,7 @@ process_header(CamelMedium *medium, cons
 		g_free (mime_part->description);
 		if (((CamelDataWrapper *) mime_part)->mime_type) {
 			charset = camel_content_type_param (((CamelDataWrapper *) mime_part)->mime_type, "charset");
-			charset = e_iconv_charset_name (charset);
+			charset = camel_iconv_charset_name (charset);
 		} else
 			charset = NULL;
 		mime_part->description = g_strstrip (camel_header_decode_string (value, charset));
@@ -831,8 +830,8 @@ write_to_stream (CamelDataWrapper *dw, C
 			part_charset = camel_content_type_param (dw->mime_type, "charset");
 			
 			if (content_charset && part_charset) {
-				content_charset = e_iconv_charset_name (content_charset);
-				part_charset = e_iconv_charset_name (part_charset);
+				content_charset = camel_iconv_charset_name (content_charset);
+				part_charset = camel_iconv_charset_name (part_charset);
 			}
 		}
 		
Index: camel/Makefile.am
===================================================================
--- camel/Makefile.am	(revision 7789)
+++ camel/Makefile.am	(working copy)
@@ -161,11 +161,13 @@ libcamel_1_2_la_SOURCES = 			\
 	camel-exception.c			\
 	camel-file-utils.c			\
 	camel-html-parser.c			\
+	camel-iconv.c				\
 	camel-index.c				\
 	camel-internet-address.c		\
 	camel-junk-plugin.c			\
 	camel-list-utils.c			\
 	camel-lock.c				\
+	camel-md5-utils.c			\
 	camel-medium.c				\
 	camel-mime-filter-basic.c		\
 	camel-mime-filter-bestenc.c		\
@@ -190,6 +192,7 @@ libcamel_1_2_la_SOURCES = 			\
 	camel-mime-part.c			\
 	camel-mime-utils.c			\
 	camel-mime-tables.c			\
+	camel-msgport.c				\
 	camel-multipart-encrypted.c		\
 	camel-multipart-signed.c		\
 	camel-multipart.c			\
@@ -209,6 +212,7 @@ libcamel_1_2_la_SOURCES = 			\
 	camel-stream.c				\
 	camel-string-utils.c			\
 	camel-text-index.c			\
+	camel-trie.c				\
 	camel-url-scanner.c			\
 	camel-url.c				\
 	camel-utf8.c				\
@@ -229,12 +233,14 @@ libcamelinclude_HEADERS =			\
 	camel-exception.h			\
 	camel-file-utils.h			\
 	camel-i18n.h				\
+	camel-iconv.h				\
 	camel-index.h				\
 	camel-internet-address.h		\
 	camel-junk-plugin.h			\
 	camel-list-utils.h			\
 	camel-lock-client.h			\
 	camel-lock.h				\
+	camel-md5-utils.h			\
 	camel-medium.h				\
 	camel-mime-filter-basic.h		\
 	camel-mime-filter-bestenc.h		\
@@ -258,6 +264,7 @@ libcamelinclude_HEADERS =			\
 	camel-mime-part-utils.h			\
 	camel-mime-part.h			\
 	camel-mime-utils.h			\
+	camel-msgport.h				\
 	camel-multipart-encrypted.h		\
 	camel-multipart-signed.h		\
 	camel-multipart.h			\
@@ -279,6 +286,7 @@ libcamelinclude_HEADERS =			\
 	camel-stream.h				\
 	camel-string-utils.h			\
 	camel-text-index.h			\
+	camel-trie.h				\
 	camel-types.h				\
 	camel-url-scanner.h			\
 	camel-url.h				\
Index: camel/camel-multipart-signed.c
===================================================================
--- camel/camel-multipart-signed.c	(revision 7789)
+++ camel/camel-multipart-signed.c	(working copy)
@@ -37,8 +37,6 @@
 #include <glib.h>
 #include <glib/gi18n-lib.h>
 
-#include <libedataserver/md5-utils.h>
-
 #include "camel-exception.h"
 #include "camel-mime-filter-canon.h"
 #include "camel-mime-filter-crlf.h"
Index: camel/camel-charset-map.c
===================================================================
--- camel/camel-charset-map.c	(revision 7789)
+++ camel/camel-charset-map.c	(working copy)
@@ -32,6 +32,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "camel-iconv.h"
+
 /*
   if you want to build the charset map, compile this with something like:
     gcc -DBUILD_MAP camel-charset-map.c `glib-config --cflags`
@@ -212,8 +214,6 @@ int main (void)
 #include "camel-charset-map-private.h"
 #include "camel-utf8.h"
 
-#include <libedataserver/e-iconv.h>
-
 void
 camel_charset_init (CamelCharset *c)
 {
@@ -260,10 +260,10 @@ camel_charset_best_mask(unsigned int mas
 	const char *locale_lang, *lang;
 	int i;
 	
-	locale_lang = e_iconv_locale_language ();
+	locale_lang = camel_iconv_locale_language ();
 	for (i = 0; i < G_N_ELEMENTS (camel_charinfo); i++) {
 		if (camel_charinfo[i].bit & mask) {
-			lang = e_iconv_charset_language (camel_charinfo[i].name);
+			lang = camel_iconv_charset_language (camel_charinfo[i].name);
 			
 			if (!locale_lang || (lang && !strncmp (locale_lang, lang, 2)))
 				return camel_charinfo[i].name;
Index: camel/camel.h
===================================================================
--- camel/camel.h	(revision 7789)
+++ camel/camel.h	(working copy)
@@ -59,6 +59,7 @@
 #include <camel/camel-lock.h>
 #include <camel/camel-lock-client.h>
 #include <camel/camel-lock-helper.h>
+#include <camel/camel-md5-utils.h>
 #include <camel/camel-medium.h>
 #include <camel/camel-mime-filter.h>
 #include <camel/camel-mime-filter-basic.h>
@@ -82,6 +83,7 @@
 #include <camel/camel-mime-part-utils.h>
 #include <camel/camel-mime-utils.h>
 #include <camel/camel-movemail.h>
+#include <camel/camel-msgport.h>
 #include <camel/camel-multipart.h>
 #include <camel/camel-multipart-encrypted.h>
 #include <camel/camel-multipart-signed.h>
@@ -127,6 +129,7 @@
 #include <camel/camel-tcp-stream-ssl.h>
 #include <camel/camel-text-index.h>
 #include <camel/camel-transport.h>
+#include <camel/camel-trie.h>
 #include <camel/camel-types.h>
 #include <camel/camel-uid-cache.h>
 #include <camel/camel-url.h>
Index: camel/camel-iconv.h
===================================================================
--- camel/camel-iconv.h	(revision 7789)
+++ camel/camel-iconv.h	(working copy)
@@ -26,19 +26,24 @@
 
 #include <sys/types.h>
 #include <iconv.h>
+#include <glib.h>
 
 G_BEGIN_DECLS
 
-const char *camel_iconv_locale_charset (void);
-const char *camel_iconv_locale_language (void);
+const gchar *	camel_iconv_locale_charset	(void);
+const gchar *	camel_iconv_locale_language	(void);
 
-const char *camel_iconv_charset_name (const char *charset);
+const gchar *	camel_iconv_charset_name	(const gchar *charset);
+const gchar *	camel_iconv_charset_language	(const gchar *charset);
 
-const char *camel_iconv_charset_language (const char *charset);
-
-iconv_t camel_iconv_open (const char *to, const char *from);
-size_t camel_iconv (iconv_t cd, const char **inbuf, size_t *inleft, char **outbuf, size_t *outleft);
-void camel_iconv_close (iconv_t cd);
+iconv_t		camel_iconv_open		(const gchar *to,
+						 const gchar *from);
+gsize		camel_iconv			(iconv_t cd,
+						 const gchar **inbuf,
+						 gsize *inleft,
+						 gchar **outbuf,
+						 gsize *outleft);
+void		camel_iconv_close		(iconv_t cd);
 
 G_END_DECLS
 
Index: camel/camel-store-summary.c
===================================================================
--- camel/camel-store-summary.c	(revision 7789)
+++ camel/camel-store-summary.c	(working copy)
@@ -36,7 +36,6 @@
 #include <glib/gstdio.h>
 
 #include <libedataserver/e-memory.h>
-#include <libedataserver/md5-utils.h>
 
 #include "camel-file-utils.h"
 #include "camel-private.h"
Index: camel/camel-url-scanner.c
===================================================================
--- camel/camel-url-scanner.c	(revision 7789)
+++ camel/camel-url-scanner.c	(working copy)
@@ -29,14 +29,13 @@
 #include <stdio.h>
 #include <string.h>
 
-#include <libedataserver/e-trie.h>
-
+#include "camel-trie.h"
 #include "camel-url-scanner.h"
 #include "camel-utf8.h"
 
 struct _CamelUrlScanner {
 	GPtrArray *patterns;
-	ETrie *trie;
+	CamelTrie *trie;
 };
 
 
@@ -47,7 +46,7 @@ camel_url_scanner_new (void)
 	
 	scanner = g_new (CamelUrlScanner, 1);
 	scanner->patterns = g_ptr_array_new ();
-	scanner->trie = e_trie_new (TRUE);
+	scanner->trie = camel_trie_new (TRUE);
 	
 	return scanner;
 }
@@ -59,7 +58,7 @@ camel_url_scanner_free (CamelUrlScanner 
 	g_return_if_fail (scanner != NULL);
 	
 	g_ptr_array_free (scanner->patterns, TRUE);
-	e_trie_free (scanner->trie);
+	camel_trie_free (scanner->trie);
 	g_free (scanner);
 }
 
@@ -69,7 +68,7 @@ camel_url_scanner_add (CamelUrlScanner *
 {
 	g_return_if_fail (scanner != NULL);
 	
-	e_trie_add (scanner->trie, pattern->pattern, scanner->patterns->len);
+	camel_trie_add (scanner->trie, pattern->pattern, scanner->patterns->len);
 	g_ptr_array_add (scanner->patterns, pattern);
 }
 
@@ -88,7 +87,7 @@ camel_url_scanner_scan (CamelUrlScanner 
 	inend = in + inlen;
 	
 	do {
-		if (!(pos = e_trie_search (scanner->trie, inptr, inlen, &pattern)))
+		if (!(pos = camel_trie_search (scanner->trie, inptr, inlen, &pattern)))
 			return FALSE;
 		
 		pat = g_ptr_array_index (scanner->patterns, pattern);
Index: camel/camel-sasl-digest-md5.c
===================================================================
--- camel/camel-sasl-digest-md5.c	(revision 7789)
+++ camel/camel-sasl-digest-md5.c	(working copy)
@@ -32,10 +32,9 @@
 #include <glib.h>
 #include <glib/gi18n-lib.h>
 
-#include <libedataserver/e-iconv.h>
-#include <libedataserver/md5-utils.h>
-
 #include "camel-charset-map.h"
+#include "camel-iconv.h"
+#include "camel-md5-utils.h"
 #include "camel-mime-utils.h"
 #include "camel-net-utils.h"
 #include "camel-sasl-digest-md5.h"
@@ -563,68 +562,68 @@ compute_response (struct _DigestResponse
 {
 	guchar hex_a1[33], hex_a2[33];
 	guchar digest[16];
-	MD5Context ctx;
+	CamelMD5Context ctx;
 	char *buf;
 	
 	/* compute A1 */
-	md5_init (&ctx);
-	md5_update (&ctx, resp->username, strlen (resp->username));
-	md5_update (&ctx, ":", 1);
-	md5_update (&ctx, resp->realm, strlen (resp->realm));
-	md5_update (&ctx, ":", 1);
-	md5_update (&ctx, passwd, strlen (passwd));
-	md5_final (&ctx, digest);
-	
-	md5_init (&ctx);
-	md5_update (&ctx, digest, 16);
-	md5_update (&ctx, ":", 1);
-	md5_update (&ctx, resp->nonce, strlen (resp->nonce));
-	md5_update (&ctx, ":", 1);
-	md5_update (&ctx, resp->cnonce, strlen (resp->cnonce));
+	camel_md5_init (&ctx);
+	camel_md5_update (&ctx, resp->username, strlen (resp->username));
+	camel_md5_update (&ctx, ":", 1);
+	camel_md5_update (&ctx, resp->realm, strlen (resp->realm));
+	camel_md5_update (&ctx, ":", 1);
+	camel_md5_update (&ctx, passwd, strlen (passwd));
+	camel_md5_final (&ctx, digest);
+	
+	camel_md5_init (&ctx);
+	camel_md5_update (&ctx, digest, 16);
+	camel_md5_update (&ctx, ":", 1);
+	camel_md5_update (&ctx, resp->nonce, strlen (resp->nonce));
+	camel_md5_update (&ctx, ":", 1);
+	camel_md5_update (&ctx, resp->cnonce, strlen (resp->cnonce));
 	if (resp->authzid) {
-		md5_update (&ctx, ":", 1);
-		md5_update (&ctx, resp->authzid, strlen (resp->authzid));
+		camel_md5_update (&ctx, ":", 1);
+		camel_md5_update (&ctx, resp->authzid, strlen (resp->authzid));
 	}
 	
 	/* hexify A1 */
-	md5_final (&ctx, digest);
+	camel_md5_final (&ctx, digest);
 	digest_hex (digest, hex_a1);
 	
 	/* compute A2 */
-	md5_init (&ctx);
+	camel_md5_init (&ctx);
 	if (client) {
 		/* we are calculating the client response */
-		md5_update (&ctx, "AUTHENTICATE:", strlen ("AUTHENTICATE:"));
+		camel_md5_update (&ctx, "AUTHENTICATE:", strlen ("AUTHENTICATE:"));
 	} else {
 		/* we are calculating the server rspauth */
-		md5_update (&ctx, ":", 1);
+		camel_md5_update (&ctx, ":", 1);
 	}
 	
 	buf = digest_uri_to_string (resp->uri);
-	md5_update (&ctx, buf, strlen (buf));
+	camel_md5_update (&ctx, buf, strlen (buf));
 	g_free (buf);
 	
 	if (resp->qop == QOP_AUTH_INT || resp->qop == QOP_AUTH_CONF)
-		md5_update (&ctx, ":00000000000000000000000000000000", 33);
+		camel_md5_update (&ctx, ":00000000000000000000000000000000", 33);
 	
 	/* now hexify A2 */
-	md5_final (&ctx, digest);
+	camel_md5_final (&ctx, digest);
 	digest_hex (digest, hex_a2);
 	
 	/* compute KD */
-	md5_init (&ctx);
-	md5_update (&ctx, hex_a1, 32);
-	md5_update (&ctx, ":", 1);
-	md5_update (&ctx, resp->nonce, strlen (resp->nonce));
-	md5_update (&ctx, ":", 1);
-	md5_update (&ctx, resp->nc, 8);
-	md5_update (&ctx, ":", 1);
-	md5_update (&ctx, resp->cnonce, strlen (resp->cnonce));
-	md5_update (&ctx, ":", 1);
-	md5_update (&ctx, qop_to_string (resp->qop), strlen (qop_to_string (resp->qop)));
-	md5_update (&ctx, ":", 1);
-	md5_update (&ctx, hex_a2, 32);
-	md5_final (&ctx, digest);
+	camel_md5_init (&ctx);
+	camel_md5_update (&ctx, hex_a1, 32);
+	camel_md5_update (&ctx, ":", 1);
+	camel_md5_update (&ctx, resp->nonce, strlen (resp->nonce));
+	camel_md5_update (&ctx, ":", 1);
+	camel_md5_update (&ctx, resp->nc, 8);
+	camel_md5_update (&ctx, ":", 1);
+	camel_md5_update (&ctx, resp->cnonce, strlen (resp->cnonce));
+	camel_md5_update (&ctx, ":", 1);
+	camel_md5_update (&ctx, qop_to_string (resp->qop), strlen (qop_to_string (resp->qop)));
+	camel_md5_update (&ctx, ":", 1);
+	camel_md5_update (&ctx, hex_a2, 32);
+	camel_md5_final (&ctx, digest);
 	
 	digest_hex (digest, out);
 }
@@ -651,7 +650,7 @@ generate_response (struct _DigestChallen
 	bgen = g_strdup_printf ("%p:%lu:%lu", resp,
 				(unsigned long) getpid (),
 				(unsigned long) time (0));
-	md5_get_digest (bgen, strlen (bgen), digest);
+	camel_md5_get_digest (bgen, strlen (bgen), digest);
 	g_free (bgen);
 	/* take our recommended 64 bits of entropy */
 	resp->cnonce = camel_base64_encode_simple (digest, 8);
@@ -710,18 +709,18 @@ digest_response (struct _DigestResponse 
 		const char *inbuf;
 		iconv_t cd;
 		
-		charset = e_iconv_locale_charset ();
+		charset = camel_iconv_locale_charset ();
 		if (!charset)
 			charset = "iso-8859-1";
 		
-		cd = e_iconv_open (resp->charset, charset);
+		cd = camel_iconv_open (resp->charset, charset);
 		
 		len = strlen (resp->username);
 		outlen = 2 * len; /* plenty of space */
 		
 		outbuf = username = g_malloc0 (outlen + 1);
 		inbuf = resp->username;
-		if (cd == (iconv_t) -1 || e_iconv (cd, &inbuf, &len, &outbuf, &outlen) == (size_t) -1) {
+		if (cd == (iconv_t) -1 || camel_iconv (cd, &inbuf, &len, &outbuf, &outlen) == (size_t) -1) {
 			/* We can't convert to UTF-8 - pretend we never got a charset param? */
 			g_free (resp->charset);
 			resp->charset = NULL;
@@ -732,7 +731,7 @@ digest_response (struct _DigestResponse 
 		}
 		
 		if (cd != (iconv_t) -1)
-			e_iconv_close (cd);
+			camel_iconv_close (cd);
 		
 		g_byte_array_append (buffer, username, strlen (username));
 		g_free (username);
Index: camel/camel-mime-message.c
===================================================================
--- camel/camel-mime-message.c	(revision 7789)
+++ camel/camel-mime-message.c	(working copy)
@@ -32,9 +32,9 @@
 #include <stdio.h>
 #include <string.h>
 
-#include <libedataserver/e-iconv.h>
 #include <libedataserver/e-time-utils.h>
 
+#include "camel-iconv.h"
 #include "camel-mime-filter-bestenc.h"
 #include "camel-mime-filter-charset.h"
 #include "camel-mime-message.h"
@@ -678,7 +678,7 @@ process_header (CamelMedium *medium, con
 		g_free (message->subject);
 		if (((CamelDataWrapper *) message)->mime_type) {
 			charset = camel_content_type_param (((CamelDataWrapper *) message)->mime_type, "charset");
-			charset = e_iconv_charset_name (charset);
+			charset = camel_iconv_charset_name (charset);
 		} else
 			charset = NULL;
 		message->subject = g_strstrip (camel_header_decode_string (value, charset));
Index: camel/camel-gpg-context.c
===================================================================
--- camel/camel-gpg-context.c	(revision 7789)
+++ camel/camel-gpg-context.c	(working copy)
@@ -53,10 +53,9 @@
 #include <glib/gi18n-lib.h>
 #include <glib/gstdio.h>
 
-#include <libedataserver/e-iconv.h>
-
 #include "camel-debug.h"
 #include "camel-gpg-context.h"
+#include "camel-iconv.h"
 #include "camel-mime-filter-canon.h"
 #include "camel-mime-filter-charset.h"
 #include "camel-mime-part.h"
@@ -298,7 +297,7 @@ gpg_ctx_new (CamelSession *session)
 	gpg->diagbuf = CAMEL_STREAM_MEM (stream)->buffer;
 	gpg->diagflushed = FALSE;
 	
-	if ((charset = e_iconv_locale_charset ()) && g_ascii_strcasecmp (charset, "UTF-8") != 0) {
+	if ((charset = camel_iconv_locale_charset ()) && g_ascii_strcasecmp (charset, "UTF-8") != 0) {
 		CamelMimeFilterCharset *filter;
 		CamelStreamFilter *fstream;
 		
Index: camel/camel-sasl-cram-md5.c
===================================================================
--- camel/camel-sasl-cram-md5.c	(revision 7789)
+++ camel/camel-sasl-cram-md5.c	(working copy)
@@ -30,8 +30,7 @@
 #include <glib.h>
 #include <glib/gi18n-lib.h>
 
-#include <libedataserver/md5-utils.h>
-
+#include "camel-md5-utils.h"
 #include "camel-mime-utils.h"
 #include "camel-sasl-cram-md5.h"
 #include "camel-service.h"
@@ -95,7 +94,7 @@ cram_md5_challenge (CamelSasl *sasl, GBy
 	GByteArray *ret = NULL;
 	guchar ipad[64];
 	guchar opad[64];
-	MD5Context ctx;
+	CamelMD5Context ctx;
 	int i, pw_len;
 	
 	/* Need to wait for the server */
@@ -113,7 +112,7 @@ cram_md5_challenge (CamelSasl *sasl, GBy
 		memcpy (ipad, passwd, pw_len);
 		memcpy (opad, passwd, pw_len);
 	} else {
-		md5_get_digest (passwd, pw_len, ipad);
+		camel_md5_get_digest (passwd, pw_len, ipad);
 		memcpy (opad, ipad, 16);
 	}
 	
@@ -122,15 +121,15 @@ cram_md5_challenge (CamelSasl *sasl, GBy
 		opad[i] ^= 0x5c;
 	}
 	
-	md5_init (&ctx);
-	md5_update (&ctx, ipad, 64);
-	md5_update (&ctx, token->data, token->len);
-	md5_final (&ctx, digest);
-	
-	md5_init (&ctx);
-	md5_update (&ctx, opad, 64);
-	md5_update (&ctx, digest, 16);
-	md5_final (&ctx, digest);
+	camel_md5_init (&ctx);
+	camel_md5_update (&ctx, ipad, 64);
+	camel_md5_update (&ctx, token->data, token->len);
+	camel_md5_final (&ctx, digest);
+	
+	camel_md5_init (&ctx);
+	camel_md5_update (&ctx, opad, 64);
+	camel_md5_update (&ctx, digest, 16);
+	camel_md5_final (&ctx, digest);
 	
 	/* lowercase hexify that bad-boy... */
 	for (s = digest, p = md5asc; p < md5asc + 32; s++, p += 2)
Index: camel/camel-mime-filter-charset.c
===================================================================
--- camel/camel-mime-filter-charset.c	(revision 7789)
+++ camel/camel-mime-filter-charset.c	(working copy)
@@ -27,9 +27,8 @@
 #include <errno.h>
 #include <string.h>
 
-#include <libedataserver/e-iconv.h>
-
 #include "camel-charset-map.h"
+#include "camel-iconv.h"
 #include "camel-mime-filter-charset.h"
 
 #define d(x)
@@ -67,7 +66,7 @@ camel_mime_filter_charset_finalize(Camel
 	g_free(f->from);
 	g_free(f->to);
 	if (f->ic != (iconv_t) -1) {
-		e_iconv_close (f->ic);
+		camel_iconv_close (f->ic);
 		f->ic = (iconv_t) -1;
 	}
 }
@@ -83,7 +82,7 @@ reset(CamelMimeFilter *mf)
 	/* what happens with the output bytes if this resets the state? */
 	if (f->ic != (iconv_t) -1) {
 		buffer = buf;
-		e_iconv (f->ic, NULL, 0, &buffer, &outlen);
+		camel_iconv (f->ic, NULL, 0, &buffer, &outlen);
 	}
 }
 
@@ -107,7 +106,7 @@ complete(CamelMimeFilter *mf, char *in, 
 	
 	if (inleft > 0) {
 		do {
-			converted = e_iconv (charset->ic, &inbuf, &inleft, &outbuf, &outleft);
+			converted = camel_iconv (charset->ic, &inbuf, &inleft, &outbuf, &outleft);
 			if (converted == (size_t) -1) {
 				if (errno == E2BIG) {
 					/*
@@ -147,7 +146,7 @@ complete(CamelMimeFilter *mf, char *in, 
 	}
 	
 	/* flush the iconv conversion */
-	e_iconv (charset->ic, NULL, NULL, &outbuf, &outleft);
+	camel_iconv (charset->ic, NULL, NULL, &outbuf, &outleft);
 	
 	*out = mf->outbuf;
 	*outlen = mf->outsize - outleft;
@@ -181,7 +180,7 @@ filter(CamelMimeFilter *mf, char *in, si
 	inleft = len;
 	
 	do {
-		converted = e_iconv (charset->ic, &inbuf, &inleft, &outbuf, &outleft);
+		converted = camel_iconv (charset->ic, &inbuf, &inleft, &outbuf, &outleft);
 		if (converted == (size_t) -1) {
 			if (errno == E2BIG || errno == EINVAL)
 				break;
@@ -273,7 +272,7 @@ camel_mime_filter_charset_new_convert (c
 	
 	new = CAMEL_MIME_FILTER_CHARSET (camel_object_new (camel_mime_filter_charset_get_type ()));
 	
-	new->ic = e_iconv_open (to_charset, from_charset);
+	new->ic = camel_iconv_open (to_charset, from_charset);
 	if (new->ic == (iconv_t) -1) {
 		w(g_warning ("Cannot create charset conversion from %s to %s: %s",
 			     from_charset ? from_charset : "(null)",
Index: camel/camel-folder-summary.c
===================================================================
--- camel/camel-folder-summary.c	(revision 7789)
+++ camel/camel-folder-summary.c	(working copy)
@@ -36,13 +36,13 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#include <libedataserver/e-iconv.h>
 #include <libedataserver/e-memory.h>
-#include <libedataserver/md5-utils.h>
 
 #include "camel-file-utils.h"
 #include "camel-folder-summary.h"
 #include "camel-folder.h"
+#include "camel-iconv.h"
+#include "camel-md5-utils.h"
 #include "camel-mime-filter-basic.h"
 #include "camel-mime-filter-charset.h"
 #include "camel-mime-filter-html.h"
@@ -1734,7 +1734,7 @@ message_info_new_from_header(CamelFolder
 	     && (g_ascii_strcasecmp(charset, "us-ascii") == 0))
 		charset = NULL;
 	
-	charset = charset ? e_iconv_charset_name (charset) : NULL;
+	charset = charset ? camel_iconv_charset_name (charset) : NULL;
 	
 	subject = summary_format_string(h, "subject", charset);
 	from = summary_format_address(h, "from", charset);
@@ -1764,7 +1764,7 @@ message_info_new_from_header(CamelFolder
 
 	msgid = camel_header_msgid_decode(camel_header_raw_find(&h, "message-id", NULL));
 	if (msgid) {
-		md5_get_digest(msgid, strlen(msgid), digest);
+		camel_md5_get_digest(msgid, strlen(msgid), digest);
 		memcpy(mi->message_id.id.hash, digest, sizeof(mi->message_id.id.hash));
 		g_free(msgid);
 	}
@@ -1789,7 +1789,7 @@ message_info_new_from_header(CamelFolder
 		count = 0;
 		scan = refs;
 		while (scan) {
-			md5_get_digest(scan->id, strlen(scan->id), digest);
+			camel_md5_get_digest(scan->id, strlen(scan->id), digest);
 			memcpy(mi->references->references[count].id.hash, digest, sizeof(mi->message_id.id.hash));
 			count++;
 			scan = scan->next;
@@ -1983,7 +1983,7 @@ content_info_new_from_header(CamelFolder
 	
 	ci = camel_folder_summary_content_info_new (s);
 	
-	charset = e_iconv_locale_charset ();
+	charset = camel_iconv_locale_charset ();
 	ci->id = camel_header_msgid_decode (camel_header_raw_find (&h, "content-id", NULL));
 	ci->description = camel_header_decode_string (camel_header_raw_find (&h, "content-description", NULL), charset);
 	ci->encoding = camel_content_transfer_encoding_decode (camel_header_raw_find (&h, "content-transfer-encoding", NULL));
Index: camel/camel-tcp-stream-ssl.c
===================================================================
--- camel/camel-tcp-stream-ssl.c	(revision 7789)
+++ camel/camel-tcp-stream-ssl.c	(working copy)
@@ -56,10 +56,9 @@
 #include <glib/gi18n-lib.h>
 #include <glib/gstdio.h>
 
-#include <libedataserver/md5-utils.h>
-
 #include "camel-certdb.h"
 #include "camel-file-utils.h"
+#include "camel-md5-utils.h"
 #include "camel-operation.h"
 #include "camel-private.h"
 #include "camel-session.h"
@@ -658,7 +657,7 @@ cert_fingerprint(CERTCertificate *cert)
 	int i;
 	const char tohex[16] = "0123456789abcdef";
 
-	md5_get_digest (cert->derCert.data, cert->derCert.len, md5sum);
+	camel_md5_get_digest (cert->derCert.data, cert->derCert.len, md5sum);
 	for (i=0,f = fingerprint; i<16; i++) {
 		unsigned int c = md5sum[i];
 
Index: docs/reference/addressbook/libedata-book/tmpl/e-book-backend.sgml
===================================================================
--- docs/reference/addressbook/libedata-book/tmpl/e-book-backend.sgml	(revision 7789)
+++ docs/reference/addressbook/libedata-book/tmpl/e-book-backend.sgml	(working copy)
@@ -447,7 +447,7 @@ EBookBackend
 @cancel_operation: 
 @set_mode: 
 @last_client_gone: 
-@_pas_reserved0: 
+@sync: 
 @_pas_reserved1: 
 @_pas_reserved2: 
 @_pas_reserved3: 
Index: docs/reference/camel/camel-sections.txt
===================================================================
--- docs/reference/camel/camel-sections.txt	(revision 7789)
+++ docs/reference/camel/camel-sections.txt	(working copy)
@@ -629,6 +629,16 @@ camel_internet_address_get_type
 </SECTION>
 
 <SECTION>
+<FILE>camel-md5-utils</FILE>
+CamelMD5Context
+camel_md5_get_digest
+camel_md5_get_digest_from_file
+camel_md5_init
+camel_md5_update
+camel_md5_final
+</SECTION>
+
+<SECTION>
 <FILE>camel-medium</FILE>
 <TITLE>CamelMedium</TITLE>
 CamelMedium
@@ -1065,6 +1075,21 @@ camel_mime_part_get_type
 </SECTION>
 
 <SECTION>
+<FILE>camel-msgport</FILE>
+<TITLE>CamelMsgPort</TITLE>
+CamelMsg
+CamelMsgPort
+camel_msgport_new
+camel_msgport_destroy
+camel_msgport_fd
+camel_msgport_push
+camel_msgport_pop
+camel_msgport_try_pop
+camel_msgport_reply
+camel_msgport_prfd
+</SECTION>
+
+<SECTION>
 <FILE>camel-multipart-encrypted</FILE>
 <TITLE>CamelMultipartEncrypted</TITLE>
 CamelMultipartEncrypted
@@ -1935,6 +1960,15 @@ camel_transport_get_type
 </SECTION>
 
 <SECTION>
+<FILE>camel-trie</FILE>
+CamelTrie
+camel_trie_new
+camel_trie_free
+camel_trie_add
+camel_trie_search
+</SECTION>
+
+<SECTION>
 <FILE>camel-vee-folder</FILE>
 <TITLE>CamelVeeFolder</TITLE>
 CamelVeeFolder
Index: docs/reference/camel/camel-docs.sgml
===================================================================
--- docs/reference/camel/camel-docs.sgml	(revision 7789)
+++ docs/reference/camel/camel-docs.sgml	(working copy)
@@ -20,11 +20,13 @@
 <!ENTITY CamelGPGContext SYSTEM "xml/camel-gpg-context.xml">
 <!ENTITY CamelHTMLParser SYSTEM "xml/camel-html-parser.xml">
 <!ENTITY CamelHTTPStream SYSTEM "xml/camel-http-stream.xml">
+<!ENTITY CamelIconv SYSTEM "xml/camel-iconv.xml">
 <!ENTITY CamelIndex SYSTEM "xml/camel-index.xml">
 <!ENTITY CamelInternetAddress SYSTEM "xml/camel-internet-address.xml">
 <!ENTITY CamelListUtils SYSTEM "xml/camel-list-utils.xml">
 <!ENTITY CamelLock SYSTEM "xml/camel-lock.xml">
 <!ENTITY CamelLockClient SYSTEM "xml/camel-lock-client.xml">
+<!ENTITY CamelMD5Utils SYSTEM "xml/camel-md5-utils.xml">
 <!ENTITY CamelMedium SYSTEM "xml/camel-medium.xml">
 <!ENTITY CamelMIMEFilter SYSTEM "xml/camel-mime-filter.xml">
 <!ENTITY CamelMIMEFilterBasic SYSTEM "xml/camel-mime-filter-basic.xml">
@@ -46,6 +48,7 @@
 <!ENTITY CamelMIMEPart SYSTEM "xml/camel-mime-part.xml">
 <!ENTITY CamelMIMEPartUtils SYSTEM "xml/camel-mime-part-utils.xml">
 <!ENTITY CamelMIMEUtils SYSTEM "xml/camel-mime-utils.xml">
+<!ENTITY CamelMsgPort SYSTEM "xml/camel-msgport.xml">
 <!ENTITY CamelMultipart SYSTEM "xml/camel-multipart.xml">
 <!ENTITY CamelMultipartEncrypted SYSTEM "xml/camel-multipart-encrypted.xml">
 <!ENTITY CamelMultipartSigned SYSTEM "xml/camel-multipart-signed.xml">
@@ -88,6 +91,7 @@
 <!ENTITY CamelTcpStreamSSL SYSTEM "xml/camel-tcp-stream-ssl.xml">
 <!ENTITY CamelTextIndex SYSTEM "xml/camel-text-index.xml">
 <!ENTITY CamelTransport SYSTEM "xml/camel-transport.xml">
+<!ENTITY CamelTrie SYSTEM "xml/camel-trie.xml">
 <!ENTITY CamelUIDCache SYSTEM "xml/camel-uid-cache.xml">
 <!ENTITY CamelURL SYSTEM "xml/camel-url.xml">
 <!ENTITY CamelURLScanner SYSTEM "xml/camel-url-scanner.xml">
Index: libedataserver/e-iconv.h
===================================================================
--- libedataserver/e-iconv.h	(revision 7789)
+++ libedataserver/e-iconv.h	(working copy)
@@ -22,9 +22,13 @@
  * 02111-1307, USA.
  */
 
+/* This API has been moved to Camel. */
+
 #ifndef _E_ICONV_H_
 #define _E_ICONV_H_
 
+#ifndef EDS_DISABLE_DEPRECATED
+
 #include <iconv.h>
 
 #ifdef __cplusplus
@@ -46,4 +50,6 @@ const char *e_iconv_charset_language (co
 }
 #endif /* __cplusplus */
 
+#endif /* EDS_DISABLE_DEPRECATED */
+
 #endif /* !_E_ICONV_H_ */
Index: libedataserver/md5-utils.h
===================================================================
--- libedataserver/md5-utils.h	(revision 7789)
+++ libedataserver/md5-utils.h	(working copy)
@@ -22,10 +22,13 @@
  * Modified October 1995 by Erik Troan for RPM
  */
 
+/* This API has been moved to Camel. */
 
 #ifndef MD5_UTILS_H
 #define MD5_UTILS_H
 
+#ifndef EDS_DISABLE_DEPRECATED
+
 #include <glib.h>
 
 G_BEGIN_DECLS
@@ -56,4 +59,6 @@ void md5_final (MD5Context *ctx, guchar 
 
 G_END_DECLS
 
+#endif /* EDS_DISABLE_DEPRECATED */
+
 #endif	/* MD5_UTILS_H */
Index: libedataserver/e-trie.h
===================================================================
--- libedataserver/e-trie.h	(revision 7789)
+++ libedataserver/e-trie.h	(working copy)
@@ -20,10 +20,13 @@
  *
  */
 
+/* This API has been moved to Camel. */
 
 #ifndef __E_TRIE_H__
 #define __E_TRIE_H__
 
+#ifndef EDS_DISABLE_DEPRECATED
+
 #ifdef __cplusplus
 extern "C" {
 #pragma }
@@ -44,4 +47,6 @@ const char *e_trie_search (ETrie *trie, 
 }
 #endif /* __cplusplus */
 
+#endif /* EDS_DISABLE_DEPRECATED */
+
 #endif /* __E_TRIE_H__ */
Index: libedataserver/e-msgport.h
===================================================================
--- libedataserver/e-msgport.h	(revision 7789)
+++ libedataserver/e-msgport.h	(working copy)
@@ -48,6 +48,7 @@ void em_cache_node_unref(EMCache *emc, E
 void em_cache_add(EMCache *emc, EMCacheNode *n);
 void em_cache_clear(EMCache *emc);
 
+#ifndef EDS_DISABLE_DEPRECATED
 /* message ports - a simple inter-thread 'ipc' primitive */
 /* opaque handle */
 typedef struct _EMsgPort EMsgPort;
@@ -70,6 +71,7 @@ void e_msgport_reply(EMsg *msg);
 #ifdef HAVE_NSS
 struct PRFileDesc *e_msgport_prfd(EMsgPort *mp);
 #endif
+#endif /* EDS_DISABLE_DEPRECATED */
 
 #ifndef EDS_DISABLE_DEPRECATED
 /* e threads, a server thread with a message based request-response, and flexible queuing */
@@ -93,7 +95,7 @@ void e_thread_set_reply_port(EThread *e,
 void e_thread_set_msg_received(EThread *e, EThreadFunc received, void *data);
 void e_thread_put(EThread *e, EMsg *msg);
 int e_thread_busy(EThread *e);
-#endif
+#endif /* EDS_DISABLE_DEPRECATED */
 
 #ifndef EDS_DISABLE_DEPRECATED
 /* sigh, another mutex interface, this one allows different mutex types, portably */
@@ -111,6 +113,6 @@ int e_mutex_unlock(EMutex *m);
 void e_mutex_assert_locked(EMutex *m);
 /* this uses pthread cond's */
 int e_mutex_cond_wait(void *cond, EMutex *m);
-#endif
+#endif /* EDS_DISABLE_DEPRECATED */
 
 #endif
