doomemacs/modules/app/irc
Henrik Lissner 77e4cc4d58
💥 Remove :feature category
:feature was a "catch-all" category. Many of its modules fit better in
other categories, so they've been moved:

- feature/debugger -> tools/debugger
- feature/evil -> editor/evil
- feature/eval -> tools/eval
- feature/lookup -> tools/lookup
- feature/snippets -> editor/snippets
- feature/file-templates -> editor/file-templates
- feature/workspaces -> ui/workspaces

More potential changes in the future:

- A new :term category for terminal emulation modules (eshell, term and
  vterm).
- A new :os category for modules dedicated to os-specific functionality.
  The :tools macos module would fit here, but so would modules for nixos
  and arch.
- A new :services category for web-service integration, like wakatime,
  twitter, elfeed, gist and pastebin services.
2019-04-24 18:16:04 -04:00
..
autoload 💥 Remove :feature category 2019-04-24 18:16:04 -04:00
config.el feature/{syntax-checker,spellcheck} -> tools/fly{check,spell} 2019-02-22 00:25:30 -05:00
packages.el app/irc: initial commit 2017-06-11 15:55:22 +02:00
README.org Add port to circe network config 2019-02-20 13:14:14 +05:30

app/irc

Description

This module turns adds an IRC client to Emacs with OS notifications.

Module Flags

This module provides no flags.

Dependencies

This module requires gnutls-cli or openssl for secure connections.

Prerequisites

This module has no direct prerequisites.

Features

An IRC Client in Emacs

To connect to IRC you can invoke the =irc function using M-x or your own custom keybinding.

command description
=irc Connect to IRC and all configured servers

When in a circe buffer these keybindings will be available.

command key description
+irc/tracking-next-buffer SPC m a Switch to the next active buffer
circe-command-JOIN SPC m j Join a channel
+irc/send-message SPC m m Send a private message
circe-command-NAMES SPC m n List the names of the current channel
circe-command-PART SPC m p Part the current channel
+irc/quit SPC m Q Kill the current circe session and workgroup
circe-reconnect SPC m R Reconnect the current server

Configuration

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

(set-irc-server! "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.

set-irc-server! accepts a plist can use functions instead of strings. +pass-get-user and +pass-get-secret can help here:

(set-irc-server! "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-server! "chat.freenode.net"
  `(:tls t
    :port 6697
    :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!

Note that +pass-get-user tries to find your username by looking for the fields listed in +pass-user-fields (by default login, user=, username= and email)=). An example configuration looks like

mysecretpassword
username: myusername

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-server! "chat.freenode.net"
  '(:tls t
    :port 6697
    :nick "doom"
    :sasl-password my-nickserver-password
    :channels ("#emacs")))

TODO Troubleshooting