Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Auto-identify support for ERC and Bitlbee, using .authinfo keys
(defun keramida/erc-bitlbee-auto-identify ()
"Auto-identify for Bitlbee channels using authinfo or netrc.
The entries that we look for in netrc or authinfo files have
their 'port' set to 'bitlbee', their 'login' or 'user' set to the
current nickname and 'server' set to the current IRC server's
name. A sample value that works for authenticating as user
'keramida' on server 'localhost' is:
machine localhost login \"keramida\" password \"****\" port bitlbee"
(when (string= (buffer-name) "&bitlbee")
(let* ((secret (plist-get (nth 0 (auth-source-search :max 1
:host erc-server
:user (erc-current-nick)
:port "bitlbee"))
(password (if (functionp secret)
(funcall secret)
(message "Authenticating as user %s to Bitlbee" (erc-current-nick))
(erc-message "PRIVMSG" (concat (erc-default-target) " " "identify" " " password) nil)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment