Skip to content

Instantly share code, notes, and snippets.

@gkeramidas
Created January 26, 2015 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gkeramidas/c73405246eea374199f0 to your computer and use it in GitHub Desktop.
Save gkeramidas/c73405246eea374199f0 to your computer and use it in GitHub Desktop.
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"
(interactive)
(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"))
:secret))
(password (if (functionp secret)
(funcall secret)
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