Skip to content

Commit

Permalink
Improved histories and default values of TLS read functions
Browse files Browse the repository at this point in the history
* tls/rudel-tls.el (rudel-tls-ask-connect-info-host-history): new
  variable; history of hosts read
  (rudel-tls-ask-connect-info-port-last): new variable; last prompt
  read
  (rudel-ask-connect-info): use
  `rudel-tls-ask-connect-info-host-history' and
  `rudel-tls-ask-connect-info-port-last' to provide default inputs and
  histories for host and port reading
  • Loading branch information
scymtym committed Aug 1, 2010
1 parent 7059b87 commit 9196ffb
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tls/rudel-tls.el
Expand Up @@ -261,14 +261,31 @@ support STARTTLS behavior.")
(unless rudel-tls-client-program
(error "Required program 'gnutls-cli' not available")))

(defvar rudel-tls-ask-connect-info-host-history nil
"History of hosts read by TLS backend's `rudel-ask-connect-info'.")

(defvar rudel-tls-ask-connect-info-port-last nil
"Last port read by TLS backend's `rudel-ask-connect-info'.")

(defmethod rudel-ask-connect-info ((this rudel-start-tls-backend)
&optional info)
"Augment INFO by read a hostname and a port number."
;; Read server host and port.
(let ((host (or (plist-get info :host)
(read-string "Server: ")))
(read-string
(if (car rudel-tls-ask-connect-info-host-history)
(format
"Server (default %s): "
(car rudel-tls-ask-connect-info-host-history))
"Server: ")
nil
'rudel-tls-ask-connect-info-host-history)))
(port (or (plist-get info :port)
(read-number "Port: "))))
(setq
rudel-tls-ask-connect-info-port-last
(read-number
"Port: "
rudel-tls-ask-connect-info-port-last)))))
(append (list :host host
:port port)
info)))
Expand Down

0 comments on commit 9196ffb

Please sign in to comment.