aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/erc/erc.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/erc/erc.el')
-rw-r--r--lisp/erc/erc.el99
1 files changed, 50 insertions, 49 deletions
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 7cb6fbb595b..cec9718e751 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -67,7 +67,7 @@
67(defconst erc-version-string "Version 5.3" 67(defconst erc-version-string "Version 5.3"
68 "ERC version. This is used by function `erc-version'.") 68 "ERC version. This is used by function `erc-version'.")
69 69
70(eval-when-compile (require 'cl)) 70(eval-when-compile (require 'cl-lib))
71(require 'font-lock) 71(require 'font-lock)
72(require 'pp) 72(require 'pp)
73(require 'thingatpt) 73(require 'thingatpt)
@@ -369,7 +369,7 @@ If no server buffer exists, return nil."
369 (with-current-buffer ,buffer 369 (with-current-buffer ,buffer
370 ,@body))))) 370 ,@body)))))
371 371
372(defstruct (erc-server-user (:type vector) :named) 372(cl-defstruct (erc-server-user (:type vector) :named)
373 ;; User data 373 ;; User data
374 nickname host login full-name info 374 nickname host login full-name info
375 ;; Buffers 375 ;; Buffers
@@ -379,7 +379,7 @@ If no server buffer exists, return nil."
379 (buffers nil) 379 (buffers nil)
380 ) 380 )
381 381
382(defstruct (erc-channel-user (:type vector) :named) 382(cl-defstruct (erc-channel-user (:type vector) :named)
383 op voice 383 op voice
384 ;; Last message time (in the form of the return value of 384 ;; Last message time (in the form of the return value of
385 ;; (current-time) 385 ;; (current-time)
@@ -1386,7 +1386,7 @@ If BUFFER is nil, the current buffer is used."
1386 t)) 1386 t))
1387 (erc-server-send (format "ISON %s" nick)) 1387 (erc-server-send (format "ISON %s" nick))
1388 (while (eq erc-online-p 'unknown) (accept-process-output)) 1388 (while (eq erc-online-p 'unknown) (accept-process-output))
1389 (if (interactive-p) 1389 (if (called-interactively-p 'interactive)
1390 (message "%s is %sonline" 1390 (message "%s is %sonline"
1391 (or erc-online-p nick) 1391 (or erc-online-p nick)
1392 (if erc-online-p "" "not ")) 1392 (if erc-online-p "" "not "))
@@ -2157,11 +2157,11 @@ functions in here get called with the parameters SERVER and NICK."
2157 (list :server server :port port :nick nick :password passwd))) 2157 (list :server server :port port :nick nick :password passwd)))
2158 2158
2159;;;###autoload 2159;;;###autoload
2160(defun* erc (&key (server (erc-compute-server)) 2160(cl-defun erc (&key (server (erc-compute-server))
2161 (port (erc-compute-port)) 2161 (port (erc-compute-port))
2162 (nick (erc-compute-nick)) 2162 (nick (erc-compute-nick))
2163 password 2163 password
2164 (full-name (erc-compute-full-name))) 2164 (full-name (erc-compute-full-name)))
2165 "ERC is a powerful, modular, and extensible IRC client. 2165 "ERC is a powerful, modular, and extensible IRC client.
2166This function is the main entry point for ERC. 2166This function is the main entry point for ERC.
2167 2167
@@ -2383,24 +2383,24 @@ If STRING is nil, the function does nothing."
2383 (while list 2383 (while list
2384 (setq elt (car list)) 2384 (setq elt (car list))
2385 (cond ((integerp elt) ; POSITION 2385 (cond ((integerp elt) ; POSITION
2386 (incf (car list) shift)) 2386 (cl-incf (car list) shift))
2387 ((or (atom elt) ; nil, EXTENT 2387 ((or (atom elt) ; nil, EXTENT
2388 ;; (eq t (car elt)) ; (t . TIME) 2388 ;; (eq t (car elt)) ; (t . TIME)
2389 (markerp (car elt))) ; (MARKER . DISTANCE) 2389 (markerp (car elt))) ; (MARKER . DISTANCE)
2390 nil) 2390 nil)
2391 ((integerp (car elt)) ; (BEGIN . END) 2391 ((integerp (car elt)) ; (BEGIN . END)
2392 (incf (car elt) shift) 2392 (cl-incf (car elt) shift)
2393 (incf (cdr elt) shift)) 2393 (cl-incf (cdr elt) shift))
2394 ((stringp (car elt)) ; (TEXT . POSITION) 2394 ((stringp (car elt)) ; (TEXT . POSITION)
2395 (incf (cdr elt) (* (if (natnump (cdr elt)) 1 -1) shift))) 2395 (cl-incf (cdr elt) (* (if (natnump (cdr elt)) 1 -1) shift)))
2396 ((null (car elt)) ; (nil PROPERTY VALUE BEG . END) 2396 ((null (car elt)) ; (nil PROPERTY VALUE BEG . END)
2397 (let ((cons (nthcdr 3 elt))) 2397 (let ((cons (nthcdr 3 elt)))
2398 (incf (car cons) shift) 2398 (cl-incf (car cons) shift)
2399 (incf (cdr cons) shift))) 2399 (cl-incf (cdr cons) shift)))
2400 ((and (featurep 'xemacs) 2400 ((and (featurep 'xemacs)
2401 (extentp (car elt))) ; (EXTENT START END) 2401 (extentp (car elt))) ; (EXTENT START END)
2402 (incf (nth 1 elt) shift) 2402 (cl-incf (nth 1 elt) shift)
2403 (incf (nth 2 elt) shift))) 2403 (cl-incf (nth 2 elt) shift)))
2404 (setq list (cdr list)))))) 2404 (setq list (cdr list))))))
2405 2405
2406(defvar erc-valid-nick-regexp "[]a-zA-Z^[;\\`_{}|][]^[;\\`_{}|a-zA-Z0-9-]*" 2406(defvar erc-valid-nick-regexp "[]a-zA-Z^[;\\`_{}|][]^[;\\`_{}|a-zA-Z0-9-]*"
@@ -2477,6 +2477,13 @@ purposes."
2477 :group 'erc-lurker 2477 :group 'erc-lurker
2478 :type 'boolean) 2478 :type 'boolean)
2479 2479
2480(defcustom erc-lurker-ignore-chars "`_"
2481 "Characters at the end of a nick to strip for activity tracking purposes.
2482
2483See also `erc-lurker-trim-nicks'."
2484 :group 'erc-lurker
2485 :type 'string)
2486
2480(defun erc-lurker-maybe-trim (nick) 2487(defun erc-lurker-maybe-trim (nick)
2481 "Maybe trim trailing `erc-lurker-ignore-chars' from NICK. 2488 "Maybe trim trailing `erc-lurker-ignore-chars' from NICK.
2482 2489
@@ -2491,13 +2498,6 @@ non-nil."
2491 "" nick) 2498 "" nick)
2492 nick)) 2499 nick))
2493 2500
2494(defcustom erc-lurker-ignore-chars "`_"
2495 "Characters at the end of a nick to strip for activity tracking purposes.
2496
2497See also `erc-lurker-trim-nicks'."
2498 :group 'erc-lurker
2499 :type 'string)
2500
2501(defcustom erc-lurker-hide-list nil 2501(defcustom erc-lurker-hide-list nil
2502 "List of IRC type messages to hide when sent by lurkers. 2502 "List of IRC type messages to hide when sent by lurkers.
2503 2503
@@ -2580,7 +2580,8 @@ updates of `erc-lurker-state'."
2580 (server 2580 (server
2581 (erc-canonicalize-server-name erc-server-announced-name))) 2581 (erc-canonicalize-server-name erc-server-announced-name)))
2582 (when (equal command "PRIVMSG") 2582 (when (equal command "PRIVMSG")
2583 (when (>= (incf erc-lurker-cleanup-count) erc-lurker-cleanup-interval) 2583 (when (>= (cl-incf erc-lurker-cleanup-count)
2584 erc-lurker-cleanup-interval)
2584 (setq erc-lurker-cleanup-count 0) 2585 (setq erc-lurker-cleanup-count 0)
2585 (erc-lurker-cleanup)) 2586 (erc-lurker-cleanup))
2586 (unless (gethash server erc-lurker-state) 2587 (unless (gethash server erc-lurker-state)
@@ -2605,6 +2606,17 @@ server within `erc-lurker-threshold-time'. See also
2605 (time-subtract (current-time) last-PRIVMSG-time)) 2606 (time-subtract (current-time) last-PRIVMSG-time))
2606 erc-lurker-threshold-time)))) 2607 erc-lurker-threshold-time))))
2607 2608
2609(defcustom erc-common-server-suffixes
2610 '(("openprojects.net$" . "OPN")
2611 ("freenode.net$" . "freenode")
2612 ("oftc.net$" . "OFTC"))
2613 "Alist of common server name suffixes.
2614This variable is used in mode-line display to save screen
2615real estate. Set it to nil if you want to avoid changing
2616displayed hostnames."
2617 :group 'erc-mode-line-and-header
2618 :type 'alist)
2619
2608(defun erc-canonicalize-server-name (server) 2620(defun erc-canonicalize-server-name (server)
2609 "Returns the canonical network name for SERVER if any, 2621 "Returns the canonical network name for SERVER if any,
2610otherwise `erc-server-announced-name'. SERVER is matched against 2622otherwise `erc-server-announced-name'. SERVER is matched against
@@ -3115,37 +3127,37 @@ If SERVER is non-nil, use that, rather than the current server."
3115 (add-to-list 'symlist 3127 (add-to-list 'symlist
3116 (cons (erc-once-with-server-event 3128 (cons (erc-once-with-server-event
3117 311 `(string= ,nick 3129 311 `(string= ,nick
3118 (second 3130 (nth 1
3119 (erc-response.command-args parsed)))) 3131 (erc-response.command-args parsed))))
3120 'erc-server-311-functions)) 3132 'erc-server-311-functions))
3121 (add-to-list 'symlist 3133 (add-to-list 'symlist
3122 (cons (erc-once-with-server-event 3134 (cons (erc-once-with-server-event
3123 312 `(string= ,nick 3135 312 `(string= ,nick
3124 (second 3136 (nth 1
3125 (erc-response.command-args parsed)))) 3137 (erc-response.command-args parsed))))
3126 'erc-server-312-functions)) 3138 'erc-server-312-functions))
3127 (add-to-list 'symlist 3139 (add-to-list 'symlist
3128 (cons (erc-once-with-server-event 3140 (cons (erc-once-with-server-event
3129 318 `(string= ,nick 3141 318 `(string= ,nick
3130 (second 3142 (nth 1
3131 (erc-response.command-args parsed)))) 3143 (erc-response.command-args parsed))))
3132 'erc-server-318-functions)) 3144 'erc-server-318-functions))
3133 (add-to-list 'symlist 3145 (add-to-list 'symlist
3134 (cons (erc-once-with-server-event 3146 (cons (erc-once-with-server-event
3135 319 `(string= ,nick 3147 319 `(string= ,nick
3136 (second 3148 (nth 1
3137 (erc-response.command-args parsed)))) 3149 (erc-response.command-args parsed))))
3138 'erc-server-319-functions)) 3150 'erc-server-319-functions))
3139 (add-to-list 'symlist 3151 (add-to-list 'symlist
3140 (cons (erc-once-with-server-event 3152 (cons (erc-once-with-server-event
3141 320 `(string= ,nick 3153 320 `(string= ,nick
3142 (second 3154 (nth 1
3143 (erc-response.command-args parsed)))) 3155 (erc-response.command-args parsed))))
3144 'erc-server-320-functions)) 3156 'erc-server-320-functions))
3145 (add-to-list 'symlist 3157 (add-to-list 'symlist
3146 (cons (erc-once-with-server-event 3158 (cons (erc-once-with-server-event
3147 330 `(string= ,nick 3159 330 `(string= ,nick
3148 (second 3160 (nth 1
3149 (erc-response.command-args parsed)))) 3161 (erc-response.command-args parsed))))
3150 'erc-server-330-functions)) 3162 'erc-server-330-functions))
3151 (add-to-list 'symlist 3163 (add-to-list 'symlist
@@ -4328,8 +4340,8 @@ See also: `erc-echo-notice-in-user-buffers',
4328 4340
4329(defun erc-banlist-store (proc parsed) 4341(defun erc-banlist-store (proc parsed)
4330 "Record ban entries for a channel." 4342 "Record ban entries for a channel."
4331 (multiple-value-bind (channel mask whoset) 4343 (pcase-let ((`(,channel ,mask ,whoset)
4332 (values-list (cdr (erc-response.command-args parsed))) 4344 (cdr (erc-response.command-args parsed))))
4333 ;; Determine to which buffer the message corresponds 4345 ;; Determine to which buffer the message corresponds
4334 (let ((buffer (erc-get-buffer channel proc))) 4346 (let ((buffer (erc-get-buffer channel proc)))
4335 (with-current-buffer buffer 4347 (with-current-buffer buffer
@@ -4340,7 +4352,7 @@ See also: `erc-echo-notice-in-user-buffers',
4340 4352
4341(defun erc-banlist-finished (proc parsed) 4353(defun erc-banlist-finished (proc parsed)
4342 "Record that we have received the banlist." 4354 "Record that we have received the banlist."
4343 (let* ((channel (second (erc-response.command-args parsed))) 4355 (let* ((channel (nth 1 (erc-response.command-args parsed)))
4344 (buffer (erc-get-buffer channel proc))) 4356 (buffer (erc-get-buffer channel proc)))
4345 (with-current-buffer buffer 4357 (with-current-buffer buffer
4346 (put 'erc-channel-banlist 'received-from-server t))) 4358 (put 'erc-channel-banlist 'received-from-server t)))
@@ -4349,7 +4361,7 @@ See also: `erc-echo-notice-in-user-buffers',
4349(defun erc-banlist-update (proc parsed) 4361(defun erc-banlist-update (proc parsed)
4350 "Check MODE commands for bans and update the banlist appropriately." 4362 "Check MODE commands for bans and update the banlist appropriately."
4351 ;; FIXME: Possibly incorrect. -- Lawrence 2004-05-11 4363 ;; FIXME: Possibly incorrect. -- Lawrence 2004-05-11
4352 (let* ((tgt (first (erc-response.command-args parsed))) 4364 (let* ((tgt (car (erc-response.command-args parsed)))
4353 (mode (erc-response.contents parsed)) 4365 (mode (erc-response.contents parsed))
4354 (whoset (erc-response.sender parsed)) 4366 (whoset (erc-response.sender parsed))
4355 (buffer (erc-get-buffer tgt proc))) 4367 (buffer (erc-get-buffer tgt proc)))
@@ -6000,7 +6012,7 @@ entry of `channel-members'."
6000 (if cuser 6012 (if cuser
6001 (setq op (erc-channel-user-op cuser) 6013 (setq op (erc-channel-user-op cuser)
6002 voice (erc-channel-user-voice cuser))) 6014 voice (erc-channel-user-voice cuser)))
6003 (if (interactive-p) 6015 (if (called-interactively-p 'interactive)
6004 (message "%s is %s@%s%s%s" 6016 (message "%s is %s@%s%s%s"
6005 nick login host 6017 nick login host
6006 (if full-name (format " (%s)" full-name) "") 6018 (if full-name (format " (%s)" full-name) "")
@@ -6088,17 +6100,6 @@ Otherwise, use the `erc-header-line' face."
6088 :group 'erc-paranoia 6100 :group 'erc-paranoia
6089 :type 'boolean) 6101 :type 'boolean)
6090 6102
6091(defcustom erc-common-server-suffixes
6092 '(("openprojects.net$" . "OPN")
6093 ("freenode.net$" . "freenode")
6094 ("oftc.net$" . "OFTC"))
6095 "Alist of common server name suffixes.
6096This variable is used in mode-line display to save screen
6097real estate. Set it to nil if you want to avoid changing
6098displayed hostnames."
6099 :group 'erc-mode-line-and-header
6100 :type 'alist)
6101
6102(defcustom erc-mode-line-away-status-format 6103(defcustom erc-mode-line-away-status-format
6103 "(AWAY since %a %b %d %H:%M) " 6104 "(AWAY since %a %b %d %H:%M) "
6104 "When you're away on a server, this is shown in the mode line. 6105 "When you're away on a server, this is shown in the mode line.
@@ -6302,7 +6303,7 @@ If optional argument HERE is non-nil, insert version number at point."
6302 (format "ERC %s (GNU Emacs %s)" erc-version-string emacs-version))) 6303 (format "ERC %s (GNU Emacs %s)" erc-version-string emacs-version)))
6303 (if here 6304 (if here
6304 (insert version-string) 6305 (insert version-string)
6305 (if (interactive-p) 6306 (if (called-interactively-p 'interactive)
6306 (message "%s" version-string) 6307 (message "%s" version-string)
6307 version-string)))) 6308 version-string))))
6308 6309
@@ -6322,7 +6323,7 @@ If optional argument HERE is non-nil, insert version number at point."
6322 ", "))) 6323 ", ")))
6323 (if here 6324 (if here
6324 (insert string) 6325 (insert string)
6325 (if (interactive-p) 6326 (if (called-interactively-p 'interactive)
6326 (message "%s" string) 6327 (message "%s" string)
6327 string)))) 6328 string))))
6328 6329