diff options
Diffstat (limited to 'lisp/erc')
-rw-r--r-- | lisp/erc/ChangeLog | 671 | ||||
-rw-r--r-- | lisp/erc/ChangeLog.07 | 839 | ||||
-rw-r--r-- | lisp/erc/erc-autoaway.el | 3 | ||||
-rw-r--r-- | lisp/erc/erc-backend.el | 277 | ||||
-rw-r--r-- | lisp/erc/erc-button.el | 28 | ||||
-rw-r--r-- | lisp/erc/erc-compat.el | 63 | ||||
-rw-r--r-- | lisp/erc/erc-dcc.el | 147 | ||||
-rw-r--r-- | lisp/erc/erc-goodies.el | 99 | ||||
-rw-r--r-- | lisp/erc/erc-ibuffer.el | 8 | ||||
-rw-r--r-- | lisp/erc/erc-identd.el | 3 | ||||
-rw-r--r-- | lisp/erc/erc-lang.el | 2 | ||||
-rw-r--r-- | lisp/erc/erc-list.el | 229 | ||||
-rw-r--r-- | lisp/erc/erc-log.el | 105 | ||||
-rw-r--r-- | lisp/erc/erc-match.el | 2 | ||||
-rw-r--r-- | lisp/erc/erc-netsplit.el | 15 | ||||
-rw-r--r-- | lisp/erc/erc-networks.el | 16 | ||||
-rw-r--r-- | lisp/erc/erc-notify.el | 3 | ||||
-rw-r--r-- | lisp/erc/erc-page.el | 8 | ||||
-rw-r--r-- | lisp/erc/erc-replace.el | 11 | ||||
-rw-r--r-- | lisp/erc/erc-services.el | 107 | ||||
-rw-r--r-- | lisp/erc/erc-sound.el | 12 | ||||
-rw-r--r-- | lisp/erc/erc-stamp.el | 84 | ||||
-rw-r--r-- | lisp/erc/erc-track.el | 252 | ||||
-rw-r--r-- | lisp/erc/erc-xdcc.el | 13 | ||||
-rw-r--r-- | lisp/erc/erc.el | 455 |
25 files changed, 2568 insertions, 884 deletions
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index 061bfc55444..fc230ddbe0e 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,393 +1,330 @@ +2008-02-20 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-notice-face): Fix this face for Emacs 21 users. + 2008-02-05 Juanma Barranquero <lekktu@gmail.com> * erc.el (erc-valid-nick-regexp): * erc-button.el (erc-button-syntax-table): * erc-match.el (erc-match-syntax-table): Replace `legal' with `valid'. -2007-11-15 Juanma Barranquero <lekktu@gmail.com> - - * erc.el (erc-open): - * erc-backend.el (define-erc-response-handler): - * erc-log.el (log): - * erc-match.el (erc-log-matches): Fix typos in docstrings. - -2007-08-08 Glenn Morris <rgm@gnu.org> - - * erc-log.el, erc.el: Replace `iff' in doc-strings and comments. - -2007-07-30 Michael Olson <mwolson@gnu.org> - - * erc-nicklist.el: Remove from the Emacs source tree. This file - is not release quality, and relies heavily on a module which - cannot be distributed with ERC due to licensing reasons. - -2007-07-25 Glenn Morris <rgm@gnu.org> - - * Relicense all FSF files to GPLv3 or later. - -2007-06-07 Juanma Barranquero <lekktu@gmail.com> - - * erc.el (erc-startup-file-list): Fix typo in docstring. - -2007-06-06 Juanma Barranquero <lekktu@gmail.com> - - * erc.el (erc-show-channel-key-p): Fix typo in docstring. - -2007-04-01 Michael Olson <mwolson@gnu.org> - - * erc.el (erc-version-string): Release ERC 5.2. - - * erc-auto.in, erc-chess.el, erc-list.el, erc-speak.el: - * erc-viper.el: Update copyright notices. - - * erc.texi: Make Emacs Lisp source code in this document - essentially public domain. Update version to 5.2. - (Obtaining ERC): Mention extras tarball. - (Releases): Mention local GNU mirror. - (Sample Configuration): Remove notice. - - * FOR-RELEASE (5.3): Add item for erc-nicklist. - Mark NEWS as done. Mark extras tarball as done. - - * Makefile (VERSION): Increment to 5.2. - (TESTING): Remove. - (EXTRAS): New variable containing the contents of our "Emacs 22 - extras" tarball. - (SOURCE): Remove $(TESTING). - (MISC): Add COPYING and ChangeLog.06. Fix ChangeLog.NNNN -> - ChangeLog.NN. - (release): Use $(SNAPDIR) instead of erc-$(VERSION). - (extras): New rule which implements the building of the extras - tarball. - (upload-extras): New rule to upload the extras tarball. It's - yucky to replicate upload, but oh well. - - * NEWS: Mention extras tarball. Note which files have been - renamed. Note that erc-list is enabled by default, except in - Emacs 22. - - * README.extras: New file which serves as a README for the extras - tarball. - -2007-03-31 Michael Olson <mwolson@gnu.org> - - * NEWS: Update for the 5.2 release. - - * FOR-RELEASE: Finish up 5.2 manual item. Add documentation item - for 5.3. - - * erc.texi (Sample Session): Flesh out. Mention #erc. - (Modules): Defer to 5.3 release. - (Advanced Usage): Move Sample Configuration chapter ahead of - unfinished chapters. - (Sample Configuration): Write. - (Options): Mention how to see available ERC options. Defer to 5.3 - release. - (Tips and Tricks): Remove, since it seems better to just include - tips and tricks in the sample configuration, commented out. - - * erc-bbdb.el (erc-bbdb-search-name-and-create): Make prompt more - informative about how to skip merging. - (erc-bbdb-insinuate-and-show-entry-1): Move contents of - erc-bbdb-insinuate-and-show-entry here. - (erc-bbdb-insinuate-and-show-entry): Run - erc-bbdb-insinuate-and-show-entry-1 "outside" of the calling - function, so that we can avoid triggering a process-filter error - if the user hits C-g. - -2007-03-30 Michael Olson <mwolson@gnu.org> - - * FOR-RELEASE: Solve C-c C-SPC keybinding dilemma. - - * erc-autoaway.el (erc-autoaway-idle-method): Use `if' rather than - `cond' and `set' rather than `set-default'. - - * erc-log.el: Avoid compiler warning by requiring erc-network - during compilation. - (erc-generate-log-file-name-function): Add tag to each option. - Add erc-generate-log-file-name-network. - (erc-generate-log-file-name-network): New function which generates - a log file name that uses network name rather than server name, - when possible. - - * erc-track.el (track): Assimilate track-when-inactive module, - since there's no need to have two modules in one file -- an option - will do. Remove track-modified-channels alias. Call - erc-track-minor-mode-maybe, and tear down the minor mode when - disabling. - (erc-track-when-inactive): New option which determines whether to - track visible buffers when inactive. The default is not to do so. - (erc-track-visibility): Mention erc-track-when-inactive. - (erc-buffer-visible): Use erc-track-when-inactive. - (erc-track-enable-keybindings): New option which determines - whether to enable the global-level tracking keybindings. The - default is to do so, unless they would override another binding, - in which case we prompt the user about it. - (erc-track-minor-mode-map): Move global keybindings here. - (erc-track-minor-mode): New minor mode which only enables the - keybindings and does nothing else. - (erc-track-minor-mode-maybe): New function which starts - erc-track-minor-mode, but only if it hasn't already been started, - an ERC buffer exists, and the user OK's it, depending on the value - of `erc-track-enable-keybindings'. - (erc-track-switch-buffer): Display a message if someone calls this - without first enabling erc-track-mode. - -2007-03-17 Michael Olson <mwolson@gnu.org> - - * erc.texi (Development): Mention ErcDevelopment page on - emacswiki. - (Getting Started): Mention ~/.emacs.d/.ercrc.el and the Customize - interface. - (Sample Session): New section that has a very rough draft for a - sample ERC session. - (Special Features): New section that explains some of the special - features of ERC. Taken from ErcFeatures on emacswiki, with - enhancements. - -2007-03-12 Diane Murray <disumu@x3y2z1.net> - - * erc-autoaway.el (erc-autoaway-idle-method): When setting the new - value, disable and re-enable `erc-autoaway-mode' only if it was - already enabled. This fixes a bug where autoaway was enabled just - by loading the file. - -2007-03-10 Diane Murray <disumu@x3y2z1.net> - - * erc-capab.el: Added more information to the Usage section. - (erc-capab-identify-prefix): Doc fix. - (erc-capab-identify-unidentified): New face. - (290): Removed. Definition moved to erc-backend.el. - (erc-capab-identify-send-messages): Renamed from - `erc-capab-send-identify-messages'. - (erc-capab-identify-setup): Use it. - (erc-capab-identify-get-unidentified-nickname): Renamed from - `erc-capab-get-unidentified-nickname'. - (erc-capab-identify-add-prefix): Use it. Use - `erc-capab-identify-unidentified' as the face. - - * erc-backend.el (290): Moved here from erc-capab.el. - - * erc.el (erc-select): Added an autoload cookie. - (erc-message-type-member, erc-restore-text-properties): Use - `erc-get-parsed-vector'. - (erc-auto-query): Set the default to 'bury since many new users - expect private messages from others to be in dedicated query - buffers, not the server buffer. - (erc-common-server-suffixes): Use "freenode" for freenode.net, not - "OPN". Added oftc.net. - - * NEWS: Added note about erc-auto-query's new default setting. - -2007-03-03 Michael Olson <mwolson@gnu.org> - - * erc.el (erc-open, erc): Docfixes. - -2007-03-02 Michael Olson <mwolson@gnu.org> - - * FOR-RELEASE: Make section for 5.3 release and move erc-backend - cleanup there. Awaiting discussion before doing other things. - Add tasks for merging filename changes from the 5.2 release - branch, and for making a tarball of modules not in Emacs 22. Add - item to remind me to update NEWS. Mark backtab entry as done. - - * erc-button.el (button): Add call to `erc-button-add-keys'. - (erc-button-keys-added): New variable tracking whether we've added - the keys yet. - (erc-button-add-keys): New function that adds the <backtab> key to - erc-mode-map. - - * erc.texi: Change version to 5.2 (pre-release). - -2007-02-15 Michael Olson <mwolson@gnu.org> - - * CREDITS: Update. - - * erc-backend.el (erc-server-send-ping-interval): Change to use a - default of 30 seconds. Improve customize interface. - (erc-server-send-ping-timeout): New option that determines when to - consider a connection stalled and restart it. The default is - after 120 seconds. - (erc-server-send-ping): Use erc-server-send-ping-timeout instead - of erc-server-send-ping-interval. If - erc-server-send-ping-timeout is nil, do not ever kill and restart - a hung IRC process. - - * erc.el (erc-modules): Include the name of the module in its - description. This should make it easier for people to find and - enable a particular module. - -2007-02-15 Vivek Dasmohapatra <vivek@etla.org> - - * erc.el (erc-cmd-RECONNECT): Kill old process if it is still - alive. - (erc-message-english-PART): Properly escape "%" characters in - reason. - - * erc-backend.el (erc-server-reconnecting): New variable that is - set when the user requests a reconnect, but the old process is - still alive. This forces the reconnect to work even though the - process is killed manually during reconnect. - (erc-server-connect): Initialize it. - (erc-server-reconnect-p): Use it. - (erc-process-sentinel-1): Set it to nil after the first reconnect - attempt. - -2007-02-07 Diane Murray <disumu@x3y2z1.net> - - * erc-menu.el (erc-menu-definition): Fixed so that the separator - is between "Current channel" and "Pals, fools and other keywords", - not at the bottom of the "Current channel" submenu. - -2007-01-25 Diane Murray <disumu@x3y2z1.net> - - * erc-networks.el (erc-server-alist): Removed SSL server for now - since `erc-server-select' doesn't know to use `erc-ssl'. - - * erc-networks.el (erc-server-alist, erc-networks-alist): Added - definitions for oftc.net. - - * erc-services.el (erc-nickserv-alist): Fixed OFTC message regexp. - -2007-01-22 Michael Olson <mwolson@gnu.org> - - * erc-backend.el (erc-server-error-occurred): New variable that - indicates when an error has been signaled by the server. This - should fix an infinite reconnect bug when giving some servers a - bogus :full-name. Thanks to Angelina Carlton for the report. - (erc-server-connect): Initialize erc-server-error-occurred. - (erc-server-reconnect-p): Use it. - (ERROR): Set it. - - * erc-services.el (erc-nickserv-alist): Alphabetize and add Ars - and QuakeNet. Standardize look of entries. Fix type mismatch - error in customize interface. - (erc-nickserv-passwords): Alphabetize and add missing entries from - erc-nickserv-alist. - -2007-01-21 Michael Olson <mwolson@gnu.org> - - * erc.el (erc-header-line-format): Document how to disable the - header line, and add a customization type for it. Also, make the - changes take effect immediately. - -2007-01-19 Michael Olson <mwolson@gnu.org> - - * erc.texi (Modules): Document new menu module. Thanks to Leo - for noticing. - -2007-01-16 Diane Murray <disumu@x3y2z1.net> - - * erc-stamp.el (erc-insert-timestamp-left): Fixed so that the - whitespace string filler is hidden correctly when timestamps are - hidden. - (erc-toggle-timestamps): New function to use instead of - `erc-show-timestamps' and `erc-hide-timestamps'. - - * erc.el (erc-restore-text-properties): Moved here from - erc-fill.el since it could be useful in general. - - * erc-fill.el (erc-restore-text-properties): Removed. - -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. +2008-02-04 Jeremy Maitin-Shepard <jbms@cmu.edu> - * 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. + * erc.el (erc-cmd-QUERY): Bind the value of `erc-auto-query' to + `erc-query-display' rather than `erc-join-buffer'. This fixes a + bug where the value of erc-auto-query was being ignored. -2007-01-11 Michael Olson <mwolson@gnu.org> +2008-01-31 Michael Olson <mwolson@gnu.org> - * erc-bbdb.el (erc-bbdb-popup-type): Fix customization type and - documentation. + * erc-dcc.el (erc-dcc-do-GET-command, erc-dcc-do-SEND-command): + Improve docstring. If FILE argument is split into multiple + arguments, re-join them into a single string, separated by a + space. This fixes an issue where the user wants to send or + receive a file with spaces in its name. It is assumed that no one + will try sending or receiving a file with multiple consecutive + spaces in its name, otherwise this fix will fail. - * 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. + * erc.el (erc-mode-map): Add binding for C-c C-x to + erc-quit-server, since rcirc.el binds its quit command in a + similar manner. Thanks to Jari Aalto for the suggestion. -2007-01-11 Diane Murray <disumu@x3y2z1.net> +2008-01-28 Diane Murray <disumu@x3y2z1.net> - * NEWS: Added note for `erc-my-nick-face'. Fixed capab-identify - wording. + * erc-list-old.el (list-old): Define module as list-old, not list. + This fixes a bug where an unknown module error would occur when + starting ERC and using the list-old module. -2007-01-10 Diane Murray <disumu@x3y2z1.net> + * erc-track.el (erc-track-find-face): If no choice was found + return nil to use the default mode-line faces. - * 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. +2008-01-26 Michael Olson <mwolson@gnu.org> -2007-01-10 Michael Olson <mwolson@gnu.org> + * erc.el (erc-version-string): Release ERC 5.3. - * erc.el: Fix typo in url-irc-function instructions. + * Makefile (VERSION): Update. + (EXTRAS): Remove erc-list.el after all, because this is mainly for + users of the version that comes with Emacs, and they will have + erc-list.el by Emacs 23. + (MISC): Add ChangeLog.07. + (elpa): Fix build issue. Add proper version to erc-pkg.el. -2007-01-09 Michael Olson <mwolson@gnu.org> + * README.extras: Mention Emacs 23. - * 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. + * erc-pkg.el: Make the version string a template. -2007-01-07 Michael Olson <mwolson@gnu.org> + * erc.texi (Obtaining ERC): Update extras URLs for 5.3. + (Development): Write instructions for git, and remove those for + Arch. + (History): Mention the switch to git. - * erc.el (erc-modules): Add the menu module. This should fix a - bug with incorrect ERC submenus being displayed. +2008-01-25 Michael Olson <mwolson@gnu.org> - * erc-menu.el: Turn this into a module. - (erc-menu-add, erc-menu-remove): New functions that add and remove - the ERC menu. + * NEWS: Update. + * erc-goodies.el (keep-place): New module which keeps your place + in unvisited ERC buffers when new messages arrive. This is mostly + taken from Johan Bockgård's init file. + (erc-noncommands-list): Move to correct place. -See ChangeLog.06 for earlier changes. + * erc-networks.el: Add a module definition. - Copyright (C) 2007, 2008 Free Software Foundation, Inc. + * erc-services.el (erc-nickserv-identify-mode): Force-enable the + networks module, because we need it to set erc-network for us. + + * erc-track.el (erc-track-faces-normal-list): Indicate in the + docstring that this variable can be set to nil. + + * erc.el: On second thought, don't load erc-networks. Just enable + the networks module by default. + (erc-modules): Add option for keep-place and networks. Enable + networks by default. + (erc-version-string): Make release candidate 1 available. + +2008-01-24 Michael Olson <mwolson@gnu.org> + + * erc.el: Load erc-networks.el so that functions get access to the + `erc-network-name' function. + + * erc-track.el (erc-track-faces-normal-list): Add + erc-dangerous-host-face. + (erc-track-exclude-types): Add 333 and 353 to the default list of + things to ignore, and explain what they are in the docstring. + +2008-01-23 Michael Olson <mwolson@gnu.org> + + * erc-track.el (erc-track-faces-priority-list): Move + erc-nick-default-face higher, so that it can be used for the + activity indication effect. Add erc-current-nick-face, + erc-pal-face, erc-dangerous-host-face, and erc-fool-face by + themselves. + (erc-track-faces-normal-list): New option that contains a list of + faces to consider "normal". + (erc-track-position-in-mode-line): Minor docfix. + (erc-track-find-face): Use erc-track-faces-normal-list to produce + a sort of blinking activity effect. + +2008-01-22 Michael Olson <mwolson@gnu.org> + + * erc-button.el (erc-button-add-nickname-buttons): When in a + channel buffer, only look at nicks from the current channel. + Thanks to e1f for the report. + +2008-01-21 Michael Olson <mwolson@gnu.org> + + * erc-compat.el (erc-const-expr-p, erc-list*, erc-assert): Remove, + since we can use the default `assert' function without it causing + us any problems, even in Emacs 21. Thanks to bojohan for the + suggestion. + + * erc-goodies.el (move-to-prompt): Use the "XEmacs" method + instead, because the [remap ...] method interferes with + delete-selection-mode. + (erc-move-to-prompt): Rename from erc-move-to-prompt-xemacs. + Deactivate mark and call push-mark before moving point. Thanks to + bojohan for the suggestion. + (erc-move-to-prompt-setup): Rename from + erc-move-to-prompt-init-xemacs. + + * erc-track.el (erc-track-faces-priority-list): Replace erc-button + with '(erc-button erc-default-face) so that we only care about + buttons that are part of normal text. Adjust customization type + to handle this case. Make erc-nick-default-face a list. Handle + pals, fools, current nick, and dangerous hosts. + (erc-track-find-face): Simplify. Adapt for list of faces case. + (erc-faces-in): Don't deflate lists of faces. Add them as-is. + (erc-track-face-priority): Use equal instead of eq. + +2008-01-20 Michael Olson <mwolson@gnu.org> + + * erc-goodies.el (erc-move-to-prompt, erc-move-to-prompt-xemacs): + Fix off-by-one error that caused the point to move when placed at + the beginning of some already-typed text. Thanks to e1f for the + report. + + * erc-dcc.el, erc-xdcc.el: Add simple module definitions. + + * erc.el (erc-modules): Add dcc and xdcc. + +2008-01-19 Michael Olson <mwolson@gnu.org> + + * erc-bbdb.el (erc-bbdb-insinuate-and-show-entry): Work around bug + in XEmacs 21.4 that throws an error when the first argument to + run-at-time is nil. + + * erc-button.el (button): Undo XEmacs-specific change to all ERC + buffers when module is removed. + (erc-button-setup): Rename from erc-button-add-keys, and move + XEmacs-specific stuff here. + + * erc-goodies.el (erc-unmorse): Improve regexp for detecting + morse. Deal with the morse style that has "/ " at the end of + every letter. + (erc-imenu-setup): New function that sets up Imenu support. Add + it instead of a lambda form to erc-mode-hook. + (scrolltobottom): Remove erc-scroll-to-bottom from all ERC buffers + when module is removed. Activate the functionality in all ERC + buffers when the module is activated, rather than leaving it up to + the user. + (move-to-prompt): New module that moves to the ERC prompt if a + user tries to type elsewhere in the buffer, and then inserts their + keystrokes there. This is mostly taken from Johan Bockgård's init + file. + (erc-move-to-prompt): New function that implements this. + (erc-move-to-prompt-xemacs): New function that implements this for + XEmacs. + (erc-move-to-prompt-init-xemacs): New function to perform the + extra initialization step needed for XEmacs. + + * erc-page.el, erc-replace.el: Fix header and footer. + + * erc-track.el (erc-track-minor-mode-maybe): Take an optional + buffer arg so that we can put this in erc-connect-pre-hook. If + given this argument, include it in the check to determine whether + to activate erc-track-minor-mode. + (track): Add erc-track-minor-mode-maybe to erc-connect-pre-hook, + so that we can use it as soon as a connection is attempted. + + * erc.el (erc-format-network, erc-format-target-and/or-network): + Use erc-network-name function instead, and check to see whether + that function is bound. This fixes an error in process filter for + people who did not have erc-services or erc-networks loaded. + (erc-modules): Add move-to-prompt module and enable it by + default. Thanks to e1f for the suggestion. + +2008-01-18 Michael Olson <mwolson@gnu.org> + + * Makefile (EXTRAS): Include erc-list-old.el. + + * erc-dcc.el (erc-dcc-verbose): Rename from erc-verbose-dcc. + (erc-pack-int): Rewrite to not depend on a count argument. + (erc-unpack-int): Rewrite to remove 4-character limitation. + (erc-dcc-server): Call set-process-coding-system and + set-process-filter-multibyte so that the contents get sent out + without modification. + (erc-dcc-send-filter): Don't take a substring -- just pass the + whole string to erc-unpack-int. + (erc-dcc-receive-cache): New option that indicates the number of + bytes to let the receive buffer grow before flushing it. + (erc-dcc-file-name): New buffer-local variable to keep track of + the filename of the currently-received file. + (erc-dcc-get-file): Disable undo for a speed increase. Set + erc-dcc-file-name. Truncate the file before writing to it. + (erc-dcc-append-contents): New function to append the contents of + a buffer to a file and then erase the contents of the buffer. + (erc-dcc-get-filter): Flush buffer contents after exceeding + erc-dcc-receive-cache. This allows large files to be downloaded + without storing the whole thing in memory. + (erc-dcc-get-sentinel): Flush any remaining contents before + closing. No need to save buffer. + (erc-dcc-listen-host): New option that determines which IP address + to listen on. + (erc-dcc-public-host): New option that determines which IP address + to advertise when sending a file. This is useful for people who + are on a local subnet. Together, these two options replace + erc-dcc-host. + + * erc.el (erc-mode-line-format): Add %N and %S. %N is the name of + the network, and %S is much like %s but with the network name + trumping the server name. Default to "%S %a". Thanks to e1f for + the suggestion. + (erc-format-network): New function that formats the network name. + (erc-format-target-and/or-network): New function that formats both + the network name and target, falling back on the server name if + the network name is not available. + (erc-update-mode-line-buffer): Add the new format spec items. + +2008-01-17 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-join-buffer): Improve documentation. + (erc-query-display): New option indicating how to display a query + buffer that is made by using the /QUERY command. The default is + to display the query in a new window. + (erc-cmd-QUERY): Use it. Improve docstring. + (erc-auto-query): Default this to 'window-noselect instead, + because I've already seen bug reports about new users thinking + that ERC didn't display their test messages. Improve + customization type. + (erc-notice-face): Make this work with XEmacs. + (erc-join-buffer): Mention 'buffer in docstring. Improve + customization type. + + * erc-dcc.el (erc-dcc-send-sentinel): Better handle case where elt + is nil, in order to avoid an error. Thanks to Brent Goodrick for + the initial patch. + (erc-dcc-display-send): New function split from erc-dcc-send-hook. + (erc-dcc-send-connect-hook): Use it -- we don't like lambda forms + in hooks. + (erc-dcc-send-filter): Display byte count if the client confirmed + too much, and kill the buffer. Otherwise a DoS might be possible + by making Emacs run out of RAM. + + * erc-backend.el (erc-server-connect): Detect early on whether the + connection attempt has failed in order to avoid confusing error + messages. + + * erc-networks.el (erc-server-alist): Add Rizon network. + + * erc-services.el (erc-nickserv-passwords): Add Rizon to options. + (erc-nickserv-alist): Add support for Rizon. + + * erc-track.el (erc-track-find-face): Don't let buttons in notices + trump default text. Use catch/throw. Default to first element of + FACES is nothing is found. + + * erc-xdcc.el: Add local variables for proper indentation setup. + +2008-01-15 Michael Olson <mwolson@gnu.org> + + * erc-backend.el (erc-server-coding-system): Docfix. + (erc-coding-system-for-target): Pass the `target' argument along + as the first and only argument. It's not good to just depend on a + dynamic binding. + +2008-01-10 Michael Olson <mwolson@gnu.org> + + * erc-backend.el (321, 322): Split message-displaying parts into + new functions, which are added to each response's respective + hook. This makes them easier to disable. + + * erc-list.el: New file from Tom Tromey. Use erc-propertize + instead of propertize. Require 'erc. + (list): New module definition. Remove message-displaying + functions for 321 and 322 response handlers when enabling the + module, and restore them when disabling. As a sanity check, + remove the erc-list-handle-322 function when disabling the module. + (erc-list-handle-322): Handle the case where we run the LIST + command, but do not go through the normal steps. + (erc-cmd-LIST): Add docstring. Strip initial space from line if + it is non-nil. Use make-local-variable to silence compiler + warning. Capture current buffer and pass it to + erc-list-install-322-handler. + (erc-list-install-322-handler): Take server-buffer argument, so + that we are certain of being in the right buffer. Use 4th + argument to add-hook, so that erc-server-322-functions is only + modified in one buffer. + + * erc-list-old.el: Renamed from old erc-list.el. + + * erc.el (erc-modules): Add list-old. + (erc-set-topic): Handle case where there are no newlines in the + existing topic, which happens when /LIST is run. + (erc-notice-face): If we have less than 88 colors, make this + blue. Otherwise the text will be pink in a tty, which looks + dreadful. Thanks to e1f for the report. + (erc-remove-parsed-property): New option that determines whether + to remove the erc-parsed property after displaying a message. + This should have the effect of making ERC take up less memory. + (erc-display-line-1): Use it. + +2008-01-04 Stefan Monnier <monnier@iro.umontreal.ca> + + * erc-ibuffer.el (erc-channel-modes): + Pass mode-name through format-mode-line + + +See ChangeLog.07 for earlier changes. + + Copyright (C) 2008 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -411,4 +348,4 @@ See ChangeLog.06 for earlier changes. ;; add-log-time-zone-rule: t ;; End: -;; arch-tag: 3369b6e5-96b1-4b32-96cd-9a905c747496 +;; arch-tag: 15787dfd-e091-4c8c-8b88-747b474e1ac7 diff --git a/lisp/erc/ChangeLog.07 b/lisp/erc/ChangeLog.07 new file mode 100644 index 00000000000..c317fe62177 --- /dev/null +++ b/lisp/erc/ChangeLog.07 @@ -0,0 +1,839 @@ +2007-12-16 Diane Murray <disumu@x3y2z1.net> + + * erc-services.el (erc-nickserv-alist): Removed autodetect regexp, + added identified regexp for OFTC. + (erc-nickserv-identification-autodetect): Make sure success-regex + is non-nil. + (erc-nickserv-identify-autodetect): Make sure identify-regex is + non-nil. Doc fix. + +2007-12-13 Diane Murray <disumu@x3y2z1.net> + + * erc-backend.el (PRIVMSG, QUIT, TOPIC, WALLOPS, 376, 004, 221) + (312, 315, 319, 330, 331, 333, 367, 368, 391, 405, 406, 412) + (421, 432, 433, 437, 442, 461, 474, 477, 482, 431): Doc fix. + +2007-12-09 Michael Olson <mwolson@gnu.org> + + * erc-services.el (erc-nickserv-alist): Fix regexps for GRnet. + +2007-12-09 Giorgos Keramidas <keramida@ceid.upatras.gr> (tiny change) + + * erc-backend.el, erc.el: + Parse 275 (secure connection) responses. + + * erc-services.el: Add identification hooks for GRnet, the Greek + IRC network <http://www.irc.gr>. + +2007-12-08 David Kastrup <dak@gnu.org> + + * erc-stamp.el (erc-echo-timestamp): + * erc-lang.el (language): + * erc-backend.el (erc-server-connect): Fix buggy call to `message'. + +2007-12-07 Edward O'Connor <ted@oconnor.cx> + + * erc-services.el: Provide a hook that runs when nickserv confirms + that the user has successfully identified. + (services, erc-nickserv-identify-mode): Add and remove + erc-nickserv-identification-autodetect from + erc-server-NOTICE-functions. + (erc-nickserv-alist): Add SUCCESS-REGEXP to each entry. + (erc-nickserv-alist-identified-regexp) + (erc-nickserv-identification-autodetect): New functions. + (erc-nickserv-identified-hook): New hook. + +2007-12-06 D. Goel <deego3@gmail.com> + + * erc-match.el (erc-add-entry-to-list): Fix buggy call to `error'. + +2007-12-01 Glenn Morris <rgm@gnu.org> + + * erc-backend.el (erc-server-send-ping): Move after definition of + erc-server-send. + +2007-11-29 Giorgos Keramidas <keramida@ceid.upatras.gr> (tiny change) + + * erc-backend.el, erc.el: + Parse 307 (nick has identified) responses. + +2007-11-15 Juanma Barranquero <lekktu@gmail.com> + + * erc.el (erc-open): + * erc-backend.el (define-erc-response-handler): + * erc-log.el (log): + * erc-match.el (erc-log-matches): Fix typos in docstrings. + +2007-11-11 Michael Olson <mwolson@gnu.org> + + * erc-autoaway.el (erc-autoaway-possibly-set-away): + * erc-netsplit.el (erc-netsplit-timer): + * erc-notify.el (erc-notify-timer): + * erc-track.el (erc-user-is-active): Only run if we have + successfully established a connection to the server and have + logged in. I suspect that sending messages too soon may make some + IRC servers not respond well, particularly when the network + connection is iffy or subject to traffic-shaping. + +2007-11-01 Michael Olson <mwolson@gnu.org> + + * erc-compat.el (erc-set-write-file-functions): New compatibility + function to set the write hooks appropriately. + + * erc-log.el (erc-log-setup-logging): Use + erc-set-write-file-functions. This fixes a byte-compiler warning. + + * erc-stamp.el: Silence byte-compiler warning about + erc-fill-column. + + * erc.el (erc-with-all-buffers-of-server): Bind the result of + mapcar to a variable in order to silence a byte-compiler warning. + +2007-10-29 Michael Olson <mwolson@gnu.org> + + * erc-ibuffer.el (erc-modified-channels-alist): Use + eval-when-compile, and explain why we are doing this. + +2007-10-25 Dan Nicolaescu <dann@ics.uci.edu> + + * erc-ibuffer.el (erc-modified-channels-alist): Pacify + byte-compiler. + +2007-10-13 Glenn Morris <rgm@gnu.org> + + * erc-track.el (erc-modified-channels-update): Use mapc rather + than mapcar. + +2007-10-12 Diane Murray <disumu@x3y2z1.net> + + * erc.el (erc-join-channel): Prompt for channel key if C-u or + another prefix-arg was typed. + + * NEWS: Noted this change. + +2007-10-07 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-cmd-ME'S): New command that handles the case where + someone types "/me's". It concatenates the text " 's" to the + beginning of the input and then sends the result like a normal + "/me" command. + (erc-command-regexp): Permit single-quote character. + +2007-09-30 Aidan Kehoe <kehoea@parhasard.net> (tiny change) + + * erc-log.el (erc-save-buffer-in-logs): Prevent spurious warnings + when looking at a log file and concurrently saving to it. + +2007-09-18 Exal de Jesus Garcia Carrillo <exal@gnu.org> (tiny change) + + * erc.texi (Special-Features): Fix small typo. + +2007-09-16 Michael Olson <mwolson@gnu.org> + + * erc-track.el (erc-track-switch-direction): Mention + erc-track-faces-priority-list. Thanks to Leo for the suggestion. + +2007-09-11 Exal de Jesus Garcia Carrillo <exal@gnu.org> (tiny change) + + * erc-sound.el: Fix typo in setting up instructions. + +2007-09-10 Michael Olson <mwolson@gnu.org> + + * Makefile (elpa): Copy dir template rather than echoing a few + lines. The reason for this is that the ELPA package for ERC was + getting a corrupt dir entry. + + * dir-template: Template for the ELPA dir file. + +2007-09-08 Michael Olson <mwolson@gnu.org> + + * erc-log.el (erc-log-filter-function): New option that specifies + the function to call for filtering text before writing it to a log + file. Thanks to David O'Toole for the suggestion. + (erc-save-buffer-in-logs): Use erc-log-filter-function. Make sure + we carry along the value of coding-system-for-write, because this + could potentially be shadowed by the temporary buffer. + + * erc.el (erc-version-string): Update to 5.3, development version. + +2007-09-07 Glenn Morris <rgm@gnu.org> + + * erc.el (erc-toggle-debug-irc-protocol): Fix call to + erc-view-mode-enter. + +2007-08-08 Glenn Morris <rgm@gnu.org> + + * erc-log.el, erc.el: Replace `iff' in doc-strings and comments. + +2007-09-03 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-default-port): Make this an integer value rather + than a string. Thanks to Luca Capello for the report. + +2007-08-27 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-cmd-GQUIT): If erc-kill-queries-on-quit is non-nil, + kill all query buffers after 4 seconds. + +2007-08-16 Michael Olson <mwolson@gnu.org> + + * NEWS: Add ERC 5.3 changes section, and mention jbms' erc-track + compatibility note. + + * erc-track.el (erc-track-list-changed-hook): Turn this into a + customizable option. + (erc-track-switch-direction): Add 'importance option. + (erc-modified-channels-display): If erc-track-switch-direction is + 'importance, call erc-track-sort-by-importance. + (erc-track-face-priority): New function that returns a number + indicating the position of a face in erc-track-faces-priority-list. + (erc-track-sort-by-importance): New function that sorts + erc-modified-channels-list according to erc-track-face-priority. + (erc-track-get-active-buffer): Make 'oldest a rough opposite of + 'importance. + +2007-08-14 Jeremy Maitin-Shepard <jbms@cmu.edu> + + * erc-track.el (erc-track-remove-disconnected-buffers): New + variable which controls whether buffers associated with a server + that is disconnected should be removed from + `erc-modified-channels-alist'. Existing behavior is to + unconditionally remove such buffers, which is achieved by setting + `erc-track-removed-disconnected-buffers' to t. When set to t, + which is the new default value, such buffers remain in the list, + which I think is often the desired behavior, since the user may + likely wish to find out about activity that occurred in a channel + prior to it being disconnected. + (erc-track-list-changed-hook): New hook that is run whenever the + contents of `erc-modified-channels-alist' changes; it is useful + for users such as myself that don't use the default mode-line + notification but instead use a separate mechanism (which is tied + to my window manager) to provide notification of channel activity. + (erc-track-get-buffer-window): New function that acts as a wrapper + around `get-buffer-window' that handles the `selected-visible' + option of `erc-track-visibility'; previously, the value of + `erc-track-visibility' was passed directly to `get-buffer-window', + which does not support `selected-visible'; consequently, + `selected-visible' was not properly supported. + (erc-track-modified-channels): Fix a bug in the logic for removing + buffers from the list in certain cases. + (erc-track-position-in-mode-line): Add a supported value that + specifies that the tracking information should not be added to the + mode line at all. The value of nil is used to indicate that the + information should not be added at all to the mode line. + (erc-track-add-to-mode-line): Check for position eq to t, rather + than non-nil. + (erc-buffer-visible): Use erc-track-get-buffer-window. + (erc-modified-channels-update): Take + erc-track-remove-disconnected-buffers into account. + (erc-modified-channels-display): Run `erc-track-list-changed-hook'. + + * erc.el (erc-reuse-frames): New option that determines whether + new frames are always created. Defaults to t. This only has an + effect when erc-join-buffer is set to 'frame. + (erc-setup-buffer): Use it. + +2007-08-14 Michael Olson <mwolson@gnu.org> + + * erc-backend.el (erc-server-reconnect): If the server buffer has + been killed, use the current buffer instead. If the current + buffer is not an ERC buffer, give an error. This fixes a bug when + /reconnect is run from a channel buffer whose server buffer has + been deleted. Thanks to jbms for the report. + (erc-process-sentinel-1): Take server buffer as an argument, so + that we can make sure that it is current. + (erc-process-sentinel): Pass buffer to erc-process-sentinel-1. + (erc-process-sentinel-2): New function split from + erc-process-sentinel-1. If server buffer is deleted during a + reconnect attempt, stop trying to reconnect. Fix bug where + reconnect was not happening when erc-server-reconnect-attempts was + t. Call erc-server-reconnect-p only once each time. If we are + instructed to try connecting indefinitely, tell the user that they + can stop this by killing the server buffer. Call the process + sentinel by means of run-at-time, so that there is time to kill + the buffer if need be; this also removes the need for a while + loop. Refuse to reconnect again if erc-server-reconnect-timeout + is not an number. + + * erc.el (erc-command-no-process-p): Fix bug: the return value of + erc-extract-command-from-line is a list rather than a single + symbol. Thanks to jbms for the report. + (erc-cmd-RECONNECT): Use simpler logic, and use buffer-live-p + rather than bufferp. + (erc-send-current-line, erc-display-command, erc-display-msg): + Handle case where erc-server-process is nil, so that /reconnect + works. + +2007-08-12 Michael Olson <mwolson@gnu.org> + + * erc-identd.el (erc-identd-filter): Instead of sending an EOF + character, which now confuses freenode, stop the server process, + so that no new connections are accepted, and kill the current + client process. + +2007-07-29 Michael Olson <mwolson@gnu.org> + + * erc-list.el: Relicense to GPLv3. Since the file was already + licensed under version 2 or later, it turns out that we do not + need the permission of all of the authors in order to proceed. + +2007-07-13 Michael Olson <mwolson@gnu.org> + + * erc-goodies.el (erc-get-bg-color-face, erc-get-fg-color-face): + Use erc-error rather than message and beep. + + * erc-sound.el: Indentation fix. + + * erc.el (erc-command-no-process-p): New function that determines + if its argument is an ERC command that can be run when the server + process is not alive. + (erc-cmd-SET, erc-cmd-CLEAR, erc-cmd-COUNTRY, erc-cmd-HELP) + (erc-cmd-LASTLOG, erc-cmd-QUIT, erc-cmd-GQUIT) + (erc-cmd-RECONNECT, erc-cmd-SERVER): Denote that these commands + can be run even when the server process is not alive. + (erc-send-current-line): Call erc-command-no-process-p if the + server process is not alive, to determine if we have a command + that can be run anyway. Thanks to Tom Tromey for the bug report. + (erc-error): New function that either displays a message or throws + an error, depending on whether debug-on-error is non-nil. + (erc-cmd-SERVER, erc-send-current-line): Use it. + +2007-07-10 Michael Olson <mwolson@gnu.org> + + * Relicense all FSF-assigned code to GPLv3. + +2007-06-25 Michael Olson <mwolson@gnu.org> + + * erc.texi (Options): Fix typo. + (Getting Help and Reporting Bugs): Update webpage URL. Make Gmane + part more readable. + +2007-06-20 Michael Olson <mwolson@gnu.org> + + * erc-stamp.el (erc-timestamp-format-left): New option that + specifies the left timestamp to use for + erc-insert-timestamp-left-and-right. + (erc-timestamp-format-right): New option that specifies the right + timestamp to use for erc-insert-timestamp-left-and-right. + (erc-insert-timestamp-function): Change default to + erc-insert-timestamp-left-and-right. + (erc-insert-away-timestamp-function): Ditto. + (erc-timestamp-last-inserted-left) + (erc-timestamp-last-inserted-right): New variables to keep track + of data for erc-insert-timestamp-left-and-right. + (erc-insert-timestamp-left-and-right): New function that places + timestamps on both the left and right sides of the screen, but + only if each timestamp has changed since it was last computed. + Thanks to offby1 for urging me to merge this. + + * erc.el (erc-open-ssl-stream): Display informative error when + ssl.el not found. + (erc-tls): New function to connect using tls.el. + (erc-open-tls-stream): New function to initiate tls connection. + Display informative error when tls.el not found. + +2007-06-19 Michael Olson <mwolson@gnu.org> + + * erc-log.el: Update header with accurate instructions. + +2007-06-17 Michael Olson <mwolson@gnu.org> + + * erc-pkg.el: Update description to match what is currently in ELPA. + +2007-06-14 Juanma Barranquero <lekktu@gmail.com> + + * erc-goodies.el (erc-scroll-to-bottom): Remove redundant check. + +2007-06-13 Michael Olson <mwolson@gnu.org> + + * erc-compat.el (erc-with-selected-window): New compatibility + macro that implements `with-selected-window'. + + * erc-goodies.el (erc-scroll-to-bottom): Use it. This fixes a bug + with buffer ordering where ERC buffers would move to the top. + Thanks to Ivan Kanis for the patch. + +2007-06-10 Michael Olson <mwolson@gnu.org> + + * erc-log.el (erc-logging-enabled): Fix a bug that occurred when + `erc-log-channels-directory' had the name of a function. + +2007-06-06 Juanma Barranquero <lekktu@gmail.com> + + * erc.el (erc-show-channel-key-p, erc-startup-file-list): + Fix typo in docstring. + +2007-06-03 Michael Olson <mwolson@gnu.org> + + * erc-compat.el (erc-view-mode-enter): Make this its own function, + in order to document what we do, and provide sane fallback + behavior. + + * erc.el (erc-toggle-debug-irc-protocol): Don't pass any arguments + to erc-view-mode-enter, since we don't do anything special with + the exit function. This fixes a bug with Emacs 21 and Emacs 22. + Thanks to Leo for noticing. + +2007-05-30 Michael Olson <mwolson@gnu.org> + + * erc-compat.el (erc-user-emacs-directory): New variable that + determines where to find user-specific Emacs settings. For Emacs, + this is usually ~/.emacs.d, and for XEmacs this is usually + ~/.xemacs. + + * erc.el (erc-startup-file-list): Use erc-user-emacs-directory. + +2007-05-28 Michael Olson <mwolson@gnu.org> + + * erc-button.el (erc-button-url-regexp): Recognize parentheses as + part of URLs. Thanks to Lawrence Mitchell for the fix. + +2007-05-26 Michael Olson <mwolson@gnu.org> + + * erc.texi (Modules): Fix references to completion modules. + +2007-05-21 Michael Olson <mwolson@gnu.org> + + * Makefile (SOURCE): Remove erc-pkg.el. + (debclean): New rule to clean old Debian packages of ERC. + (debprepare): Don't modify the released tarball, but copy it as + the .orig.tar.gz file. + (debrelease, debrevision): Remove. + (debinstall): New target that copies the generated Debian file to + a distro-specific location. + (deb): New rule that chains together the stages in building a + Debian package. + (EXTRAS): Add erc-nicklist.el, since it is not release-quality. + (extras): Copy images directory. + + * erc-nicklist.el (erc-nicklist-icons-directory): Use + locate-library to find the "images" directory. This should be + more failsafe. Thanks to Tom Tromey for the idea. + +2007-05-19 Michael Olson <mwolson@gnu.org> + + * Makefile (ELPA): New variable that contains the location of my + local ELPA repository. + (elpa): New rule that makes an ELPA package for ERC. + +2007-04-19 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-parse-prefix): New function that retrieves the + PREFIX server parameter from the current server and returns an + alist of prefix type to prefix character. + (erc-channel-receive-names): Use `erc-parse-prefix' to determine + whether the first character of a nick is a prefix character or + not. This should fix a bug reported by bromine about needing to + type "%" first to complete nicks of people who are "hops" on + Slashnet. This should also support for very exotic IRC server + setups, if any exist. + (erc-update-current-channel-member): Indentation. + +2007-04-15 Michael Olson <mwolson@gnu.org> + + * erc-log.el (erc-generate-log-file-name-function): Docfix. + Mention how to deal with the case for putting log files in + different directories. Change a customization type from `symbol' + to `function'. + (erc-log-channels-directory): Allow this to contain a function + name, which is called with the same args as in + `erc-generate-log-file-name-function'. Thanks to andrewy for the + report and use case. + (erc-current-logfile): Detect if `erc-log-channels-directory' is a + function and call it with arguments if so. + +2007-04-12 Michael Olson <mwolson@gnu.org> + + * erc-backend.el (define-erc-response-handler): Mention that hook + processing stops when the function returns non-nil. This should + help avoid a nasty "gotcha" when making custom functions. Thanks + to John Sullivan for the report. + +2007-04-08 Diane Murray <disumu@x3y2z1.net> + + * erc-nicklist.el (erc-nicklist-voiced-position): Fixed + customization mismatch. + +2007-04-01 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-version-string): Release ERC 5.2. + + * erc-auto.in, erc-chess.el, erc-list.el, erc-speak.el: + * erc-viper.el: Update copyright notices. + + * erc.texi: Make Emacs Lisp source code in this document + essentially public domain. Update version to 5.2. + (Obtaining ERC): Mention extras tarball. + (Releases): Mention local GNU mirror. + (Sample Configuration): Remove notice. + + * FOR-RELEASE (5.3): Add item for erc-nicklist. + Mark NEWS as done. Mark extras tarball as done. + + * Makefile (VERSION): Increment to 5.2. + (TESTING): Remove. + (EXTRAS): New variable containing the contents of our "Emacs 22 + extras" tarball. + (SOURCE): Remove $(TESTING). + (MISC): Add COPYING and ChangeLog.06. Fix ChangeLog.NNNN -> + ChangeLog.NN. + (release): Use $(SNAPDIR) instead of erc-$(VERSION). + (extras): New rule which implements the building of the extras + tarball. + (upload-extras): New rule to upload the extras tarball. It's + yucky to replicate upload, but oh well. + (DISTRIBUTOR): New variable used to differentiate between building + packages for Ubuntu and Debian. + (debrelease, debrevision): Use it. + (debbuild): Run linda in addition to lintian. + + * NEWS: Mention extras tarball. Note which files have been + renamed. Note that erc-list is enabled by default, except in + Emacs 22. + + * README.extras: New file which serves as a README for the extras + tarball. + +2007-03-31 Michael Olson <mwolson@gnu.org> + + * NEWS: Update for the 5.2 release. + + * FOR-RELEASE: Finish up 5.2 manual item. Add documentation item + for 5.3. + + * erc.texi (Sample Session): Flesh out. Mention #erc. + (Modules): Defer to 5.3 release. + (Advanced Usage): Move Sample Configuration chapter ahead of + unfinished chapters. + (Sample Configuration): Write. + (Options): Mention how to see available ERC options. Defer to 5.3 + release. + (Tips and Tricks): Remove, since it seems better to just include + tips and tricks in the sample configuration, commented out. + + * erc-bbdb.el (erc-bbdb-search-name-and-create): Make prompt more + informative about how to skip merging. + (erc-bbdb-insinuate-and-show-entry-1): Move contents of + erc-bbdb-insinuate-and-show-entry here. + (erc-bbdb-insinuate-and-show-entry): Run + erc-bbdb-insinuate-and-show-entry-1 "outside" of the calling + function, so that we can avoid triggering a process-filter error + if the user hits C-g. + +2007-03-30 Michael Olson <mwolson@gnu.org> + + * FOR-RELEASE: Solve C-c C-SPC keybinding dilemma. + + * erc-autoaway.el (erc-autoaway-idle-method): Use `if' rather than + `cond' and `set' rather than `set-default'. + + * erc-log.el: Avoid compiler warning by requiring erc-network + during compilation. + (erc-generate-log-file-name-function): Add tag to each option. + Add erc-generate-log-file-name-network. + (erc-generate-log-file-name-network): New function which generates + a log file name that uses network name rather than server name, + when possible. + + * erc-track.el (track): Assimilate track-when-inactive module, + since there's no need to have two modules in one file -- an option + will do. Remove track-modified-channels alias. Call + erc-track-minor-mode-maybe, and tear down the minor mode when + disabling. + (erc-track-when-inactive): New option which determines whether to + track visible buffers when inactive. The default is not to do so. + (erc-track-visibility): Mention erc-track-when-inactive. + (erc-buffer-visible): Use erc-track-when-inactive. + (erc-track-enable-keybindings): New option which determines + whether to enable the global-level tracking keybindings. The + default is to do so, unless they would override another binding, + in which case we prompt the user about it. + (erc-track-minor-mode-map): Move global keybindings here. + (erc-track-minor-mode): New minor mode which only enables the + keybindings and does nothing else. + (erc-track-minor-mode-maybe): New function which starts + erc-track-minor-mode, but only if it hasn't already been started, + an ERC buffer exists, and the user OK's it, depending on the value + of `erc-track-enable-keybindings'. + (erc-track-switch-buffer): Display a message if someone calls this + without first enabling erc-track-mode. + +2007-03-17 Michael Olson <mwolson@gnu.org> + + * erc.texi (Development): Mention ErcDevelopment page on + emacswiki. + (Getting Started): Mention ~/.emacs.d/.ercrc.el and the Customize + interface. + (Sample Session): New section that has a very rough draft for a + sample ERC session. + (Special Features): New section that explains some of the special + features of ERC. Taken from ErcFeatures on emacswiki, with + enhancements. + +2007-03-12 Diane Murray <disumu@x3y2z1.net> + + * erc-autoaway.el (erc-autoaway-idle-method): When setting the new + value, disable and re-enable `erc-autoaway-mode' only if it was + already enabled. This fixes a bug where autoaway was enabled just + by loading the file. + +2007-03-10 Diane Murray <disumu@x3y2z1.net> + + * erc-capab.el: Added more information to the Usage section. + (erc-capab-identify-prefix): Doc fix. + (erc-capab-identify-unidentified): New face. + (290): Removed. Definition moved to erc-backend.el. + (erc-capab-identify-send-messages): Renamed from + `erc-capab-send-identify-messages'. + (erc-capab-identify-setup): Use it. + (erc-capab-identify-get-unidentified-nickname): Renamed from + `erc-capab-get-unidentified-nickname'. + (erc-capab-identify-add-prefix): Use it. Use + `erc-capab-identify-unidentified' as the face. + + * erc-backend.el (290): Moved here from erc-capab.el. + + * erc.el (erc-select): Added an autoload cookie. + (erc-message-type-member, erc-restore-text-properties): Use + `erc-get-parsed-vector'. + (erc-auto-query): Set the default to 'bury since many new users + expect private messages from others to be in dedicated query + buffers, not the server buffer. + (erc-common-server-suffixes): Use "freenode" for freenode.net, not + "OPN". Added oftc.net. + + * NEWS: Added note about erc-auto-query's new default setting. + +2007-03-03 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-open, erc): Docfixes. + +2007-03-02 Michael Olson <mwolson@gnu.org> + + * FOR-RELEASE: Make section for 5.3 release and move erc-backend + cleanup there. Awaiting discussion before doing other things. + Add tasks for merging filename changes from the 5.2 release + branch, and for making a tarball of modules not in Emacs 22. Add + item to remind me to update NEWS. Mark backtab entry as done. + + * erc-button.el (button): Add call to `erc-button-add-keys'. + (erc-button-keys-added): New variable tracking whether we've added + the keys yet. + (erc-button-add-keys): New function that adds the <backtab> key to + erc-mode-map. + + * erc.texi: Change version to 5.2 (pre-release). + +2007-02-15 Michael Olson <mwolson@gnu.org> + + * CREDITS: Update. + + * erc-backend.el (erc-server-send-ping-interval): Change to use a + default of 30 seconds. Improve customize interface. + (erc-server-send-ping-timeout): New option that determines when to + consider a connection stalled and restart it. The default is + after 120 seconds. + (erc-server-send-ping): Use erc-server-send-ping-timeout instead + of erc-server-send-ping-interval. If + erc-server-send-ping-timeout is nil, do not ever kill and restart + a hung IRC process. + + * erc.el (erc-modules): Include the name of the module in its + description. This should make it easier for people to find and + enable a particular module. + +2007-02-15 Vivek Dasmohapatra <vivek@etla.org> + + * erc.el (erc-cmd-RECONNECT): Kill old process if it is still + alive. + (erc-message-english-PART): Properly escape "%" characters in + reason. + + * erc-backend.el (erc-server-reconnecting): New variable that is + set when the user requests a reconnect, but the old process is + still alive. This forces the reconnect to work even though the + process is killed manually during reconnect. + (erc-server-connect): Initialize it. + (erc-server-reconnect-p): Use it. + (erc-process-sentinel-1): Set it to nil after the first reconnect + attempt. + +2007-02-07 Diane Murray <disumu@x3y2z1.net> + + * erc-menu.el (erc-menu-definition): Fixed so that the separator + is between "Current channel" and "Pals, fools and other keywords", + not at the bottom of the "Current channel" submenu. + +2007-01-25 Diane Murray <disumu@x3y2z1.net> + + * erc-networks.el (erc-server-alist): Removed SSL server for now + since `erc-server-select' doesn't know to use `erc-ssl'. + + * erc-networks.el (erc-server-alist, erc-networks-alist): Added + definitions for oftc.net. + + * erc-services.el (erc-nickserv-alist): Fixed OFTC message regexp. + +2007-01-22 Michael Olson <mwolson@gnu.org> + + * erc-backend.el (erc-server-error-occurred): New variable that + indicates when an error has been signaled by the server. This + should fix an infinite reconnect bug when giving some servers a + bogus :full-name. Thanks to Angelina Carlton for the report. + (erc-server-connect): Initialize erc-server-error-occurred. + (erc-server-reconnect-p): Use it. + (ERROR): Set it. + + * erc-services.el (erc-nickserv-alist): Alphabetize and add Ars + and QuakeNet. Standardize look of entries. Fix type mismatch + error in customize interface. + (erc-nickserv-passwords): Alphabetize and add missing entries from + erc-nickserv-alist. + +2007-01-21 Michael Olson <mwolson@gnu.org> + + * erc.el (erc-header-line-format): Document how to disable the + header line, and add a customization type for it. Also, make the + changes take effect immediately. + +2007-01-19 Michael Olson <mwolson@gnu.org> + + * erc.texi (Modules): Document new menu module. Thanks to Leo + for noticing. + +2007-01-16 Diane Murray <disumu@x3y2z1.net> + + * erc-stamp.el (erc-insert-timestamp-left): Fixed so that the + whitespace string filler is hidden correctly when timestamps are + hidden. + (erc-toggle-timestamps): New function to use instead of + `erc-show-timestamps' and `erc-hide-timestamps'. + + * erc.el (erc-restore-text-properties): Moved here from + erc-fill.el since it could be useful in general. + + * erc-fill.el (erc-restore-text-properties): Removed. + +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-10 Michael Olson <mwolson@gnu.org> + + * erc.el: Fix typo in url-irc-function instructions. + +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. + + +See ChangeLog.06 for earlier changes. + + Copyright (C) 2007, 2008 Free Software Foundation, Inc. + + This file is part of GNU Emacs. + + 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 3, 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. + +;; Local Variables: +;; coding: utf-8 +;; add-log-time-zone-rule: t +;; End: + +;; arch-tag: 3369b6e5-96b1-4b32-96cd-9a905c747496 diff --git a/lisp/erc/erc-autoaway.el b/lisp/erc/erc-autoaway.el index cbfdd0786aa..d777b4e4cb8 100644 --- a/lisp/erc/erc-autoaway.el +++ b/lisp/erc/erc-autoaway.el @@ -248,7 +248,8 @@ exceeds `erc-autoaway-idle-seconds'." ;; A test for (erc-server-process-alive) is not necessary, because ;; this function is called from `erc-timer-hook', which is called ;; whenever the server sends something to the client. - (when (and erc-auto-set-away + (when (and erc-server-connected + erc-auto-set-away (not erc-autoaway-caused-away) (erc-autoaway-some-open-server-buffer)) (let ((idle-time (erc-time-diff erc-autoaway-last-sent-time diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index eff0157c2ff..1bb3e4aada2 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -332,11 +332,10 @@ This is either a coding system, a cons, a function, or nil. If a cons, the encoding system for outgoing text is in the car and the decoding system for incoming text is in the cdr. The most -interesting use for this is to put `undecided' in the cdr. If a -function, it is called with no arguments and should return a -coding system or a cons as described above. Note that you can use -the dynamically bound variable `target' to get the current -target. See `erc-coding-system-for-target'. +interesting use for this is to put `undecided' in the cdr. + +If a function, it is called with the argument `target' and should +return a coding system or a cons as described above. If you need to send non-ASCII text to people not using a client that does decoding on its own, you must tell ERC what encoding to use. @@ -461,27 +460,6 @@ Currently this is called by `erc-send-input'." (upcase-word 1) (buffer-string))) -(defun erc-server-send-ping (buf) - "Send a ping to the IRC server buffer in BUF. -Additionally, detect whether the IRC process has hung." - (if (buffer-live-p buf) - (with-current-buffer buf - (if (and erc-server-send-ping-timeout - (> - (erc-time-diff (erc-current-time) - erc-server-last-received-time) - erc-server-send-ping-timeout)) - (progn - ;; if the process is hung, kill it - (setq erc-server-timed-out t) - (delete-process erc-server-process)) - (erc-server-send (format "PING %.0f" (erc-current-time))))) - ;; remove timer if the server buffer has been killed - (let ((timer (assq buf erc-server-ping-timer-alist))) - (when timer - (erc-cancel-timer (cdr timer)) - (setcdr timer nil))))) - (defun erc-server-setup-periodical-ping (buffer) "Set up a timer to periodically ping the current server. The current buffer is given by BUFFER." @@ -512,6 +490,8 @@ We will store server variables in the buffer given by BUFFER." (let ((process (funcall erc-server-connect-function (format "erc-%s-%s" server port) nil server port))) + (unless (processp process) + (error "Connection attempt failed")) (message "%s...done" msg) ;; Misc server variables (with-current-buffer buffer @@ -536,7 +516,7 @@ We will store server variables in the buffer given by BUFFER." (set-process-filter process 'erc-server-filter-function) (set-process-buffer process buffer))) (erc-log "\n\n\n********************************************\n") - (message (erc-format-message + (message "%s" (erc-format-message 'login ?n (with-current-buffer buffer (erc-current-nick)))) ;; wait with script loading until we receive a confirmation (first @@ -550,11 +530,12 @@ We will store server variables in the buffer given by BUFFER." (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 + (let ((buffer (erc-server-buffer))) + (unless (buffer-live-p buffer) + (if (eq major-mode 'erc-mode) + (setq buffer (current-buffer)) + (error "Reconnect must be run from an ERC buffer"))) + (with-current-buffer buffer (erc-update-mode-line) (erc-set-active-buffer (current-buffer)) (setq erc-server-last-sent-time 0) @@ -609,39 +590,61 @@ EVENT is the message received from the closed connection process." ;; open-network-stream-nowait error for connection refused (not (string-match "^failed with code 111" event))))) -(defun erc-process-sentinel-1 (event) +(defun erc-process-sentinel-2 (event buffer) + "Called when `erc-process-sentinel-1' has detected an unexpected disconnect." + (if (not (buffer-live-p buffer)) + (erc-update-mode-line) + (with-current-buffer buffer + (let ((reconnect-p (erc-server-reconnect-p event))) + (erc-display-message nil 'error (current-buffer) + (if reconnect-p 'disconnected + 'disconnected-noreconnect)) + (if (not reconnect-p) + ;; terminate, do not reconnect + (progn + (erc-display-message nil 'error (current-buffer) + 'terminated ?e event) + ;; Update mode line indicators + (erc-update-mode-line) + (set-buffer-modified-p nil)) + ;; reconnect + (condition-case err + (progn + (setq erc-server-reconnecting nil) + (erc-server-reconnect) + (setq erc-server-reconnect-count 0)) + (error (when (buffer-live-p buffer) + (set-buffer buffer) + (if (integerp erc-server-reconnect-attempts) + (setq erc-server-reconnect-count + (1+ erc-server-reconnect-count)) + (message "%s ... %s" + "Reconnecting until we succeed" + "kill the ERC server buffer to stop")) + (if (numberp erc-server-reconnect-timeout) + (run-at-time erc-server-reconnect-timeout nil + #'erc-process-sentinel-2 + event buffer) + (error (concat "`erc-server-reconnect-timeout`" + " must be a number"))))))))))) + +(defun erc-process-sentinel-1 (event buffer) "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 - (erc-display-message nil 'error (current-buffer) 'finished) - (when erc-kill-server-buffer-on-quit + (with-current-buffer buffer + (if erc-server-quitting + ;; normal quit + (progn + (erc-display-message nil 'error (current-buffer) 'finished) + ;; Update mode line indicators + (erc-update-mode-line) + ;; Kill server buffer if user wants it (set-buffer-modified-p nil) - (kill-buffer (current-buffer)))) - ;; unexpected disconnect - (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 - (setq erc-server-reconnecting nil) - (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)))))) + (when erc-kill-server-buffer-on-quit + (kill-buffer (current-buffer)))) + ;; unexpected disconnect + (erc-process-sentinel-2 event buffer)))) (defun erc-process-sentinel (cproc event) "Sentinel function for ERC process." @@ -668,12 +671,7 @@ Conditionally try to reconnect and take appropriate action." (delete-region (point) (point-max)) ;; Decide what to do with the buffer ;; Restart if disconnected - (erc-process-sentinel-1 event) - ;; Make sure we don't write to the buffer if it has been - ;; killed - (when (buffer-live-p buf) - (erc-update-mode-line) - (set-buffer-modified-p nil)))))) + (erc-process-sentinel-1 event buf))))) ;;;; Sending messages @@ -689,7 +687,7 @@ This is determined via `erc-encoding-coding-alist' or (when (string-match (car pat) target) (throw 'match (cdr pat))))))) (and (functionp erc-server-coding-system) - (funcall erc-server-coding-system)) + (funcall erc-server-coding-system target)) erc-server-coding-system)) (defun erc-decode-string-from-target (str target) @@ -757,6 +755,27 @@ protection algorithm." (message "ERC: No process running") nil))) +(defun erc-server-send-ping (buf) + "Send a ping to the IRC server buffer in BUF. +Additionally, detect whether the IRC process has hung." + (if (buffer-live-p buf) + (with-current-buffer buf + (if (and erc-server-send-ping-timeout + (> + (erc-time-diff (erc-current-time) + erc-server-last-received-time) + erc-server-send-ping-timeout)) + (progn + ;; if the process is hung, kill it + (setq erc-server-timed-out t) + (delete-process erc-server-process)) + (erc-server-send (format "PING %.0f" (erc-current-time))))) + ;; remove timer if the server buffer has been killed + (let ((timer (assq buf erc-server-ping-timer-alist))) + (when timer + (erc-cancel-timer (cdr timer)) + (setcdr timer nil))))) + ;; From Circe (defun erc-server-send-queue (buffer) "Send messages in `erc-server-flood-queue'. @@ -1054,8 +1073,11 @@ Would expand to: \"Some non-generic variable documentation. Hook called upon receiving a WHOIS server response. + Each function is called with two arguments, the process associated - with the response and the parsed response. + with the response and the parsed response. If the function returns + non-nil, stop processing the hook. Otherwise, continue. + See also `erc-server-311'.\") (defalias 'erc-server-WI 'erc-server-311) @@ -1064,7 +1086,9 @@ Would expand to: Hook called upon receiving a WI server response. Each function is called with two arguments, the process associated - with the response and the parsed response. + with the response and the parsed response. If the function returns + non-nil, stop processing the hook. Otherwise, continue. + See also `erc-server-311'.\")) \(fn (NAME &rest ALIASES) &optional EXTRA-FN-DOC EXTRA-VAR-DOC &rest FN-BODY)" @@ -1078,7 +1102,9 @@ Would expand to: (fn-name (intern (format "erc-server-%s" name))) (hook-doc (format "%sHook called upon receiving a %%s server response. Each function is called with two arguments, the process associated -with the response and the parsed response. +with the response and the parsed response. If the function returns +non-nil, stop processing the hook. Otherwise, continue. + See also `%s'." (if extra-var-doc (concat extra-var-doc "\n\n") @@ -1324,7 +1350,7 @@ add things to `%s' instead." (erc-update-mode-line)))) (define-erc-response-handler (PRIVMSG NOTICE) - nil nil + "Handle private messages, including messages in channels." nil (let ((sender-spec (erc-response.sender parsed)) (cmd (erc-response.command parsed)) (tgt (car (erc-response.command-args parsed))) @@ -1388,7 +1414,7 @@ add things to `%s' instead." (add-hook 'erc-server-PRIVMSG-functions 'erc-auto-query) (define-erc-response-handler (QUIT) - nil nil + "Another user has quit IRC." nil (let ((reason (erc-response.contents parsed)) bufs) (multiple-value-bind (nick login host) @@ -1401,7 +1427,7 @@ add things to `%s' instead." ?h host ?r reason)))) (define-erc-response-handler (TOPIC) - nil nil + "The channel topic has changed." nil (let* ((ch (first (erc-response.command-args parsed))) (topic (erc-trim-string (erc-response.contents parsed))) (time (format-time-string "%T %m/%d/%y" (current-time)))) @@ -1414,7 +1440,7 @@ add things to `%s' instead." ?c ch ?T topic)))) (define-erc-response-handler (WALLOPS) - nil nil + "Display a WALLOPS message." nil (let ((message (erc-response.contents parsed))) (multiple-value-bind (nick login host) (erc-parse-user (erc-response.sender parsed)) @@ -1440,12 +1466,12 @@ add things to `%s' instead." (erc-response.contents parsed))) (define-erc-response-handler (376 422) - nil nil + "End of MOTD/MOTD is missing." nil (erc-server-MOTD proc parsed) (erc-connection-established proc parsed)) (define-erc-response-handler (004) - nil nil + "Display the server's identification." nil (multiple-value-bind (server-name server-version) (cdr (erc-response.command-args parsed)) (setq erc-server-version server-version) @@ -1485,7 +1511,7 @@ A server may send more than one 005 message." (erc-display-message parsed 'notice proc line))) (define-erc-response-handler (221) - nil nil + "Display the current user modes." nil (let* ((nick (first (erc-response.command-args parsed))) (modes (mapconcat 'identity (cdr (erc-response.command-args parsed)) " "))) @@ -1513,6 +1539,16 @@ A server may send more than one 005 message." See `erc-display-server-message'." nil (erc-display-server-message proc parsed)) +(define-erc-response-handler (275) + "Display secure connection message." nil + (multiple-value-bind (nick user message) + (cdr (erc-response.command-args parsed)) + (erc-display-message + parsed 'notice 'active 's275 + ?n nick + ?m (mapconcat 'identity (cddr (erc-response.command-args parsed)) + " ")))) + (define-erc-response-handler (290) "Handle dancer-ircd CAPAB messages." nil nil) @@ -1539,6 +1575,16 @@ See `erc-display-server-message'." nil (erc-display-message parsed 'notice 'active 's306 ?m (erc-response.contents parsed))) +(define-erc-response-handler (307) + "Display nick-identified message." nil + (multiple-value-bind (nick user message) + (cdr (erc-response.command-args parsed)) + (erc-display-message + parsed 'notice 'active 's307 + ?n nick + ?m (mapconcat 'identity (cddr (erc-response.command-args parsed)) + " ")))) + (define-erc-response-handler (311 314) "WHOIS/WHOWAS notices." nil (let ((fname (erc-response.contents parsed)) @@ -1551,7 +1597,7 @@ See `erc-display-server-message'." nil ?n nick ?f fname ?u user ?h host)))) (define-erc-response-handler (312) - nil nil + "Server name response in WHOIS." nil (multiple-value-bind (nick server-host) (cdr (erc-response.command-args parsed)) (erc-display-message @@ -1569,7 +1615,7 @@ See `erc-display-server-message'." nil ;; 318 - End of WHOIS list ;; 323 - End of channel LIST ;; 369 - End of WHOWAS - nil nil + "End of WHO/WHOIS/LIST/WHOWAS notices." nil (ignore proc parsed)) (define-erc-response-handler (317) @@ -1590,7 +1636,7 @@ See `erc-display-server-message'." nil ?n nick ?i (erc-sec-to-time (string-to-number seconds-idle)))))) (define-erc-response-handler (319) - nil nil + "Channel names in WHOIS response." nil (erc-display-message parsed 'notice 'active 's319 ?n (second (erc-response.command-args parsed)) @@ -1604,8 +1650,13 @@ See `erc-display-server-message'." nil (define-erc-response-handler (321) "LIST header." nil - (setq erc-channel-list nil) - (erc-display-message parsed 'notice proc 's321)) + (setq erc-channel-list nil)) + +(defun erc-server-321-message (proc parsed) + "Display a message for the 321 event." + (erc-display-message parsed 'notice proc 's321) + nil) +(add-hook 'erc-server-321-functions 'erc-server-321-message t) (define-erc-response-handler (322) "LIST notice." nil @@ -1613,10 +1664,17 @@ See `erc-display-server-message'." nil (multiple-value-bind (channel num-users) (cdr (erc-response.command-args parsed)) (add-to-list 'erc-channel-list (list channel)) - (erc-update-channel-topic channel topic) + (erc-update-channel-topic channel topic)))) + +(defun erc-server-322-message (proc parsed) + "Display a message for the 322 event." + (let ((topic (erc-response.contents parsed))) + (multiple-value-bind (channel num-users) + (cdr (erc-response.command-args parsed)) (erc-display-message parsed 'notice proc 's322 ?c channel ?u num-users ?t (or topic ""))))) +(add-hook 'erc-server-322-functions 'erc-server-322-message t) (define-erc-response-handler (324) "Channel or nick modes." nil @@ -1638,7 +1696,7 @@ See `erc-display-server-message'." nil 's329 ?c channel ?t (format-time-string "%A %Y/%m/%d %X" time)))) (define-erc-response-handler (330) - nil nil + "Nick is authed as (on Quakenet network)." nil ;; FIXME: I don't know what the magic numbers mean. Mummy, make ;; the magic numbers go away. ;; No seriously, I have no clue about the format of this command, @@ -1654,10 +1712,9 @@ See `erc-display-server-message'." nil ?n nick ?a authmsg ?i authaccount))) (define-erc-response-handler (331) - "Channel topic." nil + "No topic set for channel." nil (let ((channel (second (erc-response.command-args parsed))) (topic (erc-response.contents parsed))) - ;; FIXME: why don't we do anything with the topic? -- Lawrence 2004/05/10 (erc-display-message parsed 'notice (erc-get-buffer channel proc) 's331 ?c channel))) @@ -1670,8 +1727,7 @@ See `erc-display-server-message'." nil 's332 ?c channel ?T topic))) (define-erc-response-handler (333) - ;; Who set the topic, and when - nil nil + "Who set the topic, and when." nil (multiple-value-bind (channel nick time) (cdr (erc-response.command-args parsed)) (setq time (format-time-string "%T %Y/%m/%d" @@ -1721,7 +1777,7 @@ See `erc-display-server-message'." nil (erc-channel-end-receiving-names))) (define-erc-response-handler (367) - "Channel ban list entries" nil + "Channel ban list entries." nil (multiple-value-bind (channel banmask setter time) (cdr (erc-response.command-args parsed)) ;; setter and time are not standard @@ -1736,7 +1792,7 @@ See `erc-display-server-message'." nil ?b banmask)))) (define-erc-response-handler (368) - "End of channel ban list" nil + "End of channel ban list." nil (let ((channel (second (erc-response.command-args parsed)))) (erc-display-message parsed 'notice 'active 's368 ?c channel))) @@ -1752,7 +1808,7 @@ See `erc-display-server-message'." nil 's379 ?c from ?f to))) (define-erc-response-handler (391) - "Server's time string" nil + "Server's time string." nil (erc-display-message parsed 'notice 'active 's391 ?s (second (erc-response.command-args parsed)) @@ -1779,56 +1835,47 @@ See `erc-display-server-message'." nil (define-erc-response-handler (405) - ;; Can't join that many channels. - nil nil + "Can't join that many channels." nil (erc-display-message parsed '(notice error) 'active 's405 ?c (second (erc-response.command-args parsed)))) (define-erc-response-handler (406) - ;; No such nick - nil nil + "No such nick." nil (erc-display-message parsed '(notice error) 'active 's406 ?n (second (erc-response.command-args parsed)))) (define-erc-response-handler (412) - ;; No text to send - nil nil + "No text to send." nil (erc-display-message parsed '(notice error) 'active 's412)) (define-erc-response-handler (421) - ;; Unknown command - nil nil + "Unknown command." nil (erc-display-message parsed '(notice error) 'active 's421 ?c (second (erc-response.command-args parsed)))) (define-erc-response-handler (432) - ;; Bad nick. - nil nil + "Bad nick." nil (erc-display-message parsed '(notice error) 'active 's432 ?n (second (erc-response.command-args parsed)))) (define-erc-response-handler (433) - ;; Login-time "nick in use" - nil nil + "Login-time \"nick in use\"." nil (erc-nickname-in-use (second (erc-response.command-args parsed)) "already in use")) (define-erc-response-handler (437) - ;; Nick temporarily unavailable (IRCnet) - nil nil + "Nick temporarily unavailable (on IRCnet)." nil (let ((nick/channel (second (erc-response.command-args parsed)))) (unless (erc-channel-p nick/channel) (erc-nickname-in-use nick/channel "temporarily unavailable")))) (define-erc-response-handler (442) - ;; Not on channel - nil nil + "Not on channel." nil (erc-display-message parsed '(notice error) 'active 's442 ?c (second (erc-response.command-args parsed)))) (define-erc-response-handler (461) - ;; Not enough params for command. - nil nil + "Not enough parameters for command." nil (erc-display-message parsed '(notice error) 'active 's461 ?c (second (erc-response.command-args parsed)) ?m (erc-response.contents parsed))) @@ -1842,7 +1889,7 @@ See `erc-display-server-message'." nil (erc-response.contents parsed))) (define-erc-response-handler (474) - "Banned from channel errors" nil + "Banned from channel errors." nil (erc-display-message parsed '(notice error) nil (intern (format "s%s" (erc-response.command parsed))) @@ -1861,14 +1908,14 @@ See `erc-display-server-message'." nil (erc-cmd-JOIN channel key))))) (define-erc-response-handler (477) - nil nil + "Channel doesn't support modes." nil (let ((channel (second (erc-response.command-args parsed))) (message (erc-response.contents parsed))) (erc-display-message parsed 'notice (erc-get-buffer channel proc) (format "%s: %s" channel message)))) (define-erc-response-handler (482) - nil nil + "You need to be a channel operator to do that." nil (let ((channel (second (erc-response.command-args parsed))) (message (erc-response.contents parsed))) (erc-display-message parsed '(error notice) 'active 's482 @@ -1890,7 +1937,9 @@ See `erc-display-server-message'." nil ;; 491 - No O-lines for your host ;; 501 - Unknown MODE flag ;; 502 - Cannot change mode for other users - nil nil + "Generic display of server error messages. + +See `erc-display-error-notice'." nil (erc-display-error-notice parsed (intern (format "s%s" (erc-response.command parsed))))) diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index 249715f2674..a1e072ca191 100644 --- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -57,16 +57,15 @@ ((add-hook 'erc-insert-modify-hook 'erc-button-add-buttons 'append) (add-hook 'erc-send-modify-hook 'erc-button-add-buttons 'append) (add-hook 'erc-complete-functions 'erc-button-next) - (add-hook 'erc-mode-hook 'erc-button-add-keys)) + (add-hook 'erc-mode-hook 'erc-button-setup)) ((remove-hook 'erc-insert-modify-hook 'erc-button-add-buttons) (remove-hook 'erc-send-modify-hook 'erc-button-add-buttons) (remove-hook 'erc-complete-functions 'erc-button-next) - (remove-hook 'erc-mode-hook 'erc-button-add-keys))) - -;; Make XEmacs use `erc-button-face'. -(when (featurep 'xemacs) - (add-hook 'erc-mode-hook - (lambda () (set (make-local-variable 'widget-button-face) nil)))) + (remove-hook 'erc-mode-hook 'erc-button-setup) + (when (featurep 'xemacs) + (dolist (buffer (erc-buffer-list)) + (with-current-buffer buffer + (kill-local-variable 'widget-button-face)))))) ;;; Variables @@ -99,7 +98,7 @@ above them." (concat "\\(www\\.\\|\\(s?https?\\|" "ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\)" "\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?" - "[-a-zA-Z0-9_=!?#$@~`%&*+\\/:;.,]+[-a-zA-Z0-9_=#$@~`%&*+\\/]") + "[-a-zA-Z0-9_=!?#$@~`%&*+\\/:;.,()]+[-a-zA-Z0-9_=#$@~`%&*+\\/()]") "Regular expression that matches URLs." :group 'erc-button :type 'regexp) @@ -247,8 +246,12 @@ constituents.") "Internal variable used to keep track of whether we've added the global-level ERC button keys yet.") -(defun erc-button-add-keys () +(defun erc-button-setup () "Add ERC mode-level button movement keys. This is only done once." + ;; Make XEmacs use `erc-button-face'. + (when (featurep 'xemacs) + (set (make-local-variable 'widget-button-face) nil)) + ;; Add keys. (unless erc-button-keys-added (define-key erc-mode-map (kbd "<backtab>") 'erc-button-previous) (setq erc-button-keys-added t))) @@ -299,9 +302,10 @@ specified by `erc-button-alist'." (setq bounds (bounds-of-thing-at-point 'word)) (setq word (buffer-substring-no-properties (car bounds) (cdr bounds))) - (if (erc-get-server-user word) - (erc-button-add-button (car bounds) (cdr bounds) - fun t (list word))))))) + (when (or (and (erc-server-buffer-p) (erc-get-server-user word)) + (and erc-channel-users (erc-get-channel-user word))) + (erc-button-add-button (car bounds) (cdr bounds) + fun t (list word))))))) (defun erc-button-add-buttons-1 (regexp entry) "Search through the buffer for matches to ENTRY and add buttons." diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el index 66ab51e8f48..dd01280b3aa 100644 --- a/lisp/erc/erc-compat.el +++ b/lisp/erc/erc-compat.el @@ -50,12 +50,27 @@ See `erc-encoding-coding-alist'." (defalias 'erc-delete-dups 'delete-dups) (defalias 'erc-replace-regexp-in-string 'replace-regexp-in-string) +(defun erc-set-write-file-functions (new-val) + (set (make-local-variable 'write-file-functions) new-val)) + (defvar erc-emacs-build-time (if (stringp emacs-build-time) emacs-build-time (format-time-string "%Y-%m-%d" emacs-build-time)) "Time at which Emacs was dumped out.") +;; Emacs 21 and XEmacs do not have user-emacs-directory, but XEmacs +;; has user-init-directory. +(defvar erc-user-emacs-directory + (cond ((boundp 'user-emacs-directory) + user-emacs-directory) + ((boundp 'user-init-directory) + user-init-directory) + (t "~/.emacs.d/")) + "Directory beneath which additional per-user Emacs-specific files +are placed. +Note that this should end with a directory separator.") + ;; XEmacs' `replace-match' does not replace matching subexpressions in strings. (defun erc-replace-match-subexpression-in-string (newtext string match subexp start &optional fixedcase literal) @@ -68,57 +83,11 @@ See `replace-match' for explanations of FIXEDCASE and LITERAL." (replace-match newtext fixedcase literal string)) (t (replace-match newtext fixedcase literal string subexp)))) +(defalias 'erc-with-selected-window 'with-selected-window) (defalias 'erc-cancel-timer 'cancel-timer) (defalias 'erc-make-obsolete 'make-obsolete) (defalias 'erc-make-obsolete-variable 'make-obsolete-variable) -;; Provde an equivalent of `assert', based on the code from cl-macs.el -(defun erc-const-expr-p (x) - (cond ((consp x) - (or (eq (car x) 'quote) - (and (memq (car x) '(function function*)) - (or (symbolp (nth 1 x)) - (and (eq (and (consp (nth 1 x)) - (car (nth 1 x))) 'lambda) 'func))))) - ((symbolp x) (and (memq x '(nil t)) t)) - (t t))) - -(put 'erc-assertion-failed 'error-conditions '(error)) -(put 'erc-assertion-failed 'error-message "Assertion failed") - -(defun erc-list* (arg &rest rest) - "Return a new list with specified args as elements, cons'd to last arg. -Thus, `(list* A B C D)' is equivalent to `(nconc (list A B C) D)', or to -`(cons A (cons B (cons C D)))'." - (cond ((not rest) arg) - ((not (cdr rest)) (cons arg (car rest))) - (t (let* ((n (length rest)) - (copy (copy-sequence rest)) - (last (nthcdr (- n 2) copy))) - (setcdr last (car (cdr last))) - (cons arg copy))))) - -(defmacro erc-assert (form &optional show-args string &rest args) - "Verify that FORM returns non-nil; signal an error if not. -Second arg SHOW-ARGS means to include arguments of FORM in message. -Other args STRING and ARGS... are arguments to be passed to `error'. -They are not evaluated unless the assertion fails. If STRING is -omitted, a default message listing FORM itself is used." - (let ((sargs - (and show-args - (delq nil (mapcar - (function - (lambda (x) - (and (not (erc-const-expr-p x)) x))) - (cdr form)))))) - (list 'progn - (list 'or form - (if string - (erc-list* 'error string (append sargs args)) - (list 'signal '(quote erc-assertion-failed) - (erc-list* 'list (list 'quote form) sargs)))) - nil))) - ;; Provide a simpler replacement for `member-if' (defun erc-member-if (predicate list) "Find the first item satisfying PREDICATE in LIST. diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index 8158c0999d3..a31f87b4933 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -60,6 +60,12 @@ (require 'cl) (require 'pcomplete)) +;;;###autoload (autoload 'erc-dcc-mode "erc-dcc") +(define-erc-module dcc nil + "Provide Direct Client-to-Client support for ERC." + ((add-hook 'erc-server-401-functions 'erc-dcc-no-such-nick)) + ((remove-hook 'erc-server-401-functions 'erc-dcc-no-such-nick))) + (defgroup erc-dcc nil "DCC stands for Direct Client Communication, where you and your friend's client programs connect directly to each other, @@ -70,7 +76,7 @@ Using DCC get and send, you can transfer files directly from and to other IRC users." :group 'erc) -(defcustom erc-verbose-dcc t +(defcustom erc-dcc-verbose nil "*If non-nil, be verbose about DCC activity reporting." :group 'erc-dcc :type 'boolean) @@ -195,20 +201,22 @@ compared with `erc-nick-equal-p' which is IRC case-insensitive." (setq list (cdr list))))) result)) -;; msa wrote this nifty little frob to convert an n-byte integer to a packed -;; string. -(defun erc-pack-int (value count) - (if (> count 0) - (concat (erc-pack-int (/ value 256) (1- count)) - (char-to-string (% value 256))) - "")) +(defun erc-pack-int (value) + "Convert an integer into a packed string." + (let* ((len (ceiling (/ value 256.0))) + (str (make-string len ?a)) + (i (1- len))) + (while (>= i 0) + (aset str i (% value 256)) + (setq value (/ value 256)) + (setq i (1- i))) + str)) (defun erc-unpack-int (str) - "Unpack a 1-4 character packed string into an integer." + "Unpack a packed string into an integer." (let ((len (length str)) (num 0) (count 0)) - (erc-assert (<= len 4)) ;; this isn't going to fit in elisp bounds (while (< count len) (setq num (+ num (lsh (aref str (- len count 1)) (* 8 count)))) (setq count (1+ count))) @@ -256,15 +264,24 @@ The result is also a string." ;;; Server code -(defcustom erc-dcc-host nil - "*IP address to use for outgoing DCC offers. -Should be set to a string or nil, if nil, automatic detection of the -host interface to use will be attempted." +(defcustom erc-dcc-listen-host nil + "IP address to listen on when offering files. +Should be set to a string or nil. If nil, automatic detection of +the host interface to use will be attempted." :group 'erc-dcc :type (list 'choice (list 'const :tag "Auto-detect" nil) (list 'string :tag "IP-address" :valid-regexp erc-dcc-ipv4-regexp))) +(defcustom erc-dcc-public-host nil + "IP address to use for outgoing DCC offers. +Should be set to a string or nil. If nil, use the value of +`erc-dcc-listen-host'." + :group 'erc-dcc + :type (list 'choice (list 'const :tag "Same as erc-dcc-listen-host" nil) + (list 'string :tag "IP-address" + :valid-regexp erc-dcc-ipv4-regexp))) + (defcustom erc-dcc-send-request 'ask "*How to treat incoming DCC Send requests. 'ask - Report the Send request, and wait for the user to manually accept it @@ -282,7 +299,7 @@ host interface to use will be attempted." "Determine the IP address we are using. If variable `erc-dcc-host' is non-nil, use it. Otherwise call `erc-dcc-get-host' on the erc-server-process." - (or erc-dcc-host (erc-dcc-get-host erc-server-process) + (or erc-dcc-listen-host (erc-dcc-get-host erc-server-process) (error "Unable to determine local address"))) (defcustom erc-dcc-port-range nil @@ -311,6 +328,7 @@ created subprocess, or nil." process) (while (not process) (condition-case err + (progn (setq process (make-network-process :name name :buffer nil @@ -322,6 +340,11 @@ created subprocess, or nil." :sentinel sentinel :log #'erc-dcc-server-accept :server t)) + (when (processp process) + (when (fboundp 'set-process-coding-system) + (set-process-coding-system process 'binary 'binary)) + (when (fboundp 'set-process-filter-multibyte) + (set-process-filter-multibyte process nil)))) (file-error (unless (and (string= "Cannot bind server socket" (cadr err)) (string= "address already in use" (caddr err))) @@ -451,7 +474,12 @@ type and nick are optional." ?n (erc-extract-nick (plist-get ret :nick)))))) t)) -(defun erc-dcc-do-GET-command (proc nick &optional file) +(defun erc-dcc-do-GET-command (proc nick &rest file) + "Do a DCC GET command. NICK is the person who is sending the file. +FILE is the filename. If FILE is split into multiple arguments, +re-join the arguments, separated by a space. +PROC is the server process." + (setq file (and file (mapconcat #'identity file " "))) (let* ((elt (erc-dcc-member :nick nick :type 'GET)) (filename (or file (plist-get elt :file) "unknown"))) (if elt @@ -524,8 +552,11 @@ It lists the current state of `erc-dcc-list' in an easy to read manner." 'dcc-list-end) t)) -(defun erc-dcc-do-SEND-command (proc nick file) - "Offer FILE to NICK by sending a ctcp dcc send message." +(defun erc-dcc-do-SEND-command (proc nick &rest file) + "Offer FILE to NICK by sending a ctcp dcc send message. +If FILE is split into multiple arguments, re-join the arguments, +separated by a space." + (setq file (and file (mapconcat #'identity file " "))) (if (file-exists-p file) (progn (erc-display-message @@ -698,7 +729,7 @@ bytes sent." (confirmed-marker (plist-get elt :sent)) (sent-marker (plist-get elt :sent))) (with-current-buffer (process-buffer proc) - (when erc-verbose-dcc + (when erc-dcc-verbose (erc-display-message nil 'notice (erc-dcc-get-parent proc) (format "DCC: Confirmed %d, sent %d, sending block now" @@ -713,8 +744,7 @@ bytes sent." (length string))))) (defun erc-dcc-send-filter (proc string) - (erc-assert (= (% (length string) 4) 0)) - (let* ((size (erc-unpack-int (substring string (- (length string) 4)))) + (let* ((size (erc-unpack-int string)) (elt (erc-dcc-member :peer proc)) (parent (plist-get elt :parent)) (sent-marker (plist-get elt :sent)) @@ -742,16 +772,21 @@ bytes sent." ((> confirmed-marker sent-marker) (erc-display-message nil 'notice parent - (format "DCC: Client confirmed too much!")) + (format "DCC: Client confirmed too much (%s vs %s)!" + (marker-position confirmed-marker) + (marker-position sent-marker))) + (set-buffer-modified-p nil) + (kill-buffer (current-buffer)) (delete-process proc)))))) +(defun erc-dcc-display-send (proc) + (erc-display-message + nil 'notice (erc-dcc-get-parent proc) + (format "DCC: SEND connect from %s" + (format-network-address (process-contact proc :remote))))) + (defcustom erc-dcc-send-connect-hook - '((lambda (proc) - (erc-display-message - nil 'notice (erc-dcc-get-parent proc) - (format "DCC: SEND connect from %s" - (format-network-address (process-contact proc :remote))))) - erc-dcc-send-block) + '(erc-dcc-display-send erc-dcc-send-block) "*Hook run whenever the remote end of a DCC SEND offer connected to your listening port." :group 'erc-dcc @@ -762,14 +797,14 @@ listening port." (erc-extract-nick (plist-get plist :nick))) (defun erc-dcc-send-sentinel (proc event) - (let* ((elt (erc-dcc-member :peer proc)) - (buf (marker-buffer (plist-get elt :sent)))) + (let* ((elt (erc-dcc-member :peer proc))) (cond ((string-match "^open from " event) (when elt - (with-current-buffer buf - (set-process-buffer proc buf) - (setq erc-dcc-entry-data elt)) + (let ((buf (marker-buffer (plist-get elt :sent)))) + (with-current-buffer buf + (set-process-buffer proc buf) + (setq erc-dcc-entry-data elt))) (run-hook-with-args 'erc-dcc-send-connect-hook proc)))))) (defun erc-dcc-find-file (file) @@ -807,15 +842,23 @@ other client." (process-send-string pproc (format "PRIVMSG %s :\C-aDCC SEND %s %s %d %d\C-a\n" nick (erc-dcc-file-to-name file) - (erc-ip-to-decimal (nth 0 contact)) + (erc-ip-to-decimal (or erc-dcc-public-host + (nth 0 contact))) (nth 1 contact) size))) (error "`make-network-process' not supported by your Emacs"))) ;;; GET handling +(defcustom erc-dcc-receive-cache (* 1024 512) + "Number of bytes to let the receive buffer grow before flushing it." + :group 'erc-dcc + :type 'integer) + (defvar erc-dcc-byte-count nil) (make-variable-buffer-local 'erc-dcc-byte-count) +(defvar erc-dcc-file-name nil) +(make-variable-buffer-local 'erc-dcc-file-name) (defun erc-dcc-get-file (entry file parent-proc) "This function does the work of setting up a transfer from the remote client @@ -825,6 +868,7 @@ filter and a process sentinel, and making the connection." proc) (with-current-buffer buffer (fundamental-mode) + (buffer-disable-undo (current-buffer)) ;; This is necessary to have the buffer saved as-is in GNU ;; Emacs. ;; XEmacs change: We don't have `set-buffer-multibyte', setting @@ -835,7 +879,10 @@ filter and a process sentinel, and making the connection." (setq mode-line-process '(":%s") buffer-file-type t buffer-read-only t) - (set-visited-file-name file) + (setq erc-dcc-file-name file) + + ;; Truncate the given file to size 0 before appending to it. + (write-region (point) (point) erc-dcc-file-name nil 'nomessage) (setq erc-server-process parent-proc erc-dcc-entry-data entry) @@ -847,7 +894,6 @@ filter and a process sentinel, and making the connection." (string-to-number (plist-get entry :port)) entry)) (set-process-buffer proc buffer) - ;; The following two lines make saving as-is work under Windows (set-process-coding-system proc 'binary 'binary) (set-buffer-file-coding-system 'binary t) @@ -856,6 +902,14 @@ filter and a process sentinel, and making the connection." (setq entry (plist-put entry :start-time (erc-current-time))) (setq entry (plist-put entry :peer proc))))) +(defun erc-dcc-append-contents (buffer file) + "Append the contents of BUFFER to FILE. +The contents of the BUFFER will then be erased." + (with-current-buffer buffer + (let ((coding-system-for-write 'binary)) + (write-region (point-min) (point-max) erc-dcc-file-name t 'nomessage) + (erase-buffer)))) + (defun erc-dcc-get-filter (proc str) "This is the process filter for transfers from other clients to this one. It reads incoming bytes from the network and stores them in the DCC @@ -868,8 +922,10 @@ rather than every 1024 byte block, but nobody seems to care." (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 + (when (> (point-max) erc-dcc-receive-cache) + (erc-dcc-append-contents (current-buffer) erc-dcc-file-name)) + + (and erc-dcc-verbose (erc-display-message nil 'notice erc-server-process 'dcc-get-bytes-received @@ -885,7 +941,7 @@ rather than every 1024 byte block, but nobody seems to care." (delete-process proc)) (t (process-send-string - proc (erc-pack-int erc-dcc-byte-count 4))))))) + proc (erc-pack-int erc-dcc-byte-count))))))) (defun erc-dcc-get-sentinel (proc event) @@ -895,17 +951,18 @@ transfer is complete." ;; FIXME, we should look at EVENT, and also check size. (with-current-buffer (process-buffer proc) (delete-process proc) - (setq buffer-read-only nil) (setq erc-dcc-list (delete erc-dcc-entry-data erc-dcc-list)) + (unless (= (point-min) (point-max)) + (setq erc-dcc-byte-count (+ (buffer-size) erc-dcc-byte-count)) + (erc-dcc-append-contents (current-buffer) erc-dcc-file-name)) (erc-display-message nil 'notice erc-server-process 'dcc-get-complete - ?f (file-name-nondirectory buffer-file-name) - ?s (number-to-string (buffer-size)) + ?f erc-dcc-file-name + ?s (number-to-string erc-dcc-byte-count) ?t (format "%.0f" (erc-time-diff (plist-get erc-dcc-entry-data :start-time) - (erc-current-time)))) - (save-buffer)) + (erc-current-time))))) (kill-buffer (process-buffer proc)) (delete-process proc)) @@ -1126,8 +1183,6 @@ other client." (if (processp peer) (delete-process peer))) nil)) -(add-hook 'erc-server-401-functions 'erc-dcc-no-such-nick) - (provide 'erc-dcc) ;;; erc-dcc.el ends here diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el index dc443b9b615..ff065467f84 100644 --- a/lisp/erc/erc-goodies.el +++ b/lisp/erc/erc-goodies.el @@ -33,10 +33,14 @@ (require 'erc) -;; Imenu Autoload -(add-hook 'erc-mode-hook - (lambda () - (setq imenu-create-index-function 'erc-create-imenu-index))) +;;; Imenu support + +(defun erc-imenu-setup () + "Setup Imenu support in an ERC buffer." + (set (make-local-variable 'imenu-create-index-function) + 'erc-create-imenu-index)) + +(add-hook 'erc-mode-hook 'erc-imenu-setup) (autoload 'erc-create-imenu-index "erc-imenu" "Imenu index creation function") ;;; Automatically scroll to bottom @@ -51,11 +55,15 @@ argument to `recenter'." :type '(choice integer (const nil))) (define-erc-module scrolltobottom nil - "This mode causes the prompt to stay at the end of the window. -You have to activate or deactivate it in already created windows -separately." - ((add-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)) - ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom))) + "This mode causes the prompt to stay at the end of the window." + ((add-hook 'erc-mode-hook 'erc-add-scroll-to-bottom) + (dolist (buffer (erc-buffer-list)) + (with-current-buffer buffer + (erc-add-scroll-to-bottom)))) + ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom) + (dolist (buffer (erc-buffer-list)) + (with-current-buffer buffer + (remove-hook 'window-scroll-functions 'erc-scroll-to-bottom t))))) (defun erc-add-scroll-to-bottom () "A hook function for `erc-mode-hook' to recenter output at bottom of window. @@ -77,15 +85,14 @@ You can control which line is recentered to by customizing the variable `erc-input-line-position'. DISPLAY-START is ignored." - (if (and window (window-live-p window)) + (if (window-live-p window) ;; Temporarily bind resize-mini-windows to nil so that users who have it ;; set to a non-nil value will not suffer from premature minibuffer ;; shrinkage due to the below recenter call. I have no idea why this ;; works, but it solves the problem, and has no negative side effects. ;; (Fran Litterio, 2003/01/07) (let ((resize-mini-windows nil)) - (save-selected-window - (select-window window) + (erc-with-selected-window window (save-restriction (widen) (when (and erc-insert-marker @@ -111,7 +118,46 @@ Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'." (put-text-property (point-min) (point-max) 'front-sticky t) (put-text-property (point-min) (point-max) 'rear-nonsticky t)) -;; Distinguish non-commands +;;; Move to prompt when typing text +(define-erc-module move-to-prompt nil + "This mode causes the point to be moved to the prompt when typing text." + ((add-hook 'erc-mode-hook 'erc-move-to-prompt-setup) + (dolist (buffer (erc-buffer-list)) + (with-current-buffer buffer + (erc-move-to-prompt-setup)))) + ((remove-hook 'erc-mode-hook 'erc-move-to-prompt-setup) + (dolist (buffer (erc-buffer-list)) + (with-current-buffer buffer + (remove-hook 'pre-command-hook 'erc-move-to-prompt t))))) + +(defun erc-move-to-prompt () + "Move the point to the ERC prompt if this is a self-inserting command." + (when (and erc-input-marker (< (point) erc-input-marker) + (eq 'self-insert-command this-command)) + (deactivate-mark) + (push-mark) + (goto-char (point-max)))) + +(defun erc-move-to-prompt-setup () + "Initialize the move-to-prompt module for XEmacs." + (add-hook 'pre-command-hook 'erc-move-to-prompt nil t)) + +;;; Keep place in unvisited channels +(define-erc-module keep-place nil + "Leave point above un-viewed text in other channels." + ((add-hook 'erc-insert-pre-hook 'erc-keep-place)) + ((remove-hook 'erc-insert-pre-hook 'erc-keep-place))) + +(defun erc-keep-place (ignored) + "Move point away from the last line in a non-selected ERC buffer." + (when (and (not (eq (window-buffer (selected-window)) + (current-buffer))) + (>= (point) erc-insert-marker)) + (deactivate-mark) + (goto-char (erc-beg-of-input-line)) + (forward-line -1))) + +;;; Distinguish non-commands (defvar erc-noncommands-list '(erc-cmd-ME erc-cmd-COUNTRY erc-cmd-SV @@ -282,10 +328,8 @@ The value `erc-interpret-controls-p' must also be t for this to work." "Fetches the right face for background color N (0-15)." (if (stringp n) (setq n (string-to-number n))) (if (not (numberp n)) - (progn - (message "erc-get-bg-color-face: n is NaN: %S" n) - (beep) - 'default) + (prog1 'default + (erc-error "erc-get-bg-color-face: n is NaN: %S" n)) (when (> n 16) (erc-log (format " Wrong color: %s" n)) (setq n (mod n 16))) @@ -298,10 +342,8 @@ The value `erc-interpret-controls-p' must also be t for this to work." "Fetches the right face for foreground color N (0-15)." (if (stringp n) (setq n (string-to-number n))) (if (not (numberp n)) - (progn - (message "erc-get-fg-color-face: n is NaN: %S" n) - (beep) - 'default) + (prog1 'default + (erc-error "erc-get-fg-color-face: n is NaN: %S" n)) (when (> n 16) (erc-log (format " Wrong color: %s" n)) (setq n (mod n 16))) @@ -501,8 +543,19 @@ channel that has weird people talking in morse to each other. See also `unmorse-region'." (goto-char (point-min)) - (when (re-search-forward "[.-]+\\([.-]+[/ ]\\)+[.-]+" nil t) - (unmorse-region (match-beginning 0) (match-end 0)))) + (when (re-search-forward "[.-]+\\([.-]*/? *\\)+[.-]+/?" nil t) + (save-restriction + (narrow-to-region (match-beginning 0) (match-end 0)) + ;; Turn " / " into " " + (goto-char (point-min)) + (while (re-search-forward " / " nil t) + (replace-match " ")) + ;; Turn "/ " into "/" + (goto-char (point-min)) + (while (re-search-forward "/ " nil t) + (replace-match "/")) + ;; Unmorse region + (unmorse-region (point-min) (point-max))))) ;;; erc-occur (defun erc-occur (string &optional proc) diff --git a/lisp/erc/erc-ibuffer.el b/lisp/erc/erc-ibuffer.el index 3e659ee216d..14ac36540a9 100644 --- a/lisp/erc/erc-ibuffer.el +++ b/lisp/erc/erc-ibuffer.el @@ -71,6 +71,10 @@ (string-match qualifier (or erc-server-announced-name erc-session-server))))) +;; Silence the byte-compiler +(eval-when-compile + (defvar erc-modified-channels-alist)) + (define-ibuffer-column erc-modified (:name "M") (if (and (boundp 'erc-track-mode) erc-track-mode) @@ -154,8 +158,8 @@ (format "l %d" erc-channel-user-limit) "") ")") - (if (not (eq major-mode 'erc-mode)) - mode-name + (if (not (derived-mode-p 'erc-mode)) + (format-mode-line mode-name nil nil (current-buffer)) ""))) (define-ibuffer-column erc-nick (:name "Nick") diff --git a/lisp/erc/erc-identd.el b/lisp/erc/erc-identd.el index 24f450388dd..d8d8a80b875 100644 --- a/lisp/erc/erc-identd.el +++ b/lisp/erc/erc-identd.el @@ -74,7 +74,8 @@ This can be either a string or a number." (format "%s, %s : USERID : %s : %s\n" port-on-server port-on-client system-type (user-login-name))) - (process-send-eof erc-identd-process))))) + (stop-process erc-identd-process) + (delete-process proc))))) ;;;###autoload (defun erc-identd-start (&optional port) diff --git a/lisp/erc/erc-lang.el b/lisp/erc/erc-lang.el index 67f0960cb51..e3858eb1153 100644 --- a/lisp/erc/erc-lang.el +++ b/lisp/erc/erc-lang.el @@ -197,7 +197,7 @@ Normungsinstitut (ON), Postfach 130, A-1021 Vienna, Austria.") "Return the language name for the ISO CODE." (interactive (list (completing-read "ISO language code: " iso-638-languages))) - (message (cdr (assoc code iso-638-languages)))) + (message "%s" (cdr (assoc code iso-638-languages)))) (defun erc-cmd-LANG (language) "Display the language name for the language code given by LANGUAGE." diff --git a/lisp/erc/erc-list.el b/lisp/erc/erc-list.el new file mode 100644 index 00000000000..586c720dd19 --- /dev/null +++ b/lisp/erc/erc-list.el @@ -0,0 +1,229 @@ +;;; erc-list.el --- /list support for ERC + +;; Copyright (C) 2008 Free Software Foundation, Inc. + +;; Author: Tom Tromey <tromey@redhat.com> +;; Version: 0.1 +;; Keywords: comm + +;; This file is part of ERC. + +;; ERC 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 3, or (at your option) +;; any later version. + +;; ERC 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 ERC; 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 provides nice support for /list in ERC. + +;;; Code: + +(require 'erc) + +;; This is implicitly the width of the channel name column. Pick +;; something small enough that the topic has a chance of being +;; readable, but long enough that most channel names won't make for +;; strange formatting. +(defconst erc-list-nusers-column 25) + +;; Width of the number-of-users column. +(defconst erc-list-topic-column (+ erc-list-nusers-column 10)) + +;; The list buffer. This is buffer local in the server buffer. +(defvar erc-list-buffer nil) + +;; The argument to the last "/list". This is buffer local in the +;; server buffer. +(defvar erc-list-last-argument nil) + +;; The server buffer corresponding to the list buffer. This is buffer +;; local in the list buffer. +(defvar erc-list-server-buffer nil) + +;; Define module: +;;;###autoload (autoload 'erc-list-mode "erc-list") +(define-erc-module list nil + "List channels nicely in a separate buffer." + ((remove-hook 'erc-server-321-functions 'erc-server-321-message) + (remove-hook 'erc-server-322-functions 'erc-server-322-message)) + ((erc-with-all-buffers-of-server nil + #'erc-open-server-buffer-p + (remove-hook 'erc-server-322-functions 'erc-list-handle-322 t)) + (add-hook 'erc-server-321-functions 'erc-server-321-message t) + (add-hook 'erc-server-322-functions 'erc-server-322-message t))) + +;; Format a record for display. +(defun erc-list-make-string (channel users topic) + (concat + channel + (erc-propertize " " + 'display (list 'space :align-to erc-list-nusers-column) + 'face 'fixed-pitch) + users + (erc-propertize " " + 'display (list 'space :align-to erc-list-topic-column) + 'face 'fixed-pitch) + topic)) + +;; Insert a record into the list buffer. +(defun erc-list-insert-item (channel users topic) + (save-excursion + (let ((buffer-read-only nil)) + (goto-char (point-max)) + (insert (erc-list-make-string channel users topic) "\n")))) + +(defun erc-list-join () + "Join the irc channel named on this line." + (interactive) + (unless (eobp) + (beginning-of-line) + (unless (looking-at "\\([&#+!][^ \n]+\\)") + (error "Not looking at channel name?")) + (let ((chan (match-string 1))) + (with-current-buffer erc-list-server-buffer + (erc-join-channel chan))))) + +(defun erc-list-kill () + "Kill the current ERC list buffer." + (interactive) + (kill-buffer (current-buffer))) + +(defun erc-list-revert () + "Refresh the list of channels." + (interactive) + (with-current-buffer erc-list-server-buffer + (erc-cmd-LIST erc-list-last-argument))) + +(defun erc-list-menu-sort-by-column (&optional e) + "Sort the channel list by the column clicked on." + (interactive (list last-input-event)) + (if e (mouse-select-window e)) + (let* ((pos (event-start e)) + (obj (posn-object pos)) + (col (if obj + (get-text-property (cdr obj) 'column-number (car obj)) + (get-text-property (posn-point pos) 'column-number)))) + (let ((buffer-read-only nil)) + (if (= col 1) + (sort-fields col (point-min) (point-max)) + (sort-numeric-fields col (point-min) (point-max)))))) + +(defvar erc-list-menu-mode-map nil + "Local keymap for `erc-list-mode' buffers.") + +(unless erc-list-menu-mode-map + (setq erc-list-menu-mode-map (make-keymap)) + (suppress-keymap erc-list-menu-mode-map) + (define-key erc-list-menu-mode-map "k" 'erc-list-kill) + (define-key erc-list-menu-mode-map "j" 'erc-list-join) + (define-key erc-list-menu-mode-map "g" 'erc-list-revert) + (define-key erc-list-menu-mode-map "n" 'next-line) + (define-key erc-list-menu-mode-map "p" 'previous-line) + (define-key erc-list-menu-mode-map "q" 'quit-window)) + +(defvar erc-list-menu-sort-button-map nil + "Local keymap for ERC list menu mode sorting buttons.") + +(unless erc-list-menu-sort-button-map + (let ((map (make-sparse-keymap))) + (define-key map [header-line mouse-1] 'erc-list-menu-sort-by-column) + (define-key map [follow-link] 'mouse-face) + (setq erc-list-menu-sort-button-map map))) + +;; Helper function that makes a buttonized column header. +(defun erc-list-button (title column) + (erc-propertize title + 'column-number column + 'help-echo "mouse-1: sort by column" + 'mouse-face 'highlight + 'keymap erc-list-menu-sort-button-map)) + +(define-derived-mode erc-list-menu-mode nil "ERC-List" + "Major mode for editing a list of irc channels." + (setq header-line-format + (concat + (erc-propertize " " + 'display '(space :align-to 0) + 'face 'fixed-pitch) + (erc-list-make-string (erc-list-button "Channel" 1) + (erc-list-button "# Users" 2) + "Topic"))) + (setq truncate-lines t)) + +(put 'erc-list-menu-mode 'mode-class 'special) + +;; Handle a "322" response. This response tells us about a single +;; channel. +(defun erc-list-handle-322 (proc parsed) + (let* ((args (cdr (erc-response.command-args parsed))) + (channel (car args)) + (nusers (car (cdr args))) + (topic (erc-response.contents parsed))) + (when (buffer-live-p erc-list-buffer) + (with-current-buffer erc-list-buffer + (erc-list-insert-item channel nusers topic)))) + ;; Don't let another hook run. + t) + +;; Helper function to install our 322 handler and make our buffer. +(defun erc-list-install-322-handler (server-buffer) + (with-current-buffer server-buffer + ;; Arrange for 322 responses to insert into our buffer. + (add-hook 'erc-server-322-functions 'erc-list-handle-322 t t) + ;; Arrange for 323 (end of list) to end this. + (erc-once-with-server-event + 323 + '(progn + (remove-hook 'erc-server-322-functions 'erc-list-handle-322 t))) + ;; Find the list buffer, empty it, and display it. + (set (make-local-variable 'erc-list-buffer) + (get-buffer-create (concat "*Channels of " + erc-server-announced-name + "*"))) + (with-current-buffer erc-list-buffer + (erc-list-menu-mode) + (setq buffer-read-only nil) + (erase-buffer) + (set (make-local-variable 'erc-list-server-buffer) server-buffer) + (setq buffer-read-only t)) + (pop-to-buffer erc-list-buffer)) + t) + +;; The main entry point. +(defun erc-cmd-LIST (&optional line) + "Show a listing of channels on the current server in a separate window. + +If LINE is specified, include it with the /LIST command. It +should usually be one or more channels, separated by commas. + +Please note that this function only works with IRC servers which conform +to RFC and send the LIST header (#321) at start of list transmission." + (erc-with-server-buffer + (set (make-local-variable 'erc-list-last-argument) line) + (erc-once-with-server-event + 321 + (list 'progn + (list 'erc-list-install-322-handler (current-buffer))))) + (erc-server-send (concat "LIST :" (or (and line (substring line 1)) + "")))) +(put 'erc-cmd-LIST 'do-not-parse-args t) + +;;; erc-list.el ends here +;; +;; Local Variables: +;; indent-tabs-mode: t +;; tab-width: 8 +;; End: + +;; arch-tag: 99c5f9cb-6bac-4224-86bf-e394768cd1d0 diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el index dbbaebdf796..c48b5d9529a 100644 --- a/lisp/erc/erc-log.el +++ b/lisp/erc/erc-log.el @@ -31,17 +31,26 @@ ;; Quick start: ;; -;; (setq erc-enable-logging t) +;; (require 'erc-log) ;; (setq erc-log-channels-directory "/path/to/logfiles") ; must be writable +;; (erc-log-enable) ;; -;; There are two ways to setup logging. The first will write to the log files -;; on each incoming or outgoing line - this may not be optimal on a laptop -;; HDD. To do this, M-x customize-variable erc-modules, and add "log". +;; Or: ;; -;; The second method will save buffers on /part, /quit, or killing the -;; channel buffer. To do this, add the following to your .emacs: +;; M-x customize-variable erc-modules, and add "log". ;; -;; (require 'erc-log) +;; There are two ways to setup logging. The first (default) method +;; will save buffers on /part, /quit, or killing the channel +;; buffer. +;; +;; The second will write to the log files on each incoming or outgoing +;; line - this may not be optimal on a laptop HDD. To use this +;; method, add the following to the above instructions. +;; +;; (setq erc-save-buffer-on-part nil +;; erc-save-queries-on-quit nil +;; erc-log-write-after-send t +;; erc-log-write-after-insert t) ;; ;; If you only want to save logs for some buffers, customise the ;; variable `erc-enable-logging'. @@ -99,15 +108,19 @@ The function must take five arguments: BUFFER, TARGET, NICK, SERVER and PORT. BUFFER is the buffer to be saved, TARGET is the name of the channel, or the target of the query, NICK is the current nick, -SERVER and PORT are the parameters used to connect BUFFERs -`erc-server-process'." +SERVER and PORT are the parameters that were used to connect to BUFFERs +`erc-server-process'. + +If you want to write logs into different directories, make a +custom function which returns the directory part and set +`erc-log-channels-directory' to its name." :group 'erc-log :type '(choice (const :tag "Long style" erc-generate-log-file-name-long) (const :tag "Long, but with network name rather than server" erc-generate-log-file-name-network) (const :tag "Short" erc-generate-log-file-name-short) (const :tag "With date" erc-generate-log-file-name-with-date) - (symbol :tag "Other function"))) + (function :tag "Other function"))) (defcustom erc-truncate-buffer-on-save nil "Truncate any ERC (channel, query, server) buffer when it is saved." @@ -134,10 +147,16 @@ Log files are stored in `erc-log-channels-directory'." "The directory to place log files for channels. Leave blank to disable logging. If not nil, all the channel buffers are logged in separate files in that directory. The -directory should not end with a trailing slash." +directory should not end with a trailing slash. + +If this is the name of a function, the function will be called +with the buffer, target, nick, server, and port arguments. See +`erc-generate-log-file-name-function' for a description of these +arguments." :group 'erc-log :type '(choice directory - (const nil))) + (function "Function") + (const :tag "Disable logging" nil))) (defcustom erc-log-insert-log-on-open nil "*Insert log file contents into the buffer if a log file exists." @@ -186,6 +205,16 @@ This should ideally, be a \"catch-all\" coding system, like `emacs-mule', or `iso-2022-7bit'." :group 'erc-log) +(defcustom erc-log-filter-function nil + "*If non-nil, pass text through the given function before writing it to +a log file. + +The function should take one argument, which is the text to filter." + :group 'erc-log + :type '(choice (function "Function") + (const :tag "No filtering" nil))) + + ;;;###autoload (autoload 'erc-log-mode "erc-log" nil t) (define-erc-module log nil "Automatically logs things you receive on IRC into files. @@ -196,7 +225,7 @@ format is defined through a formatting function on Since automatic logging is not always a Good Thing (especially if people say things in different coding systems), you can turn logging behavior on and off with the variable `erc-enable-logging', which can -also be a predicate function. To only log when you are not set away, use: +also be a predicate function. To only log when you are not set away, use: \(setq erc-enable-logging (lambda (buffer) @@ -239,14 +268,7 @@ The current buffer is given by BUFFER." (with-current-buffer buffer (auto-save-mode -1) (setq buffer-file-name nil) - (cond ((boundp 'write-file-functions) - (set (make-local-variable 'write-file-functions) - '(erc-save-buffer-in-logs))) - ((boundp 'local-write-file-hooks) - (setq local-write-file-hooks '(erc-save-buffer-in-logs))) - (t - (set (make-local-variable 'write-file-hooks) - '(erc-save-buffer-in-logs)))) + (erc-set-write-file-functions '(erc-save-buffer-in-logs)) (when erc-log-insert-log-on-open (ignore-errors (insert-file-contents (erc-current-logfile)) (move-marker erc-last-saved-position @@ -297,7 +319,8 @@ Logging is enabled if `erc-log-channels-directory' is non-nil, the directory is writeable (it will be created as necessary) and `erc-enable-logging' returns a non-nil value." (and erc-log-channels-directory - (erc-directory-writable-p erc-log-channels-directory) + (or (functionp erc-log-channels-directory) + (erc-directory-writable-p erc-log-channels-directory)) (if (functionp erc-enable-logging) (funcall erc-enable-logging (or buffer (current-buffer))) erc-enable-logging))) @@ -316,14 +339,19 @@ filename is downcased." If BUFFER is nil, the value of `current-buffer' is used. This is determined by `erc-generate-log-file-name-function'. The result is converted to lowercase, as IRC is case-insensitive" - (expand-file-name - (erc-log-standardize-name - (funcall erc-generate-log-file-name-function - (or buffer (current-buffer)) - (or (buffer-name buffer) (erc-default-target)) - (erc-current-nick) - erc-session-server erc-session-port)) - erc-log-channels-directory)) + (unless buffer (setq buffer (current-buffer))) + (let ((target (or (buffer-name buffer) (erc-default-target))) + (nick (erc-current-nick)) + (server erc-session-server) + (port erc-session-port)) + (expand-file-name + (erc-log-standardize-name + (funcall erc-generate-log-file-name-function + buffer target nick server port)) + (if (functionp erc-log-channels-directory) + (funcall erc-log-channels-directory + buffer target nick server port) + erc-log-channels-directory)))) (defun erc-generate-log-file-name-with-date (buffer &rest ignore) "This function computes a short log file name. @@ -380,7 +408,8 @@ You can save every individual message by putting this function on (or buffer (setq buffer (current-buffer))) (when (erc-logging-enabled buffer) (let ((file (erc-current-logfile buffer)) - (coding-system-for-write erc-log-file-coding-system)) + (coding-system erc-log-file-coding-system) + (inhibit-clash-detection t)) ; needed for XEmacs (save-excursion (with-current-buffer buffer (save-restriction @@ -388,9 +417,17 @@ You can save every individual message by putting this function on ;; early on in the initialization, don't try and write the log out (when (and (markerp erc-last-saved-position) (> erc-insert-marker (1+ erc-last-saved-position))) - (write-region (1+ (marker-position erc-last-saved-position)) - (marker-position erc-insert-marker) - file t 'nomessage) + (let ((start (1+ (marker-position erc-last-saved-position))) + (end (marker-position erc-insert-marker))) + (if (functionp erc-log-filter-function) + (let ((text (buffer-substring start end))) + (with-temp-buffer + (insert (funcall erc-log-filter-function text)) + (let ((coding-system-for-write coding-system)) + (write-region (point-min) (point-max) + file t 'nomessage)))) + (let ((coding-system-for-write coding-system)) + (write-region start end file t 'nomessage)))) (if (and erc-truncate-buffer-on-save (interactive-p)) (progn (let ((inhibit-read-only t)) (erase-buffer)) diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el index 97d421e50d8..3e525588e66 100644 --- a/lisp/erc/erc-match.el +++ b/lisp/erc/erc-match.el @@ -299,7 +299,7 @@ Completion is performed on the optional alist COMPLETIONS." (lambda (x) (not (erc-member-ignore-case (car x) (symbol-value list))))))) (if (erc-member-ignore-case entry (symbol-value list)) - (error (format "\"%s\" is already on the list" entry)) + (error "\"%s\" is already on the list" entry) (set list (cons entry (symbol-value list)))))) (defun erc-remove-entry-from-list (list prompt) diff --git a/lisp/erc/erc-netsplit.el b/lisp/erc/erc-netsplit.el index 48970fb76c7..5bcb4327c18 100644 --- a/lisp/erc/erc-netsplit.el +++ b/lisp/erc/erc-netsplit.el @@ -173,13 +173,14 @@ join from that split has been detected or not.") (defun erc-netsplit-timer (now) "Clean cruft from `erc-netsplit-list' older than 10 minutes." - (dolist (elt erc-netsplit-list) - (when (> (erc-time-diff (cadr elt) now) 600) - (when erc-netsplit-debug - (erc-display-message - nil 'notice (current-buffer) - (concat "Netsplit: Removing " (car elt)))) - (setq erc-netsplit-list (delq elt erc-netsplit-list))))) + (when erc-server-connected + (dolist (elt erc-netsplit-list) + (when (> (erc-time-diff (cadr elt) now) 600) + (when erc-netsplit-debug + (erc-display-message + nil 'notice (current-buffer) + (concat "Netsplit: Removing " (car elt)))) + (setq erc-netsplit-list (delq elt erc-netsplit-list)))))) ;;;###autoload (defun erc-cmd-WHOLEFT () diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el index 48efd41791f..b74fdb245a4 100644 --- a/lisp/erc/erc-networks.el +++ b/lisp/erc/erc-networks.el @@ -28,9 +28,7 @@ ;; ;; Usage: ;; -;; Put into your .emacs: -;; -;; (require 'erc-networks) +;; This is the "networks" module. ;; ;; M-x erc-server-select provides an alternative way to connect to servers by ;; choosing networks. @@ -351,6 +349,7 @@ ("Relicnet: Random server" Relicnet "irc.relic.net" 6667) ("Rezosup: Random server" Rezosup "irc.rezosup.org" 6667) ("Risanet: Random server" Risanet "irc.risanet.com" ((6667 6669))) + ("Rizon: Random server" Rizon "irc.rizon.net" (6633 (6660 6669) 6697 7000 8080 9999)) ("Rubiks: Random server" Rubiks "irc.rubiks.net" 6667) ("Rusnet: EU, RU, Tomsk" Rusnet "irc.tsk.ru" ((6667 6669) (7770 7775) )) ("Rusnet: EU, RU, Vladivostok" Rusnet "irc.vladivostok.ru" ((6667 6669) (7770 7775) )) @@ -765,9 +764,14 @@ network as a symbol." (setq erc-network nil) nil) -(add-hook 'erc-server-375-functions 'erc-set-network-name) -(add-hook 'erc-server-422-functions 'erc-set-network-name) -(add-hook 'erc-disconnected-hook 'erc-unset-network-name) +(define-erc-module networks nil + "Provide data about IRC networks." + ((add-hook 'erc-server-375-functions 'erc-set-network-name) + (add-hook 'erc-server-422-functions 'erc-set-network-name) + (add-hook 'erc-disconnected-hook 'erc-unset-network-name)) + ((remove-hook 'erc-server-375-functions 'erc-set-network-name) + (remove-hook 'erc-server-422-functions 'erc-set-network-name) + (remove-hook 'erc-disconnected-hook 'erc-unset-network-name))) (defun erc-ports-list (ports) "Return a list of PORTS. diff --git a/lisp/erc/erc-notify.el b/lisp/erc/erc-notify.el index 96d49df4799..7f777309f66 100644 --- a/lisp/erc/erc-notify.el +++ b/lisp/erc/erc-notify.el @@ -111,7 +111,8 @@ changes." ;;;; Timer handler (defun erc-notify-timer (now) - (when (and erc-notify-list + (when (and erc-server-connected + erc-notify-list (> (erc-time-diff erc-last-ison-time now) erc-notify-interval)) diff --git a/lisp/erc/erc-page.el b/lisp/erc/erc-page.el index 90a2009106f..ff30bcab209 100644 --- a/lisp/erc/erc-page.el +++ b/lisp/erc/erc-page.el @@ -104,5 +104,11 @@ receive pages if `erc-page-mode' is on." (provide 'erc-page) -;; arch-tag: 82fd2e0e-6060-4dd2-9788-8c1411e844de ;;; erc-page.el ends here +;; +;; Local Variables: +;; indent-tabs-mode: t +;; tab-width: 8 +;; End: + +;; arch-tag: 82fd2e0e-6060-4dd2-9788-8c1411e844de diff --git a/lisp/erc/erc-replace.el b/lisp/erc/erc-replace.el index d6713c6a442..45ce20e7fa7 100644 --- a/lisp/erc/erc-replace.el +++ b/lisp/erc/erc-replace.el @@ -1,6 +1,7 @@ ;; erc-replace.el -- wash and massage messages inserted into the buffer -;; Copyright (C) 2001, 2002, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2002, 2004, 2006, 2007, +;; 2008 Free Software Foundation, Inc. ;; Author: Andreas Fuchs <asf@void.at> ;; Maintainer: Mario Lang (mlang@delysid.org) @@ -88,5 +89,11 @@ It replaces text according to `erc-replace-alist'." (provide 'erc-replace) -;; arch-tag: dd904a59-d8a6-47f8-ac3a-76b698289a18 ;;; erc-replace.el ends here +;; +;; Local Variables: +;; indent-tabs-mode: t +;; tab-width: 8 +;; End: + +;; arch-tag: dd904a59-d8a6-47f8-ac3a-76b698289a18 diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el index 18bcb6f2a09..b25a10dc5ca 100644 --- a/lisp/erc/erc-services.el +++ b/lisp/erc/erc-services.el @@ -29,9 +29,10 @@ ;; are made to test if NickServ is the real NickServ for a given network or ;; server. -;; As a default, ERC has the data for the official nickname services on the -;; networks Austnet, BrasNET, Dalnet, freenode, GalaxyNet, and Slashnet. -;; You can add more by using M-x customize-variable RET erc-nickserv-alist. +;; As a default, ERC has the data for the official nickname services on +;; the networks Austnet, BrasNET, Dalnet, freenode, GalaxyNet, GRnet, +;; and Slashnet. You can add more by using M-x customize-variable RET +;; erc-nickserv-alist. ;; Usage: ;; @@ -109,7 +110,9 @@ You can also use M-x erc-nickserv-identify-mode to change modes." (remove-hook 'erc-after-connect 'erc-nickserv-identify-on-connect) (remove-hook 'erc-nick-changed-functions - 'erc-nickserv-identify-on-nick-change))) + 'erc-nickserv-identify-on-nick-change) + (remove-hook 'erc-server-NOTICE-functions + 'erc-nickserv-identification-autodetect))) ;;;###autoload (defun erc-nickserv-identify-mode (mode) @@ -118,6 +121,12 @@ You can also use M-x erc-nickserv-identify-mode to change modes." (list (intern (completing-read "Choose Nickserv identify mode (RET to disable): " '(("autodetect") ("nick-change") ("both")) nil t)))) + (add-hook 'erc-server-NOTICE-functions + 'erc-nickserv-identification-autodetect) + (unless erc-networks-mode + ;; Force-enable networks module, because we need it to set + ;; erc-network for us. + (erc-networks-enable)) (cond ((eq mode 'autodetect) (setq erc-nickserv-identify-mode 'autodetect) (add-hook 'erc-server-NOTICE-functions @@ -149,7 +158,9 @@ You can also use M-x erc-nickserv-identify-mode to change modes." (remove-hook 'erc-after-connect 'erc-nickserv-identify-on-connect) (remove-hook 'erc-nick-changed-functions - 'erc-nickserv-identify-on-nick-change)))) + 'erc-nickserv-identify-on-nick-change) + (remove-hook 'erc-server-NOTICE-functions + 'erc-nickserv-identification-autodetect)))) (defcustom erc-prompt-for-nickserv-password t "Ask for the password when identifying to NickServ." @@ -176,9 +187,11 @@ Example of use: (const DALnet) (const freenode) (const GalaxyNet) + (const GRnet) (const iip) (const OFTC) (const QuakeNet) + (const Rizon) (const SlashNET) (symbol :tag "Network name")) (repeat :tag "Nickname and password" @@ -192,63 +205,80 @@ Example of use: '((Ars nil nil "Census" - "IDENTIFY" nil nil) + "IDENTIFY" nil nil nil) (Austnet "NickOP!service@austnet.org" "/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>" "nickop@austnet.org" - "identify" nil nil) + "identify" nil nil nil) (Azzurra "NickServ!service@azzurra.org" "/ns\\s-IDENTIFY\\s-password" "NickServ" - "IDENTIFY" nil nil) + "IDENTIFY" nil nil nil) (BitlBee nil nil "&bitlbee" - "identify" nil nil) + "identify" nil nil nil) (BRASnet "NickServ!services@brasnet.org" "/NickServ\\s-IDENTIFY\\s-senha" "NickServ" - "IDENTIFY" nil "") + "IDENTIFY" nil "" nil) (DALnet "NickServ!service@dal.net" "/msg\\s-NickServ@services.dal.net\\s-IDENTIFY\\s-<password>" "NickServ@services.dal.net" - "IDENTIFY" nil nil) + "IDENTIFY" nil nil nil) (freenode "NickServ!NickServ@services." + ;; freenode also accepts a password at login, see the `erc' + ;; :password argument. "/msg\\s-NickServ\\s-IDENTIFY\\s-<password>" "NickServ" - "IDENTIFY" nil nil) + "IDENTIFY" nil nil + "Password\\s-accepted\\s--\\s-you\\s-are\\s-now\\s-recognized") (GalaxyNet "NS!nickserv@galaxynet.org" "Please\\s-change\\s-nicks\\s-or\\s-authenticate." "NS@services.galaxynet.org" - "AUTH" t nil) + "AUTH" t nil nil) + (GRnet + "NickServ!service@irc.gr" + "This\\s-nickname\\s-is\\s-registered\\s-and\\s-protected." + "NickServ" + "IDENTIFY" nil nil + "Password\\s-accepted\\s--\\s-you\\s-are\\s-now\\s-recognized.") (iip "Trent@anon.iip" "type\\s-/squery\\s-Trent\\s-identify\\s-<password>" "Trent@anon.iip" - "IDENTIFY" nil "SQUERY") + "IDENTIFY" nil "SQUERY" nil) (OFTC "NickServ!services@services.oftc.net" - "type\\s-/msg\\s-NickServ\\s-IDENTIFY\\s-password." + ;; OFTC's NickServ doesn't ask you to identify anymore. + nil "NickServ" - "IDENTIFY" nil nil) + "IDENTIFY" nil nil + "You\\s-are\\s-successfully\\s-identified\\s-as\\s-") + (Rizon + "NickServ!service@rizon.net" + "This\\s-nickname\\s-is\\s-registered\\s-and\\s-protected." + "NickServ" + "IDENTIFY" nil nil + "Password\\s-accepted\\s--\\s-you\\s-are\\s-now\\s-recognized.") (QuakeNet nil nil "Q@CServe.quakenet.org" - "auth" t nil) + "auth" t nil nil) (SlashNET "NickServ!services@services.slashnet.org" "/msg\\s-NickServ\\s-IDENTIFY\\s-password" "NickServ@services.slashnet.org" - "IDENTIFY" nil nil)) + "IDENTIFY" nil nil nil)) "Alist of NickServer details, sorted by network. Every element in the list has the form - \(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER) + \(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER SUCCESS-REGEXP) SYMBOL is a network identifier, a symbol, as used in `erc-networks-alist'. NICKSERV is the description of the nickserv in the form nick!user@host. @@ -258,7 +288,9 @@ KEYWORD is the keyword to use in the reply message to identify yourself. USE-CURRENT indicates whether the current nickname must be used when identifying. ANSWER is the command to use for the answer. The default is 'privmsg. - This last element is optional." +SUCCESS-REGEXP is a regular expression matching the message nickserv + sends when you've successfully identified. +The last two elements are optional." :group 'erc-services :type '(repeat (list :tag "Nickserv data" @@ -292,12 +324,40 @@ ANSWER is the command to use for the answer. The default is 'privmsg. (defsubst erc-nickserv-alist-ident-command (network &optional entry) (nth 6 (or entry (assoc network erc-nickserv-alist)))) +(defsubst erc-nickserv-alist-identified-regexp (network &optional entry) + (nth 7 (or entry (assoc network erc-nickserv-alist)))) + ;; Functions: -(defun erc-nickserv-identify-autodetect (proc parsed) - "Check for a NickServ identify request everytime a notice is received. +(defcustom erc-nickserv-identified-hook nil + "Run this hook when NickServ acknowledged successful identification. +Hooks are called with arguments (NETWORK NICK)." + :group 'erc-services + :type 'hook) + +(defun erc-nickserv-identification-autodetect (proc parsed) + "Check for NickServ's successful identification notice. Make sure it is the real NickServ for this network and that it has -specifically asked the user to IDENTIFY. +specifically confirmed a successful identification attempt. +If this is the case, run `erc-nickserv-identified-hook'." + (let* ((network (erc-network)) + (sender (erc-nickserv-alist-sender network)) + (success-regex (erc-nickserv-alist-identified-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 told us we've successfully identified + (when (and sender (equal sspec sender) + success-regex + (string-match success-regex msg)) + (erc-log "NickServ IDENTIFY success notification detected") + (run-hook-with-args 'erc-nickserv-identified-hook network nick) + nil))) + +(defun erc-nickserv-identify-autodetect (proc parsed) + "Identify to NickServ when an identify request is received. +Make sure it is the real NickServ for this network. If `erc-prompt-for-nickserv-password' is non-nil, prompt the user for the password for this nickname, otherwise try to send it automatically." (unless (and (null erc-nickserv-passwords) @@ -311,6 +371,7 @@ password for this nickname, otherwise try to send it automatically." ;; continue only if we're sure it's the real nickserv for this network ;; and it's asked us to identify (when (and sender (equal sspec sender) + identify-regex (string-match identify-regex msg)) (erc-log "NickServ IDENTIFY request detected") (erc-nickserv-call-identify-function nick) diff --git a/lisp/erc/erc-sound.el b/lisp/erc/erc-sound.el index e62034eef71..1ee8fbf8d5a 100644 --- a/lisp/erc/erc-sound.el +++ b/lisp/erc/erc-sound.el @@ -30,7 +30,7 @@ ;; Add the following to your .emacs if you want to play sounds. ;; -;; (require 'erc-soud) +;; (require 'erc-sound) ;; (erc-sound-enable) ;; ;; To send requests to other users from within query buffers, type the @@ -125,7 +125,7 @@ See also `play-sound-file'." (if (and (not filepath) erc-default-sound) (setq filepath erc-default-sound)) (cond ((and filepath (file-exists-p filepath)) - (play-sound-file filepath)) + (play-sound-file filepath)) (t (beep))) (erc-log (format "Playing sound file %S" filepath)))) @@ -142,5 +142,11 @@ See also `play-sound-file'." (provide 'erc-sound) -;; arch-tag: 53657d1d-007f-4a20-91c1-588e71cf0cee ;;; erc-sound.el ends here +;; +;; Local Variables: +;; indent-tabs-mode: t +;; tab-width: 8 +;; End: + +;; arch-tag: 53657d1d-007f-4a20-91c1-588e71cf0cee diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el index 75e512894f5..d3a05ee65b8 100644 --- a/lisp/erc/erc-stamp.el +++ b/lisp/erc/erc-stamp.el @@ -58,16 +58,48 @@ If nil, timestamping is turned off." :type '(choice (const nil) (string))) -(defcustom erc-insert-timestamp-function 'erc-insert-timestamp-right +(defcustom erc-timestamp-format-left "\n[%a %b %e %Y]\n" + "*If set to a string, messages will be timestamped. +This string is processed using `format-time-string'. +Good examples are \"%T\" and \"%H:%M\". + +This timestamp is used for timestamps on the left side of the +screen when `erc-insert-timestamp-function' is set to +`erc-insert-timestamp-left-and-right'. + +If nil, timestamping is turned off." + :group 'erc-stamp + :type '(choice (const nil) + (string))) + +(defcustom erc-timestamp-format-right " [%H:%M]" + "*If set to a string, messages will be timestamped. +This string is processed using `format-time-string'. +Good examples are \"%T\" and \"%H:%M\". + +This timestamp is used for timestamps on the right side of the +screen when `erc-insert-timestamp-function' is set to +`erc-insert-timestamp-left-and-right'. + +If nil, timestamping is turned off." + :group 'erc-stamp + :type '(choice (const nil) + (string))) + +(defcustom erc-insert-timestamp-function 'erc-insert-timestamp-left-and-right "*Function to use to insert timestamps. It takes a single argument STRING which is the final string which all text-properties already appended. This function only cares about inserting this string at the right position. Narrowing is in effect while it is called, so (point-min) and (point-max) determine the region to -operate on." +operate on. + +You will probably want to set +`erc-insert-away-timestamp-function' to the same value." :group 'erc-stamp - :type '(choice (const :tag "Right" erc-insert-timestamp-right) + :type '(choice (const :tag "Both sides" erc-insert-timestamp-left-and-right) + (const :tag "Right" erc-insert-timestamp-right) (const :tag "Left" erc-insert-timestamp-left) function)) @@ -82,12 +114,14 @@ If `erc-timestamp-format' is set, this will not be used." :type '(choice (const nil) (string))) -(defcustom erc-insert-away-timestamp-function 'erc-insert-timestamp-right +(defcustom erc-insert-away-timestamp-function + 'erc-insert-timestamp-left-and-right "*Function to use to insert the away timestamp. See `erc-insert-timestamp-function' for details." :group 'erc-stamp - :type '(choice (const :tag "Right" erc-insert-timestamp-right) + :type '(choice (const :tag "Both sides" erc-insert-timestamp-left-and-right) + (const :tag "Right" erc-insert-timestamp-right) (const :tag "Left" erc-insert-timestamp-left) function)) @@ -160,6 +194,18 @@ or `erc-send-modify-hook'." "Last timestamp inserted into the buffer.") (make-variable-buffer-local 'erc-timestamp-last-inserted) +(defvar erc-timestamp-last-inserted-left nil + "Last timestamp inserted into the left side of the buffer. +This is used when `erc-insert-timestamp-function' is set to +`erc-timestamp-left-and-right'") +(make-variable-buffer-local 'erc-timestamp-last-inserted-left) + +(defvar erc-timestamp-last-inserted-right nil + "Last timestamp inserted into the right side of the buffer. +This is used when `erc-insert-timestamp-function' is set to +`erc-timestamp-left-and-right'") +(make-variable-buffer-local 'erc-timestamp-last-inserted-right) + (defcustom erc-timestamp-only-if-changed-flag t "*Insert timestamp only if its value changed since last insertion. If `erc-insert-timestamp-function' is `erc-insert-timestamp-left', a @@ -218,6 +264,10 @@ property to get to the POSth column." (list 'space ':align-to pos))) (insert string)) +;; Silence byte-compiler +(eval-when-compile + (defvar erc-fill-column)) + (defun erc-insert-timestamp-right (string) "Insert timestamp on the right side of the screen. STRING is the timestamp to insert. The function is a possible value @@ -272,6 +322,26 @@ be printed just before the window-width." (when erc-timestamp-intangible (erc-put-text-property from (1+ (point)) 'intangible t))))) +(defun erc-insert-timestamp-left-and-right (string) + "This is another function that can be assigned to +`erc-insert-timestamp-function'. If the date is changed, it will +print a blank line, the date, and another blank line. If the time is +changed, it will then print it off to the right." + (let* ((ct (current-time)) + (ts-left (erc-format-timestamp ct erc-timestamp-format-left)) + (ts-right (erc-format-timestamp ct erc-timestamp-format-right))) + ;; insert left timestamp + (unless (string-equal ts-left erc-timestamp-last-inserted-left) + (goto-char (point-min)) + (erc-put-text-property 0 (length ts-left) 'field 'erc-timestamp ts-left) + (insert ts-left) + (setq erc-timestamp-last-inserted-left ts-left)) + ;; insert right timestamp + (let ((erc-timestamp-only-if-changed-flag t) + (erc-timestamp-last-inserted erc-timestamp-last-inserted-right)) + (erc-insert-timestamp-right ts-right) + (setq erc-timestamp-last-inserted-right ts-right)))) + ;; for testing: (setq erc-timestamp-only-if-changed-flag nil) (defun erc-format-timestamp (time format) @@ -342,8 +412,8 @@ NOW is position of point currently." (when erc-echo-timestamps (let ((stamp (get-text-property now 'timestamp))) (when stamp - (message (format-time-string erc-echo-timestamp-format - stamp)))))) + (message "%s" (format-time-string erc-echo-timestamp-format + stamp)))))) (provide 'erc-stamp) diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index 6ccbbc3309f..3a7511cad49 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -95,9 +95,19 @@ Activity means that there was no user input in the last 10 seconds." :group 'erc-track :type '(repeat string)) -(defcustom erc-track-exclude-types '("NICK") +(defcustom erc-track-remove-disconnected-buffers nil + "*If true, remove buffers associated with a server that is +disconnected from `erc-modified-channels-alist'." + :group 'erc-track + :type 'boolean) + +(defcustom erc-track-exclude-types '("NICK" "333" "353") "*List of message types to be ignored. -This list could look like '(\"JOIN\" \"PART\")." +This list could look like '(\"JOIN\" \"PART\"). + +By default, exclude changes of nicknames (NICK), display of who +set the channel topic (333), and listing of users on the current +channel (353)." :group 'erc-track :type 'erc-message-type) @@ -151,6 +161,16 @@ If nil instead of a function, shortening is disabled." :type '(choice (const :tag "Disabled") function)) +(defcustom erc-track-list-changed-hook nil + "Hook that is run whenever the contents of +`erc-modified-channels-alist' changes. + +This is useful for people that don't use the default mode-line +notification but instead use a separate mechanism to provide +notification of channel activity." + :group 'erc-track + :type 'hook) + (defcustom erc-track-use-faces t "*Use faces in the mode-line. The faces used are the same as used for text in the buffers. @@ -159,15 +179,32 @@ The faces used are the same as used for text in the buffers. :type 'boolean) (defcustom erc-track-faces-priority-list - '(erc-error-face erc-current-nick-face erc-keyword-face erc-pal-face - erc-nick-msg-face erc-direct-msg-face erc-button erc-dangerous-host-face - erc-default-face erc-action-face erc-nick-default-face erc-fool-face - erc-notice-face erc-input-face erc-prompt-face) + '(erc-error-face + (erc-nick-default-face erc-current-nick-face) + erc-current-nick-face + erc-keyword-face + (erc-nick-default-face erc-pal-face) + erc-pal-face + erc-nick-msg-face + erc-direct-msg-face + (erc-button erc-default-face) + (erc-nick-default-face erc-dangerous-host-face) + erc-dangerous-host-face + erc-nick-default-face + (erc-nick-default-face erc-default-face) + erc-default-face + erc-action-face + (erc-nick-default-face erc-fool-face) + erc-fool-face + erc-notice-face + erc-input-face + erc-prompt-face) "A list of faces used to highlight active buffer names in the modeline. If a message contains one of the faces in this list, the buffer name will be highlighted using that face. The first matching face is used." :group 'erc-track - :type '(repeat face)) + :type '(repeat (choice face + (repeat :tag "Combination" face)))) (defcustom erc-track-priority-faces-only nil "Only track text highlighted with a priority face. @@ -177,6 +214,7 @@ this variable. You can set a list of channel name strings, so those will be ignored while all other channels will be tracked as normal. Other options are 'all, to apply this to all channels or nil, to disable this feature. + Note: If you have a lot of faces listed in `erc-track-faces-priority-list', setting this variable might not be very useful." :group 'erc-track @@ -184,20 +222,43 @@ setting this variable might not be very useful." (repeat string) (const all))) +(defcustom erc-track-faces-normal-list + '((erc-button erc-default-face) + (erc-nick-default-face erc-dangerous-host-face) + erc-dangerous-host-face + erc-nick-default-face + (erc-nick-default-face erc-default-face) + erc-default-face + erc-action-face) + "A list of faces considered to be part of normal conversations. +This list is used to highlight active buffer names in the modeline. + +If a message contains one of the faces in this list, and the +previous modeline face for this buffer is also in this list, then +the buffer name will be highlighted using the face from the +message. This gives a rough indication that active conversations +are occurring in these channels. + +The effect may be disabled by setting this variable to nil." + :group 'erc-track + :type '(repeat (choice face + (repeat :tag "Combination" face)))) + (defcustom erc-track-position-in-mode-line 'before-modes "Where to show modified channel information in the mode-line. Setting this variable only has effects in GNU Emacs versions above 21.3. Choices are: -'before-modes - add to the beginning of `mode-line-modes' -'after-modes - add to the end of `mode-line-modes' - -Any other value means add to the end of `global-mode-string'." +'before-modes - add to the beginning of `mode-line-modes', +'after-modes - add to the end of `mode-line-modes', +t - add to the end of `global-mode-string', +nil - don't add to mode line." :group 'erc-track :type '(choice (const :tag "Just before mode information" before-modes) (const :tag "Just after mode information" after-modes) - (const :tag "After all other information" nil)) + (const :tag "After all other information" t) + (const :tag "Don't display in mode line" nil)) :set (lambda (sym val) (set sym val) (when (and (boundp 'erc-track-mode) @@ -263,12 +324,18 @@ when there are no more active channels." (defcustom erc-track-switch-direction 'oldest "Direction `erc-track-switch-buffer' should switch. + importance - find buffer with the most important message oldest - find oldest active buffer newest - find newest active buffer leastactive - find buffer with least unseen messages - mostactive - find buffer with most unseen messages." + mostactive - find buffer with most unseen messages. + +If set to 'importance, the importance is determined by position +in `erc-track-faces-priority-list', where first is most +important." :group 'erc-track - :type '(choice (const oldest) + :type '(choice (const importance) + (const oldest) (const newest) (const leastactive) (const mostactive))) @@ -296,7 +363,7 @@ See `erc-track-position-in-mode-line' for possible values." (boundp 'mode-line-modes)) (add-to-list 'mode-line-modes '(t erc-modified-channels-object) t)) - (t + ((eq position t) (when (not global-mode-string) (setq global-mode-string '(""))) ; Padding for mode-line wart (add-to-list 'global-mode-string @@ -419,7 +486,7 @@ START is the minimum length of the name used." ;;; Test: -(erc-assert +(assert (and ;; verify examples from the doc strings (equal (let ((erc-track-shorten-aggressively nil)) @@ -536,13 +603,15 @@ module, otherwise the keybindings will not do anything useful." :global t :group 'erc-track) -(defun erc-track-minor-mode-maybe () +(defun erc-track-minor-mode-maybe (&optional buffer) "Enable `erc-track-minor-mode', depending on `erc-track-enable-keybindings'." - (unless (or erc-track-minor-mode - ;; don't start the minor mode until we have an ERC - ;; process running, because we don't want to prompt the - ;; user while starting Emacs - (null (erc-buffer-list))) + (when (and (not erc-track-minor-mode) + ;; don't start the minor mode until we have an ERC + ;; process running, because we don't want to prompt the + ;; user while starting Emacs + (or (and (buffer-live-p buffer) + (with-current-buffer buffer (eq major-mode 'erc-mode))) + (erc-buffer-list))) (cond ((eq erc-track-enable-keybindings 'ask) (let ((key (or (and (key-binding (kbd "C-c C-SPC")) "C-SPC") (and (key-binding (kbd "C-c C-@")) "C-@")))) @@ -592,6 +661,7 @@ module, otherwise the keybindings will not do anything useful." (add-hook 'erc-insert-post-hook 'erc-track-modified-channels) (add-hook 'erc-disconnected-hook 'erc-modified-channels-update)) ;; enable the tracking keybindings + (add-hook 'erc-connect-pre-hook 'erc-track-minor-mode-maybe) (erc-track-minor-mode-maybe))) ;; Disable: ((when (boundp 'erc-track-when-inactive) @@ -613,6 +683,7 @@ module, otherwise the keybindings will not do anything useful." (remove-hook 'erc-disconnected-hook 'erc-modified-channels-update) (remove-hook 'erc-insert-post-hook 'erc-track-modified-channels)) ;; disable the tracking keybindings + (remove-hook 'erc-connect-pre-hook 'erc-track-minor-mode-maybe) (when erc-track-minor-mode (erc-track-minor-mode -1))))) @@ -641,17 +712,25 @@ only consider active buffers visible.") (defun erc-user-is-active (&rest ignore) "Set `erc-buffer-activity'." - (setq erc-buffer-activity (erc-current-time)) - (erc-track-modified-channels)) + (when erc-server-connected + (setq erc-buffer-activity (erc-current-time)) + (erc-track-modified-channels))) + +(defun erc-track-get-buffer-window (buffer frame-param) + (if (eq frame-param 'selected-visible) + (if (eq (frame-visible-p (selected-frame)) t) + (get-buffer-window buffer nil) + nil) + (get-buffer-window buffer frame-param))) (defun erc-buffer-visible (buffer) "Return non-nil when the buffer is visible." (if erc-track-when-inactive (when erc-buffer-activity; could be nil - (and (get-buffer-window buffer erc-track-visibility) + (and (erc-track-get-buffer-window buffer erc-track-visibility) (<= (erc-time-diff erc-buffer-activity (erc-current-time)) erc-buffer-activity-timeout))) - (get-buffer-window buffer erc-track-visibility))) + (erc-track-get-buffer-window buffer erc-track-visibility))) ;;; Tracking the channel modifications @@ -668,18 +747,22 @@ called via `window-configuration-change-hook'. ARGS are ignored." (interactive) (unless erc-modified-channels-update-inside - (let ((erc-modified-channels-update-inside t)) - (mapcar (lambda (elt) - (let ((buffer (car elt))) - (when (or (not (bufferp buffer)) - (not (buffer-live-p buffer)) - (erc-buffer-visible buffer) - (not (with-current-buffer buffer - erc-server-connected))) - (erc-modified-channels-remove-buffer buffer)))) - erc-modified-channels-alist) + (let ((erc-modified-channels-update-inside t) + (removed-channel nil)) + (mapc (lambda (elt) + (let ((buffer (car elt))) + (when (or (not (bufferp buffer)) + (not (buffer-live-p buffer)) + (erc-buffer-visible buffer) + (and erc-track-remove-disconnected-buffers + (not (with-current-buffer buffer + erc-server-connected)))) + (setq removed-channel t) + (erc-modified-channels-remove-buffer buffer)))) + erc-modified-channels-alist) + (when removed-channel (erc-modified-channels-display) - (force-mode-line-update t)))) + (force-mode-line-update t))))) (defvar erc-track-mouse-face (if (featurep 'xemacs) 'modeline-mousable @@ -729,10 +812,13 @@ If FACES are provided, color STRING with them." "Set `erc-modified-channels-object' according to `erc-modified-channels-alist'. Use `erc-make-mode-line-buffer-name' to create buttons." - (if (or - (eq 'mostactive erc-track-switch-direction) - (eq 'leastactive erc-track-switch-direction)) - (erc-track-sort-by-activest)) + (cond ((or (eq 'mostactive erc-track-switch-direction) + (eq 'leastactive erc-track-switch-direction)) + (erc-track-sort-by-activest)) + ((eq 'importance erc-track-switch-direction) + (erc-track-sort-by-importance))) + (run-hooks 'erc-track-list-changed-hook) + (unless (eq erc-track-position-in-mode-line nil) (if (null erc-modified-channels-alist) (setq erc-modified-channels-object (erc-modified-channels-object nil)) ;; erc-modified-channels-alist contains all the data we need. To @@ -768,7 +854,7 @@ Use `erc-make-mode-line-buffer-name' to create buttons." (when (featurep 'xemacs) (erc-modified-channels-object nil)) (setq erc-modified-channels-object - (erc-modified-channels-object strings))))) + (erc-modified-channels-object strings)))))) (defun erc-modified-channels-remove-buffer (buffer) "Remove BUFFER from `erc-modified-channels-alist'." @@ -781,16 +867,36 @@ Use `erc-make-mode-line-buffer-name' to create buttons." (defun erc-track-find-face (faces) "Return the face to use in the modeline from the faces in FACES. -If `erc-track-faces-priority-list' is set, the one from FACES who is -first in that list will be used." - (let ((candidates erc-track-faces-priority-list) - candidate face) - (while (and candidates (not face)) - (setq candidate (car candidates) - candidates (cdr candidates)) - (when (memq candidate faces) - (setq face candidate))) - face)) +If `erc-track-faces-priority-list' is set, the one from FACES who +is first in that list will be used. If nothing matches or if +`erc-track-faces-priority-list' is not set, the default mode-line +faces will be used. + +If `erc-track-faces-normal-list' is non-nil, use it to produce a +blinking effect that indicates channel activity when the first +element in FACES and the highest-ranking face among the rest of +FACES are both members of `erc-track-faces-normal-list'. + +If one of the faces is a list, then it will be ranked according +to its highest-tanking face member. A list of faces including +that member will take priority over just the single member +element." + (let ((choice (catch 'face + (dolist (candidate erc-track-faces-priority-list) + (when (member candidate faces) + (throw 'face candidate))))) + (no-first (and erc-track-faces-normal-list + (catch 'face + (dolist (candidate erc-track-faces-priority-list) + (when (member candidate (cdr faces)) + (throw 'face candidate))))))) + (cond ((null choice) + nil) + ((and (member choice erc-track-faces-normal-list) + (member no-first erc-track-faces-normal-list)) + no-first) + (t + choice)))) (defun erc-track-modified-channels () "Hook function for `erc-insert-post-hook' to check if the current @@ -802,8 +908,7 @@ is in `erc-mode'." (if (and (not (erc-buffer-visible (current-buffer))) (not (member this-channel erc-track-exclude)) (not (and erc-track-exclude-server-buffer - (string= this-channel - (buffer-name (erc-server-buffer))))) + (erc-server-buffer-p))) (not (erc-message-type-member (or (erc-find-parsed-property) (point-min)) @@ -847,10 +952,10 @@ is in `erc-mode'." (erc-modified-channels-display))) ;; Else if the active buffer is the current buffer, remove it ;; from our list. - (when (or (erc-buffer-visible (current-buffer)) + (when (and (or (erc-buffer-visible (current-buffer)) (and this-channel - (assq (current-buffer) erc-modified-channels-alist) (member this-channel erc-track-exclude))) + (assq (current-buffer) erc-modified-channels-alist)) ;; Remove it from mode-line if buffer is visible or ;; channel was added to erc-track-exclude recently. (erc-modified-channels-remove-buffer (current-buffer)) @@ -860,14 +965,15 @@ is in `erc-mode'." "Return a list of all faces used in STR." (let ((i 0) (m (length str)) - (faces (erc-list (get-text-property 0 'face str)))) + (faces (erc-list (get-text-property 0 'face str))) + cur) (while (and (setq i (next-single-property-change i 'face str m)) (not (= i m))) - (dolist (face (erc-list (get-text-property i 'face str))) - (add-to-list 'faces face))) + (when (setq cur (get-text-property i 'face str)) + (add-to-list 'faces cur))) faces)) -(erc-assert +(assert (let ((str "is bold")) (put-text-property 3 (length str) 'face '(bold erc-current-nick-face) @@ -887,6 +993,29 @@ That means the number of unseen messages in a channel." (sort erc-modified-channels-alist (lambda (a b) (> (nth 1 a) (nth 1 b)))))) +(defun erc-track-face-priority (face) + "Return a number indicating the priority of FACE in +`erc-track-faces-priority-list'. Lower number means higher +priority. + +If face is not in `erc-track-faces-priority-list', it will have a +higher number than any other face in that list." + (let ((count 0)) + (catch 'done + (dolist (item erc-track-faces-priority-list) + (if (equal item face) + (throw 'done t) + (setq count (1+ count))))) + count)) + +(defun erc-track-sort-by-importance () + "Sort erc-modified-channels-alist by importance. +That means the position of the face in `erc-track-faces-priority-list'." + (setq erc-modified-channels-alist + (sort erc-modified-channels-alist + (lambda (a b) (< (erc-track-face-priority (cddr a)) + (erc-track-face-priority (cddr b))))))) + (defun erc-track-get-active-buffer (arg) "Return the buffer name of ARG in `erc-modified-channels-alist'. Negative arguments index in the opposite direction. This direction is @@ -898,7 +1027,8 @@ relative to `erc-track-switch-direction'" (oldest 'newest) (newest 'oldest) (mostactive 'leastactive) - (leastactive 'mostactive))) + (leastactive 'mostactive) + (importance 'oldest))) (setq arg (- arg))) (setq offset (case dir ((oldest leastactive) diff --git a/lisp/erc/erc-xdcc.el b/lisp/erc/erc-xdcc.el index ed1d0c948b6..b58a7b61713 100644 --- a/lisp/erc/erc-xdcc.el +++ b/lisp/erc/erc-xdcc.el @@ -62,6 +62,11 @@ being evaluated and should return stings." :group 'erc-dcc :type '(repeat (repeat :tag "Message" (choice string sexp)))) +;;;###autoload (autoload 'erc-xdcc-mode "erc-xdcc") +(define-erc-module xdcc nil + "Act as an XDCC file-server." + nil nil) + ;;;###autoload (defun erc-xdcc-add-file (file) "Add a file to `erc-xdcc-files'." @@ -126,5 +131,11 @@ being evaluated and should return stings." (provide 'erc-xdcc) -;; arch-tag: a13b62fe-2399-4562-af4e-f18a8dd4b9c8 ;;; erc-xdcc.el ends here +;; +;; Local Variables: +;; indent-tabs-mode: t +;; tab-width: 8 +;; End: + +;; arch-tag: a13b62fe-2399-4562-af4e-f18a8dd4b9c8 diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 649fc4a63df..a085336f9a1 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -66,7 +66,7 @@ ;;; Code: -(defconst erc-version-string "Version 5.2" +(defconst erc-version-string "Version 5.3" "ERC version. This is used by function `erc-version'.") (eval-when-compile (require 'cl)) @@ -836,8 +836,9 @@ See `erc-server-flood-margin' for other flood-related parameters.") ;; Script parameters (defcustom erc-startup-file-list - '("~/.emacs.d/.ercrc.el" "~/.emacs.d/.ercrc" - "~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc") + (list (concat erc-user-emacs-directory ".ercrc.el") + (concat erc-user-emacs-directory ".ercrc") + "~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc") "List of files to try for a startup script. The first existent and readable one will get executed. @@ -1109,6 +1110,7 @@ which the local user typed." (define-key map "\C-c\C-r" 'erc-remove-text-properties-region) (define-key map "\C-c\C-t" 'erc-set-topic) (define-key map "\C-c\C-u" 'erc-kill-input) + (define-key map "\C-c\C-x" 'erc-quit-server) (define-key map "\M-\t" 'ispell-complete-word) (define-key map "\t" 'erc-complete-word) @@ -1166,7 +1168,13 @@ This will only be used if `erc-header-line-face-method' is non-nil." See the variable `erc-command-indicator'." :group 'erc-faces) -(defface erc-notice-face '((t (:bold t :foreground "SlateBlue"))) +(defface erc-notice-face + (if (or (featurep 'xemacs) + (< emacs-major-version 22)) + '((t (:bold t :foreground "blue"))) + '((((class color) (min-colors 88)) + (:bold t :foreground "SlateBlue")) + (t (:bold t :foreground "blue")))) "ERC face for notices." :group 'erc-faces) @@ -1460,22 +1468,27 @@ Turning on `erc-mode' runs the hook `erc-mode-hook'." (defconst erc-default-server "irc.freenode.net" "IRC server to use if it cannot be detected otherwise.") -(defconst erc-default-port "6667" +(defconst erc-default-port 6667 "IRC port to use if it cannot be detected otherwise.") (defcustom erc-join-buffer 'buffer - "Determines how to display the newly created IRC buffer. -'window - in another window, -'window-noselect - in another window, but don't select that one, -'frame - in another frame, -'bury - bury it in a new buffer, -any other value - in place of the current buffer." + "Determines how to display a newly created IRC buffer. + +The available choices are: + + 'window - in another window, + 'window-noselect - in another window, but don't select that one, + 'frame - in another frame, + 'bury - bury it in a new buffer, + 'buffer - in place of the current buffer, + any other value - in place of the current buffer." :group 'erc-buffers - :type '(choice (const window) - (const window-noselect) - (const frame) - (const bury) - (const buffer))) + :type '(choice (const :tag "Split window and select" window) + (const :tag "Split window, don't select" window-noselect) + (const :tag "New frame" frame) + (const :tag "Bury in new buffer" bury) + (const :tag "Use current buffer" buffer) + (const :tag "Use current buffer" t))) (defcustom erc-frame-alist nil "*Alist of frame parameters for creating erc frames. @@ -1491,6 +1504,14 @@ This only has effect when `erc-join-buffer' is set to `frame'." :group 'erc-buffers :type 'boolean) +(defcustom erc-reuse-frames t + "*Determines whether new frames are always created. +Non-nil means that a new frame is not created to display an ERC +buffer if there is already a window displaying it. This only has +effect when `erc-join-buffer' is set to `frame'." + :group 'erc-buffers + :type 'boolean) + (defun erc-channel-p (channel) "Return non-nil if CHANNEL seems to be an IRC channel name." (cond ((stringp channel) @@ -1671,16 +1692,24 @@ nil." ;; Make the evaluation have the correct order (let ((pre (make-symbol "pre")) (pro (make-symbol "pro"))) - `(let ((,pro ,process) - (,pre ,pred)) - (mapcar (lambda (buffer) - (with-current-buffer buffer - ,@forms)) - (erc-buffer-list ,pre - ,pro))))) + `(let* ((,pro ,process) + (,pre ,pred) + (res (mapcar (lambda (buffer) + (with-current-buffer buffer + ,@forms)) + (erc-buffer-list ,pre + ,pro)))) + ;; Silence the byte-compiler by binding the result of mapcar to + ;; a variable. + res))) (put 'erc-with-all-buffers-of-server 'lisp-indent-function 1) (put 'erc-with-all-buffers-of-server 'edebug-form-spec '(form form body)) +;; (iswitchb-mode) will autoload iswitchb.el +(defvar iswitchb-temp-buflist) +(declare-function iswitchb-read-buffer "iswitchb" + (prompt &optional default require-match start matches-set)) + (defun erc-iswitchb (&optional arg) "Use `iswitchb-read-buffer' to prompt for a ERC buffer to switch to. When invoked with prefix argument, use all erc buffers. Without prefix @@ -1691,9 +1720,7 @@ If `erc-track-mode' is in enabled, put the last element of Due to some yet unresolved reason, global function `iswitchb-mode' needs to be active for this function to work." (interactive "P") - (eval-when-compile - (require 'iswitchb)) - (let ((enabled iswitchb-mode)) + (let ((enabled (bound-and-true-p iswitchb-mode))) (or enabled (iswitchb-mode 1)) (unwind-protect (let ((iswitchb-make-buflist-hook @@ -1789,8 +1816,8 @@ buffer rather than a server buffer.") mods)))) (defcustom erc-modules '(netsplit fill button match track completion readonly - ring autojoin noncommands irccontrols - stamp menu) + networks ring autojoin noncommands irccontrols + move-to-prompt stamp menu list) "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 @@ -1822,14 +1849,20 @@ removed from the list will be disabled." (const :tag "completion: Complete nicknames and commands (programmable)" completion) (const :tag "hecomplete: Complete nicknames and commands (old)" hecomplete) + (const :tag "dcc: Provide Direct Client-to-Client support" dcc) (const :tag "fill: Wrap long lines" fill) (const :tag "identd: Launch an identd server on port 8113" identd) (const :tag "irccontrols: Highlight or remove IRC control characters" irccontrols) + (const :tag "keep-place: Leave point above un-viewed text" keep-place) + (const :tag "list: List channels in a separate buffer" list) (const :tag "log: Save buffers in logs" log) (const :tag "match: Highlight pals, fools, and other keywords" match) (const :tag "menu: Display a menu in ERC buffers" menu) + (const :tag "move-to-prompt: Move to the prompt when typing text" + move-to-prompt) (const :tag "netsplit: Detect netsplits" netsplit) + (const :tag "networks: Provide data about IRC networks" networks) (const :tag "noncommands: Don't display non-IRC commands after evaluation" noncommands) (const :tag @@ -1851,6 +1884,7 @@ removed from the list will be disabled." (const :tag "track: Track channel activity in the mode-line" track) (const :tag "truncate: Truncate buffers to a certain size" truncate) (const :tag "unmorse: Translate morse code in messages" unmorse) + (const :tag "xdcc: Act as an XDCC file-server" xdcc) (repeat :tag "Others" :inline t symbol)) :group 'erc) @@ -1888,14 +1922,16 @@ removed from the list will be disabled." ((eq erc-join-buffer 'bury) nil) ((eq erc-join-buffer 'frame) - (funcall '(lambda (frame) + (when (or (not erc-reuse-frames) + (not (get-buffer-window buffer t))) + ((lambda (frame) (raise-frame frame) (select-frame frame)) (make-frame (or erc-frame-alist default-frame-alist))) (switch-to-buffer buffer) (when erc-frame-dedicated-flag - (set-window-dedicated-p (selected-window) t))) + (set-window-dedicated-p (selected-window) t)))) (t (if (active-minibuffer-window) (display-buffer buffer) @@ -2151,20 +2187,56 @@ Arguments are the same as for `erc'." (defalias 'erc-select-ssl 'erc-ssl) +(declare-function open-ssl-stream "ext:ssl" (name buffer host service)) + (defun erc-open-ssl-stream (name buffer host port) "Open an SSL stream to an IRC server. The process will be given the name NAME, its target buffer will be BUFFER. HOST and PORT specify the connection target." - (when (require 'tls) - (let ((proc (open-tls-stream name buffer host port))) + (when (condition-case nil + (require 'ssl) + (error (message "You don't have ssl.el. %s" + "Try using `erc-tls' instead.") + nil)) + (let ((proc (open-ssl-stream name buffer host port))) ;; Ugly hack, but it works for now. Problem is it is ;; very hard to detect when ssl is established, because s_client ;; doesn't give any CONNECTIONESTABLISHED kind of message, and ;; most IRC servers send nothing and wait for you to identify. - ;; Disabled when switching to tls.el -- jas - ;(sit-for 5) + (sit-for 5) proc))) +(defun erc-tls (&rest r) + "Interactively select TLS connection parameters and run ERC. +Arguments are the same as for `erc'." + (interactive (erc-select-read-args)) + (let ((erc-server-connect-function 'erc-open-tls-stream)) + (apply 'erc r))) + +(declare-function open-tls-stream "tls" (name buffer host port)) + +(defun erc-open-tls-stream (name buffer host port) + "Open an TLS stream to an IRC server. +The process will be given the name NAME, its target buffer will be +BUFFER. HOST and PORT specify the connection target." + (when (condition-case nil + (require 'tls) + (error (message "You don't have tls.el. %s" + "Try using `erc-ssl' instead.") + nil)) + (open-tls-stream name buffer host port))) + +;;; Displaying error messages + +(defun erc-error (&rest args) + "Pass ARGS to `format', and display the result as an error message. +If `debug-on-error' is set to non-nil, then throw a real error with this +message instead, to make debugging easier." + (if debug-on-error + (apply #'error args) + (apply #'message args) + (beep))) + ;;; Debugging the protocol (defvar erc-debug-irc-protocol nil @@ -2179,6 +2251,8 @@ but you won't see it. WARNING: Do not set this variable directly! Instead, use the function `erc-toggle-debug-irc-protocol' to toggle its value.") +(declare-function erc-network-name "erc-networks" ()) + (defun erc-log-irc-protocol (string &optional outbound) "Append STRING to the buffer *erc-protocol*. @@ -2228,7 +2302,7 @@ If ARG is non-nil, show the *erc-protocol* buffer." (interactive "P") (let* ((buf (get-buffer-create "*erc-protocol*"))) (with-current-buffer buf - (erc-view-mode-enter 1) + (erc-view-mode-enter) (when (null (current-local-map)) (let ((inhibit-read-only t)) (insert (erc-make-notice "This buffer displays all IRC protocol traffic exchanged with each server.\n")) @@ -2269,6 +2343,15 @@ If ARG is non-nil, show the *erc-protocol* buffer." I.e. any char in it has the `invisible' property set." (text-property-any 0 (length string) 'invisible t string)) +(defcustom erc-remove-parsed-property t + "Whether to remove the erc-parsed text property after displaying a message. + +The default is to remove it, since it causes ERC to take up extra +memory. If you have code that relies on this property, then set +this option to nil." + :type 'boolean + :group 'erc) + (defun erc-display-line-1 (string buffer) "Display STRING in `erc-mode' BUFFER. Auxiliary function used in `erc-display-line'. The line gets filtered to @@ -2309,7 +2392,10 @@ If STRING is nil, the function does nothing." (save-restriction (narrow-to-region insert-position (point)) (run-hooks 'erc-insert-modify-hook) - (run-hooks 'erc-insert-post-hook)))))) + (run-hooks 'erc-insert-post-hook) + (when erc-remove-parsed-property + (remove-text-properties (point-min) (point-max) + '(erc-parsed nil)))))))) (erc-update-undo-list (- (or (marker-position erc-insert-marker) (point-max)) insert-position)))))) @@ -2456,6 +2542,14 @@ See also `erc-server-send'." (match-string 1 arglist) arglist))) +(defun erc-command-no-process-p (str) + "Return non-nil if STR is an ERC command that can be run when the process +is not alive, nil otherwise." + (let ((fun (erc-extract-command-from-line str))) + (and fun + (symbolp (car fun)) + (get (car fun) 'process-not-needed)))) + (defun erc-command-name (cmd) "For CMD being the function name of a ERC command, something like erc-cmd-FOO, this returns a string /FOO." @@ -2565,6 +2659,7 @@ VALUE is computed by evaluating the rest of LINE in Lisp." (defalias 'erc-cmd-VAR 'erc-cmd-SET) (defalias 'erc-cmd-VARIABLE 'erc-cmd-SET) (put 'erc-cmd-SET 'do-not-parse-args t) +(put 'erc-cmd-SET 'process-not-needed t) (defun erc-cmd-default (line) "Fallback command. @@ -2623,6 +2718,7 @@ If no USER argument is specified, list the contents of `erc-ignore-list'." "Clear the window content." (recenter 0) t) +(put 'erc-cmd-CLEAR 'process-not-needed t) (defun erc-cmd-OPS () "Show the ops in the current channel." @@ -2656,6 +2752,7 @@ If no USER argument is specified, list the contents of `erc-ignore-list'." (erc-display-message nil 'notice 'active 'country-unknown ?d tld)) t)) +(put 'erc-cmd-COUNTRY 'process-not-needed t) (defun erc-cmd-AWAY (line) "Mark the user as being away, the reason being indicated by LINE. @@ -2736,6 +2833,7 @@ For a list of user commands (/join /part, ...): t)) (defalias 'erc-cmd-H 'erc-cmd-HELP) +(put 'erc-cmd-HELP 'process-not-needed t) (defun erc-cmd-JOIN (channel &optional key) "Join the channel given in CHANNEL, optionally with KEY. @@ -2959,6 +3057,11 @@ LINE has the format \"USER ACTION\"." (t nil))) (put 'erc-cmd-ME 'do-not-parse-args t) +(defun erc-cmd-ME\'S (line) + "Do a /ME command, but add the string \" 's\" to the beginning." + (erc-cmd-ME (concat " 's" line))) +(put 'erc-cmd-ME\'S 'do-not-parse-args t) + (defun erc-cmd-LASTLOG (line) "Show all lines in the current buffer matching the regexp LINE. @@ -2973,6 +3076,7 @@ the matching is case-sensitive." (occur line) t) (put 'erc-cmd-LASTLOG 'do-not-parse-args t) +(put 'erc-cmd-LASTLOG 'process-not-needed t) (defun erc-send-message (line &optional force) "Send LINE to the current channel or user and display it. @@ -3088,14 +3192,35 @@ just as you provided it. Use this command with care!" (t nil))) (put 'erc-cmd-QUOTE 'do-not-parse-args t) +(defcustom erc-query-display 'window + "Indicates how to display query buffers when using the /QUERY +command to talk to someone. + +The default behavior is to display the message in a new window +and bring it to the front. See the documentation for +`erc-join-buffer' for a description of the available choices. + +See also `erc-auto-query' to decide how private messages from +other people should be displayed." + :group 'erc-query + :type '(choice (const :tag "Split window and select" window) + (const :tag "Split window, don't select" window-noselect) + (const :tag "New frame" frame) + (const :tag "Bury in new buffer" bury) + (const :tag "Use current buffer" buffer) + (const :tag "Use current buffer" t))) + (defun erc-cmd-QUERY (&optional user) "Open a query with USER. The type of query window/frame/etc will depend on the value of -`erc-join-buffer'. If USER is omitted, close the current query buffer if one -exists - except this is broken now ;-)" +`erc-query-display'. + +If USER is omitted, close the current query buffer if one exists +- except this is broken now ;-)" (interactive (list (read-from-minibuffer "Start a query with: " nil))) - (let ((session-buffer (erc-server-buffer))) + (let ((session-buffer (erc-server-buffer)) + (erc-join-buffer erc-query-display)) (if user (erc-query user session-buffer) ;; currently broken, evil hack to display help anyway @@ -3195,20 +3320,34 @@ the message given by REASON." (defalias 'erc-cmd-EXIT 'erc-cmd-QUIT) (defalias 'erc-cmd-SIGNOFF 'erc-cmd-QUIT) (put 'erc-cmd-QUIT 'do-not-parse-args t) +(put 'erc-cmd-QUIT 'process-not-needed t) (defun erc-cmd-GQUIT (reason) "Disconnect from all servers at once with the same quit REASON." (erc-with-all-buffers-of-server nil #'erc-open-server-buffer-p - (erc-cmd-QUIT reason))) + (erc-cmd-QUIT reason)) + (when erc-kill-queries-on-quit + ;; if the query buffers have not been killed within 4 seconds, + ;; kill them + (run-at-time + 4 nil + (lambda () + (dolist (buffer (erc-buffer-list (lambda (buf) + (not (erc-server-buffer-p buf))))) + (kill-buffer buffer))))) + t) (defalias 'erc-cmd-GQ 'erc-cmd-GQUIT) (put 'erc-cmd-GQUIT 'do-not-parse-args t) +(put 'erc-cmd-GQUIT 'process-not-needed t) (defun erc-cmd-RECONNECT () "Try to reconnect to the current IRC server." - (let ((buffer (or (erc-server-buffer) (current-buffer))) + (let ((buffer (erc-server-buffer)) (process nil)) - (with-current-buffer (if (bufferp buffer) buffer (current-buffer)) + (unless (buffer-live-p buffer) + (setq buffer (current-buffer))) + (with-current-buffer buffer (setq erc-server-quitting nil) (setq erc-server-reconnecting t) (setq erc-server-reconnect-count 0) @@ -3218,6 +3357,7 @@ the message given by REASON." (erc-server-reconnect)) (setq erc-server-reconnecting nil))) t) +(put 'erc-cmd-RECONNECT 'process-not-needed t) (defun erc-cmd-SERVER (server) "Connect to SERVER, leaving existing connection intact." @@ -3225,9 +3365,9 @@ the message given by REASON." (condition-case nil (erc :server server :nick (erc-current-nick)) (error - (message "Cannot find host %s." server) - (beep))) + (erc-error "Cannot find host %s." server))) t) +(put 'erc-cmd-SERVER 'process-not-needed t) (eval-when-compile (defvar motif-version-string) @@ -3598,7 +3738,7 @@ If `point' is at the beginning of a channel name, use that as default." (set-buffer (process-buffer erc-server-process)) erc-channel-list))) (completing-read "Join channel: " table nil nil nil nil chnl)) - (when erc-prompt-for-channel-key + (when (or current-prefix-arg erc-prompt-for-channel-key) (read-from-minibuffer "Channel key (RET for none): " nil)))) (erc-cmd-JOIN channel (when (>= (length key) 1) key))) @@ -3619,8 +3759,9 @@ If `point' is at the beginning of a channel name, use that as default." (read-from-minibuffer (concat "Set topic of " (erc-default-target) ": ") (when erc-channel-topic - (cons (apply 'concat (butlast (split-string erc-channel-topic "\C-o"))) - 0))))) + (let ((ss (split-string erc-channel-topic "\C-o"))) + (cons (apply 'concat (if (cdr ss) (butlast ss) ss)) + 0)))))) (let ((topic-list (split-string topic "\C-o"))) ; strip off the topic setter (erc-cmd-TOPIC (concat (erc-default-target) " " (car topic-list))))) @@ -3753,20 +3894,22 @@ To change how this query window is displayed, use `let' to bind (erc-update-mode-line) buf)) -(defcustom erc-auto-query 'bury +(defcustom erc-auto-query 'window-noselect "If non-nil, create a query buffer each time you receive a private message. +If the buffer doesn't already exist, it is created. -If the buffer doesn't already exist it is created. This can be -set to a symbol, to control how the new query window should -appear. See the documentation for `erc-join-buffer' for -available choices." +This can be set to a symbol, to control how the new query window +should appear. The default behavior is to display the buffer in +a new window, but not to select it. See the documentation for +`erc-join-buffer' for a description of the available choices." :group 'erc-query - :type '(choice (const nil) - (const buffer) - (const window) - (const window-noselect) - (const bury) - (const frame))) + :type '(choice (const :tag "Don't create query window" nil) + (const :tag "Split window and select" window) + (const :tag "Split window, don't select" window-noselect) + (const :tag "New frame" frame) + (const :tag "Bury in new buffer" bury) + (const :tag "Use current buffer" buffer) + (const :tag "Use current buffer" t))) (defcustom erc-query-on-unjoined-chan-privmsg t "If non-nil create query buffer on receiving any PRIVMSG at all. @@ -3885,7 +4028,7 @@ and as second argument the event parsed as a vector." (string= target (erc-current-nick))) (not (erc-get-buffer query proc)) (not (erc-is-message-ctcp-and-not-action-p msg)) - (let ((erc-join-buffer erc-auto-query)) + (let ((erc-query-display erc-auto-query)) (erc-cmd-QUERY query)) nil)))) @@ -4411,33 +4554,65 @@ See also `erc-channel-begin-receiving-names'." erc-channel-users) (setq erc-channel-new-member-names nil)) +(defun erc-parse-prefix () + "Return an alist of valid prefix character types and their representations. +Example: (operator) o => @, (voiced) v => +." + (let ((str (or (cdr (assoc "PREFIX" (erc-with-server-buffer + erc-server-parameters))) + ;; provide a sane default + "(ov)@+")) + types chars) + (when (string-match "^(\\([^)]+\\))\\(.+\\)$" str) + (setq types (match-string 1 str) + chars (match-string 2 str)) + (let ((len (min (length types) (length chars))) + (i 0) + (alist nil)) + (while (< i len) + (setq alist (cons (cons (elt types i) (elt chars i)) + alist)) + (setq i (1+ i))) + alist)))) + (defun erc-channel-receive-names (names-string) "This function is for internal use only. Update `erc-channel-users' according to NAMES-STRING. NAMES-STRING is a string listing some of the names on the channel." - (let (names name op voice) - ;; We need to delete "" because in XEmacs, (split-string "a ") - ;; returns ("a" ""). - (setq names (delete "" (split-string names-string))) - (let ((erc-channel-members-changed-hook nil)) - (dolist (item names) - (cond ((string-match "^@\\(.*\\)$" item) - (setq name (match-string 1 item) - op 'on - voice 'off)) - ((string-match "^+\\(.*\\)$" item) - (setq name (match-string 1 item) - op 'off - voice 'on)) - (t (setq name item - op 'off - voice 'off))) - (puthash (erc-downcase name) t - erc-channel-new-member-names) - (erc-update-current-channel-member - name name t op voice))) + (let (prefix op-ch voice-ch names name op voice) + (setq prefix (erc-parse-prefix)) + (setq op-ch (cdr (assq ?o prefix)) + voice-ch (cdr (assq ?v prefix))) + ;; We need to delete "" because in XEmacs, (split-string "a ") + ;; returns ("a" ""). + (setq names (delete "" (split-string names-string))) + (let ((erc-channel-members-changed-hook nil)) + (dolist (item names) + (let ((updatep t) + ch) + (if (rassq (elt item 0) prefix) + (cond ((= (length item) 1) + (setq updatep nil)) + ((eq (elt item 0) op-ch) + (setq name (substring item 1) + op 'on + voice 'off)) + ((eq (elt item 0) voice-ch) + (setq name (substring item 1) + op 'off + voice 'on)) + (t (setq name (substring item 1) + op 'off + voice 'off))) + (setq name item + op 'off + voice 'off)) + (when updatep + (puthash (erc-downcase name) t + erc-channel-new-member-names) + (erc-update-current-channel-member + name name t op voice))))) (run-hooks 'erc-channel-members-changed-hook))) (defcustom erc-channel-members-changed-hook nil @@ -4529,15 +4704,15 @@ See also: `erc-update-user' and `erc-update-channel-member'." (setq changed t) (setf (erc-channel-user-op cuser) (cond ((eq op 'on) t) - ((eq op 'off) nil) - (t op)))) + ((eq op 'off) nil) + (t op)))) (when (and voice (not (eq (erc-channel-user-voice cuser) voice))) (setq changed t) (setf (erc-channel-user-voice cuser) (cond ((eq voice 'on) t) - ((eq voice 'off) nil) - (t voice)))) + ((eq voice 'off) nil) + (t voice)))) (when update-message-time (setf (erc-channel-user-last-message-time cuser) (current-time))) (setq user-changed @@ -4559,11 +4734,11 @@ See also: `erc-update-user' and `erc-update-channel-member'." (erc-server-user-buffers user)))) (setq cuser (make-erc-channel-user :op (cond ((eq op 'on) t) - ((eq op 'off) nil) - (t op)) + ((eq op 'off) nil) + (t op)) :voice (cond ((eq voice 'on) t) - ((eq voice 'off) nil) - (t voice)) + ((eq voice 'off) nil) + (t voice)) :last-message-time (if update-message-time (current-time)))) (puthash (erc-downcase nick) (cons user cuser) @@ -4892,39 +5067,37 @@ Specifically, return the position of `erc-insert-marker'." (interactive) (save-restriction (widen) - (cond - ((< (point) (erc-beg-of-input-line)) - (message "Point is not in the input area") - (beep)) - ((not (erc-server-buffer-live-p)) - (message "ERC: No process running") - (beep)) - (t - (erc-set-active-buffer (current-buffer)) + (if (< (point) (erc-beg-of-input-line)) + (erc-error "Point is not in the input area") (let ((inhibit-read-only t) (str (erc-user-input)) (old-buf (current-buffer))) - - ;; Kill the input and the prompt - (delete-region (erc-beg-of-input-line) - (erc-end-of-input-line)) - - (unwind-protect - (erc-send-input str) - ;; Fix the buffer if the command didn't kill it - (when (buffer-live-p old-buf) - (with-current-buffer old-buf - (save-restriction - (widen) - (goto-char (point-max)) - (set-marker (process-mark erc-server-process) (point)) - (set-marker erc-insert-marker (point)) - (let ((buffer-modified (buffer-modified-p))) - (erc-display-prompt) - (set-buffer-modified-p buffer-modified)))))) - - ;; Only when last hook has been run... - (run-hook-with-args 'erc-send-completed-hook str)))))) + (if (and (not (erc-server-buffer-live-p)) + (not (erc-command-no-process-p str))) + (erc-error "ERC: No process running") + (erc-set-active-buffer (current-buffer)) + + ;; Kill the input and the prompt + (delete-region (erc-beg-of-input-line) + (erc-end-of-input-line)) + + (unwind-protect + (erc-send-input str) + ;; Fix the buffer if the command didn't kill it + (when (buffer-live-p old-buf) + (with-current-buffer old-buf + (save-restriction + (widen) + (goto-char (point-max)) + (when (processp erc-server-process) + (set-marker (process-mark erc-server-process) (point))) + (set-marker erc-insert-marker (point)) + (let ((buffer-modified (buffer-modified-p))) + (erc-display-prompt) + (set-buffer-modified-p buffer-modified)))))) + + ;; Only when last hook has been run... + (run-hook-with-args 'erc-send-completed-hook str)))))) (defun erc-user-input () "Return the input of the user in the current buffer." @@ -4932,7 +5105,7 @@ 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-*\\)$" +(defvar erc-command-regexp "^/\\([A-Za-z']+\\)\\(\\s-+.*\\|\\s-*\\)$" "Regular expression used for matching commands in ERC.") (defun erc-send-input (input) @@ -4985,7 +5158,8 @@ This returns non-nil only if we actually send anything." (erc-put-text-property beg (point) 'face 'erc-command-indicator-face) (insert "\n")) - (set-marker (process-mark erc-server-process) (point)) + (when (processp erc-server-process) + (set-marker (process-mark erc-server-process) (point))) (set-marker erc-insert-marker (point)) (save-excursion (save-restriction @@ -5004,7 +5178,8 @@ current position." (erc-put-text-property beg (point) 'face 'erc-input-face)) (insert "\n") - (set-marker (process-mark erc-server-process) (point)) + (when (processp erc-server-process) + (set-marker (process-mark erc-server-process) (point))) (set-marker erc-insert-marker (point)) (save-excursion (save-restriction @@ -5702,7 +5877,7 @@ See `current-time' for details on the time format." ;; Mode line handling -(defcustom erc-mode-line-format "%s %a" +(defcustom erc-mode-line-format "%S %a" "A string to be formatted and shown in the mode-line in `erc-mode'. The string is formatted using `format-spec' and the result is set as the value @@ -5713,12 +5888,16 @@ The following characters are replaced: %l: The estimated lag time to the server %m: The modes of the channel %n: The current nick name +%N: The name of the network %o: The topic of the channel %p: The session port %t: The name of the target (channel, nickname, or servername:port) %s: In the server-buffer, this gets filled with the value of `erc-server-announced-name', in a channel, the value of - (erc-default-target) also get concatenated." + (erc-default-target) also get concatenated. +%S: In the server-buffer, this gets filled with the value of + `erc-network', in a channel, the value of (erc-default-target) + also get concatenated." :group 'erc-mode-line-and-header :type 'string) @@ -5812,6 +5991,29 @@ This should be a string with substitution variables recognized by (server-name server-name) (t (buffer-name (current-buffer)))))) +(defun erc-format-network () + "Return the name of the network we are currently on." + (let ((network (and (fboundp 'erc-network-name) (erc-network-name)))) + (if (and network (symbolp network)) + (symbol-name network) + ""))) + +(defun erc-format-target-and/or-network () + "Return the network or the current target and network combined. +If the name of the network is not available, then use the +shortened server name instead." + (let ((network-name (or (and (fboundp 'erc-network-name) (erc-network-name)) + (erc-shorten-server-name + (or erc-server-announced-name + erc-session-server))))) + (when (and network-name (symbolp network-name)) + (setq network-name (symbol-name network-name))) + (cond ((erc-default-target) + (concat (erc-string-no-properties (erc-default-target)) + "@" network-name)) + (network-name network-name) + (t (buffer-name (current-buffer)))))) + (defun erc-format-away-status () "Return a formatted `erc-mode-line-away-status-format' if `erc-away' is non-nil." @@ -5844,6 +6046,9 @@ if `erc-away' is non-nil." (cond (lag (format "lag:%.0f" lag)) (t "")))) +;; erc-goodies is required at end of this file. +(declare-function erc-controls-strip "erc-goodies" (str)) + (defun erc-update-mode-line-buffer (buffer) "Update the mode line in a single ERC buffer BUFFER." (with-current-buffer buffer @@ -5852,9 +6057,11 @@ if `erc-away' is non-nil." ?l (erc-format-lag-time) ?m (erc-format-channel-modes) ?n (or (erc-current-nick) "") + ?N (erc-format-network) ?o (erc-controls-strip erc-channel-topic) ?p (erc-port-to-string erc-session-port) ?s (erc-format-target-and/or-server) + ?S (erc-format-target-and/or-network) ?t (erc-format-target))) (process-status (cond ((and (erc-server-process-alive) (not erc-server-connected)) @@ -6090,10 +6297,12 @@ All windows are opened in the current frame." (s252 . "%i operator(s) online") (s253 . "%i unknown connection(s)") (s254 . "%i channels formed") + (s275 . "%n %m") (s301 . "%n is AWAY: %r") (s303 . "Is online: %n") (s305 . "%m") (s306 . "%m") + (s307 . "%n %m") (s311 . "%n is %f (%u@%h)") (s312 . "%n is/was on server %s (%c)") (s313 . "%n is an IRC operator") |