aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2007-01-17 18:17:25 +0000
committerMiles Bader2007-01-17 18:17:25 +0000
commit6904f7fe8ed11bf4c94c009b4ef300f4ccdfa2e6 (patch)
tree5d3f9cf0ca50143225d6e0622620942f90d90d78
parentc5f847b6b3c1733731e079c3adaca0c30ed69522 (diff)
downloademacs-6904f7fe8ed11bf4c94c009b4ef300f4ccdfa2e6.tar.gz
emacs-6904f7fe8ed11bf4c94c009b4ef300f4ccdfa2e6.zip
Merge from erc--main--0
Highlights: - Display messages starting with "/" but are not commands correctly. - Add erc-capab.el file, with capab-identify module. - Fix various ERC menu bugs and add "Current channel" submenu. - Make header-line display look nicer. - Fix warning when auto-authenticating to bitlbee. - New option erc-system-name allows the hostname next to your nick to be customized. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-599 Creator: Michael Olson <mwolson@gnu.org>
-rw-r--r--etc/ChangeLog4
-rw-r--r--etc/ERC-NEWS11
-rw-r--r--lisp/erc/ChangeLog158
-rw-r--r--lisp/erc/erc-backend.el4
-rw-r--r--lisp/erc/erc-capab.el202
-rw-r--r--lisp/erc/erc-dcc.el46
-rw-r--r--lisp/erc/erc-menu.el118
-rw-r--r--lisp/erc/erc-services.el92
-rw-r--r--lisp/erc/erc-track.el4
-rw-r--r--lisp/erc/erc.el94
-rw-r--r--man/ChangeLog4
-rw-r--r--man/erc.texi4
12 files changed, 601 insertions, 140 deletions
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 50a18ac4187..a01984d0bac 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,7 @@
12007-01-13 Michael Olson <mwolson@gnu.org>
2
3 * ERC-NEWS: Mention new erc-capab.el file.
4
12007-01-13 Glenn Morris <rgm@gnu.org> 52007-01-13 Glenn Morris <rgm@gnu.org>
2 6
3 * MACHINES: Add information on compiling 32-bit Emacs on 64-bit 7 * MACHINES: Add information on compiling 32-bit Emacs on 64-bit
diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS
index a927419c8c7..d2dcb0b00a1 100644
--- a/etc/ERC-NEWS
+++ b/etc/ERC-NEWS
@@ -22,6 +22,17 @@ reconnection attempts that ERC will make per server.
22amount of time, in seconds, that ERC will wait between successive 22amount of time, in seconds, that ERC will wait between successive
23reconnect attempts. 23reconnect attempts.
24 24
25** New face: `erc-my-nick-face'
26This helps make it easier to distinguish messages sent by yourself
27from messages sent by other users when the value of the variable
28`erc-show-my-nick' is non-nil.
29
30** New modules
31
32*** Capab identify (erc-capab.el)
33Mark users who haven't identified to NickServ on servers supporting
34CAPAB IDENTIFY-MSG.
35
25** Changes and additions to modules 36** Changes and additions to modules
26 37
27*** Channel lists (erc-list.el) 38*** Channel lists (erc-list.el)
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index fa087fb513f..79ab94269ba 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,94 @@
12007-01-13 Michael Olson <mwolson@gnu.org>
2
3 * erc.el (erc-command-regexp): New variable that is used to match
4 a command.
5 (erc-send-input): Use it. This fixes a bug where paths --
6 "/usr/bin/foo", for example -- were being displayed as commands,
7 but still sent correctly.
8 (erc-extract-command-from-line): Use it.
9
10 * erc.texi (Modules): Document erc-capab-identify.
11
122007-01-11 Diane Murray <disumu@x3y2z1.net>
13
14 * erc.el (erc-find-parsed-property): Moved here from erc-track.el
15 since it can be useful in general.
16
17 * erc-track.el (erc-find-parsed-property): Removed.
18
19 * erc-capab.el (erc-capab-find-parsed): Removed.
20 (erc-capab-identify-add-prefix): Use `erc-find-parsed-property'.
21
22 * erc.el (erc-open): Run `erc-before-connect' hook here. This
23 makes sure the hook always gets called before a connection is
24 made, as some functions, like `erc-handle-irc-url', use `erc-open'
25 instead of `erc'.
26 (erc): Removed `erc-before-connect' hook.
27
28 * erc-menu.el (erc-menu-definition): Put items specific to
29 channels in a "Current channel" submenu.
30
31 * erc-backend.el (321, 323): Display channel list in server buffer
32 when not using the channel list module.
33
34 * erc.el: Updated copyright years.
35 (erc-version-string): Set to 5.2 (devel).
36 (erc-format-lag-time): Fixed to work when `erc-server-lag' is nil.
37 (erc-update-mode-line-buffer): Set the header face.
38
392007-01-11 Michael Olson <mwolson@gnu.org>
40
41 * erc-bbdb.el (erc-bbdb-popup-type): Fix customization type and
42 documentation.
43
44 * erc-services.el (erc-nickserv-identify-mode): Improve
45 documentation for nick-change option and move higher to fix
46 compiler warning. Avoid a recursive load error.
47 (erc-nickserv-alist): Add simple entry for BitlBee, to avoid
48 "NickServ is AWAY: User is offline" error. Oddly enough, bitlbee
49 was smart enough to recognize that as an authentication request
50 and log in regardless, which is why I didn't notice this earlier.
51 (erc-nickserv-alist-sender, erc-nickserv-alist-regexp)
52 (erc-nickserv-alist-nickserv, erc-nickserv-alist-ident-keyword)
53 (erc-nickserv-alist-use-nick-p)
54 (erc-nickserv-alist-ident-command): New accessors for
55 erc-nickserv-alist. Using nth is unwieldy.
56 (erc-nickserv-identify-autodetect)
57 (erc-nickserv-identify-on-connect)
58 (erc-nickserv-identify-on-nick-change, erc-nickserv-identify): Use
59 the new accessors.
60
612007-01-11 Diane Murray <disumu@x3y2z1.net>
62
63 * NEWS: Added note for `erc-my-nick-face'. Fixed capab-identify
64 wording.
65
662007-01-10 Diane Murray <disumu@x3y2z1.net>
67
68 * erc.el (erc-mode-line-format): Added %l to documentation.
69 (erc-header-line-format): Removed "[IRC]". Use the new %l
70 replacement character. Doc fix.
71 (erc-format-channel-modes): Removed lag code. Removed parentheses
72 from mode string.
73 (erc-format-lag-time): New function.
74 (erc-update-mode-line-buffer): Use it.
75
762007-01-09 Michael Olson <mwolson@gnu.org>
77
78 * erc.el (erc-system-name): New option that determines the system
79 name to use when logging in. The default is to figure this out by
80 calling `system-name'.
81 (erc-login): Use it.
82
832007-01-07 Michael Olson <mwolson@gnu.org>
84
85 * erc.el (erc-modules): Add the menu module. This should fix a
86 bug with incorrect ERC submenus being displayed.
87
88 * erc-menu.el: Turn this into a module.
89 (erc-menu-add, erc-menu-remove): New functions that add and remove
90 the ERC menu.
91
12006-12-28 Michael Olson <mwolson@gnu.org> 922006-12-28 Michael Olson <mwolson@gnu.org>
2 93
3 * erc-list.el: Change header to mention that this is part of ERC, 94 * erc-list.el: Change header to mention that this is part of ERC,
@@ -645,8 +736,30 @@
645 <C-tab> for `erc-button-previous' as it is a more standard key 736 <C-tab> for `erc-button-previous' as it is a more standard key
646 binding for this type of function. 737 binding for this type of function.
647 738
7392006-02-28 Diane Murray <disumu@x3y2z1.net>
740
741 * erc-capab.el: Removed things that were accidentally committed on
742 2006-02-20. Removed Todo section.
743 (erc-capab-unidentified): Removed.
744
7452006-02-26 Michael Olson <mwolson@gnu.org>
746
747 * erc-capab.el: Use (eval-when-compile (require 'cl)).
748 (erc-capab-unidentified): Fix compiler warning by specifying
749 group.
750
7512006-02-20 Diane Murray <disumu@x3y2z1.net>
752
753 * erc-capab.el (erc-capab-send-identify-messages): Fixed comment
754 to explain thoughts better. `erc-server-parameters' is an
755 associated list when it's set, not a string.
756
6482006-02-19 Michael Olson <mwolson@gnu.org> 7572006-02-19 Michael Olson <mwolson@gnu.org>
649 758
759 * erc-capab.el (erc-capab-send-identify-messages): Make sure some
760 parameters are strings before using them. Thanks to Alejandro
761 Benitez for the report.
762
650 * erc.el (erc-version-string): Release ERC 5.1.2. 763 * erc.el (erc-version-string): Release ERC 5.1.2.
651 764
6522006-02-19 Diane Murray <disumu@x3y2z1.net> 7652006-02-19 Diane Murray <disumu@x3y2z1.net>
@@ -696,8 +809,13 @@
696 809
6972006-02-11 Michael Olson <mwolson@gnu.org> 8102006-02-11 Michael Olson <mwolson@gnu.org>
698 811
699 * erc.el (erc-update-modules): Make some requirements shorter, so 812 * erc.el (erc-update-modules): Handle erc-capab-identify
700 that it's easier to see why they are needed. 813 correctly. Make some requirements shorter, so that it's easier to
814 see why they are needed.
815
816 * erc-capab.el: Add autoload cookie for capab-identify.
817 (erc-capab-send-identify-messages, erc-capab-identify-activate):
818 Minor whitespace fix in code.
701 819
702 * erc-stamp.el (erc-timestamp-use-align-to): Renamed from 820 * erc-stamp.el (erc-timestamp-use-align-to): Renamed from
703 `erc-timestamp-right-align-by-pixel'. Set the default based on 821 `erc-timestamp-right-align-by-pixel'. Set the default based on
@@ -721,11 +839,21 @@
721 (erc-list-channels): Was `erc-cmd-LIST', renamed. 839 (erc-list-channels): Was `erc-cmd-LIST', renamed.
722 (erc-list-channels-simple): New function. 840 (erc-list-channels-simple): New function.
723 841
724 * erc.el (erc-modules): Added `list' to enabled modules. Moved 842 * erc.el (erc-modules): Added `list' to enabled modules. Changed
725 customization options left in source code. 843 `capab-identify' description. Moved customization options left in
844 source code.
726 845
727 * erc-menu.el (erc-menu-definition): Use `erc-list-channels'. 846 * erc-menu.el (erc-menu-definition): Use `erc-list-channels'.
728 847
848 * erc-capab.el: Put a little more detail into Usage section.
849 (define-erc-module): Run `erc-capab-identify-setup' in all open
850 server buffers when enabling.
851 (erc-capab-identify-setup): Make PROC and PARSED optional
852 arguments.
853 (erc-capab-identify-add-prefix): Simplified nickname regexp. This
854 should now also match nicknames that are formatted differently
855 than the default.
856
729 * erc-spelling.el (define-erc-module): Make sure there's a buffer 857 * erc-spelling.el (define-erc-module): Make sure there's a buffer
730 before calling `with-current-buffer'. 858 before calling `with-current-buffer'.
731 859
@@ -742,12 +870,34 @@
7422006-02-09 Diane Murray <disumu@x3y2z1.net> 8702006-02-09 Diane Murray <disumu@x3y2z1.net>
743 871
744 * erc.el (erc-get-parsed-vector, erc-get-parsed-vector-nick) 872 * erc.el (erc-get-parsed-vector, erc-get-parsed-vector-nick)
873 * erc-capab.el: Require erc.
874 (erc-capab-send-identify-messages): Use `erc-server-send'.
875 (erc-capab-identify-remove/set-identified-flag): Use 1 and 0 as
876 the flags so we can also check whether the `erc-identified' text
877 property is there at all.
878 (erc-capab-identify-add-prefix): Use `erc-capab-find-parsed'.
879 This fixes a bug where the prefix wasn't inserted when timestamps
880 are inserted on the right. Tweaked nickname regexp.
881 (erc-capab-find-parsed): New function.
882 (erc-capab-get-unidentified-nickname): Updated to check for 0
883 flag. Only get nickname if there's a nickuserhost associated with
884 this message.
885
886 * erc-capab.el: New file. Adds the new module
887 `erc-capab-identify', which allows flagging of unidentified users
888 on servers running an ircd based on dancer - irc.freenode.net, for
889 example.
890
891 * erc.el (erc-modules): Added `capab-identify' to options.
892 (erc-get-parsed-vector, erc-get-parsed-vector-nick)
745 (erc-get-parsed-vector-type): Moved here from erc-match.el. 893 (erc-get-parsed-vector-type): Moved here from erc-match.el.
746 894
747 * erc-match.el (erc-get-parsed-vector, erc-get-parsed-vector-nick) 895 * erc-match.el (erc-get-parsed-vector, erc-get-parsed-vector-nick)
748 (erc-get-parsed-vector-type): Moved these functions to erc.el 896 (erc-get-parsed-vector-type): Moved these functions to erc.el
749 since they can be useful outside of the text matching module. 897 since they can be useful outside of the text matching module.
750 898
899 * NEWS: Added erc-capab.el.
900
751 * erc-dcc.el, erc-stamp.el, erc-xdcc.el: Changed "Emacs IRC Client" 901 * erc-dcc.el, erc-stamp.el, erc-xdcc.el: Changed "Emacs IRC Client"
752 to "ERC". 902 to "ERC".
753 903
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index c589ae282a6..fa55c270497 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -1535,7 +1535,7 @@ See `erc-display-server-message'." nil
1535(define-erc-response-handler (321) 1535(define-erc-response-handler (321)
1536 "LIST header." nil 1536 "LIST header." nil
1537 (setq erc-channel-list nil) 1537 (setq erc-channel-list nil)
1538 (erc-display-message parsed 'notice 'active 's321)) 1538 (erc-display-message parsed 'notice proc 's321))
1539 1539
1540(define-erc-response-handler (322) 1540(define-erc-response-handler (322)
1541 "LIST notice." nil 1541 "LIST notice." nil
@@ -1545,7 +1545,7 @@ See `erc-display-server-message'." nil
1545 (add-to-list 'erc-channel-list (list channel)) 1545 (add-to-list 'erc-channel-list (list channel))
1546 (erc-update-channel-topic channel topic) 1546 (erc-update-channel-topic channel topic)
1547 (erc-display-message 1547 (erc-display-message
1548 parsed 'notice 'active 's322 1548 parsed 'notice proc 's322
1549 ?c channel ?u num-users ?t (or topic ""))))) 1549 ?c channel ?u num-users ?t (or topic "")))))
1550 1550
1551(define-erc-response-handler (324) 1551(define-erc-response-handler (324)
diff --git a/lisp/erc/erc-capab.el b/lisp/erc/erc-capab.el
new file mode 100644
index 00000000000..eb907225ae9
--- /dev/null
+++ b/lisp/erc/erc-capab.el
@@ -0,0 +1,202 @@
1;;; erc-capab.el --- support for dancer-ircd and hyperion's CAPAB
2
3;; Copyright (C) 2006 Free Software Foundation, Inc.
4
5;; GNU Emacs is free software; you can redistribute it and/or modify
6;; it under the terms of the GNU General Public License as published by
7;; the Free Software Foundation; either version 2, or (at your option)
8;; any later version.
9
10;; GNU Emacs is distributed in the hope that it will be useful,
11;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13;; GNU General Public License for more details.
14
15;; You should have received a copy of the GNU General Public License
16;; along with GNU Emacs; see the file COPYING. If not, write to the
17;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18;; Boston, MA 02110-1301, USA.
19
20;;; Commentary:
21
22;; This file defines the ERC module `erc-capab-identify', which allows
23;; flagging of unidentified users on servers running dancer-ircd or
24;; hyperion. freenode.net supports this capability, for example.
25
26;; With CAPAB IDENTIFY-MSG and IDENTIFY-CTCP enabled, messages from
27;; users who have identified themselves to NickServ will have a plus
28;; sign and messages from unidentified users will have a minus sign
29;; added as a prefix. Note that it is not necessary for your nickname
30;; to be identified in order to receive these marked messages.
31
32;; The plus or minus sign is removed from the message, and a prefix,
33;; `erc-capab-identify-prefix', is inserted in the front of the user's
34;; nickname if the nickname is not identified.
35
36;; Please note that once this has been enabled on a server, there is no
37;; way to tell the server to stop sending marked messages. If you
38;; disable this module, it will continue removing message flags, but the
39;; unidentified nickname prefix will not be added to messages.
40
41;; Visit <http://freenode.net/faq.shtml#spoofing> and
42;; <http://freenode.net/faq.shtml#registering> to find further
43;; explanations of this capability.
44
45;; From freenode.net's web site (not there anymore) on how to mark
46;; unidentified users:
47;; "We recommend that you add an asterisk before the nick, and
48;; optionally either highlight or colourize the line in some
49;; appropriate fashion, if the user is not identified."
50
51;;; Usage:
52
53;; Put the following in your ~/.emacs file.
54
55;; (require 'erc-capab)
56;; (erc-capab-identify-mode 1)
57
58;; `erc-capab-identify-prefix' will now be added to the beginning of
59;; unidentified users' nicknames. The default is an asterisk, "*". If
60;; the value of this variable is nil or you disable this module (see
61;; `erc-capab-identify-disable'), no prefix will be inserted, but the
62;; flag sent by the server will still be stripped.
63
64;;; Code:
65
66(require 'erc)
67(eval-when-compile (require 'cl))
68
69;;; Customization:
70
71(defgroup erc-capab nil
72 "Support for dancer-ircd's CAPAB settings."
73 :group 'erc)
74
75(defcustom erc-capab-identify-prefix "*"
76 "The prefix used for unidentified users."
77 :group 'erc-capab
78 :type '(choice string (const nil)))
79
80;;; Define module:
81
82(define-erc-response-handler (290)
83 "Handle dancer-ircd CAPAB messages." nil nil)
84
85;;;###autoload (autoload 'erc-capab-identify-mode "erc-capab" nil t)
86(define-erc-module capab-identify nil
87 "Handle dancer-ircd's CAPAB IDENTIFY-MSG and IDENTIFY-CTCP."
88 ;; append so that `erc-server-parameters' is already set by `erc-server-005'
89 ((add-hook 'erc-server-005-functions 'erc-capab-identify-setup t)
90 (add-hook 'erc-server-290-functions 'erc-capab-identify-activate)
91 (add-hook 'erc-server-PRIVMSG-functions
92 'erc-capab-identify-remove/set-identified-flag)
93 (add-hook 'erc-server-NOTICE-functions
94 'erc-capab-identify-remove/set-identified-flag)
95 (add-hook 'erc-insert-modify-hook 'erc-capab-identify-add-prefix t)
96 (mapc (lambda (buffer)
97 (when buffer
98 (with-current-buffer buffer (erc-capab-identify-setup))))
99 (erc-buffer-list 'erc-open-server-buffer-p)))
100 ((remove-hook 'erc-server-005-functions 'erc-capab-identify-setup)
101 (remove-hook 'erc-server-290-functions 'erc-capab-identify-activate)
102 ;; we don't remove the `erc-capab-identify-remove/set-identified-flag' hooks
103 ;; because there doesn't seem to be a way to tell the server to turn it off
104 (remove-hook 'erc-insert-modify-hook 'erc-capab-identify-add-prefix)))
105
106;;; Variables:
107
108(defvar erc-capab-identify-activated nil
109 "CAPAB IDENTIFY-MSG has been activated.")
110(make-variable-buffer-local 'erc-capab-identify-activated)
111
112(defvar erc-capab-identify-sent nil
113 "CAPAB IDENTIFY-MSG and IDENTIFY-CTCP messages have been sent.")
114(make-variable-buffer-local 'erc-capab-identify-sent)
115
116;;; Functions:
117
118(defun erc-capab-identify-setup (&optional proc parsed)
119 "Set up CAPAB IDENTIFY on the current server.
120
121Optional argument PROC is the current server's process.
122Optional argument PARSED is the current message, a response struct.
123
124These arguments are sent to this function when called as a hook in
125`erc-server-005-functions'."
126 (unless erc-capab-identify-sent
127 (erc-capab-send-identify-messages)))
128
129(defun erc-capab-send-identify-messages ()
130 "Send CAPAB IDENTIFY messages if the server supports it."
131 (when (and (stringp erc-server-version)
132 (string-match "^\\(dancer-ircd\\|hyperion\\)" erc-server-version)
133 ;; could possibly check for '("IRCD" . "dancer") in
134 ;; `erc-server-parameters' instead of looking for a specific name
135 ;; in `erc-server-version'
136 (assoc "CAPAB" erc-server-parameters))
137 (erc-log "Sending CAPAB IDENTIFY-MSG and IDENTIFY-CTCP")
138 (erc-server-send "CAPAB IDENTIFY-MSG")
139 (erc-server-send "CAPAB IDENTIFY-CTCP")
140 (setq erc-capab-identify-sent t)))
141
142
143(defun erc-capab-identify-activate (proc parsed)
144 "Set `erc-capab-identify-activated' and display an activation message.
145
146PROC is the current server's process.
147PARSED is an `erc-parsed' response struct."
148 (when (or (string= "IDENTIFY-MSG" (erc-response.contents parsed))
149 (string= "IDENTIFY-CTCP" (erc-response.contents parsed)))
150 (setq erc-capab-identify-activated t)
151 (erc-display-message
152 parsed 'notice 'active (format "%s activated"
153 (erc-response.contents parsed)))))
154
155(defun erc-capab-identify-remove/set-identified-flag (proc parsed)
156 "Remove PARSED message's id flag and add the `erc-identified' text property.
157
158PROC is the current server's process.
159PARSED is an `erc-parsed' response struct."
160 (let ((msg (erc-response.contents parsed)))
161 (when (and erc-capab-identify-activated
162 (string-match "^\\([-\\+]\\)\\(.+\\)$" msg))
163 (setf (erc-response.contents parsed)
164 (if erc-capab-identify-mode
165 (erc-propertize (match-string 2 msg)
166 'erc-identified
167 (if (string= (match-string 1 msg) "+")
168 1
169 0))
170 (match-string 2 msg)))
171 nil)))
172
173(defun erc-capab-identify-add-prefix ()
174 "Add `erc-capab-identify-prefix' to nickname if user is unidentified."
175 (when (and erc-capab-identify-prefix
176 (erc-with-server-buffer erc-capab-identify-activated))
177 (goto-char (or (erc-find-parsed-property) (point-min)))
178 (let ((nickname (erc-capab-get-unidentified-nickname
179 (erc-get-parsed-vector (point)))))
180 (when (and nickname
181 (goto-char (point-min))
182 ;; assuming the first use of `nickname' is the sender's nick
183 (re-search-forward (regexp-quote nickname) nil t))
184 (goto-char (match-beginning 0))
185 (insert (erc-propertize erc-capab-identify-prefix
186 'face (get-char-property (- (point) 1)
187 'face)))))))
188
189(defun erc-capab-get-unidentified-nickname (parsed)
190 "Return the nickname of the user if unidentified.
191PARSED is an `erc-parsed' response struct."
192 (when (and (erc-response-p parsed)
193 (equal 0 (get-text-property 0 'erc-identified
194 (erc-response.contents parsed))))
195 (let ((nickuserhost (erc-get-parsed-vector-nick parsed)))
196 (when nickuserhost
197 (nth 0 (erc-parse-user nickuserhost))))))
198
199(provide 'erc-capab)
200
201;; arch-tag: 27b6d668-7ee5-4e47-b9f0-27d7a4362062
202;;; erc-capab.el ends here
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index eeb3e93801e..9d5a8e938f6 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -863,29 +863,29 @@ buffer, and sends back the replies after each block of data per the DCC
863protocol spec. Well not really. We write back a reply after each read, 863protocol spec. Well not really. We write back a reply after each read,
864rather than every 1024 byte block, but nobody seems to care." 864rather than every 1024 byte block, but nobody seems to care."
865 (with-current-buffer (process-buffer proc) 865 (with-current-buffer (process-buffer proc)
866 (setq buffer-read-only nil) ;; FIXME 866 (let ((inhibit-read-only t))
867 (goto-char (point-max)) 867 (goto-char (point-max))
868 (insert (string-make-unibyte str)) 868 (insert (string-make-unibyte str))
869 869
870 (setq erc-dcc-byte-count (+ (length str) erc-dcc-byte-count)) 870 (setq erc-dcc-byte-count (+ (length str) erc-dcc-byte-count))
871 (erc-assert (= erc-dcc-byte-count (1- (point-max)))) 871 (erc-assert (= erc-dcc-byte-count (1- (point-max))))
872 (and erc-verbose-dcc 872 (and erc-verbose-dcc
873 (erc-display-message 873 (erc-display-message
874 nil 'notice erc-server-process 874 nil 'notice erc-server-process
875 'dcc-get-bytes-received 875 'dcc-get-bytes-received
876 ?f (file-name-nondirectory buffer-file-name) 876 ?f (file-name-nondirectory buffer-file-name)
877 ?b (number-to-string erc-dcc-byte-count))) 877 ?b (number-to-string erc-dcc-byte-count)))
878 (cond 878 (cond
879 ((and (> (plist-get erc-dcc-entry-data :size) 0) 879 ((and (> (plist-get erc-dcc-entry-data :size) 0)
880 (> erc-dcc-byte-count (plist-get erc-dcc-entry-data :size))) 880 (> erc-dcc-byte-count (plist-get erc-dcc-entry-data :size)))
881 (erc-display-message 881 (erc-display-message
882 nil '(error notice) 'active 882 nil '(error notice) 'active
883 'dcc-get-file-too-long 883 'dcc-get-file-too-long
884 ?f (file-name-nondirectory buffer-file-name)) 884 ?f (file-name-nondirectory buffer-file-name))
885 (delete-process proc)) 885 (delete-process proc))
886 (t 886 (t
887 (process-send-string 887 (process-send-string
888 proc (erc-pack-int erc-dcc-byte-count 4)))))) 888 proc (erc-pack-int erc-dcc-byte-count 4)))))))
889 889
890 890
891(defun erc-dcc-get-sentinel (proc event) 891(defun erc-dcc-get-sentinel (proc event)
diff --git a/lisp/erc/erc-menu.el b/lisp/erc/erc-menu.el
index a2dc7a1b2f2..bc6afc9c766 100644
--- a/lisp/erc/erc-menu.el
+++ b/lisp/erc/erc-menu.el
@@ -28,7 +28,7 @@
28 28
29;;; Code: 29;;; Code:
30 30
31;(require 'erc) 31(require 'erc)
32(require 'easymenu) 32(require 'easymenu)
33 33
34(defvar erc-menu-definition 34(defvar erc-menu-definition
@@ -40,41 +40,43 @@
40 (and erc-server-connected (fboundp 'erc-list-channels))] 40 (and erc-server-connected (fboundp 'erc-list-channels))]
41 ["Join channel..." erc-join-channel erc-server-connected] 41 ["Join channel..." erc-join-channel erc-server-connected]
42 ["Start a query..." erc-cmd-QUERY erc-server-connected] 42 ["Start a query..." erc-cmd-QUERY erc-server-connected]
43 "-"
44 ["List users in channel" erc-channel-names erc-channel-users]
45 ["List channel operators" erc-cmd-OPS erc-channel-users]
46 ["Input action..." erc-input-action (erc-default-target)] 43 ["Input action..." erc-input-action (erc-default-target)]
47 ["Set topic..." erc-set-topic
48 (and (and (erc-default-target) (not (erc-query-buffer-p)))
49 (or (not (member "t" erc-channel-modes))
50 (erc-channel-user-op-p (erc-current-nick))))]
51 (list "Channel modes"
52 ["Change mode..." erc-insert-mode-command
53 (erc-channel-user-op-p (erc-current-nick))]
54 ["No external send" (erc-toggle-channel-mode "n")
55 :active (erc-channel-user-op-p (erc-current-nick))
56 :style toggle :selected (member "n" erc-channel-modes)]
57 ["Topic set by channel operator" (erc-toggle-channel-mode "t")
58 :style toggle :selected (member "t" erc-channel-modes)
59 :active (erc-channel-user-op-p (erc-current-nick))]
60 ["Invite only" (erc-toggle-channel-mode "i")
61 :style toggle :selected (member "i" erc-channel-modes)
62 :active (erc-channel-user-op-p (erc-current-nick))]
63 ["Private" (erc-toggle-channel-mode "p")
64 :style toggle :selected (member "p" erc-channel-modes)
65 :active (erc-channel-user-op-p (erc-current-nick))]
66 ["Secret" (erc-toggle-channel-mode "s")
67 :style toggle :selected (member "s" erc-channel-modes)
68 :active (erc-channel-user-op-p (erc-current-nick))]
69 ["Moderated" (erc-toggle-channel-mode "m")
70 :style toggle :selected (member "m" erc-channel-modes)
71 :active (erc-channel-user-op-p (erc-current-nick))]
72 ["Set a limit..." erc-set-channel-limit
73 (erc-channel-user-op-p (erc-current-nick))]
74 ["Set a key..." erc-set-channel-key
75 (erc-channel-user-op-p (erc-current-nick))])
76 ["Leave this channel..." erc-part-from-channel erc-channel-users]
77 "-" 44 "-"
45 (list
46 "Current channel"
47 ["List users in channel" erc-channel-names erc-channel-users]
48 ["List channel operators" erc-cmd-OPS erc-channel-users]
49 ["Set topic..." erc-set-topic
50 (and (and (erc-default-target) (not (erc-query-buffer-p)))
51 (or (not (member "t" erc-channel-modes))
52 (erc-channel-user-op-p (erc-current-nick))))]
53 (list "Channel modes"
54 ["Change mode..." erc-insert-mode-command
55 (erc-channel-user-op-p (erc-current-nick))]
56 ["No external send" (erc-toggle-channel-mode "n")
57 :active (erc-channel-user-op-p (erc-current-nick))
58 :style toggle :selected (member "n" erc-channel-modes)]
59 ["Topic set by channel operator" (erc-toggle-channel-mode "t")
60 :style toggle :selected (member "t" erc-channel-modes)
61 :active (erc-channel-user-op-p (erc-current-nick))]
62 ["Invite only" (erc-toggle-channel-mode "i")
63 :style toggle :selected (member "i" erc-channel-modes)
64 :active (erc-channel-user-op-p (erc-current-nick))]
65 ["Private" (erc-toggle-channel-mode "p")
66 :style toggle :selected (member "p" erc-channel-modes)
67 :active (erc-channel-user-op-p (erc-current-nick))]
68 ["Secret" (erc-toggle-channel-mode "s")
69 :style toggle :selected (member "s" erc-channel-modes)
70 :active (erc-channel-user-op-p (erc-current-nick))]
71 ["Moderated" (erc-toggle-channel-mode "m")
72 :style toggle :selected (member "m" erc-channel-modes)
73 :active (erc-channel-user-op-p (erc-current-nick))]
74 ["Set a limit..." erc-set-channel-limit
75 (erc-channel-user-op-p (erc-current-nick))]
76 ["Set a key..." erc-set-channel-key
77 (erc-channel-user-op-p (erc-current-nick))])
78 ["Leave this channel..." erc-part-from-channel erc-channel-users]
79 "-")
78 (list "Pals, fools and other keywords" 80 (list "Pals, fools and other keywords"
79 ["Add pal..." erc-add-pal] 81 ["Add pal..." erc-add-pal]
80 ["Delete pal..." erc-delete-pal] 82 ["Delete pal..." erc-delete-pal]
@@ -98,16 +100,46 @@
98 ["Show ERC version" erc-version t]) 100 ["Show ERC version" erc-version t])
99 "ERC menu definition.") 101 "ERC menu definition.")
100 102
101;; `erc-mode-map' must be defined before doing this 103(defvar erc-menu-defined nil
102(eval-after-load "erc" 104 "Internal variable used to keep track of whether we've defined the
103 '(progn 105ERC menu yet.")
104 (easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition)
105 (easy-menu-add erc-menu erc-mode-map)
106 106
107 ;; for some reason the menu isn't automatically added to the menu bar 107;;;###autoload (autoload 'erc-menu-mode "erc-menu" nil t)
108 (when (featurep 'xemacs) 108(define-erc-module menu nil
109 (add-hook 'erc-mode-hook 109 "Enable a menu in ERC buffers."
110 (lambda () (easy-menu-add erc-menu erc-mode-map)))))) 110 ((unless erc-menu-defined
111 ;; make sure the menu only gets defined once, since Emacs 22
112 ;; activates it immediately
113 (easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition)
114 (setq erc-menu-defined t))
115 (if (featurep 'xemacs)
116 (progn
117 ;; the menu isn't automatically added to the menu bar in
118 ;; XEmacs
119 (add-hook 'erc-mode-hook 'erc-menu-add)
120 (dolist (buffer (erc-buffer-list))
121 (with-current-buffer buffer (erc-menu-add))))
122 (erc-menu-add)))
123 ((if (featurep 'xemacs)
124 (progn
125 (remove-hook 'erc-mode-hook 'erc-menu-add)
126 (dolist (buffer (erc-buffer-list))
127 (with-current-buffer buffer (erc-menu-remove))))
128 (erc-menu-remove)
129 ;; `easy-menu-remove' is a no-op in Emacs 22
130 (message "You might have to restart Emacs to remove the ERC menu"))))
131
132;; silence byte-compiler warning
133(eval-when-compile
134 (defvar erc-menu nil))
135
136(defun erc-menu-add ()
137 "Add the ERC menu to the current buffer."
138 (easy-menu-add erc-menu erc-mode-map))
139
140(defun erc-menu-remove ()
141 "Remove the ERC menu from the current buffer."
142 (easy-menu-remove erc-menu))
111 143
112(provide 'erc-menu) 144(provide 'erc-menu)
113 145
diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el
index b93317e6124..ce505f599fb 100644
--- a/lisp/erc/erc-services.el
+++ b/lisp/erc/erc-services.el
@@ -77,6 +77,29 @@ This group allows you to set variables to somewhat automate
77communication with those Services." 77communication with those Services."
78 :group 'erc) 78 :group 'erc)
79 79
80(defcustom erc-nickserv-identify-mode 'both
81 "The mode which is used when identifying to Nickserv.
82
83Possible settings are:.
84
85'autodetect - Identify when the real Nickserv sends an identify request.
86'nick-change - Identify when you log in or change your nickname.
87'both - Do the former if the network supports it, otherwise do the
88 latter.
89nil - Disables automatic Nickserv identification.
90
91You can also use M-x erc-nickserv-identify-mode to change modes."
92 :group 'erc-services
93 :type '(choice (const autodetect)
94 (const nick-change)
95 (const both)
96 (const nil))
97 :set (lambda (sym val)
98 (set sym val)
99 ;; avoid recursive load at startup
100 (when (featurep 'erc-services)
101 (erc-nickserv-identify-mode val))))
102
80;;;###autoload (autoload 'erc-services-mode "erc-services" nil t) 103;;;###autoload (autoload 'erc-services-mode "erc-services" nil t)
81(define-erc-module services nickserv 104(define-erc-module services nickserv
82 "This mode automates communication with services." 105 "This mode automates communication with services."
@@ -128,27 +151,6 @@ communication with those Services."
128 (remove-hook 'erc-nick-changed-functions 151 (remove-hook 'erc-nick-changed-functions
129 'erc-nickserv-identify-on-nick-change)))) 152 'erc-nickserv-identify-on-nick-change))))
130 153
131(defcustom erc-nickserv-identify-mode 'both
132 "The mode which is used when identifying to Nickserv.
133
134Possible settings are:.
135
136'autodetect - Identify when the real Nickserv sends an identify request.
137'nick-change - Identify when you change your nickname.
138'both - Do the former if the network supports it, otherwise do the
139 latter.
140nil - Disables automatic Nickserv identification.
141
142You can also use M-x erc-nickserv-identify-mode to change modes."
143 :group 'erc-services
144 :type '(choice (const autodetect)
145 (const nick-change)
146 (const both)
147 (const nil))
148 :set (lambda (sym val)
149 (set sym val)
150 (erc-nickserv-identify-mode val)))
151
152(defcustom erc-prompt-for-nickserv-password t 154(defcustom erc-prompt-for-nickserv-password t
153 "Ask for the password when identifying to NickServ." 155 "Ask for the password when identifying to NickServ."
154 :group 'erc-services 156 :group 'erc-services
@@ -184,7 +186,13 @@ Example of use:
184;; Variables: 186;; Variables:
185 187
186(defcustom erc-nickserv-alist 188(defcustom erc-nickserv-alist
187 '((DALnet 189 '((BitlBee
190 nil
191 nil
192 "&bitlbee"
193 "identify"
194 nil)
195 (DALnet
188 "NickServ!service@dal.net" 196 "NickServ!service@dal.net"
189 "/msg\\s-NickServ@services.dal.net\\s-IDENTIFY\\s-<password>" 197 "/msg\\s-NickServ@services.dal.net\\s-IDENTIFY\\s-<password>"
190 "NickServ@services.dal.net" 198 "NickServ@services.dal.net"
@@ -266,6 +274,24 @@ ANSWER is the command to use for the answer. The default is 'privmsg.
266 (string :tag "Command") 274 (string :tag "Command")
267 (const :tag "No special command necessary" nil))))) 275 (const :tag "No special command necessary" nil)))))
268 276
277(defsubst erc-nickserv-alist-sender (network &optional entry)
278 (nth 1 (or entry (assoc network erc-nickserv-alist))))
279
280(defsubst erc-nickserv-alist-regexp (network &optional entry)
281 (nth 2 (or entry (assoc network erc-nickserv-alist))))
282
283(defsubst erc-nickserv-alist-nickserv (network &optional entry)
284 (nth 3 (or entry (assoc network erc-nickserv-alist))))
285
286(defsubst erc-nickserv-alist-ident-keyword (network &optional entry)
287 (nth 4 (or entry (assoc network erc-nickserv-alist))))
288
289(defsubst erc-nickserv-alist-use-nick-p (network &optional entry)
290 (nth 5 (or entry (assoc network erc-nickserv-alist))))
291
292(defsubst erc-nickserv-alist-ident-command (network &optional entry)
293 (nth 6 (or entry (assoc network erc-nickserv-alist))))
294
269;; Functions: 295;; Functions:
270 296
271(defun erc-nickserv-identify-autodetect (proc parsed) 297(defun erc-nickserv-identify-autodetect (proc parsed)
@@ -277,14 +303,14 @@ password for this nickname, otherwise try to send it automatically."
277 (unless (and (null erc-nickserv-passwords) 303 (unless (and (null erc-nickserv-passwords)
278 (null erc-prompt-for-nickserv-password)) 304 (null erc-prompt-for-nickserv-password))
279 (let* ((network (erc-network)) 305 (let* ((network (erc-network))
280 (nickserv (nth 1 (assoc network erc-nickserv-alist))) 306 (sender (erc-nickserv-alist-sender network))
281 (identify-regex (nth 2 (assoc network erc-nickserv-alist))) 307 (identify-regex (erc-nickserv-alist-regexp network))
282 (sspec (erc-response.sender parsed)) 308 (sspec (erc-response.sender parsed))
283 (nick (car (erc-response.command-args parsed))) 309 (nick (car (erc-response.command-args parsed)))
284 (msg (erc-response.contents parsed))) 310 (msg (erc-response.contents parsed)))
285 ;; continue only if we're sure it's the real nickserv for this network 311 ;; continue only if we're sure it's the real nickserv for this network
286 ;; and it's asked us to identify 312 ;; and it's asked us to identify
287 (when (and nickserv (equal sspec nickserv) 313 (when (and sender (equal sspec sender)
288 (string-match identify-regex msg)) 314 (string-match identify-regex msg))
289 (erc-log "NickServ IDENTIFY request detected") 315 (erc-log "NickServ IDENTIFY request detected")
290 (erc-nickserv-call-identify-function nick) 316 (erc-nickserv-call-identify-function nick)
@@ -295,7 +321,7 @@ password for this nickname, otherwise try to send it automatically."
295 (unless (or (and (null erc-nickserv-passwords) 321 (unless (or (and (null erc-nickserv-passwords)
296 (null erc-prompt-for-nickserv-password)) 322 (null erc-prompt-for-nickserv-password))
297 (and (eq erc-nickserv-identify-mode 'both) 323 (and (eq erc-nickserv-identify-mode 'both)
298 (nth 2 (assoc (erc-network) erc-nickserv-alist)))) 324 (erc-nickserv-alist-regexp (erc-network))))
299 (erc-nickserv-call-identify-function nick))) 325 (erc-nickserv-call-identify-function nick)))
300 326
301(defun erc-nickserv-identify-on-nick-change (nick old-nick) 327(defun erc-nickserv-identify-on-nick-change (nick old-nick)
@@ -303,7 +329,7 @@ password for this nickname, otherwise try to send it automatically."
303 (unless (or (and (null erc-nickserv-passwords) 329 (unless (or (and (null erc-nickserv-passwords)
304 (null erc-prompt-for-nickserv-password)) 330 (null erc-prompt-for-nickserv-password))
305 (and (eq erc-nickserv-identify-mode 'both) 331 (and (eq erc-nickserv-identify-mode 'both)
306 (nth 2 (assoc (erc-network) erc-nickserv-alist)))) 332 (erc-nickserv-alist-regexp (erc-network))))
307 (erc-nickserv-call-identify-function nick))) 333 (erc-nickserv-call-identify-function nick)))
308 334
309(defun erc-nickserv-call-identify-function (nickname) 335(defun erc-nickserv-call-identify-function (nickname)
@@ -333,12 +359,16 @@ When called interactively, read the password using `read-passwd'."
333 (let* ((erc-auto-discard-away nil) 359 (let* ((erc-auto-discard-away nil)
334 (network (erc-network)) 360 (network (erc-network))
335 (nickserv-info (assoc network erc-nickserv-alist)) 361 (nickserv-info (assoc network erc-nickserv-alist))
336 (nickserv (or (nth 3 nickserv-info) "NickServ")) 362 (nickserv (or (erc-nickserv-alist-nickserv nil nickserv-info)
337 (identify-word (or (nth 4 nickserv-info) "IDENTIFY")) 363 "NickServ"))
338 (nick (if (nth 5 nickserv-info) 364 (identify-word (or (erc-nickserv-alist-ident-keyword
365 nil nickserv-info)
366 "IDENTIFY"))
367 (nick (if (erc-nickserv-alist-use-nick-p nil nickserv-info)
339 (concat (erc-current-nick) " ") 368 (concat (erc-current-nick) " ")
340 "")) 369 ""))
341 (msgtype (or (nth 6 nickserv-info) "PRIVMSG"))) 370 (msgtype (or (erc-nickserv-alist-ident-command nil nickserv-info)
371 "PRIVMSG")))
342 (erc-message msgtype 372 (erc-message msgtype
343 (concat nickserv " " identify-word " " nick password))))) 373 (concat nickserv " " identify-word " " nick password)))))
344 374
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index 3c8f93acfc2..f836a783742 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -773,10 +773,6 @@ is in `erc-mode'."
773 str) 773 str)
774 (erc-faces-in str))) 774 (erc-faces-in str)))
775 775
776(defun erc-find-parsed-property ()
777 "Find the next occurrence of the `erc-parsed' text property."
778 (text-property-not-all (point-min) (point-max) 'erc-parsed nil))
779
780;;; Buffer switching 776;;; Buffer switching
781 777
782(defvar erc-track-last-non-erc-buffer nil 778(defvar erc-track-last-non-erc-buffer nil
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 427dd178383..350a77b8210 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1,7 +1,7 @@
1;; erc.el --- An Emacs Internet Relay Chat client 1;; erc.el --- An Emacs Internet Relay Chat client
2 2
3;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4;; 2006 Free Software Foundation, Inc. 4;; 2006, 2007 Free Software Foundation, Inc.
5 5
6;; Author: Alexander L. Belikoff (alexander@belikoff.net) 6;; Author: Alexander L. Belikoff (alexander@belikoff.net)
7;; Contributors: Sergey Berezin (sergey.berezin@cs.cmu.edu), 7;; Contributors: Sergey Berezin (sergey.berezin@cs.cmu.edu),
@@ -74,7 +74,6 @@
74(require 'pp) 74(require 'pp)
75(require 'thingatpt) 75(require 'thingatpt)
76(require 'erc-compat) 76(require 'erc-compat)
77(require 'erc-menu)
78 77
79(defvar erc-official-location 78(defvar erc-official-location
80 "http://emacswiki.org/cgi-bin/wiki/ERC (mailing list: erc-discuss@gnu.org)" 79 "http://emacswiki.org/cgi-bin/wiki/ERC (mailing list: erc-discuss@gnu.org)"
@@ -782,6 +781,13 @@ set if some hacker is trying to flood you away."
782 :group 'erc 781 :group 'erc
783 :type 'string) 782 :type 'string)
784 783
784(defcustom erc-system-name nil
785 "Use this as the name of your system.
786If nil, ERC will call `system-name' to get this information."
787 :group 'erc
788 :type '(choice (const :tag "Default system name" nil)
789 string))
790
785(defcustom erc-ignore-list nil 791(defcustom erc-ignore-list nil
786 "*List of regexps matching user identifiers to ignore. 792 "*List of regexps matching user identifiers to ignore.
787 793
@@ -1764,7 +1770,7 @@ all channel buffers on all servers."
1764 1770
1765(defcustom erc-modules '(netsplit fill button match track completion readonly 1771(defcustom erc-modules '(netsplit fill button match track completion readonly
1766 ring autojoin noncommands irccontrols 1772 ring autojoin noncommands irccontrols
1767 stamp) 1773 stamp menu)
1768 "A list of modules which ERC should enable. 1774 "A list of modules which ERC should enable.
1769If you set the value of this without using `customize' remember to call 1775If you set the value of this without using `customize' remember to call
1770\(erc-update-modules) after you change it. When using `customize', modules 1776\(erc-update-modules) after you change it. When using `customize', modules
@@ -1791,17 +1797,21 @@ removed from the list will be disabled."
1791 (const :tag "Set away status automatically" autoaway) 1797 (const :tag "Set away status automatically" autoaway)
1792 (const :tag "Join channels automatically" autojoin) 1798 (const :tag "Join channels automatically" autojoin)
1793 (const :tag "Buttonize URLs, nicknames, and other text" button) 1799 (const :tag "Buttonize URLs, nicknames, and other text" button)
1800 (const
1801 :tag
1802 "Mark unidentified users on freenode and other servers supporting CAPAB"
1803 capab-identify)
1794 (const :tag "Wrap long lines" fill) 1804 (const :tag "Wrap long lines" fill)
1795 (const :tag "Launch an identd server on port 8113" identd) 1805 (const :tag "Launch an identd server on port 8113" identd)
1796 (const :tag "Highlight or remove IRC control characters" 1806 (const :tag "Highlight or remove IRC control characters"
1797 irccontrols) 1807 irccontrols)
1798 (const :tag "Save buffers in logs" log) 1808 (const :tag "Save buffers in logs" log)
1799 (const :tag "Highlight pals, fools, and other keywords" match) 1809 (const :tag "Highlight pals, fools, and other keywords" match)
1810 (const :tag "Display a menu in ERC buffers" menu)
1800 (const :tag "Detect netsplits" netsplit) 1811 (const :tag "Detect netsplits" netsplit)
1801 (const :tag "Don't display non-IRC commands after evaluation" 1812 (const :tag "Don't display non-IRC commands after evaluation"
1802 noncommands) 1813 noncommands)
1803 (const :tag 1814 (const :tag "Notify when the online status of certain users changes"
1804 "Notify when the online status of certain users changes"
1805 notify) 1815 notify)
1806 (const :tag "Complete nicknames and commands (programmable)" 1816 (const :tag "Complete nicknames and commands (programmable)"
1807 completion) 1817 completion)
@@ -1831,6 +1841,8 @@ removed from the list will be disabled."
1831 (setq req (concat "erc-" (symbol-name mod))) 1841 (setq req (concat "erc-" (symbol-name mod)))
1832 (cond 1842 (cond
1833 ;; yuck. perhaps we should bring the filenames into sync? 1843 ;; yuck. perhaps we should bring the filenames into sync?
1844 ((string= req "erc-capab-identify")
1845 (setq req "erc-capab"))
1834 ((string= req "erc-completion") 1846 ((string= req "erc-completion")
1835 (setq req "erc-pcomplete")) 1847 (setq req "erc-pcomplete"))
1836 ((string= req "erc-pcomplete") 1848 ((string= req "erc-pcomplete")
@@ -1891,6 +1903,7 @@ Returns the buffer for the given server or channel."
1891 (old-buffer (current-buffer)) 1903 (old-buffer (current-buffer))
1892 old-point 1904 old-point
1893 continued-session) 1905 continued-session)
1906 (when connect (run-hook-with-args 'erc-before-connect server port nick))
1894 (erc-update-modules) 1907 (erc-update-modules)
1895 (set-buffer buffer) 1908 (set-buffer buffer)
1896 (setq old-point (point)) 1909 (setq old-point (point))
@@ -2104,8 +2117,6 @@ server and full-name will be set to those values, whereas
2104`erc-compute-port', `erc-compute-nick' and `erc-compute-full-name' will 2117`erc-compute-port', `erc-compute-nick' and `erc-compute-full-name' will
2105be invoked for the values of the other parameters." 2118be invoked for the values of the other parameters."
2106 (interactive (erc-select-read-args)) 2119 (interactive (erc-select-read-args))
2107
2108 (run-hook-with-args 'erc-before-connect server port nick)
2109 (erc-open server port nick full-name t password)) 2120 (erc-open server port nick full-name t password))
2110 2121
2111(defalias 'erc-select 'erc) 2122(defalias 'erc-select 'erc)
@@ -4300,8 +4311,10 @@ See also `erc-display-message'."
4300 nil) 4311 nil)
4301 4312
4302(defun erc-process-away (proc away-p) 4313(defun erc-process-away (proc away-p)
4303 ;; FIXME: This docstring is AWFUL -- Lawrence 2004-01-08 4314 "Toggle the away status of the user depending on the value of AWAY-P.
4304 "Process the user being away, or returning from an away break." 4315
4316If nil, set the user as away.
4317If non-nil, return from being away."
4305 (let ((sessionbuf (process-buffer proc))) 4318 (let ((sessionbuf (process-buffer proc)))
4306 (when sessionbuf 4319 (when sessionbuf
4307 (with-current-buffer sessionbuf 4320 (with-current-buffer sessionbuf
@@ -4881,6 +4894,9 @@ Specifically, return the position of `erc-insert-marker'."
4881 erc-input-marker 4894 erc-input-marker
4882 (erc-end-of-input-line))) 4895 (erc-end-of-input-line)))
4883 4896
4897(defvar erc-command-regexp "^/\\([A-Za-z]+\\)\\(\\s-+.*\\|\\s-*\\)$"
4898 "Regular expression used for matching commands in ERC.")
4899
4884(defun erc-send-input (input) 4900(defun erc-send-input (input)
4885 "Treat INPUT as typed in by the user. It is assumed that the input 4901 "Treat INPUT as typed in by the user. It is assumed that the input
4886and the prompt is already deleted. 4902and the prompt is already deleted.
@@ -4902,7 +4918,7 @@ This returns non-nil only iff we actually send anything."
4902 (run-hook-with-args 'erc-send-pre-hook input) 4918 (run-hook-with-args 'erc-send-pre-hook input)
4903 (when erc-send-this 4919 (when erc-send-this
4904 (if (or (string-match "\n" str) 4920 (if (or (string-match "\n" str)
4905 (not (char-equal (aref str 0) ?/))) 4921 (not (string-match erc-command-regexp str)))
4906 (mapc 4922 (mapc
4907 (lambda (line) 4923 (lambda (line)
4908 (mapc 4924 (mapc
@@ -4967,7 +4983,7 @@ current position."
4967 "Extract command and args from the input LINE. 4983 "Extract command and args from the input LINE.
4968If no command was given, return nil. If command matches, return a 4984If no command was given, return nil. If command matches, return a
4969list of the form: (command args) where both elements are strings." 4985list of the form: (command args) where both elements are strings."
4970 (when (string-match "^/\\([A-Za-z]+\\)\\(\\s-+.*\\|\\s-*\\)$" line) 4986 (when (string-match erc-command-regexp line)
4971 (let* ((cmd (erc-command-symbol (match-string 1 line))) 4987 (let* ((cmd (erc-command-symbol (match-string 1 line)))
4972 ;; note: return is nil, we apply this simply for side effects 4988 ;; note: return is nil, we apply this simply for side effects
4973 (canon-defun (while (and cmd (symbolp (symbol-function cmd))) 4989 (canon-defun (while (and cmd (symbolp (symbol-function cmd)))
@@ -5406,7 +5422,7 @@ user input."
5406 (erc-log (format "login: nick: %s, user: %s %s %s :%s" 5422 (erc-log (format "login: nick: %s, user: %s %s %s :%s"
5407 (erc-current-nick) 5423 (erc-current-nick)
5408 (user-login-name) 5424 (user-login-name)
5409 (system-name) 5425 (or erc-system-name (system-name))
5410 erc-session-server 5426 erc-session-server
5411 erc-session-user-full-name)) 5427 erc-session-user-full-name))
5412 (if erc-session-password 5428 (if erc-session-password
@@ -5655,6 +5671,7 @@ of `mode-line-buffer-identification'.
5655 5671
5656The following characters are replaced: 5672The following characters are replaced:
5657%a: String indicating away status or \"\" if you are not away 5673%a: String indicating away status or \"\" if you are not away
5674%l: The estimated lag time to the server
5658%m: The modes of the channel 5675%m: The modes of the channel
5659%n: The current nick name 5676%n: The current nick name
5660%o: The topic of the channel 5677%o: The topic of the channel
@@ -5666,9 +5683,9 @@ The following characters are replaced:
5666 :group 'erc-mode-line-and-header 5683 :group 'erc-mode-line-and-header
5667 :type 'string) 5684 :type 'string)
5668 5685
5669(defcustom erc-header-line-format "[IRC] %n on %t %m %o" 5686(defcustom erc-header-line-format "%n on %t (%m,%l) %o"
5670 "A string to be formatted and shown in the header-line in `erc-mode'. 5687 "A string to be formatted and shown in the header-line in `erc-mode'.
5671Only used in Emacs 21. 5688Only used starting in Emacs 21.
5672 5689
5673See `erc-mode-line-format' for which characters are can be used." 5690See `erc-mode-line-format' for which characters are can be used."
5674 :group 'erc-mode-line-and-header 5691 :group 'erc-mode-line-and-header
@@ -5758,33 +5775,37 @@ if `erc-away' is non-nil."
5758 ""))) 5775 "")))
5759 5776
5760(defun erc-format-channel-modes () 5777(defun erc-format-channel-modes ()
5761 "Return the current channel's modes and the estimated lag." 5778 "Return the current channel's modes."
5779 (concat (apply 'concat
5780 "+" erc-channel-modes)
5781 (cond ((and erc-channel-user-limit erc-channel-key)
5782 (if erc-show-channel-key-p
5783 (format "lk %.0f %s" erc-channel-user-limit
5784 erc-channel-key)
5785 (format "kl %.0f" erc-channel-user-limit)))
5786 (erc-channel-user-limit
5787 ;; Emacs has no bignums
5788 (format "l %.0f" erc-channel-user-limit))
5789 (erc-channel-key
5790 (if erc-show-channel-key-p
5791 (format "k %s" erc-channel-key)
5792 "k"))
5793 (t nil))))
5794
5795(defun erc-format-lag-time ()
5796 "Return the estimated lag time to server, `erc-server-lag'."
5762 (let ((lag (when (erc-server-buffer-live-p) 5797 (let ((lag (when (erc-server-buffer-live-p)
5763 (with-current-buffer (process-buffer erc-server-process) 5798 (with-current-buffer (process-buffer erc-server-process)
5764 erc-server-lag)))) 5799 erc-server-lag))))
5765 (concat (apply 'concat 5800 (cond (lag (format "lag:%.0f" lag))
5766 "(+" erc-channel-modes) 5801 (t ""))))
5767 (cond ((and erc-channel-user-limit erc-channel-key)
5768 (if erc-show-channel-key-p
5769 (format "lk %.0f %s" erc-channel-user-limit
5770 erc-channel-key)
5771 (format "kl %.0f" erc-channel-user-limit)))
5772 (erc-channel-user-limit
5773 ;; Emacs has no bignums
5774 (format "l %.0f" erc-channel-user-limit))
5775 (erc-channel-key
5776 (if erc-show-channel-key-p
5777 (format "k %s" erc-channel-key)
5778 "k"))
5779 (t ""))
5780 (if lag (format ",lag:%.0f" lag) "")
5781 ")")))
5782 5802
5783(defun erc-update-mode-line-buffer (buffer) 5803(defun erc-update-mode-line-buffer (buffer)
5784 "Update the mode line in a single ERC buffer BUFFER." 5804 "Update the mode line in a single ERC buffer BUFFER."
5785 (with-current-buffer buffer 5805 (with-current-buffer buffer
5786 (let ((spec (format-spec-make 5806 (let ((spec (format-spec-make
5787 ?a (erc-format-away-status) 5807 ?a (erc-format-away-status)
5808 ?l (erc-format-lag-time)
5788 ?m (erc-format-channel-modes) 5809 ?m (erc-format-channel-modes)
5789 ?n (or (erc-current-nick) "") 5810 ?n (or (erc-current-nick) "")
5790 ?o (erc-controls-strip erc-channel-topic) 5811 ?o (erc-controls-strip erc-channel-topic)
@@ -5831,7 +5852,10 @@ if `erc-away' is non-nil."
5831 (erc-propertize header 'help-echo help-echo 5852 (erc-propertize header 'help-echo help-echo
5832 'face face) 5853 'face face)
5833 (erc-propertize header 'help-echo help-echo)))))) 5854 (erc-propertize header 'help-echo help-echo))))))
5834 (t (setq header-line-format header)))))) 5855 (t (setq header-line-format
5856 (if face
5857 (erc-propertize header 'face face)
5858 header)))))))
5835 (if (featurep 'xemacs) 5859 (if (featurep 'xemacs)
5836 (redraw-modeline) 5860 (redraw-modeline)
5837 (force-mode-line-update)))) 5861 (force-mode-line-update))))
@@ -6185,6 +6209,10 @@ This function should be on `erc-kill-channel-hook'."
6185 6209
6186;;; Dealing with `erc-parsed' 6210;;; Dealing with `erc-parsed'
6187 6211
6212(defun erc-find-parsed-property ()
6213 "Find the next occurrence of the `erc-parsed' text property."
6214 (text-property-not-all (point-min) (point-max) 'erc-parsed nil))
6215
6188(defun erc-get-parsed-vector (point) 6216(defun erc-get-parsed-vector (point)
6189 "Return the whole parsed vector on POINT." 6217 "Return the whole parsed vector on POINT."
6190 (get-text-property point 'erc-parsed)) 6218 (get-text-property point 'erc-parsed))
diff --git a/man/ChangeLog b/man/ChangeLog
index 9ab4802b34e..963691b2816 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,7 @@
12007-01-13 Michael Olson <mwolson@gnu.org>
2
3 * erc.texi (Modules): Mention capab-identify module.
4
12007-01-16 Glenn Morris <rgm@gnu.org> 52007-01-16 Glenn Morris <rgm@gnu.org>
2 6
3 * abbrevs.texi (Editing Abbrevs): Describe how to disable a system 7 * abbrevs.texi (Editing Abbrevs): Describe how to disable a system
diff --git a/man/erc.texi b/man/erc.texi
index da18618ecda..1fbad28b321 100644
--- a/man/erc.texi
+++ b/man/erc.texi
@@ -406,6 +406,10 @@ Integrate with the Big Brother Database
406@item button 406@item button
407Buttonize URLs, nicknames, and other text 407Buttonize URLs, nicknames, and other text
408 408
409@cindex modules, capab-identify
410@item capab-identify
411Mark unidentified users on freenode and other servers supporting CAPAB.
412
409@cindex modules, completion 413@cindex modules, completion
410@item pcomplete 414@item pcomplete
411Complete nicknames and commands (programmable) 415Complete nicknames and commands (programmable)