Changeset 2069:ca45605ed6eb for buffy.c
Legend:
- Unmodified
- Added
- Removed
-
buffy.c
r1601 r2069 231 231 struct stat contex_sb; 232 232 time_t t; 233 #ifdef USE_IMAP 234 static time_t last_imap_check = 0; 235 int do_imap_check = 1; 236 237 if (ImapCheckTimeout) 238 { 239 time_t now = time (NULL); 240 if (now - last_imap_check < ImapCheckTimeout) 241 do_imap_check = 0; 242 else 243 last_imap_check = now; 244 } 245 233 234 #ifdef USE_IMAP 246 235 /* update postponed count as well, on force */ 247 236 if (force) 248 237 mutt_update_num_postponed (); 249 250 238 #endif 251 239 … … 273 261 for (tmp = Incoming; tmp; tmp = tmp->next) 274 262 { 263 tmp->new = 0; 264 275 265 #ifdef USE_IMAP 276 266 if ((tmp->magic == M_IMAP) || mx_is_imap (tmp->path)) … … 278 268 else 279 269 #endif 280 { 281 tmp->new = 0; 282 283 if (stat (tmp->path, &sb) != 0 || sb.st_size == 0 || 284 (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0)) 285 { 286 /* if the mailbox still doesn't exist, set the newly created flag to 287 * be ready for when it does. 288 */ 289 tmp->newly_created = 1; 290 tmp->magic = 0; 291 #ifdef BUFFY_SIZE 292 tmp->size = 0; 293 #endif 294 continue; 295 } 270 if (stat (tmp->path, &sb) != 0 || sb.st_size == 0 || 271 (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0)) 272 { 273 /* if the mailbox still doesn't exist, set the newly created flag to 274 * be ready for when it does. */ 275 tmp->newly_created = 1; 276 tmp->magic = 0; 277 #ifdef BUFFY_SIZE 278 tmp->size = 0; 279 #endif 280 continue; 296 281 } 297 282 … … 300 285 if (!Context || !Context->path || 301 286 #ifdef USE_IMAP 302 /* unless folder is an IMAP folder */ 303 tmp->magic == M_IMAP || 287 (tmp->magic == M_IMAP && mutt_strcmp (tmp->path, Context->path)) || 288 (tmp->magic != M_IMAP && ( 304 289 #endif 305 290 sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino) 291 #ifdef USE_IMAP 292 )) 293 #endif 306 294 { 307 295 switch (tmp->magic) … … 356 344 #ifdef USE_IMAP 357 345 case M_IMAP: 358 /* poll on do_imap_check, else return cached value. 359 * If the check is forced (eg on mailbox open), check only current 360 * folder */ 361 if (do_imap_check || (force && Context && Context->path && 362 !mutt_strcmp (Context->path, tmp->path))) 363 { 364 tmp->new = 0; 365 if (imap_mailbox_check (tmp->path, 1) > 0) 366 { 367 BuffyCount++; 368 tmp->new = 1; 369 } 370 } 371 else 372 if (tmp->new) 373 BuffyCount++; 346 if ((tmp->new = imap_mailbox_check (tmp->path, 1)) > 0) 347 BuffyCount++; 348 else 349 tmp->new = 0; 374 350 375 351 break;
