changeset 106989:69a56b685af8

Fix erc reconnection via non-default connectors (Bug#4958). * erc-backend.el (erc-session-connector): New var. (erc-server-reconnect): Use it to reconnect via old connector (Bug#4958). * erc.el (erc-determine-parameters): Save erc-server-connect-function to erc-session-connector.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 25 Jan 2010 13:49:23 -0500
parents 05efa1881381
children 40a4dcd1833e 25a4d659d068
files lisp/erc/ChangeLog lisp/erc/erc-backend.el lisp/erc/erc.el
diffstat 3 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/erc/ChangeLog	Mon Jan 25 01:04:59 2010 -0800
+++ b/lisp/erc/ChangeLog	Mon Jan 25 13:49:23 2010 -0500
@@ -1,3 +1,12 @@
+2010-01-25  Vivek Dasmohapatra  <vivek@etla.org>
+
+	* erc-backend.el (erc-session-connector): New var.
+	(erc-server-reconnect): Use it to reconnect via old
+	connector (Bug#4958).
+
+	* erc.el (erc-determine-parameters): Save
+	erc-server-connect-function to erc-session-connector.
+
 2009-11-03  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* erc.el (erc-display-line-1, erc-process-away):
--- a/lisp/erc/erc-backend.el	Mon Jan 25 01:04:59 2010 -0800
+++ b/lisp/erc/erc-backend.el	Mon Jan 25 13:49:23 2010 -0500
@@ -130,6 +130,10 @@
   "The server name used to connect to for this session.")
 (make-variable-buffer-local 'erc-session-server)
 
+(defvar erc-session-connector nil
+  "The function used to connect to this session (nil for the default).")
+(make-variable-buffer-local 'erc-session-connector)
+
 (defvar erc-session-port nil
   "The port used to connect to.")
 (make-variable-buffer-local 'erc-session-port)
@@ -538,8 +542,10 @@
       (erc-set-active-buffer (current-buffer))
       (setq erc-server-last-sent-time 0)
       (setq erc-server-lines-sent 0)
-      (erc-open erc-session-server erc-session-port erc-server-current-nick
-                erc-session-user-full-name t erc-session-password))))
+      (let ((erc-server-connect-function (or erc-session-connector
+                                             'open-network-stream)))
+        (erc-open erc-session-server erc-session-port erc-server-current-nick
+                  erc-session-user-full-name t erc-session-password)))))
 
 (defun erc-server-filter-function (process string)
   "The process filter for the ERC server."
--- a/lisp/erc/erc.el	Mon Jan 25 01:04:59 2010 -0800
+++ b/lisp/erc/erc.el	Mon Jan 25 13:49:23 2010 -0500
@@ -5654,11 +5654,13 @@
   "Determine the connection and authentication parameters.
 Sets the buffer local variables:
 
+- `erc-session-connector'
 - `erc-session-server'
 - `erc-session-port'
 - `erc-session-full-name'
 - `erc-server-current-nick'"
-  (setq erc-session-server (erc-compute-server server)
+  (setq erc-session-connector erc-server-connect-function
+        erc-session-server (erc-compute-server server)
 	erc-session-port (or port erc-default-port)
 	erc-session-user-full-name (erc-compute-full-name name))
   (erc-set-current-nick (erc-compute-nick nick)))