diff -u -r evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-folder-summary.c __evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-folder-summary.c
--- evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-folder-summary.c	2009-06-26 14:36:57.000000000 +0200
+++ __evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-folder-summary.c	2009-08-11 15:09:52.000000000 +0200
@@ -993,8 +993,142 @@
 static void
 mir_from_cols (CamelMIRecord *mir, CamelFolderSummary *s, int ncol, char ** cols, char ** name)
 {
+#if 1
+	/* 
+	 * THIS ALGORITHM IS DEDICATED FOR CONST COLUMS SEQUENCE !!!
+	 * IF THE SEQUENCE CHANGE THEN THE RESULTS MAY WARRY !!!
+	 */
+	int i = 0;
+	while (i < ncol) {
+
+		if ( !strcmp (name [i], "uid") ) {
+			mir->uid = (char *) camel_pstring_strdup (cols [i]);
+			++i;
+		}
+
+		if ( !strcmp (name [i], "flags") ) {
+			mir->flags = cols [i] ? strtoul (cols [i], NULL, 10) : 0;
+			++i;
+		}
+
+		if ( !strcmp (name [i], "read") ) {
+			mir->read =  (cols [i]) ? ( ((strtoul (cols [i], NULL, 10)) ? TRUE : FALSE)) : FALSE;
+			++i;
+		}
+
+		if ( !strcmp (name [i], "deleted") ) {
+			mir->deleted = (cols [i]) ? ( ((strtoul (cols [i], NULL, 10)) ? TRUE : FALSE)) : FALSE;
+			++i;
+		}
+
+		if ( !strcmp (name [i], "replied") ) {
+			mir->replied = (cols [i]) ? ( ((strtoul (cols [i], NULL, 10)) ? TRUE : FALSE)) : FALSE;
+			++i;
+		}
+
+		if ( !strcmp (name [i], "important") ) {
+			mir->important = (cols [i]) ? ( ((strtoul (cols [i], NULL, 10)) ? TRUE : FALSE)) : FALSE;
+			++i;
+		}
+
+		if ( !strcmp (name [i], "junk") ) {
+			mir->junk = (cols [i]) ? ( ((strtoul (cols [i], NULL, 10)) ? TRUE : FALSE)) : FALSE;
+			++i;
+		}
+
+		if ( !strcmp (name [i], "attachment") ) {
+			mir->attachment = (cols [i]) ? ( ((strtoul (cols [i], NULL, 10)) ? TRUE : FALSE)) : FALSE;
+			++i;
+		}
+
+		if ( !strcmp (name [i], "size") ) {
+			mir->size =  cols [i] ? strtoul (cols [i], NULL, 10) : 0;
+			++i;
+		}
+
+		if ( !strcmp (name [i], "dsent") ) {
+			mir->dsent = cols [i] ? strtol (cols [i], NULL, 10) : 0;
+			++i;
+		}
+
+		if ( !strcmp (name [i], "dreceived") ) {
+			mir->dreceived = cols [i] ? strtol (cols [i], NULL, 10) : 0;
+			++i;
+		}
+
+		if ( !strcmp (name [i], "subject") ) {
+			mir->subject = (char *) camel_pstring_strdup (cols [i]);
+			++i;
+		}
+
+		if ( !strcmp (name [i], "mail_from") ) {
+			mir->from = (char *) camel_pstring_strdup (cols [i]);
+			++i;
+		}
+
+		if ( !strcmp (name [i], "mail_to") ) {
+			mir->to = (char *) camel_pstring_strdup (cols [i]);
+			++i;
+		}
+
+		if ( !strcmp (name [i], "mail_cc") ) {
+			mir->cc = (char *) camel_pstring_strdup(cols [i]);
+			++i;
+		}
+
+		if ( !strcmp (name [i], "mlist") ) {
+			mir->mlist = (char *) camel_pstring_strdup (cols [i]);
+			++i;
+		}
+
+		if ( !strcmp (name [i], "followup_flag") ) {
+			mir->followup_flag = (char *) camel_pstring_strdup(cols [i]);
+			++i;
+		}
+
+		if ( !strcmp (name [i], "followup_completed_on") ) {
+			mir->followup_completed_on = (char *) camel_pstring_strdup(cols [i]);
+			++i;
+		}
+
+		if ( !strcmp (name [i], "followup_due_by") ) {
+			mir->followup_due_by = (char *) camel_pstring_strdup(cols [i]);
+			++i;
+		}
+
+		if ( !strcmp (name [i], "part") ) {
+			mir->part = g_strdup (cols [i]);
+			++i;
+		}
+
+		if ( !strcmp (name [i], "labels") )  {
+			mir->labels = g_strdup (cols [i]);
+			++i;
+		}
+
+		if ( !strcmp (name [i], "usertags") ) {
+			mir->usertags = g_strdup (cols [i]);
+			++i;
+		}
+
+		if ( !strcmp (name [i], "cinfo") ) {
+			mir->cinfo = g_strdup(cols [i]);
+			++i;
+		}
+
+		if ( !strcmp (name [i], "bdata") ) {
+			mir->bdata = g_strdup(cols [i]);
+			++i;
+		} 
+
+		if (i < ncol ) {
+		 	puts("FOR PERFORMACE AND USER FREANDLY REASON THIS SHOULD NEVER BE HERE");
+			abort();
+		}
+	} 
+#else
 	int i;
-	
+
 	for (i = 0; i < ncol; ++i) {
 
 		if ( !strcmp (name [i], "uid") ) 
@@ -1047,6 +1181,7 @@
 			mir->bdata = g_strdup(cols [i]);
 
 	}	
+#endif
 }
 
 static int 
@@ -1058,18 +1193,22 @@
 	CamelMessageInfo *info;
 	int ret = 0;
 
-	mir = g_new0 (CamelMIRecord , 1);
-	mir_from_cols (mir, s, ncol, cols, name);
-	
-	CAMEL_SUMMARY_LOCK (s, summary_lock);
-	if (g_hash_table_lookup (s->loaded_infos, mir->uid)) {
-		/* Unlock and better return*/
-		CAMEL_SUMMARY_UNLOCK (s, summary_lock);
-		camel_db_camel_mir_free (mir);
-		return ret;
+	int i = 0;
+	for (; i<ncol; ++i) {
+		if (0 == strcmp (name [i], "uid") ) {
+			CAMEL_SUMMARY_LOCK (s, summary_lock);
+			if (g_hash_table_lookup (s->loaded_infos, cols [i])) {
+				/* Unlock and better return*/
+				CAMEL_SUMMARY_UNLOCK (s, summary_lock);
+				return ret;
+			}
+			CAMEL_SUMMARY_UNLOCK (s, summary_lock);
+			break;
+		}
 	}
-	CAMEL_SUMMARY_UNLOCK (s, summary_lock);
 
+	mir = g_new0 (CamelMIRecord , 1);
+	mir_from_cols (mir, s, ncol, cols, name);
 
 	info = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_from_db (s, mir);
 
diff -u -r evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-store-summary.c __evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-store-summary.c
--- evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-store-summary.c	2009-06-26 14:36:57.000000000 +0200
+++ __evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-store-summary.c	2009-08-10 18:45:41.000000000 +0200
@@ -584,6 +584,16 @@
 	return info;
 }
 
+void
+camel_store_summary_sort(CamelStoreSummary *s, GCompareFunc compare_func)
+{
+	CAMEL_STORE_SUMMARY_LOCK(s, ref_lock);
+	CAMEL_STORE_SUMMARY_LOCK(s, summary_lock);
+	g_ptr_array_sort(s->folders, compare_func);
+	CAMEL_STORE_SUMMARY_UNLOCK(s, summary_lock);
+	CAMEL_STORE_SUMMARY_UNLOCK(s, ref_lock);
+};
+
 
 /**
  * camel_store_summary_info_new_from_path:
diff -u -r evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-store-summary.h __evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-store-summary.h
--- evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-store-summary.h	2009-06-26 14:36:57.000000000 +0200
+++ __evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-store-summary.h	2009-09-07 16:28:54.000000000 +0200
@@ -170,6 +170,7 @@
 CamelStoreInfo *camel_store_summary_path(CamelStoreSummary *summary, const char *path);
 GPtrArray *camel_store_summary_array(CamelStoreSummary *summary);
 void camel_store_summary_array_free(CamelStoreSummary *summary, GPtrArray *array);
+void camel_store_summary_sort(CamelStoreSummary *summary, GCompareFunc compare_func);
 
 const char *camel_store_info_string(CamelStoreSummary *summary, const CamelStoreInfo *info, int type);
 void camel_store_info_set_string(CamelStoreSummary *summary, CamelStoreInfo *info, int type, const char *value);
diff -u -r evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-url.c __evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-url.c
--- evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-url.c	2009-06-26 14:36:57.000000000 +0200
+++ __evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/camel-url.c	2009-08-11 15:22:18.000000000 +0200
@@ -105,41 +105,43 @@
 #endif
 
 	/* Check for authority */
-	if (strncmp (url_string, "//", 2) == 0) {
+	//if (strncmp (url_string, "//", 2) == 0) {
+	if ( *((unsigned short *)url_string) == (unsigned short)('/' << 8 | '/' ) ) {
 		url_string += 2;
 
 		slash = url_string + strcspn (url_string, "/#");
-		at = strchr (url_string, '@');
+		at = memchr (url_string, '@', end - url_string);
 		if (at && at < slash) {
-			colon = strchr (url_string, ':');
+			colon = memchr (url_string, ':', end - url_string);
 			if (colon && colon < at) {
 				url->passwd = g_strndup (colon + 1,
 							 at - colon - 1);
 				camel_url_decode (url->passwd);
 			} else {
-				url->passwd = NULL;
+				//url->passwd = NULL; //this is current null due container creation method
 				colon = at;
 			}
 
-			semi = strchr(url_string, ';');
+			semi = memchr (url_string, ';', end - url_string);
 			if (semi && semi < colon &&
 			    !g_ascii_strncasecmp (semi, ";auth=", 6)) {
 				url->authmech = g_strndup (semi + 6,
 							   colon - semi - 6);
 				camel_url_decode (url->authmech);
-			} else {
-				url->authmech = NULL;
-				semi = colon;
-			}
+				colon = semi;
+			} //else {
+				//url->authmech = NULL; //this is current null due container creation method
+				//semi = colon;
+			//}
 
-			url->user = g_strndup (url_string, semi - url_string);
+			url->user = g_strndup (url_string, colon - url_string);
 			camel_url_decode (url->user);
 			url_string = at + 1;
-		} else
-			url->user = url->passwd = url->authmech = NULL;
+		} //else
+			//url->user = url->passwd = url->authmech = NULL; //this is current null due container creation method
 
 		/* Find host and port. */
-		colon = strchr (url_string, ':');
+		colon = memchr (url_string, ':', end - url_string);
 		if (colon && colon < slash) {
 			url->host = g_strndup (url_string, colon - url_string);
 			url->port = strtoul (colon + 1, NULL, 10);
@@ -197,83 +199,86 @@
 		camel_url_decode (url->path);
 	}
 
-	/* Apply base URL. Again, this is spelled out in RFC 1808. */
-	if (base && !url->protocol && url->host)
-		url->protocol = g_strdup (base->protocol);
-	else if (base && !url->protocol) {
-		if (!url->user && !url->authmech && !url->passwd &&
-		    !url->host && !url->port && !url->path &&
-		    !url->params && !url->query && !url->fragment)
-			url->fragment = g_strdup (base->fragment);
-
-		url->protocol = g_strdup (base->protocol);
-		url->user = g_strdup (base->user);
-		url->authmech = g_strdup (base->authmech);
-		url->passwd = g_strdup (base->passwd);
-		url->host = g_strdup (base->host);
-		url->port = base->port;
-
-		if (!url->path) {
-			url->path = g_strdup (base->path);
-			if (!url->params) {
-				g_datalist_foreach (&base->params, copy_param,
-						    &url->params);
-				if (!url->query)
-					url->query = g_strdup (base->query);
-			}
-		} else if (*url->path != '/') {
-			char *newpath, *last, *p, *q;
-
-			/* the base->path is NULL if given Content-Base url was without last slash,
-			   i.e. like "http://example.com" (this expected only "http://example.com/") */
-			last = base->path ? strrchr (base->path, '/') : NULL;
-			if (last) {
-				newpath = g_strdup_printf ("%.*s/%s",
-							   (int)(last - base->path),
-							   base->path,
-							   url->path);
-			} else
-				newpath = g_strdup_printf ("/%s", url->path);
-
-			/* Remove "./" where "." is a complete segment. */
-			for (p = newpath + 1; *p; ) {
-				if (*(p - 1) == '/' &&
-				    *p == '.' && *(p + 1) == '/')
-					memmove (p, p + 2, strlen (p + 2) + 1);
-				else
-					p++;
-			}
-			/* Remove "." at end. */
-			if (p > newpath + 2 &&
-			    *(p - 1) == '.' && *(p - 2) == '/')
-				*(p - 1) = '\0';
-			/* Remove "<segment>/../" where <segment> != ".." */
-			for (p = newpath + 1; *p; ) {
-				if (!strncmp (p, "../", 3)) {
-					p += 3;
-					continue;
-				}
-				q = strchr (p + 1, '/');
-				if (!q)
-					break;
-				if (strncmp (q, "/../", 4) != 0) {
-					p = q + 1;
-					continue;
-				}
-				memmove (p, q + 4, strlen (q + 4) + 1);
-				p = newpath + 1;
-			}
-			/* Remove "<segment>/.." at end */
-			q = strrchr (newpath, '/');
-			if (q && !strcmp (q, "/..")) {
-				p = q - 1;
-				while (p > newpath && *p != '/')
-					p--;
-				if (strncmp (p, "/../", 4) != 0)
-					*(p + 1) = 0;
+	if (base)
+	{
+			/* Apply base URL. Again, this is spelled out in RFC 1808. */
+			if (!url->protocol && url->host)
+				url->protocol = g_strdup (base->protocol);
+			else if (!url->protocol) {
+				if (!url->user && !url->authmech && !url->passwd &&
+					!url->host && !url->port && !url->path &&
+					!url->params && !url->query && !url->fragment)
+					url->fragment = g_strdup (base->fragment);
+
+				url->protocol = g_strdup (base->protocol);
+				url->user = g_strdup (base->user);
+				url->authmech = g_strdup (base->authmech);
+				url->passwd = g_strdup (base->passwd);
+				url->host = g_strdup (base->host);
+				url->port = base->port;
+
+				if (!url->path) {
+					url->path = g_strdup (base->path);
+					if (!url->params) {
+						g_datalist_foreach (&base->params, copy_param,
+									&url->params);
+						if (!url->query)
+							url->query = g_strdup (base->query);
+					}
+				} else if (*url->path != '/') {
+					char *newpath, *last, *p, *q;
+
+					/* the base->path is NULL if given Content-Base url was without last slash,
+					   i.e. like "http://example.com" (this expected only "http://example.com/") */
+					last = base->path ? strrchr (base->path, '/') : NULL;
+					if (last) {
+						newpath = g_strdup_printf ("%.*s/%s",
+									   (int)(last - base->path),
+									   base->path,
+									   url->path);
+					} else
+						newpath = g_strdup_printf ("/%s", url->path);
+
+					/* Remove "./" where "." is a complete segment. */
+					for (p = newpath + 1; *p; ) {
+						if (*(p - 1) == '/' &&
+							*p == '.' && *(p + 1) == '/')
+							memmove (p, p + 2, strlen (p + 2) + 1);
+						else
+							p++;
+					}
+					/* Remove "." at end. */
+					if (p > newpath + 2 &&
+						*(p - 1) == '.' && *(p - 2) == '/')
+						*(p - 1) = '\0';
+					/* Remove "<segment>/../" where <segment> != ".." */
+					for (p = newpath + 1; *p; ) {
+						if (!strncmp (p, "../", 3)) {
+							p += 3;
+							continue;
+						}
+						q = strchr (p + 1, '/');
+						if (!q)
+							break;
+						if (strncmp (q, "/../", 4) != 0) {
+							p = q + 1;
+							continue;
+						}
+						memmove (p, q + 4, strlen (q + 4) + 1);
+						p = newpath + 1;
+					}
+					/* Remove "<segment>/.." at end */
+					q = strrchr (newpath, '/');
+					if (q && !strcmp (q, "/..")) {
+						p = q - 1;
+						while (p > newpath && *p != '/')
+							p--;
+						if (strncmp (p, "/../", 4) != 0)
+							*(p + 1) = 0;
+					}
+					g_free (url->path);
+					url->path = newpath;
 			}
-			g_free (url->path);
-			url->path = newpath;
 		}
 	}
 
@@ -648,20 +653,35 @@
 void
 camel_url_decode (char *part)
 {
-	unsigned char *s, *d;
-
 	g_return_if_fail (part != NULL);
 
 #define XDIGIT(c) ((c) <= '9' ? (c) - '0' : ((c) & 0x4F) - 'A' + 10)
 
-	s = d = (unsigned char *)part;
-	do {
-		if (*s == '%' && isxdigit(s[1]) && isxdigit(s[2])) {
-			*d++ = (XDIGIT (s[1]) << 4) + XDIGIT (s[2]);
-			s += 2;
-		} else
-			*d++ = *s;
-	} while (*s++);
+	char *s = strchr(part, '%');
+	if(s) {
+		char *e = NULL, *d = s;
+		do {
+			if (isxdigit(s[1]) && isxdigit(s[2])) {
+				if (e) {
+					memmove(d, e, s - e);
+					d += s - e;
+				}
+				e = s + 3;
+				*d = (XDIGIT (s[1]) << 4) + XDIGIT (s[2]);
+				d++;
+			}
+			s++;
+			s = strchr(s, '%');
+		} while(s);
+		if (e) {
+			if (*e) {
+				strcpy(d, e);
+			} else {
+				*d = '\0';
+			}
+		}
+	}
+#undef XDIGIT
 }
 
 
diff -u -r evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/providers/imap/camel-imap-store-summary.c __evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/providers/imap/camel-imap-store-summary.c
--- evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/providers/imap/camel-imap-store-summary.c	2009-06-26 14:36:57.000000000 +0200
+++ __evolution-data-server-2.26.3/work/evolution-data-server-2.26.3/camel/providers/imap/camel-imap-store-summary.c	2009-08-11 15:08:02.000000000 +0200
@@ -45,6 +45,9 @@
 
 #define _PRIVATE(o) (((CamelImapStoreSummary *)(o))->priv)
 
+//extern void
+//camel_store_summary_sort(CamelStoreSummary *s, GCompareFunc compare_func);
+
 static void namespace_clear(CamelStoreSummary *s);
 
 static int summary_header_load(CamelStoreSummary *, FILE *);
@@ -136,6 +139,15 @@
 	return new;
 }
 
+static gint
+GCompareCamelImapStoreSummary(gconstpointer a, gconstpointer b)
+{
+	CamelImapStoreInfo *a0 = *(CamelImapStoreInfo **)a;
+	CamelImapStoreInfo *b0 = *(CamelImapStoreInfo **)b;
+	return strcmp /*g_ascii_strcasecmp*/(a0->full_name, b0->full_name);
+}
+
+
 /**
  * camel_imap_store_summary_full_name:
  * @s: 
@@ -153,16 +165,59 @@
 CamelImapStoreInfo *
 camel_imap_store_summary_full_name(CamelImapStoreSummary *s, const char *full_name)
 {
-	int count, i;
-	CamelImapStoreInfo *info;
+	guint last = camel_store_summary_count((CamelStoreSummary *)s);
+	if (last)
+	{
+		CamelImapStoreInfo *info;
+		guint first = 0;
+		guint midsize = last - first - 1;
+		gint cmp;
+		guint tx;
+
+		last--;
+
+		while (midsize > 1)
+		{
+			guint mid = first + midsize / 2;
+
+			info = (CamelImapStoreInfo *)camel_store_summary_index((CamelStoreSummary *)s, mid);
+
+			if (!info) {
+				break;
+			}
+
+			cmp = strcmp(full_name, info->full_name);
 
-	count = camel_store_summary_count((CamelStoreSummary *)s);
-	for (i=0;i<count;i++) {
-		info = (CamelImapStoreInfo *)camel_store_summary_index((CamelStoreSummary *)s, i);
-		if (info) {
-			if (strcmp(info->full_name, full_name) == 0)
+			if (cmp == 0) {
 				return info;
+			}
 			camel_store_summary_info_free((CamelStoreSummary *)s, (CamelStoreInfo *)info);
+			
+
+			if (cmp < 0)
+				last = mid-1;
+			else
+				first = mid+1;
+
+			midsize = last - first;
+		}
+
+		for (tx = first; tx <= last; tx++)
+		{
+			info = (CamelImapStoreInfo *)camel_store_summary_index((CamelStoreSummary *)s, tx);
+			if (info) {
+				cmp = strcmp(full_name, info->full_name);
+
+				if (cmp == 0) {
+					return info;
+				}
+				camel_store_summary_info_free((CamelStoreSummary *)s, (CamelStoreInfo *)info);
+
+				if (cmp < 0)
+				{
+					break;
+				}
+			}
 		}
 	}
 
@@ -339,6 +394,8 @@
 
 		if (!g_ascii_strcasecmp(full_name, "inbox"))
 			info->info.flags |= CAMEL_FOLDER_SYSTEM|CAMEL_FOLDER_TYPE_INBOX;
+
+		camel_store_summary_sort((CamelStoreSummary *)s, GCompareCamelImapStoreSummary);
 	} else
 		d(printf("  failed\n"));
 

