4.6 Using rcirc with bouncers

Some bouncers multiplex connections to various servers, but have to modify nicks and channel names to make this work. The channel #emacs on irc.libera.chat becomes #emacs/irc.libera.chat.

The options rcirc-nick-filter and rcirc-channel-filter can be used to make this feel more natural. When set to functions, these will be used to change how nicks and channel names are displayed. A simple configuration to fix the above example might be:

(defun my/rcirc-remove-suffix (STR)
  "Remove suffixes from STR."
  (save-match-data
    (if (string-match "/[[:alpha:]]+?\\'" str)
        (substring str 0 (match-beginning 0))
      str)))

(setopt rcirc-nick-filter #'my/rcirc-remove-suffix
        rcirc-channel-filter #'local/rcirc-soju-suffix)