emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog net/imap.el


From: Katsumi Yamaoka
Subject: [Emacs-diffs] emacs/lisp ChangeLog net/imap.el
Date: Mon, 28 Sep 2009 12:09:18 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Katsumi Yamaoka <yamaoka>       09/09/28 12:09:17

Modified files:
        lisp           : ChangeLog 
        lisp/net       : imap.el 

Log message:
        Synch with Gnus trunk.
        2009-09-10  Teodor Zlatanov  <address@hidden>
        
         * net/imap.el (imap-interactive-login): Better messages.
         (imap-open): Fix bug with renamed buffer on reconnect.
         (imap-authenticate): Add buffer-local imap-last-authenticator variable
         for easier debugging and cleaner code.  On successful (guessed based on
         server capabilities) secondary authentication, set imap-state
         correctly.
         (imap-last-authenticator): Define imap-last-authenticator as a variable
         to avoid warnings.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16280&r2=1.16281
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/imap.el?cvsroot=emacs&r1=1.20&r2=1.21

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16280
retrieving revision 1.16281
diff -u -b -r1.16280 -r1.16281
--- ChangeLog   28 Sep 2009 12:02:53 -0000      1.16280
+++ ChangeLog   28 Sep 2009 12:09:13 -0000      1.16281
@@ -1108,6 +1108,17 @@
        * loadup.el (define-key-rebound-commands): Don't bother fiddling with
        define-key-rebound-commands and precompute-menubar-bindings.
 
+2009-09-10  Teodor Zlatanov  <address@hidden>
+
+       * net/imap.el (imap-interactive-login): Better messages.
+       (imap-open): Fix bug with renamed buffer on reconnect.
+       (imap-authenticate): Add buffer-local imap-last-authenticator variable
+       for easier debugging and cleaner code.  On successful (guessed based on
+       server capabilities) secondary authentication, set imap-state
+       correctly.
+       (imap-last-authenticator): Define imap-last-authenticator as a variable
+       to avoid warnings.
+
 2009-09-10  Glenn Morris  <address@hidden>
 
        * pcvs.el (cvs-mode-find-file): Use forward-line rather than goto-line.

Index: net/imap.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/net/imap.el,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- net/imap.el 9 Sep 2009 09:29:32 -0000       1.20
+++ net/imap.el 28 Sep 2009 12:09:17 -0000      1.21
@@ -380,6 +380,7 @@
 (defvar imap-port nil)
 (defvar imap-username nil)
 (defvar imap-password nil)
+(defvar imap-last-authenticator nil)
 (defvar imap-calculate-literal-size-first nil)
 (defvar imap-state 'closed
   "IMAP state.
@@ -872,25 +873,26 @@
       (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))))
        (setq passwd (or imap-password
                         (read-passwd
-                         (concat "IMAP password for " user "@"
+                         (concat "imap: password for " user "@"
                                  imap-server " (using authenticator `"
                                  (symbol-name imap-auth) "'): "))))
        (when (and user passwd)
          (if (funcall loginfunc user passwd)
              (progn
+               (message "imap: Login successful...")
                (setq ret t
                      imap-username user)
                (when (and (not imap-password)
                           (or imap-store-password
-                              (y-or-n-p "Store password for this session? ")))
+                              (y-or-n-p "imap: Store password for this IMAP 
session? ")))
                  (setq imap-password passwd)))
-           (message "Login failed...")
+           (message "imap: Login failed...")
            (setq passwd nil)
            (setq imap-password nil)
            (sit-for 1))))
@@ -1160,7 +1162,10 @@
                                      buffer
                                    (buffer-name buffer))))
                        (kill-buffer buffer)
-                       (rename-buffer name))
+                       (rename-buffer name)
+                       ;; set the passed buffer to the current one,
+                       ;; so that (imap-opened buffer) later will work
+                       (setq buffer (current-buffer)))
                      (message "imap: Reconnecting with stream `%s'...done"
                               stream)
                      (setq imap-stream stream)
@@ -1173,6 +1178,7 @@
                (setq streams nil))))))
       (when (imap-opened buffer)
        (setq imap-mailbox-data (make-vector imap-mailbox-prime 0)))
+      ;; (debug "opened+state+auth+buffer" (imap-opened buffer) imap-state 
imap-auth buffer)
       (when imap-stream
        buffer))))
 
@@ -1217,25 +1223,32 @@
            (eq imap-state 'examine))
       (make-local-variable 'imap-username)
       (make-local-variable 'imap-password)
-      (if user (setq imap-username user))
-      (if passwd (setq imap-password passwd))
+      (make-local-variable 'imap-last-authenticator)
+      (when user (setq imap-username user))
+      (when passwd (setq imap-password passwd))
       (if imap-auth
-         (and (funcall (nth 2 (assq imap-auth
-                                    imap-authenticator-alist)) 
(current-buffer))
+         (and (setq imap-last-authenticator 
+                    (assq imap-auth imap-authenticator-alist))
+              (funcall (nth 2 imap-last-authenticator) (current-buffer))
               (setq imap-state 'auth))
        ;; Choose authenticator.
        (let ((auths imap-authenticators)
              auth)
          (while (setq auth (pop auths))
            ;; OK to use authenticator?
-           (when (funcall (nth 1 (assq auth imap-authenticator-alist)) 
(current-buffer))
+           (setq imap-last-authenticator
+                 (assq auth imap-authenticator-alist))
+           (when (funcall (nth 1 imap-last-authenticator) (current-buffer))
              (message "imap: Authenticating to `%s' using `%s'..."
                       imap-server auth)
              (setq imap-auth auth)
-             (if (funcall (nth 2 (assq auth imap-authenticator-alist)) 
(current-buffer))
+             (if (funcall (nth 2 imap-last-authenticator) (current-buffer))
                  (progn
                    (message "imap: Authenticating to `%s' using `%s'...done"
                             imap-server auth)
+                   ;; set imap-state correctly on successful auth attempt
+                   (setq imap-state 'auth)
+                   ;; stop iterating through the authenticator list
                    (setq auths nil))
                (message "imap: Authenticating to `%s' using `%s'...failed"
                         imap-server auth)))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]