aboutsummaryrefslogtreecommitdiffstats
path: root/imap.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2002-12-26 22:06:03 +0000
committerEric S. Raymond <esr@thyrsus.com>2002-12-26 22:06:03 +0000
commit366eb7b3a91d53282f0b1007913a55be236a322e (patch)
treeeaf93bd4f0af17a32223f3a85ed027e365544acc /imap.c
parentdf9d522301cbc3e73e9816485f7deb744ae6f373 (diff)
downloadfetchmail-366eb7b3a91d53282f0b1007913a55be236a322e.tar.gz
fetchmail-366eb7b3a91d53282f0b1007913a55be236a322e.tar.bz2
fetchmail-366eb7b3a91d53282f0b1007913a55be236a322e.zip
Routine updates, including the latest Shetye patch.
svn path=/trunk/; revision=3778
Diffstat (limited to 'imap.c')
-rw-r--r--imap.c46
1 files changed, 13 insertions, 33 deletions
diff --git a/imap.c b/imap.c
index 732141d8..3ea5c27d 100644
--- a/imap.c
+++ b/imap.c
@@ -876,11 +876,6 @@ static int imap_fetch_body(int sock, struct query *ctl, int number, int *lenp)
* craps out during the message, it will still be marked `unseen' on
* the server.
*
- * However...*don't* do this if we're using keep to suppress deletion!
- * In that case, marking the seen flag is the only way to prevent the
- * message from being re-fetched on subsequent runs (and according
- * to RFC2060 p.43 this fetch should set Seen as a side effect).
- *
* According to RFC2060, and Mark Crispin the IMAP maintainer,
* FETCH %d BODY[TEXT] and RFC822.TEXT are "functionally
* equivalent". However, we know of at least one server that
@@ -898,17 +893,11 @@ static int imap_fetch_body(int sock, struct query *ctl, int number, int *lenp)
switch (imap_version)
{
case IMAP4rev1: /* RFC 2060 */
- if (!ctl->keep)
- gen_send(sock, "FETCH %d BODY.PEEK[TEXT]", number);
- else
- gen_send(sock, "FETCH %d BODY[TEXT]", number);
+ gen_send(sock, "FETCH %d BODY.PEEK[TEXT]", number);
break;
case IMAP4: /* RFC 1730 */
- if (!ctl->keep)
- gen_send(sock, "FETCH %d RFC822.TEXT.PEEK", number);
- else
- gen_send(sock, "FETCH %d RFC822.TEXT", number);
+ gen_send(sock, "FETCH %d RFC822.TEXT.PEEK", number);
break;
default: /* RFC 1176 */
@@ -958,26 +947,6 @@ static int imap_trail(int sock, struct query *ctl, int number)
/* UW IMAP returns "OK FETCH", Cyrus returns "OK Completed" */
if (strstr(buf, "OK"))
break;
-
-#ifdef __UNUSED__
- /*
- * Any IMAP server that fails to set Seen on a BODY[TEXT]
- * fetch violates RFC2060 p.43 (top). This becomes an issue
- * when keep is on, because seen messages aren't deleted and
- * get refetched on each poll. As a workaround, if keep is on
- * we can set the Seen flag explicitly.
- *
- * This code isn't used yet because we don't know of any IMAP
- * servers broken in this way.
- */
- if (ctl->keep)
- if ((ok = gen_transact(sock,
- imap_version == IMAP4
- ? "STORE %d +FLAGS.SILENT (\\Seen)"
- : "STORE %d +FLAGS (\\Seen)",
- number)))
- return(ok);
-#endif /* __UNUSED__ */
}
return(PS_SUCCESS);
@@ -1022,6 +991,16 @@ static int imap_delete(int sock, struct query *ctl, int number)
return(PS_SUCCESS);
}
+static int imap_mark_seen(int sock, struct query *ctl, int number)
+/* mark the given message as seen */
+{
+ return(gen_transact(sock,
+ imap_version == IMAP4
+ ? "STORE %d +FLAGS.SILENT (\\Seen)"
+ : "STORE %d +FLAGS (\\Seen)",
+ number));
+}
+
static int imap_logout(int sock, struct query *ctl)
/* send logout command */
{
@@ -1059,6 +1038,7 @@ const static struct method imap =
imap_fetch_body, /* request given message body */
imap_trail, /* eat message trailer */
imap_delete, /* delete the message */
+ imap_mark_seen, /* how to mark a message as seen */
imap_logout, /* expunge and exit */
TRUE, /* yes, we can re-poll */
};