diff --git a/init.el b/init.el index 06a2450..2f51ce8 100644 --- a/init.el +++ b/init.el @@ -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