diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2000-06-28 13:58:01 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2000-06-28 13:58:01 +0000 |
commit | 6cbc54561450d2d14e6ac312a1f9882b3d4152e3 (patch) | |
tree | 7ce07385db79ad7cc180fc7bdd86b66c272ee4c8 /imap.c | |
parent | 5a60f96022ab2369d19fea05319a7357087ef8f3 (diff) | |
download | fetchmail-6cbc54561450d2d14e6ac312a1f9882b3d4152e3.tar.gz fetchmail-6cbc54561450d2d14e6ac312a1f9882b3d4152e3.tar.bz2 fetchmail-6cbc54561450d2d14e6ac312a1f9882b3d4152e3.zip |
Try to do IDLE (if enabled) even when there are no messages.
svn path=/trunk/; revision=2916
Diffstat (limited to 'imap.c')
-rw-r--r-- | imap.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -1044,6 +1044,16 @@ static int internal_expunge(int sock) return(PS_SUCCESS); } +static int imap_idle(int sock) +/* start an RFC2177 IDLE */ +{ + stage = STAGE_IDLE; + saved_timeout = mytimeout; + mytimeout = 0; + + return (gen_transact(sock, "IDLE")); +} + static int imap_getrange(int sock, struct query *ctl, const char *folder, @@ -1069,12 +1079,8 @@ static int imap_getrange(int sock, ok = internal_expunge(sock); count = -1; if (do_idle) - { - stage = STAGE_IDLE; - saved_timeout = mytimeout; - mytimeout = 0; - } - if (ok || gen_transact(sock, do_idle ? "IDLE" : "NOOP")) + ok = imap_idle(sock); + if (ok || gen_transact(sock, "NOOP")) { report(stderr, _("re-poll failed\n")); return(ok); @@ -1098,6 +1104,10 @@ static int imap_getrange(int sock, } else if (outlevel >= O_DEBUG) report(stdout, "%d messages waiting after first poll\n", count); + + /* no messages? then we may need to idle until we get some */ + if (count == 0 && do_idle) + imap_idle(sock); } *countp = count; |