Index: mail/mail-vfolder.c
===================================================================
--- mail/mail-vfolder.c	(revision 34423)
+++ mail/mail-vfolder.c	(working copy)
@@ -403,7 +403,7 @@
 
 	/* This is a bit of a hack, but really the only way it can be done at the moment. */
 
-	if ((store->flags & (CAMEL_STORE_VTRASH|CAMEL_STORE_VJUNK)) == 0)
+	if ((store->flags & (CAMEL_STORE_VTRASH|CAMEL_STORE_VJUNK|CAMEL_STORE_VARCHIVED)) == 0)
 		return FALSE;
 
 	url = camel_url_new(uri, NULL);
@@ -415,13 +415,17 @@
 		res = (((store->flags & CAMEL_STORE_VTRASH)
 			&& strcmp(url->fragment, CAMEL_VTRASH_NAME) == 0)
 		       || ((store->flags & CAMEL_STORE_VJUNK)
-			   && strcmp(url->fragment, CAMEL_VJUNK_NAME) == 0));
+			   && strcmp(url->fragment, CAMEL_VJUNK_NAME) == 0)
+		       || ((store->flags & CAMEL_STORE_VARCHIVED)
+			   && strcmp(url->fragment, CAMEL_VARCHIVED_NAME) == 0));
 	} else {
 		res = url->path
 			&& (((store->flags & CAMEL_STORE_VTRASH)
 			     && strcmp(url->path, "/" CAMEL_VTRASH_NAME) == 0)
 			    || ((store->flags & CAMEL_STORE_VJUNK)
-				&& strcmp(url->path, "/" CAMEL_VJUNK_NAME) == 0));
+				&& strcmp(url->path, "/" CAMEL_VJUNK_NAME) == 0)
+			    || ((store->flags & CAMEL_STORE_VARCHIVED)
+				&& strcmp(url->path, "/" CAMEL_VARCHIVED_NAME) == 0));
 	}
 
 	camel_url_free(url);
Index: mail/em-folder-tree.c
===================================================================
--- mail/em-folder-tree.c	(revision 34423)
+++ mail/em-folder-tree.c	(working copy)
@@ -273,6 +273,7 @@
 	FOLDER_ICON_SHARED_TO_ME,
 	FOLDER_ICON_SHARED_BY_ME,
 	FOLDER_ICON_SENT,
+	FOLDER_ICON_ARCHIVED,
 	FOLDER_ICON_LAST
 };
 
@@ -293,6 +294,8 @@
 		folder_icons[FOLDER_ICON_OUTBOX] = e_icon_factory_get_icon ("mail-outbox", E_ICON_SIZE_MENU);
 		folder_icons[FOLDER_ICON_TRASH] = e_icon_factory_get_icon ("user-trash", E_ICON_SIZE_MENU);
 		folder_icons[FOLDER_ICON_JUNK] = e_icon_factory_get_icon ("mail-mark-junk", E_ICON_SIZE_MENU);
+		folder_icons[FOLDER_ICON_ARCHIVED] = e_icon_factory_get_icon ("folder", E_ICON_SIZE_MENU); 
+		folder_icons[FOLDER_ICON_ARCHIVED] = e_icon_factory_get_icon ("gtk-cdrom", E_ICON_SIZE_MENU); 
 		folder_icons[FOLDER_ICON_SHARED_TO_ME] = e_icon_factory_get_icon ("stock_shared-to-me", E_ICON_SIZE_MENU);
 		folder_icons[FOLDER_ICON_SHARED_BY_ME] = e_icon_factory_get_icon ("stock_shared-by-me", E_ICON_SIZE_MENU);
 		folder_icons[FOLDER_ICON_SENT] = e_icon_factory_get_icon ("mail-sent", E_ICON_SIZE_MENU);
@@ -316,6 +319,9 @@
 		case CAMEL_FOLDER_TYPE_JUNK:
 			pixbuf = folder_icons[FOLDER_ICON_JUNK];
 			break;
+		case CAMEL_FOLDER_TYPE_ARCHIVED:
+			pixbuf = folder_icons[FOLDER_ICON_ARCHIVED]; 
+			break;
 		case CAMEL_FOLDER_TYPE_SENT:
 			pixbuf = folder_icons[FOLDER_ICON_SENT];
 			break;
@@ -1132,9 +1138,11 @@
 		if (!strncmp (uri, "vfolder:", 8) && !strcmp (full_name, CAMEL_UNMATCHED_NAME))
 			goto done;
 		
-		/* don't allow copying/moving into a vTrash/vJunk folder */
+		/* don't allow copying/moving into a vTrash/vJunk/vArchived folder */
+		/* Need to change if we allow drag&drop to archived folder */
 		if (!strcmp (full_name, CAMEL_VTRASH_NAME)
-		    || !strcmp (full_name, CAMEL_VJUNK_NAME))
+		    || !strcmp (full_name, CAMEL_VJUNK_NAME) 
+		    || !strcmp (full_name, CAMEL_VARCHIVED_NAME))
 			goto done;
 	}
 	
@@ -1198,9 +1206,10 @@
 				goto done;
 			}
 			
-			/* don't allow copying/moving of any vTrash/vJunk folder nor maildir 'inbox' */
+			/* don't allow copying/moving of any vTrash/vJunk/vArchived folder nor maildir 'inbox' */
 			if (strcmp(url_path, CAMEL_VTRASH_NAME) == 0
 			    || strcmp(url_path, CAMEL_VJUNK_NAME) == 0
+			    || strcmp(url_path, CAMEL_VARCHIVED_NAME) == 0
 			    /* Dont allow drag from maildir 'inbox' */
 			    || strcmp(url_path, ".") == 0) {
 				camel_url_free(url);
Index: mail/em-folder-view.h
===================================================================
--- mail/em-folder-view.h	(revision 34423)
+++ mail/em-folder-view.h	(working copy)
@@ -10,7 +10,7 @@
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
@@ -96,6 +96,7 @@
 	guint preview_active:1;	/* is preview being used */
 	guint statusbar_active:1; /* should we manage the statusbar messages ourselves? */
 	guint hide_deleted:1;
+	guint hide_archived:1;
 	guint list_active:1;	/* we actually showing the list? */
 };
 
Index: mail/em-folder-view.c
===================================================================
--- mail/em-folder-view.c	(revision 34423)
+++ mail/em-folder-view.c	(working copy)
@@ -112,6 +112,7 @@
 #include "mail-vfolder.h"
 #include "mail-component.h"
 #include "mail-tools.h"
+#include "mail-auto-archive.c"
 
 #include "evolution-shell-component-utils.h" /* Pixmap stuff, sigh */
 
@@ -169,6 +170,7 @@
 	{ "AddSenderToAddressbook",   EM_POPUP_SELECT_ADD_SENDER },
 
 	{ "MessageApplyFilters",      EM_POPUP_SELECT_MANY },
+	{ "MessageRunAutoArchive",    EM_POPUP_SELECT_FOLDER},
 	{ "MessageFilterJunk",        EM_POPUP_SELECT_MANY },
 	{ "MessageCopy",              EM_POPUP_SELECT_MANY },
 	{ "MessageDelete",            EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_DELETE },
@@ -992,6 +994,35 @@
 }
 
 static void
+emfv_popup_mark_archive(EPopup *ep, EPopupItem *pitem, void *data)
+{
+	EMFolderView *emfv = data;
+	char * dest_folder_uri = g_malloc(sizeof(char) * 1000);
+	GPtrArray *uids;
+	
+	em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_ARCHIVED, CAMEL_MESSAGE_ARCHIVED); 
+
+	/* We have to check for gconf entry if user set the remove from server then call the following function with deleted flag as 1 */
+	/*   	sprintf(dest_folder_uri, "imap://wlakke@blr-dsmaster1/.Archived/%s", emfv->folder->name); */
+	sprintf(dest_folder_uri, "exchange://expert.com\\kharish@164.99.168.137/.Archived/%s", emfv->folder->name); 
+	/* free (dest_folder_name); */
+	
+	uids = message_list_get_selected(emfv->list);
+	
+	printf(" WHAT FOLDER FROM MESAGE LIST=%s\n", dest_folder_uri);
+	
+	/* Third flag is delete from source */
+	/* mail_transfer_messages(emfv->folder, uids, 0, dest_folder_uri, 0, NULL, NULL); */
+}
+
+static void
+emfv_popup_mark_unarchive(EPopup *ep, EPopupItem *pitem, void *data)
+{
+	EMFolderView *emfv = data;
+	em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_ARCHIVED|CAMEL_MESSAGE_DELETED, 0);
+}
+
+static void
 emfv_popup_mark_important(EPopup *ep, EPopupItem *pitem, void *data)
 {
 	EMFolderView *emfv = data;
@@ -1182,7 +1213,20 @@
 	mail_filter_on_demand(emfv->folder, uids);
 }
 
+/* A function to explicitily run auto archive now */
 static void
+emfv_run_auto_archive (EPopup *ep, EPopupItem *pitem, void *data)
+{
+	EMFolderView *emfv = data;
+
+	printf (" Folder uri is = %s\n", emfv->folder_uri);
+
+	if(emfv->folder->parent_store)
+		/* 0 values means run auto archive immediately */
+		account_auto_archive_init (CAMEL_STORE(emfv->folder->parent_store), "", 0);
+}
+
+static void
 emfv_popup_filter_junk(EPopup *ep, EPopupItem *pitem, void *data)
 {
 	EMFolderView *emfv = data;
@@ -1238,11 +1282,13 @@
 	{ E_POPUP_BAR, "50.emfv", NULL, NULL, NULL, NULL },
 	{ E_POPUP_ITEM, "50.emfv.00", N_("Mar_k as Read"), emfv_popup_mark_read, NULL, "mail-read", EM_POPUP_SELECT_MARK_READ|EM_FOLDER_VIEW_SELECT_LISTONLY },
 	{ E_POPUP_ITEM, "50.emfv.01", N_("Mark as _Unread"), emfv_popup_mark_unread, NULL, "mail-unread", EM_POPUP_SELECT_MARK_UNREAD|EM_FOLDER_VIEW_SELECT_LISTONLY },
-	{ E_POPUP_ITEM, "50.emfv.02", N_("Mark as _Important"), emfv_popup_mark_important, NULL, "mail-mark-important", EM_POPUP_SELECT_MARK_IMPORTANT|EM_FOLDER_VIEW_SELECT_LISTONLY },
-	{ E_POPUP_ITEM, "50.emfv.03", N_("Mark as Un_important"), emfv_popup_mark_unimportant, NULL, NULL, EM_POPUP_SELECT_MARK_UNIMPORTANT|EM_FOLDER_VIEW_SELECT_LISTONLY },
-	{ E_POPUP_ITEM, "50.emfv.04", N_("Mark as _Junk"), emfv_popup_mark_junk, NULL, "mail-mark-junk", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY|EM_POPUP_SELECT_JUNK },
-	{ E_POPUP_ITEM, "50.emfv.05", N_("Mark as _Not Junk"), emfv_popup_mark_nojunk, NULL, "mail-mark-notjunk", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY|EM_POPUP_SELECT_NOT_JUNK },
-	{ E_POPUP_ITEM, "50.emfv.06", N_("Mark for Follo_w Up..."), emfv_popup_flag_followup, NULL, "stock_mail-flag-for-followup",  EM_POPUP_SELECT_FLAG_FOLLOWUP|EM_FOLDER_VIEW_SELECT_LISTONLY },
+	{ E_POPUP_ITEM, "50.emfv.02", N_("Mark as _Archive"), emfv_popup_mark_archive, NULL, "gtk-cdrom", EM_POPUP_SELECT_MARK_ARCHIVED|EM_FOLDER_VIEW_SELECT_LISTONLY },
+	{ E_POPUP_ITEM, "50.emfv.03", N_("Mark as _UnArchive"), emfv_popup_mark_unarchive, NULL, "gtk-cdrom", EM_POPUP_SELECT_MARK_UNARCHIVED|EM_FOLDER_VIEW_SELECT_LISTONLY },
+	{ E_POPUP_ITEM, "50.emfv.04", N_("Mark as _Important"), emfv_popup_mark_important, NULL, "emblem-important", EM_POPUP_SELECT_MARK_IMPORTANT|EM_FOLDER_VIEW_SELECT_LISTONLY },
+	{ E_POPUP_ITEM, "50.emfv.05", N_("Mark as Un_important"), emfv_popup_mark_unimportant, NULL, NULL, EM_POPUP_SELECT_MARK_UNIMPORTANT|EM_FOLDER_VIEW_SELECT_LISTONLY },
+	{ E_POPUP_ITEM, "50.emfv.06", N_("Mark as _Junk"), emfv_popup_mark_junk, NULL, "mail-mark-junk", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY|EM_POPUP_SELECT_JUNK },
+	{ E_POPUP_ITEM, "50.emfv.07", N_("Mark as _Not Junk"), emfv_popup_mark_nojunk, NULL, "mail-mark-notjunk", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY|EM_POPUP_SELECT_NOT_JUNK },
+	{ E_POPUP_ITEM, "50.emfv.08", N_("Mark for Follo_w Up..."), emfv_popup_flag_followup, NULL, "stock_mail-flag-for-followup",  EM_POPUP_SELECT_FLAG_FOLLOWUP|EM_FOLDER_VIEW_SELECT_LISTONLY },
 
 	{ E_POPUP_SUBMENU, "60.label.00", N_("_Label"), NULL, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY },
 	{ E_POPUP_ITEM, "60.label.00/00.label", N_("_None"), emfv_popup_label_clear, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY },
@@ -1374,6 +1420,7 @@
 
 EMFV_MAP_CALLBACK(emfv_add_sender_addressbook, emfv_popup_add_sender)
 EMFV_MAP_CALLBACK(emfv_message_apply_filters, emfv_popup_apply_filters)
+EMFV_MAP_CALLBACK(emfv_message_run_auto_archive, emfv_run_auto_archive)
 EMFV_MAP_CALLBACK(emfv_message_filter_junk, emfv_popup_filter_junk)
 EMFV_MAP_CALLBACK(emfv_message_copy, emfv_popup_copy)
 EMFV_MAP_CALLBACK(emfv_message_move, emfv_popup_move)
@@ -1383,6 +1430,8 @@
 EMFV_MAP_CALLBACK(emfv_message_reply_sender, emfv_popup_reply_sender)
 EMFV_MAP_CALLBACK(emfv_message_mark_read, emfv_popup_mark_read)
 EMFV_MAP_CALLBACK(emfv_message_mark_unread, emfv_popup_mark_unread)
+EMFV_MAP_CALLBACK(emfv_message_mark_archive, emfv_popup_mark_archive)
+EMFV_MAP_CALLBACK(emfv_message_mark_unarchive, emfv_popup_mark_unarchive)
 EMFV_MAP_CALLBACK(emfv_message_mark_important, emfv_popup_mark_important)
 EMFV_MAP_CALLBACK(emfv_message_mark_unimportant, emfv_popup_mark_unimportant)
 EMFV_MAP_CALLBACK(emfv_message_mark_junk, emfv_popup_mark_junk)
@@ -1893,6 +1942,7 @@
 	BONOBO_UI_UNSAFE_VERB ("AddSenderToAddressbook", emfv_add_sender_addressbook),
 
 	BONOBO_UI_UNSAFE_VERB ("MessageApplyFilters", emfv_message_apply_filters),
+	BONOBO_UI_UNSAFE_VERB ("MessageRunAutoArchive", emfv_run_auto_archive),
 	BONOBO_UI_UNSAFE_VERB ("MessageFilterJunk", emfv_message_filter_junk),
 	BONOBO_UI_UNSAFE_VERB ("MessageCopy", emfv_message_copy),
 	BONOBO_UI_UNSAFE_VERB ("MessageDelete", emfv_message_delete),
@@ -1903,6 +1953,8 @@
 	BONOBO_UI_UNSAFE_VERB ("MessageRedirect", emfv_message_redirect),
 	BONOBO_UI_UNSAFE_VERB ("MessageMarkAsRead", emfv_message_mark_read),
 	BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnRead", emfv_message_mark_unread),
+	BONOBO_UI_UNSAFE_VERB ("MessageMarkAsArchive", emfv_message_mark_archive),
+	BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnArchive", emfv_message_mark_unarchive), 
 	BONOBO_UI_UNSAFE_VERB ("MessageMarkAsImportant", emfv_message_mark_important),
 	BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnimportant", emfv_message_mark_unimportant),
 	BONOBO_UI_UNSAFE_VERB ("MessageMarkAsJunk", emfv_message_mark_junk),
@@ -1955,6 +2007,7 @@
 	E_PIXMAP ("/commands/EditPaste", "edit-paste", E_ICON_SIZE_MENU),
 	E_PIXMAP ("/commands/MailCompose", "mail-message-new", E_ICON_SIZE_MENU),
 	E_PIXMAP ("/commands/MessageApplyFilters", "stock_mail-filters-apply", E_ICON_SIZE_MENU),
+	E_PIXMAP ("/commands/MessageRunAutoArchive", "gtk-cdrom", E_ICON_SIZE_MENU),
 	E_PIXMAP ("/commands/MessageCopy", "stock_mail-copy", E_ICON_SIZE_MENU),
 	E_PIXMAP ("/commands/MessageDelete", "user-trash", E_ICON_SIZE_MENU),
 	E_PIXMAP ("/commands/MessageFilterJunk", "mail-mark-junk", E_ICON_SIZE_MENU),
@@ -1965,6 +2018,8 @@
 	E_PIXMAP ("/commands/MessageMarkAsNotJunk", "mail-mark-notjunk", E_ICON_SIZE_MENU),
 	E_PIXMAP ("/commands/MessageMarkAsRead", "mail-read", E_ICON_SIZE_MENU),
 	E_PIXMAP ("/commands/MessageMarkAsUnRead", "mail-unread", E_ICON_SIZE_MENU),
+	E_PIXMAP ("/commands/MessageMarkAsArchive", "gtk-cdrom", E_ICON_SIZE_MENU),
+ 	E_PIXMAP ("/commands/MessageMarkAsUnArchive", "stock_mail_read", E_ICON_SIZE_MENU), 
 	E_PIXMAP ("/commands/MessageMove", "stock_mail-move", E_ICON_SIZE_MENU),
 	E_PIXMAP ("/commands/MessageReplyAll", "mail-reply-all", E_ICON_SIZE_MENU),
 	E_PIXMAP ("/commands/MessageReplySender", "mail-reply-sender", E_ICON_SIZE_MENU),
@@ -2277,6 +2332,20 @@
 	}
 }
 
+void
+em_folder_view_set_hide_archived(EMFolderView *emfv, gboolean status)
+{
+	if (emfv->folder && (emfv->folder->folder_flags & CAMEL_FOLDER_IS_ARCHIVED))
+		status = FALSE;
+
+	emfv->hide_archived = status;
+
+	if (emfv->folder) {
+		message_list_set_hidearchived(emfv->list, status);
+		g_signal_emit(emfv, signals[EMFV_CHANGED], 0);
+	}
+}
+
 /* ********************************************************************** */
 
 struct mst_t {
@@ -2723,6 +2792,7 @@
 	EMFV_HEADERS,
 	EMFV_SHOW_PREVIEW,
 	EMFV_SHOW_DELETED,
+	EMFV_SHOW_ARCHIVED,
 	EMFV_THREAD_LIST,
 	EMFV_PANED_SIZE,
 	EMFV_SENDER_PHOTO,
@@ -2744,6 +2814,7 @@
 	"headers",
 	"show_preview",
 	"show_deleted",
+	"show_archived",
 	"thread_list",
 	"paned_size",
 	"sender_photo",
@@ -2886,6 +2957,16 @@
 		if (emfv->uic) 
 			bonobo_ui_component_set_prop (emfv->uic, "/commands/HideDeleted", "state", state ? "0" : "1", NULL);
 		break; }
+	case EMFV_SHOW_ARCHIVED: { 
+		gboolean state;
+
+		state = gconf_value_get_bool (value);
+		em_folder_view_set_hide_archived (emfv, !state);
+		/* Set the prop only if the component has already been
+		 * activated. */ 
+		if (emfv->uic) 
+			bonobo_ui_component_set_prop (emfv->uic, "/commands/HideArchived", "state", state ? "0" : "1", NULL);
+		break; }
 	case EMFV_THREAD_LIST: {
 		gboolean state_gconf, state_camel;
 		char *ret;
Index: mail/em-popup.c
===================================================================
--- mail/em-popup.c	(revision 34423)
+++ mail/em-popup.c	(working copy)
@@ -221,6 +221,11 @@
 		else
 			mask &= ~EM_POPUP_SELECT_MARK_READ;
 
+		if(flags & CAMEL_MESSAGE_ARCHIVED)
+			mask &= ~EM_POPUP_SELECT_MARK_UNARCHIVED;
+		else
+			mask &= ~EM_POPUP_SELECT_MARK_ARCHIVED;
+
 		if (store->flags & CAMEL_STORE_VJUNK) {
 			if ((flags & CAMEL_MESSAGE_JUNK))
 				mask &= ~EM_POPUP_SELECT_NOT_JUNK;
@@ -846,6 +851,8 @@
 	{ "many", EM_POPUP_SELECT_MANY },
 	{ "mark_read", EM_POPUP_SELECT_MARK_READ },
 	{ "mark_unread", EM_POPUP_SELECT_MARK_UNREAD },
+	{ "mark_archive", EM_POPUP_SELECT_MARK_ARCHIVED },
+	{ "mark_unarchive", EM_POPUP_SELECT_MARK_UNARCHIVED },
 	{ "delete", EM_POPUP_SELECT_DELETE },
 	{ "undelete", EM_POPUP_SELECT_UNDELETE },
 	{ "mailing_list", EM_POPUP_SELECT_MAILING_LIST },
Index: mail/em-popup.h
===================================================================
--- mail/em-popup.h	(revision 34423)
+++ mail/em-popup.h	(working copy)
@@ -105,7 +105,9 @@
 	EM_POPUP_SELECT_FOLDER             = 1<<15,     /* do we have any folder at all? */
 	EM_POPUP_SELECT_JUNK               = 1<<16,
 	EM_POPUP_SELECT_NOT_JUNK           = 1<<17,
-	EM_POPUP_SELECT_LAST               = 1<<18,	
+	EM_POPUP_SELECT_MARK_ARCHIVED      = 1<<18,	/* Archive a message */
+	EM_POPUP_SELECT_MARK_UNARCHIVED    = 1<<19,	/* Unarchive a message */
+	EM_POPUP_SELECT_LAST               = 1<<20,	
 };
 
 /**
Index: mail/mail-component.c
===================================================================
--- mail/mail-component.c	(revision 34423)
+++ mail/mail-component.c	(working copy)
@@ -53,6 +53,13 @@
 
 #include "em-search-context.h"
 #include "mail-config.h"
+/* #include "mail-auto-archive.h" */
+/* This is bit a hack kind of thing
+it raises a bonobo error but its works ok with this small .c inlcusion 
+its better we remove this look at the error and solve it
+It was out of my knowledege at this point of time
+*/
+#include "mail-auto-archive.c"
 #include "mail-component.h"
 #include "mail-folder-cache.h"
 #include "mail-vfolder.h"
@@ -315,7 +322,11 @@
 load_accounts (MailComponent *component, EAccountList *accounts)
 {
 	EIterator *iter;
+	CamelStore * store;
+	GConfClient *gconf = mail_config_get_gconf_client();
+	
 
+	srand(time(NULL));
 	/* Load each service (don't connect!). Check its provider and
 	 * see if this belongs in the shell's folder list. If so, add
 	 * it.
@@ -336,8 +347,21 @@
 		if (account->enabled
 		    && service->url != NULL
 		    && service->url[0]
-		    && strncmp(service->url, "mbox:", 5) != 0)
-			mail_component_load_store_by_uri (component, service->url, name);
+		    && strncmp(service->url, "mbox:", 5) != 0){
+			
+			store = mail_component_load_store_by_uri (component, service->url, name);
+			
+			if((!strcmp(store->parent_object.provider->name, "IMAP")) || (!strcmp(store->parent_object.provider->name, "Novell GroupWise"))){
+				printf(" STARTING auto archive for %s\n", store->parent_object.provider->name); 
+				
+				/* Start auto archive thread */
+				/* -1 signifies that run auto archive after the 
+				   time specified by AUTO_ARCHIVE_WAIT_TIME macro */
+				/* Pass 0 if you want to run it immediately */
+				time_t time = (rand () % 100);
+				account_auto_archive_init (store, name, time); 
+			}
+		}
 		
 		e_iterator_next (iter);
 	}
@@ -504,7 +528,7 @@
 
 	if (emfv->folder) {
 		char *name, *title;
-		guint32 visible, unread, deleted, junked;
+		guint32 visible, unread, deleted, junked, archived;
 		GPtrArray *selected;
 		GString *tmp = g_string_new("");
 
@@ -513,7 +537,9 @@
 				 CAMEL_FOLDER_DELETED, &deleted,
 				 CAMEL_FOLDER_VISIBLE, &visible,
 				 CAMEL_FOLDER_JUNKED, &junked,
-				 CAMEL_FOLDER_UNREAD, &unread, NULL);
+				 CAMEL_FOLDER_UNREAD, &unread, 
+				 CAMEL_FOLDER_ARCHIVED, &archived, 
+				 NULL);
 
 		selected = message_list_get_selected(emfv->list);
 
@@ -524,8 +550,10 @@
 		if (CAMEL_IS_VTRASH_FOLDER(emfv->folder)) {
 			if (((CamelVTrashFolder *)emfv->folder)->type == CAMEL_VTRASH_FOLDER_TRASH) {
 				g_string_append_printf(tmp, ngettext ("%d deleted", "%d deleted", deleted), deleted);
-			} else {
-				g_string_append_printf(tmp, ngettext ("%d junk", "%d junk", junked), junked);
+			}else if (((CamelVTrashFolder *)emfv->folder)->type == CAMEL_VTRASH_FOLDER_ARCHIVED) { 
+				g_string_append_printf(tmp, ngettext ("%d archived", "%d archived", archived), archived);
+			}else {
+			  g_string_append_printf(tmp, ngettext ("%d junk", "%d junk", junked), junked);
 			}
 		} else if (em_utils_folder_is_drafts(emfv->folder, emfv->folder_uri)) {
 			g_string_append_printf(tmp, ngettext ("%d draft", "%d drafts", visible), visible);
@@ -1309,13 +1337,20 @@
 		camel_exception_clear (&ex);
 		return NULL;
 	}
-
+	
 	mail_component_add_store(component, store, name);
 	camel_object_unref (store);
 	
+		
 	return store;
 }
 
+/* static void account_auto_archive_init (CamelStore *store) */
+/* { */
+/*   printf("Loading Aruto archiving setup \n"); */
+/* } */
+
+
 static void
 store_disconnect (CamelStore *store, void *event_data, void *user_data)
 {
Index: mail/message-list.c
===================================================================
--- mail/message-list.c	(revision 34423)
+++ mail/message-list.c	(working copy)
@@ -234,6 +234,7 @@
 	{ "stock_score-highest",               NULL },
 	{ "stock_mail-flag-for-followup",      NULL },
 	{ "stock_mail-flag-for-followup-done", NULL },
+	{ "gtk-cdrom",                         NULL }, /* Archived */
 };
 
 /* FIXME: junk prefs */
@@ -1231,7 +1232,9 @@
 	switch (col){
 	case COL_MESSAGE_STATUS:
 		flags = camel_message_info_flags(msg_info);
-		if (flags & CAMEL_MESSAGE_ANSWERED)
+		if (flags & CAMEL_MESSAGE_ARCHIVED)
+			return GINT_TO_POINTER (5);
+		else if (flags & CAMEL_MESSAGE_ANSWERED)
 			return GINT_TO_POINTER (2);
 		else if (flags & CAMEL_MESSAGE_SEEN)
 			return GINT_TO_POINTER (1);
@@ -1351,6 +1354,9 @@
 					label = NULL;
 					goto find_colour;
 				}
+			} else if (camel_message_info_flags(msg_info) & CAMEL_MESSAGE_ARCHIVED) {
+				/* Archived message will be shown in DarkGreen Colour. */
+				colour = "DarkGreen";
 			} else if (camel_message_info_flags(msg_info) & CAMEL_MESSAGE_FLAGGED) {
 				/* FIXME: extract from the important.xpm somehow. */
 				colour = "#A7453E";
@@ -1639,8 +1645,9 @@
 	
 	for (i = 0; i < 5; i++)
 		images [i] = states_pixmaps [i].pixbuf;
+	images [i] = states_pixmaps [17].pixbuf;
 	
-	e_table_extras_add_cell (extras, "render_message_status", e_cell_toggle_new (0, 5, images));
+	e_table_extras_add_cell (extras, "render_message_status", e_cell_toggle_new (0, 6, images));
 	
 	for (i = 0; i < 2; i++)
 		images [i] = states_pixmaps [i + 5].pixbuf;
@@ -2400,9 +2407,11 @@
 {
 	gboolean is_junk_folder;
 	gboolean is_trash_folder;
+	gboolean is_archived_folder;
 	guint32 flags;
 	gboolean flag_junk;
 	gboolean flag_deleted;
+	gboolean flag_archived;
 
 	g_return_val_if_fail (ml != NULL, FALSE);
 	g_return_val_if_fail (ml->folder != NULL, FALSE);
@@ -2411,11 +2420,13 @@
 	/* check folder type */
 	is_junk_folder = ml->folder->folder_flags & CAMEL_FOLDER_IS_JUNK;
 	is_trash_folder = ml->folder->folder_flags & CAMEL_FOLDER_IS_TRASH;
+	is_archived_folder = ml->folder->folder_flags & CAMEL_FOLDER_IS_ARCHIVED;
 
 	/* check flags set on current message */
 	flags = camel_message_info_flags (info);
 	flag_junk = flags & CAMEL_MESSAGE_JUNK;
 	flag_deleted = flags & CAMEL_MESSAGE_DELETED;
+	flag_archived = flags & CAMEL_MESSAGE_ARCHIVED;
 
 	/* perform actions depending on folder type */	
 	if (is_junk_folder) {
@@ -2430,6 +2441,10 @@
 		 * not deleted any more */
 		if (flag_deleted)
 			return TRUE;
+	} else if (is_archived_folder) {
+		/* Lucky : Archived folder node is selectable */
+		if (flag_archived)
+			return TRUE;
 	} else {
 		/* in normal folders it depends on hidedeleted,
 		 * hidejunk and the message flags */
@@ -3043,8 +3058,8 @@
 				changes->uid_removed->pdata[i]);
 		
 		/* check if the hidden state has changed, if so modify accordingly, then regenerate */
-		if (ml->hidejunk || ml->hidedeleted)
-			mail_folder_hide_by_flag (folder, ml, &changes, (ml->hidejunk ? CAMEL_MESSAGE_JUNK : 0) | (ml->hidedeleted ? CAMEL_MESSAGE_DELETED : 0));
+		if (ml->hidejunk || ml->hidedeleted || ml->hidearchived)
+			mail_folder_hide_by_flag (folder, ml, &changes, (ml->hidejunk ? CAMEL_MESSAGE_JUNK : 0) | (ml->hidedeleted ? CAMEL_MESSAGE_DELETED : 0) | (ml->hidearchived ? CAMEL_MESSAGE_ARCHIVED : 0));
 
 		if (changes->uid_added->len == 0 && changes->uid_removed->len == 0 && changes->uid_changed->len < 100) {
 			for (i = 0; i < changes->uid_changed->len; i++) {
@@ -3102,6 +3117,7 @@
 {
 	ETreeModel *etm = message_list->model;
 	gboolean hide_deleted;
+	gboolean hide_archived;
 	GConfClient *gconf;
 	CamelException ex;
 	
@@ -3189,7 +3205,9 @@
 		
 		gconf = mail_config_get_gconf_client ();
 		hide_deleted = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL);
+		hide_archived = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_archived", NULL);
 		message_list->hidedeleted = hide_deleted && !(folder->folder_flags & CAMEL_FOLDER_IS_TRASH);
+		message_list->hidearchived = hide_archived && !(folder->folder_flags & CAMEL_FOLDER_IS_ARCHIVED);
 		message_list->hidejunk = junk_folder && !(folder->folder_flags & CAMEL_FOLDER_IS_JUNK) && !(folder->folder_flags & CAMEL_FOLDER_IS_TRASH);
 		
 		load_hide_state (message_list);
@@ -3464,6 +3482,17 @@
 }
 
 void
+message_list_set_hidearchived (MessageList *ml, gboolean hidearchived)
+{
+	if (ml->hidearchived != hidearchived) {
+		ml->hidearchived = hidearchived;
+		
+		if (ml->frozen == 0)
+			mail_regen_list (ml, ml->search, NULL, NULL);
+	}
+}
+
+void
 message_list_set_search (MessageList *ml, const char *search)
 {
 	if (search == NULL || search[0] == '\0')
@@ -3718,6 +3747,7 @@
 	CamelFolderChangeInfo *changes;
 	gboolean dotree;	/* we are building a tree */
 	gboolean hidedel;	/* we want to/dont want to show deleted messages */
+	gboolean hidearchived;	/* we want to/dont want to show archived messages */
 	gboolean hidejunk;	/* we want to/dont want to show junk messages */
 	gboolean thread_subject;
 	CamelFolderThread *tree;
@@ -3776,9 +3806,9 @@
 				expr = "(match-all (not (system-flag \"deleted\")))";
 		}
 		searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &mm->ex);
-	} else {
+	}else {
 		char *expr;
-
+		
 		if (m->hidejunk) {
 			if (m->search) {
 				expr = alloca(strlen(m->search) + 64);
@@ -3793,7 +3823,17 @@
 				uids = camel_folder_get_uids (m->folder);
 		}
 	}
-	
+
+	if (m->hidearchived) {
+		char *expr;
+
+		if (m->search) {
+			expr = alloca(strlen(m->search) + 64);
+			sprintf(expr, "(and (match-all (not (system-flag \"archived\")))\n %s)", m->search);
+		} else
+			expr = "(match-all (not (system-flag \"archived\")))";
+		searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &mm->ex);
+	}
 	if (camel_exception_is_set (&mm->ex))
 		return;
 	
@@ -4080,6 +4120,7 @@
 	m->changes = changes;
 	m->dotree = ml->threaded;
 	m->hidedel = ml->hidedeleted;
+	m->hidearchived = ml->hidearchived;
 	m->hidejunk = ml->hidejunk;
 	m->thread_subject = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/thread_subject", NULL);
 	g_object_ref(ml);
Index: mail/message-list.h
===================================================================
--- mail/message-list.h	(revision 34423)
+++ mail/message-list.h	(working copy)
@@ -125,6 +125,9 @@
 	/* do we automatically hide deleted messages? */
 	guint hidedeleted : 1;
 
+	/* do we automatically hide archived messages? */
+	guint hidearchived : 1;
+
 	/* do we automatically hide junk messages? */
 	guint hidejunk : 1;
 	
1,172d0
< /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
< /* mail-component.c
<  *
<  * Copyright (C) 2003  Ximian Inc.
<  *
<  * Authors: Lucky R. Wankhede <wlakke@novell.com>
<  *
<  * 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., 51 Franklin Street, Fifth Floor,
<  * Boston, MA 02110-1301, USA.
<  *
<  */
< 
< #ifdef HAVE_CONFIG_H
< #include <config.h>
< #endif
< 
< #include <stdlib.h>
< #include <string.h>
< #include <sys/types.h>
< #include <sys/stat.h>
< #include <unistd.h>
< #include <fcntl.h>
< #include <errno.h>
< 
< #include <glib/gi18n.h>
< 
< /*#include "mail-auto-archive.h" */
< #include "mail-component.h"
< #include "mail-mt.h"
< 
< struct _timer_thread_msg {
< 	struct _mail_msg msg;
< 
< 	char *name;
< 	CamelStore *store;
< 	int time;
< };
< 
< struct _archived_mail_msg {
< 	struct _mail_msg msg;
< 
< 	char *name;
< 	CamelStore *store;
< 	int count;
< };
< 
< static void timer_thread_start (struct _mail_msg *mm)
< {
< 	printf ("Timer Thread started ............... \n");
< 	return g_strdup ((" "));
< }
< 
< static void timer_thread_run (struct _mail_msg *mm)
< {
< 	struct _timer_thread_msg * msg = (struct _timer_thread_msg *) mm;
< 	
< 	printf ("Running timer Thread............... \n");
< 	if(msg->time < 0){
< 		time_t t = ((time(NULL)%10)*2);
< 		printf ("=============== thread time %d===================\n", t);
< 		sleep (t);
< 	}
< 	else{
< 		printf ("=============== thread time %d===================\n", msg->time);
<  		sleep (msg->time); 
< 	}
< 
< 	/* char *str = g_strdup_printf ("Evolution wants to run auto archive for account %s. Do you want evolution to proceed?\n", msg->name); */	
< 
< 	if (em_utils_prompt_user (NULL, NULL, "mail:auto-archiving-start", msg->name, NULL))
< 		;
< }
< 
< static void timer_thread_free (struct _mail_msg *mm)
< {
< 	struct _timer_thread_msg *msg = (struct _timer_thread_msg *) mm;
< 	
< 	/* g_free(msg->name); */
< }
< 
< 
< /* All about auto archived thread */
< static void archiving_thread_start (struct _mail_msg *mm)
< {
< 	struct _archived_mail_msg *msg_arch = (struct _archived_mail_msg *) mm;
< 	printf ("Starting archiving now ............ %s \n",msg_arch->name);
< 	
< 	char *str = g_strdup_printf (_("Auto archiving account %s"), msg_arch->name);
< 	return g_strdup ((str));
< }
< 
< static void 
< archiving_thread_run (struct _mail_msg *mm)
< {
< 	struct _archived_mail_msg *msg_arch = (struct _archived_mail_msg *) mm;
< 	CamelException *ex;
< 
< 	int i = camel_store_archive_messages (msg_arch->store, ex);
< 	msg_arch->count = i;
< }
< 
< static void 
< archiving_thread_done (struct _mail_msg *mm)
< {
< 	struct _archived_mail_msg *msg_arch = (struct _archived_mail_msg *) mm;
< 	
< 	char * str = g_strdup_printf ("%d", msg_arch->count);
< 	if (em_utils_prompt_user (NULL, NULL, "mail:auto-archiving-done", str, msg_arch->name,NULL))
< 		;
< 	g_free (str);
< 	printf ("Auto archiving done............... \n");
< }
< 
< static void 
< archiving_thread_free (struct _mail_msg *mm)
< {
< 	struct _archived_mail_msg *msg_arch = (struct _archived_mail_msg *) mm;
< 
< 	camel_object_unref (msg_arch->store);
< 	g_free (msg_arch->name);
< }
< 
< static struct _mail_msg_op archiving_thread_op = {
< 	archiving_thread_start,
< 	archiving_thread_run,
< 	archiving_thread_done,
< 	archiving_thread_free
< };
< 
< static void
< timer_thread_done (struct _mail_msg *mm)
< {
< 	struct _timer_thread_msg *msg = (struct _timer_thread_msg *) mm;
< 	struct _archived_mail_msg *msg_arch;
< 
< 	msg_arch = mail_msg_new (&archiving_thread_op, NULL, sizeof (struct _archived_mail_msg));
< 	msg_arch->store = msg->store;
< 	camel_object_ref (msg_arch->store);
< 	msg_arch->name = msg->name;
< 	
< 	e_thread_put (mail_thread_new, (EMsg *)msg_arch);
< }
< 
< static struct _mail_msg_op timer_thread_op = {
< 	timer_thread_start,
< 	timer_thread_run,
< 	timer_thread_done,
< 	timer_thread_free,
< };
< 
< static void account_auto_archive_init (CamelStore *store, char *name, int i)
< {
< 	struct _timer_thread_msg * msg;
< 	
< 	msg = mail_msg_new (&timer_thread_op, NULL, sizeof (struct _timer_thread_msg));
< 	msg->store = store;
< 	msg->name = g_strdup(name);
< 	msg->time = i;
< 
< 	e_thread_put (mail_thread_new, (EMsg *)msg);
< }
1,23d0
< /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
< /* mail-component.c
<  *
<  * Copyright (C) 2003  Ximian Inc.
<  *
<  * Authors: Lucky R. Wankhede <wlakke@novell>
<  * 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., 51 Franklin Street, Fifth Floor,
<  * Boston, MA 02110-1301, USA.
<  *
<  */
< 
< static void account_auto_archive_init (CamelStore *store, char *name, int i);
