Changeset 1111:53998cee3e2d for buffy.c
Legend:
- Unmodified
- Added
- Removed
-
buffy.c
r1099 r1111 229 229 struct stat contex_sb; 230 230 time_t t; 231 #ifdef USE_IMAP 232 static time_t last_imap_check = 0; 233 int do_imap_check = 1; 234 235 if (ImapCheckTime) 236 { 237 time_t now = time (NULL); 238 if (!force && (now - last_imap_check < ImapCheckTime)) 239 do_imap_check = 0; 240 else 241 last_imap_check = now; 242 } 243 #endif 231 244 232 245 /* fastest return if there are no mailboxes */ … … 234 247 return 0; 235 248 t = time (NULL); 236 if (!force && t - BuffyTime < BuffyTimeout)249 if (!force && (t - BuffyTime < BuffyTimeout)) 237 250 return BuffyCount; 238 251 … … 241 254 BuffyNotify = 0; 242 255 256 #ifdef USE_IMAP 257 if (!Context || Context->magic != M_IMAP) 258 #endif 243 259 /* check device ID and serial number instead of comparing paths */ 244 260 if (!Context || !Context->path || stat (Context->path, &contex_sb) != 0) … … 250 266 for (tmp = Incoming; tmp; tmp = tmp->next) 251 267 { 252 tmp->new = 0;253 254 268 #ifdef USE_IMAP 255 269 if ((tmp->magic == M_IMAP) || mx_is_imap (tmp->path)) 256 {257 270 tmp->magic = M_IMAP; 258 }259 271 else 260 272 #endif 261 if (stat (tmp->path, &sb) != 0 || sb.st_size == 0 || 262 (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0)) 263 { 264 /* if the mailbox still doesn't exist, set the newly created flag to 265 * be ready for when it does. 266 */ 267 tmp->newly_created = 1; 268 tmp->magic = 0; 269 #ifdef BUFFY_SIZE 270 tmp->size = 0; 271 #endif 272 continue; 273 } 274 273 { 274 tmp->new = 0; 275 276 if (stat (tmp->path, &sb) != 0 || sb.st_size == 0 || 277 (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0)) 278 { 279 /* if the mailbox still doesn't exist, set the newly created flag to 280 * be ready for when it does. 281 */ 282 tmp->newly_created = 1; 283 tmp->magic = 0; 284 #ifdef BUFFY_SIZE 285 tmp->size = 0; 286 #endif 287 continue; 288 } 289 290 #ifdef USE_IMAP 291 } 292 #endif 293 294 /* check to see if the folder is the currently selected folder 295 * before polling */ 275 296 if (!Context || !Context->path || 297 #ifdef USE_IMAP 298 /* unless folder is an IMAP folder */ 299 tmp->magic == M_IMAP || 300 #endif 276 301 sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino) 277 302 { … … 327 352 #ifdef USE_IMAP 328 353 case M_IMAP: 329 if (imap_buffy_check (tmp->path) > 0) 330 { 331 BuffyCount++; 332 tmp->new = 1; 333 } 354 /* poll on do_imap_check, else return cached value */ 355 if (do_imap_check) 356 { 357 tmp->new = 0; 358 if (imap_buffy_check (tmp->path) > 0) 359 { 360 BuffyCount++; 361 tmp->new = 1; 362 } 363 } 364 else 365 { 366 if (tmp->new) 367 BuffyCount++; 368 } 369 334 370 break; 335 371 #endif … … 346 382 BuffyNotify++; 347 383 } 384 348 385 BuffyDoneTime = BuffyTime; 349 386 return (BuffyCount);
