[Pkg-wmaker-commits] [wmbiff] 03/05: wmbiff: EXAMINE before STATUS

Doug Torrance dtorrance-guest at moszumanska.debian.org
Wed Jul 20 13:37:54 UTC 2016


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch upstream
in repository wmbiff.

commit 9286c5eab08c2d82ba684bfae2394b797f0018d7
Author: Doug Torrance <dtorrance at piedmont.edu>
Date:   Tue Jul 12 14:25:18 2016 -0400

    wmbiff: EXAMINE before STATUS
    
    Patch by Nye Liu <nyet at nyet.org> to fix Debian bug #830889 [1].
    
    Dear Maintainer,
    
    Outlook Office365 IMAP servers now expect a client to issue at least one
    EXAMINE before STATUS, or UNSEEN is always zero:
    
    "unsub" folder has two messages, one unseen.
    
    Broken:
    
    56:04.84 > CJFK1 LOGIN "nyet at xxx" "xxx"
    56:21.99 < CJFK1 OK LOGIN completed.
    56:21.99 > CJFK2 STATUS unsub (MESSAGES UNSEEN)
    56:22.20 < * STATUS unsub (MESSAGES 2 UNSEEN 0)
    56:22.20 < CJFK2 OK STATUS completed.
    
    Works:
    
    56:46.04 > BPEB1 LOGIN "nyet at xxx" "xxx"
    56:51.43 < BPEB1 OK LOGIN completed.
    56:51.43 > BPEB2 EXAMINE unsub
    56:51.67 < * 2 EXISTS
    56:51.67 < * 0 RECENT
    56:51.67 < * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
    56:51.67 < * OK [PERMANENTFLAGS ()] Permanent flags
    56:51.67 < * OK [UNSEEN 2] Is the first unseen message
    56:51.67 < * OK [UIDVALIDITY 164] UIDVALIDITY value
    56:51.67 < * OK [UIDNEXT 16] The next unique identifier value
    56:51.67 < BPEB2 OK [READ-ONLY] EXAMINE completed.
    56:51.67 > BPEB3 STATUS unsub (MESSAGES UNSEEN)
    56:51.89 < * STATUS unsub (MESSAGES 2 UNSEEN 1)
    56:51.89 < BPEB3 OK STATUS completed.
    
    Attached is a patch to always issue EXAMINE before a STATUS.
    
    It doesn't seem like it has to be done before every STATUS, just at least once.
    Is only a proof of concept. I don't presume to know the best way to handle
    optimizing it.
    
    [1] https://bugs.debian.org/830889
---
 wmbiff/Imap4Client.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/wmbiff/Imap4Client.c b/wmbiff/Imap4Client.c
index 8599f5a..882446d 100644
--- a/wmbiff/Imap4Client.c
+++ b/wmbiff/Imap4Client.c
@@ -294,6 +294,7 @@ int imap_checkmail( /*@notnull@ */ Pop3 pc)
 	/* recover connection state from the cache */
 	struct connection_state *scs = state_for_pcu(pc);
 	char buf[BUF_SIZE];
+	char examine_expect[BUF_SIZE];
 	static int command_id;
 
 	/* if it's not in the cache, try to open */
@@ -312,6 +313,14 @@ int imap_checkmail( /*@notnull@ */ Pop3 pc)
 		return -1;
 	}
 
+	command_id++;
+	tlscomm_printf(scs, "a%03d EXAMINE %s\r\n", command_id, pc->path);
+	snprintf(examine_expect, BUF_SIZE, "a%03d OK", command_id);
+	if (tlscomm_expect(scs, examine_expect, buf, 127) == 0) {
+		tlscomm_close(unbind(scs));
+		return -1;
+	}
+
 	/* if we've got it by now, try the status query */
 	command_id++;
 	tlscomm_printf(scs, "a%03d STATUS %s (MESSAGES UNSEEN)\r\n",

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git



More information about the Pkg-wmaker-commits mailing list