Index: /trunk/expressoMail1_2/setup/phpgw_en.lang
===================================================================
--- /trunk/expressoMail1_2/setup/phpgw_en.lang	(revision 1330)
+++ /trunk/expressoMail1_2/setup/phpgw_en.lang	(revision 1340)
@@ -80,5 +80,4 @@
 Do you want to block this e-mail?	expressoMail1_2	en	Do you want to block this e-mail?
 Do you want to log the sent messages?	admin	en	Do you want to log the sent messages?
-Do you want to show common name instead of UID?	expressoMail1_2	en	Do you want to show common name instead of UID?
 Do you want to use the spam filter?	admin	en	Do you want to use the spam filter?
 Do you wish to exclude the folder 	expressoMail1_2	en	Do you wish to exclude the folder 
Index: /trunk/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- /trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 1330)
+++ /trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 1340)
@@ -1424,6 +1424,6 @@
 				$result[$i]['folder_name'] = array_pop($tmp_folder_parent);
 				$result[$i]['folder_name'] = $result[$i]['folder_name'] == 'INBOX' ? 'Inbox' : $result[$i]['folder_name'];
-				if ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['uid2cn']){
-					$this->ldap = new ldap_functions();
+				if (is_numeric($result[$i]['folder_name']))	{
+					//$this->ldap = new ldap_functions();
 					if ($cn = $this->ldap->uid2cn($result[$i]['folder_name'])){
 						$result[$i]['folder_name'] = $cn;
@@ -2153,12 +2153,11 @@
         }
         //Este bloco tem a finalidade de transformar o CPF das pastas compartilhadas em common name
-        if ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['uid2cn']){
-        	if (substr($new_folder_name,0,4) == 'user'){
-        		$this->ldap = new ldap_functions();
-        		$tmp_folder_name = explode($this->imap_delimiter, $new_folder_name);
-				$return['new_folder_name'] = array_pop($tmp_folder_name);
+        if (substr($new_folder_name,0,4) == 'user'){
+        	$this->ldap = new ldap_functions();
+        	$tmp_folder_name = explode($this->imap_delimiter, $new_folder_name);
+			$return['new_folder_name'] = array_pop($tmp_folder_name);
+			if (is_numeric($return['new_folder_name']))
 				if( $cn = $this->ldap->uid2cn($return['new_folder_name']))
 					$return['new_folder_name'] = $cn;
-        	}
         }
 		
@@ -2918,14 +2917,12 @@
 				$filter = $this->remove_accents($filter);
 				//Este bloco tem a finalidade de transformar o login (quando numerico) das pastas compartilhadas em common name
-				if ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['uid2cn']){
-					$folder_name = explode($this->imap_delimiter,$name_box);
+				$folder_name = explode($this->imap_delimiter,$name_box);
+				if (is_numeric($folder_name[1])) {
 					$this->ldap = new ldap_functions();
-					if ($cn = $this->ldap->uid2cn($folder_name[1])){
+					if ($cn = $this->ldap->uid2cn($folder_name[1]))	{
 						$folder_name[1] = $cn;
 					}
-					$folder_name = implode($this->imap_delimiter,$folder_name);
-				}
-				else
-					$folder_name = mb_convert_encoding(utf8_decode($name_box), "UTF7-IMAP", "ISO_8859-1" );
+				}
+				$folder_name = implode($this->imap_delimiter,$folder_name);
 				
 				if(!is_resource($mbox_stream))
@@ -2946,5 +2943,5 @@
 						{
 							foreach($search_criteria as $new_search){
-								$m_token = trim("##". mb_convert_encoding( $folder_name, "ISO_8859-1", "UTF7-IMAP" ) . "--" . mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ) . "--" . $this->get_msg($new_search,$name_box,$mbox_stream) . "--".$new_search."##"."\n");
+								$m_token = trim("##".mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ) . "--" . $this->get_msg($new_search,$name_box,$mbox_stream) . "--".$new_search."##"."\n");
 								if(!@strstr($retorno,$m_token))
 									$retorno .= $m_token;
@@ -2960,5 +2957,5 @@
 					{
 						foreach($search_criteria as $new_search)
-							$retorno .= trim("##". mb_convert_encoding( $folder_name, "ISO_8859-1", "UTF7-IMAP" ) . "--" . mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ) . "--" . $this->get_msg($new_search,$name_box,$mbox_stream) . "--" . $new_search."##"."\n");
+							$retorno .= trim("##".mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ) . "--" . $this->get_msg($new_search,$name_box,$mbox_stream) . "--" . $new_search."##"."\n");
 					}
 				}
Index: /trunk/expressoMail1_2/inc/hook_settings.inc.php
===================================================================
--- /trunk/expressoMail1_2/inc/hook_settings.inc.php	(revision 1330)
+++ /trunk/expressoMail1_2/inc/hook_settings.inc.php	(revision 1340)
@@ -64,8 +64,4 @@
 '</script>');
 //}
-
-$default = false;
-create_check_box('Do you want to show common name instead of UID?','uid2cn',$default,
-	'Do you want to show common name instead of UID?'); 
 
 $default = array(
Index: /trunk/expressoMail1_2/js/main.js
===================================================================
--- /trunk/expressoMail1_2/js/main.js	(revision 1330)
+++ /trunk/expressoMail1_2/js/main.js	(revision 1340)
@@ -1469,5 +1469,5 @@
 			if(data.msg_day == '')
 			{
-                header=expresso_local_messages.get_msg_date(data.original_ID);
+                header=expresso_local_messages.get_msg_date(data.original_ID, proxy_mensagens.is_local_folder(get_current_folder()));
 
 				data.fulldate=header.fulldate;
Index: /trunk/expressoMail1_2/js/local_messages.js
===================================================================
--- /trunk/expressoMail1_2/js/local_messages.js	(revision 1330)
+++ /trunk/expressoMail1_2/js/local_messages.js	(revision 1340)
@@ -569,5 +569,5 @@
 		while(rs.isValidRow()) {
 			var header = connector.unserialize(rs.field(0));
-			retorno+="##"+"local_"+rs.field(1)+"--"+"local_"+rs.field(1)+"--"+header["from"]["name"]+"--"+header["subject"]+"--"+header["udate"]+"--"+this.aux_convert_size(rs.field(3))+"--"+header["Unseen"]+header["Recent"]+header["Flagged"]+header["Draft"]+"--"+rs.field(2)+"##";
+			retorno+="##"+"local_"+rs.field(1)+"--"+header["from"]["name"]+"--"+header["subject"]+"--"+header["udate"]+"--"+this.aux_convert_size(rs.field(3))+"--"+header["Unseen"]+header["Recent"]+header["Flagged"]+header["Draft"]+"--"+rs.field(2)+"##";
 			rs.next();
 		}
@@ -701,10 +701,23 @@
     }
 
-    local_messages.prototype.get_msg_date = function (original_id){
+    local_messages.prototype.get_msg_date = function (original_id, is_local){
 
         this.init_local_messages();
 
-        var rs = this.dbGears.execute("select mail from mail where rowid="+original_id);
-        // rs = this.dbGears.execute("select mail from mail where original_id="+original_id);
+        if (typeof(is_local) == 'undefined')
+        {
+            is_local = false;
+        }
+
+        var rs;
+
+        if (is_local)
+        {
+            rs = this.dbGears.execute("select mail from mail where rowid="+original_id);
+        }
+        else
+        {
+            rs = this.dbGears.execute("select mail from mail where original_id="+original_id);
+        }
         var tmp = connector.unserialize(rs.field(0));
         var ret = new Array();
