From: Andreas Rottmann <a.rottmann@gmx.at>
To: emacs-devel@gnu.org
Subject: [PATCH] Allow multiple rcirc connections to the same host
Date: Mon, 07 Mar 2011 19:56:50 +0100 [thread overview]
Message-ID: <87k4ga4v4d.fsf@gmx.at> (raw)
[-- 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/>
reply other threads:[~2011-03-07 18:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k4ga4v4d.fsf@gmx.at \
--to=a.rottmann@gmx.at \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.