aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--driver.c8
-rw-r--r--etrn.c1
-rw-r--r--fetchmail.h2
-rw-r--r--imap.c40
-rw-r--r--odmr.c1
-rw-r--r--pop3.c1
7 files changed, 34 insertions, 22 deletions
diff --git a/NEWS b/NEWS
index 24cb0d85..cd76a51a 100644
--- a/NEWS
+++ b/NEWS
@@ -199,6 +199,9 @@ fetchmail 6.3.0 (not yet released officially):
Berlios Bug #4725. Matthias Andree.
* Fix "auth ntlm" to send AUTH NTLM (rather than AUTH MSN). Add "auth msn"
officially. Reported by Yves Boisjoly. Matthias Andree
+* Expunge between IMAP folders when polling multiple folders.
+ Sunil Shetye. (MA)
+* Fix IMAP expunged message counting. Sunil Shetye. (MA)
# INTERNAL CHANGES
* Switched to automake. Matthias Andree.
diff --git a/driver.c b/driver.c
index 35ec61a6..88add41c 100644
--- a/driver.c
+++ b/driver.c
@@ -1424,6 +1424,14 @@ is restored."));
send_size_warnings(ctl);
}
}
+
+ /* end-of-mailbox processing before we repoll or switch to another one */
+ if (ctl->server.base_protocol->end_mailbox_poll)
+ {
+ err = (ctl->server.base_protocol->end_mailbox_poll)(mailserver_socket, ctl);
+ if (err)
+ goto cleanUp;
+ }
} while
/*
* Only re-poll if we either had some actual forwards and
diff --git a/etrn.c b/etrn.c
index eb953008..2a7e1aca 100644
--- a/etrn.c
+++ b/etrn.c
@@ -137,6 +137,7 @@ static const struct method etrn =
NULL, /* no message trailer */
NULL, /* how to delete a message */
NULL, /* how to mark a message as seen */
+ NULL, /* no mailbox support */
etrn_logout, /* log out, we're done */
FALSE, /* no, we can't re-poll */
};
diff --git a/fetchmail.h b/fetchmail.h
index fe65c336..bd992827 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -221,6 +221,8 @@ struct method /* describe methods for protocol state machine */
/* delete method */
int (*mark_seen)(int, struct query *, int);
/* mark as seen method */
+ int (*end_mailbox_poll)(int, struct query *);
+ /* end-of-mailbox processing */
int (*logout_cmd)(int, struct query *);
/* logout command */
flag retry; /* can getrange poll for new messages? */
diff --git a/imap.c b/imap.c
index 4d6727b1..933dd132 100644
--- a/imap.c
+++ b/imap.c
@@ -101,7 +101,10 @@ static int imap_ok(int sock, char *argbuf)
}
else if (strstr(buf, "EXPUNGE") && !strstr(buf, "OK"))
{
- count -= atoi(buf+2);
+ /* the response "* 10 EXPUNGE" means that the currently
+ * tenth (i.e. only one) message has been deleted */
+ if (atoi(buf+2) > 0)
+ count--;
if (count < 0)
count = 0;
}
@@ -639,29 +642,14 @@ static int imap_getrange(int sock,
if (pass > 1)
{
- /*
- * We have to have an expunge here, otherwise the re-poll will
- * infinite-loop picking up un-expunged messages -- unless the
- * expunge period is one and we've been nuking each message
- * just after deletion.
- */
- ok = 0;
- if (deletions) {
- ok = internal_expunge(sock);
- if (ok)
- {
- report(stderr, GT_("expunge failed\n"));
- return(ok);
- }
- }
-
- /*
+ /* deleted mails have already been expunged by
+ * end_mailbox_poll().
+ *
* recentcount is already set here by the last imap command which
* returned RECENT on detecting new mail. if recentcount is 0, wait
* for new mail.
- */
-
- /* this is a while loop because imap_idle() might return on other
+ *
+ * this is a while loop because imap_idle() might return on other
* mailbox changes also */
while (recentcount == 0 && do_idle) {
smtp_close(ctl, 1);
@@ -792,7 +780,6 @@ static int imap_getrange(int sock,
unseen = -1;
*newp = unseen;
- count = 0;
expunged = 0;
deletions = 0;
@@ -1108,6 +1095,14 @@ static int imap_mark_seen(int sock, struct query *ctl, int number)
number));
}
+static int imap_end_mailbox_poll(int sock, struct query *ctl)
+/* cleanup mailbox before we idle or switch to another one */
+{
+ if (deletions)
+ internal_expunge(sock);
+ return(PS_SUCCESS);
+}
+
static int imap_logout(int sock, struct query *ctl)
/* send logout command */
{
@@ -1142,6 +1137,7 @@ static const struct method imap =
imap_trail, /* eat message trailer */
imap_delete, /* delete the message */
imap_mark_seen, /* how to mark a message as seen */
+ imap_end_mailbox_poll, /* end-of-mailbox processing */
imap_logout, /* expunge and exit */
TRUE, /* yes, we can re-poll */
};
diff --git a/odmr.c b/odmr.c
index d1af7361..427d0796 100644
--- a/odmr.c
+++ b/odmr.c
@@ -226,6 +226,7 @@ static const struct method odmr =
NULL, /* no message trailer */
NULL, /* how to delete a message */
NULL, /* how to mark a message as seen */
+ NULL, /* no mailbox support */
odmr_logout, /* log out, we're done */
FALSE, /* no, we can't re-poll */
};
diff --git a/pop3.c b/pop3.c
index 171c9c3e..c320a620 100644
--- a/pop3.c
+++ b/pop3.c
@@ -1250,6 +1250,7 @@ static const struct method pop3 =
NULL, /* no message trailer */
pop3_delete, /* how to delete a message */
pop3_mark_seen, /* how to mark a message as seen */
+ NULL, /* no action at end of mailbox */
pop3_logout, /* log out, we're done */
FALSE, /* no, we can't re-poll */
};