aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii2006-02-08 17:39:10 +0000
committerEli Zaretskii2006-02-08 17:39:10 +0000
commitdb58efbf51c969dea052cb259ee0a01078e4db68 (patch)
tree0e22ca007bae13c9386668c75d3276cf6b4c42aa /lisp
parent063cd226b900cfcfcc98fd1d12ad1c0ad535f0c5 (diff)
downloademacs-db58efbf51c969dea052cb259ee0a01078e4db68.tar.gz
emacs-db58efbf51c969dea052cb259ee0a01078e4db68.zip
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
(rcirc-ignore-all-activity-flag): Remove variable. (rcirc-authinfo): New variable. (rcirc-authinfo-filename): Remove variable. (rcirc-always-use-server-buffer-flag): New flag. (rcirc): M-x rcirc will automatically connect without prompting. C-u M-x rcirc will prompt. Use rcirc-connect to create a connection in lisp. (rcirc-process-server-response-1): Remove everything but the nick portion of the sender so it doesn't need to be done everywhere else. Update related code. (global-map): Remove global keybindings. (rcirc-get-buffer-create): Make sure rcirc-topic is set. (rcirc-send-input): Split into several functions. (rcirc-process-input-line, rcirc-process-message, rcirc-process-command): New functions. (rcirc-target-buffer): Add function to determine where to route messages. (rcirc-user-nick): Save match data. (rcirc-toggle-ignore-buffer-activity) (rcirc-update-activity-string): Remove global ignore functionality, which can be done now by toggling rcirc-track-minor-mode. (rcirc-track-minor-mode-map): New keymap. (rcirc-track-minor-mode): New minor-mode. (ignore): Make the ignore output nicer. Always print it when adding or removing nicks. (rcirc-url-regexp): Improve. (rcirc-mangle-text): Remove properties before using text in the modeline. (rcirc-authenticate): Authentication data comes from rcirc-authinfo, not the file pointed to by rcirc-authinfo-file. (rcirc-server-prefix): Inherit from rcirc-server.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog37
-rw-r--r--lisp/net/rcirc.el522
2 files changed, 309 insertions, 250 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2dabb698218..c03d0171f06 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,40 @@
12006-02-08 Ryan Yeske <rcyeske@gmail.com>
2
3 * net/rcirc.el (rcirc-startup-channels-alist): Add
4 irc.freenode.net and #emacs as defaults.
5 (rcirc-ignore-all-activity-flag): Remove variable.
6 (rcirc-authinfo): New variable.
7 (rcirc-authinfo-filename): Remove variable.
8 (rcirc-always-use-server-buffer-flag): New flag.
9 (rcirc): M-x rcirc will automatically connect without prompting.
10 C-u M-x rcirc will prompt. Use rcirc-connect to create a
11 connection in lisp.
12 (rcirc-process-server-response-1): Remove everything but the nick
13 portion of the sender so it doesn't need to be done everywhere
14 else. Update related code.
15 (global-map): Remove global keybindings.
16 (rcirc-get-buffer-create): Make sure rcirc-topic is set.
17 (rcirc-send-input): Split into several functions.
18 (rcirc-process-input-line, rcirc-process-message)
19 (rcirc-process-command): New functions.
20 (rcirc-target-buffer): New function to determine where to route
21 messages.
22 (rcirc-user-nick): Save match data.
23 (rcirc-toggle-ignore-buffer-activity)
24 (rcirc-update-activity-string): Remove global ignore
25 functionality, which can be done now by toggling
26 rcirc-track-minor-mode.
27 (rcirc-track-minor-mode-map): New keymap.
28 (rcirc-track-minor-mode): New minor-mode.
29 (ignore): Make the ignore output nicer. Always print it when
30 adding or removing nicks.
31 (rcirc-url-regexp): Improve.
32 (rcirc-mangle-text): Remove properties before using text in the
33 modeline.
34 (rcirc-authenticate): Authentication data comes from
35 rcirc-authinfo, not the file pointed to by rcirc-authinfo-file.
36 (rcirc-server-prefix): Inherit from rcirc-server.
37
12006-02-08 Mathias Megyei <Mathias.Megyei@micronas.com> (tiny change) 382006-02-08 Mathias Megyei <Mathias.Megyei@micronas.com> (tiny change)
2 39
3 * Makefile.in (compile): Append "|| true" to the end of the `find' 40 * Makefile.in (compile): Append "|| true" to the end of the `find'
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index fc7399ee631..29beea21a89 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -79,7 +79,7 @@
79 :type 'string 79 :type 'string
80 :group 'rcirc) 80 :group 'rcirc)
81 81
82(defcustom rcirc-startup-channels-alist nil 82(defcustom rcirc-startup-channels-alist '(("^irc.freenode.net$" "#emacs"))
83 "Alist of channels to join at startup. 83 "Alist of channels to join at startup.
84Each element looks like (SERVER-REGEXP . CHANNEL-LIST)." 84Each element looks like (SERVER-REGEXP . CHANNEL-LIST)."
85 :type '(alist :key-type string :value-type (repeat string)) 85 :type '(alist :key-type string :value-type (repeat string))
@@ -111,11 +111,6 @@ underneath each nick."
111 "If non-nil, ignore activity in this buffer.") 111 "If non-nil, ignore activity in this buffer.")
112(make-variable-buffer-local 'rcirc-ignore-buffer-activity-flag) 112(make-variable-buffer-local 'rcirc-ignore-buffer-activity-flag)
113 113
114(defcustom rcirc-ignore-all-activity-flag nil
115 "*Non-nil means do not indicate any activity in the modeline."
116 :type 'boolean
117 :group 'rcirc)
118
119(defcustom rcirc-time-format "%H:%M " 114(defcustom rcirc-time-format "%H:%M "
120 "*Describes how timestamps are printed. 115 "*Describes how timestamps are printed.
121Used as the first arg to `format-time-string'." 116Used as the first arg to `format-time-string'."
@@ -140,29 +135,42 @@ number. If zero or nil, no truncating is done."
140 (integer :tag "Number of lines")) 135 (integer :tag "Number of lines"))
141 :group 'rcirc) 136 :group 'rcirc)
142 137
143(defcustom rcirc-authinfo-file-name 138(defcustom rcirc-authinfo nil
144 "~/.rcirc-authinfo" 139 "List of authentication passwords.
145 "File containing rcirc authentication passwords. 140Each element of the list is a list with a SERVER-REGEXP string
146The file consists of a single list, with each element itself a 141and a method symbol followed by method specific arguments.
147list with a SERVER-REGEXP string, a NICK-REGEXP string, a METHOD 142
148and the remaining method specific ARGUMENTS. The valid METHOD 143The valid METHOD symbols are `nickserv', `chanserv' and
149symbols are `nickserv', `chanserv' and `bitlbee'. 144`bitlbee'.
150 145
151The required ARGUMENTS for each METHOD symbol are: 146The required ARGUMENTS for each METHOD symbol are:
152 `nickserv': PASSWORD 147 `nickserv': NICK PASSWORD
153 `chanserv': CHANNEL PASSWORD 148 `chanserv': NICK CHANNEL PASSWORD
154 `bitlbee': PASSWORD 149 `bitlbee': NICK PASSWORD
155 150
156Example: 151Example:
157 ((\"freenode\" \"bob\" nickserv \"p455w0rd\") 152 ((\"freenode\" nickserv \"bob\" \"p455w0rd\")
158 (\"freenode\" \"bob\" chanserv \"#bobland\" \"passwd99\") 153 (\"freenode\" chanserv \"bob\" \"#bobland\" \"passwd99\")
159 (\"bitlbee\" \"robert\" bitlbee \"sekrit\"))" 154 (\"bitlbee\" bitlbee \"robert\" \"sekrit\"))"
160 :type 'string 155 :type '(alist :key-type (string :tag "Server")
156 :value-type (choice (list :tag "NickServ"
157 (const nickserv)
158 (string :tag "Nick")
159 (string :tag "Password"))
160 (list :tag "ChanServ"
161 (const chanserv)
162 (string :tag "Nick")
163 (string :tag "Channel")
164 (string :tag "Password"))
165 (list :tag "BitlBee"
166 (const bitlbee)
167 (string :tag "Nick")
168 (string :tag "Password"))))
161 :group 'rcirc) 169 :group 'rcirc)
162 170
163(defcustom rcirc-auto-authenticate-flag (file-readable-p rcirc-authinfo-file-name) 171(defcustom rcirc-auto-authenticate-flag t
164 "*Non-nil means automatically send authentication string to server. 172 "*Non-nil means automatically send authentication string to server.
165See also `rcirc-authinfo-file-name'." 173See also `rcirc-authinfo'."
166 :type 'boolean 174 :type 'boolean
167 :group 'rcirc) 175 :group 'rcirc)
168 176
@@ -199,6 +207,11 @@ Called with 5 arguments, PROCESS, SENDER, RESPONSE, TARGET and TEXT."
199 :type 'hook 207 :type 'hook
200 :group 'rcirc) 208 :group 'rcirc)
201 209
210(defcustom rcirc-always-use-server-buffer-flag nil
211 "Non-nil means messages without a channel target will go to the server buffer."
212 :type 'boolean
213 :group 'rcirc)
214
202(defvar rcirc-prompt-start-marker nil) 215(defvar rcirc-prompt-start-marker nil)
203(defvar rcirc-prompt-end-marker nil) 216(defvar rcirc-prompt-end-marker nil)
204 217
@@ -238,37 +251,35 @@ Called with 5 arguments, PROCESS, SENDER, RESPONSE, TARGET and TEXT."
238 251
239(defvar rcirc-startup-channels nil) 252(defvar rcirc-startup-channels nil)
240;;;###autoload 253;;;###autoload
241(defun rcirc (&optional server port nick channels) 254(defun rcirc (arg)
242 "Connect to IRC. 255 "Connect to IRC.
243 256If ARG is non-nil, prompt for a server to connect to."
244If any of the the optional SERVER, PORT, NICK or CHANNELS are not 257 (interactive "P")
245supplied, they are taken from the variables `rcirc-server', 258 (if arg
246`rcirc-port', `rcirc-nick', and `rcirc-startup-channels-alist', 259 (let* ((server (read-string "IRC Server: " rcirc-server))
247respectively." 260 (port (read-string "IRC Port: " (number-to-string rcirc-port)))
248 (interactive (list (read-string "IRC Server: " rcirc-server) 261 (nick (read-string "IRC Nick: " rcirc-nick))
249 (read-string "IRC Port: " (number-to-string rcirc-port)) 262 (channels (split-string
250 (read-string "IRC Nick: " rcirc-nick))) 263 (read-string "IRC Channels: "
251 (or server (setq server rcirc-server)) 264 (mapconcat 'identity
252 (or port (setq port rcirc-port)) 265 (rcirc-startup-channels server)
253 (or nick (setq nick rcirc-nick)) 266 " "))
254 (or channels 267 "[, ]+" t)))
255 (setq channels 268 (rcirc-connect server port nick rcirc-user-name rcirc-user-full-name
256 (if (interactive-p) 269 channels))
257 (split-string 270 ;; make new connection using defaults unless already connected to
258 (read-string "Channels: " 271 ;; the default rcirc-server
259 (mapconcat 'identity 272 (let ((default-server (default-value 'rcirc-server))
260 (rcirc-startup-channels server) 273 connected)
261 " ")) 274 (dolist (p (rcirc-process-list))
262 "[, ]+" t) 275 (when (string= default-server (process-name p))
263 (rcirc-startup-channels server)))) 276 (setq connected p)))
264 (or global-mode-string (setq global-mode-string '(""))) 277 (if (not connected)
265 (and (not (memq 'rcirc-activity-string global-mode-string)) 278 (rcirc-connect rcirc-server rcirc-port rcirc-nick
266 (setq global-mode-string 279 rcirc-user-name rcirc-user-full-name
267 (append global-mode-string '(rcirc-activity-string)))) 280 (rcirc-startup-channels rcirc-server))
268 (add-hook 'window-configuration-change-hook 281 (switch-to-buffer (process-buffer connected))
269 'rcirc-window-configuration-change) 282 (message "Connected to %s" rcirc-server)))))
270 (rcirc-connect server port nick rcirc-user-name rcirc-user-full-name
271 channels))
272 283
273;;;###autoload 284;;;###autoload
274(defalias 'irc 'rcirc) 285(defalias 'irc 'rcirc)
@@ -279,11 +290,9 @@ respectively."
279(defvar rcirc-keepalive-timer nil) 290(defvar rcirc-keepalive-timer nil)
280(defvar rcirc-last-server-message-time nil) 291(defvar rcirc-last-server-message-time nil)
281(defun rcirc-connect (server port nick user-name full-name startup-channels) 292(defun rcirc-connect (server port nick user-name full-name startup-channels)
282 "Return a connection to SERVER on PORT. 293 (add-hook 'window-configuration-change-hook
294 'rcirc-window-configuration-change)
283 295
284User will identify using the values of NICK, USER-NAME and
285FULL-NAME. The variable list of channel names in
286STARTUP-CHANNELS will automatically be joined on startup."
287 (save-excursion 296 (save-excursion
288 (message "Connecting to %s..." server) 297 (message "Connecting to %s..." server)
289 (let* ((inhibit-eol-conversion) 298 (let* ((inhibit-eol-conversion)
@@ -377,13 +386,13 @@ Functions are called with PROCESS and SENTINEL arguments.")
377 (rcirc-debug process (format "SENTINEL: %S %S\n" process sentinel)) 386 (rcirc-debug process (format "SENTINEL: %S %S\n" process sentinel))
378 (with-rcirc-process-buffer process 387 (with-rcirc-process-buffer process
379 (dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist))) 388 (dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist)))
380 (rcirc-print process "rcirc.el" "ERROR" buffer
381 (format "%s: %s (%S)"
382 (process-name process)
383 sentinel
384 (process-status process)) t)
385 ;; remove the prompt from buffers
386 (with-current-buffer (or buffer (current-buffer)) 389 (with-current-buffer (or buffer (current-buffer))
390 (rcirc-print process "rcirc.el" "ERROR" rcirc-target
391 (format "%s: %s (%S)"
392 (process-name process)
393 sentinel
394 (process-status process)) t)
395 ;; remove the prompt from buffers
387 (let ((inhibit-read-only t)) 396 (let ((inhibit-read-only t))
388 (delete-region rcirc-prompt-start-marker 397 (delete-region rcirc-prompt-start-marker
389 rcirc-prompt-end-marker))))) 398 rcirc-prompt-end-marker)))))
@@ -428,7 +437,8 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.")
428 437
429(defun rcirc-process-server-response-1 (process text) 438(defun rcirc-process-server-response-1 (process text)
430 (if (string-match "^\\(:\\([^ ]+\\) \\)?\\([^ ]+\\) \\(.+\\)$" text) 439 (if (string-match "^\\(:\\([^ ]+\\) \\)?\\([^ ]+\\) \\(.+\\)$" text)
431 (let* ((sender (match-string 2 text)) 440 (let* ((user (match-string 2 text))
441 (sender (rcirc-user-nick user))
432 (cmd (match-string 3 text)) 442 (cmd (match-string 3 text))
433 (args (match-string 4 text)) 443 (args (match-string 4 text))
434 (handler (intern-soft (concat "rcirc-handler-" cmd)))) 444 (handler (intern-soft (concat "rcirc-handler-" cmd))))
@@ -487,12 +497,10 @@ If NOTICEP is non-nil, send a notice instead of privmsg."
487 text)) 497 text))
488 (more (if oversize 498 (more (if oversize
489 (substring message rcirc-max-message-length)))) 499 (substring message rcirc-max-message-length))))
490 (rcirc-print process (rcirc-nick process) response 500 (rcirc-get-buffer-create process target)
491 (rcirc-get-buffer-create process target) 501 (rcirc-print process (rcirc-nick process) response target text)
492 text)
493 (rcirc-send-string process (concat response " " target " :" text)) 502 (rcirc-send-string process (concat response " " target " :" text))
494 (if more 503 (when more (rcirc-send-message process target more noticep))))
495 (rcirc-send-message process target more noticep))))
496 504
497(defvar rcirc-input-ring nil) 505(defvar rcirc-input-ring nil)
498(defvar rcirc-input-ring-index 0) 506(defvar rcirc-input-ring-index 0)
@@ -582,10 +590,6 @@ If buffer is nil, return the target of the current buffer."
582(define-key rcirc-mode-map (kbd "C-c C-s") 'rcirc-switch-to-server-buffer) 590(define-key rcirc-mode-map (kbd "C-c C-s") 'rcirc-switch-to-server-buffer)
583(define-key rcirc-mode-map (kbd "C-c C-a") 'rcirc-jump-to-first-unread-line) 591(define-key rcirc-mode-map (kbd "C-c C-a") 'rcirc-jump-to-first-unread-line)
584 592
585(define-key global-map (kbd "C-c `") 'rcirc-next-active-buffer)
586(define-key global-map (kbd "C-c C-@") 'rcirc-next-active-buffer)
587(define-key global-map (kbd "C-c C-SPC") 'rcirc-next-active-buffer)
588
589(defvar rcirc-browse-url-map (make-sparse-keymap) 593(defvar rcirc-browse-url-map (make-sparse-keymap)
590 "Keymap used for browsing URLs in `rcirc-mode'.") 594 "Keymap used for browsing URLs in `rcirc-mode'.")
591 595
@@ -730,8 +734,6 @@ This is used for the initial name given to IRC buffers."
730(defun rcirc-get-buffer (process target &optional server) 734(defun rcirc-get-buffer (process target &optional server)
731 "Return the buffer associated with the PROCESS and TARGET. 735 "Return the buffer associated with the PROCESS and TARGET.
732 736
733If TARGET is nil, return the server buffer.
734
735If optional argument SERVER is non-nil, return the server buffer 737If optional argument SERVER is non-nil, return the server buffer
736if there is no existing buffer for TARGET, otherwise return nil." 738if there is no existing buffer for TARGET, otherwise return nil."
737 (with-rcirc-process-buffer process 739 (with-rcirc-process-buffer process
@@ -744,7 +746,11 @@ if there is no existing buffer for TARGET, otherwise return nil."
744 "Return the buffer associated with the PROCESS and TARGET. 746 "Return the buffer associated with the PROCESS and TARGET.
745Create the buffer if it doesn't exist." 747Create the buffer if it doesn't exist."
746 (let ((buffer (rcirc-get-buffer process target))) 748 (let ((buffer (rcirc-get-buffer process target)))
747 (or buffer 749 (if buffer
750 (progn
751 (when (not rcirc-target)
752 (setq rcirc-target target))
753 buffer)
748 ;; create the buffer 754 ;; create the buffer
749 (with-rcirc-process-buffer process 755 (with-rcirc-process-buffer process
750 (let ((new-buffer (get-buffer-create 756 (let ((new-buffer (get-buffer-create
@@ -781,36 +787,45 @@ Create the buffer if it doesn't exist."
781 (delete-backward-char 1)) 787 (delete-backward-char 1))
782 (let ((input (buffer-substring-no-properties 788 (let ((input (buffer-substring-no-properties
783 rcirc-prompt-end-marker (point)))) 789 rcirc-prompt-end-marker (point))))
784 ;; process a /cmd 790 (dolist (line (split-string input "\n"))
785 (if (string-match "^/\\([^ ]+\\) ?\\(.*\\)$" input) 791 (rcirc-process-input-line rcirc-process target line))
786 (let* ((command (match-string 1 input))
787 (fun (intern-soft (concat "rcirc-cmd-" command)))
788 (args (match-string 2 input)))
789 (newline)
790 (with-current-buffer (current-buffer)
791 (delete-region rcirc-prompt-end-marker (point))
792 (if (string= command "me")
793 (rcirc-print rcirc-process (rcirc-nick rcirc-process)
794 "ACTION" (current-buffer) args)
795 (rcirc-print rcirc-process (rcirc-nick rcirc-process)
796 "COMMAND" (current-buffer) input))
797 (set-marker rcirc-prompt-end-marker (point))
798 (if (fboundp fun)
799 (funcall fun args rcirc-process target)
800 (rcirc-send-string rcirc-process
801 (concat command " " args)))))
802 ;; send message to server
803 (if (not rcirc-target)
804 (message "Not joined")
805 (delete-region rcirc-prompt-end-marker (point))
806 (mapc (lambda (message)
807 (rcirc-send-message rcirc-process target message))
808 (split-string input "\n"))))
809 ;; add to input-ring 792 ;; add to input-ring
810 (save-excursion 793 (save-excursion
811 (ring-insert rcirc-input-ring input) 794 (ring-insert rcirc-input-ring input)
812 (setq rcirc-input-ring-index 0))))))) 795 (setq rcirc-input-ring-index 0)))))))
813 796
797(defun rcirc-process-input-line (process target line)
798 (if (string-match "^/\\([^ ]+\\) ?\\(.*\\)$" line)
799 (rcirc-process-command (match-string 1 line)
800 (match-string 2 line)
801 line)
802 (rcirc-process-message line)))
803
804(defun rcirc-process-message (line)
805 (if (not rcirc-target)
806 (message "Not joined")
807 (delete-region rcirc-prompt-end-marker (point))
808 (rcirc-send-message rcirc-process rcirc-target line)))
809
810(defun rcirc-process-command (command args line)
811 (if (eq (aref command 0) ?/)
812 ;; "//text" will send "/text" as a message
813 (rcirc-process-message (substring line 1))
814 (let* ((fun (intern-soft (concat "rcirc-cmd-" command))))
815 (newline)
816 (with-current-buffer (current-buffer)
817 (delete-region rcirc-prompt-end-marker (point))
818 (if (string= command "me")
819 (rcirc-print rcirc-process (rcirc-nick rcirc-process)
820 "ACTION" rcirc-target args)
821 (rcirc-print rcirc-process (rcirc-nick rcirc-process)
822 "COMMAND" rcirc-target line))
823 (set-marker rcirc-prompt-end-marker (point))
824 (if (fboundp fun)
825 (funcall fun args rcirc-process rcirc-target)
826 (rcirc-send-string rcirc-process
827 (concat command " " args)))))))
828
814(defvar rcirc-parent-buffer nil) 829(defvar rcirc-parent-buffer nil)
815(defvar rcirc-window-configuration nil) 830(defvar rcirc-window-configuration nil)
816(defun rcirc-edit-multiline () 831(defun rcirc-edit-multiline ()
@@ -828,7 +843,8 @@ Create the buffer if it doesn't exist."
828 (setq rcirc-parent-buffer parent) 843 (setq rcirc-parent-buffer parent)
829 (setq rcirc-process process) 844 (setq rcirc-process process)
830 (insert text) 845 (insert text)
831 (and (> pos 0) (goto-char pos))))) 846 (and (> pos 0) (goto-char pos))
847 (message "Type C-c C-c to return text to %s, or C-c C-k to cancel" parent))))
832 848
833(define-derived-mode rcirc-multiline-edit-mode 849(define-derived-mode rcirc-multiline-edit-mode
834 text-mode "rcirc multi" 850 text-mode "rcirc multi"
@@ -894,13 +910,15 @@ Create the buffer if it doesn't exist."
894 (t 910 (t
895 (setq first "[" middle " " end "]"))) 911 (setq first "[" middle " " end "]")))
896 (concat first 912 (concat first
897 (rcirc-facify (rcirc-user-nick sender) 913 (rcirc-facify (concat
914 sender
915 (when target (concat "," target)))
898 (if (string= sender 916 (if (string= sender
899 (rcirc-nick process)) 917 (rcirc-nick process))
900 'rcirc-my-nick 918 'rcirc-my-nick
901 'rcirc-other-nick)) 919 'rcirc-other-nick))
902 middle 920 middle
903 (rcirc-mangle-text process text) 921 (rcirc-mangle-text process text)
904 end))) 922 end)))
905 ((string= response "COMMAND") 923 ((string= response "COMMAND")
906 text) 924 text)
@@ -914,31 +932,41 @@ Create the buffer if it doesn't exist."
914 (rcirc-facify 932 (rcirc-facify
915 (concat 933 (concat
916 (when (not (string= sender (rcirc-server process))) 934 (when (not (string= sender (rcirc-server process)))
917 (concat (rcirc-user-nick sender) " ")) 935 (concat sender " "))
918 (when (zerop (string-to-number response)) 936 (when (zerop (string-to-number response))
919 (concat response " ")) 937 (concat response " "))
920 text) 938 text)
921 'rcirc-server))))))) 939 'rcirc-server)))))))
922 940
941(defun rcirc-target-buffer (process sender response target text)
942 "Return a buffer to print the server response."
943 (assert (not (bufferp target)))
944 (with-rcirc-process-buffer process
945 (cond ((not target)
946 (if rcirc-always-use-server-buffer-flag
947 (process-buffer process)
948 (rcirc-get-any-buffer process)))
949 ((not (rcirc-channel-p target))
950 ;; message from another user
951 (if (string= response "PRIVMSG")
952 (rcirc-get-buffer-create process (if (string= sender rcirc-nick)
953 target
954 sender))
955 (rcirc-get-buffer process target t)))
956 ((or (rcirc-get-buffer process target)
957 (rcirc-get-any-buffer process))))))
958
923(defvar rcirc-activity-type nil) 959(defvar rcirc-activity-type nil)
924(make-variable-buffer-local 'rcirc-activity-type) 960(make-variable-buffer-local 'rcirc-activity-type)
925(defun rcirc-print (process sender response target text &optional activity) 961(defun rcirc-print (process sender response target text &optional activity)
926 "Print TEXT in the buffer associated with TARGET. 962 "Print TEXT in the buffer associated with TARGET.
927Format based on SENDER and RESPONSE. If ACTIVITY is non-nil, 963Format based on SENDER and RESPONSE. If ACTIVITY is non-nil,
928record activity." 964record activity."
929 (unless (or (member (rcirc-user-nick sender) rcirc-ignore-list) 965 (unless (or (member sender rcirc-ignore-list)
930 (member (with-syntax-table rcirc-nick-syntax-table 966 (member (with-syntax-table rcirc-nick-syntax-table
931 (when (string-match "^\\([^/]\\w*\\)[:,]" text) 967 (when (string-match "^\\([^/]\\w*\\)[:,]" text)
932 (match-string 1 text))) rcirc-ignore-list)) 968 (match-string 1 text))) rcirc-ignore-list))
933 (let* ((buffer (cond ((bufferp target) 969 (let* ((buffer (rcirc-target-buffer process sender response target text))
934 target)
935 ((not target)
936 (rcirc-get-any-buffer process))
937 ((not (rcirc-channel-p target))
938 (rcirc-get-buffer-create process
939 (rcirc-user-nick sender)))
940 ((or (rcirc-get-buffer process target)
941 (rcirc-get-any-buffer process)))))
942 (inhibit-read-only t)) 970 (inhibit-read-only t))
943 (with-current-buffer buffer 971 (with-current-buffer buffer
944 (let ((moving (= (point) rcirc-prompt-end-marker)) 972 (let ((moving (= (point) rcirc-prompt-end-marker))
@@ -961,7 +989,7 @@ record activity."
961 (set-marker-insertion-type rcirc-prompt-start-marker t) 989 (set-marker-insertion-type rcirc-prompt-start-marker t)
962 (set-marker-insertion-type rcirc-prompt-end-marker t) 990 (set-marker-insertion-type rcirc-prompt-end-marker t)
963 (insert 991 (insert
964 (rcirc-format-response-string process sender response target text) 992 (rcirc-format-response-string process sender response nil text)
965 (propertize "\n" 'hard t)) 993 (propertize "\n" 'hard t))
966 (set-marker-insertion-type rcirc-prompt-start-marker nil) 994 (set-marker-insertion-type rcirc-prompt-start-marker nil)
967 (set-marker-insertion-type rcirc-prompt-end-marker nil) 995 (set-marker-insertion-type rcirc-prompt-end-marker nil)
@@ -978,10 +1006,10 @@ record activity."
978 0) 1006 0)
979 (cond ((or (string= response "PRIVMSG") 1007 (cond ((or (string= response "PRIVMSG")
980 (string= response "NOTICE")) 1008 (string= response "NOTICE"))
981 (+ (length (rcirc-user-nick sender)) 1009 (+ (length sender)
982 2)) ; <> 1010 2)) ; <>
983 ((string= response "ACTION") 1011 ((string= response "ACTION")
984 (+ (length (rcirc-user-nick sender)) 1012 (+ (length sender)
985 1)) ; [ 1013 1)) ; [
986 (t 3)) ; *** 1014 (t 3)) ; ***
987 1) 1015 1)
@@ -1056,17 +1084,17 @@ record activity."
1056(defun rcirc-join-channels (process channels) 1084(defun rcirc-join-channels (process channels)
1057 "Join CHANNELS." 1085 "Join CHANNELS."
1058 (save-window-excursion 1086 (save-window-excursion
1059 (mapc (lambda (channel) 1087 (dolist (channel channels)
1060 (with-rcirc-process-buffer process 1088 (with-rcirc-process-buffer process
1061 (rcirc-cmd-join channel process))) 1089 (rcirc-cmd-join channel process)))))
1062 channels)))
1063 1090
1064;;; nick management 1091;;; nick management
1065(defun rcirc-user-nick (user) 1092(defun rcirc-user-nick (user)
1066 "Return the nick from USER. Remove any non-nick junk." 1093 "Return the nick from USER. Remove any non-nick junk."
1067 (if (string-match "^[@%+]?\\([^! ]+\\)!?" (or user "")) 1094 (save-match-data
1068 (match-string 1 user) 1095 (if (string-match "^[@%+]?\\([^! ]+\\)!?" (or user ""))
1069 user)) 1096 (match-string 1 user)
1097 user)))
1070 1098
1071(defun rcirc-user-non-nick (user) 1099(defun rcirc-user-non-nick (user)
1072 "Return the non-nick portion of USER." 1100 "Return the non-nick portion of USER."
@@ -1076,17 +1104,15 @@ record activity."
1076 1104
1077(defun rcirc-nick-channels (process nick) 1105(defun rcirc-nick-channels (process nick)
1078 "Return list of channels for NICK." 1106 "Return list of channels for NICK."
1079 (let ((nick (rcirc-user-nick nick))) 1107 (with-rcirc-process-buffer process
1080 (with-rcirc-process-buffer process 1108 (mapcar (lambda (x) (car x))
1081 (mapcar (lambda (x) (car x)) 1109 (gethash nick rcirc-nick-table))))
1082 (gethash nick rcirc-nick-table)))))
1083 1110
1084(defun rcirc-put-nick-channel (process nick channel) 1111(defun rcirc-put-nick-channel (process nick channel)
1085 "Add CHANNEL to list associated with NICK." 1112 "Add CHANNEL to list associated with NICK."
1086 (with-rcirc-process-buffer process 1113 (with-rcirc-process-buffer process
1087 (let* ((nick (rcirc-user-nick nick)) 1114 (let* ((chans (gethash nick rcirc-nick-table))
1088 (chans (gethash nick rcirc-nick-table)) 1115 (record (assoc-string channel chans t)))
1089 (record (assoc-string channel chans t)))
1090 (if record 1116 (if record
1091 (setcdr record (current-time)) 1117 (setcdr record (current-time))
1092 (puthash nick (cons (cons channel (current-time)) 1118 (puthash nick (cons (cons channel (current-time))
@@ -1101,8 +1127,7 @@ record activity."
1101(defun rcirc-remove-nick-channel (process nick channel) 1127(defun rcirc-remove-nick-channel (process nick channel)
1102 "Remove the CHANNEL from list associated with NICK." 1128 "Remove the CHANNEL from list associated with NICK."
1103 (with-rcirc-process-buffer process 1129 (with-rcirc-process-buffer process
1104 (let* ((nick (rcirc-user-nick nick)) 1130 (let* ((chans (gethash nick rcirc-nick-table))
1105 (chans (gethash nick rcirc-nick-table))
1106 (newchans 1131 (newchans
1107 ;; instead of assoc-string-delete-all: 1132 ;; instead of assoc-string-delete-all:
1108 (let ((record (assoc-string channel chans t))) 1133 (let ((record (assoc-string channel chans t)))
@@ -1136,28 +1161,44 @@ if NICK is also on `rcirc-ignore-list-automatic'."
1136 (delete nick rcirc-ignore-list)))) 1161 (delete nick rcirc-ignore-list))))
1137 1162
1138;;; activity tracking 1163;;; activity tracking
1164(defvar rcirc-track-minor-mode-map (make-sparse-keymap)
1165 "Keymap for rcirc track minor mode.")
1166
1167(define-key rcirc-track-minor-mode-map (kbd "C-c `") 'rcirc-next-active-buffer)
1168(define-key rcirc-track-minor-mode-map (kbd "C-c C-@") 'rcirc-next-active-buffer)
1169(define-key rcirc-track-minor-mode-map (kbd "C-c C-SPC") 'rcirc-next-active-buffer)
1170
1171;;; FIXME: the code to insert `rcirc-activity-string' into
1172;;; `global-mode-string' isn't called when the mode is activated by
1173;;; customize. I don't know how to set that up.
1174(define-minor-mode rcirc-track-minor-mode
1175 "Global minor mode for tracking activity in rcirc buffers."
1176 :init-value nil
1177 :lighter ""
1178 :keymap rcirc-track-minor-mode-map
1179 :global t
1180 :group 'rcirc
1181 (or global-mode-string (setq global-mode-string '("")))
1182 ;; toggle the mode-line channel indicator
1183 (if rcirc-track-minor-mode
1184 (and (not (memq 'rcirc-activity-string global-mode-string))
1185 (setq global-mode-string
1186 (append global-mode-string '(rcirc-activity-string))))
1187 (setq global-mode-string
1188 (delete 'rcirc-activity-string global-mode-string))))
1189
1139(or (assq 'rcirc-ignore-buffer-activity-flag minor-mode-alist) 1190(or (assq 'rcirc-ignore-buffer-activity-flag minor-mode-alist)
1140 (setq minor-mode-alist 1191 (setq minor-mode-alist
1141 (cons '(rcirc-ignore-buffer-activity-flag " Ignore") minor-mode-alist))) 1192 (cons '(rcirc-ignore-buffer-activity-flag " Ignore") minor-mode-alist)))
1142 1193
1143(defun rcirc-toggle-ignore-buffer-activity (&optional all) 1194(defun rcirc-toggle-ignore-buffer-activity ()
1144 "Toggle the value of `rcirc-ignore-buffer-activity-flag'. 1195 "Toggle the value of `rcirc-ignore-buffer-activity-flag'."
1145If ALL is non-nil, instead toggle the value of 1196 (interactive)
1146`rcirc-ignore-all-activity-flag'." 1197 (setq rcirc-ignore-buffer-activity-flag
1147 (interactive "P") 1198 (not rcirc-ignore-buffer-activity-flag))
1148 (if all 1199 (message (if rcirc-ignore-buffer-activity-flag
1149 (progn 1200 "Ignore activity in this buffer"
1150 (setq rcirc-ignore-all-activity-flag 1201 "Notice activity in this buffer"))
1151 (not rcirc-ignore-all-activity-flag))
1152 (message (if rcirc-ignore-all-activity-flag
1153 "Hide all buffer activity"
1154 "Display buffer activity"))
1155 (rcirc-update-activity-string))
1156 (setq rcirc-ignore-buffer-activity-flag
1157 (not rcirc-ignore-buffer-activity-flag))
1158 (message (if rcirc-ignore-buffer-activity-flag
1159 "Ignore activity in this buffer"
1160 "Notice activity in this buffer")))
1161 (force-mode-line-update)) 1202 (force-mode-line-update))
1162 1203
1163(defvar rcirc-switch-to-buffer-function 'switch-to-buffer 1204(defvar rcirc-switch-to-buffer-function 'switch-to-buffer
@@ -1229,21 +1270,18 @@ activity. Only run if the buffer is not visible and
1229(defun rcirc-update-activity-string () 1270(defun rcirc-update-activity-string ()
1230 "Update mode-line string." 1271 "Update mode-line string."
1231 (setq rcirc-activity-string 1272 (setq rcirc-activity-string
1232 (cond (rcirc-ignore-all-activity-flag 1273 (if (not rcirc-activity)
1233 " DND") 1274 ""
1234 ((not rcirc-activity) 1275 (concat " ["
1235 "") 1276 (mapconcat
1236 (t 1277 (lambda (b)
1237 (concat " [" 1278 (let ((s (rcirc-short-buffer-name b)))
1238 (mapconcat 1279 (with-current-buffer b
1239 (lambda (b) 1280 (if (not (eq rcirc-activity-type 'nick))
1240 (let ((s (rcirc-short-buffer-name b))) 1281 s
1241 (with-current-buffer b 1282 (rcirc-facify s 'rcirc-mode-line-nick)))))
1242 (if (not (eq rcirc-activity-type 'nick)) 1283 rcirc-activity ",")
1243 s 1284 "]"))))
1244 (rcirc-facify s 'rcirc-mode-line-nick)))))
1245 rcirc-activity ",")
1246 "]")))))
1247 1285
1248(defun rcirc-short-buffer-name (buffer) 1286(defun rcirc-short-buffer-name (buffer)
1249 "Return a short name for BUFFER to use in the modeline indicator." 1287 "Return a short name for BUFFER to use in the modeline indicator."
@@ -1488,23 +1526,22 @@ Ignore NICK, unignore NICK if already ignored, or list ignored
1488nicks when no NICK is given. When listing ignored nicks, the 1526nicks when no NICK is given. When listing ignored nicks, the
1489ones added to the list automatically are marked with an asterisk." 1527ones added to the list automatically are marked with an asterisk."
1490 (interactive "sToggle ignoring of nick: ") 1528 (interactive "sToggle ignoring of nick: ")
1491 (if (string= "" nick) 1529 (when (not (string= "" nick))
1492 (rcirc-print process (rcirc-nick process) "NOTICE" target
1493 (mapconcat
1494 (lambda (nick)
1495 (concat nick
1496 (if (member nick rcirc-ignore-list-automatic)
1497 "*" "")))
1498 rcirc-ignore-list " "))
1499 (if (member nick rcirc-ignore-list) 1530 (if (member nick rcirc-ignore-list)
1500 (setq rcirc-ignore-list (delete nick rcirc-ignore-list)) 1531 (setq rcirc-ignore-list (delete nick rcirc-ignore-list))
1501 (setq rcirc-ignore-list (cons nick rcirc-ignore-list))))) 1532 (setq rcirc-ignore-list (cons nick rcirc-ignore-list))))
1502 1533 (rcirc-print process (rcirc-nick process) "IGNORE" target
1534 (mapconcat
1535 (lambda (nick)
1536 (concat nick
1537 (if (member nick rcirc-ignore-list-automatic)
1538 "*" "")))
1539 rcirc-ignore-list " ")))
1503 1540
1504 1541
1505(defun rcirc-message-leader (sender face) 1542(defun rcirc-message-leader (sender face)
1506 "Return a string with SENDER propertized with FACE." 1543 "Return a string with SENDER propertized with FACE."
1507 (rcirc-facify (concat "<" (rcirc-user-nick sender) "> ") face)) 1544 (rcirc-facify (concat "<" sender "> ") face))
1508 1545
1509(defun rcirc-facify (string face) 1546(defun rcirc-facify (string face)
1510 "Return a copy of STRING with FACE property added." 1547 "Return a copy of STRING with FACE property added."
@@ -1518,8 +1555,8 @@ ones added to the list automatically are marked with an asterisk."
1518 "://" 1555 "://"
1519 (1+ (char "a-zA-Z0-9_.")) 1556 (1+ (char "a-zA-Z0-9_."))
1520 (optional ":" (1+ (char "0-9"))))) 1557 (optional ":" (1+ (char "0-9")))))
1521 (1+ (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;.,")) 1558 (1+ (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;.,{}[]"))
1522 (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;")) 1559 (char "-a-zA-Z0-9_=#$\@~`%&*+|\\/:;{}[]"))
1523 "Regexp matching URLs. Set to nil to disable URL features in rcirc.") 1560 "Regexp matching URLs. Set to nil to disable URL features in rcirc.")
1524 1561
1525(defun rcirc-browse-url (&optional arg) 1562(defun rcirc-browse-url (&optional arg)
@@ -1603,7 +1640,7 @@ FUNCTION takes 3 arguments, MATCH-START, MATCH-END, and STRING."
1603 'mouse-face 'highlight 1640 'mouse-face 'highlight
1604 'keymap rcirc-browse-url-map) 1641 'keymap rcirc-browse-url-map)
1605 string)) 1642 string))
1606 (push (substring string start end) rcirc-urls)) 1643 (push (substring-no-properties string start end) rcirc-urls))
1607 rcirc-url-regexp 1644 rcirc-url-regexp
1608 text)) 1645 text))
1609 text) 1646 text)
@@ -1627,7 +1664,7 @@ FUNCTION takes 3 arguments, MATCH-START, MATCH-END, and STRING."
1627(defun rcirc-handler-PRIVMSG (process sender args text) 1664(defun rcirc-handler-PRIVMSG (process sender args text)
1628 (let ((target (if (rcirc-channel-p (car args)) 1665 (let ((target (if (rcirc-channel-p (car args))
1629 (car args) 1666 (car args)
1630 (rcirc-user-nick sender))) 1667 sender))
1631 (message (or (cadr args) ""))) 1668 (message (or (cadr args) "")))
1632 (if (string-match "^\C-a\\(.*\\)\C-a$" message) 1669 (if (string-match "^\C-a\\(.*\\)\C-a$" message)
1633 (rcirc-handler-CTCP process target sender (match-string 1 message)) 1670 (rcirc-handler-CTCP process target sender (match-string 1 message))
@@ -1650,25 +1687,21 @@ FUNCTION takes 3 arguments, MATCH-START, MATCH-END, and STRING."
1650 (match-string 1 message)) 1687 (match-string 1 message))
1651 (sender 1688 (sender
1652 (if (string= sender (rcirc-server process)) 1689 (if (string= sender (rcirc-server process))
1653 (process-buffer process) 1690 nil ; server notice
1654 (rcirc-user-nick sender)))) 1691 sender)))
1655 message t)))) 1692 message t))))
1656 ;; do we need this:
1657 ;;(and sender (rcirc-put-nick-channel process sender target))))
1658 1693
1659(defun rcirc-handler-WALLOPS (process sender args text) 1694(defun rcirc-handler-WALLOPS (process sender args text)
1660 (let ((target (rcirc-user-nick sender))) 1695 (rcirc-print process sender "WALLOPS" sender (car args) t))
1661 (rcirc-print process sender "WALLOPS" target (car args) t)))
1662 1696
1663(defun rcirc-handler-JOIN (process sender args text) 1697(defun rcirc-handler-JOIN (process sender args text)
1664 (let ((channel (car args)) 1698 (let ((channel (car args)))
1665 (nick (rcirc-user-nick sender)))
1666 (rcirc-get-buffer-create process channel) 1699 (rcirc-get-buffer-create process channel)
1667 (rcirc-print process sender "JOIN" channel "") 1700 (rcirc-print process sender "JOIN" channel "")
1668 1701
1669 ;; print in private chat buffer if it exists 1702 ;; print in private chat buffer if it exists
1670 (when (rcirc-get-buffer rcirc-process nick) 1703 (when (rcirc-get-buffer rcirc-process sender)
1671 (rcirc-print process sender "JOIN" nick channel)) 1704 (rcirc-print process sender "JOIN" sender channel))
1672 1705
1673 (rcirc-put-nick-channel process sender channel))) 1706 (rcirc-put-nick-channel process sender channel)))
1674 1707
@@ -1695,9 +1728,9 @@ FUNCTION takes 3 arguments, MATCH-START, MATCH-END, and STRING."
1695 (setq rcirc-target nil)))))) 1728 (setq rcirc-target nil))))))
1696 1729
1697(defun rcirc-handler-PART (process sender args text) 1730(defun rcirc-handler-PART (process sender args text)
1698 (rcirc-ignore-update-automatic (rcirc-user-nick sender)) 1731 (rcirc-ignore-update-automatic sender)
1699 (rcirc-handler-PART-or-KICK process "PART" 1732 (rcirc-handler-PART-or-KICK process "PART"
1700 (car args) sender (rcirc-user-nick sender) 1733 (car args) sender sender
1701 (cadr args))) 1734 (cadr args)))
1702 1735
1703(defun rcirc-handler-KICK (process sender args text) 1736(defun rcirc-handler-KICK (process sender args text)
@@ -1705,21 +1738,19 @@ FUNCTION takes 3 arguments, MATCH-START, MATCH-END, and STRING."
1705 (caddr args))) 1738 (caddr args)))
1706 1739
1707(defun rcirc-handler-QUIT (process sender args text) 1740(defun rcirc-handler-QUIT (process sender args text)
1708 (rcirc-ignore-update-automatic (rcirc-user-nick sender)) 1741 (rcirc-ignore-update-automatic sender)
1709 (let ((nick (rcirc-user-nick sender))) 1742 (mapc (lambda (channel)
1710 (mapc (lambda (channel) 1743 (rcirc-print process sender "QUIT" channel (apply 'concat args)))
1711 (rcirc-print process sender "QUIT" channel (apply 'concat args))) 1744 (rcirc-nick-channels process sender))
1712 (rcirc-nick-channels process nick))
1713 1745
1714 ;; print in private chat buffer if it exists 1746 ;; print in private chat buffer if it exists
1715 (let ((buffer (rcirc-get-buffer rcirc-process nick))) 1747 (when (rcirc-get-buffer rcirc-process sender)
1716 (when buffer 1748 (rcirc-print process sender "QUIT" sender (apply 'concat args)))
1717 (rcirc-print process sender "QUIT" buffer (apply 'concat args))))
1718 1749
1719 (rcirc-nick-remove process nick))) 1750 (rcirc-nick-remove process sender))
1720 1751
1721(defun rcirc-handler-NICK (process sender args text) 1752(defun rcirc-handler-NICK (process sender args text)
1722 (let* ((old-nick (rcirc-user-nick sender)) 1753 (let* ((old-nick sender)
1723 (new-nick (car args)) 1754 (new-nick (car args))
1724 (channels (rcirc-nick-channels process old-nick))) 1755 (channels (rcirc-nick-channels process old-nick)))
1725 ;; update list of ignored nicks 1756 ;; update list of ignored nicks
@@ -1796,9 +1827,8 @@ FUNCTION takes 3 arguments, MATCH-START, MATCH-END, and STRING."
1796 1827
1797 ;; print in private chat buffers if they exist 1828 ;; print in private chat buffers if they exist
1798 (mapc (lambda (nick) 1829 (mapc (lambda (nick)
1799 (let ((existing-buffer (rcirc-get-buffer process nick))) 1830 (when (rcirc-get-buffer process nick)
1800 (when existing-buffer 1831 (rcirc-print process sender "MODE" nick msg)))
1801 (rcirc-print process sender "MODE" existing-buffer msg))))
1802 (cddr args)))) 1832 (cddr args))))
1803 1833
1804(defun rcirc-get-temp-buffer-create (process channel) 1834(defun rcirc-get-temp-buffer-create (process channel)
@@ -1834,40 +1864,35 @@ FUNCTION takes 3 arguments, MATCH-START, MATCH-END, and STRING."
1834 1864
1835(defun rcirc-authenticate () 1865(defun rcirc-authenticate ()
1836 "Send authentication to process associated with current buffer. 1866 "Send authentication to process associated with current buffer.
1837Passwords are read from `rcirc-authinfo-file-name' (which see)." 1867Passwords are stored in `rcirc-authinfo' (which see)."
1838 (interactive) 1868 (interactive)
1839 (let ((password-alist 1869 (with-rcirc-process-buffer rcirc-process
1840 (with-temp-buffer 1870 (dolist (i rcirc-authinfo)
1841 (insert-file-contents-literally rcirc-authinfo-file-name) 1871 (let ((server (car i))
1842 (goto-char (point-min)) 1872 (nick (caddr i))
1843 (read (current-buffer))))) 1873 (method (cadr i))
1844 (with-rcirc-process-buffer rcirc-process 1874 (args (cdddr i)))
1845 (dolist (i password-alist) 1875 (when (and (string-match server rcirc-server)
1846 (let ((server (car i)) 1876 (string-match nick rcirc-nick))
1847 (nick (cadr i)) 1877 (cond ((equal method 'nickserv)
1848 (method (caddr i)) 1878 (rcirc-send-string
1849 (args (cdddr i))) 1879 rcirc-process
1850 (when (and (string-match server rcirc-server) 1880 (concat
1851 (string-match nick rcirc-nick)) 1881 "PRIVMSG nickserv :identify "
1852 (cond ((equal method 'nickserv) 1882 (car args))))
1853 (rcirc-send-string 1883 ((equal method 'chanserv)
1854 rcirc-process 1884 (rcirc-send-string
1855 (concat 1885 rcirc-process
1856 "PRIVMSG nickserv :identify " 1886 (concat
1857 (car args)))) 1887 "PRIVMSG chanserv :identify "
1858 ((equal method 'chanserv) 1888 (cadr args) " " (car args))))
1859 (rcirc-send-string 1889 ((equal method 'bitlbee)
1860 rcirc-process 1890 (rcirc-send-string
1861 (concat 1891 rcirc-process
1862 "PRIVMSG chanserv :identify " 1892 (concat "PRIVMSG &bitlbee :identify " (car args))))
1863 (car args) " " (cadr args)))) 1893 (t
1864 ((equal method 'bitlbee) 1894 (message "No %S authentication method defined"
1865 (rcirc-send-string 1895 method))))))))
1866 rcirc-process
1867 (concat "PRIVMSG #bitlbee :identify " (car args))))
1868 (t
1869 (message "No %S authentication method defined"
1870 method)))))))))
1871 1896
1872(defun rcirc-handler-INVITE (process sender args text) 1897(defun rcirc-handler-INVITE (process sender args text)
1873 (rcirc-print process sender "INVITE" nil (mapconcat 'identity args " ") t)) 1898 (rcirc-print process sender "INVITE" nil (mapconcat 'identity args " ") t))
@@ -1879,22 +1904,19 @@ Passwords are read from `rcirc-authinfo-file-name' (which see)."
1879 (if (string-match "^\\([^ ]+\\) *\\(.*\\)$" text) 1904 (if (string-match "^\\([^ ]+\\) *\\(.*\\)$" text)
1880 (let* ((request (upcase (match-string 1 text))) 1905 (let* ((request (upcase (match-string 1 text)))
1881 (args (match-string 2 text)) 1906 (args (match-string 2 text))
1882 (nick (rcirc-user-nick sender))
1883 (handler (intern-soft (concat "rcirc-handler-ctcp-" request)))) 1907 (handler (intern-soft (concat "rcirc-handler-ctcp-" request))))
1884 (if (not (fboundp handler)) 1908 (if (not (fboundp handler))
1885 (rcirc-print process sender "ERROR" 1909 (rcirc-print process sender "ERROR" target
1886 (rcirc-get-buffer process target) 1910 (format "%s sent unsupported ctcp: %s" sender text)
1887 (format "%s sent unsupported ctcp: %s" nick text)
1888 t) 1911 t)
1889 (funcall handler process target sender args) 1912 (funcall handler process target sender args)
1890 (if (not (string= request "ACTION")) 1913 (if (not (string= request "ACTION"))
1891 (rcirc-print process sender "CTCP" 1914 (rcirc-print process sender "CTCP" target
1892 (rcirc-get-buffer process target)
1893 (format "%s" text) t)))))) 1915 (format "%s" text) t))))))
1894 1916
1895(defun rcirc-handler-ctcp-VERSION (process target sender args) 1917(defun rcirc-handler-ctcp-VERSION (process target sender args)
1896 (rcirc-send-string process 1918 (rcirc-send-string process
1897 (concat "NOTICE " (rcirc-user-nick sender) 1919 (concat "NOTICE " sender
1898 " :\C-aVERSION " rcirc-id-string 1920 " :\C-aVERSION " rcirc-id-string
1899 "\C-a"))) 1921 "\C-a")))
1900 1922
@@ -1903,7 +1925,7 @@ Passwords are read from `rcirc-authinfo-file-name' (which see)."
1903 1925
1904(defun rcirc-handler-ctcp-TIME (process target sender args) 1926(defun rcirc-handler-ctcp-TIME (process target sender args)
1905 (rcirc-send-string process 1927 (rcirc-send-string process
1906 (concat "NOTICE " (rcirc-user-nick sender) 1928 (concat "NOTICE " sender
1907 " :\C-aTIME " (current-time-string) "\C-a"))) 1929 " :\C-aTIME " (current-time-string) "\C-a")))
1908 1930
1909(defun rcirc-handler-CTCP-response (process target sender message) 1931(defun rcirc-handler-CTCP-response (process target sender message)
@@ -1960,7 +1982,7 @@ Passwords are read from `rcirc-authinfo-file-name' (which see)."
1960 :group 'rcirc-faces) 1982 :group 'rcirc-faces)
1961 1983
1962(defface rcirc-server-prefix ; font-lock-comment-delimiter-face 1984(defface rcirc-server-prefix ; font-lock-comment-delimiter-face
1963 '((default :inherit font-lock-comment-face) 1985 '((default :inherit rcirc-server)
1964 (((class grayscale))) 1986 (((class grayscale)))
1965 (((class color) (min-colors 16))) 1987 (((class color) (min-colors 16)))
1966 (((class color) (min-colors 8) (background light)) 1988 (((class color) (min-colors 8) (background light))