Index: sandbox/2.5.0-expresso1/expressoMail1_2/templates/default/main.css
===================================================================
--- sandbox/2.5.0-expresso1/expressoMail1_2/templates/default/main.css	(revision 7113)
+++ sandbox/2.5.0-expresso1/expressoMail1_2/templates/default/main.css	(revision 7157)
@@ -130,4 +130,6 @@
 .context-menu-item.icon-delete-box{ background-image: url(images/user_delete.png); }
 .context-menu-item.icon-quick-search-contact{ background-image: url(images/zoom.png); }
+/* Airton. Adicionando o ícone da opção de arquivar do menu de contexto do expressoMail */
+.context-menu-item.icon-archive{ background-image: url(images/archive.png); }
 
 
Index: sandbox/2.5.0-expresso1/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- sandbox/2.5.0-expresso1/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 7070)
+++ sandbox/2.5.0-expresso1/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 7157)
@@ -5436,4 +5436,57 @@
 	}
 
+	
+	/* Airton
+	 * Fazendo um port dos métodos necessários para o arquivamento de mensagens
+	 */
+	//MailArchiver -> get offsettogmt as a global javascript variable, invoked at "main.js", init()
+    function get_offset_gmt(){
+        return($this->functions->CalculateDateOffset());
+    }
+    
+    //MailArchiver -> get message flags only, invoked at archive operation
+    function get_msg_flags($args){       
+		$msg_folder = $args['folder'];
+        $msg_n = $args['msg_number'];
+        
+        $arr_msg = explode(",", $msg_n);
+       
+        for($i=0; $i<count($arr_msg); $i++){
+                        
+            if(!$this->mbox || !is_resource($this->mbox))
+                $this->mbox = $this->open_mbox($msg_folder);
+        
+            if(!is_resource($this->mbox))
+                return(false);
+                       
+            $header = @imap_headerinfo($this->mbox, imap_msgno($this->mbox, $arr_msg[$i]), 80, 255);
+                
+            if (!is_object($header))
+                return false;
+
+            $taglist[$i]["msgid"] = $msg_n;
+            $taglist[$i]["unseen"] = $header->Unseen;
+            $taglist[$i]["recent"] = $header->Recent;
+            $taglist[$i]["flagged"] = $header->Flagged;
+            $taglist[$i]["draft"] = $header->Draft;
+            $taglist[$i]["answered"] = $header->Answered;
+            $taglist[$i]["deleted"] = $header->Deleted;
+        
+            if($header->Answered =='A' && $header->Draft == 'X')
+                $taglist[$i]['forwarded'] = 'F';
+            else
+                $taglist[$i]['forwarded'] = ' ';
+        
+            if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_important_flag']) {
+                $flag = preg_match('/importance *: *(.*)\r/i',imap_fetchheader($this->mbox, imap_msgno($this->mbox, $arr_msg[$i])),$importance);
+                $taglist[$i]["importance"] = $flag==0?"Normal":$importance[1];
+            }
+        }
+		return $taglist;        
+    }    
+	/* Airton
+	 * Fim dos métodos 
+	 */
+	
 }
 ?>
Index: sandbox/2.5.0-expresso1/expressoMail1_2/inc/class.exporteml.inc.php
===================================================================
--- sandbox/2.5.0-expresso1/expressoMail1_2/inc/class.exporteml.inc.php	(revision 7040)
+++ sandbox/2.5.0-expresso1/expressoMail1_2/inc/class.exporteml.inc.php	(revision 7157)
@@ -478,4 +478,42 @@
 	}
 
+	
+	
+	/* Airton
+	 * Fazendo o port de um método necessário para o funcionamento do arquivamento local
+	 */
+	//MAILARCHIVER 
+	function js_source_var($params) {
+		$this-> folder = $params['folder'];
+		if(!$this->folder){
+		   $aux = explode(';',$params['msgs_to_export']);
+		   $this->folder = $aux[0];
+		   $id_number = $aux[1];
+		}
+		else{
+			$id_number = $params['msgs_to_export'];
+		}
+		$this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","ISO_8859-1");
+		$tempDir = ini_get("session.save_path");
+
+		$this->connectImap();
+		$header	 	= $this-> getHeader($id_number);
+		$body		= $this-> getBody($id_number);
+
+		imap_close($this->mbox_stream);
+		
+		$input = $header . "\r\n\r\n" . $body;
+		$input = preg_replace('/\x1d/', '', $input); //remove special char control detected (hex 1D)
+		
+		return($input);
+	} 
+	/*Airton 
+	 * Fim do método portado
+	 */ 
+	
+	
+	
+	
+	
     function export_msg_data($id_msg,$folder) {
 		$this->folder = $folder;
Index: sandbox/2.5.0-expresso1/expressoMail1_2/js/mail_archiver.js
===================================================================
--- sandbox/2.5.0-expresso1/expressoMail1_2/js/mail_archiver.js	(revision 7150)
+++ sandbox/2.5.0-expresso1/expressoMail1_2/js/mail_archiver.js	(revision 7157)
@@ -403,11 +403,9 @@
 MailArchiver.prototype.Archive = function(source_folder,destination_folder,msgs_id){
     //window.alert('tentando arquivar a mensagem [' + msgs_id + '], do folder ['+source_folder+'] para a pasta destino ['+destination_folder+']');
-    modal('archive_queue');
+    //modal('archive_queue');
     
     try{
-        
         //Sets the folders properties: destination and origin
         expresso_mail_archive.folder_origin = source_folder;
-        
         expresso_mail_archive.CreateMessageList(msgs_id);
         var tagsHandler = function(data){
@@ -456,5 +454,5 @@
                     try{
                         //Archive services needs session id, message source and destination folder
-                        ArchiveServices.archive(expresso_mail_archive.getArchiveOperationOK, expresso_mail_archive.getArchiveOperationFailure, expresso_mail_archive.session.id, expresso_mail_archive.folder_destination, data);
+						ArchiveServices.archive(expresso_mail_archive.getArchiveOperationOK, expresso_mail_archive.getArchiveOperationFailure, expresso_mail_archive.session.id, expresso_mail_archive.folder_destination, data);
                     }
                     catch(e){
@@ -464,9 +462,9 @@
                 
                 //document.getElementById('main_title').innerHTML = get_lang('Archiving message %1 of %2 on folder %3', expresso_mail_archive.messages_processed, expresso_mail_archive.total_messages, fcaption);
-                document.getElementById('text_archive_queue').innerHTML = get_lang('Archiving message %1 of %2 on folder %3', expresso_mail_archive.messages_processed+1, expresso_mail_archive.total_messages, fcaption);
+                //document.getElementById('text_archive_queue').innerHTML = get_lang('Archiving message %1 of %2 on folder %3', expresso_mail_archive.messages_processed+1, expresso_mail_archive.total_messages, fcaption);
                 cExecute("$this.exporteml.js_source_var",arch_handler,"folder="+url_decode(source_folder)+"&msgs_to_export="+expresso_mail_archive.message_list[0]);                
             }
             else{
-                close_lightbox();
+                //close_lightbox();
                 write_msg(get_lang('Archive operation error: getting online message flags fails. Achievement will not be done'),true);
                 expresso_mail_archive.archivefolder = null;
@@ -493,5 +491,5 @@
     catch(e){
         //window.alert(get_lang("Archive error: %1", (e.description)?e.description:e));
-        expresso_mail_archive.getFaultInfo();
+		expresso_mail_archive.getFaultInfo();
     }
 }
Index: sandbox/2.5.0-expresso1/expressoMail1_2/js/messages_controller.js
===================================================================
--- sandbox/2.5.0-expresso1/expressoMail1_2/js/messages_controller.js	(revision 7150)
+++ sandbox/2.5.0-expresso1/expressoMail1_2/js/messages_controller.js	(revision 7157)
@@ -711,4 +711,25 @@
 		}
 	}
+	
+
+
+	/* Airton
+	* Método que vai chamar efetivamente o método Archive.
+	* TO-DO: Tirar desse arquivo o método e passar pra outro arquivo
+	*/
+	messages_proxy.prototype.archive_message = function(folder, msgs_number) {
+		if(msgs_number == 'get_selected_messages')
+			msgs_number = get_selected_messages();
+
+		var array_msgs = msgs_number.split(",");
+
+		// No momento só estou arquivando uma primeira mensagem.
+		// Ver qual é o padrão de parâmetro que o serviço espera para mandar mais de uma mensagem para arquivar
+		expresso_mail_archive.Archive("INBOX", "inbox", array_msgs[0]);
+		//expresso_mail_archive.Archive("INBOX", "inbox", msgs_number);
+	}
+
+
+	
 	/*
     	messages_proxy.prototype.proxy_export_all_msg=function(){
Index: sandbox/2.5.0-expresso1/expressoMail1_2/js/doiMenuData.js
===================================================================
--- sandbox/2.5.0-expresso1/expressoMail1_2/js/doiMenuData.js	(revision 7053)
+++ sandbox/2.5.0-expresso1/expressoMail1_2/js/doiMenuData.js	(revision 7157)
@@ -128,5 +128,10 @@
 			"move": {"name": get_lang("Move to")+"...", "icon": "move", callback: function(key, opt){ wfolders.makeWindow('', 'move_to'); }},
 			"remove": {"name": get_lang("Delete"),      "icon": "delete", callback: function(key, opt){ proxy_mensagens.delete_msgs('null','selected','null'); }},
-			"export": {"name": get_lang("Export"),      "icon": "export", callback: function(key, opt){ proxy_mensagens.export_all_messages(); }}
+			"export": {"name": get_lang("Export"),      "icon": "export", callback: function(key, opt){ proxy_mensagens.export_all_messages(); }},
+			/* Airton
+				TO-DO: Esse menu só deve aparecer quando a preferência de arquivamento local estiver ativada
+				Como aqui dentro não dá pra fazer um if, fazer isso no início do método, passar toda essa linha para uma string e depois só colocar a variável aqui embaixo
+			*/   
+			"archive": {"name": get_lang("Archive"), "icon": "archive", callback: function(key, opt){ proxy_mensagens.archive_message('inbox', 'get_selected_messages'); }}
 		}
 	});
