Ignore:
Timestamp:
Apr 11, 2008 12:53:59 PM (5 years ago)
Author:
alec
Message:

#1484972: optimization: mark as read in one action with preview, deleted redundant quota reads

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/steps/mail/show.inc

    r1195 r1285  
    5454    $MESSAGE['is_safe'] = 1; 
    5555 
     56  $mbox_name = $IMAP->get_mailbox_name(); 
     57   
    5658  // calculate Etag for this request 
    57   $etag = md5($MESSAGE['UID'].$IMAP->get_mailbox_name().session_id().intval($MESSAGE['headers']->mdn_sent).intval($MESSAGE['is_safe']).intval($PRINT_MODE)); 
     59  $etag = md5($MESSAGE['UID'].$mbox_name.session_id().intval($MESSAGE['headers']->mdn_sent).intval($MESSAGE['is_safe']).intval($PRINT_MODE)); 
    5860 
    5961  // allow caching, unless remote images are present 
     
    7678    $MESSAGE['body'] = $IMAP->get_body($MESSAGE['UID']); 
    7779 
    78  
    7980  // mark message as read 
    80   if (!$MESSAGE['headers']->seen && $_action != 'preview') 
    81     $IMAP->set_flag($MESSAGE['UID'], 'SEEN'); 
     81  if (!$MESSAGE['headers']->seen) 
     82    { 
     83      $marked = $IMAP->set_flag($MESSAGE['UID'], 'SEEN'); 
     84      if($_action == 'preview' && $marked != -1) 
     85        { 
     86        $OUTPUT->command('set_unread_count_from_preview', $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN'), ($mbox_name == 'INBOX')); 
     87        $OUTPUT->command('mark_as_read_from_preview', $MESSAGE['UID']); 
     88        } 
     89    } 
    8290 
    8391  // give message uid to the client 
     
    8694   
    8795  // check for unset disposition notification 
    88   if ($MESSAGE['headers']->mdn_to && !$MESSAGE['headers']->mdn_sent && $IMAP->get_mailbox_name() != $CONFIG['drafts_mbox']) 
     96  if ($MESSAGE['headers']->mdn_to && !$MESSAGE['headers']->mdn_sent && $mbox_name != $CONFIG['drafts_mbox']) 
    8997  { 
    9098    if (intval($CONFIG['mdn_requests']) === 1) 
Note: See TracChangeset for help on using the changeset viewer.