all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Allow multiple rcirc connections to the same host
@ 2011-03-07 18:56 Andreas Rottmann
  0 siblings, 0 replies; only message in thread
From: Andreas Rottmann @ 2011-03-07 18:56 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

Hi!

The attached small patch allows the `rcirc' command to connect to the
same host multiple times when the port numbers differ.  This is
especially useful when using e.g. SSH forwarding to the IRC server, for
instance when connecting to an irssi proxy.

Also, it displays the port number on "Already connected", "Quit
connecting", and "Connecting to" messages.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rcirc-multiport.diff --]
[-- Type: text/x-diff, Size: 2203 bytes --]

From: Andreas Rottmann <a.rottmann@gmx.at>
Subject: Allow multiple rcirc connections to the same host

* lisp/net/rcirc.el (rcirc): When collecting the already-connected
  servers list, consider both hostname and port, instead of hostname
  only.  Also take the port into account on the messages displayed.
  (rcirc-connect): Include port number in "Connecting to" message.

---
 lisp/net/rcirc.el |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 41e0954..4a47104 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -458,20 +458,19 @@ If ARG is non-nil, instead prompt for connection parameters."
 	      (channels (plist-get (cdr c) :channels))
               (password (plist-get (cdr c) :password)))
 	  (when server
-	    (let (connected)
+	    (let ((contact (list server port))
+		  connected)
 	      (dolist (p (rcirc-process-list))
-		(when (string= server (process-name p))
+		(when (equal contact (process-contact p))
 		  (setq connected p)))
 	      (if (not connected)
 		  (condition-case e
 		      (rcirc-connect server port nick user-name
 				     full-name channels password)
-		    (quit (message "Quit connecting to %s" server)))
-		(with-current-buffer (process-buffer connected)
-		  (setq connected-servers
-			(cons (process-contact (get-buffer-process
-						(current-buffer)) :host)
-			      connected-servers))))))))
+		    (quit (message "Quit connecting to %s:%d" server port)))
+		(setq connected-servers
+		      (cons (format "%s:%d" (car contact) (cadr contact))
+			    connected-servers)))))))
       (when connected-servers
 	(message "Already connected to %s"
 		 (if (cdr connected-servers)
@@ -499,7 +498,7 @@ If ARG is non-nil, instead prompt for connection parameters."
 (defun rcirc-connect (server &optional port nick user-name
                              full-name startup-channels password)
   (save-excursion
-    (message "Connecting to %s..." server)
+    (message "Connecting to %s:%s..." server port)
     (let* ((inhibit-eol-conversion)
            (port-number (if port
 			    (if (stringp port)
-- 
tg: (7e78959..) t/rcirc-multiport (depends on: master)

[-- Attachment #3: Type: text/plain, Size: 63 bytes --]


Regards, Rotty
-- 
Andreas Rottmann -- <http://rotty.yi.org/>

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-07 18:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-07 18:56 [PATCH] Allow multiple rcirc connections to the same host Andreas Rottmann

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.