[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r107832: Make erc use auth-source to
From: |
Lars Magne Ingebrigtsen |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r107832: Make erc use auth-source to look up channel keys |
Date: |
Tue, 10 Apr 2012 06:43:35 +0200 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 107832
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Tue 2012-04-10 06:43:35 +0200
message:
Make erc use auth-source to look up channel keys
* lisp/erc/erc-join.el (erc-server-join-channel): New function to look up
the channel password via auth-source.
(erc-autojoin-channels): Use it.
(erc-autojoin-after-ident): Ditto.
(erc-autojoin-channels-alist): Mention auth-source.
modified:
etc/NEWS
lisp/erc/ChangeLog
lisp/erc/erc-join.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2012-04-09 12:36:01 +0000
+++ b/etc/NEWS 2012-04-10 04:43:35 +0000
@@ -39,6 +39,10 @@
* Editing Changes in Emacs 24.2
* Changes in Specialized Modes and Packages in Emacs 24.2
+
+** erc will look up server/channel names via auth-source and use the
+ channel keys found, if any.
+
* New Modes and Packages in Emacs 24.2
=== modified file 'lisp/erc/ChangeLog'
--- a/lisp/erc/ChangeLog 2012-04-10 02:51:39 +0000
+++ b/lisp/erc/ChangeLog 2012-04-10 04:43:35 +0000
@@ -1,3 +1,11 @@
+2012-04-10 Lars Magne Ingebrigtsen <address@hidden>
+
+ * erc-join.el (erc-server-join-channel): New function to look up
+ the channel password via auth-source.
+ (erc-autojoin-channels): Use it.
+ (erc-autojoin-after-ident): Ditto.
+ (erc-autojoin-channels-alist): Mention auth-source.
+
2012-04-10 Deniz Dogan <address@hidden> (tiny change)
* erc.el (erc-display-prompt): Adds the field text property to the
=== modified file 'lisp/erc/erc-join.el'
--- a/lisp/erc/erc-join.el 2012-02-08 08:07:24 +0000
+++ b/lisp/erc/erc-join.el 2012-04-10 04:43:35 +0000
@@ -32,6 +32,7 @@
;;; Code:
(require 'erc)
+(require 'auth-source)
(eval-when-compile (require 'cl))
(defgroup erc-autojoin nil
@@ -56,6 +57,13 @@
SERVER is a regexp matching the server, and channels is the
list of channels to join.
+If the channel(s) require channel keys for joining, the passwords
+are found via auth-source. For instance, if you use ~/.authinfo
+as your auth-source backend, then put something like the
+following in that file:
+
+machine irc.example.net login \"#fsf\" password sEcReT
+
Customize this variable to set the value for your first connect.
Once you are connected and join and part channels, this alist
keeps track of what channels you are on, and will join them
@@ -131,7 +139,7 @@
(when (string-match (car l) server)
(dolist (chan (cdr l))
(unless (erc-member-ignore-case chan joined)
- (erc-server-send (concat "join " chan))))))))
+ (erc-server-join-channel server chan)))))))
nil)
(defun erc-autojoin-channels (server nick)
@@ -148,10 +156,25 @@
(dolist (l erc-autojoin-channels-alist)
(when (string-match (car l) server)
(dolist (chan (cdr l))
- (erc-server-send (concat "join " chan))))))
+ (erc-server-join-channel server chan)))))
;; Return nil to avoid stomping on any other hook funcs.
nil)
+(defun erc-server-join-channel (server channel)
+ (let* ((secret (plist-get (nth 0 (auth-source-search
+ :max 1
+ :host server
+ :port "irc"
+ :user channel))
+ :secret))
+ (password (if (functionp secret)
+ (funcall secret)
+ secret)))
+ (erc-server-send (concat "join " channel
+ (if password
+ (concat " " password)
+ "")))))
+
(defun erc-autojoin-add (proc parsed)
"Add the channel being joined to `erc-autojoin-channels-alist'."
(let* ((chnl (erc-response.contents parsed))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r107832: Make erc use auth-source to look up channel keys,
Lars Magne Ingebrigtsen <=