]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/net/rcirc.el (rcirc-prompt-for-encryption): New function.
authorDeniz Dogan <deniz@dogan.se>
Sun, 5 Jun 2011 19:03:28 +0000 (21:03 +0200)
committerDeniz Dogan <deniz@dogan.se>
Sun, 5 Jun 2011 19:03:28 +0000 (21:03 +0200)
(rcirc): Use it to prompt for encryption.

lisp/ChangeLog
lisp/net/rcirc.el

index 2e0352a7bdf03a052c54f26d7a885b82c6b58169..f5a26ed8482b2413cc677a7fbeeb022be20dd362 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-05  Deniz Dogan  <deniz@dogan.se>
+
+       * net/rcirc.el (rcirc-prompt-for-encryption): New function.
+       (rcirc): Use it to prompt for encryption.
+
 2011-06-05  Roland Winkler  <winkler@gnu.org>
 
        * textmodes/bibtex.el (bibtex-search-buffer): New variable.
index bd9d6846a4bb45ee0e363f8b2c58b96f97876b20..bf4faba519791e62e20c62fbcde1b7a7b5499e42 100644 (file)
@@ -455,15 +455,7 @@ If ARG is non-nil, instead prompt for connection parameters."
                                                           :channels)
                                                " "))
                        "[, ]+" t))
-             (encryption
-              (intern (completing-read "Encryption (default plain): "
-                                       '("plain" "tls")
-                                       nil t
-                                       (let ((choice (plist-get server-plist
-                                                                :encryption)))
-                                         (when choice
-                                           (symbol-name choice)))
-                                       nil "plain"))))
+             (encryption (rcirc-prompt-for-encryption server-plist)))
        (rcirc-connect server port nick user-name
                       rcirc-default-full-name
                       channels password encryption))
@@ -596,6 +588,17 @@ If ARG is non-nil, instead prompt for connection parameters."
       (time-to-seconds (current-time))
     (float-time)))
 
+(defun rcirc-prompt-for-encryption (server-plist)
+  "Prompt the user for the encryption method to use.
+SERVER-PLIST is the property list for the server."
+  (let ((msg "Encryption (default %s): ")
+        (choices '("plain" "tls"))
+        (default (or (plist-get server-plist :encryption)
+                     "plain")))
+    (intern
+     (completing-read (format msg default)
+                      choices nil t "" nil default))))
+
 (defun rcirc-keepalive ()
   "Send keep alive pings to active rcirc processes.
 Kill processes that have not received a server message since the