From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/73564 Path: news.gmane.org!not-for-mail From: Daiki Ueno Newsgroups: gmane.emacs.gnus.general Subject: nnimap-username Date: Mon, 25 Oct 2010 11:59:20 +0900 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1287975422 19235 80.91.229.12 (25 Oct 2010 02:57:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 25 Oct 2010 02:57:02 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M21933@lists.math.uh.edu Mon Oct 25 04:57:00 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PADF5-0008W5-S9 for ding-account@gmane.org; Mon, 25 Oct 2010 04:57:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1PADE4-0003IZ-2o; Sun, 24 Oct 2010 21:55:56 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1PADE0-0003IC-Hw for ding@lists.math.uh.edu; Sun, 24 Oct 2010 21:55:52 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PADDy-0007LI-Ax for ding@lists.math.uh.edu; Sun, 24 Oct 2010 21:55:51 -0500 Original-Received: from ivory4.scn-net.ne.jp ([219.117.176.192]) by quimby.gnus.org with smtp (Exim 3.36 #1 (Debian)) id 1PADDw-0000Vk-00 for ; Mon, 25 Oct 2010 04:55:48 +0200 Original-Received: from ([192.168.0.187]) (envelope sender: ) by ivory4.scn-net.ne.jp with Active!Hunter esmtp server; Mon, 25 Oct 2010 11:55:43 +0900 Original-Received: Received: from well-done.deisui.org (g187018.scn-net.ne.jp [202.83.187.18]) (authenticated) by blue17.scn-net.ne.jp (unknown) with ESMTP id o9P2th39009540 for ; Mon, 25 Oct 2010 11:55:43 +0900 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:73564 Archived-At: --=-=-= Content-Type: text/plain Hi, The current nnimap/auth-source combo does not seem to support multiple IMAP accounts on the same host/port. How about adding `nnimap-username' server parameter to user can specify username like: (setq gnus-secondary-select-methods '((nnimap "ueno" (nnimap-address "example.org") (nnimap-username "ueno")) (nnimap "daiki" (nnimap-address "example.org") (nnimap-username "daiki")))) Here is a quick patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=nnimap-username.diff === modified file 'lisp/gnus/auth-source.el' --- lisp/gnus/auth-source.el 2010-10-10 22:48:40 +0000 +++ lisp/gnus/auth-source.el 2010-10-25 02:30:05 +0000 @@ -325,7 +325,9 @@ (cond ((equal "password" m) (let ((passwd (read-passwd - (format "Password for %s on %s: " prot host)))) + (if user + (format "Password for %s on %s/%s: " user host prot) + (format "Password for %s on %s: " prot host))))) (cond ;; Secret Service API. ((consp source) === modified file 'lisp/gnus/nnimap.el' --- lisp/gnus/nnimap.el 2010-10-24 22:32:38 +0000 +++ lisp/gnus/nnimap.el 2010-10-25 01:57:59 +0000 @@ -58,6 +58,9 @@ If nnimap-stream is `ssl', this will default to `imaps'. If not, it will default to `imap'.") +(defvoo nnimap-username nil + "The IMAP username used to login.") + (defvoo nnimap-stream 'ssl "How nnimap will talk to the IMAP server. Values are `ssl', `network', `starttls' or `shell'.") @@ -263,7 +266,7 @@ ?s host ?p port))))) -(defun nnimap-credentials (address ports &optional inhibit-create) +(defun nnimap-credentials (address ports &optional inhibit-create username) (let (port credentials) ;; Request the credentials from all ports, but only query on the ;; last port if all the previous ones have failed. @@ -271,7 +274,7 @@ (setq port (pop ports))) (setq credentials (auth-source-user-or-password - '("login" "password") address port nil + '("login" "password") address port username (if inhibit-create nil (null ports))))) @@ -410,7 +413,7 @@ (nnoo-current-server 'nnimap) ports t) ;; Then look them up based on the ;; physical address. - (nnimap-credentials nnimap-address ports))))) + (nnimap-credentials nnimap-address ports nil nnimap-username))))) (setq nnimap-object nil) (setq login-result (nnimap-command "LOGIN %S %S" (car credentials) @@ -418,12 +421,12 @@ (unless (car login-result) ;; If the login failed, then forget the credentials ;; that are now possibly cached. - (dolist (host (list (nnoo-current-server 'nnimap) - nnimap-address)) + (dolist (host (list (list (nnoo-current-server 'nnimap) nil) + (list nnimap-address nnimap-username))) (dolist (port ports) (dolist (element '("login" "password")) (auth-source-forget-user-or-password - element host port)))) + element (car host) port (nth 1 host))))) (delete-process (nnimap-process nnimap-object)) (setq nnimap-object nil)))) (when nnimap-object --=-=-= Content-Type: text/plain Regards, -- Daiki Ueno --=-=-=--