all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jonathan Rockway <jon@jrock.us>
To: emacs-devel@gnu.org
Subject: [PATCH] rcirc - support servers that require a PASS command
Date: Sun, 15 Feb 2009 14:20:08 -0600	[thread overview]
Message-ID: <87y6w7cv0n.fsf@bar.jrock.us> (raw)

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


My irc proxy (irssi-proxy) wants a password before allowing connections,
so I added support for this to rcirc.  The patch is attached.


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

diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index f63237f..ec1d777 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -80,6 +80,11 @@ VALUE must be a number or string.  If absent,
 VALUE must be a string.  If absent, `rcirc-default-user-name' is
 used.
 
+`:password'
+
+VALUE must be a string.  If absent, no PASS command will be sent
+to the server.
+
 `:full-name'
 
 VALUE must be a string.  If absent, `rcirc-default-full-name' is
@@ -94,6 +99,7 @@ connected to automatically."
 		:value-type (plist :options ((:nick string)
 					     (:port integer)
 					     (:user-name string)
+					     (:password string)
 					     (:full-name string)
 					     (:channels (repeat string)))))
   :group 'rcirc)
@@ -380,6 +386,8 @@ If ARG is non-nil, instead prompt for connection parameters."
 	     (nick (read-string "IRC Nick: "
 				(or (plist-get server-plist 'nick)
 				    rcirc-default-nick)))
+             (password (read-passwd "IRC Password: "
+                                      (plist-get server-plist 'password)))
 	     (channels (split-string
 			(read-string "IRC Channels: "
 				     (mapconcat 'identity
@@ -387,9 +395,13 @@ If ARG is non-nil, instead prompt for connection parameters."
 							   'channels)
 						" "))
 			"[, ]+" t)))
+
+        (when (= 0 (length password))
+          (setq password nil))
+
 	(rcirc-connect server port nick rcirc-default-user-name
 		       rcirc-default-full-name
-		       channels))
+		       channels password))
     ;; connect to servers in `rcirc-server-alist'
     (let (connected-servers)
       (dolist (c rcirc-server-alist)
@@ -400,7 +412,8 @@ If ARG is non-nil, instead prompt for connection parameters."
 			     rcirc-default-user-name))
 	      (full-name (or (plist-get (cdr c) :full-name)
 			     rcirc-default-full-name))
-	      (channels (plist-get (cdr c) :channels)))
+	      (channels (plist-get (cdr c) :channels))
+              (password (plist-get (cdr c) :password)))
 	  (when server
 	    (let (connected)
 	      (dolist (p (rcirc-process-list))
@@ -409,7 +422,7 @@ If ARG is non-nil, instead prompt for connection parameters."
 	      (if (not connected)
 		  (condition-case e
 		      (rcirc-connect server port nick user-name
-				     full-name channels)
+				     full-name channels password)
 		    (quit (message "Quit connecting to %s" server)))
 		(with-current-buffer (process-buffer connected)
 		  (setq connected-servers
@@ -441,7 +454,7 @@ If ARG is non-nil, instead prompt for connection parameters."
 
 ;;;###autoload
 (defun rcirc-connect (server &optional port nick user-name full-name
-			     startup-channels)
+			     startup-channels password)
   (save-excursion
     (message "Connecting to %s..." server)
     (let* ((inhibit-eol-conversion)
@@ -490,6 +503,8 @@ If ARG is non-nil, instead prompt for connection parameters."
       (add-hook 'auto-save-hook 'rcirc-log-write)
 
       ;; identify
+      (when password
+        (rcirc-send-string process (concat "PASS " password)))
       (rcirc-send-string process (concat "NICK " nick))
       (rcirc-send-string process (concat "USER " user-name
                                       " hostname servername :"

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


Regards,
Jonathan Rockway

--
print just => another => perl => hacker => if $,=$"


             reply	other threads:[~2009-02-15 20:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-15 20:20 Jonathan Rockway [this message]
2010-06-07 21:22 ` [PATCH] rcirc - support servers that require a PASS command Stefan Monnier

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=87y6w7cv0n.fsf@bar.jrock.us \
    --to=jon@jrock.us \
    --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.