From: Julien Danjou Date: Fri, 15 Jun 2012 14:47:31 +0000 (+0200) Subject: erc: use auth-source X-Git-Tag: emacs-24.2.90~1199^2~470 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=52f8337d7129eebc1bebcd07b61f3e0ec3a6bbc2;p=emacs.git erc: use auth-source * erc.el (erc-open): Use `auth-source' for password retrieval when possible. --- diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index fbc5baa6a79..f84df4c7b89 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,3 +1,8 @@ +2012-06-15 Julien Danjou + + * erc.el (erc-open): Use `auth-source' for password retrieval when + possible. + 2012-06-12 Chong Yidong * erc-dcc.el (erc-dcc-chat-filter-functions): Rename from diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 2f714bd6d14..0fc308621b1 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -71,6 +71,7 @@ (require 'font-lock) (require 'pp) (require 'thingatpt) +(require 'auth-source) (require 'erc-compat) (defvar erc-official-location @@ -2006,7 +2007,19 @@ Returns the buffer for the given server or channel." ;; The local copy of `erc-nick' - the list of nicks to choose (setq erc-default-nicks (if (consp erc-nick) erc-nick (list erc-nick))) ;; password stuff - (setq erc-session-password passwd) + (setq erc-session-password (or passwd + (let ((secret + (plist-get + (nth 0 + (auth-source-search :host server + :max 1 + :user nick + :port port + :require '(:secret))) + :secret))) + (if (functionp secret) + (funcall secret) + secret)))) ;; debug output buffer (setq erc-dbuf (when erc-log-p