emacs-devel
[Top][All Lists]
Advanced

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

[PATCH] Allow multiple rcirc connections to the same host


From: Andreas Rottmann
Subject: [PATCH] Allow multiple rcirc connections to the same host
Date: Mon, 07 Mar 2011 19:56:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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.

From: Andreas Rottmann <address@hidden>
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)
Regards, Rotty
-- 
Andreas Rottmann -- <http://rotty.yi.org/>

reply via email to

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