Assume that password-cache.el is available

It was introduced in Emacs 23.1, which is our minimum requirement.

Remove conditional require of password.el, which used to be part of
Gnus.

Remove some fboundp calls.
This commit is contained in:
Magnus Henoch 2017-01-07 00:03:58 +00:00
parent 3de7fb40ab
commit 7fb313c259
1 changed files with 6 additions and 12 deletions

View File

@ -22,9 +22,7 @@
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(require 'cl)
(condition-case nil
(require 'password)
(error nil))
(require 'password-cache)
(condition-case nil
(require 'auth-source)
(error nil))
@ -329,24 +327,20 @@ If FULLJIDS is non-nil, complete jids with resources."
(funcall secret)
secret)))
(let ((prompt (format "Jabber password for %s: " bare-jid)))
(if (require 'password-cache nil t)
;; Need to copy the password, as sasl.el wants to erase it.
(copy-sequence
(password-read prompt (jabber-password-key bare-jid)))
(read-passwd prompt))))))
;; Need to copy the password, as sasl.el wants to erase it.
(copy-sequence
(password-read prompt (jabber-password-key bare-jid)))))))
(defun jabber-cache-password (bare-jid password)
"Cache PASSWORD for BARE-JID."
(when (fboundp 'password-cache-add)
(password-cache-add (jabber-password-key bare-jid) password)))
(password-cache-add (jabber-password-key bare-jid) password))
(defun jabber-uncache-password (bare-jid)
"Uncache cached password for BARE-JID.
Useful if the password proved to be wrong."
(interactive (list (jabber-jid-user
(completing-read "Forget password of account: " jabber-account-list nil nil nil 'jabber-account-history))))
(when (fboundp 'password-cache-remove)
(password-cache-remove (jabber-password-key bare-jid))))
(password-cache-remove (jabber-password-key bare-jid)))
(defun jabber-read-account (&optional always-ask contact-hint)
"Ask for which connected account to use.