bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: bug#8385: 24.0.50; rcirc auto-authentication slightly broken


From: Ted Zlatanov
Subject: Re: bug#8385: 24.0.50; rcirc auto-authentication slightly broken
Date: Tue, 05 Apr 2011 15:01:02 -0500
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux)

On Thu, 31 Mar 2011 18:59:12 +0200 Deniz Dogan <deniz.a.m.dogan@gmail.com> 
wrote: 

DD> Actually, my bad. Neale's patches have nothing to do with
DD> auth-source.el. I don't know much about auth-source.el but if you feel
DD> that it's easy to wire them together, feel free to write functionality
DD> for it!

Hmm, it looks like rcirc-authinfo is kind of orthogonal to the actual
server login parameters.  Maybe you want to add support for auth-info to
that, but I don't want to break it or change the design.  So let me know
if you want it.  You can also merge rcirc-authinfo with the line below,
e.g. an extra "bitlbee BB" parameter to provide the bitlbee auth
tokens...  Whatever makes sense.

The attached patch will make rcirc.el look at your `auth-sources', which
by default is the list "~/.authinfo.gpg" "~/.authinfo" "~/.netrc".

The file line would look like this (all except host are optional):

host H port P login NICK username "long name" password "my password" channels 
"one two three"

If you fail to connect, it will keep retrying with the same login info.
You probably want to fall back on prompting if that happens.

Also you can use the :create t parameter to request that the password,
port, etc. be created on a line.

Let me know if you want help implementing the connect fallback or the
token creation.  There are examples of both in lisp/gnus/nnimap.el.
It's fairly simple except for the creation prompts and default values.

Ted

=== modified file 'lisp/net/rcirc.el'
*** lisp/net/rcirc.el   2011-03-31 12:19:17 +0000
--- lisp/net/rcirc.el   2011-04-05 19:54:59 +0000
***************
*** 47,52 ****
--- 47,54 ----
  (require 'time-date)
  (eval-when-compile (require 'cl))
  
+ (autoload 'auth-source-search "auth-source")
+ 
  (defgroup rcirc nil
    "Simple IRC client."
    :version "22.1"
***************
*** 420,446 ****
                                      (caar rcirc-server-alist)
                                      'rcirc-server-name-history))
             (server-plist (cdr (assoc-string server rcirc-server-alist)))
!            (port (read-string "IRC Port: "
!                               (number-to-string
!                                (or (plist-get server-plist :port)
!                                    rcirc-default-port))
!                               'rcirc-server-port-history))
!            (nick (read-string "IRC Nick: "
!                               (or (plist-get server-plist :nick)
!                                   rcirc-default-nick)
!                               'rcirc-nick-name-history))
!            (user-name (read-string "IRC Username: "
!                                      (or (plist-get server-plist :user-name)
!                                          rcirc-default-user-name)
!                                      'rcirc-user-name-history))
!            (password (read-passwd "IRC Password: " nil
!                                     (plist-get server-plist :password)))
             (channels (split-string
!                       (read-string "IRC Channels: "
!                                    (mapconcat 'identity
!                                               (plist-get server-plist
!                                                          :channels)
!                                               " "))
                        "[, ]+" t)))
        (rcirc-connect server port nick user-name
                       rcirc-default-full-name
--- 422,456 ----
                                      (caar rcirc-server-alist)
                                      'rcirc-server-name-history))
             (server-plist (cdr (assoc-string server rcirc-server-alist)))
!              ;; TODO: could also use :create t to create the auth tokens
!              (server-auth (nth 0 (auth-source-search :max 1 :host server)))
!            (port (or (plist-get server-plist :port)
!                        (read-string "IRC Port: "
!                                     (number-to-string
!                                      (or (plist-get server-plist :port)
!                                          rcirc-default-port))
!                                     'rcirc-server-port-history)))
!            (nick (or (plist-get server-plist :login)
!                        (read-string "IRC Nick: "
!                                     (or (plist-get server-plist :nick)
!                                         rcirc-default-nick)
!                                     'rcirc-nick-name-history)))
!            (user-name (or (plist-get server-plist :username)
!                             (read-string "IRC Username: "
!                                          (or (plist-get server-plist 
:user-name)
!                                              rcirc-default-user-name)
!                                          'rcirc-user-name-history)))
!            (password (or (and (functionp (plist-get server-plist :secret))
!                                 (funcall (plist-get server-plist :secret)))
!                            (read-passwd "IRC Password: " nil
!                                         (plist-get server-plist :password))))
             (channels (split-string
!                         (or (plist-get server-plist :channels)
!                             (read-string "IRC Channels: "
!                                          (mapconcat 'identity
!                                                     (plist-get server-plist
!                                                                :channels)
!                                                     " ")))
                        "[, ]+" t)))
        (rcirc-connect server port nick user-name
                       rcirc-default-full-name


reply via email to

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