diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 1999-07-20 08:05:32 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 1999-07-20 08:05:32 +0000 |
commit | d0b3c76ae7658317eefe99de8b281d80ad36bc02 (patch) | |
tree | 5d96bb8dcbfcd7dff27255c7b3f71d66851e1f3b /buffy.c | |
parent | 1264a0274621278ddff7571d4397920e2f8770e5 (diff) |
Bugs fixed
* Mutt sometimes forgets that IMAP folders with new mail have new
mail.
* On some common IMAP servers, Mutt erroneously insists that the
current folder has new mail.
* Mutt constantly polls the server for new messages,
disregarding the imap_checkinterval option.
New features
* tab-completion of IMAP folders. Not yet namespace aware, though it
will work within an alternate namespace (eg won't complete #ft ->
#ftp, but will complete #ftp/pu -> #ftp/pub). Some tweaking of the
browser was necessary to get it to cooperate with completion.
Some remains to be done.
(From: From: Brendan Cully <brendan@kublai.com>)
Diffstat (limited to 'buffy.c')
-rw-r--r-- | buffy.c | 75 |
1 files changed, 56 insertions, 19 deletions
@@ -228,18 +228,34 @@ int mutt_buffy_check (int force) char path[_POSIX_PATH_MAX]; struct stat contex_sb; time_t t; +#ifdef USE_IMAP + static time_t last_imap_check = 0; + int do_imap_check = 1; + + if (ImapCheckTime) + { + time_t now = time (NULL); + if (!force && (now - last_imap_check < ImapCheckTime)) + do_imap_check = 0; + else + last_imap_check = now; + } +#endif /* fastest return if there are no mailboxes */ if (!Incoming) return 0; t = time (NULL); - if (!force && t - BuffyTime < BuffyTimeout) + if (!force && (t - BuffyTime < BuffyTimeout)) return BuffyCount; BuffyTime = t; BuffyCount = 0; BuffyNotify = 0; +#ifdef USE_IMAP + if (!Context || Context->magic != M_IMAP) +#endif /* check device ID and serial number instead of comparing paths */ if (!Context || !Context->path || stat (Context->path, &contex_sb) != 0) { @@ -249,30 +265,39 @@ int mutt_buffy_check (int force) for (tmp = Incoming; tmp; tmp = tmp->next) { - tmp->new = 0; - #ifdef USE_IMAP if ((tmp->magic == M_IMAP) || mx_is_imap (tmp->path)) - { tmp->magic = M_IMAP; - } else #endif - if (stat (tmp->path, &sb) != 0 || sb.st_size == 0 || - (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0)) { - /* if the mailbox still doesn't exist, set the newly created flag to - * be ready for when it does. - */ - tmp->newly_created = 1; - tmp->magic = 0; + tmp->new = 0; + + if (stat (tmp->path, &sb) != 0 || sb.st_size == 0 || + (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0)) + { + /* if the mailbox still doesn't exist, set the newly created flag to + * be ready for when it does. + */ + tmp->newly_created = 1; + tmp->magic = 0; #ifdef BUFFY_SIZE - tmp->size = 0; + tmp->size = 0; #endif - continue; + continue; + } + +#ifdef USE_IMAP } +#endif + /* check to see if the folder is the currently selected folder + * before polling */ if (!Context || !Context->path || +#ifdef USE_IMAP + /* unless folder is an IMAP folder */ + tmp->magic == M_IMAP || +#endif sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino) { switch (tmp->magic) @@ -326,11 +351,22 @@ int mutt_buffy_check (int force) #ifdef USE_IMAP case M_IMAP: - if (imap_buffy_check (tmp->path) > 0) - { - BuffyCount++; - tmp->new = 1; - } + /* poll on do_imap_check, else return cached value */ + if (do_imap_check) + { + tmp->new = 0; + if (imap_buffy_check (tmp->path) > 0) + { + BuffyCount++; + tmp->new = 1; + } + } + else + { + if (tmp->new) + BuffyCount++; + } + break; #endif } @@ -345,6 +381,7 @@ int mutt_buffy_check (int force) else if (!tmp->notified) BuffyNotify++; } + BuffyDoneTime = BuffyTime; return (BuffyCount); } |