Index: branches/2.4/expressoMail1_2/inc/class.db_functions.inc.php
===================================================================
--- branches/2.4/expressoMail1_2/inc/class.db_functions.inc.php	(revision 6331)
+++ branches/2.4/expressoMail1_2/inc/class.db_functions.inc.php	(revision 6754)
@@ -24,5 +24,4 @@
 	include_once(PHPGW_API_INC.'/class.db.inc.php'); 
 } 
-include_once('class.dynamic_contacts.inc.php');
 	
 class db_functions
@@ -248,32 +247,4 @@
 	}
 
-	//Gera lista de contatos para ser gravado e acessado pelo expresso offline.
-	function get_dropdown_contacts_to_cache() {
-		return $this->get_dropdown_contacts();
-	}
-	
-	function get_dropdown_contacts(){
-		$contacts = $this->get_cc_contacts();
-		$groups = $this->get_cc_groups();
-		
-		if(($contacts) && ($groups))
-			$stringDropDownContacts = $contacts . ',' . $groups;
-		elseif ((!$contacts) && (!$groups))
-			$stringDropDownContacts = '';
-		elseif (($contacts) && (!$groups))
-			$stringDropDownContacts = $contacts;
-		elseif ((!$contacts) && ($groups))
-			$stringDropDownContacts = $groups;
-					
-		if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts']) {
-			// Free others requests 
-                        session_write_close(); 
-			$dynamic_contact = new dynamic_contacts();
-			$dynamic = $dynamic_contact->dynamic_contact_toString();
-			if ($dynamic)
-				$stringDropDownContacts .= ($stringDropDownContacts ? ',' : '') . $dynamic;
-		}
-		return $stringDropDownContacts;	
-	}
 	function getUserByEmail($params){	
 		// Follow the referral
@@ -309,60 +280,4 @@
 	}
 	
-	function get_dynamic_contacts()
-	{				
-		// Pesquisa os emails e ultima inserção nos contatos dinamicos.
- 		if(!$this->db->select('phpgw_expressomail_contacts','data','id_owner ='.$this->user_id,__LINE__,__FILE__))
-		{
-        	return $this->db->Error;
-}
-		while($this->db->next_record())
-		{
-			$result[] = $this->db->row();
-		}
-		if($result) foreach($result as $item) 
-		{
-			$contacts = unserialize($item['data']);
-		}
-		if (count($contacts) == 0)
-		{			
-			return null;
-		}	
-		//Sort by email
-		function cmp($a, $b) { return strcmp($a["email"], $b["email"]);} 
-		usort($contacts,"cmp");
-		return $contacts;
-	}
-	function update_contacts($contacts=array())
-	{			
-		
-	
-		if(!$this->db->select('phpgw_expressomail_contacts','data','id_owner ='.$this->user_id,__LINE__,__FILE__))
-        {
-            $result['dberr1'] = $this->db->Error;
-        }
-		$regs = array();
-		while($this->db->next_record())
-        {
-            $regs[] = $this->db->row();
-        }
-		$old_contatacts = array();
-		foreach($regs as $old){
-			$old_contatacts = unserialize($old['data']);
-		}
-		 
-		foreach($old_contatacts as $i => $v)
-			foreach($contacts as $ii => $vv)
-				if(trim($v['email']) == trim($vv['email']))
-					unset($old_contatacts[$i]);
-		
-		 
-		 $old_contatacts = array_merge( $old_contatacts , $contacts);		
-		// Atualiza um email nos contatos dinamicos.
-		if(!$this->db->update('phpgw_expressomail_contacts ','data=\''.serialize($old_contatacts).'\'','id_owner ='.$this->user_id,__LINE__,__FILE__))
-		{
-			return $this->db->Error;
-		}
-		return $contacts;
-	}	
 	function update_preferences($params){
 		$string_serial = urldecode($params['prefe_string']);				
@@ -375,24 +290,4 @@
 		else
 			return array("success" => true);
-	}
-	
-	function insert_contact($contact)	
-	{
-		$contacts[] = array( 'timestamp' 	=> time(),
-								'email'		=> $contact );
-
-		// Insere um email nos contatos dinamicos.	
-		$query = 'INSERT INTO phpgw_expressomail_contacts (data, id_owner)  ' .
-					'values ( \''.serialize($contacts).'\', '.$this->user_id.')';
-		
-		if(!$this->db->query($query,__LINE__,__FILE__))
-    	  	return $this->db->Error;
-    	return $contacts;
-	}
-	
-	function remove_dynamic_contact($user_id,$line,$file)
-	{
-		$where = $user_id.' = id_owner';
-		$this->db->delete('phpgw_expressomail_contacts',$where,$line,$file);	
 	}
 	
Index: branches/2.4/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- branches/2.4/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 6735)
+++ branches/2.4/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 6754)
@@ -1095,5 +1095,4 @@
 	function get_info_msg($params)
 	{
-	
 		if(isset($params['alarm'])){
 			$alarm = $params['alarm'];
@@ -1140,8 +1139,8 @@
 	    //$return['signature']	= $return_get_body['signature'];
 		}
-		
+
 		$pattern = '/^[ \t]*Disposition-Notification-To:.*/mi';
 		if (preg_match($pattern, $header_, $fields))
-		$return['DispositionNotificationTo'] = base64_encode(trim(str_ireplace('Disposition-Notification-To:', '', $fields[0])));
+			$return['DispositionNotificationTo'] = base64_encode(trim(str_ireplace('Disposition-Notification-To:', '', $fields[0]))); 
 
 		$return['Recent']	= $header->Recent;
@@ -1400,9 +1399,9 @@
 		$return['login'] = $_SESSION['phpgw_info']['expressomail']['user']['account_id'];//$GLOBALS['phpgw_info']['user']['account_id'];
 		$return['reply_toaddress'] = $header->reply_toaddress;
-                
+  		
 		if(($return['from']['email'] ==  '@unspecified-domain' || $return['sender']['email'] == null) && $return['msg_folder'] == 'INBOX/Drafts'){
 			$return['from']['email'] = "Rascunho";
 		}
-		
+
 		if(strpos($return['toaddress2'], 'undisclosed-recipients') !== false){
 			$return['toaddress2'] = $this->functions->getLang('without destination');
@@ -1677,5 +1676,5 @@
                         break;
 
-                      case 'CANCEL':
+                    case 'CANCEL':
 
                           $ical = $icalService->getComponent('vevent');
@@ -2811,7 +2810,7 @@
             $header = $this->get_header($msg_numb);
             $header_ = imap_fetchheader($this->mbox, $msg_numb, FT_UID);
-            $pattern = '/^[ \t]*Disposition-Notification-To:.*/mi'; 
- 	                if (preg_match($pattern, $header_, $fields)) 
- 	                        $return['DispositionNotificationTo'] = base64_encode(trim(str_ireplace('Disposition-Notification-To:', '', $fields[0])));
+            $pattern = '/^[ \t]*Disposition-Notification-To:.*/mi';
+			if (preg_match($pattern, $header_, $fields))
+				$return['DispositionNotificationTo'] = base64_encode(trim(str_ireplace('Disposition-Notification-To:', '', $fields[0]))); 
 
             $message_id = $header->message_id;
@@ -2918,9 +2917,9 @@
                      if($att['disposition'] == 'embedded' && $isHTML) //Caso mensagem em texto simples converter os embedded para attachments
                      {
-                         $body = str_replace('"../prototype/getArchive.php?mailAttachment='.$att['id'].'"', $att['name'], $body);
-                         $mailService->addStringImage(base64_decode($att['source']), $att['type'], mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1')); 
+                         $body = str_replace('"../prototype/getArchive.php?mailAttachment='.$att['id'].'"', '"'.mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1').'"', $body);
+                         $mailService->addStringImage(base64_decode($att['source']), $att['type'], mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1'));
                      }
                      else
-                          $mailService->addStringAttachment(base64_decode($att['source']), mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1'), $att['type'], 'base64', isset($att['disposition']) ? $att['disposition'] :'attachment' );
+                         $mailService->addStringAttachment(base64_decode($att['source']), mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1'), $att['type'], 'base64', isset($att['disposition']) ? $att['disposition'] :'attachment' );
                      
                      $message_size_total += $att['size'];
@@ -2937,5 +2936,5 @@
                                 {    
                                     $body = str_ireplace('<img src="./inc/get_archive.php?msgFolder='.$value['folder'].'&msgNumber='.$value['uid'].'&indexPart='.$value['part'].'" />' , '<img src="'.$att['name'].'" />', $body);
-                                    $mailService->addStringImage($att['source'], $att['type'],mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1') ); 
+                                    $mailService->addStringImage($att['source'], $att['type'],mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1') );
                                 }
                                 else
@@ -2948,6 +2947,6 @@
                                 $mbox_stream = $this->open_mbox(mb_convert_encoding($value['folder'] , 'ISO-8859-1' , 'UTF7-IMAP'));
                                 $rawmsg = $this->getRawHeader($value['uid']) . "\r\n\r\n" . $this->getRawBody($value['uid']);
-                                 
- 		                $mailService->addStringAttachment($rawmsg, mb_convert_encoding(base64_decode($value['name']), 'ISO-8859-1' , 'UTF-8,ISO-8859-1'), 'message/rfc822', '7bit', 'attachment' ); 
+                                
+                                $mailService->addStringAttachment($rawmsg, mb_convert_encoding(base64_decode($value['name']), 'ISO-8859-1' , 'UTF-8,ISO-8859-1'), 'message/rfc822', '7bit', 'attachment' );
                                 $message_size_total += mb_strlen($rawmsg); //Adiciona o tamanho do anexo a variavel que controlao tamanho da msg.
                                 unset($rawmsg);
@@ -3029,18 +3028,18 @@
              */
             ////////////////////////////////////////////////////////////////////////////////////////////////////
-
             if ($isHTML)
-	    { 
- 	        $defaultStyle = ''; 
- 		 
- 	        if(isset($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['font_family_editor']) && $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['font_family_editor']) 
- 	        $defaultStyle .= ' font-family:'.$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['font_family_editor'] .';'; 
- 		                 
- 	        if(isset($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['font_size_editor']) && $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['font_size_editor']) 
- 	        $defaultStyle .= ' font-size:'.$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['font_size_editor'].';'; 
- 	               
- 	        $body = '<span class="'.$defaultStyle.'">'.$body.'</span>'; 
+            {
+                $this->rfc2397ToEmbeddedAttachment($mailService , $body);
+
+                $defaultStyle = '';
+                if(isset($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['font_family_editor']) && $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['font_family_editor'])
+                    $defaultStyle .= ' font-family:'.$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['font_family_editor'] .';';
+                
+                if(isset($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['font_size_editor']) && $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['font_size_editor'])
+                    $defaultStyle .= ' font-size:'.$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['font_size_editor'].';';
+    
+                $body = '<span class="'.$defaultStyle.'">'.$body.'</span>';
                 $mailService->setBodyHtml($body);
-	     }
+            }    
             else
                 $mailService->setBodyText($body);
@@ -3074,14 +3073,7 @@
                     error_log("$now - $userip - $sent [$subject] - $userid => $addrs\r\n", 3, "/home/expressolivre/mail_senders.log");
                 }
-                if ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts']) {
-                    $contacts = new dynamic_contacts();
-                    $new_contacts = $contacts->add_dynamic_contacts($toaddress . "," . $ccaddress . "," . $ccoaddress);
-                    return array("success" => true, "new_contacts" => $new_contacts);
-                }
-                
-                   if($params['uids_save'] )
-                        $this->delete_msgs(array('folder'=> $params['save_folder'] , 'msgs_number' => $params['uids_save']));
+                if($params['uids_save'] )
+					$this->delete_msgs(array('folder'=> $params['save_folder'] , 'msgs_number' => $params['uids_save']));
                        
-                
                 //return array("success" => true, "folder" => $folder_list);
 				return array("success" => true, "load" => $has_new_folder);
@@ -3839,14 +3831,14 @@
 	}
 
-	function send_notification($params) 
- 	{ 
- 	        $mailService = ServiceLocator::getService('mail');
+	function send_notification($params)
+	{
+		$mailService = ServiceLocator::getService('mail'); 
 		$body = lang("Your message: %1",$params['subject']) . '<br>';
 		$body .= lang("Received in: %1",date("d/m/Y H:i",$params['date'])) . '<br>';
 		$body .= lang("Has been read by: %1 &lt; %2 &gt; at %3", $_SESSION['phpgw_info']['expressomail']['user']['fullname'], $_SESSION['phpgw_info']['expressomail']['user']['email'], date("d/m/Y H:i"));
-		return $mailService->sendMail(base64_decode($params['notificationto']),  
-		                                           $_SESSION['phpgw_info']['expressomail']['user']['email'],  
-		                                           $this->htmlspecialchars_decode(lang("Read receipt: %1",$params['subject'])),  
-		                                           $body);
+		return $mailService->sendMail(base64_decode($params['notificationto']), 
+ 							   $_SESSION['phpgw_info']['expressomail']['user']['email'], 
+ 							   $this->htmlspecialchars_decode(lang("Read receipt: %1",$params['subject'])), 
+ 							   $body); 
 
 	}
@@ -4907,5 +4899,5 @@
 				$return['msgs'][$i]['flag'] .= $msg->Deleted ? $msg->Deleted : '';	
 				
-				$header = imap_fetchheader( $imap, $v , FT_UID ); // Necessario para recuperar se a mensagem Ã© importante ou nÃ£o.
+				$header = imap_fetchheader( $imap, $v , FT_UID ); // Necessario para recuperar se a mensagem é importante ou não.
 				$importante = array();
 				
@@ -5188,5 +5180,5 @@
 	* @param      <Array> <$proc> <ações do filtro>
 	* @return     <Regras do usuário em Array>
-	* @access     <public>
+	* @access public
 	*/
 	function apliSieveFilter($msgs , $proc)
@@ -5229,4 +5221,179 @@
 		return $ret;
 	}
+
+   /**
+    * Método que convert imagens no formato rfc2397 para Embedded Attachment
+    *
+    * @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     Cristiano Corrêa Schmidt
+    * @param      <MailService> <$mailService> <Referencia objeto MailService>
+    * @param      <String> <$body> <Referencia Corpo do email>
+    * @return     <void>
+    * @access     public
+    */
+   function rfc2397ToEmbeddedAttachment( &$mailService , &$body )
+   { 
+       $matches = array();
+       preg_match_all("/src=[\'|\"]+data:([^,]*);base64,([a-zA-Z0-9\+\/\=]+)[\'|\"]+/i", $body, $matches,  PREG_SET_ORDER); //Resgata imagens em rfc2397       
+       
+       foreach ($matches as $i => &$v)
+       {
+            $ext = explode(';', $v[1]); //quebra todos os parametros em um array. 
+            $mailService->addStringImage(base64_decode($v[2]), $ext[0] , 'EmbeddedImage'.$i.'.'.$this->mimeToExtension($v[1])); 
+            $body = str_replace($v[0], 'src="EmbeddedImage'.$i.'.'.$this->mimeToExtension($ext[0]).'"' , $body); 
+       }
+   }
+
+   /**
+    * Método que retorna a extensão do arquivo atraves do mime type
+    *
+    * @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     Cristiano Corrêa Schmidt
+    * @param      <String> <$mimeType> <Mime Type do arquivo>
+    * @return     <String> <extensão>
+    * @access     public
+    */
+   function mimeToExtension($mimeType)
+   {
+       switch ( $mimeType ) 
+       {   
+           case 'image/bmp' : 
+           return 'bmp';
+           case 'image/cgm' :
+               return 'cgm';
+           case 'image/vnd.djvu' : 
+               return 'djv';
+           case 'image/gif' :
+               return 'gif';
+           case 'image/x-icon' :
+               return 'ico';
+           case 'image/ief' :
+               return 'ief';
+           case 'image/jpeg' :
+               return 'jpg';
+           case 'image/x-macpaint' :
+               return 'mac';
+           case 'image/pict' :
+               return 'pct';
+           case 'image/png' :
+               return 'png';
+           case 'image/x-quicktime' :
+               return 'qti';
+           case 'image/x-rgb' :
+               return 'rgb';
+           case 'image/tiff' :
+               return 'tif';
+           default:
+               return '';
+       }
+       
+   }
+	
+	
+	/**
+	* 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);
+			/* Não deletadas, não lidas e com a flag */
+			$messages = imap_search($this->mbox, 'UNDELETED UNSEEN KEYWORD "$FilteredMessage"', SE_UID);
+			if(is_array($messages))
+				foreach ($messages as $k => $m) {
+					$headers = imap_fetch_overview($this->mbox, $m, FT_UID);
+					$date = explode(" ", $headers[0]->date); 
+					$result[$m."_".$folder] = array (
+						'udate'      => $headers[0]->udate,
+						'smalldate'  => $date[5],
+						'from'       => $headers[0]->from,
+						'subject'    =>	self::decodeMimeString($headers[0]->subject),
+						'msg_number' => $m,
+						'msg_folder' => $folder
+					);
+				}
+		}
+		$result_final = array();
+		foreach ($result as $r){
+			$result_final[] = $r;
+		}
+
+		return $result_final;
+	}
+	
+	/**
+	* Esta função é chamada ao clicar sobre uma mensagem listada nos alertas de Filtro por Remetente
+	* remove a flag e chama a função que recupera os dados da mensagem, para serem utilizados na abertura da aba de leitura da msg
+	*/
+	function open_flagged_msg($params){
+		$message_number = $params['msg_number'];
+		$message_folder = $params['msg_folder'];
+		$alarm = $params['alarm'];
+		if ($message_folder && $message_number) {
+			$this->mbox = $this->open_mbox($message_folder);
+			imap_clearflag_full($this->mbox, $message_number, '$FilteredMessage', ST_UID);
+		}
+		$r = $this->get_info_msg(array('msg_number' => $message_number, 'msg_folder' =>urlencode($message_folder), 'alarm' => ($alarm)));
+		return $r;
+	}
+	
+	/**
+	* Remove a flag que caracteriza uma mensagem como alertada por Filtro por Remetente.
+	* se houver o parametro msg_number, então remove a flag de uma msg especifica
+	* se não houver o parametro msg_number, mas sim o from, então remove a flag de todas as msgs da pasta (parametro from), 
+	* e que o remetente for o from.
+	*/
+	function removeFlagMessagesFilter($params){
+		$message_number = $params['msg_number'];
+		$folder = $params['folder'];
+
+		if(isset($message_number)){
+			if(isset($folder)){
+				$message_number = explode(',', $message_number);
+				$this->mbox = $this->open_mbox($folder);
+				foreach ($message_number as $k => $m) {			
+						imap_clearflag_full($this->mbox, $m, '$FilteredMessage', ST_UID);
+					}
+			}
+		}
+		else{
+			$from = $params['from'];
+			if(isset($folder) && isset($from)){
+				$this->mbox = $this->open_mbox($folder);
+				$messages = imap_search($this->mbox, 'UNDELETED UNSEEN KEYWORD "$FilteredMessage"', SE_UID);
+			}
+			if(is_array($messages)){
+				foreach ($messages as $k => $m) {
+					$headers = imap_fetch_overview($this->mbox, $m, FT_UID);
+					if(strpos($headers[0]->from, $from) > 0){
+						imap_clearflag_full($this->mbox, $m, '$FilteredMessage', ST_UID);
+					}
+				}
+			}
+		}
+		
+		return array('status' => "success"); 
+	}
+
 }
 ?>
Index: branches/2.4/expressoMail1_2/inc/class.ldap_functions.inc.php
===================================================================
--- branches/2.4/expressoMail1_2/inc/class.ldap_functions.inc.php	(revision 6139)
+++ branches/2.4/expressoMail1_2/inc/class.ldap_functions.inc.php	(revision 6754)
@@ -436,5 +436,5 @@
                 $ldapService->connection = $this->ds;
                 $campos_extras = '';
-                $justthese = array("cn", "mail", "telephonenumber", "mobile", "phpgwaccountvisible", "uid", "employeenumber", "ou");
+                $justthese = array("cn", "mail", "telephonenumber", "mobile", "phpgwaccountvisible", "uid", "employeenumber", "ou","vacationActive","vacationInfo");
                 foreach($searchable_fields as $fields_ldap => $value_field)
                 {   
@@ -473,5 +473,5 @@
 					$this->ldapConnect(true,$i);
 					$filter="(|(cn=*$search_for*)(mail=*$search_for*))";
-					$justthese = array("cn", "mail", "telephoneNumber", "mobile", "phpgwAccountVisible", "uid","employeeNumber", "ou");
+					$justthese = array("cn", "mail", "telephoneNumber", "mobile", "phpgwAccountVisible", "uid","employeeNumber", "ou","vacationActive","vacationInfo"); 
 					$sr=@ldap_search($this->ds, $this->ldap_context, $filter, $justthese, 0, $this->max_result+1);
 					if(!$sr)
@@ -496,7 +496,18 @@
 				
 			$info_return['search_for'] = $params['search_for'];
-            return $info_return;
+            return $this->toISO8859($info_return); 
         } 
 	
+    /*Converte um parametro de UTF-8 para ISO8859*/ 
+    function toISO8859($data) 
+    { 
+        if(!is_array($data)) 
+          return mb_convert_encoding( $data , 'ISO-8859-1' , 'UTF-8 , ISO-8859-1' ); 
+        $return = array(); 
+        foreach ($data as $i => $v) 
+          $return[$this->toISO8859($i)] = $this->toISO8859($v); 
+        return $return; 
+    } 
+
 	function make_quicksearch_card($info, $cn)
 	{
@@ -553,5 +564,5 @@
 			'<tr class="quicksearchcontacts_unselected">' .
 				'<td class="cc" width="1%">' .
-					'<a title="'.$this->functions->getLang("Write message").'" onClick="javascript:QuickSearchUser.create_new_message(\''.$contacts_result["cn"].'\', \''.$contacts_result["mail"].'\')">' .
+					'<a title="'.$this->functions->getLang("Write message").'" onClick="javascript:QuickSearchUser.create_new_message(\''.$contacts_result["cn"].'\', \''.$contacts_result["mail"].'\', \''.$contacts_result["uid"].'\')">' .
 						$photo_link .
 					'</a>' .
@@ -559,5 +570,5 @@
 				'<td class="cc">' .
 					'<span name="cn">' . ($empNumber != "" ? $empNumber : $uid) . $contacts_result['cn'] . '</span>' . '<br>' .
-					'<a title="'.$functions->getLang("Write message").'" onClick="javascript:QuickSearchUser.create_new_message(\''.$contacts_result["cn"].'\', \''.$contacts_result["mail"].'\')">' .
+					'<a title="'.$functions->getLang("Write message").'" onClick="javascript:QuickSearchUser.create_new_message(\''.$contacts_result["cn"].'\', \''.$contacts_result["mail"].'\', \''.$contacts_result["uid"].'\')">' .
 						'<font color=blue>' .
 						'<span name="mail">' . $contacts_result['mail'] . '</span></a></font>'.
Index: branches/2.4/expressoMail1_2/inc/class.functions.inc.php
===================================================================
--- branches/2.4/expressoMail1_2/inc/class.functions.inc.php	(revision 6733)
+++ branches/2.4/expressoMail1_2/inc/class.functions.inc.php	(revision 6754)
@@ -15,9 +15,9 @@
                 function CalculateDateOffset()
                 {
-					
 
-					$zones = $this->getTimezones(); 
- 		            $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['timezone'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['timezone'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['timezone'] : sprintf("%s", array_search("America/Sao_Paulo", $zones)); 
                     
+                    $zones = $this->getTimezones();
+                    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['timezone'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['timezone'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['timezone'] : sprintf("%s", array_search("America/Sao_Paulo", $zones));
+
                     $timezone_index = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['timezone'];
                     $user_timezone = $zones[$timezone_index];
