[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exchange status errors



At Tue, 16 Nov 2010 20:35:35 -0600,
Eric Larson wrote:
>
> I've tried debugging this more and I'm pretty sure I'm hitting:
>
>  * IMAP STATUS command MUST NOT be used as a "check for new messages in the
>   selected mailbox" operation (RFC3501)
>
> In reading the code it seems like the "right" way to fix it would be
> to do and async check per folder, but that hasn't been done.

I don't think that the problem is caused by this bug in WL: The
Exchange server sends us an OK with the requested mailbox information
and for some reason WL fails when parsing the response.  You could try
this (e.g. it's not the STATUS bug) out by checking out WL branch
'elmo-imap4-compliance' where the STATUS command bug has been fixed.

> I think it is b/c the status returned uses all lowercase words. I'm
> not entirely sure that is the case, but that my current hypothesis. In
> any case, looking at the debug output, it seems like there is a subtle
> difference b/w gmail and exchange that lets gmail work and exchange
> fails.

The relevant code in elmo-imap4.el:

(setq status
      (cons
       (let ((token (read (current-buffer))))
	 (case (intern (upcase (symbol-name token)))
	   (MESSAGES
	    (list 'messages (read (current-buffer))))
	   (RECENT
	    (list 'recent (read (current-buffer))))
	   (UIDNEXT
	    (list 'uidnext (read (current-buffer))))
	   (UIDVALIDITY
	    (and (looking-at " \\([0-9]+\\)")
		 (prog1 (list 'uidvalidity (match-string 1))
		   (goto-char (match-end 1)))))
	   (UNSEEN
	    (list 'unseen (read (current-buffer))))
	   (t
	    (message
	     "Unknown status data %s in mailbox %s ignored"
	     token mailbox))))
       status))

So the lowercase answer should not be the problem because the tokes
are uppercased.  The error message you get indicate that grabbing the
tokens works.

You could try to overload the function `elmo-imap4-parse-status' with
a variant below and see what the conversion of the response token to a
symbol gets us.

(defun elmo-imap4-parse-status ()
  (let ((mailbox (elmo-imap4-parse-mailbox))
	status)
    (when (and mailbox (search-forward "(" nil t))
      (while (not (eq (char-after (point)) ?\)))
	(setq status
	      (cons
	       (let ((token (read (current-buffer))))
		 (case (intern (upcase (symbol-name token)))
		   (MESSAGES
		    (list 'messages (read (current-buffer))))
		   (RECENT
		    (list 'recent (read (current-buffer))))
		   (UIDNEXT
		    (list 'uidnext (read (current-buffer))))
		   (UIDVALIDITY
		    (and (looking-at " \\([0-9]+\\)")
			 (prog1 (list 'uidvalidity (match-string 1))
			   (goto-char (match-end 1)))))
		   (UNSEEN
		    (list 'unseen (read (current-buffer))))
		   (t
		    (message
		     "Unknown status data %s in mailbox %s ignored"
		     (intern (upcase (symbol-name token))) mailbox))))
	       status))
	(skip-chars-forward " ")))
    (and elmo-imap4-status-callback
	 (funcall elmo-imap4-status-callback
		  status
		  elmo-imap4-status-callback-data))
    (list 'status status)))

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

Attachment: pgprH3jG1v8rj.pgp
Description: PGP signature