summary refs log tree commit diff stats
path: root/lisp/acdw-circe.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/acdw-circe.el')
-rw-r--r--lisp/acdw-circe.el60
1 files changed, 60 insertions, 0 deletions
diff --git a/lisp/acdw-circe.el b/lisp/acdw-circe.el index 076bbc6..4ff3fdf 100644 --- a/lisp/acdw-circe.el +++ b/lisp/acdw-circe.el
@@ -7,9 +7,32 @@
7;;; Code: 7;;; Code:
8 8
9(require 'circe) 9(require 'circe)
10(require 'el-patch)
10 11
11;;; Functions 12;;; Functions
12 13
14(defun irc ()
15 "Connect to all IRC networks in `circe-network-options'."
16 (interactive)
17 (dolist (network (mapcar #'car circe-network-options))
18 (unless (member network circe-network-inhibit-autoconnect)
19 (circe-maybe-connect network))))
20
21(defun circe-network-connected-p (network)
22 "Return whether circe is connected to NETWORK."
23 (catch 'return
24 (dolist (buffer (circe-server-buffers))
25 (with-current-buffer buffer
26 (if (string= network circe-server-network)
27 (throw 'return t))))))
28
29(defun circe-maybe-connect (network)
30 "Connect to NETWORK, asking for confirmation to reconnect."
31 (interactive "sNetwork: ")
32 (if (or (not (circe-network-connected-p network))
33 (y-or-n-p (format "Already connected to %s, reconnect? " network)))
34 (circe network)))
35
13(defun circe-current-topic (&optional message) 36(defun circe-current-topic (&optional message)
14 "Return the topic of the current channel. 37 "Return the topic of the current channel.
15When called with MESSAGE set to non-nil (or interactively), also 38When called with MESSAGE set to non-nil (or interactively), also
@@ -93,6 +116,43 @@ message the current topic."
93 (message "%s: %s" buf circe-server-killed-confirmation) 116 (message "%s: %s" buf circe-server-killed-confirmation)
94 (kill-buffer))))) 117 (kill-buffer)))))
95 118
119;;; Patches
120
121(el-patch-feature circe)
122(with-eval-after-load 'circe
123 (defvar circe-server-buffer-action 'pop-to-buffer-same-window
124 "What to do with `circe-server' buffers when created.")
125
126 (el-patch-defun circe (network-or-server &rest server-options)
127 "Connect to IRC.
128
129Connect to the given network specified by NETWORK-OR-SERVER.
130
131When this function is called, it collects options from the
132SERVER-OPTIONS argument, the user variable
133`circe-network-options', and the defaults found in
134`circe-network-defaults', in this order.
135
136If NETWORK-OR-SERVER is not found in any of these variables, the
137argument is assumed to be the host name for the server, and all
138relevant settings must be passed via SERVER-OPTIONS.
139
140All SERVER-OPTIONS are treated as variables by getting the string
141\"circe-\" prepended to their name. This variable is then set
142locally in the server buffer.
143
144See `circe-network-options' for a list of common options."
145 (interactive (circe--read-network-and-options))
146 (let* ((options (circe--server-get-network-options network-or-server
147 server-options))
148 (buffer (circe--server-generate-buffer options)))
149 (with-current-buffer buffer
150 (circe-server-mode)
151 (circe--server-set-variables options)
152 (circe-reconnect))
153 (el-patch-swap (pop-to-buffer-same-window buffer)
154 (funcall circe-server-buffer-action buffer)))))
155
96;;; Dumb modes 156;;; Dumb modes
97 157
98(define-minor-mode circe-cappy-hour-mode 158(define-minor-mode circe-cappy-hour-mode