Index: sandbox/webservice/api/adapters/CalendarAdapter.php
===================================================================
--- sandbox/webservice/api/adapters/CalendarAdapter.php	(revision 7465)
+++ sandbox/webservice/api/adapters/CalendarAdapter.php	(revision 7489)
@@ -19,5 +19,5 @@
 	}
 
-	protected function getEvents( $month, $year )
+	protected function getEvents($month, $year)
 	{
 		$bo = CreateObject('calendar.bocalendar',1);
Index: sandbox/webservice/api/adapters/CatalogAdapter.php
===================================================================
--- sandbox/webservice/api/adapters/CatalogAdapter.php	(revision 7465)
+++ sandbox/webservice/api/adapters/CatalogAdapter.php	(revision 7489)
@@ -93,34 +93,42 @@
 		$params = array ("search_for" => $search);
  		$result = $this->getLdapCatalog()->quicksearch($params);
- 		// Reconnect for searching other attributes.
- 		$this->getLdapCatalog()->ldapConnect(true);
-		foreach($result as $i => $row) {
-			if(is_int($i)) {
-				$contacts[$i] = array(
-					'contactMails'	=> array($result[$i]['mail']),
-					'contactPhones'	=> array($result[$i]['phone']),
-					'contactAlias' => "",					
-					'contactFullName' 	=> ($result[$i]['cn'] != null ? mb_convert_encoding($row['cn'],"UTF8", "ISO_8859-1") : ""),
-					'contactBirthDate'	=> "",
-					'contactNotes' 		=> ""
-				);
-				// Buscar atributos faltantes. 
-				$otherAttrs = $this->getUserLdapAttrs($result[$i]['mail']);
-				if(is_array($otherAttrs))
-					$contacts[$i] = array_merge($otherAttrs, $contacts[$i]);				
+ 		
+ 		if ( array_key_exists('error', $result))
+ 		{
+ 			Errors::runException("CATALOG_MANY_RESULTS");
+ 		}
+ 		else
+ 		{
+	 		// Reconnect for searching other attributes.
+	 		$this->getLdapCatalog()->ldapConnect(true);
+			foreach($result as $i => $row) {
+				if(is_int($i)) {
+					$contacts[$i] = array(
+						'contactMails'	=> array($result[$i]['mail']),
+						'contactPhones'	=> array($result[$i]['phone']),
+						'contactAlias' => "",					
+						'contactFullName' 	=> ($result[$i]['cn'] != null ? mb_convert_encoding($row['cn'],"UTF8", "ISO_8859-1") : ""),
+						'contactBirthDate'	=> "",
+						'contactNotes' 		=> ""
+					);
+					// Buscar atributos faltantes. 
+					$otherAttrs = $this->getUserLdapAttrs($result[$i]['mail']);
+					if(is_array($otherAttrs))
+						$contacts[$i] = array_merge($otherAttrs, $contacts[$i]);				
+				}
 			}
-		}
-		// Force ldap close
-		ldap_close($this->getLdapCatalog()->ds);		
-		if( count($contacts) )
-		{
-			$result = array ('contacts' => $contacts);
-			$this->setResult($result);
-			return $this->getResponse();
-		}
-		else
-		{
-			Errors::runException("CATALOG_NO_RESULTS");
-		}
+			// Force ldap close
+			ldap_close($this->getLdapCatalog()->ds);		
+			if( count($contacts) )
+			{
+				$result = array ('contacts' => $contacts);
+				$this->setResult($result);
+				return $this->getResponse();
+			}
+			else
+			{
+				Errors::runException("CATALOG_NO_RESULTS");
+			}
+ 		}
 	}
 }
Index: sandbox/webservice/api/rest/mail/RenameFolderResource.php
===================================================================
--- sandbox/webservice/api/rest/mail/RenameFolderResource.php	(revision 7469)
+++ sandbox/webservice/api/rest/mail/RenameFolderResource.php	(revision 7489)
@@ -8,10 +8,10 @@
 		if($this-> isLoggedIn())
 		{
-			$old_id   = mb_convert_encoding($this->getParam('folderID'), "UTF-8", "ISO-8859-1");
+			$old_id  = mb_convert_encoding($this->getParam('folderID'), "UTF-8", "ISO-8859-1");
 			$new_name = mb_convert_encoding($this->getParam('folderName'), "UTF-8", "ISO-8859-1");
 
-			if(!$this->getImap()->folder_exists( mb_convert_encoding($old_id, "UTF7-IMAP", "UTF-8")))
+			if(!$this->getImap()->folder_exists(mb_convert_encoding($old_id, "UTF7-IMAP", "UTF-8")))
 				Errors::runException("MAIL_INVALID_OLD_FOLDER");
-
+ 
 			$default_folders = array_keys($this->defaultFolders);
 			if(in_array($old_id, $default_folders))
Index: sandbox/webservice/api/rest/mail/AddFolderResource.php
===================================================================
--- sandbox/webservice/api/rest/mail/AddFolderResource.php	(revision 7469)
+++ sandbox/webservice/api/rest/mail/AddFolderResource.php	(revision 7489)
@@ -11,6 +11,5 @@
 			$parent_id = empty($parent_id) ? 'INBOX' : $parent_id;
 			$new_name  = $this->getParam('folderName');
-			$new_name  = mb_convert_encoding($new_name, "UTF-8", "ISO-8859-1");
-
+			$new_name = mb_convert_encoding($new_name, "UTF-8", "ISO-8859-1");
 
 			$all_folders = $this->getImap()->get_folders_list();
Index: sandbox/webservice/api/rest/mail/MessagesResource.php
===================================================================
--- sandbox/webservice/api/rest/mail/MessagesResource.php	(revision 7480)
+++ sandbox/webservice/api/rest/mail/MessagesResource.php	(revision 7489)
@@ -10,6 +10,4 @@
 		if($this-> isLoggedIn()) 
 		{					
-			$max_email_per_page = intval($this->getParam('resultsPerPage') ? $this->getParam('resultsPerPage') :
-					$this->getImap()->prefs['max_email_per_page']);
 
 			if($this->getParam('folderID') && $this->getParam('msgID') > 0) {
@@ -42,19 +40,17 @@
 					$params = array(
 							'condition' => implode(",",$condition),							
-							'page' 		=> ($this->getParam('page') ? intval($this->getParam('page')) - 1 : 0),
+							'page' 		=> (intval($this->getParam('page') ? $this->getParam('page') : "1"))-1,
 							'sort_type' => "SORTDATE"
 						);
 
 					$this->getImap()->prefs['preview_msg_subject'] = "1";
+					error_log(serialize($params));
 					$imap_msgs = $this->getImap()->search_msg($params);
 
-					if(!$imap_msgs){
-						return $this->getResponse();
-					}
 					if($imap_msgs['num_msgs'] > 0) {
 						foreach($imap_msgs['data'] as $imap_msg) {
 							$msg = array();
 							$msg['msgID'] = $imap_msg['uid'];
-							$msg['folderID'] = $imap_msg['boxname'];
+							$msg['folderID'] = mb_convert_encoding($imap_msg['boxname'],'UTF-8','ISO-8859-1');
 							$msg['msgDate']	= $imap_msg['udate']." 00:00";
 							$msg['msgSubject'] = mb_convert_encoding($imap_msg['subject'],"UTF8", "ISO_8859-1");
@@ -76,8 +72,11 @@
 				}
 				else{
-					// TODO: Implementar a pesquisa de mensagens para versão 2.4
+					// TODO: Implementar a pesquisa de mensagens para verso 2.4
 				}
 			}
 			else{
+				$max_email_per_page = intval($this->getParam('resultsPerPage') ? $this->getParam('resultsPerPage') :
+					$this->getImap()->prefs['max_email_per_page']);
+	
 				$current_page = intval($this->getParam('page') ? $this->getParam('page') : 1);
 	
@@ -86,6 +85,5 @@
 	
 				$this->getImap()->prefs['preview_msg_subject'] = "1";
-	
-	
+
 				$imap_msgs = $this->getImap()-> get_range_msgs2(
 					array(	"folder"			=> $this->getParam('folderID'),
@@ -99,12 +97,16 @@
 					return $this->getResponse();
 				}
-	
+
+				$folderID = mb_convert_encoding($this->getParam('folderID'), 'UTF-8','ISO-8859-1');
+
 				foreach($imap_msgs as $i => $imap_msg) {
 					if(!is_int($i)) {
 						continue;
 					}
+					
 					$msg = array();
 					$msg['msgID'] = $imap_msg['msg_number'];
-					$msg['folderID'] =  $imap_msgs['folder'];
+					$msg['folderID'] = $folderID;
+
 					$msg['msgDate']	= gmdate('d/m/Y H:i', $imap_msg['timestamp']);
 					$msg['msgFrom']['fullName'] = mb_convert_encoding($imap_msg['from']['name'],"UTF8", "ISO_8859-1");
@@ -153,17 +155,6 @@
 			}
 		}
-		$num_msgs  = 0;
-		$num_pages = 1;		
-		$num_msgs = intval($imap_msgs['num_msgs']);
-		if($num_msgs > $max_email_per_page) {
-			$num_pages = $num_msgs / $max_email_per_page;
-			if($num_pages > intval($num_pages))
-				$num_pages = intval($num_pages) + 1;
-		}
-		
 		$result = array (
 				'messages' 	  => $all_msgs,
-				'numMessages' => $num_msgs,
-				'numPages'	  => $num_pages,
 				'timeZone'	  => $imap_msgs['offsetToGMT'] ? $imap_msgs['offsetToGMT'] : "",
 				'totalUnseen' => $imap_msgs['tot_unseen'] ? $imap_msgs['tot_unseen'] : ""
Index: sandbox/webservice/api/rest/mail/DelFolderResource.php
===================================================================
--- sandbox/webservice/api/rest/mail/DelFolderResource.php	(revision 7470)
+++ sandbox/webservice/api/rest/mail/DelFolderResource.php	(revision 7489)
@@ -8,5 +8,5 @@
 		if($this-> isLoggedIn())
 		{
-			$params['del_past'] = $folder_id = mb_convert_encoding($this->getParam('folderID'),"UTF-8","ISO-8859-1");
+			$params['del_past'] = $folder_id = mb_convert_encoding($this->getParam('folderID'), "UTF-8","ISO-8859-1");
 
 			if(!$this->getImap()->folder_exists(mb_convert_encoding($folder_id, "UTF7-IMAP","UTF-8")))
@@ -29,5 +29,5 @@
 				Errors::runException("MAIL_FOLDER_NOT_EMPTY");
 
-			// TODO: verificar o que ocorre com o objeto imap nas validaÃ§Ãµes acima. Por algum motivo, recriando o objeto, o mÃ©todo delete_mailbox funciona, mas sem recriar, nÃ£o funciona.
+			// TODO: verificar o que ocorre com o objeto imap nas validações acima. Por algum motivo, recriando o objeto, o método delete_mailbox funciona, mas sem recriar, não funciona.
 			$this->imap = null;
 
Index: sandbox/webservice/api/rest/calendar/EventsResource.php
===================================================================
--- sandbox/webservice/api/rest/calendar/EventsResource.php	(revision 7463)
+++ sandbox/webservice/api/rest/calendar/EventsResource.php	(revision 7489)
Index: sandbox/webservice/api/rest/catalog/ContactsResource.php
===================================================================
--- sandbox/webservice/api/rest/catalog/ContactsResource.php	(revision 7463)
+++ sandbox/webservice/api/rest/catalog/ContactsResource.php	(revision 7489)
@@ -61,5 +61,4 @@
 				}
 			}
-			
 			$result = array ('contacts' => array_values($contacts));
 			$this->setResult($result);
