all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dave Barker <kzar@kzar.co.uk>
To: Ryan Yeske <ryan@ryanyeske.com>
Cc: Leo Liu <sdl.web@gmail.com>,
	Artur Malabarba <bruce.connor.am@gmail.com>,
	emacs-devel@gnu.org
Subject: Re: PATCH: Add the ability to give rcirc servers an alias name
Date: Sun, 8 Nov 2015 19:01:45 +0000	[thread overview]
Message-ID: <CAH+bdfTBhDE170dnqYqfhA31nJ5_e3UNdxXiD60JSHLM3XGFvw@mail.gmail.com> (raw)
In-Reply-To: <1447008724.187480.432504041.0E012C01@webmail.messagingengine.com>


[-- Attachment #1.1: Type: text/plain, Size: 145 bytes --]

Here you go Ryan, it's attached.

Cheers, Dave.



On Sun, Nov 8, 2015 at 6:52 PM, Ryan Yeske <ryan@ryanyeske.com> wrote:

> Where is the patch?

[-- Attachment #1.2: Type: text/html, Size: 502 bytes --]

[-- Attachment #2: 0001-Add-ability-to-give-rcirc-servers-an-alias-name.patch --]
[-- Type: text/x-patch, Size: 5051 bytes --]

From 8e76f8dd43d137b23e3f43f61641ff26b45bb648 Mon Sep 17 00:00:00 2001
From: Dave Barker <kzar@kzar.co.uk>
Date: Sat, 7 Nov 2015 22:32:51 +0000
Subject: [PATCH] Add ability to give rcirc servers an alias name

---
 lisp/net/rcirc.el | 36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index d58f3eb..89a446f 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -103,7 +103,12 @@ connected to automatically.
 `:encryption'
 
 VALUE must be `plain' (the default) for unencrypted connections, or `tls'
-for connections using SSL/TLS."
+for connections using SSL/TLS.
+
+`:server-alias'
+
+VALUE must be a string that will be used instead of the server name for
+display purposes. If absent, the real server name will be displayed instead."
   :type '(alist :key-type string
 		:value-type (plist :options
                                    ((:nick string)
@@ -113,7 +118,8 @@ for connections using SSL/TLS."
                                     (:full-name string)
                                     (:channels (repeat string))
                                     (:encryption (choice (const tls)
-                                                         (const plain))))))
+                                                         (const plain)))
+                                    (:server-alias string))))
   :group 'rcirc)
 
 (defcustom rcirc-default-port 6667
@@ -484,22 +490,26 @@ If ARG is non-nil, instead prompt for connection parameters."
 	      (channels (plist-get (cdr c) :channels))
               (password (plist-get (cdr c) :password))
               (encryption (plist-get (cdr c) :encryption))
+              (server-alias (plist-get (cdr c) :server-alias))
               contact)
 	  (when server
 	    (let (connected)
 	      (dolist (p (rcirc-process-list))
-		(when (string= server (process-name p))
+		(when (string= (or server-alias server) (process-name p))
 		  (setq connected p)))
 	      (if (not connected)
 		  (condition-case nil
 		      (rcirc-connect server port nick user-name
-				     full-name channels password encryption)
-		    (quit (message "Quit connecting to %s" server)))
+                                     full-name channels password encryption
+                                     server-alias)
+		    (quit (message "Quit connecting to %s"
+                                   (or server-alias server))))
 		(with-current-buffer (process-buffer connected)
                   (setq contact (process-contact
-                                 (get-buffer-process (current-buffer)) :host))
+                                 (get-buffer-process (current-buffer)) :name))
                   (setq connected-servers
-                        (cons (if (stringp contact) contact server)
+                        (cons (if (stringp contact)
+                                  contact (or server-alias server))
                               connected-servers))))))))
       (when connected-servers
 	(message "Already connected to %s"
@@ -528,9 +538,10 @@ If ARG is non-nil, instead prompt for connection parameters."
 
 ;;;###autoload
 (defun rcirc-connect (server &optional port nick user-name
-                             full-name startup-channels password encryption)
+                             full-name startup-channels password encryption
+                             server-alias)
   (save-excursion
-    (message "Connecting to %s..." server)
+    (message "Connecting to %s..." (or server-alias server))
     (let* ((inhibit-eol-conversion)
            (port-number (if port
 			    (if (stringp port)
@@ -542,7 +553,7 @@ If ARG is non-nil, instead prompt for connection parameters."
 	   (full-name (or full-name rcirc-default-full-name))
 	   (startup-channels startup-channels)
            (process (open-network-stream
-                     server nil server port-number
+                     (or server-alias server) nil server port-number
                      :type (or encryption 'plain))))
       ;; set up process
       (set-process-coding-system process 'raw-text 'raw-text)
@@ -557,7 +568,8 @@ If ARG is non-nil, instead prompt for connection parameters."
 			password encryption))
       (setq-local rcirc-process process)
       (setq-local rcirc-server server)
-      (setq-local rcirc-server-name server) ; Update when we get 001 response.
+      (setq-local rcirc-server-name
+                  (or server-alias server)) ; Update when we get 001 response.
       (setq-local rcirc-buffer-alist nil)
       (setq-local rcirc-nick-table (make-hash-table :test 'equal))
       (setq-local rcirc-nick nick)
@@ -584,7 +596,7 @@ If ARG is non-nil, instead prompt for connection parameters."
 	(setq rcirc-keepalive-timer
 	      (run-at-time 0 (/ rcirc-timeout-seconds 2) 'rcirc-keepalive)))
 
-      (message "Connecting to %s...done" server)
+      (message "Connecting to %s...done" (or server-alias server))
 
       ;; return process object
       process)))
-- 
2.1.4


  reply	other threads:[~2015-11-08 19:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-07 23:00 PATCH: Add the ability to give rcirc servers an alias name Dave Barker
2015-11-08 17:45 ` Dave Barker
2015-11-08 19:22   ` Artur Malabarba
2015-11-08 18:52     ` Ryan Yeske
2015-11-08 19:01       ` Dave Barker [this message]
2015-11-18 11:20         ` Dave Barker
2015-12-13 18:23           ` Dave Barker
2015-12-16  6:16             ` Ryan Yeske
2015-12-16 12:29               ` Dave Barker
2015-12-17 18:40                 ` Ryan Yeske
2015-12-18 10:46                   ` Dave Barker
2015-12-18 13:34                     ` Artur Malabarba
2015-12-18 14:52                       ` Dave Barker
2016-01-03 23:11                         ` Artur Malabarba
2016-01-07 11:52                           ` Dave Barker
2016-01-07 16:12                             ` Eli Zaretskii
2016-01-07 19:23                               ` Artur Malabarba
2016-01-08  5:57                             ` Richard Stallman
2016-01-08 11:07                               ` Dave Barker
2016-01-09  3:23                                 ` Richard Stallman
2016-01-31 14:05                                   ` Dave Barker

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=CAH+bdfTBhDE170dnqYqfhA31nJ5_e3UNdxXiD60JSHLM3XGFvw@mail.gmail.com \
    --to=kzar@kzar.co.uk \
    --cc=bruce.connor.am@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=ryan@ryanyeske.com \
    --cc=sdl.web@gmail.com \
    /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.