Changeset 1024:72cb474edaf3 for buffy.c

Show
Ignore:
Timestamp:
1999-08-30 02:41:10 (9 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
mutt-1-0-stable
Message:

[stable] back-port of various IMAP-related fixes. From Brendan
Cully <brendan@…>.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • buffy.c

    r905 r1024  
    228228  struct stat contex_sb; 
    229229  time_t t; 
     230#ifdef USE_IMAP 
     231  static time_t last_imap_check = 0; 
     232  int do_imap_check = 1; 
     233 
     234  if (ImapCheckTime) 
     235  { 
     236    time_t now = time (NULL); 
     237    if (!force && (now - last_imap_check < ImapCheckTime)) 
     238      do_imap_check = 0; 
     239    else 
     240      last_imap_check = now; 
     241  } 
     242#endif 
    230243 
    231244  /* fastest return if there are no mailboxes */ 
     
    240253  BuffyNotify = 0; 
    241254 
     255#ifdef USE_IMAP 
     256  if (!Context || Context->magic != M_IMAP) 
     257#endif 
    242258  /* check device ID and serial number instead of comparing paths */ 
    243259  if (!Context || !Context->path || stat (Context->path, &contex_sb) != 0) 
     
    249265  for (tmp = Incoming; tmp; tmp = tmp->next) 
    250266  { 
    251     tmp->new = 0; 
    252  
    253267#ifdef USE_IMAP 
    254268    if ((tmp->magic == M_IMAP) || mx_is_imap (tmp->path)) 
    255     { 
    256269      tmp->magic = M_IMAP; 
    257     } 
    258270    else 
    259271#endif 
    260     if (stat (tmp->path, &sb) != 0 || 
    261         (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0)) 
    262     { 
    263       /* if the mailbox still doesn't exist, set the newly created flag to 
    264        * be ready for when it does. 
    265        */ 
    266       tmp->newly_created = 1; 
    267       tmp->magic = 0; 
    268 #ifdef BUFFY_SIZE 
    269       tmp->size = 0; 
    270 #endif 
    271       continue; 
     272    { 
     273      tmp->new = 0; 
     274 
     275      if (stat (tmp->path, &sb) != 0 || 
     276        (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0)) 
     277      { 
     278        /* if the mailbox still doesn't exist, set the newly created flag to 
     279         * be ready for when it does. 
     280         */ 
     281        tmp->newly_created = 1; 
     282        tmp->magic = 0; 
     283#ifdef BUFFY_SIZE 
     284        tmp->size = 0; 
     285#endif 
     286        continue; 
     287      } 
    272288    } 
    273289 
    274290    if (!Context || !Context->path ||  
     291#ifdef USE_IMAP 
     292        /* Poll current IMAP folder like any other */ 
     293        tmp->magic == M_IMAP || 
     294#endif 
    275295        sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino) 
    276296    { 
     
    326346#ifdef USE_IMAP 
    327347      case M_IMAP: 
    328         if (imap_buffy_check (tmp->path) > 0) 
    329         { 
    330           BuffyCount++; 
    331           tmp->new = 1; 
    332         } 
     348        /* poll on do_imap_check, else return cached value */ 
     349        if (do_imap_check) 
     350        { 
     351          tmp->new = 0; 
     352          if (imap_buffy_check (tmp->path) > 0) 
     353          { 
     354            BuffyCount++; 
     355            tmp->new = 1; 
     356          } 
     357        } 
     358        else 
     359          if (tmp->new) 
     360            BuffyCount++; 
     361 
    333362        break; 
    334363#endif