Add `irc' command

Might want to consider a different name, since `irc' is an alias to `rcirc'...
This commit is contained in:
Case Duckworth 2021-09-01 18:12:24 -05:00
parent 585b95ea00
commit 94e355ff10
1 changed files with 23 additions and 0 deletions

23
init.el
View File

@ -1089,6 +1089,29 @@ like a dumbass."
circe-reduce-lurker-spam t
circe-server-auto-join-default-type :after-auth)
(defun irc ()
"Connect to IRC."
(interactive)
(dolist (network (mapcar #'car circe-network-options))
(circe-maybe-connect network)))
(defun circe-network-connected-p (network)
"Return non-nil if there's any Circe server-buffer whose
`circe-server-netwok' is NETWORK."
(catch 'return
(dolist (buffer (circe-server-buffers))
(with-current-buffer buffer
(if (string= network circe-server-network)
(throw 'return t))))))
(defun circe-maybe-connect (network)
"Connect to NETWORK, but ask user for confirmation if it's
already been connected to."
(interactive "sNetwork: ")
(if (or (not (circe-network-connected-p network))
(y-or-n-p (format "Already connected to %s, reconnect?" network)))
(circe network)))
(add-hook 'circe-chat-mode-hook
(defun circe-chat@setup ()
(lui-set-prompt