Index: trunk/zpush/lib/utils/utils.php
===================================================================
--- trunk/zpush/lib/utils/utils.php	(revision 7589)
+++ trunk/zpush/lib/utils/utils.php	(revision 8131)
@@ -446,5 +446,5 @@
     static public function IsSystemFolder($foldertype) {
         return ($foldertype == SYNC_FOLDER_TYPE_INBOX || $foldertype == SYNC_FOLDER_TYPE_DRAFTS || $foldertype == SYNC_FOLDER_TYPE_WASTEBASKET || $foldertype == SYNC_FOLDER_TYPE_SENTMAIL ||
-                $foldertype == SYNC_FOLDER_TYPE_OUTBOX || $foldertype == SYNC_FOLDER_TYPE_TASK || $foldertype == SYNC_FOLDER_TYPE_APPOINTMENT || $foldertype == SYNC_FOLDER_TYPE_CONTACT ||
+                $foldertype == SYNC_FOLDER_TYPE_OUTBOX || $foldertype == SYNC_FOLDER_TYPE_TASK /*|| $foldertype == SYNC_FOLDER_TYPE_APPOINTMENT */|| $foldertype == SYNC_FOLDER_TYPE_CONTACT ||
                 $foldertype == SYNC_FOLDER_TYPE_NOTE || $foldertype == SYNC_FOLDER_TYPE_JOURNAL) ? true:false;
     }
Index: trunk/zpush/backend/expresso/providers/imapProvider.php
===================================================================
--- trunk/zpush/backend/expresso/providers/imapProvider.php	(revision 8026)
+++ trunk/zpush/backend/expresso/providers/imapProvider.php	(revision 8131)
@@ -903,20 +903,13 @@
 
         // build name for new mailboxBackendMaildir
-        $displayname = Utils::Utf7_iconv_encode(Utils::Utf8_to_utf7($displayname));
-        $newname = $this->server . $folderid . $this->serverdelimiter . $displayname;
-
+        $displayname = Utils::Utf7_iconv_encode(Utils::Utf8_to_utf7($displayname));;
+        $new = $this->server . $this->getImapIdFromFolderId($folderid) . $this->serverdelimiter.  $displayname;
         $csts = false;
-        // if $id is set => rename mailbox, otherwise create
-        if ($oldid) {
-            // rename doesn't work properly with IMAP
-            // the activesync client doesn't support a 'changing ID'
-            // TODO this would be solved by implementing hex ids (Mantis #459)
-            //$csts = imap_renamemailbox($this->mbox, $this->server . imap_utf7_encode(str_replace(".", $this->serverdelimiter, $oldid)), $newname);
-        }
-        else {
-            $csts = @imap_createmailbox($this->mbox, $newname);
-        }
+
+        $csts = ($oldid) ? imap_renamemailbox($this->mbox,  $this->server .$this->getImapIdFromFolderId($oldid) , $new) : imap_createmailbox($this->mbox, $new);
+
         if ($csts) {
-            return $this->StatFolder($folderid . $this->serverdelimiter . $displayname);
+           $newId =  $this->convertImapId($new);
+           return $this->StatFolder($newId);
         }
         else
@@ -935,7 +928,9 @@
      *
      */
-    public function DeleteFolder($id, $parentid){
-        // TODO implement
-        return false;
+    public function DeleteFolder($id, $parentid)
+    {
+        $ret = imap_deletemailbox($this->mbox , $this->server .$this->getImapIdFromFolderId($id) );
+        imap_expunge( $this->mbox );
+        return $ret;
     }
 
Index: trunk/zpush/backend/expresso/providers/calendarProvider.php
===================================================================
--- trunk/zpush/backend/expresso/providers/calendarProvider.php	(revision 8030)
+++ trunk/zpush/backend/expresso/providers/calendarProvider.php	(revision 8131)
@@ -154,4 +154,50 @@
     public function ChangeFolder($folderid, $oldid, $displayname, $type)
     {
+        if($oldid)
+        {
+            $idNumber = (int)str_replace('calendar' , '' , $oldid);
+            $calendarSignature =  Controller::read( array( 'concept' => 'calendarSignature' , 'id' => $idNumber ));
+
+            Controller::update( array('concept' => 'calendar' , 'id' => $calendarSignature['calendar']), array( 'name' => $displayname) );
+
+            return $this->StatFolder($oldid);
+        }
+        else
+        {
+             $cal = array('name' => $displayname,
+                'timezone' => 'America/Sao_Paulo',
+                'type' => '0'
+            );
+
+            $calCreated = Controller::create(array('concept' => 'calendar'), $cal);
+
+            if(!$calCreated){
+                return false;
+            }
+
+            $sig = array('user' => $_SESSION['wallet']['user']['uidNumber'],
+                'calendar' => $calCreated['id'],
+                'isOwner' => '1',
+                'dtstamp' => time() . '000',
+                'fontColor' => 'FFFFFF',
+                'backgroundColor' => '3366CC',
+                'borderColor' => '3366CC',
+            );
+
+            $sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig);
+
+            if(!$sigCreated){
+                return false;
+            }
+            else
+            {
+                $return = array();
+                $return["id"] = 'calendar'.$calCreated;
+                $return["parent"] = 0;
+                $return["mod"] = $displayname;
+                return $return;
+            }
+        }
+
         return false;
 
@@ -168,7 +214,17 @@
      * @throws StatusException              could throw specific SYNC_FSSTATUS_* exceptions
      */
-    public function DeleteFolder($id, $parentid)
-    {
-        return false;
+    public function DeleteFolder($id, $parent)
+    {
+        $interation = array();
+        $idNumber = (int)str_replace('calendar' , '' , $id);
+        $calendarSignature =  Controller::read( array( 'concept' => 'calendarSignature' , 'id' => $idNumber ));
+
+        $interation['calendar://' . $calendarSignature['calendar']] = false;
+        ob_start();
+        $args = $interation;
+        include EXPRESSO_PATH.'/prototype/Sync.php';
+        ob_end_clean();
+
+        return true;
     }
 
Index: trunk/zpush/backend/expresso/expresso.php
===================================================================
--- trunk/zpush/backend/expresso/expresso.php	(revision 7671)
+++ trunk/zpush/backend/expresso/expresso.php	(revision 8131)
@@ -24,4 +24,6 @@
     private function getProvider( $folderId )
     {
+
+
         foreach($this->providers as $provider)
         {
@@ -109,5 +111,5 @@
     public function ChangeFolder($folderid, $oldid, $displayname, $type)
     {
-        // TODO: Implement ChangeFolder() method.
+        return $this->getProvider($oldid ? $oldid: $folderid)->ChangeFolder($folderid, $oldid, $displayname, $type);
     }
 
@@ -124,5 +126,5 @@
     public function DeleteFolder($id, $parentid)
     {
-        // TODO: Implement DeleteFolder() method.
+        return $this->getProvider($id)->DeleteFolder($id, $parentid);
     }
 
