diff options
| author | Lars Magne Ingebrigtsen | 2011-06-23 02:17:41 +0200 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2011-06-23 02:17:41 +0200 |
| commit | c4db078bfdea38627518a92872885e2948db48d3 (patch) | |
| tree | df77d51f6cf6146af08850c09419732daf895717 | |
| parent | b534ed407e625728e26d7f3101e500cf59e593c5 (diff) | |
| download | emacs-c4db078bfdea38627518a92872885e2948db48d3.tar.gz emacs-c4db078bfdea38627518a92872885e2948db48d3.zip | |
Clean up the ssl/tls support to be able to use the built-in support, too.
| -rw-r--r-- | lisp/erc/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/erc/erc.el | 39 |
2 files changed, 12 insertions, 36 deletions
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index f1c0b2d1c65..3d9b0c8646f 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2011-06-23 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * erc.el (erc-ssl): Made into a synonym for erc-tls, which | ||
| 4 | provides a superset of the same functionality. | ||
| 5 | (erc-open-ssl-stream): Removed. | ||
| 6 | (erc-open-tls-stream): Use `open-network-stream' instead of | ||
| 7 | `open-tls-stream' directly to be able to use the built-in TLS | ||
| 8 | support. | ||
| 9 | |||
| 1 | 2011-05-28 Stefan Monnier <monnier@iro.umontreal.ca> | 10 | 2011-05-28 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 11 | ||
| 3 | * erc-pcomplete.el (erc-pcompletions-at-point): Mark the completion | 12 | * erc-pcomplete.el (erc-pcompletions-at-point): Mark the completion |
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index a8c592696ad..bab8fd1e455 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el | |||
| @@ -2164,34 +2164,7 @@ be invoked for the values of the other parameters." | |||
| 2164 | 2164 | ||
| 2165 | ;;;###autoload | 2165 | ;;;###autoload |
| 2166 | (defalias 'erc-select 'erc) | 2166 | (defalias 'erc-select 'erc) |
| 2167 | 2167 | (defalias 'erc-ssl 'erc-tls) | |
| 2168 | (defun erc-ssl (&rest r) | ||
| 2169 | "Interactively select SSL connection parameters and run ERC. | ||
| 2170 | Arguments are the same as for `erc'." | ||
| 2171 | (interactive (erc-select-read-args)) | ||
| 2172 | (let ((erc-server-connect-function 'erc-open-ssl-stream)) | ||
| 2173 | (apply 'erc r))) | ||
| 2174 | |||
| 2175 | (defalias 'erc-select-ssl 'erc-ssl) | ||
| 2176 | |||
| 2177 | (declare-function open-ssl-stream "ext:ssl" (name buffer host service)) | ||
| 2178 | |||
| 2179 | (defun erc-open-ssl-stream (name buffer host port) | ||
| 2180 | "Open an SSL stream to an IRC server. | ||
| 2181 | The process will be given the name NAME, its target buffer will be | ||
| 2182 | BUFFER. HOST and PORT specify the connection target." | ||
| 2183 | (when (condition-case nil | ||
| 2184 | (require 'ssl) | ||
| 2185 | (error (message "You don't have ssl.el. %s" | ||
| 2186 | "Try using `erc-tls' instead.") | ||
| 2187 | nil)) | ||
| 2188 | (let ((proc (open-ssl-stream name buffer host port))) | ||
| 2189 | ;; Ugly hack, but it works for now. Problem is it is | ||
| 2190 | ;; very hard to detect when ssl is established, because s_client | ||
| 2191 | ;; doesn't give any CONNECTIONESTABLISHED kind of message, and | ||
| 2192 | ;; most IRC servers send nothing and wait for you to identify. | ||
| 2193 | (sit-for 5) | ||
| 2194 | proc))) | ||
| 2195 | 2168 | ||
| 2196 | (defun erc-tls (&rest r) | 2169 | (defun erc-tls (&rest r) |
| 2197 | "Interactively select TLS connection parameters and run ERC. | 2170 | "Interactively select TLS connection parameters and run ERC. |
| @@ -2200,18 +2173,12 @@ Arguments are the same as for `erc'." | |||
| 2200 | (let ((erc-server-connect-function 'erc-open-tls-stream)) | 2173 | (let ((erc-server-connect-function 'erc-open-tls-stream)) |
| 2201 | (apply 'erc r))) | 2174 | (apply 'erc r))) |
| 2202 | 2175 | ||
| 2203 | (declare-function open-tls-stream "tls" (name buffer host port)) | ||
| 2204 | |||
| 2205 | (defun erc-open-tls-stream (name buffer host port) | 2176 | (defun erc-open-tls-stream (name buffer host port) |
| 2206 | "Open an TLS stream to an IRC server. | 2177 | "Open an TLS stream to an IRC server. |
| 2207 | The process will be given the name NAME, its target buffer will be | 2178 | The process will be given the name NAME, its target buffer will be |
| 2208 | BUFFER. HOST and PORT specify the connection target." | 2179 | BUFFER. HOST and PORT specify the connection target." |
| 2209 | (when (condition-case nil | 2180 | (open-network-stream name buffer host port |
| 2210 | (require 'tls) | 2181 | :type 'tls))) |
| 2211 | (error (message "You don't have tls.el. %s" | ||
| 2212 | "Try using `erc-ssl' instead.") | ||
| 2213 | nil)) | ||
| 2214 | (open-tls-stream name buffer host port))) | ||
| 2215 | 2182 | ||
| 2216 | ;;; Displaying error messages | 2183 | ;;; Displaying error messages |
| 2217 | 2184 | ||