doomemacs/modules/app/irc
Henrik Lissner d2d71795e5 Merge branch 'develop'
* develop: (64 commits)
  Prepare for v2.0.5
  Temporarily disable doom-themes-visual-bell-config
  Fix neotree always changing root
  Update changelog
  Fix wrong-type-argument error from +org/insert-item
  Make +ivy-buffer-transformer autoloadable
  General refactor & cleanup
  Correct troubleshooting link in README
  org: set org-ellipsis to downward chevron
  Add elfeed-(show|search)-mode to evil-snipe-disabled-modes
  Autoload json library
  Rethink smartparens config #181
  README: expand troubleshooting
  Fix wiki links in README (again)
  Correct intro in README
  Fix wiki links in README
  Prevent private commands from affecting projectile cache
  Remove recentf-filename-handlers fix for projectile-recentf-files
  lang/sh: remove unused setup.sh
  Convert +ivy/switch-buffer to transformers + add mode icons #169
  ...
2017-09-03 23:32:23 +02:00
..
autoload Add: app/irc: (=irc) if irc workspace exists switch to that 2017-08-06 17:01:32 +02:00
config.el Add: app/irc: make truncate nick character customizable 2017-08-06 17:01:30 +02:00
packages.el
README.org Standardize module READMEs 2017-08-21 20:13:31 +02:00

:app irc

This module turns adds an IRC client to Emacs (circe) with native notifications (circe-notifications).

Dependencies

This module has no dependencies, besides gnutls-cli or openssl for secure connections.

Configure

Use the :irc setting to configure IRC servers. Its second argument (a plist) takes the same arguments as circe-network-options.

(set! :irc "chat.freenode.net"
    `(:tls t
      :nick "doom"
      :sasl-username "myusername"
      :sasl-password "mypassword"
      :channels ("#emacs")))

It is a obviously a bad idea to store auth-details in plaintext, so here are some ways to avoid that:

Pass: the unix password manager

Pass is my tool of choice. I use it to manage my passwords. If you activate the :tools password-store module you get an elisp API through which to access your password store.

:irc's plist can use functions instead of strings. +pass-get-user and +pass-get-secret can help here:

(set! :irc "chat.freenode.net"
    `(:tls t
      :nick "doom"
      :sasl-username ,(+pass-get-user   "irc/freenode.net")
      :sasl-password ,(+pass-get-secret "irc/freenode.net")
      :channels ("#emacs")))

But wait, there's more! This stores your password in a public variable which could be accessed or appear in backtraces. Not good! So we go a step further:

(set! :irc "chat.freenode.net"
    `(:tls t
      :nick "doom"
      :sasl-username ,(+pass-get-user "irc/freenode.net")
      :sasl-password (lambda (&rest _) (+pass-get-secret "irc/freenode.net"))
      :channels ("#emacs")))

And you're good to go!

Emacs' auth-source API

auth-source is built into Emacs. As suggested in the circe wiki, you can store (and retrieve) encrypted passwords with it.

(setq auth-sources '("~/.authinfo.gpg"))

(defun my-fetch-password (&rest params)
  (require 'auth-source)
  (let ((match (car (apply #'auth-source-search params))))
    (if match
        (let ((secret (plist-get match :secret)))
          (if (functionp secret)
              (funcall secret)
            secret))
      (error "Password not found for %S" params))))

(defun my-nickserv-password (server)
  (my-fetch-password :user "forcer" :host "irc.freenode.net"))

(set! :irc "chat.freenode.net"
    '(:tls t
      :nick "doom"
      :sasl-password my-nickserver-password
      :channels ("#emacs")))