Created
January 26, 2015 04:08
-
-
Save gkeramidas/c73405246eea374199f0 to your computer and use it in GitHub Desktop.
Auto-identify support for ERC and Bitlbee, using .authinfo keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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