thomascube
2010-03-02 5e9a5661011e64423e1978599c56d47f8b0cfa37
Fix checking for new mail (#1485794)

3 files modified
38 ■■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/js/app.js 26 ●●●● patch | view | raw | blame | history
program/steps/mail/check_recent.inc 11 ●●●●● patch | view | raw | blame | history
CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
- Fix checking for new mail: now checks unseen count of inbox (#1485794)
- Improve performance by avoiding unnecessary updates to the session table (#1486325)
- Fix invalid <font> tags which cause HTML message rendering problems (#1486521)
- Fix CVE-2010-0464: Disable DNS prefetching (#1486449)
program/js/app.js
@@ -624,8 +624,8 @@
        if (this.env.sort_col==sort_col)
          sort_order = this.env.sort_order=='ASC' ? 'DESC' : 'ASC';
        else
      sort_order = 'ASC';
          sort_order = 'ASC';
        // set table header class
        $('#rcm'+this.env.sort_col).removeClass('sorted'+(this.env.sort_order.toUpperCase()));
        $('#rcm'+sort_col).addClass('sorted'+sort_order);
@@ -1618,8 +1618,8 @@
      this.env.current_page = 1;
      this.set_busy(true, 'searching');
      this.http_request('search', '_filter='+filter
            + (search ? '&_q='+urlencode(search) : '')
            + (this.env.mailbox ? '&_mbox='+urlencode(this.env.mailbox) : ''), true);
          + (search ? '&_q='+urlencode(search) : '')
          + (this.env.mailbox ? '&_mbox='+urlencode(this.env.mailbox) : ''), true);
    }
@@ -4260,8 +4260,8 @@
      
      case 'moveto':
        if (this.env.action == 'show') {
      // re-enable commands on move/delete error
      this.enable_command('reply', 'reply-all', 'forward', 'delete', 'mark', 'print', 'open', 'edit', 'viewsource', 'download', true);
          // re-enable commands on move/delete error
          this.enable_command('reply', 'reply-all', 'forward', 'delete', 'mark', 'print', 'open', 'edit', 'viewsource', 'download', true);
        } else if (this.message_list)
          this.message_list.init();
        break;
@@ -4274,8 +4274,8 @@
            this.show_contentframe(false);
          // disable commands useless when mailbox is empty
          this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete', 
        'mark', 'viewsource', 'open', 'edit', 'download', 'print', 'load-attachment',
        'purge', 'expunge', 'select-all', 'select-none', 'sort', false);
            'mark', 'viewsource', 'open', 'edit', 'download', 'print', 'load-attachment',
            'purge', 'expunge', 'select-all', 'select-none', 'sort', false);
        }
        break;
@@ -4321,16 +4321,18 @@
    };
  // send periodic request to check for recent messages
  this.check_for_recent = function(setbusy)
  this.check_for_recent = function(refresh)
    {
    if (this.busy)
      return;
    if (setbusy)
      this.set_busy(true, 'checkingmail');
    var addurl = '_t=' + (new Date().getTime());
    if (refresh) {
      this.set_busy(true, 'checkingmail');
      addurl += '&_refresh=1';
    }
    if (this.gui_objects.messagelist)
      addurl += '&_list=1';
    if (this.gui_objects.quotadisplay)
program/steps/mail/check_recent.inc
@@ -22,6 +22,17 @@
$a_mailboxes = $IMAP->list_mailboxes();
$check_all = (bool)$RCMAIL->config->get('check_all_folders');
// check if unread count of INBOX changed and refresh message list if so
if (!empty($_GET['_refresh'])) {
  $unread_count = $IMAP->messagecount('INBOX', 'UNSEEN', TRUE);
  if ($unread_count > $_SESSION['unseen_count']['INBOX']) {
    $OUTPUT->command('set_unread_count', 'INBOX', $unread_count, true);
    $OUTPUT->command('list_mailbox', 'INBOX', 1);  // let the client switch to INBOX and get the message list
    $OUTPUT->send();
  }
}
// check recent/unseen counts for all mailboxes
foreach ($a_mailboxes as $mbox_name) {
  if ($mbox_name == $IMAP->get_mailbox_name()) {
    if ($recent_count = $IMAP->messagecount(NULL, 'RECENT', TRUE)) {