Changeset 710e274 in github
- Timestamp:
- Oct 20, 2010 9:33:27 AM (3 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 659cf14c
- Parents:
- 8794f16
- Files:
-
- 2 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/rcube_imap_generic.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
r8794f16 r710e274 38 38 - Fix decoding of e-mail address strings in message headers (#1487068) 39 39 - Fix handling of attachments when Content-Disposition is not inline nor attachment (#1487051) 40 - Improve performance of unseen messages counting (#1487058) 40 41 41 42 RELEASE 0.4.2 -
program/include/rcube_imap_generic.php
ra2e8cb36 r710e274 734 734 } 735 735 736 /** 737 * Executes STATUS comand 738 * 739 * @param string $mailbox Mailbox name 740 * @param array $items Requested item names 741 * 742 * @return array Status item-value hash 743 * @access public 744 * @since 0.5-beta 745 */ 746 function status($mailbox, $items) 747 { 748 if (empty($mailbox) || empty($items)) { 749 return false; 750 } 751 752 list($code, $response) = $this->execute('STATUS', array($this->escape($mailbox), 753 '(' . implode(' ', (array) $items) . ')')); 754 755 if ($code == self::ERROR_OK && preg_match('/\* STATUS /i', $response)) { 756 $result = array(); 757 $response = substr($response, 9); // remove prefix "* STATUS " 758 759 list($mbox, $items) = $this->tokenizeResponse($response, 2); 760 761 for ($i=0, $len=count($items); $i<$len; $i += 2) { 762 $result[$items[$i]] = (int) $items[$i+1]; 763 } 764 765 return $result; 766 } 767 768 return false; 769 } 770 736 771 function checkForRecent($mailbox) 737 772 { … … 758 793 return $this->data['EXISTS']; 759 794 } 795 796 return false; 797 } 798 799 /** 800 * Returns count of messages without \Seen flag in a specified folder 801 * 802 * @param string $mailbox Mailbox name 803 * 804 * @return int Number of messages, False on error 805 * @access public 806 */ 807 function countUnseen($mailbox) 808 { 809 // Try STATUS, should be faster 810 $counts = $this->status($mailbox, array('UNSEEN')); 811 if (is_array($counts)) { 812 return (int) $counts['UNSEEN']; 813 } 814 815 // Invoke SEARCH as a fallback 816 // @TODO: ESEARCH support 817 $index = $this->search($mailbox, 'ALL UNSEEN'); 818 if (is_array($index)) { 819 return count($index); 820 } 760 821 761 822 return false; … … 1414 1475 } 1415 1476 1416 function countUnseen($folder)1417 {1418 $index = $this->search($folder, 'ALL UNSEEN');1419 if (is_array($index))1420 return count($index);1421 return false;1422 }1423 1424 1477 // Don't be tempted to change $str to pass by reference to speed this up - it will slow it down by about 1425 1478 // 7 times instead :-) See comments on http://uk2.php.net/references and this article:
Note: See TracChangeset
for help on using the changeset viewer.
