Index: /sandbox/2.4.1-1/prototype/modules/mail/js/followupflag.js
===================================================================
--- /sandbox/2.4.1-1/prototype/modules/mail/js/followupflag.js	(revision 6280)
+++ /sandbox/2.4.1-1/prototype/modules/mail/js/followupflag.js	(revision 6285)
@@ -698,5 +698,10 @@
 	
 }
+		
 $('#main_table').ready(function(){
-    alarmFollowupflagged();
+	handlerMessageFilter = function (data) {
+		alarmFollowupflagged(null, data);
+	}
+	/* Busca  nas pastas indexadas para ver se há novas mensagens com a flag $FilteredMessage */
+	cExecute ("$this.imap_functions.getFlaggedAlertMessages&folders="+fromRules, handlerMessageFilter);
 });
Index: /sandbox/2.4.1-1/prototype/modules/filters/interceptors/FilterMapping.php
===================================================================
--- /sandbox/2.4.1-1/prototype/modules/filters/interceptors/FilterMapping.php	(revision 6213)
+++ /sandbox/2.4.1-1/prototype/modules/filters/interceptors/FilterMapping.php	(revision 6285)
@@ -217,5 +217,7 @@
 			$script_criteria .= ")"; 
 
-			$script_action = " {\r\n ";
+			//$script_action = " {\r\n ";
+			/* Somente para controlar que o addFlag virá antes de qualquer ação. Modificar isso depois */
+			$action_addFlag = '';
 			
 			if( is_array($action) )
@@ -223,4 +225,12 @@
 			{
 				switch ($action[$k]['type']) {
+					case 'setflag':
+						$require_flag = true;
+						$action[$k]['parameter'] = "\\\\" . $action[$k]['parameter'];
+						break;
+					case 'addflag':	
+						$require_flag = true;
+						$action_addFlag = "addflag \"" . $action[$k]['parameter'] . "\";\r\n ";
+						break;
 					case 'redirect':
 						break;
@@ -238,15 +248,15 @@
 						$vacation = true;
 						continue;
-					case 'setflag':
-						$require_flag = true;
-						$action[$k]['parameter'] = "\\\\" . $action[$k]['parameter'];
-						break;
 					case 'discard':
 						break;
 				}
-				if ($vacation == false) $script_action .= $action[$k]['type'] . " \"" . $action[$k]['parameter'] . "\";\r\n ";
+				if ($vacation == false && $action[$k]['type'] != 'addflag') $script_action .= $action[$k]['type'] . " \"" . $action[$k]['parameter'] . "\";\r\n ";
 			}
-			$script_action .= "}";
 			
+			/* ATENÇÃO: Colocar sempre o comando addflag antes de qualquer outro no caso de ações compostas no Sieve */
+			if ($action_addFlag != '') $script_action = $action_addFlag . $script_action; 
+			
+			$script_action = "{\r\n " . $script_action . "}";
+			$action_addFlag = '';
 			if($vacation == false)
 				$script_rules .= $script_match . $script_criteria . $script_action . "\r\n";
@@ -256,4 +266,5 @@
 			$script_match = "";
 			$script_criteria = "";	
+			$script_action = "";
 			$data['applyMessages'] = "";					 		
 		}
@@ -281,5 +292,5 @@
 
 		$content = $script_begin . $script_header . $script_rules . "\r\n\r\n#PseudoScript#" . "\r\n#" . $json_data;
-		
+
 		return( $content );
 	}
Index: /sandbox/2.4.1-1/prototype/modules/filters/filters.js
===================================================================
--- /sandbox/2.4.1-1/prototype/modules/filters/filters.js	(revision 6176)
+++ /sandbox/2.4.1-1/prototype/modules/filters/filters.js	(revision 6285)
@@ -1,2 +1,20 @@
+/* 
+ * Retorna as regras por remetente e que o usuário deseja ser avisado 
+ *
+ */
+function getFromAlertRules() { 
+	var filters = DataLayer.get("filter");
+	fromRules = [];
+	var alertMessage;
+	for (var index in filters) {
+		alertMessage = filters[index]['alertMessage'];		
+		for(var criterias in filters[index]['actions']) {
+			if (filters[index]['actions'][criterias]['type'] == 'fileinto' && alertMessage == 'true')
+				fromRules[fromRules.length] = filters[index]['actions'][criterias]['parameter'];
+		}
+	}
+	return fromRules;
+}
+
 function outOfficeVerify() { 	
 	DataLayer.remove('filter', false);
@@ -173,7 +191,6 @@
 
 DataLayer.codec( "filter", "detail", {
-  
   decoder: function( form ){
-      if( form.vacation )
+	  if( form.vacation )
 	  return {
 		criteria: [{ value: "vacation", operator: "", field: "vacation" }],
@@ -205,4 +222,12 @@
 			
 			!the_parameter ? the_parameter = form.actionParameter[i+1] : "";
+			if (type == 'alertMessage') { 
+				//if(!$('[value="alertMessage"]').parent().hasClass("hidden")){
+					type = 'addflag';
+					the_parameter = '$FilteredMessage';
+				//}else{
+				//	return;
+				//}
+			} 
 			if (type == 'fileinto') { 
 				the_parameter = form.valueFileInto;
@@ -234,4 +259,5 @@
 		}),
 		enabled : true,
+		alertMessage: $('.alertMessage').is(':checked'),
 		//applyMessages: allMessages? !$.isEmptyObject( selectedMessages ) ?
 		//keys( selectedMessages ) : allMessages : ""
@@ -261,5 +287,4 @@
   },
   encoder:function( data ){
- 
       var tree1 = [], tree2 = [], tree3 = [];
 
@@ -293,6 +318,5 @@
 });
 
-
-
+fromRules = getFromAlertRules();
 
 var BASE_PATH = '../prototype/';
Index: /sandbox/2.4.1-1/prototype/modules/filters/edit-filter.ejs
===================================================================
--- /sandbox/2.4.1-1/prototype/modules/filters/edit-filter.ejs	(revision 6128)
+++ /sandbox/2.4.1-1/prototype/modules/filters/edit-filter.ejs	(revision 6285)
@@ -121,4 +121,6 @@
 					%>
 				</select>
+				<input type="checkbox" name="actionType[]" value="alertMessage" class="alertMessage"/>
+				<label><%= get_lang("Alert message filter by sender")%></label>
 			</fieldset>
 			<fieldset>
Index: /sandbox/2.4.1-1/expressoMail1_2/setup/phpgw_pt-br.lang
===================================================================
--- /sandbox/2.4.1-1/expressoMail1_2/setup/phpgw_pt-br.lang	(revision 6217)
+++ /sandbox/2.4.1-1/expressoMail1_2/setup/phpgw_pt-br.lang	(revision 6285)
@@ -16,4 +16,5 @@
 Add user into my IM	expressoMail1_2	pt-br	Adicionar no meu IM
 After store email in your local computer delete it from server	expressoMail1_2	pt-br	Depois de guardar e-mail no seu computador local, excluí-lo do servidor
+Alert message filter by sender	expressoMail1_2	pt-br	Alertar ao receber mensagens filtradas por remetente
 all	expressoMail1_2	pt-br	Todas
 All messages are successfully unarchived	expressoMail1_2	pt-br	Mensagens desarquivadas com sucesso
Index: /sandbox/2.4.1-1/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- /sandbox/2.4.1-1/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 6212)
+++ /sandbox/2.4.1-1/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 6285)
@@ -5271,4 +5271,48 @@
 		return $ret;
 	}
+	
+	
+	/**
+	* Método que retorna as mensagens com a flag $FilteredMessage que representa as mensagens filtradas que devem ser alertadas para o usuário
+	*
+	* @license    http://www.gnu.org/copyleft/gpl.html GPL
+	* @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
+	* @sponsor    Caixa Econômica Federal
+	* @author     Airton Bordin Junior <airton@prognus.com.br>
+	* @author	  Marcieli <marcieli@prognus.com.br>	
+	* @author	  Marcos <marcosw@prognus.com.br>	
+	* @param      <Array> <$paramFolders> <Pastas onde devem ser buscadas as mensagens>
+	* @return     <Mensagens encontradas com a flag $FilteredMessage>
+	* @access     <public>
+	*/
+	function getFlaggedAlertMessages($paramFolders) {
+		
+		$folders = explode(",", $paramFolders['folders']);
+	
+		$messages = array();
+		$result   = array();
+		$label    = '$FilteredMessage';
+		
+		foreach ($folders as $folder) {
+			$this->mbox = $this->open_mbox($folder);
+			$messages = imap_search($this->mbox, 'ALL KEYWORD "$FilteredMessage"', SE_UID);
+			
+			if(is_array($messages))
+				foreach ($messages as $k => $m) {
+					$headers = imap_fetch_overview($this->mbox, $m, FT_UID);
+
+					$result[] = array (
+						'udate'      => $headers[0]->udate,
+						'smalldate'  => $headers[0]->date,
+						'from'       => $headers[0]->from,
+						'subject'    => $headers[0]->subject,
+						'msg_number' => $m,
+						'msg_folder' => $folder
+					);
+					
+				}
+		}
+		return $result;
+	}
 }
 ?>
Index: /sandbox/2.4.1-1/expressoMail1_2/js/main.js
===================================================================
--- /sandbox/2.4.1-1/expressoMail1_2/js/main.js	(revision 6280)
+++ /sandbox/2.4.1-1/expressoMail1_2/js/main.js	(revision 6285)
@@ -510,4 +510,11 @@
 function refresh(alert_new_msg){
 	var handler_refresh = function(data){
+		
+		handlerMessageFilter = function (data) {
+			alarmFollowupflagged('filtersAlarms', data);
+		}
+		/* Busca  nas pastas indexadas para ver se há novas mensagens com a flag $FilteredMessage */
+		cExecute ("$this.imap_functions.getFlaggedAlertMessages&folders="+fromRules, handlerMessageFilter);
+		
 		if(data['msg_range_end'])
 			if(data['msg_range_end'] > 0)
