erc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Erc-commit] [commit][emacs22] Add explicit tls connection function


From: mwolson
Subject: [Erc-commit] [commit][emacs22] Add explicit tls connection function
Date: Sun, 14 Oct 2007 00:49:04 -0400

commit bd8cdbf8c8745956c373ded818601924c1925294
Author: Michael Olson <address@hidden>
Date:   Wed Jun 20 23:55:13 2007 +0000

    Add explicit tls connection function
    
    2007-06-20  Michael Olson  <address@hidden>
    
        * erc.el (erc-open-ssl-stream): Display informative error when
        ssl.el not found.
        (erc-tls): New function to connect using tls.el.
        (erc-open-tls-stream): New function to initiate tls connection.
        Display informative error when tls.el not found.
    git-archimport-id: address@hidden/erc--main--0--patch-153

diff --git a/ChangeLog b/ChangeLog
index ea81e0f..72d7445 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,12 @@
        only if each timestamp has changed since it was last computed.
        Thanks to offby1 for urging me to merge this.
 
+       * erc.el (erc-open-ssl-stream): Display informative error when
+       ssl.el not found.
+       (erc-tls): New function to connect using tls.el.
+       (erc-open-tls-stream): New function to initiate tls connection.
+       Display informative error when tls.el not found.
+
 2007-06-19  Michael Olson  <address@hidden>
 
        * erc-log.el: Update header with accurate instructions.
diff --git a/erc.el b/erc.el
index 08cda2e..66153d5 100644
--- a/erc.el
+++ b/erc.el
@@ -2158,7 +2158,11 @@ Arguments are the same as for `erc'."
   "Open an SSL stream to an IRC server.
 The process will be given the name NAME, its target buffer will be
 BUFFER.  HOST and PORT specify the connection target."
-  (when (require 'ssl)
+  (when (condition-case nil
+           (require 'ssl)
+         (error (message "You don't have ssl.el.  %s"
+                         "Try using `erc-tls' instead.")
+                nil))
     (let ((proc (open-ssl-stream name buffer host port)))
       ;; Ugly hack, but it works for now. Problem is it is
       ;; very hard to detect when ssl is established, because s_client
@@ -2167,6 +2171,24 @@ BUFFER.  HOST and PORT specify the connection target."
       (sit-for 5)
       proc)))
 
+(defun erc-tls (&rest r)
+  "Interactively select TLS connection parameters and run ERC.
+Arguments are the same as for `erc'."
+  (interactive (erc-select-read-args))
+  (let ((erc-server-connect-function 'erc-open-tls-stream))
+    (apply 'erc r)))
+
+(defun erc-open-tls-stream (name buffer host port)
+  "Open an TLS stream to an IRC server.
+The process will be given the name NAME, its target buffer will be
+BUFFER.  HOST and PORT specify the connection target."
+  (when (condition-case nil
+           (require 'tls)
+         (error (message "You don't have tls.el.  %s"
+                         "Try using `erc-ssl' instead.")
+                nil))
+    (open-tls-stream name buffer host port)))
+
 ;;; Debugging the protocol
 
 (defvar erc-debug-irc-protocol nil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]