diff options
Diffstat (limited to 'lisp/erc')
41 files changed, 873 insertions, 243 deletions
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index b356f83b0b2..f47e7d798c5 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,3 +1,147 @@ +2007-01-13 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-command-regexp): New variable that is used to match + a command. + (erc-send-input): Use it. This fixes a bug where paths -- + "/usr/bin/foo", for example -- were being displayed as commands, + but still sent correctly. + (erc-extract-command-from-line): Use it. + + * erc.texi (Modules): Document erc-capab-identify. + +2007-01-11 Diane Murray <disumu@x3y2z1.net> + + * erc.el (erc-find-parsed-property): Moved here from erc-track.el + since it can be useful in general. + + * erc-track.el (erc-find-parsed-property): Removed. + + * erc-capab.el (erc-capab-find-parsed): Removed. + (erc-capab-identify-add-prefix): Use `erc-find-parsed-property'. + + * erc.el (erc-open): Run `erc-before-connect' hook here. This + makes sure the hook always gets called before a connection is + made, as some functions, like `erc-handle-irc-url', use `erc-open' + instead of `erc'. + (erc): Removed `erc-before-connect' hook. + + * erc-menu.el (erc-menu-definition): Put items specific to + channels in a "Current channel" submenu. + + * erc-backend.el (321, 323): Display channel list in server buffer + when not using the channel list module. + + * erc.el: Updated copyright years. + (erc-version-string): Set to 5.2 (devel). + (erc-format-lag-time): Fixed to work when `erc-server-lag' is nil. + (erc-update-mode-line-buffer): Set the header face. + +2007-01-11 Michael Olson <mwolson@gnu.org> + + * erc-bbdb.el (erc-bbdb-popup-type): Fix customization type and + documentation. + + * erc-services.el (erc-nickserv-identify-mode): Improve + documentation for nick-change option and move higher to fix + compiler warning. Avoid a recursive load error. + (erc-nickserv-alist): Add simple entry for BitlBee, to avoid + "NickServ is AWAY: User is offline" error. Oddly enough, bitlbee + was smart enough to recognize that as an authentication request + and log in regardless, which is why I didn't notice this earlier. + (erc-nickserv-alist-sender, erc-nickserv-alist-regexp) + (erc-nickserv-alist-nickserv, erc-nickserv-alist-ident-keyword) + (erc-nickserv-alist-use-nick-p) + (erc-nickserv-alist-ident-command): New accessors for + erc-nickserv-alist. Using nth is unwieldy. + (erc-nickserv-identify-autodetect) + (erc-nickserv-identify-on-connect) + (erc-nickserv-identify-on-nick-change, erc-nickserv-identify): Use + the new accessors. + +2007-01-11 Diane Murray <disumu@x3y2z1.net> + + * NEWS: Added note for `erc-my-nick-face'. Fixed capab-identify + wording. + +2007-01-10 Diane Murray <disumu@x3y2z1.net> + + * erc.el (erc-mode-line-format): Added %l to documentation. + (erc-header-line-format): Removed "[IRC]". Use the new %l + replacement character. Doc fix. + (erc-format-channel-modes): Removed lag code. Removed parentheses + from mode string. + (erc-format-lag-time): New function. + (erc-update-mode-line-buffer): Use it. + +2007-01-09 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-system-name): New option that determines the system + name to use when logging in. The default is to figure this out by + calling `system-name'. + (erc-login): Use it. + +2007-01-07 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-modules): Add the menu module. This should fix a + bug with incorrect ERC submenus being displayed. + + * erc-menu.el: Turn this into a module. + (erc-menu-add, erc-menu-remove): New functions that add and remove + the ERC menu. + +2006-12-28 Michael Olson <mwolson@gnu.org> + + * erc-list.el: Change header to mention that this is part of ERC, + rather than GNU Emacs. + + * erc-networks.el (erc-server-alist): Add Ars OpenIRC and + LinuxChix networks. Thanks to Angelina Carlton for mentioning + them. Properly escape periods in Konfido.Net and Kewl.Org. + (erc-networks-alist): Add entries for Ars and LinuxChix, though + the latter does not actually provide an announced network name. + + * erc-services.el (erc-nickserv-identify-mode): Add 'both method, + which waits for a NickServ message if the network supports it, + otherwise sends the password after connecting. + (erc-nickserv-identify-mode): Default to 'both. + (erc-nickserv-passwords): Add OFTC and Azzurra to custom options. + (erc-nickserv-alist): Indentation fix. + (erc-nickserv-identify-on-connect) + (erc-nickserv-identify-on-nick-change): Handle 'both method. + +2006-12-28 Leo <sdl.web@gmail.com> (tiny change) + + * erc.el (erc-iswitchb): Wrap body in unwind-protect so that + hitting C-g does not leave iswitchb-mode on. + +2006-12-27 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-cmd-RECONNECT): New command that calls + erc-server-reconnect. + + * erc-backend.el (erc-server-reconnect-count): New server variable + that keeps track of reconnection attempts. + (erc-server-reconnect-attempts): New option that determines the + number of reconnection attempts that ERC will make per server. + (erc-server-reconnect-timeout): New option that determines the + amount of time, in seconds, that ERC will wait between successive + reconnect attempts. + (erc-server-reconnect): New function that reestablishes the + current IRC connection. Move some commands from + erc-process-sentinel-1 here. + (erc-process-sentinel-1): If we have been disconnected, loop until + we either reconnect or run out of attempts. + (erc-server-reconnect-p): Move higher and make this a defsubst, + since I'm worried about the current buffer changing from + underneath us. Implement limit of number of reconnect attempts.. + + * erc.texi (Getting Started): Update for /RECONNECT command. + +2006-12-26 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-open): Restore old point correctly, or at least get + closer to doing so than before. + 2006-12-13 Leo <sdl.web@gmail.com> (tiny change) * erc.el (erc-iswitchb): Temporarily enable iswitchb mode if it @@ -38,7 +182,7 @@ (erc-update-current-channel-member, erc-load-script): (erc-mode-line-away-status-format): Doc fixes. -2006-11-20 Andrea Russo <rastandy@inventati.org> +2006-11-20 Andrea Russo <rastandy@inventati.org> (tiny change) * erc-dcc.el (erc-dcc-chat-setup): Initialize `erc-input-marker' before calling `erc-display-prompt'. @@ -111,7 +255,7 @@ `erc-show-my-nick' is non-nil. (erc-compute-server): Doc fix. -2006-10-01 John J Foerch <jjfoerch@earthlink.net> +2006-10-01 John J Foerch <jjfoerch@earthlink.net> (tiny change) * erc-stamp.el (erc-insert-timestamp-right): Exclude the newline from the erc-timestamp field. @@ -121,7 +265,7 @@ * erc-nicklist.el (erc-nicklist-insert-contents): Add missing parenthesis. Thanks to Stephan Stahl for the report. -2006-09-10 Eric Hanchrow <offby1@blarg.net> +2006-09-10 Eric Hanchrow <offby1@blarg.net> (tiny change) * erc.el (erc-cmd-IGNORE): Prompt user if this might be a regexp instead of a single user. @@ -230,18 +374,47 @@ * NEWS: Added note about these changes. +2006-08-20 Diane Murray <disumu@x3y2z1.net> + + * erc-backend.el (erc-process-sentinel-1): Doc fix. Let + `erc-server-reconnect-p' check all condition cases. + (erc-server-reconnect-p): Moved rest of checks from + `erc-process-sentinel-1' to here. Now takes an argument, EVENT. + 2006-08-21 Diane Murray <disumu@x3y2z1.net> * erc-track.el (erc-track-mode-line-mouse-face): New variable. (erc-make-mode-line-buffer-name): Add help-echo and mouse-face properties to channel name. +2006-08-20 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-with-server-buffer): New macro that switches to the + current ERC server buffer and runs some code. If no server buffer + is available, return nil. This is a useful way to access + variables in the server buffer. + (erc-open-server-buffer-p): New function that returns non-nil if + the given buffer is an ERC server buffer that has an open IRC + process. + 2006-08-14 Diane Murray <disumu@x3y2z1.net> * erc-menu.el: Updated copyright years. Removed EmacsWiki URL. (erc-menu-definition): Name the menu "ERC" instead of "IRC" to avoid confusion with rcirc and other clients. + * erc-backend.el (erc-server-banned): New variable. + (erc-server-connect): Set `erc-server-banned' to nil. + (erc-process-sentinel-1): Use `erc-server-reconnect-p'. + (erc-server-reconnect-p): New function. Return non-nil if the + user wants automatic reconnects and if the user has not been + banned from the server. This should fix a bug where ERC gets into + a loop trying to reconnect with no way to stop it when the user is + denied access to the server due to a server ban. It might also + help when Tor users are blocked from freenode if freenode servers + send the 465 message before disconnecting. + (465): Handle "banned from server" error notices. + 2006-08-13 Romain Francoise <romain@orebokech.com> * erc-match.el (erc-log-matches-make-buffer): End `y-or-n-p' @@ -573,8 +746,30 @@ <C-tab> for `erc-button-previous' as it is a more standard key binding for this type of function. +2006-02-28 Diane Murray <disumu@x3y2z1.net> + + * erc-capab.el: Removed things that were accidentally committed on + 2006-02-20. Removed Todo section. + (erc-capab-unidentified): Removed. + +2006-02-26 Michael Olson <mwolson@gnu.org> + + * erc-capab.el: Use (eval-when-compile (require 'cl)). + (erc-capab-unidentified): Fix compiler warning by specifying + group. + +2006-02-20 Diane Murray <disumu@x3y2z1.net> + + * erc-capab.el (erc-capab-send-identify-messages): Fixed comment + to explain thoughts better. `erc-server-parameters' is an + associated list when it's set, not a string. + 2006-02-19 Michael Olson <mwolson@gnu.org> + * erc-capab.el (erc-capab-send-identify-messages): Make sure some + parameters are strings before using them. Thanks to Alejandro + Benitez for the report. + * erc.el (erc-version-string): Release ERC 5.1.2. 2006-02-19 Diane Murray <disumu@x3y2z1.net> @@ -624,8 +819,13 @@ 2006-02-11 Michael Olson <mwolson@gnu.org> - * erc.el (erc-update-modules): Make some requirements shorter, so - that it's easier to see why they are needed. + * erc.el (erc-update-modules): Handle erc-capab-identify + correctly. Make some requirements shorter, so that it's easier to + see why they are needed. + + * erc-capab.el: Add autoload cookie for capab-identify. + (erc-capab-send-identify-messages, erc-capab-identify-activate): + Minor whitespace fix in code. * erc-stamp.el (erc-timestamp-use-align-to): Renamed from `erc-timestamp-right-align-by-pixel'. Set the default based on @@ -649,11 +849,21 @@ (erc-list-channels): Was `erc-cmd-LIST', renamed. (erc-list-channels-simple): New function. - * erc.el (erc-modules): Added `list' to enabled modules. Moved - customization options left in source code. + * erc.el (erc-modules): Added `list' to enabled modules. Changed + `capab-identify' description. Moved customization options left in + source code. * erc-menu.el (erc-menu-definition): Use `erc-list-channels'. + * erc-capab.el: Put a little more detail into Usage section. + (define-erc-module): Run `erc-capab-identify-setup' in all open + server buffers when enabling. + (erc-capab-identify-setup): Make PROC and PARSED optional + arguments. + (erc-capab-identify-add-prefix): Simplified nickname regexp. This + should now also match nicknames that are formatted differently + than the default. + * erc-spelling.el (define-erc-module): Make sure there's a buffer before calling `with-current-buffer'. @@ -670,12 +880,34 @@ 2006-02-09 Diane Murray <disumu@x3y2z1.net> * erc.el (erc-get-parsed-vector, erc-get-parsed-vector-nick) + * erc-capab.el: Require erc. + (erc-capab-send-identify-messages): Use `erc-server-send'. + (erc-capab-identify-remove/set-identified-flag): Use 1 and 0 as + the flags so we can also check whether the `erc-identified' text + property is there at all. + (erc-capab-identify-add-prefix): Use `erc-capab-find-parsed'. + This fixes a bug where the prefix wasn't inserted when timestamps + are inserted on the right. Tweaked nickname regexp. + (erc-capab-find-parsed): New function. + (erc-capab-get-unidentified-nickname): Updated to check for 0 + flag. Only get nickname if there's a nickuserhost associated with + this message. + + * erc-capab.el: New file. Adds the new module + `erc-capab-identify', which allows flagging of unidentified users + on servers running an ircd based on dancer - irc.freenode.net, for + example. + + * erc.el (erc-modules): Added `capab-identify' to options. + (erc-get-parsed-vector, erc-get-parsed-vector-nick) (erc-get-parsed-vector-type): Moved here from erc-match.el. * erc-match.el (erc-get-parsed-vector, erc-get-parsed-vector-nick) (erc-get-parsed-vector-type): Moved these functions to erc.el since they can be useful outside of the text matching module. + * NEWS: Added erc-capab.el. + * erc-dcc.el, erc-stamp.el, erc-xdcc.el: Changed "Emacs IRC Client" to "ERC". @@ -1110,7 +1342,7 @@ See ChangeLog.05 for earlier changes. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2007 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted provided the copyright notice and this notice are preserved. diff --git a/lisp/erc/ChangeLog.01 b/lisp/erc/ChangeLog.01 index 25f57569742..fd0be8bbb8f 100644 --- a/lisp/erc/ChangeLog.01 +++ b/lisp/erc/ChangeLog.01 @@ -1035,7 +1035,7 @@ * erc-speak.el, erc.el: New file. - Copyright (C) 2001, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2006, 2007 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted provided the copyright notice and this notice are preserved. diff --git a/lisp/erc/ChangeLog.02 b/lisp/erc/ChangeLog.02 index 332bd7fbfb9..eaa94c1c1ed 100644 --- a/lisp/erc/ChangeLog.02 +++ b/lisp/erc/ChangeLog.02 @@ -2596,7 +2596,7 @@ See ChangeLog.01 for earlier changes. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2007 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted provided the copyright notice and this notice are preserved. diff --git a/lisp/erc/ChangeLog.03 b/lisp/erc/ChangeLog.03 index 20f0f92f5e0..ed3b4e24b7b 100644 --- a/lisp/erc/ChangeLog.03 +++ b/lisp/erc/ChangeLog.03 @@ -2140,7 +2140,7 @@ See ChangeLog.02 for earlier changes. - Copyright (C) 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted provided the copyright notice and this notice are preserved. diff --git a/lisp/erc/ChangeLog.04 b/lisp/erc/ChangeLog.04 index c5338a311c9..61af66db2ad 100644 --- a/lisp/erc/ChangeLog.04 +++ b/lisp/erc/ChangeLog.04 @@ -2069,7 +2069,7 @@ See ChangeLog.03 for earlier changes. - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted provided the copyright notice and this notice are preserved. diff --git a/lisp/erc/ChangeLog.05 b/lisp/erc/ChangeLog.05 index a640aba00a1..6f3207bb475 100644 --- a/lisp/erc/ChangeLog.05 +++ b/lisp/erc/ChangeLog.05 @@ -1217,7 +1217,7 @@ See ChangeLog.04 for earlier changes. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted provided the copyright notice and this notice are preserved. diff --git a/lisp/erc/erc-autoaway.el b/lisp/erc/erc-autoaway.el index dcb6bc0756e..9d90d0ae5e9 100644 --- a/lisp/erc/erc-autoaway.el +++ b/lisp/erc/erc-autoaway.el @@ -1,6 +1,6 @@ ;;; erc-autoaway.el --- Provides autoaway for ERC -;; Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Jorgen Schaefer <forcer@forcix.cx> ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcAutoAway diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 82934f92218..fbe6f22e1d6 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -1,6 +1,6 @@ ;;; erc-backend.el --- Backend network communication for ERC -;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ;; Filename: erc-backend.el ;; Author: Lawrence Mitchell <wence@gmx.li> @@ -179,10 +179,18 @@ WALLCHOPS - supports sending messages to all operators in a channel") This variable is buffer-local.") (make-variable-buffer-local 'erc-server-connected) +(defvar erc-server-reconnect-count 0 + "Number of times we have failed to reconnect to the current server.") +(make-variable-buffer-local 'erc-server-reconnect-count) + (defvar erc-server-quitting nil "Non-nil if the user requests a quit.") (make-variable-buffer-local 'erc-server-quitting) +(defvar erc-server-banned nil + "Non-nil if the user is denied access because of a server ban.") +(make-variable-buffer-local 'erc-server-banned) + (defvar erc-server-lines-sent nil "Line counter.") (make-variable-buffer-local 'erc-server-lines-sent) @@ -259,6 +267,23 @@ Reconnection will happen automatically for any unexpected disconnection." :group 'erc-server :type 'boolean) +(defcustom erc-server-reconnect-attempts 2 + "The number of times that ERC will attempt to reestablish a +broken connection, or t to always attempt to reconnect. + +This only has an effect if `erc-server-auto-reconnect' is non-nil." + :group 'erc-server + :type '(choice (const :tag "Always reconnect" t) + integer)) + +(defcustom erc-server-reconnect-timeout 1 + "The amount of time, in seconds, that ERC will wait between +successive reconnect attempts. + +If a key is pressed while ERC is waiting, it will stop waiting." + :group 'erc-server + :type 'number) + (defcustom erc-split-line-length 440 "*The maximum length of a single message. If a message exceeds this size, it is broken into multiple ones. @@ -434,6 +459,7 @@ We will store server variables in the current buffer." (message "%s...done" msg)) ;; Misc server variables (setq erc-server-quitting nil) + (setq erc-server-banned nil) (setq erc-server-last-sent-time (erc-current-time)) (setq erc-server-last-ping-time (erc-current-time)) (setq erc-server-lines-sent 0) @@ -457,6 +483,21 @@ We will store server variables in the current buffer." "Opening connection..\n") (erc-login))) +(defun erc-server-reconnect () +"Reestablish the current IRC connection. +Make sure you are in an ERC buffer when running this." + (let ((server (erc-server-buffer))) + (unless (and server + (buffer-live-p server)) + (error "Couldn't switch to server buffer")) + (with-current-buffer server + (erc-update-mode-line) + (erc-set-active-buffer (current-buffer)) + (setq erc-server-last-sent-time 0) + (setq erc-server-lines-sent 0) + (erc-open erc-session-server erc-session-port erc-server-current-nick + erc-session-user-full-name t erc-session-password)))) + (defun erc-server-filter-function (process string) "The process filter for the ERC server." (with-current-buffer (process-buffer process) @@ -485,11 +526,24 @@ We will store server variables in the current buffer." (match-end 0)))) (erc-parse-server-response process line))))))) +(defsubst erc-server-reconnect-p (event) + "Return non-nil if ERC should attempt to reconnect automatically. +EVENT is the message received from the closed connection process." + (and erc-server-auto-reconnect + (not erc-server-banned) + ;; make sure we don't infinitely try to reconnect, unless the + ;; user wants that + (or (eq erc-server-reconnect-attempts t) + (and (integerp erc-server-reconnect-attempts) + (< erc-server-reconnect-count erc-server-reconnect-attempts))) + (not (string-match "^deleted" event)) + ;; open-network-stream-nowait error for connection refused + (not (string-match "^failed with code 111" event)))) + (defun erc-process-sentinel-1 (event) - "This will be called when erc-process-sentinel has decided that we -are going to quit. Determine whether user has quit or whether erc has -been terminated. Conditionally try to reconnect and take appropriate -action." + "Called when `erc-process-sentinel' has decided that we're disconnecting. +Determine whether user has quit or whether erc has been terminated. +Conditionally try to reconnect and take appropriate action." (if erc-server-quitting ;; normal quit (progn @@ -498,25 +552,26 @@ action." (set-buffer-modified-p nil) (kill-buffer (current-buffer)))) ;; unexpected disconnect - (erc-display-message nil 'error (current-buffer) - (if erc-server-auto-reconnect - 'disconnected - 'disconnected-noreconnect)) - (erc-update-mode-line) - (erc-set-active-buffer (current-buffer)) - (setq erc-server-last-sent-time 0) - (setq erc-server-lines-sent 0) - (if (and erc-server-auto-reconnect - (not (string-match "^deleted" event)) - ;; open-network-stream-nowait error for connection refused - (not (string-match "^failed with code 111" event))) - ;; Yuck, this should perhaps funcall - ;; erc-server-reconnect-function with no args - (erc-open erc-session-server erc-session-port erc-server-current-nick - erc-session-user-full-name t erc-session-password) - ;; terminate, do not reconnect - (erc-display-message nil 'error (current-buffer) - 'terminated ?e event)))) + (let ((again t)) + (while again + (setq again nil) + (erc-display-message nil 'error (current-buffer) + (if (erc-server-reconnect-p event) + 'disconnected + 'disconnected-noreconnect)) + (if (erc-server-reconnect-p event) + (condition-case err + (progn + (erc-server-reconnect) + (setq erc-server-reconnect-count 0)) + (error (when (integerp erc-server-reconnect-attempts) + (setq erc-server-reconnect-count + (1+ erc-server-reconnect-count)) + (sit-for erc-server-reconnect-timeout) + (setq again t)))) + ;; terminate, do not reconnect + (erc-display-message nil 'error (current-buffer) + 'terminated ?e event)))))) (defun erc-process-sentinel (cproc event) "Sentinel function for ERC process." @@ -1480,7 +1535,7 @@ See `erc-display-server-message'." nil (define-erc-response-handler (321) "LIST header." nil (setq erc-channel-list nil) - (erc-display-message parsed 'notice 'active 's321)) + (erc-display-message parsed 'notice proc 's321)) (define-erc-response-handler (322) "LIST notice." nil @@ -1490,7 +1545,7 @@ See `erc-display-server-message'." nil (add-to-list 'erc-channel-list (list channel)) (erc-update-channel-topic channel topic) (erc-display-message - parsed 'notice 'active 's322 + parsed 'notice proc 's322 ?c channel ?u num-users ?t (or topic ""))))) (define-erc-response-handler (324) @@ -1708,6 +1763,14 @@ See `erc-display-server-message'." nil ?c (second (erc-response.command-args parsed)) ?m (erc-response.contents parsed))) +(define-erc-response-handler (465) + "You are banned from this server." nil + (setq erc-server-banned t) + ;; show the server's message, as a reason might be provided + (erc-display-error-notice + parsed + (erc-response.contents parsed))) + (define-erc-response-handler (474) "Banned from channel errors" nil (erc-display-message parsed '(notice error) nil @@ -1741,7 +1804,7 @@ See `erc-display-server-message'." nil (erc-display-message parsed '(error notice) 'active 's482 ?c channel ?m message))) -(define-erc-response-handler (431 445 446 451 462 463 464 465 481 483 484 485 +(define-erc-response-handler (431 445 446 451 462 463 464 481 483 484 485 491 501 502) ;; 431 - No nickname given ;; 445 - SUMMON has been disabled @@ -1750,7 +1813,6 @@ See `erc-display-server-message'." nil ;; 462 - Unauthorized command (already registered) ;; 463 - Your host isn't among the privileged ;; 464 - Password incorrect - ;; 465 - You are banned from this server ;; 481 - Need IRCop privileges ;; 483 - You can't kill a server! ;; 484 - Your connection is restricted! diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index 13e2a384735..1fd224fb956 100644 --- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -1,7 +1,7 @@ ;; erc-button.el --- A way of buttonizing certain things in ERC buffers ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -;; 2006 Free Software Foundation, Inc. +;; 2006, 2007 Free Software Foundation, Inc. ;; Author: Mario Lang <mlang@delysid.org> ;; Keywords: irc, button, url, regexp diff --git a/lisp/erc/erc-capab.el b/lisp/erc/erc-capab.el new file mode 100644 index 00000000000..268c4bfe68a --- /dev/null +++ b/lisp/erc/erc-capab.el @@ -0,0 +1,202 @@ +;;; erc-capab.el --- support for dancer-ircd and hyperion's CAPAB + +;; Copyright (C) 2006, 2007 Free Software Foundation, Inc. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; This file defines the ERC module `erc-capab-identify', which allows +;; flagging of unidentified users on servers running dancer-ircd or +;; hyperion. freenode.net supports this capability, for example. + +;; With CAPAB IDENTIFY-MSG and IDENTIFY-CTCP enabled, messages from +;; users who have identified themselves to NickServ will have a plus +;; sign and messages from unidentified users will have a minus sign +;; added as a prefix. Note that it is not necessary for your nickname +;; to be identified in order to receive these marked messages. + +;; The plus or minus sign is removed from the message, and a prefix, +;; `erc-capab-identify-prefix', is inserted in the front of the user's +;; nickname if the nickname is not identified. + +;; Please note that once this has been enabled on a server, there is no +;; way to tell the server to stop sending marked messages. If you +;; disable this module, it will continue removing message flags, but the +;; unidentified nickname prefix will not be added to messages. + +;; Visit <http://freenode.net/faq.shtml#spoofing> and +;; <http://freenode.net/faq.shtml#registering> to find further +;; explanations of this capability. + +;; From freenode.net's web site (not there anymore) on how to mark +;; unidentified users: +;; "We recommend that you add an asterisk before the nick, and +;; optionally either highlight or colourize the line in some +;; appropriate fashion, if the user is not identified." + +;;; Usage: + +;; Put the following in your ~/.emacs file. + +;; (require 'erc-capab) +;; (erc-capab-identify-mode 1) + +;; `erc-capab-identify-prefix' will now be added to the beginning of +;; unidentified users' nicknames. The default is an asterisk, "*". If +;; the value of this variable is nil or you disable this module (see +;; `erc-capab-identify-disable'), no prefix will be inserted, but the +;; flag sent by the server will still be stripped. + +;;; Code: + +(require 'erc) +(eval-when-compile (require 'cl)) + +;;; Customization: + +(defgroup erc-capab nil + "Support for dancer-ircd's CAPAB settings." + :group 'erc) + +(defcustom erc-capab-identify-prefix "*" + "The prefix used for unidentified users." + :group 'erc-capab + :type '(choice string (const nil))) + +;;; Define module: + +(define-erc-response-handler (290) + "Handle dancer-ircd CAPAB messages." nil nil) + +;;;###autoload (autoload 'erc-capab-identify-mode "erc-capab" nil t) +(define-erc-module capab-identify nil + "Handle dancer-ircd's CAPAB IDENTIFY-MSG and IDENTIFY-CTCP." + ;; append so that `erc-server-parameters' is already set by `erc-server-005' + ((add-hook 'erc-server-005-functions 'erc-capab-identify-setup t) + (add-hook 'erc-server-290-functions 'erc-capab-identify-activate) + (add-hook 'erc-server-PRIVMSG-functions + 'erc-capab-identify-remove/set-identified-flag) + (add-hook 'erc-server-NOTICE-functions + 'erc-capab-identify-remove/set-identified-flag) + (add-hook 'erc-insert-modify-hook 'erc-capab-identify-add-prefix t) + (mapc (lambda (buffer) + (when buffer + (with-current-buffer buffer (erc-capab-identify-setup)))) + (erc-buffer-list 'erc-open-server-buffer-p))) + ((remove-hook 'erc-server-005-functions 'erc-capab-identify-setup) + (remove-hook 'erc-server-290-functions 'erc-capab-identify-activate) + ;; we don't remove the `erc-capab-identify-remove/set-identified-flag' hooks + ;; because there doesn't seem to be a way to tell the server to turn it off + (remove-hook 'erc-insert-modify-hook 'erc-capab-identify-add-prefix))) + +;;; Variables: + +(defvar erc-capab-identify-activated nil + "CAPAB IDENTIFY-MSG has been activated.") +(make-variable-buffer-local 'erc-capab-identify-activated) + +(defvar erc-capab-identify-sent nil + "CAPAB IDENTIFY-MSG and IDENTIFY-CTCP messages have been sent.") +(make-variable-buffer-local 'erc-capab-identify-sent) + +;;; Functions: + +(defun erc-capab-identify-setup (&optional proc parsed) + "Set up CAPAB IDENTIFY on the current server. + +Optional argument PROC is the current server's process. +Optional argument PARSED is the current message, a response struct. + +These arguments are sent to this function when called as a hook in +`erc-server-005-functions'." + (unless erc-capab-identify-sent + (erc-capab-send-identify-messages))) + +(defun erc-capab-send-identify-messages () + "Send CAPAB IDENTIFY messages if the server supports it." + (when (and (stringp erc-server-version) + (string-match "^\\(dancer-ircd\\|hyperion\\)" erc-server-version) + ;; could possibly check for '("IRCD" . "dancer") in + ;; `erc-server-parameters' instead of looking for a specific name + ;; in `erc-server-version' + (assoc "CAPAB" erc-server-parameters)) + (erc-log "Sending CAPAB IDENTIFY-MSG and IDENTIFY-CTCP") + (erc-server-send "CAPAB IDENTIFY-MSG") + (erc-server-send "CAPAB IDENTIFY-CTCP") + (setq erc-capab-identify-sent t))) + + +(defun erc-capab-identify-activate (proc parsed) + "Set `erc-capab-identify-activated' and display an activation message. + +PROC is the current server's process. +PARSED is an `erc-parsed' response struct." + (when (or (string= "IDENTIFY-MSG" (erc-response.contents parsed)) + (string= "IDENTIFY-CTCP" (erc-response.contents parsed))) + (setq erc-capab-identify-activated t) + (erc-display-message + parsed 'notice 'active (format "%s activated" + (erc-response.contents parsed))))) + +(defun erc-capab-identify-remove/set-identified-flag (proc parsed) + "Remove PARSED message's id flag and add the `erc-identified' text property. + +PROC is the current server's process. +PARSED is an `erc-parsed' response struct." + (let ((msg (erc-response.contents parsed))) + (when (and erc-capab-identify-activated + (string-match "^\\([-\\+]\\)\\(.+\\)$" msg)) + (setf (erc-response.contents parsed) + (if erc-capab-identify-mode + (erc-propertize (match-string 2 msg) + 'erc-identified + (if (string= (match-string 1 msg) "+") + 1 + 0)) + (match-string 2 msg))) + nil))) + +(defun erc-capab-identify-add-prefix () + "Add `erc-capab-identify-prefix' to nickname if user is unidentified." + (when (and erc-capab-identify-prefix + (erc-with-server-buffer erc-capab-identify-activated)) + (goto-char (or (erc-find-parsed-property) (point-min))) + (let ((nickname (erc-capab-get-unidentified-nickname + (erc-get-parsed-vector (point))))) + (when (and nickname + (goto-char (point-min)) + ;; assuming the first use of `nickname' is the sender's nick + (re-search-forward (regexp-quote nickname) nil t)) + (goto-char (match-beginning 0)) + (insert (erc-propertize erc-capab-identify-prefix + 'face (get-char-property (- (point) 1) + 'face))))))) + +(defun erc-capab-get-unidentified-nickname (parsed) + "Return the nickname of the user if unidentified. +PARSED is an `erc-parsed' response struct." + (when (and (erc-response-p parsed) + (equal 0 (get-text-property 0 'erc-identified + (erc-response.contents parsed)))) + (let ((nickuserhost (erc-get-parsed-vector-nick parsed))) + (when nickuserhost + (nth 0 (erc-parse-user nickuserhost)))))) + +(provide 'erc-capab) + +;; arch-tag: 27b6d668-7ee5-4e47-b9f0-27d7a4362062 +;;; erc-capab.el ends here diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el index 9d652b26d05..60cbe992d19 100644 --- a/lisp/erc/erc-compat.el +++ b/lisp/erc/erc-compat.el @@ -1,6 +1,6 @@ ;;; erc-compat.el --- ERC compatibility code for XEmacs -;; Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. ;; Author: Alex Schroeder <alex@gnu.org> ;; URL: http://www.emacswiki.org/cgi-bin/wiki/ERC diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index eeb3e93801e..2c906af4516 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -1,6 +1,6 @@ ;;; erc-dcc.el --- CTCP DCC module for ERC -;; Copyright (C) 1993, 1994, 1995, 1998, 2002, 2003, 2004, 2006 +;; Copyright (C) 1993, 1994, 1995, 1998, 2002, 2003, 2004, 2006, 2007 ;; Free Software Foundation, Inc. ;; Author: Ben A. Mesander <ben@gnu.ai.mit.edu> @@ -863,29 +863,29 @@ buffer, and sends back the replies after each block of data per the DCC protocol spec. Well not really. We write back a reply after each read, rather than every 1024 byte block, but nobody seems to care." (with-current-buffer (process-buffer proc) - (setq buffer-read-only nil) ;; FIXME - (goto-char (point-max)) - (insert (string-make-unibyte str)) - - (setq erc-dcc-byte-count (+ (length str) erc-dcc-byte-count)) - (erc-assert (= erc-dcc-byte-count (1- (point-max)))) - (and erc-verbose-dcc - (erc-display-message - nil 'notice erc-server-process - 'dcc-get-bytes-received - ?f (file-name-nondirectory buffer-file-name) - ?b (number-to-string erc-dcc-byte-count))) - (cond - ((and (> (plist-get erc-dcc-entry-data :size) 0) - (> erc-dcc-byte-count (plist-get erc-dcc-entry-data :size))) - (erc-display-message - nil '(error notice) 'active - 'dcc-get-file-too-long - ?f (file-name-nondirectory buffer-file-name)) - (delete-process proc)) - (t - (process-send-string - proc (erc-pack-int erc-dcc-byte-count 4)))))) + (let ((inhibit-read-only t)) + (goto-char (point-max)) + (insert (string-make-unibyte str)) + + (setq erc-dcc-byte-count (+ (length str) erc-dcc-byte-count)) + (erc-assert (= erc-dcc-byte-count (1- (point-max)))) + (and erc-verbose-dcc + (erc-display-message + nil 'notice erc-server-process + 'dcc-get-bytes-received + ?f (file-name-nondirectory buffer-file-name) + ?b (number-to-string erc-dcc-byte-count))) + (cond + ((and (> (plist-get erc-dcc-entry-data :size) 0) + (> erc-dcc-byte-count (plist-get erc-dcc-entry-data :size))) + (erc-display-message + nil '(error notice) 'active + 'dcc-get-file-too-long + ?f (file-name-nondirectory buffer-file-name)) + (delete-process proc)) + (t + (process-send-string + proc (erc-pack-int erc-dcc-byte-count 4))))))) (defun erc-dcc-get-sentinel (proc event) diff --git a/lisp/erc/erc-ezbounce.el b/lisp/erc/erc-ezbounce.el index ea5afcabcbe..f63682c51ff 100644 --- a/lisp/erc/erc-ezbounce.el +++ b/lisp/erc/erc-ezbounce.el @@ -1,6 +1,6 @@ ;;; erc-ezbounce.el --- Handle EZBounce bouncer commands -;; Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Andreas Fuchs <asf@void.at> ;; Keywords: comm diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el index 9552ce8543d..26ca86f04c6 100644 --- a/lisp/erc/erc-fill.el +++ b/lisp/erc/erc-fill.el @@ -1,6 +1,6 @@ ;;; erc-fill.el --- Filling IRC messages in various ways -;; Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Andreas Fuchs <asf@void.at> ;; Mario Lang <mlang@delysid.org> diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el index f6d32ee7c06..933e6b34b52 100644 --- a/lisp/erc/erc-goodies.el +++ b/lisp/erc/erc-goodies.el @@ -1,6 +1,6 @@ ;; erc-goodies.el --- Collection of ERC modules -;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 +;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 ;; Free Software Foundation, Inc. ;; Author: Jorgen Schaefer <forcer@forcix.cx> diff --git a/lisp/erc/erc-hecomplete.el b/lisp/erc/erc-hecomplete.el index 85a81569782..e6f91ce8998 100644 --- a/lisp/erc/erc-hecomplete.el +++ b/lisp/erc/erc-hecomplete.el @@ -1,6 +1,6 @@ ;;; erc-hecomplete.el --- Provides Nick name completion for ERC -;; Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2002, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Alex Schroeder <alex@gnu.org> ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcCompletion diff --git a/lisp/erc/erc-ibuffer.el b/lisp/erc/erc-ibuffer.el index 24eb2f09ccb..5266d837d64 100644 --- a/lisp/erc/erc-ibuffer.el +++ b/lisp/erc/erc-ibuffer.el @@ -1,6 +1,6 @@ ;;; erc-ibuffer.el --- ibuffer integration with ERC -;; Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Mario Lang <mlang@delysid.org> ;; Keywords: comm diff --git a/lisp/erc/erc-identd.el b/lisp/erc/erc-identd.el index f30c40d4792..c7f7c615e92 100644 --- a/lisp/erc/erc-identd.el +++ b/lisp/erc/erc-identd.el @@ -1,6 +1,6 @@ ;;; erc-identd.el --- RFC1413 (identd authentication protocol) server -;; Copyright (C) 2003, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. ;; Author: John Wiegley <johnw@gnu.org> ;; Keywords: comm, processes diff --git a/lisp/erc/erc-imenu.el b/lisp/erc/erc-imenu.el index e897a9d8a0c..5e005181b7b 100644 --- a/lisp/erc/erc-imenu.el +++ b/lisp/erc/erc-imenu.el @@ -1,6 +1,6 @@ ;;; erc-imenu.el -- Imenu support for ERC -;; Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2002, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Mario Lang <mlang@delysid.org> ;; Keywords: comm diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el index 86b79c538f1..fb59cd905a6 100644 --- a/lisp/erc/erc-join.el +++ b/lisp/erc/erc-join.el @@ -1,6 +1,6 @@ ;;; erc-join.el --- autojoin channels on connect and reconnects -;; Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Alex Schroeder <alex@gnu.org> ;; Keywords: irc diff --git a/lisp/erc/erc-lang.el b/lisp/erc/erc-lang.el index 04cfbe9e220..c4d103a0f4a 100644 --- a/lisp/erc/erc-lang.el +++ b/lisp/erc/erc-lang.el @@ -1,6 +1,6 @@ ;;; erc-lang.el --- provide the LANG command to ERC -;; Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Alex Schroeder <alex@gnu.org> ;; Maintainer: Alex Schroeder <alex@gnu.org> diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el index bd4ed3387d5..22c9b3622d3 100644 --- a/lisp/erc/erc-log.el +++ b/lisp/erc/erc-log.el @@ -1,6 +1,6 @@ ;;; erc-log.el --- Logging facilities for ERC. -;; Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ;; Author: Lawrence Mitchell <wence@gmx.li> ;; Keywords: IRC, chat, client, Internet, logging diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el index b5dc913a8c4..50e4cfbc521 100644 --- a/lisp/erc/erc-match.el +++ b/lisp/erc/erc-match.el @@ -1,6 +1,6 @@ ;;; erc-match.el --- Highlight messages matching certain regexps -;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ;; Author: Andreas Fuchs <asf@void.at> ;; Keywords: comm, faces diff --git a/lisp/erc/erc-menu.el b/lisp/erc/erc-menu.el index a2dc7a1b2f2..a5826625bde 100644 --- a/lisp/erc/erc-menu.el +++ b/lisp/erc/erc-menu.el @@ -1,6 +1,6 @@ ;; erc-menu.el -- Menu-bar definitions for ERC -;; Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ;; Author: Mario Lang <mlang@delysid.org> ;; Keywords: comm, processes, menu @@ -28,7 +28,7 @@ ;;; Code: -;(require 'erc) +(require 'erc) (require 'easymenu) (defvar erc-menu-definition @@ -40,41 +40,43 @@ (and erc-server-connected (fboundp 'erc-list-channels))] ["Join channel..." erc-join-channel erc-server-connected] ["Start a query..." erc-cmd-QUERY erc-server-connected] - "-" - ["List users in channel" erc-channel-names erc-channel-users] - ["List channel operators" erc-cmd-OPS erc-channel-users] ["Input action..." erc-input-action (erc-default-target)] - ["Set topic..." erc-set-topic - (and (and (erc-default-target) (not (erc-query-buffer-p))) - (or (not (member "t" erc-channel-modes)) - (erc-channel-user-op-p (erc-current-nick))))] - (list "Channel modes" - ["Change mode..." erc-insert-mode-command - (erc-channel-user-op-p (erc-current-nick))] - ["No external send" (erc-toggle-channel-mode "n") - :active (erc-channel-user-op-p (erc-current-nick)) - :style toggle :selected (member "n" erc-channel-modes)] - ["Topic set by channel operator" (erc-toggle-channel-mode "t") - :style toggle :selected (member "t" erc-channel-modes) - :active (erc-channel-user-op-p (erc-current-nick))] - ["Invite only" (erc-toggle-channel-mode "i") - :style toggle :selected (member "i" erc-channel-modes) - :active (erc-channel-user-op-p (erc-current-nick))] - ["Private" (erc-toggle-channel-mode "p") - :style toggle :selected (member "p" erc-channel-modes) - :active (erc-channel-user-op-p (erc-current-nick))] - ["Secret" (erc-toggle-channel-mode "s") - :style toggle :selected (member "s" erc-channel-modes) - :active (erc-channel-user-op-p (erc-current-nick))] - ["Moderated" (erc-toggle-channel-mode "m") - :style toggle :selected (member "m" erc-channel-modes) - :active (erc-channel-user-op-p (erc-current-nick))] - ["Set a limit..." erc-set-channel-limit - (erc-channel-user-op-p (erc-current-nick))] - ["Set a key..." erc-set-channel-key - (erc-channel-user-op-p (erc-current-nick))]) - ["Leave this channel..." erc-part-from-channel erc-channel-users] "-" + (list + "Current channel" + ["List users in channel" erc-channel-names erc-channel-users] + ["List channel operators" erc-cmd-OPS erc-channel-users] + ["Set topic..." erc-set-topic + (and (and (erc-default-target) (not (erc-query-buffer-p))) + (or (not (member "t" erc-channel-modes)) + (erc-channel-user-op-p (erc-current-nick))))] + (list "Channel modes" + ["Change mode..." erc-insert-mode-command + (erc-channel-user-op-p (erc-current-nick))] + ["No external send" (erc-toggle-channel-mode "n") + :active (erc-channel-user-op-p (erc-current-nick)) + :style toggle :selected (member "n" erc-channel-modes)] + ["Topic set by channel operator" (erc-toggle-channel-mode "t") + :style toggle :selected (member "t" erc-channel-modes) + :active (erc-channel-user-op-p (erc-current-nick))] + ["Invite only" (erc-toggle-channel-mode "i") + :style toggle :selected (member "i" erc-channel-modes) + :active (erc-channel-user-op-p (erc-current-nick))] + ["Private" (erc-toggle-channel-mode "p") + :style toggle :selected (member "p" erc-channel-modes) + :active (erc-channel-user-op-p (erc-current-nick))] + ["Secret" (erc-toggle-channel-mode "s") + :style toggle :selected (member "s" erc-channel-modes) + :active (erc-channel-user-op-p (erc-current-nick))] + ["Moderated" (erc-toggle-channel-mode "m") + :style toggle :selected (member "m" erc-channel-modes) + :active (erc-channel-user-op-p (erc-current-nick))] + ["Set a limit..." erc-set-channel-limit + (erc-channel-user-op-p (erc-current-nick))] + ["Set a key..." erc-set-channel-key + (erc-channel-user-op-p (erc-current-nick))]) + ["Leave this channel..." erc-part-from-channel erc-channel-users] + "-") (list "Pals, fools and other keywords" ["Add pal..." erc-add-pal] ["Delete pal..." erc-delete-pal] @@ -98,16 +100,46 @@ ["Show ERC version" erc-version t]) "ERC menu definition.") -;; `erc-mode-map' must be defined before doing this -(eval-after-load "erc" - '(progn - (easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition) - (easy-menu-add erc-menu erc-mode-map) +(defvar erc-menu-defined nil + "Internal variable used to keep track of whether we've defined the +ERC menu yet.") - ;; for some reason the menu isn't automatically added to the menu bar - (when (featurep 'xemacs) - (add-hook 'erc-mode-hook - (lambda () (easy-menu-add erc-menu erc-mode-map)))))) +;;;###autoload (autoload 'erc-menu-mode "erc-menu" nil t) +(define-erc-module menu nil + "Enable a menu in ERC buffers." + ((unless erc-menu-defined + ;; make sure the menu only gets defined once, since Emacs 22 + ;; activates it immediately + (easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition) + (setq erc-menu-defined t)) + (if (featurep 'xemacs) + (progn + ;; the menu isn't automatically added to the menu bar in + ;; XEmacs + (add-hook 'erc-mode-hook 'erc-menu-add) + (dolist (buffer (erc-buffer-list)) + (with-current-buffer buffer (erc-menu-add)))) + (erc-menu-add))) + ((if (featurep 'xemacs) + (progn + (remove-hook 'erc-mode-hook 'erc-menu-add) + (dolist (buffer (erc-buffer-list)) + (with-current-buffer buffer (erc-menu-remove)))) + (erc-menu-remove) + ;; `easy-menu-remove' is a no-op in Emacs 22 + (message "You might have to restart Emacs to remove the ERC menu")))) + +;; silence byte-compiler warning +(eval-when-compile + (defvar erc-menu nil)) + +(defun erc-menu-add () + "Add the ERC menu to the current buffer." + (easy-menu-add erc-menu erc-mode-map)) + +(defun erc-menu-remove () + "Remove the ERC menu from the current buffer." + (easy-menu-remove erc-menu)) (provide 'erc-menu) diff --git a/lisp/erc/erc-netsplit.el b/lisp/erc/erc-netsplit.el index 72e7b8bbd7f..567c91cc075 100644 --- a/lisp/erc/erc-netsplit.el +++ b/lisp/erc/erc-netsplit.el @@ -1,6 +1,6 @@ ;;; erc-netsplit.el --- Reduce JOIN/QUIT messages on netsplits -;; Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Mario Lang <mlang@delysid.org> ;; Keywords: comm diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el index 99aba31c3d4..9f8c5528d04 100644 --- a/lisp/erc/erc-networks.el +++ b/lisp/erc/erc-networks.el @@ -1,6 +1,6 @@ ;;; erc-networks.el --- IRC networks -;; Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ;; Author: Mario Lang <mlang@lexx.delysid.org> ;; Keywords: comm @@ -64,6 +64,7 @@ ("AngelEyez: Random server" AngelEyez "irc.angeleyez.net" ((6666 7000))) ("AnotherNet: Random server" Anothernet "irc.another.net" (6667 7000 )) ("ArabChat: Random server" ArabChat "irc.arabchat.org" ((6660 6667))) + ("Ars-OpenIRC: Random server" Ars "irc.arstechnica.com" 6667) ("AsiaTalk: Random server" AsiaTalk "irc.asiatalk.org" ((6667 6669) 7000 )) ("AstroLink: Random server" AstroLink "irc.astrolink.org" ((6660 6667))) ("Asylumnet: Random server" Asylumnet "irc.asylum-net.org" ((6661 6669) 7000 7777 )) @@ -280,12 +281,12 @@ ("K0wNet: Random server" K0wNet "irc.k0w.net" ((6660 6669))) ("KDFSnet: Random server" KDFSnet "irc.kdfs.net" ((6667 6669))) ("Kemik: Random server" Kemik "irc.kemik.net" 6667) - ("Kewl.Org: Random server" Kewl.Org "irc.kewl.org" (6667 7000 )) + ("Kewl.Org: Random server" Kewl\.Org "irc.kewl.org" (6667 7000 )) ("Kickchat: Random server" Kickchat "irc.kickchat.com" ((6660 6669) 7000 )) ("Kidsworld: Random server" KidsWorld "irc.kidsworld.org" ((6666 6669))) ("Knightnet: AF, ZA, Durban" Knightnet "orc.dbn.za.knightnet.net" (6667 5555 )) ("Knightnet: US, CA, Goldengate" Knightnet "goldengate.ca.us.knightnet.net" (6667 5555 )) - ("Konfido.Net: Random server" Konfido.Net "irc.konfido.net" 6667) + ("Konfido.Net: Random server" Konfido\.Net "irc.konfido.net" 6667) ("KreyNet: Random server" Kreynet "irc.krey.net" 6667) ("Krono: Random server" Krono "irc.krono.net" ((6660 6669) 7000 )) ("Krushnet: Random server" Krushnet "irc.krushnet.org" 6667) @@ -294,6 +295,7 @@ ("LagNet: AF, ZA, Johannesburg" LagNet "mystery.lagnet.org.za" 6667) ("Librenet: Random server" Librenet "irc.librenet.net" 6667) ("LinkNet: Random server" LinkNet "irc.link-net.org" ((6667 6669))) + ("LinuxChix: Random server" LinuxChix "irc.linuxchix.org" 6667) ("Liquidized: Random server" Liquidized "irc.liquidized.net" (6667 7000 )) ("M-IRC: Random server" M-IRC "irc.m-sys.org" ((6667 6669))) ("MagicStar: Random server" MagicStar "irc.magicstar.net" 6667) @@ -457,6 +459,7 @@ PORTS is either a number, a list of numbers, or a list of port ranges." (AngelEyez "angeleyez.net") (Anothernet "another.net") (ArabChat "arabchat.org") + (Ars "arstechnica.com") (AsiaTalk "asiatalk.org") (AstroLink "astrolink.org") (Asylumnet "asylumnet.org") @@ -586,6 +589,7 @@ PORTS is either a number, a list of numbers, or a list of port ranges." (LagNet "lagnet.org.za") (Librenet "librenet.net") (LinkNet "link-net.org") + (LinuxChix "cats\.meow\.at\\|linuxchix\.org") (Liquidized "liquidized.net") (M-IRC "m-sys.org") (MagicStar "magicstar.net") diff --git a/lisp/erc/erc-nicklist.el b/lisp/erc/erc-nicklist.el index 7a94d2be9cc..f37b8eab996 100644 --- a/lisp/erc/erc-nicklist.el +++ b/lisp/erc/erc-nicklist.el @@ -1,6 +1,6 @@ ;;; erc-nicklist.el --- Display channel nicknames in a side buffer. -;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ;; Filename: erc-nicklist.el ;; Author: Lawrence Mitchell <wence@gmx.li> diff --git a/lisp/erc/erc-notify.el b/lisp/erc/erc-notify.el index bb1c9cdceb3..82784c624c0 100644 --- a/lisp/erc/erc-notify.el +++ b/lisp/erc/erc-notify.el @@ -1,6 +1,6 @@ ;;; erc-notify.el --- Online status change notification -;; Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Mario Lang <mlang@lexx.delysid.org> ;; Keywords: comm diff --git a/lisp/erc/erc-page.el b/lisp/erc/erc-page.el index 4c6b86bd564..de13c6037a6 100644 --- a/lisp/erc/erc-page.el +++ b/lisp/erc/erc-page.el @@ -1,6 +1,6 @@ ;; erc-page.el - CTCP PAGE support for ERC -;; Copyright (C) 2002, 2004, 2006 Free Software Foundation +;; Copyright (C) 2002, 2004, 2006, 2007 Free Software Foundation ;; This file is part of GNU Emacs. diff --git a/lisp/erc/erc-pcomplete.el b/lisp/erc/erc-pcomplete.el index 33231ee2590..951ba25898c 100644 --- a/lisp/erc/erc-pcomplete.el +++ b/lisp/erc/erc-pcomplete.el @@ -1,6 +1,6 @@ ;;; erc-pcomplete.el --- Provides programmable completion for ERC -;; Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Sacha Chua <sacha@free.net.ph> ;; Keywords: comm, convenience diff --git a/lisp/erc/erc-replace.el b/lisp/erc/erc-replace.el index 7a22954f171..5e63f8d7d4f 100644 --- a/lisp/erc/erc-replace.el +++ b/lisp/erc/erc-replace.el @@ -1,6 +1,6 @@ ;; erc-replace.el -- wash and massage messages inserted into the buffer -;; Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2002, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Andreas Fuchs <asf@void.at> ;; Maintainer: Mario Lang (mlang@delysid.org) diff --git a/lisp/erc/erc-ring.el b/lisp/erc/erc-ring.el index 87707e65faa..911a154e915 100644 --- a/lisp/erc/erc-ring.el +++ b/lisp/erc/erc-ring.el @@ -1,6 +1,6 @@ ;; erc-ring.el -- Command history handling for erc using ring.el -;; Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Alex Schroeder <alex@gnu.org> ;; Keywords: comm diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el index c8bac7fe45c..5d03a7b6365 100644 --- a/lisp/erc/erc-services.el +++ b/lisp/erc/erc-services.el @@ -1,6 +1,6 @@ ;;; erc-services.el --- Identify to NickServ -;; Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -77,6 +77,29 @@ This group allows you to set variables to somewhat automate communication with those Services." :group 'erc) +(defcustom erc-nickserv-identify-mode 'both + "The mode which is used when identifying to Nickserv. + +Possible settings are:. + +'autodetect - Identify when the real Nickserv sends an identify request. +'nick-change - Identify when you log in or change your nickname. +'both - Do the former if the network supports it, otherwise do the + latter. +nil - Disables automatic Nickserv identification. + +You can also use M-x erc-nickserv-identify-mode to change modes." + :group 'erc-services + :type '(choice (const autodetect) + (const nick-change) + (const both) + (const nil)) + :set (lambda (sym val) + (set sym val) + ;; avoid recursive load at startup + (when (featurep 'erc-services) + (erc-nickserv-identify-mode val)))) + ;;;###autoload (autoload 'erc-services-mode "erc-services" nil t) (define-erc-module services nickserv "This mode automates communication with services." @@ -94,7 +117,7 @@ communication with those Services." (interactive (list (intern (completing-read "Choose Nickserv identify mode (RET to disable): " - '(("autodetect") ("nick-change")) nil t)))) + '(("autodetect") ("nick-change") ("both")) nil t)))) (cond ((eq mode 'autodetect) (setq erc-nickserv-identify-mode 'autodetect) (add-hook 'erc-server-NOTICE-functions @@ -111,6 +134,14 @@ communication with those Services." 'erc-nickserv-identify-on-nick-change) (remove-hook 'erc-server-NOTICE-functions 'erc-nickserv-identify-autodetect)) + ((eq mode 'both) + (setq erc-nickserv-identify-mode 'both) + (add-hook 'erc-server-NOTICE-functions + 'erc-nickserv-identify-autodetect) + (add-hook 'erc-after-connect + 'erc-nickserv-identify-on-connect) + (add-hook 'erc-nick-changed-functions + 'erc-nickserv-identify-on-nick-change)) (t (setq erc-nickserv-identify-mode nil) (remove-hook 'erc-server-NOTICE-functions @@ -120,24 +151,6 @@ communication with those Services." (remove-hook 'erc-nick-changed-functions 'erc-nickserv-identify-on-nick-change)))) -(defcustom erc-nickserv-identify-mode 'autodetect - "The mode which is used when identifying to Nickserv. - -Possible settings are:. - -'autodetect - Identify when the real Nickserv sends an identify request. -'nick-change - Identify when you change your nickname. -nil - Disables automatic Nickserv identification. - -You can also use M-x erc-nickserv-identify-mode to change modes." - :group 'erc-services - :type '(choice (const autodetect) - (const nick-change) - (const nil)) - :set (lambda (sym val) - (set-default sym val) - (erc-nickserv-identify-mode val))) - (defcustom erc-prompt-for-nickserv-password t "Ask for the password when identifying to NickServ." :group 'erc-services @@ -156,12 +169,14 @@ Example of use: (list :tag "Network" (choice :tag "Network name" (const freenode) + (const OFTC) (const DALnet) (const GalaxyNet) (const SlashNET) (const BRASnet) (const iip) (const Austnet) + (const Azzurra) (symbol :tag "Network name")) (repeat :tag "Nickname and password" (cons :tag "Identity" @@ -171,7 +186,13 @@ Example of use: ;; Variables: (defcustom erc-nickserv-alist - '((DALnet + '((BitlBee + nil + nil + "&bitlbee" + "identify" + nil) + (DALnet "NickServ!service@dal.net" "/msg\\s-NickServ@services.dal.net\\s-IDENTIFY\\s-<password>" "NickServ@services.dal.net" @@ -209,24 +230,24 @@ Example of use: "IDENTIFY" nil "") - (Austnet - "NickOP!service@austnet.org" - "/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>" - "nickop@austnet.org" - "identify" - nil) - (Azzurra - "NickServ!service@azzurra.org" - "/ns\\s-IDENTIFY\\s-password" - "NickServ" - "IDENTIFY" - nil) - (OFTC - "NickServ!services@services.oftc.net" - "/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password" - "NickServ" - "IDENTIFY" - nil)) + (Austnet + "NickOP!service@austnet.org" + "/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>" + "nickop@austnet.org" + "identify" + nil) + (Azzurra + "NickServ!service@azzurra.org" + "/ns\\s-IDENTIFY\\s-password" + "NickServ" + "IDENTIFY" + nil) + (OFTC + "NickServ!services@services.oftc.net" + "/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password" + "NickServ" + "IDENTIFY" + nil)) "Alist of NickServer details, sorted by network. Every element in the list has the form \(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER) @@ -253,6 +274,24 @@ ANSWER is the command to use for the answer. The default is 'privmsg. (string :tag "Command") (const :tag "No special command necessary" nil))))) +(defsubst erc-nickserv-alist-sender (network &optional entry) + (nth 1 (or entry (assoc network erc-nickserv-alist)))) + +(defsubst erc-nickserv-alist-regexp (network &optional entry) + (nth 2 (or entry (assoc network erc-nickserv-alist)))) + +(defsubst erc-nickserv-alist-nickserv (network &optional entry) + (nth 3 (or entry (assoc network erc-nickserv-alist)))) + +(defsubst erc-nickserv-alist-ident-keyword (network &optional entry) + (nth 4 (or entry (assoc network erc-nickserv-alist)))) + +(defsubst erc-nickserv-alist-use-nick-p (network &optional entry) + (nth 5 (or entry (assoc network erc-nickserv-alist)))) + +(defsubst erc-nickserv-alist-ident-command (network &optional entry) + (nth 6 (or entry (assoc network erc-nickserv-alist)))) + ;; Functions: (defun erc-nickserv-identify-autodetect (proc parsed) @@ -264,14 +303,14 @@ password for this nickname, otherwise try to send it automatically." (unless (and (null erc-nickserv-passwords) (null erc-prompt-for-nickserv-password)) (let* ((network (erc-network)) - (nickserv (nth 1 (assoc network erc-nickserv-alist))) - (identify-regex (nth 2 (assoc network erc-nickserv-alist))) + (sender (erc-nickserv-alist-sender network)) + (identify-regex (erc-nickserv-alist-regexp network)) (sspec (erc-response.sender parsed)) (nick (car (erc-response.command-args parsed))) (msg (erc-response.contents parsed))) ;; continue only if we're sure it's the real nickserv for this network ;; and it's asked us to identify - (when (and nickserv (equal sspec nickserv) + (when (and sender (equal sspec sender) (string-match identify-regex msg)) (erc-log "NickServ IDENTIFY request detected") (erc-nickserv-call-identify-function nick) @@ -279,14 +318,18 @@ password for this nickname, otherwise try to send it automatically." (defun erc-nickserv-identify-on-connect (server nick) "Identify to Nickserv after the connection to the server is established." - (unless (and (null erc-nickserv-passwords) - (null erc-prompt-for-nickserv-password)) + (unless (or (and (null erc-nickserv-passwords) + (null erc-prompt-for-nickserv-password)) + (and (eq erc-nickserv-identify-mode 'both) + (erc-nickserv-alist-regexp (erc-network)))) (erc-nickserv-call-identify-function nick))) (defun erc-nickserv-identify-on-nick-change (nick old-nick) "Identify to Nickserv whenever your nick changes." - (unless (and (null erc-nickserv-passwords) - (null erc-prompt-for-nickserv-password)) + (unless (or (and (null erc-nickserv-passwords) + (null erc-prompt-for-nickserv-password)) + (and (eq erc-nickserv-identify-mode 'both) + (erc-nickserv-alist-regexp (erc-network)))) (erc-nickserv-call-identify-function nick))) (defun erc-nickserv-call-identify-function (nickname) @@ -316,12 +359,16 @@ When called interactively, read the password using `read-passwd'." (let* ((erc-auto-discard-away nil) (network (erc-network)) (nickserv-info (assoc network erc-nickserv-alist)) - (nickserv (or (nth 3 nickserv-info) "NickServ")) - (identify-word (or (nth 4 nickserv-info) "IDENTIFY")) - (nick (if (nth 5 nickserv-info) + (nickserv (or (erc-nickserv-alist-nickserv nil nickserv-info) + "NickServ")) + (identify-word (or (erc-nickserv-alist-ident-keyword + nil nickserv-info) + "IDENTIFY")) + (nick (if (erc-nickserv-alist-use-nick-p nil nickserv-info) (concat (erc-current-nick) " ") "")) - (msgtype (or (nth 6 nickserv-info) "PRIVMSG"))) + (msgtype (or (erc-nickserv-alist-ident-command nil nickserv-info) + "PRIVMSG"))) (erc-message msgtype (concat nickserv " " identify-word " " nick password))))) diff --git a/lisp/erc/erc-sound.el b/lisp/erc/erc-sound.el index e152d8ed0df..fdac1cc3be0 100644 --- a/lisp/erc/erc-sound.el +++ b/lisp/erc/erc-sound.el @@ -1,6 +1,6 @@ ;;; erc-sound.el --- CTCP SOUND support for ERC -;; Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2006, 2007 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el index 55e24782f77..551b83fb5ac 100644 --- a/lisp/erc/erc-speedbar.el +++ b/lisp/erc/erc-speedbar.el @@ -1,6 +1,6 @@ ;;; erc-speedbar.el --- Speedbar support for ERC -;; Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Mario Lang <mlang@delysid.org> ;; Contributor: Eric M. Ludlam <eric@siege-engine.com> diff --git a/lisp/erc/erc-spelling.el b/lisp/erc/erc-spelling.el index 7ed0f510539..484ddb36d52 100644 --- a/lisp/erc/erc-spelling.el +++ b/lisp/erc/erc-spelling.el @@ -1,6 +1,6 @@ ;;; erc-spelling.el --- use flyspell in ERC -;; Copyright (C) 2005, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. ;; Author: Jorgen Schaefer <forcer@forcix.cx> ;; Keywords: irc diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el index b0622b99443..5a9977aaead 100644 --- a/lisp/erc/erc-stamp.el +++ b/lisp/erc/erc-stamp.el @@ -1,6 +1,6 @@ ;;; erc-stamp.el --- Timestamping for ERC messages -;; Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Mario Lang <mlang@delysid.org> ;; Keywords: comm, processes, timestamp diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index 3c8f93acfc2..0fa550a5838 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -1,6 +1,6 @@ ;;; erc-track.el --- Track modified channel buffers -;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ;; Author: Mario Lang <mlang@delysid.org> ;; Keywords: comm, faces @@ -773,10 +773,6 @@ is in `erc-mode'." str) (erc-faces-in str))) -(defun erc-find-parsed-property () - "Find the next occurrence of the `erc-parsed' text property." - (text-property-not-all (point-min) (point-max) 'erc-parsed nil)) - ;;; Buffer switching (defvar erc-track-last-non-erc-buffer nil diff --git a/lisp/erc/erc-truncate.el b/lisp/erc/erc-truncate.el index 76475ab8ee5..440dc870e2c 100644 --- a/lisp/erc/erc-truncate.el +++ b/lisp/erc/erc-truncate.el @@ -1,6 +1,6 @@ ;;; erc-truncate.el --- Functions for truncating ERC buffers -;; Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Andreas Fuchs <asf@void.at> ;; Keywords: IRC, chat, client, Internet, logging diff --git a/lisp/erc/erc-xdcc.el b/lisp/erc/erc-xdcc.el index d00dfc5e1a0..ea1fa27bf4b 100644 --- a/lisp/erc/erc-xdcc.el +++ b/lisp/erc/erc-xdcc.el @@ -1,6 +1,6 @@ ;;; erc-xdcc.el --- XDCC file-server support for ERC -;; Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc. ;; Author: Mario Lang <mlang@delysid.org> ;; Keywords: comm, processes diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 7de2828b86d..927dce02d64 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1,7 +1,7 @@ ;; erc.el --- An Emacs Internet Relay Chat client ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -;; 2006 Free Software Foundation, Inc. +;; 2006, 2007 Free Software Foundation, Inc. ;; Author: Alexander L. Belikoff (alexander@belikoff.net) ;; Contributors: Sergey Berezin (sergey.berezin@cs.cmu.edu), @@ -74,7 +74,6 @@ (require 'pp) (require 'thingatpt) (require 'erc-compat) -(require 'erc-menu) (defvar erc-official-location "http://emacswiki.org/cgi-bin/wiki/ERC (mailing list: erc-discuss@gnu.org)" @@ -356,6 +355,17 @@ nicknames with erc-server-user struct instances.") (cdr (assq (aref s (match-beginning 0)) c))))) s)) +(defmacro erc-with-server-buffer (&rest body) + "Execute BODY in the current ERC server buffer. +If no server buffer exists, return nil." + (let ((buffer (make-symbol "buffer"))) + `(let ((,buffer (erc-server-buffer))) + (when (buffer-live-p ,buffer) + (with-current-buffer ,buffer + ,@body))))) +(put 'erc-with-server-buffer 'lisp-indent-function 0) +(put 'erc-with-server-buffer 'edebug-form-spec '(body)) + (defstruct (erc-server-user (:type vector) :named) ;; User data nickname host login full-name info @@ -782,6 +792,13 @@ set if some hacker is trying to flood you away." :group 'erc :type 'string) +(defcustom erc-system-name nil + "Use this as the name of your system. +If nil, ERC will call `system-name' to get this information." + :group 'erc + :type '(choice (const :tag "Default system name" nil) + string)) + (defcustom erc-ignore-list nil "*List of regexps matching user identifiers to ignore. @@ -1333,6 +1350,14 @@ If BUFFER is nil, the current buffer is used." (and (eq major-mode 'erc-mode) (null (erc-default-target))))) +(defun erc-open-server-buffer-p (&optional buffer) + "Return non-nil if argument BUFFER is an ERC server buffer that +has an open IRC process. + +If BUFFER is nil, the current buffer is used." + (and (erc-server-buffer-p) + (erc-server-process-alive))) + (defun erc-query-buffer-p (&optional buffer) "Return non-nil if BUFFER is an ERC query buffer. If BUFFER is nil, the current buffer is used." @@ -1672,21 +1697,22 @@ needs to be active for this function to work." (require 'iswitchb)) (let ((enabled iswitchb-mode)) (or enabled (iswitchb-mode 1)) - (let ((iswitchb-make-buflist-hook - (lambda () - (setq iswitchb-temp-buflist - (mapcar 'buffer-name - (erc-buffer-list - nil - (when arg erc-server-process))))))) - (switch-to-buffer - (iswitchb-read-buffer - "Switch-to: " - (if (boundp 'erc-modified-channels-alist) - (buffer-name (caar (last erc-modified-channels-alist))) - nil) - t))) - (or enabled (iswitchb-mode -1)))) + (unwind-protect + (let ((iswitchb-make-buflist-hook + (lambda () + (setq iswitchb-temp-buflist + (mapcar 'buffer-name + (erc-buffer-list + nil + (when arg erc-server-process))))))) + (switch-to-buffer + (iswitchb-read-buffer + "Switch-to: " + (if (boundp 'erc-modified-channels-alist) + (buffer-name (caar (last erc-modified-channels-alist))) + nil) + t))) + (or enabled (iswitchb-mode -1))))) (defun erc-channel-list (proc) "Return a list of channel buffers. @@ -1763,7 +1789,7 @@ all channel buffers on all servers." (defcustom erc-modules '(netsplit fill button match track completion readonly ring autojoin noncommands irccontrols - stamp) + stamp menu) "A list of modules which ERC should enable. If you set the value of this without using `customize' remember to call \(erc-update-modules) after you change it. When using `customize', modules @@ -1790,17 +1816,21 @@ removed from the list will be disabled." (const :tag "Set away status automatically" autoaway) (const :tag "Join channels automatically" autojoin) (const :tag "Buttonize URLs, nicknames, and other text" button) + (const + :tag + "Mark unidentified users on freenode and other servers supporting CAPAB" + capab-identify) (const :tag "Wrap long lines" fill) (const :tag "Launch an identd server on port 8113" identd) (const :tag "Highlight or remove IRC control characters" irccontrols) (const :tag "Save buffers in logs" log) (const :tag "Highlight pals, fools, and other keywords" match) + (const :tag "Display a menu in ERC buffers" menu) (const :tag "Detect netsplits" netsplit) (const :tag "Don't display non-IRC commands after evaluation" noncommands) - (const :tag - "Notify when the online status of certain users changes" + (const :tag "Notify when the online status of certain users changes" notify) (const :tag "Complete nicknames and commands (programmable)" completion) @@ -1830,6 +1860,8 @@ removed from the list will be disabled." (setq req (concat "erc-" (symbol-name mod))) (cond ;; yuck. perhaps we should bring the filenames into sync? + ((string= req "erc-capab-identify") + (setq req "erc-capab")) ((string= req "erc-completion") (setq req "erc-pcomplete")) ((string= req "erc-pcomplete") @@ -1888,10 +1920,12 @@ Returns the buffer for the given server or channel." (connected-p (unless connect erc-server-connected)) (buffer (erc-get-buffer-create server port channel)) (old-buffer (current-buffer)) - (old-point (point)) + old-point continued-session) + (when connect (run-hook-with-args 'erc-before-connect server port nick)) (erc-update-modules) (set-buffer buffer) + (setq old-point (point)) (erc-mode) (setq erc-server-announced-name server-announced-name) (setq erc-server-connected connected-p) @@ -2102,8 +2136,6 @@ server and full-name will be set to those values, whereas `erc-compute-port', `erc-compute-nick' and `erc-compute-full-name' will be invoked for the values of the other parameters." (interactive (erc-select-read-args)) - - (run-hook-with-args 'erc-before-connect server port nick) (erc-open server port nick full-name t password)) (defalias 'erc-select 'erc) @@ -3165,6 +3197,12 @@ the message given by REASON." (defalias 'erc-cmd-GQ 'erc-cmd-GQUIT) (put 'erc-cmd-GQUIT 'do-not-parse-args t) +(defun erc-cmd-RECONNECT () + "Try to reconnect to the current IRC server." + (setq erc-server-reconnect-count 0) + (erc-server-reconnect) + t) + (defun erc-cmd-SERVER (server) "Connect to SERVER, leaving existing connection intact." (erc-log (format "cmd: SERVER: %s" server)) @@ -4292,8 +4330,10 @@ See also `erc-display-message'." nil) (defun erc-process-away (proc away-p) - ;; FIXME: This docstring is AWFUL -- Lawrence 2004-01-08 - "Process the user being away, or returning from an away break." + "Toggle the away status of the user depending on the value of AWAY-P. + +If nil, set the user as away. +If non-nil, return from being away." (let ((sessionbuf (process-buffer proc))) (when sessionbuf (with-current-buffer sessionbuf @@ -4873,6 +4913,9 @@ Specifically, return the position of `erc-insert-marker'." erc-input-marker (erc-end-of-input-line))) +(defvar erc-command-regexp "^/\\([A-Za-z]+\\)\\(\\s-+.*\\|\\s-*\\)$" + "Regular expression used for matching commands in ERC.") + (defun erc-send-input (input) "Treat INPUT as typed in by the user. It is assumed that the input and the prompt is already deleted. @@ -4894,7 +4937,7 @@ This returns non-nil only iff we actually send anything." (run-hook-with-args 'erc-send-pre-hook input) (when erc-send-this (if (or (string-match "\n" str) - (not (char-equal (aref str 0) ?/))) + (not (string-match erc-command-regexp str))) (mapc (lambda (line) (mapc @@ -4959,7 +5002,7 @@ current position." "Extract command and args from the input LINE. If no command was given, return nil. If command matches, return a list of the form: (command args) where both elements are strings." - (when (string-match "^/\\([A-Za-z]+\\)\\(\\s-+.*\\|\\s-*\\)$" line) + (when (string-match erc-command-regexp line) (let* ((cmd (erc-command-symbol (match-string 1 line))) ;; note: return is nil, we apply this simply for side effects (canon-defun (while (and cmd (symbolp (symbol-function cmd))) @@ -5398,7 +5441,7 @@ user input." (erc-log (format "login: nick: %s, user: %s %s %s :%s" (erc-current-nick) (user-login-name) - (system-name) + (or erc-system-name (system-name)) erc-session-server erc-session-user-full-name)) (if erc-session-password @@ -5647,6 +5690,7 @@ of `mode-line-buffer-identification'. The following characters are replaced: %a: String indicating away status or \"\" if you are not away +%l: The estimated lag time to the server %m: The modes of the channel %n: The current nick name %o: The topic of the channel @@ -5658,9 +5702,9 @@ The following characters are replaced: :group 'erc-mode-line-and-header :type 'string) -(defcustom erc-header-line-format "[IRC] %n on %t %m %o" +(defcustom erc-header-line-format "%n on %t (%m,%l) %o" "A string to be formatted and shown in the header-line in `erc-mode'. -Only used in Emacs 21. +Only used starting in Emacs 21. See `erc-mode-line-format' for which characters are can be used." :group 'erc-mode-line-and-header @@ -5750,33 +5794,37 @@ if `erc-away' is non-nil." ""))) (defun erc-format-channel-modes () - "Return the current channel's modes and the estimated lag." + "Return the current channel's modes." + (concat (apply 'concat + "+" erc-channel-modes) + (cond ((and erc-channel-user-limit erc-channel-key) + (if erc-show-channel-key-p + (format "lk %.0f %s" erc-channel-user-limit + erc-channel-key) + (format "kl %.0f" erc-channel-user-limit))) + (erc-channel-user-limit + ;; Emacs has no bignums + (format "l %.0f" erc-channel-user-limit)) + (erc-channel-key + (if erc-show-channel-key-p + (format "k %s" erc-channel-key) + "k")) + (t nil)))) + +(defun erc-format-lag-time () + "Return the estimated lag time to server, `erc-server-lag'." (let ((lag (when (erc-server-buffer-live-p) (with-current-buffer (process-buffer erc-server-process) erc-server-lag)))) - (concat (apply 'concat - "(+" erc-channel-modes) - (cond ((and erc-channel-user-limit erc-channel-key) - (if erc-show-channel-key-p - (format "lk %.0f %s" erc-channel-user-limit - erc-channel-key) - (format "kl %.0f" erc-channel-user-limit))) - (erc-channel-user-limit - ;; Emacs has no bignums - (format "l %.0f" erc-channel-user-limit)) - (erc-channel-key - (if erc-show-channel-key-p - (format "k %s" erc-channel-key) - "k")) - (t "")) - (if lag (format ",lag:%.0f" lag) "") - ")"))) + (cond (lag (format "lag:%.0f" lag)) + (t "")))) (defun erc-update-mode-line-buffer (buffer) "Update the mode line in a single ERC buffer BUFFER." (with-current-buffer buffer (let ((spec (format-spec-make ?a (erc-format-away-status) + ?l (erc-format-lag-time) ?m (erc-format-channel-modes) ?n (or (erc-current-nick) "") ?o (erc-controls-strip erc-channel-topic) @@ -5823,7 +5871,10 @@ if `erc-away' is non-nil." (erc-propertize header 'help-echo help-echo 'face face) (erc-propertize header 'help-echo help-echo)))))) - (t (setq header-line-format header)))))) + (t (setq header-line-format + (if face + (erc-propertize header 'face face) + header))))))) (if (featurep 'xemacs) (redraw-modeline) (force-mode-line-update)))) @@ -6177,6 +6228,10 @@ This function should be on `erc-kill-channel-hook'." ;;; Dealing with `erc-parsed' +(defun erc-find-parsed-property () + "Find the next occurrence of the `erc-parsed' text property." + (text-property-not-all (point-min) (point-max) 'erc-parsed nil)) + (defun erc-get-parsed-vector (point) "Return the whole parsed vector on POINT." (get-text-property point 'erc-parsed)) |