summaryrefslogtreecommitdiffstats
path: root/imap
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1999-11-25 12:57:31 +0000
committerThomas Roessler <roessler@does-not-exist.org>1999-11-25 12:57:31 +0000
commite3c3035ca3d198f48846bd3d966a7860f0a61067 (patch)
tree98dde723d9978e3303c09b3c99b02faca32f9dbb /imap
parent0570f9dca7f6b07b47ddd2655466e681024796f4 (diff)
A modified version of Tommi Komulainen's imap keepalive patch.
Diffstat (limited to 'imap')
-rw-r--r--imap/imap.h1
-rw-r--r--imap/util.c29
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);
+}
+
+