emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r99839: * lisp/net/rcirc.el: Add s


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r99839: * lisp/net/rcirc.el: Add support for password authentication.
Date: Mon, 07 Jun 2010 17:20:44 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99839
author: Jonathan Rockway <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: emacs-23
timestamp: Mon 2010-06-07 17:20:44 -0400
message:
  * lisp/net/rcirc.el: Add support for password authentication.
  (rcirc-server-alist): Add :password keyword.
  (rcirc): Ask for a password, or get it from the server's alist.
  (rcirc-connect): Add password argument.  Pass it to server.
modified:
  lisp/ChangeLog
  lisp/net/rcirc.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-06-05 20:36:27 +0000
+++ b/lisp/ChangeLog    2010-06-07 21:20:44 +0000
@@ -1,3 +1,10 @@
+2010-06-07  Jonathan Rockway  <address@hidden>
+
+       * net/rcirc.el: Add support for password authentication.
+       (rcirc-server-alist): Add :password keyword.
+       (rcirc): Ask for a password, or get it from the server's alist.
+       (rcirc-connect): Add password argument.  Pass it to server.
+
 2010-06-05  Juanma Barranquero  <address@hidden>
 
        * net/dbus.el (dbus-register-method): Declare function.

=== modified file 'lisp/net/rcirc.el'
--- a/lisp/net/rcirc.el 2010-01-13 08:35:10 +0000
+++ b/lisp/net/rcirc.el 2010-06-07 21:20:44 +0000
@@ -80,6 +80,11 @@
 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 @@
                :value-type (plist :options ((:nick string)
                                             (:port integer)
                                             (:user-name string)
+                                            (:password string)
                                             (:full-name string)
                                             (:channels (repeat string)))))
   :group 'rcirc)
@@ -393,6 +399,8 @@
                                (or (plist-get server-plist :nick)
                                    rcirc-default-nick)
                                'rcirc-nick-name-history))
+             (password (read-passwd "IRC Password: "
+                                    (plist-get server-plist 'password)))
             (channels (split-string
                        (read-string "IRC Channels: "
                                     (mapconcat 'identity
@@ -400,9 +408,13 @@
                                                           :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)
@@ -413,7 +425,8 @@
                             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))
@@ -422,7 +435,7 @@
              (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
@@ -454,7 +467,7 @@
 
 ;;;###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)
@@ -503,6 +516,8 @@
       (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 :"


reply via email to

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