From: Daiki Ueno <ueno@unixuser.org>
To: ding@gnus.org
Subject: nnimap-username
Date: Mon, 25 Oct 2010 11:59:20 +0900 [thread overview]
Message-ID: <m3vd4r6kqf.fsf-ueno@unixuser.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 498 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnimap-username.diff --]
[-- Type: text/x-patch, Size: 2690 bytes --]
=== 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
[-- Attachment #3: Type: text/plain, Size: 25 bytes --]
Regards,
--
Daiki Ueno
next reply other threads:[~2010-10-25 2:59 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-25 2:59 Daiki Ueno [this message]
2010-10-25 6:33 ` nnimap-username Reiner Steib
2010-10-25 7:13 ` nnimap-username Daiki Ueno
2010-10-25 18:09 ` auth-source tokens (was: nnimap-username) Ted Zlatanov
2010-10-26 16:56 ` auth-source tokens Ted Zlatanov
2010-10-29 8:04 ` Michael Albinus
2010-10-29 22:15 ` Lars Magne Ingebrigtsen
2010-11-11 16:22 ` Ted Zlatanov
2010-11-14 17:24 ` Michael Albinus
2010-11-15 0:59 ` Ted Zlatanov
2010-11-15 4:47 ` Michael Albinus
2010-11-15 15:14 ` Ted Zlatanov
2010-11-15 16:03 ` Michael Albinus
2011-01-24 17:27 ` auth-source.el rewrite (was: auth-source tokens) Ted Zlatanov
2011-01-24 23:36 ` auth-source.el rewrite Lars Ingebrigtsen
2011-01-25 16:59 ` Ted Zlatanov
2011-01-25 21:09 ` Michael Albinus
2011-01-25 21:42 ` Ted Zlatanov
2011-01-26 8:32 ` Michael Albinus
2011-01-26 17:03 ` Ted Zlatanov
2011-01-26 19:35 ` Michael Albinus
2011-01-26 20:35 ` Ted Zlatanov
2011-01-26 22:15 ` Ted Zlatanov
2011-01-27 16:49 ` Michael Albinus
2011-01-27 20:20 ` Ted Zlatanov
2011-01-29 14:11 ` Michael Albinus
2011-01-31 2:49 ` Ted Zlatanov
2011-01-31 14:30 ` Michael Albinus
2011-01-31 17:09 ` Ted Zlatanov
2011-01-27 12:35 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3vd4r6kqf.fsf-ueno@unixuser.org \
--to=ueno@unixuser.org \
--cc=ding@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).