(not (string-match "failed" response))))
(setq done process)
(if (memq (process-status process) '(open run))
- (imap-send-command-wait "LOGOUT"))
+ (imap-send-command "LOGOUT"))
(delete-process process)
nil)))))
done))
(not (string-match "failed" response))))
(setq done process)
(if (memq (process-status process) '(open run))
- (imap-send-command-wait "LOGOUT"))
+ (imap-send-command "LOGOUT"))
(delete-process process)
nil)))))
done))
(while (or (not user) (not passwd))
(setq user (or imap-username
(read-from-minibuffer
- (concat "IMAP username for " imap-server
+ (concat "IMAP username for " imap-server
" (using stream `" (symbol-name imap-stream)
"'): ")
(or user imap-default-user))))
t)
(defun imap-anonymous-auth (buffer)
- (message "imap: Loging in anonymously...")
+ (message "imap: Logging in anonymously...")
(with-current-buffer buffer
(imap-ok-p (imap-send-command-wait
(concat "LOGIN anonymous \"" (concat (user-login-name) "@"
(imap-disable-multibyte)
(buffer-disable-undo)
(setq imap-server (or server imap-server))
- (setq imap-port imap-port)
- (setq imap-auth imap-auth)
+ (setq imap-port (or port imap-port))
+ (setq imap-auth (or auth imap-auth))
(message "imap: Reconnecting with stream `%s'..." stream)
(if (null (let ((imap-stream stream))
(imap-open-1 (current-buffer))))
(progn
(kill-buffer (current-buffer))
- (message
- "imap: Reconnecting with stream `%s'...failed"
+ (message
+ "imap: Reconnecting with stream `%s'...failed"
stream))
;; We're done, kill the first connection
(imap-close buffer)
(setq streams nil))))))
(when (imap-opened buffer)
(setq imap-mailbox-data (make-vector imap-mailbox-prime 0)))
- (when imap-stream
+ (when imap-stream
buffer))))
(defun imap-opened (&optional buffer)
(if user (setq imap-username user))
(if passwd (setq imap-password passwd))
(if imap-auth
- (and (funcall (nth 2 (assq imap-auth
+ (and (funcall (nth 2 (assq imap-auth
imap-authenticator-alist)) buffer)
(setq imap-state 'auth))
;; Choose authenticator.
items)
(imap-mailbox-get items mailbox)))))
+(defun imap-mailbox-status-asynch (mailbox items &optional buffer)
+ "Send status item request ITEM on MAILBOX to server in BUFFER.
+ITEMS can be a symbol or a list of symbols, valid symbols are one of
+the STATUS data items -- ie 'messages, 'recent, 'uidnext, 'uidvalidity
+or 'unseen. The IMAP command tag is returned."
+ (with-current-buffer (or buffer (current-buffer))
+ (imap-send-command (list "STATUS \""
+ (imap-utf7-encode mailbox)
+ "\" "
+ (format "%s"
+ (if (listp items)
+ items
+ (list items)))))))
+
(defun imap-mailbox-acl-get (&optional mailbox buffer)
"Get ACL on mailbox from server in BUFFER."
(let ((mailbox (imap-utf7-encode mailbox)))
;; resp-cond-bye = "BYE" SP resp-text
;;
;; mailbox-data = "FLAGS" SP flag-list /
-;; "LIST" SP mailbox-list /
+;; "LIST" SP mailbox-list /
;; "LSUB" SP mailbox-list /
;; "SEARCH" *(SP nz-number) /
;; "STATUS" SP mailbox SP "("
;; [flag-perm *(SP flag-perm)] ")" /
;; "READ-ONLY" /
;; "READ-WRITE" /
-;; "TRYCREATE" /
+;; "TRYCREATE" /
;; "UIDNEXT" SP nz-number /
;; "UIDVALIDITY" SP nz-number /
;; "UNSEEN" SP nz-number /
(imap-forward)
(cond ((search-forward "PERMANENTFLAGS " nil t)
(imap-mailbox-put 'permanentflags (imap-parse-flag-list)))
- ((search-forward "UIDNEXT " nil t)
- (imap-mailbox-put 'uidnext (read (current-buffer))))
+ ((search-forward "UIDNEXT \\([0-9]+\\)" nil t)
+ (imap-mailbox-put 'uidnext (match-string 1)))
((search-forward "UNSEEN " nil t)
(imap-mailbox-put 'unseen (read (current-buffer))))
((looking-at "UIDVALIDITY \\([0-9]+\\)")
((eq token 'RECENT)
(imap-mailbox-put 'recent (read (current-buffer)) mailbox))
((eq token 'UIDNEXT)
- (imap-mailbox-put 'uidnext (read (current-buffer)) mailbox))
+ (and (looking-at " \\([0-9]+\\)")
+ (imap-mailbox-put 'uidnext (match-string 1) mailbox)
+ (goto-char (match-end 1))))
((eq token 'UIDVALIDITY)
(and (looking-at " \\([0-9]+\\)")
(imap-mailbox-put 'uidvalidity (match-string 1) mailbox)