Changeset 5011:b0172175cc89 for buffy.c

Show
Ignore:
Timestamp:
2007-03-20 13:39:29 (21 months ago)
Author:
Miroslav Lichvar <mlichvar@…>
Branch:
default
Message:

Make BUFFY_SIZE a runtime switch ($check_mbox_size)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • buffy.c

    r4868 r5011  
    4646static short BuffyNotify = 0;   /* # of unnotified new boxes */ 
    4747 
    48 #ifdef BUFFY_SIZE 
    49  
    5048/* Find the last message in the file.  
    5149 * upon success return 0. If no message found - return -1 */ 
     
    168166  return; 
    169167} 
    170 #endif 
    171168 
    172169int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *err) 
     
    174171  BUFFY **tmp,*tmp1; 
    175172  char buf[_POSIX_PATH_MAX]; 
    176 #ifdef BUFFY_SIZE 
    177173  struct stat sb; 
    178 #endif /* BUFFY_SIZE */ 
    179174 
    180175  while (MoreArgs (s)) 
     
    233228    (*tmp)->newly_created = 0; 
    234229 
    235 #ifdef BUFFY_SIZE 
    236     /* for buffy_size, it is important that if the folder is new (tested by 
     230    /* for check_mbox_size, it is important that if the folder is new (tested by 
    237231     * reading it), the size is set to 0 so that later when we check we see 
    238      * that it increased .  without buffy_size we probably don't care. 
     232     * that it increased .  without check_mbox_size we probably don't care. 
    239233     */ 
    240     if (stat ((*tmp)->path, &sb) == 0 && !test_new_folder ((*tmp)->path)) 
     234    if (option(OPTCHECKMBOXSIZE) && 
     235        stat ((*tmp)->path, &sb) == 0 && !test_new_folder ((*tmp)->path)) 
    241236    { 
    242237      /* some systems out there don't have an off_t type */ 
     
    245240    else 
    246241      (*tmp)->size = 0; 
    247 #endif /* BUFFY_SIZE */ 
    248242  } 
    249243  return 0; 
    250244} 
    251245 
    252 #ifdef BUFFY_SIZE 
    253 /* people use buffy_size on systems where modified time attributes are BADLY 
    254  * broken. Ignore them. 
     246/* people use check_mbox_size on systems where modified time attributes are  
     247 * BADLY broken. Ignore them. 
    255248 */ 
    256 #define STAT_CHECK (sb.st_size > tmp->size) 
    257 #else 
    258 #define STAT_CHECK (sb.st_mtime > sb.st_atime || (tmp->newly_created && sb.st_ctime == sb.st_mtime && sb.st_ctime == sb.st_atime)) 
    259 #endif /* BUFFY_SIZE */ 
     249#define STAT_CHECK_SIZE (sb.st_size > tmp->size) 
     250#define STAT_CHECK_TIME (sb.st_mtime > sb.st_atime || (tmp->newly_created && sb.st_ctime == sb.st_mtime && sb.st_ctime == sb.st_atime)) 
     251#define STAT_CHECK (option(OPTCHECKMBOXSIZE) ? STAT_CHECK_SIZE : STAT_CHECK_TIME) 
    260252 
    261253int mutt_buffy_check (int force) 
     
    324316      tmp->newly_created = 1; 
    325317      tmp->magic = 0; 
    326 #ifdef BUFFY_SIZE 
    327318      tmp->size = 0; 
    328 #endif 
    329319      continue; 
    330320    } 
     
    366356          tmp->new = 1; 
    367357        } 
    368 #ifdef BUFFY_SIZE 
    369         else 
     358        else if (option(OPTCHECKMBOXSIZE)) 
    370359        { 
    371360          /* some other program has deleted mail from the folder */ 
    372361          tmp->size = (long) sb.st_size; 
    373362        } 
    374 #endif 
    375363        if (tmp->newly_created && 
    376364            (sb.st_ctime != sb.st_mtime || sb.st_ctime != sb.st_atime)) 
     
    408396      } 
    409397    } 
    410 #ifdef BUFFY_SIZE 
    411     else if (Context && Context->path) 
     398    else if (option(OPTCHECKMBOXSIZE) && Context && Context->path) 
    412399      tmp->size = (long) sb.st_size;    /* update the size */ 
    413 #endif 
    414400 
    415401    if (!tmp->new)