[Svn] r2540 - in trunk/roundcubemail: . program/include program/lib

trac at roundcube.net trac at roundcube.net
Tue May 26 10:50:10 CEST 2009


Author: alec
Date: 2009-05-26 03:50:10 -0500 (Tue, 26 May 2009)
New Revision: 2540

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/include/rcube_imap.php
   trunk/roundcubemail/program/lib/imap.inc
Log:
- Support UID EXPUNGE: remove only moved/deleted messages


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2009-05-26 08:48:04 UTC (rev 2539)
+++ trunk/roundcubemail/CHANGELOG	2009-05-26 08:50:10 UTC (rev 2540)
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Support UID EXPUNGE: remove only moved/deleted messages
 - Add drag cancelling with ESC key (#1484344)
 - Support initial identity name from virtuser_query (#1484003)
 - Added message menu, removed Print and Source buttons

Modified: trunk/roundcubemail/program/include/rcube_imap.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap.php	2009-05-26 08:48:04 UTC (rev 2539)
+++ trunk/roundcubemail/program/include/rcube_imap.php	2009-05-26 08:50:10 UTC (rev 2540)
@@ -1629,7 +1629,7 @@
       // but only when flag_for_deletion is set to false
       if (!rcmail::get_instance()->config->get('flag_for_deletion', false))
         {
-        $this->_expunge($from_mbox, FALSE);
+        $this->_expunge($from_mbox, FALSE, $a_uids);
         $this->_clear_messagecount($from_mbox);
         $this->_clear_messagecount($to_mbox);
         }
@@ -1688,7 +1688,7 @@
     // really deleted from the mailbox
     if ($deleted)
       {
-      $this->_expunge($mailbox, FALSE);
+      $this->_expunge($mailbox, FALSE, $a_uids);
       $this->_clear_messagecount($mailbox);
       unset($this->uid_id_map[$mailbox]);
       }
@@ -1768,12 +1768,21 @@
    * Send IMAP expunge command and clear cache
    *
    * @see rcube_imap::expunge()
+   * @param string 	Mailbox name
+   * @param boolean 	False if cache should not be cleared
+   * @param string 	List of UIDs to remove, separated by comma
+   * @return boolean True on success
    * @access private
    */
-  function _expunge($mailbox, $clear_cache=TRUE)
+  function _expunge($mailbox, $clear_cache=TRUE, $uids=NULL)
     {
-    $result = iil_C_Expunge($this->conn, $mailbox);
+    if ($uids && $this->get_capability('UIDPLUS')) 
+      $a_uids = is_array($uids) ? join(',', $uids) : $uids;
+    else
+      $a_uids = NULL;
 
+    $result = iil_C_Expunge($this->conn, $mailbox, $a_uids);
+
     if ($result>=0 && $clear_cache)
       {
       $this->clear_message_cache($mailbox.'.msg');

Modified: trunk/roundcubemail/program/lib/imap.inc
===================================================================
--- trunk/roundcubemail/program/lib/imap.inc	2009-05-26 08:48:04 UTC (rev 2539)
+++ trunk/roundcubemail/program/lib/imap.inc	2009-05-26 08:50:10 UTC (rev 2540)
@@ -82,6 +82,7 @@
 		- use PREG instead of EREG
 		- removed caching functions
 		- handling connection startup response
+		- added UID EXPUNGE support
 
 ********************************************************/
 
@@ -1863,11 +1864,13 @@
 	return $result;
 }
 
-function iil_C_Expunge(&$conn, $mailbox) {
+function iil_C_Expunge(&$conn, $mailbox, $messages=NULL) {
 
 	if (iil_C_Select($conn, $mailbox)) {
 		$c = 0;
-		iil_PutLine($conn->fp, "exp1 EXPUNGE");
+		$command = $messages ? "UID EXPUNGE $messages" : "EXPUNGE";
+
+		iil_PutLine($conn->fp, "exp1 $command");
 		do {
 			$line=chop(iil_ReadLine($conn->fp, 100));
 			if ($line[0] == '*') {
@@ -2030,12 +2033,13 @@
 }
 
 function iil_C_Move(&$conn, $messages, $from, $to) {
-    $fp = $conn->fp;
 
     if (!$from || !$to) {
         return -1;
     }
-    $r = iil_C_Copy($conn, $messages, $from,$to);
+    
+    $r = iil_C_Copy($conn, $messages, $from, $to);
+
     if ($r==0) {
         return iil_C_Delete($conn, $from, $messages);
     }

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list