diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 1999-11-25 12:57:31 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 1999-11-25 12:57:31 +0000 |
commit | e3c3035ca3d198f48846bd3d966a7860f0a61067 (patch) | |
tree | 98dde723d9978e3303c09b3c99b02faca32f9dbb /imap | |
parent | 0570f9dca7f6b07b47ddd2655466e681024796f4 (diff) |
A modified version of Tommi Komulainen's imap keepalive patch.
Diffstat (limited to 'imap')
-rw-r--r-- | imap/imap.h | 1 | ||||
-rw-r--r-- | imap/util.c | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/imap/imap.h b/imap/imap.h index fd41112d..7fdb30d8 100644 --- a/imap/imap.h +++ b/imap/imap.h @@ -51,5 +51,6 @@ int imap_parse_path (char* path, char* host, size_t hlen, int* port, int *socktype, char** mbox); void imap_qualify_path (char* dest, size_t len, const char* host, int port, const char* path, const char* name); +void imap_keepalive (void); #endif diff --git a/imap/util.c b/imap/util.c index 6bc5d423..fae9defe 100644 --- a/imap/util.c +++ b/imap/util.c @@ -26,6 +26,8 @@ #include <stdlib.h> #include <ctype.h> +#include <signal.h> + /* imap_continue: display a message and ask the user if she wants to * go on. */ int imap_continue (const char* msg, const char* resp) @@ -299,3 +301,30 @@ int imap_wordcasecmp(const char *a, const char *b) return mutt_strcasecmp(a, tmp); } + +/* imap_keepalive: use buffy to poll a remote imap folder + * while waiting for an external process + */ + +void imap_keepalive (void) +{ + sigset_t sigset; + sigset_t osigset; + + if (option (OPTMSGERR)) + return; + + sigemptyset (&sigset); + sigaddset (&sigset, SIGCHLD); + sigprocmask (SIG_UNBLOCK, &sigset, &osigset); + + set_option (OPTKEEPQUIET); + + mutt_buffy_check (0); + sleep (ImapCheckTimeout > 0 ? ImapCheckTimeout : 60); + + unset_option (OPTKEEPQUIET); + sigprocmask (SIG_BLOCK, &osigset, NULL); +} + + |