Hello everyone! I’m trying to set up ERC to automatically identify me with NickServ via authinfo (and pass), but this doesn’t work at all. I know I’ve got my authinfo and pass set up correctly because it does work for my mu4e setup. Currently the function I’m using to connect to libera.chat is as follows:
I’ve seen another thread here where this issue was solved by leaving out the port in the connection function. I’ve tried this as well, but it didn’t solve my issue. My password is stored in a file named libera.chat, with a line of it being username: kovariszt. Whenever I try to connect I get the following output in my *Messages* buffer:
Connecting to irc.libera.chat:6697...
Logging in as `kovariszt'...
Logging in without password
Logging in as ‘kovariszt’... done
Cannot find a password for nickname kovariszt
@zororg
I use pass (aka password-store) as my auth source, which is enabled by running (auth-source-pass-enable), so I don’t have an authinfo file at all. The format of that password is as described in my initial post. I think it’s correct though, since I also use this setup with my mu4e setup without any issues at all
(defun my-erc-join-libre-chat ()
"Connect to Libera Chat IRC server."
;; This gets my password, I'm using a .authinfo.gpg file, but a similar approach for GNU Pass should work.
(let ((credential (auth-source-pick-first-password :host "irc.libre.chat")))
(erc :server "irc.libera.chat"
:port 6667
:password credential
:nick "my-nick" ; replace with your nick as appropriate
:id "Libera.Chat")))
;; here is how I use the above:
(defun my-erc-join-libre-systemcrafters-live ()
"Connect to libera chat IRC channel for SystemCrafters-Live."
(interactive)
(my-erc-join-libre-chat)
(sleep-for 3) ; wait a bit before sending the following commands
(erc-cmd-JOIN "#systemcrafters-live")
;; wait until the systemcrafters-live channel buffer has been
;; created.
(while (= 0 (length (match-buffers "^#systemcrafters-live")))
(sleep-for 1))
(switch-to-buffer-other-window "#systemcrafters-live"))
As a follow-up, looking at the source, erc-nickserv-get-password attempts to call the function stored in erc-auth-source-services-function which (for me) is set to #'erc-auth-source-search and is called as:
;; NICK is a parameter to the function mentioned above.
(funcall erc-auth-source-services-function :user nick)
So, you may need to create a function for this purpose as I always get an error when trying to call the erc-auth-source-search function.
N.B. here is the error I see:
⛔ Error (erc): Problem querying ‘auth-source’: "Invalid password-store search: nil t". See (info "(erc) auth-source Troubleshooting") for more.
Thus I use the method in my first post to lookup the credential and then pass it along rather than trying to customize ERC to do it for me. Although, I have not read the troubleshooting guide mentioned in the error, which I might do and then I might try using customize to set things up as I’m in favor of doing that over writing code.
If you go with the approach I presented earlier, replace my call to auth-source-pick-first-password with something like this:
(auth-source-pass-get 'secret "irc.libera.chat") ; update as appropriate