Changeset 4306 in subversion
- Timestamp:
- Dec 3, 2010 7:25:49 AM (2 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 3 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/rcube_imap.php (modified) (6 diffs)
-
program/include/rcube_imap_generic.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r4304 r4306 13 13 - Add folder size and quota indicator in folder manager (#1485780) 14 14 - Add possibility to move a subfolder into root folder (#1486791) 15 - Fix copying all messages in a folder copies only messages from current page 16 - Improve performance of moving or copying of all messages in a folder 15 17 16 18 RELEASE 0.5-BETA -
trunk/roundcubemail/program/include/rcube_imap.php
r4304 r4306 186 186 function close() 187 187 { 188 $this->conn->close ();188 $this->conn->closeConnection(); 189 189 $this->write_cache(); 190 190 } … … 199 199 function reconnect() 200 200 { 201 $this->close ();201 $this->closeConnection(); 202 202 $this->connect($this->host, $this->user, $this->pass, $this->port, $this->ssl); 203 203 … … 618 618 // RECENT count is fetched a bit different 619 619 else if ($mode == 'RECENT') { 620 $count = $this->conn->c heckForRecent($mailbox);620 $count = $this->conn->countRecent($mailbox); 621 621 } 622 622 // use SEARCH for message counting … … 2583 2583 // send expunge command in order to have the moved message 2584 2584 // really deleted from the source mailbox 2585 $aa = rcube_timer(); 2585 2586 if ($moved) { 2586 2587 $this->_expunge($from_mbox, false, $uids); … … 2592 2593 $moved = $this->delete_message($uids, $fbox); 2593 2594 } 2594 2595 rcube_print_time($aa); 2595 2596 if ($moved) { 2596 2597 // unset threads internal cache … … 2775 2776 $a_uids = NULL; 2776 2777 2777 $result = $this->conn->expunge($mailbox, $a_uids); 2778 // CLOSE(+SELECT) should be faster than EXPUNGE 2779 if (empty($a_uids) || $a_uids == '1:*') 2780 $result = $this->conn->close(); 2781 else 2782 $result = $this->conn->expunge($mailbox, $a_uids); 2778 2783 2779 2784 if ($result && $clear_cache) { -
trunk/roundcubemail/program/include/rcube_imap_generic.php
r4263 r4306 684 684 685 685 $this->setError(self::ERROR_BAD, $error); 686 $this->close ();686 $this->closeConnection(); 687 687 return false; 688 688 } … … 701 701 702 702 if ($res[0] != self::ERROR_OK) { 703 $this->close ();703 $this->closeConnection(); 704 704 return false; 705 705 } … … 707 707 if (!stream_socket_enable_crypto($this->fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { 708 708 $this->setError(self::ERROR_BAD, "Unable to negotiate TLS"); 709 $this->close ();709 $this->closeConnection(); 710 710 return false; 711 711 } … … 739 739 if ($auth_method == 'LOGIN' && $this->getCapability('LOGINDISABLED')) { 740 740 $this->setError(self::ERROR_BAD, "Login disabled by IMAP server"); 741 $this->close ();741 $this->closeConnection(); 742 742 return false; 743 743 } … … 779 779 } 780 780 781 // Close connection 782 $this->close(); 781 $this->closeConnection(); 783 782 784 783 return false; … … 790 789 } 791 790 792 function close ()791 function closeConnection() 793 792 { 794 793 if ($this->putLine($this->nextTag() . ' LOGOUT')) { … … 800 799 } 801 800 801 /** 802 * Executes SELECT command (if mailbox is already not in selected state) 803 * 804 * @param string $mailbox Mailbox name 805 * 806 * @return boolean True on success, false on error 807 * @access public 808 */ 802 809 function select($mailbox) 803 810 { … … 843 850 844 851 /** 845 * Executes STATUS com and852 * Executes STATUS command 846 853 * 847 854 * @param string $mailbox Mailbox name … … 888 895 } 889 896 890 function checkForRecent($mailbox) 891 { 892 if (!strlen($mailbox)) { 893 $mailbox = 'INBOX'; 894 } 895 896 $this->select($mailbox); 897 898 if ($this->selected == $mailbox) { 899 return $this->data['RECENT']; 900 } 897 /** 898 * Executes EXPUNGE command 899 * 900 * @param string $mailbox Mailbox name 901 * @param string $messages Message UIDs to expunge 902 * 903 * @return boolean True on success, False on error 904 * @access public 905 */ 906 function expunge($mailbox, $messages=NULL) 907 { 908 if (!$this->select($mailbox)) { 909 return false; 910 } 911 912 // Clear internal status cache 913 unset($this->data['STATUS:'.$mailbox]); 914 915 if ($messages) 916 $result = $this->execute('UID EXPUNGE', array($messages), self::COMMAND_NORESPONSE); 917 else 918 $result = $this->execute('EXPUNGE', null, self::COMMAND_NORESPONSE); 919 920 if ($result == self::ERROR_OK) { 921 $this->selected = ''; // state has changed, need to reselect 922 return true; 923 } 901 924 902 925 return false; 903 926 } 904 927 928 /** 929 * Executes CLOSE command 930 * 931 * @return boolean True on success, False on error 932 * @access public 933 * @since 0.5 934 */ 935 function close() 936 { 937 $result = $this->execute('CLOSE', NULL, self::COMMAND_NORESPONSE); 938 939 if ($result == self::ERROR_OK) { 940 $this->selected = ''; 941 return true; 942 } 943 944 return false; 945 } 946 947 /** 948 * Executes SUBSCRIBE command 949 * 950 * @param string $mailbox Mailbox name 951 * 952 * @return boolean True on success, False on error 953 * @access public 954 */ 955 function subscribe($mailbox) 956 { 957 $result = $this->execute('SUBSCRIBE', array($this->escape($mailbox)), 958 self::COMMAND_NORESPONSE); 959 960 return ($result == self::ERROR_OK); 961 } 962 963 /** 964 * Executes UNSUBSCRIBE command 965 * 966 * @param string $mailbox Mailbox name 967 * 968 * @return boolean True on success, False on error 969 * @access public 970 */ 971 function unsubscribe($mailbox) 972 { 973 $result = $this->execute('UNSUBSCRIBE', array($this->escape($mailbox)), 974 self::COMMAND_NORESPONSE); 975 976 return ($result == self::ERROR_OK); 977 } 978 979 /** 980 * Executes DELETE command 981 * 982 * @param string $mailbox Mailbox name 983 * 984 * @return boolean True on success, False on error 985 * @access public 986 */ 987 function deleteFolder($mailbox) 988 { 989 $result = $this->execute('DELETE', array($this->escape($mailbox)), 990 self::COMMAND_NORESPONSE); 991 992 return ($result == self::ERROR_OK); 993 } 994 995 /** 996 * Removes all messages in a folder 997 * 998 * @param string $mailbox Mailbox name 999 * 1000 * @return boolean True on success, False on error 1001 * @access public 1002 */ 1003 function clearFolder($mailbox) 1004 { 1005 $num_in_trash = $this->countMessages($mailbox); 1006 if ($num_in_trash > 0) { 1007 $this->delete($mailbox, '1:*'); 1008 } 1009 1010 $res = $this->close(); 1011 // $res = $this->expunge($mailbox); 1012 1013 return $res; 1014 } 1015 1016 /** 1017 * Returns count of all messages in a folder 1018 * 1019 * @param string $mailbox Mailbox name 1020 * 1021 * @return int Number of messages, False on error 1022 * @access public 1023 */ 905 1024 function countMessages($mailbox, $refresh = false) 906 1025 { … … 926 1045 927 1046 return false; 1047 } 1048 1049 /** 1050 * Returns count of messages with \Recent flag in a folder 1051 * 1052 * @param string $mailbox Mailbox name 1053 * 1054 * @return int Number of messages, False on error 1055 * @access public 1056 */ 1057 function countRecent($mailbox) 1058 { 1059 if (!strlen($mailbox)) { 1060 $mailbox = 'INBOX'; 1061 } 1062 1063 $this->select($mailbox); 1064 1065 if ($this->selected == $mailbox) { 1066 return $this->data['RECENT']; 1067 } 1068 1069 return false; 928 1070 } 929 1071 … … 1566 1708 } 1567 1709 1568 function expunge($mailbox, $messages=NULL)1569 {1570 if (!$this->select($mailbox)) {1571 return false;1572 }1573 1574 // Clear internal status cache1575 unset($this->data['STATUS:'.$mailbox]);1576 1577 if ($messages)1578 $result = $this->execute('UID EXPUNGE', array($messages), self::COMMAND_NORESPONSE);1579 else1580 $result = $this->execute('EXPUNGE', null, self::COMMAND_NORESPONSE);1581 1582 if ($result == self::ERROR_OK) {1583 $this->selected = ''; // state has changed, need to reselect1584 return true;1585 }1586 1587 return false;1588 }1589 1710 1590 1711 function modFlag($mailbox, $messages, $flag, $mod) … … 2154 2275 } 2155 2276 2156 function deleteFolder($mailbox)2157 {2158 $result = $this->execute('DELETE', array($this->escape($mailbox)),2159 self::COMMAND_NORESPONSE);2160 2161 return ($result == self::ERROR_OK);2162 }2163 2164 function clearFolder($mailbox)2165 {2166 $num_in_trash = $this->countMessages($mailbox);2167 if ($num_in_trash > 0) {2168 $this->delete($mailbox, '1:*');2169 }2170 return ($this->expunge($mailbox) >= 0);2171 }2172 2173 function subscribe($mailbox)2174 {2175 $result = $this->execute('SUBSCRIBE', array($this->escape($mailbox)),2176 self::COMMAND_NORESPONSE);2177 2178 return ($result == self::ERROR_OK);2179 }2180 2181 function unsubscribe($mailbox)2182 {2183 $result = $this->execute('UNSUBSCRIBE', array($this->escape($mailbox)),2184 self::COMMAND_NORESPONSE);2185 2186 return ($result == self::ERROR_OK);2187 }2188 2189 2277 function append($mailbox, &$message) 2190 2278 {
Note: See TracChangeset
for help on using the changeset viewer.
